Constants

This module contains list of white- and black-listed python members.

It contains lists of keywords and built-in functions we discourage to use. It also contains some exceptions that we allow to use in our codebase.

FUNCTIONS_BLACKLIST: typing_extensions.Final = frozenset({'__import__', 'breakpoint', 'compile', 'copyright', 'credits', 'delattr', 'dir', 'eval', 'exec', 'exit', 'globals', 'hasattr', 'help', 'input', 'locals', 'pprint', 'print', 'quit', 'reveal_type', 'staticmethod', 'vars'})

List of functions we forbid to use.

MODULE_METADATA_VARIABLES_BLACKLIST: typing_extensions.Final = frozenset({'__about__', '__all__', '__author__', '__version__'})

List of module metadata we forbid to use.

VARIABLE_NAMES_BLACKLIST: typing_extensions.Final = frozenset({'bar', 'baz', 'content', 'contents', 'data', 'do', 'false', 'file', 'foo', 'handle', 'handler', 'info', 'item', 'items', 'no', 'obj', 'objects', 'objs', 'param', 'parameters', 'params', 'result', 'results', 'some', 'true', 'val', 'vals', 'value', 'values', 'var', 'variable', 'vars'})

List of variable names we forbid to use.

SPECIAL_ARGUMENT_NAMES_WHITELIST: typing_extensions.Final = frozenset({'cls', 'mcs', 'self'})

List of special names that are used only as first argument in methods.

ALL_MAGIC_METHODS: typing_extensions.Final = frozenset({'__abs__', '__add__', '__aenter__', '__aexit__', '__aiter__', '__and__', '__anext__', '__await__', '__bool__', '__bytes__', '__call__', '__ceil__', '__class_getitem__', '__complex__', '__contains__', '__del__', '__delattr__', '__delete__', '__delitem__', '__dir__', '__divmod__', '__enter__', '__eq__', '__exit__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__get__', '__getattr__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__iand__', '__ifloordiv__', '__ilshift__', '__imatmul__', '__imod__', '__imul__', '__index__', '__init__', '__init_subclass__', '__instancecheck__', '__int__', '__invert__', '__ior__', '__ipow__', '__irshift__', '__isub__', '__iter__', '__itruediv__', '__ixor__', '__le__', '__len__', '__length_hint__', '__lshift__', '__lt__', '__matmul__', '__missing__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__repr__', '__reversed__', '__rfloordiv__', '__rlshift__', '__rmatmul__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__set__', '__set_name__', '__setattr__', '__setitem__', '__str__', '__sub__', '__subclasscheck__', '__truediv__', '__trunc__', '__xor__'})

List of all magic methods from the python docs.

MAGIC_METHODS_BLACKLIST: typing_extensions.Final = frozenset({'__del__', '__delattr__', '__delete__', '__delitem__', '__dir__'})

List of magic methods that are forbidden to use.

YIELD_MAGIC_METHODS_BLACKLIST: typing_extensions.Final = frozenset({'__abs__', '__add__', '__aenter__', '__aexit__', '__aiter__', '__and__', '__anext__', '__await__', '__bool__', '__bytes__', '__call__', '__ceil__', '__class_getitem__', '__complex__', '__contains__', '__del__', '__delattr__', '__delete__', '__delitem__', '__dir__', '__divmod__', '__enter__', '__eq__', '__exit__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__get__', '__getattr__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__iand__', '__ifloordiv__', '__ilshift__', '__imatmul__', '__imod__', '__imul__', '__index__', '__init__', '__init_subclass__', '__instancecheck__', '__int__', '__invert__', '__ior__', '__ipow__', '__irshift__', '__isub__', '__itruediv__', '__ixor__', '__le__', '__len__', '__length_hint__', '__lshift__', '__lt__', '__matmul__', '__missing__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__repr__', '__reversed__', '__rfloordiv__', '__rlshift__', '__rmatmul__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__set__', '__set_name__', '__setattr__', '__setitem__', '__str__', '__sub__', '__subclasscheck__', '__truediv__', '__trunc__', '__xor__'})

List of magic methods that are not allowed to be generators.

ASYNC_MAGIC_METHODS_BLACKLIST: typing_extensions.Final = frozenset({'__abs__', '__add__', '__aiter__', '__and__', '__await__', '__bool__', '__bytes__', '__call__', '__ceil__', '__class_getitem__', '__complex__', '__contains__', '__del__', '__delattr__', '__delete__', '__delitem__', '__dir__', '__divmod__', '__enter__', '__eq__', '__exit__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__get__', '__getattr__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__iand__', '__ifloordiv__', '__ilshift__', '__imatmul__', '__imod__', '__imul__', '__index__', '__init__', '__init_subclass__', '__instancecheck__', '__int__', '__invert__', '__ior__', '__ipow__', '__irshift__', '__isub__', '__iter__', '__itruediv__', '__ixor__', '__le__', '__len__', '__length_hint__', '__lshift__', '__lt__', '__matmul__', '__missing__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__repr__', '__reversed__', '__rfloordiv__', '__rlshift__', '__rmatmul__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__set__', '__set_name__', '__setattr__', '__setitem__', '__str__', '__sub__', '__subclasscheck__', '__truediv__', '__trunc__', '__xor__'})

List of magic methods that are not allowed to be async.

ALLOWED_BUILTIN_CLASSES: typing_extensions.Final = frozenset({'object', 'type'})

List of builtin classes that are allowed to subclass.

NESTED_FUNCTIONS_WHITELIST: typing_extensions.Final = frozenset({'decorator', 'factory'})

List of nested functions’ names we allow to use.

FUTURE_IMPORTS_WHITELIST: typing_extensions.Final = frozenset({'annotations', 'generator_stop'})

List of allowed __future__ imports.

MODULE_NAMES_BLACKLIST: typing_extensions.Final = frozenset({'helpers', 'util', 'utilities', 'utils'})

List of blacklisted module names.

MAGIC_MODULE_NAMES_WHITELIST: typing_extensions.Final = frozenset({'__init__', '__main__'})

List of allowed module magic names.

MAGIC_MODULE_NAMES_BLACKLIST: typing_extensions.Final = frozenset({'__dir__', '__getattr__'})

List of bad magic module functions.

MODULE_NAME_PATTERN: typing_extensions.Final = re.compile('^_?_?[a-z][a-z\\d_]*[a-z\\d](__)?$')

Regex pattern to name modules.

MAGIC_NUMBERS_WHITELIST: typing_extensions.Final = frozenset({0, 0.5, 0.1, 1.0, 100, 1024, 1j, 1000, 24, 60})

Common numbers that are allowed to be used without being called “magic”.

MAX_NO_COVER_COMMENTS: typing_extensions.Final = 5

Maximum amount of pragma no-cover comments per module.

MAX_LEN_YIELD_TUPLE: typing_extensions.Final = 5

Maximum length of yield tuple expressions.

MATH_APPROXIMATE_CONSTANTS: typing_extensions.Final = frozenset({2.718281828459045, 3.141592653589793, 6.283185307179586})

Approximate constants which real values should be imported from math module.

VAGUE_IMPORTS_BLACKLIST = frozenset({'dump', 'dump_all', 'dumps', 'load', 'load_all', 'loads', 'parse', 'read', 'safe_dump', 'safe_dump_all', 'safe_load', 'safe_load_all', 'write'})

List of vague method names that may cause confusion if imported as is:

LITERALS_BLACKLIST: typing_extensions.Final = frozenset({'bool', 'bytes', 'complex', 'float', 'int', 'str'})

List of literals without arguments we forbid to use.

TUPLE_ARGUMENTS_METHODS = frozenset({'frozenset'})

List of functions in which arguments must be tuples.