Fix warnings.

This commit is contained in:
Sergey Vartanov 2021-10-11 01:13:55 +03:00
parent b358e56223
commit 1be9906baf
6 changed files with 13 additions and 11 deletions

View file

@ -32,6 +32,8 @@
<w>rasterize</w>
<w>rasterized</w>
<w>röntgen</w>
<w>subattributes</w>
<w>subelement</w>
<w>subparser</w>
<w>svgwrite</w>
<w>taginfo</w>

View file

@ -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.

View file

@ -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)

View file

@ -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

View file

@ -1,3 +1,6 @@
"""
Check whether `requirements.txt` contains all requirements from `setup.py`.
"""
from map_machine import REQUIREMENTS
from pathlib import Path

View file

@ -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))
)