Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more str and repr methods #2673

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tilecloud_chain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1475,6 +1475,12 @@ def __call__(self, tile: Tile | None = None) -> Tile | None:
self.nb += 1
return tile

def __str__(self) -> str:
return f"Count: {self.nb}"

def __repr__(self) -> str:
return f"Count: {self.nb}"


class CountSize:
"""Count the number of generated tile and measure the total generated size."""
Expand All @@ -1492,6 +1498,12 @@ def __call__(self, tile: Tile | None = None) -> Tile | None:
self.size += len(tile.data)
return tile

def __str__(self) -> str:
return f"CountSize: {self.nb} {self.size}"

def __repr__(self) -> str:
return f"CountSize: {self.nb} {self.size}"


class HashDropper:
"""
Expand Down
6 changes: 6 additions & 0 deletions tilecloud_chain/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ def __call__(self, tile: Tile) -> Tile:

return tile

def __str__(self) -> str:
return self.__class__.__name__

def __repr__(self) -> str:
return self.__str__()


class Generate:
"""Generate the tiles, generate the queue, ..."""
Expand Down
Loading