makes parsing minimally faster (and also more readable)

This commit is contained in:
Stefan Harmuth 2020-12-08 08:55:18 +01:00
parent 29b0604952
commit 9b0b8eb1f6

View File

@ -21,11 +21,8 @@ def getBagContent(bag_line):
return return_dict return return_dict
for content in contents.split(", "): for content in contents.split(", "):
match_groups = re.match(content_re, content) content_count, content_color = re.match(content_re, content).groups()
if not match_groups: return_dict[color][content_color] = int(content_count)
print("ERROR: content '%s' cannot be matched" % content)
return_dict[color][match_groups.group(2)] = int(match_groups.group(1))
return return_dict return return_dict