File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ IMAS-Python public API
2121 ids_convert.convert_ids
2222 ids_data_type.IDSDataType
2323 ids_factory.IDSFactory
24+ ids_factory.get_all_ids_names
2425 ids_identifiers.identifiers
2526 ids_metadata.IDSMetadata
2627 ids_metadata.IDSType
Original file line number Diff line number Diff line change 2323from .db_entry import DBEntry
2424from .ids_convert import convert_ids
2525from .ids_data_type import IDSDataType
26- from .ids_factory import IDSFactory
26+ from .ids_factory import IDSFactory , get_all_ids_names
2727from .ids_identifiers import identifiers
2828from .ids_metadata import IDSMetadata , IDSType
2929from .ids_primitive import IDSPrimitive
4242 "DBEntry" ,
4343 "IDSDataType" ,
4444 "IDSFactory" ,
45+ "get_all_ids_names" ,
4546 "IDSMetadata" ,
4647 "IDSPrimitive" ,
4748 "IDSStructure" ,
Original file line number Diff line number Diff line change 1717logger = logging .getLogger (__name__ )
1818
1919
20+ def get_all_ids_names () -> list [str ]:
21+ """Get all IDS names available across all dd versions"""
22+ ids_names : set [str ] = set ()
23+
24+ for dd_version in dd_zip .dd_xml_versions ():
25+ ids_names .update (IDSFactory (dd_version ).ids_names ())
26+
27+ return sorted (ids_names )
28+
29+
2030class IDSFactory :
2131 """Factory class generating IDSToplevel elements for specific DD versions.
2232
Original file line number Diff line number Diff line change 11import pytest
22
3- from imas .dd_zip import latest_dd_version
4- from imas .ids_factory import IDSFactory
3+ from imas .dd_zip import dd_xml_versions , latest_dd_version
4+ from imas .ids_factory import IDSFactory , get_all_ids_names
55
66
77def test_ids_factory_with_version ():
@@ -33,3 +33,10 @@ def test_ids_factory_from_env(monkeypatch: pytest.MonkeyPatch):
3333 monkeypatch .setenv ("IMAS_VERSION" , version )
3434 factory = IDSFactory ()
3535 assert factory ._version == version
36+
37+
38+ def test_get_all_ids_names ():
39+ ids_names = get_all_ids_names ()
40+
41+ for dd_version in dd_xml_versions ():
42+ assert set (IDSFactory (dd_version ).ids_names ()) <= set (ids_names )
You can’t perform that action at this time.
0 commit comments