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

docbook.py: It's not about the performance, it's about the style. #570

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

rkopicki
Copy link
Contributor

@rkopicki rkopicki commented Dec 6, 2024

Disclaimer: The proposed modifications do not improve performance or address any issues, but merely make the code more Pythonish and hopefully less prone to errors. The code has been checked to make sure it follows PEP 8 as well as the latest versions of Python 3 and pylint. To preserve the coding style and preferences of the original author, certain pylint warnings and suggestions have been intentionally muted (disabled checks).

  • Removed pass (introduced by Enable use of a symlink to bin/docbook (.py) #505) that is no longer needed since Propagate the Saxon return code to the shell #540 solved the original problem.
  • Removed unnecessary semicolons (W0301 - unnecessary-semicolon).
  • Removed unnecessary C0103 (invalid-name) check already specified at the class level.
  • Removed now optional (since version 2.14) pylint check R0201 (no-self-use).
  • Disabled W1514 (unspecified-encoding) check for open without explicitly specifying an encoding.
  • Disabled C0206 (consider-using-dict-items) check for jar files iteration.
  • Specified exception type OSError for os.makedirs (W0702 - bare-except). In an unlikely event of an illegal path, os.path.isdir might raise ValueError.
  • Changed an f-string that does not use any interpolation variables to a regular string (W1309 - f-string-without-interpolation).
  • Formatted os.path.abspath argument with an f-string to ensure its type.
  • Replaced function call with set literal.
  • Replaced dictionary creation with a dictionary literal.
  • Declared static methods (plain functions) with the @staticmethod decorator.

Removed `pass` (introduced by docbook#505) that is no longer needed since docbook#540 solved the original problem.
Removed unnecessary semicolons (W0301 - unnecessary-semicolon).
Removed unnecessary C0103 (invalid-name) check already specified at the class level.
Removed now optional (since version 2.14) pylint check R0201 (no-self-use).
Disabled W1514 (unspecified-encoding) check for open without explicitly specifying an encoding.
Disabled C0206 (consider-using-dict-items) check for jar files iteration.
Specified exception type `OSError` for `os.makedirs` (W0702 - bare-except). In an unlikely event of an illegal path, `os.path.isdir` might raise `ValueError`.
Changed an f-string that does not use any interpolation variables to a regular string (W1309 - f-string-without-interpolation).
Formatted `os.path.abspath` argument with an f-string to ensure its type.
Declared static methods (plain functions) with the `@staticmethod` decorator.
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