Skip to content

Commit

Permalink
mypy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
richardjgowers committed Apr 4, 2022
1 parent e426ac3 commit 3754cc8
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions gufe/solventcomponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,13 @@ def total_charge(self):
"""Solvents don't have a formal charge defined so this returns None"""
return None

def __eq__(self, other: SolventComponent):
try:
return (self.smiles == other.smiles and
self.positive_ion == other.positive_ion and
self.negative_ion == other.negative_ion and
self.ion_concentration == other.ion_concentration)
except AttributeError:
return False
def __eq__(self, other):
if not isinstance(other, SolventComponent):
return NotImplemented
return (self.smiles == other.smiles and
self.positive_ion == other.positive_ion and
self.negative_ion == other.negative_ion and
self.ion_concentration == other.ion_concentration)

def __hash__(self):
return hash((self.smiles, self.positive_ion, self.negative_ion,
Expand Down

0 comments on commit 3754cc8

Please sign in to comment.