-
Notifications
You must be signed in to change notification settings - Fork 20
Patch: Document metaprogrammed module attributes #19
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
Patch: Document metaprogrammed module attributes #19
Conversation
Expanded documentation to include dynamically-generated module-level attributes that cannot be detected or documented without running the code. Specifically: * adafruit_logging.NOTSET * adafruit_logging.DEBUG * adafruit_logging.INFO * adafruit_logging.WARNING * adafruit_logging.ERROR * adafruit_logging.CRITICAL are all module-level attributes that are generated using this block of metaprogramming (line 65): ``` LEVELS = [ (00, "NOTSET"), (10, "DEBUG"), (20, "INFO"), (30, "WARNING"), (40, "ERROR"), (50, "CRITICAL"), ] for level_value, level_name in LEVELS: globals()[level_name] = level_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.
Thank you for the PR- requesting a few changes.
… type to `Logger.addHandler(..)` docstring, and reverted `level_for(..)` param rename from `level_value` back to `value` as suggested by @brentru
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.
Replied to 2 comments and resolved suggestions by @brentru
Suggestions were to remove PyCharm-specific code inspection comments, add param type to Logger.addHandler(..)
docstring, and revert level_for(..)
param rename from level_value
back to value
@garrettheath4 This is failing on |
# Conflicts: # adafruit_logging/__init__.py
I merged main to this branch and resolved the conflicts. Fixed one other pylint issue resulting from renaming some of the arguments in this PR. Changes look good to me as well. |
Updating https://github.com/adafruit/Adafruit_CircuitPython_Logging to 3.7.3 from 3.7.2: > Merge pull request adafruit/Adafruit_CircuitPython_Logging#19 from garrettheath4/document-dynamic-levels > update rtd py version
Expanded documentation to include dynamically-generated module-level attributes that cannot be detected (by an IDE) or documented (by NumpyDoc) without running the code. Specifically:
adafruit_logging.NOTSET
adafruit_logging.DEBUG
adafruit_logging.INFO
adafruit_logging.WARNING
adafruit_logging.ERROR
adafruit_logging.CRITICAL
are all module-level attributes that are generated using this block of metaprogramming (line 65):