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.
-
BAD_FUNCTIONS
= frozenset({'locals', 'delattr', 'dir', 'input', 'eval', 'help', 'globals', '__import__', 'vars', 'copyright', 'staticmethod', 'compile', 'hasattr', 'exec'})¶ List of functions we forbid to use.
-
BAD_MODULE_METADATA_VARIABLES
= frozenset({'__author__', '__all__', '__about__', '__version__'})¶ List of module metadata we forbid to use.
-
BAD_VARIABLE_NAMES
= frozenset({'info', 'false', 'items', 'vars', 'objs', 'async', 'foo', 'results', 'await', 'contents', 'true', 'no', 'values', 'bar', 'baz', 'data', 'val', 'objects', 'vals', 'obj', 'handle', 'item', 'file', 'var', 'result', 'some', 'handler', 'value', 'content'})¶ List of variable names we forbid to use.
-
BAD_MAGIC_METHODS
= frozenset({'__delete__', '__delitem__', '__dir__', '__del__', '__delattr__'})¶ List of magic methods that are forbiden to use.
-
NESTED_CLASSES_WHITELIST
= frozenset({'Params', 'Meta'})¶ 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.
-
BAD_MODULE_NAMES
= frozenset({'util', 'utilities', 'helpers', 'utils'})¶ List of blacklisted module names:
-
MAGIC_MODULE_NAMES_WHITELIST
= frozenset({'__main__', '__init__'})¶ 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”: