-
Notifications
You must be signed in to change notification settings - Fork 874
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
Explicit UTF-8 encoding for VASP input files with zopen
, and open
for other text files
#4218
base: master
Are you sure you want to change the base?
Explicit UTF-8 encoding for VASP input files with zopen
, and open
for other text files
#4218
Conversation
As you have started this already, let me know when I shall step in (if needed). |
Thanks for saying that I could handle this as there aren't too many to fix across the entire code base (~300) and unsafe fixes from >>> ruff check . --select PLW1514 --preview
Found 282 errors.
No fixes available (282 hidden fixes can be enabled with the `--unsafe-fixes` option). If you could help me review changes (if you have time), that would be wonderful :) |
Yes, I have a bit of time to spare for a review 😎 |
open
for text files
open
for text fileszopen
, and open
for other text files
7ce8014
to
bd90e90
Compare
448ec77
to
c54d772
Compare
@QuantumChemist I went through the changes myself and didn't see much issue (not trying to bias you), please help me review those changes if you have time, really appreciate that. AFAIK, if we don't give a I would separate the remaining change to Thanks again! |
@DanielYang59 , sorry this weekend was big exhaustion time and today I also had a day off but now I have the time and energy for reviewing x) |
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 think there is not a lot to review here xD
I'm just wondering how we could make sure that no "open ... " line was missed out 🤔
I can also test this implementation on Wednesday (will not be able to test it tomorrow) with a Γ
in a KPOINTS file 👀
That's totally alright, no one would expect you to work on weekends/holidays :) Thanks a lot!
In fact I tested on my local machine, and of course additional test is always welcome (I should add a test in CI, in TODO list now). However a pitfall may be: your system could be using a default encoding where
Thanks for noticing this, I originally used the ruff PLW1514 rule to identify them, Update: looks like I was wrong here, upon a closer look I believe all I believe this code shown with #4218 (comment) is at the time of comment and would not be updated automatically, i.e. the Not really useful anymoreWe might need regular expression for this, something like: However this is not "perfect" so I would still need to manually inspect its outcome (it's the best I could do within a rational time frame):
An Line 250 in 31f1e1f
|
I know that nobody expects to work on weekends, I just thought I would have the time and energy but was not the case against my expectation.
An |
I guess there is always a gap between the ideal image of self and and real us :) You have already done so much BTW
Thanks for the comment, with the unspecified-encoding (PLW1514) rule enable |
I wasn't aware that |
I would see if I could get the warning filter to work in #4222 so let's discuss there maybe, apparently the filter I added in bbd53bf is not doing what I expected as no error is thrown after I intentionally removed some encoding in 2ccf30c The |
@QuantumChemist Sorry there was a major typo, the EncodingWarning was added in Python 3.10 not Python 3.13 The reason for the custom |
I see it was a typo xD
yeah, I will have a closer look in the other PR too :) |
Is this ready to be merged? |
Yes as far as I'm aware, thank you! |
yes, ready to be merged. |
Summary
zopen
, to fix For band structure, how to correctly display the symbol of the \Gamma point #4214open
pytest
ignoreUserWarning
only by default instead of all warningsRationale
PEP 597 – Add optional EncodingWarning:
Meanwhile PEP 686 – Make UTF-8 mode default should resolve this altogether but it wouldn't be in place until Python 3.15
Ruff rule: unspecified-encoding (PLW1514)