File tree 1 file changed +4
-10
lines changed
1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change 1
- # mypy: ignore-errors
2
- # isort: off
3
- """
4
- This module stubs some pymatgen classes that implement custom behavior
5
- outside the standard MSONable model
6
- """
7
- from typing import Dict
1
+ """Stub some pymatgen classes with behaviors besides those of MSONable."""
8
2
9
3
import pymatgen .core .composition
10
4
from pydantic import RootModel
20
14
class StubComposition (RootModel ):
21
15
"""A dictionary mapping element to total quantity"""
22
16
23
- root : Dict [Element , float ]
17
+ root : dict [Element , float ]
24
18
25
19
26
20
@classmethod # type: ignore
@@ -34,5 +28,5 @@ def validate_composition(cls, v):
34
28
return pymatgen .core .composition .Composition (** v )
35
29
36
30
37
- pymatgen .core .composition .Composition . __pydantic_model__ = StubComposition
38
- pymatgen .core .composition .Composition . __get_validators__ = get_validators
31
+ setattr ( pymatgen .core .composition .Composition , " __pydantic_model__" , StubComposition )
32
+ setattr ( pymatgen .core .composition .Composition , " __get_validators__" , get_validators )
You can’t perform that action at this time.
0 commit comments