@@ -44,27 +44,7 @@ def load_json(json_like: str | bytes, deser: bool = False, encoding: str = "utf-
4444 return MontyDecoder ().process_decoded (data ) if deser else data
4545
4646
47- def _legacy_id_validation (id_list : list [str ]) -> list [str ]:
48- """Legacy utility to validate IDs, pre-AlphaID transition.
49-
50- This function is temporarily maintained to allow for
51- backwards compatibility with older versions of emmet, and will
52- not be preserved.
53- """
54- pattern = "(mp|mvc|mol|mpcule)-.*"
55- if malformed_ids := {
56- entry for entry in id_list if re .match (pattern , entry ) is None
57- }:
58- raise ValueError (
59- f"{ 'Entry' if len (malformed_ids ) == 1 else 'Entries' } "
60- f" { ', ' .join (malformed_ids )} "
61- f"{ 'is' if len (malformed_ids ) == 1 else 'are' } not formatted correctly!"
62- )
63-
64- return id_list
65-
66-
67- def validate_ids (id_list : list [str ]):
47+ def validate_ids (id_list : list [str ]) -> list [str ]:
6848 """Function to validate material and task IDs.
6949
7050 Args:
@@ -85,6 +65,4 @@ def validate_ids(id_list: list[str]):
8565 # TODO: after the transition to AlphaID in the document models,
8666 # The following line should be changed to
8767 # return [validate_identifier(idx,serialize=True) for idx in id_list]
88- if validate_identifier :
89- return [str (validate_identifier (idx )) for idx in id_list ]
90- return _legacy_id_validation (id_list )
68+ return [validate_identifier (idx ).string for idx in id_list ]
0 commit comments