Address TODO in acl normalization script

Minor refactoring to simplify the code.

Change-Id: I9467865bdf1950c1f35c5c3bd0361c6ae8466397
This commit is contained in:
Brian Rosmaita 2023-11-30 11:43:50 -05:00
parent 7c915d64ce
commit 154f0b2c3a

View File

@ -115,19 +115,13 @@ except IndexError:
print(USAGE_STRING) print(USAGE_STRING)
sys.exit(1) sys.exit(1)
# TODO(rosmaita): refactor this, there's nothing in the 'try' transformations = sys.argv[3:]
# that will raise a KeyError, and in any case, an out-of-range slice if transformations:
# reference already returns an empty list RANGE_END = LAST_TRANSFORMATION + 1
try: if transformations[0] == 'all':
transformations = sys.argv[3:] transformations = [str(x) for x in range(0, RANGE_END)]
if transformations: elif transformations[0] == 'apply':
RANGE_END = LAST_TRANSFORMATION + 1 transformations = [str(x) for x in range(1, RANGE_END)]
if transformations[0] == 'all':
transformations = [str(x) for x in range(0, RANGE_END)]
elif transformations[0] == 'apply':
transformations = [str(x) for x in range(1, RANGE_END)]
except KeyError:
transformations = []
def tokens(data): def tokens(data):