-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix most pylint warnings, add main()s
Move all CLI script code under `if __name__ == "__main__"` to separate module-level `main()` methods that serve as the entrypoint. This fixes many invalid-name errors and all redefined-outer-name errors. Sort imports alphabetically, and group them in the order: builtins, 3rd-parties, local stuff. This eliminates import-related warnings. Other minor warnings are dealt with by fixing the code, or disabling the warning if it is a false positive. Notably, refactor warnings (Rxxxx) are not handled. These require considerably more thought to work out. Since VS code doesn't show them as errors, we're in no rush. Unrelated to Pylint warnings: In sample scripts, remove the statements that directly added the project root to sys.path. This was a hack used to make d2txt.py importable in sample scripts. Now that we have `pip install -e .`, there's no need to tamper with sys.path. Note: As of Pylint 2.4.4, it incorrectly believes that all module-level variables are constants, and emits invalid-name on them. This check had to be disabled via comments sprinkled throughout the codebase. Looks like this will be fixed in Pylint 2.5.0, though. It's already been integrated into the main branch: pylint-dev/pylint@3422e4a Also see relevant issues that motivated the change: - pylint-dev/pylint#3111 - pylint-dev/pylint#3132 The latest changelog with the fix mentioned under 2.5.0 changes: https://github.com/PyCQA/pylint/blob/f2f4e6f42416644471ab003d4df7ecf052c3c411/ChangeLog
- Loading branch information
1 parent
a74cc08
commit 26613db
Showing
8 changed files
with
68 additions
and
60 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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