Simplify expand_alphanumeric_pattern

The regex search of the pattern is unneccessary. Instead, we rely on the
new behaviour that terminates early if there are no patterns.
This commit is contained in:
Per von Zweigbergk 2023-09-09 14:21:59 +02:00
parent d40a49e6e3
commit 834d34a01c

View File

@ -94,11 +94,8 @@ def expand_alphanumeric_pattern(string):
return return
parsed_range = parse_alphanumeric_range(pattern) parsed_range = parse_alphanumeric_range(pattern)
for i in parsed_range: for i in parsed_range:
if re.search(ALPHANUMERIC_EXPANSION_PATTERN, remnant):
for string in expand_alphanumeric_pattern(remnant): for string in expand_alphanumeric_pattern(remnant):
yield "{}{}{}".format(lead, i, string) yield f"{lead}{i}{string}"
else:
yield "{}{}{}".format(lead, i, remnant)
def expand_ipaddress_pattern(string, family): def expand_ipaddress_pattern(string, family):