-
Notifications
You must be signed in to change notification settings - Fork 9
add alias for AnyDisplay & convert to ruff #48
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
Conversation
This failed actions because it's not able to run the version of pylint requested under python 3.12 which the workflow is using. Instead of updating pylint, I just swapped this over to use ruff so it matches the libraries. This one isn't in the bundle since it doesn't go on devices and therefore wasn't part of the recent sweep doing these conversions. |
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.
One small change request. Also, not surprising but that's one heck of a linting rule disable list! Is it spread out across files? And is any of it a target for someone to hack away at over time?
circuitpython_typing/displayio.py
Outdated
from epaperdisplay import EPaperDisplay | ||
from framebufferio import FramebufferDisplay | ||
|
||
AnyDisplay: TypeAlias = Union[BusDisplay | EPaperDisplay | FramebufferDisplay] |
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 you mean Union[X, Y, Z]
and not Union[X | Y | Z]
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.
yep, thank you!
@tekktrik I'd say anyone is welcome to work on making changes to reduce the number of disables needed. While doing the pass for conversion to ruff recently I started adding any disable rules that were popping up over and over in code into the main disable list inside the config rather than continuing to have disable comments scattered in the codebase because it seemed easier to maintain over time to me. For some of the "too many ___" rules in particular the targets are a little low IMO, I haven't looked into it to determine if we can raise the limits, but if so I would say it's worth considering that because a lot of our libraries do surpass some of those limits as-is. I did just copy the config from an unrelated library though, and there were a few rules disabled that didn't need to be so I've removed those in the latest commit. |
There is a similar definition used in core docstrings here: https://github.com/adafruit/circuitpython/blob/main/shared-bindings/displayio/__init__.c#L48
This would allow us to easily annotate arguments that can be any kind of display.