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
1 changed files with 7 additions and 13 deletions

View File

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