magic comment to remove items from whopairs dictionary

If no more scenarios will be using a macro, you can remove it from the dictionary with "unwho".
This commit is contained in:
Groggy Dice 2013-08-15 00:08:31 -04:00
parent 56be5f2f6b
commit ab18d94117

View file

@ -1317,6 +1317,13 @@ def global_sanity_check(filename, lines):
whopairs.update({mac: fields[1].strip()})
except IndexError:
pass
if 'wmllint: unwho ' in lines[i]:
unmac = lines[i].split("wmllint: unwho ", 1)[1].strip()
try:
del whopairs[string_strip(unmac)]
except KeyError:
print >>sys.stderr, '%s, line %s: magic comment "unwho %s" does not match any current keys: %s' \
% (filename, i+1, unmac, str(whopairs.keys())[1:-1])
if lines[i].lstrip().startswith('{'):
# Recognize macro pairings from "wmllint: who" magic
# comments.