Skip to content

Commit

Permalink
truncate set repr after 3 paths
Browse files Browse the repository at this point in the history
  • Loading branch information
tclose committed Sep 17, 2024
1 parent c040b82 commit c1c15bc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions fileformats/generic/set.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ class TypedSet(FileSet):

content_types: ty.Tuple[ty.Type[FileSet], ...] = ()

MAX_REPR_PATHS = 3

def __repr__(self) -> str:
paths_repr = (
"'"
+ "', '".join(str(p) for p in sorted(self.fspaths)[: self.MAX_REPR_PATHS])
+ "'"
)
if len(self.fspaths) > self.MAX_REPR_PATHS:
paths_repr += ", ..."

Check warning on line 25 in fileformats/generic/set.py

View check run for this annotation

Codecov / codecov/patch

fileformats/generic/set.py#L25

Added line #L25 was not covered by tests
return f"{self.type_name}({paths_repr})"

@cached_property
def contents(self) -> ty.List[FileSet]:
contnts = []
Expand Down

0 comments on commit c1c15bc

Please sign in to comment.