Skip to content

Commit

Permalink
add version to deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasNeugebauer committed Jan 20, 2025
1 parent 776b9a3 commit 3a91cc4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions rosys/helpers/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
from functools import wraps


def deprecated_param(param_name: str) -> Callable:
def deprecated_param(param_name: str, *, remove_in_version: str | None = None) -> Callable:
"""Mark a function parameter as deprecated."""
def decorator(func: Callable) -> Callable:
@wraps(func)
def wrapper(*args, **kwargs):
if param_name in kwargs:
warnings.warn(
f'The parameter "{param_name}" is deprecated and will be removed in future versions.',
f'The parameter "{param_name}" is deprecated and will be removed in {remove_in_version if remove_in_version else "future versions"}.',
category=DeprecationWarning,
stacklevel=2,
)
Expand Down
2 changes: 1 addition & 1 deletion rosys/vision/rtsp_camera/rtsp_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class RtspCamera(ConfigurableCamera, TransformableCamera):

@deprecated_param('jovision_profile')
@deprecated_param('jovision_profile', remove_in_version='0.27.0')
def __init__(self,
*,
id: str, # pylint: disable=redefined-builtin
Expand Down
2 changes: 1 addition & 1 deletion rosys/vision/rtsp_camera/rtsp_camera_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class RtspCameraProvider(CameraProvider[RtspCamera], persistence.PersistentModul
"""This module collects and provides real RTSP streaming cameras."""
SCAN_INTERVAL = 10

@deprecated_param('jovision_profile')
@deprecated_param('jovision_profile', remove_in_version='0.27.0')
def __init__(self, *,
frame_rate: int = 6,
substream: int = 0,
Expand Down

0 comments on commit 3a91cc4

Please sign in to comment.