From 3bdf708729e47335a780c0ef753e4f2779a10aac Mon Sep 17 00:00:00 2001 From: zoechanzy Date: Thu, 6 Aug 2026 09:47:43 +0800 Subject: [PATCH 1/6] default value: Update nislscapi_full.json --------- Signed-off-by: zoechanzy --- src/codegen/metadata/nislscapi_full.json | 109 +++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/src/codegen/metadata/nislscapi_full.json b/src/codegen/metadata/nislscapi_full.json index 7727275..57cc6f7 100644 --- a/src/codegen/metadata/nislscapi_full.json +++ b/src/codegen/metadata/nislscapi_full.json @@ -1214,6 +1214,7 @@ }, { "dataType": "TimeoutSeconds", + "default": -1, "dir": [ "in" ], @@ -1239,6 +1240,7 @@ }, { "dataType": "TimeoutSeconds", + "default": -1, "dir": [ "in" ], @@ -1313,6 +1315,7 @@ }, { "dataType": "TimeoutSeconds", + "default": -1, "dir": [ "in" ], @@ -1338,6 +1341,7 @@ }, { "dataType": "TimeoutSeconds", + "default": -1, "dir": [ "in" ], @@ -1413,6 +1417,7 @@ }, { "dataType": "TimeoutSeconds", + "default": -1, "dir": [ "in" ], @@ -1438,6 +1443,7 @@ }, { "dataType": "TimeoutSeconds", + "default": -1, "dir": [ "in" ], @@ -1723,6 +1729,7 @@ }, { "dataType": "TimeoutSeconds", + "default": -1, "dir": [ "in" ], @@ -1787,6 +1794,7 @@ }, { "dataType": "Device", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -1795,6 +1803,7 @@ }, { "dataType": "TimeoutSeconds", + "default": -1, "dir": [ "in" ], @@ -1823,6 +1832,7 @@ }, { "dataType": "Device", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -1875,6 +1885,7 @@ }, { "dataType": "TimeoutSeconds", + "default": -1, "dir": [ "in" ], @@ -1911,6 +1922,7 @@ }, { "dataType": "Device", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -1936,6 +1948,7 @@ }, { "dataType": "TimeoutSeconds", + "default": -1, "dir": [ "in" ], @@ -1964,6 +1977,7 @@ }, { "dataType": "Device", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -1992,6 +2006,7 @@ }, { "dataType": "Device", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -2065,6 +2080,7 @@ }, { "dataType": "TimeoutSeconds", + "default": -1, "dir": [ "in" ], @@ -2116,6 +2132,7 @@ }, { "dataType": "TimeoutSeconds", + "default": -1, "dir": [ "in" ], @@ -2240,6 +2257,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -2284,6 +2302,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -2328,6 +2347,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -2372,6 +2392,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -2416,6 +2437,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -2460,6 +2482,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -2504,6 +2527,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -2548,6 +2572,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -2592,6 +2617,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -2636,6 +2662,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -2680,6 +2707,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -2724,6 +2752,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -2768,6 +2797,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -2812,6 +2842,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -2856,6 +2887,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -2900,6 +2932,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -2944,6 +2977,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -2988,6 +3022,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -3032,6 +3067,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -3076,6 +3112,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -3120,6 +3157,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -3164,6 +3202,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -3208,6 +3247,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -3252,6 +3292,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -3296,6 +3337,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -3340,6 +3382,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -3384,6 +3427,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -3428,6 +3472,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -3472,6 +3517,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -3559,6 +3605,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -3604,6 +3651,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -3649,6 +3697,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -3694,6 +3743,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -3739,6 +3789,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -3784,6 +3835,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -3829,6 +3881,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -3874,6 +3927,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -3919,6 +3973,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -3964,6 +4019,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4009,6 +4065,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4054,6 +4111,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4099,6 +4157,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4144,6 +4203,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4189,6 +4249,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4234,6 +4295,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4279,6 +4341,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4324,6 +4387,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4369,6 +4433,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4414,6 +4479,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4459,6 +4525,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4504,6 +4571,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4549,6 +4617,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4594,6 +4663,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4639,6 +4709,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4684,6 +4755,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4729,6 +4801,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4774,6 +4847,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4819,6 +4893,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4871,6 +4946,7 @@ }, { "dataType": "string", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -4900,6 +4976,7 @@ }, { "dataType": "string", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4976,6 +5053,7 @@ }, { "dataType": "string", + "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -5020,6 +5098,7 @@ }, { "dataType": "string", + "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -5064,6 +5143,7 @@ }, { "dataType": "string", + "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -5108,6 +5188,7 @@ }, { "dataType": "string", + "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -5152,6 +5233,7 @@ }, { "dataType": "string", + "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -5196,6 +5278,7 @@ }, { "dataType": "string", + "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -6987,6 +7070,7 @@ }, { "dataType": "Device", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -7032,6 +7116,7 @@ }, { "dataType": "PhysChan", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -7120,6 +7205,7 @@ }, { "dataType": "Device", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -7165,6 +7251,7 @@ }, { "dataType": "Device", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -7210,6 +7297,7 @@ }, { "dataType": "Device", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -7255,6 +7343,7 @@ }, { "dataType": "Device", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -7300,6 +7389,7 @@ }, { "dataType": "Device", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -7345,6 +7435,7 @@ }, { "dataType": "Device", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -7390,6 +7481,7 @@ }, { "dataType": "Device", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -7435,6 +7527,7 @@ }, { "dataType": "Device", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -7480,6 +7573,7 @@ }, { "dataType": "NvmemArea", + "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -7526,6 +7620,7 @@ }, { "dataType": "NvmemArea", + "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -7596,6 +7691,7 @@ }, { "dataType": "NvmemArea", + "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -7656,6 +7752,7 @@ }, { "dataType": "NvmemArea", + "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -7685,6 +7782,7 @@ }, { "dataType": "Device", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -9476,6 +9574,7 @@ }, { "dataType": "Device", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -9523,6 +9622,7 @@ }, { "dataType": "Device", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -9570,6 +9670,7 @@ }, { "dataType": "Device", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -9617,6 +9718,7 @@ }, { "dataType": "Device", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -9664,6 +9766,7 @@ }, { "dataType": "Device", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -9711,6 +9814,7 @@ }, { "dataType": "Device", + "default": "$DefaultDevices", "dir": [ "in" ], @@ -9758,6 +9862,7 @@ }, { "dataType": "NvmemArea", + "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -9805,6 +9910,7 @@ }, { "dataType": "NvmemArea", + "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -9852,6 +9958,7 @@ }, { "dataType": "NvmemArea", + "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -9900,6 +10007,7 @@ }, { "dataType": "PhysChan", + "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -9948,6 +10056,7 @@ }, { "dataType": "PhysChan", + "default": "$DefaultPhysChans", "dir": [ "in" ], From 077ce2a72e9b411a25c29012b4810bdd9eab00a6 Mon Sep 17 00:00:00 2001 From: zoechanzy Date: Thu, 6 Aug 2026 11:32:54 +0800 Subject: [PATCH 2/6] default value: Update files to consume default values * Update function_helpers.py and templates files to consume default value field from nislscapi_full.json * Refactor the order of parameters to avoid python TypeError: positional argument follows keyword argument error * Regenerate generated Python module files --------- Signed-off-by: zoechanzy --- generated/nislsc/session.py | 180 +++++++++++----------- src/codegen/templates/command.py.mako | 4 +- src/codegen/templates/library.py.mako | 2 +- src/codegen/templates/property.py.mako | 4 +- src/codegen/templates/session.py.mako | 4 +- src/codegen/templates/utils.py.mako | 2 +- src/codegen/utilities/function_helpers.py | 108 +++++++++++-- 7 files changed, 189 insertions(+), 115 deletions(-) diff --git a/generated/nislsc/session.py b/generated/nislsc/session.py index c6b153b..1ca6f6e 100644 --- a/generated/nislsc/session.py +++ b/generated/nislsc/session.py @@ -67,7 +67,7 @@ def close(self) -> None: self._owns_library = False @classmethod - def initialize_session_with_devices(cls, library: Library | None, device_names: str, connection_timeout: float, reservation_access: ReservationAccess, reservation_group: str, reservation_timeout: float) -> Self: + def initialize_session_with_devices(cls, library: Library | None, device_names: str, reservation_access: ReservationAccess, reservation_group: str, connection_timeout: float = -1, reservation_timeout: float = -1) -> Self: """Initialize an SLSC session with one or multiple devices. The session opens network connections for devices. If reservationAccess @@ -110,7 +110,7 @@ def initialize_session_with_devices(cls, library: Library | None, device_names: return cls(library, session_handle, owns_library) @classmethod - def initialize_session_with_nvmem_areas(cls, library: Library | None, nvmem_area_names: str, connection_timeout: float, reservation_access: ReservationAccess, reservation_group: str, reservation_timeout: float) -> Self: + def initialize_session_with_nvmem_areas(cls, library: Library | None, nvmem_area_names: str, reservation_access: ReservationAccess, reservation_group: str, connection_timeout: float = -1, reservation_timeout: float = -1) -> Self: """Initialize an SLSC session with one or multiple NVMEM areas. The session opens network connections for NVMEM areas. If @@ -155,7 +155,7 @@ def initialize_session_with_nvmem_areas(cls, library: Library | None, nvmem_area return cls(library, session_handle, owns_library) @classmethod - def initialize_session_with_physical_channels(cls, library: Library | None, physical_channel_names: str, connection_timeout: float, reservation_access: ReservationAccess, reservation_group: str, reservation_timeout: float) -> Self: + def initialize_session_with_physical_channels(cls, library: Library | None, physical_channel_names: str, reservation_access: ReservationAccess, reservation_group: str, connection_timeout: float = -1, reservation_timeout: float = -1) -> Self: """Initialize an SLSC session with one or multiple physical channels. The session opens network connections for devices that correspond to the @@ -239,7 +239,7 @@ def abort_session(self) -> None: """ self._interpreter.abort_session(self._session_handle) - def log_in(self, chassis_name: str, username: str, password: str, connection_timeout: float, save_credentials_to_disk: bool) -> None: + def log_in(self, chassis_name: str, username: str, password: str, save_credentials_to_disk: bool, connection_timeout: float = -1) -> None: """Attempt to connect and log in to the specified SLSC chassis. If successful, the username and password are cached on the local system @@ -297,7 +297,7 @@ def log_out(self, chassis_name: str) -> None: """ self._interpreter.log_out(self._session_handle, chassis_name) - def connect_to_devices(self, device_names: str, connection_timeout: float) -> None: + def connect_to_devices(self, device_names: str = '$DefaultDevices', connection_timeout: float = -1) -> None: """Open network connections for the specified device(s), sharing connections to the same SLSC chassis. @@ -318,7 +318,7 @@ def connect_to_devices(self, device_names: str, connection_timeout: float) -> No """ self._interpreter.connect_to_devices(self._session_handle, device_names, connection_timeout) - def disconnect_from_devices(self, device_names: str) -> None: + def disconnect_from_devices(self, device_names: str = '$DefaultDevices') -> None: """Close network connections for the specified devices. When multiple devices share a network connection because they are in the @@ -332,7 +332,7 @@ def disconnect_from_devices(self, device_names: str) -> None: """ self._interpreter.disconnect_from_devices(self._session_handle, device_names) - def connect_to_chassis_by_address(self, address: str, username: str, password: str, connection_timeout: float) -> str: + def connect_to_chassis_by_address(self, address: str, username: str, password: str, connection_timeout: float = -1) -> str: """Open a network connection for a chassis by the specified IP address or hostname. @@ -353,7 +353,7 @@ def connect_to_chassis_by_address(self, address: str, username: str, password: s chassis_name = self._interpreter.connect_to_chassis_by_address(self._session_handle, address, username, password, connection_timeout) return chassis_name - def reserve_devices(self, device_names: str, reservation_access: ReservationAccess, reservation_group: str, reservation_timeout: float) -> None: + def reserve_devices(self, reservation_access: ReservationAccess, reservation_group: str, device_names: str = '$DefaultDevices', reservation_timeout: float = -1) -> None: """Reserve the specified device(s), which prevents other sessions from accessing them. @@ -379,7 +379,7 @@ def reserve_devices(self, device_names: str, reservation_access: ReservationAcce """ self._interpreter.reserve_devices(self._session_handle, device_names, reservation_access, reservation_group, reservation_timeout) - def unreserve_devices(self, device_names: str) -> None: + def unreserve_devices(self, device_names: str = '$DefaultDevices') -> None: """Unreserve the specified device(s), allowing other sessions to access them. @@ -390,7 +390,7 @@ def unreserve_devices(self, device_names: str) -> None: """ self._interpreter.unreserve_devices(self._session_handle, device_names) - def reset_devices(self, device_names: str) -> None: + def reset_devices(self, device_names: str = '$DefaultDevices') -> None: """Reset the specified device(s) to the default state. This function sends the specified devices a hardware reset signal, @@ -425,7 +425,7 @@ def rename_device(self, device_name: str, new_device_name: str) -> None: """ self._interpreter.rename_device(self._session_handle, device_name, new_device_name) - def update_system_configuration_file(self, chassis_name: str, connection_timeout: float) -> None: + def update_system_configuration_file(self, chassis_name: str, connection_timeout: float = -1) -> None: """Update the information of the specified chassis and its modules in the local configuration file. @@ -442,7 +442,7 @@ def update_system_configuration_file(self, chassis_name: str, connection_timeout """ self._interpreter.update_system_configuration_file(self._session_handle, chassis_name, connection_timeout) - def add_network_chassis(self, address: str, username: str, password: str, connection_timeout: float) -> str: + def add_network_chassis(self, address: str, username: str, password: str, connection_timeout: float = -1) -> str: """Connect to the specified network chassis, adds the chassis and its modules to the system, and saves them to the local configuration file. @@ -478,7 +478,7 @@ def remove_chassis(self, chassis_name: str) -> None: """ self._interpreter.remove_chassis(self._session_handle, chassis_name) - def get_device_property_bool(self, device_names: str, property_name: str) -> bool: + def get_device_property_bool(self, property_name: str, device_names: str = '$DefaultDevices') -> bool: """Get the value of the specified device property from one or more devices. @@ -497,7 +497,7 @@ def get_device_property_bool(self, device_names: str, property_name: str) -> boo property_value = self._interpreter.get_device_property_bool(self._session_handle, device_names, property_name) return property_value - def get_device_property_bool_array(self, device_names: str, property_name: str) -> list[bool]: + def get_device_property_bool_array(self, property_name: str, device_names: str = '$DefaultDevices') -> list[bool]: """Get the value of the specified device property from one or more devices. @@ -516,7 +516,7 @@ def get_device_property_bool_array(self, device_names: str, property_name: str) property_value = self._interpreter.get_device_property_bool_array(self._session_handle, device_names, property_name) return property_value - def get_device_property_double(self, device_names: str, property_name: str) -> float: + def get_device_property_double(self, property_name: str, device_names: str = '$DefaultDevices') -> float: """Get the value of the specified device property from one or more devices. @@ -535,7 +535,7 @@ def get_device_property_double(self, device_names: str, property_name: str) -> f property_value = self._interpreter.get_device_property_double(self._session_handle, device_names, property_name) return property_value - def get_device_property_double_array(self, device_names: str, property_name: str) -> list[float]: + def get_device_property_double_array(self, property_name: str, device_names: str = '$DefaultDevices') -> list[float]: """Get the value of the specified device property from one or more devices. @@ -554,7 +554,7 @@ def get_device_property_double_array(self, device_names: str, property_name: str property_value = self._interpreter.get_device_property_double_array(self._session_handle, device_names, property_name) return property_value - def get_device_property_int32(self, device_names: str, property_name: str) -> int: + def get_device_property_int32(self, property_name: str, device_names: str = '$DefaultDevices') -> int: """Get the value of the specified device property from one or more devices. @@ -573,7 +573,7 @@ def get_device_property_int32(self, device_names: str, property_name: str) -> in property_value = self._interpreter.get_device_property_int32(self._session_handle, device_names, property_name) return property_value - def get_device_property_int32_array(self, device_names: str, property_name: str) -> list[int]: + def get_device_property_int32_array(self, property_name: str, device_names: str = '$DefaultDevices') -> list[int]: """Get the value of the specified device property from one or more devices. @@ -592,7 +592,7 @@ def get_device_property_int32_array(self, device_names: str, property_name: str) property_value = self._interpreter.get_device_property_int32_array(self._session_handle, device_names, property_name) return property_value - def get_device_property_int64(self, device_names: str, property_name: str) -> int: + def get_device_property_int64(self, property_name: str, device_names: str = '$DefaultDevices') -> int: """Get the value of the specified device property from one or more devices. @@ -611,7 +611,7 @@ def get_device_property_int64(self, device_names: str, property_name: str) -> in property_value = self._interpreter.get_device_property_int64(self._session_handle, device_names, property_name) return property_value - def get_device_property_int64_array(self, device_names: str, property_name: str) -> list[int]: + def get_device_property_int64_array(self, property_name: str, device_names: str = '$DefaultDevices') -> list[int]: """Get the value of the specified device property from one or more devices. @@ -630,7 +630,7 @@ def get_device_property_int64_array(self, device_names: str, property_name: str) property_value = self._interpreter.get_device_property_int64_array(self._session_handle, device_names, property_name) return property_value - def get_device_property_string(self, device_names: str, property_name: str) -> str: + def get_device_property_string(self, property_name: str, device_names: str = '$DefaultDevices') -> str: """Get the value of the specified device property from one or more devices. @@ -649,7 +649,7 @@ def get_device_property_string(self, device_names: str, property_name: str) -> s property_value = self._interpreter.get_device_property_string(self._session_handle, device_names, property_name) return property_value - def get_device_property_string_array(self, device_names: str, property_name: str) -> list[str]: + def get_device_property_string_array(self, property_name: str, device_names: str = '$DefaultDevices') -> list[str]: """Get the value of the specified device property from one or more devices. @@ -668,7 +668,7 @@ def get_device_property_string_array(self, device_names: str, property_name: str property_value = self._interpreter.get_device_property_string_array(self._session_handle, device_names, property_name) return property_value - def get_device_property_uint32(self, device_names: str, property_name: str) -> int: + def get_device_property_uint32(self, property_name: str, device_names: str = '$DefaultDevices') -> int: """Get the value of the specified device property from one or more devices. @@ -687,7 +687,7 @@ def get_device_property_uint32(self, device_names: str, property_name: str) -> i property_value = self._interpreter.get_device_property_uint32(self._session_handle, device_names, property_name) return property_value - def get_device_property_uint32_array(self, device_names: str, property_name: str) -> list[int]: + def get_device_property_uint32_array(self, property_name: str, device_names: str = '$DefaultDevices') -> list[int]: """Get the value of the specified device property from one or more devices. @@ -706,7 +706,7 @@ def get_device_property_uint32_array(self, device_names: str, property_name: str property_value = self._interpreter.get_device_property_uint32_array(self._session_handle, device_names, property_name) return property_value - def get_device_property_uint64(self, device_names: str, property_name: str) -> int: + def get_device_property_uint64(self, property_name: str, device_names: str = '$DefaultDevices') -> int: """Get the value of the specified device property from one or more devices. @@ -725,7 +725,7 @@ def get_device_property_uint64(self, device_names: str, property_name: str) -> i property_value = self._interpreter.get_device_property_uint64(self._session_handle, device_names, property_name) return property_value - def get_device_property_uint64_array(self, device_names: str, property_name: str) -> list[int]: + def get_device_property_uint64_array(self, property_name: str, device_names: str = '$DefaultDevices') -> list[int]: """Get the value of the specified device property from one or more devices. @@ -744,7 +744,7 @@ def get_device_property_uint64_array(self, device_names: str, property_name: str property_value = self._interpreter.get_device_property_uint64_array(self._session_handle, device_names, property_name) return property_value - def set_device_property_bool(self, device_names: str, property_name: str, property_value: bool) -> None: + def set_device_property_bool(self, property_name: str, property_value: bool, device_names: str = '$DefaultDevices') -> None: """Set the specified device property to a new value for one or more devices. @@ -764,7 +764,7 @@ def set_device_property_bool(self, device_names: str, property_name: str, proper """ self._interpreter.set_device_property_bool(self._session_handle, device_names, property_name, property_value) - def set_device_property_bool_array(self, device_names: str, property_name: str, property_value: list[bool]) -> None: + def set_device_property_bool_array(self, property_name: str, property_value: list[bool], device_names: str = '$DefaultDevices') -> None: """Set the specified device property to a new value for one or more devices. @@ -784,7 +784,7 @@ def set_device_property_bool_array(self, device_names: str, property_name: str, """ self._interpreter.set_device_property_bool_array(self._session_handle, device_names, property_name, property_value) - def set_device_property_double(self, device_names: str, property_name: str, property_value: float) -> None: + def set_device_property_double(self, property_name: str, property_value: float, device_names: str = '$DefaultDevices') -> None: """Set the specified device property to a new value for one or more devices. @@ -804,7 +804,7 @@ def set_device_property_double(self, device_names: str, property_name: str, prop """ self._interpreter.set_device_property_double(self._session_handle, device_names, property_name, property_value) - def set_device_property_double_array(self, device_names: str, property_name: str, property_value: list[float]) -> None: + def set_device_property_double_array(self, property_name: str, property_value: list[float], device_names: str = '$DefaultDevices') -> None: """Set the specified device property to a new value for one or more devices. @@ -824,7 +824,7 @@ def set_device_property_double_array(self, device_names: str, property_name: str """ self._interpreter.set_device_property_double_array(self._session_handle, device_names, property_name, property_value) - def set_device_property_int32(self, device_names: str, property_name: str, property_value: int) -> None: + def set_device_property_int32(self, property_name: str, property_value: int, device_names: str = '$DefaultDevices') -> None: """Set the specified device property to a new value for one or more devices. @@ -844,7 +844,7 @@ def set_device_property_int32(self, device_names: str, property_name: str, prope """ self._interpreter.set_device_property_int32(self._session_handle, device_names, property_name, property_value) - def set_device_property_int32_array(self, device_names: str, property_name: str, property_value: list[int]) -> None: + def set_device_property_int32_array(self, property_name: str, property_value: list[int], device_names: str = '$DefaultDevices') -> None: """Set the specified device property to a new value for one or more devices. @@ -864,7 +864,7 @@ def set_device_property_int32_array(self, device_names: str, property_name: str, """ self._interpreter.set_device_property_int32_array(self._session_handle, device_names, property_name, property_value) - def set_device_property_int64(self, device_names: str, property_name: str, property_value: int) -> None: + def set_device_property_int64(self, property_name: str, property_value: int, device_names: str = '$DefaultDevices') -> None: """Set the specified device property to a new value for one or more devices. @@ -884,7 +884,7 @@ def set_device_property_int64(self, device_names: str, property_name: str, prope """ self._interpreter.set_device_property_int64(self._session_handle, device_names, property_name, property_value) - def set_device_property_int64_array(self, device_names: str, property_name: str, property_value: list[int]) -> None: + def set_device_property_int64_array(self, property_name: str, property_value: list[int], device_names: str = '$DefaultDevices') -> None: """Set the specified device property to a new value for one or more devices. @@ -904,7 +904,7 @@ def set_device_property_int64_array(self, device_names: str, property_name: str, """ self._interpreter.set_device_property_int64_array(self._session_handle, device_names, property_name, property_value) - def set_device_property_string(self, device_names: str, property_name: str, property_value: str) -> None: + def set_device_property_string(self, property_name: str, property_value: str, device_names: str = '$DefaultDevices') -> None: """Set the specified device property to a new value for one or more devices. @@ -924,7 +924,7 @@ def set_device_property_string(self, device_names: str, property_name: str, prop """ self._interpreter.set_device_property_string(self._session_handle, device_names, property_name, property_value) - def set_device_property_string_array(self, device_names: str, property_name: str, property_value: list[str]) -> None: + def set_device_property_string_array(self, property_name: str, property_value: list[str], device_names: str = '$DefaultDevices') -> None: """Set the specified device property to a new value for one or more devices. @@ -944,7 +944,7 @@ def set_device_property_string_array(self, device_names: str, property_name: str """ self._interpreter.set_device_property_string_array(self._session_handle, device_names, property_name, property_value) - def set_device_property_uint32(self, device_names: str, property_name: str, property_value: int) -> None: + def set_device_property_uint32(self, property_name: str, property_value: int, device_names: str = '$DefaultDevices') -> None: """Set the specified device property to a new value for one or more devices. @@ -964,7 +964,7 @@ def set_device_property_uint32(self, device_names: str, property_name: str, prop """ self._interpreter.set_device_property_uint32(self._session_handle, device_names, property_name, property_value) - def set_device_property_uint32_array(self, device_names: str, property_name: str, property_value: list[int]) -> None: + def set_device_property_uint32_array(self, property_name: str, property_value: list[int], device_names: str = '$DefaultDevices') -> None: """Set the specified device property to a new value for one or more devices. @@ -984,7 +984,7 @@ def set_device_property_uint32_array(self, device_names: str, property_name: str """ self._interpreter.set_device_property_uint32_array(self._session_handle, device_names, property_name, property_value) - def set_device_property_uint64(self, device_names: str, property_name: str, property_value: int) -> None: + def set_device_property_uint64(self, property_name: str, property_value: int, device_names: str = '$DefaultDevices') -> None: """Set the specified device property to a new value for one or more devices. @@ -1004,7 +1004,7 @@ def set_device_property_uint64(self, device_names: str, property_name: str, prop """ self._interpreter.set_device_property_uint64(self._session_handle, device_names, property_name, property_value) - def set_device_property_uint64_array(self, device_names: str, property_name: str, property_value: list[int]) -> None: + def set_device_property_uint64_array(self, property_name: str, property_value: list[int], device_names: str = '$DefaultDevices') -> None: """Set the specified device property to a new value for one or more devices. @@ -1024,7 +1024,7 @@ def set_device_property_uint64_array(self, device_names: str, property_name: str """ self._interpreter.set_device_property_uint64_array(self._session_handle, device_names, property_name, property_value) - def get_physical_channel_property_bool(self, physical_channel_names: str, property_name: str) -> bool: + def get_physical_channel_property_bool(self, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> bool: """Get the value of the specified physical channel property from one or more physical channels. @@ -1046,7 +1046,7 @@ def get_physical_channel_property_bool(self, physical_channel_names: str, proper property_value = self._interpreter.get_physical_channel_property_bool(self._session_handle, physical_channel_names, property_name) return property_value - def get_physical_channel_property_bool_array(self, physical_channel_names: str, property_name: str) -> list[bool]: + def get_physical_channel_property_bool_array(self, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> list[bool]: """Get the value of the specified physical channel property from one or more physical channels. @@ -1068,7 +1068,7 @@ def get_physical_channel_property_bool_array(self, physical_channel_names: str, property_value = self._interpreter.get_physical_channel_property_bool_array(self._session_handle, physical_channel_names, property_name) return property_value - def get_physical_channel_property_double(self, physical_channel_names: str, property_name: str) -> float: + def get_physical_channel_property_double(self, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> float: """Get the value of the specified physical channel property from one or more physical channels. @@ -1090,7 +1090,7 @@ def get_physical_channel_property_double(self, physical_channel_names: str, prop property_value = self._interpreter.get_physical_channel_property_double(self._session_handle, physical_channel_names, property_name) return property_value - def get_physical_channel_property_double_array(self, physical_channel_names: str, property_name: str) -> list[float]: + def get_physical_channel_property_double_array(self, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> list[float]: """Get the value of the specified physical channel property from one or more physical channels. @@ -1112,7 +1112,7 @@ def get_physical_channel_property_double_array(self, physical_channel_names: str property_value = self._interpreter.get_physical_channel_property_double_array(self._session_handle, physical_channel_names, property_name) return property_value - def get_physical_channel_property_int32(self, physical_channel_names: str, property_name: str) -> int: + def get_physical_channel_property_int32(self, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> int: """Get the value of the specified physical channel property from one or more physical channels. @@ -1134,7 +1134,7 @@ def get_physical_channel_property_int32(self, physical_channel_names: str, prope property_value = self._interpreter.get_physical_channel_property_int32(self._session_handle, physical_channel_names, property_name) return property_value - def get_physical_channel_property_int32_array(self, physical_channel_names: str, property_name: str) -> list[int]: + def get_physical_channel_property_int32_array(self, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> list[int]: """Get the value of the specified physical channel property from one or more physical channels. @@ -1156,7 +1156,7 @@ def get_physical_channel_property_int32_array(self, physical_channel_names: str, property_value = self._interpreter.get_physical_channel_property_int32_array(self._session_handle, physical_channel_names, property_name) return property_value - def get_physical_channel_property_int64(self, physical_channel_names: str, property_name: str) -> int: + def get_physical_channel_property_int64(self, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> int: """Get the value of the specified physical channel property from one or more physical channels. @@ -1178,7 +1178,7 @@ def get_physical_channel_property_int64(self, physical_channel_names: str, prope property_value = self._interpreter.get_physical_channel_property_int64(self._session_handle, physical_channel_names, property_name) return property_value - def get_physical_channel_property_int64_array(self, physical_channel_names: str, property_name: str) -> list[int]: + def get_physical_channel_property_int64_array(self, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> list[int]: """Get the value of the specified physical channel property from one or more physical channels. @@ -1200,7 +1200,7 @@ def get_physical_channel_property_int64_array(self, physical_channel_names: str, property_value = self._interpreter.get_physical_channel_property_int64_array(self._session_handle, physical_channel_names, property_name) return property_value - def get_physical_channel_property_string(self, physical_channel_names: str, property_name: str) -> str: + def get_physical_channel_property_string(self, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> str: """Get the value of the specified physical channel property from one or more physical channels. @@ -1222,7 +1222,7 @@ def get_physical_channel_property_string(self, physical_channel_names: str, prop property_value = self._interpreter.get_physical_channel_property_string(self._session_handle, physical_channel_names, property_name) return property_value - def get_physical_channel_property_string_array(self, physical_channel_names: str, property_name: str) -> list[str]: + def get_physical_channel_property_string_array(self, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> list[str]: """Get the value of the specified physical channel property from one or more physical channels. @@ -1244,7 +1244,7 @@ def get_physical_channel_property_string_array(self, physical_channel_names: str property_value = self._interpreter.get_physical_channel_property_string_array(self._session_handle, physical_channel_names, property_name) return property_value - def get_physical_channel_property_uint32(self, physical_channel_names: str, property_name: str) -> int: + def get_physical_channel_property_uint32(self, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> int: """Get the value of the specified physical channel property from one or more physical channels. @@ -1266,7 +1266,7 @@ def get_physical_channel_property_uint32(self, physical_channel_names: str, prop property_value = self._interpreter.get_physical_channel_property_uint32(self._session_handle, physical_channel_names, property_name) return property_value - def get_physical_channel_property_uint32_array(self, physical_channel_names: str, property_name: str) -> list[int]: + def get_physical_channel_property_uint32_array(self, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> list[int]: """Get the value of the specified physical channel property from one or more physical channels. @@ -1288,7 +1288,7 @@ def get_physical_channel_property_uint32_array(self, physical_channel_names: str property_value = self._interpreter.get_physical_channel_property_uint32_array(self._session_handle, physical_channel_names, property_name) return property_value - def get_physical_channel_property_uint64(self, physical_channel_names: str, property_name: str) -> int: + def get_physical_channel_property_uint64(self, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> int: """Get the value of the specified physical channel property from one or more physical channels. @@ -1310,7 +1310,7 @@ def get_physical_channel_property_uint64(self, physical_channel_names: str, prop property_value = self._interpreter.get_physical_channel_property_uint64(self._session_handle, physical_channel_names, property_name) return property_value - def get_physical_channel_property_uint64_array(self, physical_channel_names: str, property_name: str) -> list[int]: + def get_physical_channel_property_uint64_array(self, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> list[int]: """Get the value of the specified physical channel property from one or more physical channels. @@ -1332,7 +1332,7 @@ def get_physical_channel_property_uint64_array(self, physical_channel_names: str property_value = self._interpreter.get_physical_channel_property_uint64_array(self._session_handle, physical_channel_names, property_name) return property_value - def set_physical_channel_property_bool(self, physical_channel_names: str, property_name: str, property_value: bool) -> None: + def set_physical_channel_property_bool(self, property_name: str, property_value: bool, physical_channel_names: str = '$DefaultPhysChans') -> None: """Set the specified physical channel property to a new value for one or more physical channels. @@ -1356,7 +1356,7 @@ def set_physical_channel_property_bool(self, physical_channel_names: str, proper """ self._interpreter.set_physical_channel_property_bool(self._session_handle, physical_channel_names, property_name, property_value) - def set_physical_channel_property_bool_array(self, physical_channel_names: str, property_name: str, property_value: list[bool]) -> None: + def set_physical_channel_property_bool_array(self, property_name: str, property_value: list[bool], physical_channel_names: str = '$DefaultPhysChans') -> None: """Set the specified physical channel property to a new value for one or more physical channels. @@ -1380,7 +1380,7 @@ def set_physical_channel_property_bool_array(self, physical_channel_names: str, """ self._interpreter.set_physical_channel_property_bool_array(self._session_handle, physical_channel_names, property_name, property_value) - def set_physical_channel_property_double(self, physical_channel_names: str, property_name: str, property_value: float) -> None: + def set_physical_channel_property_double(self, property_name: str, property_value: float, physical_channel_names: str = '$DefaultPhysChans') -> None: """Set the specified physical channel property to a new value for one or more physical channels. @@ -1404,7 +1404,7 @@ def set_physical_channel_property_double(self, physical_channel_names: str, prop """ self._interpreter.set_physical_channel_property_double(self._session_handle, physical_channel_names, property_name, property_value) - def set_physical_channel_property_double_array(self, physical_channel_names: str, property_name: str, property_value: list[float]) -> None: + def set_physical_channel_property_double_array(self, property_name: str, property_value: list[float], physical_channel_names: str = '$DefaultPhysChans') -> None: """Set the specified physical channel property to a new value for one or more physical channels. @@ -1428,7 +1428,7 @@ def set_physical_channel_property_double_array(self, physical_channel_names: str """ self._interpreter.set_physical_channel_property_double_array(self._session_handle, physical_channel_names, property_name, property_value) - def set_physical_channel_property_int32(self, physical_channel_names: str, property_name: str, property_value: int) -> None: + def set_physical_channel_property_int32(self, property_name: str, property_value: int, physical_channel_names: str = '$DefaultPhysChans') -> None: """Set the specified physical channel property to a new value for one or more physical channels. @@ -1452,7 +1452,7 @@ def set_physical_channel_property_int32(self, physical_channel_names: str, prope """ self._interpreter.set_physical_channel_property_int32(self._session_handle, physical_channel_names, property_name, property_value) - def set_physical_channel_property_int32_array(self, physical_channel_names: str, property_name: str, property_value: list[int]) -> None: + def set_physical_channel_property_int32_array(self, property_name: str, property_value: list[int], physical_channel_names: str = '$DefaultPhysChans') -> None: """Set the specified physical channel property to a new value for one or more physical channels. @@ -1476,7 +1476,7 @@ def set_physical_channel_property_int32_array(self, physical_channel_names: str, """ self._interpreter.set_physical_channel_property_int32_array(self._session_handle, physical_channel_names, property_name, property_value) - def set_physical_channel_property_int64(self, physical_channel_names: str, property_name: str, property_value: int) -> None: + def set_physical_channel_property_int64(self, property_name: str, property_value: int, physical_channel_names: str = '$DefaultPhysChans') -> None: """Set the specified physical channel property to a new value for one or more physical channels. @@ -1500,7 +1500,7 @@ def set_physical_channel_property_int64(self, physical_channel_names: str, prope """ self._interpreter.set_physical_channel_property_int64(self._session_handle, physical_channel_names, property_name, property_value) - def set_physical_channel_property_int64_array(self, physical_channel_names: str, property_name: str, property_value: list[int]) -> None: + def set_physical_channel_property_int64_array(self, property_name: str, property_value: list[int], physical_channel_names: str = '$DefaultPhysChans') -> None: """Set the specified physical channel property to a new value for one or more physical channels. @@ -1524,7 +1524,7 @@ def set_physical_channel_property_int64_array(self, physical_channel_names: str, """ self._interpreter.set_physical_channel_property_int64_array(self._session_handle, physical_channel_names, property_name, property_value) - def set_physical_channel_property_string(self, physical_channel_names: str, property_name: str, property_value: str) -> None: + def set_physical_channel_property_string(self, property_name: str, property_value: str, physical_channel_names: str = '$DefaultPhysChans') -> None: """Set the specified physical channel property to a new value for one or more physical channels. @@ -1548,7 +1548,7 @@ def set_physical_channel_property_string(self, physical_channel_names: str, prop """ self._interpreter.set_physical_channel_property_string(self._session_handle, physical_channel_names, property_name, property_value) - def set_physical_channel_property_string_array(self, physical_channel_names: str, property_name: str, property_value: list[str]) -> None: + def set_physical_channel_property_string_array(self, property_name: str, property_value: list[str], physical_channel_names: str = '$DefaultPhysChans') -> None: """Set the specified physical channel property to a new value for one or more physical channels. @@ -1572,7 +1572,7 @@ def set_physical_channel_property_string_array(self, physical_channel_names: str """ self._interpreter.set_physical_channel_property_string_array(self._session_handle, physical_channel_names, property_name, property_value) - def set_physical_channel_property_uint32(self, physical_channel_names: str, property_name: str, property_value: int) -> None: + def set_physical_channel_property_uint32(self, property_name: str, property_value: int, physical_channel_names: str = '$DefaultPhysChans') -> None: """Set the specified physical channel property to a new value for one or more physical channels. @@ -1596,7 +1596,7 @@ def set_physical_channel_property_uint32(self, physical_channel_names: str, prop """ self._interpreter.set_physical_channel_property_uint32(self._session_handle, physical_channel_names, property_name, property_value) - def set_physical_channel_property_uint32_array(self, physical_channel_names: str, property_name: str, property_value: list[int]) -> None: + def set_physical_channel_property_uint32_array(self, property_name: str, property_value: list[int], physical_channel_names: str = '$DefaultPhysChans') -> None: """Set the specified physical channel property to a new value for one or more physical channels. @@ -1620,7 +1620,7 @@ def set_physical_channel_property_uint32_array(self, physical_channel_names: str """ self._interpreter.set_physical_channel_property_uint32_array(self._session_handle, physical_channel_names, property_name, property_value) - def set_physical_channel_property_uint64(self, physical_channel_names: str, property_name: str, property_value: int) -> None: + def set_physical_channel_property_uint64(self, property_name: str, property_value: int, physical_channel_names: str = '$DefaultPhysChans') -> None: """Set the specified physical channel property to a new value for one or more physical channels. @@ -1644,7 +1644,7 @@ def set_physical_channel_property_uint64(self, physical_channel_names: str, prop """ self._interpreter.set_physical_channel_property_uint64(self._session_handle, physical_channel_names, property_name, property_value) - def set_physical_channel_property_uint64_array(self, physical_channel_names: str, property_name: str, property_value: list[int]) -> None: + def set_physical_channel_property_uint64_array(self, property_name: str, property_value: list[int], physical_channel_names: str = '$DefaultPhysChans') -> None: """Set the specified physical channel property to a new value for one or more physical channels. @@ -1668,7 +1668,7 @@ def set_physical_channel_property_uint64_array(self, physical_channel_names: str """ self._interpreter.set_physical_channel_property_uint64_array(self._session_handle, physical_channel_names, property_name, property_value) - def commit_properties_for_devices(self, device_names: str) -> None: + def commit_properties_for_devices(self, device_names: str = '$DefaultDevices') -> None: """Commit all device or physical channels properties with pending changes to hardware for the specified device(s) and the physical channels that they contain. @@ -1683,7 +1683,7 @@ def commit_properties_for_devices(self, device_names: str) -> None: """ self._interpreter.commit_properties_for_devices(self._session_handle, device_names) - def commit_properties_for_physical_channels(self, physical_channel_names: str) -> None: + def commit_properties_for_physical_channels(self, physical_channel_names: str = '$DefaultPhysChans') -> None: """Commit all physical channel properties with pending changes to hardware for the specified physical channel(s). @@ -1724,7 +1724,7 @@ def commit_properties_generic(self, resources: str) -> None: """ self._interpreter.commit_properties_generic(self._session_handle, resources) - def get_nvmem_area_property_bool(self, nvmem_area_names: str, property_name: str) -> bool: + def get_nvmem_area_property_bool(self, property_name: str, nvmem_area_names: str = '$DefaultNVMEMAreas') -> bool: """Get the value of the specified NVMEM area property for one or more NVMEM areas. @@ -1743,7 +1743,7 @@ def get_nvmem_area_property_bool(self, nvmem_area_names: str, property_name: str property_value = self._interpreter.get_nvmem_area_property_bool(self._session_handle, nvmem_area_names, property_name) return property_value - def get_nvmem_area_property_bool_array(self, nvmem_area_names: str, property_name: str) -> list[bool]: + def get_nvmem_area_property_bool_array(self, property_name: str, nvmem_area_names: str = '$DefaultNVMEMAreas') -> list[bool]: """Get the value of the specified NVMEM area property for one or more NVMEM areas. @@ -1762,7 +1762,7 @@ def get_nvmem_area_property_bool_array(self, nvmem_area_names: str, property_nam property_value = self._interpreter.get_nvmem_area_property_bool_array(self._session_handle, nvmem_area_names, property_name) return property_value - def get_nvmem_area_property_string(self, nvmem_area_names: str, property_name: str) -> str: + def get_nvmem_area_property_string(self, property_name: str, nvmem_area_names: str = '$DefaultNVMEMAreas') -> str: """Get the value of the specified NVMEM area property for one or more NVMEM areas. @@ -1781,7 +1781,7 @@ def get_nvmem_area_property_string(self, nvmem_area_names: str, property_name: s property_value = self._interpreter.get_nvmem_area_property_string(self._session_handle, nvmem_area_names, property_name) return property_value - def get_nvmem_area_property_string_array(self, nvmem_area_names: str, property_name: str) -> list[str]: + def get_nvmem_area_property_string_array(self, property_name: str, nvmem_area_names: str = '$DefaultNVMEMAreas') -> list[str]: """Get the value of the specified NVMEM area property for one or more NVMEM areas. @@ -1800,7 +1800,7 @@ def get_nvmem_area_property_string_array(self, nvmem_area_names: str, property_n property_value = self._interpreter.get_nvmem_area_property_string_array(self._session_handle, nvmem_area_names, property_name) return property_value - def get_nvmem_area_property_uint32(self, nvmem_area_names: str, property_name: str) -> int: + def get_nvmem_area_property_uint32(self, property_name: str, nvmem_area_names: str = '$DefaultNVMEMAreas') -> int: """Get the value of the specified NVMEM area property for one or more NVMEM areas. @@ -1819,7 +1819,7 @@ def get_nvmem_area_property_uint32(self, nvmem_area_names: str, property_name: s property_value = self._interpreter.get_nvmem_area_property_uint32(self._session_handle, nvmem_area_names, property_name) return property_value - def get_nvmem_area_property_uint32_array(self, nvmem_area_names: str, property_name: str) -> list[int]: + def get_nvmem_area_property_uint32_array(self, property_name: str, nvmem_area_names: str = '$DefaultNVMEMAreas') -> list[int]: """Get the value of the specified NVMEM area property for one or more NVMEM areas. @@ -2514,7 +2514,7 @@ def set_generic_property_uint64_array(self, resources: str, property_name: str, """ self._interpreter.set_generic_property_uint64_array(self._session_handle, resources, property_name, property_value) - def execute_device_command(self, device_names: str, command_name: str, timeout: float) -> None: + def execute_device_command(self, command_name: str, timeout: float, device_names: str = '$DefaultDevices') -> None: """Execute the specified device command on one or more devices. Commands define how user applications initiate actions or coordinated @@ -2538,7 +2538,7 @@ def execute_device_command(self, device_names: str, command_name: str, timeout: """ self._interpreter.execute_device_command(self._session_handle, device_names, command_name, timeout) - def execute_physical_channel_command(self, physical_channel_names: str, command_name: str, timeout: float) -> None: + def execute_physical_channel_command(self, command_name: str, timeout: float, physical_channel_names: str = '$DefaultPhysChans') -> None: """Execute the specified physical channel command on one or more physical channels. @@ -2588,7 +2588,7 @@ def execute_generic_command(self, resources: str, command_name: str, timeout: fl """ self._interpreter.execute_generic_command(self._session_handle, resources, command_name, timeout) - def read_register_uint8(self, device_name: str, register_address: int) -> int: + def read_register_uint8(self, register_address: int, device_name: str = '$DefaultDevices') -> int: """Read the specified register. To read a single bitfield, consider using properties instead. @@ -2607,7 +2607,7 @@ def read_register_uint8(self, device_name: str, register_address: int) -> int: data = self._interpreter.read_register_uint8(self._session_handle, device_name, register_address) return data - def read_register_uint16(self, device_name: str, register_address: int) -> int: + def read_register_uint16(self, register_address: int, device_name: str = '$DefaultDevices') -> int: """Read the specified register. To read a single bitfield, consider using properties instead. @@ -2626,7 +2626,7 @@ def read_register_uint16(self, device_name: str, register_address: int) -> int: data = self._interpreter.read_register_uint16(self._session_handle, device_name, register_address) return data - def read_register_uint32(self, device_name: str, register_address: int) -> int: + def read_register_uint32(self, register_address: int, device_name: str = '$DefaultDevices') -> int: """Read the specified register. To read a single bitfield, consider using properties instead. @@ -2645,7 +2645,7 @@ def read_register_uint32(self, device_name: str, register_address: int) -> int: data = self._interpreter.read_register_uint32(self._session_handle, device_name, register_address) return data - def read_register_uint64(self, device_name: str, register_address: int) -> int: + def read_register_uint64(self, register_address: int, device_name: str = '$DefaultDevices') -> int: """Read the specified register. To read a single bitfield, consider using properties instead. @@ -2664,7 +2664,7 @@ def read_register_uint64(self, device_name: str, register_address: int) -> int: data = self._interpreter.read_register_uint64(self._session_handle, device_name, register_address) return data - def write_register_uint8(self, device_name: str, register_address: int, data: int) -> None: + def write_register_uint8(self, register_address: int, data: int, device_name: str = '$DefaultDevices') -> None: """Write data to the specified register. To write a single bitfield, consider using properties instead. @@ -2680,7 +2680,7 @@ def write_register_uint8(self, device_name: str, register_address: int, data: in """ self._interpreter.write_register_uint8(self._session_handle, device_name, register_address, data) - def write_register_uint16(self, device_name: str, register_address: int, data: int) -> None: + def write_register_uint16(self, register_address: int, data: int, device_name: str = '$DefaultDevices') -> None: """Write data to the specified register. To write a single bitfield, consider using properties instead. @@ -2696,7 +2696,7 @@ def write_register_uint16(self, device_name: str, register_address: int, data: i """ self._interpreter.write_register_uint16(self._session_handle, device_name, register_address, data) - def write_register_uint32(self, device_name: str, register_address: int, data: int) -> None: + def write_register_uint32(self, register_address: int, data: int, device_name: str = '$DefaultDevices') -> None: """Write data to the specified register. To write a single bitfield, consider using properties instead. @@ -2712,7 +2712,7 @@ def write_register_uint32(self, device_name: str, register_address: int, data: i """ self._interpreter.write_register_uint32(self._session_handle, device_name, register_address, data) - def write_register_uint64(self, device_name: str, register_address: int, data: int) -> None: + def write_register_uint64(self, register_address: int, data: int, device_name: str = '$DefaultDevices') -> None: """Write data to the specified register. To write a single bitfield, consider using properties instead. @@ -2728,7 +2728,7 @@ def write_register_uint64(self, device_name: str, register_address: int, data: i """ self._interpreter.write_register_uint64(self._session_handle, device_name, register_address, data) - def get_nvmem_bytes(self, nvmem_area: str, nvmem_address: int, num_byte: int) -> bytes: + def get_nvmem_bytes(self, nvmem_address: int, num_byte: int, nvmem_area: str = '$DefaultNVMEMAreas') -> bytes: """Get a range of bytes from an NVMEM area. Args: @@ -2742,7 +2742,7 @@ def get_nvmem_bytes(self, nvmem_area: str, nvmem_address: int, num_byte: int) -> byte = self._interpreter.get_nvmem_bytes(self._session_handle, nvmem_area, nvmem_address, num_byte) return byte - def set_nvmem_bytes(self, nvmem_area: str, nvmem_address: int, bytes_data: bytes, serial_number: str, password: str) -> None: + def set_nvmem_bytes(self, nvmem_address: int, bytes_data: bytes, serial_number: str, password: str, nvmem_area: str = '$DefaultNVMEMAreas') -> None: """Set a range of bytes to write to an NVMEM area. The data is cached in the session until the NVMEM area is committed. If @@ -2764,7 +2764,7 @@ def set_nvmem_bytes(self, nvmem_area: str, nvmem_address: int, bytes_data: bytes """ self._interpreter.set_nvmem_bytes(self._session_handle, nvmem_area, nvmem_address, bytes_data, serial_number, password) - def commit_nvmem_areas(self, nvmem_area_names: str) -> None: + def commit_nvmem_areas(self, nvmem_area_names: str = '$DefaultNVMEMAreas') -> None: """Commit pending changes to hardware for the specified NVMEM area(s). Args: @@ -2774,7 +2774,7 @@ def commit_nvmem_areas(self, nvmem_area_names: str) -> None: """ self._interpreter.commit_nvmem_areas(self._session_handle, nvmem_area_names) - def commit_nvmem_for_devices(self, device_names: str) -> None: + def commit_nvmem_for_devices(self, device_names: str = '$DefaultDevices') -> None: """Commit pending changes to hardware for all NVMEM areas on the specified device(s). diff --git a/src/codegen/templates/command.py.mako b/src/codegen/templates/command.py.mako index ee30b11..6aadd3a 100644 --- a/src/codegen/templates/command.py.mako +++ b/src/codegen/templates/command.py.mako @@ -70,9 +70,9 @@ class Command: % if is_class_func(function, "CommandReference") and function["name"] != "CloseProperty": % if is_classmethod(function, "CommandReference"): @classmethod - def ${get_python_function_name(function)}(${", ".join([param for param in get_classmethod_parameter_list(function)])})${get_function_return_type(function, True)}: + def ${get_python_function_name(function)}(${", ".join([param for param in get_classmethod_parameter_list(function, True)])})${get_function_return_type(function, True)}: % else: - def ${get_python_function_name(function)}(${", ".join([param for param in get_function_parameter_list(function, "CommandReference")])})${get_function_return_type(function, True)}: + def ${get_python_function_name(function)}(${", ".join([param for param in get_function_parameter_list(function, "CommandReference", True, False, True, True)])})${get_function_return_type(function, True)}: % endif: % if is_classmethod(function, "CommandReference"): % for docstrings in generate_docstrings(function, "CommandReference", True): diff --git a/src/codegen/templates/library.py.mako b/src/codegen/templates/library.py.mako index a1278c1..97d9e5a 100644 --- a/src/codegen/templates/library.py.mako +++ b/src/codegen/templates/library.py.mako @@ -85,7 +85,7 @@ class Library: % for function in functions: % if 'capi' in function['targets']: % if is_class_func(function, "Library") and function["name"] != "FinalizeLibrary" and function["name"] != "GetExtendedErrorInfo": - def ${get_python_function_name(function, True)}(${", ".join([param for param in get_function_parameter_list(function, "Library", True, True)])})${get_function_return_type(function)}: + def ${get_python_function_name(function, True)}(${", ".join([param for param in get_function_parameter_list(function, "Library", True, True, True, True)])})${get_function_return_type(function)}: % for docstrings in generate_docstrings(function, "Library"): ${docstrings} % endfor diff --git a/src/codegen/templates/property.py.mako b/src/codegen/templates/property.py.mako index 6d27f25..c1952b0 100644 --- a/src/codegen/templates/property.py.mako +++ b/src/codegen/templates/property.py.mako @@ -71,9 +71,9 @@ class Property: % if is_class_func(function, "PropertyReference") and function["name"] != "CloseProperty": % if is_classmethod(function, "PropertyReference"): @classmethod - def ${get_python_function_name(function)}(${", ".join([param for param in get_classmethod_parameter_list(function)])})${get_function_return_type(function, True)}: + def ${get_python_function_name(function)}(${", ".join([param for param in get_classmethod_parameter_list(function, True)])})${get_function_return_type(function, True)}: % else: - def ${get_python_function_name(function)}(${", ".join([param for param in get_function_parameter_list(function, "PropertyReference")])})${get_function_return_type(function, True)}: + def ${get_python_function_name(function)}(${", ".join([param for param in get_function_parameter_list(function, "PropertyReference", True, False, True, True)])})${get_function_return_type(function, True)}: % endif: % if is_classmethod(function, "PropertyReference"): % for docstrings in generate_docstrings(function, "PropertyReference", True): diff --git a/src/codegen/templates/session.py.mako b/src/codegen/templates/session.py.mako index a321001..9b7d4af 100644 --- a/src/codegen/templates/session.py.mako +++ b/src/codegen/templates/session.py.mako @@ -76,9 +76,9 @@ class Session: % if is_class_func(function, "Session") and function["name"] != "CloseSession": % if is_classmethod(function, "Session"): @classmethod - def ${get_python_function_name(function)}(${", ".join([param for param in get_classmethod_parameter_list(function)])})${get_function_return_type(function, True)}: + def ${get_python_function_name(function)}(${", ".join([param for param in get_classmethod_parameter_list(function, True)])})${get_function_return_type(function, True)}: % else: - def ${get_python_function_name(function)}(${", ".join([param for param in get_function_parameter_list(function, "Session")])})${get_function_return_type(function, True)}: + def ${get_python_function_name(function)}(${", ".join([param for param in get_function_parameter_list(function, "Session", True, False, True, True)])})${get_function_return_type(function, True)}: % endif: % if is_classmethod(function, "Session"): % for docstrings in generate_docstrings(function, "Session", True): diff --git a/src/codegen/templates/utils.py.mako b/src/codegen/templates/utils.py.mako index e816413..bb63a10 100644 --- a/src/codegen/templates/utils.py.mako +++ b/src/codegen/templates/utils.py.mako @@ -31,7 +31,7 @@ def _select_interpreter() -> BaseInterpreter: % for function in functions: % if 'capi' in function['targets']: % if remove_all_class_functions(function): -def ${get_python_function_name(function)}(${", ".join([param for param in get_function_parameter_list(function, None, True, False, False)])})${get_function_return_type(function)}: +def ${get_python_function_name(function)}(${", ".join([param for param in get_function_parameter_list(function, None, True, False, False, True)])})${get_function_return_type(function)}: % for docstrings in generate_docstrings(function): ${docstrings} % endfor diff --git a/src/codegen/utilities/function_helpers.py b/src/codegen/utilities/function_helpers.py index c7e47da..98fb1ed 100644 --- a/src/codegen/utilities/function_helpers.py +++ b/src/codegen/utilities/function_helpers.py @@ -133,42 +133,99 @@ def get_ctypes_argtypes(function: dict) -> list[str]: return arg_list -def get_classmethod_parameter_list(function: dict) -> list[str]: +def get_classmethod_parameter_list(function: dict, include_defaults: bool = False) -> list[str]: """Generate the parameters for class methods.""" param_list = [] param_list.append("cls") + signature_params: list[tuple[str, bool]] = [] if "capi" in function["targets"]: for parameter in function["params"]: if is_capi(parameter) and is_param_input(parameter) and "Size" not in parameter["name"]: + default_value = _format_default_value(parameter) if include_defaults else None + has_none_default = _is_none_default(parameter) if include_defaults else False if parameter["dataType"] == "uint8[]": - param_list.append(f"{get_standardized_param_name(parameter)}s_data: bytes") + param_type = _type_with_none_default("bytes", has_none_default) + param = f"{get_standardized_param_name(parameter)}s_data: {param_type}" + if default_value is not None: + param = f"{param} = {default_value}" + signature_params.append((param, default_value is not None)) elif parameter["dataType"] == "enum": - param_list.append( - f"{get_standardized_param_name(parameter)}: {parameter['enumType']}" + param_type = _type_with_none_default(parameter["enumType"], has_none_default) + param = f"{get_standardized_param_name(parameter)}: {param_type}" + if default_value is not None: + param = f"{param} = {default_value}" + signature_params.append( + (param, default_value is not None) ) elif parameter["dataType"] == "Library": - param_list.append("library: Library | None") + param_type = _type_with_none_default("Library | None", has_none_default) + param = f"library: {param_type}" + if default_value is not None: + param = f"{param} = {default_value}" + signature_params.append((param, default_value is not None)) elif parameter["dataType"] == "Session": - param_list.append("session: Session") + param_type = _type_with_none_default("Session", has_none_default) + param = f"session: {param_type}" + if default_value is not None: + param = f"{param} = {default_value}" + signature_params.append((param, default_value is not None)) else: - param_list.append( - f"{get_standardized_param_name(parameter)}: {PYTHON_DATATYPE_MAP.get(parameter['dataType'])}" + param_type = _type_with_none_default( + f"{PYTHON_DATATYPE_MAP.get(parameter['dataType'])}", has_none_default + ) + param = ( + f"{get_standardized_param_name(parameter)}: {param_type}" + ) + if default_value is not None: + param = f"{param} = {default_value}" + signature_params.append( + (param, default_value is not None) ) elif ( is_capi(parameter) and is_param_output(parameter) and parameter["dataType"] == "uint8[]" ): - param_list.append(f"num_{get_standardized_param_name(parameter)}: int") + signature_params.append((f"num_{get_standardized_param_name(parameter)}: int", False)) + param_list.extend(_reorder_signature_parameters(signature_params)) return param_list +def _format_default_value(parameter: dict) -> str | None: + """Convert metadata defaults to Python literals for generated signatures.""" + if "default" not in parameter: + return None + return repr(parameter["default"]) + + +def _is_none_default(parameter: dict) -> bool: + """Check whether metadata explicitly sets a parameter default to None.""" + return "default" in parameter and parameter["default"] is None + + +def _type_with_none_default(type_hint: str, is_none_default: bool) -> str: + """Widen type hints for None defaults without duplicating optional markers.""" + if not is_none_default: + return type_hint + if "None" in type_hint: + return type_hint + return f"{type_hint} | None" + + +def _reorder_signature_parameters(parameters: list[tuple[str, bool]]) -> list[str]: + """Move all required parameters before defaulted ones while preserving relative order.""" + required = [parameter for parameter, has_default in parameters if not has_default] + defaulted = [parameter for parameter, has_default in parameters if has_default] + return required + defaulted + + def get_function_parameter_list( function: dict, class_name: str = None, typing: bool = True, is_language: bool = False, class_func: bool = True, + include_defaults: bool = False, ) -> list[str]: """Generate a list of function parameters for a Python API function. @@ -183,6 +240,9 @@ def get_function_parameter_list( with a default value of Language.UNDEFINED. class_func: If True, indicates that the function is a class function. + include_defaults: If True, include parameter defaults + from metadata and reorder parameters so required + parameters appear before defaulted parameters. Returns: param_list: A list of parameter strings for the function definition. @@ -190,6 +250,7 @@ def get_function_parameter_list( param_list = [] if "capi" in function["targets"]: if typing: + signature_params: list[tuple[str, bool]] = [] if class_func: param_list.append("self") for parameter in function["params"]: @@ -199,24 +260,37 @@ def get_function_parameter_list( and "Size" not in parameter["name"] and parameter["dataType"] != class_name ): + default_value = _format_default_value(parameter) if include_defaults else None + has_none_default = _is_none_default(parameter) if include_defaults else False if parameter["dataType"] == "uint8[]": - param_list.append(f"{get_standardized_param_name(parameter)}s_data: bytes") + param_type = _type_with_none_default("bytes", has_none_default) + param = f"{get_standardized_param_name(parameter)}s_data: {param_type}" + if default_value is not None: + param = f"{param} = {default_value}" + signature_params.append((param, default_value is not None)) elif parameter["name"] == "language" and is_language: - param_list.append("language: Language = Language.UNDEFINED") + signature_params.append(("language: Language = Language.UNDEFINED", True)) elif parameter["dataType"] == "enum": - param_list.append( - f"{get_standardized_param_name(parameter)}: {parameter['enumType']}" - ) + param_type = _type_with_none_default(parameter["enumType"], has_none_default) + param = f"{get_standardized_param_name(parameter)}: {param_type}" + if default_value is not None: + param = f"{param} = {default_value}" + signature_params.append((param, default_value is not None)) else: - param_list.append( - f"{get_standardized_param_name(parameter)}: {PYTHON_DATATYPE_MAP.get(parameter['dataType'])}" + param_type = _type_with_none_default( + f"{PYTHON_DATATYPE_MAP.get(parameter['dataType'])}", has_none_default ) + param = f"{get_standardized_param_name(parameter)}: {param_type}" + if default_value is not None: + param = f"{param} = {default_value}" + signature_params.append((param, default_value is not None)) elif ( is_capi(parameter) and is_param_output(parameter) and parameter["dataType"] == "uint8[]" ): - param_list.append(f"num_{get_standardized_param_name(parameter)}: int") + signature_params.append((f"num_{get_standardized_param_name(parameter)}: int", False)) + param_list.extend(_reorder_signature_parameters(signature_params)) else: for parameter in function["params"]: if ( From 646ecac50fc503a38f80b75b41b5b72722eff744 Mon Sep 17 00:00:00 2001 From: zoechanzy Date: Thu, 6 Aug 2026 12:46:36 +0800 Subject: [PATCH 3/6] default value: Add default value for library parameter * Added default value of None for the library parameter * Regenerate generated Python module files --------- Signed-off-by: zoechanzy --- generated/nislsc/session.py | 8 ++--- src/codegen/utilities/function_helpers.py | 42 +++++++++++++---------- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/generated/nislsc/session.py b/generated/nislsc/session.py index 1ca6f6e..1872430 100644 --- a/generated/nislsc/session.py +++ b/generated/nislsc/session.py @@ -67,7 +67,7 @@ def close(self) -> None: self._owns_library = False @classmethod - def initialize_session_with_devices(cls, library: Library | None, device_names: str, reservation_access: ReservationAccess, reservation_group: str, connection_timeout: float = -1, reservation_timeout: float = -1) -> Self: + def initialize_session_with_devices(cls, device_names: str, reservation_access: ReservationAccess, reservation_group: str, library: Library | None = None, connection_timeout: float = -1, reservation_timeout: float = -1) -> Self: """Initialize an SLSC session with one or multiple devices. The session opens network connections for devices. If reservationAccess @@ -110,7 +110,7 @@ def initialize_session_with_devices(cls, library: Library | None, device_names: return cls(library, session_handle, owns_library) @classmethod - def initialize_session_with_nvmem_areas(cls, library: Library | None, nvmem_area_names: str, reservation_access: ReservationAccess, reservation_group: str, connection_timeout: float = -1, reservation_timeout: float = -1) -> Self: + def initialize_session_with_nvmem_areas(cls, nvmem_area_names: str, reservation_access: ReservationAccess, reservation_group: str, library: Library | None = None, connection_timeout: float = -1, reservation_timeout: float = -1) -> Self: """Initialize an SLSC session with one or multiple NVMEM areas. The session opens network connections for NVMEM areas. If @@ -155,7 +155,7 @@ def initialize_session_with_nvmem_areas(cls, library: Library | None, nvmem_area return cls(library, session_handle, owns_library) @classmethod - def initialize_session_with_physical_channels(cls, library: Library | None, physical_channel_names: str, reservation_access: ReservationAccess, reservation_group: str, connection_timeout: float = -1, reservation_timeout: float = -1) -> Self: + def initialize_session_with_physical_channels(cls, physical_channel_names: str, reservation_access: ReservationAccess, reservation_group: str, library: Library | None = None, connection_timeout: float = -1, reservation_timeout: float = -1) -> Self: """Initialize an SLSC session with one or multiple physical channels. The session opens network connections for devices that correspond to the @@ -203,7 +203,7 @@ def initialize_session_with_physical_channels(cls, library: Library | None, phys return cls(library, session_handle, owns_library) @classmethod - def initialize_session_without_resources(cls, library: Library | None) -> Self: + def initialize_session_without_resources(cls, library: Library | None = None) -> Self: """Initialize an SLSC session without specifying any resources or opening any network connections. diff --git a/src/codegen/utilities/function_helpers.py b/src/codegen/utilities/function_helpers.py index 98fb1ed..1287621 100644 --- a/src/codegen/utilities/function_helpers.py +++ b/src/codegen/utilities/function_helpers.py @@ -154,15 +154,11 @@ def get_classmethod_parameter_list(function: dict, include_defaults: bool = Fals param = f"{get_standardized_param_name(parameter)}: {param_type}" if default_value is not None: param = f"{param} = {default_value}" - signature_params.append( - (param, default_value is not None) - ) + signature_params.append((param, default_value is not None)) elif parameter["dataType"] == "Library": param_type = _type_with_none_default("Library | None", has_none_default) - param = f"library: {param_type}" - if default_value is not None: - param = f"{param} = {default_value}" - signature_params.append((param, default_value is not None)) + param = f"library: {param_type} = None" + signature_params.append((param, True)) elif parameter["dataType"] == "Session": param_type = _type_with_none_default("Session", has_none_default) param = f"session: {param_type}" @@ -171,22 +167,24 @@ def get_classmethod_parameter_list(function: dict, include_defaults: bool = Fals signature_params.append((param, default_value is not None)) else: param_type = _type_with_none_default( - f"{PYTHON_DATATYPE_MAP.get(parameter['dataType'])}", has_none_default - ) - param = ( - f"{get_standardized_param_name(parameter)}: {param_type}" + f"{PYTHON_DATATYPE_MAP.get(parameter['dataType'])}", + has_none_default, ) + param = f"{get_standardized_param_name(parameter)}: {param_type}" if default_value is not None: param = f"{param} = {default_value}" - signature_params.append( - (param, default_value is not None) - ) + signature_params.append((param, default_value is not None)) elif ( is_capi(parameter) and is_param_output(parameter) and parameter["dataType"] == "uint8[]" ): - signature_params.append((f"num_{get_standardized_param_name(parameter)}: int", False)) + signature_params.append( + ( + f"num_{get_standardized_param_name(parameter)}: int", + False, + ) + ) param_list.extend(_reorder_signature_parameters(signature_params)) return param_list @@ -271,14 +269,17 @@ def get_function_parameter_list( elif parameter["name"] == "language" and is_language: signature_params.append(("language: Language = Language.UNDEFINED", True)) elif parameter["dataType"] == "enum": - param_type = _type_with_none_default(parameter["enumType"], has_none_default) + param_type = _type_with_none_default( + parameter["enumType"], has_none_default + ) param = f"{get_standardized_param_name(parameter)}: {param_type}" if default_value is not None: param = f"{param} = {default_value}" signature_params.append((param, default_value is not None)) else: param_type = _type_with_none_default( - f"{PYTHON_DATATYPE_MAP.get(parameter['dataType'])}", has_none_default + f"{PYTHON_DATATYPE_MAP.get(parameter['dataType'])}", + has_none_default, ) param = f"{get_standardized_param_name(parameter)}: {param_type}" if default_value is not None: @@ -289,7 +290,12 @@ def get_function_parameter_list( and is_param_output(parameter) and parameter["dataType"] == "uint8[]" ): - signature_params.append((f"num_{get_standardized_param_name(parameter)}: int", False)) + signature_params.append( + ( + f"num_{get_standardized_param_name(parameter)}: int", + False, + ) + ) param_list.extend(_reorder_signature_parameters(signature_params)) else: for parameter in function["params"]: From 7dd42d634c7b56e99da6f6b508e7be75835dd6a8 Mon Sep 17 00:00:00 2001 From: zoechanzy Date: Fri, 7 Aug 2026 09:17:24 +0800 Subject: [PATCH 4/6] default value: Update unit tests for new defaults * Refactor parameter ordering in unit tests --------- Signed-off-by: zoechanzy --- tests/unit/conftest.py | 7 ++- tests/unit/test_session.py | 114 ++++++++++++++++++++++++++++--------- 2 files changed, 93 insertions(+), 28 deletions(-) diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index 8c27214..b6246f7 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -57,6 +57,11 @@ def session(library: Library, interpreter: Mock) -> Generator[Session, None, Non """ expect_initialize_session_with_devices(interpreter) with Session.initialize_session_with_devices( - library, "Dev1", -1.0, ReservationAccess.NONE, "", -1.0 + "Dev1", + ReservationAccess.NONE, + "", + library=library, + connection_timeout=-1.0, + reservation_timeout=-1.0, ) as sess: yield sess diff --git a/tests/unit/test_session.py b/tests/unit/test_session.py index 59bff71..2b91cff 100644 --- a/tests/unit/test_session.py +++ b/tests/unit/test_session.py @@ -24,7 +24,12 @@ def test___library_provided___initialize_session_with_devices___session_handle_i expect_initialize_session_with_devices(interpreter, 100) with Session.initialize_session_with_devices( - library, "Dev1", -1.0, ReservationAccess.NONE, "", -1.0 + "Dev1", + ReservationAccess.NONE, + "", + library=library, + connection_timeout=-1.0, + reservation_timeout=-1.0, ) as session: assert session._session_handle == 100 interpreter.initialize_session_with_devices.assert_called_once() @@ -36,7 +41,12 @@ def test___library_provided___initialize_session_with_devices___owns_library_is_ expect_initialize_session_with_devices(interpreter) with Session.initialize_session_with_devices( - library, "Dev1", -1.0, ReservationAccess.NONE, "", -1.0 + "Dev1", + ReservationAccess.NONE, + "", + library=library, + connection_timeout=-1.0, + reservation_timeout=-1.0, ) as session: assert not session._owns_library @@ -48,7 +58,12 @@ def test___no_library___initialize_session_with_devices___library_created_and_ow expect_initialize_session_with_devices(interpreter) with Session.initialize_session_with_devices( - None, "Dev1", -1.0, ReservationAccess.NONE, "", -1.0 + "Dev1", + ReservationAccess.NONE, + "", + library=None, + connection_timeout=-1.0, + reservation_timeout=-1.0, ) as session: assert session._owns_library assert session._library is not None @@ -61,7 +76,12 @@ def test___library_provided___initialize_session_with_devices___interpreter_call library_handle = library._interpreter._library_handle with Session.initialize_session_with_devices( - library, "Dev1,Dev2", 5.0, ReservationAccess.READ_WRITE, "MyGroup", 10.0 + "Dev1,Dev2", + ReservationAccess.READ_WRITE, + "MyGroup", + library=library, + connection_timeout=5.0, + reservation_timeout=10.0, ): interpreter.initialize_session_with_devices.assert_called_once_with( library_handle, @@ -82,7 +102,12 @@ def test___interpreter_raises_error___initialize_session_with_devices___slsc_err with pytest.raises(SLSCError) as exc_info: Session.initialize_session_with_devices( - library, "Dev1", -1.0, ReservationAccess.NONE, "", -1.0 + "Dev1", + ReservationAccess.NONE, + "", + library=library, + connection_timeout=-1.0, + reservation_timeout=-1.0, ) assert exc_info.value.error_code == -250806 @@ -153,7 +178,12 @@ def test___library_provided___initialize_session_with_nvmem_areas___session_hand expect_initialize_session_with_nvmem_areas(interpreter, 200) with Session.initialize_session_with_nvmem_areas( - library, "Area1", -1.0, ReservationAccess.NONE, "", -1.0 + "Area1", + ReservationAccess.NONE, + "", + library=library, + connection_timeout=-1.0, + reservation_timeout=-1.0, ) as session: assert session._session_handle == 200 interpreter.initialize_session_with_nvmem_areas.assert_called_once() @@ -166,7 +196,12 @@ def test___no_library___initialize_session_with_nvmem_areas___library_created_an expect_initialize_session_with_nvmem_areas(interpreter) with Session.initialize_session_with_nvmem_areas( - None, "Area1", -1.0, ReservationAccess.NONE, "", -1.0 + "Area1", + ReservationAccess.NONE, + "", + library=None, + connection_timeout=-1.0, + reservation_timeout=-1.0, ) as session: assert session._owns_library @@ -177,7 +212,12 @@ def test___library_provided___initialize_session_with_physical_channels___sessio expect_initialize_session_with_physical_channels(interpreter, 300) with Session.initialize_session_with_physical_channels( - library, "Dev1/phys0", -1.0, ReservationAccess.NONE, "", -1.0 + "Dev1/phys0", + ReservationAccess.NONE, + "", + library=library, + connection_timeout=-1.0, + reservation_timeout=-1.0, ) as session: assert session._session_handle == 300 interpreter.initialize_session_with_physical_channels.assert_called_once() @@ -190,7 +230,12 @@ def test___no_library___initialize_session_with_physical_channels___library_crea expect_initialize_session_with_physical_channels(interpreter) with Session.initialize_session_with_physical_channels( - None, "Dev1/phys0", -1.0, ReservationAccess.NONE, "", -1.0 + "Dev1/phys0", + ReservationAccess.NONE, + "", + library=None, + connection_timeout=-1.0, + reservation_timeout=-1.0, ) as session: assert session._owns_library @@ -200,7 +245,7 @@ def test___library_provided___initialize_session_without_resources___session_han ) -> None: expect_initialize_session_without_resources(interpreter, 400) - with Session.initialize_session_without_resources(library) as session: + with Session.initialize_session_without_resources(library=library) as session: assert session._session_handle == 400 interpreter.initialize_session_without_resources.assert_called_once() @@ -211,7 +256,7 @@ def test___no_library___initialize_session_without_resources___library_created_a expect_initialize_library(interpreter) expect_initialize_session_without_resources(interpreter) - with Session.initialize_session_without_resources(None) as session: + with Session.initialize_session_without_resources(library=None) as session: assert session._owns_library @@ -243,7 +288,12 @@ def test___context_manager___close___close_session_called_on_exit( expect_initialize_session_with_devices(interpreter, 100) with Session.initialize_session_with_devices( - library, "Dev1", -1.0, ReservationAccess.NONE, "", -1.0 + "Dev1", + ReservationAccess.NONE, + "", + library=library, + connection_timeout=-1.0, + reservation_timeout=-1.0, ): interpreter.close_session.assert_not_called() @@ -257,7 +307,12 @@ def test___close_owns_library___close___finalize_library_also_called( expect_initialize_session_with_devices(interpreter, 100) session = Session.initialize_session_with_devices( - None, "Dev1", -1.0, ReservationAccess.NONE, "", -1.0 + "Dev1", + ReservationAccess.NONE, + "", + library=None, + connection_timeout=-1.0, + reservation_timeout=-1.0, ) session.close() @@ -270,7 +325,12 @@ def test___close_does_not_own_library___close___finalize_library_not_called( ) -> None: expect_initialize_session_with_devices(interpreter, 100) session = Session.initialize_session_with_devices( - library, "Dev1", -1.0, ReservationAccess.NONE, "", -1.0 + "Dev1", + ReservationAccess.NONE, + "", + library=library, + connection_timeout=-1.0, + reservation_timeout=-1.0, ) session.close() @@ -293,7 +353,7 @@ def test___session_opened___log_in___interpreter_called_with_args( ) -> None: session_handle = session._session_handle - session.log_in("Chassis1", "admin", "secret", 10.0, False) + session.log_in("Chassis1", "admin", "secret", False, 10.0) interpreter.log_in.assert_called_once_with( session_handle, "Chassis1", "admin", "secret", 10.0, False @@ -349,7 +409,7 @@ def test___session_opened___reserve_devices___interpreter_called_with_args( ) -> None: session_handle = session._session_handle - session.reserve_devices("Dev1", ReservationAccess.READ_WRITE, "MyGroup", 30.0) + session.reserve_devices(ReservationAccess.READ_WRITE, "MyGroup", "Dev1", 30.0) interpreter.reserve_devices.assert_called_once_with( session_handle, "Dev1", ReservationAccess.READ_WRITE, "MyGroup", 30.0 @@ -447,7 +507,7 @@ def test___session_opened___get_device_property___returns_value( getattr(interpreter, method).return_value = value session_handle = session._session_handle - result = getattr(session, method)("Dev1", prop) + result = getattr(session, method)(prop, "Dev1") getattr(interpreter, method).assert_called_once_with(session_handle, "Dev1", prop) assert result == value @@ -477,7 +537,7 @@ def test___session_opened___set_device_property___interpreter_called_with_args( ) -> None: session_handle = session._session_handle - getattr(session, method)("Dev1", prop, value) + getattr(session, method)(prop, value, "Dev1") getattr(interpreter, method).assert_called_once_with(session_handle, "Dev1", prop, value) @@ -582,7 +642,7 @@ def test___session_opened___get_physical_channel_property___returns_value( getattr(interpreter, method).return_value = value session_handle = session._session_handle - result = getattr(session, method)(resource, prop) + result = getattr(session, method)(prop, resource) getattr(interpreter, method).assert_called_once_with(session_handle, resource, prop) assert result == value @@ -668,7 +728,7 @@ def test___session_opened___set_physical_channel_property___interpreter_called_w ) -> None: session_handle = session._session_handle - getattr(session, method)("Dev1/phys0", prop, value) + getattr(session, method)(prop, value, "Dev1/phys0") getattr(interpreter, method).assert_called_once_with(session_handle, "Dev1/phys0", prop, value) @@ -732,7 +792,7 @@ def test___session_opened___get_nvmem_area_property___returns_value( getattr(interpreter, method).return_value = value session_handle = session._session_handle - result = getattr(session, method)("Area1", prop) + result = getattr(session, method)(prop, "Area1") getattr(interpreter, method).assert_called_once_with(session_handle, "Area1", prop) assert result == value @@ -873,7 +933,7 @@ def test___session_opened___execute_device_command___interpreter_called_with_arg ) -> None: session_handle = session._session_handle - session.execute_device_command("Dev1", "Reset", 10.0) + session.execute_device_command("Reset", 10.0, "Dev1") interpreter.execute_device_command.assert_called_once_with( session_handle, "Dev1", "Reset", 10.0 @@ -885,7 +945,7 @@ def test___session_opened___execute_physical_channel_command___interpreter_calle ) -> None: session_handle = session._session_handle - session.execute_physical_channel_command("Dev1/phys0", "Calibrate", 5.0) + session.execute_physical_channel_command("Calibrate", 5.0, "Dev1/phys0") interpreter.execute_physical_channel_command.assert_called_once_with( session_handle, "Dev1/phys0", "Calibrate", 5.0 @@ -919,7 +979,7 @@ def test___session_opened___read_register___returns_value( getattr(interpreter, method).return_value = value session_handle = session._session_handle - result = getattr(session, method)("Dev1", address) + result = getattr(session, method)(address, "Dev1") getattr(interpreter, method).assert_called_once_with(session_handle, "Dev1", address) assert result == value @@ -939,7 +999,7 @@ def test___session_opened___write_register___interpreter_called_with_args( ) -> None: session_handle = session._session_handle - getattr(session, method)("Dev1", address, value) + getattr(session, method)(address, value, "Dev1") getattr(interpreter, method).assert_called_once_with(session_handle, "Dev1", address, value) @@ -950,7 +1010,7 @@ def test___session_opened___get_nvmem_bytes___returns_value( interpreter.get_nvmem_bytes.return_value = b"\x01\x02\x03" session_handle = session._session_handle - result = session.get_nvmem_bytes("Area1", 0, 3) + result = session.get_nvmem_bytes(0, 3, "Area1") interpreter.get_nvmem_bytes.assert_called_once_with(session_handle, "Area1", 0, 3) assert result == b"\x01\x02\x03" @@ -961,7 +1021,7 @@ def test___session_opened___set_nvmem_bytes___interpreter_called_with_args( ) -> None: session_handle = session._session_handle - session.set_nvmem_bytes("Area1", 0, b"\x01\x02\x03", "SN001", "pass") + session.set_nvmem_bytes(0, b"\x01\x02\x03", "SN001", "pass", "Area1") interpreter.set_nvmem_bytes.assert_called_once_with( session_handle, "Area1", 0, b"\x01\x02\x03", "SN001", "pass" From fdd3ed9fbd2343545f60a729e269f99c7535ce61 Mon Sep 17 00:00:00 2001 From: zoechanzy Date: Fri, 7 Aug 2026 09:25:21 +0800 Subject: [PATCH 5/6] default value: Update examples for new defaults * Refactor parameter ordering in examples to match new defaults --------- Signed-off-by: zoechanzy --- examples/check_chassis_battery.py | 10 +++++----- examples/reset_device.py | 4 ++-- examples/show_command_and_property_tree.py | 16 ++++++++-------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/examples/check_chassis_battery.py b/examples/check_chassis_battery.py index 5ea26c8..980e6ee 100644 --- a/examples/check_chassis_battery.py +++ b/examples/check_chassis_battery.py @@ -28,24 +28,24 @@ def main(chassis_name: str) -> None: reservation_timeout = 10.0 with Session.initialize_session_with_physical_channels( - None, physical_channel_names=physical_channel_names, - connection_timeout=connection_timeout, reservation_access=reservation_access, reservation_group=reservation_group, + library=None, + connection_timeout=connection_timeout, reservation_timeout=reservation_timeout, ) as session: sensor_lower_critical = session.get_physical_channel_property_double( - physical_channel_names=physical_channel_names, property_name="SensorLowerCritical", + physical_channel_names=physical_channel_names, ) sensor_reading = session.get_physical_channel_property_double( - physical_channel_names=physical_channel_names, property_name="SensorReading", + physical_channel_names=physical_channel_names, ) health_state = session.get_physical_channel_property_string( - physical_channel_names=physical_channel_names, property_name="HealthState", + physical_channel_names=physical_channel_names, ) needs_replacement = sensor_reading < sensor_lower_critical diff --git a/examples/reset_device.py b/examples/reset_device.py index f62180f..5a821de 100644 --- a/examples/reset_device.py +++ b/examples/reset_device.py @@ -28,11 +28,11 @@ def main(device_names: str) -> None: reservation_timeout = 10.0 with Session.initialize_session_with_devices( - None, device_names=device_names, - connection_timeout=connection_timeout, reservation_access=reservation_access, reservation_group=reservation_group, + library=None, + connection_timeout=connection_timeout, reservation_timeout=reservation_timeout, ) as session: session.reset_devices(device_names) diff --git a/examples/show_command_and_property_tree.py b/examples/show_command_and_property_tree.py index 63b86a6..ac05b98 100644 --- a/examples/show_command_and_property_tree.py +++ b/examples/show_command_and_property_tree.py @@ -55,12 +55,12 @@ def get_command_and_property_tree(device_name: str) -> dict: reservation_timeout = 10.0 with Session.initialize_session_with_devices( - None, device_name, - connection_timeout, reservation_access, reservation_group, - reservation_timeout, + library=None, + connection_timeout=connection_timeout, + reservation_timeout=reservation_timeout, ) as session: data = { @@ -70,18 +70,18 @@ def get_command_and_property_tree(device_name: str) -> dict: } device_commands = session.get_device_property_string_array( - device_name, DeviceProperty.COMMANDS, + device_name, ) device_properties = session.get_device_property_string_array( - device_name, DeviceProperty.PROPERTIES, + device_name, ) device_physical_channels = session.get_device_property_string_array( - device_name, DeviceProperty.PHYSICAL_CHANNELS, + device_name, ) for physical_channel in device_physical_channels: @@ -138,10 +138,10 @@ def get_command_and_property_tree(device_name: str) -> dict: for physical_channel in device_physical_channels: physical_channel_commands = session.get_physical_channel_property_string_array( - physical_channel, PhysicalChannelProperty.COMMANDS + PhysicalChannelProperty.COMMANDS, physical_channel ) physical_channel_properties = session.get_physical_channel_property_string_array( - physical_channel, PhysicalChannelProperty.PROPERTIES + PhysicalChannelProperty.PROPERTIES, physical_channel ) for physical_channel_command in physical_channel_commands: From 0bf3a56105076c3a1c30f71c3cdae795cecf1d99 Mon Sep 17 00:00:00 2001 From: zoechanzy Date: Fri, 7 Aug 2026 13:05:54 +0800 Subject: [PATCH 6/6] fix: convert integer defaults to float for double and TimeoutSeconds types --------- Signed-off-by: zoechanzy --- generated/nislsc/session.py | 18 +++++++++--------- src/codegen/utilities/function_helpers.py | 6 +++++- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/generated/nislsc/session.py b/generated/nislsc/session.py index 1872430..8af571a 100644 --- a/generated/nislsc/session.py +++ b/generated/nislsc/session.py @@ -67,7 +67,7 @@ def close(self) -> None: self._owns_library = False @classmethod - def initialize_session_with_devices(cls, device_names: str, reservation_access: ReservationAccess, reservation_group: str, library: Library | None = None, connection_timeout: float = -1, reservation_timeout: float = -1) -> Self: + def initialize_session_with_devices(cls, device_names: str, reservation_access: ReservationAccess, reservation_group: str, library: Library | None = None, connection_timeout: float = -1.0, reservation_timeout: float = -1.0) -> Self: """Initialize an SLSC session with one or multiple devices. The session opens network connections for devices. If reservationAccess @@ -110,7 +110,7 @@ def initialize_session_with_devices(cls, device_names: str, reservation_access: return cls(library, session_handle, owns_library) @classmethod - def initialize_session_with_nvmem_areas(cls, nvmem_area_names: str, reservation_access: ReservationAccess, reservation_group: str, library: Library | None = None, connection_timeout: float = -1, reservation_timeout: float = -1) -> Self: + def initialize_session_with_nvmem_areas(cls, nvmem_area_names: str, reservation_access: ReservationAccess, reservation_group: str, library: Library | None = None, connection_timeout: float = -1.0, reservation_timeout: float = -1.0) -> Self: """Initialize an SLSC session with one or multiple NVMEM areas. The session opens network connections for NVMEM areas. If @@ -155,7 +155,7 @@ def initialize_session_with_nvmem_areas(cls, nvmem_area_names: str, reservation_ return cls(library, session_handle, owns_library) @classmethod - def initialize_session_with_physical_channels(cls, physical_channel_names: str, reservation_access: ReservationAccess, reservation_group: str, library: Library | None = None, connection_timeout: float = -1, reservation_timeout: float = -1) -> Self: + def initialize_session_with_physical_channels(cls, physical_channel_names: str, reservation_access: ReservationAccess, reservation_group: str, library: Library | None = None, connection_timeout: float = -1.0, reservation_timeout: float = -1.0) -> Self: """Initialize an SLSC session with one or multiple physical channels. The session opens network connections for devices that correspond to the @@ -239,7 +239,7 @@ def abort_session(self) -> None: """ self._interpreter.abort_session(self._session_handle) - def log_in(self, chassis_name: str, username: str, password: str, save_credentials_to_disk: bool, connection_timeout: float = -1) -> None: + def log_in(self, chassis_name: str, username: str, password: str, save_credentials_to_disk: bool, connection_timeout: float = -1.0) -> None: """Attempt to connect and log in to the specified SLSC chassis. If successful, the username and password are cached on the local system @@ -297,7 +297,7 @@ def log_out(self, chassis_name: str) -> None: """ self._interpreter.log_out(self._session_handle, chassis_name) - def connect_to_devices(self, device_names: str = '$DefaultDevices', connection_timeout: float = -1) -> None: + def connect_to_devices(self, device_names: str = '$DefaultDevices', connection_timeout: float = -1.0) -> None: """Open network connections for the specified device(s), sharing connections to the same SLSC chassis. @@ -332,7 +332,7 @@ def disconnect_from_devices(self, device_names: str = '$DefaultDevices') -> None """ self._interpreter.disconnect_from_devices(self._session_handle, device_names) - def connect_to_chassis_by_address(self, address: str, username: str, password: str, connection_timeout: float = -1) -> str: + def connect_to_chassis_by_address(self, address: str, username: str, password: str, connection_timeout: float = -1.0) -> str: """Open a network connection for a chassis by the specified IP address or hostname. @@ -353,7 +353,7 @@ def connect_to_chassis_by_address(self, address: str, username: str, password: s chassis_name = self._interpreter.connect_to_chassis_by_address(self._session_handle, address, username, password, connection_timeout) return chassis_name - def reserve_devices(self, reservation_access: ReservationAccess, reservation_group: str, device_names: str = '$DefaultDevices', reservation_timeout: float = -1) -> None: + def reserve_devices(self, reservation_access: ReservationAccess, reservation_group: str, device_names: str = '$DefaultDevices', reservation_timeout: float = -1.0) -> None: """Reserve the specified device(s), which prevents other sessions from accessing them. @@ -425,7 +425,7 @@ def rename_device(self, device_name: str, new_device_name: str) -> None: """ self._interpreter.rename_device(self._session_handle, device_name, new_device_name) - def update_system_configuration_file(self, chassis_name: str, connection_timeout: float = -1) -> None: + def update_system_configuration_file(self, chassis_name: str, connection_timeout: float = -1.0) -> None: """Update the information of the specified chassis and its modules in the local configuration file. @@ -442,7 +442,7 @@ def update_system_configuration_file(self, chassis_name: str, connection_timeout """ self._interpreter.update_system_configuration_file(self._session_handle, chassis_name, connection_timeout) - def add_network_chassis(self, address: str, username: str, password: str, connection_timeout: float = -1) -> str: + def add_network_chassis(self, address: str, username: str, password: str, connection_timeout: float = -1.0) -> str: """Connect to the specified network chassis, adds the chassis and its modules to the system, and saves them to the local configuration file. diff --git a/src/codegen/utilities/function_helpers.py b/src/codegen/utilities/function_helpers.py index 1287621..1451a0f 100644 --- a/src/codegen/utilities/function_helpers.py +++ b/src/codegen/utilities/function_helpers.py @@ -193,7 +193,11 @@ def _format_default_value(parameter: dict) -> str | None: """Convert metadata defaults to Python literals for generated signatures.""" if "default" not in parameter: return None - return repr(parameter["default"]) + default = parameter["default"] + + if isinstance(default, int) and parameter.get("dataType") in {"double", "TimeoutSeconds"}: + default = float(default) + return repr(default) def _is_none_default(parameter: dict) -> bool: