Skip to content

Commit

Permalink
Fix for pypy not liking to pickle things
Browse files Browse the repository at this point in the history
  • Loading branch information
CalebBell committed Sep 17, 2023
1 parent 8185bdc commit e05e4e2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions thermo/chemical_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ def _missing_properties(self):
missing.append(prop)
return tuple(missing)

@property
def __dict__(self):
def as_dict(self):
new = {}
properties = self.properties
for p in properties:
Expand All @@ -194,7 +193,7 @@ def as_json(self):
>>> constants = ChemicalConstantsPackage(MWs=[18.01528, 106.165], names=['water', 'm-xylene'])
>>> string = json.dumps(constants.as_json())
'''
d = self.__dict__.copy()
d = self.as_dict().copy()
for k in ('PSRK_groups', 'UNIFAC_Dortmund_groups', 'UNIFAC_groups'):
# keys are stored as strings and not ints
d[k] = [{str(k): v for k, v in r.items()} if r is not None else r for r in d[k]]
Expand Down Expand Up @@ -283,8 +282,8 @@ def __add__(self, b):
raise TypeError('Adding to a ChemicalConstantsPackage requires that the other object '
'also be a ChemicalConstantsPackage.')
a = self
a_dict = a.__dict__
b_dict = b.__dict__
a_dict = a.as_dict()
b_dict = b.as_dict()
kwargs = {}
for k in a_dict.keys():
kwargs[k] = a_dict[k] + b_dict[k]
Expand Down

0 comments on commit e05e4e2

Please sign in to comment.