Skip to content
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

PseudoPotentialData: add the get_or_create classmethod #33

Merged
merged 1 commit into from
Dec 8, 2020

Conversation

sphuber
Copy link
Contributor

@sphuber sphuber commented Dec 7, 2020

Fixes #32

The classmethod has the exact same signature as the constructor but
instead of constructing a new instance straightaway, it will first check
if the database already contains a node with the exact same class (so no
subclassing is used in the query) and with an md5 checksum that matches
that of the bytes of the stream.

If an existing node is matched, that is returned, otherwise a new
instance is constructed and returned unstored.

The classmethod has the exact same signature as the constructor but
instead of constructing a new instance straightaway, it will first check
if the database already contains a node with the exact same class (so no
subclassing is used in the query) and with an md5 checksum that matches
that of the bytes of the stream.

If an existing node is matched, that is returned, otherwise a new
instance is constructed and returned unstored.
@sphuber sphuber force-pushed the feature/032/pseudo-potential-get-or-create branch from 806bd18 to 4d8ef71 Compare December 8, 2020 08:23
@sphuber sphuber requested a review from bosonie December 8, 2020 08:26
Copy link
Collaborator

@bosonie bosonie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good

@sphuber sphuber merged commit a750038 into master Dec 8, 2020
@sphuber sphuber deleted the feature/032/pseudo-potential-get-or-create branch December 8, 2020 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add PseudoPotentialData.get_or_create classmethod
3 participants