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({'hasattr', 'copyright', 'input', 'credits', 'globals', 'dir', '__import__', 'help', 'vars', 'locals', 'delattr', 'compile', 'staticmethod', 'eval', 'exec', 'quit', 'exit'})¶ List of functions we forbid to use.
-
MODULE_METADATA_VARIABLES_BLACKLIST
= frozenset({'__all__', '__about__', '__author__', '__version__'})¶ List of module metadata we forbid to use.
-
VARIABLE_NAMES_BLACKLIST
= frozenset({'info', 'vars', 'result', 'results', 'val', 'true', 'handler', 'items', 'false', 'foo', 'some', 'var', 'objects', 'bar', 'value', 'item', 'content', 'file', 'no', 'obj', 'handle', 'objs', 'data', 'vals', 'baz', 'values', 'contents'})¶ List of variable names we forbid to use.
-
MAGIC_METHODS_BLACKLIST
= frozenset({'__dir__', '__delattr__', '__delete__', '__del__', '__delitem__'})¶ List of magic methods that are forbidden to use.
-
NESTED_CLASSES_WHITELIST
= frozenset({'Params', 'Meta'})¶ List of nested classes’ names we allow to use.
-
NESTED_FUNCTIONS_WHITELIST
= frozenset({'decorator', 'factory'})¶ 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({'helpers', 'util', 'utils', 'utilities'})¶ 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”.