-
Notifications
You must be signed in to change notification settings - Fork 2
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
Update to use new attribute API and pyright #57
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #57 +/- ##
==========================================
- Coverage 84.06% 83.94% -0.13%
==========================================
Files 4 4
Lines 295 299 +4
==========================================
+ Hits 248 251 +3
- Misses 47 48 +1 ☔ View full report in Codecov by Sentry. |
|
implement pyright review comments
""" | ||
Handler for FastCS Attribute Creation | ||
|
||
Dataclass that is called using the AttrR, AttrRW function. | ||
Used for dynamically created attributes that are added for additional logic | ||
""" | ||
|
||
async def put(self, _: "EigerController", attr: AttrW, value: Any) -> None: | ||
async def put(self, controller: BaseController, attr: AttrW, value: Any) -> None: | ||
assert isinstance(attr, AttrR) # AttrW does not implement set |
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.
Why is this necessary if attr
is AttrW
?
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.
AttrW doesn't have set so pyright complains if we're trying to call set if we don't verify it's an AttrR (or I guess AttrRW).
if isinstance(value, list) and all( | ||
isinstance(s, str) for s in value | ||
): # error is a list of strings | ||
value = ", ".join(value) |
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.
Formatting it like this might make it look like two messages is actually one, so it is probably clearer to just do str(value)
Or maybe use a different separator, like |
?
I do wonder if this should be implemented in FastCS with String().validate(value)
.
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 have a feeling that in a previous release lists did automatically get cast to strings, though I may be misremembering and that was just in a dev branch I never pushed anywhere.
Closing #50