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
= frozenset({'help', 'compile', 'exit', 'hasattr', 'staticmethod', 'delattr', 'vars', 'locals', '__import__', 'globals', 'copyright', 'eval', 'credits', 'quit', 'dir', 'input', 'exec'})¶ List of functions we forbid to use.
-
MODULE_METADATA_VARIABLES_BLACKLIST
= frozenset({'__all__', '__author__', '__version__', '__about__'})¶ List of module metadata we forbid to use.
-
VARIABLE_NAMES_BLACKLIST
= frozenset({'content', 'some', 'file', 'vals', 'handler', 'contents', 'no', 'true', 'false', 'var', 'value', 'baz', 'values', 'data', 'vars', 'do', 'handle', 'objects', 'foo', 'bar', 'obj', 'objs', 'results', 'variable', 'val', 'result', 'items', 'item', 'info'})¶ List of variable names we forbid to use.
-
SPECIAL_ARGUMENT_NAMES_WHITELIST
= frozenset({'self', 'mcs', 'cls'})¶ List of special names that are used only as first argument in methods.
-
MAGIC_METHODS_BLACKLIST
= frozenset({'__delitem__', '__delattr__', '__dir__', '__del__', '__delete__'})¶ List of magic methods that are forbidden to use.
-
NESTED_CLASSES_WHITELIST
= frozenset({'Meta', 'Params'})¶ List of nested classes’ names we allow to use.
-
NESTED_FUNCTIONS_WHITELIST
= frozenset({'factory', 'decorator'})¶ List of nested functions’ names we allow to use.
-
FUTURE_IMPORTS_WHITELIST
= frozenset({'generator_stop', 'annotations'})¶ List of allowed
__future__
imports.
-
MODULE_NAMES_BLACKLIST
= frozenset({'util', 'utils', 'helpers', 'utilities'})¶ List of blacklisted module names.
-
MAGIC_MODULE_NAMES_WHITELIST
= frozenset({'__init__', '__main__'})¶ List of allowed module magic names.
-
MODULE_NAME_PATTERN
= re.compile('^_?_?[a-z][a-z\\d_]+[a-z\\d](__)?$')¶ Regex pattern to name modules.
-
MAGIC_NUMBERS_WHITELIST
= frozenset({0.5, 1024, 100, 1000, 24, 60})¶ Common numbers that are allowed to be used without being called “magic”.