Open Andrew-S-Rosen opened 6 months ago
Looks like I ran into something similar, resolved on monty's side: https://github.com/materialsvirtuallab/monty/pull/602/
Oh that was smart! Thanks!! I'll check if is resolved with the monty update.
Looks like your PR didn't fix this one btw, @jmmshn. I'll have to dig into it later.
So I think the custom as_dict
for this takes precedence over the new general for the Enums
So something like this should work.
from monty.serialization import dumpfn
from enum import Enum
class Test(Enum):
a = "a"
b = "b"
t = Test.a
dumpfn(t, "test.json")
So I think if we just remove the custom as_dict
and from_dict
for that class then things should work. But we will have a see about the consequences.
Thanks for the pointer, @jmmshn! Removing the .as_dict()
method in emmet.core.utils.ValueEnum
results in an AttributeError
:
AttributeError: 'CrystalSystem' object has no attribute 'as_dict'
I'll dig into this later in the week. I think I know where to look now. 👍
@munrojm can you please re-open this? It won't let me do so. It needs to be reopened due to #974.
Problem
This returns the string "Triclinic" rather than a dictionary. This would normally be fine, but the fact that it's a string means that doing
dumpfn
doesn't work on a data structure containing aCrystalSystem
object.Traceback:
Proposed Solution
Modify the
.as_dict()
method?Alternatives
No response