Skip to content

Commit

Permalink
Fix SonarCloud bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
mpenning committed Dec 11, 2023
1 parent 1d2fa92 commit 6f820fa
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
- Summary:
- Insert something here

## Version: 0.1.7

- Released: 2023-12-11
- Summary:
- Fix SonarCloud bugs

## Version: 0.1.6

- Released: 2023-12-11
Expand Down
5 changes: 2 additions & 3 deletions ciscoconfparse2/ccp_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,7 @@ def as_diff_dict(self):
#
# Sometimes brace escaping is not required... we need better fencing
# around safe_escape_curly_braces()
if False:
newtext = self.safe_escape_curly_braces(newtext)
newtext = self.safe_escape_curly_braces(newtext)

# Remove all double-spacing, except for the indent spaces...
self.line_id = self.calculate_line_id()
Expand Down Expand Up @@ -1356,7 +1355,7 @@ def re_sub(self, regex, replacergx, re_flags=None):
self.text = text_after_replace


if text_before_replace != text_after_replace:
if self.confobj and text_before_replace != text_after_replace:
# Substitute the modified object back into
# the UserList...
self.confobj[idx] = self
Expand Down
11 changes: 3 additions & 8 deletions ciscoconfparse2/ciscoconfparse2.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,6 @@ def __delitem__(self, ii):
# This method is on ConfigList()
@logger.catch(reraise=True)
def __add__(self, other):
raise NotImplementedError()
if isinstance(other, ConfigList):
return self.__class__(self.data + other._list)
elif isinstance(other, type(self.data)):
Expand All @@ -832,7 +831,6 @@ def __add__(self, other):
# This method is on ConfigList()
@logger.catch(reraise=True)
def __radd__(self, other):
raise NotImplementedError()
if isinstance(other, ConfigList):
return self.__class__(other.data + self.data)
elif isinstance(other, type(self.data)):
Expand All @@ -842,7 +840,6 @@ def __radd__(self, other):
# This method is on ConfigList()
@logger.catch(reraise=True)
def __iadd__(self, other):
raise NotImplementedError()
if isinstance(other, ConfigList):
self.data += other.data
elif isinstance(other, type(self.data)):
Expand All @@ -859,15 +856,13 @@ def __iadd__(self, other):
# This method is on ConfigList()
@logger.catch(reraise=True)
def __mul__(self, val):
raise NotImplementedError()
return self.__class__(self.data * val)

__rmul__ = __mul__

# This method is on ConfigList()
@logger.catch(reraise=True)
def __imul__(self, val):
raise NotImplementedError()
self.data *= val
return self

Expand Down Expand Up @@ -1340,13 +1335,13 @@ def insert(self, ii, val):
if isinstance(val, str):
if self.factory:
obj = config_line_factory(
text=val,
line=val,
syntax=self.syntax,
)

elif self.factory is False:
obj = CFGLINE[self.syntax](
text=val,
line=val,
)

else:
Expand Down Expand Up @@ -3728,7 +3723,7 @@ def decrypt(self, ep=""):
return dp


#@logger.catch(reraise=True)
@logger.catch(reraise=True)
def config_line_factory(all_lines=None, line=None, comment_delimiters=None, syntax="ios", debug=0):
"""A factory method to assign a custom BaseCfgLine() subclass based on `all_lines`, `line`, `comment_delimiters`, and `syntax` parameters."""
# Complicted & Buggy
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ requires-python = ">=3.8.0"

[tool.poetry]
name = "ciscoconfparse2"
version = "0.1.6"
version = "0.1.7"
description = "Parse, Audit, Query, Build, and Modify Cisco IOS-style and JunOS-style configs"
license = "GPL-3.0-only"
authors = [
Expand Down

0 comments on commit 6f820fa

Please sign in to comment.