styleguide | Style guides for Google-originated open-source projects

submited by
Style Pass
2022-01-13 22:30:04

pylint is a tool for finding bugs and style problems in Python source code. It finds problems that are typically caught by a compiler for less dynamic languages like C and C++. Because of the dynamic nature of Python, some warnings may be incorrect; however, spurious warnings should be fairly infrequent.

Suppress warnings if they are inappropriate so that other issues are not hidden. To suppress warnings, you can set a line-level comment:

Unused argument warnings can be suppressed by deleting the variables at the beginning of the function. Always include a comment explaining why you are deleting it. “Unused.” is sufficient. For example:

Other common forms of suppressing this warning include using ‘_’ as the identifier for the unused argument or prefixing the argument name with ‘unused_’, or assigning them to ‘_’. These forms are allowed but no longer encouraged. These break callers that pass arguments by name and do not enforce that the arguments are actually unused.

Use import statements for packages and modules only, not for individual classes or functions. Classes imported from the typing module, typing_extensions module, and redirects from the six.moves module are exempt from this rule.

Leave a Comment