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

Make AimsSpeciesFile a dataclass #4054

Merged
merged 2 commits into from
Sep 8, 2024

Conversation

tpurcell90
Copy link
Contributor

As recommended by @janosh in #3878

Summary

Major changes:

  • Make AimsSpeciesFile a dataclass

Todos

Checklist

  • Google format doc strings added. Check with ruff.
  • Type annotations included. Check with mypy.
  • Tests added for new features/fixes.
  • If applicable, new classes/functions/modules have duecredit @due.dcite decorators to reference relevant papers by DOI (example)

remove commented code and __init__ function
"""Deserialization of the AimsSpeciesFile object"""
return AimsSpeciesFile(data=dct["data"], label=dct["label"])
return cls(**dct)
Copy link
Member

Choose a reason for hiding this comment

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

this method will now fail if dct contains additional keys besides data and label where it wouldn't before but could be a good safety mechanism unless that leeway was intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this would be okay. I added the leeway there in case something changed in the future with the species.

@janosh janosh added io Input/output functionality refactor Refactorings labels Sep 8, 2024
@janosh janosh merged commit 326beb9 into materialsproject:master Sep 8, 2024
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
io Input/output functionality refactor Refactorings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants