Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bentole committed Mar 15, 2023
1 parent d9d54a6 commit 8e9e8c0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions plugins/cliconf/ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,13 @@ def get_diff(
% (diff_replace, ", ".join(option_values["diff_replace"])),
)

<<<<<<< Updated upstream
cand_pattern = r"(?P<parent>^\w.*\n?)(?P<child>(?:\s+.*\n?)*)"
=======
cand_pattern = r'(?P<parent>^\w.*\n?)(?P<child>(?:\s+.*\n?)*)'
# remove blank lines
candidate = re.sub('\n\n', '\n', candidate)
>>>>>>> Stashed changes
candidates = re.findall(cand_pattern, candidate, re.M)

diff["config_diff"] = ""
Expand Down Expand Up @@ -271,8 +277,14 @@ def get_diff(
negates = ""
negated_parents = []
for line in have_lines:
<<<<<<< Updated upstream
if not line in want_lines:
negates += "".join(f"{i}\n" for i in line.parents if not i in negates)
=======
if line not in want_lines:
negates += ''.join(f'{i}\n' for i in line.parents
if i not in negates and i not in negated_parents)
>>>>>>> Stashed changes

if line.has_children:
negated_parents.append(line.text)
Expand All @@ -284,9 +296,16 @@ def get_diff(

wants = ""
for line in want_lines:
<<<<<<< Updated upstream
if not line in have_lines:
wants += "".join(f"{i}\n" for i in line.parents if not i in wants)
wants += f"{line}\n"
=======
if line not in have_lines:
wants += ''.join(f'{i}\n' for i in line.parents
if i not in wants)
wants += f'{line}\n'
>>>>>>> Stashed changes

diff["config_diff"] += wants

Expand Down

0 comments on commit 8e9e8c0

Please sign in to comment.