-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement basic save and load functionality #53
Conversation
… cleanup and possibly restructing
Hello @orioncohen! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:
|
You can use |
} | ||
return data | ||
|
||
def as_dict(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems quite indirect -- why not have a to_dict
, from_dict
akin to a __setstate__
, __getstate__
method?
save_json
is also not my favourite method name. to_json
could return a json string perhaps (json.dumps(obj.to_dict())
), which the user could be responsible for writing to a file, or a to/from_file
method could handle that.
With a bunch of common mis-matching APIs already out there (e.g. pandas.to_json
, pandas.read_json
; pydantic's .json()
, .parse_raw
/ .parse_file
) keeping a neat to/from
naming scheme is really valuable.
Description
Addresses issue #52
This PR seeks to implement basic functionality to serialize the key data in a Solution and then reconstitute it as a dict. This allows the main features of a Solution to be saved.
Todos
Notable points that this PR has either accomplished or will accomplish.
Status