Skip to content

Commit

Permalink
Apply pre-commit fix
Browse files Browse the repository at this point in the history
From the artifact of the previous workflow run
  • Loading branch information
geo-ghci-int[bot] committed Dec 2, 2024
1 parent 42395f2 commit 28621e6
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 37 deletions.
63 changes: 42 additions & 21 deletions tilecloud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def consume(
iterator: Iterator[Optional["Tile"]],
n: Optional[int] = None, # pylint: disable=invalid-name
) -> None: # pragma: no cover
"""Advance the iterator n-steps ahead.
"""
Advance the iterator n-steps ahead.
If n is none, consume entirely.
"""
Expand All @@ -45,7 +46,8 @@ class Bounds:
"""Uni-dimensional integer bounds."""

def __init__(self, start: Optional[int] = None, stop: Optional[int] = None) -> None:
"""Construct a :class:`Bounds` object.
"""
Construct a :class:`Bounds` object.
Arguments:
start: Start
Expand All @@ -70,7 +72,8 @@ def __eq__(self, other: object) -> bool:
return [self.start, self.stop] == [other.start, other.stop]

def __contains__(self, key: int) -> bool:
"""Return ``True`` if ``self`` contains ``key``.
"""
Return ``True`` if ``self`` contains ``key``.
Arguments:
key: Key
Expand Down Expand Up @@ -139,7 +142,8 @@ def union(self, other: "Bounds") -> "Bounds":


class BoundingPyramid:
"""The bounding pyramid.
"""
The bounding pyramid.
Used to generate a list of tiles in a pyramid.
"""
Expand Down Expand Up @@ -314,7 +318,8 @@ def __init__(
metadata: Optional[dict[str, str]] = None,
**kwargs: Any,
) -> None:
"""Construct.
"""
Construct.
Arguments:
tilecoord: The tile coordinate
Expand All @@ -335,7 +340,8 @@ def __init__(
setattr(self, key, value)

def __cmp__(self, other: "Tile") -> int:
"""Compare ``self`` to ``other``.
"""
Compare ``self`` to ``other``.
Tile comparison is done by comparing their coordinates.
"""
Expand Down Expand Up @@ -371,7 +377,8 @@ class TileCoord:
"""A tile coordinate."""

def __init__(self, z: int, x: int, y: int, n: int = 1) -> None: # pylint: disable=invalid-name
"""Construct a TileCoord.
"""
Construct a TileCoord.
Attributes:
z: Zoom level
Expand All @@ -386,7 +393,8 @@ def __init__(self, z: int, x: int, y: int, n: int = 1) -> None: # pylint: disab
self.n = n # pylint: disable=invalid-name

def __cmp__(self, other: "TileCoord") -> int:
"""Compare ``self`` to ``other``.
"""
Compare ``self`` to ``other``.
:class:`TileCoord`s are compared in order of their size and ``z``, ``x`` and
``y`` coordinates.
Expand All @@ -404,7 +412,8 @@ def __eq__(self, other: object) -> bool:
return [self.n, self.z, self.x, self.y] == [other.n, other.z, other.x, other.y]

def __hash__(self) -> int:
"""Return a hash value.
"""
Return a hash value.
The hash values are unique for all tiles at a given zoom level, but
tiles from different zoom levels may have equal hash values.
Expand Down Expand Up @@ -504,7 +513,8 @@ class TileLayout:
"""Maps tile coordinates to filenames and vice versa."""

def filename(self, tilecoord: TileCoord, metadata: Optional[Any] = None) -> str:
"""Return the filename for the given tile coordinate.
"""
Return the filename for the given tile coordinate.
Attributes:
tilecoord: Tile coordinate
Expand All @@ -513,7 +523,8 @@ def filename(self, tilecoord: TileCoord, metadata: Optional[Any] = None) -> str:
raise NotImplementedError

def tilecoord(self, filename: str) -> TileCoord:
"""Return the tile coordinate for the given filename.
"""
Return the tile coordinate for the given filename.
Attributes:
filename: Filename
Expand All @@ -531,7 +542,8 @@ def __init__(
content_type: Optional[str] = None,
**kwargs: Any,
) -> None:
"""Construct a :class:`TileStore`.
"""
Construct a :class:`TileStore`.
Attributes:
bounding_pyramid: Bounding pyramid
Expand All @@ -545,7 +557,8 @@ def __init__(
setattr(self, key, value)

def __contains__(self, tile: Tile) -> bool:
"""Return true if this store contains ``tile``.
"""
Return true if this store contains ``tile``.
Attributes:
tile: Tile
Expand All @@ -560,7 +573,8 @@ def __len__(self) -> int:
return reduce(lambda x, _: x + 1, ifilter(None, self.list()), 0)

def delete(self, tiles: Iterable[Tile]) -> Iterator[Tile]:
"""Delete ``tiles`` from the store.
"""
Delete ``tiles`` from the store.
Attributes:
tiles: Input tilestream
Expand All @@ -569,7 +583,8 @@ def delete(self, tiles: Iterable[Tile]) -> Iterator[Tile]:
return map(self.delete_one, ifilter(None, tiles))

def delete_one(self, tile: Tile) -> Tile:
"""Delete ``tile`` and return ``tile``.
"""
Delete ``tile`` and return ``tile``.
Attributes:
tile: Tile
Expand All @@ -578,7 +593,8 @@ def delete_one(self, tile: Tile) -> Tile:
raise NotImplementedError

def get(self, tiles: Iterable[Optional[Tile]]) -> Iterator[Optional[Tile]]:
"""Add data to each of ``tiles``.
"""
Add data to each of ``tiles``.
Attributes:
tiles: Tilestream
Expand All @@ -597,15 +613,17 @@ def get_bounding_pyramid(self) -> BoundingPyramid:
)

def get_cheap_bounding_pyramid(self) -> Optional[BoundingPyramid]:
"""Get a bounding pyramid that is cheap to calculate.
"""
Get a bounding pyramid that is cheap to calculate.
Or ``None`` if it is not possible to calculate
a bounding pyramid cheaply.
"""
return None

def get_one(self, tile: Tile) -> Optional[Tile]:
"""Add data to ``tile``, or return ``None`` if ``tile`` is not in the store.
"""
Add data to ``tile``, or return ``None`` if ``tile`` is not in the store.
Attributes:
tile: Tile
Expand All @@ -620,7 +638,8 @@ def list(self) -> Iterable[Tile]:
yield Tile(tilecoord)

def put(self, tiles: Iterable[Tile]) -> Iterator[Tile]:
"""Store ``tiles`` in the store.
"""
Store ``tiles`` in the store.
Attributes:
tiles: Tilestream
Expand All @@ -629,7 +648,8 @@ def put(self, tiles: Iterable[Tile]) -> Iterator[Tile]:
return map(self.put_one, ifilter(None, tiles))

def put_one(self, tile: Tile) -> Tile:
"""Store ``tile`` in the store.
"""
Store ``tile`` in the store.
Attributes:
tile: Tile
Expand All @@ -639,7 +659,8 @@ def put_one(self, tile: Tile) -> Tile:

@staticmethod
def load(name: str, allows_no_contenttype: bool = False) -> "TileStore": # pragma: no cover
"""Construct a :class:`TileStore` from a name.
"""
Construct a :class:`TileStore` from a name.
Attributes:
name: Name
Expand Down
3 changes: 2 additions & 1 deletion tilecloud/filter/consistenthash.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@


class EveryNth:
"""Create a filter that returns one out of every n tiles. This is done using consistent hashing.
"""
Create a filter that returns one out of every n tiles. This is done using consistent hashing.
The following is used to determine if the tile should be returned::
Expand Down
3 changes: 2 additions & 1 deletion tilecloud/filter/contenttype.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@


class ContentTypeAdder:
"""Create a filter that adds a content type to the tile.
"""
Create a filter that adds a content type to the tile.
content_type:
Force this content type for the tile. Default is ``None``, meaning
Expand Down
9 changes: 6 additions & 3 deletions tilecloud/filter/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ def __call__(self, tile: Optional[Tile]) -> Optional[Tile]:


class MaximumConsecutiveErrors:
"""Create a filter that limit the consecutive errors.
"""
Create a filter that limit the consecutive errors.
Raises a :class:`TooManyErrors` exception when there are ``max_consecutive_errors``
consecutive errors.
Expand All @@ -62,7 +63,8 @@ def __call__(self, tile: Tile) -> Tile:


class MaximumErrorRate:
"""Create a filter that limit the error rate.
"""
Create a filter that limit the error rate.
Raises a :class:`TooManyErrors` exception when the total error rate exceeds ``max_error_rate``.
Expand Down Expand Up @@ -93,7 +95,8 @@ def __call__(self, tile: Tile) -> Tile:


class MaximumErrors:
"""Create a filter that raises a :class:`TooManyErrors` exception when a number of errors is reached.
"""
Create a filter that raises a :class:`TooManyErrors` exception when a number of errors is reached.
max_errors:
The maximum number of errors. Once exceeded a :class:`TooManyErrors`
Expand Down
3 changes: 2 additions & 1 deletion tilecloud/filter/gzip_.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@


class GzipCompressor:
"""Create a filter that compresses a tile with gzip.
"""
Create a filter that compresses a tile with gzip.
compresslevel:
The compression level. Default is 9.
Expand Down
12 changes: 8 additions & 4 deletions tilecloud/filter/image.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module includes filters doing manipulations on the tile image.
"""
Module includes filters doing manipulations on the tile image.
It requires the PIL lib.
"""
Expand All @@ -14,7 +15,8 @@


class ImageFormatConverter:
"""Create a filter that converts a tile into the desired format.
"""
Create a filter that converts a tile into the desired format.
content_type:
The content type representing the format to convert the tile image
Expand All @@ -40,7 +42,8 @@ def __call__(self, tile: Tile) -> Tile:


class MergeFilter:
"""Create a filter that merges the tile with tiles of the same coordinates.
"""
Create a filter that merges the tile with tiles of the same coordinates.
tilestores:
A collection of :class:`TileStore` objects from which tiles to
Expand Down Expand Up @@ -78,7 +81,8 @@ def __call__(self, tile: Tile) -> Tile:


class PILImageFilter:
"""Create a filter to filter the tile image (with the PIL ``filter`` function).
"""
Create a filter to filter the tile image (with the PIL ``filter`` function).
filter:
The filter to pass to the PIL ``filter`` function.
Expand Down
3 changes: 2 additions & 1 deletion tilecloud/filter/inboundingpyramid.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@


class InBoundingPyramid:
"""Create a filter that filters out tiles that are not in the specified bounding pyramid.
"""
Create a filter that filters out tiles that are not in the specified bounding pyramid.
When called the filter returns ``None`` if the tile is not in the bounding pyramid.
Expand Down
3 changes: 2 additions & 1 deletion tilecloud/grid/free.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@


class FreeTileGrid(TileGrid):
"""A free tile grid.
"""
A free tile grid.
There is no correspondence between the tiles of the different zoom levels.
"""
Expand Down
3 changes: 2 additions & 1 deletion tilecloud/grid/quad.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@


class QuadTileGrid(TileGrid):
"""A quad tile grid.
"""
A quad tile grid.
Each tiles aer separate in exactly 4 tiles in the next zoom level.
"""
Expand Down
3 changes: 2 additions & 1 deletion tilecloud/lib/wmts.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ class _Layer(TypedDict):


def _get_capabilities(layers: list[_Layer], tile_matrix_set: _TileMatrixSet, wmts_gettile: str) -> str:
"""Generate the WMTS GetCapabilities XML.
"""
Generate the WMTS GetCapabilities XML.
Layers is an array of dict that contains:
Expand Down
6 changes: 4 additions & 2 deletions tilecloud/store/mapnik_.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@


class MapnikTileStore(TileStore):
"""Tile store that renders tiles with Mapnik.
"""
Tile store that renders tiles with Mapnik.
requires mapnik2: http://pypi.python.org/pypi/mapnik2
"""
Expand All @@ -28,7 +29,8 @@ def __init__(
proj4_literal: Optional[str] = None,
**kwargs: Any,
):
"""Construct a MapnikTileStore.
"""
Construct a MapnikTileStore.
tilegrid: the tilegrid.
mapfile: the file used to render the tiles.
Expand Down

0 comments on commit 28621e6

Please sign in to comment.