Skip to content

Commit

Permalink
Add more str and repr methods
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Dec 20, 2024
1 parent d1718f3 commit bff3d5e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
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

0 comments on commit bff3d5e

Please sign in to comment.