Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Avoid
bader_caller
from altering compressed file in place #3660Avoid
bader_caller
from altering compressed file in place #3660Changes from 13 commits
ade7207
e4e445f
819c66e
302307c
cba9a17
de679d1
e53c383
50f0352
ae60ff0
7c1df63
06d1663
4385885
b3a989a
022889f
c648e14
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
My oversight, should use set instead
{".bz2", ".gz", ".z"}
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.
Add a quick note for myself,
Sourcery
would recommend usingset
overlist
ortuple
for membership check, see here.The advantage of
set/tuple
overlist
seems quite obvious, for example discussed here.However I still don't quite know the difference between
tuple
andset
in this scenario, some claims it's related to performance.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.
Didn't see
self.is_vasp
being used.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.
The
_get_filepath
method already issued a warning in line 529, maybe this is not necessary?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.
i guess
Chgcar.from_file(chgcar_path)
will already raise if the file is missing?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.
Maybe no... By
Chgcar.from_file
pymatgen/pymatgen/io/vasp/outputs.py
Lines 3661 to 3672 in d07164f
And then
VolumetricData.parse_file
:pymatgen/pymatgen/io/vasp/outputs.py
Lines 3431 to 3535 in d07164f
Then
zopen
: https://github.com/materialsvirtuallab/monty/blob/4d60fd4745f840354e7b3f48346eaf3cd68f2b35/monty/io.py#L19-L45But certainly
open
would complain (maybe not so descriptive). But_get_filepath
would issue a warning anyway, so maybe don't bother issure another here 😄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.
By the way, I added the
if chgcar_path is not None
check to avoidmypy
error, because_get_filepath
could returnNone
and triggermypy
incompatible type error: