armodel 1.4.3__py3-none-any.whl → 1.6.0__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.
- armodel/cli/arxml_dump_cli.py +14 -14
- armodel/cli/memory_section_cli.py +76 -0
- armodel/cli/system_signal_cli.py +74 -0
- armodel/lib/__init__.py +2 -1
- armodel/lib/system_signal.py +37 -0
- armodel/models/__init__.py +6 -3
- armodel/models/annotation.py +27 -3
- armodel/models/ar_object.py +18 -6
- armodel/models/ar_package.py +248 -30
- armodel/models/ar_ref.py +115 -45
- armodel/models/bsw_module_template.py +66 -28
- armodel/models/common_structure.py +150 -150
- armodel/models/communication.py +1 -1
- armodel/models/data_prototype.py +41 -6
- armodel/models/datatype.py +11 -5
- armodel/models/fibex/__init__.py +0 -0
- armodel/models/fibex/can_communication.py +122 -0
- armodel/models/fibex/fibex_4_can/__init__.py +0 -0
- armodel/models/fibex/fibex_4_lin/__init__.py +0 -0
- armodel/models/fibex/fibex_4_multiplatform.py +138 -0
- armodel/models/fibex/fibex_core/__init__.py +0 -0
- armodel/models/fibex/fibex_core/core_communication.py +627 -0
- armodel/models/fibex/fibex_core/core_topology.py +180 -0
- armodel/models/fibex/fibex_core.py +341 -0
- armodel/models/fibex/lin_communication.py +38 -0
- armodel/models/fibex/lin_topology.py +7 -0
- armodel/models/general_structure.py +119 -10
- armodel/models/implementation.py +4 -5
- armodel/models/internal_behavior.py +63 -0
- armodel/models/m2/__init__.py +0 -0
- armodel/models/m2/autosar_templates/__init__.py +0 -0
- armodel/models/m2/autosar_templates/common_structure/__init__.py +188 -0
- armodel/models/m2/autosar_templates/common_structure/constants.py +0 -0
- armodel/models/m2/autosar_templates/ecuc_description_template.py +268 -0
- armodel/models/m2/autosar_templates/sw_component_template/__init__.py +0 -0
- armodel/models/m2/autosar_templates/sw_component_template/communication.py +316 -0
- armodel/models/m2/autosar_templates/sw_component_template/components/__init__.py +0 -0
- armodel/models/m2/autosar_templates/sw_component_template/components/instance_refs.py +149 -0
- armodel/models/m2/autosar_templates/sw_component_template/port_interface.py +236 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/__init__.py +203 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/access_count.py +13 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/data_elements.py +54 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/mode_declaration_group.py +39 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/server_call.py +26 -0
- armodel/models/m2/autosar_templates/sw_component_template/swc_internal_behavior/trigger.py +10 -0
- armodel/models/m2/autosar_templates/system_template/__init__.py +321 -0
- armodel/models/m2/autosar_templates/system_template/data_mapping.py +88 -0
- armodel/models/m2/autosar_templates/system_template/network_management.py +554 -0
- armodel/models/m2/autosar_templates/system_template/transport_protocols.py +7 -0
- armodel/models/m2/msr/__init__.py +0 -0
- armodel/models/m2/msr/asam_hdo/__init__.py +0 -0
- armodel/models/m2/msr/asam_hdo/units.py +105 -0
- armodel/models/m2/msr/data_dictionary/__init__.py +0 -0
- armodel/models/m2/msr/data_dictionary/auxillary_objects.py +42 -0
- armodel/models/m2/msr/data_dictionary/data_def_properties.py +295 -0
- armodel/models/m2/msr/documentation/__init__.py +0 -0
- armodel/models/m2/msr/documentation/block_elements.py +18 -0
- armodel/models/mode_declaration.py +8 -0
- armodel/models/multilanguage_data.py +15 -0
- armodel/models/per_instance_memory.py +34 -6
- armodel/models/port_prototype.py +15 -159
- armodel/models/rpt_scenario.py +20 -0
- armodel/models/sw_component.py +48 -187
- armodel/models/system_template/__init__.py +0 -0
- armodel/models/system_template/network_management.py +7 -0
- armodel/models/system_template/transport_protocols.py +7 -0
- armodel/models/timing.py +91 -0
- armodel/parser/abstract_arxml_parser.py +11 -2
- armodel/parser/arxml_parser.py +1101 -227
- armodel/tests/test_armodel/models/test_ar_package.py +1 -1
- armodel/tests/test_armodel/models/test_ar_ref.py +3 -3
- armodel/tests/test_armodel/models/test_bsw_module_template.py +5 -5
- armodel/tests/test_armodel/models/test_common_structure.py +3 -3
- armodel/tests/test_armodel/models/test_data_dictionary.py +5 -5
- armodel/tests/test_armodel/models/test_data_prototype.py +2 -2
- armodel/tests/test_armodel/models/test_datatype.py +8 -8
- armodel/tests/test_armodel/models/test_port_interface.py +6 -6
- armodel/tests/test_armodel/parser/test_parse_bswmd.py +16 -8
- armodel/tests/test_armodel/parser/test_sw_components.py +6 -6
- armodel/writer/arxml_writer.py +1046 -181
- {armodel-1.4.3.dist-info → armodel-1.6.0.dist-info}/METADATA +48 -1
- armodel-1.6.0.dist-info/RECORD +127 -0
- {armodel-1.4.3.dist-info → armodel-1.6.0.dist-info}/entry_points.txt +3 -1
- armodel-1.4.3.dist-info/RECORD +0 -78
- {armodel-1.4.3.dist-info → armodel-1.6.0.dist-info}/LICENSE +0 -0
- {armodel-1.4.3.dist-info → armodel-1.6.0.dist-info}/WHEEL +0 -0
- {armodel-1.4.3.dist-info → armodel-1.6.0.dist-info}/top_level.txt +0 -0
armodel/cli/arxml_dump_cli.py
CHANGED
|
@@ -2,9 +2,9 @@ import getopt
|
|
|
2
2
|
import sys
|
|
3
3
|
import logging
|
|
4
4
|
|
|
5
|
-
from ..models import AUTOSAR, ARPackage,
|
|
5
|
+
from ..models import AUTOSAR, ARPackage, VariableAccess, SwComponentType, DataTypeMappingSet
|
|
6
6
|
from ..models import SwcInternalBehavior, ImplementationDataType
|
|
7
|
-
from ..models import BswModuleDescription,
|
|
7
|
+
from ..models import BswModuleDescription, BswInternalBehavior, BswModuleEntity, BswModuleEntry
|
|
8
8
|
from ..models import PortPrototype, RPortPrototype, PPortPrototype
|
|
9
9
|
from ..models import SenderReceiverInterface, ClientServerInterface
|
|
10
10
|
from ..parser import ARXMLParser
|
|
@@ -21,26 +21,26 @@ def show_port(indent:int, port_prototype: PortPrototype):
|
|
|
21
21
|
if (isinstance(port_prototype, RPortPrototype)):
|
|
22
22
|
print("%s-RPort: %s (%s)" % (" " * indent, port_prototype.short_name, port_prototype.required_interface_tref.value))
|
|
23
23
|
for client_com_spec in port_prototype.getClientComSpecs():
|
|
24
|
-
print("%s : %s (ClientComSpec)" % (" " * (indent + 2), client_com_spec.
|
|
24
|
+
print("%s : %s (ClientComSpec)" % (" " * (indent + 2), client_com_spec.operationRef.value))
|
|
25
25
|
for com_spec in port_prototype.getNonqueuedReceiverComSpecs():
|
|
26
|
-
print("%s : %s (NonqueuedReceiverComSpec)" % (" " * (indent + 2), com_spec.
|
|
26
|
+
print("%s : %s (NonqueuedReceiverComSpec)" % (" " * (indent + 2), com_spec.dataElementRef.value))
|
|
27
27
|
elif (isinstance(port_prototype, PPortPrototype)):
|
|
28
28
|
print("%s-PPort: %s (%s)" % (" " * indent, port_prototype.short_name, port_prototype.provided_interface_tref.value))
|
|
29
29
|
for com_spec in port_prototype.getNonqueuedSenderComSpecs():
|
|
30
|
-
print("%s : %s (NonqueuedSenderComSpec)" % (" " * (indent + 2), com_spec.
|
|
30
|
+
print("%s : %s (NonqueuedSenderComSpec)" % (" " * (indent + 2), com_spec.dataElementRef.value))
|
|
31
31
|
else:
|
|
32
32
|
raise ValueError("Unsupported Port prototype")
|
|
33
33
|
|
|
34
34
|
def show_type(indent: int, data_type: ImplementationDataType):
|
|
35
|
-
print("%s-Implementation Type: %s (%s)" % (" " * indent, data_type.short_name, data_type.
|
|
35
|
+
print("%s-Implementation Type: %s (%s)" % (" " * indent, data_type.short_name, data_type._parent.full_name))
|
|
36
36
|
print("%s : %s" % (" " * indent, data_type.category))
|
|
37
|
-
if (data_type.
|
|
38
|
-
if (data_type.
|
|
39
|
-
base_type_ref = data_type.
|
|
37
|
+
if (data_type.swDataDefProps != None):
|
|
38
|
+
if (data_type.swDataDefProps.baseTypeRef != None):
|
|
39
|
+
base_type_ref = data_type.swDataDefProps.baseTypeRef
|
|
40
40
|
print("%s : %s (%s)" % (" " * indent, base_type_ref.value, base_type_ref.dest))
|
|
41
41
|
|
|
42
|
-
if (data_type.
|
|
43
|
-
implementation_data_type_ref = data_type.
|
|
42
|
+
if (data_type.swDataDefProps.implementationDataTypeRef != None):
|
|
43
|
+
implementation_data_type_ref = data_type.swDataDefProps.implementationDataTypeRef
|
|
44
44
|
print("%s : %s (%s)" % (" " * indent, implementation_data_type_ref.value, implementation_data_type_ref.dest))
|
|
45
45
|
|
|
46
46
|
def show_data_type_mapping(indent: int, mapping_set: DataTypeMappingSet):
|
|
@@ -92,7 +92,7 @@ def show_client_server_interface(indent: int, cs_interface: ClientServerInterfac
|
|
|
92
92
|
print("%sOperation:%s" % (" " * (indent + 2), operation.short_name))
|
|
93
93
|
for argument in operation.getArgumentDataPrototypes():
|
|
94
94
|
print("%s :%s (%s: %s)" % (" " * (indent + 2), argument.short_name,
|
|
95
|
-
argument.direction, argument.
|
|
95
|
+
argument.direction, argument.typeTRef.value))
|
|
96
96
|
|
|
97
97
|
def show_bsw_internal_behavior(indent: int, behavior: BswInternalBehavior):
|
|
98
98
|
document = AUTOSAR.getInstance()
|
|
@@ -107,8 +107,8 @@ def show_bsw_internal_behavior(indent: int, behavior: BswInternalBehavior):
|
|
|
107
107
|
print("%s-%s: %s" % (" " * (indent + 4), "StartsOnEventRef", event.startsOnEventRef.value))
|
|
108
108
|
starts_on_event = document.find(event.startsOnEventRef.value) # type: BswModuleEntity
|
|
109
109
|
print("%s-%s: %s" % (" " * (indent + 4), "StartsOnEvent", starts_on_event.short_name))
|
|
110
|
-
print("%s-%s: %s" % (" " * (indent + 4), "ImplementedEntryRef", starts_on_event.
|
|
111
|
-
implemented_entry = document.find(starts_on_event.
|
|
110
|
+
print("%s-%s: %s" % (" " * (indent + 4), "ImplementedEntryRef", starts_on_event.implementedEntryRef.value))
|
|
111
|
+
implemented_entry = document.find(starts_on_event.implementedEntryRef.value) # type: BswModuleEntry
|
|
112
112
|
print("%s-%s: %s" % (" " * (indent + 4), "ImplementedEntry", implemented_entry.short_name))
|
|
113
113
|
print("%s-%s: %d" % (" " * (indent + 6), "Service Id", implemented_entry.service_id))
|
|
114
114
|
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import pkg_resources
|
|
3
|
+
import logging
|
|
4
|
+
import sys
|
|
5
|
+
import os.path
|
|
6
|
+
|
|
7
|
+
from armodel import AUTOSAR
|
|
8
|
+
from armodel.parser import ARXMLParser
|
|
9
|
+
from ..lib import InputFileParser, SystemSignalAnalyzer
|
|
10
|
+
|
|
11
|
+
def main():
|
|
12
|
+
version = pkg_resources.require("armodel")[0].version
|
|
13
|
+
|
|
14
|
+
ap = argparse.ArgumentParser()
|
|
15
|
+
ap.add_argument("-v", "--verbose", required= False, help= "Print debug information", action= "store_true")
|
|
16
|
+
ap.add_argument("-f", "--format", required= False, help= "Specify the short or long name of Sw-C. [short|long]")
|
|
17
|
+
|
|
18
|
+
ap.add_argument("INPUT", help = "The path of AUTOSAR XML", nargs='+')
|
|
19
|
+
ap.add_argument("")
|
|
20
|
+
|
|
21
|
+
args = ap.parse_args()
|
|
22
|
+
|
|
23
|
+
logger = logging.getLogger()
|
|
24
|
+
|
|
25
|
+
formatter = logging.Formatter('[%(levelname)s] : %(message)s')
|
|
26
|
+
|
|
27
|
+
stdout_handler = logging.StreamHandler(sys.stderr)
|
|
28
|
+
stdout_handler.setFormatter(formatter)
|
|
29
|
+
|
|
30
|
+
#base_path = os.path.dirname(args.Output)
|
|
31
|
+
log_file = os.path.join(".", 'system-signals.log')
|
|
32
|
+
|
|
33
|
+
if os.path.exists(log_file):
|
|
34
|
+
os.remove(log_file)
|
|
35
|
+
|
|
36
|
+
file_handler = logging.FileHandler(log_file)
|
|
37
|
+
file_handler.setFormatter(formatter)
|
|
38
|
+
|
|
39
|
+
logger.setLevel(logging.DEBUG)
|
|
40
|
+
file_handler.setLevel(logging.DEBUG)
|
|
41
|
+
|
|
42
|
+
if args.verbose:
|
|
43
|
+
stdout_handler.setLevel(logging.DEBUG)
|
|
44
|
+
|
|
45
|
+
else:
|
|
46
|
+
stdout_handler.setLevel(logging.INFO)
|
|
47
|
+
|
|
48
|
+
logger.addHandler(file_handler)
|
|
49
|
+
logger.addHandler(stdout_handler)
|
|
50
|
+
|
|
51
|
+
try:
|
|
52
|
+
parser = InputFileParser(args.INPUT)
|
|
53
|
+
filenames = parser.parse()
|
|
54
|
+
|
|
55
|
+
document = AUTOSAR().getInstance()
|
|
56
|
+
parser = ARXMLParser({'warning': True})
|
|
57
|
+
|
|
58
|
+
format = "short"
|
|
59
|
+
if args.format is not None and args.format.lower() == "long":
|
|
60
|
+
format = "long"
|
|
61
|
+
|
|
62
|
+
for filename in filenames:
|
|
63
|
+
parser.load(filename, document)
|
|
64
|
+
|
|
65
|
+
analyzer = SystemSignalAnalyzer()
|
|
66
|
+
analyzer.import_data(document)
|
|
67
|
+
analyzer.print_out({
|
|
68
|
+
'format': format,
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
except Exception as e:
|
|
72
|
+
print(e)
|
|
73
|
+
#raise e
|
|
74
|
+
|
|
75
|
+
if __name__ == "__main__":
|
|
76
|
+
main()
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import pkg_resources
|
|
3
|
+
import logging
|
|
4
|
+
import sys
|
|
5
|
+
import os.path
|
|
6
|
+
|
|
7
|
+
from armodel import AUTOSAR
|
|
8
|
+
from armodel.parser import ARXMLParser
|
|
9
|
+
from ..lib import InputFileParser, SystemSignalAnalyzer
|
|
10
|
+
|
|
11
|
+
def main():
|
|
12
|
+
version = pkg_resources.require("armodel")[0].version
|
|
13
|
+
|
|
14
|
+
ap = argparse.ArgumentParser()
|
|
15
|
+
ap.add_argument("-v", "--verbose", required= False, help= "Print debug information", action= "store_true")
|
|
16
|
+
ap.add_argument("-f", "--format", required= False, help= "Specify the name format of SW-C. [short|full]")
|
|
17
|
+
ap.add_argument("INPUT", help = "The path of AUTOSAR XML", nargs='+')
|
|
18
|
+
|
|
19
|
+
args = ap.parse_args()
|
|
20
|
+
|
|
21
|
+
logger = logging.getLogger()
|
|
22
|
+
|
|
23
|
+
formatter = logging.Formatter('[%(levelname)s] : %(message)s')
|
|
24
|
+
|
|
25
|
+
stdout_handler = logging.StreamHandler(sys.stderr)
|
|
26
|
+
stdout_handler.setFormatter(formatter)
|
|
27
|
+
|
|
28
|
+
#base_path = os.path.dirname(args.Output)
|
|
29
|
+
log_file = os.path.join(".", 'system-signals.log')
|
|
30
|
+
|
|
31
|
+
if os.path.exists(log_file):
|
|
32
|
+
os.remove(log_file)
|
|
33
|
+
|
|
34
|
+
file_handler = logging.FileHandler(log_file)
|
|
35
|
+
file_handler.setFormatter(formatter)
|
|
36
|
+
|
|
37
|
+
logger.setLevel(logging.DEBUG)
|
|
38
|
+
file_handler.setLevel(logging.DEBUG)
|
|
39
|
+
|
|
40
|
+
if args.verbose:
|
|
41
|
+
stdout_handler.setLevel(logging.DEBUG)
|
|
42
|
+
|
|
43
|
+
else:
|
|
44
|
+
stdout_handler.setLevel(logging.INFO)
|
|
45
|
+
|
|
46
|
+
logger.addHandler(file_handler)
|
|
47
|
+
logger.addHandler(stdout_handler)
|
|
48
|
+
|
|
49
|
+
try:
|
|
50
|
+
parser = InputFileParser(args.INPUT)
|
|
51
|
+
filenames = parser.parse()
|
|
52
|
+
|
|
53
|
+
document = AUTOSAR().getInstance()
|
|
54
|
+
parser = ARXMLParser({'warning': True})
|
|
55
|
+
|
|
56
|
+
format = "short"
|
|
57
|
+
if args.format is not None and args.format.lower() == "full":
|
|
58
|
+
format = "full"
|
|
59
|
+
|
|
60
|
+
for filename in filenames:
|
|
61
|
+
parser.load(filename, document)
|
|
62
|
+
|
|
63
|
+
analyzer = SystemSignalAnalyzer()
|
|
64
|
+
analyzer.import_data(document)
|
|
65
|
+
analyzer.print_out({
|
|
66
|
+
'format': format,
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
except Exception as e:
|
|
70
|
+
print(e)
|
|
71
|
+
#raise e
|
|
72
|
+
|
|
73
|
+
if __name__ == "__main__":
|
|
74
|
+
main()
|
armodel/lib/__init__.py
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from typing import List
|
|
3
|
+
|
|
4
|
+
from ..models.ar_package import AUTOSAR, ARPackage
|
|
5
|
+
from ..models.fibex.fibex_core.core_communication import SystemSignal
|
|
6
|
+
|
|
7
|
+
class SystemSignalAnalyzer:
|
|
8
|
+
def __init__(self) -> None:
|
|
9
|
+
self.system_signals = [] # type: List[SystemSignal]
|
|
10
|
+
|
|
11
|
+
def add_system_signal(self, signal: SystemSignal):
|
|
12
|
+
self.system_signals.append(signal)
|
|
13
|
+
|
|
14
|
+
def get_system_signals(self) -> List[SystemSignal]:
|
|
15
|
+
return self.system_signals
|
|
16
|
+
|
|
17
|
+
def parse_pkg(self, parent: ARPackage):
|
|
18
|
+
for pkg in parent.getARPackages():
|
|
19
|
+
self.parse_pkg(pkg)
|
|
20
|
+
for signal in parent.getSystemSignals():
|
|
21
|
+
|
|
22
|
+
self.add_system_signal(signal)
|
|
23
|
+
|
|
24
|
+
def import_data(self, document: AUTOSAR):
|
|
25
|
+
for pkg in document.getARPackages():
|
|
26
|
+
self.parse_pkg(pkg)
|
|
27
|
+
|
|
28
|
+
def print_out(self, option = {}):
|
|
29
|
+
logger = logging.getLogger()
|
|
30
|
+
|
|
31
|
+
logger.info("== SYSTEM SIGNAL LIST ==")
|
|
32
|
+
|
|
33
|
+
for signal in sorted(self.system_signals, key = lambda o: o.short_name):
|
|
34
|
+
if option['format'] == 'full':
|
|
35
|
+
logger.info("%s" % signal.full_name)
|
|
36
|
+
else:
|
|
37
|
+
logger.info("%s" % signal.short_name)
|
armodel/models/__init__.py
CHANGED
|
@@ -8,12 +8,15 @@ from .ar_ref import *
|
|
|
8
8
|
from .datatype import *
|
|
9
9
|
from .port_prototype import *
|
|
10
10
|
from .data_prototype import *
|
|
11
|
-
from .
|
|
12
|
-
from .
|
|
11
|
+
from .m2.msr.asam_hdo.units import *
|
|
12
|
+
from .m2.msr.data_dictionary.data_def_properties import *
|
|
13
|
+
from .m2.msr.data_dictionary.auxillary_objects import *
|
|
14
|
+
from .m2.autosar_templates.sw_component_template.port_interface import *
|
|
13
15
|
from .m2_msr import *
|
|
14
16
|
from .implementation import *
|
|
15
17
|
from .bsw_module_template import *
|
|
16
18
|
from .communication import *
|
|
17
19
|
from .calibration import *
|
|
18
20
|
from .global_constraints import *
|
|
19
|
-
from .
|
|
21
|
+
from .m2.msr.asam_hdo.units import *
|
|
22
|
+
from .m2.autosar_templates.sw_component_template import *
|
armodel/models/annotation.py
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
from abc import ABCMeta
|
|
3
3
|
|
|
4
|
+
from .m2.msr.documentation.block_elements import DocumentationBlock
|
|
4
5
|
from .multilanguage_data import MultilanguageLongName
|
|
5
|
-
from .ar_object import ARObject
|
|
6
|
+
from .ar_object import ARLiteral, ARObject
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
class GeneralAnnotation(ARObject, metaclass=ABCMeta):
|
|
@@ -10,10 +11,33 @@ class GeneralAnnotation(ARObject, metaclass=ABCMeta):
|
|
|
10
11
|
if type(self) == ARObject:
|
|
11
12
|
raise NotImplementedError("GeneralAnnotation is an abstract class.")
|
|
12
13
|
|
|
13
|
-
self.label = None # type: MultilanguageLongName
|
|
14
|
-
|
|
15
14
|
super().__init__()
|
|
16
15
|
|
|
16
|
+
self.annotationOrigin = None # type: ARLiteral
|
|
17
|
+
self.annotationText = None # type: DocumentationBlock
|
|
18
|
+
self.label = None # type: MultilanguageLongName
|
|
19
|
+
|
|
20
|
+
def getAnnotationOrigin(self) -> ARLiteral:
|
|
21
|
+
return self.annotationOrigin
|
|
22
|
+
|
|
23
|
+
def setAnnotationOrigin(self, value: ARLiteral):
|
|
24
|
+
self.annotationOrigin = value
|
|
25
|
+
return self
|
|
26
|
+
|
|
27
|
+
def getAnnotationText(self) -> DocumentationBlock:
|
|
28
|
+
return self.annotationText
|
|
29
|
+
|
|
30
|
+
def setAnnotationText(self, value: DocumentationBlock):
|
|
31
|
+
self.annotationText = value
|
|
32
|
+
return self
|
|
33
|
+
|
|
34
|
+
def getLabel(self) -> MultilanguageLongName:
|
|
35
|
+
return self.label
|
|
36
|
+
|
|
37
|
+
def setLabel(self, value: MultilanguageLongName):
|
|
38
|
+
self.label = value
|
|
39
|
+
return self
|
|
40
|
+
|
|
17
41
|
class Annotation(GeneralAnnotation):
|
|
18
42
|
def __init__(self):
|
|
19
43
|
super().__init__()
|
armodel/models/ar_object.py
CHANGED
|
@@ -73,10 +73,21 @@ class ARNumerical(ARType):
|
|
|
73
73
|
self._text = None # type: str
|
|
74
74
|
|
|
75
75
|
def _convertStringToNumberValue(self, value: str) -> int:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
try:
|
|
77
|
+
if value == 'true':
|
|
78
|
+
return 1
|
|
79
|
+
elif value == 'false':
|
|
80
|
+
return 0
|
|
81
|
+
else:
|
|
82
|
+
m = re.match(r"0x([0-9a-f]+)", value, re.I)
|
|
83
|
+
if m:
|
|
84
|
+
return int(m.group(1), 16)
|
|
85
|
+
m = re.match(r"\d+\.\d+", value)
|
|
86
|
+
if m:
|
|
87
|
+
return float(value)
|
|
88
|
+
return int(value)
|
|
89
|
+
except:
|
|
90
|
+
raise ValueError("Invalid Numerical Type <%s>" % value)
|
|
80
91
|
|
|
81
92
|
@property
|
|
82
93
|
def value(self) -> int:
|
|
@@ -118,7 +129,7 @@ class ARPositiveInteger(ARNumerical):
|
|
|
118
129
|
else:
|
|
119
130
|
raise ValueError("Unsupported Type <%s>", type(val))
|
|
120
131
|
|
|
121
|
-
class ARFloat(
|
|
132
|
+
class ARFloat(ARNumerical):
|
|
122
133
|
def __init__(self) -> None:
|
|
123
134
|
super().__init__()
|
|
124
135
|
|
|
@@ -136,7 +147,8 @@ class ARFloat(ARType):
|
|
|
136
147
|
self._value = val * 1.0
|
|
137
148
|
elif isinstance(val, str):
|
|
138
149
|
self._text = val
|
|
139
|
-
self._value = float(val)
|
|
150
|
+
#self._value = float(val)
|
|
151
|
+
self._value = self._convertStringToNumberValue(val)
|
|
140
152
|
else:
|
|
141
153
|
raise ValueError("Unsupported Type <%s>", type(val))
|
|
142
154
|
|