Skip to content

Commit

Permalink
Merge pull request #56 from DSD-DBS/v3
Browse files Browse the repository at this point in the history
Add deprecation warnings
  • Loading branch information
unexcellent authored Nov 18, 2024
2 parents 8f969f4 + 4c2478e commit 3d8fc22
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
9 changes: 9 additions & 0 deletions raillabel/filter/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions raillabel/load_/loader_classes/loader_understand_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@

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
from ._loader_abc import LoaderABC
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.
Expand Down Expand Up @@ -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)

Expand Down
5 changes: 5 additions & 0 deletions raillabel/stats/generate_timespan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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

Expand Down
5 changes: 5 additions & 0 deletions raillabel/validate/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)

Expand Down

0 comments on commit 3d8fc22

Please sign in to comment.