Enhance documentation and formatting with docstrings and f-strings#7
Open
Diode-exe wants to merge 17 commits into
Open
Enhance documentation and formatting with docstrings and f-strings#7Diode-exe wants to merge 17 commits into
Diode-exe wants to merge 17 commits into
Conversation
the latter was to prevent redefining argument from outer scope
also changed cmd to CMD because it's a constant
Author
|
Apologies that I didn't do this in a separate branch, I haven't opened very many PRs. Also, fixed bare URL in README |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request enhances code clarity and maintainability across several modules by adding descriptive docstrings to functions and modules, improving logging with f-strings, and making minor refactorings for consistency and readability. The most significant changes are grouped as follows:
Documentation improvements:
modules/common.py,modules/gpt.py,modules/handshake.py, andmodules/handshake2.py, and added or expanded docstrings for nearly all functions in these files to clarify their purpose and usage. [1] [2] [3] [4]Logging and code style improvements:
modules/gpt.pyandmodules/common.pyto use f-strings for improved readability and consistency. [1] [2] [3] [4] [5]serial_ports()inmodules/common.pyto use f-strings.Function and variable naming consistency:
devtodev_ref,cmdtocmd_ref) for clarity and consistency inmodules/handshake.pyandmodules/handshake2.py. [1] [2]modules/handshake2.py.Error handling improvements:
parse_gpt()to catch specific exception types and use exception chaining for better debugging.General code quality:
Deviceclass inmodules/common.pyto document their behavior and parameters. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]These changes collectively improve code documentation, readability, and maintainability without altering functional behavior.
Why did I do these changes?
Because docstrings are very useful, and using f-strings instead of regular strings with .format() is much easier to manage. Some issues could not be avoided and instead were ignored via .pylintrc. .pylintrc is in the .gitignore, however.