aas-standard-parser 0.2.8__py3-none-any.whl → 0.3.1__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.
- aas_standard_parser/submodel_json_parser.py +1 -2
- aas_standard_parser/utils.py +25 -2
- {aas_standard_parser-0.2.8.dist-info → aas_standard_parser-0.3.1.dist-info}/METADATA +3 -3
- {aas_standard_parser-0.2.8.dist-info → aas_standard_parser-0.3.1.dist-info}/RECORD +7 -7
- {aas_standard_parser-0.2.8.dist-info → aas_standard_parser-0.3.1.dist-info}/WHEEL +0 -0
- {aas_standard_parser-0.2.8.dist-info → aas_standard_parser-0.3.1.dist-info}/licenses/LICENSE +0 -0
- {aas_standard_parser-0.2.8.dist-info → aas_standard_parser-0.3.1.dist-info}/top_level.txt +0 -0
|
@@ -5,11 +5,10 @@ import logging
|
|
|
5
5
|
logger = logging.getLogger(__name__)
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def get_value_from_semantic_id_by_index(submodel_data: dict, index: int) -> str | None:
|
|
8
|
+
def get_value_from_semantic_id_by_index(submodel_data: dict, index: int = 0) -> str | None:
|
|
9
9
|
"""Retrieve the value from the semantic ID from a submodel JSON dictionary by index.
|
|
10
10
|
|
|
11
11
|
:param submodel_data: The submodel data as a dictionary.
|
|
12
|
-
|
|
13
12
|
:param index: The index to access if the element is a list or collection, defaults to 0.
|
|
14
13
|
:return: The value of the found submodel element or None if not found.
|
|
15
14
|
"""
|
aas_standard_parser/utils.py
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"""Utility functions for AAS standard parser."""
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
|
+
import logging
|
|
4
5
|
from pathlib import Path
|
|
6
|
+
from typing import Any
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
import basyx.aas.adapter.json
|
|
7
9
|
from basyx.aas import model
|
|
8
10
|
|
|
11
|
+
logger = logging.getLogger(__name__)
|
|
12
|
+
|
|
9
13
|
|
|
10
14
|
def create_submodel_from_file(file_path: str) -> model.Submodel:
|
|
11
15
|
"""Loads a Submodel structure from a given JSON file and converts it into a model.Submodel object from the python SDK framework.
|
|
@@ -24,4 +28,23 @@ def create_submodel_from_file(file_path: str) -> model.Submodel:
|
|
|
24
28
|
template_data = json.load(f)
|
|
25
29
|
|
|
26
30
|
# Load the template JSON into a Submodel object
|
|
27
|
-
return
|
|
31
|
+
return _convert_to_object(template_data)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _convert_to_object(content: dict) -> Any | None:
|
|
35
|
+
"""Convert a dictionary to a BaSyx SDK framework object.
|
|
36
|
+
|
|
37
|
+
:param content: dictionary to convert
|
|
38
|
+
:return: BaSyx SDK framework object or None
|
|
39
|
+
"""
|
|
40
|
+
if not content or len(content) == 0:
|
|
41
|
+
logger.debug("Empty content provided for conversion to object.")
|
|
42
|
+
return None
|
|
43
|
+
|
|
44
|
+
try:
|
|
45
|
+
dict_string = json.dumps(content)
|
|
46
|
+
return json.loads(dict_string, cls=basyx.aas.adapter.json.json_deserialization.AASFromJsonDecoder)
|
|
47
|
+
except Exception as e:
|
|
48
|
+
logger.error(f"Decoding error: {e}")
|
|
49
|
+
logger.error(f"In JSON: {content}")
|
|
50
|
+
return None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aas-standard-parser
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.1
|
|
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
|
|
@@ -25,7 +25,7 @@ License: MIT License
|
|
|
25
25
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
26
|
SOFTWARE.
|
|
27
27
|
|
|
28
|
-
Project-URL: Homepage, https://github.com/fluid40/aas-
|
|
28
|
+
Project-URL: Homepage, https://github.com/fluid40/aas-standard-parser
|
|
29
29
|
Description-Content-Type: text/markdown
|
|
30
30
|
License-File: LICENSE
|
|
31
31
|
Requires-Dist: typing>=3.7.4.3
|
|
@@ -38,7 +38,7 @@ Dynamic: license-file
|
|
|
38
38
|
<!-- change this to your projects logo if you have on.
|
|
39
39
|
If you don't have one it might be worth trying chatgpt dall-e to create one for you...
|
|
40
40
|
-->
|
|
41
|
-
<img src="docs/assets/fluid_logo.svg" alt="
|
|
41
|
+
<img src="docs/assets/fluid_logo.svg" alt="aas_standard_parser" width=500 />
|
|
42
42
|
</div>
|
|
43
43
|
|
|
44
44
|
---
|
|
@@ -4,15 +4,15 @@ aas_standard_parser/aid_parser.py,sha256=9vp8_kJRfExTmw8tjmO32n1eHFAE5ItmfPlZ2OR
|
|
|
4
4
|
aas_standard_parser/aimc_parser.py,sha256=3GSM-jBj-9OqNDnL7CssqogNOZEd7_fjRtxwzRZi-iA,9972
|
|
5
5
|
aas_standard_parser/collection_helpers.py,sha256=fTQGQiC-bGD41Qx0FDDBtWhvkeZtEe6Sh-aT93ePwro,4153
|
|
6
6
|
aas_standard_parser/reference_helpers.py,sha256=HJMK1FjoEkPipw9kcT7k75EYioHz_SwcLLqXdFo9Eew,1339
|
|
7
|
-
aas_standard_parser/submodel_json_parser.py,sha256=
|
|
7
|
+
aas_standard_parser/submodel_json_parser.py,sha256=SeRJ-Oelrx1ZXW0W5rKVBLM_ade48yssBelVIZrGJLA,1240
|
|
8
8
|
aas_standard_parser/submodel_parser.py,sha256=cKDKUBoKMJb1q6ISalJhLlE1VRqqFHTDWsv6BdeSmXU,2653
|
|
9
|
-
aas_standard_parser/utils.py,sha256=
|
|
9
|
+
aas_standard_parser/utils.py,sha256=aupcb_VfgLy8kGRReMXpEk_LS67rNwCVCW7BMFdgnv8,1608
|
|
10
10
|
aas_standard_parser/version_check.py,sha256=P1nb2WvVVU5RaQ4mWViFLnF9QkUv61Zc2EApYPGiiC8,1058
|
|
11
11
|
aas_standard_parser/classes/aimc_parser_classes.py,sha256=PwKpuyB36urFc8YqQ6KtrG8H5WLd-3R2c3yST8Yyc_w,2581
|
|
12
12
|
aas_standard_parser/demo/demo_process.py,sha256=Xn9uD0xLoNx0ZvB3Lk0oYkGBRHaEfUbfqv5_SpPWYck,530
|
|
13
13
|
aas_standard_parser/demo/logging_handler.py,sha256=x-eX4XDU3sZTJE22rzJSiaWQ8wRMbtaFpFBAeAcbIzI,5752
|
|
14
|
-
aas_standard_parser-0.
|
|
15
|
-
aas_standard_parser-0.
|
|
16
|
-
aas_standard_parser-0.
|
|
17
|
-
aas_standard_parser-0.
|
|
18
|
-
aas_standard_parser-0.
|
|
14
|
+
aas_standard_parser-0.3.1.dist-info/licenses/LICENSE,sha256=simqYMD2P9Ikm0Kh9n7VGNpaVcm2TMVVQmECYZ_xVZ8,1065
|
|
15
|
+
aas_standard_parser-0.3.1.dist-info/METADATA,sha256=MDqFHZtMLJdWAaI8KsbIesRLfYqqKmEAVGRI1rBMqm4,4510
|
|
16
|
+
aas_standard_parser-0.3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
17
|
+
aas_standard_parser-0.3.1.dist-info/top_level.txt,sha256=OQaK6cwYttR1-eKTz5u4M0jbwSfp4HqJ56chaf0nHnw,20
|
|
18
|
+
aas_standard_parser-0.3.1.dist-info/RECORD,,
|
|
File without changes
|
{aas_standard_parser-0.2.8.dist-info → aas_standard_parser-0.3.1.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|