Skip to content

Enhance documentation and formatting with docstrings and f-strings#7

Open
Diode-exe wants to merge 17 commits into
R0rt1z2:mt8163-checkersfrom
Diode-exe:mt8163-checkers
Open

Enhance documentation and formatting with docstrings and f-strings#7
Diode-exe wants to merge 17 commits into
R0rt1z2:mt8163-checkersfrom
Diode-exe:mt8163-checkers

Conversation

@Diode-exe

@Diode-exe Diode-exe commented Apr 21, 2026

Copy link
Copy Markdown

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:

  • Added descriptive module-level docstrings to modules/common.py, modules/gpt.py, modules/handshake.py, and modules/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:

  • Refactored logging statements in modules/gpt.py and modules/common.py to use f-strings for improved readability and consistency. [1] [2] [3] [4] [5]
  • Updated string formatting in serial_ports() in modules/common.py to use f-strings.

Function and variable naming consistency:

  • Renamed function parameters (e.g., dev to dev_ref, cmd to cmd_ref) for clarity and consistency in modules/handshake.py and modules/handshake2.py. [1] [2]
  • Standardized variable naming in the CLI handling section of modules/handshake2.py.

Error handling improvements:

  • Refined exception handling in parse_gpt() to catch specific exception types and use exception chaining for better debugging.

General code quality:

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.

@Diode-exe

Copy link
Copy Markdown
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

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.

1 participant