To make your codes more beautiful and more readable, try to use below checker to scan your python codes.
1. mypy
Mypy is an optional static type checker for Python.
from typing import Union, Any, List, Optional, NoReturn, Dict, Tuple, Annotated, AnyStr
def fib(n: int) -> Iterator[int]:
a, b = 0, 1
while a < n:
yield a
a, b = b, a + b
Repo here.
Mypy supports reading configuration settings from a file.
# Global options:
[mypy]
python_version = 3.9
warn_return_any = True
warn_unused_configs = True
# Per-module options:
[mypy-mycode.foo.*]
disallow_untyped_defs = True
[mypy-mycode.bar]
warn_return_any = False
[mypy-somelibrary]
ignore_missing_imports = True
More configs here.
2. pylint
Pylint is a tool that checks for errors in Python code, tries to enforce a coding standard and looks for code smells. The default coding style used by Pylint is close to PEP 8. You can change config file to apply Google Style.
[MASTER]
# Specify a configuration file.
#rcfile=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Files or directories to be skipped. They should be base names, not
# paths.
ignore=CVS
# Pickle collected data for later comparisons.
persistent=yes
pylintrc sample here.
docs here.