mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-24 00:15:17 -06:00
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:
parent
d40a49e6e3
commit
834d34a01c
@ -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 f"{lead}{i}{string}"
|
||||||
yield "{}{}{}".format(lead, i, string)
|
|
||||||
else:
|
|
||||||
yield "{}{}{}".format(lead, i, remnant)
|
|
||||||
|
|
||||||
|
|
||||||
def expand_ipaddress_pattern(string, family):
|
def expand_ipaddress_pattern(string, family):
|
||||||
|
Loading…
Reference in New Issue
Block a user