Skip to content
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

Remove some attributes defined outside of __init__() #1694

Merged
merged 1 commit into from
Sep 16, 2023

Conversation

Julian-O
Copy link
Contributor

@Julian-O Julian-O commented Sep 11, 2023

Attributes of a class instance should, where possible, be defined in the __init__() method, for clarity (especially about lifetimes). Pylint has a warning about this, but I can't see one from Flake8.

TargetAndroid has an attribute _serials which is defined (sometimes) outside of __init()__, and its value is checked with hasattr(). Changed it to act like a normal instance attribute, defined in __init__().

Buildozer() goes even further. It monkey-patches two attributes, _build_prepared and _build_done onto its associated target. These attributes have the same lifetime as the Buildozer instance. I removed the monkey-patching, and made them normal instance attributes of Buildozer, defined in __init__().

Copy link
Member

@misl6 misl6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you!

@misl6 misl6 merged commit a289958 into kivy:master Sep 16, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants