optimize reserved names warning
This commit is contained in:
parent
b3a57a4014
commit
de16ce42ef
1 changed files with 8 additions and 6 deletions
|
@ -70,9 +70,11 @@ def get_reserved_names(include_private=True):
|
|||
|
||||
def warn_if_reserved(myvars):
|
||||
''' this function warns if any variable passed conflicts with internally reserved names '''
|
||||
reserved = get_reserved_names()
|
||||
for varname in myvars:
|
||||
if varname == 'vars':
|
||||
continue # we add this one internally
|
||||
if varname in reserved:
|
||||
display.warning('Found variable using reserved name: %s' % varname)
|
||||
|
||||
varnames = set(myvars)
|
||||
varnames.discard('vars') # we add this one internally, so safe to ignore
|
||||
for varname in varnames.intersection(_RESERVED_NAMES):
|
||||
display.warning('Found variable using reserved name: %s' % varname)
|
||||
|
||||
|
||||
_RESERVED_NAMES = frozenset(get_reserved_names())
|
||||
|
|
Loading…
Reference in a new issue