From 1be9906baf1994822aa7a23e666da8456847e904 Mon Sep 17 00:00:00 2001 From: Sergey Vartanov Date: Mon, 11 Oct 2021 01:13:55 +0300 Subject: [PATCH] Fix warnings. --- data/dictionary.xml | 2 ++ data/githooks/commit-msg | 6 ------ map_machine/mapper.py | 8 ++++---- map_machine/road.py | 1 + tests/test_requirements.py | 3 +++ tests/test_vector.py | 4 +++- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/data/dictionary.xml b/data/dictionary.xml index 2978abf..46012f2 100644 --- a/data/dictionary.xml +++ b/data/dictionary.xml @@ -32,6 +32,8 @@ rasterize rasterized röntgen + subattributes + subelement subparser svgwrite taginfo diff --git a/data/githooks/commit-msg b/data/githooks/commit-msg index 8065e28..94f55b5 100755 --- a/data/githooks/commit-msg +++ b/data/githooks/commit-msg @@ -12,12 +12,6 @@ SHORT_MESSAGE_MAX_LENGTH: int = 50 MESSAGE_MAX_LENGTH: int = 72 -def error(message: str): - """Print error message and return exit code 1.""" - print(f"Error: {message}") - sys.exit(1) - - def check_file(file_name: str) -> Optional[str]: """ Exit program with exit code 1 if commit message does not conform the rules. diff --git a/map_machine/mapper.py b/map_machine/mapper.py index 991d1c4..6b54638 100644 --- a/map_machine/mapper.py +++ b/map_machine/mapper.py @@ -146,14 +146,14 @@ class Map: previous_height = height - def draw_roads(self, roads: Iterator[Road]) -> None: + def draw_simple_roads(self, roads: Iterator[Road]) -> None: """Draw road as simple SVG path.""" nodes: dict[OSMNode, set[RoadPart]] = {} for road in roads: - for index in range(len(road.outers[0]) - 1): - node_1: OSMNode = road.outers[0][index] - node_2: OSMNode = road.outers[0][index + 1] + for index in range(len(road.nodes) - 1): + node_1: OSMNode = road.nodes[index] + node_2: OSMNode = road.nodes[index + 1] point_1: np.ndarray = self.flinger.fling(node_1.coordinates) point_2: np.ndarray = self.flinger.fling(node_2.coordinates) scale: float = self.flinger.get_scale(node_1.coordinates) diff --git a/map_machine/road.py b/map_machine/road.py index 7bbc2a8..fcc6fa9 100644 --- a/map_machine/road.py +++ b/map_machine/road.py @@ -464,6 +464,7 @@ class Road(Tagged): return style def get_filter(self, svg: Drawing, is_border: bool) -> Optional[Filter]: + """Get blurring filter.""" if not USE_BLUR: return None diff --git a/tests/test_requirements.py b/tests/test_requirements.py index 8e1c5df..a2527fa 100644 --- a/tests/test_requirements.py +++ b/tests/test_requirements.py @@ -1,3 +1,6 @@ +""" +Check whether `requirements.txt` contains all requirements from `setup.py`. +""" from map_machine import REQUIREMENTS from pathlib import Path diff --git a/tests/test_vector.py b/tests/test_vector.py index 54548da..0b6a316 100644 --- a/tests/test_vector.py +++ b/tests/test_vector.py @@ -25,4 +25,6 @@ def test_compute_angle() -> None: def test_turn_by_compute_angle() -> None: """Test turing one angle by another.""" - assert np.allclose(turn_by_angle((1, 0), np.pi / 2), np.array((0, 1))) + assert np.allclose( + turn_by_angle(np.array((1, 0)), np.pi / 2), np.array((0, 1)) + )