Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
mpenning committed Oct 10, 2023
2 parents 5530a98 + 450d652 commit 876e0de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
3 changes: 1 addition & 2 deletions ciscoconfparse/ccp_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,7 @@ def delete(self, recurse=True):
logger.debug(" Deleting <IOSCfgLine(line # {})>.".format(linenum))
del self.confobj._list[linenum]

# W0212: Access to a protected attribute (i.e. with leading underscore)
self.confobj._reassign_linenums() # noqa: W0212
self.confobj.reassign_linenums()
return True

# On BaseCfgLine()
Expand Down
14 changes: 4 additions & 10 deletions ciscoconfparse/ciscoconfparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2847,8 +2847,6 @@ class ALL
retval.append(obj.re_sub(linespec, replacestr))

if self.factory and atomic:
# self.ConfigObjs._reassign_linenums()
#self.ConfigObjs._bootstrap_from_text()
self.ConfigObjs._list = self.ConfigObjs._bootstrap_obj_init_ng(self.ioscfg)

return retval
Expand Down Expand Up @@ -2937,8 +2935,6 @@ def replace_children(
pass

if self.factory and atomic:
# self.ConfigObjs._reassign_linenums()
#self.ConfigObjs._bootstrap_from_text()
self.ConfigObjs._list = self.ConfigObjs._bootstrap_obj_init_ng(self.ioscfg)
return retval

Expand Down Expand Up @@ -2973,8 +2969,6 @@ def replace_all_children(
pass

if self.factory and atomic:
# self.ConfigObjs._reassign_linenums()
#self.ConfigObjs._bootstrap_from_text()
self.ConfigObjs._list = self.ConfigObjs._bootstrap_obj_init_ng(self.ioscfg)

return retval
Expand Down Expand Up @@ -4844,7 +4838,7 @@ def insert_before(self, exist_val, new_val, atomic=False):

else:
## Just renumber lines...
self._reassign_linenums()
self.reassign_linenums()

# This method is on ConfigList()
@junos_unsupported
Expand Down Expand Up @@ -4956,7 +4950,7 @@ def insert_after(self, exist_val="", new_val="", atomic=False, new_val_indent=-1
self._list = self._bootstrap_obj_init_ng(self.ioscfg)
else:
## Just renumber lines...
self._reassign_linenums()
self.reassign_linenums()

# This method is on ConfigList()
@junos_unsupported
Expand Down Expand Up @@ -4992,7 +4986,7 @@ def insert(self, ii, val):
self._list.insert(ii, obj)

## Just renumber lines...
self._reassign_linenums()
self.reassign_linenums()

# This method is on ConfigList()
def config_hierarchy(self):
Expand Down Expand Up @@ -5372,7 +5366,7 @@ def iter_no_comments(self, begin_index=0):
yield obj

# This method is on ConfigList()
def _reassign_linenums(self):
def reassign_linenums(self):
# Call this after any insertion or deletion
for idx, obj in enumerate(self._list):
obj.linenum = idx
Expand Down

0 comments on commit 876e0de

Please sign in to comment.