Skip to content

Commit

Permalink
Rewrite code to work around mypy 1.7 regression.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmeyer committed Nov 11, 2023
1 parent 18e3204 commit 047ac85
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nion/swift/model/Symbolic.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,10 @@ def __init__(self, entity_type: typing.Optional[Schema.EntityType] = None,
self._set_field_value("reference", reference)

def __eq__(self, other: typing.Any) -> bool:
if other and isinstance(other, self.__class__):
return self.write() == other.write()
# written like this to work around regression in mypy 1.7
if other:
if isinstance(other, self.__class__):
return self.write() == other.write()
return False

def __hash__(self) -> typing.Any:
Expand Down

0 comments on commit 047ac85

Please sign in to comment.