Skip to content

Commit

Permalink
fix: replace '==' with 'is' for types comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
marcofavorito committed Jan 7, 2024
1 parent 0481d14 commit c3dcd74
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pylogics/helpers/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class RegexConstrainedString(str):

def __new__(cls, value, *args, **kwargs):
"""Instantiate a new object."""
if type(value) == cls:
if type(value) is cls:
return value
else:
inst = super(RegexConstrainedString, cls).__new__(cls, value)
Expand Down
4 changes: 2 additions & 2 deletions pylogics/syntax/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def __eq__(self, other):
the set of instances of this class
equal between them.
"""
return type(other) == type(self) and self.logic == other.logic
return type(other) is type(self) and self.logic == other.logic

def __invert__(self) -> "Formula":
"""Negate."""
Expand Down Expand Up @@ -337,7 +337,7 @@ def __eq__(self, other):
the set of instances of this class
equal between them.
"""
return type(other) == type(self) and self.logic == other.logic
return type(other) is type(self) and self.logic == other.logic

def __invert__(self) -> "Formula":
"""Negate."""
Expand Down
2 changes: 1 addition & 1 deletion pylogics/syntax/ldl.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def tail_formula(self) -> Formula:
def __eq__(self, other):
"""Test equality."""
return (
type(self) == type(other)
type(self) is type(other)
and self.regular_expression == other.regular_expression
and self.tail_formula == other.tail_formula
)
Expand Down

0 comments on commit c3dcd74

Please sign in to comment.