Skip to content

Commit

Permalink
use re noncapture group for multiple match as suggested by Eric
Browse files Browse the repository at this point in the history
  • Loading branch information
gdpak committed Apr 17, 2018
1 parent 5104a0c commit edcef52
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/ansible/modules/network/iosxr/iosxr_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,9 @@ def parse_bandwidth(self, data):
return int(match.group(1))

def parse_duplex(self, data):
match = re.search(r'(\w+) Duplex', data, re.M)
match = re.search(r'(\w+)(?: D|-d)uplex', data, re.M)
if match:
return match.group(1)
else:
alt_match = re.search(r'(\w+)-duplex', data, re.M)
if alt_match:
return alt_match.group(1)

def parse_type(self, data):
match = re.search(r'Hardware is (.+),', data, re.M)
Expand Down

0 comments on commit edcef52

Please sign in to comment.