Skip to content

Commit 438878e

Browse files
remove allow_msonable_dict as its only prior use was in api_sanitize, also removed
1 parent 792c389 commit 438878e

1 file changed

Lines changed: 1 addition & 31 deletions

File tree

mp_api/client/core/utils.py

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -87,34 +87,4 @@ def validate_ids(id_list: list[str]):
8787
# return [validate_identifier(idx,serialize=True) for idx in id_list]
8888
if validate_identifier:
8989
return [str(validate_identifier(idx)) for idx in id_list]
90-
return _legacy_id_validation(id_list)
91-
92-
93-
def allow_msonable_dict(monty_cls: type[MSONable]):
94-
"""Patch Monty to allow for dict values for MSONable."""
95-
96-
def validate_monty(cls, v, _):
97-
"""Stub validator for MSONable as a dictionary only."""
98-
if isinstance(v, cls):
99-
return v
100-
elif isinstance(v, dict):
101-
# Just validate the simple Monty Dict Model
102-
errors = []
103-
if v.get("@module", "") != monty_cls.__module__:
104-
errors.append("@module")
105-
106-
if v.get("@class", "") != monty_cls.__name__:
107-
errors.append("@class")
108-
109-
if len(errors) > 0:
110-
raise ValueError(
111-
"Missing Monty seriailzation fields in dictionary: {errors}"
112-
)
113-
114-
return v
115-
else:
116-
raise ValueError(f"Must provide {cls.__name__} or MSONable dictionary")
117-
118-
monty_cls.validate_monty_v2 = classmethod(validate_monty)
119-
120-
return monty_cls
90+
return _legacy_id_validation(id_list)

0 commit comments

Comments
 (0)