Skip to content

Commit

Permalink
Deprecate CiscoRange().insert()
Browse files Browse the repository at this point in the history
  • Loading branch information
mpenning committed Oct 28, 2023
1 parent 24687b3 commit a62e439
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions ciscoconfparse/ccp_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4412,25 +4412,8 @@ def append(self, val, sort=True, ignore_errors=False, debug=False):
@logger.catch(reraise=True)
def insert(self, idx, val, sort=True):
"""CiscoRange().insert() is disabled because it currently generates a stackoverflow. Use CiscoRange().append() instead."""
# This function currently generates a stackoverflow...
raise NotImplementedError()

# Insert at the end of the list with new_last_list_idx = len(self._list)
if val in self._list:
raise DuplicateMember(val)
# WAS DEEPCOPY
new_list = copy.deepcopy(self._list)

#pragma warning disable S2190
new_list = new_list.insert(int(idx), val)
#pragma warning restore S2190
if sort is True:
retval = self.attribute_sort(new_list, attribute="sort_list", reverse=False)
else:
retval = new_list
self._list = retval
return self


# This method is on CiscoRange()
@logger.catch(reraise=True)
Expand Down

0 comments on commit a62e439

Please sign in to comment.