remove FORBIDDEN_NAMES (no more getattr)

This commit is contained in:
Emmanuel Garette 2018-09-11 21:17:28 +02:00
parent f779c8f36d
commit 754d4a6e00

View file

@ -35,9 +35,6 @@ STATIC_TUPLE = frozenset()
submulti = 2 submulti = 2
NAME_REGEXP = re.compile(r'^[a-zA-Z][a-zA-Z\d_-]*$') NAME_REGEXP = re.compile(r'^[a-zA-Z][a-zA-Z\d_-]*$')
FORBIDDEN_NAMES = frozenset(['iter_all', 'iter_group', 'find', 'find_first',
'make_dict', 'read_only',
'read_write', 'getowner', 'set_contexts'])
def valid_name(name): def valid_name(name):
@ -46,7 +43,6 @@ def valid_name(name):
if not isinstance(name, str): if not isinstance(name, str):
return False return False
return re.match(NAME_REGEXP, name) is not None and \ return re.match(NAME_REGEXP, name) is not None and \
name not in FORBIDDEN_NAMES and \
not name.startswith('impl_') and \ not name.startswith('impl_') and \
not name.startswith('cfgimpl_') not name.startswith('cfgimpl_')