From 3bdf708729e47335a780c0ef753e4f2779a10aac Mon Sep 17 00:00:00 2001 From: zoechanzy Date: Thu, 6 Aug 2026 09:47:43 +0800 Subject: [PATCH 01/19] 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 02/19] 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 03/19] 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 04/19] 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 14f3ae735c6a22401e75104651e16dab2705e516 Mon Sep 17 00:00:00 2001 From: zoechanzy Date: Fri, 7 Aug 2026 09:25:21 +0800 Subject: [PATCH 05/19] default value: Update examples for new defaults * Refactor parameter ordering in examples to match new defaults * Remove library,connection_timeout and reservation_timeout parameters from examples since they have default values. --------- Signed-off-by: zoechanzy --- examples/check_chassis_battery.py | 11 +++-------- examples/reset_device.py | 5 ----- examples/show_command_and_property_tree.py | 15 +++++---------- 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/examples/check_chassis_battery.py b/examples/check_chassis_battery.py index 5ea26c8..d89a8f6 100644 --- a/examples/check_chassis_battery.py +++ b/examples/check_chassis_battery.py @@ -22,30 +22,25 @@ def main(chassis_name: str) -> None: """ # noqa: D301 try: physical_channel_names = f"{chassis_name}/BatteryVoltageSensor" - connection_timeout = 10.0 reservation_access = ReservationAccess.READ_ONLY reservation_group = "admin" - 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, - 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..cdc46f1 100644 --- a/examples/reset_device.py +++ b/examples/reset_device.py @@ -22,18 +22,13 @@ def main(device_names: str) -> None: reset_device SLSC-12001-XXXXXXXX-Mod1,SLSC-12001-XXXXXXXX-Mod2 """ # noqa: D301 try: - connection_timeout = 10.0 reservation_access = ReservationAccess.READ_ONLY reservation_group = "admin" - 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, - reservation_timeout=reservation_timeout, ) as session: session.reset_devices(device_names) print(f"Reset command sent to device(s) {device_names}") diff --git a/examples/show_command_and_property_tree.py b/examples/show_command_and_property_tree.py index 63b86a6..9a2ae66 100644 --- a/examples/show_command_and_property_tree.py +++ b/examples/show_command_and_property_tree.py @@ -49,18 +49,13 @@ def get_command_and_property_tree(device_name: str) -> dict: Returns: Dictionary containing the command and property tree of the device. """ - connection_timeout = 10.0 reservation_access = ReservationAccess.READ_ONLY reservation_group = "admin" - reservation_timeout = 10.0 with Session.initialize_session_with_devices( - None, device_name, - connection_timeout, reservation_access, reservation_group, - reservation_timeout, ) as session: data = { @@ -70,18 +65,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 +133,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 30845a7f2d8735a8da7e3bc61dbe38787ba3795a Mon Sep 17 00:00:00 2001 From: zoechanzy Date: Fri, 7 Aug 2026 13:05:54 +0800 Subject: [PATCH 06/19] 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: From 21b56695539417f4faac2e376e154d53c9d2fb43 Mon Sep 17 00:00:00 2001 From: zoechanzy Date: Wed, 12 Aug 2026 20:03:45 +0800 Subject: [PATCH 07/19] fix: use named parameters for get_function_parameter_list * Add * in get_function_parameter_list to make the Booleans keyword-only * Remove argument from get_function_parameter_list if the argument have default value. * Use named parameters for get_function_parameter_list to avoid ambiguity --- 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 | 4 ++-- src/codegen/utilities/function_helpers.py | 11 ++++++----- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/codegen/templates/command.py.mako b/src/codegen/templates/command.py.mako index 6aadd3a..db95a77 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, True)])})${get_function_return_type(function, True)}: + def ${get_python_function_name(function)}(${", ".join([param for param in get_classmethod_parameter_list(function, include_defaults=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", True, False, True, True)])})${get_function_return_type(function, True)}: + def ${get_python_function_name(function)}(${", ".join([param for param in get_function_parameter_list(function, "CommandReference", include_defaults=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 97d9e5a..5146a66 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, 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", is_language=True, include_defaults=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 c1952b0..c28fe57 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, True)])})${get_function_return_type(function, True)}: + def ${get_python_function_name(function)}(${", ".join([param for param in get_classmethod_parameter_list(function, include_defaults=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", True, False, True, True)])})${get_function_return_type(function, True)}: + def ${get_python_function_name(function)}(${", ".join([param for param in get_function_parameter_list(function, "PropertyReference", include_defaults=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 9b7d4af..c100f80 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, True)])})${get_function_return_type(function, True)}: + def ${get_python_function_name(function)}(${", ".join([param for param in get_classmethod_parameter_list(function, include_defaults=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", True, False, True, True)])})${get_function_return_type(function, True)}: + def ${get_python_function_name(function)}(${", ".join([param for param in get_function_parameter_list(function, "Session", include_defaults=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 bb63a10..ae0f323 100644 --- a/src/codegen/templates/utils.py.mako +++ b/src/codegen/templates/utils.py.mako @@ -31,12 +31,12 @@ 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, True)])})${get_function_return_type(function)}: +def ${get_python_function_name(function)}(${", ".join([param for param in get_function_parameter_list(function, None, class_func=False, include_defaults=True)])})${get_function_return_type(function)}: % for docstrings in generate_docstrings(function): ${docstrings} % endfor _interpreter = _select_interpreter() - return _interpreter.${get_python_function_name(function)}(${", ".join([param for param in get_function_parameter_list(function, "", False)])}) + return _interpreter.${get_python_function_name(function)}(${", ".join([param for param in get_function_parameter_list(function, "", typing=False)])}) % endif % endif diff --git a/src/codegen/utilities/function_helpers.py b/src/codegen/utilities/function_helpers.py index 1451a0f..c2172cb 100644 --- a/src/codegen/utilities/function_helpers.py +++ b/src/codegen/utilities/function_helpers.py @@ -224,6 +224,7 @@ def _reorder_signature_parameters(parameters: list[tuple[str, bool]]) -> list[st def get_function_parameter_list( function: dict, class_name: str = None, + *, typing: bool = True, is_language: bool = False, class_func: bool = True, @@ -369,27 +370,27 @@ def generate_function_call_in_class(function: dict, class_name: str) -> str: return_list.append("interpreter = library._interpreter") return_list.append("library_handle = library._interpreter._library_handle") return_list.append( - f"{return_var} = interpreter.{get_python_function_name(function)}({', '.join([param for param in (get_function_parameter_list(function, class_name, False) or [])])})" + f"{return_var} = interpreter.{get_python_function_name(function)}({', '.join([param for param in (get_function_parameter_list(function, class_name, typing=False) or [])])})" ) elif return_datatype == "CommandReference": return_list.append("session_handle = session._session_handle") return_list.append("interpreter = session._interpreter") return_list.append( - f"{return_var} = interpreter.{get_python_function_name(function)}({', '.join([param for param in (get_function_parameter_list(function, class_name, False) or [])])})" + f"{return_var} = interpreter.{get_python_function_name(function)}({', '.join([param for param in (get_function_parameter_list(function, class_name, typing=False) or [])])})" ) elif return_datatype == "PropertyReference": return_list.append("session_handle = session._session_handle") return_list.append("interpreter = session._interpreter") return_list.append( - f"{return_var} = interpreter.{get_python_function_name(function)}({', '.join([param for param in (get_function_parameter_list(function, class_name, False) or [])])})" + f"{return_var} = interpreter.{get_python_function_name(function)}({', '.join([param for param in (get_function_parameter_list(function, class_name, typing=False) or [])])})" ) elif return_datatype: return_list.append( - f"{return_var} = self._interpreter.{get_python_function_name(function)}({', '.join([param for param in (get_function_parameter_list(function, class_name, False) or [])])})" + f"{return_var} = self._interpreter.{get_python_function_name(function)}({', '.join([param for param in (get_function_parameter_list(function, class_name, typing=False) or [])])})" ) else: return_list.append( - f"self._interpreter.{get_python_function_name(function)}({', '.join([param for param in (get_function_parameter_list(function, class_name, False) or [])])})" + f"self._interpreter.{get_python_function_name(function)}({', '.join([param for param in (get_function_parameter_list(function, class_name, typing=False) or [])])})" ) return return_list From e906a73940418ca68149c9062521ff3d69509f24 Mon Sep 17 00:00:00 2001 From: zoechanzy Date: Thu, 13 Aug 2026 08:20:32 +0800 Subject: [PATCH 08/19] default value: Add constants for resource aliases * Add CONNECTED_DEVICES_ALIAS constant * Add RESERVED_DEVICES_ALIAS constant * Add DEFAULT_NVMEM_AREAS_ALIAS constant * Add DEFAULT_PHYS_CHANS_ALIAS constant * Add RESERVED_DEVICES_ALIAS constant * Add SESSION_ALIAS constant * Add SYSTEM_ALIAS constant --------- Signed-off-by: zoechanzy --- generated/nislsc/constants.py | 20 ++++++++++++++++++++ src/codegen/templates/constants.py.mako | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/generated/nislsc/constants.py b/generated/nislsc/constants.py index b2875c3..a76c0ae 100644 --- a/generated/nislsc/constants.py +++ b/generated/nislsc/constants.py @@ -15,6 +15,26 @@ class StrEnum(str, Enum): """StrEnum fallback for Python versions < 3.11.""" +CONNECTED_DEVICES_ALIAS = "$ConnectedDevices" +"""A resource alias representing the session's connected devices.""" + +DEFAULT_DEVICES_ALIAS = "$DefaultDevices" +"""A resource alias representing the session's default devices.""" + +DEFAULT_NVMEM_AREAS_ALIAS = "$DefaultNVMEMAreas" +"""A resource alias representing the session's default NVMEM areas.""" + +DEFAULT_PHYS_CHANS_ALIAS = "$DefaultPhysChans" +"""A resource alias representing the session's default physical channels.""" + +RESERVED_DEVICES_ALIAS = "$ReservedDevices" +"""A resource alias representing the session's reserved devices.""" + +SESSION_ALIAS = "$Session" +"""A resource alias for accessing session properties.""" + +SYSTEM_ALIAS = "$System" +"""A resource alias for accessing system properties.""" class ReservationAccess(Enum): """Define SLSC reservation access modes.""" diff --git a/src/codegen/templates/constants.py.mako b/src/codegen/templates/constants.py.mako index 2d0ce9c..2851cd4 100644 --- a/src/codegen/templates/constants.py.mako +++ b/src/codegen/templates/constants.py.mako @@ -59,6 +59,26 @@ except ImportError: class StrEnum(str, Enum): """StrEnum fallback for Python versions < 3.11.""" +CONNECTED_DEVICES_ALIAS = "$ConnectedDevices" +"""A resource alias representing the session's connected devices.""" + +DEFAULT_DEVICES_ALIAS = "$DefaultDevices" +"""A resource alias representing the session's default devices.""" + +DEFAULT_NVMEM_AREAS_ALIAS = "$DefaultNVMEMAreas" +"""A resource alias representing the session's default NVMEM areas.""" + +DEFAULT_PHYS_CHANS_ALIAS = "$DefaultPhysChans" +"""A resource alias representing the session's default physical channels.""" + +RESERVED_DEVICES_ALIAS = "$ReservedDevices" +"""A resource alias representing the session's reserved devices.""" + +SESSION_ALIAS = "$Session" +"""A resource alias for accessing session properties.""" + +SYSTEM_ALIAS = "$System" +"""A resource alias for accessing system properties.""" % for enum in enums: % if "capi" in enum["targets"]: From 4175108cbd7f8923313475982b3da1710a1eca12 Mon Sep 17 00:00:00 2001 From: zoechanzy Date: Mon, 17 Aug 2026 14:22:20 +0800 Subject: [PATCH 09/19] default value: Update nislscapi_full.json * Change timeout default value from -1 to -1.0 * Add default value "" for reservationGroup * Add default value "read/write" for reservationAccess * Update function_helpers.py to convert read/write to READ_WRITE * Generate new session.py with updated default values --------- Signed-off-by: zoechanzy --- generated/nislsc/session.py | 136 +++++++++++----------- src/codegen/metadata/nislscapi_full.json | 110 ++++------------- src/codegen/utilities/function_helpers.py | 3 + 3 files changed, 91 insertions(+), 158 deletions(-) diff --git a/generated/nislsc/session.py b/generated/nislsc/session.py index 8af571a..88ef578 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.0, reservation_timeout: float = -1.0) -> Self: + def initialize_session_with_devices(cls, device_names: str, library: Library | None = None, connection_timeout: float = -1.0, reservation_access: ReservationAccess = ReservationAccess.READ_WRITE, reservation_group: str = '', 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.0, reservation_timeout: float = -1.0) -> Self: + def initialize_session_with_nvmem_areas(cls, nvmem_area_names: str, library: Library | None = None, connection_timeout: float = -1.0, reservation_access: ReservationAccess = ReservationAccess.READ_WRITE, reservation_group: str = '', 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.0, reservation_timeout: float = -1.0) -> Self: + def initialize_session_with_physical_channels(cls, physical_channel_names: str, library: Library | None = None, connection_timeout: float = -1.0, reservation_access: ReservationAccess = ReservationAccess.READ_WRITE, reservation_group: str = '', 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 @@ -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.0) -> None: + def reserve_devices(self, device_names: str = '$DefaultDevices', reservation_access: ReservationAccess = ReservationAccess.READ_WRITE, reservation_group: str = '', reservation_timeout: float = -1.0) -> None: """Reserve the specified device(s), which prevents other sessions from accessing them. @@ -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, property_name: str, device_names: str = '$DefaultDevices') -> bool: + def get_device_property_bool(self, device_names: str, property_name: str) -> bool: """Get the value of the specified device property from one or more devices. @@ -497,7 +497,7 @@ def get_device_property_bool(self, property_name: str, device_names: str = '$Def 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, property_name: str, device_names: str = '$DefaultDevices') -> list[bool]: + def get_device_property_bool_array(self, device_names: str, property_name: str) -> 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, property_name: str, device_names: 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, property_name: str, device_names: str = '$DefaultDevices') -> float: + def get_device_property_double(self, device_names: str, property_name: str) -> float: """Get the value of the specified device property from one or more devices. @@ -535,7 +535,7 @@ def get_device_property_double(self, property_name: str, device_names: str = '$D 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, property_name: str, device_names: str = '$DefaultDevices') -> list[float]: + def get_device_property_double_array(self, device_names: str, property_name: str) -> 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, property_name: str, device_names: 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, property_name: str, device_names: str = '$DefaultDevices') -> int: + def get_device_property_int32(self, device_names: str, property_name: str) -> int: """Get the value of the specified device property from one or more devices. @@ -573,7 +573,7 @@ def get_device_property_int32(self, property_name: str, device_names: str = '$De 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, property_name: str, device_names: str = '$DefaultDevices') -> list[int]: + def get_device_property_int32_array(self, device_names: str, property_name: str) -> 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, property_name: str, device_names: 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, property_name: str, device_names: str = '$DefaultDevices') -> int: + def get_device_property_int64(self, device_names: str, property_name: str) -> int: """Get the value of the specified device property from one or more devices. @@ -611,7 +611,7 @@ def get_device_property_int64(self, property_name: str, device_names: str = '$De 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, property_name: str, device_names: str = '$DefaultDevices') -> list[int]: + def get_device_property_int64_array(self, device_names: str, property_name: str) -> 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, property_name: str, device_names: 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, property_name: str, device_names: str = '$DefaultDevices') -> str: + def get_device_property_string(self, device_names: str, property_name: str) -> str: """Get the value of the specified device property from one or more devices. @@ -649,7 +649,7 @@ def get_device_property_string(self, property_name: str, device_names: str = '$D 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, property_name: str, device_names: str = '$DefaultDevices') -> list[str]: + def get_device_property_string_array(self, device_names: str, property_name: str) -> 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, property_name: str, device_names: 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, property_name: str, device_names: str = '$DefaultDevices') -> int: + def get_device_property_uint32(self, device_names: str, property_name: str) -> int: """Get the value of the specified device property from one or more devices. @@ -687,7 +687,7 @@ def get_device_property_uint32(self, property_name: str, device_names: str = '$D 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, property_name: str, device_names: str = '$DefaultDevices') -> list[int]: + def get_device_property_uint32_array(self, device_names: str, property_name: str) -> 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, property_name: str, device_names: 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, property_name: str, device_names: str = '$DefaultDevices') -> int: + def get_device_property_uint64(self, device_names: str, property_name: str) -> int: """Get the value of the specified device property from one or more devices. @@ -725,7 +725,7 @@ def get_device_property_uint64(self, property_name: str, device_names: str = '$D 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, property_name: str, device_names: str = '$DefaultDevices') -> list[int]: + def get_device_property_uint64_array(self, device_names: str, property_name: str) -> 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, property_name: str, device_names: 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, property_name: str, property_value: bool, device_names: str = '$DefaultDevices') -> None: + def set_device_property_bool(self, device_names: str, property_name: str, property_value: bool) -> 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, property_name: str, property_value: bool, dev """ self._interpreter.set_device_property_bool(self._session_handle, device_names, property_name, property_value) - def set_device_property_bool_array(self, property_name: str, property_value: list[bool], device_names: str = '$DefaultDevices') -> None: + def set_device_property_bool_array(self, device_names: str, property_name: str, property_value: list[bool]) -> 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, property_name: str, property_value: lis """ self._interpreter.set_device_property_bool_array(self._session_handle, device_names, property_name, property_value) - def set_device_property_double(self, property_name: str, property_value: float, device_names: str = '$DefaultDevices') -> None: + def set_device_property_double(self, device_names: str, property_name: str, property_value: float) -> 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, property_name: str, property_value: float, """ self._interpreter.set_device_property_double(self._session_handle, device_names, property_name, property_value) - def set_device_property_double_array(self, property_name: str, property_value: list[float], device_names: str = '$DefaultDevices') -> None: + def set_device_property_double_array(self, device_names: str, property_name: str, property_value: list[float]) -> 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, property_name: str, property_value: l """ self._interpreter.set_device_property_double_array(self._session_handle, device_names, property_name, property_value) - def set_device_property_int32(self, property_name: str, property_value: int, device_names: str = '$DefaultDevices') -> None: + def set_device_property_int32(self, device_names: str, property_name: str, property_value: int) -> 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, property_name: str, property_value: int, dev """ self._interpreter.set_device_property_int32(self._session_handle, device_names, property_name, property_value) - def set_device_property_int32_array(self, property_name: str, property_value: list[int], device_names: str = '$DefaultDevices') -> None: + def set_device_property_int32_array(self, device_names: str, property_name: str, property_value: list[int]) -> 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, property_name: str, property_value: li """ self._interpreter.set_device_property_int32_array(self._session_handle, device_names, property_name, property_value) - def set_device_property_int64(self, property_name: str, property_value: int, device_names: str = '$DefaultDevices') -> None: + def set_device_property_int64(self, device_names: str, property_name: str, property_value: int) -> 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, property_name: str, property_value: int, dev """ self._interpreter.set_device_property_int64(self._session_handle, device_names, property_name, property_value) - def set_device_property_int64_array(self, property_name: str, property_value: list[int], device_names: str = '$DefaultDevices') -> None: + def set_device_property_int64_array(self, device_names: str, property_name: str, property_value: list[int]) -> 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, property_name: str, property_value: li """ self._interpreter.set_device_property_int64_array(self._session_handle, device_names, property_name, property_value) - def set_device_property_string(self, property_name: str, property_value: str, device_names: str = '$DefaultDevices') -> None: + def set_device_property_string(self, device_names: str, property_name: str, property_value: str) -> 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, property_name: str, property_value: str, de """ self._interpreter.set_device_property_string(self._session_handle, device_names, property_name, property_value) - def set_device_property_string_array(self, property_name: str, property_value: list[str], device_names: str = '$DefaultDevices') -> None: + def set_device_property_string_array(self, device_names: str, property_name: str, property_value: list[str]) -> 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, property_name: str, property_value: l """ self._interpreter.set_device_property_string_array(self._session_handle, device_names, property_name, property_value) - def set_device_property_uint32(self, property_name: str, property_value: int, device_names: str = '$DefaultDevices') -> None: + def set_device_property_uint32(self, device_names: str, property_name: str, property_value: int) -> 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, property_name: str, property_value: int, de """ self._interpreter.set_device_property_uint32(self._session_handle, device_names, property_name, property_value) - def set_device_property_uint32_array(self, property_name: str, property_value: list[int], device_names: str = '$DefaultDevices') -> None: + def set_device_property_uint32_array(self, device_names: str, property_name: str, property_value: list[int]) -> 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, property_name: str, property_value: l """ self._interpreter.set_device_property_uint32_array(self._session_handle, device_names, property_name, property_value) - def set_device_property_uint64(self, property_name: str, property_value: int, device_names: str = '$DefaultDevices') -> None: + def set_device_property_uint64(self, device_names: str, property_name: str, property_value: int) -> 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, property_name: str, property_value: int, de """ self._interpreter.set_device_property_uint64(self._session_handle, device_names, property_name, property_value) - def set_device_property_uint64_array(self, property_name: str, property_value: list[int], device_names: str = '$DefaultDevices') -> None: + def set_device_property_uint64_array(self, device_names: str, property_name: str, property_value: list[int]) -> 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, property_name: str, property_value: l """ self._interpreter.set_device_property_uint64_array(self._session_handle, device_names, property_name, property_value) - def get_physical_channel_property_bool(self, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> bool: + def get_physical_channel_property_bool(self, physical_channel_names: str, property_name: str) -> 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, property_name: str, physical_channe 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, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> list[bool]: + def get_physical_channel_property_bool_array(self, physical_channel_names: str, property_name: str) -> 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, property_name: str, physical_ 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, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> float: + def get_physical_channel_property_double(self, physical_channel_names: str, property_name: str) -> 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, property_name: str, physical_chan 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, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> list[float]: + def get_physical_channel_property_double_array(self, physical_channel_names: str, property_name: str) -> 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, property_name: str, physica 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, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> int: + def get_physical_channel_property_int32(self, physical_channel_names: str, property_name: str) -> 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, property_name: str, physical_chann 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, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> list[int]: + def get_physical_channel_property_int32_array(self, physical_channel_names: str, property_name: str) -> 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, property_name: str, physical 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, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> int: + def get_physical_channel_property_int64(self, physical_channel_names: str, property_name: str) -> 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, property_name: str, physical_chann 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, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> list[int]: + def get_physical_channel_property_int64_array(self, physical_channel_names: str, property_name: str) -> 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, property_name: str, physical 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, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> str: + def get_physical_channel_property_string(self, physical_channel_names: str, property_name: str) -> 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, property_name: str, physical_chan 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, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> list[str]: + def get_physical_channel_property_string_array(self, physical_channel_names: str, property_name: str) -> 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, property_name: str, physica 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, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> int: + def get_physical_channel_property_uint32(self, physical_channel_names: str, property_name: str) -> 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, property_name: str, physical_chan 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, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> list[int]: + def get_physical_channel_property_uint32_array(self, physical_channel_names: str, property_name: str) -> 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, property_name: str, physica 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, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> int: + def get_physical_channel_property_uint64(self, physical_channel_names: str, property_name: str) -> 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, property_name: str, physical_chan 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, property_name: str, physical_channel_names: str = '$DefaultPhysChans') -> list[int]: + def get_physical_channel_property_uint64_array(self, physical_channel_names: str, property_name: str) -> 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, property_name: str, physica 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, property_name: str, property_value: bool, physical_channel_names: str = '$DefaultPhysChans') -> None: + def set_physical_channel_property_bool(self, physical_channel_names: str, property_name: str, property_value: bool) -> 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, property_name: str, property_value: """ 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, property_name: str, property_value: list[bool], physical_channel_names: str = '$DefaultPhysChans') -> None: + def set_physical_channel_property_bool_array(self, physical_channel_names: str, property_name: str, property_value: list[bool]) -> 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, property_name: str, property_ """ 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, property_name: str, property_value: float, physical_channel_names: str = '$DefaultPhysChans') -> None: + def set_physical_channel_property_double(self, physical_channel_names: str, property_name: str, property_value: float) -> 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, property_name: str, property_valu """ 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, property_name: str, property_value: list[float], physical_channel_names: str = '$DefaultPhysChans') -> None: + def set_physical_channel_property_double_array(self, physical_channel_names: str, property_name: str, property_value: list[float]) -> 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, property_name: str, propert """ 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, property_name: str, property_value: int, physical_channel_names: str = '$DefaultPhysChans') -> None: + def set_physical_channel_property_int32(self, physical_channel_names: str, property_name: str, property_value: int) -> 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, property_name: str, property_value """ 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, property_name: str, property_value: list[int], physical_channel_names: str = '$DefaultPhysChans') -> None: + def set_physical_channel_property_int32_array(self, physical_channel_names: str, property_name: str, property_value: list[int]) -> 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, property_name: str, property """ 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, property_name: str, property_value: int, physical_channel_names: str = '$DefaultPhysChans') -> None: + def set_physical_channel_property_int64(self, physical_channel_names: str, property_name: str, property_value: int) -> 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, property_name: str, property_value """ 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, property_name: str, property_value: list[int], physical_channel_names: str = '$DefaultPhysChans') -> None: + def set_physical_channel_property_int64_array(self, physical_channel_names: str, property_name: str, property_value: list[int]) -> 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, property_name: str, property """ 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, property_name: str, property_value: str, physical_channel_names: str = '$DefaultPhysChans') -> None: + def set_physical_channel_property_string(self, physical_channel_names: str, property_name: str, property_value: str) -> 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, property_name: str, property_valu """ 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, property_name: str, property_value: list[str], physical_channel_names: str = '$DefaultPhysChans') -> None: + def set_physical_channel_property_string_array(self, physical_channel_names: str, property_name: str, property_value: list[str]) -> 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, property_name: str, propert """ 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, property_name: str, property_value: int, physical_channel_names: str = '$DefaultPhysChans') -> None: + def set_physical_channel_property_uint32(self, physical_channel_names: str, property_name: str, property_value: int) -> 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, property_name: str, property_valu """ 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, property_name: str, property_value: list[int], physical_channel_names: str = '$DefaultPhysChans') -> None: + def set_physical_channel_property_uint32_array(self, physical_channel_names: str, property_name: str, property_value: list[int]) -> 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, property_name: str, propert """ 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, property_name: str, property_value: int, physical_channel_names: str = '$DefaultPhysChans') -> None: + def set_physical_channel_property_uint64(self, physical_channel_names: str, property_name: str, property_value: int) -> 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, property_name: str, property_valu """ 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, property_name: str, property_value: list[int], physical_channel_names: str = '$DefaultPhysChans') -> None: + def set_physical_channel_property_uint64_array(self, physical_channel_names: str, property_name: str, property_value: list[int]) -> None: """Set the specified physical channel property to a new value for one or more physical channels. @@ -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, property_name: str, nvmem_area_names: str = '$DefaultNVMEMAreas') -> bool: + def get_nvmem_area_property_bool(self, nvmem_area_names: str, property_name: str) -> 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, property_name: str, nvmem_area_names: 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, property_name: str, nvmem_area_names: str = '$DefaultNVMEMAreas') -> list[bool]: + def get_nvmem_area_property_bool_array(self, nvmem_area_names: str, property_name: str) -> 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, property_name: str, nvmem_area_name 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, property_name: str, nvmem_area_names: str = '$DefaultNVMEMAreas') -> str: + def get_nvmem_area_property_string(self, nvmem_area_names: str, property_name: str) -> 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, property_name: str, nvmem_area_names: 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, property_name: str, nvmem_area_names: str = '$DefaultNVMEMAreas') -> list[str]: + def get_nvmem_area_property_string_array(self, nvmem_area_names: str, property_name: str) -> 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, property_name: str, nvmem_area_na 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, property_name: str, nvmem_area_names: str = '$DefaultNVMEMAreas') -> int: + def get_nvmem_area_property_uint32(self, nvmem_area_names: str, property_name: str) -> 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, property_name: str, nvmem_area_names: 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, property_name: str, nvmem_area_names: str = '$DefaultNVMEMAreas') -> list[int]: + def get_nvmem_area_property_uint32_array(self, nvmem_area_names: str, property_name: str) -> list[int]: """Get the value of the specified NVMEM area property for one or more NVMEM areas. @@ -2728,7 +2728,7 @@ def write_register_uint64(self, register_address: int, data: int, device_name: s """ self._interpreter.write_register_uint64(self._session_handle, device_name, register_address, data) - def get_nvmem_bytes(self, nvmem_address: int, num_byte: int, nvmem_area: str = '$DefaultNVMEMAreas') -> bytes: + def get_nvmem_bytes(self, nvmem_area: str, nvmem_address: int, num_byte: int) -> bytes: """Get a range of bytes from an NVMEM area. Args: @@ -2742,7 +2742,7 @@ def get_nvmem_bytes(self, nvmem_address: int, num_byte: int, nvmem_area: str = ' byte = self._interpreter.get_nvmem_bytes(self._session_handle, nvmem_area, nvmem_address, num_byte) return byte - def set_nvmem_bytes(self, nvmem_address: int, bytes_data: bytes, serial_number: str, password: str, nvmem_area: str = '$DefaultNVMEMAreas') -> None: + def set_nvmem_bytes(self, nvmem_area: str, nvmem_address: int, bytes_data: bytes, serial_number: str, password: str) -> 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 diff --git a/src/codegen/metadata/nislscapi_full.json b/src/codegen/metadata/nislscapi_full.json index 57cc6f7..b71e0ff 100644 --- a/src/codegen/metadata/nislscapi_full.json +++ b/src/codegen/metadata/nislscapi_full.json @@ -1214,7 +1214,7 @@ }, { "dataType": "TimeoutSeconds", - "default": -1, + "default": -1.0, "dir": [ "in" ], @@ -1223,6 +1223,7 @@ }, { "dataType": "enum", + "default": "read/write", "dir": [ "in" ], @@ -1232,6 +1233,7 @@ }, { "dataType": "string", + "default": "", "dir": [ "in" ], @@ -1240,7 +1242,7 @@ }, { "dataType": "TimeoutSeconds", - "default": -1, + "default": -1.0, "dir": [ "in" ], @@ -1315,7 +1317,7 @@ }, { "dataType": "TimeoutSeconds", - "default": -1, + "default": -1.0, "dir": [ "in" ], @@ -1324,6 +1326,7 @@ }, { "dataType": "enum", + "default": "read/write", "dir": [ "in" ], @@ -1333,6 +1336,7 @@ }, { "dataType": "string", + "default": "", "dir": [ "in" ], @@ -1341,7 +1345,7 @@ }, { "dataType": "TimeoutSeconds", - "default": -1, + "default": -1.0, "dir": [ "in" ], @@ -1417,7 +1421,7 @@ }, { "dataType": "TimeoutSeconds", - "default": -1, + "default": -1.0, "dir": [ "in" ], @@ -1426,6 +1430,7 @@ }, { "dataType": "enum", + "default": "read/write", "dir": [ "in" ], @@ -1435,6 +1440,7 @@ }, { "dataType": "string", + "default": "", "dir": [ "in" ], @@ -1443,7 +1449,7 @@ }, { "dataType": "TimeoutSeconds", - "default": -1, + "default": -1.0, "dir": [ "in" ], @@ -1729,7 +1735,7 @@ }, { "dataType": "TimeoutSeconds", - "default": -1, + "default": -1.0, "dir": [ "in" ], @@ -1803,7 +1809,7 @@ }, { "dataType": "TimeoutSeconds", - "default": -1, + "default": -1.0, "dir": [ "in" ], @@ -1885,7 +1891,7 @@ }, { "dataType": "TimeoutSeconds", - "default": -1, + "default": -1.0, "dir": [ "in" ], @@ -1931,6 +1937,7 @@ }, { "dataType": "enum", + "default": "read/write", "dir": [ "in" ], @@ -1940,6 +1947,7 @@ }, { "dataType": "string", + "default": "", "dir": [ "in" ], @@ -1948,7 +1956,7 @@ }, { "dataType": "TimeoutSeconds", - "default": -1, + "default": -1.0, "dir": [ "in" ], @@ -2080,7 +2088,7 @@ }, { "dataType": "TimeoutSeconds", - "default": -1, + "default": -1.0, "dir": [ "in" ], @@ -2132,7 +2140,7 @@ }, { "dataType": "TimeoutSeconds", - "default": -1, + "default": -1.0, "dir": [ "in" ], @@ -2257,7 +2265,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -2302,7 +2309,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -2347,7 +2353,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -2392,7 +2397,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -2437,7 +2441,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -2482,7 +2485,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -2527,7 +2529,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -2572,7 +2573,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -2617,7 +2617,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -2662,7 +2661,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -2707,7 +2705,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -2752,7 +2749,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -2797,7 +2793,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -2842,7 +2837,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -2887,7 +2881,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -2932,7 +2925,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -2977,7 +2969,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -3022,7 +3013,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -3067,7 +3057,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -3112,7 +3101,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -3157,7 +3145,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -3202,7 +3189,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -3247,7 +3233,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -3292,7 +3277,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -3337,7 +3321,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -3382,7 +3365,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -3427,7 +3409,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -3472,7 +3453,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -3517,7 +3497,6 @@ }, { "dataType": "string", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -3605,7 +3584,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -3651,7 +3629,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -3697,7 +3674,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -3743,7 +3719,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -3789,7 +3764,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -3835,7 +3809,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -3881,7 +3854,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -3927,7 +3899,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -3973,7 +3944,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4019,7 +3989,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4065,7 +4034,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4111,7 +4079,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4157,7 +4124,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4203,7 +4169,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4249,7 +4214,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4295,7 +4259,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4341,7 +4304,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4387,7 +4349,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4433,7 +4394,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4479,7 +4439,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4525,7 +4484,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4571,7 +4529,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4617,7 +4574,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4663,7 +4619,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4709,7 +4664,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4755,7 +4709,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4801,7 +4754,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4847,7 +4799,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -4893,7 +4844,6 @@ }, { "dataType": "string", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -5053,7 +5003,6 @@ }, { "dataType": "string", - "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -5098,7 +5047,6 @@ }, { "dataType": "string", - "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -5143,7 +5091,6 @@ }, { "dataType": "string", - "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -5188,7 +5135,6 @@ }, { "dataType": "string", - "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -5233,7 +5179,6 @@ }, { "dataType": "string", - "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -5278,7 +5223,6 @@ }, { "dataType": "string", - "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -7573,7 +7517,6 @@ }, { "dataType": "NvmemArea", - "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -7620,7 +7563,6 @@ }, { "dataType": "NvmemArea", - "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -7691,7 +7633,6 @@ }, { "dataType": "NvmemArea", - "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -9574,7 +9515,6 @@ }, { "dataType": "Device", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -9622,7 +9562,6 @@ }, { "dataType": "Device", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -9670,7 +9609,6 @@ }, { "dataType": "Device", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -9718,7 +9656,6 @@ }, { "dataType": "Device", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -9766,7 +9703,6 @@ }, { "dataType": "Device", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -9814,7 +9750,6 @@ }, { "dataType": "Device", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -9862,7 +9797,6 @@ }, { "dataType": "NvmemArea", - "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -9910,7 +9844,6 @@ }, { "dataType": "NvmemArea", - "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -9958,7 +9891,6 @@ }, { "dataType": "NvmemArea", - "default": "$DefaultNVMEMAreas", "dir": [ "in" ], @@ -10007,7 +9939,6 @@ }, { "dataType": "PhysChan", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -10056,7 +9987,6 @@ }, { "dataType": "PhysChan", - "default": "$DefaultPhysChans", "dir": [ "in" ], diff --git a/src/codegen/utilities/function_helpers.py b/src/codegen/utilities/function_helpers.py index c2172cb..0922b43 100644 --- a/src/codegen/utilities/function_helpers.py +++ b/src/codegen/utilities/function_helpers.py @@ -6,6 +6,7 @@ """ from utilities.interpreter_helpers import ( + convert_to_screaming_snake_case, get_param_datatype_in_ctypes, get_python_function_name, get_standardized_param_name, @@ -195,6 +196,8 @@ def _format_default_value(parameter: dict) -> str | None: return None default = parameter["default"] + if parameter.get("dataType") == "enum" and isinstance(default, str): + return f"{parameter['enumType']}.{convert_to_screaming_snake_case(default)}" if isinstance(default, int) and parameter.get("dataType") in {"double", "TimeoutSeconds"}: default = float(default) return repr(default) From 2f4cb6c75c3a9b5efa50c0c8453005ba40680e45 Mon Sep 17 00:00:00 2001 From: zoechanzy Date: Mon, 17 Aug 2026 16:10:31 +0800 Subject: [PATCH 10/19] default value: Update unit tests * Remove parameters from intialization if its value same as default value. * Reorder parameters to match the order in the function definition. --------- Signed-off-by: zoechanzy --- tests/unit/conftest.py | 7 +--- tests/unit/test_session.py | 80 ++++++++++---------------------------- 2 files changed, 22 insertions(+), 65 deletions(-) diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index b6246f7..7440980 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -10,7 +10,7 @@ from nislsc import Library, Session from nislsc._base_interpreter import BaseInterpreter -from nislsc.constants import Language, ReservationAccess +from nislsc.constants import Language from tests.unit._session_utils import ( expect_initialize_library, expect_initialize_session_with_devices, @@ -58,10 +58,5 @@ def session(library: Library, interpreter: Mock) -> Generator[Session, None, Non expect_initialize_session_with_devices(interpreter) with Session.initialize_session_with_devices( "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 2b91cff..3a42386 100644 --- a/tests/unit/test_session.py +++ b/tests/unit/test_session.py @@ -25,11 +25,8 @@ def test___library_provided___initialize_session_with_devices___session_handle_i with Session.initialize_session_with_devices( "Dev1", - ReservationAccess.NONE, - "", library=library, - connection_timeout=-1.0, - reservation_timeout=-1.0, + reservation_access=ReservationAccess.NONE, ) as session: assert session._session_handle == 100 interpreter.initialize_session_with_devices.assert_called_once() @@ -42,11 +39,8 @@ def test___library_provided___initialize_session_with_devices___owns_library_is_ with Session.initialize_session_with_devices( "Dev1", - ReservationAccess.NONE, - "", library=library, - connection_timeout=-1.0, - reservation_timeout=-1.0, + reservation_access=ReservationAccess.NONE, ) as session: assert not session._owns_library @@ -59,11 +53,7 @@ def test___no_library___initialize_session_with_devices___library_created_and_ow with Session.initialize_session_with_devices( "Dev1", - ReservationAccess.NONE, - "", - library=None, - connection_timeout=-1.0, - reservation_timeout=-1.0, + reservation_access=ReservationAccess.NONE, ) as session: assert session._owns_library assert session._library is not None @@ -77,10 +67,9 @@ def test___library_provided___initialize_session_with_devices___interpreter_call with Session.initialize_session_with_devices( "Dev1,Dev2", - ReservationAccess.READ_WRITE, - "MyGroup", library=library, connection_timeout=5.0, + reservation_group="MyGroup", reservation_timeout=10.0, ): interpreter.initialize_session_with_devices.assert_called_once_with( @@ -103,11 +92,8 @@ def test___interpreter_raises_error___initialize_session_with_devices___slsc_err with pytest.raises(SLSCError) as exc_info: Session.initialize_session_with_devices( "Dev1", - ReservationAccess.NONE, - "", library=library, - connection_timeout=-1.0, - reservation_timeout=-1.0, + reservation_access=ReservationAccess.NONE, ) assert exc_info.value.error_code == -250806 @@ -179,11 +165,8 @@ def test___library_provided___initialize_session_with_nvmem_areas___session_hand with Session.initialize_session_with_nvmem_areas( "Area1", - ReservationAccess.NONE, - "", library=library, - connection_timeout=-1.0, - reservation_timeout=-1.0, + reservation_access=ReservationAccess.NONE, ) as session: assert session._session_handle == 200 interpreter.initialize_session_with_nvmem_areas.assert_called_once() @@ -197,11 +180,7 @@ def test___no_library___initialize_session_with_nvmem_areas___library_created_an with Session.initialize_session_with_nvmem_areas( "Area1", - ReservationAccess.NONE, - "", - library=None, - connection_timeout=-1.0, - reservation_timeout=-1.0, + reservation_access=ReservationAccess.NONE, ) as session: assert session._owns_library @@ -213,11 +192,8 @@ def test___library_provided___initialize_session_with_physical_channels___sessio with Session.initialize_session_with_physical_channels( "Dev1/phys0", - ReservationAccess.NONE, - "", library=library, - connection_timeout=-1.0, - reservation_timeout=-1.0, + reservation_access=ReservationAccess.NONE, ) as session: assert session._session_handle == 300 interpreter.initialize_session_with_physical_channels.assert_called_once() @@ -231,11 +207,7 @@ def test___no_library___initialize_session_with_physical_channels___library_crea with Session.initialize_session_with_physical_channels( "Dev1/phys0", - ReservationAccess.NONE, - "", - library=None, - connection_timeout=-1.0, - reservation_timeout=-1.0, + reservation_access=ReservationAccess.NONE, ) as session: assert session._owns_library @@ -256,7 +228,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(library=None) as session: + with Session.initialize_session_without_resources() as session: assert session._owns_library @@ -289,11 +261,8 @@ def test___context_manager___close___close_session_called_on_exit( with Session.initialize_session_with_devices( "Dev1", - ReservationAccess.NONE, - "", library=library, - connection_timeout=-1.0, - reservation_timeout=-1.0, + reservation_access=ReservationAccess.NONE, ): interpreter.close_session.assert_not_called() @@ -308,11 +277,7 @@ def test___close_owns_library___close___finalize_library_also_called( session = Session.initialize_session_with_devices( "Dev1", - ReservationAccess.NONE, - "", - library=None, - connection_timeout=-1.0, - reservation_timeout=-1.0, + reservation_access=ReservationAccess.NONE, ) session.close() @@ -326,11 +291,8 @@ def test___close_does_not_own_library___close___finalize_library_not_called( expect_initialize_session_with_devices(interpreter, 100) session = Session.initialize_session_with_devices( "Dev1", - ReservationAccess.NONE, - "", library=library, - connection_timeout=-1.0, - reservation_timeout=-1.0, + reservation_access=ReservationAccess.NONE, ) session.close() @@ -409,7 +371,7 @@ def test___session_opened___reserve_devices___interpreter_called_with_args( ) -> None: session_handle = session._session_handle - session.reserve_devices(ReservationAccess.READ_WRITE, "MyGroup", "Dev1", 30.0) + session.reserve_devices("Dev1", reservation_group="MyGroup", reservation_timeout=30.0) interpreter.reserve_devices.assert_called_once_with( session_handle, "Dev1", ReservationAccess.READ_WRITE, "MyGroup", 30.0 @@ -507,7 +469,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)(prop, "Dev1") + result = getattr(session, method)("Dev1", prop) getattr(interpreter, method).assert_called_once_with(session_handle, "Dev1", prop) assert result == value @@ -537,7 +499,7 @@ def test___session_opened___set_device_property___interpreter_called_with_args( ) -> None: session_handle = session._session_handle - getattr(session, method)(prop, value, "Dev1") + getattr(session, method)("Dev1", prop, value) getattr(interpreter, method).assert_called_once_with(session_handle, "Dev1", prop, value) @@ -642,7 +604,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)(prop, resource) + result = getattr(session, method)(resource, prop) getattr(interpreter, method).assert_called_once_with(session_handle, resource, prop) assert result == value @@ -728,7 +690,7 @@ def test___session_opened___set_physical_channel_property___interpreter_called_w ) -> None: session_handle = session._session_handle - getattr(session, method)(prop, value, "Dev1/phys0") + getattr(session, method)("Dev1/phys0", prop, value) getattr(interpreter, method).assert_called_once_with(session_handle, "Dev1/phys0", prop, value) @@ -792,7 +754,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)(prop, "Area1") + result = getattr(session, method)("Area1", prop) getattr(interpreter, method).assert_called_once_with(session_handle, "Area1", prop) assert result == value @@ -1010,7 +972,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(0, 3, "Area1") + result = session.get_nvmem_bytes("Area1", 0, 3) interpreter.get_nvmem_bytes.assert_called_once_with(session_handle, "Area1", 0, 3) assert result == b"\x01\x02\x03" @@ -1021,7 +983,7 @@ def test___session_opened___set_nvmem_bytes___interpreter_called_with_args( ) -> None: session_handle = session._session_handle - session.set_nvmem_bytes(0, b"\x01\x02\x03", "SN001", "pass", "Area1") + session.set_nvmem_bytes("Area1", 0, b"\x01\x02\x03", "SN001", "pass") interpreter.set_nvmem_bytes.assert_called_once_with( session_handle, "Area1", 0, b"\x01\x02\x03", "SN001", "pass" From 5fe1708783c0ff56d905d6a925bf9dd8d4b142cc Mon Sep 17 00:00:00 2001 From: zoechanzy Date: Tue, 18 Aug 2026 09:11:27 +0800 Subject: [PATCH 11/19] default value: Update examples * Reorder parameters to match the order in the function definition. --------- Signed-off-by: zoechanzy --- examples/show_command_and_property_tree.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/show_command_and_property_tree.py b/examples/show_command_and_property_tree.py index 9a2ae66..2750c9a 100644 --- a/examples/show_command_and_property_tree.py +++ b/examples/show_command_and_property_tree.py @@ -53,9 +53,9 @@ def get_command_and_property_tree(device_name: str) -> dict: reservation_group = "admin" with Session.initialize_session_with_devices( - device_name, - reservation_access, - reservation_group, + device_names=device_name, + reservation_access=reservation_access, + reservation_group=reservation_group, ) as session: data = { @@ -65,18 +65,18 @@ def get_command_and_property_tree(device_name: str) -> dict: } device_commands = session.get_device_property_string_array( - DeviceProperty.COMMANDS, device_name, + DeviceProperty.COMMANDS, ) device_properties = session.get_device_property_string_array( - DeviceProperty.PROPERTIES, device_name, + DeviceProperty.PROPERTIES, ) device_physical_channels = session.get_device_property_string_array( - DeviceProperty.PHYSICAL_CHANNELS, device_name, + DeviceProperty.PHYSICAL_CHANNELS, ) for physical_channel in device_physical_channels: @@ -133,10 +133,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( - PhysicalChannelProperty.COMMANDS, physical_channel + physical_channel, PhysicalChannelProperty.COMMANDS ) physical_channel_properties = session.get_physical_channel_property_string_array( - PhysicalChannelProperty.PROPERTIES, physical_channel + physical_channel, PhysicalChannelProperty.PROPERTIES ) for physical_channel_command in physical_channel_commands: From 985f24be3739912dc5fe65f4fe45df3e0880823c Mon Sep 17 00:00:00 2001 From: zoechanzy Date: Thu, 20 Aug 2026 14:46:13 +0800 Subject: [PATCH 12/19] default value: Add get_default_alias_constants in function_helpers.py * Add get_default_alias_constants in function_helpers.py to retrieve default alias constants. * Update session.py.mako to use get_default_alias_constants for default values. * Generate session.py with updated default values --------- Signed-off-by: zoechanzy --- generated/nislsc/session.py | 40 +++++++++++------------ src/codegen/templates/session.py.mako | 4 +-- src/codegen/utilities/function_helpers.py | 24 ++++++++++++++ 3 files changed, 46 insertions(+), 22 deletions(-) diff --git a/generated/nislsc/session.py b/generated/nislsc/session.py index 88ef578..7e16d0b 100644 --- a/generated/nislsc/session.py +++ b/generated/nislsc/session.py @@ -10,7 +10,7 @@ from typing_extensions import Self -from nislsc.constants import ReservationAccess, TableScaleCoercion +from nislsc.constants import ReservationAccess, TableScaleCoercion, DEFAULT_DEVICES_ALIAS, DEFAULT_NVMEM_AREAS_ALIAS, DEFAULT_PHYS_CHANS_ALIAS from nislsc.library import Library @@ -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.0) -> None: + def connect_to_devices(self, device_names: str = DEFAULT_DEVICES_ALIAS, connection_timeout: float = -1.0) -> 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 = '$DefaultDevices', connection_t """ self._interpreter.connect_to_devices(self._session_handle, device_names, connection_timeout) - def disconnect_from_devices(self, device_names: str = '$DefaultDevices') -> None: + def disconnect_from_devices(self, device_names: str = DEFAULT_DEVICES_ALIAS) -> None: """Close network connections for the specified devices. When multiple devices share a network connection because they are in the @@ -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 = '$DefaultDevices', reservation_access: ReservationAccess = ReservationAccess.READ_WRITE, reservation_group: str = '', reservation_timeout: float = -1.0) -> None: + def reserve_devices(self, device_names: str = DEFAULT_DEVICES_ALIAS, reservation_access: ReservationAccess = ReservationAccess.READ_WRITE, reservation_group: str = '', reservation_timeout: float = -1.0) -> None: """Reserve the specified device(s), which prevents other sessions from accessing them. @@ -379,7 +379,7 @@ def reserve_devices(self, device_names: str = '$DefaultDevices', reservation_acc """ self._interpreter.reserve_devices(self._session_handle, device_names, reservation_access, reservation_group, reservation_timeout) - def unreserve_devices(self, device_names: str = '$DefaultDevices') -> None: + def unreserve_devices(self, device_names: str = DEFAULT_DEVICES_ALIAS) -> None: """Unreserve the specified device(s), allowing other sessions to access them. @@ -390,7 +390,7 @@ def unreserve_devices(self, device_names: str = '$DefaultDevices') -> None: """ self._interpreter.unreserve_devices(self._session_handle, device_names) - def reset_devices(self, device_names: str = '$DefaultDevices') -> None: + def reset_devices(self, device_names: str = DEFAULT_DEVICES_ALIAS) -> None: """Reset the specified device(s) to the default state. This function sends the specified devices a hardware reset signal, @@ -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 = '$DefaultDevices') -> None: + def commit_properties_for_devices(self, device_names: str = DEFAULT_DEVICES_ALIAS) -> 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 = '$DefaultDevices') - """ self._interpreter.commit_properties_for_devices(self._session_handle, device_names) - def commit_properties_for_physical_channels(self, physical_channel_names: str = '$DefaultPhysChans') -> None: + def commit_properties_for_physical_channels(self, physical_channel_names: str = DEFAULT_PHYS_CHANS_ALIAS) -> None: """Commit all physical channel properties with pending changes to hardware for the specified physical channel(s). @@ -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, command_name: str, timeout: float, device_names: str = '$DefaultDevices') -> None: + def execute_device_command(self, command_name: str, timeout: float, device_names: str = DEFAULT_DEVICES_ALIAS) -> 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, command_name: str, timeout: float, device_names """ self._interpreter.execute_device_command(self._session_handle, device_names, command_name, timeout) - def execute_physical_channel_command(self, command_name: str, timeout: float, physical_channel_names: str = '$DefaultPhysChans') -> None: + def execute_physical_channel_command(self, command_name: str, timeout: float, physical_channel_names: str = DEFAULT_PHYS_CHANS_ALIAS) -> 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, register_address: int, device_name: str = '$DefaultDevices') -> int: + def read_register_uint8(self, register_address: int, device_name: str = DEFAULT_DEVICES_ALIAS) -> int: """Read the specified register. To read a single bitfield, consider using properties instead. @@ -2607,7 +2607,7 @@ def read_register_uint8(self, register_address: int, device_name: str = '$Defaul data = self._interpreter.read_register_uint8(self._session_handle, device_name, register_address) return data - def read_register_uint16(self, register_address: int, device_name: str = '$DefaultDevices') -> int: + def read_register_uint16(self, register_address: int, device_name: str = DEFAULT_DEVICES_ALIAS) -> int: """Read the specified register. To read a single bitfield, consider using properties instead. @@ -2626,7 +2626,7 @@ def read_register_uint16(self, register_address: int, device_name: str = '$Defau data = self._interpreter.read_register_uint16(self._session_handle, device_name, register_address) return data - def read_register_uint32(self, register_address: int, device_name: str = '$DefaultDevices') -> int: + def read_register_uint32(self, register_address: int, device_name: str = DEFAULT_DEVICES_ALIAS) -> int: """Read the specified register. To read a single bitfield, consider using properties instead. @@ -2645,7 +2645,7 @@ def read_register_uint32(self, register_address: int, device_name: str = '$Defau data = self._interpreter.read_register_uint32(self._session_handle, device_name, register_address) return data - def read_register_uint64(self, register_address: int, device_name: str = '$DefaultDevices') -> int: + def read_register_uint64(self, register_address: int, device_name: str = DEFAULT_DEVICES_ALIAS) -> int: """Read the specified register. To read a single bitfield, consider using properties instead. @@ -2664,7 +2664,7 @@ def read_register_uint64(self, register_address: int, device_name: str = '$Defau data = self._interpreter.read_register_uint64(self._session_handle, device_name, register_address) return data - def write_register_uint8(self, register_address: int, data: int, device_name: str = '$DefaultDevices') -> None: + def write_register_uint8(self, register_address: int, data: int, device_name: str = DEFAULT_DEVICES_ALIAS) -> 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, register_address: int, data: int, device_name: st """ self._interpreter.write_register_uint8(self._session_handle, device_name, register_address, data) - def write_register_uint16(self, register_address: int, data: int, device_name: str = '$DefaultDevices') -> None: + def write_register_uint16(self, register_address: int, data: int, device_name: str = DEFAULT_DEVICES_ALIAS) -> 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, register_address: int, data: int, device_name: s """ self._interpreter.write_register_uint16(self._session_handle, device_name, register_address, data) - def write_register_uint32(self, register_address: int, data: int, device_name: str = '$DefaultDevices') -> None: + def write_register_uint32(self, register_address: int, data: int, device_name: str = DEFAULT_DEVICES_ALIAS) -> 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, register_address: int, data: int, device_name: s """ self._interpreter.write_register_uint32(self._session_handle, device_name, register_address, data) - def write_register_uint64(self, register_address: int, data: int, device_name: str = '$DefaultDevices') -> None: + def write_register_uint64(self, register_address: int, data: int, device_name: str = DEFAULT_DEVICES_ALIAS) -> None: """Write data to the specified register. To write a single bitfield, consider using properties instead. @@ -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 = '$DefaultNVMEMAreas') -> None: + def commit_nvmem_areas(self, nvmem_area_names: str = DEFAULT_NVMEM_AREAS_ALIAS) -> 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 = '$DefaultNVMEMAreas') -> No """ self._interpreter.commit_nvmem_areas(self._session_handle, nvmem_area_names) - def commit_nvmem_for_devices(self, device_names: str = '$DefaultDevices') -> None: + def commit_nvmem_for_devices(self, device_names: str = DEFAULT_DEVICES_ALIAS) -> None: """Commit pending changes to hardware for all NVMEM areas on the specified device(s). diff --git a/src/codegen/templates/session.py.mako b/src/codegen/templates/session.py.mako index c100f80..b97839c 100644 --- a/src/codegen/templates/session.py.mako +++ b/src/codegen/templates/session.py.mako @@ -1,5 +1,5 @@ <%! -from utilities.function_helpers import get_function_parameter_list, get_function_return_type, is_creating_handle, is_class_func, is_classmethod, get_classmethod_parameter_list, generate_return_in_class, generate_function_call_in_class +from utilities.function_helpers import get_default_alias_constants, get_function_parameter_list, get_function_return_type, is_creating_handle, is_class_func, is_classmethod, get_classmethod_parameter_list, generate_return_in_class, generate_function_call_in_class from utilities.interpreter_helpers import get_python_function_name, is_capi, is_param_input, is_param_output from utilities.docstrings_helpers import generate_docstrings %>\ @@ -15,7 +15,7 @@ from types import TracebackType from typing_extensions import Self -from nislsc.constants import ReservationAccess, TableScaleCoercion +from nislsc.constants import ${", ".join(["ReservationAccess", "TableScaleCoercion", *get_default_alias_constants(functions)])} from nislsc.library import Library diff --git a/src/codegen/utilities/function_helpers.py b/src/codegen/utilities/function_helpers.py index 0922b43..c814131 100644 --- a/src/codegen/utilities/function_helpers.py +++ b/src/codegen/utilities/function_helpers.py @@ -17,6 +17,16 @@ ARRAY_VAR = ["int64[]", "uint64[]", "int32[]", "uint32[]", "bool[]", "double[]"] +RESOURCE_ALIAS_CONSTANTS = { + "$ConnectedDevices": "CONNECTED_DEVICES_ALIAS", + "$DefaultDevices": "DEFAULT_DEVICES_ALIAS", + "$DefaultNVMEMAreas": "DEFAULT_NVMEM_AREAS_ALIAS", + "$DefaultPhysChans": "DEFAULT_PHYS_CHANS_ALIAS", + "$ReservedDevices": "RESERVED_DEVICES_ALIAS", + "$Session": "SESSION_ALIAS", + "$System": "SYSTEM_ALIAS", +} + STRING_LIST = { "string": "ctypes.c_char_p", "Device": "ctypes.c_char_p", @@ -196,6 +206,8 @@ def _format_default_value(parameter: dict) -> str | None: return None default = parameter["default"] + if default in RESOURCE_ALIAS_CONSTANTS: + return RESOURCE_ALIAS_CONSTANTS[default] if parameter.get("dataType") == "enum" and isinstance(default, str): return f"{parameter['enumType']}.{convert_to_screaming_snake_case(default)}" if isinstance(default, int) and parameter.get("dataType") in {"double", "TimeoutSeconds"}: @@ -203,6 +215,18 @@ def _format_default_value(parameter: dict) -> str | None: return repr(default) +def get_default_alias_constants(functions: list[dict]) -> list[str]: + """Get constant names used by resource-alias defaults in function metadata.""" + return sorted( + { + RESOURCE_ALIAS_CONSTANTS[parameter["default"]] + for function in functions + for parameter in function["params"] + if parameter.get("default") in RESOURCE_ALIAS_CONSTANTS + } + ) + + 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 From dffcc1c0feafad3109fb2215182270f43bf11302 Mon Sep 17 00:00:00 2001 From: zoechanzy Date: Thu, 20 Aug 2026 15:14:49 +0800 Subject: [PATCH 13/19] default value: Update nislscapi_full.json * Remove default value of device/physchan/nvmem from read/write register and execute device/physicalChannel command * Generate new session.py with updated default values --------- Signed-off-by: zoechanzy --- generated/nislsc/session.py | 20 ++++++++++---------- src/codegen/metadata/nislscapi_full.json | 10 ---------- tests/unit/test_session.py | 8 ++++---- 3 files changed, 14 insertions(+), 24 deletions(-) diff --git a/generated/nislsc/session.py b/generated/nislsc/session.py index 7e16d0b..23900a1 100644 --- a/generated/nislsc/session.py +++ b/generated/nislsc/session.py @@ -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, command_name: str, timeout: float, device_names: str = DEFAULT_DEVICES_ALIAS) -> None: + def execute_device_command(self, device_names: str, command_name: str, timeout: float) -> 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, command_name: str, timeout: float, device_names """ self._interpreter.execute_device_command(self._session_handle, device_names, command_name, timeout) - def execute_physical_channel_command(self, command_name: str, timeout: float, physical_channel_names: str = DEFAULT_PHYS_CHANS_ALIAS) -> None: + def execute_physical_channel_command(self, physical_channel_names: str, command_name: str, timeout: float) -> 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, register_address: int, device_name: str = DEFAULT_DEVICES_ALIAS) -> int: + def read_register_uint8(self, device_name: str, register_address: int) -> int: """Read the specified register. To read a single bitfield, consider using properties instead. @@ -2607,7 +2607,7 @@ def read_register_uint8(self, register_address: int, device_name: str = DEFAULT_ data = self._interpreter.read_register_uint8(self._session_handle, device_name, register_address) return data - def read_register_uint16(self, register_address: int, device_name: str = DEFAULT_DEVICES_ALIAS) -> int: + def read_register_uint16(self, device_name: str, register_address: int) -> int: """Read the specified register. To read a single bitfield, consider using properties instead. @@ -2626,7 +2626,7 @@ def read_register_uint16(self, register_address: int, device_name: str = DEFAULT data = self._interpreter.read_register_uint16(self._session_handle, device_name, register_address) return data - def read_register_uint32(self, register_address: int, device_name: str = DEFAULT_DEVICES_ALIAS) -> int: + def read_register_uint32(self, device_name: str, register_address: int) -> int: """Read the specified register. To read a single bitfield, consider using properties instead. @@ -2645,7 +2645,7 @@ def read_register_uint32(self, register_address: int, device_name: str = DEFAULT data = self._interpreter.read_register_uint32(self._session_handle, device_name, register_address) return data - def read_register_uint64(self, register_address: int, device_name: str = DEFAULT_DEVICES_ALIAS) -> int: + def read_register_uint64(self, device_name: str, register_address: int) -> int: """Read the specified register. To read a single bitfield, consider using properties instead. @@ -2664,7 +2664,7 @@ def read_register_uint64(self, register_address: int, device_name: str = DEFAULT data = self._interpreter.read_register_uint64(self._session_handle, device_name, register_address) return data - def write_register_uint8(self, register_address: int, data: int, device_name: str = DEFAULT_DEVICES_ALIAS) -> None: + def write_register_uint8(self, device_name: str, register_address: int, data: int) -> 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, register_address: int, data: int, device_name: st """ self._interpreter.write_register_uint8(self._session_handle, device_name, register_address, data) - def write_register_uint16(self, register_address: int, data: int, device_name: str = DEFAULT_DEVICES_ALIAS) -> None: + def write_register_uint16(self, device_name: str, register_address: int, data: int) -> 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, register_address: int, data: int, device_name: s """ self._interpreter.write_register_uint16(self._session_handle, device_name, register_address, data) - def write_register_uint32(self, register_address: int, data: int, device_name: str = DEFAULT_DEVICES_ALIAS) -> None: + def write_register_uint32(self, device_name: str, register_address: int, data: int) -> 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, register_address: int, data: int, device_name: s """ self._interpreter.write_register_uint32(self._session_handle, device_name, register_address, data) - def write_register_uint64(self, register_address: int, data: int, device_name: str = DEFAULT_DEVICES_ALIAS) -> None: + def write_register_uint64(self, device_name: str, register_address: int, data: int) -> None: """Write data to the specified register. To write a single bitfield, consider using properties instead. diff --git a/src/codegen/metadata/nislscapi_full.json b/src/codegen/metadata/nislscapi_full.json index b71e0ff..bdab916 100644 --- a/src/codegen/metadata/nislscapi_full.json +++ b/src/codegen/metadata/nislscapi_full.json @@ -7014,7 +7014,6 @@ }, { "dataType": "Device", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -7060,7 +7059,6 @@ }, { "dataType": "PhysChan", - "default": "$DefaultPhysChans", "dir": [ "in" ], @@ -7149,7 +7147,6 @@ }, { "dataType": "Device", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -7195,7 +7192,6 @@ }, { "dataType": "Device", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -7241,7 +7237,6 @@ }, { "dataType": "Device", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -7287,7 +7282,6 @@ }, { "dataType": "Device", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -7333,7 +7327,6 @@ }, { "dataType": "Device", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -7379,7 +7372,6 @@ }, { "dataType": "Device", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -7425,7 +7417,6 @@ }, { "dataType": "Device", - "default": "$DefaultDevices", "dir": [ "in" ], @@ -7471,7 +7462,6 @@ }, { "dataType": "Device", - "default": "$DefaultDevices", "dir": [ "in" ], diff --git a/tests/unit/test_session.py b/tests/unit/test_session.py index 3a42386..93f63b2 100644 --- a/tests/unit/test_session.py +++ b/tests/unit/test_session.py @@ -895,7 +895,7 @@ def test___session_opened___execute_device_command___interpreter_called_with_arg ) -> None: session_handle = session._session_handle - session.execute_device_command("Reset", 10.0, "Dev1") + session.execute_device_command("Dev1", "Reset", 10.0) interpreter.execute_device_command.assert_called_once_with( session_handle, "Dev1", "Reset", 10.0 @@ -907,7 +907,7 @@ def test___session_opened___execute_physical_channel_command___interpreter_calle ) -> None: session_handle = session._session_handle - session.execute_physical_channel_command("Calibrate", 5.0, "Dev1/phys0") + session.execute_physical_channel_command("Dev1/phys0", "Calibrate", 5.0) interpreter.execute_physical_channel_command.assert_called_once_with( session_handle, "Dev1/phys0", "Calibrate", 5.0 @@ -941,7 +941,7 @@ def test___session_opened___read_register___returns_value( getattr(interpreter, method).return_value = value session_handle = session._session_handle - result = getattr(session, method)(address, "Dev1") + result = getattr(session, method)("Dev1", address) getattr(interpreter, method).assert_called_once_with(session_handle, "Dev1", address) assert result == value @@ -961,7 +961,7 @@ def test___session_opened___write_register___interpreter_called_with_args( ) -> None: session_handle = session._session_handle - getattr(session, method)(address, value, "Dev1") + getattr(session, method)("Dev1", address, value) getattr(interpreter, method).assert_called_once_with(session_handle, "Dev1", address, value) From ed44a8d9892b032a30acd87b7757cd217337525c Mon Sep 17 00:00:00 2001 From: "Jun Liang, Tan" Date: Tue, 25 Aug 2026 00:16:35 +0800 Subject: [PATCH 14/19] examples: Remove reservation_group from check_chassis_battery to align with the LabVIEW example Allow the session API to use its default reservation group when checking chassis battery. This matches the behavior of the equivalent LabVIEW example. Signed-off-by: Jun Liang, Tan --- examples/check_chassis_battery.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/check_chassis_battery.py b/examples/check_chassis_battery.py index d89a8f6..9efe046 100644 --- a/examples/check_chassis_battery.py +++ b/examples/check_chassis_battery.py @@ -23,12 +23,10 @@ def main(chassis_name: str) -> None: try: physical_channel_names = f"{chassis_name}/BatteryVoltageSensor" reservation_access = ReservationAccess.READ_ONLY - reservation_group = "admin" with Session.initialize_session_with_physical_channels( physical_channel_names=physical_channel_names, reservation_access=reservation_access, - reservation_group=reservation_group, ) as session: sensor_lower_critical = session.get_physical_channel_property_double( property_name="SensorLowerCritical", From d00b777028bc3c6d71fcf09307de7a6b4bb7c885 Mon Sep 17 00:00:00 2001 From: "Jun Liang, Tan" Date: Tue, 25 Aug 2026 00:51:29 +0800 Subject: [PATCH 15/19] examples: Restore original parameter ordering and update to use DEFAULT_CHANS_ALIAS to align with the LabVIEW example Signed-off-by: Jun Liang, Tan --- examples/check_chassis_battery.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/check_chassis_battery.py b/examples/check_chassis_battery.py index 9efe046..ff737af 100644 --- a/examples/check_chassis_battery.py +++ b/examples/check_chassis_battery.py @@ -3,7 +3,7 @@ import click from nislsc import Session -from nislsc.constants import ReservationAccess +from nislsc.constants import DEFAULT_PHYS_CHANS_ALIAS, ReservationAccess @click.command() @@ -29,16 +29,16 @@ def main(chassis_name: str) -> None: reservation_access=reservation_access, ) as session: sensor_lower_critical = session.get_physical_channel_property_double( + physical_channel_names=DEFAULT_PHYS_CHANS_ALIAS, property_name="SensorLowerCritical", - physical_channel_names=physical_channel_names, ) sensor_reading = session.get_physical_channel_property_double( + physical_channel_names=DEFAULT_PHYS_CHANS_ALIAS, property_name="SensorReading", - physical_channel_names=physical_channel_names, ) health_state = session.get_physical_channel_property_string( + physical_channel_names=DEFAULT_PHYS_CHANS_ALIAS, property_name="HealthState", - physical_channel_names=physical_channel_names, ) needs_replacement = sensor_reading < sensor_lower_critical From 487019b1338f64d13e60016ed0bfd7cc4935138c Mon Sep 17 00:00:00 2001 From: "Jun Liang, Tan" Date: Tue, 25 Aug 2026 00:59:24 +0800 Subject: [PATCH 16/19] examples: Remove reservation_access and reservation_group from reset_device to align with the LabVIEW example Signed-off-by: Jun Liang, Tan --- examples/reset_device.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/examples/reset_device.py b/examples/reset_device.py index cdc46f1..e6c8c4a 100644 --- a/examples/reset_device.py +++ b/examples/reset_device.py @@ -3,7 +3,6 @@ import click from nislsc import Session -from nislsc.constants import ReservationAccess @click.command() @@ -22,13 +21,8 @@ def main(device_names: str) -> None: reset_device SLSC-12001-XXXXXXXX-Mod1,SLSC-12001-XXXXXXXX-Mod2 """ # noqa: D301 try: - reservation_access = ReservationAccess.READ_ONLY - reservation_group = "admin" - with Session.initialize_session_with_devices( device_names=device_names, - reservation_access=reservation_access, - reservation_group=reservation_group, ) as session: session.reset_devices(device_names) print(f"Reset command sent to device(s) {device_names}") From b7c6f0b5a9ba0dab0346e043f19598371ea18df6 Mon Sep 17 00:00:00 2001 From: "Jun Liang, Tan" Date: Tue, 25 Aug 2026 01:08:00 +0800 Subject: [PATCH 17/19] examples: Remove reservation_group from show_command_and_property_tree to align with the LabVIEW example Signed-off-by: Jun Liang, Tan --- examples/show_command_and_property_tree.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/show_command_and_property_tree.py b/examples/show_command_and_property_tree.py index 2750c9a..d5cb805 100644 --- a/examples/show_command_and_property_tree.py +++ b/examples/show_command_and_property_tree.py @@ -50,12 +50,10 @@ def get_command_and_property_tree(device_name: str) -> dict: Dictionary containing the command and property tree of the device. """ reservation_access = ReservationAccess.READ_ONLY - reservation_group = "admin" with Session.initialize_session_with_devices( device_names=device_name, reservation_access=reservation_access, - reservation_group=reservation_group, ) as session: data = { From 0df81eca652c938747457329d128652cbbb64335 Mon Sep 17 00:00:00 2001 From: "Jun Liang, Tan" Date: Tue, 25 Aug 2026 01:16:25 +0800 Subject: [PATCH 18/19] examples: Remove device_names from reset_device to align with the LabVIEW example Remove device_names from reset_devices so that default devices are used. This aligns with the behavior of the equivalent LabVIEW example. Signed-off-by: Jun Liang, Tan --- examples/reset_device.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/reset_device.py b/examples/reset_device.py index e6c8c4a..c264747 100644 --- a/examples/reset_device.py +++ b/examples/reset_device.py @@ -24,7 +24,7 @@ def main(device_names: str) -> None: with Session.initialize_session_with_devices( device_names=device_names, ) as session: - session.reset_devices(device_names) + session.reset_devices() print(f"Reset command sent to device(s) {device_names}") except Exception as e: click.echo(f"Error: {e}", err=True) From abc88ddfb5cf9b4837fbec23c94513c7b9a7fa49 Mon Sep 17 00:00:00 2001 From: "Jun Liang, Tan" Date: Tue, 25 Aug 2026 01:29:40 +0800 Subject: [PATCH 19/19] examples: Update show_command_and_property_tree to use the default device alias for property queries Signed-off-by: Jun Liang, Tan --- examples/show_command_and_property_tree.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/show_command_and_property_tree.py b/examples/show_command_and_property_tree.py index d5cb805..e7ed05b 100644 --- a/examples/show_command_and_property_tree.py +++ b/examples/show_command_and_property_tree.py @@ -9,6 +9,7 @@ from nislsc.constants import ( CommandProperty, DataType, + DEFAULT_DEVICES_ALIAS, DeviceProperty, PhysicalChannelProperty, PropertyAccess, @@ -63,17 +64,17 @@ def get_command_and_property_tree(device_name: str) -> dict: } device_commands = session.get_device_property_string_array( - device_name, + DEFAULT_DEVICES_ALIAS, DeviceProperty.COMMANDS, ) device_properties = session.get_device_property_string_array( - device_name, + DEFAULT_DEVICES_ALIAS, DeviceProperty.PROPERTIES, ) device_physical_channels = session.get_device_property_string_array( - device_name, + DEFAULT_DEVICES_ALIAS, DeviceProperty.PHYSICAL_CHANNELS, )