diff --git a/pyproject.toml b/pyproject.toml index d89728e..49e3b29 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,8 @@ dependencies = [ "jsonschema>=4.4.0", "fastjsonschema>=2.16.2", "raillabel>=3.1.0, <4.0.0", - "pyyaml>=6.0.0" + "pyyaml>=6.0.0", + "numpy>=1.24.4", ] [project.urls] diff --git a/raillabel_providerkit/validation/validate_rail_side/validate_rail_side.py b/raillabel_providerkit/validation/validate_rail_side/validate_rail_side.py index e791bd1..d01bd76 100644 --- a/raillabel_providerkit/validation/validate_rail_side/validate_rail_side.py +++ b/raillabel_providerkit/validation/validate_rail_side/validate_rail_side.py @@ -131,14 +131,14 @@ def _count_rails_per_track_in_frame(frame: raillabel.format.Frame) -> dict[str, left_count: int = 0 right_count: int = 0 for poly2d in poly2ds: - match poly2d.attributes["railSide"]: - case "leftRail": - left_count += 1 - case "rightRail": - right_count += 1 - case _: - # NOTE: This is ignored because it is covered by validate_onthology - continue + rail_side = poly2d.attributes["railSide"] + if rail_side == "leftRail": + left_count += 1 + elif rail_side == "rightRail": + right_count += 1 + else: + # NOTE: This is ignored because it is covered by validate_onthology + continue # Store counts of current track counts[object_uid] = (left_count, right_count) diff --git a/tests/test_raillabel_providerkit/_util/test_filters.py b/tests/test_raillabel_providerkit/_util/test_filters.py index b9bc5ab..c6c812b 100644 --- a/tests/test_raillabel_providerkit/_util/test_filters.py +++ b/tests/test_raillabel_providerkit/_util/test_filters.py @@ -1,6 +1,8 @@ # Copyright DB Netz AG and contributors # SPDX-License-Identifier: Apache-2.0 +from __future__ import annotations + import pytest import raillabel