mirror of
https://github.com/enzet/map-machine.git
synced 2025-04-29 10:17:23 +02:00
Fix static analysis warnings.
This commit is contained in:
parent
999c3112bb
commit
d1e48e21df
2 changed files with 14 additions and 8 deletions
|
@ -229,7 +229,9 @@ class Constructor:
|
||||||
|
|
||||||
center_point, _ = line_center(outers[0], self.flinger)
|
center_point, _ = line_center(outers[0], self.flinger)
|
||||||
if self.configuration.is_wireframe():
|
if self.configuration.is_wireframe():
|
||||||
color: Color
|
# Dead code to make insensitive static analysis happy.
|
||||||
|
color: Color = self.scheme.get_default_color()
|
||||||
|
|
||||||
if self.configuration.drawing_mode == DrawingMode.AUTHOR:
|
if self.configuration.drawing_mode == DrawingMode.AUTHOR:
|
||||||
color = get_user_color(
|
color = get_user_color(
|
||||||
line.user if line.user else "", self.configuration.seed
|
line.user if line.user else "", self.configuration.seed
|
||||||
|
@ -409,7 +411,7 @@ class Constructor:
|
||||||
self.construct_line(relation, inners_path, outers_path)
|
self.construct_line(relation, inners_path, outers_path)
|
||||||
|
|
||||||
def construct_nodes(self) -> None:
|
def construct_nodes(self) -> None:
|
||||||
"""Draw nodes."""
|
"""Construct point and add them to the collection."""
|
||||||
logging.info("Constructing nodes...")
|
logging.info("Constructing nodes...")
|
||||||
|
|
||||||
# Sort node vertically (using latitude values) to draw them from top to
|
# Sort node vertically (using latitude values) to draw them from top to
|
||||||
|
@ -422,7 +424,7 @@ class Constructor:
|
||||||
self.construct_node(self.osm_data.nodes[node_id])
|
self.construct_node(self.osm_data.nodes[node_id])
|
||||||
|
|
||||||
def construct_node(self, node: OSMNode) -> None:
|
def construct_node(self, node: OSMNode) -> None:
|
||||||
"""Draw one node."""
|
"""Create new point if needed and add it to the point collection."""
|
||||||
tags: dict[str, str] = node.tags
|
tags: dict[str, str] = node.tags
|
||||||
|
|
||||||
if not tags:
|
if not tags:
|
||||||
|
@ -442,11 +444,14 @@ class Constructor:
|
||||||
DrawingMode.AUTHOR,
|
DrawingMode.AUTHOR,
|
||||||
DrawingMode.TIME,
|
DrawingMode.TIME,
|
||||||
):
|
):
|
||||||
color: Color = self.scheme.get_color("default")
|
# Dead code to make insensitive static analysis happy.
|
||||||
|
color: Color = self.scheme.get_default_color()
|
||||||
|
|
||||||
if self.configuration.drawing_mode == DrawingMode.AUTHOR:
|
if self.configuration.drawing_mode == DrawingMode.AUTHOR:
|
||||||
color = get_user_color(node.user, self.configuration.seed)
|
color = get_user_color(node.user, self.configuration.seed)
|
||||||
if self.configuration.drawing_mode == DrawingMode.TIME:
|
if self.configuration.drawing_mode == DrawingMode.TIME:
|
||||||
color = get_time_color(node.timestamp, self.osm_data.time)
|
color = get_time_color(node.timestamp, self.osm_data.time)
|
||||||
|
|
||||||
dot: Shape = self.extractor.get_shape(DEFAULT_SMALL_SHAPE_ID)
|
dot: Shape = self.extractor.get_shape(DEFAULT_SMALL_SHAPE_ID)
|
||||||
icon_set: IconSet = IconSet(
|
icon_set: IconSet = IconSet(
|
||||||
Icon([ShapeSpecification(dot, color)]),
|
Icon([ShapeSpecification(dot, color)]),
|
||||||
|
@ -470,6 +475,9 @@ class Constructor:
|
||||||
DrawingMode.WHITE,
|
DrawingMode.WHITE,
|
||||||
DrawingMode.BLACK,
|
DrawingMode.BLACK,
|
||||||
):
|
):
|
||||||
|
# Dead code to make insensitive static analysis happy.
|
||||||
|
color: Color = self.scheme.get_default_color()
|
||||||
|
|
||||||
if self.configuration.drawing_mode == DrawingMode.WHITE:
|
if self.configuration.drawing_mode == DrawingMode.WHITE:
|
||||||
color = Color("#CCCCCC")
|
color = Color("#CCCCCC")
|
||||||
if self.configuration.drawing_mode == DrawingMode.BLACK:
|
if self.configuration.drawing_mode == DrawingMode.BLACK:
|
||||||
|
|
|
@ -147,7 +147,7 @@ def test_icon_2_extra() -> None:
|
||||||
|
|
||||||
def test_no_icon_1_extra() -> None:
|
def test_no_icon_1_extra() -> None:
|
||||||
"""
|
"""
|
||||||
Tags that should be visualized with default main icon and single extra icon.
|
Tags that should be visualized without main icon and with single extra icon.
|
||||||
"""
|
"""
|
||||||
check_icon_set(
|
check_icon_set(
|
||||||
{"access": "private"}, [], [[("lock_with_keyhole", EXTRA_COLOR)]]
|
{"access": "private"}, [], [[("lock_with_keyhole", EXTRA_COLOR)]]
|
||||||
|
@ -166,9 +166,7 @@ def test_no_icon_2_extra() -> None:
|
||||||
|
|
||||||
|
|
||||||
def test_icon_regex() -> None:
|
def test_icon_regex() -> None:
|
||||||
"""
|
"""Check that simple regular expressions work properly."""
|
||||||
Tags that should be visualized with default main icon and single extra icon.
|
|
||||||
"""
|
|
||||||
check_icon_set(
|
check_icon_set(
|
||||||
{"traffic_sign": "maxspeed", "maxspeed": "42"},
|
{"traffic_sign": "maxspeed", "maxspeed": "42"},
|
||||||
[("circle_11", DEFAULT_COLOR), ("digit_4", WHITE), ("digit_2", WHITE)],
|
[("circle_11", DEFAULT_COLOR), ("digit_4", WHITE), ("digit_2", WHITE)],
|
||||||
|
|
Loading…
Add table
Reference in a new issue