diff --git a/pyproject.toml b/pyproject.toml index e4b42b5..e38d9a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,8 @@ classifiers = [ ] dependencies = [ "jsonschema>=4.4.0", - "fastjsonschema>=2.16.2" + "fastjsonschema>=2.16.2", + "typing_extensions==4.12.2" ] [project.urls] diff --git a/raillabel/filter/filter.py b/raillabel/filter/filter.py index afa17bf..e3ee76e 100644 --- a/raillabel/filter/filter.py +++ b/raillabel/filter/filter.py @@ -3,11 +3,17 @@ import pickle import typing as t +from warnings import warn + +from typing_extensions import deprecated from .. import format from . import _filter_classes +@deprecated( + "filter() will not be included in any future releases. Use `scene.filter()` in those versions instead" +) def filter(scene: format.Scene, **kwargs) -> format.Scene: """Return a copy of the scene with the annotations filtered. @@ -83,6 +89,9 @@ def filter(scene: format.Scene, **kwargs) -> format.Scene: TypeError if an unexpected keyword argument has been set. """ + warn( + "filter() will not be included in any future releases. Use `scene.filter()` in those versions instead" + ) filters_by_level = _collect_filter_classes(kwargs) filtered_scene, used_sensors, used_objects = _filter_scene(_copy(scene), filters_by_level) diff --git a/raillabel/load_/loader_classes/loader_understand_ai.py b/raillabel/load_/loader_classes/loader_understand_ai.py index d196360..b15d902 100644 --- a/raillabel/load_/loader_classes/loader_understand_ai.py +++ b/raillabel/load_/loader_classes/loader_understand_ai.py @@ -3,6 +3,9 @@ import typing as t from pathlib import Path +from warnings import warn + +from typing_extensions import deprecated from ..._util._warning import _WarningsLogger from ...format import understand_ai as uai_format @@ -10,6 +13,7 @@ from .loader_raillabel import LoaderRailLabel +@deprecated("This class will be moved to `raillabel_providerkit` in all future releases.") class LoaderUnderstandAi(LoaderABC): """Loader class for the Understand.Ai Trains4 annotation format. @@ -49,6 +53,8 @@ def load(self, data: dict, validate: bool = False) -> uai_format.Scene: The loaded scene with the data. """ + warn("This class will be moved to `raillabel_providerkit` in all future releases.") + if validate: self.validate(data) diff --git a/raillabel/stats/generate_timespan.py b/raillabel/stats/generate_timespan.py index 44853d7..5847c31 100644 --- a/raillabel/stats/generate_timespan.py +++ b/raillabel/stats/generate_timespan.py @@ -3,10 +3,14 @@ import typing as t from decimal import Decimal +from warnings import warn + +from typing_extensions import deprecated from ..format import Scene +@deprecated("This function will be removed in all future releases") def generate_timespan(scene: Scene) -> t.Tuple[t.Optional[Decimal], t.Optional[Decimal]]: """Return start and end timestamp of the scene. @@ -22,6 +26,7 @@ def generate_timespan(scene: Scene) -> t.Tuple[t.Optional[Decimal], t.Optional[D decimal.Decimal or None End timestamp of the scene. Is None if the scene has no frames. """ + warn("This function will be removed in all future releases") start_timestamp = None end_timestamp = None diff --git a/raillabel/validate/validate.py b/raillabel/validate/validate.py index 0beab3e..55c01cf 100644 --- a/raillabel/validate/validate.py +++ b/raillabel/validate/validate.py @@ -5,13 +5,16 @@ import os import typing as t from pathlib import Path +from warnings import warn import fastjsonschema import jsonschema +from typing_extensions import deprecated from .. import exceptions +@deprecated("This function will be moved to `raillabel_providerkit` in all future releases.") def validate(data: dict, schema_path: str = "raillabel") -> t.Tuple[bool, t.List[str]]: """Validate JSON data represented by a dict via a given schema. @@ -38,6 +41,8 @@ def validate(data: dict, schema_path: str = "raillabel") -> t.Tuple[bool, t.List # options must be distinguished. It is therefore assumed, that a complete path contains at # # least one '/' or '\'. + warn("This function will be moved to `raillabel_providerkit` in all future releases.") + if "/" in schema_path or "\\" in schema_path: # if schema_path is a complete path schema_path = Path(schema_path)