-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dahua profile setting #246
Conversation
feat: use substream parameter for dahua cameras
I would like to rename the Suggestion:
|
refactor: deprecate jovision_profile
Opinions on the deprecation? |
I expected the decorator to hide type information of decorated functions. But as far as I can tell it seems to work. Mypy and pylint are happy too. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will be removed in future versions
How do we want to keep track of deprecations? Keep them for x versions, for an amount of time or just until we feel like removing it?
Versions would be easiest to keep track of but is very arbitrary since we have neither a release schedule nor major versions. I guess something like 5 versions ahead would still make sense though? |
I'd suggest to tag deprecated code with |
since this is always automatically called by the system
I added the version to the decorator and a comment where it is not used |
@NiklasNeugebauer What do you think about a decorator not just for parameters but also for functions and classes? |
rosys/helpers/deprecation.py
Outdated
def wrapper(*args, **kwargs): | ||
if param_name in kwargs: | ||
warnings.warn( | ||
f'The parameter "{param_name}" is deprecated and will be removed in {"Rosys " + remove_in_version if remove_in_version else "a future version"}.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will look funny if remove_in_version
is None
:
"...and will be removed in Rosys a future version."
By the way, it's "RoSys" with an uppercase "S".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yes, that should have parentheses. Good catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I'm wrong. if
has higher precedence, so it should already work correctly.
I had the same thought but was too lazy. I'll add one for functions. |
And I found another bug, the parameter code is really too complicated for this... |
@@ -73,7 +84,7 @@ async def connect(self) -> None: | |||
return | |||
|
|||
self.device = RtspDevice(mac=self.id, ip=self.ip, | |||
jovision_profile=self.parameters['jovision_profile'], | |||
substream=self.parameters['jovision_profile'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it correct to access self.parameters['jovision_profile']
?
feat: use substream parameter for dahua cameras
DEPRECATION: rename jovision_profile to substream in
RtspCamera
andRtspCameraProvider