-
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
Fix CI failure: bump netcdf4
, replace Namespace
with standard dict
for io.abinit.pseudos
#4223
Fix CI failure: bump netcdf4
, replace Namespace
with standard dict
for io.abinit.pseudos
#4223
Conversation
619eb2e
to
2b37fc9
Compare
@@ -601,7 +601,9 @@ def _dict_from_lines(lines, key_nums, sep=None) -> dict: | |||
if len(lines) != len(key_nums): | |||
raise ValueError(f"{lines = }\n{key_nums = }") | |||
|
|||
kwargs = Namespace() |
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.
It turns out the issue is two-fold:
My fault goes first, looks like the override on update
is not complete to handle Iterator
correctly, and surely I would fix this ASAP:
from monty.collections import Namespace
namespace_dict = Namespace()
namespace_dict.update(zip(["a", "b"], [1, 2]))
print(namespace_dict) # {}
namespace_dict.update({"a":1, "b":2})
print(namespace_dict) # {'a': 1, 'b': 2}
After fixing this issue, the usage of Namespace
in oncvpsp_header
method of io.abinit.pseudo.NcAbinitHeader
seems unexpected to me around pop
:
pymatgen/src/pymatgen/io/abinit/pseudos.py
Line 783 in b28b4c2
header.pop("pspd") |
According to the original docstring (before my clean up in materialsvirtuallab/monty#722):
A dictionary that does not permit to redefine its keys.
As such I would consider pop
"redefined its keys" as it removed the key from the dictionary.
Currently I don't see any error with replacing Namespace
dict by a standard dict
, so I might use standard dict for now until someone have any comment.
2b37fc9
to
070a8c6
Compare
netcdf4
, replace Namespace
with standard dict
for io.abinit.pseudos
@shyuep This should fix failure. Regarding the |
Thanks! |
Fix CI failure, to fix #4221
TODOs: