From 1ebbc0524ec42211319a9950b0d74dbfa17a6f84 Mon Sep 17 00:00:00 2001 From: Niklas Freund Date: Mon, 2 Dec 2024 13:39:18 +0100 Subject: [PATCH] feat: Add Issue class Co-authored-by: tklockau --- pyproject.toml | 1 + raillabel_providerkit/validation/__init__.py | 3 +- raillabel_providerkit/validation/issue.py | 32 ++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 raillabel_providerkit/validation/issue.py diff --git a/pyproject.toml b/pyproject.toml index 9655646..25d1fcd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,6 +61,7 @@ test = [ [tool.ruff] line-length = 101 +target-version = "py310" [tool.ruff.lint] exclude = ["tests/*", "docs/*"] diff --git a/raillabel_providerkit/validation/__init__.py b/raillabel_providerkit/validation/__init__.py index fd71faf..d33d953 100644 --- a/raillabel_providerkit/validation/__init__.py +++ b/raillabel_providerkit/validation/__init__.py @@ -2,7 +2,8 @@ # SPDX-License-Identifier: Apache-2.0 """Package for validating raillabel data regarding the format requirements.""" +from .issue import Issue, IssueIdentifiers, IssueType from .validate_onthology.validate_onthology import validate_onthology from .validate_schema import validate_schema -__all__ = ["validate_onthology", "validate_schema"] +__all__ = ["Issue", "IssueIdentifiers", "IssueType", "validate_onthology", "validate_schema"] diff --git a/raillabel_providerkit/validation/issue.py b/raillabel_providerkit/validation/issue.py new file mode 100644 index 0000000..5c490fd --- /dev/null +++ b/raillabel_providerkit/validation/issue.py @@ -0,0 +1,32 @@ +# Copyright DB InfraGO AG and contributors +# SPDX-License-Identifier: Apache-2.0 + +from dataclasses import dataclass +from enum import Enum + + +class IssueType(Enum): + """General classification of the issue.""" + + SCHEMA = "SchemaIssue" + EMPTY_FRAMES = "EmptyFramesIssue" + RAIL_SIDE = "RailSide" + + +@dataclass +class IssueIdentifiers: + """Information for locating an issue.""" + + annotation: str | None = None + frame: str | None = None + object: str | None = None + sensor: str | None = None + + +@dataclass +class Issue: + """An error that was found inside the scene.""" + + type: IssueType + reason: str + identifiers: IssueIdentifiers