Skip to content

Commit 12dbab2

Browse files
committed
Harmonize naming of methods
- Some method names starting with 'make_' changed to 'create_'
1 parent dba3cb7 commit 12dbab2

7 files changed

+99
-97
lines changed

examples/xml/port_interface/client_server_interface.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ def create_port_interfaces(packages: dict[str, ar_element.Package]):
3333
"""
3434
uint32_impl_type = packages["PlatformImplementationDataTypes"].find("uint32")
3535
interface = ar_element.ClientServerInterface("FreeRunningTimer_I", is_service=True)
36-
operation = interface.make_operation("GetTimeStamp")
37-
operation.make_out_argument("value",
38-
ar_enum.ServerArgImplPolicy.USE_ARGUMENT_TYPE,
39-
type_ref=uint32_impl_type.ref())
36+
operation = interface.create_operation("GetTimeStamp")
37+
operation.create_out_argument("value",
38+
ar_enum.ServerArgImplPolicy.USE_ARGUMENT_TYPE,
39+
type_ref=uint32_impl_type.ref())
4040
packages["PortInterfaces"].append(interface)
4141

4242

examples/xml/port_interface/nv_data_interface.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def create_nv_data_interface_with_one_element(packages: dict[str, ar_element.Pac
3232
"""
3333
uint8_type: ar_element.ImplementationDataType = packages["PlatformImplementationDataTypes"].find("uint8")
3434
portinterface = ar_element.NvDataInterface("DataInterface1")
35-
portinterface.make_data_element("Data1", type_ref=uint8_type.ref())
35+
portinterface.create_data_element("Data1", type_ref=uint8_type.ref())
3636
packages["PortInterfaces"].append(portinterface)
3737

3838

@@ -42,8 +42,8 @@ def create_nv_data_interface_with_two_elements(packages: dict[str, ar_element.Pa
4242
"""
4343
uint8_type: ar_element.ImplementationDataType = packages["PlatformImplementationDataTypes"].find("uint8")
4444
portinterface = ar_element.NvDataInterface("DataInterface2")
45-
portinterface.make_data_element("Data1", type_ref=uint8_type.ref())
46-
portinterface.make_data_element("Data2", type_ref=uint8_type.ref())
45+
portinterface.create_data_element("Data1", type_ref=uint8_type.ref())
46+
portinterface.create_data_element("Data2", type_ref=uint8_type.ref())
4747
packages["PortInterfaces"].append(portinterface)
4848

4949

examples/xml/port_interface/parameter_interface.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def create_parameter_interface_with_one_parameter(packages: dict[str, ar_element
3232
"""
3333
uint8_type: ar_element.ImplementationDataType = packages["PlatformImplementationDataTypes"].find("uint8")
3434
portinterface = ar_element.ParameterInterface("ParameterInterface1")
35-
portinterface.make_parameter("Param1", type_ref=uint8_type.ref())
35+
portinterface.create_parameter("Param1", type_ref=uint8_type.ref())
3636
packages["PortInterfaces"].append(portinterface)
3737

3838

@@ -42,8 +42,8 @@ def create_parameter_interface_with_two_parameters(packages: dict[str, ar_elemen
4242
"""
4343
uint8_type: ar_element.ImplementationDataType = packages["PlatformImplementationDataTypes"].find("uint8")
4444
portinterface = ar_element.ParameterInterface("ParameterInterface2")
45-
portinterface.make_parameter("Param1", type_ref=uint8_type.ref())
46-
portinterface.make_parameter("Param2", type_ref=uint8_type.ref())
45+
portinterface.create_parameter("Param1", type_ref=uint8_type.ref())
46+
portinterface.create_parameter("Param2", type_ref=uint8_type.ref())
4747
packages["PortInterfaces"].append(portinterface)
4848

4949

examples/xml/port_interface/sender_receiver_interface.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def create_sender_receiver_interface_with_one_element(packages: dict[str, ar_ele
4343
"""
4444
inactive_active_t = packages["ImplementationDataTypes"].find("InactiveActive_T")
4545
portinterface = ar_element.SenderReceiverInterface("HeadLightStatus_I")
46-
portinterface.make_data_element("HeadLightStatus", type_ref=inactive_active_t.ref())
46+
portinterface.create_data_element("HeadLightStatus", type_ref=inactive_active_t.ref())
4747
packages["PortInterfaces"].append(portinterface)
4848

4949

@@ -53,8 +53,8 @@ def create_sender_receiver_interface_with_two_elements(packages: dict[str, ar_el
5353
"""
5454
inactive_active_t = packages["ImplementationDataTypes"].find("InactiveActive_T")
5555
portinterface = ar_element.SenderReceiverInterface("InterfaceName")
56-
portinterface.make_data_element("Element1", type_ref=inactive_active_t.ref())
57-
portinterface.make_data_element("Element2", type_ref=inactive_active_t.ref())
56+
portinterface.create_data_element("Element1", type_ref=inactive_active_t.ref())
57+
portinterface.create_data_element("Element2", type_ref=inactive_active_t.ref())
5858
packages["PortInterfaces"].append(portinterface)
5959

6060

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "autosar"
3-
version = "0.5.1"
3+
version = "0.5.2a1"
44
description = "A set of Python modules for working with AUTOSAR XML files"
55
readme = "README.md"
66
requires-python = ">=3.10"

src/autosar/xml/element.py

+50-50
Original file line numberDiff line numberDiff line change
@@ -3057,9 +3057,9 @@ def __init__(self,
30573057
if isinstance(mode_declaration, ModeDeclaration):
30583058
self.append_mode_declaratation(mode_declaration)
30593059
elif isinstance(mode_declaration, str):
3060-
self.make_mode_declaration(mode_declaration)
3060+
self.create_mode_declaration(mode_declaration)
30613061
elif isinstance(mode_declaration, tuple):
3062-
self.make_mode_declaration(*mode_declaration)
3062+
self.create_mode_declaration(*mode_declaration)
30633063
else:
30643064
err_msg = f"Invalid type '{str(type(mode_declaration))}'"
30653065
raise TypeError(err_msg + ". " + expected_types)
@@ -3100,10 +3100,10 @@ def append_mode_declaratation(self, mode_declaration: ModeDeclaration) -> None:
31003100
msg = f"mode_declaration: Invalid type '{str(type(mode_declaration))}'"
31013101
raise TypeError(msg + ". Expected 'ModeDeclaration'")
31023102

3103-
def make_mode_declaration(self,
3104-
name: str,
3105-
value: int | None = None,
3106-
**kwargs) -> ModeDeclaration:
3103+
def create_mode_declaration(self,
3104+
name: str,
3105+
value: int | None = None,
3106+
**kwargs) -> ModeDeclaration:
31073107
"""
31083108
Convenience method for creating a new mode declaration within this group
31093109
"""
@@ -3251,20 +3251,20 @@ def append_invalidation_policy(self, invalidation_policy: InvalidationPolicy):
32513251
msg = f"invalidation_policy: Invalid type '{str(type(invalidation_policy))}'"
32523252
raise TypeError(msg + ". Expected 'InvalidationPolicy'")
32533253

3254-
def make_data_element(self,
3255-
name: str,
3256-
init_value: ValueSpeficationElement | None = None,
3257-
**kwargs) -> VariableDataPrototype:
3254+
def create_data_element(self,
3255+
name: str,
3256+
init_value: ValueSpeficationElement | None = None,
3257+
**kwargs) -> VariableDataPrototype:
32583258
"""
32593259
Convenience method for adding a new data element to this port interface
32603260
"""
32613261
data_element = VariableDataPrototype(name, init_value, **kwargs)
32623262
self.append_data_element(data_element)
32633263
return data_element
32643264

3265-
def make_invalidation_policy(self,
3266-
data_element_ref: VariableDataPrototypeRef | str,
3267-
handle_invalid: ar_enum.HandleInvalid) -> InvalidationPolicy:
3265+
def create_invalidation_policy(self,
3266+
data_element_ref: VariableDataPrototypeRef | str,
3267+
handle_invalid: ar_enum.HandleInvalid) -> InvalidationPolicy:
32683268
"""
32693269
Convenience method for adding a new invalidation policy to this port interface
32703270
"""
@@ -3314,10 +3314,10 @@ def append_data_element(self, nv_data: VariableDataPrototype):
33143314
msg = f"nv_data: Invalid type '{str(type(nv_data))}'"
33153315
raise TypeError(msg + ". Expected 'VariableDataPrototype'")
33163316

3317-
def make_data_element(self,
3318-
name: str,
3319-
init_value: ValueSpeficationElement | None = None,
3320-
**kwargs) -> VariableDataPrototype:
3317+
def create_data_element(self,
3318+
name: str,
3319+
init_value: ValueSpeficationElement | None = None,
3320+
**kwargs) -> VariableDataPrototype:
33213321
"""
33223322
Convenience method for adding a new data element to this port interface
33233323
"""
@@ -3359,10 +3359,10 @@ def append_parameter(self, parameter: ParameterDataPrototype):
33593359
msg = f"parameter: Invalid type '{str(type(parameter))}'"
33603360
raise TypeError(msg + ". Expected 'ParameterDataPrototype'")
33613361

3362-
def make_parameter(self,
3363-
name: str,
3364-
init_value: ValueSpeficationElement | None = None,
3365-
**kwargs) -> ParameterDataPrototype:
3362+
def create_parameter(self,
3363+
name: str,
3364+
init_value: ValueSpeficationElement | None = None,
3365+
**kwargs) -> ParameterDataPrototype:
33663366
"""
33673367
Convenience method for adding a new parameter to this port interface
33683368
"""
@@ -3440,44 +3440,44 @@ def append_argument(self, argument: ArgumentDataPrototype) -> None:
34403440
msg = f"argument: Invalid type '{str(type(argument))}'"
34413441
raise TypeError(msg + ". Expected 'ArgumentDataPrototype'")
34423442

3443-
def make_argument(self,
3444-
name: str,
3445-
direction: ar_enum.ArgumentDirection | None = None,
3446-
server_arg_impl_policy: ar_enum.ServerArgImplPolicy | None = None,
3447-
**kwargs) -> ArgumentDataPrototype:
3443+
def create_argument(self,
3444+
name: str,
3445+
direction: ar_enum.ArgumentDirection | None = None,
3446+
server_arg_impl_policy: ar_enum.ServerArgImplPolicy | None = None,
3447+
**kwargs) -> ArgumentDataPrototype:
34483448
"""
34493449
Convenience method for adding a new argument to this operation
34503450
"""
34513451
argument = ArgumentDataPrototype(name, direction, server_arg_impl_policy, **kwargs)
34523452
self.append_argument(argument)
34533453
return argument
34543454

3455-
def make_in_argument(self,
3456-
name: str,
3457-
server_arg_impl_policy: ar_enum.ServerArgImplPolicy | None = None,
3458-
**kwargs) -> ArgumentDataPrototype:
3455+
def create_in_argument(self,
3456+
name: str,
3457+
server_arg_impl_policy: ar_enum.ServerArgImplPolicy | None = None,
3458+
**kwargs) -> ArgumentDataPrototype:
34593459
"""
34603460
Convenience method for adding a new in-argument to this operation
34613461
"""
34623462
argument = ArgumentDataPrototype(name, ar_enum.ArgumentDirection.IN, server_arg_impl_policy, **kwargs)
34633463
self.append_argument(argument)
34643464
return argument
34653465

3466-
def make_inout_argument(self,
3467-
name: str,
3468-
server_arg_impl_policy: ar_enum.ServerArgImplPolicy | None = None,
3469-
**kwargs) -> ArgumentDataPrototype:
3466+
def create_inout_argument(self,
3467+
name: str,
3468+
server_arg_impl_policy: ar_enum.ServerArgImplPolicy | None = None,
3469+
**kwargs) -> ArgumentDataPrototype:
34703470
"""
34713471
Convenience method for adding a new inout-argument to this operation
34723472
"""
34733473
argument = ArgumentDataPrototype(name, ar_enum.ArgumentDirection.INOUT, server_arg_impl_policy, **kwargs)
34743474
self.append_argument(argument)
34753475
return argument
34763476

3477-
def make_out_argument(self,
3478-
name: str,
3479-
server_arg_impl_policy: ar_enum.ServerArgImplPolicy | None = None,
3480-
**kwargs) -> ArgumentDataPrototype:
3477+
def create_out_argument(self,
3478+
name: str,
3479+
server_arg_impl_policy: ar_enum.ServerArgImplPolicy | None = None,
3480+
**kwargs) -> ArgumentDataPrototype:
34813481
"""
34823482
Convenience method for adding a new out-argument to this operation
34833483
"""
@@ -3495,7 +3495,7 @@ def append_possible_error_ref(self, possible_error_ref: ApplicationErrorRef) ->
34953495
msg = f"argument: Invalid type '{str(type(possible_error_ref))}'"
34963496
raise TypeError(msg + ". Expected 'ApplicationErrorRef'")
34973497

3498-
def make_possible_error_ref(self, value: str) -> ApplicationErrorRef:
3498+
def create_possible_error_ref(self, value: str) -> ApplicationErrorRef:
34993499
"""
35003500
Convenience method for creating and adding a new possible error reference to this operation
35013501
"""
@@ -3559,13 +3559,13 @@ def append_possible_errors(self, possible_error: ApplicationError) -> None:
35593559
msg = f"operation: Invalid type '{str(type(possible_error))}'"
35603560
raise TypeError(msg + ". Expected 'ApplicationError'")
35613561

3562-
def make_operation(self,
3563-
name: str,
3564-
arguments: ArgumentDataPrototype | list[ArgumentDataPrototype] | None = None,
3565-
diag_arg_integrity: bool | None = None,
3566-
fire_and_forget: bool | None = None,
3567-
possible_error_refs: ApplicationErrorRef | list[ApplicationErrorRef] | None = None,
3568-
**kwargs) -> ClientServerOperation:
3562+
def create_operation(self,
3563+
name: str,
3564+
arguments: ArgumentDataPrototype | list[ArgumentDataPrototype] | None = None,
3565+
diag_arg_integrity: bool | None = None,
3566+
fire_and_forget: bool | None = None,
3567+
possible_error_refs: ApplicationErrorRef | list[ApplicationErrorRef] | None = None,
3568+
**kwargs) -> ClientServerOperation:
35693569
"""
35703570
Convenience method for creating a new operation in this port interface
35713571
"""
@@ -3574,10 +3574,10 @@ def make_operation(self,
35743574
self.append_operation(operation)
35753575
return operation
35763576

3577-
def make_possible_error(self,
3578-
name: str,
3579-
error_code: int | None = None,
3580-
**kwargs) -> ApplicationError:
3577+
def create_possible_error(self,
3578+
name: str,
3579+
error_code: int | None = None,
3580+
**kwargs) -> ApplicationError:
35813581
"""
35823582
Convenience-method for creating a new possible error in this port interface
35833583
"""

0 commit comments

Comments
 (0)