-
Notifications
You must be signed in to change notification settings - Fork 52
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
TangoShutter: refactor (changes from https://github.com/mxcube/mxcubecore/pull/847/) #1158
TangoShutter: refactor (changes from https://github.com/mxcube/mxcubecore/pull/847/) #1158
Conversation
Originally added in github.com/mxcube/pull/847
113fe3a
to
26e1677
Compare
26e1677
to
acb0962
Compare
The ruff config had to be adjusted to ignore the rule saying that methods have to start with lowercase letter - as there is a mocked Tango Device.
acb0962
to
afb38fe
Compare
self.config_values = None | ||
|
||
def _update_value(self, value): | ||
def _update_value(self, value: DevState) -> None: |
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.
Are you sure the value is DevState type. I believe this is the output of the DevState command, which is a str.
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.
When I checked the type of value there during runtime I got a DevState
type.
I believe that the state_channel
could be set to return a string (with TangoChannel.read_as_str
set to True
).
I think setting it as DevState | str
is a safe choice then :)
Nice with the test |
I recommend you check how the docstrings are rendered: |
Oh yes, the documentation looks a bit strange. |
Thanks, alot. I think its really worth taking a look at how the documentation is rendered, there seems to be a tag missing or something similar. |
Added code-block to improve documentation.
Also changed type hint for `TangoShutter._update_value`. The value could possibly be a string (i.e. using `TangoChannel` with `read_as_str` set to True).
167fd15
to
51a65d0
Compare
Thanks @beteva for fixing the xml code rendering in the docs! :) I also pushed some changes, information about return rendered wrongly, when there was no space between docstring summary and |
Co-authored-by: fabcor <[email protected]>
c9f788b
to
79a42b6
Compare
The exceptions for capital case functions (Tango commands) are moved to the functions that offend them instead of creating an exception for the whole file.
Adds code changes from PR #847
And a test case for the TangoShutter Hardware Object.
At MAXIV we use these changes for quite a long time, but it has not been merged in the original for some reason (which is rather unclear looking at the PR's discussion).
The difference between the version at #847 and this PR is addition of type annotations and adoption of new linting rules.