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

Add Composition.replace() #2284

Merged
merged 5 commits into from
Oct 29, 2021
Merged

Add Composition.replace() #2284

merged 5 commits into from
Oct 29, 2021

Conversation

janosh
Copy link
Member

@janosh janosh commented Oct 29, 2021

Addresses #2282.

I originally attempted to handle SpeciesLike rather than just str as input, i.e.

elem_map: Dict[SpeciesLike, Union[SpeciesLike, Dict[SpeciesLike, float]]]

instead of the current

elem_map: Dict[str, Union[str, Dict[str, float]]]

but it turned into much more of a hassle with perhaps not much extra value. What's your take?

Checklist

  • Code is in the standard Python style. The easiest way to handle this
    is to run the following in the correct sequence on your local machine. Start with running
    black on your new code. This will automatically reformat
    your code to PEP8 conventions and removes most issues. Then run
    pycodestyle, followed by
    flake8.
  • Docstrings have been added in the Google docstring format.
    Run pydocstyle on your code.
  • Type annotations are highly encouraged. Run mypy to type check your code.
  • Tests have been added for any new functionality or bug fixes.
  • All linting and tests pass.

pymatgen/core/composition.py Outdated Show resolved Hide resolved
pymatgen/core/composition.py Outdated Show resolved Hide resolved
@shyuep shyuep merged commit acfe589 into materialsproject:master Oct 29, 2021
@janosh janosh deleted the comp-replace branch October 29, 2021 18:05
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.

2 participants