-
Notifications
You must be signed in to change notification settings - Fork 38
Label base class #126
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
Label base class #126
Conversation
I think this is ready to go now. If anyone has a moment to check this out, it would be most appreciated. If we get this merged I think it will allow actions to pass on some of the other pending PRs so we can get those finished up. |
@FoamyGuy thanks for making this code more modular between the two types with the new LabelBase class. As for the code, this may be a stylistic question, but I'm curious to understand how you chose to extract the arguments from the To me, it's easier to understand which variables the For example, the This isn't anything that's a show stopper, but maybe will make it easier to clarify which variables are used in which classes/subclasses. As for sphinx docs, I think putting the doc strings in both is just fine for now. Main question is whether they get out of sync in the future with changes. But keeping the doc strings in the subclass (that most people will use) will probably make life easier so folks don't have to traipse through the superclasses. I explored some of dealing with inheritance with Sphinx but I haven't yet been able to get it as clean as I wanted, so I think your choice on Docs here is a good one. I did a few random checks of the setters (both |
@kmatch98 Thanks for having a look! My main motivation with the In the original actions failure from the issue it flagged this chunk of code for the duplication:
I do think the code would be overall more clear if they were listed in the base class instead of using the kwargs "lookup". But I'm not sure of a way to include them while minding the duplicate check. |
Seems lame for pylint to complain about but so it goes... |
I agree, in this case I wish it was just a touch smarter about finding duplicates. It does seem to ignore some things since the docstrings currently exist in both and don't get flagged, I wish it would allow arguments similarly. A few other options possibly worth consideration:
These were the only other ideas I had, but I think the drawbacks outweigh both of them personally. |
I tested this with some code, and it seems ok, if any glitches we could fix them after. Thanks @FoamyGuy for all this work, |
Thank you @kmatch98 and @jposada202020 for looking into this and testing the changes. We can see if there is any further feedback tomorrow. I'll come back tomorrow night to merge this if there is nothing further. Once this is merged it will unlock a few of the other PRs. |
@FoamyGuy Thank you for working on this. That would be great :). I did more testing as I was also testing the new "directional" label with this Refactor library. works good |
Updating https://github.com/adafruit/Adafruit_CircuitPython_Fingerprint to 2.2.0 from 2.1.4: > Merge pull request adafruit/Adafruit_CircuitPython_Fingerprint#28 from admiralmaggie/master Updating https://github.com/adafruit/Adafruit_CircuitPython_GPS to 3.8.0 from 3.7.1: > Merge pull request adafruit/Adafruit_CircuitPython_GPS#57 from lesamouraipourpre/bad-sentences Updating https://github.com/adafruit/Adafruit_CircuitPython_HT16K33 to 4.1.5 from 4.1.4: > Merge pull request adafruit/Adafruit_CircuitPython_HT16K33#86 from SAK917/master Updating https://github.com/adafruit/Adafruit_CircuitPython_IS31FL3731 to 3.0.1 from 3.0.0: > Merge pull request adafruit/Adafruit_CircuitPython_IS31FL3731#39 from dglaude/patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_MONSTERM4SK to 0.1.2 from 0.1.1: > Merge pull request adafruit/Adafruit_CircuitPython_MONSTERM4SK#6 from FoamyGuy/pylintrc_update > Removed pylint process from github workflow Updating https://github.com/adafruit/Adafruit_CircuitPython_AirLift to 1.0.1 from 1.0.0: > Merge pull request adafruit/Adafruit_CircuitPython_AirLift#2 from FoamyGuy/pylintrc > Set correct black and reuse versions > Removed pylint process from github workflow > Hardcoded black version Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Text to 2.15.4 from 2.15.1: > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#132 from jposada202020/tab_replacement > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#130 from kmatch98/master > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#126 from FoamyGuy/label_base_class Updating https://github.com/adafruit/Adafruit_CircuitPython_PIOASM to 0.2.2 from 0.2.1: > Merge pull request adafruit/Adafruit_CircuitPython_PIOASM#9 from tannewt/audiobusio_examples > Merge pull request adafruit/Adafruit_CircuitPython_PIOASM#13 from FoamyGuy/pylintrc Updating https://github.com/adafruit/Adafruit_CircuitPython_Pixel_Framebuf to 1.1.2 from 1.1.1: > Merge pull request adafruit/Adafruit_CircuitPython_Pixel_Framebuf#4 from FoamyGuy/main > Hardcoded black version
Resolves #125
LabelBase class has been introduced inside of init.py and bitmap_label and label now extend LabelBase which removes all of the duplicated code from them.
I've tested successfully on Blinka_Displayio, PyPortal, and MagTag. This is a relatively large refactor though, happy to get any additional testing from other folks.
One thing I was unsure about was the sphinx docstrings. I think we want to make sure all of the relevant parameters will be visible in the subclass docs pages. I don't know if we should have the parameters documented in just the base, or just the sub-classes, or both. Currently it's in both.
One other thing that needs finished up still is fixing up some old now irrelevant comments.