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:

python_version = 3.9
warn_return_any = True
warn_unused_configs = True

# Per-module options:

disallow_untyped_defs = True

warn_return_any = False

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.


# Specify a configuration file.

# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().

# Files or directories to be skipped. They should be base names, not
# paths.

# Pickle collected data for later comparisons.

pylintrc sample here.

docs here.