File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,12 +51,6 @@ def __iter__(self) -> Iterator[_DESCRIPTOR_TYPE]:
5151 return iter (self ._backend .values ())
5252
5353
54- _DESCRIPTOR_KEY_TO_CLS = (
55- ("assetAdministrationShellDescriptors" , descriptor .AssetAdministrationShellDescriptor ),
56- ("submodelDescriptors" , descriptor .SubmodelDescriptor ),
57- )
58-
59-
6054def load_directory (directory : Union [Path , str ]) -> DictDescriptorStore :
6155 """
6256 Load AAS/Submodel descriptor JSON files from a directory into a :class:`DictDescriptorStore`.
@@ -74,12 +68,17 @@ def load_directory(directory: Union[Path, str]) -> DictDescriptorStore:
7468 continue
7569 with open (file ) as f :
7670 data = json .load (f , cls = ServerAASFromJsonDecoder )
77- for key , cls in _DESCRIPTOR_KEY_TO_CLS :
78- for item in data .get (key , []):
79- if isinstance (item , cls ):
80- try :
81- store .add (item )
82- except KeyError :
83- pass
71+ for item in data .get ("assetAdministrationShellDescriptors" , []):
72+ if isinstance (item , descriptor .AssetAdministrationShellDescriptor ):
73+ try :
74+ store .add (item )
75+ except KeyError :
76+ pass
77+ for item in data .get ("submodelDescriptors" , []):
78+ if isinstance (item , descriptor .SubmodelDescriptor ):
79+ try :
80+ store .add (item )
81+ except KeyError :
82+ pass
8483
8584 return store
You can’t perform that action at this time.
0 commit comments