This module contains knowledge about the most important types that we use.
There are also different visitor specific types that are defined and use exclusively in that file.
If any of the following statements is true, move the type to this file:
if type is used in multiple files
if type is complex enough it has to be documented
if type is very important for the public API
As you can see in the source code almost everything
is marked as
It means that this value cannot be subclassed or reassigned.
This it only a
mypy feature, it does not affect
We do this, because we value composition over inheritance.
@final decorators help you to define readable and clear APIs
for cases when inheritance is used.
My guide about
@final type in
We use this type to represent all string-like nodes.
In cases we need to work with both import types.
In cases we need to work with both function definitions.
In cases we need to work with all function definitions (including lambdas).
In cases we need to work with both forms of if functions.
In cases we need to work with both sync and async loops.
sync, async, and while.
In case we need to work with any loop
This is how you can define a variable in Python.
All different comprehension types in one place.
In cases we need to work with both sync and async context managers.
When we search for assign elements, we also need typed assign.
In cases we need to work with both access types.
In case we need to handle types that can be chained.
Tuple of AST node types for declarative syntax.
We use this type to work with any text-like values. Related to AnyText.
That’s how we define context of operations.
Flake8 API format to return error messages.
- class ConfigurationOptions(*args, **kwargs)¶
Provides structure for the options we use in our checker and visitors.
Then this protocol is passed to each individual visitor. It uses structural sub-typing, and does not represent any kind of a real class or structure.
@propertydecorator here instead of regular attributes, because we need to explicitly mark these atrtibutes as read-only.
- property min_name_length: int¶
- property i_control_code: bool¶
- property max_name_length: int¶
- property max_noqa_comments: int¶
- property nested_classes_whitelist: Tuple[str, ...]¶
- property forbidden_inline_ignore: Tuple[str, ...]¶
- property allowed_domain_names: Tuple[str, ...]¶
- property forbidden_domain_names: Tuple[str, ...]¶
- property max_arguments: int¶
- property max_local_variables: int¶
- property max_returns: int¶
- property max_expressions: int¶
- property max_module_members: int¶
- property max_methods: int¶
- property max_line_complexity: int¶
- property max_jones_score: int¶
- property max_imports: int¶
- property max_imported_names: int¶
- property max_base_classes: int¶
- property max_decorators: int¶
- property max_string_usages: int¶
- property max_awaits: int¶
- property max_try_body_length: int¶
- property max_module_expressions: int¶
- property max_function_expressions: int¶
- property max_asserts: int¶
- property max_access_level: int¶
- property max_attributes: int¶
- property max_raises: int¶
- property max_cognitive_score: int¶
- property max_cognitive_average: int¶
- property max_call_level: int¶
- property max_annotation_complexity: int¶
- property max_import_from_members: int¶
- property max_tuple_unpack_length: int¶
- property exps_for_one_empty_line: int¶