aas-standard-parser 0.2.4__py3-none-any.whl → 0.2.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,7 +13,7 @@ except importlib.metadata.PackageNotFoundError:
13
13
  __project__ = "aas-standard-parser"
14
14
  __package__ = "aas-standard-parser"
15
15
 
16
- from aas_standard_parser import aimc_parser
16
+ from aas_standard_parser import aas_parser, aid_parser, aimc_parser, submodel_parser
17
17
  from aas_standard_parser.aid_parser import AIDParser
18
18
 
19
- __all__ = ["AIDParser", "aimc_parser"]
19
+ __all__ = ["AIDParser", "aimc_parser", "aas_parser", "aid_parser", "submodel_parser"]
@@ -0,0 +1,24 @@
1
+ """Module for parsing AAS."""
2
+
3
+ import logging
4
+
5
+ from basyx.aas import model
6
+
7
+ logger = logging.getLogger(__name__)
8
+
9
+
10
+ def get_submodel_ids(shell: model.AssetAdministrationShell) -> list[str]:
11
+ """Get all submodel IDs from the given AAS.
12
+
13
+ :param shell: parent AAS to search within
14
+ :return: list of submodel IDs
15
+ """
16
+ submodel_ids = []
17
+ for submodel in shell.submodel:
18
+ if len(submodel.key) < 1 or submodel.key[0].type != model.KeyTypes.SUBMODEL:
19
+ logger.warning(f"Submodel reference {submodel} does not start with SUBMODEL key type.")
20
+ continue
21
+
22
+ submodel_ids.append(submodel.key[0].value)
23
+
24
+ return submodel_ids
@@ -6,7 +6,26 @@ def construct_idshort_path_from_reference(reference: ModelReference) -> str:
6
6
 
7
7
  # start from the second Key and omit the Identifiable at the beginning of the list
8
8
  for key in reference.key[1:]:
9
- idshort_path += (key.value + ".")
9
+ idshort_path += key.value + "."
10
10
 
11
11
  # get rid of the trailing dot
12
12
  return idshort_path[:-1]
13
+
14
+
15
+ def get_values_from_keys(reference: ModelReference) -> list[str]:
16
+ """Returns the values from all keys in reference as list.
17
+
18
+ :param reference: reference to extract values from
19
+ :return: list of values from all keys in the reference
20
+ """
21
+ return [key.value for key in reference.key]
22
+
23
+
24
+ def get_value_from_key_at_index(reference: ModelReference, index: int) -> str:
25
+ """Returns the value from the key at the given index in reference.
26
+
27
+ :param reference: reference to extract value from
28
+ :param index: index of the key to get the value from
29
+ :return: value from the key at the given index
30
+ """
31
+ return reference.key[index].value
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aas-standard-parser
3
- Version: 0.2.4
3
+ Version: 0.2.6
4
4
  Summary: Some auxiliary functions for parsing standard submodels
5
5
  Author-email: Daniel Klein <daniel.klein@em.ag>
6
6
  License: MIT License
@@ -1,15 +1,16 @@
1
- aas_standard_parser/__init__.py,sha256=3iBTUUlJ97ImkAHdss_GP970BANEU1uNeg0HlRzzois,599
1
+ aas_standard_parser/__init__.py,sha256=lp7rs4UL5yebN0F69JKuNaqI8kI2_lU2LV3B0vUSXAw,687
2
+ aas_standard_parser/aas_parser.py,sha256=9SDxG2YGEWlcK2Wyy70r9rOO6ExAOaN79-SbjurOci4,667
2
3
  aas_standard_parser/aid_parser.py,sha256=9vp8_kJRfExTmw8tjmO32n1eHFAE5ItmfPlZ2ORLZMs,14314
3
4
  aas_standard_parser/aimc_parser.py,sha256=3GSM-jBj-9OqNDnL7CssqogNOZEd7_fjRtxwzRZi-iA,9972
4
5
  aas_standard_parser/collection_helpers.py,sha256=fTQGQiC-bGD41Qx0FDDBtWhvkeZtEe6Sh-aT93ePwro,4153
5
- aas_standard_parser/reference_helpers.py,sha256=UbqXaub5PTvt_W3VPntSSFcTS59PUwlTpoujny8rIRI,377
6
+ aas_standard_parser/reference_helpers.py,sha256=mUWlxD81aV8J-VLowjZ1prS52cFW1EVwXkaUOFL_P2Y,1037
6
7
  aas_standard_parser/submodel_parser.py,sha256=XH-XTBB3a0MB1NR5nAzG9C6f9hT_qG42f-ABruN3MzE,3169
7
8
  aas_standard_parser/utils.py,sha256=5iIPpM_ob2V9MwFL_vTbXd23doYKot30xenRmTPAquo,723
8
9
  aas_standard_parser/classes/aimc_parser_classes.py,sha256=PwKpuyB36urFc8YqQ6KtrG8H5WLd-3R2c3yST8Yyc_w,2581
9
10
  aas_standard_parser/demo/demo_process.py,sha256=Xn9uD0xLoNx0ZvB3Lk0oYkGBRHaEfUbfqv5_SpPWYck,530
10
11
  aas_standard_parser/demo/logging_handler.py,sha256=x-eX4XDU3sZTJE22rzJSiaWQ8wRMbtaFpFBAeAcbIzI,5752
11
- aas_standard_parser-0.2.4.dist-info/licenses/LICENSE,sha256=simqYMD2P9Ikm0Kh9n7VGNpaVcm2TMVVQmECYZ_xVZ8,1065
12
- aas_standard_parser-0.2.4.dist-info/METADATA,sha256=5IbBJL1Hf5CzK57tlUGPDomLXkj46Me6AZQIwCRj3Vs,1718
13
- aas_standard_parser-0.2.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
- aas_standard_parser-0.2.4.dist-info/top_level.txt,sha256=OQaK6cwYttR1-eKTz5u4M0jbwSfp4HqJ56chaf0nHnw,20
15
- aas_standard_parser-0.2.4.dist-info/RECORD,,
12
+ aas_standard_parser-0.2.6.dist-info/licenses/LICENSE,sha256=simqYMD2P9Ikm0Kh9n7VGNpaVcm2TMVVQmECYZ_xVZ8,1065
13
+ aas_standard_parser-0.2.6.dist-info/METADATA,sha256=-ikDTRghNsQWEqvTm3X1zntFc5XrXBG_xJA66UpDc4E,1718
14
+ aas_standard_parser-0.2.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
+ aas_standard_parser-0.2.6.dist-info/top_level.txt,sha256=OQaK6cwYttR1-eKTz5u4M0jbwSfp4HqJ56chaf0nHnw,20
16
+ aas_standard_parser-0.2.6.dist-info/RECORD,,