diff --git a/roentgen/constructor.py b/roentgen/constructor.py index d114ebf..7700d84 100644 --- a/roentgen/constructor.py +++ b/roentgen/constructor.py @@ -132,7 +132,7 @@ class Constructor: check_level=lambda x: True, mode: str = "normal", seed: str = "", - ): + ) -> None: self.check_level = check_level self.mode: str = mode self.seed: str = seed diff --git a/roentgen/direction.py b/roentgen/direction.py index 0be51b5..3bec4ce 100644 --- a/roentgen/direction.py +++ b/roentgen/direction.py @@ -62,7 +62,7 @@ class Sector: Sector described by two vectors. """ - def __init__(self, text: str, angle: Optional[float] = None): + def __init__(self, text: str, angle: Optional[float] = None) -> None: """ :param text: sector text representation (e.g. "70-210", "N-NW") :param angle: angle in degrees @@ -130,7 +130,7 @@ class DirectionSet: Describes direction, set of directions. """ - def __init__(self, text: str): + def __init__(self, text: str) -> None: """ :param text: direction tag value """ diff --git a/roentgen/drawing.py b/roentgen/drawing.py index e71f282..623f8fb 100644 --- a/roentgen/drawing.py +++ b/roentgen/drawing.py @@ -60,7 +60,7 @@ class Drawing: Image. """ - def __init__(self, file_path: Path, width: int, height: int): + def __init__(self, file_path: Path, width: int, height: int) -> None: self.file_path: Path = file_path self.width: int = width self.height: int = height @@ -89,7 +89,7 @@ class SVGDrawing(Drawing): SVG image. """ - def __init__(self, file_path: Path, width: int, height: int): + def __init__(self, file_path: Path, width: int, height: int) -> None: super().__init__(file_path, width, height) self.image = svgwrite.Drawing(str(file_path), (width, height)) @@ -131,7 +131,7 @@ class PNGDrawing(Drawing): PNG image. """ - def __init__(self, file_path: Path, width: int, height: int): + def __init__(self, file_path: Path, width: int, height: int) -> None: super().__init__(file_path, width, height) self.surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height) self.context = cairo.Context(self.surface) diff --git a/roentgen/figure.py b/roentgen/figure.py index 022b745..8dc4207 100644 --- a/roentgen/figure.py +++ b/roentgen/figure.py @@ -28,7 +28,7 @@ class Figure(Tagged): tags: Dict[str, str], inners: List[List[OSMNode]], outers: List[List[OSMNode]], - ): + ) -> None: super().__init__() self.tags: Dict[str, str] = tags @@ -72,7 +72,7 @@ class Building(Figure): outers: List[List[OSMNode]], flinger: Flinger, scheme: Scheme, - ): + ) -> None: super().__init__(tags, inners, outers) style: Dict[str, Any] = { @@ -192,7 +192,7 @@ class StyledFigure(Figure): inners: List[List[OSMNode]], outers: List[List[OSMNode]], line_style: LineStyle, - ): + ) -> None: super().__init__(tags, inners, outers) self.line_style = line_style @@ -208,7 +208,7 @@ class Road(Figure): inners: List[List[OSMNode]], outers: List[List[OSMNode]], matcher: RoadMatcher, - ): + ) -> None: super().__init__(tags, inners, outers) self.matcher: RoadMatcher = matcher @@ -243,7 +243,7 @@ class Tree(Tagged): def __init__( self, tags: dict[str, str], coordinates: np.array, point: np.array - ): + ) -> None: super().__init__(tags) self.coordinates: np.array = coordinates self.point: np.array = point @@ -269,7 +269,7 @@ class DirectionSector(Tagged): Sector that represents direction. """ - def __init__(self, tags: dict[str, str], point): + def __init__(self, tags: dict[str, str], point) -> None: super().__init__(tags) self.point = point @@ -337,7 +337,7 @@ class Segment: Line segment. """ - def __init__(self, point_1: np.array, point_2: np.array): + def __init__(self, point_1: np.array, point_2: np.array) -> None: self.point_1: np.array = point_1 self.point_2: np.array = point_2 diff --git a/roentgen/flinger.py b/roentgen/flinger.py index e6f709f..208335b 100644 --- a/roentgen/flinger.py +++ b/roentgen/flinger.py @@ -48,7 +48,7 @@ class Flinger: geo_boundaries: MinMax, scale: float = 18, border: np.array = np.array((0, 0)), - ): + ) -> None: """ :param geo_boundaries: minimum and maximum latitude and longitude :param scale: OSM zoom level diff --git a/roentgen/icon.py b/roentgen/icon.py index 6137927..d9dfaaf 100644 --- a/roentgen/icon.py +++ b/roentgen/icon.py @@ -172,7 +172,9 @@ class ShapeExtractor: Shape is a single path with "id" attribute that aligned to 16×16 grid. """ - def __init__(self, svg_file_name: Path, configuration_file_name: Path): + def __init__( + self, svg_file_name: Path, configuration_file_name: Path + ) -> None: """ :param svg_file_name: input SVG file name with icons. File may contain any other irrelevant graphics. diff --git a/roentgen/mapcss.py b/roentgen/mapcss.py index 712b5a9..4bec356 100644 --- a/roentgen/mapcss.py +++ b/roentgen/mapcss.py @@ -77,7 +77,7 @@ class MapCSSWriter: add_icons: bool = True, add_ways: bool = True, add_icons_for_lifecycle: bool = True, - ): + ) -> None: self.add_icons: bool = add_icons self.add_ways: bool = add_ways self.add_icons_for_lifecycle: bool = add_icons_for_lifecycle diff --git a/roentgen/mapper.py b/roentgen/mapper.py index 5c6a995..dc78fc0 100644 --- a/roentgen/mapper.py +++ b/roentgen/mapper.py @@ -37,7 +37,7 @@ class Map: overlap: int = 12, mode: str = "normal", label_mode: str = "main", - ): + ) -> None: self.overlap: int = overlap self.mode: str = mode self.label_mode: str = label_mode diff --git a/roentgen/moire_manager.py b/roentgen/moire_manager.py index f38e5f3..9cbd0b4 100644 --- a/roentgen/moire_manager.py +++ b/roentgen/moire_manager.py @@ -28,7 +28,7 @@ class ArgumentParser(argparse.ArgumentParser): Argument parser that stores arguments and creates help in Moire markup. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: self.arguments: list[dict[str, Any]] = [] super(ArgumentParser, self).__init__(*args, **kwargs) @@ -90,7 +90,7 @@ class TestConfiguration: GitHub Actions test configuration. """ - def __init__(self, test_config: Path): + def __init__(self, test_config: Path) -> None: self.steps: dict[str, Any] = {} with test_config.open() as input_file: @@ -177,7 +177,7 @@ class RoentgenHTML(RoentgenMoire, DefaultHTML): Simple HTML. """ - def __init__(self): + def __init__(self) -> None: self.images: dict = {} def color(self, args: Arguments) -> str: @@ -203,7 +203,7 @@ class RoentgenOSMWiki(RoentgenMoire, DefaultWiki): See https://wiki.openstreetmap.org/wiki/Main_Page """ - def __init__(self): + def __init__(self) -> None: self.images: dict = {} self.extractor: ShapeExtractor = ShapeExtractor( workspace.ICONS_PATH, workspace.ICONS_CONFIG_PATH diff --git a/roentgen/osm_reader.py b/roentgen/osm_reader.py index 8d10904..34354a0 100644 --- a/roentgen/osm_reader.py +++ b/roentgen/osm_reader.py @@ -51,7 +51,7 @@ class Tagged: OpenStreetMap element (node, way or relation) with tags. """ - def __init__(self, tags: dict[str, str] = None): + def __init__(self, tags: dict[str, str] = None) -> None: self.tags: dict[str, str] self.tags = {} if tags is None else tags @@ -104,7 +104,7 @@ class OSMNode(Tagged): See https://wiki.openstreetmap.org/wiki/Node """ - def __init__(self): + def __init__(self) -> None: super().__init__() self.id_: Optional[int] = None @@ -162,7 +162,9 @@ class OSMWay(Tagged): See https://wiki.openstreetmap.org/wiki/Way """ - def __init__(self, id_: int = 0, nodes: Optional[list[OSMNode]] = None): + def __init__( + self, id_: int = 0, nodes: Optional[list[OSMNode]] = None + ) -> None: super().__init__() self.id_: int = id_ @@ -243,7 +245,7 @@ class OSMRelation(Tagged): See https://wiki.openstreetmap.org/wiki/Relation """ - def __init__(self, id_: int = 0): + def __init__(self, id_: int = 0) -> None: super().__init__() self.id_: int = id_ @@ -312,7 +314,7 @@ class OSMData: The whole OpenStreetMap information about nodes, ways, and relations. """ - def __init__(self): + def __init__(self) -> None: self.nodes: dict[int, OSMNode] = {} self.ways: dict[int, OSMWay] = {} self.relations: dict[int, OSMRelation] = {} @@ -356,7 +358,7 @@ class OverpassReader: See https://wiki.openstreetmap.org/wiki/Overpass_API """ - def __init__(self): + def __init__(self) -> None: self.osm_data = OSMData() def parse_json_file(self, file_name: Path) -> OSMData: @@ -400,7 +402,7 @@ class OSMReader: parse_ways: bool = True, parse_relations: bool = True, is_full: bool = False, - ): + ) -> None: """ :param parse_nodes: whether nodes should be parsed :param parse_ways: whether ways should be parsed diff --git a/roentgen/point.py b/roentgen/point.py index 7477fed..ab8402f 100644 --- a/roentgen/point.py +++ b/roentgen/point.py @@ -23,7 +23,7 @@ class Occupied: texts, shapes). """ - def __init__(self, width: int, height: int, overlap: float): + def __init__(self, width: int, height: int, overlap: float) -> None: self.matrix = np.full((int(width), int(height)), False, dtype=bool) self.width: float = width self.height: float = height @@ -64,7 +64,7 @@ class Point(Tagged): priority: float = 0, is_for_node: bool = True, draw_outline: bool = True, - ): + ) -> None: super().__init__() assert point is not None diff --git a/roentgen/road.py b/roentgen/road.py index 28de82f..973c39d 100644 --- a/roentgen/road.py +++ b/roentgen/road.py @@ -50,7 +50,7 @@ class RoadPart: point_2: np.array, lanes: list[Lane], scale: False, - ): + ) -> None: """ :param point_1: start point of the road part :param point_2: end point of the road part @@ -297,7 +297,7 @@ class Intersection: points of the road parts should be the same. """ - def __init__(self, parts: list[RoadPart]): + def __init__(self, parts: list[RoadPart]) -> None: self.parts: list[RoadPart] = sorted(parts, key=lambda x: x.get_angle()) for index in range(len(self.parts)): diff --git a/roentgen/scheme.py b/roentgen/scheme.py index b3c6ec0..73c060b 100644 --- a/roentgen/scheme.py +++ b/roentgen/scheme.py @@ -89,7 +89,7 @@ class Matcher: Tag matching. """ - def __init__(self, structure: dict[str, Any]): + def __init__(self, structure: dict[str, Any]) -> None: self.tags: dict[str, str] = structure["tags"] self.exception: dict[str, str] = {} @@ -159,7 +159,7 @@ class NodeMatcher(Matcher): Tag specification matcher. """ - def __init__(self, structure: dict[str, Any]): + def __init__(self, structure: dict[str, Any]) -> None: # Dictionary with tag keys and values, value lists, or "*" super().__init__(structure) @@ -203,7 +203,7 @@ class WayMatcher(Matcher): Special tag matcher for ways. """ - def __init__(self, structure: dict[str, Any], scheme: "Scheme"): + def __init__(self, structure: dict[str, Any], scheme: "Scheme") -> None: super().__init__(structure) self.style: dict[str, Any] = {"fill": "none"} if "style" in structure: @@ -227,7 +227,7 @@ class RoadMatcher(Matcher): Special tag matcher for highways. """ - def __init__(self, structure: dict[str, Any], scheme: "Scheme"): + def __init__(self, structure: dict[str, Any], scheme: "Scheme") -> None: super().__init__(structure) self.border_color: Color = Color( scheme.get_color(structure["border_color"]) @@ -248,7 +248,7 @@ class Scheme: Specifies map colors and rules to draw icons for OpenStreetMap tags. """ - def __init__(self, file_name: Path): + def __init__(self, file_name: Path) -> None: """ :param file_name: name of the scheme file with tags, colors, and tag key specification diff --git a/roentgen/server.py b/roentgen/server.py index b2bde5f..81b33e3 100644 --- a/roentgen/server.py +++ b/roentgen/server.py @@ -21,7 +21,7 @@ class Handler(BaseHTTPRequestHandler): def __init__( self, request: bytes, client_address: tuple[str, int], server - ): + ) -> None: super().__init__(request, client_address, server) self.cache: Path = Path("cache") self.update_cache: bool = False diff --git a/roentgen/taginfo.py b/roentgen/taginfo.py index 7d36102..1370248 100644 --- a/roentgen/taginfo.py +++ b/roentgen/taginfo.py @@ -25,7 +25,7 @@ class TaginfoProjectFile: JSON structure with OpenStreetMap tag usage. """ - def __init__(self, path: Path, scheme: Scheme): + def __init__(self, path: Path, scheme: Scheme) -> None: self.path: Path = path self.structure = { diff --git a/roentgen/vector.py b/roentgen/vector.py index 3236e3f..d7e5926 100644 --- a/roentgen/vector.py +++ b/roentgen/vector.py @@ -47,7 +47,7 @@ class Line: Infinity line: Ax + By + C = 0. """ - def __init__(self, start: np.array, end: np.array): + def __init__(self, start: np.array, end: np.array) -> None: # if start.near(end): # util.error("cannot create line by one point") self.a: float = start[1] - end[1] diff --git a/roentgen/workspace.py b/roentgen/workspace.py index 3eddece..f4c597e 100644 --- a/roentgen/workspace.py +++ b/roentgen/workspace.py @@ -32,7 +32,7 @@ class Workspace: MAPCSS_ICONS_DIRECTORY_NAME: str = "icons" - def __init__(self, output_path: Path): + def __init__(self, output_path: Path) -> None: self.output_path: Path = output_path check_and_create(output_path)