Skip to content

Commit

Permalink
Merge pull request #2676 from camptocamp/backport/2673-to-master
Browse files Browse the repository at this point in the history
[Backport master] Add more str and repr methods
  • Loading branch information
sbrunner authored Dec 20, 2024
2 parents d1718f3 + bff3d5e commit 16c28f7
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 16c28f7

Please sign in to comment.