From cc38a9c71c1f2d6376f178a30c7bc84a3d27bf3f Mon Sep 17 00:00:00 2001 From: Marcos Kirsch Date: Wed, 13 Apr 2022 13:55:35 -0500 Subject: [PATCH 1/6] Generated files but after running black for diffing purposes --- generated/nidcpower/nidcpower/__init__.py | 93 +- generated/nidcpower/nidcpower/_attributes.py | 54 +- generated/nidcpower/nidcpower/_converters.py | 125 +- generated/nidcpower/nidcpower/_library.py | 1131 ++++-- .../nidcpower/nidcpower/_library_singleton.py | 25 +- generated/nidcpower/nidcpower/_visatype.py | 5 +- generated/nidcpower/nidcpower/enums.py | 256 +- generated/nidcpower/nidcpower/errors.py | 63 +- generated/nidcpower/nidcpower/session.py | 2205 ++++++++---- .../nidcpower/unit_tests/_matchers.py | 153 +- .../nidcpower/unit_tests/_mock_helper.py | 1566 +++++---- generated/nidcpower/setup.py | 37 +- generated/nidigital/nidigital/__init__.py | 97 +- generated/nidigital/nidigital/_attributes.py | 54 +- generated/nidigital/nidigital/_converters.py | 125 +- generated/nidigital/nidigital/_library.py | 1858 ++++++++-- .../nidigital/nidigital/_library_singleton.py | 25 +- generated/nidigital/nidigital/_visatype.py | 5 +- generated/nidigital/nidigital/enums.py | 300 +- generated/nidigital/nidigital/errors.py | 63 +- .../history_ram_cycle_information.py | 87 +- generated/nidigital/nidigital/session.py | 3075 ++++++++++++----- .../nidigital/unit_tests/_matchers.py | 153 +- .../nidigital/unit_tests/_mock_helper.py | 2313 ++++++++----- .../nidigital/unit_tests/test_nidigital.py | 747 +++- generated/nidigital/setup.py | 39 +- generated/nidmm/nidmm/__init__.py | 93 +- generated/nidmm/nidmm/_attributes.py | 54 +- generated/nidmm/nidmm/_converters.py | 125 +- generated/nidmm/nidmm/_library.py | 684 +++- generated/nidmm/nidmm/_library_singleton.py | 25 +- generated/nidmm/nidmm/_visatype.py | 5 +- generated/nidmm/nidmm/enums.py | 432 +-- generated/nidmm/nidmm/errors.py | 63 +- generated/nidmm/nidmm/session.py | 1390 +++++--- generated/nidmm/nidmm/unit_tests/_matchers.py | 153 +- .../nidmm/nidmm/unit_tests/_mock_helper.py | 1187 ++++--- generated/nidmm/setup.py | 37 +- generated/nifake/nifake/__init__.py | 93 +- generated/nifake/nifake/_attributes.py | 54 +- generated/nifake/nifake/_converters.py | 125 +- generated/nifake/nifake/_library.py | 960 +++-- generated/nifake/nifake/_library_singleton.py | 25 +- generated/nifake/nifake/_visatype.py | 5 +- generated/nifake/nifake/custom_struct.py | 14 +- generated/nifake/nifake/enums.py | 70 +- generated/nifake/nifake/errors.py | 63 +- generated/nifake/nifake/session.py | 1452 +++++--- .../nifake/nifake/unit_tests/_matchers.py | 153 +- .../nifake/nifake/unit_tests/_mock_helper.py | 1572 +++++---- .../nifake/unit_tests/test_converters.py | 586 +++- .../nifake/nifake/unit_tests/test_session.py | 2104 +++++++---- generated/nifake/setup.py | 39 +- generated/nifgen/nifgen/__init__.py | 93 +- generated/nifgen/nifgen/_attributes.py | 54 +- generated/nifgen/nifgen/_converters.py | 125 +- generated/nifgen/nifgen/_library.py | 1195 +++++-- generated/nifgen/nifgen/_library_singleton.py | 25 +- generated/nifgen/nifgen/_visatype.py | 5 +- generated/nifgen/nifgen/enums.py | 318 +- generated/nifgen/nifgen/errors.py | 63 +- generated/nifgen/nifgen/session.py | 2390 +++++++++---- .../nifgen/nifgen/unit_tests/_matchers.py | 153 +- .../nifgen/nifgen/unit_tests/_mock_helper.py | 1913 ++++++---- generated/nifgen/setup.py | 39 +- generated/nimodinst/nimodinst/__init__.py | 93 +- generated/nimodinst/nimodinst/_converters.py | 125 +- generated/nimodinst/nimodinst/_library.py | 110 +- .../nimodinst/nimodinst/_library_singleton.py | 25 +- generated/nimodinst/nimodinst/_visatype.py | 5 +- generated/nimodinst/nimodinst/errors.py | 49 +- generated/nimodinst/nimodinst/session.py | 235 +- .../nimodinst/unit_tests/_matchers.py | 153 +- .../nimodinst/unit_tests/_mock_helper.py | 158 +- .../nimodinst/unit_tests/test_modinst.py | 295 +- generated/nimodinst/setup.py | 37 +- generated/niscope/niscope/__init__.py | 93 +- generated/niscope/niscope/_attributes.py | 54 +- generated/niscope/niscope/_converters.py | 125 +- generated/niscope/niscope/_library.py | 1103 ++++-- .../niscope/niscope/_library_singleton.py | 25 +- generated/niscope/niscope/_visatype.py | 5 +- generated/niscope/niscope/enums.py | 520 +-- generated/niscope/niscope/errors.py | 63 +- .../niscope/niscope/measurement_stats.py | 44 +- generated/niscope/niscope/session.py | 2613 +++++++++----- .../niscope/niscope/unit_tests/_matchers.py | 153 +- .../niscope/unit_tests/_mock_helper.py | 1436 ++++---- .../niscope/unit_tests/test_niscope.py | 12 +- generated/niscope/niscope/waveform_info.py | 119 +- generated/niscope/setup.py | 39 +- generated/nise/nise/__init__.py | 93 +- generated/nise/nise/_converters.py | 125 +- generated/nise/nise/_library.py | 181 +- generated/nise/nise/_library_singleton.py | 25 +- generated/nise/nise/_visatype.py | 5 +- generated/nise/nise/enums.py | 64 +- generated/nise/nise/errors.py | 57 +- generated/nise/nise/session.py | 363 +- generated/nise/nise/unit_tests/_matchers.py | 153 +- .../nise/nise/unit_tests/_mock_helper.py | 289 +- generated/nise/setup.py | 37 +- generated/niswitch/niswitch/__init__.py | 93 +- generated/niswitch/niswitch/_attributes.py | 54 +- generated/niswitch/niswitch/_converters.py | 125 +- generated/niswitch/niswitch/_library.py | 504 ++- .../niswitch/niswitch/_library_singleton.py | 25 +- generated/niswitch/niswitch/_visatype.py | 5 +- generated/niswitch/niswitch/enums.py | 376 +- generated/niswitch/niswitch/errors.py | 63 +- generated/niswitch/niswitch/session.py | 1036 ++++-- .../niswitch/niswitch/unit_tests/_matchers.py | 153 +- .../niswitch/unit_tests/_mock_helper.py | 824 +++-- generated/niswitch/setup.py | 37 +- generated/nitclk/nitclk/__init__.py | 93 +- generated/nitclk/nitclk/_attributes.py | 54 +- generated/nitclk/nitclk/_converters.py | 133 +- generated/nitclk/nitclk/_library.py | 264 +- generated/nitclk/nitclk/_library_singleton.py | 25 +- generated/nitclk/nitclk/_visatype.py | 5 +- generated/nitclk/nitclk/errors.py | 49 +- generated/nitclk/nitclk/session.py | 522 ++- .../nitclk/nitclk/unit_tests/_matchers.py | 153 +- .../nitclk/nitclk/unit_tests/_mock_helper.py | 324 +- .../nitclk/nitclk/unit_tests/test_nitclk.py | 338 +- generated/nitclk/setup.py | 37 +- 126 files changed, 31511 insertions(+), 15452 deletions(-) diff --git a/generated/nidcpower/nidcpower/__init__.py b/generated/nidcpower/nidcpower/__init__.py index b4c976047..6204442ad 100644 --- a/generated/nidcpower/nidcpower/__init__.py +++ b/generated/nidcpower/nidcpower/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = '1.4.2.dev0' +__version__ = "1.4.2.dev0" from nidcpower.enums import * # noqa: F403,F401,H303 from nidcpower.errors import DriverWarning # noqa: F401 @@ -11,12 +11,12 @@ def get_diagnostic_information(): - '''Get diagnostic information about the system state that is suitable for printing or logging + """Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - ''' + """ import os import pkg_resources import platform @@ -24,73 +24,80 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return (struct.calcsize("P") == 8) + return struct.calcsize("P") == 8 def is_os_64bit(): - return platform.machine().endswith('64') + return platform.machine().endswith("64") def is_venv(): - return 'VIRTUAL_ENV' in os.environ + return "VIRTUAL_ENV" in os.environ info = {} - info['os'] = {} - info['python'] = {} - info['driver'] = {} - info['module'] = {} - if platform.system() == 'Windows': + info["os"] = {} + info["python"] = {} + info["driver"] = {} + info["module"] = {} + if platform.system() == "Windows": try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = 'Windows' + os_name = "Windows" try: - driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-DCPower\CurrentVersion") + driver_version_key = winreg.OpenKey( + winreg.HKEY_LOCAL_MACHINE, + r"SOFTWARE\National Instruments\NI-DCPower\CurrentVersion", + ) driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = 'Unknown' - elif platform.system() == 'Linux': - os_name = 'Linux' - driver_version = 'Unknown' + driver_version = "Unknown" + elif platform.system() == "Linux": + os_name = "Linux" + driver_version = "Unknown" else: - raise SystemError('Unsupported platform: {}'.format(platform.system())) + raise SystemError("Unsupported platform: {}".format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] - - info['os']['name'] = os_name - info['os']['version'] = platform.version() - info['os']['bits'] = '64' if is_os_64bit() else '32' - info['driver']['name'] = "NI-DCPower" - info['driver']['version'] = driver_version - info['module']['name'] = 'nidcpower' - info['module']['version'] = "1.4.2.dev0" - info['python']['version'] = sys.version - info['python']['bits'] = '64' if is_python_64bit() else '32' - info['python']['is_venv'] = is_venv() - info['python']['packages'] = installed_packages_list + installed_packages_list = [ + { + "name": i.key, + "version": i.version, + } + for i in installed_packages + ] + + info["os"]["name"] = os_name + info["os"]["version"] = platform.version() + info["os"]["bits"] = "64" if is_os_64bit() else "32" + info["driver"]["name"] = "NI-DCPower" + info["driver"]["version"] = driver_version + info["module"]["name"] = "nidcpower" + info["module"]["version"] = "1.4.2.dev0" + info["python"]["version"] = sys.version + info["python"]["bits"] = "64" if is_python_64bit() else "32" + info["python"]["is_venv"] = is_venv() + info["python"]["packages"] = installed_packages_list return info def print_diagnostic_information(): - '''Print diagnostic information in a format suitable for issue report + """Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - ''' + """ info = get_diagnostic_information() - row_format = ' {:<10} {}' - for type in ['OS', 'Driver', 'Module', 'Python']: + row_format = " {:<10} {}" + for type in ["OS", "Driver", "Module", "Python"]: typename = type.lower() - print(type + ':') + print(type + ":") for item in info[typename]: - if item != 'packages': - print(row_format.format(item.title() + ':', info[typename][item])) - print(' Installed Packages:') - for p in info['python']['packages']: - print((' ' * 8) + p['name'] + '==' + p['version']) + if item != "packages": + print(row_format.format(item.title() + ":", info[typename][item])) + print(" Installed Packages:") + for p in info["python"]["packages"]: + print((" " * 8) + p["name"] + "==" + p["version"]) return info - - diff --git a/generated/nidcpower/nidcpower/_attributes.py b/generated/nidcpower/nidcpower/_attributes.py index 1ca78bd23..f7cb3fcda 100644 --- a/generated/nidcpower/nidcpower/_attributes.py +++ b/generated/nidcpower/nidcpower/_attributes.py @@ -6,14 +6,13 @@ class Attribute(object): - '''Base class for all typed attributes.''' + """Base class for all typed attributes.""" def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -22,16 +21,19 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) + return hightime.timedelta( + milliseconds=session._get_attribute_vi_int32(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) + session._set_attribute_vi_int32( + self._attribute_id, + _converters.convert_timedelta_to_milliseconds_int32(value).value, + ) class AttributeViInt64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -40,7 +42,6 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -49,16 +50,19 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) + return hightime.timedelta( + seconds=session._get_attribute_vi_real64(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) + session._set_attribute_vi_real64( + self._attribute_id, + _converters.convert_timedelta_to_seconds_real64(value).value, + ) class AttributeViString(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -67,16 +71,17 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) + session._set_attribute_vi_string( + self._attribute_id, + _converters.convert_repeated_capabilities_without_prefix(value), + ) class AttributeViBoolean(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -85,31 +90,36 @@ def __set__(self, session, value): class AttributeEnum(object): - def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) + return self._attribute_type( + self._underlying_attribute.__get__(session, session_type) + ) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) + raise TypeError( + "must be " + + str(self._attribute_type.__name__) + + " not " + + str(type(value).__name__) + ) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): - def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from nidcpower.session import SessionReference + return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) - - - + session._set_attribute_vi_session( + self._attribute_id, _converters.convert_to_nitclk_session_number(value) + ) diff --git a/generated/nidcpower/nidcpower/_converters.py b/generated/nidcpower/nidcpower/_converters.py index 3da843692..f4c70b5c3 100644 --- a/generated/nidcpower/nidcpower/_converters.py +++ b/generated/nidcpower/nidcpower/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - '''Base version that should not be called + """Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,36 +40,38 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - ''' - raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + """ + raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - '''Integer version''' + """Integer version""" return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - '''String version (this is the most complex) + """String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - ''' + """ # First we deal with a list - rep_cap_list = repeated_capability.split(',') + rep_cap_list = repeated_capability.split(",") if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, '').replace(':', '-') - rc = r.split('-') + r = repeated_capability.strip().replace(prefix, "").replace(":", "-") + rc = r.split("-") if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + raise errors.InvalidRepeatedCapabilityError( + "Multiple '-' or ':'", repeated_capability + ) try: start = int(rc[0]) end = int(rc[1]) @@ -85,7 +87,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, '').strip()] + return [repeated_capability.replace(prefix, "").strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -94,7 +96,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - '''Iterable version - can handle lists, ranges, and tuples''' + """Iterable version - can handle lists, ranges, and tuples""" rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -103,16 +105,22 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - '''slice version''' + """slice version""" + def ifnone(a, b): return b if a is None else a + # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) + rng = range( + ifnone(repeated_capability.start, 0), + repeated_capability.stop, + ifnone(repeated_capability.step, 1), + ) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=''): - '''Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=""): + """Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -120,15 +128,17 @@ def convert_repeated_capabilities(repeated_capability, prefix=''): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - ''' + """ # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] + return [ + prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) + ] def convert_repeated_capabilities_without_prefix(repeated_capability): - '''Convert a repeated capabilities object, without any prefix, to a comma delimited list + """Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -144,8 +154,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - ''' - return ','.join(convert_repeated_capabilities(repeated_capability, '')) + """ + return ",".join(convert_repeated_capabilities(repeated_capability, "")) def _convert_timedelta(value, library_type, scaling): @@ -158,7 +168,14 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: + if library_type in [ + _visatype.ViInt64, + _visatype.ViInt32, + _visatype.ViUInt32, + _visatype.ViInt16, + _visatype.ViUInt16, + _visatype.ViInt8, + ]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -195,34 +212,36 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - 'rangecheck': 'RangeCheck', - 'queryinstrstatus': 'QueryInstrStatus', - 'cache': 'Cache', - 'simulate': 'Simulate', - 'recordcoercions': 'RecordCoercions', - 'interchangecheck': 'InterchangeCheck', - 'driversetup': 'DriverSetup', - 'range_check': 'RangeCheck', - 'query_instr_status': 'QueryInstrStatus', - 'record_coercions': 'RecordCoercions', - 'interchange_check': 'InterchangeCheck', - 'driver_setup': 'DriverSetup', + "rangecheck": "RangeCheck", + "queryinstrstatus": "QueryInstrStatus", + "cache": "Cache", + "simulate": "Simulate", + "recordcoercions": "RecordCoercions", + "interchangecheck": "InterchangeCheck", + "driversetup": "DriverSetup", + "range_check": "RangeCheck", + "query_instr_status": "QueryInstrStatus", + "record_coercions": "RecordCoercions", + "interchange_check": "InterchangeCheck", + "driver_setup": "DriverSetup", } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': - value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') - elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': + if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": + value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") + elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": if not isinstance(values[k], dict): - raise TypeError('DriverSetup must be a dictionary') - value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) + raise TypeError("DriverSetup must be a dictionary") + value = "DriverSetup=" + ( + ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) + ) else: - value = k + ('=1' if values[k] is True else '=0') + value = k + ("=1" if values[k] is True else "=0") init_with_options.append(value) - init_with_options_string = ','.join(init_with_options) + init_with_options_string = ",".join(init_with_options) return init_with_options_string @@ -251,11 +270,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(',')] + return [x.strip() for x in comma_separated_string.split(",")] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -267,11 +286,17 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - ''' - chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) - repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] + """ + chained_repeated_capability_items = convert_comma_separated_string_to_list( + chained_repeated_capability + ) + repeated_capability_lists = [ + [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) + ] for item in chained_repeated_capability_items: - repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] - return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] - - + repeated_capability_lists = [ + x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) + ] + return [ + ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists + ] diff --git a/generated/nidcpower/nidcpower/_library.py b/generated/nidcpower/nidcpower/_library.py index 3d518981d..18d2572c2 100644 --- a/generated/nidcpower/nidcpower/_library.py +++ b/generated/nidcpower/nidcpower/_library.py @@ -9,11 +9,11 @@ class Library(object): - '''Library + """Library Wrapper around driver library. Class will setup the correct ctypes information for every function on first call. - ''' + """ def __init__(self, ctypes_library): self._func_lock = threading.Lock() @@ -88,351 +88,854 @@ def _get_library_function(self, name): def niDCPower_AbortWithChannels(self, vi, channel_name): # noqa: N802 with self._func_lock: if self.niDCPower_AbortWithChannels_cfunc is None: - self.niDCPower_AbortWithChannels_cfunc = self._get_library_function('niDCPower_AbortWithChannels') - self.niDCPower_AbortWithChannels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDCPower_AbortWithChannels_cfunc = self._get_library_function( + "niDCPower_AbortWithChannels" + ) + self.niDCPower_AbortWithChannels_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDCPower_AbortWithChannels_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_AbortWithChannels_cfunc(vi, channel_name) def niDCPower_CalSelfCalibrate(self, vi, channel_name): # noqa: N802 with self._func_lock: if self.niDCPower_CalSelfCalibrate_cfunc is None: - self.niDCPower_CalSelfCalibrate_cfunc = self._get_library_function('niDCPower_CalSelfCalibrate') - self.niDCPower_CalSelfCalibrate_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDCPower_CalSelfCalibrate_cfunc = self._get_library_function( + "niDCPower_CalSelfCalibrate" + ) + self.niDCPower_CalSelfCalibrate_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDCPower_CalSelfCalibrate_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_CalSelfCalibrate_cfunc(vi, channel_name) - def niDCPower_ClearLatchedOutputCutoffState(self, vi, channel_name, output_cutoff_reason): # noqa: N802 + def niDCPower_ClearLatchedOutputCutoffState( + self, vi, channel_name, output_cutoff_reason + ): # noqa: N802 with self._func_lock: if self.niDCPower_ClearLatchedOutputCutoffState_cfunc is None: - self.niDCPower_ClearLatchedOutputCutoffState_cfunc = self._get_library_function('niDCPower_ClearLatchedOutputCutoffState') - self.niDCPower_ClearLatchedOutputCutoffState_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32] # noqa: F405 - self.niDCPower_ClearLatchedOutputCutoffState_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_ClearLatchedOutputCutoffState_cfunc(vi, channel_name, output_cutoff_reason) + self.niDCPower_ClearLatchedOutputCutoffState_cfunc = ( + self._get_library_function( + "niDCPower_ClearLatchedOutputCutoffState" + ) + ) + self.niDCPower_ClearLatchedOutputCutoffState_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ] # noqa: F405 + self.niDCPower_ClearLatchedOutputCutoffState_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_ClearLatchedOutputCutoffState_cfunc( + vi, channel_name, output_cutoff_reason + ) def niDCPower_CommitWithChannels(self, vi, channel_name): # noqa: N802 with self._func_lock: if self.niDCPower_CommitWithChannels_cfunc is None: - self.niDCPower_CommitWithChannels_cfunc = self._get_library_function('niDCPower_CommitWithChannels') - self.niDCPower_CommitWithChannels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDCPower_CommitWithChannels_cfunc = self._get_library_function( + "niDCPower_CommitWithChannels" + ) + self.niDCPower_CommitWithChannels_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDCPower_CommitWithChannels_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_CommitWithChannels_cfunc(vi, channel_name) - def niDCPower_ConfigureApertureTime(self, vi, channel_name, aperture_time, units): # noqa: N802 + def niDCPower_ConfigureApertureTime( + self, vi, channel_name, aperture_time, units + ): # noqa: N802 with self._func_lock: if self.niDCPower_ConfigureApertureTime_cfunc is None: - self.niDCPower_ConfigureApertureTime_cfunc = self._get_library_function('niDCPower_ConfigureApertureTime') - self.niDCPower_ConfigureApertureTime_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViInt32] # noqa: F405 - self.niDCPower_ConfigureApertureTime_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_ConfigureApertureTime_cfunc(vi, channel_name, aperture_time, units) - - def niDCPower_CreateAdvancedSequenceCommitStepWithChannels(self, vi, channel_name, set_as_active_step): # noqa: N802 + self.niDCPower_ConfigureApertureTime_cfunc = self._get_library_function( + "niDCPower_ConfigureApertureTime" + ) + self.niDCPower_ConfigureApertureTime_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViReal64, + ViInt32, + ] # noqa: F405 + self.niDCPower_ConfigureApertureTime_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_ConfigureApertureTime_cfunc( + vi, channel_name, aperture_time, units + ) + + def niDCPower_CreateAdvancedSequenceCommitStepWithChannels( + self, vi, channel_name, set_as_active_step + ): # noqa: N802 with self._func_lock: - if self.niDCPower_CreateAdvancedSequenceCommitStepWithChannels_cfunc is None: - self.niDCPower_CreateAdvancedSequenceCommitStepWithChannels_cfunc = self._get_library_function('niDCPower_CreateAdvancedSequenceCommitStepWithChannels') - self.niDCPower_CreateAdvancedSequenceCommitStepWithChannels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViBoolean] # noqa: F405 - self.niDCPower_CreateAdvancedSequenceCommitStepWithChannels_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_CreateAdvancedSequenceCommitStepWithChannels_cfunc(vi, channel_name, set_as_active_step) - - def niDCPower_CreateAdvancedSequenceStepWithChannels(self, vi, channel_name, set_as_active_step): # noqa: N802 + if ( + self.niDCPower_CreateAdvancedSequenceCommitStepWithChannels_cfunc + is None + ): + self.niDCPower_CreateAdvancedSequenceCommitStepWithChannels_cfunc = ( + self._get_library_function( + "niDCPower_CreateAdvancedSequenceCommitStepWithChannels" + ) + ) + self.niDCPower_CreateAdvancedSequenceCommitStepWithChannels_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViBoolean, + ] # noqa: F405 + self.niDCPower_CreateAdvancedSequenceCommitStepWithChannels_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_CreateAdvancedSequenceCommitStepWithChannels_cfunc( + vi, channel_name, set_as_active_step + ) + + def niDCPower_CreateAdvancedSequenceStepWithChannels( + self, vi, channel_name, set_as_active_step + ): # noqa: N802 with self._func_lock: if self.niDCPower_CreateAdvancedSequenceStepWithChannels_cfunc is None: - self.niDCPower_CreateAdvancedSequenceStepWithChannels_cfunc = self._get_library_function('niDCPower_CreateAdvancedSequenceStepWithChannels') - self.niDCPower_CreateAdvancedSequenceStepWithChannels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViBoolean] # noqa: F405 - self.niDCPower_CreateAdvancedSequenceStepWithChannels_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_CreateAdvancedSequenceStepWithChannels_cfunc(vi, channel_name, set_as_active_step) - - def niDCPower_CreateAdvancedSequenceWithChannels(self, vi, channel_name, sequence_name, attribute_id_count, attribute_ids, set_as_active_sequence): # noqa: N802 + self.niDCPower_CreateAdvancedSequenceStepWithChannels_cfunc = ( + self._get_library_function( + "niDCPower_CreateAdvancedSequenceStepWithChannels" + ) + ) + self.niDCPower_CreateAdvancedSequenceStepWithChannels_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViBoolean, + ] # noqa: F405 + self.niDCPower_CreateAdvancedSequenceStepWithChannels_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_CreateAdvancedSequenceStepWithChannels_cfunc( + vi, channel_name, set_as_active_step + ) + + def niDCPower_CreateAdvancedSequenceWithChannels( + self, + vi, + channel_name, + sequence_name, + attribute_id_count, + attribute_ids, + set_as_active_sequence, + ): # noqa: N802 with self._func_lock: if self.niDCPower_CreateAdvancedSequenceWithChannels_cfunc is None: - self.niDCPower_CreateAdvancedSequenceWithChannels_cfunc = self._get_library_function('niDCPower_CreateAdvancedSequenceWithChannels') - self.niDCPower_CreateAdvancedSequenceWithChannels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViInt32), ViBoolean] # noqa: F405 - self.niDCPower_CreateAdvancedSequenceWithChannels_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_CreateAdvancedSequenceWithChannels_cfunc(vi, channel_name, sequence_name, attribute_id_count, attribute_ids, set_as_active_sequence) - - def niDCPower_DeleteAdvancedSequenceWithChannels(self, vi, channel_name, sequence_name): # noqa: N802 + self.niDCPower_CreateAdvancedSequenceWithChannels_cfunc = ( + self._get_library_function( + "niDCPower_CreateAdvancedSequenceWithChannels" + ) + ) + self.niDCPower_CreateAdvancedSequenceWithChannels_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViInt32), + ViBoolean, + ] # noqa: F405 + self.niDCPower_CreateAdvancedSequenceWithChannels_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_CreateAdvancedSequenceWithChannels_cfunc( + vi, + channel_name, + sequence_name, + attribute_id_count, + attribute_ids, + set_as_active_sequence, + ) + + def niDCPower_DeleteAdvancedSequenceWithChannels( + self, vi, channel_name, sequence_name + ): # noqa: N802 with self._func_lock: if self.niDCPower_DeleteAdvancedSequenceWithChannels_cfunc is None: - self.niDCPower_DeleteAdvancedSequenceWithChannels_cfunc = self._get_library_function('niDCPower_DeleteAdvancedSequenceWithChannels') - self.niDCPower_DeleteAdvancedSequenceWithChannels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar)] # noqa: F405 - self.niDCPower_DeleteAdvancedSequenceWithChannels_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_DeleteAdvancedSequenceWithChannels_cfunc(vi, channel_name, sequence_name) + self.niDCPower_DeleteAdvancedSequenceWithChannels_cfunc = ( + self._get_library_function( + "niDCPower_DeleteAdvancedSequenceWithChannels" + ) + ) + self.niDCPower_DeleteAdvancedSequenceWithChannels_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niDCPower_DeleteAdvancedSequenceWithChannels_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_DeleteAdvancedSequenceWithChannels_cfunc( + vi, channel_name, sequence_name + ) def niDCPower_Disable(self, vi): # noqa: N802 with self._func_lock: if self.niDCPower_Disable_cfunc is None: - self.niDCPower_Disable_cfunc = self._get_library_function('niDCPower_Disable') + self.niDCPower_Disable_cfunc = self._get_library_function( + "niDCPower_Disable" + ) self.niDCPower_Disable_cfunc.argtypes = [ViSession] # noqa: F405 self.niDCPower_Disable_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_Disable_cfunc(vi) - def niDCPower_ExportAttributeConfigurationBuffer(self, vi, size, configuration): # noqa: N802 + def niDCPower_ExportAttributeConfigurationBuffer( + self, vi, size, configuration + ): # noqa: N802 with self._func_lock: if self.niDCPower_ExportAttributeConfigurationBuffer_cfunc is None: - self.niDCPower_ExportAttributeConfigurationBuffer_cfunc = self._get_library_function('niDCPower_ExportAttributeConfigurationBuffer') - self.niDCPower_ExportAttributeConfigurationBuffer_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt8)] # noqa: F405 - self.niDCPower_ExportAttributeConfigurationBuffer_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_ExportAttributeConfigurationBuffer_cfunc(vi, size, configuration) + self.niDCPower_ExportAttributeConfigurationBuffer_cfunc = ( + self._get_library_function( + "niDCPower_ExportAttributeConfigurationBuffer" + ) + ) + self.niDCPower_ExportAttributeConfigurationBuffer_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViInt8), + ] # noqa: F405 + self.niDCPower_ExportAttributeConfigurationBuffer_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_ExportAttributeConfigurationBuffer_cfunc( + vi, size, configuration + ) def niDCPower_ExportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niDCPower_ExportAttributeConfigurationFile_cfunc is None: - self.niDCPower_ExportAttributeConfigurationFile_cfunc = self._get_library_function('niDCPower_ExportAttributeConfigurationFile') - self.niDCPower_ExportAttributeConfigurationFile_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 - self.niDCPower_ExportAttributeConfigurationFile_cfunc.restype = ViStatus # noqa: F405 + self.niDCPower_ExportAttributeConfigurationFile_cfunc = ( + self._get_library_function( + "niDCPower_ExportAttributeConfigurationFile" + ) + ) + self.niDCPower_ExportAttributeConfigurationFile_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niDCPower_ExportAttributeConfigurationFile_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niDCPower_ExportAttributeConfigurationFile_cfunc(vi, file_path) - def niDCPower_FancyInitialize(self, resource_name, channels, reset, option_string, vi, independent_channels): # noqa: N802 + def niDCPower_FancyInitialize( + self, resource_name, channels, reset, option_string, vi, independent_channels + ): # noqa: N802 with self._func_lock: if self.niDCPower_FancyInitialize_cfunc is None: - self.niDCPower_FancyInitialize_cfunc = self._get_library_function('niDCPower_FancyInitialize') - self.niDCPower_FancyInitialize_cfunc.argtypes = [ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViBoolean, ctypes.POINTER(ViChar), ctypes.POINTER(ViSession), ViBoolean] # noqa: F405 + self.niDCPower_FancyInitialize_cfunc = self._get_library_function( + "niDCPower_FancyInitialize" + ) + self.niDCPower_FancyInitialize_cfunc.argtypes = [ + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViBoolean, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViSession), + ViBoolean, + ] # noqa: F405 self.niDCPower_FancyInitialize_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_FancyInitialize_cfunc(resource_name, channels, reset, option_string, vi, independent_channels) - - def niDCPower_FetchMultiple(self, vi, channel_name, timeout, count, voltage_measurements, current_measurements, in_compliance, actual_count): # noqa: N802 + return self.niDCPower_FancyInitialize_cfunc( + resource_name, channels, reset, option_string, vi, independent_channels + ) + + def niDCPower_FetchMultiple( + self, + vi, + channel_name, + timeout, + count, + voltage_measurements, + current_measurements, + in_compliance, + actual_count, + ): # noqa: N802 with self._func_lock: if self.niDCPower_FetchMultiple_cfunc is None: - self.niDCPower_FetchMultiple_cfunc = self._get_library_function('niDCPower_FetchMultiple') - self.niDCPower_FetchMultiple_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ctypes.POINTER(ViBoolean), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDCPower_FetchMultiple_cfunc = self._get_library_function( + "niDCPower_FetchMultiple" + ) + self.niDCPower_FetchMultiple_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViReal64, + ViInt32, + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViBoolean), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niDCPower_FetchMultiple_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_FetchMultiple_cfunc(vi, channel_name, timeout, count, voltage_measurements, current_measurements, in_compliance, actual_count) - - def niDCPower_GetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + return self.niDCPower_FetchMultiple_cfunc( + vi, + channel_name, + timeout, + count, + voltage_measurements, + current_measurements, + in_compliance, + actual_count, + ) + + def niDCPower_GetAttributeViBoolean( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niDCPower_GetAttributeViBoolean_cfunc is None: - self.niDCPower_GetAttributeViBoolean_cfunc = self._get_library_function('niDCPower_GetAttributeViBoolean') - self.niDCPower_GetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViBoolean)] # noqa: F405 - self.niDCPower_GetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_GetAttributeViBoolean_cfunc(vi, channel_name, attribute_id, attribute_value) - - def niDCPower_GetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + self.niDCPower_GetAttributeViBoolean_cfunc = self._get_library_function( + "niDCPower_GetAttributeViBoolean" + ) + self.niDCPower_GetAttributeViBoolean_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 + self.niDCPower_GetAttributeViBoolean_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_GetAttributeViBoolean_cfunc( + vi, channel_name, attribute_id, attribute_value + ) + + def niDCPower_GetAttributeViInt32( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niDCPower_GetAttributeViInt32_cfunc is None: - self.niDCPower_GetAttributeViInt32_cfunc = self._get_library_function('niDCPower_GetAttributeViInt32') - self.niDCPower_GetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViInt32)] # noqa: F405 - self.niDCPower_GetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_GetAttributeViInt32_cfunc(vi, channel_name, attribute_id, attribute_value) - - def niDCPower_GetAttributeViInt64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + self.niDCPower_GetAttributeViInt32_cfunc = self._get_library_function( + "niDCPower_GetAttributeViInt32" + ) + self.niDCPower_GetAttributeViInt32_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niDCPower_GetAttributeViInt32_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_GetAttributeViInt32_cfunc( + vi, channel_name, attribute_id, attribute_value + ) + + def niDCPower_GetAttributeViInt64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niDCPower_GetAttributeViInt64_cfunc is None: - self.niDCPower_GetAttributeViInt64_cfunc = self._get_library_function('niDCPower_GetAttributeViInt64') - self.niDCPower_GetAttributeViInt64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViInt64)] # noqa: F405 - self.niDCPower_GetAttributeViInt64_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_GetAttributeViInt64_cfunc(vi, channel_name, attribute_id, attribute_value) - - def niDCPower_GetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + self.niDCPower_GetAttributeViInt64_cfunc = self._get_library_function( + "niDCPower_GetAttributeViInt64" + ) + self.niDCPower_GetAttributeViInt64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViInt64), + ] # noqa: F405 + self.niDCPower_GetAttributeViInt64_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_GetAttributeViInt64_cfunc( + vi, channel_name, attribute_id, attribute_value + ) + + def niDCPower_GetAttributeViReal64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niDCPower_GetAttributeViReal64_cfunc is None: - self.niDCPower_GetAttributeViReal64_cfunc = self._get_library_function('niDCPower_GetAttributeViReal64') - self.niDCPower_GetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViReal64)] # noqa: F405 - self.niDCPower_GetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_GetAttributeViReal64_cfunc(vi, channel_name, attribute_id, attribute_value) - - def niDCPower_GetAttributeViString(self, vi, channel_name, attribute_id, buffer_size, attribute_value): # noqa: N802 + self.niDCPower_GetAttributeViReal64_cfunc = self._get_library_function( + "niDCPower_GetAttributeViReal64" + ) + self.niDCPower_GetAttributeViReal64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViReal64), + ] # noqa: F405 + self.niDCPower_GetAttributeViReal64_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_GetAttributeViReal64_cfunc( + vi, channel_name, attribute_id, attribute_value + ) + + def niDCPower_GetAttributeViString( + self, vi, channel_name, attribute_id, buffer_size, attribute_value + ): # noqa: N802 with self._func_lock: if self.niDCPower_GetAttributeViString_cfunc is None: - self.niDCPower_GetAttributeViString_cfunc = self._get_library_function('niDCPower_GetAttributeViString') - self.niDCPower_GetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 - self.niDCPower_GetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_GetAttributeViString_cfunc(vi, channel_name, attribute_id, buffer_size, attribute_value) - - def niDCPower_GetChannelName(self, vi, index, buffer_size, channel_name): # noqa: N802 + self.niDCPower_GetAttributeViString_cfunc = self._get_library_function( + "niDCPower_GetAttributeViString" + ) + self.niDCPower_GetAttributeViString_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niDCPower_GetAttributeViString_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_GetAttributeViString_cfunc( + vi, channel_name, attribute_id, buffer_size, attribute_value + ) + + def niDCPower_GetChannelName( + self, vi, index, buffer_size, channel_name + ): # noqa: N802 with self._func_lock: if self.niDCPower_GetChannelName_cfunc is None: - self.niDCPower_GetChannelName_cfunc = self._get_library_function('niDCPower_GetChannelName') - self.niDCPower_GetChannelName_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDCPower_GetChannelName_cfunc = self._get_library_function( + "niDCPower_GetChannelName" + ) + self.niDCPower_GetChannelName_cfunc.argtypes = [ + ViSession, + ViInt32, + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDCPower_GetChannelName_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_GetChannelName_cfunc(vi, index, buffer_size, channel_name) - def niDCPower_GetChannelNameFromString(self, vi, indices, buffer_size, names): # noqa: N802 + def niDCPower_GetChannelNameFromString( + self, vi, indices, buffer_size, names + ): # noqa: N802 with self._func_lock: if self.niDCPower_GetChannelNameFromString_cfunc is None: - self.niDCPower_GetChannelNameFromString_cfunc = self._get_library_function('niDCPower_GetChannelNameFromString') - self.niDCPower_GetChannelNameFromString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 - self.niDCPower_GetChannelNameFromString_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_GetChannelNameFromString_cfunc(vi, indices, buffer_size, names) + self.niDCPower_GetChannelNameFromString_cfunc = ( + self._get_library_function("niDCPower_GetChannelNameFromString") + ) + self.niDCPower_GetChannelNameFromString_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niDCPower_GetChannelNameFromString_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_GetChannelNameFromString_cfunc( + vi, indices, buffer_size, names + ) def niDCPower_GetError(self, vi, code, buffer_size, description): # noqa: N802 with self._func_lock: if self.niDCPower_GetError_cfunc is None: - self.niDCPower_GetError_cfunc = self._get_library_function('niDCPower_GetError') - self.niDCPower_GetError_cfunc.argtypes = [ViSession, ctypes.POINTER(ViStatus), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDCPower_GetError_cfunc = self._get_library_function( + "niDCPower_GetError" + ) + self.niDCPower_GetError_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViStatus), + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDCPower_GetError_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_GetError_cfunc(vi, code, buffer_size, description) - def niDCPower_GetExtCalLastDateAndTime(self, vi, year, month, day, hour, minute): # noqa: N802 + def niDCPower_GetExtCalLastDateAndTime( + self, vi, year, month, day, hour, minute + ): # noqa: N802 with self._func_lock: if self.niDCPower_GetExtCalLastDateAndTime_cfunc is None: - self.niDCPower_GetExtCalLastDateAndTime_cfunc = self._get_library_function('niDCPower_GetExtCalLastDateAndTime') - self.niDCPower_GetExtCalLastDateAndTime_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 - self.niDCPower_GetExtCalLastDateAndTime_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_GetExtCalLastDateAndTime_cfunc(vi, year, month, day, hour, minute) + self.niDCPower_GetExtCalLastDateAndTime_cfunc = ( + self._get_library_function("niDCPower_GetExtCalLastDateAndTime") + ) + self.niDCPower_GetExtCalLastDateAndTime_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niDCPower_GetExtCalLastDateAndTime_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_GetExtCalLastDateAndTime_cfunc( + vi, year, month, day, hour, minute + ) def niDCPower_GetExtCalLastTemp(self, vi, temperature): # noqa: N802 with self._func_lock: if self.niDCPower_GetExtCalLastTemp_cfunc is None: - self.niDCPower_GetExtCalLastTemp_cfunc = self._get_library_function('niDCPower_GetExtCalLastTemp') - self.niDCPower_GetExtCalLastTemp_cfunc.argtypes = [ViSession, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niDCPower_GetExtCalLastTemp_cfunc = self._get_library_function( + "niDCPower_GetExtCalLastTemp" + ) + self.niDCPower_GetExtCalLastTemp_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niDCPower_GetExtCalLastTemp_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_GetExtCalLastTemp_cfunc(vi, temperature) def niDCPower_GetExtCalRecommendedInterval(self, vi, months): # noqa: N802 with self._func_lock: if self.niDCPower_GetExtCalRecommendedInterval_cfunc is None: - self.niDCPower_GetExtCalRecommendedInterval_cfunc = self._get_library_function('niDCPower_GetExtCalRecommendedInterval') - self.niDCPower_GetExtCalRecommendedInterval_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32)] # noqa: F405 - self.niDCPower_GetExtCalRecommendedInterval_cfunc.restype = ViStatus # noqa: F405 + self.niDCPower_GetExtCalRecommendedInterval_cfunc = ( + self._get_library_function("niDCPower_GetExtCalRecommendedInterval") + ) + self.niDCPower_GetExtCalRecommendedInterval_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niDCPower_GetExtCalRecommendedInterval_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niDCPower_GetExtCalRecommendedInterval_cfunc(vi, months) - def niDCPower_GetSelfCalLastDateAndTime(self, vi, year, month, day, hour, minute): # noqa: N802 + def niDCPower_GetSelfCalLastDateAndTime( + self, vi, year, month, day, hour, minute + ): # noqa: N802 with self._func_lock: if self.niDCPower_GetSelfCalLastDateAndTime_cfunc is None: - self.niDCPower_GetSelfCalLastDateAndTime_cfunc = self._get_library_function('niDCPower_GetSelfCalLastDateAndTime') - self.niDCPower_GetSelfCalLastDateAndTime_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 - self.niDCPower_GetSelfCalLastDateAndTime_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_GetSelfCalLastDateAndTime_cfunc(vi, year, month, day, hour, minute) + self.niDCPower_GetSelfCalLastDateAndTime_cfunc = ( + self._get_library_function("niDCPower_GetSelfCalLastDateAndTime") + ) + self.niDCPower_GetSelfCalLastDateAndTime_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niDCPower_GetSelfCalLastDateAndTime_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_GetSelfCalLastDateAndTime_cfunc( + vi, year, month, day, hour, minute + ) def niDCPower_GetSelfCalLastTemp(self, vi, temperature): # noqa: N802 with self._func_lock: if self.niDCPower_GetSelfCalLastTemp_cfunc is None: - self.niDCPower_GetSelfCalLastTemp_cfunc = self._get_library_function('niDCPower_GetSelfCalLastTemp') - self.niDCPower_GetSelfCalLastTemp_cfunc.argtypes = [ViSession, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niDCPower_GetSelfCalLastTemp_cfunc = self._get_library_function( + "niDCPower_GetSelfCalLastTemp" + ) + self.niDCPower_GetSelfCalLastTemp_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niDCPower_GetSelfCalLastTemp_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_GetSelfCalLastTemp_cfunc(vi, temperature) - def niDCPower_ImportAttributeConfigurationBuffer(self, vi, size, configuration): # noqa: N802 + def niDCPower_ImportAttributeConfigurationBuffer( + self, vi, size, configuration + ): # noqa: N802 with self._func_lock: if self.niDCPower_ImportAttributeConfigurationBuffer_cfunc is None: - self.niDCPower_ImportAttributeConfigurationBuffer_cfunc = self._get_library_function('niDCPower_ImportAttributeConfigurationBuffer') - self.niDCPower_ImportAttributeConfigurationBuffer_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt8)] # noqa: F405 - self.niDCPower_ImportAttributeConfigurationBuffer_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_ImportAttributeConfigurationBuffer_cfunc(vi, size, configuration) + self.niDCPower_ImportAttributeConfigurationBuffer_cfunc = ( + self._get_library_function( + "niDCPower_ImportAttributeConfigurationBuffer" + ) + ) + self.niDCPower_ImportAttributeConfigurationBuffer_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViInt8), + ] # noqa: F405 + self.niDCPower_ImportAttributeConfigurationBuffer_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_ImportAttributeConfigurationBuffer_cfunc( + vi, size, configuration + ) def niDCPower_ImportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niDCPower_ImportAttributeConfigurationFile_cfunc is None: - self.niDCPower_ImportAttributeConfigurationFile_cfunc = self._get_library_function('niDCPower_ImportAttributeConfigurationFile') - self.niDCPower_ImportAttributeConfigurationFile_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 - self.niDCPower_ImportAttributeConfigurationFile_cfunc.restype = ViStatus # noqa: F405 + self.niDCPower_ImportAttributeConfigurationFile_cfunc = ( + self._get_library_function( + "niDCPower_ImportAttributeConfigurationFile" + ) + ) + self.niDCPower_ImportAttributeConfigurationFile_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niDCPower_ImportAttributeConfigurationFile_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niDCPower_ImportAttributeConfigurationFile_cfunc(vi, file_path) - def niDCPower_InitializeWithChannels(self, resource_name, channels, reset, option_string, vi): # noqa: N802 + def niDCPower_InitializeWithChannels( + self, resource_name, channels, reset, option_string, vi + ): # noqa: N802 with self._func_lock: if self.niDCPower_InitializeWithChannels_cfunc is None: - self.niDCPower_InitializeWithChannels_cfunc = self._get_library_function('niDCPower_InitializeWithChannels') - self.niDCPower_InitializeWithChannels_cfunc.argtypes = [ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViBoolean, ctypes.POINTER(ViChar), ctypes.POINTER(ViSession)] # noqa: F405 - self.niDCPower_InitializeWithChannels_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_InitializeWithChannels_cfunc(resource_name, channels, reset, option_string, vi) - - def niDCPower_InitializeWithIndependentChannels(self, resource_name, reset, option_string, vi): # noqa: N802 + self.niDCPower_InitializeWithChannels_cfunc = ( + self._get_library_function("niDCPower_InitializeWithChannels") + ) + self.niDCPower_InitializeWithChannels_cfunc.argtypes = [ + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViBoolean, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViSession), + ] # noqa: F405 + self.niDCPower_InitializeWithChannels_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_InitializeWithChannels_cfunc( + resource_name, channels, reset, option_string, vi + ) + + def niDCPower_InitializeWithIndependentChannels( + self, resource_name, reset, option_string, vi + ): # noqa: N802 with self._func_lock: if self.niDCPower_InitializeWithIndependentChannels_cfunc is None: - self.niDCPower_InitializeWithIndependentChannels_cfunc = self._get_library_function('niDCPower_InitializeWithIndependentChannels') - self.niDCPower_InitializeWithIndependentChannels_cfunc.argtypes = [ctypes.POINTER(ViChar), ViBoolean, ctypes.POINTER(ViChar), ctypes.POINTER(ViSession)] # noqa: F405 - self.niDCPower_InitializeWithIndependentChannels_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_InitializeWithIndependentChannels_cfunc(resource_name, reset, option_string, vi) + self.niDCPower_InitializeWithIndependentChannels_cfunc = ( + self._get_library_function( + "niDCPower_InitializeWithIndependentChannels" + ) + ) + self.niDCPower_InitializeWithIndependentChannels_cfunc.argtypes = [ + ctypes.POINTER(ViChar), + ViBoolean, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViSession), + ] # noqa: F405 + self.niDCPower_InitializeWithIndependentChannels_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_InitializeWithIndependentChannels_cfunc( + resource_name, reset, option_string, vi + ) def niDCPower_InitiateWithChannels(self, vi, channel_name): # noqa: N802 with self._func_lock: if self.niDCPower_InitiateWithChannels_cfunc is None: - self.niDCPower_InitiateWithChannels_cfunc = self._get_library_function('niDCPower_InitiateWithChannels') - self.niDCPower_InitiateWithChannels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 - self.niDCPower_InitiateWithChannels_cfunc.restype = ViStatus # noqa: F405 + self.niDCPower_InitiateWithChannels_cfunc = self._get_library_function( + "niDCPower_InitiateWithChannels" + ) + self.niDCPower_InitiateWithChannels_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niDCPower_InitiateWithChannels_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niDCPower_InitiateWithChannels_cfunc(vi, channel_name) def niDCPower_LockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niDCPower_LockSession_cfunc is None: - self.niDCPower_LockSession_cfunc = self._get_library_function('niDCPower_LockSession') - self.niDCPower_LockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niDCPower_LockSession_cfunc = self._get_library_function( + "niDCPower_LockSession" + ) + self.niDCPower_LockSession_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niDCPower_LockSession_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_LockSession_cfunc(vi, caller_has_lock) - def niDCPower_Measure(self, vi, channel_name, measurement_type, measurement): # noqa: N802 + def niDCPower_Measure( + self, vi, channel_name, measurement_type, measurement + ): # noqa: N802 with self._func_lock: if self.niDCPower_Measure_cfunc is None: - self.niDCPower_Measure_cfunc = self._get_library_function('niDCPower_Measure') - self.niDCPower_Measure_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niDCPower_Measure_cfunc = self._get_library_function( + "niDCPower_Measure" + ) + self.niDCPower_Measure_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niDCPower_Measure_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_Measure_cfunc(vi, channel_name, measurement_type, measurement) + return self.niDCPower_Measure_cfunc( + vi, channel_name, measurement_type, measurement + ) - def niDCPower_MeasureMultiple(self, vi, channel_name, voltage_measurements, current_measurements): # noqa: N802 + def niDCPower_MeasureMultiple( + self, vi, channel_name, voltage_measurements, current_measurements + ): # noqa: N802 with self._func_lock: if self.niDCPower_MeasureMultiple_cfunc is None: - self.niDCPower_MeasureMultiple_cfunc = self._get_library_function('niDCPower_MeasureMultiple') - self.niDCPower_MeasureMultiple_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64)] # noqa: F405 + self.niDCPower_MeasureMultiple_cfunc = self._get_library_function( + "niDCPower_MeasureMultiple" + ) + self.niDCPower_MeasureMultiple_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niDCPower_MeasureMultiple_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_MeasureMultiple_cfunc(vi, channel_name, voltage_measurements, current_measurements) + return self.niDCPower_MeasureMultiple_cfunc( + vi, channel_name, voltage_measurements, current_measurements + ) - def niDCPower_ParseChannelCount(self, vi, channels_string, number_of_channels): # noqa: N802 + def niDCPower_ParseChannelCount( + self, vi, channels_string, number_of_channels + ): # noqa: N802 with self._func_lock: if self.niDCPower_ParseChannelCount_cfunc is None: - self.niDCPower_ParseChannelCount_cfunc = self._get_library_function('niDCPower_ParseChannelCount') - self.niDCPower_ParseChannelCount_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViUInt32)] # noqa: F405 + self.niDCPower_ParseChannelCount_cfunc = self._get_library_function( + "niDCPower_ParseChannelCount" + ) + self.niDCPower_ParseChannelCount_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViUInt32), + ] # noqa: F405 self.niDCPower_ParseChannelCount_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_ParseChannelCount_cfunc(vi, channels_string, number_of_channels) + return self.niDCPower_ParseChannelCount_cfunc( + vi, channels_string, number_of_channels + ) - def niDCPower_QueryInCompliance(self, vi, channel_name, in_compliance): # noqa: N802 + def niDCPower_QueryInCompliance( + self, vi, channel_name, in_compliance + ): # noqa: N802 with self._func_lock: if self.niDCPower_QueryInCompliance_cfunc is None: - self.niDCPower_QueryInCompliance_cfunc = self._get_library_function('niDCPower_QueryInCompliance') - self.niDCPower_QueryInCompliance_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niDCPower_QueryInCompliance_cfunc = self._get_library_function( + "niDCPower_QueryInCompliance" + ) + self.niDCPower_QueryInCompliance_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niDCPower_QueryInCompliance_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_QueryInCompliance_cfunc(vi, channel_name, in_compliance) - def niDCPower_QueryLatchedOutputCutoffState(self, vi, channel_name, output_cutoff_reason, output_cutoff_state): # noqa: N802 + def niDCPower_QueryLatchedOutputCutoffState( + self, vi, channel_name, output_cutoff_reason, output_cutoff_state + ): # noqa: N802 with self._func_lock: if self.niDCPower_QueryLatchedOutputCutoffState_cfunc is None: - self.niDCPower_QueryLatchedOutputCutoffState_cfunc = self._get_library_function('niDCPower_QueryLatchedOutputCutoffState') - self.niDCPower_QueryLatchedOutputCutoffState_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViBoolean)] # noqa: F405 - self.niDCPower_QueryLatchedOutputCutoffState_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_QueryLatchedOutputCutoffState_cfunc(vi, channel_name, output_cutoff_reason, output_cutoff_state) - - def niDCPower_QueryMaxCurrentLimit(self, vi, channel_name, voltage_level, max_current_limit): # noqa: N802 + self.niDCPower_QueryLatchedOutputCutoffState_cfunc = ( + self._get_library_function( + "niDCPower_QueryLatchedOutputCutoffState" + ) + ) + self.niDCPower_QueryLatchedOutputCutoffState_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 + self.niDCPower_QueryLatchedOutputCutoffState_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_QueryLatchedOutputCutoffState_cfunc( + vi, channel_name, output_cutoff_reason, output_cutoff_state + ) + + def niDCPower_QueryMaxCurrentLimit( + self, vi, channel_name, voltage_level, max_current_limit + ): # noqa: N802 with self._func_lock: if self.niDCPower_QueryMaxCurrentLimit_cfunc is None: - self.niDCPower_QueryMaxCurrentLimit_cfunc = self._get_library_function('niDCPower_QueryMaxCurrentLimit') - self.niDCPower_QueryMaxCurrentLimit_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ctypes.POINTER(ViReal64)] # noqa: F405 - self.niDCPower_QueryMaxCurrentLimit_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_QueryMaxCurrentLimit_cfunc(vi, channel_name, voltage_level, max_current_limit) - - def niDCPower_QueryMaxVoltageLevel(self, vi, channel_name, current_limit, max_voltage_level): # noqa: N802 + self.niDCPower_QueryMaxCurrentLimit_cfunc = self._get_library_function( + "niDCPower_QueryMaxCurrentLimit" + ) + self.niDCPower_QueryMaxCurrentLimit_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViReal64, + ctypes.POINTER(ViReal64), + ] # noqa: F405 + self.niDCPower_QueryMaxCurrentLimit_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_QueryMaxCurrentLimit_cfunc( + vi, channel_name, voltage_level, max_current_limit + ) + + def niDCPower_QueryMaxVoltageLevel( + self, vi, channel_name, current_limit, max_voltage_level + ): # noqa: N802 with self._func_lock: if self.niDCPower_QueryMaxVoltageLevel_cfunc is None: - self.niDCPower_QueryMaxVoltageLevel_cfunc = self._get_library_function('niDCPower_QueryMaxVoltageLevel') - self.niDCPower_QueryMaxVoltageLevel_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ctypes.POINTER(ViReal64)] # noqa: F405 - self.niDCPower_QueryMaxVoltageLevel_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_QueryMaxVoltageLevel_cfunc(vi, channel_name, current_limit, max_voltage_level) - - def niDCPower_QueryMinCurrentLimit(self, vi, channel_name, voltage_level, min_current_limit): # noqa: N802 + self.niDCPower_QueryMaxVoltageLevel_cfunc = self._get_library_function( + "niDCPower_QueryMaxVoltageLevel" + ) + self.niDCPower_QueryMaxVoltageLevel_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViReal64, + ctypes.POINTER(ViReal64), + ] # noqa: F405 + self.niDCPower_QueryMaxVoltageLevel_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_QueryMaxVoltageLevel_cfunc( + vi, channel_name, current_limit, max_voltage_level + ) + + def niDCPower_QueryMinCurrentLimit( + self, vi, channel_name, voltage_level, min_current_limit + ): # noqa: N802 with self._func_lock: if self.niDCPower_QueryMinCurrentLimit_cfunc is None: - self.niDCPower_QueryMinCurrentLimit_cfunc = self._get_library_function('niDCPower_QueryMinCurrentLimit') - self.niDCPower_QueryMinCurrentLimit_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ctypes.POINTER(ViReal64)] # noqa: F405 - self.niDCPower_QueryMinCurrentLimit_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_QueryMinCurrentLimit_cfunc(vi, channel_name, voltage_level, min_current_limit) - - def niDCPower_QueryOutputState(self, vi, channel_name, output_state, in_state): # noqa: N802 + self.niDCPower_QueryMinCurrentLimit_cfunc = self._get_library_function( + "niDCPower_QueryMinCurrentLimit" + ) + self.niDCPower_QueryMinCurrentLimit_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViReal64, + ctypes.POINTER(ViReal64), + ] # noqa: F405 + self.niDCPower_QueryMinCurrentLimit_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_QueryMinCurrentLimit_cfunc( + vi, channel_name, voltage_level, min_current_limit + ) + + def niDCPower_QueryOutputState( + self, vi, channel_name, output_state, in_state + ): # noqa: N802 with self._func_lock: if self.niDCPower_QueryOutputState_cfunc is None: - self.niDCPower_QueryOutputState_cfunc = self._get_library_function('niDCPower_QueryOutputState') - self.niDCPower_QueryOutputState_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niDCPower_QueryOutputState_cfunc = self._get_library_function( + "niDCPower_QueryOutputState" + ) + self.niDCPower_QueryOutputState_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niDCPower_QueryOutputState_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_QueryOutputState_cfunc(vi, channel_name, output_state, in_state) + return self.niDCPower_QueryOutputState_cfunc( + vi, channel_name, output_state, in_state + ) def niDCPower_ReadCurrentTemperature(self, vi, temperature): # noqa: N802 with self._func_lock: if self.niDCPower_ReadCurrentTemperature_cfunc is None: - self.niDCPower_ReadCurrentTemperature_cfunc = self._get_library_function('niDCPower_ReadCurrentTemperature') - self.niDCPower_ReadCurrentTemperature_cfunc.argtypes = [ViSession, ctypes.POINTER(ViReal64)] # noqa: F405 - self.niDCPower_ReadCurrentTemperature_cfunc.restype = ViStatus # noqa: F405 + self.niDCPower_ReadCurrentTemperature_cfunc = ( + self._get_library_function("niDCPower_ReadCurrentTemperature") + ) + self.niDCPower_ReadCurrentTemperature_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViReal64), + ] # noqa: F405 + self.niDCPower_ReadCurrentTemperature_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niDCPower_ReadCurrentTemperature_cfunc(vi, temperature) def niDCPower_ResetDevice(self, vi): # noqa: N802 with self._func_lock: if self.niDCPower_ResetDevice_cfunc is None: - self.niDCPower_ResetDevice_cfunc = self._get_library_function('niDCPower_ResetDevice') + self.niDCPower_ResetDevice_cfunc = self._get_library_function( + "niDCPower_ResetDevice" + ) self.niDCPower_ResetDevice_cfunc.argtypes = [ViSession] # noqa: F405 self.niDCPower_ResetDevice_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_ResetDevice_cfunc(vi) @@ -440,95 +943,215 @@ def niDCPower_ResetDevice(self, vi): # noqa: N802 def niDCPower_ResetWithChannels(self, vi, channel_name): # noqa: N802 with self._func_lock: if self.niDCPower_ResetWithChannels_cfunc is None: - self.niDCPower_ResetWithChannels_cfunc = self._get_library_function('niDCPower_ResetWithChannels') - self.niDCPower_ResetWithChannels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDCPower_ResetWithChannels_cfunc = self._get_library_function( + "niDCPower_ResetWithChannels" + ) + self.niDCPower_ResetWithChannels_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDCPower_ResetWithChannels_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_ResetWithChannels_cfunc(vi, channel_name) def niDCPower_ResetWithDefaults(self, vi): # noqa: N802 with self._func_lock: if self.niDCPower_ResetWithDefaults_cfunc is None: - self.niDCPower_ResetWithDefaults_cfunc = self._get_library_function('niDCPower_ResetWithDefaults') - self.niDCPower_ResetWithDefaults_cfunc.argtypes = [ViSession] # noqa: F405 + self.niDCPower_ResetWithDefaults_cfunc = self._get_library_function( + "niDCPower_ResetWithDefaults" + ) + self.niDCPower_ResetWithDefaults_cfunc.argtypes = [ + ViSession + ] # noqa: F405 self.niDCPower_ResetWithDefaults_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_ResetWithDefaults_cfunc(vi) - def niDCPower_SendSoftwareEdgeTriggerWithChannels(self, vi, channel_name, trigger): # noqa: N802 + def niDCPower_SendSoftwareEdgeTriggerWithChannels( + self, vi, channel_name, trigger + ): # noqa: N802 with self._func_lock: if self.niDCPower_SendSoftwareEdgeTriggerWithChannels_cfunc is None: - self.niDCPower_SendSoftwareEdgeTriggerWithChannels_cfunc = self._get_library_function('niDCPower_SendSoftwareEdgeTriggerWithChannels') - self.niDCPower_SendSoftwareEdgeTriggerWithChannels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32] # noqa: F405 - self.niDCPower_SendSoftwareEdgeTriggerWithChannels_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_SendSoftwareEdgeTriggerWithChannels_cfunc(vi, channel_name, trigger) - - def niDCPower_SetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + self.niDCPower_SendSoftwareEdgeTriggerWithChannels_cfunc = ( + self._get_library_function( + "niDCPower_SendSoftwareEdgeTriggerWithChannels" + ) + ) + self.niDCPower_SendSoftwareEdgeTriggerWithChannels_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ] # noqa: F405 + self.niDCPower_SendSoftwareEdgeTriggerWithChannels_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_SendSoftwareEdgeTriggerWithChannels_cfunc( + vi, channel_name, trigger + ) + + def niDCPower_SetAttributeViBoolean( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niDCPower_SetAttributeViBoolean_cfunc is None: - self.niDCPower_SetAttributeViBoolean_cfunc = self._get_library_function('niDCPower_SetAttributeViBoolean') - self.niDCPower_SetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViBoolean] # noqa: F405 - self.niDCPower_SetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_SetAttributeViBoolean_cfunc(vi, channel_name, attribute_id, attribute_value) - - def niDCPower_SetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + self.niDCPower_SetAttributeViBoolean_cfunc = self._get_library_function( + "niDCPower_SetAttributeViBoolean" + ) + self.niDCPower_SetAttributeViBoolean_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViBoolean, + ] # noqa: F405 + self.niDCPower_SetAttributeViBoolean_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_SetAttributeViBoolean_cfunc( + vi, channel_name, attribute_id, attribute_value + ) + + def niDCPower_SetAttributeViInt32( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niDCPower_SetAttributeViInt32_cfunc is None: - self.niDCPower_SetAttributeViInt32_cfunc = self._get_library_function('niDCPower_SetAttributeViInt32') - self.niDCPower_SetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32] # noqa: F405 - self.niDCPower_SetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_SetAttributeViInt32_cfunc(vi, channel_name, attribute_id, attribute_value) - - def niDCPower_SetAttributeViInt64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + self.niDCPower_SetAttributeViInt32_cfunc = self._get_library_function( + "niDCPower_SetAttributeViInt32" + ) + self.niDCPower_SetAttributeViInt32_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViInt32, + ] # noqa: F405 + self.niDCPower_SetAttributeViInt32_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_SetAttributeViInt32_cfunc( + vi, channel_name, attribute_id, attribute_value + ) + + def niDCPower_SetAttributeViInt64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niDCPower_SetAttributeViInt64_cfunc is None: - self.niDCPower_SetAttributeViInt64_cfunc = self._get_library_function('niDCPower_SetAttributeViInt64') - self.niDCPower_SetAttributeViInt64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt64] # noqa: F405 - self.niDCPower_SetAttributeViInt64_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_SetAttributeViInt64_cfunc(vi, channel_name, attribute_id, attribute_value) - - def niDCPower_SetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + self.niDCPower_SetAttributeViInt64_cfunc = self._get_library_function( + "niDCPower_SetAttributeViInt64" + ) + self.niDCPower_SetAttributeViInt64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViInt64, + ] # noqa: F405 + self.niDCPower_SetAttributeViInt64_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_SetAttributeViInt64_cfunc( + vi, channel_name, attribute_id, attribute_value + ) + + def niDCPower_SetAttributeViReal64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niDCPower_SetAttributeViReal64_cfunc is None: - self.niDCPower_SetAttributeViReal64_cfunc = self._get_library_function('niDCPower_SetAttributeViReal64') - self.niDCPower_SetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViReal64] # noqa: F405 - self.niDCPower_SetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_SetAttributeViReal64_cfunc(vi, channel_name, attribute_id, attribute_value) - - def niDCPower_SetAttributeViString(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + self.niDCPower_SetAttributeViReal64_cfunc = self._get_library_function( + "niDCPower_SetAttributeViReal64" + ) + self.niDCPower_SetAttributeViReal64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViReal64, + ] # noqa: F405 + self.niDCPower_SetAttributeViReal64_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_SetAttributeViReal64_cfunc( + vi, channel_name, attribute_id, attribute_value + ) + + def niDCPower_SetAttributeViString( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niDCPower_SetAttributeViString_cfunc is None: - self.niDCPower_SetAttributeViString_cfunc = self._get_library_function('niDCPower_SetAttributeViString') - self.niDCPower_SetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViChar)] # noqa: F405 - self.niDCPower_SetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_SetAttributeViString_cfunc(vi, channel_name, attribute_id, attribute_value) - - def niDCPower_SetSequence(self, vi, channel_name, values, source_delays, size): # noqa: N802 + self.niDCPower_SetAttributeViString_cfunc = self._get_library_function( + "niDCPower_SetAttributeViString" + ) + self.niDCPower_SetAttributeViString_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niDCPower_SetAttributeViString_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_SetAttributeViString_cfunc( + vi, channel_name, attribute_id, attribute_value + ) + + def niDCPower_SetSequence( + self, vi, channel_name, values, source_delays, size + ): # noqa: N802 with self._func_lock: if self.niDCPower_SetSequence_cfunc is None: - self.niDCPower_SetSequence_cfunc = self._get_library_function('niDCPower_SetSequence') - self.niDCPower_SetSequence_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ViUInt32] # noqa: F405 + self.niDCPower_SetSequence_cfunc = self._get_library_function( + "niDCPower_SetSequence" + ) + self.niDCPower_SetSequence_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViReal64), + ViUInt32, + ] # noqa: F405 self.niDCPower_SetSequence_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_SetSequence_cfunc(vi, channel_name, values, source_delays, size) + return self.niDCPower_SetSequence_cfunc( + vi, channel_name, values, source_delays, size + ) def niDCPower_UnlockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niDCPower_UnlockSession_cfunc is None: - self.niDCPower_UnlockSession_cfunc = self._get_library_function('niDCPower_UnlockSession') - self.niDCPower_UnlockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niDCPower_UnlockSession_cfunc = self._get_library_function( + "niDCPower_UnlockSession" + ) + self.niDCPower_UnlockSession_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niDCPower_UnlockSession_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_UnlockSession_cfunc(vi, caller_has_lock) - def niDCPower_WaitForEventWithChannels(self, vi, channel_name, event_id, timeout): # noqa: N802 + def niDCPower_WaitForEventWithChannels( + self, vi, channel_name, event_id, timeout + ): # noqa: N802 with self._func_lock: if self.niDCPower_WaitForEventWithChannels_cfunc is None: - self.niDCPower_WaitForEventWithChannels_cfunc = self._get_library_function('niDCPower_WaitForEventWithChannels') - self.niDCPower_WaitForEventWithChannels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViReal64] # noqa: F405 - self.niDCPower_WaitForEventWithChannels_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_WaitForEventWithChannels_cfunc(vi, channel_name, event_id, timeout) + self.niDCPower_WaitForEventWithChannels_cfunc = ( + self._get_library_function("niDCPower_WaitForEventWithChannels") + ) + self.niDCPower_WaitForEventWithChannels_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ViReal64, + ] # noqa: F405 + self.niDCPower_WaitForEventWithChannels_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDCPower_WaitForEventWithChannels_cfunc( + vi, channel_name, event_id, timeout + ) def niDCPower_close(self, vi): # noqa: N802 with self._func_lock: if self.niDCPower_close_cfunc is None: - self.niDCPower_close_cfunc = self._get_library_function('niDCPower_close') + self.niDCPower_close_cfunc = self._get_library_function( + "niDCPower_close" + ) self.niDCPower_close_cfunc.argtypes = [ViSession] # noqa: F405 self.niDCPower_close_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_close_cfunc(vi) @@ -536,15 +1159,29 @@ def niDCPower_close(self, vi): # noqa: N802 def niDCPower_error_message(self, vi, error_code, error_message): # noqa: N802 with self._func_lock: if self.niDCPower_error_message_cfunc is None: - self.niDCPower_error_message_cfunc = self._get_library_function('niDCPower_error_message') - self.niDCPower_error_message_cfunc.argtypes = [ViSession, ViStatus, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDCPower_error_message_cfunc = self._get_library_function( + "niDCPower_error_message" + ) + self.niDCPower_error_message_cfunc.argtypes = [ + ViSession, + ViStatus, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDCPower_error_message_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_error_message_cfunc(vi, error_code, error_message) - def niDCPower_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 + def niDCPower_self_test( + self, vi, self_test_result, self_test_message + ): # noqa: N802 with self._func_lock: if self.niDCPower_self_test_cfunc is None: - self.niDCPower_self_test_cfunc = self._get_library_function('niDCPower_self_test') - self.niDCPower_self_test_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt16), ctypes.POINTER(ViChar)] # noqa: F405 + self.niDCPower_self_test_cfunc = self._get_library_function( + "niDCPower_self_test" + ) + self.niDCPower_self_test_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt16), + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDCPower_self_test_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_self_test_cfunc(vi, self_test_result, self_test_message) diff --git a/generated/nidcpower/nidcpower/_library_singleton.py b/generated/nidcpower/nidcpower/_library_singleton.py index 62fd03c29..48f6714c5 100644 --- a/generated/nidcpower/nidcpower/_library_singleton.py +++ b/generated/nidcpower/nidcpower/_library_singleton.py @@ -12,30 +12,36 @@ _instance = None _instance_lock = threading.Lock() -_library_info = {'Linux': {'64bit': {'name': 'nidcpower', 'type': 'cdll'}}, - 'Windows': {'32bit': {'name': 'nidcpower_32.dll', 'type': 'windll'}, - '64bit': {'name': 'nidcpower_64.dll', 'type': 'cdll'}}} +_library_info = { + "Linux": {"64bit": {"name": "nidcpower", "type": "cdll"}}, + "Windows": { + "32bit": {"name": "nidcpower_32.dll", "type": "windll"}, + "64bit": {"name": "nidcpower_64.dll", "type": "cdll"}, + }, +} def _get_library_name(): try: - return ctypes.util.find_library(_library_info[platform.system()][platform.architecture()[0]]['name']) # We find and return full path to the DLL + return ctypes.util.find_library( + _library_info[platform.system()][platform.architecture()[0]]["name"] + ) # We find and return full path to the DLL except KeyError: raise errors.UnsupportedConfigurationError def _get_library_type(): try: - return _library_info[platform.system()][platform.architecture()[0]]['type'] + return _library_info[platform.system()][platform.architecture()[0]]["type"] except KeyError: raise errors.UnsupportedConfigurationError def get(): - '''get + """get Returns the library.Library singleton for nidcpower. - ''' + """ global _instance global _instance_lock @@ -43,13 +49,12 @@ def get(): if _instance is None: try: library_type = _get_library_type() - if library_type == 'windll': + if library_type == "windll": ctypes_library = ctypes.WinDLL(_get_library_name()) else: - assert library_type == 'cdll' + assert library_type == "cdll" ctypes_library = ctypes.CDLL(_get_library_name()) except OSError: raise errors.DriverNotInstalledError() _instance = _library.Library(ctypes_library) return _instance - diff --git a/generated/nidcpower/nidcpower/_visatype.py b/generated/nidcpower/nidcpower/_visatype.py index 02cc41d1b..bf96c3cfb 100644 --- a/generated/nidcpower/nidcpower/_visatype.py +++ b/generated/nidcpower/nidcpower/_visatype.py @@ -2,9 +2,9 @@ import ctypes -'''Definitions of the VISA types used by the C API of the driver runtime. +"""Definitions of the VISA types used by the C API of the driver runtime. These are aliased directly to ctypes types so can be used directly to call into the library. -''' +""" ViChar = ctypes.c_char @@ -26,4 +26,3 @@ ViAttr = ViUInt32 ViConstString = ViString ViRsrc = ViString - diff --git a/generated/nidcpower/nidcpower/enums.py b/generated/nidcpower/nidcpower/enums.py index ef5089b9e..4ad82e51d 100644 --- a/generated/nidcpower/nidcpower/enums.py +++ b/generated/nidcpower/nidcpower/enums.py @@ -6,99 +6,99 @@ class ApertureTimeUnits(Enum): SECONDS = 1028 - r''' + r""" Specifies aperture time in seconds. - ''' + """ POWER_LINE_CYCLES = 1029 - r''' + r""" Specifies aperture time in power line cycles (PLCs). - ''' + """ class AutoZero(Enum): OFF = 0 - r''' + r""" Disables auto zero. - ''' + """ ON = 1 - r''' + r""" Makes zero conversions for every measurement. - ''' + """ ONCE = 1024 - r''' + r""" Makes zero conversions following the first measurement after initiating the device. The device uses these zero conversions for the preceding measurement and future measurements until the device is reinitiated. - ''' + """ class AutorangeApertureTimeMode(Enum): AUTO = 1110 - r''' + r""" NI-DCPower optimizes the aperture time for the autorange algorithm based on the module range. - ''' + """ CUSTOM = 1111 - r''' + r""" The user specifies a minimum aperture time for the algorithm using the autorange_minimum_aperture_time property and the corresponding autorange_minimum_aperture_time_units property. - ''' + """ class AutorangeBehavior(Enum): UP_TO_LIMIT_THEN_DOWN = 1107 - r''' + r""" Go to limit range then range down as needed until measured value is within thresholds. - ''' + """ UP = 1108 - r''' + r""" go up one range when the upper threshold is reached. - ''' + """ UP_AND_DOWN = 1109 - r''' + r""" go up or down one range when the upper/lower threshold is reached. - ''' + """ class AutorangeThresholdMode(Enum): NORMAL = 1112 - r''' + r""" Thresholds are selected based on a balance between accuracy and hysteresis. - ''' + """ FAST_STEP = 1113 - r''' + r""" Optimized for faster changes in the measured signal. Thresholds are configured to be a smaller percentage of the range. - ''' + """ HIGH_HYSTERESIS = 1114 - r''' + r""" Optimized for noisy signals to minimize frequent and unpredictable range changes. Thresholds are configured to be a larger percentage of the range. - ''' + """ MEDIUM_HYSTERESIS = 1115 - r''' + r""" Optimized for noisy signals to minimize frequent and unpredictable range changes. Thresholds are configured to be a medium percentage of the range. - ''' + """ HOLD = 1116 - r''' + r""" Attempt to maintain the active range. Thresholds will favor the active range. - ''' + """ class ComplianceLimitSymmetry(Enum): SYMMETRIC = 0 - r''' + r""" Compliance limits are specified symmetrically about 0. - ''' + """ ASYMMETRIC = 1 - r''' + r""" Compliance limits can be specified asymmetrically with respect to 0. - ''' + """ class DCNoiseRejection(Enum): SECOND_ORDER = 1043 - r''' + r""" Second-order rejection of DC noise. - ''' + """ NORMAL = 1044 - r''' + r""" Normal rejection of DC noise. - ''' + """ class Event(Enum): @@ -112,171 +112,171 @@ class Event(Enum): class MeasureWhen(Enum): AUTOMATICALLY_AFTER_SOURCE_COMPLETE = 1025 - r''' + r""" Acquires a measurement after each Source Complete event completes. - ''' + """ ON_DEMAND = 1026 - r''' + r""" Acquires a measurement when the measure method or measure_multiple method is called. - ''' + """ ON_MEASURE_TRIGGER = 1027 - r''' + r""" Acquires a measurement when a Measure trigger is received. - ''' + """ class MeasurementTypes(Enum): CURRENT = 0 - r''' + r""" The device measures current. - ''' + """ VOLTAGE = 1 - r''' + r""" The device measures voltage. - ''' + """ class OutputCapacitance(Enum): LOW = 1010 - r''' + r""" Output Capacitance is low. - ''' + """ HIGH = 1011 - r''' + r""" Output Capacitance is high. - ''' + """ class OutputCutoffReason(Enum): ALL = -1 - r''' + r""" Queries any output cutoff condition; clears all output cutoff conditions. - ''' + """ VOLTAGE_OUTPUT_HIGH = 1 - r''' + r""" Queries or clears cutoff conditions when the output exceeded the high cutoff limit for voltage output. - ''' + """ VOLTAGE_OUTPUT_LOW = 2 - r''' + r""" Queries or clears cutoff conditions when the output fell below the low cutoff limit for voltage output. - ''' + """ CURRENT_MEASURE_HIGH = 4 - r''' + r""" Queries or clears cutoff conditions when the measured current exceeded the high cutoff limit for current output. - ''' + """ CURRENT_MEASURE_LOW = 8 - r''' + r""" Queries or clears cutoff conditions when the measured current fell below the low cutoff limit for current output. - ''' + """ VOLTAGE_CHANGE_HIGH = 16 - r''' + r""" Queries or clears cutoff conditions when the voltage slew rate increased beyond the positive change cutoff for voltage output. - ''' + """ VOLTAGE_CHANGE_LOW = 32 - r''' + r""" Queries or clears cutoff conditions when the voltage slew rate decreased beyond the negative change cutoff for voltage output. - ''' + """ CURRENT_CHANGE_HIGH = 64 - r''' + r""" Queries or clears cutoff conditions when the current slew rate increased beyond the positive change cutoff for current output. - ''' + """ CURRENT_CHANGE_LOW = 128 - r''' + r""" Queries or clears cutoff conditions when the current slew rate decreased beyond the negative change cutoff for current output. - ''' + """ class OutputFunction(Enum): DC_VOLTAGE = 1006 - r''' + r""" Sets the output method to DC voltage. - ''' + """ DC_CURRENT = 1007 - r''' + r""" Sets the output method to DC current. - ''' + """ PULSE_VOLTAGE = 1049 - r''' + r""" Sets the output method to pulse voltage. - ''' + """ PULSE_CURRENT = 1050 - r''' + r""" Sets the output method to pulse current. - ''' + """ class OutputStates(Enum): VOLTAGE = 0 - r''' + r""" The device maintains a constant voltage by adjusting the current - ''' + """ CURRENT = 1 - r''' + r""" The device maintains a constant current by adjusting the voltage. - ''' + """ class Polarity(Enum): HIGH = 1018 - r''' + r""" A high pulse occurs when the event is generated. The exported signal is low level both before and after the event is generated. - ''' + """ LOW = 1019 - r''' + r""" A low pulse occurs when the event is generated. The exported signal is high level both before and after the event is generated. - ''' + """ class PowerAllocationMode(Enum): DISABLED = 1058 - r''' + r""" The device attempts to source, on each active channel, the power that the present source configuration requires; NI-DCPower does not perform a sourcing power check. If the required power is greater than the maximum sourcing power, the device attempts to source the required amount and may shut down to prevent damage. - ''' + """ AUTOMATIC = 1059 - r''' + r""" The device attempts to source, on each active channel, the power that the present source configuration requires; NI-DCPower performs a sourcing power check. If the required power is greater than the maximum sourcing power, the device does not exceed the maximum power, and NI-DCPower returns an error. - ''' + """ MANUAL = 1060 - r''' + r""" The device attempts to source, on each active channel, the power you request with the requested_power_allocation property; NI-DCPower performs a sourcing power check. If the requested power is either less than the required power for the present source configuration or greater than the maximum sourcing power, the device does not exceed the requested or allowed power, respectively, and NI-DCPower returns an error. - ''' + """ class PowerSource(Enum): INTERNAL = 1003 - r''' + r""" Uses the PXI chassis power source. - ''' + """ AUXILIARY = 1004 - r''' + r""" Uses the auxiliary power source connected to the device. - ''' + """ AUTOMATIC = 1005 - r''' + r""" Uses the auxiliary power source if it is available; otherwise uses the PXI chassis power source. - ''' + """ class PowerSourceInUse(Enum): INTERNAL = 1003 - r''' + r""" Uses the PXI chassis power source. - ''' + """ AUXILIARY = 1004 - r''' + r""" Uses the auxiliary power source connected to the device. Only the NI PXI-4110, NI PXIe-4112, NI PXIe-4113, and NI PXI-4130 support this value. This is the only supported value for the NI PXIe-4112 and NI PXIe-4113. - ''' + """ class SelfCalibrationPersistence(Enum): KEEP_IN_MEMORY = 1045 - r''' + r""" Keep new self calibration values in memory only. - ''' + """ WRITE_TO_EEPROM = 1046 - r''' + r""" Write new self calibration values to hardware. - ''' + """ class SendSoftwareEdgeTriggerType(Enum): @@ -290,55 +290,55 @@ class SendSoftwareEdgeTriggerType(Enum): class Sense(Enum): LOCAL = 1008 - r''' + r""" Local sensing is selected. - ''' + """ REMOTE = 1009 - r''' + r""" Remote sensing is selected. - ''' + """ class SourceMode(Enum): SINGLE_POINT = 1020 - r''' + r""" The source unit applies a single source configuration. - ''' + """ SEQUENCE = 1021 - r''' + r""" The source unit applies a list of voltage or current configurations sequentially. - ''' + """ class TransientResponse(Enum): NORMAL = 1038 - r''' + r""" The output responds to changes in load at a normal speed. - ''' + """ FAST = 1039 - r''' + r""" The output responds to changes in load quickly. - ''' + """ SLOW = 1041 - r''' + r""" The output responds to changes in load slowly. - ''' + """ CUSTOM = 1042 - r''' + r""" The output responds to changes in load based on specified values. - ''' + """ class TriggerType(Enum): NONE = 1012 - r''' + r""" No trigger is configured. - ''' + """ DIGITAL_EDGE = 1014 - r''' + r""" The data operation starts when a digital edge is detected. - ''' + """ SOFTWARE_EDGE = 1015 - r''' + r""" The data operation starts when a software trigger occurs. - ''' + """ diff --git a/generated/nidcpower/nidcpower/errors.py b/generated/nidcpower/nidcpower/errors.py index ffce9d274..68216a70e 100644 --- a/generated/nidcpower/nidcpower/errors.py +++ b/generated/nidcpower/nidcpower/errors.py @@ -7,86 +7,103 @@ def _is_success(code): - return (code == 0) + return code == 0 def _is_error(code): - return (code < 0) + return code < 0 def _is_warning(code): - return (code > 0) + return code > 0 class Error(Exception): - '''Base error class for NI-DCPower''' + """Base error class for NI-DCPower""" def __init__(self, message): super(Error, self).__init__(message) class DriverError(Error): - '''An error originating from the NI-DCPower driver''' + """An error originating from the NI-DCPower driver""" def __init__(self, code, description): - assert (_is_error(code)), "Should not raise Error if code is not fatal." + assert _is_error(code), "Should not raise Error if code is not fatal." self.code = code self.description = description super(DriverError, self).__init__(str(self.code) + ": " + self.description) class DriverWarning(Warning): - '''A warning originating from the NI-DCPower driver''' + """A warning originating from the NI-DCPower driver""" def __init__(self, code, description): - assert (_is_warning(code)), "Should not create Warning if code is not positive." - super(DriverWarning, self).__init__('Warning {0} occurred.\n\n{1}'.format(code, description)) + assert _is_warning(code), "Should not create Warning if code is not positive." + super(DriverWarning, self).__init__( + "Warning {0} occurred.\n\n{1}".format(code, description) + ) class UnsupportedConfigurationError(Error): - '''An error due to using this module in an usupported platform.''' + """An error due to using this module in an usupported platform.""" def __init__(self): - super(UnsupportedConfigurationError, self).__init__('System configuration is unsupported: ' + platform.architecture()[0] + ' ' + platform.system()) + super(UnsupportedConfigurationError, self).__init__( + "System configuration is unsupported: " + + platform.architecture()[0] + + " " + + platform.system() + ) class DriverNotInstalledError(Error): - '''An error due to using this module without the driver runtime installed.''' + """An error due to using this module without the driver runtime installed.""" def __init__(self): - super(DriverNotInstalledError, self).__init__('The NI-DCPower runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it.') + super(DriverNotInstalledError, self).__init__( + "The NI-DCPower runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it." + ) class DriverTooOldError(Error): - '''An error due to using this module with an older version of the driver runtime.''' + """An error due to using this module with an older version of the driver runtime.""" def __init__(self): - super(DriverTooOldError, self).__init__('A function was not found in the NI-DCPower runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it.') + super(DriverTooOldError, self).__init__( + "A function was not found in the NI-DCPower runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it." + ) class InvalidRepeatedCapabilityError(Error): - '''An error due to an invalid character in a repeated capability''' + """An error due to an invalid character in a repeated capability""" def __init__(self, invalid_character, invalid_string): - super(InvalidRepeatedCapabilityError, self).__init__('An invalid character ({0}) was found in repeated capability string ({1})'.format(invalid_character, invalid_string)) + super(InvalidRepeatedCapabilityError, self).__init__( + "An invalid character ({0}) was found in repeated capability string ({1})".format( + invalid_character, invalid_string + ) + ) class SelfTestError(Error): - '''An error due to a failed self-test''' + """An error due to a failed self-test""" def __init__(self, code, msg): self.code = code self.message = msg - super(SelfTestError, self).__init__('Self-test failed with code {0}: {1}'.format(code, msg)) + super(SelfTestError, self).__init__( + "Self-test failed with code {0}: {1}".format(code, msg) + ) def handle_error(session, code, ignore_warnings, is_error_handling): - '''handle_error + """handle_error Helper function for handling errors returned by nidcpower.Library. It calls back into the session to get the corresponding error description and raises if necessary. - ''' + """ if _is_success(code) or (_is_warning(code) and ignore_warnings): return @@ -94,7 +111,7 @@ def handle_error(session, code, ignore_warnings, is_error_handling): if is_error_handling: # The caller is in the midst of error handling and an error occurred. # Don't try to get the description or we'll start recursing until the stack overflows. - description = '' + description = "" else: description = session._get_error_description(code) @@ -103,5 +120,3 @@ def handle_error(session, code, ignore_warnings, is_error_handling): assert _is_warning(code) warnings.warn(DriverWarning(code, description)) - - diff --git a/generated/nidcpower/nidcpower/session.py b/generated/nidcpower/nidcpower/session.py index 8d6352138..1bf675943 100644 --- a/generated/nidcpower/nidcpower/session.py +++ b/generated/nidcpower/nidcpower/session.py @@ -2,6 +2,7 @@ # This file was generated import array # noqa: F401 import ctypes + # Used by @ivi_synchronized from functools import wraps @@ -16,22 +17,24 @@ # Used for __repr__ import pprint + pp = pprint.PrettyPrinter(indent=4) # Helper functions for creating ctypes needed for calling into the driver DLL def get_ctypes_pointer_for_buffer(value=None, library_type=None, size=None): if isinstance(value, array.array): - assert library_type is not None, 'library_type is required for array.array' + assert library_type is not None, "library_type is required for array.array" addr, _ = value.buffer_info() return ctypes.cast(addr, ctypes.POINTER(library_type)) elif str(type(value)).find("'numpy.ndarray'") != -1: import numpy + return numpy.ctypeslib.as_ctypes(value) elif isinstance(value, bytes): return ctypes.cast(value, ctypes.POINTER(library_type)) elif isinstance(value, list): - assert library_type is not None, 'library_type is required for list' + assert library_type is not None, "library_type is required for list" return (library_type * len(value))(*value) else: if library_type is not None and size is not None: @@ -71,6 +74,7 @@ def aux(*xs, **kws): session = xs[0] # parameter 0 is 'self' which is the session object with session.lock(): return f(*xs, **kws) + return aux @@ -91,16 +95,34 @@ def __init__(self, session, prefix, current_repeated_capability_list): self._session = session self._prefix = prefix # We need at least one element. If we get an empty list, make the one element an empty string - self._current_repeated_capability_list = current_repeated_capability_list if len(current_repeated_capability_list) > 0 else [''] + self._current_repeated_capability_list = ( + current_repeated_capability_list + if len(current_repeated_capability_list) > 0 + else [""] + ) # Now we know there is at lease one entry, so we look if it is an empty string or not - self._separator = '/' if len(self._current_repeated_capability_list[0]) > 0 else '' + self._separator = ( + "/" if len(self._current_repeated_capability_list[0]) > 0 else "" + ) def __getitem__(self, repeated_capability): - '''Set/get properties or call methods with a repeated capability (i.e. channels)''' - rep_caps_list = _converters.convert_repeated_capabilities(repeated_capability, self._prefix) - complete_rep_cap_list = [current_rep_cap + self._separator + rep_cap for current_rep_cap in self._current_repeated_capability_list for rep_cap in rep_caps_list] - - return _SessionBase(vi=self._session._vi, repeated_capability_list=complete_rep_cap_list, library=self._session._library, encoding=self._session._encoding, freeze_it=True) + """Set/get properties or call methods with a repeated capability (i.e. channels)""" + rep_caps_list = _converters.convert_repeated_capabilities( + repeated_capability, self._prefix + ) + complete_rep_cap_list = [ + current_rep_cap + self._separator + rep_cap + for current_rep_cap in self._current_repeated_capability_list + for rep_cap in rep_caps_list + ] + + return _SessionBase( + vi=self._session._vi, + repeated_capability_list=complete_rep_cap_list, + library=self._session._library, + encoding=self._session._encoding, + freeze_it=True, + ) # This is a very simple context manager we can use when we need to set/get attributes @@ -112,20 +134,20 @@ def __init__(self, session): def __enter__(self): self._repeated_capability_cache = self._session._repeated_capability - self._session._repeated_capability = '' + self._session._repeated_capability = "" def __exit__(self, exc_type, exc_value, traceback): self._session._repeated_capability = self._repeated_capability_cache class _SessionBase(object): - '''Base class for all NI-DCPower sessions.''' + """Base class for all NI-DCPower sessions.""" # This is needed during __init__. Without it, __setattr__ raises an exception _is_frozen = False active_advanced_sequence = _attributes.AttributeViString(1150074) - '''Type: str + """Type: str Specifies the advanced sequence to configure or generate. @@ -140,9 +162,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.active_advanced_sequence` - ''' + """ active_advanced_sequence_step = _attributes.AttributeViInt64(1150075) - '''Type: int + """Type: int Specifies the advanced sequence step to configure. @@ -157,9 +179,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.active_advanced_sequence_step` - ''' + """ actual_power_allocation = _attributes.AttributeViReal64(1150205) - '''Type: float + """Type: float Returns the power, in watts, the device is sourcing on each active channel if the power_allocation_mode property is set to PowerAllocationMode.AUTOMATIC or PowerAllocationMode.MANUAL. @@ -180,9 +202,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.actual_power_allocation` - ''' + """ aperture_time = _attributes.AttributeViReal64(1150058) - '''Type: float + """Type: float Specifies the measurement aperture time for the channel configuration. Aperture time is specified in the units set by the aperture_time_units property. for information about supported devices. @@ -200,9 +222,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.aperture_time` - ''' - aperture_time_units = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ApertureTimeUnits, 1150059) - '''Type: enums.ApertureTimeUnits + """ + aperture_time_units = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.ApertureTimeUnits, 1150059 + ) + """Type: enums.ApertureTimeUnits Specifies the units of the aperture_time property for the channel configuration. for information about supported devices. @@ -220,9 +244,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.aperture_time_units` - ''' + """ autorange = _attributes.AttributeViInt32(1150244) - '''Type: bool + """Type: bool Specifies whether the hardware automatically selects the best range to measure the signal. Note the highest range the algorithm uses is dependent on the corresponding limit range property. The algorithm the hardware uses can be controlled using the autorange_aperture_time_mode property. @@ -237,9 +261,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.autorange` - ''' - autorange_aperture_time_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.AutorangeApertureTimeMode, 1150246) - '''Type: enums.AutorangeApertureTimeMode + """ + autorange_aperture_time_mode = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.AutorangeApertureTimeMode, 1150246 + ) + """Type: enums.AutorangeApertureTimeMode Specifies whether the aperture time used for the measurement autorange algorithm is determined automatically or customized using the autorange_minimum_aperture_time property. @@ -254,9 +280,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.autorange_aperture_time_mode` - ''' - autorange_behavior = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.AutorangeBehavior, 1150245) - '''Type: enums.AutorangeBehavior + """ + autorange_behavior = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.AutorangeBehavior, 1150245 + ) + """Type: enums.AutorangeBehavior Specifies the algorithm the hardware uses for measurement autoranging. @@ -271,9 +299,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.autorange_behavior` - ''' + """ autorange_minimum_aperture_time = _attributes.AttributeViReal64(1150247) - '''Type: float + """Type: float Specifies the measurement autorange aperture time used for the measurement autorange algorithm. The aperture time is specified in the units set by the autorange_minimum_aperture_time_units property. This value will typically be smaller than the aperture time used for measurements. @@ -288,9 +316,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.autorange_minimum_aperture_time` - ''' - autorange_minimum_aperture_time_units = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ApertureTimeUnits, 1150248) - '''Type: enums.ApertureTimeUnits + """ + autorange_minimum_aperture_time_units = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.ApertureTimeUnits, 1150248 + ) + """Type: enums.ApertureTimeUnits Specifies the units of the autorange_minimum_aperture_time property. @@ -305,9 +335,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.autorange_minimum_aperture_time_units` - ''' + """ autorange_minimum_current_range = _attributes.AttributeViReal64(1150255) - '''Type: float + """Type: float Specifies the lowest range used during measurement autoranging. Limiting the lowest range used during autoranging can improve the speed of the autoranging algorithm and minimize frequent and unpredictable range changes for noisy signals. @@ -322,9 +352,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.autorange_minimum_current_range` - ''' + """ autorange_minimum_voltage_range = _attributes.AttributeViReal64(1150256) - '''Type: float + """Type: float Specifies the lowest range used during measurement autoranging. The maximum range used is range that includes the value specified in the compliance limit property. Limiting the lowest range used during autoranging can improve the speed of the autoranging algorithm and/or minimize thrashing between ranges for noisy signals. @@ -339,9 +369,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.autorange_minimum_voltage_range` - ''' - autorange_threshold_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.AutorangeThresholdMode, 1150257) - '''Type: enums.AutorangeThresholdMode + """ + autorange_threshold_mode = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.AutorangeThresholdMode, 1150257 + ) + """Type: enums.AutorangeThresholdMode Specifies thresholds used during autoranging to determine when range changing occurs. @@ -356,9 +388,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.autorange_threshold_mode` - ''' - auto_zero = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.AutoZero, 1150055) - '''Type: enums.AutoZero + """ + auto_zero = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.AutoZero, 1150055 + ) + """Type: enums.AutoZero Specifies the auto-zero method to use on the device. Refer to the NI PXI-4132 Measurement Configuration and Timing and Auto Zero topics for more information about how to configure your measurements. @@ -373,23 +407,25 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.auto_zero` - ''' + """ auxiliary_power_source_available = _attributes.AttributeViBoolean(1150002) - '''Type: bool + """Type: bool Indicates whether an auxiliary power source is connected to the device. A value of False may indicate that the auxiliary input fuse has blown. Refer to the Detecting Internal/Auxiliary Power topic in the NI DC Power Supplies and SMUs Help for more information about internal and auxiliary power. power source to generate power. Use the power_source_in_use property to retrieve this information. Note: This property does not necessarily indicate if the device is using the auxiliary - ''' + """ channel_count = _attributes.AttributeViInt32(1050203) - '''Type: int + """Type: int Indicates the number of channels that NI-DCPower supports for the instrument that was chosen when the current session was opened. For channel-based properties, the IVI engine maintains a separate cache value for each channel. - ''' - compliance_limit_symmetry = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ComplianceLimitSymmetry, 1150184) - '''Type: enums.ComplianceLimitSymmetry + """ + compliance_limit_symmetry = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.ComplianceLimitSymmetry, 1150184 + ) + """Type: enums.ComplianceLimitSymmetry Specifies whether compliance limits for current generation and voltage generation for the device are applied symmetrically about 0 V and 0 A or @@ -423,9 +459,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.compliance_limit_symmetry` - ''' + """ current_compensation_frequency = _attributes.AttributeViReal64(1150071) - '''Type: float + """Type: float The frequency at which a pole-zero pair is added to the system when the channel is in Constant Current mode. for information about supported devices. @@ -442,9 +478,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_compensation_frequency` - ''' + """ current_gain_bandwidth = _attributes.AttributeViReal64(1150070) - '''Type: float + """Type: float The frequency at which the unloaded loop gain extrapolates to 0 dB in the absence of additional poles and zeroes. This property takes effect when the channel is in Constant Current mode. for information about supported devices. @@ -461,9 +497,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_gain_bandwidth` - ''' + """ current_level = _attributes.AttributeViReal64(1150009) - '''Type: float + """Type: float Specifies the current level, in amps, that the device attempts to generate on the specified channel(s). This property is applicable only if the output_function property is set to OutputFunction.DC_CURRENT. @@ -481,9 +517,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_level` - ''' + """ current_level_autorange = _attributes.AttributeViInt32(1150017) - '''Type: bool + """Type: bool Specifies whether NI-DCPower automatically selects the current level range based on the desired current level for the specified channels. If you set this property to AutoZero.ON, NI-DCPower ignores any changes you make to the current_level_range property. If you change the current_level_autorange property from AutoZero.ON to AutoZero.OFF, NI-DCPower retains the last value the current_level_range property was set to (or the default value if the property was never set) and uses that value as the current level range. @@ -500,9 +536,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_level_autorange` - ''' + """ current_level_range = _attributes.AttributeViReal64(1150011) - '''Type: float + """Type: float Specifies the current level range, in amps, for the specified channel(s). The range defines the valid value to which the current level can be set. Use the current_level_autorange property to enable automatic selection of the current level range. @@ -521,9 +557,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_level_range` - ''' + """ current_limit = _attributes.AttributeViReal64(1250005) - '''Type: float + """Type: float Specifies the current limit, in amps, that the output cannot exceed when generating the desired voltage level on the specified channel(s). This property is applicable only if the output_function property is set to OutputFunction.DC_VOLTAGE and the compliance_limit_symmetry property is set to ComplianceLimitSymmetry.SYMMETRIC. @@ -541,9 +577,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_limit` - ''' + """ current_limit_autorange = _attributes.AttributeViInt32(1150016) - '''Type: bool + """Type: bool Specifies whether NI-DCPower automatically selects the current limit range based on the desired current limit for the specified channel(s). If you set this property to AutoZero.ON, NI-DCPower ignores any changes you make to the current_limit_range property. If you change this property from AutoZero.ON to AutoZero.OFF, NI-DCPower retains the last value the current_limit_range property was set to (or the default value if the property was never set) and uses that value as the current limit range. @@ -560,9 +596,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_limit_autorange` - ''' + """ current_limit_behavior = _attributes.AttributeViInt32(1250004) - '''Type: int + """Type: int Tip: This property can be set/get on specific channels within your :py:class:`nidcpower.Session` instance. @@ -573,9 +609,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_limit_behavior` - ''' + """ current_limit_high = _attributes.AttributeViReal64(1150187) - '''Type: float + """Type: float Specifies the maximum current, in amps, that the output can produce when generating the desired voltage on the specified channel(s). @@ -617,9 +653,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_limit_high` - ''' + """ current_limit_low = _attributes.AttributeViReal64(1150188) - '''Type: float + """Type: float Specifies the minimum current, in amps, that the output can produce when generating the desired voltage on the specified channel(s). @@ -661,9 +697,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_limit_low` - ''' + """ current_limit_range = _attributes.AttributeViReal64(1150004) - '''Type: float + """Type: float Specifies the current limit range, in amps, for the specified channel(s). The range defines the valid value to which the current limit can be set. Use the current_limit_autorange property to enable automatic selection of the current limit range. @@ -682,9 +718,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_limit_range` - ''' + """ current_pole_zero_ratio = _attributes.AttributeViReal64(1150072) - '''Type: float + """Type: float The ratio of the pole frequency to the zero frequency when the channel is in Constant Current mode. for information about supported devices. @@ -701,9 +737,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_pole_zero_ratio` - ''' - dc_noise_rejection = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.DCNoiseRejection, 1150066) - '''Type: enums.DCNoiseRejection + """ + dc_noise_rejection = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.DCNoiseRejection, 1150066 + ) + """Type: enums.DCNoiseRejection Determines the relative weighting of samples in a measurement. Refer to the NI PXIe-4140/4141 DC Noise Rejection, NI PXIe-4142/4143 DC Noise Rejection, or NI PXIe-4144/4145 DC Noise Rejection topic in the NI DC Power Supplies and SMUs Help for more information about noise rejection. for information about supported devices. @@ -720,9 +758,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.dc_noise_rejection` - ''' + """ digital_edge_measure_trigger_input_terminal = _attributes.AttributeViString(1150036) - '''Type: str + """Type: str Specifies the input terminal for the Measure trigger. This property is used only when the measure_trigger_type property is set to TriggerType.DIGITAL_EDGE. for this property. @@ -740,9 +778,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.digital_edge_measure_trigger_input_terminal` - ''' + """ digital_edge_pulse_trigger_input_terminal = _attributes.AttributeViString(1150097) - '''Type: str + """Type: str Specifies the input terminal for the Pulse trigger. This property is used only when the pulse_trigger_type property is set to digital edge. You can specify any valid input terminal for this property. Valid terminals are listed in Measurement & Automation Explorer under the Device Routes tab. @@ -759,9 +797,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.digital_edge_pulse_trigger_input_terminal` - ''' - digital_edge_sequence_advance_trigger_input_terminal = _attributes.AttributeViString(1150028) - '''Type: str + """ + digital_edge_sequence_advance_trigger_input_terminal = ( + _attributes.AttributeViString(1150028) + ) + """Type: str Specifies the input terminal for the Sequence Advance trigger. Use this property only when the sequence_advance_trigger_type property is set to TriggerType.DIGITAL_EDGE. the NI DC Power Supplies and SMUs Help for information about supported devices. @@ -779,9 +819,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.digital_edge_sequence_advance_trigger_input_terminal` - ''' - digital_edge_shutdown_trigger_input_terminal = _attributes.AttributeViString(1150277) - '''Type: str + """ + digital_edge_shutdown_trigger_input_terminal = _attributes.AttributeViString( + 1150277 + ) + """Type: str Specifies the input terminal for the Shutdown trigger. This property is used only when the shutdown_trigger_type property is set to digital edge. You can specify any valid input terminal for this property. Valid terminals are listed in Measurement & Automation Explorer under the Device Routes tab. @@ -798,9 +840,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.digital_edge_shutdown_trigger_input_terminal` - ''' + """ digital_edge_source_trigger_input_terminal = _attributes.AttributeViString(1150032) - '''Type: str + """Type: str Specifies the input terminal for the Source trigger. Use this property only when the source_trigger_type property is set to TriggerType.DIGITAL_EDGE. for information about supported devices. @@ -818,9 +860,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.digital_edge_source_trigger_input_terminal` - ''' + """ digital_edge_start_trigger_input_terminal = _attributes.AttributeViString(1150023) - '''Type: str + """Type: str Specifies the input terminal for the Start trigger. Use this property only when the start_trigger_type property is set to TriggerType.DIGITAL_EDGE. for information about supported devices. @@ -838,16 +880,16 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.digital_edge_start_trigger_input_terminal` - ''' + """ driver_setup = _attributes.AttributeViString(1050007) - '''Type: str + """Type: str Indicates the Driver Setup string that you specified when initializing the driver. Some cases exist where you must specify the instrument driver options at initialization time. An example of this case is specifying a particular device model from among a family of devices that the driver supports. This property is useful when simulating a device. You can specify the driver-specific options through the DriverSetup keyword in the optionsString parameter in the __init__ method or through the IVI Configuration Utility. You can specify driver-specific options through the DriverSetup keyword in the optionsString parameter in the __init__ method. If you do not specify a Driver Setup string, this property returns an empty string. - ''' + """ exported_measure_trigger_output_terminal = _attributes.AttributeViString(1150037) - '''Type: str + """Type: str Specifies the output terminal for exporting the Measure trigger. Refer to the Device Routes tab in Measurement & Automation Explorer for a list of the terminals available on your device. @@ -865,9 +907,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.exported_measure_trigger_output_terminal` - ''' + """ exported_pulse_trigger_output_terminal = _attributes.AttributeViString(1150098) - '''Type: str + """Type: str Specifies the output terminal for exporting the Pulse trigger. Refer to the Device Routes tab in Measurement & Automation Explorer for a list of the terminals available on your device. @@ -884,9 +926,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.exported_pulse_trigger_output_terminal` - ''' - exported_sequence_advance_trigger_output_terminal = _attributes.AttributeViString(1150029) - '''Type: str + """ + exported_sequence_advance_trigger_output_terminal = _attributes.AttributeViString( + 1150029 + ) + """Type: str Specifies the output terminal for exporting the Sequence Advance trigger. Refer to the Device Routes tab in Measurement & Automation Explorer for a list of the terminals available on your device. @@ -904,9 +948,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.exported_sequence_advance_trigger_output_terminal` - ''' + """ exported_source_trigger_output_terminal = _attributes.AttributeViString(1150033) - '''Type: str + """Type: str Specifies the output terminal for exporting the Source trigger. Refer to the Device Routes tab in MAX for a list of the terminals available on your device. @@ -924,9 +968,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.exported_source_trigger_output_terminal` - ''' + """ exported_start_trigger_output_terminal = _attributes.AttributeViString(1150024) - '''Type: str + """Type: str Specifies the output terminal for exporting the Start trigger. Refer to the Device Routes tab in Measurement & Automation Explorer (MAX) for a list of the terminals available on your device. @@ -944,9 +988,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.exported_start_trigger_output_terminal` - ''' + """ fetch_backlog = _attributes.AttributeViInt32(1150056) - '''Type: int + """Type: int Returns the number of measurements acquired that have not been fetched yet. @@ -959,9 +1003,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.fetch_backlog` - ''' + """ instrument_firmware_revision = _attributes.AttributeViString(1050510) - '''Type: str + """Type: str Contains the firmware revision information for the device you are currently using. @@ -974,9 +1018,9 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.instrument_firmware_revision` - ''' + """ instrument_manufacturer = _attributes.AttributeViString(1050511) - '''Type: str + """Type: str Contains the name of the manufacturer for the device you are currently using. @@ -989,9 +1033,9 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.instrument_manufacturer` - ''' + """ instrument_model = _attributes.AttributeViString(1050512) - '''Type: str + """Type: str Contains the model number or name of the device that you are currently using. @@ -1004,9 +1048,9 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.instrument_model` - ''' + """ interlock_input_open = _attributes.AttributeViBoolean(1150105) - '''Type: bool + """Type: bool Indicates whether the safety interlock circuit is open. Refer to the Safety Interlock topic in the NI DC Power Supplies and SMUs Help for more information about the safety interlock circuit. @@ -1023,22 +1067,22 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.interlock_input_open` - ''' + """ io_resource_descriptor = _attributes.AttributeViString(1050304) - '''Type: str + """Type: str Indicates the resource descriptor NI-DCPower uses to identify the physical device. If you initialize NI-DCPower with a logical name, this property contains the resource descriptor that corresponds to the entry in the IVI Configuration utility. If you initialize NI-DCPower with the resource descriptor, this property contains that value. - ''' + """ logical_name = _attributes.AttributeViString(1050305) - '''Type: str + """Type: str Contains the logical name you specified when opening the current IVI session. You can pass a logical name to the __init__ method. The IVI Configuration utility must contain an entry for the logical name. The logical name entry refers to a method section in the IVI Configuration file. The method section specifies a physical device and initial user options. - ''' + """ measure_buffer_size = _attributes.AttributeViInt32(1150077) - '''Type: int + """Type: int Specifies the number of samples that the active channel measurement buffer can hold. The default value is the maximum number of samples that a device is capable of recording in one second. @@ -1057,9 +1101,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.measure_buffer_size` - ''' - measure_complete_event_delay = _attributes.AttributeViReal64TimeDeltaSeconds(1150046) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """ + measure_complete_event_delay = _attributes.AttributeViReal64TimeDeltaSeconds( + 1150046 + ) + """Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the amount of time to delay the generation of the Measure Complete event, in seconds. for information about supported devices. @@ -1077,9 +1123,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.measure_complete_event_delay` - ''' + """ measure_complete_event_output_terminal = _attributes.AttributeViString(1150047) - '''Type: str + """Type: str Specifies the output terminal for exporting the Measure Complete event. for information about supported devices. @@ -1096,9 +1142,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.measure_complete_event_output_terminal` - ''' - measure_complete_event_pulse_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.Polarity, 1150044) - '''Type: enums.Polarity + """ + measure_complete_event_pulse_polarity = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.Polarity, 1150044 + ) + """Type: enums.Polarity Specifies the behavior of the Measure Complete event. for information about supported devices. @@ -1115,9 +1163,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.measure_complete_event_pulse_polarity` - ''' + """ measure_complete_event_pulse_width = _attributes.AttributeViReal64(1150045) - '''Type: float + """Type: float Specifies the width of the Measure Complete event, in seconds. The minimum event pulse width value for PXI devices is 150 ns, and the minimum event pulse width value for PXI Express devices is 250 ns. @@ -1137,9 +1185,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.measure_complete_event_pulse_width` - ''' + """ measure_record_delta_time = _attributes.AttributeViReal64TimeDeltaSeconds(1150065) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """Type: hightime.timedelta, datetime.timedelta, or float in seconds Queries the amount of time, in seconds, between between the start of two consecutive measurements in a measure record. Only query this property after the desired measurement settings are committed. for information about supported devices. @@ -1156,9 +1204,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.measure_record_delta_time` - ''' + """ measure_record_length = _attributes.AttributeViInt32(1150063) - '''Type: int + """Type: int Specifies how many measurements compose a measure record. When this property is set to a value greater than 1, the measure_when property must be set to MeasureWhen.AUTOMATICALLY_AFTER_SOURCE_COMPLETE or MeasureWhen.ON_MEASURE_TRIGGER. for information about supported devices. @@ -1177,9 +1225,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.measure_record_length` - ''' + """ measure_record_length_is_finite = _attributes.AttributeViBoolean(1150064) - '''Type: bool + """Type: bool Specifies whether to take continuous measurements. Call the abort method to stop continuous measurements. When this property is set to False and the source_mode property is set to SourceMode.SINGLE_POINT, the measure_when property must be set to MeasureWhen.AUTOMATICALLY_AFTER_SOURCE_COMPLETE or MeasureWhen.ON_MEASURE_TRIGGER. When this property is set to False and the source_mode property is set to SourceMode.SEQUENCE, the measure_when property must be set to MeasureWhen.ON_MEASURE_TRIGGER. for information about supported devices. @@ -1197,9 +1245,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.measure_record_length_is_finite` - ''' - measure_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerType, 1150034) - '''Type: enums.TriggerType + """ + measure_trigger_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TriggerType, 1150034 + ) + """Type: enums.TriggerType Specifies the behavior of the Measure trigger. for information about supported devices. @@ -1216,9 +1266,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.measure_trigger_type` - ''' - measure_when = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.MeasureWhen, 1150057) - '''Type: enums.MeasureWhen + """ + measure_when = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.MeasureWhen, 1150057 + ) + """Type: enums.MeasureWhen Specifies when the measure unit should acquire measurements. Unless this property is configured to MeasureWhen.ON_MEASURE_TRIGGER, the measure_trigger_type property is ignored. Refer to the Acquiring Measurements topic in the NI DC Power Supplies and SMUs Help for more information about how to configure your measurements. @@ -1233,9 +1285,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.measure_when` - ''' + """ merged_channels = _attributes.AttributeViStringRepeatedCapability(1150249) - '''Type: str + """Type: str Specifies the channel(s) to merge with a designated primary channel of an SMU in order to increase the maximum current you can source from the SMU. This property designates the merge channels to combine with a primary channel. To designate the primary channel, initialize the session to the primary channel only. @@ -1254,9 +1306,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.merged_channels` - ''' - output_capacitance = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.OutputCapacitance, 1150014) - '''Type: enums.OutputCapacitance + """ + output_capacitance = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.OutputCapacitance, 1150014 + ) + """Type: enums.OutputCapacitance Specifies whether to use a low or high capacitance on the output for the specified channel(s). for information about supported devices. @@ -1273,9 +1327,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_capacitance` - ''' + """ output_connected = _attributes.AttributeViBoolean(1150060) - '''Type: bool + """Type: bool Specifies whether the output relay is connected (closed) or disconnected (open). The output_enabled property does not change based on this property; they are independent of each other. about supported devices. @@ -1294,9 +1348,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_connected` - ''' + """ output_cutoff_current_change_limit_high = _attributes.AttributeViReal64(1150295) - '''Type: float + """Type: float Specifies a limit for positive current slew rate, in amps per microsecond, for output cutoff. If the current increases at a rate that exceeds this limit, the output is disconnected. @@ -1314,9 +1368,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_cutoff_current_change_limit_high` - ''' + """ output_cutoff_current_change_limit_low = _attributes.AttributeViReal64(1150239) - '''Type: float + """Type: float Specifies a limit for negative current slew rate, in amps per microsecond, for output cutoff. If the current decreases at a rate that exceeds this limit, the output is disconnected. @@ -1334,9 +1388,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_cutoff_current_change_limit_low` - ''' + """ output_cutoff_current_measure_limit_high = _attributes.AttributeViReal64(1150237) - '''Type: float + """Type: float Specifies a high limit current value, in amps, for output cutoff. If the measured current exceeds this limit, the output is disconnected. @@ -1354,9 +1408,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_cutoff_current_measure_limit_high` - ''' + """ output_cutoff_current_measure_limit_low = _attributes.AttributeViReal64(1150293) - '''Type: float + """Type: float Specifies a low limit current value, in amps, for output cutoff. If the measured current falls below this limit, the output is disconnected. @@ -1374,9 +1428,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_cutoff_current_measure_limit_low` - ''' + """ output_cutoff_current_overrange_enabled = _attributes.AttributeViBoolean(1150240) - '''Type: bool + """Type: bool Enables or disables current overrange functionality for output cutoff. If enabled, the output is disconnected when the measured current saturates the current range. @@ -1393,9 +1447,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_cutoff_current_overrange_enabled` - ''' + """ output_cutoff_delay = _attributes.AttributeViReal64TimeDeltaSeconds(1150300) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """Type: hightime.timedelta, datetime.timedelta, or float in seconds Delays disconnecting the output by the time you specify, in seconds, when a limit is exceeded. @@ -1410,9 +1464,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_cutoff_delay` - ''' + """ output_cutoff_enabled = _attributes.AttributeViBoolean(1150235) - '''Type: bool + """Type: bool Enables or disables output cutoff functionality. If enabled, you can define output cutoffs that, if exceeded, cause the output of the specified channel(s) to be disconnected. When this property is disabled, all other output cutoff properties are ignored. @@ -1428,9 +1482,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_cutoff_enabled` - ''' + """ output_cutoff_voltage_change_limit_high = _attributes.AttributeViReal64(1150294) - '''Type: float + """Type: float Specifies a limit for positive voltage slew rate, in volts per microsecond, for output cutoff. If the voltage increases at a rate that exceeds this limit, the output is disconnected. @@ -1448,9 +1502,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_cutoff_voltage_change_limit_high` - ''' + """ output_cutoff_voltage_change_limit_low = _attributes.AttributeViReal64(1150238) - '''Type: float + """Type: float Specifies a limit for negative voltage slew rate, in volts per microsecond, for output cutoff. If the voltage decreases at a rate that exceeds this limit, the output is disconnected. @@ -1468,9 +1522,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_cutoff_voltage_change_limit_low` - ''' + """ output_cutoff_voltage_output_limit_high = _attributes.AttributeViReal64(1150236) - '''Type: float + """Type: float Specifies a high limit voltage value, in volts, for output cutoff. If the voltage output exceeds this limit, the output is disconnected. @@ -1488,9 +1542,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_cutoff_voltage_output_limit_high` - ''' + """ output_cutoff_voltage_output_limit_low = _attributes.AttributeViReal64(1150292) - '''Type: float + """Type: float Specifies a low limit voltage value, in volts, for output cutoff. If the voltage output falls below this limit, the output is disconnected. @@ -1508,9 +1562,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_cutoff_voltage_output_limit_low` - ''' + """ output_enabled = _attributes.AttributeViBoolean(1250006) - '''Type: bool + """Type: bool Specifies whether the output is enabled (True) or disabled (False). Depending on the value you specify for the output_function property, you also must set the voltage level or current level in addition to enabling the output @@ -1528,9 +1582,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_enabled` - ''' - output_function = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.OutputFunction, 1150008) - '''Type: enums.OutputFunction + """ + output_function = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.OutputFunction, 1150008 + ) + """Type: enums.OutputFunction Configures the method to generate on the specified channel(s). When OutputFunction.DC_VOLTAGE is selected, the device generates the desired voltage level on the output as long as the output current is below the current limit. You can use the following properties to configure the channel when OutputFunction.DC_VOLTAGE is selected: @@ -1559,9 +1615,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_function` - ''' + """ output_resistance = _attributes.AttributeViReal64(1150061) - '''Type: float + """Type: float Specifies the output resistance that the device attempts to generate for the specified channel(s). This property is available only when you set the output_function property on a support device. Refer to a supported device's topic about output resistance for more information about selecting an output resistance. about supported devices. @@ -1578,9 +1634,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_resistance` - ''' + """ overranging_enabled = _attributes.AttributeViBoolean(1150007) - '''Type: bool + """Type: bool Specifies whether NI-DCPower allows setting the voltage level, current level, voltage limit and current limit outside the device specification limits. True means that overranging is enabled. Refer to the Ranges topic in the NI DC Power Supplies and SMUs Help for more information about overranging. @@ -1595,9 +1651,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.overranging_enabled` - ''' + """ ovp_enabled = _attributes.AttributeViBoolean(1250002) - '''Type: bool + """Type: bool Enables (True) or disables (False) overvoltage protection (OVP). Refer to the Output Overvoltage Protection topic in the NI DC Power Supplies and SMUs Help for more information about overvoltage protection. @@ -1615,9 +1671,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.ovp_enabled` - ''' + """ ovp_limit = _attributes.AttributeViReal64(1250003) - '''Type: float + """Type: float Determines the voltage limit, in volts, beyond which overvoltage protection (OVP) engages. for information about supported devices. @@ -1635,9 +1691,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.ovp_limit` - ''' - power_allocation_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.PowerAllocationMode, 1150207) - '''Type: enums.PowerAllocationMode + """ + power_allocation_mode = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.PowerAllocationMode, 1150207 + ) + """Type: enums.PowerAllocationMode Determines whether the device sources the power its source configuration requires or a specific wattage you request; determines whether NI-DCPower proactively checks that this sourcing power is within the maximum per-channel and overall sourcing power of the device. @@ -1658,9 +1716,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.power_allocation_mode` - ''' + """ power_line_frequency = _attributes.AttributeViReal64(1150020) - '''Type: float + """Type: float Specifies the power line frequency for specified channel(s). NI-DCPower uses this value to select a timebase for setting the aperture_time property in power line cycles (PLCs). in the NI DC Power Supplies and SMUs Help for information about supported devices. @@ -1680,23 +1738,27 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.power_line_frequency` - ''' - power_source = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.PowerSource, 1150000) - '''Type: enums.PowerSource + """ + power_source = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.PowerSource, 1150000 + ) + """Type: enums.PowerSource Specifies the power source to use. NI-DCPower switches the power source used by the device to the specified value. Default Value: PowerSource.AUTOMATIC is set to PowerSource.AUTOMATIC. However, if the session is in the Committed or Uncommitted state when you set this property, the power source selection only occurs after you call the initiate method. Note: Automatic selection is not persistent and occurs only at the time this property - ''' - power_source_in_use = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.PowerSourceInUse, 1150001) - '''Type: enums.PowerSourceInUse + """ + power_source_in_use = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.PowerSourceInUse, 1150001 + ) + """Type: enums.PowerSourceInUse Indicates whether the device is using the internal or auxiliary power source to generate power. - ''' + """ pulse_bias_current_level = _attributes.AttributeViReal64(1150088) - '''Type: float + """Type: float Specifies the pulse bias current level, in amps, that the device attempts to generate on the specified channel(s) during the off phase of a pulse. This property is applicable only if the output_function property is set to OutputFunction.PULSE_CURRENT. @@ -1713,9 +1775,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_bias_current_level` - ''' + """ pulse_bias_current_limit = _attributes.AttributeViReal64(1150083) - '''Type: float + """Type: float Specifies the pulse bias current limit, in amps, that the output cannot exceed when generating the desired pulse bias voltage on the specified channel(s) during the off phase of a pulse. This property is applicable only if the output_function property is set to OutputFunction.PULSE_VOLTAGE. @@ -1732,9 +1794,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_bias_current_limit` - ''' + """ pulse_bias_current_limit_high = _attributes.AttributeViReal64(1150195) - '''Type: float + """Type: float Specifies the maximum current, in amps, that the output can produce when generating the desired pulse voltage on the specified channel(s) during @@ -1779,9 +1841,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_bias_current_limit_high` - ''' + """ pulse_bias_current_limit_low = _attributes.AttributeViReal64(1150196) - '''Type: float + """Type: float Specifies the minimum current, in amps, that the output can produce when generating the desired pulse voltage on the specified channel(s) during @@ -1826,9 +1888,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_bias_current_limit_low` - ''' + """ pulse_bias_delay = _attributes.AttributeViReal64(1150092) - '''Type: float + """Type: float Determines when, in seconds, the device generates the Pulse Complete event after generating the off level of a pulse. Valid Values: 0 to 167 seconds @@ -1845,9 +1907,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_bias_delay` - ''' + """ pulse_bias_voltage_level = _attributes.AttributeViReal64(1150082) - '''Type: float + """Type: float Specifies the pulse bias voltage level, in volts, that the device attempts to generate on the specified channel(s) during the off phase of a pulse. This property is applicable only if the output_function property is set to OutputFunction.PULSE_VOLTAGE. @@ -1864,9 +1926,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_bias_voltage_level` - ''' + """ pulse_bias_voltage_limit = _attributes.AttributeViReal64(1150089) - '''Type: float + """Type: float Specifies the pulse voltage limit, in volts, that the output cannot exceed when generating the desired current on the specified channel(s) during the off phase of a pulse. This property is applicable only if the output_function property is set to OutputFunction.PULSE_CURRENT. @@ -1883,9 +1945,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_bias_voltage_limit` - ''' + """ pulse_bias_voltage_limit_high = _attributes.AttributeViReal64(1150191) - '''Type: float + """Type: float Specifies the maximum voltage, in volts, that the output can produce when generating the desired pulse current on the specified channel(s) @@ -1930,9 +1992,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_bias_voltage_limit_high` - ''' + """ pulse_bias_voltage_limit_low = _attributes.AttributeViReal64(1150192) - '''Type: float + """Type: float Specifies the minimum voltage, in volts, that the output can produce when generating the desired pulse current on the specified channel(s) @@ -1977,9 +2039,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_bias_voltage_limit_low` - ''' + """ pulse_complete_event_output_terminal = _attributes.AttributeViString(1150099) - '''Type: str + """Type: str Specifies the output terminal for exporting the Pulse Complete event. Output terminals can be specified in one of two ways. If the device is named Dev1 and your terminal is PXI_Trig0, you can specify the terminal with the fully qualified terminal name, /Dev1/PXI_Trig0, or with the shortened terminal name, PXI_Trig0. @@ -1996,9 +2058,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_complete_event_output_terminal` - ''' - pulse_complete_event_pulse_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.Polarity, 1150100) - '''Type: enums.Polarity + """ + pulse_complete_event_pulse_polarity = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.Polarity, 1150100 + ) + """Type: enums.Polarity Specifies the behavior of the Pulse Complete event. Default Value: Polarity.HIGH @@ -2014,9 +2078,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_complete_event_pulse_polarity` - ''' + """ pulse_complete_event_pulse_width = _attributes.AttributeViReal64(1150101) - '''Type: float + """Type: float Specifies the width of the Pulse Complete event, in seconds. The minimum event pulse width value for PXI Express devices is 250 ns. @@ -2034,9 +2098,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_complete_event_pulse_width` - ''' + """ pulse_current_level = _attributes.AttributeViReal64(1150086) - '''Type: float + """Type: float Specifies the pulse current level, in amps, that the device attempts to generate on the specified channel(s) during the on phase of a pulse. This property is applicable only if the output_function property is set to OutputFunction.PULSE_CURRENT. @@ -2053,9 +2117,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_current_level` - ''' + """ pulse_current_level_range = _attributes.AttributeViReal64(1150090) - '''Type: float + """Type: float Specifies the pulse current level range, in amps, for the specified channel(s). The range defines the valid values to which you can set the pulse current level and pulse bias current level. @@ -2073,9 +2137,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_current_level_range` - ''' + """ pulse_current_limit = _attributes.AttributeViReal64(1150081) - '''Type: float + """Type: float Specifies the pulse current limit, in amps, that the output cannot exceed when generating the desired pulse voltage on the specified channel(s) during the on phase of a pulse. This property is applicable only if the output_function property is set to OutputFunction.PULSE_VOLTAGE and the compliance_limit_symmetry property is set to ComplianceLimitSymmetry.SYMMETRIC. @@ -2092,9 +2156,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_current_limit` - ''' + """ pulse_current_limit_high = _attributes.AttributeViReal64(1150193) - '''Type: float + """Type: float Specifies the maximum current, in amps, that the output can produce when generating the desired pulse voltage on the specified channel(s) during @@ -2139,9 +2203,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_current_limit_high` - ''' + """ pulse_current_limit_low = _attributes.AttributeViReal64(1150194) - '''Type: float + """Type: float Specifies the minimum current, in amps, that the output can produce when generating the desired pulse voltage on the specified channel(s) during @@ -2186,9 +2250,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_current_limit_low` - ''' + """ pulse_current_limit_range = _attributes.AttributeViReal64(1150085) - '''Type: float + """Type: float Specifies the pulse current limit range, in amps, for the specified channel(s). The range defines the valid values to which you can set the pulse current limit and pulse bias current limit. @@ -2206,9 +2270,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_current_limit_range` - ''' + """ pulse_off_time = _attributes.AttributeViReal64TimeDeltaSeconds(1150094) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """Type: hightime.timedelta, datetime.timedelta, or float in seconds Determines the length, in seconds, of the off phase of a pulse. Valid Values: 10 microseconds to 167 seconds @@ -2225,9 +2289,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_off_time` - ''' + """ pulse_on_time = _attributes.AttributeViReal64TimeDeltaSeconds(1150093) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """Type: hightime.timedelta, datetime.timedelta, or float in seconds Determines the length, in seconds, of the on phase of a pulse. Valid Values: 10 microseconds to 167 seconds @@ -2244,9 +2308,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_on_time` - ''' - pulse_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerType, 1150095) - '''Type: enums.TriggerType + """ + pulse_trigger_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TriggerType, 1150095 + ) + """Type: enums.TriggerType Specifies the behavior of the Pulse trigger. Default Value: TriggerType.NONE @@ -2262,9 +2328,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_trigger_type` - ''' + """ pulse_voltage_level = _attributes.AttributeViReal64(1150080) - '''Type: float + """Type: float Specifies the pulse current limit, in amps, that the output cannot exceed when generating the desired pulse voltage on the specified channel(s) during the on phase of a pulse. This property is applicable only if the output_function property is set to OutputFunction.PULSE_VOLTAGE. @@ -2281,9 +2347,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_voltage_level` - ''' + """ pulse_voltage_level_range = _attributes.AttributeViReal64(1150084) - '''Type: float + """Type: float Specifies the pulse voltage level range, in volts, for the specified channel(s). The range defines the valid values at which you can set the pulse voltage level and pulse bias voltage level. @@ -2301,9 +2367,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_voltage_level_range` - ''' + """ pulse_voltage_limit = _attributes.AttributeViReal64(1150087) - '''Type: float + """Type: float Specifies the pulse voltage limit, in volts, that the output cannot exceed when generating the desired pulse current on the specified channel(s) during the on phase of a pulse. This property is applicable only if the output_function property is set to OutputFunction.PULSE_CURRENT and the compliance_limit_symmetry property is set to ComplianceLimitSymmetry.SYMMETRIC. @@ -2320,9 +2386,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_voltage_limit` - ''' + """ pulse_voltage_limit_high = _attributes.AttributeViReal64(1150189) - '''Type: float + """Type: float Specifies the maximum voltage, in volts, that the output can produce when generating the desired pulse current on the specified channel(s) @@ -2367,9 +2433,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_voltage_limit_high` - ''' + """ pulse_voltage_limit_low = _attributes.AttributeViReal64(1150190) - '''Type: float + """Type: float Specifies the minimum voltage, in volts, that the output can produce when generating the desired pulse current on the specified channel(s) @@ -2414,9 +2480,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_voltage_limit_low` - ''' + """ pulse_voltage_limit_range = _attributes.AttributeViReal64(1150091) - '''Type: float + """Type: float Specifies the pulse voltage limit range, in volts, for the specified channel(s). The range defines the valid values to which you can set the pulse voltage limit and pulse bias voltage limit. @@ -2434,18 +2500,20 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_voltage_limit_range` - ''' + """ query_instrument_status = _attributes.AttributeViBoolean(1050003) - '''Type: bool + """Type: bool Specifies whether NI-DCPower queries the device status after each operation. Querying the device status is useful for debugging. After you validate your program, you can set this property to False to disable status checking and maximize performance. NI-DCPower ignores status checking for particular properties regardless of the setting of this property. Use the __init__ method to override this value. Default Value: True - ''' - ready_for_pulse_trigger_event_output_terminal = _attributes.AttributeViString(1150102) - '''Type: str + """ + ready_for_pulse_trigger_event_output_terminal = _attributes.AttributeViString( + 1150102 + ) + """Type: str Specifies the output terminal for exporting the Ready For Pulse Trigger event. Output terminals can be specified in one of two ways. If the device is named Dev1 and your terminal is PXI_Trig0, you can specify the terminal with the fully qualified terminal name, /Dev1/PXI_Trig0, or with the shortened terminal name, PXI_Trig0. @@ -2461,9 +2529,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.ready_for_pulse_trigger_event_output_terminal` - ''' - ready_for_pulse_trigger_event_pulse_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.Polarity, 1150103) - '''Type: enums.Polarity + """ + ready_for_pulse_trigger_event_pulse_polarity = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.Polarity, 1150103 + ) + """Type: enums.Polarity Specifies the behavior of the Ready For Pulse Trigger event. Default Value: Polarity.HIGH @@ -2479,9 +2549,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.ready_for_pulse_trigger_event_pulse_polarity` - ''' + """ ready_for_pulse_trigger_event_pulse_width = _attributes.AttributeViReal64(1150104) - '''Type: float + """Type: float Specifies the width of the Ready For Pulse Trigger event, in seconds. The minimum event pulse width value for PXI Express devices is 250 ns. @@ -2499,9 +2569,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.ready_for_pulse_trigger_event_pulse_width` - ''' + """ requested_power_allocation = _attributes.AttributeViReal64(1150206) - '''Type: float + """Type: float Specifies the power, in watts, to request the device to source from each active channel. This property defines the power to source from the device only if the power_allocation_mode property is set to PowerAllocationMode.MANUAL. @@ -2524,9 +2594,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.requested_power_allocation` - ''' + """ reset_average_before_measurement = _attributes.AttributeViBoolean(1150006) - '''Type: bool + """Type: bool Specifies whether the measurement returned from any measurement call starts with a new measurement call (True) or returns a measurement that has already begun or completed(False). for information about supported devices. @@ -2544,9 +2614,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.reset_average_before_measurement` - ''' + """ samples_to_average = _attributes.AttributeViInt32(1150003) - '''Type: int + """Type: int Specifies the number of samples to average when you take a measurement. Increasing the number of samples to average decreases measurement noise but increases the time required to take a measurement. Refer to the NI PXI-4110, NI PXI-4130, NI PXI-4132, or NI PXIe-4154 Averaging topic for optional property settings to improve immunity to certain noise types, or refer to the NI PXIe-4140/4141 DC Noise Rejection, NI PXIe-4142/4143 DC Noise Rejection, or NI PXIe-4144/4145 DC Noise Rejection topic for information about improving noise immunity for those devices. @@ -2569,9 +2639,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.samples_to_average` - ''' - self_calibration_persistence = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.SelfCalibrationPersistence, 1150073) - '''Type: enums.SelfCalibrationPersistence + """ + self_calibration_persistence = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.SelfCalibrationPersistence, 1150073 + ) + """Type: enums.SelfCalibrationPersistence Specifies whether the values calculated during self-calibration should be written to hardware to be used until the next self-calibration or only used until the reset_device method is called or the machine is powered down. This property affects the behavior of the self_cal method. When set to SelfCalibrationPersistence.KEEP_IN_MEMORY, the values calculated by the self_cal method are used in the existing session, as well as in all further sessions until you call the reset_device method or restart the machine. When you set this property to SelfCalibrationPersistence.WRITE_TO_EEPROM, the values calculated by the self_cal method are written to hardware and used in the existing session and in all subsequent sessions until another call to the self_cal method is made. @@ -2589,9 +2661,11 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.self_calibration_persistence` - ''' - sense = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.Sense, 1150013) - '''Type: enums.Sense + """ + sense = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.Sense, 1150013 + ) + """Type: enums.Sense Selects either local or remote sensing of the output voltage for the specified channel(s). Refer to the Local and Remote Sense topic in the NI DC Power Supplies and SMUs Help for more information about sensing voltage on supported channels and about devices that support local and/or remote sensing. @@ -2606,9 +2680,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sense` - ''' - sequence_advance_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerType, 1150026) - '''Type: enums.TriggerType + """ + sequence_advance_trigger_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TriggerType, 1150026 + ) + """Type: enums.TriggerType Specifies the behavior of the Sequence Advance trigger. for information about supported devices. @@ -2625,9 +2701,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sequence_advance_trigger_type` - ''' + """ sequence_engine_done_event_output_terminal = _attributes.AttributeViString(1150050) - '''Type: str + """Type: str Specifies the output terminal for exporting the Sequence Engine Done Complete event. for information about supported devices. @@ -2644,9 +2720,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sequence_engine_done_event_output_terminal` - ''' - sequence_engine_done_event_pulse_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.Polarity, 1150048) - '''Type: enums.Polarity + """ + sequence_engine_done_event_pulse_polarity = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.Polarity, 1150048 + ) + """Type: enums.Polarity Specifies the behavior of the Sequence Engine Done event. for information about supported devices. @@ -2663,9 +2741,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sequence_engine_done_event_pulse_polarity` - ''' + """ sequence_engine_done_event_pulse_width = _attributes.AttributeViReal64(1150049) - '''Type: float + """Type: float Specifies the width of the Sequence Engine Done event, in seconds. The minimum event pulse width value for PXI devices is 150 ns, and the minimum event pulse width value for PXI Express devices is 250 ns. @@ -2685,9 +2763,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sequence_engine_done_event_pulse_width` - ''' - sequence_iteration_complete_event_output_terminal = _attributes.AttributeViString(1150040) - '''Type: str + """ + sequence_iteration_complete_event_output_terminal = _attributes.AttributeViString( + 1150040 + ) + """Type: str Specifies the output terminal for exporting the Sequence Iteration Complete event. for information about supported devices. @@ -2704,9 +2784,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sequence_iteration_complete_event_output_terminal` - ''' - sequence_iteration_complete_event_pulse_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.Polarity, 1150038) - '''Type: enums.Polarity + """ + sequence_iteration_complete_event_pulse_polarity = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.Polarity, 1150038 + ) + """Type: enums.Polarity Specifies the behavior of the Sequence Iteration Complete event. for information about supported devices. @@ -2723,9 +2805,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sequence_iteration_complete_event_pulse_polarity` - ''' - sequence_iteration_complete_event_pulse_width = _attributes.AttributeViReal64(1150039) - '''Type: float + """ + sequence_iteration_complete_event_pulse_width = _attributes.AttributeViReal64( + 1150039 + ) + """Type: float Specifies the width of the Sequence Iteration Complete event, in seconds. The minimum event pulse width value for PXI devices is 150 ns, and the minimum event pulse width value for PXI Express devices is 250 ns. @@ -2745,9 +2829,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sequence_iteration_complete_event_pulse_width` - ''' + """ sequence_loop_count = _attributes.AttributeViInt32(1150025) - '''Type: int + """Type: int Specifies the number of times a sequence is run after initiation. Refer to the Sequence Source Mode topic in the NI DC Power Supplies and SMUs Help for more information about the sequence loop count. @@ -2766,9 +2850,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sequence_loop_count` - ''' + """ sequence_loop_count_is_finite = _attributes.AttributeViBoolean(1150078) - '''Type: bool + """Type: bool Specifies whether a sequence should repeat indefinitely. Refer to the Sequence Source Mode topic in the NI DC Power Supplies and SMUs Help for more information about infinite sequencing. @@ -2786,9 +2870,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sequence_loop_count_is_finite` - ''' + """ sequence_step_delta_time = _attributes.AttributeViReal64(1150198) - '''Type: float + """Type: float Tip: This property can be set/get on specific channels within your :py:class:`nidcpower.Session` instance. @@ -2799,9 +2883,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sequence_step_delta_time` - ''' + """ sequence_step_delta_time_enabled = _attributes.AttributeViBoolean(1150199) - '''Type: bool + """Type: bool Tip: This property can be set/get on specific channels within your :py:class:`nidcpower.Session` instance. @@ -2812,9 +2896,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sequence_step_delta_time_enabled` - ''' + """ serial_number = _attributes.AttributeViString(1150152) - '''Type: str + """Type: str Contains the serial number for the device you are currently using. @@ -2827,9 +2911,11 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.serial_number` - ''' - shutdown_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerType, 1150275) - '''Type: enums.TriggerType + """ + shutdown_trigger_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TriggerType, 1150275 + ) + """Type: enums.TriggerType Specifies the behavior of the Shutdown trigger. Default Value: TriggerType.NONE @@ -2845,15 +2931,15 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.shutdown_trigger_type` - ''' + """ simulate = _attributes.AttributeViBoolean(1050005) - '''Type: bool + """Type: bool Specifies whether to simulate NI-DCPower I/O operations. True specifies that operation is simulated. Default Value: False - ''' + """ source_complete_event_output_terminal = _attributes.AttributeViString(1150043) - '''Type: str + """Type: str Specifies the output terminal for exporting the Source Complete event. for information about supported devices. @@ -2870,9 +2956,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.source_complete_event_output_terminal` - ''' - source_complete_event_pulse_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.Polarity, 1150041) - '''Type: enums.Polarity + """ + source_complete_event_pulse_polarity = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.Polarity, 1150041 + ) + """Type: enums.Polarity Specifies the behavior of the Source Complete event. for information about supported devices. @@ -2889,9 +2977,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.source_complete_event_pulse_polarity` - ''' + """ source_complete_event_pulse_width = _attributes.AttributeViReal64(1150042) - '''Type: float + """Type: float Specifies the width of the Source Complete event, in seconds. for information about supported devices. @@ -2911,9 +2999,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.source_complete_event_pulse_width` - ''' + """ source_delay = _attributes.AttributeViReal64TimeDeltaSeconds(1150051) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """Type: hightime.timedelta, datetime.timedelta, or float in seconds Determines when, in seconds, the device generates the Source Complete event, potentially starting a measurement if the measure_when property is set to MeasureWhen.AUTOMATICALLY_AFTER_SOURCE_COMPLETE. Refer to the Single Point Source Mode and Sequence Source Mode topics for more information. @@ -2932,9 +3020,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.source_delay` - ''' - source_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.SourceMode, 1150054) - '''Type: enums.SourceMode + """ + source_mode = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.SourceMode, 1150054 + ) + """Type: enums.SourceMode Specifies whether to run a single output point or a sequence. Refer to the Single Point Source Mode and Sequence Source Mode topics in the NI DC Power Supplies and SMUs Help for more information about source modes. Default value: SourceMode.SINGLE_POINT @@ -2948,9 +3038,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.source_mode` - ''' - source_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerType, 1150030) - '''Type: enums.TriggerType + """ + source_trigger_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TriggerType, 1150030 + ) + """Type: enums.TriggerType Specifies the behavior of the Source trigger. for information about supported devices. @@ -2967,29 +3059,31 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.source_trigger_type` - ''' + """ specific_driver_description = _attributes.AttributeViString(1050514) - '''Type: str + """Type: str Contains a brief description of the specific driver. - ''' + """ specific_driver_prefix = _attributes.AttributeViString(1050302) - '''Type: str + """Type: str Contains the prefix for NI-DCPower. The name of each user-callable method in NI-DCPower begins with this prefix. - ''' + """ specific_driver_revision = _attributes.AttributeViString(1050551) - '''Type: str + """Type: str Contains additional version information about NI-DCPower. - ''' + """ specific_driver_vendor = _attributes.AttributeViString(1050513) - '''Type: str + """Type: str Contains the name of the vendor that supplies NI-DCPower. - ''' - start_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerType, 1150021) - '''Type: enums.TriggerType + """ + start_trigger_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TriggerType, 1150021 + ) + """Type: enums.TriggerType Specifies the behavior of the Start trigger. for information about supported devices. @@ -3006,14 +3100,16 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.start_trigger_type` - ''' + """ supported_instrument_models = _attributes.AttributeViString(1050327) - '''Type: str + """Type: str Contains a comma-separated (,) list of supported NI-DCPower device models. - ''' - transient_response = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TransientResponse, 1150062) - '''Type: enums.TransientResponse + """ + transient_response = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TransientResponse, 1150062 + ) + """Type: enums.TransientResponse Specifies the transient response. Refer to the Transient Response topic in the NI DC Power Supplies and SMUs Help for more information about transient response. for information about supported devices. @@ -3030,9 +3126,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.transient_response` - ''' + """ voltage_compensation_frequency = _attributes.AttributeViReal64(1150068) - '''Type: float + """Type: float The frequency at which a pole-zero pair is added to the system when the channel is in Constant Voltage mode. for information about supported devices. @@ -3049,9 +3145,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.voltage_compensation_frequency` - ''' + """ voltage_gain_bandwidth = _attributes.AttributeViReal64(1150067) - '''Type: float + """Type: float The frequency at which the unloaded loop gain extrapolates to 0 dB in the absence of additional poles and zeroes. This property takes effect when the channel is in Constant Voltage mode. for information about supported devices. @@ -3068,9 +3164,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.voltage_gain_bandwidth` - ''' + """ voltage_level = _attributes.AttributeViReal64(1250001) - '''Type: float + """Type: float Specifies the voltage level, in volts, that the device attempts to generate on the specified channel(s). This property is applicable only if the output_function property is set to OutputFunction.DC_VOLTAGE. @@ -3088,9 +3184,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.voltage_level` - ''' + """ voltage_level_autorange = _attributes.AttributeViInt32(1150015) - '''Type: bool + """Type: bool Specifies whether NI-DCPower automatically selects the voltage level range based on the desired voltage level for the specified channel(s). If you set this property to AutoZero.ON, NI-DCPower ignores any changes you make to the voltage_level_range property. If you change the voltage_level_autorange property from AutoZero.ON to AutoZero.OFF, NI-DCPower retains the last value the voltage_level_range property was set to (or the default value if the property was never set) and uses that value as the voltage level range. @@ -3107,9 +3203,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.voltage_level_autorange` - ''' + """ voltage_level_range = _attributes.AttributeViReal64(1150005) - '''Type: float + """Type: float Specifies the voltage level range, in volts, for the specified channel(s). The range defines the valid values to which the voltage level can be set. Use the voltage_level_autorange property to enable automatic selection of the voltage level range. @@ -3128,9 +3224,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.voltage_level_range` - ''' + """ voltage_limit = _attributes.AttributeViReal64(1150010) - '''Type: float + """Type: float Specifies the voltage limit, in volts, that the output cannot exceed when generating the desired current level on the specified channels. This property is applicable only if the output_function property is set to OutputFunction.DC_CURRENT and the compliance_limit_symmetry property is set to ComplianceLimitSymmetry.SYMMETRIC. @@ -3148,9 +3244,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.voltage_limit` - ''' + """ voltage_limit_autorange = _attributes.AttributeViInt32(1150018) - '''Type: bool + """Type: bool Specifies whether NI-DCPower automatically selects the voltage limit range based on the desired voltage limit for the specified channel(s). If this property is set to AutoZero.ON, NI-DCPower ignores any changes you make to the voltage_limit_range property. If you change the voltage_limit_autorange property from AutoZero.ON to AutoZero.OFF, NI-DCPower retains the last value the voltage_limit_range property was set to (or the default value if the property was never set) and uses that value as the voltage limit range. @@ -3167,9 +3263,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.voltage_limit_autorange` - ''' + """ voltage_limit_high = _attributes.AttributeViReal64(1150185) - '''Type: float + """Type: float Specifies the maximum voltage, in volts, that the output can produce when generating the desired current on the specified channel(s). @@ -3211,9 +3307,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.voltage_limit_high` - ''' + """ voltage_limit_low = _attributes.AttributeViReal64(1150186) - '''Type: float + """Type: float Specifies the minimum voltage, in volts, that the output can produce when generating the desired current on the specified channel(s). @@ -3255,9 +3351,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.voltage_limit_low` - ''' + """ voltage_limit_range = _attributes.AttributeViReal64(1150012) - '''Type: float + """Type: float Specifies the voltage limit range, in volts, for the specified channel(s). The range defines the valid values to which the voltage limit can be set. Use the voltage_limit_autorange property to enable automatic selection of the voltage limit range. @@ -3276,9 +3372,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.voltage_limit_range` - ''' + """ voltage_pole_zero_ratio = _attributes.AttributeViReal64(1150069) - '''Type: float + """Type: float The ratio of the pole frequency to the zero frequency when the channel is in Constant Voltage mode. for information about supported devices. @@ -3295,42 +3391,50 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.voltage_pole_zero_ratio` - ''' + """ - def __init__(self, repeated_capability_list, vi, library, encoding, freeze_it=False): + def __init__( + self, repeated_capability_list, vi, library, encoding, freeze_it=False + ): self._repeated_capability_list = repeated_capability_list - self._repeated_capability = ','.join(repeated_capability_list) + self._repeated_capability = ",".join(repeated_capability_list) self._vi = vi self._library = library self._encoding = encoding # Store the parameter list for later printing in __repr__ param_list = [] - param_list.append("repeated_capability_list=" + pp.pformat(repeated_capability_list)) + param_list.append( + "repeated_capability_list=" + pp.pformat(repeated_capability_list) + ) param_list.append("vi=" + pp.pformat(vi)) param_list.append("library=" + pp.pformat(library)) param_list.append("encoding=" + pp.pformat(encoding)) - self._param_list = ', '.join(param_list) + self._param_list = ", ".join(param_list) # Instantiate any repeated capability objects - self.channels = _RepeatedCapabilities(self, '', repeated_capability_list) - self.instruments = _RepeatedCapabilities(self, '', repeated_capability_list) + self.channels = _RepeatedCapabilities(self, "", repeated_capability_list) + self.instruments = _RepeatedCapabilities(self, "", repeated_capability_list) self._is_frozen = freeze_it def __repr__(self): - return '{0}.{1}({2})'.format('nidcpower', self.__class__.__name__, self._param_list) + return "{0}.{1}({2})".format( + "nidcpower", self.__class__.__name__, self._param_list + ) def __setattr__(self, key, value): if self._is_frozen and key not in dir(self): - raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) + raise AttributeError( + "'{0}' object has no attribute '{1}'".format(type(self).__name__, key) + ) object.__setattr__(self, key, value) def _get_error_description(self, error_code): - '''_get_error_description + """_get_error_description Returns the error description. - ''' + """ try: _, error_string = self._get_error() return error_string @@ -3338,18 +3442,18 @@ def _get_error_description(self, error_code): pass try: - ''' + """ It is expected for _get_error to raise when the session is invalid (IVI spec requires GetError to fail). Use _error_message instead. It doesn't require a session. - ''' + """ error_string = self._error_message(error_code) return error_string except errors.Error: return "Failed to retrieve error description." def initiate(self): - '''initiate + """initiate Starts generation or acquisition, causing the specified channel(s) to leave the Uncommitted state or Committed state and enter the Running @@ -3377,14 +3481,14 @@ def initiate(self): To call the method on all channels, you can call it directly on the :py:class:`nidcpower.Session`. Example: :py:meth:`my_session.initiate` - ''' + """ return _Acquisition(self) - ''' These are code-generated ''' + """ These are code-generated """ @ivi_synchronized def abort(self): - r'''abort + r"""abort Transitions the specified channel(s) from the Running state to the Uncommitted state. If a sequence is running, it is stopped. Any @@ -3420,16 +3524,22 @@ def abort(self): To call the method on all channels, you can call it directly on the :py:class:`nidcpower.Session`. Example: :py:meth:`my_session.abort` - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - error_code = self._library.niDCPower_AbortWithChannels(vi_ctype, channel_name_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + error_code = self._library.niDCPower_AbortWithChannels( + vi_ctype, channel_name_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def self_cal(self): - r'''self_cal + r"""self_cal Performs a self-calibration upon the specified channel(s). @@ -3469,16 +3579,22 @@ def self_cal(self): To call the method on all channels, you can call it directly on the :py:class:`nidcpower.Session`. Example: :py:meth:`my_session.self_cal` - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - error_code = self._library.niDCPower_CalSelfCalibrate(vi_ctype, channel_name_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + error_code = self._library.niDCPower_CalSelfCalibrate( + vi_ctype, channel_name_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def clear_latched_output_cutoff_state(self, output_cutoff_reason): - r'''clear_latched_output_cutoff_state + r"""clear_latched_output_cutoff_state Clears the state of an output cutoff that was engaged. To clear the state for all output cutoff reasons, use OutputCutoffReason.ALL. @@ -3517,19 +3633,30 @@ def clear_latched_output_cutoff_state(self, output_cutoff_reason): | OutputCutoffReason.CURRENT_CHANGE_LOW | Clears cutoffs caused when the voltage slew rate decreased beyond the negative change cutoff for current output | +-----------------------------------------+-----------------------------------------------------------------------------------------------------------------+ - ''' + """ if type(output_cutoff_reason) is not enums.OutputCutoffReason: - raise TypeError('Parameter output_cutoff_reason must be of type ' + str(enums.OutputCutoffReason)) + raise TypeError( + "Parameter output_cutoff_reason must be of type " + + str(enums.OutputCutoffReason) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - output_cutoff_reason_ctype = _visatype.ViInt32(output_cutoff_reason.value) # case S130 - error_code = self._library.niDCPower_ClearLatchedOutputCutoffState(vi_ctype, channel_name_ctype, output_cutoff_reason_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + output_cutoff_reason_ctype = _visatype.ViInt32( + output_cutoff_reason.value + ) # case S130 + error_code = self._library.niDCPower_ClearLatchedOutputCutoffState( + vi_ctype, channel_name_ctype, output_cutoff_reason_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def commit(self): - r'''commit + r"""commit Applies previously configured settings to the specified channel(s). Calling this method moves the NI-DCPower session from the Uncommitted state into @@ -3556,16 +3683,24 @@ def commit(self): To call the method on all channels, you can call it directly on the :py:class:`nidcpower.Session`. Example: :py:meth:`my_session.commit` - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - error_code = self._library.niDCPower_CommitWithChannels(vi_ctype, channel_name_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + error_code = self._library.niDCPower_CommitWithChannels( + vi_ctype, channel_name_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def configure_aperture_time(self, aperture_time, units=enums.ApertureTimeUnits.SECONDS): - r'''configure_aperture_time + def configure_aperture_time( + self, aperture_time, units=enums.ApertureTimeUnits.SECONDS + ): + r"""configure_aperture_time Configures the aperture time on the specified channel(s). @@ -3613,20 +3748,28 @@ def configure_aperture_time(self, aperture_time, units=enums.ApertureTimeUnits.S | ApertureTimeUnits.POWER_LINE_CYCLES | Specifies Power Line Cycles. | +-------------------------------------+------------------------------+ - ''' + """ if type(units) is not enums.ApertureTimeUnits: - raise TypeError('Parameter units must be of type ' + str(enums.ApertureTimeUnits)) + raise TypeError( + "Parameter units must be of type " + str(enums.ApertureTimeUnits) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 aperture_time_ctype = _visatype.ViReal64(aperture_time) # case S150 units_ctype = _visatype.ViInt32(units.value) # case S130 - error_code = self._library.niDCPower_ConfigureApertureTime(vi_ctype, channel_name_ctype, aperture_time_ctype, units_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_ConfigureApertureTime( + vi_ctype, channel_name_ctype, aperture_time_ctype, units_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def create_advanced_sequence_commit_step(self, set_as_active_step=True): - r'''create_advanced_sequence_commit_step + r"""create_advanced_sequence_commit_step Creates a Commit step in the Active advanced sequence. A Commit step configures channels to a user-defined known state before starting the advanced sequence. @@ -3673,17 +3816,25 @@ def create_advanced_sequence_commit_step(self, set_as_active_step=True): Args: set_as_active_step (bool): Specifies whether the step created with this method is active in the Active advanced sequence. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 set_as_active_step_ctype = _visatype.ViBoolean(set_as_active_step) # case S150 - error_code = self._library.niDCPower_CreateAdvancedSequenceCommitStepWithChannels(vi_ctype, channel_name_ctype, set_as_active_step_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = ( + self._library.niDCPower_CreateAdvancedSequenceCommitStepWithChannels( + vi_ctype, channel_name_ctype, set_as_active_step_ctype + ) + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def create_advanced_sequence_step(self, set_as_active_step=True): - r'''create_advanced_sequence_step + r"""create_advanced_sequence_step Creates a new advanced sequence step in the advanced sequence specified by the Active advanced sequence. When you create an advanced sequence @@ -3728,17 +3879,25 @@ def create_advanced_sequence_step(self, set_as_active_step=True): Args: set_as_active_step (bool): Specifies whether the step created with this method is active in the Active advanced sequence. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 set_as_active_step_ctype = _visatype.ViBoolean(set_as_active_step) # case S150 - error_code = self._library.niDCPower_CreateAdvancedSequenceStepWithChannels(vi_ctype, channel_name_ctype, set_as_active_step_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_CreateAdvancedSequenceStepWithChannels( + vi_ctype, channel_name_ctype, set_as_active_step_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def _create_advanced_sequence_with_channels(self, sequence_name, attribute_ids, set_as_active_sequence): - r'''_create_advanced_sequence_with_channels + def _create_advanced_sequence_with_channels( + self, sequence_name, attribute_ids, set_as_active_sequence + ): + r"""_create_advanced_sequence_with_channels Creates an empty advanced sequence. Call the create_advanced_sequence_step method to add steps to the @@ -3906,20 +4065,39 @@ def _create_advanced_sequence_with_channels(self, sequence_name, attribute_ids, set_as_active_sequence (bool): Specifies that this current sequence is active. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - sequence_name_ctype = ctypes.create_string_buffer(sequence_name.encode(self._encoding)) # case C020 - attribute_id_count_ctype = _visatype.ViInt32(0 if attribute_ids is None else len(attribute_ids)) # case S160 - attribute_ids_ctype = get_ctypes_pointer_for_buffer(value=attribute_ids, library_type=_visatype.ViInt32) # case B550 - set_as_active_sequence_ctype = _visatype.ViBoolean(set_as_active_sequence) # case S150 - error_code = self._library.niDCPower_CreateAdvancedSequenceWithChannels(vi_ctype, channel_name_ctype, sequence_name_ctype, attribute_id_count_ctype, attribute_ids_ctype, set_as_active_sequence_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + sequence_name_ctype = ctypes.create_string_buffer( + sequence_name.encode(self._encoding) + ) # case C020 + attribute_id_count_ctype = _visatype.ViInt32( + 0 if attribute_ids is None else len(attribute_ids) + ) # case S160 + attribute_ids_ctype = get_ctypes_pointer_for_buffer( + value=attribute_ids, library_type=_visatype.ViInt32 + ) # case B550 + set_as_active_sequence_ctype = _visatype.ViBoolean( + set_as_active_sequence + ) # case S150 + error_code = self._library.niDCPower_CreateAdvancedSequenceWithChannels( + vi_ctype, + channel_name_ctype, + sequence_name_ctype, + attribute_id_count_ctype, + attribute_ids_ctype, + set_as_active_sequence_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def delete_advanced_sequence(self, sequence_name): - r'''delete_advanced_sequence + r"""delete_advanced_sequence Deletes a previously created advanced sequence and all the advanced sequence steps in the advanced sequence. @@ -3959,17 +4137,27 @@ def delete_advanced_sequence(self, sequence_name): Args: sequence_name (str): specifies the name of the sequence to delete. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - sequence_name_ctype = ctypes.create_string_buffer(sequence_name.encode(self._encoding)) # case C020 - error_code = self._library.niDCPower_DeleteAdvancedSequenceWithChannels(vi_ctype, channel_name_ctype, sequence_name_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + sequence_name_ctype = ctypes.create_string_buffer( + sequence_name.encode(self._encoding) + ) # case C020 + error_code = self._library.niDCPower_DeleteAdvancedSequenceWithChannels( + vi_ctype, channel_name_ctype, sequence_name_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def create_advanced_sequence(self, sequence_name, property_names, set_as_active_sequence=True): - '''create_advanced_sequence + def create_advanced_sequence( + self, sequence_name, property_names, set_as_active_sequence=True + ): + """create_advanced_sequence Creates an empty advanced sequence. Call the create_advanced_sequence_step method to add steps to the @@ -4132,23 +4320,35 @@ def create_advanced_sequence(self, sequence_name, property_names, set_as_active_ set_as_active_sequence (bool): Specifies that this current sequence is active. - ''' + """ # The way the NI-DCPower C API is designed, we need to know all the attribute ID's upfront in order to call # `niDCPower_CreateAdvancedSequence`. In order to find the attribute ID of each property, we look at the # member Attribute objects of Session. We use a set since we don't have to worry about is it already there. attribute_ids_used = set() for prop in property_names: if prop not in Session.__base__.__dict__: - raise KeyError('{0} is not an property on the nidcpower.Session'.format(prop)) - if not isinstance(Session.__base__.__dict__[prop], _attributes.Attribute) and not isinstance(Session.__base__.__dict__[prop], _attributes.AttributeEnum): - raise TypeError('{0} is not a valid property: {1}'.format(prop, type(Session.__base__.__dict__[prop]))) + raise KeyError( + "{0} is not an property on the nidcpower.Session".format(prop) + ) + if not isinstance( + Session.__base__.__dict__[prop], _attributes.Attribute + ) and not isinstance( + Session.__base__.__dict__[prop], _attributes.AttributeEnum + ): + raise TypeError( + "{0} is not a valid property: {1}".format( + prop, type(Session.__base__.__dict__[prop]) + ) + ) attribute_ids_used.add(Session.__base__.__dict__[prop]._attribute_id) - self._create_advanced_sequence_with_channels(sequence_name, list(attribute_ids_used), set_as_active_sequence) + self._create_advanced_sequence_with_channels( + sequence_name, list(attribute_ids_used), set_as_active_sequence + ) @ivi_synchronized def fetch_multiple(self, count, timeout=hightime.timedelta(seconds=1.0)): - '''fetch_multiple + """fetch_multiple Returns a list of named tuples (Measurement) that were previously taken and are stored in the NI-DCPower buffer. This method @@ -4190,17 +4390,31 @@ def fetch_multiple(self, count, timeout=hightime.timedelta(seconds=1.0)): - **current** (float) - **in_compliance** (bool) - ''' + """ import collections - Measurement = collections.namedtuple('Measurement', ['voltage', 'current', 'in_compliance']) - - voltage_measurements, current_measurements, in_compliance = self._fetch_multiple(timeout, count) - return [Measurement(voltage=voltage_measurements[i], current=current_measurements[i], in_compliance=in_compliance[i]) for i in range(count)] + Measurement = collections.namedtuple( + "Measurement", ["voltage", "current", "in_compliance"] + ) + + ( + voltage_measurements, + current_measurements, + in_compliance, + ) = self._fetch_multiple(timeout, count) + + return [ + Measurement( + voltage=voltage_measurements[i], + current=current_measurements[i], + in_compliance=in_compliance[i], + ) + for i in range(count) + ] @ivi_synchronized def measure_multiple(self): - '''measure_multiple + """measure_multiple Returns a list of named tuples (Measurement) containing the measured voltage and current values on the specified output channel(s). Each call to this method @@ -4234,17 +4448,27 @@ def measure_multiple(self): - **current** (float) - **in_compliance** (bool) - Always None - ''' + """ import collections - Measurement = collections.namedtuple('Measurement', ['voltage', 'current', 'in_compliance']) + + Measurement = collections.namedtuple( + "Measurement", ["voltage", "current", "in_compliance"] + ) voltage_measurements, current_measurements = self._measure_multiple() - return [Measurement(voltage=voltage_measurements[i], current=current_measurements[i], in_compliance=None) for i in range(self._parse_channel_count())] + return [ + Measurement( + voltage=voltage_measurements[i], + current=current_measurements[i], + in_compliance=None, + ) + for i in range(self._parse_channel_count()) + ] @ivi_synchronized def _fetch_multiple(self, timeout, count): - r'''_fetch_multiple + r"""_fetch_multiple Returns an array of voltage measurements, an array of current measurements, and an array of compliance measurements that were @@ -4303,27 +4527,58 @@ def _fetch_multiple(self, timeout, count): actual_count (int): Indicates the number of measured values actually retrieved from the device. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64( + timeout + ) # case S140 count_ctype = _visatype.ViInt32(count) # case S210 voltage_measurements_size = count # case B600 - voltage_measurements_array = array.array("d", [0] * voltage_measurements_size) # case B600 - voltage_measurements_ctype = get_ctypes_pointer_for_buffer(value=voltage_measurements_array, library_type=_visatype.ViReal64) # case B600 + voltage_measurements_array = array.array( + "d", [0] * voltage_measurements_size + ) # case B600 + voltage_measurements_ctype = get_ctypes_pointer_for_buffer( + value=voltage_measurements_array, library_type=_visatype.ViReal64 + ) # case B600 current_measurements_size = count # case B600 - current_measurements_array = array.array("d", [0] * current_measurements_size) # case B600 - current_measurements_ctype = get_ctypes_pointer_for_buffer(value=current_measurements_array, library_type=_visatype.ViReal64) # case B600 + current_measurements_array = array.array( + "d", [0] * current_measurements_size + ) # case B600 + current_measurements_ctype = get_ctypes_pointer_for_buffer( + value=current_measurements_array, library_type=_visatype.ViReal64 + ) # case B600 in_compliance_size = count # case B600 - in_compliance_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViBoolean, size=in_compliance_size) # case B600 + in_compliance_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViBoolean, size=in_compliance_size + ) # case B600 actual_count_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDCPower_FetchMultiple(vi_ctype, channel_name_ctype, timeout_ctype, count_ctype, voltage_measurements_ctype, current_measurements_ctype, in_compliance_ctype, None if actual_count_ctype is None else (ctypes.pointer(actual_count_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return voltage_measurements_array, current_measurements_array, [bool(in_compliance_ctype[i]) for i in range(count_ctype.value)] + error_code = self._library.niDCPower_FetchMultiple( + vi_ctype, + channel_name_ctype, + timeout_ctype, + count_ctype, + voltage_measurements_ctype, + current_measurements_ctype, + in_compliance_ctype, + None + if actual_count_ctype is None + else (ctypes.pointer(actual_count_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return ( + voltage_measurements_array, + current_measurements_array, + [bool(in_compliance_ctype[i]) for i in range(count_ctype.value)], + ) @ivi_synchronized def _get_attribute_vi_boolean(self, attribute_id): - r'''_get_attribute_vi_boolean + r"""_get_attribute_vi_boolean | Queries the value of a ViBoolean property. | You can use this method to get the values of device-specific @@ -4370,18 +4625,29 @@ def _get_attribute_vi_boolean(self, attribute_id): pressing **Enter** on this control. Select a value by double-clicking on it or by selecting it and then pressing **Enter**. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niDCPower_GetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_GetAttributeViBoolean( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + None + if attribute_value_ctype is None + else (ctypes.pointer(attribute_value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return bool(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_int32(self, attribute_id): - r'''_get_attribute_vi_int32 + r"""_get_attribute_vi_int32 | Queries the value of a ViInt32 property. | You can use this method to get the values of device-specific @@ -4428,18 +4694,29 @@ def _get_attribute_vi_int32(self, attribute_id): pressing **Enter** on this control. Select a value by double-clicking on it or by selecting it and then pressing **Enter**. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDCPower_GetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_GetAttributeViInt32( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + None + if attribute_value_ctype is None + else (ctypes.pointer(attribute_value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_int64(self, attribute_id): - r'''_get_attribute_vi_int64 + r"""_get_attribute_vi_int64 | Queries the value of a ViInt64 property. | You can use this method to get the values of device-specific @@ -4486,18 +4763,29 @@ def _get_attribute_vi_int64(self, attribute_id): pressing **Enter** on this control. Select a value by double-clicking on it or by selecting it and then pressing **Enter**. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt64() # case S220 - error_code = self._library.niDCPower_GetAttributeViInt64(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_GetAttributeViInt64( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + None + if attribute_value_ctype is None + else (ctypes.pointer(attribute_value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_real64(self, attribute_id): - r'''_get_attribute_vi_real64 + r"""_get_attribute_vi_real64 | Queries the value of a ViReal64 property. | You can use this method to get the values of device-specific @@ -4544,18 +4832,29 @@ def _get_attribute_vi_real64(self, attribute_id): pressing **Enter** on this control. Select a value by double-clicking on it or by selecting it and then pressing **Enter**. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDCPower_GetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_GetAttributeViReal64( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + None + if attribute_value_ctype is None + else (ctypes.pointer(attribute_value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_string(self, attribute_id): - r'''_get_attribute_vi_string + r"""_get_attribute_vi_string | Queries the value of a ViString property. | You can use this method to get the values of device-specific @@ -4612,22 +4911,42 @@ def _get_attribute_vi_string(self, attribute_id): pressing on this control. Select a value by double-clicking on it or by selecting it and then pressing . - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 buffer_size_ctype = _visatype.ViInt32() # case S170 attribute_value_ctype = None # case C050 - error_code = self._library.niDCPower_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, buffer_size_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niDCPower_GetAttributeViString( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + buffer_size_ctype, + attribute_value_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - attribute_value_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niDCPower_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, buffer_size_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + attribute_value_ctype = ( + _visatype.ViChar * buffer_size_ctype.value + )() # case C060 + error_code = self._library.niDCPower_GetAttributeViString( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + buffer_size_ctype, + attribute_value_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return attribute_value_ctype.value.decode(self._encoding) def _get_error(self): - r'''_get_error + r"""_get_error | Retrieves and then clears the IVI error information for the session or the current execution thread unless **bufferSize** is 0, in which case @@ -4663,22 +4982,36 @@ def _get_error(self): If you pass 0 for **bufferSize**, you can pass VI_NULL for this property. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 code_ctype = _visatype.ViStatus() # case S220 buffer_size_ctype = _visatype.ViInt32() # case S170 description_ctype = None # case C050 - error_code = self._library.niDCPower_GetError(vi_ctype, None if code_ctype is None else (ctypes.pointer(code_ctype)), buffer_size_ctype, description_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True) + error_code = self._library.niDCPower_GetError( + vi_ctype, + None if code_ctype is None else (ctypes.pointer(code_ctype)), + buffer_size_ctype, + description_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=True + ) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 description_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niDCPower_GetError(vi_ctype, None if code_ctype is None else (ctypes.pointer(code_ctype)), buffer_size_ctype, description_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + error_code = self._library.niDCPower_GetError( + vi_ctype, + None if code_ctype is None else (ctypes.pointer(code_ctype)), + buffer_size_ctype, + description_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return int(code_ctype.value), description_ctype.value.decode(self._encoding) @ivi_synchronized def _initiate_with_channels(self): - r'''_initiate_with_channels + r"""_initiate_with_channels Starts generation or acquisition, causing the specified channel(s) to leave the Uncommitted state or Committed state and enter the Running @@ -4703,15 +5036,21 @@ def _initiate_with_channels(self): To call the method on all channels, you can call it directly on the :py:class:`nidcpower.Session`. Example: :py:meth:`my_session._initiate_with_channels` - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - error_code = self._library.niDCPower_InitiateWithChannels(vi_ctype, channel_name_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + error_code = self._library.niDCPower_InitiateWithChannels( + vi_ctype, channel_name_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def lock(self): - '''lock + """lock Obtains a multithread lock on the device session. Before doing so, the software waits until all other execution threads release their locks @@ -4739,25 +5078,27 @@ def lock(self): Returns: lock (context manager): When used in a with statement, nidcpower.Session.lock acts as a context manager and unlock will be called when the with block is exited - ''' + """ self._lock_session() # We do not call _lock_session() in the context manager so that this function can # act standalone as well and let the client call unlock() explicitly. If they do use the context manager, # that will handle the unlock for them return _Lock(self) def _lock_session(self): - '''_lock_session + """_lock_session Actual call to driver - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDCPower_LockSession(vi_ctype, None) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return @ivi_synchronized def measure(self, measurement_type): - r'''measure + r"""measure Returns the measured value of either the voltage or current on the specified output channel. Each call to this method blocks other @@ -4791,20 +5132,32 @@ def measure(self, measurement_type): measurement (float): Returns the value of the measurement, either in volts for voltage or amps for current. - ''' + """ if type(measurement_type) is not enums.MeasurementTypes: - raise TypeError('Parameter measurement_type must be of type ' + str(enums.MeasurementTypes)) + raise TypeError( + "Parameter measurement_type must be of type " + + str(enums.MeasurementTypes) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 measurement_type_ctype = _visatype.ViInt32(measurement_type.value) # case S130 measurement_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDCPower_Measure(vi_ctype, channel_name_ctype, measurement_type_ctype, None if measurement_ctype is None else (ctypes.pointer(measurement_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_Measure( + vi_ctype, + channel_name_ctype, + measurement_type_ctype, + None if measurement_ctype is None else (ctypes.pointer(measurement_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(measurement_ctype.value) @ivi_synchronized def _measure_multiple(self): - r'''_measure_multiple + r"""_measure_multiple Returns arrays of the measured voltage and current values on the specified output channel(s). Each call to this method blocks other @@ -4834,22 +5187,39 @@ def _measure_multiple(self): **channelName**. Ensure that sufficient space has been allocated for the returned array. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 voltage_measurements_size = self._parse_channel_count() # case B560 - voltage_measurements_array = array.array("d", [0] * voltage_measurements_size) # case B560 - voltage_measurements_ctype = get_ctypes_pointer_for_buffer(value=voltage_measurements_array, library_type=_visatype.ViReal64) # case B560 + voltage_measurements_array = array.array( + "d", [0] * voltage_measurements_size + ) # case B560 + voltage_measurements_ctype = get_ctypes_pointer_for_buffer( + value=voltage_measurements_array, library_type=_visatype.ViReal64 + ) # case B560 current_measurements_size = self._parse_channel_count() # case B560 - current_measurements_array = array.array("d", [0] * current_measurements_size) # case B560 - current_measurements_ctype = get_ctypes_pointer_for_buffer(value=current_measurements_array, library_type=_visatype.ViReal64) # case B560 - error_code = self._library.niDCPower_MeasureMultiple(vi_ctype, channel_name_ctype, voltage_measurements_ctype, current_measurements_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + current_measurements_array = array.array( + "d", [0] * current_measurements_size + ) # case B560 + current_measurements_ctype = get_ctypes_pointer_for_buffer( + value=current_measurements_array, library_type=_visatype.ViReal64 + ) # case B560 + error_code = self._library.niDCPower_MeasureMultiple( + vi_ctype, + channel_name_ctype, + voltage_measurements_ctype, + current_measurements_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return voltage_measurements_array, current_measurements_array @ivi_synchronized def _parse_channel_count(self): - r'''_parse_channel_count + r"""_parse_channel_count Returns the number of channels. @@ -4867,17 +5237,27 @@ def _parse_channel_count(self): Returns: number_of_channels (int): - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channels_string_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channels_string_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 number_of_channels_ctype = _visatype.ViUInt32() # case S220 - error_code = self._library.niDCPower_ParseChannelCount(vi_ctype, channels_string_ctype, None if number_of_channels_ctype is None else (ctypes.pointer(number_of_channels_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_ParseChannelCount( + vi_ctype, + channels_string_ctype, + None + if number_of_channels_ctype is None + else (ctypes.pointer(number_of_channels_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(number_of_channels_ctype.value) @ivi_synchronized def query_in_compliance(self): - r'''query_in_compliance + r"""query_in_compliance Queries the specified output device to determine if it is operating at the `compliance `__ limit. @@ -4917,17 +5297,27 @@ def query_in_compliance(self): Returns: in_compliance (bool): Returns whether the device output channel is in compliance. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 in_compliance_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niDCPower_QueryInCompliance(vi_ctype, channel_name_ctype, None if in_compliance_ctype is None else (ctypes.pointer(in_compliance_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_QueryInCompliance( + vi_ctype, + channel_name_ctype, + None + if in_compliance_ctype is None + else (ctypes.pointer(in_compliance_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return bool(in_compliance_ctype.value) @ivi_synchronized def query_latched_output_cutoff_state(self, output_cutoff_reason): - r'''query_latched_output_cutoff_state + r"""query_latched_output_cutoff_state Discovers if an output cutoff limit was exceeded for the specified reason. When an output cutoff is engaged, the output of the channel(s) is disconnected. If a limit was exceeded, the state is latched until you clear it with the clear_latched_output_cutoff_state method or the reset method. @@ -4978,20 +5368,36 @@ def query_latched_output_cutoff_state(self, output_cutoff_reason): | False | No output cutoff has engaged. | +-------+------------------------------------------------------------------------------+ - ''' + """ if type(output_cutoff_reason) is not enums.OutputCutoffReason: - raise TypeError('Parameter output_cutoff_reason must be of type ' + str(enums.OutputCutoffReason)) + raise TypeError( + "Parameter output_cutoff_reason must be of type " + + str(enums.OutputCutoffReason) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - output_cutoff_reason_ctype = _visatype.ViInt32(output_cutoff_reason.value) # case S130 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + output_cutoff_reason_ctype = _visatype.ViInt32( + output_cutoff_reason.value + ) # case S130 output_cutoff_state_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niDCPower_QueryLatchedOutputCutoffState(vi_ctype, channel_name_ctype, output_cutoff_reason_ctype, None if output_cutoff_state_ctype is None else (ctypes.pointer(output_cutoff_state_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_QueryLatchedOutputCutoffState( + vi_ctype, + channel_name_ctype, + output_cutoff_reason_ctype, + None + if output_cutoff_state_ctype is None + else (ctypes.pointer(output_cutoff_state_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return bool(output_cutoff_state_ctype.value) @ivi_synchronized def query_max_current_limit(self, voltage_level): - r'''query_max_current_limit + r"""query_max_current_limit Queries the maximum current limit on an output channel if the output channel is set to the specified **voltageLevel**. @@ -5016,18 +5422,29 @@ def query_max_current_limit(self, voltage_level): max_current_limit (float): Returns the maximum current limit that can be set with the specified **voltageLevel**. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 voltage_level_ctype = _visatype.ViReal64(voltage_level) # case S150 max_current_limit_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDCPower_QueryMaxCurrentLimit(vi_ctype, channel_name_ctype, voltage_level_ctype, None if max_current_limit_ctype is None else (ctypes.pointer(max_current_limit_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_QueryMaxCurrentLimit( + vi_ctype, + channel_name_ctype, + voltage_level_ctype, + None + if max_current_limit_ctype is None + else (ctypes.pointer(max_current_limit_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(max_current_limit_ctype.value) @ivi_synchronized def query_max_voltage_level(self, current_limit): - r'''query_max_voltage_level + r"""query_max_voltage_level Queries the maximum voltage level on an output channel if the output channel is set to the specified **currentLimit**. @@ -5052,18 +5469,29 @@ def query_max_voltage_level(self, current_limit): max_voltage_level (float): Returns the maximum voltage level that can be set on an output channel with the specified **currentLimit**. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 current_limit_ctype = _visatype.ViReal64(current_limit) # case S150 max_voltage_level_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDCPower_QueryMaxVoltageLevel(vi_ctype, channel_name_ctype, current_limit_ctype, None if max_voltage_level_ctype is None else (ctypes.pointer(max_voltage_level_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_QueryMaxVoltageLevel( + vi_ctype, + channel_name_ctype, + current_limit_ctype, + None + if max_voltage_level_ctype is None + else (ctypes.pointer(max_voltage_level_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(max_voltage_level_ctype.value) @ivi_synchronized def query_min_current_limit(self, voltage_level): - r'''query_min_current_limit + r"""query_min_current_limit Queries the minimum current limit on an output channel if the output channel is set to the specified **voltageLevel**. @@ -5088,18 +5516,29 @@ def query_min_current_limit(self, voltage_level): min_current_limit (float): Returns the minimum current limit that can be set on an output channel with the specified **voltageLevel**. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 voltage_level_ctype = _visatype.ViReal64(voltage_level) # case S150 min_current_limit_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDCPower_QueryMinCurrentLimit(vi_ctype, channel_name_ctype, voltage_level_ctype, None if min_current_limit_ctype is None else (ctypes.pointer(min_current_limit_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_QueryMinCurrentLimit( + vi_ctype, + channel_name_ctype, + voltage_level_ctype, + None + if min_current_limit_ctype is None + else (ctypes.pointer(min_current_limit_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(min_current_limit_ctype.value) @ivi_synchronized def query_output_state(self, output_state): - r'''query_output_state + r"""query_output_state Queries the specified output channel to determine if the output channel is currently in the state specified by **outputState**. @@ -5134,20 +5573,31 @@ def query_output_state(self, output_state): in_state (bool): Returns whether the device output channel is in the specified output state. - ''' + """ if type(output_state) is not enums.OutputStates: - raise TypeError('Parameter output_state must be of type ' + str(enums.OutputStates)) + raise TypeError( + "Parameter output_state must be of type " + str(enums.OutputStates) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 output_state_ctype = _visatype.ViInt32(output_state.value) # case S130 in_state_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niDCPower_QueryOutputState(vi_ctype, channel_name_ctype, output_state_ctype, None if in_state_ctype is None else (ctypes.pointer(in_state_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_QueryOutputState( + vi_ctype, + channel_name_ctype, + output_state_ctype, + None if in_state_ctype is None else (ctypes.pointer(in_state_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return bool(in_state_ctype.value) @ivi_synchronized def reset(self): - r'''reset + r"""reset Resets the specified channel(s) to a known state. This method disables power generation, resets session properties to their default values, commits @@ -5166,16 +5616,22 @@ def reset(self): To call the method on all channels, you can call it directly on the :py:class:`nidcpower.Session`. Example: :py:meth:`my_session.reset` - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - error_code = self._library.niDCPower_ResetWithChannels(vi_ctype, channel_name_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + error_code = self._library.niDCPower_ResetWithChannels( + vi_ctype, channel_name_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def send_software_edge_trigger(self, trigger): - r'''send_software_edge_trigger + r"""send_software_edge_trigger Asserts the specified trigger. This method can override an external edge trigger. @@ -5222,19 +5678,28 @@ def send_software_edge_trigger(self, trigger): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - ''' + """ if type(trigger) is not enums.SendSoftwareEdgeTriggerType: - raise TypeError('Parameter trigger must be of type ' + str(enums.SendSoftwareEdgeTriggerType)) + raise TypeError( + "Parameter trigger must be of type " + + str(enums.SendSoftwareEdgeTriggerType) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 trigger_ctype = _visatype.ViInt32(trigger.value) # case S130 - error_code = self._library.niDCPower_SendSoftwareEdgeTriggerWithChannels(vi_ctype, channel_name_ctype, trigger_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_SendSoftwareEdgeTriggerWithChannels( + vi_ctype, channel_name_ctype, trigger_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_boolean(self, attribute_id, attribute_value): - r'''_set_attribute_vi_boolean + r"""_set_attribute_vi_boolean | Sets the value of a ViBoolean property. | This is a low-level method that you can use to set the values of @@ -5284,18 +5749,24 @@ def _set_attribute_vi_boolean(self, attribute_id, attribute_value): Some of the values might not be valid depending upon the current settings of the device session. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViBoolean(attribute_value) # case S150 - error_code = self._library.niDCPower_SetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_SetAttributeViBoolean( + vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_int32(self, attribute_id, attribute_value): - r'''_set_attribute_vi_int32 + r"""_set_attribute_vi_int32 | Sets the value of a ViInt32 property. | This is a low-level method that you can use to set the values of @@ -5345,18 +5816,24 @@ def _set_attribute_vi_int32(self, attribute_id, attribute_value): Some of the values might not be valid depending upon the current settings of the device session. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt32(attribute_value) # case S150 - error_code = self._library.niDCPower_SetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_SetAttributeViInt32( + vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_int64(self, attribute_id, attribute_value): - r'''_set_attribute_vi_int64 + r"""_set_attribute_vi_int64 | Sets the value of a ViInt64 property. | This is a low-level method that you can use to set the values of @@ -5406,18 +5883,24 @@ def _set_attribute_vi_int64(self, attribute_id, attribute_value): Some of the values might not be valid depending upon the current settings of the device session. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt64(attribute_value) # case S150 - error_code = self._library.niDCPower_SetAttributeViInt64(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_SetAttributeViInt64( + vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_real64(self, attribute_id, attribute_value): - r'''_set_attribute_vi_real64 + r"""_set_attribute_vi_real64 | Sets the value of a ViReal64 property. | This is a low-level method that you can use to set the values of @@ -5467,18 +5950,24 @@ def _set_attribute_vi_real64(self, attribute_id, attribute_value): Some of the values might not be valid depending upon the current settings of the device session. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViReal64(attribute_value) # case S150 - error_code = self._library.niDCPower_SetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_SetAttributeViReal64( + vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_string(self, attribute_id, attribute_value): - r'''_set_attribute_vi_string + r"""_set_attribute_vi_string | Sets the value of a ViString property. | This is a low-level method that you can use to set the values of @@ -5528,18 +6017,26 @@ def _set_attribute_vi_string(self, attribute_id, attribute_value): Some of the values might not be valid depending upon the current settings of the device session. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 - attribute_value_ctype = ctypes.create_string_buffer(attribute_value.encode(self._encoding)) # case C020 - error_code = self._library.niDCPower_SetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + attribute_value_ctype = ctypes.create_string_buffer( + attribute_value.encode(self._encoding) + ) # case C020 + error_code = self._library.niDCPower_SetAttributeViString( + vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def set_sequence(self, values, source_delays): - r'''set_sequence + r"""set_sequence Configures a series of voltage or current outputs and corresponding source delays. The source mode must be set to @@ -5587,33 +6084,49 @@ def set_sequence(self, values, source_delays): **Valid Values**: The valid values are between 0 and 167 seconds. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - values_ctype = get_ctypes_pointer_for_buffer(value=values, library_type=_visatype.ViReal64) # case B550 - source_delays_ctype = get_ctypes_pointer_for_buffer(value=source_delays, library_type=_visatype.ViReal64) # case B550 - size_ctype = _visatype.ViUInt32(0 if values is None else len(values)) # case S160 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + values_ctype = get_ctypes_pointer_for_buffer( + value=values, library_type=_visatype.ViReal64 + ) # case B550 + source_delays_ctype = get_ctypes_pointer_for_buffer( + value=source_delays, library_type=_visatype.ViReal64 + ) # case B550 + size_ctype = _visatype.ViUInt32( + 0 if values is None else len(values) + ) # case S160 if source_delays is not None and len(source_delays) != len(values): # case S160 - raise ValueError("Length of source_delays and values parameters do not match.") # case S160 - error_code = self._library.niDCPower_SetSequence(vi_ctype, channel_name_ctype, values_ctype, source_delays_ctype, size_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + raise ValueError( + "Length of source_delays and values parameters do not match." + ) # case S160 + error_code = self._library.niDCPower_SetSequence( + vi_ctype, channel_name_ctype, values_ctype, source_delays_ctype, size_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def unlock(self): - '''unlock + """unlock Releases a lock that you acquired on an device session using lock. Refer to lock for additional information on session locks. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDCPower_UnlockSession(vi_ctype, None) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return @ivi_synchronized def wait_for_event(self, event_id, timeout=hightime.timedelta(seconds=10.0)): - r'''wait_for_event + r"""wait_for_event Waits until the specified channel(s) have generated the specified event. @@ -5669,19 +6182,27 @@ def wait_for_event(self, event_id, timeout=hightime.timedelta(seconds=10.0)): triggers so that the timeout interval is long enough for your application. - ''' + """ if type(event_id) is not enums.Event: - raise TypeError('Parameter event_id must be of type ' + str(enums.Event)) + raise TypeError("Parameter event_id must be of type " + str(enums.Event)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 event_id_ctype = _visatype.ViInt32(event_id.value) # case S130 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 - error_code = self._library.niDCPower_WaitForEventWithChannels(vi_ctype, channel_name_ctype, event_id_ctype, timeout_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + timeout_ctype = _converters.convert_timedelta_to_seconds_real64( + timeout + ) # case S140 + error_code = self._library.niDCPower_WaitForEventWithChannels( + vi_ctype, channel_name_ctype, event_id_ctype, timeout_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def _error_message(self, error_code): - r'''_error_message + r"""_error_message Converts a status code returned by an instrument driver method into a user-readable string. @@ -5696,20 +6217,31 @@ def _error_message(self, error_code): code you specify. You must pass a ViChar array with at least 256 bytes. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus(error_code) # case S150 error_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niDCPower_error_message(vi_ctype, error_code_ctype, error_message_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + error_code = self._library.niDCPower_error_message( + vi_ctype, error_code_ctype, error_message_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return error_message_ctype.value.decode(self._encoding) class Session(_SessionBase): - '''An NI-DCPower session to a National Instruments Programmable Power Supply or Source Measure Unit.''' - - def __init__(self, resource_name, channels=None, reset=False, options={}, independent_channels=True): - r'''An NI-DCPower session to a National Instruments Programmable Power Supply or Source Measure Unit. + """An NI-DCPower session to a National Instruments Programmable Power Supply or Source Measure Unit.""" + + def __init__( + self, + resource_name, + channels=None, + reset=False, + options={}, + independent_channels=True, + ): + r"""An NI-DCPower session to a National Instruments Programmable Power Supply or Source Measure Unit. Creates and returns a new NI-DCPower session to the instrument(s) and channel(s) specified in **resource name** to be used in all subsequent NI-DCPower method calls. With this method, @@ -5816,17 +6348,27 @@ def __init__(self, resource_name, channels=None, reset=False, options={}, indepe Returns: session (nidcpower.Session): A session object representing the device. - ''' - super(Session, self).__init__(repeated_capability_list=[], vi=None, library=None, encoding=None, freeze_it=False) - resource_name = _converters.convert_repeated_capabilities_without_prefix(resource_name) + """ + super(Session, self).__init__( + repeated_capability_list=[], + vi=None, + library=None, + encoding=None, + freeze_it=False, + ) + resource_name = _converters.convert_repeated_capabilities_without_prefix( + resource_name + ) channels = _converters.convert_repeated_capabilities_without_prefix(channels) options = _converters.convert_init_with_options_dictionary(options) self._library = _library_singleton.get() - self._encoding = 'windows-1251' + self._encoding = "windows-1251" # Call specified init function self._vi = 0 # This must be set before calling _fancy_initialize(). - self._vi = self._fancy_initialize(resource_name, channels, reset, options, independent_channels) + self._vi = self._fancy_initialize( + resource_name, channels, reset, options, independent_channels + ) # Store the parameter list for later printing in __repr__ param_list = [] @@ -5835,7 +6377,7 @@ def __init__(self, resource_name, channels=None, reset=False, options={}, indepe param_list.append("reset=" + pp.pformat(reset)) param_list.append("options=" + pp.pformat(options)) param_list.append("independent_channels=" + pp.pformat(independent_channels)) - self._param_list = ', '.join(param_list) + self._param_list = ", ".join(param_list) self._is_frozen = True @@ -5846,7 +6388,7 @@ def __exit__(self, exc_type, exc_value, traceback): self.close() def close(self): - '''close + """close Closes the session specified in **vi** and deallocates the resources that NI-DCPower reserves. If power output is enabled when you call this @@ -5865,7 +6407,7 @@ def close(self): Note: This method is not needed when using the session context manager - ''' + """ try: self._close() except errors.DriverError: @@ -5873,11 +6415,11 @@ def close(self): raise self._vi = 0 - ''' These are code-generated ''' + """ These are code-generated """ @ivi_synchronized def disable(self): - r'''disable + r"""disable This method performs the same actions as the reset method, except that this method also immediately sets the @@ -5885,15 +6427,17 @@ def disable(self): This method opens the output relay on devices that have an output relay. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDCPower_Disable(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def export_attribute_configuration_buffer(self): - r'''export_attribute_configuration_buffer + r"""export_attribute_configuration_buffer Exports the property configuration of the session to the specified configuration buffer. @@ -5942,23 +6486,33 @@ def export_attribute_configuration_buffer(self): configuration (bytes): Specifies the byte array buffer to be populated with the exported property configuration. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 size_ctype = _visatype.ViInt32() # case S170 configuration_ctype = None # case B580 - error_code = self._library.niDCPower_ExportAttributeConfigurationBuffer(vi_ctype, size_ctype, configuration_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niDCPower_ExportAttributeConfigurationBuffer( + vi_ctype, size_ctype, configuration_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) size_ctype = _visatype.ViInt32(error_code) # case S180 configuration_size = size_ctype.value # case B590 configuration_array = array.array("b", [0] * configuration_size) # case B590 - configuration_ctype = get_ctypes_pointer_for_buffer(value=configuration_array, library_type=_visatype.ViInt8) # case B590 - error_code = self._library.niDCPower_ExportAttributeConfigurationBuffer(vi_ctype, size_ctype, configuration_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + configuration_ctype = get_ctypes_pointer_for_buffer( + value=configuration_array, library_type=_visatype.ViInt8 + ) # case B590 + error_code = self._library.niDCPower_ExportAttributeConfigurationBuffer( + vi_ctype, size_ctype, configuration_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return _converters.convert_to_bytes(configuration_array) @ivi_synchronized def export_attribute_configuration_file(self, file_path): - r'''export_attribute_configuration_file + r"""export_attribute_configuration_file Exports the property configuration of the session to the specified file. @@ -6009,15 +6563,28 @@ def export_attribute_configuration_file(self, file_path): method returns an error. **Default file extension:** .nidcpowerconfig - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 - error_code = self._library.niDCPower_ExportAttributeConfigurationFile(vi_ctype, file_path_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + file_path_ctype = ctypes.create_string_buffer( + file_path.encode(self._encoding) + ) # case C020 + error_code = self._library.niDCPower_ExportAttributeConfigurationFile( + vi_ctype, file_path_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return - def _fancy_initialize(self, resource_name, channels=None, reset=False, option_string="", independent_channels=True): - '''_fancy_initialize + def _fancy_initialize( + self, + resource_name, + channels=None, + reset=False, + option_string="", + independent_channels=True, + ): + """_fancy_initialize Creates and returns a new NI-DCPower session to the instrument(s) and channel(s) specified in **resource name** to be used in all subsequent NI-DCPower method calls. With this method, @@ -6113,43 +6680,62 @@ def _fancy_initialize(self, resource_name, channels=None, reset=False, option_st vi (int): Returns a session handle that you use to identify the device in all subsequent NI-DCPower method calls. - ''' + """ if independent_channels: resource_string = resource_name # store potential modifications to resource_name in a separate variable if channels: # if we have a channels arg, we need to try and combine it with the resource name # before calling into initialize with independent channels - channel_list = (resource_name + "/" + channel for channel in channels.split(",")) + channel_list = ( + resource_name + "/" + channel for channel in channels.split(",") + ) resource_string = ",".join(channel_list) import warnings + warnings.warn( "Attempting to initialize an independent channels session with a channels argument. The resource " - "name '" + resource_name + "' will be combined with the channels '" + channels + "' to form the " - "fully-qualified channel list '" + resource_string + "'. To avoid this warning, use a " + "name '" + + resource_name + + "' will be combined with the channels '" + + channels + + "' to form the " + "fully-qualified channel list '" + + resource_string + + "'. To avoid this warning, use a " "fully-qualified channel list as the resource name instead of providing a channels argument.", - DeprecationWarning + DeprecationWarning, ) if "," in resource_name: raise ValueError( - "Channels cannot be combined with multiple instruments in the resource name '" + resource_name + "'. " + "Channels cannot be combined with multiple instruments in the resource name '" + + resource_name + + "'. " "Specify a list of fully-qualified channels as the resource name instead of supplying a " "channels argument." ) - return self._initialize_with_independent_channels(resource_string, reset, option_string) + return self._initialize_with_independent_channels( + resource_string, reset, option_string + ) else: import warnings - warnings.warn("Initializing session without independent channels enabled.", DeprecationWarning) - return self._initialize_with_channels(resource_name, channels, reset, option_string) + warnings.warn( + "Initializing session without independent channels enabled.", + DeprecationWarning, + ) + + return self._initialize_with_channels( + resource_name, channels, reset, option_string + ) @ivi_synchronized def get_channel_name(self, index): - r'''get_channel_name + r"""get_channel_name Retrieves the output **channelName** that corresponds to the requested **index**. Use the channel_count property to @@ -6163,22 +6749,30 @@ def get_channel_name(self, index): Returns: channel_name (str): Returns the output channel name that corresponds to **index**. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 index_ctype = _visatype.ViInt32(index) # case S150 buffer_size_ctype = _visatype.ViInt32() # case S170 channel_name_ctype = None # case C050 - error_code = self._library.niDCPower_GetChannelName(vi_ctype, index_ctype, buffer_size_ctype, channel_name_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niDCPower_GetChannelName( + vi_ctype, index_ctype, buffer_size_ctype, channel_name_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 channel_name_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niDCPower_GetChannelName(vi_ctype, index_ctype, buffer_size_ctype, channel_name_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_GetChannelName( + vi_ctype, index_ctype, buffer_size_ctype, channel_name_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return channel_name_ctype.value.decode(self._encoding) @ivi_synchronized def get_channel_names(self, indices): - r'''get_channel_names + r"""get_channel_names Returns a list of channel names for the given channel indices. @@ -6195,22 +6789,36 @@ def get_channel_names(self, indices): Returns: names (list of str): The channel name(s) at the specified indices. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - indices_ctype = ctypes.create_string_buffer(_converters.convert_repeated_capabilities_without_prefix(indices).encode(self._encoding)) # case C040 + indices_ctype = ctypes.create_string_buffer( + _converters.convert_repeated_capabilities_without_prefix(indices).encode( + self._encoding + ) + ) # case C040 buffer_size_ctype = _visatype.ViInt32() # case S170 names_ctype = None # case C050 - error_code = self._library.niDCPower_GetChannelNameFromString(vi_ctype, indices_ctype, buffer_size_ctype, names_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niDCPower_GetChannelNameFromString( + vi_ctype, indices_ctype, buffer_size_ctype, names_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 names_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niDCPower_GetChannelNameFromString(vi_ctype, indices_ctype, buffer_size_ctype, names_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return _converters.convert_comma_separated_string_to_list(names_ctype.value.decode(self._encoding)) + error_code = self._library.niDCPower_GetChannelNameFromString( + vi_ctype, indices_ctype, buffer_size_ctype, names_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return _converters.convert_comma_separated_string_to_list( + names_ctype.value.decode(self._encoding) + ) @ivi_synchronized def _get_ext_cal_last_date_and_time(self): - r'''_get_ext_cal_last_date_and_time + r"""_get_ext_cal_last_date_and_time Returns the date and time of the last successful calibration. The time returned is 24-hour (military) local time; for example, if the device @@ -6229,20 +6837,35 @@ def _get_ext_cal_last_date_and_time(self): minute (int): Returns the **minute** in which the device was last calibrated. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 year_ctype = _visatype.ViInt32() # case S220 month_ctype = _visatype.ViInt32() # case S220 day_ctype = _visatype.ViInt32() # case S220 hour_ctype = _visatype.ViInt32() # case S220 minute_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDCPower_GetExtCalLastDateAndTime(vi_ctype, None if year_ctype is None else (ctypes.pointer(year_ctype)), None if month_ctype is None else (ctypes.pointer(month_ctype)), None if day_ctype is None else (ctypes.pointer(day_ctype)), None if hour_ctype is None else (ctypes.pointer(hour_ctype)), None if minute_ctype is None else (ctypes.pointer(minute_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return int(year_ctype.value), int(month_ctype.value), int(day_ctype.value), int(hour_ctype.value), int(minute_ctype.value) + error_code = self._library.niDCPower_GetExtCalLastDateAndTime( + vi_ctype, + None if year_ctype is None else (ctypes.pointer(year_ctype)), + None if month_ctype is None else (ctypes.pointer(month_ctype)), + None if day_ctype is None else (ctypes.pointer(day_ctype)), + None if hour_ctype is None else (ctypes.pointer(hour_ctype)), + None if minute_ctype is None else (ctypes.pointer(minute_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return ( + int(year_ctype.value), + int(month_ctype.value), + int(day_ctype.value), + int(hour_ctype.value), + int(minute_ctype.value), + ) @ivi_synchronized def get_ext_cal_last_temp(self): - r'''get_ext_cal_last_temp + r"""get_ext_cal_last_temp Returns the onboard **temperature** of the device, in degrees Celsius, during the last successful external calibration. @@ -6251,16 +6874,21 @@ def get_ext_cal_last_temp(self): temperature (float): Returns the onboard **temperature** of the device, in degrees Celsius, during the last successful external calibration. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 temperature_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDCPower_GetExtCalLastTemp(vi_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_GetExtCalLastTemp( + vi_ctype, + None if temperature_ctype is None else (ctypes.pointer(temperature_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(temperature_ctype.value) @ivi_synchronized def get_ext_cal_recommended_interval(self): - r'''get_ext_cal_recommended_interval + r"""get_ext_cal_recommended_interval Returns the recommended maximum interval, in **months**, between external calibrations. @@ -6269,29 +6897,33 @@ def get_ext_cal_recommended_interval(self): months (hightime.timedelta): Specifies the recommended maximum interval, in **months**, between external calibrations. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 months_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDCPower_GetExtCalRecommendedInterval(vi_ctype, None if months_ctype is None else (ctypes.pointer(months_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_GetExtCalRecommendedInterval( + vi_ctype, None if months_ctype is None else (ctypes.pointer(months_ctype)) + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return _converters.convert_month_to_timedelta(int(months_ctype.value)) @ivi_synchronized def get_ext_cal_last_date_and_time(self): - '''get_ext_cal_last_date_and_time + """get_ext_cal_last_date_and_time Returns the date and time of the last successful calibration. Returns: month (hightime.datetime): Indicates date and time of the last calibration. - ''' + """ year, month, day, hour, minute = self._get_ext_cal_last_date_and_time() return hightime.datetime(year, month, day, hour, minute) @ivi_synchronized def get_self_cal_last_date_and_time(self): - '''get_self_cal_last_date_and_time + """get_self_cal_last_date_and_time Returns the date and time of the oldest successful self-calibration from among the channels in the session. @@ -6300,13 +6932,13 @@ def get_self_cal_last_date_and_time(self): Returns: month (hightime.datetime): Returns the date and time the device was last calibrated. - ''' + """ year, month, day, hour, minute = self._get_self_cal_last_date_and_time() return hightime.datetime(year, month, day, hour, minute) @ivi_synchronized def _get_self_cal_last_date_and_time(self): - r'''_get_self_cal_last_date_and_time + r"""_get_self_cal_last_date_and_time Returns the date and time of the oldest successful self-calibration from among the channels in the session. @@ -6335,20 +6967,35 @@ def _get_self_cal_last_date_and_time(self): minute (int): Returns the **minute** in which the device was last calibrated. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 year_ctype = _visatype.ViInt32() # case S220 month_ctype = _visatype.ViInt32() # case S220 day_ctype = _visatype.ViInt32() # case S220 hour_ctype = _visatype.ViInt32() # case S220 minute_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDCPower_GetSelfCalLastDateAndTime(vi_ctype, None if year_ctype is None else (ctypes.pointer(year_ctype)), None if month_ctype is None else (ctypes.pointer(month_ctype)), None if day_ctype is None else (ctypes.pointer(day_ctype)), None if hour_ctype is None else (ctypes.pointer(hour_ctype)), None if minute_ctype is None else (ctypes.pointer(minute_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return int(year_ctype.value), int(month_ctype.value), int(day_ctype.value), int(hour_ctype.value), int(minute_ctype.value) + error_code = self._library.niDCPower_GetSelfCalLastDateAndTime( + vi_ctype, + None if year_ctype is None else (ctypes.pointer(year_ctype)), + None if month_ctype is None else (ctypes.pointer(month_ctype)), + None if day_ctype is None else (ctypes.pointer(day_ctype)), + None if hour_ctype is None else (ctypes.pointer(hour_ctype)), + None if minute_ctype is None else (ctypes.pointer(minute_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return ( + int(year_ctype.value), + int(month_ctype.value), + int(day_ctype.value), + int(hour_ctype.value), + int(minute_ctype.value), + ) @ivi_synchronized def get_self_cal_last_temp(self): - r'''get_self_cal_last_temp + r"""get_self_cal_last_temp Returns the onboard temperature of the device, in degrees Celsius, during the oldest successful self-calibration from among the channels in @@ -6370,16 +7017,21 @@ def get_self_cal_last_temp(self): temperature (float): Returns the onboard **temperature** of the device, in degrees Celsius, during the oldest successful calibration. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 temperature_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDCPower_GetSelfCalLastTemp(vi_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_GetSelfCalLastTemp( + vi_ctype, + None if temperature_ctype is None else (ctypes.pointer(temperature_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(temperature_ctype.value) @ivi_synchronized def import_attribute_configuration_buffer(self, configuration): - r'''import_attribute_configuration_buffer + r"""import_attribute_configuration_buffer Imports a property configuration to the session from the specified configuration buffer. @@ -6427,18 +7079,28 @@ def import_attribute_configuration_buffer(self, configuration): configuration (bytes): Specifies the byte array buffer that contains the property configuration to import. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - size_ctype = _visatype.ViInt32(0 if configuration is None else len(configuration)) # case S160 - configuration_converted = _converters.convert_to_bytes(configuration) # case B520 - configuration_ctype = get_ctypes_pointer_for_buffer(value=configuration_converted, library_type=_visatype.ViInt8) # case B520 - error_code = self._library.niDCPower_ImportAttributeConfigurationBuffer(vi_ctype, size_ctype, configuration_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + size_ctype = _visatype.ViInt32( + 0 if configuration is None else len(configuration) + ) # case S160 + configuration_converted = _converters.convert_to_bytes( + configuration + ) # case B520 + configuration_ctype = get_ctypes_pointer_for_buffer( + value=configuration_converted, library_type=_visatype.ViInt8 + ) # case B520 + error_code = self._library.niDCPower_ImportAttributeConfigurationBuffer( + vi_ctype, size_ctype, configuration_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def import_attribute_configuration_file(self, file_path): - r'''import_attribute_configuration_file + r"""import_attribute_configuration_file Imports a property configuration to the session from the specified file. @@ -6488,15 +7150,21 @@ def import_attribute_configuration_file(self, file_path): method returns an error. **Default File Extension:** .nidcpowerconfig - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 - error_code = self._library.niDCPower_ImportAttributeConfigurationFile(vi_ctype, file_path_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + file_path_ctype = ctypes.create_string_buffer( + file_path.encode(self._encoding) + ) # case C020 + error_code = self._library.niDCPower_ImportAttributeConfigurationFile( + vi_ctype, file_path_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def _initialize_with_channels(self, resource_name, channels, reset, option_string): - r'''_initialize_with_channels + r"""_initialize_with_channels Creates and returns a new NI-DCPower session to the power supply or SMU specified in **resource name** to be used in all subsequent NI-DCPower @@ -6563,18 +7231,34 @@ def _initialize_with_channels(self, resource_name, channels, reset, option_strin vi (int): Returns a session handle that you use to identify the device in all subsequent NI-DCPower method calls. - ''' - resource_name_ctype = ctypes.create_string_buffer(resource_name.encode(self._encoding)) # case C020 - channels_ctype = ctypes.create_string_buffer(channels.encode(self._encoding)) # case C020 + """ + resource_name_ctype = ctypes.create_string_buffer( + resource_name.encode(self._encoding) + ) # case C020 + channels_ctype = ctypes.create_string_buffer( + channels.encode(self._encoding) + ) # case C020 reset_ctype = _visatype.ViBoolean(reset) # case S150 - option_string_ctype = ctypes.create_string_buffer(option_string.encode(self._encoding)) # case C020 + option_string_ctype = ctypes.create_string_buffer( + option_string.encode(self._encoding) + ) # case C020 vi_ctype = _visatype.ViSession() # case S220 - error_code = self._library.niDCPower_InitializeWithChannels(resource_name_ctype, channels_ctype, reset_ctype, option_string_ctype, None if vi_ctype is None else (ctypes.pointer(vi_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_InitializeWithChannels( + resource_name_ctype, + channels_ctype, + reset_ctype, + option_string_ctype, + None if vi_ctype is None else (ctypes.pointer(vi_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(vi_ctype.value) - def _initialize_with_independent_channels(self, resource_name, reset, option_string): - r'''_initialize_with_independent_channels + def _initialize_with_independent_channels( + self, resource_name, reset, option_string + ): + r"""_initialize_with_independent_channels Creates a new NI-DCPower session to the specified instrument(s) and channel(s) and returns a session handle to be used in all subsequent NI-DCPower method calls. @@ -6649,18 +7333,29 @@ def _initialize_with_independent_channels(self, resource_name, reset, option_str vi (int): Returns a session handle that you use to identify the session in all subsequent NI-DCPower method calls. - ''' - resource_name_ctype = ctypes.create_string_buffer(resource_name.encode(self._encoding)) # case C020 + """ + resource_name_ctype = ctypes.create_string_buffer( + resource_name.encode(self._encoding) + ) # case C020 reset_ctype = _visatype.ViBoolean(reset) # case S150 - option_string_ctype = ctypes.create_string_buffer(option_string.encode(self._encoding)) # case C020 + option_string_ctype = ctypes.create_string_buffer( + option_string.encode(self._encoding) + ) # case C020 vi_ctype = _visatype.ViSession() # case S220 - error_code = self._library.niDCPower_InitializeWithIndependentChannels(resource_name_ctype, reset_ctype, option_string_ctype, None if vi_ctype is None else (ctypes.pointer(vi_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_InitializeWithIndependentChannels( + resource_name_ctype, + reset_ctype, + option_string_ctype, + None if vi_ctype is None else (ctypes.pointer(vi_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(vi_ctype.value) @ivi_synchronized def read_current_temperature(self): - r'''read_current_temperature + r"""read_current_temperature Returns the current onboard **temperature**, in degrees Celsius, of the device. @@ -6668,16 +7363,21 @@ def read_current_temperature(self): Returns: temperature (float): Returns the onboard **temperature**, in degrees Celsius, of the device. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 temperature_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDCPower_ReadCurrentTemperature(vi_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDCPower_ReadCurrentTemperature( + vi_ctype, + None if temperature_ctype is None else (ctypes.pointer(temperature_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(temperature_ctype.value) @ivi_synchronized def reset_device(self): - r'''reset_device + r"""reset_device Resets the device to a known state. The method disables power generation, resets session properties to their default values, clears @@ -6692,15 +7392,17 @@ def reset_device(self): This will also open the output relay on devices that have an output relay. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDCPower_ResetDevice(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def reset_with_defaults(self): - r'''reset_with_defaults + r"""reset_with_defaults Resets the device to a known state. This method disables power generation, resets session properties to their default values, commits @@ -6709,14 +7411,16 @@ def reset_with_defaults(self): state. In addition to exhibiting the behavior of the reset method, this method can assign user-defined default values for configurable properties from the IVI configuration. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDCPower_ResetWithDefaults(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def _close(self): - r'''_close + r"""_close Closes the session specified in **vi** and deallocates the resources that NI-DCPower reserves. If power output is enabled when you call this @@ -6732,15 +7436,17 @@ def _close(self): Note: One or more of the referenced methods are not in the Python API for this driver. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDCPower_close(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def self_test(self): - '''self_test + """self_test Performs the device self-test routine and returns the test result(s). Calling this method implicitly calls the reset method. @@ -6762,7 +7468,7 @@ def self_test(self): +----------------+-------------------+ | 1 | Self test failed. | +----------------+-------------------+ - ''' + """ code, msg = self._self_test() if code: raise errors.SelfTestError(code, msg) @@ -6770,7 +7476,7 @@ def self_test(self): @ivi_synchronized def _self_test(self): - r'''_self_test + r"""_self_test Performs the device self-test routine and returns the test result(s). Calling this method implicitly calls the reset method. @@ -6794,13 +7500,20 @@ def _self_test(self): self_test_message (str): Returns the self-test result message. The size of this array must be at least 256 bytes. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 self_test_result_ctype = _visatype.ViInt16() # case S220 self_test_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niDCPower_self_test(vi_ctype, None if self_test_result_ctype is None else (ctypes.pointer(self_test_result_ctype)), self_test_message_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return int(self_test_result_ctype.value), self_test_message_ctype.value.decode(self._encoding) - - - + error_code = self._library.niDCPower_self_test( + vi_ctype, + None + if self_test_result_ctype is None + else (ctypes.pointer(self_test_result_ctype)), + self_test_message_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return int(self_test_result_ctype.value), self_test_message_ctype.value.decode( + self._encoding + ) diff --git a/generated/nidcpower/nidcpower/unit_tests/_matchers.py b/generated/nidcpower/nidcpower/unit_tests/_matchers.py index 4aff4eb59..c4918400f 100644 --- a/generated/nidcpower/nidcpower/unit_tests/_matchers.py +++ b/generated/nidcpower/nidcpower/unit_tests/_matchers.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # This file was generated -'''Matcher classes used by unit tests in order to set mock expectations. +"""Matcher classes used by unit tests in order to set mock expectations. These work well with our visatype definitions. -''' +""" import ctypes import nidcpower._visatype as _visatype @@ -21,15 +21,27 @@ def __init__(self, expected_type, expected_value): def __eq__(self, other): if not isinstance(other, self.expected_type): - print("{0}: Unexpected type. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_type, type(other))) + print( + "{0}: Unexpected type. Expected: {1}. Received: {2}".format( + self.__class__.__name__, self.expected_type, type(other) + ) + ) return False if other.value != self.expected_value: - print("{0}: Unexpected value. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_value, other.value)) + print( + "{0}: Unexpected value. Expected: {1}. Received: {2}".format( + self.__class__.__name__, self.expected_value, other.value + ) + ) return False return True def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_type), + pp.pformat(self.expected_value), + ) class _PointerMatcher(object): @@ -38,12 +50,18 @@ def __init__(self, expected_type): def __eq__(self, other): if not isinstance(other, ctypes.POINTER(self.expected_type)): - print("Unexpected type. Expected: {0}. Received: {1}".format(ctypes.POINTER(self.expected_type), type(other))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + ctypes.POINTER(self.expected_type), type(other) + ) + ) return False return True def __repr__(self): - return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_type)) + return "{0}({1})".format( + self.__class__.__name__, pp.pformat(self.expected_type) + ) class _BufferMatcher(object): @@ -70,29 +88,47 @@ def __eq__(self, other): pass # Because of object lifetimes, we may need to mock the other instance and provide lists instead of the actual array - if not isinstance(other, self.expected_type) and not isinstance(other, list): - print("Unexpected type. Expected: {0} or {1}. Received: {2}".format(self.expected_type, list, type(other))) + if not isinstance(other, self.expected_type) and not isinstance( + other, list + ): + print( + "Unexpected type. Expected: {0} or {1}. Received: {2}".format( + self.expected_type, list, type(other) + ) + ) return False if self.expected_size != len(other): - print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(other))) + print( + "Unexpected length. Expected: {0}. Received: {1}".format( + self.expected_size, len(other) + ) + ) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for i in range(0, len(self.expected_value)): if self.expected_value[i] != other[i]: - print("Unexpected value at index {0}. Expected: {1}. Received: {2}".format(i, self.expected_value[i], other[i])) + print( + "Unexpected value at index {0}. Expected: {1}. Received: {2}".format( + i, self.expected_value[i], other[i] + ) + ) return False return True def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self._expected_element_type), pp.pformat(self._expected_size_or_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self._expected_element_type), + pp.pformat(self._expected_size_or_value), + ) def __str__(self): - ret_str = self.__repr__() + '\n' - ret_str += ' expected_type = ' + str(self.expected_type) + '\n' - ret_str += ' expected_value = ' + str(self.expected_value) + '\n' - ret_str += ' expected_size = ' + str(self.expected_size) + '\n' + ret_str = self.__repr__() + "\n" + ret_str += " expected_type = " + str(self.expected_type) + "\n" + ret_str += " expected_value = " + str(self.expected_value) + "\n" + ret_str += " expected_size = " + str(self.expected_size) + "\n" return ret_str @@ -112,21 +148,37 @@ def __eq__(self, other): pass if not isinstance(other, ctypes.Array): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(other))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_type, type(other) + ) + ) return False - if len(other) < len(self.expected_string_value) + 1: # +1 for NULL terminating character - print("Unexpected length in C string. Expected at least: {0}. Received {1}".format(len(other), len(self.expected_string_value) + 1)) + if ( + len(other) < len(self.expected_string_value) + 1 + ): # +1 for NULL terminating character + print( + "Unexpected length in C string. Expected at least: {0}. Received {1}".format( + len(other), len(self.expected_string_value) + 1 + ) + ) return False if not isinstance(other[0], bytes): print("Unexpected type. Not a string. Received: {0}".format(type(other[0]))) return False if other.value.decode("ascii") != self.expected_string_value: - print("Unexpected value. Expected {0}. Received: {1}".format(self.expected_string_value, other.value.decode)) + print( + "Unexpected value. Expected {0}. Received: {1}".format( + self.expected_string_value, other.value.decode + ) + ) return False return True def __repr__(self): - return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_string_value)) + return "{0}({1})".format( + self.__class__.__name__, pp.pformat(self.expected_string_value) + ) # Custom Type @@ -139,7 +191,11 @@ def _compare_ctype_structs(expected, actual): expected_val = getattr(expected, field_name) actual_val = getattr(actual, field_name) if expected_val != actual_val: - print("Unexpected value field {0}. Expected: {1}. Received: {2}".format(field_name, expected_val, actual_val)) + print( + "Unexpected value field {0}. Expected: {1}. Received: {2}".format( + field_name, expected_val, actual_val + ) + ) return False return True @@ -151,12 +207,20 @@ def __init__(self, expected_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_type, type(actual) + ) + ) return False return _compare_ctype_structs(self.expected_value, actual) def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_type), + pp.pformat(self.expected_value), + ) class CustomTypeBufferMatcher(object): @@ -168,30 +232,48 @@ def __init__(self, expected_element_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print("Unexpected array type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) + print( + "Unexpected array type. Expected: {0}. Received: {1}".format( + self.expected_type, type(actual) + ) + ) return False if self.expected_size != len(actual): - print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(actual))) + print( + "Unexpected length. Expected: {0}. Received: {1}".format( + self.expected_size, len(actual) + ) + ) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for a, e in zip(actual, self.expected_value): if not isinstance(a, self.expected_element_type): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_element_type, type(a))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_element_type, type(a) + ) + ) return False if not _compare_ctype_structs(e, a): return False return True def __repr__(self): - expected_val_repr = '[' + ', '.join([x.__repr__() for x in self.expected_value]) + ']' - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_element_type), expected_val_repr) + expected_val_repr = ( + "[" + ", ".join([x.__repr__() for x in self.expected_value]) + "]" + ) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_element_type), + expected_val_repr, + ) def __str__(self): - ret_str = self.__repr__() + '\n' - ret_str += ' expected_type = ' + str(self.expected_type) + '\n' - ret_str += ' expected_size = ' + str(self.expected_size) + '\n' + ret_str = self.__repr__() + "\n" + ret_str += " expected_type = " + str(self.expected_type) + "\n" + ret_str += " expected_size = " + str(self.expected_size) + "\n" return ret_str @@ -200,7 +282,9 @@ def __str__(self): class ViBooleanMatcher(_ScalarMatcher): def __init__(self, expected_value): - _ScalarMatcher.__init__(self, _visatype.ViBoolean, 1 if expected_value is True else 0) + _ScalarMatcher.__init__( + self, _visatype.ViBoolean, 1 if expected_value is True else 0 + ) class ViSessionMatcher(_ScalarMatcher): @@ -312,6 +396,3 @@ def __init__(self, expected_size_or_value): class ViSessionBufferMatcher(_BufferMatcher): def __init__(self, expected_size_or_value): _BufferMatcher.__init__(self, _visatype.ViSession, expected_size_or_value) - - - diff --git a/generated/nidcpower/nidcpower/unit_tests/_mock_helper.py b/generated/nidcpower/nidcpower/unit_tests/_mock_helper.py index 9af5ae091..f4dfb00bc 100644 --- a/generated/nidcpower/nidcpower/unit_tests/_mock_helper.py +++ b/generated/nidcpower/nidcpower/unit_tests/_mock_helper.py @@ -16,168 +16,168 @@ def __init__(self, function, param=None): class SideEffectsHelper(object): def __init__(self): self._defaults = {} - self._defaults['AbortWithChannels'] = {} - self._defaults['AbortWithChannels']['return'] = 0 - self._defaults['CalSelfCalibrate'] = {} - self._defaults['CalSelfCalibrate']['return'] = 0 - self._defaults['ClearLatchedOutputCutoffState'] = {} - self._defaults['ClearLatchedOutputCutoffState']['return'] = 0 - self._defaults['CommitWithChannels'] = {} - self._defaults['CommitWithChannels']['return'] = 0 - self._defaults['ConfigureApertureTime'] = {} - self._defaults['ConfigureApertureTime']['return'] = 0 - self._defaults['CreateAdvancedSequenceCommitStepWithChannels'] = {} - self._defaults['CreateAdvancedSequenceCommitStepWithChannels']['return'] = 0 - self._defaults['CreateAdvancedSequenceStepWithChannels'] = {} - self._defaults['CreateAdvancedSequenceStepWithChannels']['return'] = 0 - self._defaults['CreateAdvancedSequenceWithChannels'] = {} - self._defaults['CreateAdvancedSequenceWithChannels']['return'] = 0 - self._defaults['DeleteAdvancedSequenceWithChannels'] = {} - self._defaults['DeleteAdvancedSequenceWithChannels']['return'] = 0 - self._defaults['Disable'] = {} - self._defaults['Disable']['return'] = 0 - self._defaults['ExportAttributeConfigurationBuffer'] = {} - self._defaults['ExportAttributeConfigurationBuffer']['return'] = 0 - self._defaults['ExportAttributeConfigurationBuffer']['configuration'] = None - self._defaults['ExportAttributeConfigurationFile'] = {} - self._defaults['ExportAttributeConfigurationFile']['return'] = 0 - self._defaults['FancyInitialize'] = {} - self._defaults['FancyInitialize']['return'] = 0 - self._defaults['FancyInitialize']['vi'] = None - self._defaults['FetchMultiple'] = {} - self._defaults['FetchMultiple']['return'] = 0 - self._defaults['FetchMultiple']['voltageMeasurements'] = None - self._defaults['FetchMultiple']['currentMeasurements'] = None - self._defaults['FetchMultiple']['inCompliance'] = None - self._defaults['FetchMultiple']['actualCount'] = None - self._defaults['GetAttributeViBoolean'] = {} - self._defaults['GetAttributeViBoolean']['return'] = 0 - self._defaults['GetAttributeViBoolean']['attributeValue'] = None - self._defaults['GetAttributeViInt32'] = {} - self._defaults['GetAttributeViInt32']['return'] = 0 - self._defaults['GetAttributeViInt32']['attributeValue'] = None - self._defaults['GetAttributeViInt64'] = {} - self._defaults['GetAttributeViInt64']['return'] = 0 - self._defaults['GetAttributeViInt64']['attributeValue'] = None - self._defaults['GetAttributeViReal64'] = {} - self._defaults['GetAttributeViReal64']['return'] = 0 - self._defaults['GetAttributeViReal64']['attributeValue'] = None - self._defaults['GetAttributeViString'] = {} - self._defaults['GetAttributeViString']['return'] = 0 - self._defaults['GetAttributeViString']['attributeValue'] = None - self._defaults['GetChannelName'] = {} - self._defaults['GetChannelName']['return'] = 0 - self._defaults['GetChannelName']['channelName'] = None - self._defaults['GetChannelNameFromString'] = {} - self._defaults['GetChannelNameFromString']['return'] = 0 - self._defaults['GetChannelNameFromString']['channelName'] = None - self._defaults['GetError'] = {} - self._defaults['GetError']['return'] = 0 - self._defaults['GetError']['code'] = None - self._defaults['GetError']['description'] = None - self._defaults['GetExtCalLastDateAndTime'] = {} - self._defaults['GetExtCalLastDateAndTime']['return'] = 0 - self._defaults['GetExtCalLastDateAndTime']['year'] = None - self._defaults['GetExtCalLastDateAndTime']['month'] = None - self._defaults['GetExtCalLastDateAndTime']['day'] = None - self._defaults['GetExtCalLastDateAndTime']['hour'] = None - self._defaults['GetExtCalLastDateAndTime']['minute'] = None - self._defaults['GetExtCalLastTemp'] = {} - self._defaults['GetExtCalLastTemp']['return'] = 0 - self._defaults['GetExtCalLastTemp']['temperature'] = None - self._defaults['GetExtCalRecommendedInterval'] = {} - self._defaults['GetExtCalRecommendedInterval']['return'] = 0 - self._defaults['GetExtCalRecommendedInterval']['months'] = None - self._defaults['GetSelfCalLastDateAndTime'] = {} - self._defaults['GetSelfCalLastDateAndTime']['return'] = 0 - self._defaults['GetSelfCalLastDateAndTime']['year'] = None - self._defaults['GetSelfCalLastDateAndTime']['month'] = None - self._defaults['GetSelfCalLastDateAndTime']['day'] = None - self._defaults['GetSelfCalLastDateAndTime']['hour'] = None - self._defaults['GetSelfCalLastDateAndTime']['minute'] = None - self._defaults['GetSelfCalLastTemp'] = {} - self._defaults['GetSelfCalLastTemp']['return'] = 0 - self._defaults['GetSelfCalLastTemp']['temperature'] = None - self._defaults['ImportAttributeConfigurationBuffer'] = {} - self._defaults['ImportAttributeConfigurationBuffer']['return'] = 0 - self._defaults['ImportAttributeConfigurationFile'] = {} - self._defaults['ImportAttributeConfigurationFile']['return'] = 0 - self._defaults['InitializeWithChannels'] = {} - self._defaults['InitializeWithChannels']['return'] = 0 - self._defaults['InitializeWithChannels']['vi'] = None - self._defaults['InitializeWithIndependentChannels'] = {} - self._defaults['InitializeWithIndependentChannels']['return'] = 0 - self._defaults['InitializeWithIndependentChannels']['vi'] = None - self._defaults['InitiateWithChannels'] = {} - self._defaults['InitiateWithChannels']['return'] = 0 - self._defaults['LockSession'] = {} - self._defaults['LockSession']['return'] = 0 - self._defaults['LockSession']['callerHasLock'] = None - self._defaults['Measure'] = {} - self._defaults['Measure']['return'] = 0 - self._defaults['Measure']['measurement'] = None - self._defaults['MeasureMultiple'] = {} - self._defaults['MeasureMultiple']['return'] = 0 - self._defaults['MeasureMultiple']['voltageMeasurements'] = None - self._defaults['MeasureMultiple']['currentMeasurements'] = None - self._defaults['ParseChannelCount'] = {} - self._defaults['ParseChannelCount']['return'] = 0 - self._defaults['ParseChannelCount']['numberOfChannels'] = None - self._defaults['QueryInCompliance'] = {} - self._defaults['QueryInCompliance']['return'] = 0 - self._defaults['QueryInCompliance']['inCompliance'] = None - self._defaults['QueryLatchedOutputCutoffState'] = {} - self._defaults['QueryLatchedOutputCutoffState']['return'] = 0 - self._defaults['QueryLatchedOutputCutoffState']['outputCutoffState'] = None - self._defaults['QueryMaxCurrentLimit'] = {} - self._defaults['QueryMaxCurrentLimit']['return'] = 0 - self._defaults['QueryMaxCurrentLimit']['maxCurrentLimit'] = None - self._defaults['QueryMaxVoltageLevel'] = {} - self._defaults['QueryMaxVoltageLevel']['return'] = 0 - self._defaults['QueryMaxVoltageLevel']['maxVoltageLevel'] = None - self._defaults['QueryMinCurrentLimit'] = {} - self._defaults['QueryMinCurrentLimit']['return'] = 0 - self._defaults['QueryMinCurrentLimit']['minCurrentLimit'] = None - self._defaults['QueryOutputState'] = {} - self._defaults['QueryOutputState']['return'] = 0 - self._defaults['QueryOutputState']['inState'] = None - self._defaults['ReadCurrentTemperature'] = {} - self._defaults['ReadCurrentTemperature']['return'] = 0 - self._defaults['ReadCurrentTemperature']['temperature'] = None - self._defaults['ResetDevice'] = {} - self._defaults['ResetDevice']['return'] = 0 - self._defaults['ResetWithChannels'] = {} - self._defaults['ResetWithChannels']['return'] = 0 - self._defaults['ResetWithDefaults'] = {} - self._defaults['ResetWithDefaults']['return'] = 0 - self._defaults['SendSoftwareEdgeTriggerWithChannels'] = {} - self._defaults['SendSoftwareEdgeTriggerWithChannels']['return'] = 0 - self._defaults['SetAttributeViBoolean'] = {} - self._defaults['SetAttributeViBoolean']['return'] = 0 - self._defaults['SetAttributeViInt32'] = {} - self._defaults['SetAttributeViInt32']['return'] = 0 - self._defaults['SetAttributeViInt64'] = {} - self._defaults['SetAttributeViInt64']['return'] = 0 - self._defaults['SetAttributeViReal64'] = {} - self._defaults['SetAttributeViReal64']['return'] = 0 - self._defaults['SetAttributeViString'] = {} - self._defaults['SetAttributeViString']['return'] = 0 - self._defaults['SetSequence'] = {} - self._defaults['SetSequence']['return'] = 0 - self._defaults['UnlockSession'] = {} - self._defaults['UnlockSession']['return'] = 0 - self._defaults['UnlockSession']['callerHasLock'] = None - self._defaults['WaitForEventWithChannels'] = {} - self._defaults['WaitForEventWithChannels']['return'] = 0 - self._defaults['close'] = {} - self._defaults['close']['return'] = 0 - self._defaults['error_message'] = {} - self._defaults['error_message']['return'] = 0 - self._defaults['error_message']['errorMessage'] = None - self._defaults['self_test'] = {} - self._defaults['self_test']['return'] = 0 - self._defaults['self_test']['selfTestResult'] = None - self._defaults['self_test']['selfTestMessage'] = None + self._defaults["AbortWithChannels"] = {} + self._defaults["AbortWithChannels"]["return"] = 0 + self._defaults["CalSelfCalibrate"] = {} + self._defaults["CalSelfCalibrate"]["return"] = 0 + self._defaults["ClearLatchedOutputCutoffState"] = {} + self._defaults["ClearLatchedOutputCutoffState"]["return"] = 0 + self._defaults["CommitWithChannels"] = {} + self._defaults["CommitWithChannels"]["return"] = 0 + self._defaults["ConfigureApertureTime"] = {} + self._defaults["ConfigureApertureTime"]["return"] = 0 + self._defaults["CreateAdvancedSequenceCommitStepWithChannels"] = {} + self._defaults["CreateAdvancedSequenceCommitStepWithChannels"]["return"] = 0 + self._defaults["CreateAdvancedSequenceStepWithChannels"] = {} + self._defaults["CreateAdvancedSequenceStepWithChannels"]["return"] = 0 + self._defaults["CreateAdvancedSequenceWithChannels"] = {} + self._defaults["CreateAdvancedSequenceWithChannels"]["return"] = 0 + self._defaults["DeleteAdvancedSequenceWithChannels"] = {} + self._defaults["DeleteAdvancedSequenceWithChannels"]["return"] = 0 + self._defaults["Disable"] = {} + self._defaults["Disable"]["return"] = 0 + self._defaults["ExportAttributeConfigurationBuffer"] = {} + self._defaults["ExportAttributeConfigurationBuffer"]["return"] = 0 + self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] = None + self._defaults["ExportAttributeConfigurationFile"] = {} + self._defaults["ExportAttributeConfigurationFile"]["return"] = 0 + self._defaults["FancyInitialize"] = {} + self._defaults["FancyInitialize"]["return"] = 0 + self._defaults["FancyInitialize"]["vi"] = None + self._defaults["FetchMultiple"] = {} + self._defaults["FetchMultiple"]["return"] = 0 + self._defaults["FetchMultiple"]["voltageMeasurements"] = None + self._defaults["FetchMultiple"]["currentMeasurements"] = None + self._defaults["FetchMultiple"]["inCompliance"] = None + self._defaults["FetchMultiple"]["actualCount"] = None + self._defaults["GetAttributeViBoolean"] = {} + self._defaults["GetAttributeViBoolean"]["return"] = 0 + self._defaults["GetAttributeViBoolean"]["attributeValue"] = None + self._defaults["GetAttributeViInt32"] = {} + self._defaults["GetAttributeViInt32"]["return"] = 0 + self._defaults["GetAttributeViInt32"]["attributeValue"] = None + self._defaults["GetAttributeViInt64"] = {} + self._defaults["GetAttributeViInt64"]["return"] = 0 + self._defaults["GetAttributeViInt64"]["attributeValue"] = None + self._defaults["GetAttributeViReal64"] = {} + self._defaults["GetAttributeViReal64"]["return"] = 0 + self._defaults["GetAttributeViReal64"]["attributeValue"] = None + self._defaults["GetAttributeViString"] = {} + self._defaults["GetAttributeViString"]["return"] = 0 + self._defaults["GetAttributeViString"]["attributeValue"] = None + self._defaults["GetChannelName"] = {} + self._defaults["GetChannelName"]["return"] = 0 + self._defaults["GetChannelName"]["channelName"] = None + self._defaults["GetChannelNameFromString"] = {} + self._defaults["GetChannelNameFromString"]["return"] = 0 + self._defaults["GetChannelNameFromString"]["channelName"] = None + self._defaults["GetError"] = {} + self._defaults["GetError"]["return"] = 0 + self._defaults["GetError"]["code"] = None + self._defaults["GetError"]["description"] = None + self._defaults["GetExtCalLastDateAndTime"] = {} + self._defaults["GetExtCalLastDateAndTime"]["return"] = 0 + self._defaults["GetExtCalLastDateAndTime"]["year"] = None + self._defaults["GetExtCalLastDateAndTime"]["month"] = None + self._defaults["GetExtCalLastDateAndTime"]["day"] = None + self._defaults["GetExtCalLastDateAndTime"]["hour"] = None + self._defaults["GetExtCalLastDateAndTime"]["minute"] = None + self._defaults["GetExtCalLastTemp"] = {} + self._defaults["GetExtCalLastTemp"]["return"] = 0 + self._defaults["GetExtCalLastTemp"]["temperature"] = None + self._defaults["GetExtCalRecommendedInterval"] = {} + self._defaults["GetExtCalRecommendedInterval"]["return"] = 0 + self._defaults["GetExtCalRecommendedInterval"]["months"] = None + self._defaults["GetSelfCalLastDateAndTime"] = {} + self._defaults["GetSelfCalLastDateAndTime"]["return"] = 0 + self._defaults["GetSelfCalLastDateAndTime"]["year"] = None + self._defaults["GetSelfCalLastDateAndTime"]["month"] = None + self._defaults["GetSelfCalLastDateAndTime"]["day"] = None + self._defaults["GetSelfCalLastDateAndTime"]["hour"] = None + self._defaults["GetSelfCalLastDateAndTime"]["minute"] = None + self._defaults["GetSelfCalLastTemp"] = {} + self._defaults["GetSelfCalLastTemp"]["return"] = 0 + self._defaults["GetSelfCalLastTemp"]["temperature"] = None + self._defaults["ImportAttributeConfigurationBuffer"] = {} + self._defaults["ImportAttributeConfigurationBuffer"]["return"] = 0 + self._defaults["ImportAttributeConfigurationFile"] = {} + self._defaults["ImportAttributeConfigurationFile"]["return"] = 0 + self._defaults["InitializeWithChannels"] = {} + self._defaults["InitializeWithChannels"]["return"] = 0 + self._defaults["InitializeWithChannels"]["vi"] = None + self._defaults["InitializeWithIndependentChannels"] = {} + self._defaults["InitializeWithIndependentChannels"]["return"] = 0 + self._defaults["InitializeWithIndependentChannels"]["vi"] = None + self._defaults["InitiateWithChannels"] = {} + self._defaults["InitiateWithChannels"]["return"] = 0 + self._defaults["LockSession"] = {} + self._defaults["LockSession"]["return"] = 0 + self._defaults["LockSession"]["callerHasLock"] = None + self._defaults["Measure"] = {} + self._defaults["Measure"]["return"] = 0 + self._defaults["Measure"]["measurement"] = None + self._defaults["MeasureMultiple"] = {} + self._defaults["MeasureMultiple"]["return"] = 0 + self._defaults["MeasureMultiple"]["voltageMeasurements"] = None + self._defaults["MeasureMultiple"]["currentMeasurements"] = None + self._defaults["ParseChannelCount"] = {} + self._defaults["ParseChannelCount"]["return"] = 0 + self._defaults["ParseChannelCount"]["numberOfChannels"] = None + self._defaults["QueryInCompliance"] = {} + self._defaults["QueryInCompliance"]["return"] = 0 + self._defaults["QueryInCompliance"]["inCompliance"] = None + self._defaults["QueryLatchedOutputCutoffState"] = {} + self._defaults["QueryLatchedOutputCutoffState"]["return"] = 0 + self._defaults["QueryLatchedOutputCutoffState"]["outputCutoffState"] = None + self._defaults["QueryMaxCurrentLimit"] = {} + self._defaults["QueryMaxCurrentLimit"]["return"] = 0 + self._defaults["QueryMaxCurrentLimit"]["maxCurrentLimit"] = None + self._defaults["QueryMaxVoltageLevel"] = {} + self._defaults["QueryMaxVoltageLevel"]["return"] = 0 + self._defaults["QueryMaxVoltageLevel"]["maxVoltageLevel"] = None + self._defaults["QueryMinCurrentLimit"] = {} + self._defaults["QueryMinCurrentLimit"]["return"] = 0 + self._defaults["QueryMinCurrentLimit"]["minCurrentLimit"] = None + self._defaults["QueryOutputState"] = {} + self._defaults["QueryOutputState"]["return"] = 0 + self._defaults["QueryOutputState"]["inState"] = None + self._defaults["ReadCurrentTemperature"] = {} + self._defaults["ReadCurrentTemperature"]["return"] = 0 + self._defaults["ReadCurrentTemperature"]["temperature"] = None + self._defaults["ResetDevice"] = {} + self._defaults["ResetDevice"]["return"] = 0 + self._defaults["ResetWithChannels"] = {} + self._defaults["ResetWithChannels"]["return"] = 0 + self._defaults["ResetWithDefaults"] = {} + self._defaults["ResetWithDefaults"]["return"] = 0 + self._defaults["SendSoftwareEdgeTriggerWithChannels"] = {} + self._defaults["SendSoftwareEdgeTriggerWithChannels"]["return"] = 0 + self._defaults["SetAttributeViBoolean"] = {} + self._defaults["SetAttributeViBoolean"]["return"] = 0 + self._defaults["SetAttributeViInt32"] = {} + self._defaults["SetAttributeViInt32"]["return"] = 0 + self._defaults["SetAttributeViInt64"] = {} + self._defaults["SetAttributeViInt64"]["return"] = 0 + self._defaults["SetAttributeViReal64"] = {} + self._defaults["SetAttributeViReal64"]["return"] = 0 + self._defaults["SetAttributeViString"] = {} + self._defaults["SetAttributeViString"]["return"] = 0 + self._defaults["SetSequence"] = {} + self._defaults["SetSequence"]["return"] = 0 + self._defaults["UnlockSession"] = {} + self._defaults["UnlockSession"]["return"] = 0 + self._defaults["UnlockSession"]["callerHasLock"] = None + self._defaults["WaitForEventWithChannels"] = {} + self._defaults["WaitForEventWithChannels"]["return"] = 0 + self._defaults["close"] = {} + self._defaults["close"]["return"] = 0 + self._defaults["error_message"] = {} + self._defaults["error_message"]["return"] = 0 + self._defaults["error_message"]["errorMessage"] = None + self._defaults["self_test"] = {} + self._defaults["self_test"]["return"] = 0 + self._defaults["self_test"]["selfTestResult"] = None + self._defaults["self_test"]["selfTestMessage"] = None def __getitem__(self, func): return self._defaults[func] @@ -186,92 +186,142 @@ def __setitem__(self, func, val): self._defaults[func] = val def niDCPower_AbortWithChannels(self, vi, channel_name): # noqa: N802 - if self._defaults['AbortWithChannels']['return'] != 0: - return self._defaults['AbortWithChannels']['return'] - return self._defaults['AbortWithChannels']['return'] + if self._defaults["AbortWithChannels"]["return"] != 0: + return self._defaults["AbortWithChannels"]["return"] + return self._defaults["AbortWithChannels"]["return"] def niDCPower_CalSelfCalibrate(self, vi, channel_name): # noqa: N802 - if self._defaults['CalSelfCalibrate']['return'] != 0: - return self._defaults['CalSelfCalibrate']['return'] - return self._defaults['CalSelfCalibrate']['return'] + if self._defaults["CalSelfCalibrate"]["return"] != 0: + return self._defaults["CalSelfCalibrate"]["return"] + return self._defaults["CalSelfCalibrate"]["return"] - def niDCPower_ClearLatchedOutputCutoffState(self, vi, channel_name, output_cutoff_reason): # noqa: N802 - if self._defaults['ClearLatchedOutputCutoffState']['return'] != 0: - return self._defaults['ClearLatchedOutputCutoffState']['return'] - return self._defaults['ClearLatchedOutputCutoffState']['return'] + def niDCPower_ClearLatchedOutputCutoffState( + self, vi, channel_name, output_cutoff_reason + ): # noqa: N802 + if self._defaults["ClearLatchedOutputCutoffState"]["return"] != 0: + return self._defaults["ClearLatchedOutputCutoffState"]["return"] + return self._defaults["ClearLatchedOutputCutoffState"]["return"] def niDCPower_CommitWithChannels(self, vi, channel_name): # noqa: N802 - if self._defaults['CommitWithChannels']['return'] != 0: - return self._defaults['CommitWithChannels']['return'] - return self._defaults['CommitWithChannels']['return'] - - def niDCPower_ConfigureApertureTime(self, vi, channel_name, aperture_time, units): # noqa: N802 - if self._defaults['ConfigureApertureTime']['return'] != 0: - return self._defaults['ConfigureApertureTime']['return'] - return self._defaults['ConfigureApertureTime']['return'] - - def niDCPower_CreateAdvancedSequenceCommitStepWithChannels(self, vi, channel_name, set_as_active_step): # noqa: N802 - if self._defaults['CreateAdvancedSequenceCommitStepWithChannels']['return'] != 0: - return self._defaults['CreateAdvancedSequenceCommitStepWithChannels']['return'] - return self._defaults['CreateAdvancedSequenceCommitStepWithChannels']['return'] - - def niDCPower_CreateAdvancedSequenceStepWithChannels(self, vi, channel_name, set_as_active_step): # noqa: N802 - if self._defaults['CreateAdvancedSequenceStepWithChannels']['return'] != 0: - return self._defaults['CreateAdvancedSequenceStepWithChannels']['return'] - return self._defaults['CreateAdvancedSequenceStepWithChannels']['return'] - - def niDCPower_CreateAdvancedSequenceWithChannels(self, vi, channel_name, sequence_name, attribute_id_count, attribute_ids, set_as_active_sequence): # noqa: N802 - if self._defaults['CreateAdvancedSequenceWithChannels']['return'] != 0: - return self._defaults['CreateAdvancedSequenceWithChannels']['return'] - return self._defaults['CreateAdvancedSequenceWithChannels']['return'] - - def niDCPower_DeleteAdvancedSequenceWithChannels(self, vi, channel_name, sequence_name): # noqa: N802 - if self._defaults['DeleteAdvancedSequenceWithChannels']['return'] != 0: - return self._defaults['DeleteAdvancedSequenceWithChannels']['return'] - return self._defaults['DeleteAdvancedSequenceWithChannels']['return'] + if self._defaults["CommitWithChannels"]["return"] != 0: + return self._defaults["CommitWithChannels"]["return"] + return self._defaults["CommitWithChannels"]["return"] + + def niDCPower_ConfigureApertureTime( + self, vi, channel_name, aperture_time, units + ): # noqa: N802 + if self._defaults["ConfigureApertureTime"]["return"] != 0: + return self._defaults["ConfigureApertureTime"]["return"] + return self._defaults["ConfigureApertureTime"]["return"] + + def niDCPower_CreateAdvancedSequenceCommitStepWithChannels( + self, vi, channel_name, set_as_active_step + ): # noqa: N802 + if ( + self._defaults["CreateAdvancedSequenceCommitStepWithChannels"]["return"] + != 0 + ): + return self._defaults["CreateAdvancedSequenceCommitStepWithChannels"][ + "return" + ] + return self._defaults["CreateAdvancedSequenceCommitStepWithChannels"]["return"] + + def niDCPower_CreateAdvancedSequenceStepWithChannels( + self, vi, channel_name, set_as_active_step + ): # noqa: N802 + if self._defaults["CreateAdvancedSequenceStepWithChannels"]["return"] != 0: + return self._defaults["CreateAdvancedSequenceStepWithChannels"]["return"] + return self._defaults["CreateAdvancedSequenceStepWithChannels"]["return"] + + def niDCPower_CreateAdvancedSequenceWithChannels( + self, + vi, + channel_name, + sequence_name, + attribute_id_count, + attribute_ids, + set_as_active_sequence, + ): # noqa: N802 + if self._defaults["CreateAdvancedSequenceWithChannels"]["return"] != 0: + return self._defaults["CreateAdvancedSequenceWithChannels"]["return"] + return self._defaults["CreateAdvancedSequenceWithChannels"]["return"] + + def niDCPower_DeleteAdvancedSequenceWithChannels( + self, vi, channel_name, sequence_name + ): # noqa: N802 + if self._defaults["DeleteAdvancedSequenceWithChannels"]["return"] != 0: + return self._defaults["DeleteAdvancedSequenceWithChannels"]["return"] + return self._defaults["DeleteAdvancedSequenceWithChannels"]["return"] def niDCPower_Disable(self, vi): # noqa: N802 - if self._defaults['Disable']['return'] != 0: - return self._defaults['Disable']['return'] - return self._defaults['Disable']['return'] - - def niDCPower_ExportAttributeConfigurationBuffer(self, vi, size, configuration): # noqa: N802 - if self._defaults['ExportAttributeConfigurationBuffer']['return'] != 0: - return self._defaults['ExportAttributeConfigurationBuffer']['return'] - if self._defaults['ExportAttributeConfigurationBuffer']['configuration'] is None: - raise MockFunctionCallError("niDCPower_ExportAttributeConfigurationBuffer", param='configuration') + if self._defaults["Disable"]["return"] != 0: + return self._defaults["Disable"]["return"] + return self._defaults["Disable"]["return"] + + def niDCPower_ExportAttributeConfigurationBuffer( + self, vi, size, configuration + ): # noqa: N802 + if self._defaults["ExportAttributeConfigurationBuffer"]["return"] != 0: + return self._defaults["ExportAttributeConfigurationBuffer"]["return"] + if ( + self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] + is None + ): + raise MockFunctionCallError( + "niDCPower_ExportAttributeConfigurationBuffer", param="configuration" + ) if size.value == 0: - return len(self._defaults['ExportAttributeConfigurationBuffer']['configuration']) + return len( + self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] + ) try: configuration_ref = configuration.contents except AttributeError: configuration_ref = configuration - for i in range(len(self._defaults['ExportAttributeConfigurationBuffer']['configuration'])): - configuration_ref[i] = self._defaults['ExportAttributeConfigurationBuffer']['configuration'][i] - return self._defaults['ExportAttributeConfigurationBuffer']['return'] + for i in range( + len(self._defaults["ExportAttributeConfigurationBuffer"]["configuration"]) + ): + configuration_ref[i] = self._defaults["ExportAttributeConfigurationBuffer"][ + "configuration" + ][i] + return self._defaults["ExportAttributeConfigurationBuffer"]["return"] def niDCPower_ExportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 - if self._defaults['ExportAttributeConfigurationFile']['return'] != 0: - return self._defaults['ExportAttributeConfigurationFile']['return'] - return self._defaults['ExportAttributeConfigurationFile']['return'] - - def niDCPower_FancyInitialize(self, resource_name, channels, reset, option_string, vi, independent_channels): # noqa: N802 - if self._defaults['FancyInitialize']['return'] != 0: - return self._defaults['FancyInitialize']['return'] + if self._defaults["ExportAttributeConfigurationFile"]["return"] != 0: + return self._defaults["ExportAttributeConfigurationFile"]["return"] + return self._defaults["ExportAttributeConfigurationFile"]["return"] + + def niDCPower_FancyInitialize( + self, resource_name, channels, reset, option_string, vi, independent_channels + ): # noqa: N802 + if self._defaults["FancyInitialize"]["return"] != 0: + return self._defaults["FancyInitialize"]["return"] # vi - if self._defaults['FancyInitialize']['vi'] is None: - raise MockFunctionCallError("niDCPower_FancyInitialize", param='vi') + if self._defaults["FancyInitialize"]["vi"] is None: + raise MockFunctionCallError("niDCPower_FancyInitialize", param="vi") if vi is not None: - vi.contents.value = self._defaults['FancyInitialize']['vi'] - return self._defaults['FancyInitialize']['return'] - - def niDCPower_FetchMultiple(self, vi, channel_name, timeout, count, voltage_measurements, current_measurements, in_compliance, actual_count): # noqa: N802 - if self._defaults['FetchMultiple']['return'] != 0: - return self._defaults['FetchMultiple']['return'] + vi.contents.value = self._defaults["FancyInitialize"]["vi"] + return self._defaults["FancyInitialize"]["return"] + + def niDCPower_FetchMultiple( + self, + vi, + channel_name, + timeout, + count, + voltage_measurements, + current_measurements, + in_compliance, + actual_count, + ): # noqa: N802 + if self._defaults["FetchMultiple"]["return"] != 0: + return self._defaults["FetchMultiple"]["return"] # voltage_measurements - if self._defaults['FetchMultiple']['voltageMeasurements'] is None: - raise MockFunctionCallError("niDCPower_FetchMultiple", param='voltageMeasurements') - test_value = self._defaults['FetchMultiple']['voltageMeasurements'] + if self._defaults["FetchMultiple"]["voltageMeasurements"] is None: + raise MockFunctionCallError( + "niDCPower_FetchMultiple", param="voltageMeasurements" + ) + test_value = self._defaults["FetchMultiple"]["voltageMeasurements"] try: voltage_measurements_ref = voltage_measurements.contents except AttributeError: @@ -280,9 +330,11 @@ def niDCPower_FetchMultiple(self, vi, channel_name, timeout, count, voltage_meas for i in range(len(test_value)): voltage_measurements_ref[i] = test_value[i] # current_measurements - if self._defaults['FetchMultiple']['currentMeasurements'] is None: - raise MockFunctionCallError("niDCPower_FetchMultiple", param='currentMeasurements') - test_value = self._defaults['FetchMultiple']['currentMeasurements'] + if self._defaults["FetchMultiple"]["currentMeasurements"] is None: + raise MockFunctionCallError( + "niDCPower_FetchMultiple", param="currentMeasurements" + ) + test_value = self._defaults["FetchMultiple"]["currentMeasurements"] try: current_measurements_ref = current_measurements.contents except AttributeError: @@ -291,9 +343,9 @@ def niDCPower_FetchMultiple(self, vi, channel_name, timeout, count, voltage_meas for i in range(len(test_value)): current_measurements_ref[i] = test_value[i] # in_compliance - if self._defaults['FetchMultiple']['inCompliance'] is None: - raise MockFunctionCallError("niDCPower_FetchMultiple", param='inCompliance') - test_value = self._defaults['FetchMultiple']['inCompliance'] + if self._defaults["FetchMultiple"]["inCompliance"] is None: + raise MockFunctionCallError("niDCPower_FetchMultiple", param="inCompliance") + test_value = self._defaults["FetchMultiple"]["inCompliance"] try: in_compliance_ref = in_compliance.contents except AttributeError: @@ -302,249 +354,345 @@ def niDCPower_FetchMultiple(self, vi, channel_name, timeout, count, voltage_meas for i in range(len(test_value)): in_compliance_ref[i] = test_value[i] # actual_count - if self._defaults['FetchMultiple']['actualCount'] is None: - raise MockFunctionCallError("niDCPower_FetchMultiple", param='actualCount') + if self._defaults["FetchMultiple"]["actualCount"] is None: + raise MockFunctionCallError("niDCPower_FetchMultiple", param="actualCount") if actual_count is not None: - actual_count.contents.value = self._defaults['FetchMultiple']['actualCount'] - return self._defaults['FetchMultiple']['return'] - - def niDCPower_GetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['GetAttributeViBoolean']['return'] != 0: - return self._defaults['GetAttributeViBoolean']['return'] + actual_count.contents.value = self._defaults["FetchMultiple"]["actualCount"] + return self._defaults["FetchMultiple"]["return"] + + def niDCPower_GetAttributeViBoolean( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["GetAttributeViBoolean"]["return"] != 0: + return self._defaults["GetAttributeViBoolean"]["return"] # attribute_value - if self._defaults['GetAttributeViBoolean']['attributeValue'] is None: - raise MockFunctionCallError("niDCPower_GetAttributeViBoolean", param='attributeValue') + if self._defaults["GetAttributeViBoolean"]["attributeValue"] is None: + raise MockFunctionCallError( + "niDCPower_GetAttributeViBoolean", param="attributeValue" + ) if attribute_value is not None: - attribute_value.contents.value = self._defaults['GetAttributeViBoolean']['attributeValue'] - return self._defaults['GetAttributeViBoolean']['return'] - - def niDCPower_GetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['GetAttributeViInt32']['return'] != 0: - return self._defaults['GetAttributeViInt32']['return'] + attribute_value.contents.value = self._defaults["GetAttributeViBoolean"][ + "attributeValue" + ] + return self._defaults["GetAttributeViBoolean"]["return"] + + def niDCPower_GetAttributeViInt32( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["GetAttributeViInt32"]["return"] != 0: + return self._defaults["GetAttributeViInt32"]["return"] # attribute_value - if self._defaults['GetAttributeViInt32']['attributeValue'] is None: - raise MockFunctionCallError("niDCPower_GetAttributeViInt32", param='attributeValue') + if self._defaults["GetAttributeViInt32"]["attributeValue"] is None: + raise MockFunctionCallError( + "niDCPower_GetAttributeViInt32", param="attributeValue" + ) if attribute_value is not None: - attribute_value.contents.value = self._defaults['GetAttributeViInt32']['attributeValue'] - return self._defaults['GetAttributeViInt32']['return'] - - def niDCPower_GetAttributeViInt64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['GetAttributeViInt64']['return'] != 0: - return self._defaults['GetAttributeViInt64']['return'] + attribute_value.contents.value = self._defaults["GetAttributeViInt32"][ + "attributeValue" + ] + return self._defaults["GetAttributeViInt32"]["return"] + + def niDCPower_GetAttributeViInt64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["GetAttributeViInt64"]["return"] != 0: + return self._defaults["GetAttributeViInt64"]["return"] # attribute_value - if self._defaults['GetAttributeViInt64']['attributeValue'] is None: - raise MockFunctionCallError("niDCPower_GetAttributeViInt64", param='attributeValue') + if self._defaults["GetAttributeViInt64"]["attributeValue"] is None: + raise MockFunctionCallError( + "niDCPower_GetAttributeViInt64", param="attributeValue" + ) if attribute_value is not None: - attribute_value.contents.value = self._defaults['GetAttributeViInt64']['attributeValue'] - return self._defaults['GetAttributeViInt64']['return'] - - def niDCPower_GetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['GetAttributeViReal64']['return'] != 0: - return self._defaults['GetAttributeViReal64']['return'] + attribute_value.contents.value = self._defaults["GetAttributeViInt64"][ + "attributeValue" + ] + return self._defaults["GetAttributeViInt64"]["return"] + + def niDCPower_GetAttributeViReal64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["GetAttributeViReal64"]["return"] != 0: + return self._defaults["GetAttributeViReal64"]["return"] # attribute_value - if self._defaults['GetAttributeViReal64']['attributeValue'] is None: - raise MockFunctionCallError("niDCPower_GetAttributeViReal64", param='attributeValue') + if self._defaults["GetAttributeViReal64"]["attributeValue"] is None: + raise MockFunctionCallError( + "niDCPower_GetAttributeViReal64", param="attributeValue" + ) if attribute_value is not None: - attribute_value.contents.value = self._defaults['GetAttributeViReal64']['attributeValue'] - return self._defaults['GetAttributeViReal64']['return'] - - def niDCPower_GetAttributeViString(self, vi, channel_name, attribute_id, buffer_size, attribute_value): # noqa: N802 - if self._defaults['GetAttributeViString']['return'] != 0: - return self._defaults['GetAttributeViString']['return'] - if self._defaults['GetAttributeViString']['attributeValue'] is None: - raise MockFunctionCallError("niDCPower_GetAttributeViString", param='attributeValue') + attribute_value.contents.value = self._defaults["GetAttributeViReal64"][ + "attributeValue" + ] + return self._defaults["GetAttributeViReal64"]["return"] + + def niDCPower_GetAttributeViString( + self, vi, channel_name, attribute_id, buffer_size, attribute_value + ): # noqa: N802 + if self._defaults["GetAttributeViString"]["return"] != 0: + return self._defaults["GetAttributeViString"]["return"] + if self._defaults["GetAttributeViString"]["attributeValue"] is None: + raise MockFunctionCallError( + "niDCPower_GetAttributeViString", param="attributeValue" + ) if buffer_size.value == 0: - return len(self._defaults['GetAttributeViString']['attributeValue']) - attribute_value.value = self._defaults['GetAttributeViString']['attributeValue'].encode('ascii') - return self._defaults['GetAttributeViString']['return'] - - def niDCPower_GetChannelName(self, vi, index, buffer_size, channel_name): # noqa: N802 - if self._defaults['GetChannelName']['return'] != 0: - return self._defaults['GetChannelName']['return'] - if self._defaults['GetChannelName']['channelName'] is None: - raise MockFunctionCallError("niDCPower_GetChannelName", param='channelName') + return len(self._defaults["GetAttributeViString"]["attributeValue"]) + attribute_value.value = self._defaults["GetAttributeViString"][ + "attributeValue" + ].encode("ascii") + return self._defaults["GetAttributeViString"]["return"] + + def niDCPower_GetChannelName( + self, vi, index, buffer_size, channel_name + ): # noqa: N802 + if self._defaults["GetChannelName"]["return"] != 0: + return self._defaults["GetChannelName"]["return"] + if self._defaults["GetChannelName"]["channelName"] is None: + raise MockFunctionCallError("niDCPower_GetChannelName", param="channelName") if buffer_size.value == 0: - return len(self._defaults['GetChannelName']['channelName']) - channel_name.value = self._defaults['GetChannelName']['channelName'].encode('ascii') - return self._defaults['GetChannelName']['return'] - - def niDCPower_GetChannelNameFromString(self, vi, indices, buffer_size, names): # noqa: N802 - if self._defaults['GetChannelNameFromString']['return'] != 0: - return self._defaults['GetChannelNameFromString']['return'] - if self._defaults['GetChannelNameFromString']['channelName'] is None: - raise MockFunctionCallError("niDCPower_GetChannelNameFromString", param='channelName') + return len(self._defaults["GetChannelName"]["channelName"]) + channel_name.value = self._defaults["GetChannelName"]["channelName"].encode( + "ascii" + ) + return self._defaults["GetChannelName"]["return"] + + def niDCPower_GetChannelNameFromString( + self, vi, indices, buffer_size, names + ): # noqa: N802 + if self._defaults["GetChannelNameFromString"]["return"] != 0: + return self._defaults["GetChannelNameFromString"]["return"] + if self._defaults["GetChannelNameFromString"]["channelName"] is None: + raise MockFunctionCallError( + "niDCPower_GetChannelNameFromString", param="channelName" + ) if buffer_size.value == 0: - return len(self._defaults['GetChannelNameFromString']['channelName']) - names.value = self._defaults['GetChannelNameFromString']['channelName'].encode('ascii') - return self._defaults['GetChannelNameFromString']['return'] + return len(self._defaults["GetChannelNameFromString"]["channelName"]) + names.value = self._defaults["GetChannelNameFromString"]["channelName"].encode( + "ascii" + ) + return self._defaults["GetChannelNameFromString"]["return"] def niDCPower_GetError(self, vi, code, buffer_size, description): # noqa: N802 - if self._defaults['GetError']['return'] != 0: - return self._defaults['GetError']['return'] + if self._defaults["GetError"]["return"] != 0: + return self._defaults["GetError"]["return"] # code - if self._defaults['GetError']['code'] is None: - raise MockFunctionCallError("niDCPower_GetError", param='code') + if self._defaults["GetError"]["code"] is None: + raise MockFunctionCallError("niDCPower_GetError", param="code") if code is not None: - code.contents.value = self._defaults['GetError']['code'] - if self._defaults['GetError']['description'] is None: - raise MockFunctionCallError("niDCPower_GetError", param='description') + code.contents.value = self._defaults["GetError"]["code"] + if self._defaults["GetError"]["description"] is None: + raise MockFunctionCallError("niDCPower_GetError", param="description") if buffer_size.value == 0: - return len(self._defaults['GetError']['description']) - description.value = self._defaults['GetError']['description'].encode('ascii') - return self._defaults['GetError']['return'] - - def niDCPower_GetExtCalLastDateAndTime(self, vi, year, month, day, hour, minute): # noqa: N802 - if self._defaults['GetExtCalLastDateAndTime']['return'] != 0: - return self._defaults['GetExtCalLastDateAndTime']['return'] + return len(self._defaults["GetError"]["description"]) + description.value = self._defaults["GetError"]["description"].encode("ascii") + return self._defaults["GetError"]["return"] + + def niDCPower_GetExtCalLastDateAndTime( + self, vi, year, month, day, hour, minute + ): # noqa: N802 + if self._defaults["GetExtCalLastDateAndTime"]["return"] != 0: + return self._defaults["GetExtCalLastDateAndTime"]["return"] # year - if self._defaults['GetExtCalLastDateAndTime']['year'] is None: - raise MockFunctionCallError("niDCPower_GetExtCalLastDateAndTime", param='year') + if self._defaults["GetExtCalLastDateAndTime"]["year"] is None: + raise MockFunctionCallError( + "niDCPower_GetExtCalLastDateAndTime", param="year" + ) if year is not None: - year.contents.value = self._defaults['GetExtCalLastDateAndTime']['year'] + year.contents.value = self._defaults["GetExtCalLastDateAndTime"]["year"] # month - if self._defaults['GetExtCalLastDateAndTime']['month'] is None: - raise MockFunctionCallError("niDCPower_GetExtCalLastDateAndTime", param='month') + if self._defaults["GetExtCalLastDateAndTime"]["month"] is None: + raise MockFunctionCallError( + "niDCPower_GetExtCalLastDateAndTime", param="month" + ) if month is not None: - month.contents.value = self._defaults['GetExtCalLastDateAndTime']['month'] + month.contents.value = self._defaults["GetExtCalLastDateAndTime"]["month"] # day - if self._defaults['GetExtCalLastDateAndTime']['day'] is None: - raise MockFunctionCallError("niDCPower_GetExtCalLastDateAndTime", param='day') + if self._defaults["GetExtCalLastDateAndTime"]["day"] is None: + raise MockFunctionCallError( + "niDCPower_GetExtCalLastDateAndTime", param="day" + ) if day is not None: - day.contents.value = self._defaults['GetExtCalLastDateAndTime']['day'] + day.contents.value = self._defaults["GetExtCalLastDateAndTime"]["day"] # hour - if self._defaults['GetExtCalLastDateAndTime']['hour'] is None: - raise MockFunctionCallError("niDCPower_GetExtCalLastDateAndTime", param='hour') + if self._defaults["GetExtCalLastDateAndTime"]["hour"] is None: + raise MockFunctionCallError( + "niDCPower_GetExtCalLastDateAndTime", param="hour" + ) if hour is not None: - hour.contents.value = self._defaults['GetExtCalLastDateAndTime']['hour'] + hour.contents.value = self._defaults["GetExtCalLastDateAndTime"]["hour"] # minute - if self._defaults['GetExtCalLastDateAndTime']['minute'] is None: - raise MockFunctionCallError("niDCPower_GetExtCalLastDateAndTime", param='minute') + if self._defaults["GetExtCalLastDateAndTime"]["minute"] is None: + raise MockFunctionCallError( + "niDCPower_GetExtCalLastDateAndTime", param="minute" + ) if minute is not None: - minute.contents.value = self._defaults['GetExtCalLastDateAndTime']['minute'] - return self._defaults['GetExtCalLastDateAndTime']['return'] + minute.contents.value = self._defaults["GetExtCalLastDateAndTime"]["minute"] + return self._defaults["GetExtCalLastDateAndTime"]["return"] def niDCPower_GetExtCalLastTemp(self, vi, temperature): # noqa: N802 - if self._defaults['GetExtCalLastTemp']['return'] != 0: - return self._defaults['GetExtCalLastTemp']['return'] + if self._defaults["GetExtCalLastTemp"]["return"] != 0: + return self._defaults["GetExtCalLastTemp"]["return"] # temperature - if self._defaults['GetExtCalLastTemp']['temperature'] is None: - raise MockFunctionCallError("niDCPower_GetExtCalLastTemp", param='temperature') + if self._defaults["GetExtCalLastTemp"]["temperature"] is None: + raise MockFunctionCallError( + "niDCPower_GetExtCalLastTemp", param="temperature" + ) if temperature is not None: - temperature.contents.value = self._defaults['GetExtCalLastTemp']['temperature'] - return self._defaults['GetExtCalLastTemp']['return'] + temperature.contents.value = self._defaults["GetExtCalLastTemp"][ + "temperature" + ] + return self._defaults["GetExtCalLastTemp"]["return"] def niDCPower_GetExtCalRecommendedInterval(self, vi, months): # noqa: N802 - if self._defaults['GetExtCalRecommendedInterval']['return'] != 0: - return self._defaults['GetExtCalRecommendedInterval']['return'] + if self._defaults["GetExtCalRecommendedInterval"]["return"] != 0: + return self._defaults["GetExtCalRecommendedInterval"]["return"] # months - if self._defaults['GetExtCalRecommendedInterval']['months'] is None: - raise MockFunctionCallError("niDCPower_GetExtCalRecommendedInterval", param='months') + if self._defaults["GetExtCalRecommendedInterval"]["months"] is None: + raise MockFunctionCallError( + "niDCPower_GetExtCalRecommendedInterval", param="months" + ) if months is not None: - months.contents.value = self._defaults['GetExtCalRecommendedInterval']['months'] - return self._defaults['GetExtCalRecommendedInterval']['return'] - - def niDCPower_GetSelfCalLastDateAndTime(self, vi, year, month, day, hour, minute): # noqa: N802 - if self._defaults['GetSelfCalLastDateAndTime']['return'] != 0: - return self._defaults['GetSelfCalLastDateAndTime']['return'] + months.contents.value = self._defaults["GetExtCalRecommendedInterval"][ + "months" + ] + return self._defaults["GetExtCalRecommendedInterval"]["return"] + + def niDCPower_GetSelfCalLastDateAndTime( + self, vi, year, month, day, hour, minute + ): # noqa: N802 + if self._defaults["GetSelfCalLastDateAndTime"]["return"] != 0: + return self._defaults["GetSelfCalLastDateAndTime"]["return"] # year - if self._defaults['GetSelfCalLastDateAndTime']['year'] is None: - raise MockFunctionCallError("niDCPower_GetSelfCalLastDateAndTime", param='year') + if self._defaults["GetSelfCalLastDateAndTime"]["year"] is None: + raise MockFunctionCallError( + "niDCPower_GetSelfCalLastDateAndTime", param="year" + ) if year is not None: - year.contents.value = self._defaults['GetSelfCalLastDateAndTime']['year'] + year.contents.value = self._defaults["GetSelfCalLastDateAndTime"]["year"] # month - if self._defaults['GetSelfCalLastDateAndTime']['month'] is None: - raise MockFunctionCallError("niDCPower_GetSelfCalLastDateAndTime", param='month') + if self._defaults["GetSelfCalLastDateAndTime"]["month"] is None: + raise MockFunctionCallError( + "niDCPower_GetSelfCalLastDateAndTime", param="month" + ) if month is not None: - month.contents.value = self._defaults['GetSelfCalLastDateAndTime']['month'] + month.contents.value = self._defaults["GetSelfCalLastDateAndTime"]["month"] # day - if self._defaults['GetSelfCalLastDateAndTime']['day'] is None: - raise MockFunctionCallError("niDCPower_GetSelfCalLastDateAndTime", param='day') + if self._defaults["GetSelfCalLastDateAndTime"]["day"] is None: + raise MockFunctionCallError( + "niDCPower_GetSelfCalLastDateAndTime", param="day" + ) if day is not None: - day.contents.value = self._defaults['GetSelfCalLastDateAndTime']['day'] + day.contents.value = self._defaults["GetSelfCalLastDateAndTime"]["day"] # hour - if self._defaults['GetSelfCalLastDateAndTime']['hour'] is None: - raise MockFunctionCallError("niDCPower_GetSelfCalLastDateAndTime", param='hour') + if self._defaults["GetSelfCalLastDateAndTime"]["hour"] is None: + raise MockFunctionCallError( + "niDCPower_GetSelfCalLastDateAndTime", param="hour" + ) if hour is not None: - hour.contents.value = self._defaults['GetSelfCalLastDateAndTime']['hour'] + hour.contents.value = self._defaults["GetSelfCalLastDateAndTime"]["hour"] # minute - if self._defaults['GetSelfCalLastDateAndTime']['minute'] is None: - raise MockFunctionCallError("niDCPower_GetSelfCalLastDateAndTime", param='minute') + if self._defaults["GetSelfCalLastDateAndTime"]["minute"] is None: + raise MockFunctionCallError( + "niDCPower_GetSelfCalLastDateAndTime", param="minute" + ) if minute is not None: - minute.contents.value = self._defaults['GetSelfCalLastDateAndTime']['minute'] - return self._defaults['GetSelfCalLastDateAndTime']['return'] + minute.contents.value = self._defaults["GetSelfCalLastDateAndTime"][ + "minute" + ] + return self._defaults["GetSelfCalLastDateAndTime"]["return"] def niDCPower_GetSelfCalLastTemp(self, vi, temperature): # noqa: N802 - if self._defaults['GetSelfCalLastTemp']['return'] != 0: - return self._defaults['GetSelfCalLastTemp']['return'] + if self._defaults["GetSelfCalLastTemp"]["return"] != 0: + return self._defaults["GetSelfCalLastTemp"]["return"] # temperature - if self._defaults['GetSelfCalLastTemp']['temperature'] is None: - raise MockFunctionCallError("niDCPower_GetSelfCalLastTemp", param='temperature') + if self._defaults["GetSelfCalLastTemp"]["temperature"] is None: + raise MockFunctionCallError( + "niDCPower_GetSelfCalLastTemp", param="temperature" + ) if temperature is not None: - temperature.contents.value = self._defaults['GetSelfCalLastTemp']['temperature'] - return self._defaults['GetSelfCalLastTemp']['return'] - - def niDCPower_ImportAttributeConfigurationBuffer(self, vi, size, configuration): # noqa: N802 - if self._defaults['ImportAttributeConfigurationBuffer']['return'] != 0: - return self._defaults['ImportAttributeConfigurationBuffer']['return'] - return self._defaults['ImportAttributeConfigurationBuffer']['return'] + temperature.contents.value = self._defaults["GetSelfCalLastTemp"][ + "temperature" + ] + return self._defaults["GetSelfCalLastTemp"]["return"] + + def niDCPower_ImportAttributeConfigurationBuffer( + self, vi, size, configuration + ): # noqa: N802 + if self._defaults["ImportAttributeConfigurationBuffer"]["return"] != 0: + return self._defaults["ImportAttributeConfigurationBuffer"]["return"] + return self._defaults["ImportAttributeConfigurationBuffer"]["return"] def niDCPower_ImportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 - if self._defaults['ImportAttributeConfigurationFile']['return'] != 0: - return self._defaults['ImportAttributeConfigurationFile']['return'] - return self._defaults['ImportAttributeConfigurationFile']['return'] - - def niDCPower_InitializeWithChannels(self, resource_name, channels, reset, option_string, vi): # noqa: N802 - if self._defaults['InitializeWithChannels']['return'] != 0: - return self._defaults['InitializeWithChannels']['return'] + if self._defaults["ImportAttributeConfigurationFile"]["return"] != 0: + return self._defaults["ImportAttributeConfigurationFile"]["return"] + return self._defaults["ImportAttributeConfigurationFile"]["return"] + + def niDCPower_InitializeWithChannels( + self, resource_name, channels, reset, option_string, vi + ): # noqa: N802 + if self._defaults["InitializeWithChannels"]["return"] != 0: + return self._defaults["InitializeWithChannels"]["return"] # vi - if self._defaults['InitializeWithChannels']['vi'] is None: - raise MockFunctionCallError("niDCPower_InitializeWithChannels", param='vi') + if self._defaults["InitializeWithChannels"]["vi"] is None: + raise MockFunctionCallError("niDCPower_InitializeWithChannels", param="vi") if vi is not None: - vi.contents.value = self._defaults['InitializeWithChannels']['vi'] - return self._defaults['InitializeWithChannels']['return'] - - def niDCPower_InitializeWithIndependentChannels(self, resource_name, reset, option_string, vi): # noqa: N802 - if self._defaults['InitializeWithIndependentChannels']['return'] != 0: - return self._defaults['InitializeWithIndependentChannels']['return'] + vi.contents.value = self._defaults["InitializeWithChannels"]["vi"] + return self._defaults["InitializeWithChannels"]["return"] + + def niDCPower_InitializeWithIndependentChannels( + self, resource_name, reset, option_string, vi + ): # noqa: N802 + if self._defaults["InitializeWithIndependentChannels"]["return"] != 0: + return self._defaults["InitializeWithIndependentChannels"]["return"] # vi - if self._defaults['InitializeWithIndependentChannels']['vi'] is None: - raise MockFunctionCallError("niDCPower_InitializeWithIndependentChannels", param='vi') + if self._defaults["InitializeWithIndependentChannels"]["vi"] is None: + raise MockFunctionCallError( + "niDCPower_InitializeWithIndependentChannels", param="vi" + ) if vi is not None: - vi.contents.value = self._defaults['InitializeWithIndependentChannels']['vi'] - return self._defaults['InitializeWithIndependentChannels']['return'] + vi.contents.value = self._defaults["InitializeWithIndependentChannels"][ + "vi" + ] + return self._defaults["InitializeWithIndependentChannels"]["return"] def niDCPower_InitiateWithChannels(self, vi, channel_name): # noqa: N802 - if self._defaults['InitiateWithChannels']['return'] != 0: - return self._defaults['InitiateWithChannels']['return'] - return self._defaults['InitiateWithChannels']['return'] + if self._defaults["InitiateWithChannels"]["return"] != 0: + return self._defaults["InitiateWithChannels"]["return"] + return self._defaults["InitiateWithChannels"]["return"] def niDCPower_LockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults['LockSession']['return'] != 0: - return self._defaults['LockSession']['return'] + if self._defaults["LockSession"]["return"] != 0: + return self._defaults["LockSession"]["return"] # caller_has_lock - if self._defaults['LockSession']['callerHasLock'] is None: - raise MockFunctionCallError("niDCPower_LockSession", param='callerHasLock') + if self._defaults["LockSession"]["callerHasLock"] is None: + raise MockFunctionCallError("niDCPower_LockSession", param="callerHasLock") if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults['LockSession']['callerHasLock'] - return self._defaults['LockSession']['return'] - - def niDCPower_Measure(self, vi, channel_name, measurement_type, measurement): # noqa: N802 - if self._defaults['Measure']['return'] != 0: - return self._defaults['Measure']['return'] + caller_has_lock.contents.value = self._defaults["LockSession"][ + "callerHasLock" + ] + return self._defaults["LockSession"]["return"] + + def niDCPower_Measure( + self, vi, channel_name, measurement_type, measurement + ): # noqa: N802 + if self._defaults["Measure"]["return"] != 0: + return self._defaults["Measure"]["return"] # measurement - if self._defaults['Measure']['measurement'] is None: - raise MockFunctionCallError("niDCPower_Measure", param='measurement') + if self._defaults["Measure"]["measurement"] is None: + raise MockFunctionCallError("niDCPower_Measure", param="measurement") if measurement is not None: - measurement.contents.value = self._defaults['Measure']['measurement'] - return self._defaults['Measure']['return'] - - def niDCPower_MeasureMultiple(self, vi, channel_name, voltage_measurements, current_measurements): # noqa: N802 - if self._defaults['MeasureMultiple']['return'] != 0: - return self._defaults['MeasureMultiple']['return'] + measurement.contents.value = self._defaults["Measure"]["measurement"] + return self._defaults["Measure"]["return"] + + def niDCPower_MeasureMultiple( + self, vi, channel_name, voltage_measurements, current_measurements + ): # noqa: N802 + if self._defaults["MeasureMultiple"]["return"] != 0: + return self._defaults["MeasureMultiple"]["return"] # voltage_measurements - if self._defaults['MeasureMultiple']['voltageMeasurements'] is None: - raise MockFunctionCallError("niDCPower_MeasureMultiple", param='voltageMeasurements') - test_value = self._defaults['MeasureMultiple']['voltageMeasurements'] + if self._defaults["MeasureMultiple"]["voltageMeasurements"] is None: + raise MockFunctionCallError( + "niDCPower_MeasureMultiple", param="voltageMeasurements" + ) + test_value = self._defaults["MeasureMultiple"]["voltageMeasurements"] try: voltage_measurements_ref = voltage_measurements.contents except AttributeError: @@ -553,9 +701,11 @@ def niDCPower_MeasureMultiple(self, vi, channel_name, voltage_measurements, curr for i in range(len(test_value)): voltage_measurements_ref[i] = test_value[i] # current_measurements - if self._defaults['MeasureMultiple']['currentMeasurements'] is None: - raise MockFunctionCallError("niDCPower_MeasureMultiple", param='currentMeasurements') - test_value = self._defaults['MeasureMultiple']['currentMeasurements'] + if self._defaults["MeasureMultiple"]["currentMeasurements"] is None: + raise MockFunctionCallError( + "niDCPower_MeasureMultiple", param="currentMeasurements" + ) + test_value = self._defaults["MeasureMultiple"]["currentMeasurements"] try: current_measurements_ref = current_measurements.contents except AttributeError: @@ -563,306 +713,490 @@ def niDCPower_MeasureMultiple(self, vi, channel_name, voltage_measurements, curr assert len(current_measurements_ref) >= len(test_value) for i in range(len(test_value)): current_measurements_ref[i] = test_value[i] - return self._defaults['MeasureMultiple']['return'] + return self._defaults["MeasureMultiple"]["return"] - def niDCPower_ParseChannelCount(self, vi, channels_string, number_of_channels): # noqa: N802 - if self._defaults['ParseChannelCount']['return'] != 0: - return self._defaults['ParseChannelCount']['return'] + def niDCPower_ParseChannelCount( + self, vi, channels_string, number_of_channels + ): # noqa: N802 + if self._defaults["ParseChannelCount"]["return"] != 0: + return self._defaults["ParseChannelCount"]["return"] # number_of_channels - if self._defaults['ParseChannelCount']['numberOfChannels'] is None: - raise MockFunctionCallError("niDCPower_ParseChannelCount", param='numberOfChannels') + if self._defaults["ParseChannelCount"]["numberOfChannels"] is None: + raise MockFunctionCallError( + "niDCPower_ParseChannelCount", param="numberOfChannels" + ) if number_of_channels is not None: - number_of_channels.contents.value = self._defaults['ParseChannelCount']['numberOfChannels'] - return self._defaults['ParseChannelCount']['return'] - - def niDCPower_QueryInCompliance(self, vi, channel_name, in_compliance): # noqa: N802 - if self._defaults['QueryInCompliance']['return'] != 0: - return self._defaults['QueryInCompliance']['return'] + number_of_channels.contents.value = self._defaults["ParseChannelCount"][ + "numberOfChannels" + ] + return self._defaults["ParseChannelCount"]["return"] + + def niDCPower_QueryInCompliance( + self, vi, channel_name, in_compliance + ): # noqa: N802 + if self._defaults["QueryInCompliance"]["return"] != 0: + return self._defaults["QueryInCompliance"]["return"] # in_compliance - if self._defaults['QueryInCompliance']['inCompliance'] is None: - raise MockFunctionCallError("niDCPower_QueryInCompliance", param='inCompliance') + if self._defaults["QueryInCompliance"]["inCompliance"] is None: + raise MockFunctionCallError( + "niDCPower_QueryInCompliance", param="inCompliance" + ) if in_compliance is not None: - in_compliance.contents.value = self._defaults['QueryInCompliance']['inCompliance'] - return self._defaults['QueryInCompliance']['return'] - - def niDCPower_QueryLatchedOutputCutoffState(self, vi, channel_name, output_cutoff_reason, output_cutoff_state): # noqa: N802 - if self._defaults['QueryLatchedOutputCutoffState']['return'] != 0: - return self._defaults['QueryLatchedOutputCutoffState']['return'] + in_compliance.contents.value = self._defaults["QueryInCompliance"][ + "inCompliance" + ] + return self._defaults["QueryInCompliance"]["return"] + + def niDCPower_QueryLatchedOutputCutoffState( + self, vi, channel_name, output_cutoff_reason, output_cutoff_state + ): # noqa: N802 + if self._defaults["QueryLatchedOutputCutoffState"]["return"] != 0: + return self._defaults["QueryLatchedOutputCutoffState"]["return"] # output_cutoff_state - if self._defaults['QueryLatchedOutputCutoffState']['outputCutoffState'] is None: - raise MockFunctionCallError("niDCPower_QueryLatchedOutputCutoffState", param='outputCutoffState') + if self._defaults["QueryLatchedOutputCutoffState"]["outputCutoffState"] is None: + raise MockFunctionCallError( + "niDCPower_QueryLatchedOutputCutoffState", param="outputCutoffState" + ) if output_cutoff_state is not None: - output_cutoff_state.contents.value = self._defaults['QueryLatchedOutputCutoffState']['outputCutoffState'] - return self._defaults['QueryLatchedOutputCutoffState']['return'] - - def niDCPower_QueryMaxCurrentLimit(self, vi, channel_name, voltage_level, max_current_limit): # noqa: N802 - if self._defaults['QueryMaxCurrentLimit']['return'] != 0: - return self._defaults['QueryMaxCurrentLimit']['return'] + output_cutoff_state.contents.value = self._defaults[ + "QueryLatchedOutputCutoffState" + ]["outputCutoffState"] + return self._defaults["QueryLatchedOutputCutoffState"]["return"] + + def niDCPower_QueryMaxCurrentLimit( + self, vi, channel_name, voltage_level, max_current_limit + ): # noqa: N802 + if self._defaults["QueryMaxCurrentLimit"]["return"] != 0: + return self._defaults["QueryMaxCurrentLimit"]["return"] # max_current_limit - if self._defaults['QueryMaxCurrentLimit']['maxCurrentLimit'] is None: - raise MockFunctionCallError("niDCPower_QueryMaxCurrentLimit", param='maxCurrentLimit') + if self._defaults["QueryMaxCurrentLimit"]["maxCurrentLimit"] is None: + raise MockFunctionCallError( + "niDCPower_QueryMaxCurrentLimit", param="maxCurrentLimit" + ) if max_current_limit is not None: - max_current_limit.contents.value = self._defaults['QueryMaxCurrentLimit']['maxCurrentLimit'] - return self._defaults['QueryMaxCurrentLimit']['return'] - - def niDCPower_QueryMaxVoltageLevel(self, vi, channel_name, current_limit, max_voltage_level): # noqa: N802 - if self._defaults['QueryMaxVoltageLevel']['return'] != 0: - return self._defaults['QueryMaxVoltageLevel']['return'] + max_current_limit.contents.value = self._defaults["QueryMaxCurrentLimit"][ + "maxCurrentLimit" + ] + return self._defaults["QueryMaxCurrentLimit"]["return"] + + def niDCPower_QueryMaxVoltageLevel( + self, vi, channel_name, current_limit, max_voltage_level + ): # noqa: N802 + if self._defaults["QueryMaxVoltageLevel"]["return"] != 0: + return self._defaults["QueryMaxVoltageLevel"]["return"] # max_voltage_level - if self._defaults['QueryMaxVoltageLevel']['maxVoltageLevel'] is None: - raise MockFunctionCallError("niDCPower_QueryMaxVoltageLevel", param='maxVoltageLevel') + if self._defaults["QueryMaxVoltageLevel"]["maxVoltageLevel"] is None: + raise MockFunctionCallError( + "niDCPower_QueryMaxVoltageLevel", param="maxVoltageLevel" + ) if max_voltage_level is not None: - max_voltage_level.contents.value = self._defaults['QueryMaxVoltageLevel']['maxVoltageLevel'] - return self._defaults['QueryMaxVoltageLevel']['return'] - - def niDCPower_QueryMinCurrentLimit(self, vi, channel_name, voltage_level, min_current_limit): # noqa: N802 - if self._defaults['QueryMinCurrentLimit']['return'] != 0: - return self._defaults['QueryMinCurrentLimit']['return'] + max_voltage_level.contents.value = self._defaults["QueryMaxVoltageLevel"][ + "maxVoltageLevel" + ] + return self._defaults["QueryMaxVoltageLevel"]["return"] + + def niDCPower_QueryMinCurrentLimit( + self, vi, channel_name, voltage_level, min_current_limit + ): # noqa: N802 + if self._defaults["QueryMinCurrentLimit"]["return"] != 0: + return self._defaults["QueryMinCurrentLimit"]["return"] # min_current_limit - if self._defaults['QueryMinCurrentLimit']['minCurrentLimit'] is None: - raise MockFunctionCallError("niDCPower_QueryMinCurrentLimit", param='minCurrentLimit') + if self._defaults["QueryMinCurrentLimit"]["minCurrentLimit"] is None: + raise MockFunctionCallError( + "niDCPower_QueryMinCurrentLimit", param="minCurrentLimit" + ) if min_current_limit is not None: - min_current_limit.contents.value = self._defaults['QueryMinCurrentLimit']['minCurrentLimit'] - return self._defaults['QueryMinCurrentLimit']['return'] - - def niDCPower_QueryOutputState(self, vi, channel_name, output_state, in_state): # noqa: N802 - if self._defaults['QueryOutputState']['return'] != 0: - return self._defaults['QueryOutputState']['return'] + min_current_limit.contents.value = self._defaults["QueryMinCurrentLimit"][ + "minCurrentLimit" + ] + return self._defaults["QueryMinCurrentLimit"]["return"] + + def niDCPower_QueryOutputState( + self, vi, channel_name, output_state, in_state + ): # noqa: N802 + if self._defaults["QueryOutputState"]["return"] != 0: + return self._defaults["QueryOutputState"]["return"] # in_state - if self._defaults['QueryOutputState']['inState'] is None: - raise MockFunctionCallError("niDCPower_QueryOutputState", param='inState') + if self._defaults["QueryOutputState"]["inState"] is None: + raise MockFunctionCallError("niDCPower_QueryOutputState", param="inState") if in_state is not None: - in_state.contents.value = self._defaults['QueryOutputState']['inState'] - return self._defaults['QueryOutputState']['return'] + in_state.contents.value = self._defaults["QueryOutputState"]["inState"] + return self._defaults["QueryOutputState"]["return"] def niDCPower_ReadCurrentTemperature(self, vi, temperature): # noqa: N802 - if self._defaults['ReadCurrentTemperature']['return'] != 0: - return self._defaults['ReadCurrentTemperature']['return'] + if self._defaults["ReadCurrentTemperature"]["return"] != 0: + return self._defaults["ReadCurrentTemperature"]["return"] # temperature - if self._defaults['ReadCurrentTemperature']['temperature'] is None: - raise MockFunctionCallError("niDCPower_ReadCurrentTemperature", param='temperature') + if self._defaults["ReadCurrentTemperature"]["temperature"] is None: + raise MockFunctionCallError( + "niDCPower_ReadCurrentTemperature", param="temperature" + ) if temperature is not None: - temperature.contents.value = self._defaults['ReadCurrentTemperature']['temperature'] - return self._defaults['ReadCurrentTemperature']['return'] + temperature.contents.value = self._defaults["ReadCurrentTemperature"][ + "temperature" + ] + return self._defaults["ReadCurrentTemperature"]["return"] def niDCPower_ResetDevice(self, vi): # noqa: N802 - if self._defaults['ResetDevice']['return'] != 0: - return self._defaults['ResetDevice']['return'] - return self._defaults['ResetDevice']['return'] + if self._defaults["ResetDevice"]["return"] != 0: + return self._defaults["ResetDevice"]["return"] + return self._defaults["ResetDevice"]["return"] def niDCPower_ResetWithChannels(self, vi, channel_name): # noqa: N802 - if self._defaults['ResetWithChannels']['return'] != 0: - return self._defaults['ResetWithChannels']['return'] - return self._defaults['ResetWithChannels']['return'] + if self._defaults["ResetWithChannels"]["return"] != 0: + return self._defaults["ResetWithChannels"]["return"] + return self._defaults["ResetWithChannels"]["return"] def niDCPower_ResetWithDefaults(self, vi): # noqa: N802 - if self._defaults['ResetWithDefaults']['return'] != 0: - return self._defaults['ResetWithDefaults']['return'] - return self._defaults['ResetWithDefaults']['return'] - - def niDCPower_SendSoftwareEdgeTriggerWithChannels(self, vi, channel_name, trigger): # noqa: N802 - if self._defaults['SendSoftwareEdgeTriggerWithChannels']['return'] != 0: - return self._defaults['SendSoftwareEdgeTriggerWithChannels']['return'] - return self._defaults['SendSoftwareEdgeTriggerWithChannels']['return'] - - def niDCPower_SetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['SetAttributeViBoolean']['return'] != 0: - return self._defaults['SetAttributeViBoolean']['return'] - return self._defaults['SetAttributeViBoolean']['return'] - - def niDCPower_SetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['SetAttributeViInt32']['return'] != 0: - return self._defaults['SetAttributeViInt32']['return'] - return self._defaults['SetAttributeViInt32']['return'] - - def niDCPower_SetAttributeViInt64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['SetAttributeViInt64']['return'] != 0: - return self._defaults['SetAttributeViInt64']['return'] - return self._defaults['SetAttributeViInt64']['return'] - - def niDCPower_SetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['SetAttributeViReal64']['return'] != 0: - return self._defaults['SetAttributeViReal64']['return'] - return self._defaults['SetAttributeViReal64']['return'] - - def niDCPower_SetAttributeViString(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['SetAttributeViString']['return'] != 0: - return self._defaults['SetAttributeViString']['return'] - return self._defaults['SetAttributeViString']['return'] - - def niDCPower_SetSequence(self, vi, channel_name, values, source_delays, size): # noqa: N802 - if self._defaults['SetSequence']['return'] != 0: - return self._defaults['SetSequence']['return'] - return self._defaults['SetSequence']['return'] + if self._defaults["ResetWithDefaults"]["return"] != 0: + return self._defaults["ResetWithDefaults"]["return"] + return self._defaults["ResetWithDefaults"]["return"] + + def niDCPower_SendSoftwareEdgeTriggerWithChannels( + self, vi, channel_name, trigger + ): # noqa: N802 + if self._defaults["SendSoftwareEdgeTriggerWithChannels"]["return"] != 0: + return self._defaults["SendSoftwareEdgeTriggerWithChannels"]["return"] + return self._defaults["SendSoftwareEdgeTriggerWithChannels"]["return"] + + def niDCPower_SetAttributeViBoolean( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["SetAttributeViBoolean"]["return"] != 0: + return self._defaults["SetAttributeViBoolean"]["return"] + return self._defaults["SetAttributeViBoolean"]["return"] + + def niDCPower_SetAttributeViInt32( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["SetAttributeViInt32"]["return"] != 0: + return self._defaults["SetAttributeViInt32"]["return"] + return self._defaults["SetAttributeViInt32"]["return"] + + def niDCPower_SetAttributeViInt64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["SetAttributeViInt64"]["return"] != 0: + return self._defaults["SetAttributeViInt64"]["return"] + return self._defaults["SetAttributeViInt64"]["return"] + + def niDCPower_SetAttributeViReal64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["SetAttributeViReal64"]["return"] != 0: + return self._defaults["SetAttributeViReal64"]["return"] + return self._defaults["SetAttributeViReal64"]["return"] + + def niDCPower_SetAttributeViString( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["SetAttributeViString"]["return"] != 0: + return self._defaults["SetAttributeViString"]["return"] + return self._defaults["SetAttributeViString"]["return"] + + def niDCPower_SetSequence( + self, vi, channel_name, values, source_delays, size + ): # noqa: N802 + if self._defaults["SetSequence"]["return"] != 0: + return self._defaults["SetSequence"]["return"] + return self._defaults["SetSequence"]["return"] def niDCPower_UnlockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults['UnlockSession']['return'] != 0: - return self._defaults['UnlockSession']['return'] + if self._defaults["UnlockSession"]["return"] != 0: + return self._defaults["UnlockSession"]["return"] # caller_has_lock - if self._defaults['UnlockSession']['callerHasLock'] is None: - raise MockFunctionCallError("niDCPower_UnlockSession", param='callerHasLock') + if self._defaults["UnlockSession"]["callerHasLock"] is None: + raise MockFunctionCallError( + "niDCPower_UnlockSession", param="callerHasLock" + ) if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults['UnlockSession']['callerHasLock'] - return self._defaults['UnlockSession']['return'] - - def niDCPower_WaitForEventWithChannels(self, vi, channel_name, event_id, timeout): # noqa: N802 - if self._defaults['WaitForEventWithChannels']['return'] != 0: - return self._defaults['WaitForEventWithChannels']['return'] - return self._defaults['WaitForEventWithChannels']['return'] + caller_has_lock.contents.value = self._defaults["UnlockSession"][ + "callerHasLock" + ] + return self._defaults["UnlockSession"]["return"] + + def niDCPower_WaitForEventWithChannels( + self, vi, channel_name, event_id, timeout + ): # noqa: N802 + if self._defaults["WaitForEventWithChannels"]["return"] != 0: + return self._defaults["WaitForEventWithChannels"]["return"] + return self._defaults["WaitForEventWithChannels"]["return"] def niDCPower_close(self, vi): # noqa: N802 - if self._defaults['close']['return'] != 0: - return self._defaults['close']['return'] - return self._defaults['close']['return'] + if self._defaults["close"]["return"] != 0: + return self._defaults["close"]["return"] + return self._defaults["close"]["return"] def niDCPower_error_message(self, vi, error_code, error_message): # noqa: N802 - if self._defaults['error_message']['return'] != 0: - return self._defaults['error_message']['return'] + if self._defaults["error_message"]["return"] != 0: + return self._defaults["error_message"]["return"] # error_message - if self._defaults['error_message']['errorMessage'] is None: - raise MockFunctionCallError("niDCPower_error_message", param='errorMessage') - test_value = self._defaults['error_message']['errorMessage'] + if self._defaults["error_message"]["errorMessage"] is None: + raise MockFunctionCallError("niDCPower_error_message", param="errorMessage") + test_value = self._defaults["error_message"]["errorMessage"] if type(test_value) is str: - test_value = test_value.encode('ascii') + test_value = test_value.encode("ascii") assert len(error_message) >= len(test_value) for i in range(len(test_value)): error_message[i] = test_value[i] - return self._defaults['error_message']['return'] + return self._defaults["error_message"]["return"] - def niDCPower_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 - if self._defaults['self_test']['return'] != 0: - return self._defaults['self_test']['return'] + def niDCPower_self_test( + self, vi, self_test_result, self_test_message + ): # noqa: N802 + if self._defaults["self_test"]["return"] != 0: + return self._defaults["self_test"]["return"] # self_test_result - if self._defaults['self_test']['selfTestResult'] is None: - raise MockFunctionCallError("niDCPower_self_test", param='selfTestResult') + if self._defaults["self_test"]["selfTestResult"] is None: + raise MockFunctionCallError("niDCPower_self_test", param="selfTestResult") if self_test_result is not None: - self_test_result.contents.value = self._defaults['self_test']['selfTestResult'] + self_test_result.contents.value = self._defaults["self_test"][ + "selfTestResult" + ] # self_test_message - if self._defaults['self_test']['selfTestMessage'] is None: - raise MockFunctionCallError("niDCPower_self_test", param='selfTestMessage') - test_value = self._defaults['self_test']['selfTestMessage'] + if self._defaults["self_test"]["selfTestMessage"] is None: + raise MockFunctionCallError("niDCPower_self_test", param="selfTestMessage") + test_value = self._defaults["self_test"]["selfTestMessage"] if type(test_value) is str: - test_value = test_value.encode('ascii') + test_value = test_value.encode("ascii") assert len(self_test_message) >= len(test_value) for i in range(len(test_value)): self_test_message[i] = test_value[i] - return self._defaults['self_test']['return'] + return self._defaults["self_test"]["return"] # Helper function to setup Mock object with default side effects and return values def set_side_effects_and_return_values(self, mock_library): - mock_library.niDCPower_AbortWithChannels.side_effect = MockFunctionCallError("niDCPower_AbortWithChannels") + mock_library.niDCPower_AbortWithChannels.side_effect = MockFunctionCallError( + "niDCPower_AbortWithChannels" + ) mock_library.niDCPower_AbortWithChannels.return_value = 0 - mock_library.niDCPower_CalSelfCalibrate.side_effect = MockFunctionCallError("niDCPower_CalSelfCalibrate") + mock_library.niDCPower_CalSelfCalibrate.side_effect = MockFunctionCallError( + "niDCPower_CalSelfCalibrate" + ) mock_library.niDCPower_CalSelfCalibrate.return_value = 0 - mock_library.niDCPower_ClearLatchedOutputCutoffState.side_effect = MockFunctionCallError("niDCPower_ClearLatchedOutputCutoffState") + mock_library.niDCPower_ClearLatchedOutputCutoffState.side_effect = ( + MockFunctionCallError("niDCPower_ClearLatchedOutputCutoffState") + ) mock_library.niDCPower_ClearLatchedOutputCutoffState.return_value = 0 - mock_library.niDCPower_CommitWithChannels.side_effect = MockFunctionCallError("niDCPower_CommitWithChannels") + mock_library.niDCPower_CommitWithChannels.side_effect = MockFunctionCallError( + "niDCPower_CommitWithChannels" + ) mock_library.niDCPower_CommitWithChannels.return_value = 0 - mock_library.niDCPower_ConfigureApertureTime.side_effect = MockFunctionCallError("niDCPower_ConfigureApertureTime") + mock_library.niDCPower_ConfigureApertureTime.side_effect = ( + MockFunctionCallError("niDCPower_ConfigureApertureTime") + ) mock_library.niDCPower_ConfigureApertureTime.return_value = 0 - mock_library.niDCPower_CreateAdvancedSequenceCommitStepWithChannels.side_effect = MockFunctionCallError("niDCPower_CreateAdvancedSequenceCommitStepWithChannels") - mock_library.niDCPower_CreateAdvancedSequenceCommitStepWithChannels.return_value = 0 - mock_library.niDCPower_CreateAdvancedSequenceStepWithChannels.side_effect = MockFunctionCallError("niDCPower_CreateAdvancedSequenceStepWithChannels") + mock_library.niDCPower_CreateAdvancedSequenceCommitStepWithChannels.side_effect = MockFunctionCallError( + "niDCPower_CreateAdvancedSequenceCommitStepWithChannels" + ) + mock_library.niDCPower_CreateAdvancedSequenceCommitStepWithChannels.return_value = ( + 0 + ) + mock_library.niDCPower_CreateAdvancedSequenceStepWithChannels.side_effect = ( + MockFunctionCallError("niDCPower_CreateAdvancedSequenceStepWithChannels") + ) mock_library.niDCPower_CreateAdvancedSequenceStepWithChannels.return_value = 0 - mock_library.niDCPower_CreateAdvancedSequenceWithChannels.side_effect = MockFunctionCallError("niDCPower_CreateAdvancedSequenceWithChannels") + mock_library.niDCPower_CreateAdvancedSequenceWithChannels.side_effect = ( + MockFunctionCallError("niDCPower_CreateAdvancedSequenceWithChannels") + ) mock_library.niDCPower_CreateAdvancedSequenceWithChannels.return_value = 0 - mock_library.niDCPower_DeleteAdvancedSequenceWithChannels.side_effect = MockFunctionCallError("niDCPower_DeleteAdvancedSequenceWithChannels") + mock_library.niDCPower_DeleteAdvancedSequenceWithChannels.side_effect = ( + MockFunctionCallError("niDCPower_DeleteAdvancedSequenceWithChannels") + ) mock_library.niDCPower_DeleteAdvancedSequenceWithChannels.return_value = 0 - mock_library.niDCPower_Disable.side_effect = MockFunctionCallError("niDCPower_Disable") + mock_library.niDCPower_Disable.side_effect = MockFunctionCallError( + "niDCPower_Disable" + ) mock_library.niDCPower_Disable.return_value = 0 - mock_library.niDCPower_ExportAttributeConfigurationBuffer.side_effect = MockFunctionCallError("niDCPower_ExportAttributeConfigurationBuffer") + mock_library.niDCPower_ExportAttributeConfigurationBuffer.side_effect = ( + MockFunctionCallError("niDCPower_ExportAttributeConfigurationBuffer") + ) mock_library.niDCPower_ExportAttributeConfigurationBuffer.return_value = 0 - mock_library.niDCPower_ExportAttributeConfigurationFile.side_effect = MockFunctionCallError("niDCPower_ExportAttributeConfigurationFile") + mock_library.niDCPower_ExportAttributeConfigurationFile.side_effect = ( + MockFunctionCallError("niDCPower_ExportAttributeConfigurationFile") + ) mock_library.niDCPower_ExportAttributeConfigurationFile.return_value = 0 - mock_library.niDCPower_FancyInitialize.side_effect = MockFunctionCallError("niDCPower_FancyInitialize") + mock_library.niDCPower_FancyInitialize.side_effect = MockFunctionCallError( + "niDCPower_FancyInitialize" + ) mock_library.niDCPower_FancyInitialize.return_value = 0 - mock_library.niDCPower_FetchMultiple.side_effect = MockFunctionCallError("niDCPower_FetchMultiple") + mock_library.niDCPower_FetchMultiple.side_effect = MockFunctionCallError( + "niDCPower_FetchMultiple" + ) mock_library.niDCPower_FetchMultiple.return_value = 0 - mock_library.niDCPower_GetAttributeViBoolean.side_effect = MockFunctionCallError("niDCPower_GetAttributeViBoolean") + mock_library.niDCPower_GetAttributeViBoolean.side_effect = ( + MockFunctionCallError("niDCPower_GetAttributeViBoolean") + ) mock_library.niDCPower_GetAttributeViBoolean.return_value = 0 - mock_library.niDCPower_GetAttributeViInt32.side_effect = MockFunctionCallError("niDCPower_GetAttributeViInt32") + mock_library.niDCPower_GetAttributeViInt32.side_effect = MockFunctionCallError( + "niDCPower_GetAttributeViInt32" + ) mock_library.niDCPower_GetAttributeViInt32.return_value = 0 - mock_library.niDCPower_GetAttributeViInt64.side_effect = MockFunctionCallError("niDCPower_GetAttributeViInt64") + mock_library.niDCPower_GetAttributeViInt64.side_effect = MockFunctionCallError( + "niDCPower_GetAttributeViInt64" + ) mock_library.niDCPower_GetAttributeViInt64.return_value = 0 - mock_library.niDCPower_GetAttributeViReal64.side_effect = MockFunctionCallError("niDCPower_GetAttributeViReal64") + mock_library.niDCPower_GetAttributeViReal64.side_effect = MockFunctionCallError( + "niDCPower_GetAttributeViReal64" + ) mock_library.niDCPower_GetAttributeViReal64.return_value = 0 - mock_library.niDCPower_GetAttributeViString.side_effect = MockFunctionCallError("niDCPower_GetAttributeViString") + mock_library.niDCPower_GetAttributeViString.side_effect = MockFunctionCallError( + "niDCPower_GetAttributeViString" + ) mock_library.niDCPower_GetAttributeViString.return_value = 0 - mock_library.niDCPower_GetChannelName.side_effect = MockFunctionCallError("niDCPower_GetChannelName") + mock_library.niDCPower_GetChannelName.side_effect = MockFunctionCallError( + "niDCPower_GetChannelName" + ) mock_library.niDCPower_GetChannelName.return_value = 0 - mock_library.niDCPower_GetChannelNameFromString.side_effect = MockFunctionCallError("niDCPower_GetChannelNameFromString") + mock_library.niDCPower_GetChannelNameFromString.side_effect = ( + MockFunctionCallError("niDCPower_GetChannelNameFromString") + ) mock_library.niDCPower_GetChannelNameFromString.return_value = 0 - mock_library.niDCPower_GetError.side_effect = MockFunctionCallError("niDCPower_GetError") + mock_library.niDCPower_GetError.side_effect = MockFunctionCallError( + "niDCPower_GetError" + ) mock_library.niDCPower_GetError.return_value = 0 - mock_library.niDCPower_GetExtCalLastDateAndTime.side_effect = MockFunctionCallError("niDCPower_GetExtCalLastDateAndTime") + mock_library.niDCPower_GetExtCalLastDateAndTime.side_effect = ( + MockFunctionCallError("niDCPower_GetExtCalLastDateAndTime") + ) mock_library.niDCPower_GetExtCalLastDateAndTime.return_value = 0 - mock_library.niDCPower_GetExtCalLastTemp.side_effect = MockFunctionCallError("niDCPower_GetExtCalLastTemp") + mock_library.niDCPower_GetExtCalLastTemp.side_effect = MockFunctionCallError( + "niDCPower_GetExtCalLastTemp" + ) mock_library.niDCPower_GetExtCalLastTemp.return_value = 0 - mock_library.niDCPower_GetExtCalRecommendedInterval.side_effect = MockFunctionCallError("niDCPower_GetExtCalRecommendedInterval") + mock_library.niDCPower_GetExtCalRecommendedInterval.side_effect = ( + MockFunctionCallError("niDCPower_GetExtCalRecommendedInterval") + ) mock_library.niDCPower_GetExtCalRecommendedInterval.return_value = 0 - mock_library.niDCPower_GetSelfCalLastDateAndTime.side_effect = MockFunctionCallError("niDCPower_GetSelfCalLastDateAndTime") + mock_library.niDCPower_GetSelfCalLastDateAndTime.side_effect = ( + MockFunctionCallError("niDCPower_GetSelfCalLastDateAndTime") + ) mock_library.niDCPower_GetSelfCalLastDateAndTime.return_value = 0 - mock_library.niDCPower_GetSelfCalLastTemp.side_effect = MockFunctionCallError("niDCPower_GetSelfCalLastTemp") + mock_library.niDCPower_GetSelfCalLastTemp.side_effect = MockFunctionCallError( + "niDCPower_GetSelfCalLastTemp" + ) mock_library.niDCPower_GetSelfCalLastTemp.return_value = 0 - mock_library.niDCPower_ImportAttributeConfigurationBuffer.side_effect = MockFunctionCallError("niDCPower_ImportAttributeConfigurationBuffer") + mock_library.niDCPower_ImportAttributeConfigurationBuffer.side_effect = ( + MockFunctionCallError("niDCPower_ImportAttributeConfigurationBuffer") + ) mock_library.niDCPower_ImportAttributeConfigurationBuffer.return_value = 0 - mock_library.niDCPower_ImportAttributeConfigurationFile.side_effect = MockFunctionCallError("niDCPower_ImportAttributeConfigurationFile") + mock_library.niDCPower_ImportAttributeConfigurationFile.side_effect = ( + MockFunctionCallError("niDCPower_ImportAttributeConfigurationFile") + ) mock_library.niDCPower_ImportAttributeConfigurationFile.return_value = 0 - mock_library.niDCPower_InitializeWithChannels.side_effect = MockFunctionCallError("niDCPower_InitializeWithChannels") + mock_library.niDCPower_InitializeWithChannels.side_effect = ( + MockFunctionCallError("niDCPower_InitializeWithChannels") + ) mock_library.niDCPower_InitializeWithChannels.return_value = 0 - mock_library.niDCPower_InitializeWithIndependentChannels.side_effect = MockFunctionCallError("niDCPower_InitializeWithIndependentChannels") + mock_library.niDCPower_InitializeWithIndependentChannels.side_effect = ( + MockFunctionCallError("niDCPower_InitializeWithIndependentChannels") + ) mock_library.niDCPower_InitializeWithIndependentChannels.return_value = 0 - mock_library.niDCPower_InitiateWithChannels.side_effect = MockFunctionCallError("niDCPower_InitiateWithChannels") + mock_library.niDCPower_InitiateWithChannels.side_effect = MockFunctionCallError( + "niDCPower_InitiateWithChannels" + ) mock_library.niDCPower_InitiateWithChannels.return_value = 0 - mock_library.niDCPower_LockSession.side_effect = MockFunctionCallError("niDCPower_LockSession") + mock_library.niDCPower_LockSession.side_effect = MockFunctionCallError( + "niDCPower_LockSession" + ) mock_library.niDCPower_LockSession.return_value = 0 - mock_library.niDCPower_Measure.side_effect = MockFunctionCallError("niDCPower_Measure") + mock_library.niDCPower_Measure.side_effect = MockFunctionCallError( + "niDCPower_Measure" + ) mock_library.niDCPower_Measure.return_value = 0 - mock_library.niDCPower_MeasureMultiple.side_effect = MockFunctionCallError("niDCPower_MeasureMultiple") + mock_library.niDCPower_MeasureMultiple.side_effect = MockFunctionCallError( + "niDCPower_MeasureMultiple" + ) mock_library.niDCPower_MeasureMultiple.return_value = 0 - mock_library.niDCPower_ParseChannelCount.side_effect = MockFunctionCallError("niDCPower_ParseChannelCount") + mock_library.niDCPower_ParseChannelCount.side_effect = MockFunctionCallError( + "niDCPower_ParseChannelCount" + ) mock_library.niDCPower_ParseChannelCount.return_value = 0 - mock_library.niDCPower_QueryInCompliance.side_effect = MockFunctionCallError("niDCPower_QueryInCompliance") + mock_library.niDCPower_QueryInCompliance.side_effect = MockFunctionCallError( + "niDCPower_QueryInCompliance" + ) mock_library.niDCPower_QueryInCompliance.return_value = 0 - mock_library.niDCPower_QueryLatchedOutputCutoffState.side_effect = MockFunctionCallError("niDCPower_QueryLatchedOutputCutoffState") + mock_library.niDCPower_QueryLatchedOutputCutoffState.side_effect = ( + MockFunctionCallError("niDCPower_QueryLatchedOutputCutoffState") + ) mock_library.niDCPower_QueryLatchedOutputCutoffState.return_value = 0 - mock_library.niDCPower_QueryMaxCurrentLimit.side_effect = MockFunctionCallError("niDCPower_QueryMaxCurrentLimit") + mock_library.niDCPower_QueryMaxCurrentLimit.side_effect = MockFunctionCallError( + "niDCPower_QueryMaxCurrentLimit" + ) mock_library.niDCPower_QueryMaxCurrentLimit.return_value = 0 - mock_library.niDCPower_QueryMaxVoltageLevel.side_effect = MockFunctionCallError("niDCPower_QueryMaxVoltageLevel") + mock_library.niDCPower_QueryMaxVoltageLevel.side_effect = MockFunctionCallError( + "niDCPower_QueryMaxVoltageLevel" + ) mock_library.niDCPower_QueryMaxVoltageLevel.return_value = 0 - mock_library.niDCPower_QueryMinCurrentLimit.side_effect = MockFunctionCallError("niDCPower_QueryMinCurrentLimit") + mock_library.niDCPower_QueryMinCurrentLimit.side_effect = MockFunctionCallError( + "niDCPower_QueryMinCurrentLimit" + ) mock_library.niDCPower_QueryMinCurrentLimit.return_value = 0 - mock_library.niDCPower_QueryOutputState.side_effect = MockFunctionCallError("niDCPower_QueryOutputState") + mock_library.niDCPower_QueryOutputState.side_effect = MockFunctionCallError( + "niDCPower_QueryOutputState" + ) mock_library.niDCPower_QueryOutputState.return_value = 0 - mock_library.niDCPower_ReadCurrentTemperature.side_effect = MockFunctionCallError("niDCPower_ReadCurrentTemperature") + mock_library.niDCPower_ReadCurrentTemperature.side_effect = ( + MockFunctionCallError("niDCPower_ReadCurrentTemperature") + ) mock_library.niDCPower_ReadCurrentTemperature.return_value = 0 - mock_library.niDCPower_ResetDevice.side_effect = MockFunctionCallError("niDCPower_ResetDevice") + mock_library.niDCPower_ResetDevice.side_effect = MockFunctionCallError( + "niDCPower_ResetDevice" + ) mock_library.niDCPower_ResetDevice.return_value = 0 - mock_library.niDCPower_ResetWithChannels.side_effect = MockFunctionCallError("niDCPower_ResetWithChannels") + mock_library.niDCPower_ResetWithChannels.side_effect = MockFunctionCallError( + "niDCPower_ResetWithChannels" + ) mock_library.niDCPower_ResetWithChannels.return_value = 0 - mock_library.niDCPower_ResetWithDefaults.side_effect = MockFunctionCallError("niDCPower_ResetWithDefaults") + mock_library.niDCPower_ResetWithDefaults.side_effect = MockFunctionCallError( + "niDCPower_ResetWithDefaults" + ) mock_library.niDCPower_ResetWithDefaults.return_value = 0 - mock_library.niDCPower_SendSoftwareEdgeTriggerWithChannels.side_effect = MockFunctionCallError("niDCPower_SendSoftwareEdgeTriggerWithChannels") + mock_library.niDCPower_SendSoftwareEdgeTriggerWithChannels.side_effect = ( + MockFunctionCallError("niDCPower_SendSoftwareEdgeTriggerWithChannels") + ) mock_library.niDCPower_SendSoftwareEdgeTriggerWithChannels.return_value = 0 - mock_library.niDCPower_SetAttributeViBoolean.side_effect = MockFunctionCallError("niDCPower_SetAttributeViBoolean") + mock_library.niDCPower_SetAttributeViBoolean.side_effect = ( + MockFunctionCallError("niDCPower_SetAttributeViBoolean") + ) mock_library.niDCPower_SetAttributeViBoolean.return_value = 0 - mock_library.niDCPower_SetAttributeViInt32.side_effect = MockFunctionCallError("niDCPower_SetAttributeViInt32") + mock_library.niDCPower_SetAttributeViInt32.side_effect = MockFunctionCallError( + "niDCPower_SetAttributeViInt32" + ) mock_library.niDCPower_SetAttributeViInt32.return_value = 0 - mock_library.niDCPower_SetAttributeViInt64.side_effect = MockFunctionCallError("niDCPower_SetAttributeViInt64") + mock_library.niDCPower_SetAttributeViInt64.side_effect = MockFunctionCallError( + "niDCPower_SetAttributeViInt64" + ) mock_library.niDCPower_SetAttributeViInt64.return_value = 0 - mock_library.niDCPower_SetAttributeViReal64.side_effect = MockFunctionCallError("niDCPower_SetAttributeViReal64") + mock_library.niDCPower_SetAttributeViReal64.side_effect = MockFunctionCallError( + "niDCPower_SetAttributeViReal64" + ) mock_library.niDCPower_SetAttributeViReal64.return_value = 0 - mock_library.niDCPower_SetAttributeViString.side_effect = MockFunctionCallError("niDCPower_SetAttributeViString") + mock_library.niDCPower_SetAttributeViString.side_effect = MockFunctionCallError( + "niDCPower_SetAttributeViString" + ) mock_library.niDCPower_SetAttributeViString.return_value = 0 - mock_library.niDCPower_SetSequence.side_effect = MockFunctionCallError("niDCPower_SetSequence") + mock_library.niDCPower_SetSequence.side_effect = MockFunctionCallError( + "niDCPower_SetSequence" + ) mock_library.niDCPower_SetSequence.return_value = 0 - mock_library.niDCPower_UnlockSession.side_effect = MockFunctionCallError("niDCPower_UnlockSession") + mock_library.niDCPower_UnlockSession.side_effect = MockFunctionCallError( + "niDCPower_UnlockSession" + ) mock_library.niDCPower_UnlockSession.return_value = 0 - mock_library.niDCPower_WaitForEventWithChannels.side_effect = MockFunctionCallError("niDCPower_WaitForEventWithChannels") + mock_library.niDCPower_WaitForEventWithChannels.side_effect = ( + MockFunctionCallError("niDCPower_WaitForEventWithChannels") + ) mock_library.niDCPower_WaitForEventWithChannels.return_value = 0 - mock_library.niDCPower_close.side_effect = MockFunctionCallError("niDCPower_close") + mock_library.niDCPower_close.side_effect = MockFunctionCallError( + "niDCPower_close" + ) mock_library.niDCPower_close.return_value = 0 - mock_library.niDCPower_error_message.side_effect = MockFunctionCallError("niDCPower_error_message") + mock_library.niDCPower_error_message.side_effect = MockFunctionCallError( + "niDCPower_error_message" + ) mock_library.niDCPower_error_message.return_value = 0 - mock_library.niDCPower_self_test.side_effect = MockFunctionCallError("niDCPower_self_test") + mock_library.niDCPower_self_test.side_effect = MockFunctionCallError( + "niDCPower_self_test" + ) mock_library.niDCPower_self_test.return_value = 0 diff --git a/generated/nidcpower/setup.py b/generated/nidcpower/setup.py index 7701e32c7..bef30ccdf 100644 --- a/generated/nidcpower/setup.py +++ b/generated/nidcpower/setup.py @@ -15,41 +15,44 @@ def finalize_options(self): def run_tests(self): import pytest + pytest.main(self.test_args) -pypi_name = 'nidcpower' +pypi_name = "nidcpower" def read_contents(file_to_read): - with open(file_to_read, 'r') as f: + with open(file_to_read, "r") as f: return f.read() setup( name=pypi_name, zip_safe=True, - version='1.4.2.dev0', - description='NI-DCPower Python API', - long_description=read_contents('README.rst'), - long_description_content_type='text/x-rst', - author='NI', + version="1.4.2.dev0", + description="NI-DCPower Python API", + long_description=read_contents("README.rst"), + long_description_content_type="text/x-rst", + author="NI", author_email="opensource@ni.com", url="https://github.com/ni/nimi-python", maintainer="NI", maintainer_email="opensource@ni.com", - keywords=['nidcpower'], - license='MIT', + keywords=["nidcpower"], + license="MIT", include_package_data=True, - packages=['nidcpower'], + packages=["nidcpower"], install_requires=[ 'enum34;python_version<"3.4"', 'singledispatch;python_version<"3.4"', - 'hightime>=0.2.0', + "hightime>=0.2.0", + ], + setup_requires=[ + "pytest-runner", ], - setup_requires=['pytest-runner', ], - tests_require=['pytest'], - test_suite='tests', + tests_require=["pytest"], + test_suite="tests", classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -64,8 +67,8 @@ def read_contents(file_to_read): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", - "Topic :: System :: Hardware :: Hardware Drivers" + "Topic :: System :: Hardware :: Hardware Drivers", ], - cmdclass={'test': PyTest}, - package_data={pypi_name: ['VERSION']}, + cmdclass={"test": PyTest}, + package_data={pypi_name: ["VERSION"]}, ) diff --git a/generated/nidigital/nidigital/__init__.py b/generated/nidigital/nidigital/__init__.py index 815b17ddc..8af945476 100644 --- a/generated/nidigital/nidigital/__init__.py +++ b/generated/nidigital/nidigital/__init__.py @@ -2,23 +2,25 @@ # This file was generated -__version__ = '1.4.2.dev0' +__version__ = "1.4.2.dev0" from nidigital.enums import * # noqa: F403,F401,H303 from nidigital.errors import DriverWarning # noqa: F401 from nidigital.errors import Error # noqa: F401 from nidigital.session import Session # noqa: F401 -from nidigital.history_ram_cycle_information import HistoryRAMCycleInformation # noqa: F401 +from nidigital.history_ram_cycle_information import ( + HistoryRAMCycleInformation, +) # noqa: F401 def get_diagnostic_information(): - '''Get diagnostic information about the system state that is suitable for printing or logging + """Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - ''' + """ import os import pkg_resources import platform @@ -26,73 +28,80 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return (struct.calcsize("P") == 8) + return struct.calcsize("P") == 8 def is_os_64bit(): - return platform.machine().endswith('64') + return platform.machine().endswith("64") def is_venv(): - return 'VIRTUAL_ENV' in os.environ + return "VIRTUAL_ENV" in os.environ info = {} - info['os'] = {} - info['python'] = {} - info['driver'] = {} - info['module'] = {} - if platform.system() == 'Windows': + info["os"] = {} + info["python"] = {} + info["driver"] = {} + info["module"] = {} + if platform.system() == "Windows": try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = 'Windows' + os_name = "Windows" try: - driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-Digital Pattern Driver\CurrentVersion") + driver_version_key = winreg.OpenKey( + winreg.HKEY_LOCAL_MACHINE, + r"SOFTWARE\National Instruments\NI-Digital Pattern Driver\CurrentVersion", + ) driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = 'Unknown' - elif platform.system() == 'Linux': - os_name = 'Linux' - driver_version = 'Unknown' + driver_version = "Unknown" + elif platform.system() == "Linux": + os_name = "Linux" + driver_version = "Unknown" else: - raise SystemError('Unsupported platform: {}'.format(platform.system())) + raise SystemError("Unsupported platform: {}".format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] - - info['os']['name'] = os_name - info['os']['version'] = platform.version() - info['os']['bits'] = '64' if is_os_64bit() else '32' - info['driver']['name'] = "NI-Digital Pattern Driver" - info['driver']['version'] = driver_version - info['module']['name'] = 'nidigital' - info['module']['version'] = "1.4.2.dev0" - info['python']['version'] = sys.version - info['python']['bits'] = '64' if is_python_64bit() else '32' - info['python']['is_venv'] = is_venv() - info['python']['packages'] = installed_packages_list + installed_packages_list = [ + { + "name": i.key, + "version": i.version, + } + for i in installed_packages + ] + + info["os"]["name"] = os_name + info["os"]["version"] = platform.version() + info["os"]["bits"] = "64" if is_os_64bit() else "32" + info["driver"]["name"] = "NI-Digital Pattern Driver" + info["driver"]["version"] = driver_version + info["module"]["name"] = "nidigital" + info["module"]["version"] = "1.4.2.dev0" + info["python"]["version"] = sys.version + info["python"]["bits"] = "64" if is_python_64bit() else "32" + info["python"]["is_venv"] = is_venv() + info["python"]["packages"] = installed_packages_list return info def print_diagnostic_information(): - '''Print diagnostic information in a format suitable for issue report + """Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - ''' + """ info = get_diagnostic_information() - row_format = ' {:<10} {}' - for type in ['OS', 'Driver', 'Module', 'Python']: + row_format = " {:<10} {}" + for type in ["OS", "Driver", "Module", "Python"]: typename = type.lower() - print(type + ':') + print(type + ":") for item in info[typename]: - if item != 'packages': - print(row_format.format(item.title() + ':', info[typename][item])) - print(' Installed Packages:') - for p in info['python']['packages']: - print((' ' * 8) + p['name'] + '==' + p['version']) + if item != "packages": + print(row_format.format(item.title() + ":", info[typename][item])) + print(" Installed Packages:") + for p in info["python"]["packages"]: + print((" " * 8) + p["name"] + "==" + p["version"]) return info - - diff --git a/generated/nidigital/nidigital/_attributes.py b/generated/nidigital/nidigital/_attributes.py index 277b4b001..5a20ca61f 100644 --- a/generated/nidigital/nidigital/_attributes.py +++ b/generated/nidigital/nidigital/_attributes.py @@ -6,14 +6,13 @@ class Attribute(object): - '''Base class for all typed attributes.''' + """Base class for all typed attributes.""" def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -22,16 +21,19 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) + return hightime.timedelta( + milliseconds=session._get_attribute_vi_int32(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) + session._set_attribute_vi_int32( + self._attribute_id, + _converters.convert_timedelta_to_milliseconds_int32(value).value, + ) class AttributeViInt64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -40,7 +42,6 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -49,16 +50,19 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) + return hightime.timedelta( + seconds=session._get_attribute_vi_real64(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) + session._set_attribute_vi_real64( + self._attribute_id, + _converters.convert_timedelta_to_seconds_real64(value).value, + ) class AttributeViString(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -67,16 +71,17 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) + session._set_attribute_vi_string( + self._attribute_id, + _converters.convert_repeated_capabilities_without_prefix(value), + ) class AttributeViBoolean(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -85,31 +90,36 @@ def __set__(self, session, value): class AttributeEnum(object): - def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) + return self._attribute_type( + self._underlying_attribute.__get__(session, session_type) + ) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) + raise TypeError( + "must be " + + str(self._attribute_type.__name__) + + " not " + + str(type(value).__name__) + ) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): - def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from nidigital.session import SessionReference + return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) - - - + session._set_attribute_vi_session( + self._attribute_id, _converters.convert_to_nitclk_session_number(value) + ) diff --git a/generated/nidigital/nidigital/_converters.py b/generated/nidigital/nidigital/_converters.py index b36b311d8..a6c2c8434 100644 --- a/generated/nidigital/nidigital/_converters.py +++ b/generated/nidigital/nidigital/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - '''Base version that should not be called + """Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,36 +40,38 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - ''' - raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + """ + raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - '''Integer version''' + """Integer version""" return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - '''String version (this is the most complex) + """String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - ''' + """ # First we deal with a list - rep_cap_list = repeated_capability.split(',') + rep_cap_list = repeated_capability.split(",") if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, '').replace(':', '-') - rc = r.split('-') + r = repeated_capability.strip().replace(prefix, "").replace(":", "-") + rc = r.split("-") if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + raise errors.InvalidRepeatedCapabilityError( + "Multiple '-' or ':'", repeated_capability + ) try: start = int(rc[0]) end = int(rc[1]) @@ -85,7 +87,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, '').strip()] + return [repeated_capability.replace(prefix, "").strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -94,7 +96,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - '''Iterable version - can handle lists, ranges, and tuples''' + """Iterable version - can handle lists, ranges, and tuples""" rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -103,16 +105,22 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - '''slice version''' + """slice version""" + def ifnone(a, b): return b if a is None else a + # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) + rng = range( + ifnone(repeated_capability.start, 0), + repeated_capability.stop, + ifnone(repeated_capability.step, 1), + ) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=''): - '''Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=""): + """Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -120,15 +128,17 @@ def convert_repeated_capabilities(repeated_capability, prefix=''): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - ''' + """ # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] + return [ + prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) + ] def convert_repeated_capabilities_without_prefix(repeated_capability): - '''Convert a repeated capabilities object, without any prefix, to a comma delimited list + """Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -144,8 +154,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - ''' - return ','.join(convert_repeated_capabilities(repeated_capability, '')) + """ + return ",".join(convert_repeated_capabilities(repeated_capability, "")) def _convert_timedelta(value, library_type, scaling): @@ -158,7 +168,14 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: + if library_type in [ + _visatype.ViInt64, + _visatype.ViInt32, + _visatype.ViUInt32, + _visatype.ViInt16, + _visatype.ViUInt16, + _visatype.ViInt8, + ]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -195,34 +212,36 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - 'rangecheck': 'RangeCheck', - 'queryinstrstatus': 'QueryInstrStatus', - 'cache': 'Cache', - 'simulate': 'Simulate', - 'recordcoercions': 'RecordCoercions', - 'interchangecheck': 'InterchangeCheck', - 'driversetup': 'DriverSetup', - 'range_check': 'RangeCheck', - 'query_instr_status': 'QueryInstrStatus', - 'record_coercions': 'RecordCoercions', - 'interchange_check': 'InterchangeCheck', - 'driver_setup': 'DriverSetup', + "rangecheck": "RangeCheck", + "queryinstrstatus": "QueryInstrStatus", + "cache": "Cache", + "simulate": "Simulate", + "recordcoercions": "RecordCoercions", + "interchangecheck": "InterchangeCheck", + "driversetup": "DriverSetup", + "range_check": "RangeCheck", + "query_instr_status": "QueryInstrStatus", + "record_coercions": "RecordCoercions", + "interchange_check": "InterchangeCheck", + "driver_setup": "DriverSetup", } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': - value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') - elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': + if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": + value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") + elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": if not isinstance(values[k], dict): - raise TypeError('DriverSetup must be a dictionary') - value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) + raise TypeError("DriverSetup must be a dictionary") + value = "DriverSetup=" + ( + ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) + ) else: - value = k + ('=1' if values[k] is True else '=0') + value = k + ("=1" if values[k] is True else "=0") init_with_options.append(value) - init_with_options_string = ','.join(init_with_options) + init_with_options_string = ",".join(init_with_options) return init_with_options_string @@ -251,11 +270,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(',')] + return [x.strip() for x in comma_separated_string.split(",")] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -267,11 +286,17 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - ''' - chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) - repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] + """ + chained_repeated_capability_items = convert_comma_separated_string_to_list( + chained_repeated_capability + ) + repeated_capability_lists = [ + [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) + ] for item in chained_repeated_capability_items: - repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] - return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] - - + repeated_capability_lists = [ + x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) + ] + return [ + ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists + ] diff --git a/generated/nidigital/nidigital/_library.py b/generated/nidigital/nidigital/_library.py index 7912475c1..5d47c2095 100644 --- a/generated/nidigital/nidigital/_library.py +++ b/generated/nidigital/nidigital/_library.py @@ -11,11 +11,11 @@ class Library(object): - '''Library + """Library Wrapper around driver library. Class will setup the correct ctypes information for every function on first call. - ''' + """ def __init__(self, ctypes_library): self._func_lock = threading.Lock() @@ -124,7 +124,9 @@ def _get_library_function(self, name): def niDigital_Abort(self, vi): # noqa: N802 with self._func_lock: if self.niDigital_Abort_cfunc is None: - self.niDigital_Abort_cfunc = self._get_library_function('niDigital_Abort') + self.niDigital_Abort_cfunc = self._get_library_function( + "niDigital_Abort" + ) self.niDigital_Abort_cfunc.argtypes = [ViSession] # noqa: F405 self.niDigital_Abort_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_Abort_cfunc(vi) @@ -132,439 +134,1239 @@ def niDigital_Abort(self, vi): # noqa: N802 def niDigital_AbortKeepAlive(self, vi): # noqa: N802 with self._func_lock: if self.niDigital_AbortKeepAlive_cfunc is None: - self.niDigital_AbortKeepAlive_cfunc = self._get_library_function('niDigital_AbortKeepAlive') + self.niDigital_AbortKeepAlive_cfunc = self._get_library_function( + "niDigital_AbortKeepAlive" + ) self.niDigital_AbortKeepAlive_cfunc.argtypes = [ViSession] # noqa: F405 self.niDigital_AbortKeepAlive_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_AbortKeepAlive_cfunc(vi) - def niDigital_ApplyLevelsAndTiming(self, vi, site_list, levels_sheet, timing_sheet, initial_state_high_pins, initial_state_low_pins, initial_state_tristate_pins): # noqa: N802 + def niDigital_ApplyLevelsAndTiming( + self, + vi, + site_list, + levels_sheet, + timing_sheet, + initial_state_high_pins, + initial_state_low_pins, + initial_state_tristate_pins, + ): # noqa: N802 with self._func_lock: if self.niDigital_ApplyLevelsAndTiming_cfunc is None: - self.niDigital_ApplyLevelsAndTiming_cfunc = self._get_library_function('niDigital_ApplyLevelsAndTiming') - self.niDigital_ApplyLevelsAndTiming_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ctypes.POINTER(ViChar)] # noqa: F405 - self.niDigital_ApplyLevelsAndTiming_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_ApplyLevelsAndTiming_cfunc(vi, site_list, levels_sheet, timing_sheet, initial_state_high_pins, initial_state_low_pins, initial_state_tristate_pins) - - def niDigital_ApplyTDROffsets(self, vi, channel_list, num_offsets, offsets): # noqa: N802 + self.niDigital_ApplyLevelsAndTiming_cfunc = self._get_library_function( + "niDigital_ApplyLevelsAndTiming" + ) + self.niDigital_ApplyLevelsAndTiming_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niDigital_ApplyLevelsAndTiming_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_ApplyLevelsAndTiming_cfunc( + vi, + site_list, + levels_sheet, + timing_sheet, + initial_state_high_pins, + initial_state_low_pins, + initial_state_tristate_pins, + ) + + def niDigital_ApplyTDROffsets( + self, vi, channel_list, num_offsets, offsets + ): # noqa: N802 with self._func_lock: if self.niDigital_ApplyTDROffsets_cfunc is None: - self.niDigital_ApplyTDROffsets_cfunc = self._get_library_function('niDigital_ApplyTDROffsets') - self.niDigital_ApplyTDROffsets_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niDigital_ApplyTDROffsets_cfunc = self._get_library_function( + "niDigital_ApplyTDROffsets" + ) + self.niDigital_ApplyTDROffsets_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niDigital_ApplyTDROffsets_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_ApplyTDROffsets_cfunc(vi, channel_list, num_offsets, offsets) - - def niDigital_BurstPattern(self, vi, site_list, start_label, select_digital_function, wait_until_done, timeout): # noqa: N802 + return self.niDigital_ApplyTDROffsets_cfunc( + vi, channel_list, num_offsets, offsets + ) + + def niDigital_BurstPattern( + self, + vi, + site_list, + start_label, + select_digital_function, + wait_until_done, + timeout, + ): # noqa: N802 with self._func_lock: if self.niDigital_BurstPattern_cfunc is None: - self.niDigital_BurstPattern_cfunc = self._get_library_function('niDigital_BurstPattern') - self.niDigital_BurstPattern_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViBoolean, ViBoolean, ViReal64] # noqa: F405 + self.niDigital_BurstPattern_cfunc = self._get_library_function( + "niDigital_BurstPattern" + ) + self.niDigital_BurstPattern_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViBoolean, + ViBoolean, + ViReal64, + ] # noqa: F405 self.niDigital_BurstPattern_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_BurstPattern_cfunc(vi, site_list, start_label, select_digital_function, wait_until_done, timeout) + return self.niDigital_BurstPattern_cfunc( + vi, + site_list, + start_label, + select_digital_function, + wait_until_done, + timeout, + ) def niDigital_ClockGenerator_Abort(self, vi, channel_list): # noqa: N802 with self._func_lock: if self.niDigital_ClockGenerator_Abort_cfunc is None: - self.niDigital_ClockGenerator_Abort_cfunc = self._get_library_function('niDigital_ClockGenerator_Abort') - self.niDigital_ClockGenerator_Abort_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 - self.niDigital_ClockGenerator_Abort_cfunc.restype = ViStatus # noqa: F405 + self.niDigital_ClockGenerator_Abort_cfunc = self._get_library_function( + "niDigital_ClockGenerator_Abort" + ) + self.niDigital_ClockGenerator_Abort_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niDigital_ClockGenerator_Abort_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niDigital_ClockGenerator_Abort_cfunc(vi, channel_list) - def niDigital_ClockGenerator_GenerateClock(self, vi, channel_list, frequency, select_digital_function): # noqa: N802 + def niDigital_ClockGenerator_GenerateClock( + self, vi, channel_list, frequency, select_digital_function + ): # noqa: N802 with self._func_lock: if self.niDigital_ClockGenerator_GenerateClock_cfunc is None: - self.niDigital_ClockGenerator_GenerateClock_cfunc = self._get_library_function('niDigital_ClockGenerator_GenerateClock') - self.niDigital_ClockGenerator_GenerateClock_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViBoolean] # noqa: F405 - self.niDigital_ClockGenerator_GenerateClock_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_ClockGenerator_GenerateClock_cfunc(vi, channel_list, frequency, select_digital_function) + self.niDigital_ClockGenerator_GenerateClock_cfunc = ( + self._get_library_function("niDigital_ClockGenerator_GenerateClock") + ) + self.niDigital_ClockGenerator_GenerateClock_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViReal64, + ViBoolean, + ] # noqa: F405 + self.niDigital_ClockGenerator_GenerateClock_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_ClockGenerator_GenerateClock_cfunc( + vi, channel_list, frequency, select_digital_function + ) def niDigital_Commit(self, vi): # noqa: N802 with self._func_lock: if self.niDigital_Commit_cfunc is None: - self.niDigital_Commit_cfunc = self._get_library_function('niDigital_Commit') + self.niDigital_Commit_cfunc = self._get_library_function( + "niDigital_Commit" + ) self.niDigital_Commit_cfunc.argtypes = [ViSession] # noqa: F405 self.niDigital_Commit_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_Commit_cfunc(vi) - def niDigital_ConfigureActiveLoadLevels(self, vi, channel_list, iol, ioh, vcom): # noqa: N802 + def niDigital_ConfigureActiveLoadLevels( + self, vi, channel_list, iol, ioh, vcom + ): # noqa: N802 with self._func_lock: if self.niDigital_ConfigureActiveLoadLevels_cfunc is None: - self.niDigital_ConfigureActiveLoadLevels_cfunc = self._get_library_function('niDigital_ConfigureActiveLoadLevels') - self.niDigital_ConfigureActiveLoadLevels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViReal64, ViReal64] # noqa: F405 - self.niDigital_ConfigureActiveLoadLevels_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_ConfigureActiveLoadLevels_cfunc(vi, channel_list, iol, ioh, vcom) + self.niDigital_ConfigureActiveLoadLevels_cfunc = ( + self._get_library_function("niDigital_ConfigureActiveLoadLevels") + ) + self.niDigital_ConfigureActiveLoadLevels_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViReal64, + ViReal64, + ViReal64, + ] # noqa: F405 + self.niDigital_ConfigureActiveLoadLevels_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_ConfigureActiveLoadLevels_cfunc( + vi, channel_list, iol, ioh, vcom + ) def niDigital_ConfigurePatternBurstSites(self, vi, site_list): # noqa: N802 with self._func_lock: if self.niDigital_ConfigurePatternBurstSites_cfunc is None: - self.niDigital_ConfigurePatternBurstSites_cfunc = self._get_library_function('niDigital_ConfigurePatternBurstSites') - self.niDigital_ConfigurePatternBurstSites_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 - self.niDigital_ConfigurePatternBurstSites_cfunc.restype = ViStatus # noqa: F405 + self.niDigital_ConfigurePatternBurstSites_cfunc = ( + self._get_library_function("niDigital_ConfigurePatternBurstSites") + ) + self.niDigital_ConfigurePatternBurstSites_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niDigital_ConfigurePatternBurstSites_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niDigital_ConfigurePatternBurstSites_cfunc(vi, site_list) - def niDigital_ConfigureTimeSetCompareEdgesStrobe(self, vi, pin_list, time_set_name, strobe_edge): # noqa: N802 + def niDigital_ConfigureTimeSetCompareEdgesStrobe( + self, vi, pin_list, time_set_name, strobe_edge + ): # noqa: N802 with self._func_lock: if self.niDigital_ConfigureTimeSetCompareEdgesStrobe_cfunc is None: - self.niDigital_ConfigureTimeSetCompareEdgesStrobe_cfunc = self._get_library_function('niDigital_ConfigureTimeSetCompareEdgesStrobe') - self.niDigital_ConfigureTimeSetCompareEdgesStrobe_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViReal64] # noqa: F405 - self.niDigital_ConfigureTimeSetCompareEdgesStrobe_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_ConfigureTimeSetCompareEdgesStrobe_cfunc(vi, pin_list, time_set_name, strobe_edge) - - def niDigital_ConfigureTimeSetCompareEdgesStrobe2x(self, vi, pin_list, time_set_name, strobe_edge, strobe2_edge): # noqa: N802 + self.niDigital_ConfigureTimeSetCompareEdgesStrobe_cfunc = ( + self._get_library_function( + "niDigital_ConfigureTimeSetCompareEdgesStrobe" + ) + ) + self.niDigital_ConfigureTimeSetCompareEdgesStrobe_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViReal64, + ] # noqa: F405 + self.niDigital_ConfigureTimeSetCompareEdgesStrobe_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_ConfigureTimeSetCompareEdgesStrobe_cfunc( + vi, pin_list, time_set_name, strobe_edge + ) + + def niDigital_ConfigureTimeSetCompareEdgesStrobe2x( + self, vi, pin_list, time_set_name, strobe_edge, strobe2_edge + ): # noqa: N802 with self._func_lock: if self.niDigital_ConfigureTimeSetCompareEdgesStrobe2x_cfunc is None: - self.niDigital_ConfigureTimeSetCompareEdgesStrobe2x_cfunc = self._get_library_function('niDigital_ConfigureTimeSetCompareEdgesStrobe2x') - self.niDigital_ConfigureTimeSetCompareEdgesStrobe2x_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViReal64, ViReal64] # noqa: F405 - self.niDigital_ConfigureTimeSetCompareEdgesStrobe2x_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_ConfigureTimeSetCompareEdgesStrobe2x_cfunc(vi, pin_list, time_set_name, strobe_edge, strobe2_edge) - - def niDigital_ConfigureTimeSetDriveEdges(self, vi, pin_list, time_set_name, format, drive_on_edge, drive_data_edge, drive_return_edge, drive_off_edge): # noqa: N802 + self.niDigital_ConfigureTimeSetCompareEdgesStrobe2x_cfunc = ( + self._get_library_function( + "niDigital_ConfigureTimeSetCompareEdgesStrobe2x" + ) + ) + self.niDigital_ConfigureTimeSetCompareEdgesStrobe2x_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViReal64, + ViReal64, + ] # noqa: F405 + self.niDigital_ConfigureTimeSetCompareEdgesStrobe2x_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_ConfigureTimeSetCompareEdgesStrobe2x_cfunc( + vi, pin_list, time_set_name, strobe_edge, strobe2_edge + ) + + def niDigital_ConfigureTimeSetDriveEdges( + self, + vi, + pin_list, + time_set_name, + format, + drive_on_edge, + drive_data_edge, + drive_return_edge, + drive_off_edge, + ): # noqa: N802 with self._func_lock: if self.niDigital_ConfigureTimeSetDriveEdges_cfunc is None: - self.niDigital_ConfigureTimeSetDriveEdges_cfunc = self._get_library_function('niDigital_ConfigureTimeSetDriveEdges') - self.niDigital_ConfigureTimeSetDriveEdges_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ViReal64, ViReal64, ViReal64, ViReal64] # noqa: F405 - self.niDigital_ConfigureTimeSetDriveEdges_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_ConfigureTimeSetDriveEdges_cfunc(vi, pin_list, time_set_name, format, drive_on_edge, drive_data_edge, drive_return_edge, drive_off_edge) - - def niDigital_ConfigureTimeSetDriveEdges2x(self, vi, pin_list, time_set_name, format, drive_on_edge, drive_data_edge, drive_return_edge, drive_off_edge, drive_data2_edge, drive_return2_edge): # noqa: N802 + self.niDigital_ConfigureTimeSetDriveEdges_cfunc = ( + self._get_library_function("niDigital_ConfigureTimeSetDriveEdges") + ) + self.niDigital_ConfigureTimeSetDriveEdges_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViInt32, + ViReal64, + ViReal64, + ViReal64, + ViReal64, + ] # noqa: F405 + self.niDigital_ConfigureTimeSetDriveEdges_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_ConfigureTimeSetDriveEdges_cfunc( + vi, + pin_list, + time_set_name, + format, + drive_on_edge, + drive_data_edge, + drive_return_edge, + drive_off_edge, + ) + + def niDigital_ConfigureTimeSetDriveEdges2x( + self, + vi, + pin_list, + time_set_name, + format, + drive_on_edge, + drive_data_edge, + drive_return_edge, + drive_off_edge, + drive_data2_edge, + drive_return2_edge, + ): # noqa: N802 with self._func_lock: if self.niDigital_ConfigureTimeSetDriveEdges2x_cfunc is None: - self.niDigital_ConfigureTimeSetDriveEdges2x_cfunc = self._get_library_function('niDigital_ConfigureTimeSetDriveEdges2x') - self.niDigital_ConfigureTimeSetDriveEdges2x_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ViReal64, ViReal64, ViReal64, ViReal64, ViReal64, ViReal64] # noqa: F405 - self.niDigital_ConfigureTimeSetDriveEdges2x_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_ConfigureTimeSetDriveEdges2x_cfunc(vi, pin_list, time_set_name, format, drive_on_edge, drive_data_edge, drive_return_edge, drive_off_edge, drive_data2_edge, drive_return2_edge) - - def niDigital_ConfigureTimeSetDriveFormat(self, vi, pin_list, time_set_name, drive_format): # noqa: N802 + self.niDigital_ConfigureTimeSetDriveEdges2x_cfunc = ( + self._get_library_function("niDigital_ConfigureTimeSetDriveEdges2x") + ) + self.niDigital_ConfigureTimeSetDriveEdges2x_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViInt32, + ViReal64, + ViReal64, + ViReal64, + ViReal64, + ViReal64, + ViReal64, + ] # noqa: F405 + self.niDigital_ConfigureTimeSetDriveEdges2x_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_ConfigureTimeSetDriveEdges2x_cfunc( + vi, + pin_list, + time_set_name, + format, + drive_on_edge, + drive_data_edge, + drive_return_edge, + drive_off_edge, + drive_data2_edge, + drive_return2_edge, + ) + + def niDigital_ConfigureTimeSetDriveFormat( + self, vi, pin_list, time_set_name, drive_format + ): # noqa: N802 with self._func_lock: if self.niDigital_ConfigureTimeSetDriveFormat_cfunc is None: - self.niDigital_ConfigureTimeSetDriveFormat_cfunc = self._get_library_function('niDigital_ConfigureTimeSetDriveFormat') - self.niDigital_ConfigureTimeSetDriveFormat_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32] # noqa: F405 - self.niDigital_ConfigureTimeSetDriveFormat_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_ConfigureTimeSetDriveFormat_cfunc(vi, pin_list, time_set_name, drive_format) - - def niDigital_ConfigureTimeSetEdge(self, vi, pin_list, time_set_name, edge, time): # noqa: N802 + self.niDigital_ConfigureTimeSetDriveFormat_cfunc = ( + self._get_library_function("niDigital_ConfigureTimeSetDriveFormat") + ) + self.niDigital_ConfigureTimeSetDriveFormat_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViInt32, + ] # noqa: F405 + self.niDigital_ConfigureTimeSetDriveFormat_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_ConfigureTimeSetDriveFormat_cfunc( + vi, pin_list, time_set_name, drive_format + ) + + def niDigital_ConfigureTimeSetEdge( + self, vi, pin_list, time_set_name, edge, time + ): # noqa: N802 with self._func_lock: if self.niDigital_ConfigureTimeSetEdge_cfunc is None: - self.niDigital_ConfigureTimeSetEdge_cfunc = self._get_library_function('niDigital_ConfigureTimeSetEdge') - self.niDigital_ConfigureTimeSetEdge_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ViReal64] # noqa: F405 - self.niDigital_ConfigureTimeSetEdge_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_ConfigureTimeSetEdge_cfunc(vi, pin_list, time_set_name, edge, time) - - def niDigital_ConfigureTimeSetEdgeMultiplier(self, vi, pin_list, time_set_name, edge_multiplier): # noqa: N802 + self.niDigital_ConfigureTimeSetEdge_cfunc = self._get_library_function( + "niDigital_ConfigureTimeSetEdge" + ) + self.niDigital_ConfigureTimeSetEdge_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViInt32, + ViReal64, + ] # noqa: F405 + self.niDigital_ConfigureTimeSetEdge_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_ConfigureTimeSetEdge_cfunc( + vi, pin_list, time_set_name, edge, time + ) + + def niDigital_ConfigureTimeSetEdgeMultiplier( + self, vi, pin_list, time_set_name, edge_multiplier + ): # noqa: N802 with self._func_lock: if self.niDigital_ConfigureTimeSetEdgeMultiplier_cfunc is None: - self.niDigital_ConfigureTimeSetEdgeMultiplier_cfunc = self._get_library_function('niDigital_ConfigureTimeSetEdgeMultiplier') - self.niDigital_ConfigureTimeSetEdgeMultiplier_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32] # noqa: F405 - self.niDigital_ConfigureTimeSetEdgeMultiplier_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_ConfigureTimeSetEdgeMultiplier_cfunc(vi, pin_list, time_set_name, edge_multiplier) + self.niDigital_ConfigureTimeSetEdgeMultiplier_cfunc = ( + self._get_library_function( + "niDigital_ConfigureTimeSetEdgeMultiplier" + ) + ) + self.niDigital_ConfigureTimeSetEdgeMultiplier_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViInt32, + ] # noqa: F405 + self.niDigital_ConfigureTimeSetEdgeMultiplier_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_ConfigureTimeSetEdgeMultiplier_cfunc( + vi, pin_list, time_set_name, edge_multiplier + ) def niDigital_ConfigureTimeSetPeriod(self, vi, time_set_name, period): # noqa: N802 with self._func_lock: if self.niDigital_ConfigureTimeSetPeriod_cfunc is None: - self.niDigital_ConfigureTimeSetPeriod_cfunc = self._get_library_function('niDigital_ConfigureTimeSetPeriod') - self.niDigital_ConfigureTimeSetPeriod_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64] # noqa: F405 - self.niDigital_ConfigureTimeSetPeriod_cfunc.restype = ViStatus # noqa: F405 + self.niDigital_ConfigureTimeSetPeriod_cfunc = ( + self._get_library_function("niDigital_ConfigureTimeSetPeriod") + ) + self.niDigital_ConfigureTimeSetPeriod_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViReal64, + ] # noqa: F405 + self.niDigital_ConfigureTimeSetPeriod_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niDigital_ConfigureTimeSetPeriod_cfunc(vi, time_set_name, period) - def niDigital_ConfigureVoltageLevels(self, vi, channel_list, vil, vih, vol, voh, vterm): # noqa: N802 + def niDigital_ConfigureVoltageLevels( + self, vi, channel_list, vil, vih, vol, voh, vterm + ): # noqa: N802 with self._func_lock: if self.niDigital_ConfigureVoltageLevels_cfunc is None: - self.niDigital_ConfigureVoltageLevels_cfunc = self._get_library_function('niDigital_ConfigureVoltageLevels') - self.niDigital_ConfigureVoltageLevels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViReal64, ViReal64, ViReal64, ViReal64] # noqa: F405 - self.niDigital_ConfigureVoltageLevels_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_ConfigureVoltageLevels_cfunc(vi, channel_list, vil, vih, vol, voh, vterm) - - def niDigital_CreateCaptureWaveformFromFileDigicapture(self, vi, waveform_name, waveform_file_path): # noqa: N802 + self.niDigital_ConfigureVoltageLevels_cfunc = ( + self._get_library_function("niDigital_ConfigureVoltageLevels") + ) + self.niDigital_ConfigureVoltageLevels_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViReal64, + ViReal64, + ViReal64, + ViReal64, + ViReal64, + ] # noqa: F405 + self.niDigital_ConfigureVoltageLevels_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_ConfigureVoltageLevels_cfunc( + vi, channel_list, vil, vih, vol, voh, vterm + ) + + def niDigital_CreateCaptureWaveformFromFileDigicapture( + self, vi, waveform_name, waveform_file_path + ): # noqa: N802 with self._func_lock: if self.niDigital_CreateCaptureWaveformFromFileDigicapture_cfunc is None: - self.niDigital_CreateCaptureWaveformFromFileDigicapture_cfunc = self._get_library_function('niDigital_CreateCaptureWaveformFromFileDigicapture') - self.niDigital_CreateCaptureWaveformFromFileDigicapture_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar)] # noqa: F405 - self.niDigital_CreateCaptureWaveformFromFileDigicapture_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_CreateCaptureWaveformFromFileDigicapture_cfunc(vi, waveform_name, waveform_file_path) - - def niDigital_CreateCaptureWaveformParallel(self, vi, pin_list, waveform_name): # noqa: N802 + self.niDigital_CreateCaptureWaveformFromFileDigicapture_cfunc = ( + self._get_library_function( + "niDigital_CreateCaptureWaveformFromFileDigicapture" + ) + ) + self.niDigital_CreateCaptureWaveformFromFileDigicapture_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niDigital_CreateCaptureWaveformFromFileDigicapture_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_CreateCaptureWaveformFromFileDigicapture_cfunc( + vi, waveform_name, waveform_file_path + ) + + def niDigital_CreateCaptureWaveformParallel( + self, vi, pin_list, waveform_name + ): # noqa: N802 with self._func_lock: if self.niDigital_CreateCaptureWaveformParallel_cfunc is None: - self.niDigital_CreateCaptureWaveformParallel_cfunc = self._get_library_function('niDigital_CreateCaptureWaveformParallel') - self.niDigital_CreateCaptureWaveformParallel_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar)] # noqa: F405 - self.niDigital_CreateCaptureWaveformParallel_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_CreateCaptureWaveformParallel_cfunc(vi, pin_list, waveform_name) - - def niDigital_CreateCaptureWaveformSerial(self, vi, pin_list, waveform_name, sample_width, bit_order): # noqa: N802 + self.niDigital_CreateCaptureWaveformParallel_cfunc = ( + self._get_library_function( + "niDigital_CreateCaptureWaveformParallel" + ) + ) + self.niDigital_CreateCaptureWaveformParallel_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niDigital_CreateCaptureWaveformParallel_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_CreateCaptureWaveformParallel_cfunc( + vi, pin_list, waveform_name + ) + + def niDigital_CreateCaptureWaveformSerial( + self, vi, pin_list, waveform_name, sample_width, bit_order + ): # noqa: N802 with self._func_lock: if self.niDigital_CreateCaptureWaveformSerial_cfunc is None: - self.niDigital_CreateCaptureWaveformSerial_cfunc = self._get_library_function('niDigital_CreateCaptureWaveformSerial') - self.niDigital_CreateCaptureWaveformSerial_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViUInt32, ViInt32] # noqa: F405 - self.niDigital_CreateCaptureWaveformSerial_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_CreateCaptureWaveformSerial_cfunc(vi, pin_list, waveform_name, sample_width, bit_order) - - def niDigital_CreateSourceWaveformFromFileTDMS(self, vi, waveform_name, waveform_file_path, write_waveform_data): # noqa: N802 + self.niDigital_CreateCaptureWaveformSerial_cfunc = ( + self._get_library_function("niDigital_CreateCaptureWaveformSerial") + ) + self.niDigital_CreateCaptureWaveformSerial_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViUInt32, + ViInt32, + ] # noqa: F405 + self.niDigital_CreateCaptureWaveformSerial_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_CreateCaptureWaveformSerial_cfunc( + vi, pin_list, waveform_name, sample_width, bit_order + ) + + def niDigital_CreateSourceWaveformFromFileTDMS( + self, vi, waveform_name, waveform_file_path, write_waveform_data + ): # noqa: N802 with self._func_lock: if self.niDigital_CreateSourceWaveformFromFileTDMS_cfunc is None: - self.niDigital_CreateSourceWaveformFromFileTDMS_cfunc = self._get_library_function('niDigital_CreateSourceWaveformFromFileTDMS') - self.niDigital_CreateSourceWaveformFromFileTDMS_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViBoolean] # noqa: F405 - self.niDigital_CreateSourceWaveformFromFileTDMS_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_CreateSourceWaveformFromFileTDMS_cfunc(vi, waveform_name, waveform_file_path, write_waveform_data) - - def niDigital_CreateSourceWaveformParallel(self, vi, pin_list, waveform_name, data_mapping): # noqa: N802 + self.niDigital_CreateSourceWaveformFromFileTDMS_cfunc = ( + self._get_library_function( + "niDigital_CreateSourceWaveformFromFileTDMS" + ) + ) + self.niDigital_CreateSourceWaveformFromFileTDMS_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViBoolean, + ] # noqa: F405 + self.niDigital_CreateSourceWaveformFromFileTDMS_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_CreateSourceWaveformFromFileTDMS_cfunc( + vi, waveform_name, waveform_file_path, write_waveform_data + ) + + def niDigital_CreateSourceWaveformParallel( + self, vi, pin_list, waveform_name, data_mapping + ): # noqa: N802 with self._func_lock: if self.niDigital_CreateSourceWaveformParallel_cfunc is None: - self.niDigital_CreateSourceWaveformParallel_cfunc = self._get_library_function('niDigital_CreateSourceWaveformParallel') - self.niDigital_CreateSourceWaveformParallel_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32] # noqa: F405 - self.niDigital_CreateSourceWaveformParallel_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_CreateSourceWaveformParallel_cfunc(vi, pin_list, waveform_name, data_mapping) - - def niDigital_CreateSourceWaveformSerial(self, vi, pin_list, waveform_name, data_mapping, sample_width, bit_order): # noqa: N802 + self.niDigital_CreateSourceWaveformParallel_cfunc = ( + self._get_library_function("niDigital_CreateSourceWaveformParallel") + ) + self.niDigital_CreateSourceWaveformParallel_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViInt32, + ] # noqa: F405 + self.niDigital_CreateSourceWaveformParallel_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_CreateSourceWaveformParallel_cfunc( + vi, pin_list, waveform_name, data_mapping + ) + + def niDigital_CreateSourceWaveformSerial( + self, vi, pin_list, waveform_name, data_mapping, sample_width, bit_order + ): # noqa: N802 with self._func_lock: if self.niDigital_CreateSourceWaveformSerial_cfunc is None: - self.niDigital_CreateSourceWaveformSerial_cfunc = self._get_library_function('niDigital_CreateSourceWaveformSerial') - self.niDigital_CreateSourceWaveformSerial_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ViUInt32, ViInt32] # noqa: F405 - self.niDigital_CreateSourceWaveformSerial_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_CreateSourceWaveformSerial_cfunc(vi, pin_list, waveform_name, data_mapping, sample_width, bit_order) + self.niDigital_CreateSourceWaveformSerial_cfunc = ( + self._get_library_function("niDigital_CreateSourceWaveformSerial") + ) + self.niDigital_CreateSourceWaveformSerial_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViInt32, + ViUInt32, + ViInt32, + ] # noqa: F405 + self.niDigital_CreateSourceWaveformSerial_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_CreateSourceWaveformSerial_cfunc( + vi, pin_list, waveform_name, data_mapping, sample_width, bit_order + ) def niDigital_CreateTimeSet(self, vi, name): # noqa: N802 with self._func_lock: if self.niDigital_CreateTimeSet_cfunc is None: - self.niDigital_CreateTimeSet_cfunc = self._get_library_function('niDigital_CreateTimeSet') - self.niDigital_CreateTimeSet_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_CreateTimeSet_cfunc = self._get_library_function( + "niDigital_CreateTimeSet" + ) + self.niDigital_CreateTimeSet_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDigital_CreateTimeSet_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_CreateTimeSet_cfunc(vi, name) def niDigital_DeleteAllTimeSets(self, vi): # noqa: N802 with self._func_lock: if self.niDigital_DeleteAllTimeSets_cfunc is None: - self.niDigital_DeleteAllTimeSets_cfunc = self._get_library_function('niDigital_DeleteAllTimeSets') - self.niDigital_DeleteAllTimeSets_cfunc.argtypes = [ViSession] # noqa: F405 + self.niDigital_DeleteAllTimeSets_cfunc = self._get_library_function( + "niDigital_DeleteAllTimeSets" + ) + self.niDigital_DeleteAllTimeSets_cfunc.argtypes = [ + ViSession + ] # noqa: F405 self.niDigital_DeleteAllTimeSets_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_DeleteAllTimeSets_cfunc(vi) def niDigital_DisableSites(self, vi, site_list): # noqa: N802 with self._func_lock: if self.niDigital_DisableSites_cfunc is None: - self.niDigital_DisableSites_cfunc = self._get_library_function('niDigital_DisableSites') - self.niDigital_DisableSites_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_DisableSites_cfunc = self._get_library_function( + "niDigital_DisableSites" + ) + self.niDigital_DisableSites_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDigital_DisableSites_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_DisableSites_cfunc(vi, site_list) def niDigital_EnableSites(self, vi, site_list): # noqa: N802 with self._func_lock: if self.niDigital_EnableSites_cfunc is None: - self.niDigital_EnableSites_cfunc = self._get_library_function('niDigital_EnableSites') - self.niDigital_EnableSites_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_EnableSites_cfunc = self._get_library_function( + "niDigital_EnableSites" + ) + self.niDigital_EnableSites_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDigital_EnableSites_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_EnableSites_cfunc(vi, site_list) - def niDigital_FetchCaptureWaveformU32(self, vi, site_list, waveform_name, samples_to_read, timeout, data_buffer_size, data, actual_num_waveforms, actual_samples_per_waveform): # noqa: N802 + def niDigital_FetchCaptureWaveformU32( + self, + vi, + site_list, + waveform_name, + samples_to_read, + timeout, + data_buffer_size, + data, + actual_num_waveforms, + actual_samples_per_waveform, + ): # noqa: N802 with self._func_lock: if self.niDigital_FetchCaptureWaveformU32_cfunc is None: - self.niDigital_FetchCaptureWaveformU32_cfunc = self._get_library_function('niDigital_FetchCaptureWaveformU32') - self.niDigital_FetchCaptureWaveformU32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ViReal64, ViInt32, ctypes.POINTER(ViUInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 - self.niDigital_FetchCaptureWaveformU32_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_FetchCaptureWaveformU32_cfunc(vi, site_list, waveform_name, samples_to_read, timeout, data_buffer_size, data, actual_num_waveforms, actual_samples_per_waveform) - - def niDigital_FetchHistoryRAMCycleInformation(self, vi, site, sample_index, pattern_index, time_set_index, vector_number, cycle_number, num_dut_cycles): # noqa: N802 + self.niDigital_FetchCaptureWaveformU32_cfunc = ( + self._get_library_function("niDigital_FetchCaptureWaveformU32") + ) + self.niDigital_FetchCaptureWaveformU32_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViInt32, + ViReal64, + ViInt32, + ctypes.POINTER(ViUInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niDigital_FetchCaptureWaveformU32_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_FetchCaptureWaveformU32_cfunc( + vi, + site_list, + waveform_name, + samples_to_read, + timeout, + data_buffer_size, + data, + actual_num_waveforms, + actual_samples_per_waveform, + ) + + def niDigital_FetchHistoryRAMCycleInformation( + self, + vi, + site, + sample_index, + pattern_index, + time_set_index, + vector_number, + cycle_number, + num_dut_cycles, + ): # noqa: N802 with self._func_lock: if self.niDigital_FetchHistoryRAMCycleInformation_cfunc is None: - self.niDigital_FetchHistoryRAMCycleInformation_cfunc = self._get_library_function('niDigital_FetchHistoryRAMCycleInformation') - self.niDigital_FetchHistoryRAMCycleInformation_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt64, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt64), ctypes.POINTER(ViInt64), ctypes.POINTER(ViInt32)] # noqa: F405 - self.niDigital_FetchHistoryRAMCycleInformation_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_FetchHistoryRAMCycleInformation_cfunc(vi, site, sample_index, pattern_index, time_set_index, vector_number, cycle_number, num_dut_cycles) - - def niDigital_FetchHistoryRAMCyclePinData(self, vi, site, pin_list, sample_index, dut_cycle_index, pin_data_buffer_size, expected_pin_states, actual_pin_states, per_pin_pass_fail, actual_num_pin_data): # noqa: N802 + self.niDigital_FetchHistoryRAMCycleInformation_cfunc = ( + self._get_library_function( + "niDigital_FetchHistoryRAMCycleInformation" + ) + ) + self.niDigital_FetchHistoryRAMCycleInformation_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt64, + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt64), + ctypes.POINTER(ViInt64), + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niDigital_FetchHistoryRAMCycleInformation_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_FetchHistoryRAMCycleInformation_cfunc( + vi, + site, + sample_index, + pattern_index, + time_set_index, + vector_number, + cycle_number, + num_dut_cycles, + ) + + def niDigital_FetchHistoryRAMCyclePinData( + self, + vi, + site, + pin_list, + sample_index, + dut_cycle_index, + pin_data_buffer_size, + expected_pin_states, + actual_pin_states, + per_pin_pass_fail, + actual_num_pin_data, + ): # noqa: N802 with self._func_lock: if self.niDigital_FetchHistoryRAMCyclePinData_cfunc is None: - self.niDigital_FetchHistoryRAMCyclePinData_cfunc = self._get_library_function('niDigital_FetchHistoryRAMCyclePinData') - self.niDigital_FetchHistoryRAMCyclePinData_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt64, ViInt32, ViInt32, ctypes.POINTER(ViUInt8), ctypes.POINTER(ViUInt8), ctypes.POINTER(ViBoolean), ctypes.POINTER(ViInt32)] # noqa: F405 - self.niDigital_FetchHistoryRAMCyclePinData_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_FetchHistoryRAMCyclePinData_cfunc(vi, site, pin_list, sample_index, dut_cycle_index, pin_data_buffer_size, expected_pin_states, actual_pin_states, per_pin_pass_fail, actual_num_pin_data) - - def niDigital_FetchHistoryRAMScanCycleNumber(self, vi, site, sample_index, scan_cycle_number): # noqa: N802 + self.niDigital_FetchHistoryRAMCyclePinData_cfunc = ( + self._get_library_function("niDigital_FetchHistoryRAMCyclePinData") + ) + self.niDigital_FetchHistoryRAMCyclePinData_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViInt64, + ViInt32, + ViInt32, + ctypes.POINTER(ViUInt8), + ctypes.POINTER(ViUInt8), + ctypes.POINTER(ViBoolean), + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niDigital_FetchHistoryRAMCyclePinData_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_FetchHistoryRAMCyclePinData_cfunc( + vi, + site, + pin_list, + sample_index, + dut_cycle_index, + pin_data_buffer_size, + expected_pin_states, + actual_pin_states, + per_pin_pass_fail, + actual_num_pin_data, + ) + + def niDigital_FetchHistoryRAMScanCycleNumber( + self, vi, site, sample_index, scan_cycle_number + ): # noqa: N802 with self._func_lock: if self.niDigital_FetchHistoryRAMScanCycleNumber_cfunc is None: - self.niDigital_FetchHistoryRAMScanCycleNumber_cfunc = self._get_library_function('niDigital_FetchHistoryRAMScanCycleNumber') - self.niDigital_FetchHistoryRAMScanCycleNumber_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt64, ctypes.POINTER(ViInt64)] # noqa: F405 - self.niDigital_FetchHistoryRAMScanCycleNumber_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_FetchHistoryRAMScanCycleNumber_cfunc(vi, site, sample_index, scan_cycle_number) - - def niDigital_FrequencyCounter_MeasureFrequency(self, vi, channel_list, frequencies_buffer_size, frequencies, actual_num_frequencies): # noqa: N802 + self.niDigital_FetchHistoryRAMScanCycleNumber_cfunc = ( + self._get_library_function( + "niDigital_FetchHistoryRAMScanCycleNumber" + ) + ) + self.niDigital_FetchHistoryRAMScanCycleNumber_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt64, + ctypes.POINTER(ViInt64), + ] # noqa: F405 + self.niDigital_FetchHistoryRAMScanCycleNumber_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_FetchHistoryRAMScanCycleNumber_cfunc( + vi, site, sample_index, scan_cycle_number + ) + + def niDigital_FrequencyCounter_MeasureFrequency( + self, + vi, + channel_list, + frequencies_buffer_size, + frequencies, + actual_num_frequencies, + ): # noqa: N802 with self._func_lock: if self.niDigital_FrequencyCounter_MeasureFrequency_cfunc is None: - self.niDigital_FrequencyCounter_MeasureFrequency_cfunc = self._get_library_function('niDigital_FrequencyCounter_MeasureFrequency') - self.niDigital_FrequencyCounter_MeasureFrequency_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt32)] # noqa: F405 - self.niDigital_FrequencyCounter_MeasureFrequency_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_FrequencyCounter_MeasureFrequency_cfunc(vi, channel_list, frequencies_buffer_size, frequencies, actual_num_frequencies) - - def niDigital_GetAttributeViBoolean(self, vi, channel_name, attribute, value): # noqa: N802 + self.niDigital_FrequencyCounter_MeasureFrequency_cfunc = ( + self._get_library_function( + "niDigital_FrequencyCounter_MeasureFrequency" + ) + ) + self.niDigital_FrequencyCounter_MeasureFrequency_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niDigital_FrequencyCounter_MeasureFrequency_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_FrequencyCounter_MeasureFrequency_cfunc( + vi, + channel_list, + frequencies_buffer_size, + frequencies, + actual_num_frequencies, + ) + + def niDigital_GetAttributeViBoolean( + self, vi, channel_name, attribute, value + ): # noqa: N802 with self._func_lock: if self.niDigital_GetAttributeViBoolean_cfunc is None: - self.niDigital_GetAttributeViBoolean_cfunc = self._get_library_function('niDigital_GetAttributeViBoolean') - self.niDigital_GetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViBoolean)] # noqa: F405 - self.niDigital_GetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_GetAttributeViBoolean_cfunc(vi, channel_name, attribute, value) - - def niDigital_GetAttributeViInt32(self, vi, channel_name, attribute, value): # noqa: N802 + self.niDigital_GetAttributeViBoolean_cfunc = self._get_library_function( + "niDigital_GetAttributeViBoolean" + ) + self.niDigital_GetAttributeViBoolean_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 + self.niDigital_GetAttributeViBoolean_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_GetAttributeViBoolean_cfunc( + vi, channel_name, attribute, value + ) + + def niDigital_GetAttributeViInt32( + self, vi, channel_name, attribute, value + ): # noqa: N802 with self._func_lock: if self.niDigital_GetAttributeViInt32_cfunc is None: - self.niDigital_GetAttributeViInt32_cfunc = self._get_library_function('niDigital_GetAttributeViInt32') - self.niDigital_GetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViInt32)] # noqa: F405 - self.niDigital_GetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_GetAttributeViInt32_cfunc(vi, channel_name, attribute, value) - - def niDigital_GetAttributeViInt64(self, vi, channel_name, attribute, value): # noqa: N802 + self.niDigital_GetAttributeViInt32_cfunc = self._get_library_function( + "niDigital_GetAttributeViInt32" + ) + self.niDigital_GetAttributeViInt32_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niDigital_GetAttributeViInt32_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_GetAttributeViInt32_cfunc( + vi, channel_name, attribute, value + ) + + def niDigital_GetAttributeViInt64( + self, vi, channel_name, attribute, value + ): # noqa: N802 with self._func_lock: if self.niDigital_GetAttributeViInt64_cfunc is None: - self.niDigital_GetAttributeViInt64_cfunc = self._get_library_function('niDigital_GetAttributeViInt64') - self.niDigital_GetAttributeViInt64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViInt64)] # noqa: F405 - self.niDigital_GetAttributeViInt64_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_GetAttributeViInt64_cfunc(vi, channel_name, attribute, value) - - def niDigital_GetAttributeViReal64(self, vi, channel_name, attribute, value): # noqa: N802 + self.niDigital_GetAttributeViInt64_cfunc = self._get_library_function( + "niDigital_GetAttributeViInt64" + ) + self.niDigital_GetAttributeViInt64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViInt64), + ] # noqa: F405 + self.niDigital_GetAttributeViInt64_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_GetAttributeViInt64_cfunc( + vi, channel_name, attribute, value + ) + + def niDigital_GetAttributeViReal64( + self, vi, channel_name, attribute, value + ): # noqa: N802 with self._func_lock: if self.niDigital_GetAttributeViReal64_cfunc is None: - self.niDigital_GetAttributeViReal64_cfunc = self._get_library_function('niDigital_GetAttributeViReal64') - self.niDigital_GetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViReal64)] # noqa: F405 - self.niDigital_GetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_GetAttributeViReal64_cfunc(vi, channel_name, attribute, value) - - def niDigital_GetAttributeViString(self, vi, channel_name, attribute, buffer_size, value): # noqa: N802 + self.niDigital_GetAttributeViReal64_cfunc = self._get_library_function( + "niDigital_GetAttributeViReal64" + ) + self.niDigital_GetAttributeViReal64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViReal64), + ] # noqa: F405 + self.niDigital_GetAttributeViReal64_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_GetAttributeViReal64_cfunc( + vi, channel_name, attribute, value + ) + + def niDigital_GetAttributeViString( + self, vi, channel_name, attribute, buffer_size, value + ): # noqa: N802 with self._func_lock: if self.niDigital_GetAttributeViString_cfunc is None: - self.niDigital_GetAttributeViString_cfunc = self._get_library_function('niDigital_GetAttributeViString') - self.niDigital_GetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 - self.niDigital_GetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_GetAttributeViString_cfunc(vi, channel_name, attribute, buffer_size, value) - - def niDigital_GetChannelNameFromString(self, vi, indices, name_buffer_size, names): # noqa: N802 + self.niDigital_GetAttributeViString_cfunc = self._get_library_function( + "niDigital_GetAttributeViString" + ) + self.niDigital_GetAttributeViString_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niDigital_GetAttributeViString_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_GetAttributeViString_cfunc( + vi, channel_name, attribute, buffer_size, value + ) + + def niDigital_GetChannelNameFromString( + self, vi, indices, name_buffer_size, names + ): # noqa: N802 with self._func_lock: if self.niDigital_GetChannelNameFromString_cfunc is None: - self.niDigital_GetChannelNameFromString_cfunc = self._get_library_function('niDigital_GetChannelNameFromString') - self.niDigital_GetChannelNameFromString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 - self.niDigital_GetChannelNameFromString_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_GetChannelNameFromString_cfunc(vi, indices, name_buffer_size, names) - - def niDigital_GetError(self, vi, error_code, error_description_buffer_size, error_description): # noqa: N802 + self.niDigital_GetChannelNameFromString_cfunc = ( + self._get_library_function("niDigital_GetChannelNameFromString") + ) + self.niDigital_GetChannelNameFromString_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niDigital_GetChannelNameFromString_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_GetChannelNameFromString_cfunc( + vi, indices, name_buffer_size, names + ) + + def niDigital_GetError( + self, vi, error_code, error_description_buffer_size, error_description + ): # noqa: N802 with self._func_lock: if self.niDigital_GetError_cfunc is None: - self.niDigital_GetError_cfunc = self._get_library_function('niDigital_GetError') - self.niDigital_GetError_cfunc.argtypes = [ViSession, ctypes.POINTER(ViStatus), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_GetError_cfunc = self._get_library_function( + "niDigital_GetError" + ) + self.niDigital_GetError_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViStatus), + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDigital_GetError_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_GetError_cfunc(vi, error_code, error_description_buffer_size, error_description) + return self.niDigital_GetError_cfunc( + vi, error_code, error_description_buffer_size, error_description + ) - def niDigital_GetFailCount(self, vi, channel_list, buffer_size, failure_count, actual_num_read): # noqa: N802 + def niDigital_GetFailCount( + self, vi, channel_list, buffer_size, failure_count, actual_num_read + ): # noqa: N802 with self._func_lock: if self.niDigital_GetFailCount_cfunc is None: - self.niDigital_GetFailCount_cfunc = self._get_library_function('niDigital_GetFailCount') - self.niDigital_GetFailCount_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViInt64), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDigital_GetFailCount_cfunc = self._get_library_function( + "niDigital_GetFailCount" + ) + self.niDigital_GetFailCount_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViInt64), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niDigital_GetFailCount_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_GetFailCount_cfunc(vi, channel_list, buffer_size, failure_count, actual_num_read) + return self.niDigital_GetFailCount_cfunc( + vi, channel_list, buffer_size, failure_count, actual_num_read + ) def niDigital_GetHistoryRAMSampleCount(self, vi, site, sample_count): # noqa: N802 with self._func_lock: if self.niDigital_GetHistoryRAMSampleCount_cfunc is None: - self.niDigital_GetHistoryRAMSampleCount_cfunc = self._get_library_function('niDigital_GetHistoryRAMSampleCount') - self.niDigital_GetHistoryRAMSampleCount_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViInt64)] # noqa: F405 - self.niDigital_GetHistoryRAMSampleCount_cfunc.restype = ViStatus # noqa: F405 + self.niDigital_GetHistoryRAMSampleCount_cfunc = ( + self._get_library_function("niDigital_GetHistoryRAMSampleCount") + ) + self.niDigital_GetHistoryRAMSampleCount_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViInt64), + ] # noqa: F405 + self.niDigital_GetHistoryRAMSampleCount_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niDigital_GetHistoryRAMSampleCount_cfunc(vi, site, sample_count) - def niDigital_GetPatternName(self, vi, pattern_index, name_buffer_size, name): # noqa: N802 + def niDigital_GetPatternName( + self, vi, pattern_index, name_buffer_size, name + ): # noqa: N802 with self._func_lock: if self.niDigital_GetPatternName_cfunc is None: - self.niDigital_GetPatternName_cfunc = self._get_library_function('niDigital_GetPatternName') - self.niDigital_GetPatternName_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_GetPatternName_cfunc = self._get_library_function( + "niDigital_GetPatternName" + ) + self.niDigital_GetPatternName_cfunc.argtypes = [ + ViSession, + ViInt32, + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDigital_GetPatternName_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_GetPatternName_cfunc(vi, pattern_index, name_buffer_size, name) + return self.niDigital_GetPatternName_cfunc( + vi, pattern_index, name_buffer_size, name + ) - def niDigital_GetPatternPinList(self, vi, start_label, pin_list_buffer_size, pin_list): # noqa: N802 + def niDigital_GetPatternPinList( + self, vi, start_label, pin_list_buffer_size, pin_list + ): # noqa: N802 with self._func_lock: if self.niDigital_GetPatternPinList_cfunc is None: - self.niDigital_GetPatternPinList_cfunc = self._get_library_function('niDigital_GetPatternPinList') - self.niDigital_GetPatternPinList_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_GetPatternPinList_cfunc = self._get_library_function( + "niDigital_GetPatternPinList" + ) + self.niDigital_GetPatternPinList_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDigital_GetPatternPinList_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_GetPatternPinList_cfunc(vi, start_label, pin_list_buffer_size, pin_list) + return self.niDigital_GetPatternPinList_cfunc( + vi, start_label, pin_list_buffer_size, pin_list + ) def niDigital_GetPinName(self, vi, pin_index, name_buffer_size, name): # noqa: N802 with self._func_lock: if self.niDigital_GetPinName_cfunc is None: - self.niDigital_GetPinName_cfunc = self._get_library_function('niDigital_GetPinName') - self.niDigital_GetPinName_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_GetPinName_cfunc = self._get_library_function( + "niDigital_GetPinName" + ) + self.niDigital_GetPinName_cfunc.argtypes = [ + ViSession, + ViInt32, + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDigital_GetPinName_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_GetPinName_cfunc(vi, pin_index, name_buffer_size, name) - def niDigital_GetPinResultsPinInformation(self, vi, channel_list, buffer_size, pin_indexes, site_numbers, channel_indexes, actual_num_values): # noqa: N802 + def niDigital_GetPinResultsPinInformation( + self, + vi, + channel_list, + buffer_size, + pin_indexes, + site_numbers, + channel_indexes, + actual_num_values, + ): # noqa: N802 with self._func_lock: if self.niDigital_GetPinResultsPinInformation_cfunc is None: - self.niDigital_GetPinResultsPinInformation_cfunc = self._get_library_function('niDigital_GetPinResultsPinInformation') - self.niDigital_GetPinResultsPinInformation_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 - self.niDigital_GetPinResultsPinInformation_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_GetPinResultsPinInformation_cfunc(vi, channel_list, buffer_size, pin_indexes, site_numbers, channel_indexes, actual_num_values) - - def niDigital_GetSitePassFail(self, vi, site_list, pass_fail_buffer_size, pass_fail, actual_num_sites): # noqa: N802 + self.niDigital_GetPinResultsPinInformation_cfunc = ( + self._get_library_function("niDigital_GetPinResultsPinInformation") + ) + self.niDigital_GetPinResultsPinInformation_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niDigital_GetPinResultsPinInformation_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_GetPinResultsPinInformation_cfunc( + vi, + channel_list, + buffer_size, + pin_indexes, + site_numbers, + channel_indexes, + actual_num_values, + ) + + def niDigital_GetSitePassFail( + self, vi, site_list, pass_fail_buffer_size, pass_fail, actual_num_sites + ): # noqa: N802 with self._func_lock: if self.niDigital_GetSitePassFail_cfunc is None: - self.niDigital_GetSitePassFail_cfunc = self._get_library_function('niDigital_GetSitePassFail') - self.niDigital_GetSitePassFail_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViBoolean), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDigital_GetSitePassFail_cfunc = self._get_library_function( + "niDigital_GetSitePassFail" + ) + self.niDigital_GetSitePassFail_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViBoolean), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niDigital_GetSitePassFail_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_GetSitePassFail_cfunc(vi, site_list, pass_fail_buffer_size, pass_fail, actual_num_sites) - - def niDigital_GetSiteResultsSiteNumbers(self, vi, site_list, site_result_type, site_numbers_buffer_size, site_numbers, actual_num_site_numbers): # noqa: N802 + return self.niDigital_GetSitePassFail_cfunc( + vi, site_list, pass_fail_buffer_size, pass_fail, actual_num_sites + ) + + def niDigital_GetSiteResultsSiteNumbers( + self, + vi, + site_list, + site_result_type, + site_numbers_buffer_size, + site_numbers, + actual_num_site_numbers, + ): # noqa: N802 with self._func_lock: if self.niDigital_GetSiteResultsSiteNumbers_cfunc is None: - self.niDigital_GetSiteResultsSiteNumbers_cfunc = self._get_library_function('niDigital_GetSiteResultsSiteNumbers') - self.niDigital_GetSiteResultsSiteNumbers_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViInt32, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 - self.niDigital_GetSiteResultsSiteNumbers_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_GetSiteResultsSiteNumbers_cfunc(vi, site_list, site_result_type, site_numbers_buffer_size, site_numbers, actual_num_site_numbers) - - def niDigital_GetTimeSetDriveFormat(self, vi, pin, time_set_name, format): # noqa: N802 + self.niDigital_GetSiteResultsSiteNumbers_cfunc = ( + self._get_library_function("niDigital_GetSiteResultsSiteNumbers") + ) + self.niDigital_GetSiteResultsSiteNumbers_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ViInt32, + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niDigital_GetSiteResultsSiteNumbers_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_GetSiteResultsSiteNumbers_cfunc( + vi, + site_list, + site_result_type, + site_numbers_buffer_size, + site_numbers, + actual_num_site_numbers, + ) + + def niDigital_GetTimeSetDriveFormat( + self, vi, pin, time_set_name, format + ): # noqa: N802 with self._func_lock: if self.niDigital_GetTimeSetDriveFormat_cfunc is None: - self.niDigital_GetTimeSetDriveFormat_cfunc = self._get_library_function('niDigital_GetTimeSetDriveFormat') - self.niDigital_GetTimeSetDriveFormat_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32)] # noqa: F405 - self.niDigital_GetTimeSetDriveFormat_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_GetTimeSetDriveFormat_cfunc(vi, pin, time_set_name, format) - - def niDigital_GetTimeSetEdge(self, vi, pin, time_set_name, edge, time): # noqa: N802 + self.niDigital_GetTimeSetDriveFormat_cfunc = self._get_library_function( + "niDigital_GetTimeSetDriveFormat" + ) + self.niDigital_GetTimeSetDriveFormat_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niDigital_GetTimeSetDriveFormat_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_GetTimeSetDriveFormat_cfunc( + vi, pin, time_set_name, format + ) + + def niDigital_GetTimeSetEdge( + self, vi, pin, time_set_name, edge, time + ): # noqa: N802 with self._func_lock: if self.niDigital_GetTimeSetEdge_cfunc is None: - self.niDigital_GetTimeSetEdge_cfunc = self._get_library_function('niDigital_GetTimeSetEdge') - self.niDigital_GetTimeSetEdge_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niDigital_GetTimeSetEdge_cfunc = self._get_library_function( + "niDigital_GetTimeSetEdge" + ) + self.niDigital_GetTimeSetEdge_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niDigital_GetTimeSetEdge_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_GetTimeSetEdge_cfunc(vi, pin, time_set_name, edge, time) - def niDigital_GetTimeSetEdgeMultiplier(self, vi, pin, time_set_name, edge_multiplier): # noqa: N802 + def niDigital_GetTimeSetEdgeMultiplier( + self, vi, pin, time_set_name, edge_multiplier + ): # noqa: N802 with self._func_lock: if self.niDigital_GetTimeSetEdgeMultiplier_cfunc is None: - self.niDigital_GetTimeSetEdgeMultiplier_cfunc = self._get_library_function('niDigital_GetTimeSetEdgeMultiplier') - self.niDigital_GetTimeSetEdgeMultiplier_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32)] # noqa: F405 - self.niDigital_GetTimeSetEdgeMultiplier_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_GetTimeSetEdgeMultiplier_cfunc(vi, pin, time_set_name, edge_multiplier) - - def niDigital_GetTimeSetName(self, vi, time_set_index, name_buffer_size, name): # noqa: N802 + self.niDigital_GetTimeSetEdgeMultiplier_cfunc = ( + self._get_library_function("niDigital_GetTimeSetEdgeMultiplier") + ) + self.niDigital_GetTimeSetEdgeMultiplier_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niDigital_GetTimeSetEdgeMultiplier_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_GetTimeSetEdgeMultiplier_cfunc( + vi, pin, time_set_name, edge_multiplier + ) + + def niDigital_GetTimeSetName( + self, vi, time_set_index, name_buffer_size, name + ): # noqa: N802 with self._func_lock: if self.niDigital_GetTimeSetName_cfunc is None: - self.niDigital_GetTimeSetName_cfunc = self._get_library_function('niDigital_GetTimeSetName') - self.niDigital_GetTimeSetName_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_GetTimeSetName_cfunc = self._get_library_function( + "niDigital_GetTimeSetName" + ) + self.niDigital_GetTimeSetName_cfunc.argtypes = [ + ViSession, + ViInt32, + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDigital_GetTimeSetName_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_GetTimeSetName_cfunc(vi, time_set_index, name_buffer_size, name) + return self.niDigital_GetTimeSetName_cfunc( + vi, time_set_index, name_buffer_size, name + ) def niDigital_GetTimeSetPeriod(self, vi, time_set_name, period): # noqa: N802 with self._func_lock: if self.niDigital_GetTimeSetPeriod_cfunc is None: - self.niDigital_GetTimeSetPeriod_cfunc = self._get_library_function('niDigital_GetTimeSetPeriod') - self.niDigital_GetTimeSetPeriod_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViReal64)] # noqa: F405 + self.niDigital_GetTimeSetPeriod_cfunc = self._get_library_function( + "niDigital_GetTimeSetPeriod" + ) + self.niDigital_GetTimeSetPeriod_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niDigital_GetTimeSetPeriod_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_GetTimeSetPeriod_cfunc(vi, time_set_name, period) - def niDigital_InitWithOptions(self, resource_name, id_query, reset_device, option_string, new_vi): # noqa: N802 + def niDigital_InitWithOptions( + self, resource_name, id_query, reset_device, option_string, new_vi + ): # noqa: N802 with self._func_lock: if self.niDigital_InitWithOptions_cfunc is None: - self.niDigital_InitWithOptions_cfunc = self._get_library_function('niDigital_InitWithOptions') - self.niDigital_InitWithOptions_cfunc.argtypes = [ctypes.POINTER(ViChar), ViBoolean, ViBoolean, ctypes.POINTER(ViChar), ctypes.POINTER(ViSession)] # noqa: F405 + self.niDigital_InitWithOptions_cfunc = self._get_library_function( + "niDigital_InitWithOptions" + ) + self.niDigital_InitWithOptions_cfunc.argtypes = [ + ctypes.POINTER(ViChar), + ViBoolean, + ViBoolean, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViSession), + ] # noqa: F405 self.niDigital_InitWithOptions_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_InitWithOptions_cfunc(resource_name, id_query, reset_device, option_string, new_vi) + return self.niDigital_InitWithOptions_cfunc( + resource_name, id_query, reset_device, option_string, new_vi + ) def niDigital_Initiate(self, vi): # noqa: N802 with self._func_lock: if self.niDigital_Initiate_cfunc is None: - self.niDigital_Initiate_cfunc = self._get_library_function('niDigital_Initiate') + self.niDigital_Initiate_cfunc = self._get_library_function( + "niDigital_Initiate" + ) self.niDigital_Initiate_cfunc.argtypes = [ViSession] # noqa: F405 self.niDigital_Initiate_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_Initiate_cfunc(vi) @@ -572,111 +1374,209 @@ def niDigital_Initiate(self, vi): # noqa: N802 def niDigital_IsDone(self, vi, done): # noqa: N802 with self._func_lock: if self.niDigital_IsDone_cfunc is None: - self.niDigital_IsDone_cfunc = self._get_library_function('niDigital_IsDone') - self.niDigital_IsDone_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niDigital_IsDone_cfunc = self._get_library_function( + "niDigital_IsDone" + ) + self.niDigital_IsDone_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niDigital_IsDone_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_IsDone_cfunc(vi, done) def niDigital_IsSiteEnabled(self, vi, site, enable): # noqa: N802 with self._func_lock: if self.niDigital_IsSiteEnabled_cfunc is None: - self.niDigital_IsSiteEnabled_cfunc = self._get_library_function('niDigital_IsSiteEnabled') - self.niDigital_IsSiteEnabled_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niDigital_IsSiteEnabled_cfunc = self._get_library_function( + "niDigital_IsSiteEnabled" + ) + self.niDigital_IsSiteEnabled_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niDigital_IsSiteEnabled_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_IsSiteEnabled_cfunc(vi, site, enable) def niDigital_LoadLevels(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niDigital_LoadLevels_cfunc is None: - self.niDigital_LoadLevels_cfunc = self._get_library_function('niDigital_LoadLevels') - self.niDigital_LoadLevels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_LoadLevels_cfunc = self._get_library_function( + "niDigital_LoadLevels" + ) + self.niDigital_LoadLevels_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDigital_LoadLevels_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_LoadLevels_cfunc(vi, file_path) def niDigital_LoadPattern(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niDigital_LoadPattern_cfunc is None: - self.niDigital_LoadPattern_cfunc = self._get_library_function('niDigital_LoadPattern') - self.niDigital_LoadPattern_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_LoadPattern_cfunc = self._get_library_function( + "niDigital_LoadPattern" + ) + self.niDigital_LoadPattern_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDigital_LoadPattern_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_LoadPattern_cfunc(vi, file_path) def niDigital_LoadPinMap(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niDigital_LoadPinMap_cfunc is None: - self.niDigital_LoadPinMap_cfunc = self._get_library_function('niDigital_LoadPinMap') - self.niDigital_LoadPinMap_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_LoadPinMap_cfunc = self._get_library_function( + "niDigital_LoadPinMap" + ) + self.niDigital_LoadPinMap_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDigital_LoadPinMap_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_LoadPinMap_cfunc(vi, file_path) def niDigital_LoadSpecifications(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niDigital_LoadSpecifications_cfunc is None: - self.niDigital_LoadSpecifications_cfunc = self._get_library_function('niDigital_LoadSpecifications') - self.niDigital_LoadSpecifications_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_LoadSpecifications_cfunc = self._get_library_function( + "niDigital_LoadSpecifications" + ) + self.niDigital_LoadSpecifications_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDigital_LoadSpecifications_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_LoadSpecifications_cfunc(vi, file_path) def niDigital_LoadTiming(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niDigital_LoadTiming_cfunc is None: - self.niDigital_LoadTiming_cfunc = self._get_library_function('niDigital_LoadTiming') - self.niDigital_LoadTiming_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_LoadTiming_cfunc = self._get_library_function( + "niDigital_LoadTiming" + ) + self.niDigital_LoadTiming_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDigital_LoadTiming_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_LoadTiming_cfunc(vi, file_path) def niDigital_LockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niDigital_LockSession_cfunc is None: - self.niDigital_LockSession_cfunc = self._get_library_function('niDigital_LockSession') - self.niDigital_LockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niDigital_LockSession_cfunc = self._get_library_function( + "niDigital_LockSession" + ) + self.niDigital_LockSession_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niDigital_LockSession_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_LockSession_cfunc(vi, caller_has_lock) - def niDigital_PPMU_Measure(self, vi, channel_list, measurement_type, buffer_size, measurements, actual_num_read): # noqa: N802 + def niDigital_PPMU_Measure( + self, + vi, + channel_list, + measurement_type, + buffer_size, + measurements, + actual_num_read, + ): # noqa: N802 with self._func_lock: if self.niDigital_PPMU_Measure_cfunc is None: - self.niDigital_PPMU_Measure_cfunc = self._get_library_function('niDigital_PPMU_Measure') - self.niDigital_PPMU_Measure_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDigital_PPMU_Measure_cfunc = self._get_library_function( + "niDigital_PPMU_Measure" + ) + self.niDigital_PPMU_Measure_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ViInt32, + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niDigital_PPMU_Measure_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_PPMU_Measure_cfunc(vi, channel_list, measurement_type, buffer_size, measurements, actual_num_read) + return self.niDigital_PPMU_Measure_cfunc( + vi, + channel_list, + measurement_type, + buffer_size, + measurements, + actual_num_read, + ) def niDigital_PPMU_Source(self, vi, channel_list): # noqa: N802 with self._func_lock: if self.niDigital_PPMU_Source_cfunc is None: - self.niDigital_PPMU_Source_cfunc = self._get_library_function('niDigital_PPMU_Source') - self.niDigital_PPMU_Source_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_PPMU_Source_cfunc = self._get_library_function( + "niDigital_PPMU_Source" + ) + self.niDigital_PPMU_Source_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDigital_PPMU_Source_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_PPMU_Source_cfunc(vi, channel_list) def niDigital_ReadSequencerFlag(self, vi, flag, value): # noqa: N802 with self._func_lock: if self.niDigital_ReadSequencerFlag_cfunc is None: - self.niDigital_ReadSequencerFlag_cfunc = self._get_library_function('niDigital_ReadSequencerFlag') - self.niDigital_ReadSequencerFlag_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niDigital_ReadSequencerFlag_cfunc = self._get_library_function( + "niDigital_ReadSequencerFlag" + ) + self.niDigital_ReadSequencerFlag_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niDigital_ReadSequencerFlag_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_ReadSequencerFlag_cfunc(vi, flag, value) def niDigital_ReadSequencerRegister(self, vi, reg, value): # noqa: N802 with self._func_lock: if self.niDigital_ReadSequencerRegister_cfunc is None: - self.niDigital_ReadSequencerRegister_cfunc = self._get_library_function('niDigital_ReadSequencerRegister') - self.niDigital_ReadSequencerRegister_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32)] # noqa: F405 - self.niDigital_ReadSequencerRegister_cfunc.restype = ViStatus # noqa: F405 + self.niDigital_ReadSequencerRegister_cfunc = self._get_library_function( + "niDigital_ReadSequencerRegister" + ) + self.niDigital_ReadSequencerRegister_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niDigital_ReadSequencerRegister_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niDigital_ReadSequencerRegister_cfunc(vi, reg, value) - def niDigital_ReadStatic(self, vi, channel_list, buffer_size, data, actual_num_read): # noqa: N802 + def niDigital_ReadStatic( + self, vi, channel_list, buffer_size, data, actual_num_read + ): # noqa: N802 with self._func_lock: if self.niDigital_ReadStatic_cfunc is None: - self.niDigital_ReadStatic_cfunc = self._get_library_function('niDigital_ReadStatic') - self.niDigital_ReadStatic_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViUInt8), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDigital_ReadStatic_cfunc = self._get_library_function( + "niDigital_ReadStatic" + ) + self.niDigital_ReadStatic_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViUInt8), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niDigital_ReadStatic_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_ReadStatic_cfunc(vi, channel_list, buffer_size, data, actual_num_read) + return self.niDigital_ReadStatic_cfunc( + vi, channel_list, buffer_size, data, actual_num_read + ) def niDigital_ResetDevice(self, vi): # noqa: N802 with self._func_lock: if self.niDigital_ResetDevice_cfunc is None: - self.niDigital_ResetDevice_cfunc = self._get_library_function('niDigital_ResetDevice') + self.niDigital_ResetDevice_cfunc = self._get_library_function( + "niDigital_ResetDevice" + ) self.niDigital_ResetDevice_cfunc.argtypes = [ViSession] # noqa: F405 self.niDigital_ResetDevice_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_ResetDevice_cfunc(vi) @@ -684,151 +1584,353 @@ def niDigital_ResetDevice(self, vi): # noqa: N802 def niDigital_SelfCalibrate(self, vi): # noqa: N802 with self._func_lock: if self.niDigital_SelfCalibrate_cfunc is None: - self.niDigital_SelfCalibrate_cfunc = self._get_library_function('niDigital_SelfCalibrate') + self.niDigital_SelfCalibrate_cfunc = self._get_library_function( + "niDigital_SelfCalibrate" + ) self.niDigital_SelfCalibrate_cfunc.argtypes = [ViSession] # noqa: F405 self.niDigital_SelfCalibrate_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_SelfCalibrate_cfunc(vi) - def niDigital_SendSoftwareEdgeTrigger(self, vi, trigger, trigger_identifier): # noqa: N802 + def niDigital_SendSoftwareEdgeTrigger( + self, vi, trigger, trigger_identifier + ): # noqa: N802 with self._func_lock: if self.niDigital_SendSoftwareEdgeTrigger_cfunc is None: - self.niDigital_SendSoftwareEdgeTrigger_cfunc = self._get_library_function('niDigital_SendSoftwareEdgeTrigger') - self.niDigital_SendSoftwareEdgeTrigger_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 - self.niDigital_SendSoftwareEdgeTrigger_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_SendSoftwareEdgeTrigger_cfunc(vi, trigger, trigger_identifier) - - def niDigital_SetAttributeViBoolean(self, vi, channel_name, attribute, value): # noqa: N802 + self.niDigital_SendSoftwareEdgeTrigger_cfunc = ( + self._get_library_function("niDigital_SendSoftwareEdgeTrigger") + ) + self.niDigital_SendSoftwareEdgeTrigger_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niDigital_SendSoftwareEdgeTrigger_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_SendSoftwareEdgeTrigger_cfunc( + vi, trigger, trigger_identifier + ) + + def niDigital_SetAttributeViBoolean( + self, vi, channel_name, attribute, value + ): # noqa: N802 with self._func_lock: if self.niDigital_SetAttributeViBoolean_cfunc is None: - self.niDigital_SetAttributeViBoolean_cfunc = self._get_library_function('niDigital_SetAttributeViBoolean') - self.niDigital_SetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViBoolean] # noqa: F405 - self.niDigital_SetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_SetAttributeViBoolean_cfunc(vi, channel_name, attribute, value) - - def niDigital_SetAttributeViInt32(self, vi, channel_name, attribute, value): # noqa: N802 + self.niDigital_SetAttributeViBoolean_cfunc = self._get_library_function( + "niDigital_SetAttributeViBoolean" + ) + self.niDigital_SetAttributeViBoolean_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViBoolean, + ] # noqa: F405 + self.niDigital_SetAttributeViBoolean_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_SetAttributeViBoolean_cfunc( + vi, channel_name, attribute, value + ) + + def niDigital_SetAttributeViInt32( + self, vi, channel_name, attribute, value + ): # noqa: N802 with self._func_lock: if self.niDigital_SetAttributeViInt32_cfunc is None: - self.niDigital_SetAttributeViInt32_cfunc = self._get_library_function('niDigital_SetAttributeViInt32') - self.niDigital_SetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32] # noqa: F405 - self.niDigital_SetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_SetAttributeViInt32_cfunc(vi, channel_name, attribute, value) - - def niDigital_SetAttributeViInt64(self, vi, channel_name, attribute, value): # noqa: N802 + self.niDigital_SetAttributeViInt32_cfunc = self._get_library_function( + "niDigital_SetAttributeViInt32" + ) + self.niDigital_SetAttributeViInt32_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViInt32, + ] # noqa: F405 + self.niDigital_SetAttributeViInt32_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_SetAttributeViInt32_cfunc( + vi, channel_name, attribute, value + ) + + def niDigital_SetAttributeViInt64( + self, vi, channel_name, attribute, value + ): # noqa: N802 with self._func_lock: if self.niDigital_SetAttributeViInt64_cfunc is None: - self.niDigital_SetAttributeViInt64_cfunc = self._get_library_function('niDigital_SetAttributeViInt64') - self.niDigital_SetAttributeViInt64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt64] # noqa: F405 - self.niDigital_SetAttributeViInt64_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_SetAttributeViInt64_cfunc(vi, channel_name, attribute, value) - - def niDigital_SetAttributeViReal64(self, vi, channel_name, attribute, value): # noqa: N802 + self.niDigital_SetAttributeViInt64_cfunc = self._get_library_function( + "niDigital_SetAttributeViInt64" + ) + self.niDigital_SetAttributeViInt64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViInt64, + ] # noqa: F405 + self.niDigital_SetAttributeViInt64_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_SetAttributeViInt64_cfunc( + vi, channel_name, attribute, value + ) + + def niDigital_SetAttributeViReal64( + self, vi, channel_name, attribute, value + ): # noqa: N802 with self._func_lock: if self.niDigital_SetAttributeViReal64_cfunc is None: - self.niDigital_SetAttributeViReal64_cfunc = self._get_library_function('niDigital_SetAttributeViReal64') - self.niDigital_SetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViReal64] # noqa: F405 - self.niDigital_SetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_SetAttributeViReal64_cfunc(vi, channel_name, attribute, value) - - def niDigital_SetAttributeViString(self, vi, channel_name, attribute, value): # noqa: N802 + self.niDigital_SetAttributeViReal64_cfunc = self._get_library_function( + "niDigital_SetAttributeViReal64" + ) + self.niDigital_SetAttributeViReal64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViReal64, + ] # noqa: F405 + self.niDigital_SetAttributeViReal64_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_SetAttributeViReal64_cfunc( + vi, channel_name, attribute, value + ) + + def niDigital_SetAttributeViString( + self, vi, channel_name, attribute, value + ): # noqa: N802 with self._func_lock: if self.niDigital_SetAttributeViString_cfunc is None: - self.niDigital_SetAttributeViString_cfunc = self._get_library_function('niDigital_SetAttributeViString') - self.niDigital_SetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViChar)] # noqa: F405 - self.niDigital_SetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_SetAttributeViString_cfunc(vi, channel_name, attribute, value) - - def niDigital_TDR(self, vi, channel_list, apply_offsets, offsets_buffer_size, offsets, actual_num_offsets): # noqa: N802 + self.niDigital_SetAttributeViString_cfunc = self._get_library_function( + "niDigital_SetAttributeViString" + ) + self.niDigital_SetAttributeViString_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niDigital_SetAttributeViString_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_SetAttributeViString_cfunc( + vi, channel_name, attribute, value + ) + + def niDigital_TDR( + self, + vi, + channel_list, + apply_offsets, + offsets_buffer_size, + offsets, + actual_num_offsets, + ): # noqa: N802 with self._func_lock: if self.niDigital_TDR_cfunc is None: - self.niDigital_TDR_cfunc = self._get_library_function('niDigital_TDR') - self.niDigital_TDR_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViBoolean, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDigital_TDR_cfunc = self._get_library_function("niDigital_TDR") + self.niDigital_TDR_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViBoolean, + ViInt32, + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niDigital_TDR_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_TDR_cfunc(vi, channel_list, apply_offsets, offsets_buffer_size, offsets, actual_num_offsets) + return self.niDigital_TDR_cfunc( + vi, + channel_list, + apply_offsets, + offsets_buffer_size, + offsets, + actual_num_offsets, + ) def niDigital_UnloadAllPatterns(self, vi, unload_keep_alive_pattern): # noqa: N802 with self._func_lock: if self.niDigital_UnloadAllPatterns_cfunc is None: - self.niDigital_UnloadAllPatterns_cfunc = self._get_library_function('niDigital_UnloadAllPatterns') - self.niDigital_UnloadAllPatterns_cfunc.argtypes = [ViSession, ViBoolean] # noqa: F405 + self.niDigital_UnloadAllPatterns_cfunc = self._get_library_function( + "niDigital_UnloadAllPatterns" + ) + self.niDigital_UnloadAllPatterns_cfunc.argtypes = [ + ViSession, + ViBoolean, + ] # noqa: F405 self.niDigital_UnloadAllPatterns_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_UnloadAllPatterns_cfunc(vi, unload_keep_alive_pattern) def niDigital_UnloadSpecifications(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niDigital_UnloadSpecifications_cfunc is None: - self.niDigital_UnloadSpecifications_cfunc = self._get_library_function('niDigital_UnloadSpecifications') - self.niDigital_UnloadSpecifications_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 - self.niDigital_UnloadSpecifications_cfunc.restype = ViStatus # noqa: F405 + self.niDigital_UnloadSpecifications_cfunc = self._get_library_function( + "niDigital_UnloadSpecifications" + ) + self.niDigital_UnloadSpecifications_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niDigital_UnloadSpecifications_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niDigital_UnloadSpecifications_cfunc(vi, file_path) def niDigital_UnlockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niDigital_UnlockSession_cfunc is None: - self.niDigital_UnlockSession_cfunc = self._get_library_function('niDigital_UnlockSession') - self.niDigital_UnlockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niDigital_UnlockSession_cfunc = self._get_library_function( + "niDigital_UnlockSession" + ) + self.niDigital_UnlockSession_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niDigital_UnlockSession_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_UnlockSession_cfunc(vi, caller_has_lock) def niDigital_WaitUntilDone(self, vi, timeout): # noqa: N802 with self._func_lock: if self.niDigital_WaitUntilDone_cfunc is None: - self.niDigital_WaitUntilDone_cfunc = self._get_library_function('niDigital_WaitUntilDone') - self.niDigital_WaitUntilDone_cfunc.argtypes = [ViSession, ViReal64] # noqa: F405 + self.niDigital_WaitUntilDone_cfunc = self._get_library_function( + "niDigital_WaitUntilDone" + ) + self.niDigital_WaitUntilDone_cfunc.argtypes = [ + ViSession, + ViReal64, + ] # noqa: F405 self.niDigital_WaitUntilDone_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_WaitUntilDone_cfunc(vi, timeout) def niDigital_WriteSequencerFlag(self, vi, flag, value): # noqa: N802 with self._func_lock: if self.niDigital_WriteSequencerFlag_cfunc is None: - self.niDigital_WriteSequencerFlag_cfunc = self._get_library_function('niDigital_WriteSequencerFlag') - self.niDigital_WriteSequencerFlag_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViBoolean] # noqa: F405 + self.niDigital_WriteSequencerFlag_cfunc = self._get_library_function( + "niDigital_WriteSequencerFlag" + ) + self.niDigital_WriteSequencerFlag_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViBoolean, + ] # noqa: F405 self.niDigital_WriteSequencerFlag_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_WriteSequencerFlag_cfunc(vi, flag, value) def niDigital_WriteSequencerRegister(self, vi, reg, value): # noqa: N802 with self._func_lock: if self.niDigital_WriteSequencerRegister_cfunc is None: - self.niDigital_WriteSequencerRegister_cfunc = self._get_library_function('niDigital_WriteSequencerRegister') - self.niDigital_WriteSequencerRegister_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32] # noqa: F405 - self.niDigital_WriteSequencerRegister_cfunc.restype = ViStatus # noqa: F405 + self.niDigital_WriteSequencerRegister_cfunc = ( + self._get_library_function("niDigital_WriteSequencerRegister") + ) + self.niDigital_WriteSequencerRegister_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ] # noqa: F405 + self.niDigital_WriteSequencerRegister_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niDigital_WriteSequencerRegister_cfunc(vi, reg, value) - def niDigital_WriteSourceWaveformBroadcastU32(self, vi, waveform_name, waveform_size, waveform_data): # noqa: N802 + def niDigital_WriteSourceWaveformBroadcastU32( + self, vi, waveform_name, waveform_size, waveform_data + ): # noqa: N802 with self._func_lock: if self.niDigital_WriteSourceWaveformBroadcastU32_cfunc is None: - self.niDigital_WriteSourceWaveformBroadcastU32_cfunc = self._get_library_function('niDigital_WriteSourceWaveformBroadcastU32') - self.niDigital_WriteSourceWaveformBroadcastU32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViUInt32)] # noqa: F405 - self.niDigital_WriteSourceWaveformBroadcastU32_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_WriteSourceWaveformBroadcastU32_cfunc(vi, waveform_name, waveform_size, waveform_data) - - def niDigital_WriteSourceWaveformDataFromFileTDMS(self, vi, waveform_name, waveform_file_path): # noqa: N802 + self.niDigital_WriteSourceWaveformBroadcastU32_cfunc = ( + self._get_library_function( + "niDigital_WriteSourceWaveformBroadcastU32" + ) + ) + self.niDigital_WriteSourceWaveformBroadcastU32_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViUInt32), + ] # noqa: F405 + self.niDigital_WriteSourceWaveformBroadcastU32_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_WriteSourceWaveformBroadcastU32_cfunc( + vi, waveform_name, waveform_size, waveform_data + ) + + def niDigital_WriteSourceWaveformDataFromFileTDMS( + self, vi, waveform_name, waveform_file_path + ): # noqa: N802 with self._func_lock: if self.niDigital_WriteSourceWaveformDataFromFileTDMS_cfunc is None: - self.niDigital_WriteSourceWaveformDataFromFileTDMS_cfunc = self._get_library_function('niDigital_WriteSourceWaveformDataFromFileTDMS') - self.niDigital_WriteSourceWaveformDataFromFileTDMS_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar)] # noqa: F405 - self.niDigital_WriteSourceWaveformDataFromFileTDMS_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_WriteSourceWaveformDataFromFileTDMS_cfunc(vi, waveform_name, waveform_file_path) - - def niDigital_WriteSourceWaveformSiteUniqueU32(self, vi, site_list, waveform_name, num_waveforms, samples_per_waveform, waveform_data): # noqa: N802 + self.niDigital_WriteSourceWaveformDataFromFileTDMS_cfunc = ( + self._get_library_function( + "niDigital_WriteSourceWaveformDataFromFileTDMS" + ) + ) + self.niDigital_WriteSourceWaveformDataFromFileTDMS_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niDigital_WriteSourceWaveformDataFromFileTDMS_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_WriteSourceWaveformDataFromFileTDMS_cfunc( + vi, waveform_name, waveform_file_path + ) + + def niDigital_WriteSourceWaveformSiteUniqueU32( + self, + vi, + site_list, + waveform_name, + num_waveforms, + samples_per_waveform, + waveform_data, + ): # noqa: N802 with self._func_lock: if self.niDigital_WriteSourceWaveformSiteUniqueU32_cfunc is None: - self.niDigital_WriteSourceWaveformSiteUniqueU32_cfunc = self._get_library_function('niDigital_WriteSourceWaveformSiteUniqueU32') - self.niDigital_WriteSourceWaveformSiteUniqueU32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ViInt32, ctypes.POINTER(ViUInt32)] # noqa: F405 - self.niDigital_WriteSourceWaveformSiteUniqueU32_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_WriteSourceWaveformSiteUniqueU32_cfunc(vi, site_list, waveform_name, num_waveforms, samples_per_waveform, waveform_data) + self.niDigital_WriteSourceWaveformSiteUniqueU32_cfunc = ( + self._get_library_function( + "niDigital_WriteSourceWaveformSiteUniqueU32" + ) + ) + self.niDigital_WriteSourceWaveformSiteUniqueU32_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViInt32, + ViInt32, + ctypes.POINTER(ViUInt32), + ] # noqa: F405 + self.niDigital_WriteSourceWaveformSiteUniqueU32_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDigital_WriteSourceWaveformSiteUniqueU32_cfunc( + vi, + site_list, + waveform_name, + num_waveforms, + samples_per_waveform, + waveform_data, + ) def niDigital_WriteStatic(self, vi, channel_list, state): # noqa: N802 with self._func_lock: if self.niDigital_WriteStatic_cfunc is None: - self.niDigital_WriteStatic_cfunc = self._get_library_function('niDigital_WriteStatic') - self.niDigital_WriteStatic_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViUInt8] # noqa: F405 + self.niDigital_WriteStatic_cfunc = self._get_library_function( + "niDigital_WriteStatic" + ) + self.niDigital_WriteStatic_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViUInt8, + ] # noqa: F405 self.niDigital_WriteStatic_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_WriteStatic_cfunc(vi, channel_list, state) def niDigital_close(self, vi): # noqa: N802 with self._func_lock: if self.niDigital_close_cfunc is None: - self.niDigital_close_cfunc = self._get_library_function('niDigital_close') + self.niDigital_close_cfunc = self._get_library_function( + "niDigital_close" + ) self.niDigital_close_cfunc.argtypes = [ViSession] # noqa: F405 self.niDigital_close_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_close_cfunc(vi) @@ -836,15 +1938,23 @@ def niDigital_close(self, vi): # noqa: N802 def niDigital_error_message(self, vi, error_code, error_message): # noqa: N802 with self._func_lock: if self.niDigital_error_message_cfunc is None: - self.niDigital_error_message_cfunc = self._get_library_function('niDigital_error_message') - self.niDigital_error_message_cfunc.argtypes = [ViSession, ViStatus, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_error_message_cfunc = self._get_library_function( + "niDigital_error_message" + ) + self.niDigital_error_message_cfunc.argtypes = [ + ViSession, + ViStatus, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDigital_error_message_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_error_message_cfunc(vi, error_code, error_message) def niDigital_reset(self, vi): # noqa: N802 with self._func_lock: if self.niDigital_reset_cfunc is None: - self.niDigital_reset_cfunc = self._get_library_function('niDigital_reset') + self.niDigital_reset_cfunc = self._get_library_function( + "niDigital_reset" + ) self.niDigital_reset_cfunc.argtypes = [ViSession] # noqa: F405 self.niDigital_reset_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_reset_cfunc(vi) @@ -852,7 +1962,13 @@ def niDigital_reset(self, vi): # noqa: N802 def niDigital_self_test(self, vi, test_result, test_message): # noqa: N802 with self._func_lock: if self.niDigital_self_test_cfunc is None: - self.niDigital_self_test_cfunc = self._get_library_function('niDigital_self_test') - self.niDigital_self_test_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt16), ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_self_test_cfunc = self._get_library_function( + "niDigital_self_test" + ) + self.niDigital_self_test_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt16), + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDigital_self_test_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_self_test_cfunc(vi, test_result, test_message) diff --git a/generated/nidigital/nidigital/_library_singleton.py b/generated/nidigital/nidigital/_library_singleton.py index f0af2a56e..c3c24e475 100644 --- a/generated/nidigital/nidigital/_library_singleton.py +++ b/generated/nidigital/nidigital/_library_singleton.py @@ -12,30 +12,36 @@ _instance = None _instance_lock = threading.Lock() -_library_info = {'Linux': {'64bit': {'name': 'nidigital', 'type': 'cdll'}}, - 'Windows': {'32bit': {'name': 'niDigital_32.dll', 'type': 'windll'}, - '64bit': {'name': 'niDigital_64.dll', 'type': 'cdll'}}} +_library_info = { + "Linux": {"64bit": {"name": "nidigital", "type": "cdll"}}, + "Windows": { + "32bit": {"name": "niDigital_32.dll", "type": "windll"}, + "64bit": {"name": "niDigital_64.dll", "type": "cdll"}, + }, +} def _get_library_name(): try: - return ctypes.util.find_library(_library_info[platform.system()][platform.architecture()[0]]['name']) # We find and return full path to the DLL + return ctypes.util.find_library( + _library_info[platform.system()][platform.architecture()[0]]["name"] + ) # We find and return full path to the DLL except KeyError: raise errors.UnsupportedConfigurationError def _get_library_type(): try: - return _library_info[platform.system()][platform.architecture()[0]]['type'] + return _library_info[platform.system()][platform.architecture()[0]]["type"] except KeyError: raise errors.UnsupportedConfigurationError def get(): - '''get + """get Returns the library.Library singleton for nidigital. - ''' + """ global _instance global _instance_lock @@ -43,13 +49,12 @@ def get(): if _instance is None: try: library_type = _get_library_type() - if library_type == 'windll': + if library_type == "windll": ctypes_library = ctypes.WinDLL(_get_library_name()) else: - assert library_type == 'cdll' + assert library_type == "cdll" ctypes_library = ctypes.CDLL(_get_library_name()) except OSError: raise errors.DriverNotInstalledError() _instance = _library.Library(ctypes_library) return _instance - diff --git a/generated/nidigital/nidigital/_visatype.py b/generated/nidigital/nidigital/_visatype.py index 02cc41d1b..bf96c3cfb 100644 --- a/generated/nidigital/nidigital/_visatype.py +++ b/generated/nidigital/nidigital/_visatype.py @@ -2,9 +2,9 @@ import ctypes -'''Definitions of the VISA types used by the C API of the driver runtime. +"""Definitions of the VISA types used by the C API of the driver runtime. These are aliased directly to ctypes types so can be used directly to call into the library. -''' +""" ViChar = ctypes.c_char @@ -26,4 +26,3 @@ ViAttr = ViUInt32 ViConstString = ViString ViRsrc = ViString - diff --git a/generated/nidigital/nidigital/enums.py b/generated/nidigital/nidigital/enums.py index 0542e11ad..f716d39bb 100644 --- a/generated/nidigital/nidigital/enums.py +++ b/generated/nidigital/nidigital/enums.py @@ -6,351 +6,351 @@ class BitOrder(Enum): MSB = 2500 - r''' + r""" The most significant bit is first. The first bit is in the 2^n place, where n is the number of bits. - ''' + """ LSB = 2501 - r''' + r""" The least significant bit is first. The first bit is in the 2^0 place. - ''' + """ class DigitalEdge(Enum): RISING = 1800 - r''' + r""" Asserts the trigger when the signal transitions from low level to high level. - ''' + """ FALLING = 1801 - r''' + r""" Asserts the trigger when the signal transitions from high level to low level. - ''' + """ class DriveFormat(Enum): NR = 1500 - r''' + r""" Drive format remains at logic level after each bit. - ''' + """ RL = 1501 - r''' + r""" Drive format returns to a logic level low after each bit. - ''' + """ RH = 1502 - r''' + r""" Drive format returns to a logic level high after each bit. - ''' + """ SBC = 1503 - r''' + r""" Drive format returns to the complement logic level of the bit after each bit. - ''' + """ class FrequencyMeasurementMode(Enum): BANKED = 3700 - r''' + r""" Frequency measurements are made serially for groups of channels associated with a single frequency counter for each group. Maximum frequency measured: 200 MHz. - ''' + """ PARALLEL = 3701 - r''' + r""" Frequency measurements are made by multiple frequency counters in parallel. Maximum frequency measured: 100 MHz. - ''' + """ class HistoryRAMCyclesToAcquire(Enum): FAILED = 2303 - r''' + r""" Acquires failed cycles. - ''' + """ ALL = 2304 - r''' + r""" Acquires all cycles. - ''' + """ class HistoryRAMTriggerType(Enum): FIRST_FAILURE = 2200 - r''' + r""" First Failure History RAM trigger - ''' + """ CYCLE_NUMBER = 2201 - r''' + r""" Cycle Number History RAM trigger. - ''' + """ PATTERN_LABEL = 2202 - r''' + r""" Pattern Label History RAM trigger - ''' + """ class PPMUApertureTimeUnits(Enum): SECONDS = 2100 - r''' + r""" Unit in seconds. - ''' + """ class PPMUCurrentLimitBehavior(Enum): REGULATE = 3100 - r''' + r""" Controls output current so that it does not exceed the current limit. Power continues to generate even if the current limit is reached. - ''' + """ class PPMUMeasurementType(Enum): CURRENT = 2400 - r''' + r""" The PPMU measures current. - ''' + """ VOLTAGE = 2401 - r''' + r""" The PPMU measures voltage. - ''' + """ class PPMUOutputFunction(Enum): VOLTAGE = 1300 - r''' + r""" The PPMU forces voltage to the DUT. - ''' + """ CURRENT = 1301 - r''' + r""" The PPMU forces current to the DUT. - ''' + """ class PinState(Enum): ZERO = 0 - r''' + r""" A digital state of 0. - ''' + """ ONE = 1 - r''' + r""" A digital state of 1. - ''' + """ L = 3 - r''' + r""" A digital state of L (low). - ''' + """ H = 4 - r''' + r""" A digital state of H (high). - ''' + """ X = 5 - r''' + r""" A digital state of X (non-drive state). - ''' + """ M = 6 - r''' + r""" A digital state of M (midband). - ''' + """ V = 7 - r''' + r""" A digital state of V (compare high or low, not midband; store results from capture functionality if configured). - ''' + """ D = 8 - r''' + r""" A digital state of D (drive data from source functionality if configured). - ''' + """ E = 9 - r''' + r""" A digital state of E (compare data from source functionality if configured). - ''' + """ NOT_A_PIN_STATE = 254 - r''' + r""" Not a pin state is used for non-existent DUT cycles. - ''' + """ PIN_STATE_NOT_ACQUIRED = 255 - r''' + r""" Pin state could not be acquired because none of the pins mapped to the instrument in a multi-instrument session had any failures. - ''' + """ def __str__(self): return { - 'ZERO': '0', - 'ONE': '1', - 'NOT_A_PIN_STATE': 'Not a Pin State', - 'PIN_STATE_NOT_ACQUIRED': 'Pin State Not Acquired', + "ZERO": "0", + "ONE": "1", + "NOT_A_PIN_STATE": "Not a Pin State", + "PIN_STATE_NOT_ACQUIRED": "Pin State Not Acquired", }.get(self.name, self.name) class SelectedFunction(Enum): DIGITAL = 1100 - r''' + r""" The pattern sequencer controls the specified pin(s). If a pattern is currently bursting, the pin immediately switches to bursting the pattern. This option disconnects the PPMU. - ''' + """ PPMU = 1101 - r''' + r""" The PPMU controls the specified pin(s) and connects the PPMU. The pin driver is in a non-drive state, and the active load is disabled. The PPMU does not start sourcing or measuring until Source or Measure(PpmuMeasurementType) is called. - ''' + """ OFF = 1102 - r''' + r""" Puts the digital driver in a non-drive state, disables the active load, disconnects the PPMU, and closes the I/O switch connecting the instrument channel. - ''' + """ DISCONNECT = 1103 - r''' + r""" The I/O switch connecting the instrument channel is open to the I/O connector. If the PPMU is sourcing, it is stopped prior to opening the I/O switch. - ''' + """ RIO = 1104 - r''' + r""" Yields control of the specified pin(s) to LabVIEW FPGA. - ''' + """ class SequencerFlag(Enum): - FLAG0 = 'seqflag0' - FLAG1 = 'seqflag1' - FLAG2 = 'seqflag2' - FLAG3 = 'seqflag3' + FLAG0 = "seqflag0" + FLAG1 = "seqflag1" + FLAG2 = "seqflag2" + FLAG3 = "seqflag3" class SequencerRegister(Enum): - REGISTER0 = 'reg0' - REGISTER1 = 'reg1' - REGISTER2 = 'reg2' - REGISTER3 = 'reg3' - REGISTER4 = 'reg4' - REGISTER5 = 'reg5' - REGISTER6 = 'reg6' - REGISTER7 = 'reg7' - REGISTER8 = 'reg8' - REGISTER9 = 'reg9' - REGISTER10 = 'reg10' - REGISTER11 = 'reg11' - REGISTER12 = 'reg12' - REGISTER13 = 'reg13' - REGISTER14 = 'reg14' - REGISTER15 = 'reg15' + REGISTER0 = "reg0" + REGISTER1 = "reg1" + REGISTER2 = "reg2" + REGISTER3 = "reg3" + REGISTER4 = "reg4" + REGISTER5 = "reg5" + REGISTER6 = "reg6" + REGISTER7 = "reg7" + REGISTER8 = "reg8" + REGISTER9 = "reg9" + REGISTER10 = "reg10" + REGISTER11 = "reg11" + REGISTER12 = "reg12" + REGISTER13 = "reg13" + REGISTER14 = "reg14" + REGISTER15 = "reg15" class _SiteResultType(Enum): PASS_FAIL = 3300 - r''' + r""" Pass/fail site result. - ''' + """ CAPTURE_WAVEFORM = 3301 - r''' + r""" Capture waveform site result. - ''' + """ class SoftwareTrigger(Enum): START = 2000 - r''' + r""" Overrides the start trigger. - ''' + """ CONDITIONAL_JUMP = 2001 - r''' + r""" Specifies to route a conditional jump trigger. - ''' + """ class SourceDataMapping(Enum): BROADCAST = 2600 - r''' + r""" Broadcasts the waveform you specify to all sites. - ''' + """ SITE_UNIQUE = 2601 - r''' + r""" Sources unique waveform data to each site. - ''' + """ class TDREndpointTermination(Enum): OPEN = 3600 - r''' + r""" TDR channels are connected to an open circuit. - ''' + """ SHORT_TO_GROUND = 3601 - r''' + r""" TDR channels are connected to a short to ground. - ''' + """ class TerminationMode(Enum): ACTIVE_LOAD = 1200 - r''' + r""" The active load provides a constant current to a commutating voltage (Vcom). - ''' + """ VTERM = 1201 - r''' + r""" The pin driver drives Vterm. - ''' + """ HIGH_Z = 1202 - r''' + r""" The pin driver is in a non-drive state (in a high-impedance state) and the active load is disabled. - ''' + """ class TimeSetEdgeType(Enum): DRIVE_ON = 2800 - r''' + r""" Specifies the drive on edge of the time set. - ''' + """ DRIVE_DATA = 2801 - r''' + r""" Specifies the drive data edge of the time set. - ''' + """ DRIVE_RETURN = 2802 - r''' + r""" Specifies the drive return edge of the time set. - ''' + """ DRIVE_OFF = 2803 - r''' + r""" Specifies the drive off edge of the time set. - ''' + """ COMPARE_STROBE = 2804 - r''' + r""" Specifies the compare strobe of the time set. - ''' + """ DRIVE_DATA2 = 2805 - r''' + r""" Specifies the drive data 2 edge of the time set. - ''' + """ DRIVE_RETURN2 = 2806 - r''' + r""" Specifies the drive return 2 edge of the time set. - ''' + """ COMPARE_STROBE2 = 2807 - r''' + r""" Specifies the compare strobe 2 of the time set. - ''' + """ class TriggerType(Enum): NONE = 1700 - r''' + r""" Disables the start trigger. - ''' + """ DIGITAL_EDGE = 1701 - r''' + r""" Digital edge trigger. - ''' + """ SOFTWARE = 1702 - r''' + r""" Software start trigger. - ''' + """ class WriteStaticPinState(Enum): ZERO = 0 - r''' + r""" Specifies to drive low. - ''' + """ ONE = 1 - r''' + r""" Specifies to drive high. - ''' + """ X = 5 - r''' + r""" Specifies to not drive. - ''' + """ def __str__(self): return { - 'ZERO': '0', - 'ONE': '1', + "ZERO": "0", + "ONE": "1", }.get(self.name, self.name) diff --git a/generated/nidigital/nidigital/errors.py b/generated/nidigital/nidigital/errors.py index e6c0a9402..3cfc94d52 100644 --- a/generated/nidigital/nidigital/errors.py +++ b/generated/nidigital/nidigital/errors.py @@ -7,86 +7,103 @@ def _is_success(code): - return (code == 0) + return code == 0 def _is_error(code): - return (code < 0) + return code < 0 def _is_warning(code): - return (code > 0) + return code > 0 class Error(Exception): - '''Base error class for NI-Digital Pattern Driver''' + """Base error class for NI-Digital Pattern Driver""" def __init__(self, message): super(Error, self).__init__(message) class DriverError(Error): - '''An error originating from the NI-Digital Pattern Driver driver''' + """An error originating from the NI-Digital Pattern Driver driver""" def __init__(self, code, description): - assert (_is_error(code)), "Should not raise Error if code is not fatal." + assert _is_error(code), "Should not raise Error if code is not fatal." self.code = code self.description = description super(DriverError, self).__init__(str(self.code) + ": " + self.description) class DriverWarning(Warning): - '''A warning originating from the NI-Digital Pattern Driver driver''' + """A warning originating from the NI-Digital Pattern Driver driver""" def __init__(self, code, description): - assert (_is_warning(code)), "Should not create Warning if code is not positive." - super(DriverWarning, self).__init__('Warning {0} occurred.\n\n{1}'.format(code, description)) + assert _is_warning(code), "Should not create Warning if code is not positive." + super(DriverWarning, self).__init__( + "Warning {0} occurred.\n\n{1}".format(code, description) + ) class UnsupportedConfigurationError(Error): - '''An error due to using this module in an usupported platform.''' + """An error due to using this module in an usupported platform.""" def __init__(self): - super(UnsupportedConfigurationError, self).__init__('System configuration is unsupported: ' + platform.architecture()[0] + ' ' + platform.system()) + super(UnsupportedConfigurationError, self).__init__( + "System configuration is unsupported: " + + platform.architecture()[0] + + " " + + platform.system() + ) class DriverNotInstalledError(Error): - '''An error due to using this module without the driver runtime installed.''' + """An error due to using this module without the driver runtime installed.""" def __init__(self): - super(DriverNotInstalledError, self).__init__('The NI-Digital Pattern Driver runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it.') + super(DriverNotInstalledError, self).__init__( + "The NI-Digital Pattern Driver runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it." + ) class DriverTooOldError(Error): - '''An error due to using this module with an older version of the driver runtime.''' + """An error due to using this module with an older version of the driver runtime.""" def __init__(self): - super(DriverTooOldError, self).__init__('A function was not found in the NI-Digital Pattern Driver runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it.') + super(DriverTooOldError, self).__init__( + "A function was not found in the NI-Digital Pattern Driver runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it." + ) class InvalidRepeatedCapabilityError(Error): - '''An error due to an invalid character in a repeated capability''' + """An error due to an invalid character in a repeated capability""" def __init__(self, invalid_character, invalid_string): - super(InvalidRepeatedCapabilityError, self).__init__('An invalid character ({0}) was found in repeated capability string ({1})'.format(invalid_character, invalid_string)) + super(InvalidRepeatedCapabilityError, self).__init__( + "An invalid character ({0}) was found in repeated capability string ({1})".format( + invalid_character, invalid_string + ) + ) class SelfTestError(Error): - '''An error due to a failed self-test''' + """An error due to a failed self-test""" def __init__(self, code, msg): self.code = code self.message = msg - super(SelfTestError, self).__init__('Self-test failed with code {0}: {1}'.format(code, msg)) + super(SelfTestError, self).__init__( + "Self-test failed with code {0}: {1}".format(code, msg) + ) def handle_error(session, code, ignore_warnings, is_error_handling): - '''handle_error + """handle_error Helper function for handling errors returned by nidigital.Library. It calls back into the session to get the corresponding error description and raises if necessary. - ''' + """ if _is_success(code) or (_is_warning(code) and ignore_warnings): return @@ -94,7 +111,7 @@ def handle_error(session, code, ignore_warnings, is_error_handling): if is_error_handling: # The caller is in the midst of error handling and an error occurred. # Don't try to get the description or we'll start recursing until the stack overflows. - description = '' + description = "" else: description = session._get_error_description(code) @@ -103,5 +120,3 @@ def handle_error(session, code, ignore_warnings, is_error_handling): assert _is_warning(code) warnings.warn(DriverWarning(code, description)) - - diff --git a/generated/nidigital/nidigital/history_ram_cycle_information.py b/generated/nidigital/nidigital/history_ram_cycle_information.py index 78c682cf0..65d559775 100644 --- a/generated/nidigital/nidigital/history_ram_cycle_information.py +++ b/generated/nidigital/nidigital/history_ram_cycle_information.py @@ -1,5 +1,15 @@ class HistoryRAMCycleInformation(object): - def __init__(self, pattern_name, time_set_name, vector_number, cycle_number, scan_cycle_number, expected_pin_states, actual_pin_states, per_pin_pass_fail): + def __init__( + self, + pattern_name, + time_set_name, + vector_number, + cycle_number, + scan_cycle_number, + expected_pin_states, + actual_pin_states, + per_pin_pass_fail, + ): self.pattern_name = pattern_name self.time_set_name = time_set_name self.vector_number = vector_number @@ -13,40 +23,71 @@ def __repr__(self): parameter_list = [ 'pattern_name="{}"'.format(self.pattern_name), 'time_set_name="{}"'.format(self.time_set_name), - 'vector_number={}'.format(self.vector_number), - 'cycle_number={}'.format(self.cycle_number), - 'scan_cycle_number={}'.format(self.scan_cycle_number), - 'expected_pin_states={}'.format(self._digital_states_representation(self.expected_pin_states)), - 'actual_pin_states={}'.format(self._digital_states_representation(self.actual_pin_states)), - 'per_pin_pass_fail={}'.format(self.per_pin_pass_fail), + "vector_number={}".format(self.vector_number), + "cycle_number={}".format(self.cycle_number), + "scan_cycle_number={}".format(self.scan_cycle_number), + "expected_pin_states={}".format( + self._digital_states_representation(self.expected_pin_states) + ), + "actual_pin_states={}".format( + self._digital_states_representation(self.actual_pin_states) + ), + "per_pin_pass_fail={}".format(self.per_pin_pass_fail), ] - return '{0}.{1}({2})'.format(self.__class__.__module__, self.__class__.__qualname__, ', '.join(parameter_list)) + return "{0}.{1}({2})".format( + self.__class__.__module__, + self.__class__.__qualname__, + ", ".join(parameter_list), + ) def __str__(self): # different format lines - row_format_d = '{:<20}: {:,}\n' - row_format_s = '{:<20}: {:}\n' + row_format_d = "{:<20}: {:,}\n" + row_format_s = "{:<20}: {:}\n" - string_representation = '' - string_representation += row_format_s.format('Pattern Name', self.pattern_name) - string_representation += row_format_s.format('Time Set Name', self.time_set_name) - string_representation += row_format_d.format('Vector Number', self.vector_number) - string_representation += row_format_d.format('Cycle Number', self.cycle_number) - string_representation += row_format_d.format('Scan Cycle Number', self.scan_cycle_number) - string_representation += row_format_s.format('Expected Pin States', self._digital_states_string(self.expected_pin_states)) - string_representation += row_format_s.format('Actual Pin States', self._digital_states_string(self.actual_pin_states)) - string_representation += row_format_s.format('Per Pin Pass Fail', self.per_pin_pass_fail) + string_representation = "" + string_representation += row_format_s.format("Pattern Name", self.pattern_name) + string_representation += row_format_s.format( + "Time Set Name", self.time_set_name + ) + string_representation += row_format_d.format( + "Vector Number", self.vector_number + ) + string_representation += row_format_d.format("Cycle Number", self.cycle_number) + string_representation += row_format_d.format( + "Scan Cycle Number", self.scan_cycle_number + ) + string_representation += row_format_s.format( + "Expected Pin States", self._digital_states_string(self.expected_pin_states) + ) + string_representation += row_format_s.format( + "Actual Pin States", self._digital_states_string(self.actual_pin_states) + ) + string_representation += row_format_s.format( + "Per Pin Pass Fail", self.per_pin_pass_fail + ) return string_representation @staticmethod def _digital_states_representation(states): - states_representation = [['{0}.{1}.{2}'.format(i.__class__.__module__, i.__class__.__qualname__, i.name) for i in j] for j in states] - return '[{}]'.format(', '.join(['[{}]'.format(', '.join(i)) for i in states_representation])) + states_representation = [ + [ + "{0}.{1}.{2}".format( + i.__class__.__module__, i.__class__.__qualname__, i.name + ) + for i in j + ] + for j in states + ] + return "[{}]".format( + ", ".join(["[{}]".format(", ".join(i)) for i in states_representation]) + ) @staticmethod def _digital_states_string(states): states_string = [[str(i) for i in j] for j in states] - return '[{}]'.format(', '.join(['[{}]'.format(', '.join(i)) for i in states_string])) - + return "[{}]".format( + ", ".join(["[{}]".format(", ".join(i)) for i in states_string]) + ) diff --git a/generated/nidigital/nidigital/session.py b/generated/nidigital/nidigital/session.py index 5fe928f87..d6fb85c2c 100644 --- a/generated/nidigital/nidigital/session.py +++ b/generated/nidigital/nidigital/session.py @@ -2,6 +2,7 @@ # This file was generated import array # noqa: F401 import ctypes + # Used by @ivi_synchronized from functools import wraps @@ -19,22 +20,24 @@ # Used for __repr__ import pprint + pp = pprint.PrettyPrinter(indent=4) # Helper functions for creating ctypes needed for calling into the driver DLL def get_ctypes_pointer_for_buffer(value=None, library_type=None, size=None): if isinstance(value, array.array): - assert library_type is not None, 'library_type is required for array.array' + assert library_type is not None, "library_type is required for array.array" addr, _ = value.buffer_info() return ctypes.cast(addr, ctypes.POINTER(library_type)) elif str(type(value)).find("'numpy.ndarray'") != -1: import numpy + return numpy.ctypeslib.as_ctypes(value) elif isinstance(value, bytes): return ctypes.cast(value, ctypes.POINTER(library_type)) elif isinstance(value, list): - assert library_type is not None, 'library_type is required for list' + assert library_type is not None, "library_type is required for list" return (library_type * len(value))(*value) else: if library_type is not None and size is not None: @@ -74,6 +77,7 @@ def aux(*xs, **kws): session = xs[0] # parameter 0 is 'self' which is the session object with session.lock(): return f(*xs, **kws) + return aux @@ -94,16 +98,34 @@ def __init__(self, session, prefix, current_repeated_capability_list): self._session = session self._prefix = prefix # We need at least one element. If we get an empty list, make the one element an empty string - self._current_repeated_capability_list = current_repeated_capability_list if len(current_repeated_capability_list) > 0 else [''] + self._current_repeated_capability_list = ( + current_repeated_capability_list + if len(current_repeated_capability_list) > 0 + else [""] + ) # Now we know there is at lease one entry, so we look if it is an empty string or not - self._separator = '/' if len(self._current_repeated_capability_list[0]) > 0 else '' + self._separator = ( + "/" if len(self._current_repeated_capability_list[0]) > 0 else "" + ) def __getitem__(self, repeated_capability): - '''Set/get properties or call methods with a repeated capability (i.e. channels)''' - rep_caps_list = _converters.convert_repeated_capabilities(repeated_capability, self._prefix) - complete_rep_cap_list = [current_rep_cap + self._separator + rep_cap for current_rep_cap in self._current_repeated_capability_list for rep_cap in rep_caps_list] - - return _SessionBase(vi=self._session._vi, repeated_capability_list=complete_rep_cap_list, library=self._session._library, encoding=self._session._encoding, freeze_it=True) + """Set/get properties or call methods with a repeated capability (i.e. channels)""" + rep_caps_list = _converters.convert_repeated_capabilities( + repeated_capability, self._prefix + ) + complete_rep_cap_list = [ + current_rep_cap + self._separator + rep_cap + for current_rep_cap in self._current_repeated_capability_list + for rep_cap in rep_caps_list + ] + + return _SessionBase( + vi=self._session._vi, + repeated_capability_list=complete_rep_cap_list, + library=self._session._library, + encoding=self._session._encoding, + freeze_it=True, + ) # This is a very simple context manager we can use when we need to set/get attributes @@ -115,20 +137,20 @@ def __init__(self, session): def __enter__(self): self._repeated_capability_cache = self._session._repeated_capability - self._session._repeated_capability = '' + self._session._repeated_capability = "" def __exit__(self, exc_type, exc_value, traceback): self._session._repeated_capability = self._repeated_capability_cache class _SessionBase(object): - '''Base class for all NI-Digital Pattern Driver sessions.''' + """Base class for all NI-Digital Pattern Driver sessions.""" # This is needed during __init__. Without it, __setattr__ raises an exception _is_frozen = False active_load_ioh = _attributes.AttributeViReal64(1150013) - '''Type: float + """Type: float Specifies the current that the DUT sources to the active load while outputting a voltage above VCOM. @@ -141,9 +163,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.active_load_ioh` - ''' + """ active_load_iol = _attributes.AttributeViReal64(1150012) - '''Type: float + """Type: float Specifies the current that the DUT sinks from the active load while outputting a voltage below VCOM. @@ -156,9 +178,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.active_load_iol` - ''' + """ active_load_vcom = _attributes.AttributeViReal64(1150014) - '''Type: float + """Type: float Specifies the voltage level at which the active load circuit switches between sourcing current and sinking current. @@ -171,19 +193,19 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.active_load_vcom` - ''' + """ cache = _attributes.AttributeViBoolean(1050004) - '''Type: bool + """Type: bool Specifies whether to cache the value of properties. When caching is enabled, the instrument driver keeps track of the current instrument settings and avoids sending redundant commands to the instrument. This significantly increases execution speed. Caching is always enabled in the driver, regardless of the value of this property. - ''' + """ channel_count = _attributes.AttributeViInt32(1050203) - '''Type: int + """Type: int Returns the number of channels that the specific digital pattern instrument driver supports. - ''' + """ clock_generator_frequency = _attributes.AttributeViReal64(1150073) - '''Type: float + """Type: float Specifies the frequency for the clock generator. @@ -196,9 +218,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.clock_generator_frequency` - ''' + """ clock_generator_is_running = _attributes.AttributeViBoolean(1150074) - '''Type: bool + """Type: bool Indicates whether the clock generator is running. @@ -211,9 +233,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.clock_generator_is_running` - ''' + """ conditional_jump_trigger_terminal_name = _attributes.AttributeViString(1150040) - '''Type: str + """Type: str Specifies the terminal name from which the exported conditional jump trigger signal may be routed to other instruments through the PXI trigger bus. You can use this signal to trigger other instruments when the conditional jump trigger instance asserts on the digital pattern instrument. @@ -226,9 +248,11 @@ class _SessionBase(object): To set/get on all conditional_jump_triggers, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.conditional_jump_trigger_terminal_name` - ''' - conditional_jump_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerType, 1150033) - '''Type: enums.TriggerType + """ + conditional_jump_trigger_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TriggerType, 1150033 + ) + """Type: enums.TriggerType Disables the conditional jump trigger or configures it for either hardware triggering or software triggering. The default value is TriggerType.NONE. @@ -251,14 +275,18 @@ class _SessionBase(object): To set/get on all conditional_jump_triggers, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.conditional_jump_trigger_type` - ''' - cycle_number_history_ram_trigger_cycle_number = _attributes.AttributeViInt64(1150044) - '''Type: int + """ + cycle_number_history_ram_trigger_cycle_number = _attributes.AttributeViInt64( + 1150044 + ) + """Type: int Specifies the cycle number on which History RAM starts acquiring pattern information when configured for a cycle number trigger. - ''' - digital_edge_conditional_jump_trigger_edge = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.DigitalEdge, 1150035) - '''Type: enums.DigitalEdge + """ + digital_edge_conditional_jump_trigger_edge = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.DigitalEdge, 1150035 + ) + """Type: enums.DigitalEdge Configures the active edge of the incoming trigger signal for the conditional jump trigger instance. The default value is DigitalEdge.RISING. @@ -279,9 +307,11 @@ class _SessionBase(object): To set/get on all conditional_jump_triggers, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.digital_edge_conditional_jump_trigger_edge` - ''' - digital_edge_conditional_jump_trigger_source = _attributes.AttributeViString(1150034) - '''Type: str + """ + digital_edge_conditional_jump_trigger_source = _attributes.AttributeViString( + 1150034 + ) + """Type: str Configures the digital trigger source terminal for a conditional jump trigger instance. The PXIe-6570/6571 supports triggering through the PXI trigger bus. You can specify source terminals in one of two ways. If the digital pattern instrument is named Dev1 and your terminal is PXI_Trig0, you can specify the terminal with the fully qualified terminal name, /Dev1/PXI_Trig0, or with the shortened terminal name, PXI_Trig0. The source terminal can also be a terminal from another device, in which case the NI-Digital Pattern Driver automatically finds a route (if one is available) from that terminal to the input terminal (going through a physical PXI backplane trigger line). For example, you can set the source terminal on Dev1 to be /Dev2/ConditionalJumpTrigger0. The default value is VI_NULL. @@ -300,9 +330,11 @@ class _SessionBase(object): To set/get on all conditional_jump_triggers, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.digital_edge_conditional_jump_trigger_source` - ''' - digital_edge_rio_trigger_edge = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.DigitalEdge, 1150088) - '''Type: enums.DigitalEdge + """ + digital_edge_rio_trigger_edge = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.DigitalEdge, 1150088 + ) + """Type: enums.DigitalEdge Configures the active edge of the incoming trigger signal for the RIO trigger instance. The default value is DigitalEdge.RISING. @@ -323,9 +355,9 @@ class _SessionBase(object): To set/get on all rio_triggers, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.digital_edge_rio_trigger_edge` - ''' + """ digital_edge_rio_trigger_source = _attributes.AttributeViString(1150087) - '''Type: str + """Type: str Configures the digital trigger source terminal for a RIO trigger instance. The PXIe-6570/6571 supports triggering through the PXI trigger bus. You can specify source terminals in one of two ways. If the digital pattern instrument is named Dev1 and your terminal is PXI_Trig0, you can specify the terminal with the fully qualified terminal name, /Dev1/PXI_Trig0, or with the shortened terminal name, PXI_Trig0. The source terminal can also be a terminal from another device, in which case the NI-Digital Pattern Driver automatically finds a route (if one is available) from that terminal to the input terminal (going through a physical PXI backplane trigger line). For example, you can set the source terminal on Dev1 to be /Dev2/RIOTrigger0. The default value is VI_NULL. @@ -344,9 +376,11 @@ class _SessionBase(object): To set/get on all rio_triggers, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.digital_edge_rio_trigger_source` - ''' - digital_edge_start_trigger_edge = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.DigitalEdge, 1150031) - '''Type: enums.DigitalEdge + """ + digital_edge_start_trigger_edge = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.DigitalEdge, 1150031 + ) + """Type: enums.DigitalEdge Specifies the active edge for the Start trigger. This property is used when the start_trigger_type property is set to Digital Edge. @@ -357,9 +391,9 @@ class _SessionBase(object): +---------------------+-------------------------------------------------------------------------------+ | DigitalEdge.FALLING | Asserts the trigger when the signal transitions from high level to low level. | +---------------------+-------------------------------------------------------------------------------+ - ''' + """ digital_edge_start_trigger_source = _attributes.AttributeViString(1150030) - '''Type: str + """Type: str Specifies the source terminal for the Start trigger. This property is used when the start_trigger_type property is set to Digital Edge. You can specify source terminals in one of two ways. If the digital pattern instrument is named Dev1 and your terminal is PXI_Trig0, you can specify the terminal with the fully qualified terminal name, /Dev1/PXI_Trig0, or with the shortened terminal name, PXI_Trig0. The source terminal can also be a terminal from another device, in which case the NI-Digital Pattern Driver automatically finds a route (if one is available) from that terminal to the input terminal (going through a physical PXI backplane trigger line). For example, you can set the source terminal on Dev1 to be /Dev2/StartTrigger. @@ -382,14 +416,16 @@ class _SessionBase(object): +-----------------+--------------------+ | PXI_Trig7 | PXI trigger line 7 | +-----------------+--------------------+ - ''' + """ driver_setup = _attributes.AttributeViString(1050007) - '''Type: str + """Type: str This property returns initial values for NI-Digital Pattern Driver properties as a string. - ''' - exported_conditional_jump_trigger_output_terminal = _attributes.AttributeViString(1150036) - '''Type: str + """ + exported_conditional_jump_trigger_output_terminal = _attributes.AttributeViString( + 1150036 + ) + """Type: str Specifies the terminal to output the exported signal of the specified instance of the conditional jump trigger. The default value is VI_NULL. @@ -424,9 +460,11 @@ class _SessionBase(object): To set/get on all conditional_jump_triggers, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.exported_conditional_jump_trigger_output_terminal` - ''' - exported_pattern_opcode_event_output_terminal = _attributes.AttributeViString(1150041) - '''Type: str + """ + exported_pattern_opcode_event_output_terminal = _attributes.AttributeViString( + 1150041 + ) + """Type: str Specifies the destination terminal for exporting the Pattern Opcode Event. Terminals can be specified in one of two ways. If the digital pattern instrument is named Dev1 and your terminal is PXI_Trig0, you can specify the terminal with the fully qualified terminal name, /Dev1/PXI_Trig0, or with the shortened terminal name, PXI_Trig0. @@ -459,9 +497,9 @@ class _SessionBase(object): To set/get on all pattern_opcode_events, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.exported_pattern_opcode_event_output_terminal` - ''' + """ exported_rio_event_output_terminal = _attributes.AttributeViString(1150090) - '''Type: str + """Type: str Specifies the destination terminal for exporting the RIO Event. Terminals can be specified in one of two ways. If the digital pattern instrument is named Dev1 and your terminal is PXI_Trig0, you can specify the terminal with the fully qualified terminal name, /Dev1/PXI_Trig0, or with the shortened terminal name, PXI_Trig0. @@ -494,9 +532,9 @@ class _SessionBase(object): To set/get on all rio_events, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.exported_rio_event_output_terminal` - ''' + """ exported_start_trigger_output_terminal = _attributes.AttributeViString(1150032) - '''Type: str + """Type: str Specifies the destination terminal for exporting the Start trigger. Terminals can be specified in one of two ways. If the digital pattern instrument is named Dev1 and your terminal is PXI_Trig0, you can specify the terminal with the fully qualified terminal name, /Dev1/PXI_Trig0, or with the shortened terminal name, PXI_Trig0. @@ -521,14 +559,16 @@ class _SessionBase(object): +----------------------+-----------------------------+ | PXI_Trig7 | PXI trigger line 7 | +----------------------+-----------------------------+ - ''' + """ frequency_counter_hysteresis_enabled = _attributes.AttributeViBoolean(1150085) - '''Type: bool + """Type: bool Specifies whether hysteresis is enabled for the frequency counters of the digital pattern instrument. - ''' - frequency_counter_measurement_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.FrequencyMeasurementMode, 1150084) - '''Type: enums.FrequencyMeasurementMode + """ + frequency_counter_measurement_mode = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.FrequencyMeasurementMode, 1150084 + ) + """Type: enums.FrequencyMeasurementMode Determines how the frequency counters of the digital pattern instrument make measurements. @@ -539,9 +579,11 @@ class _SessionBase(object): +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | FrequencyMeasurementMode.PARALLEL | All discrete frequency counters make frequency measurements from all channels in parallel with one another. Use parallel mode to increase the speed of frequency measurements if you do not need access to the full measure frequency range of the instrument; in parallel mode, you can also add frequency_counter_hysteresis_enabled to reduce measurement noise. | +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - ''' - frequency_counter_measurement_time = _attributes.AttributeViReal64TimeDeltaSeconds(1150069) - '''Type: float in seconds or datetime.timedelta + """ + frequency_counter_measurement_time = _attributes.AttributeViReal64TimeDeltaSeconds( + 1150069 + ) + """Type: float in seconds or datetime.timedelta Specifies the measurement time for the frequency counter. @@ -554,19 +596,19 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.frequency_counter_measurement_time` - ''' + """ group_capabilities = _attributes.AttributeViString(1050401) - '''Type: str + """Type: str Returns a string that contains a comma-separated list of class-extension groups that the driver implements. - ''' + """ halt_on_keep_alive_opcode = _attributes.AttributeViBoolean(1150062) - '''Type: bool + """Type: bool Specifies whether keep_alive opcodes should behave like halt opcodes. - ''' + """ history_ram_buffer_size_per_site = _attributes.AttributeViInt64(1150079) - '''Type: int + """Type: int Specifies the size, in samples, of the host memory buffer. The default value is 32000. @@ -575,9 +617,11 @@ class _SessionBase(object): +===============+ | 0-INT64_MAX | +---------------+ - ''' - history_ram_cycles_to_acquire = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.HistoryRAMCyclesToAcquire, 1150047) - '''Type: enums.HistoryRAMCyclesToAcquire + """ + history_ram_cycles_to_acquire = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.HistoryRAMCyclesToAcquire, 1150047 + ) + """Type: enums.HistoryRAMCyclesToAcquire Configures which cycles History RAM acquires after the trigger conditions are met. If you configure History RAM to only acquire failed cycles, you must set the pretrigger samples for History RAM to 0. @@ -588,14 +632,14 @@ class _SessionBase(object): +----------------------------------+-----------------------------------------------------------------------------------+ | HistoryRAMCyclesToAcquire.ALL | Acquires all cycles after the triggering conditions are met. | +----------------------------------+-----------------------------------------------------------------------------------+ - ''' + """ history_ram_max_samples_to_acquire_per_site = _attributes.AttributeViInt32(1150077) - '''Type: int + """Type: int Specifies the maximum number of History RAM samples to acquire per site. If the property is set to -1, it will acquire until the History RAM buffer is full. - ''' + """ history_ram_number_of_samples_is_finite = _attributes.AttributeViBoolean(1150078) - '''Type: bool + """Type: bool Specifies whether the instrument acquires a finite number of History Ram samples or acquires continuously. The maximum number of samples that will be acquired when this property is set to True is determined by the instrument History RAM depth specification and the History RAM Max Samples to Acquire Per Site property. The default value is True. @@ -606,14 +650,16 @@ class _SessionBase(object): +---------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | False | Specifies that History RAM results will automatically start streaming into a host buffer after a pattern is burst and the History RAM has triggered. | +---------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ - ''' + """ history_ram_pretrigger_samples = _attributes.AttributeViInt32(1150048) - '''Type: int + """Type: int Specifies the number of samples to acquire before the trigger conditions are met. If you configure History RAM to only acquire failed cycles, you must set the pretrigger samples for History RAM to 0. - ''' - history_ram_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.HistoryRAMTriggerType, 1150043) - '''Type: enums.HistoryRAMTriggerType + """ + history_ram_trigger_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.HistoryRAMTriggerType, 1150043 + ) + """Type: enums.HistoryRAMTriggerType Specifies the type of trigger condition on which History RAM starts acquiring pattern information. @@ -626,9 +672,9 @@ class _SessionBase(object): +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+ | HistoryRAMTriggerType.PATTERN_LABEL | Starts acquiring pattern information in History RAM starting from a specified pattern label, augmented by vector and cycle offsets. | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+ - ''' + """ instrument_firmware_revision = _attributes.AttributeViString(1050510) - '''Type: str + """Type: str Returns a string that contains the firmware revision information for the digital pattern instrument. @@ -641,39 +687,39 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.instrument_firmware_revision` - ''' + """ instrument_manufacturer = _attributes.AttributeViString(1050511) - '''Type: str + """Type: str Returns a string ("National Instruments") that contains the name of the manufacturer of the digital pattern instrument. - ''' + """ instrument_model = _attributes.AttributeViString(1050512) - '''Type: str + """Type: str Returns a string that contains the model number or name of the digital pattern instrument. - ''' + """ interchange_check = _attributes.AttributeViBoolean(1050021) - '''Type: bool + """Type: bool This property is not supported. - ''' + """ io_resource_descriptor = _attributes.AttributeViString(1050304) - '''Type: str + """Type: str Returns a string that contains the resource descriptor that the NI-Digital Pattern Driver uses to identify the digital pattern instrument. - ''' + """ is_keep_alive_active = _attributes.AttributeViBoolean(1150063) - '''Type: bool + """Type: bool Returns True if the digital pattern instrument is driving the keep alive pattern. - ''' + """ logical_name = _attributes.AttributeViString(1050305) - '''Type: str + """Type: str Returns a string containing the logical name that you specified when opening the current IVI session. This property is not supported. - ''' + """ mask_compare = _attributes.AttributeViBoolean(1150060) - '''Type: bool + """Type: bool Specifies whether the pattern comparisons are masked or not. When set to True for a specified pin, failures on that pin will be masked. @@ -686,24 +732,28 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.mask_compare` - ''' - pattern_label_history_ram_trigger_cycle_offset = _attributes.AttributeViInt64(1150045) - '''Type: int + """ + pattern_label_history_ram_trigger_cycle_offset = _attributes.AttributeViInt64( + 1150045 + ) + """Type: int Specifies the number of cycles that follow the specified pattern label and vector offset, after which History RAM will start acquiring pattern information when configured for a pattern label trigger. - ''' + """ pattern_label_history_ram_trigger_label = _attributes.AttributeViString(1150046) - '''Type: str + """Type: str Specifies the pattern label, augmented by the vector and cycle offset, to determine the point where History RAM will start acquiring pattern information when configured for a pattern label trigger. - ''' - pattern_label_history_ram_trigger_vector_offset = _attributes.AttributeViInt64(1150052) - '''Type: int + """ + pattern_label_history_ram_trigger_vector_offset = _attributes.AttributeViInt64( + 1150052 + ) + """Type: int Specifies the number of vectors that follow the specified pattern label, after which History RAM will start acquiring pattern information when configured for a pattern label trigger. - ''' + """ pattern_opcode_event_terminal_name = _attributes.AttributeViString(1150042) - '''Type: str + """Type: str Specifies the terminal name for the output trigger signal of the specified instance of a Pattern Opcode Event. You can use this terminal name as an input signal source for another trigger. @@ -716,9 +766,9 @@ class _SessionBase(object): To set/get on all pattern_opcode_events, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.pattern_opcode_event_terminal_name` - ''' + """ ppmu_allow_extended_voltage_range = _attributes.AttributeViBoolean(1150076) - '''Type: bool + """Type: bool Enables the instrument to operate in additional voltage ranges where instrument specifications may differ from standard ranges. When set to True, this property enables extended voltage range operation. Review specification deviations for application suitability before using this property. NI recommends setting this property to False when not using the extended voltage range to avoid unintentional use of this range. The extended voltage range is supported only for PPMU, with the output method set to DC Voltage. A voltage glitch may occur when you change the PPMU output voltage from a standard range to the extended voltage range, or vice-versa, while the PPMU is sourcing. NI recommends temporarily changing the selected_function property to Off before sourcing a voltage level that requires a range change. @@ -731,9 +781,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_allow_extended_voltage_range` - ''' + """ ppmu_aperture_time = _attributes.AttributeViReal64(1150037) - '''Type: float + """Type: float Specifies the measurement aperture time for the PPMU. The ppmu_aperture_time_units property sets the units of the PPMU aperture time. @@ -746,9 +796,11 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_aperture_time` - ''' - ppmu_aperture_time_units = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.PPMUApertureTimeUnits, 1150038) - '''Type: enums.PPMUApertureTimeUnits + """ + ppmu_aperture_time_units = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.PPMUApertureTimeUnits, 1150038 + ) + """Type: enums.PPMUApertureTimeUnits Specifies the units of the measurement aperture time for the PPMU. @@ -767,9 +819,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_aperture_time_units` - ''' + """ ppmu_current_level = _attributes.AttributeViReal64(1150019) - '''Type: float + """Type: float Specifies the current level, in amps, that the PPMU forces to the DUT. This property is applicable only when you set the ppmu_output_function property to DC Current. Specify valid values for the current level using the PPMU_ConfigureCurrentLevelRange method. @@ -785,9 +837,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_current_level` - ''' + """ ppmu_current_level_range = _attributes.AttributeViReal64(1150020) - '''Type: float + """Type: float Specifies the range of valid values for the current level, in amps, that the PPMU forces to the DUT. This property is applicable only when you set the ppmu_output_function property to DC Current. @@ -800,9 +852,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_current_level_range` - ''' + """ ppmu_current_limit = _attributes.AttributeViReal64(1150054) - '''Type: float + """Type: float Specifies the current limit, in amps, that the output cannot exceed while the PPMU forces voltage to the DUT. This property is applicable only when you set the ppmu_output_function property to DC Voltage. The PXIe-6570/6571 does not support the ppmu_current_limit property and only allows configuration of the ppmu_current_limit_range property. @@ -815,9 +867,11 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_current_limit` - ''' - ppmu_current_limit_behavior = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.PPMUCurrentLimitBehavior, 1150064) - '''Type: enums.PPMUCurrentLimitBehavior + """ + ppmu_current_limit_behavior = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.PPMUCurrentLimitBehavior, 1150064 + ) + """Type: enums.PPMUCurrentLimitBehavior Specifies how the output should behave when the current limit is reached. @@ -836,9 +890,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_current_limit_behavior` - ''' + """ ppmu_current_limit_range = _attributes.AttributeViReal64(1150017) - '''Type: float + """Type: float Specifies the valid range, in amps, to which the current limit can be set while the PPMU forces voltage to the DUT. This property is applicable only when you set the ppmu_output_function property to DC Voltage. @@ -851,9 +905,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_current_limit_range` - ''' + """ ppmu_current_limit_supported = _attributes.AttributeViBoolean(1150055) - '''Type: bool + """Type: bool Returns whether the device supports configuration of a current limit when you set the ppmu_output_function property to DC Voltage. @@ -866,9 +920,11 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_current_limit_supported` - ''' - ppmu_output_function = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.PPMUOutputFunction, 1150015) - '''Type: enums.PPMUOutputFunction + """ + ppmu_output_function = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.PPMUOutputFunction, 1150015 + ) + """Type: enums.PPMUOutputFunction Specifies whether the PPMU forces voltage or current to the DUT. @@ -889,9 +945,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_output_function` - ''' + """ ppmu_voltage_level = _attributes.AttributeViReal64(1150016) - '''Type: float + """Type: float Specifies the voltage level, in volts, that the PPMU forces to the DUT. This property is applicable only when you set the ppmu_output_function property to DC Voltage. @@ -904,9 +960,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_voltage_level` - ''' + """ ppmu_voltage_limit_high = _attributes.AttributeViReal64(1150022) - '''Type: float + """Type: float Specifies the maximum voltage limit, or high clamp voltage (V :sub:`CH` ), in volts, at the pin when the PPMU forces current to the DUT. This property is applicable only when you set the ppmu_output_function property to DC Current. @@ -919,9 +975,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_voltage_limit_high` - ''' + """ ppmu_voltage_limit_low = _attributes.AttributeViReal64(1150021) - '''Type: float + """Type: float Specifies the minimum voltage limit, or low clamp voltage (V :sub:`CL` ), in volts, at the pin when the PPMU forces current to the DUT. This property is applicable only when you set the ppmu_output_function property to DC Current. @@ -934,24 +990,24 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_voltage_limit_low` - ''' + """ query_instrument_status = _attributes.AttributeViBoolean(1050003) - '''Type: bool + """Type: bool Specifies whether the NI-Digital Pattern Driver queries the digital pattern instrument status after each operation. The instrument status is always queried, regardless of the property setting. - ''' + """ range_check = _attributes.AttributeViBoolean(1050002) - '''Type: bool + """Type: bool Checks the range and validates parameter and property values you pass to NI-Digital Pattern Driver methods. Ranges are always checked, regardless of the property setting. - ''' + """ record_coercions = _attributes.AttributeViBoolean(1050006) - '''Type: bool + """Type: bool Specifies whether the IVI engine keeps a list of the value coercions it makes for integer and real type properties. Enabling record value coercions is not supported. - ''' + """ rio_event_terminal_name = _attributes.AttributeViString(1150091) - '''Type: str + """Type: str Specifies the terminal name for the output signal of the specified instance of a RIO Event. You can use this terminal name as an input signal source for another trigger. @@ -964,9 +1020,9 @@ class _SessionBase(object): To set/get on all rio_events, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.rio_event_terminal_name` - ''' + """ rio_trigger_terminal_name = _attributes.AttributeViString(1150089) - '''Type: str + """Type: str Specifies the terminal name from which the exported RIO trigger signal may be routed to other instruments through the PXI trigger bus. You can use this signal to trigger other instruments when the RIO trigger instance asserts on the digital pattern instrument. @@ -979,9 +1035,11 @@ class _SessionBase(object): To set/get on all rio_triggers, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.rio_trigger_terminal_name` - ''' - rio_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerType, 1150086) - '''Type: enums.TriggerType + """ + rio_trigger_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TriggerType, 1150086 + ) + """Type: enums.TriggerType Disables the rio trigger or configures it for hardware triggering. The default value is TriggerType.NONE. @@ -1002,9 +1060,11 @@ class _SessionBase(object): To set/get on all rio_triggers, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.rio_trigger_type` - ''' - selected_function = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.SelectedFunction, 1150004) - '''Type: enums.SelectedFunction + """ + selected_function = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.SelectedFunction, 1150004 + ) + """Type: enums.SelectedFunction Caution: In the Disconnect state, some I/O protection and sensing circuitry remains exposed. Do not subject the instrument to voltage beyond its operating range. @@ -1033,14 +1093,14 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.selected_function` - ''' + """ sequencer_flag_terminal_name = _attributes.AttributeViString(1150059) - '''Type: str + """Type: str Specifies the terminal name for the output trigger signal of the Sequencer Flags trigger. You can use this terminal name as an input signal source for another trigger. - ''' + """ serial_number = _attributes.AttributeViString(1150001) - '''Type: str + """Type: str Returns the serial number of the device. @@ -1053,54 +1113,56 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.serial_number` - ''' + """ simulate = _attributes.AttributeViBoolean(1050005) - '''Type: bool + """Type: bool Simulates I/O operations. After you open a session, you cannot change the simulation state. Use the __init__ method to enable simulation. - ''' + """ specific_driver_class_spec_major_version = _attributes.AttributeViInt32(1050515) - '''Type: int + """Type: int Returns the major version number of the class specification with which NI-Digital is compliant. This property is not supported. - ''' + """ specific_driver_class_spec_minor_version = _attributes.AttributeViInt32(1050516) - '''Type: int + """Type: int Returns the minor version number of the class specification with which NI-Digital is compliant. This property is not supported. - ''' + """ specific_driver_description = _attributes.AttributeViString(1050514) - '''Type: str + """Type: str Returns a string that contains a brief description of the NI-Digital Pattern driver. - ''' + """ specific_driver_prefix = _attributes.AttributeViString(1050302) - '''Type: str + """Type: str Returns a string that contains the prefix for the NI-Digital Pattern driver. - ''' + """ specific_driver_revision = _attributes.AttributeViString(1050551) - '''Type: str + """Type: str Returns a string that contains additional version information about the NI-Digital Pattern Driver. For example, the driver can return Driver: NI-Digital 16.0 as the value of this property. - ''' + """ specific_driver_vendor = _attributes.AttributeViString(1050513) - '''Type: str + """Type: str Returns a string ("National Instruments") that contains the name of the vendor that supplies the NI-Digital Pattern Driver. - ''' + """ start_label = _attributes.AttributeViString(1150023) - '''Type: str + """Type: str Specifies the pattern name or exported pattern label from which to start bursting the pattern. - ''' + """ start_trigger_terminal_name = _attributes.AttributeViString(1150039) - '''Type: str + """Type: str Specifies the terminal name for the output trigger signal of the Start trigger. You can use this terminal name as an input signal source for another trigger. - ''' - start_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerType, 1150029) - '''Type: enums.TriggerType + """ + start_trigger_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TriggerType, 1150029 + ) + """Type: enums.TriggerType Specifies the Start trigger type. The digital pattern instrument waits for this trigger after you call the init method or the burst_pattern method, and does not burst a pattern until this trigger is received. @@ -1116,19 +1178,21 @@ class _SessionBase(object): Note: One or more of the referenced methods are not in the Python API for this driver. - ''' + """ supported_instrument_models = _attributes.AttributeViString(1050327) - '''Type: str + """Type: str Returns a comma delimited string that contains the supported digital pattern instrument models for the specific driver. - ''' - tdr_endpoint_termination = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TDREndpointTermination, 1150081) - '''Type: enums.TDREndpointTermination + """ + tdr_endpoint_termination = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TDREndpointTermination, 1150081 + ) + """Type: enums.TDREndpointTermination Specifies whether TDR Channels are connected to an open circuit or a short to ground. - ''' + """ tdr_offset = _attributes.AttributeViReal64TimeDeltaSeconds(1150051) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the TDR Offset. @@ -1141,9 +1205,11 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.tdr_offset` - ''' - termination_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TerminationMode, 1150006) - '''Type: enums.TerminationMode + """ + termination_mode = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TerminationMode, 1150006 + ) + """Type: enums.TerminationMode Specifies the behavior of the pin during non-drive cycles. @@ -1166,9 +1232,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.termination_mode` - ''' + """ timing_absolute_delay = _attributes.AttributeViReal64TimeDeltaSeconds(1150072) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies a timing delay, measured in seconds, and applies the delay to the digital pattern instrument in addition to TDR and calibration adjustments. If the timing_absolute_delay_enabled property is set to True, this value is the intermodule skew measured by NI-TClk. You can modify this value to override the timing delay and align the I/O timing of this instrument with another instrument that shares the same reference clock. If the timing_absolute_delay_enabled property is False, this property will return 0.0. Changing the timing_absolute_delay_enabled property from False to True will set the timing_absolute_delay value back to your previously set value. @@ -1181,14 +1247,14 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.timing_absolute_delay` - ''' + """ timing_absolute_delay_enabled = _attributes.AttributeViBoolean(1150071) - '''Type: bool + """Type: bool Specifies whether the timing_absolute_delay property should be applied to adjust the digital pattern instrument timing reference relative to other instruments in the system. Do not use this feature with digital pattern instruments in a Semiconductor Test System (STS). Timing absolute delay conflicts with the adjustment performed during STS timing calibration. When set to True, the digital pattern instrument automatically adjusts the timing absolute delay to correct the instrument timing reference relative to other instruments in the system for better timing alignment among synchronized instruments. - ''' + """ vih = _attributes.AttributeViReal64(1150008) - '''Type: float + """Type: float Specifies the voltage that the digital pattern instrument will apply to the input of the DUT when the test instrument drives a logic high (1). @@ -1201,9 +1267,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.vih` - ''' + """ vil = _attributes.AttributeViReal64(1150007) - '''Type: float + """Type: float Specifies the voltage that the digital pattern instrument will apply to the input of the DUT when the test instrument drives a logic low (0). @@ -1216,9 +1282,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.vil` - ''' + """ voh = _attributes.AttributeViReal64(1150010) - '''Type: float + """Type: float Specifies the output voltage from the DUT above which the comparator on the digital pattern test instrument interprets a logic high (H). @@ -1231,9 +1297,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.voh` - ''' + """ vol = _attributes.AttributeViReal64(1150009) - '''Type: float + """Type: float Specifies the output voltage from the DUT below which the comparator on the digital pattern test instrument interprets a logic low (L). @@ -1246,9 +1312,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.vol` - ''' + """ vterm = _attributes.AttributeViReal64(1150011) - '''Type: float + """Type: float Specifies the termination voltage the digital pattern instrument applies during non-drive cycles when the termination mode is set to V :sub:`term`. The instrument applies the termination voltage through a 50 Ω parallel termination resistance. @@ -1261,48 +1327,64 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.vterm` - ''' + """ - def __init__(self, repeated_capability_list, vi, library, encoding, freeze_it=False): + def __init__( + self, repeated_capability_list, vi, library, encoding, freeze_it=False + ): self._repeated_capability_list = repeated_capability_list - self._repeated_capability = ','.join(repeated_capability_list) + self._repeated_capability = ",".join(repeated_capability_list) self._vi = vi self._library = library self._encoding = encoding # Store the parameter list for later printing in __repr__ param_list = [] - param_list.append("repeated_capability_list=" + pp.pformat(repeated_capability_list)) + param_list.append( + "repeated_capability_list=" + pp.pformat(repeated_capability_list) + ) param_list.append("vi=" + pp.pformat(vi)) param_list.append("library=" + pp.pformat(library)) param_list.append("encoding=" + pp.pformat(encoding)) - self._param_list = ', '.join(param_list) + self._param_list = ", ".join(param_list) # Instantiate any repeated capability objects - self.channels = _RepeatedCapabilities(self, '', repeated_capability_list) - self.pins = _RepeatedCapabilities(self, '', repeated_capability_list) - self.instruments = _RepeatedCapabilities(self, '', repeated_capability_list) - self.pattern_opcode_events = _RepeatedCapabilities(self, 'patternOpcodeEvent', repeated_capability_list) - self.conditional_jump_triggers = _RepeatedCapabilities(self, 'conditionalJumpTrigger', repeated_capability_list) - self.sites = _RepeatedCapabilities(self, 'site', repeated_capability_list) - self.rio_events = _RepeatedCapabilities(self, 'RIOEvent', repeated_capability_list) - self.rio_triggers = _RepeatedCapabilities(self, 'RIOTrigger', repeated_capability_list) + self.channels = _RepeatedCapabilities(self, "", repeated_capability_list) + self.pins = _RepeatedCapabilities(self, "", repeated_capability_list) + self.instruments = _RepeatedCapabilities(self, "", repeated_capability_list) + self.pattern_opcode_events = _RepeatedCapabilities( + self, "patternOpcodeEvent", repeated_capability_list + ) + self.conditional_jump_triggers = _RepeatedCapabilities( + self, "conditionalJumpTrigger", repeated_capability_list + ) + self.sites = _RepeatedCapabilities(self, "site", repeated_capability_list) + self.rio_events = _RepeatedCapabilities( + self, "RIOEvent", repeated_capability_list + ) + self.rio_triggers = _RepeatedCapabilities( + self, "RIOTrigger", repeated_capability_list + ) self._is_frozen = freeze_it def __repr__(self): - return '{0}.{1}({2})'.format('nidigital', self.__class__.__name__, self._param_list) + return "{0}.{1}({2})".format( + "nidigital", self.__class__.__name__, self._param_list + ) def __setattr__(self, key, value): if self._is_frozen and key not in dir(self): - raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) + raise AttributeError( + "'{0}' object has no attribute '{1}'".format(type(self).__name__, key) + ) object.__setattr__(self, key, value) def _get_error_description(self, error_code): - '''_get_error_description + """_get_error_description Returns the error description. - ''' + """ try: _, error_string = self._get_error() return error_string @@ -1310,21 +1392,28 @@ def _get_error_description(self, error_code): pass try: - ''' + """ It is expected for _get_error to raise when the session is invalid (IVI spec requires GetError to fail). Use _error_message instead. It doesn't require a session. - ''' + """ error_string = self._error_message(error_code) return error_string except errors.Error: return "Failed to retrieve error description." - ''' These are code-generated ''' + """ These are code-generated """ @ivi_synchronized - def apply_levels_and_timing(self, levels_sheet, timing_sheet, initial_state_high_pins=None, initial_state_low_pins=None, initial_state_tristate_pins=None): - r'''apply_levels_and_timing + def apply_levels_and_timing( + self, + levels_sheet, + timing_sheet, + initial_state_high_pins=None, + initial_state_low_pins=None, + initial_state_tristate_pins=None, + ): + r"""apply_levels_and_timing Applies digital levels and timing values defined in previously loaded levels and timing sheets. When applying a levels sheet, only the levels specified in the sheet are affected. Any levels not specified in the sheet remain unchanged. When applying a timing sheet, all existing time sets are deleted before the new time sets are loaded. @@ -1350,21 +1439,49 @@ def apply_levels_and_timing(self, levels_sheet, timing_sheet, initial_state_high initial_state_tristate_pins (basic sequence types or str): Comma-delimited list of pins, pin groups, or channels to initialize to a non-drive state (X) - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - levels_sheet_ctype = ctypes.create_string_buffer(levels_sheet.encode(self._encoding)) # case C020 - timing_sheet_ctype = ctypes.create_string_buffer(timing_sheet.encode(self._encoding)) # case C020 - initial_state_high_pins_ctype = ctypes.create_string_buffer(_converters.convert_repeated_capabilities_without_prefix(initial_state_high_pins).encode(self._encoding)) # case C040 - initial_state_low_pins_ctype = ctypes.create_string_buffer(_converters.convert_repeated_capabilities_without_prefix(initial_state_low_pins).encode(self._encoding)) # case C040 - initial_state_tristate_pins_ctype = ctypes.create_string_buffer(_converters.convert_repeated_capabilities_without_prefix(initial_state_tristate_pins).encode(self._encoding)) # case C040 - error_code = self._library.niDigital_ApplyLevelsAndTiming(vi_ctype, site_list_ctype, levels_sheet_ctype, timing_sheet_ctype, initial_state_high_pins_ctype, initial_state_low_pins_ctype, initial_state_tristate_pins_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + site_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + levels_sheet_ctype = ctypes.create_string_buffer( + levels_sheet.encode(self._encoding) + ) # case C020 + timing_sheet_ctype = ctypes.create_string_buffer( + timing_sheet.encode(self._encoding) + ) # case C020 + initial_state_high_pins_ctype = ctypes.create_string_buffer( + _converters.convert_repeated_capabilities_without_prefix( + initial_state_high_pins + ).encode(self._encoding) + ) # case C040 + initial_state_low_pins_ctype = ctypes.create_string_buffer( + _converters.convert_repeated_capabilities_without_prefix( + initial_state_low_pins + ).encode(self._encoding) + ) # case C040 + initial_state_tristate_pins_ctype = ctypes.create_string_buffer( + _converters.convert_repeated_capabilities_without_prefix( + initial_state_tristate_pins + ).encode(self._encoding) + ) # case C040 + error_code = self._library.niDigital_ApplyLevelsAndTiming( + vi_ctype, + site_list_ctype, + levels_sheet_ctype, + timing_sheet_ctype, + initial_state_high_pins_ctype, + initial_state_low_pins_ctype, + initial_state_tristate_pins_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def apply_tdr_offsets(self, offsets): - r'''apply_tdr_offsets + r"""apply_tdr_offsets Applies the correction for propagation delay offsets to a digital pattern instrument. Use this method to apply TDR offsets that are stored from a past measurement or are measured by means other than the tdr method. Also use this method to apply correction for offsets if the **applyOffsets** input of the tdr method was set to False at the time of measurement. @@ -1382,19 +1499,37 @@ def apply_tdr_offsets(self, offsets): Args: offsets (basic sequence of hightime.timedelta, datetime.timedelta, or float in seconds): TDR offsets to apply, in seconds. Specify an offset for each pin or channel in the repeated capabilities. If the repeated capabilities contain pin names, you must specify offsets for each site in the channel map per pin. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - num_offsets_ctype = _visatype.ViInt32(0 if offsets is None else len(offsets)) # case S160 - offsets_converted = _converters.convert_timedeltas_to_seconds_real64(offsets) # case B520 - offsets_ctype = get_ctypes_pointer_for_buffer(value=offsets_converted, library_type=_visatype.ViReal64) # case B520 - error_code = self._library.niDigital_ApplyTDROffsets(vi_ctype, channel_list_ctype, num_offsets_ctype, offsets_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + num_offsets_ctype = _visatype.ViInt32( + 0 if offsets is None else len(offsets) + ) # case S160 + offsets_converted = _converters.convert_timedeltas_to_seconds_real64( + offsets + ) # case B520 + offsets_ctype = get_ctypes_pointer_for_buffer( + value=offsets_converted, library_type=_visatype.ViReal64 + ) # case B520 + error_code = self._library.niDigital_ApplyTDROffsets( + vi_ctype, channel_list_ctype, num_offsets_ctype, offsets_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def _burst_pattern(self, start_label, select_digital_function=True, wait_until_done=True, timeout=hightime.timedelta(seconds=10.0)): - r'''_burst_pattern + def _burst_pattern( + self, + start_label, + select_digital_function=True, + wait_until_done=True, + timeout=hightime.timedelta(seconds=10.0), + ): + r"""_burst_pattern Uses the **startLabel** you specify to burst the pattern on the sites you specify and provides the option to wait for the burst to complete. Digital pins retain their state at the end of a pattern burst until the first vector of a subsequent pattern burst, a call to write_static, or a call to apply_levels_and_timing. @@ -1418,20 +1553,37 @@ def _burst_pattern(self, start_label, select_digital_function=True, wait_until_d timeout (hightime.timedelta, datetime.timedelta, or float in seconds): Maximum time (in seconds) allowed for this method to complete. If this method does not complete within this time interval, this method returns an error. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - start_label_ctype = ctypes.create_string_buffer(start_label.encode(self._encoding)) # case C020 - select_digital_function_ctype = _visatype.ViBoolean(select_digital_function) # case S150 + site_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + start_label_ctype = ctypes.create_string_buffer( + start_label.encode(self._encoding) + ) # case C020 + select_digital_function_ctype = _visatype.ViBoolean( + select_digital_function + ) # case S150 wait_until_done_ctype = _visatype.ViBoolean(wait_until_done) # case S150 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 - error_code = self._library.niDigital_BurstPattern(vi_ctype, site_list_ctype, start_label_ctype, select_digital_function_ctype, wait_until_done_ctype, timeout_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + timeout_ctype = _converters.convert_timedelta_to_seconds_real64( + timeout + ) # case S140 + error_code = self._library.niDigital_BurstPattern( + vi_ctype, + site_list_ctype, + start_label_ctype, + select_digital_function_ctype, + wait_until_done_ctype, + timeout_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def clock_generator_abort(self): - r'''clock_generator_abort + r"""clock_generator_abort Stops clock generation on the specified channel(s) or pin(s) and pin group(s). @@ -1445,16 +1597,22 @@ def clock_generator_abort(self): To call the method on all channels, you can call it directly on the :py:class:`nidigital.Session`. Example: :py:meth:`my_session.clock_generator_abort` - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - error_code = self._library.niDigital_ClockGenerator_Abort(vi_ctype, channel_list_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + error_code = self._library.niDigital_ClockGenerator_Abort( + vi_ctype, channel_list_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def clock_generator_generate_clock(self, frequency, select_digital_function=True): - r'''clock_generator_generate_clock + r"""clock_generator_generate_clock Configures clock generator frequency and initiates clock generation on the specified channel(s) or pin(s) and pin group(s). @@ -1474,18 +1632,26 @@ def clock_generator_generate_clock(self, frequency, select_digital_function=True select_digital_function (bool): A Boolean that specifies whether to select the digital method for the pins specified prior to starting clock generation. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 frequency_ctype = _visatype.ViReal64(frequency) # case S150 - select_digital_function_ctype = _visatype.ViBoolean(select_digital_function) # case S150 - error_code = self._library.niDigital_ClockGenerator_GenerateClock(vi_ctype, channel_list_ctype, frequency_ctype, select_digital_function_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + select_digital_function_ctype = _visatype.ViBoolean( + select_digital_function + ) # case S150 + error_code = self._library.niDigital_ClockGenerator_GenerateClock( + vi_ctype, channel_list_ctype, frequency_ctype, select_digital_function_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def configure_active_load_levels(self, iol, ioh, vcom): - r'''configure_active_load_levels + r"""configure_active_load_levels Configures I\ :sub:`OL`, I\ :sub:`OH`, and V\ :sub:`COM` levels for the active load on the pins you specify. The DUT sources or sinks current based on the level values. To enable active load, set the termination mode to TerminationMode.ACTIVE_LOAD. To disable active load, set the termination mode of the instrument to TerminationMode.HIGH_Z or TerminationMode.VTERM. @@ -1507,19 +1673,25 @@ def configure_active_load_levels(self, iol, ioh, vcom): vcom (float): Commutating voltage level at which the active load circuit switches between sourcing current and sinking current. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 iol_ctype = _visatype.ViReal64(iol) # case S150 ioh_ctype = _visatype.ViReal64(ioh) # case S150 vcom_ctype = _visatype.ViReal64(vcom) # case S150 - error_code = self._library.niDigital_ConfigureActiveLoadLevels(vi_ctype, channel_list_ctype, iol_ctype, ioh_ctype, vcom_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_ConfigureActiveLoadLevels( + vi_ctype, channel_list_ctype, iol_ctype, ioh_ctype, vcom_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def configure_pattern_burst_sites(self): - r'''configure_pattern_burst_sites + r"""configure_pattern_burst_sites Configures which sites burst the pattern on the next call to the initiate method. The pattern burst sites can also be modified through the repeated capabilities for the burst_pattern method. If a site has been disabled through the disable_sites method, the site does not burst a pattern even if included in the pattern burst sites. @@ -1533,16 +1705,22 @@ def configure_pattern_burst_sites(self): To call the method on all sites, you can call it directly on the :py:class:`nidigital.Session`. Example: :py:meth:`my_session.configure_pattern_burst_sites` - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - error_code = self._library.niDigital_ConfigurePatternBurstSites(vi_ctype, site_list_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + site_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + error_code = self._library.niDigital_ConfigurePatternBurstSites( + vi_ctype, site_list_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def configure_time_set_compare_edges_strobe(self, time_set_name, strobe_edge): - r'''configure_time_set_compare_edges_strobe + r"""configure_time_set_compare_edges_strobe Configures the strobe edge time for the specified pins. Use this method to modify time set values after applying a timing sheet with the apply_levels_and_timing method, or to create time sets programmatically without the use of timing sheets. This method does not modify the timing sheet file or the timing sheet contents that will be used in future calls to apply_levels_and_timing; it only affects the values of the current timing context. @@ -1562,18 +1740,30 @@ def configure_time_set_compare_edges_strobe(self, time_set_name, strobe_edge): strobe_edge (hightime.timedelta, datetime.timedelta, or float in seconds): Time when the comparison happens within a vector period. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 - strobe_edge_ctype = _converters.convert_timedelta_to_seconds_real64(strobe_edge) # case S140 - error_code = self._library.niDigital_ConfigureTimeSetCompareEdgesStrobe(vi_ctype, pin_list_ctype, time_set_name_ctype, strobe_edge_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + pin_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + time_set_name_ctype = ctypes.create_string_buffer( + time_set_name.encode(self._encoding) + ) # case C020 + strobe_edge_ctype = _converters.convert_timedelta_to_seconds_real64( + strobe_edge + ) # case S140 + error_code = self._library.niDigital_ConfigureTimeSetCompareEdgesStrobe( + vi_ctype, pin_list_ctype, time_set_name_ctype, strobe_edge_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def configure_time_set_compare_edges_strobe2x(self, time_set_name, strobe_edge, strobe2_edge): - r'''configure_time_set_compare_edges_strobe2x + def configure_time_set_compare_edges_strobe2x( + self, time_set_name, strobe_edge, strobe2_edge + ): + r"""configure_time_set_compare_edges_strobe2x Configures the compare strobes for the specified pins in the time set, including the 2x strobe. Use this method to modify time set values after applying a timing sheet with the apply_levels_and_timing method, or to create time sets programmatically without the use of timing sheets. This method does not modify the timing sheet file or the timing sheet contents that will be used in future calls to apply_levels_and_timing; it only affects the values of the current timing context. @@ -1595,19 +1785,43 @@ def configure_time_set_compare_edges_strobe2x(self, time_set_name, strobe_edge, strobe2_edge (hightime.timedelta, datetime.timedelta, or float in seconds): Time when the comparison happens for the second DUT cycle within a vector period. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 - strobe_edge_ctype = _converters.convert_timedelta_to_seconds_real64(strobe_edge) # case S140 - strobe2_edge_ctype = _converters.convert_timedelta_to_seconds_real64(strobe2_edge) # case S140 - error_code = self._library.niDigital_ConfigureTimeSetCompareEdgesStrobe2x(vi_ctype, pin_list_ctype, time_set_name_ctype, strobe_edge_ctype, strobe2_edge_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + pin_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + time_set_name_ctype = ctypes.create_string_buffer( + time_set_name.encode(self._encoding) + ) # case C020 + strobe_edge_ctype = _converters.convert_timedelta_to_seconds_real64( + strobe_edge + ) # case S140 + strobe2_edge_ctype = _converters.convert_timedelta_to_seconds_real64( + strobe2_edge + ) # case S140 + error_code = self._library.niDigital_ConfigureTimeSetCompareEdgesStrobe2x( + vi_ctype, + pin_list_ctype, + time_set_name_ctype, + strobe_edge_ctype, + strobe2_edge_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def configure_time_set_drive_edges(self, time_set_name, format, drive_on_edge, drive_data_edge, drive_return_edge, drive_off_edge): - r'''configure_time_set_drive_edges + def configure_time_set_drive_edges( + self, + time_set_name, + format, + drive_on_edge, + drive_data_edge, + drive_return_edge, + drive_off_edge, + ): + r"""configure_time_set_drive_edges Configures the drive format and drive edge placement for the specified pins. Use this method to modify time set values after applying a timing sheet with the apply_levels_and_timing method, or to create time sets programmatically without the use of timing sheets. This method does not modify the timing sheet file or the timing sheet contents that will be used in future calls to apply_levels_and_timing; it only affects the values of the current timing context. @@ -1640,24 +1854,59 @@ def configure_time_set_drive_edges(self, time_set_name, format, drive_on_edge, d drive_off_edge (hightime.timedelta, datetime.timedelta, or float in seconds): Delay, in seconds, from the beginning of the vector period to turn off the pin driver when the next vector period uses a non-drive symbol (L, H, X, V, M, E). - ''' + """ if type(format) is not enums.DriveFormat: - raise TypeError('Parameter format must be of type ' + str(enums.DriveFormat)) + raise TypeError( + "Parameter format must be of type " + str(enums.DriveFormat) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 + pin_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + time_set_name_ctype = ctypes.create_string_buffer( + time_set_name.encode(self._encoding) + ) # case C020 format_ctype = _visatype.ViInt32(format.value) # case S130 - drive_on_edge_ctype = _converters.convert_timedelta_to_seconds_real64(drive_on_edge) # case S140 - drive_data_edge_ctype = _converters.convert_timedelta_to_seconds_real64(drive_data_edge) # case S140 - drive_return_edge_ctype = _converters.convert_timedelta_to_seconds_real64(drive_return_edge) # case S140 - drive_off_edge_ctype = _converters.convert_timedelta_to_seconds_real64(drive_off_edge) # case S140 - error_code = self._library.niDigital_ConfigureTimeSetDriveEdges(vi_ctype, pin_list_ctype, time_set_name_ctype, format_ctype, drive_on_edge_ctype, drive_data_edge_ctype, drive_return_edge_ctype, drive_off_edge_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + drive_on_edge_ctype = _converters.convert_timedelta_to_seconds_real64( + drive_on_edge + ) # case S140 + drive_data_edge_ctype = _converters.convert_timedelta_to_seconds_real64( + drive_data_edge + ) # case S140 + drive_return_edge_ctype = _converters.convert_timedelta_to_seconds_real64( + drive_return_edge + ) # case S140 + drive_off_edge_ctype = _converters.convert_timedelta_to_seconds_real64( + drive_off_edge + ) # case S140 + error_code = self._library.niDigital_ConfigureTimeSetDriveEdges( + vi_ctype, + pin_list_ctype, + time_set_name_ctype, + format_ctype, + drive_on_edge_ctype, + drive_data_edge_ctype, + drive_return_edge_ctype, + drive_off_edge_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def configure_time_set_drive_edges2x(self, time_set_name, format, drive_on_edge, drive_data_edge, drive_return_edge, drive_off_edge, drive_data2_edge, drive_return2_edge): - r'''configure_time_set_drive_edges2x + def configure_time_set_drive_edges2x( + self, + time_set_name, + format, + drive_on_edge, + drive_data_edge, + drive_return_edge, + drive_off_edge, + drive_data2_edge, + drive_return2_edge, + ): + r"""configure_time_set_drive_edges2x Configures the drive edges of the pins in the time set, including 2x edges. Use this method to modify time set values after applying a timing sheet with the apply_levels_and_timing method, or to create time sets programmatically without the use of timing sheets. This method does not modify the timing sheet file or the timing sheet contents that will be used in future calls to apply_levels_and_timing; it only affects the values of the current timing context. @@ -1694,26 +1943,57 @@ def configure_time_set_drive_edges2x(self, time_set_name, format, drive_on_edge, drive_return2_edge (hightime.timedelta, datetime.timedelta, or float in seconds): Delay, in seconds, from the beginning of the vector period until the pin changes from the pattern data in the second DUT cycle to the return value, as specified in the format. - ''' + """ if type(format) is not enums.DriveFormat: - raise TypeError('Parameter format must be of type ' + str(enums.DriveFormat)) + raise TypeError( + "Parameter format must be of type " + str(enums.DriveFormat) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 + pin_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + time_set_name_ctype = ctypes.create_string_buffer( + time_set_name.encode(self._encoding) + ) # case C020 format_ctype = _visatype.ViInt32(format.value) # case S130 - drive_on_edge_ctype = _converters.convert_timedelta_to_seconds_real64(drive_on_edge) # case S140 - drive_data_edge_ctype = _converters.convert_timedelta_to_seconds_real64(drive_data_edge) # case S140 - drive_return_edge_ctype = _converters.convert_timedelta_to_seconds_real64(drive_return_edge) # case S140 - drive_off_edge_ctype = _converters.convert_timedelta_to_seconds_real64(drive_off_edge) # case S140 - drive_data2_edge_ctype = _converters.convert_timedelta_to_seconds_real64(drive_data2_edge) # case S140 - drive_return2_edge_ctype = _converters.convert_timedelta_to_seconds_real64(drive_return2_edge) # case S140 - error_code = self._library.niDigital_ConfigureTimeSetDriveEdges2x(vi_ctype, pin_list_ctype, time_set_name_ctype, format_ctype, drive_on_edge_ctype, drive_data_edge_ctype, drive_return_edge_ctype, drive_off_edge_ctype, drive_data2_edge_ctype, drive_return2_edge_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + drive_on_edge_ctype = _converters.convert_timedelta_to_seconds_real64( + drive_on_edge + ) # case S140 + drive_data_edge_ctype = _converters.convert_timedelta_to_seconds_real64( + drive_data_edge + ) # case S140 + drive_return_edge_ctype = _converters.convert_timedelta_to_seconds_real64( + drive_return_edge + ) # case S140 + drive_off_edge_ctype = _converters.convert_timedelta_to_seconds_real64( + drive_off_edge + ) # case S140 + drive_data2_edge_ctype = _converters.convert_timedelta_to_seconds_real64( + drive_data2_edge + ) # case S140 + drive_return2_edge_ctype = _converters.convert_timedelta_to_seconds_real64( + drive_return2_edge + ) # case S140 + error_code = self._library.niDigital_ConfigureTimeSetDriveEdges2x( + vi_ctype, + pin_list_ctype, + time_set_name_ctype, + format_ctype, + drive_on_edge_ctype, + drive_data_edge_ctype, + drive_return_edge_ctype, + drive_off_edge_ctype, + drive_data2_edge_ctype, + drive_return2_edge_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def configure_time_set_drive_format(self, time_set_name, drive_format): - r'''configure_time_set_drive_format + r"""configure_time_set_drive_format Configures the drive format for the pins specified in the **pinList**. Use this method to modify time set values after applying a timing sheet with the apply_levels_and_timing method, or to create time sets programmatically without the use of timing sheets. This method does not modify the timing sheet file or the timing sheet contents that will be used in future calls to apply_levels_and_timing; it only affects the values of the current timing context. @@ -1738,20 +2018,30 @@ def configure_time_set_drive_format(self, time_set_name, drive_format): - DriveFormat.RH: Return to high. - DriveFormat.SBC: Surround by complement. - ''' + """ if type(drive_format) is not enums.DriveFormat: - raise TypeError('Parameter drive_format must be of type ' + str(enums.DriveFormat)) + raise TypeError( + "Parameter drive_format must be of type " + str(enums.DriveFormat) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 + pin_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + time_set_name_ctype = ctypes.create_string_buffer( + time_set_name.encode(self._encoding) + ) # case C020 drive_format_ctype = _visatype.ViInt32(drive_format.value) # case S130 - error_code = self._library.niDigital_ConfigureTimeSetDriveFormat(vi_ctype, pin_list_ctype, time_set_name_ctype, drive_format_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_ConfigureTimeSetDriveFormat( + vi_ctype, pin_list_ctype, time_set_name_ctype, drive_format_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def configure_time_set_edge(self, time_set_name, edge, time): - r'''configure_time_set_edge + r"""configure_time_set_edge Configures the edge placement for the pins specified in the pin list. Use this method to modify time set values after applying a timing sheet with the apply_levels_and_timing method, or to create time sets programmatically without the use of timing sheets. This method does not modify the timing sheet file or the timing sheet contents that will be used in future calls to apply_levels_and_timing; it only affects the values of the current timing context. @@ -1782,21 +2072,31 @@ def configure_time_set_edge(self, time_set_name, edge, time): time (hightime.timedelta, datetime.timedelta, or float in seconds): The time from the beginning of the vector period in which to place the edge. - ''' + """ if type(edge) is not enums.TimeSetEdgeType: - raise TypeError('Parameter edge must be of type ' + str(enums.TimeSetEdgeType)) + raise TypeError( + "Parameter edge must be of type " + str(enums.TimeSetEdgeType) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 + pin_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + time_set_name_ctype = ctypes.create_string_buffer( + time_set_name.encode(self._encoding) + ) # case C020 edge_ctype = _visatype.ViInt32(edge.value) # case S130 time_ctype = _converters.convert_timedelta_to_seconds_real64(time) # case S140 - error_code = self._library.niDigital_ConfigureTimeSetEdge(vi_ctype, pin_list_ctype, time_set_name_ctype, edge_ctype, time_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_ConfigureTimeSetEdge( + vi_ctype, pin_list_ctype, time_set_name_ctype, edge_ctype, time_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def configure_time_set_edge_multiplier(self, time_set_name, edge_multiplier): - r'''configure_time_set_edge_multiplier + r"""configure_time_set_edge_multiplier Configures the edge multiplier of the pins in the time set. Use this method to modify time set values after applying a timing sheet with the apply_levels_and_timing method, or to create time sets programmatically without the use of timing sheets. This method does not modify the timing sheet file or the timing sheet contents that will be used in future calls to apply_levels_and_timing; it only affects the values of the current timing context. @@ -1816,18 +2116,26 @@ def configure_time_set_edge_multiplier(self, time_set_name, edge_multiplier): edge_multiplier (int): The specified edge multiplier for the pins in the pin list. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 + pin_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + time_set_name_ctype = ctypes.create_string_buffer( + time_set_name.encode(self._encoding) + ) # case C020 edge_multiplier_ctype = _visatype.ViInt32(edge_multiplier) # case S150 - error_code = self._library.niDigital_ConfigureTimeSetEdgeMultiplier(vi_ctype, pin_list_ctype, time_set_name_ctype, edge_multiplier_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_ConfigureTimeSetEdgeMultiplier( + vi_ctype, pin_list_ctype, time_set_name_ctype, edge_multiplier_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def configure_voltage_levels(self, vil, vih, vol, voh, vterm): - r'''configure_voltage_levels + r"""configure_voltage_levels Configures voltage levels for the pins you specify. @@ -1853,21 +2161,33 @@ def configure_voltage_levels(self, vil, vih, vol, voh, vterm): vterm (float): Termination voltage the instrument applies during non-drive cycles when the termination mode is set to V\ :sub:`term`. The instrument applies the termination voltage through a 50 ohm parallel termination resistance. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 vil_ctype = _visatype.ViReal64(vil) # case S150 vih_ctype = _visatype.ViReal64(vih) # case S150 vol_ctype = _visatype.ViReal64(vol) # case S150 voh_ctype = _visatype.ViReal64(voh) # case S150 vterm_ctype = _visatype.ViReal64(vterm) # case S150 - error_code = self._library.niDigital_ConfigureVoltageLevels(vi_ctype, channel_list_ctype, vil_ctype, vih_ctype, vol_ctype, voh_ctype, vterm_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_ConfigureVoltageLevels( + vi_ctype, + channel_list_ctype, + vil_ctype, + vih_ctype, + vol_ctype, + voh_ctype, + vterm_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def create_capture_waveform_parallel(self, waveform_name): - r'''create_capture_waveform_parallel + r"""create_capture_waveform_parallel Sets the capture waveform settings for parallel acquisition. Settings apply across all sites if multiple sites are configured in the pin map. You cannot reconfigure settings after waveforms are created. @@ -1885,17 +2205,25 @@ def create_capture_waveform_parallel(self, waveform_name): Args: waveform_name (str): Waveform name you want to use. Use the waveform_name with the capture_start opcode in your pattern. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 - error_code = self._library.niDigital_CreateCaptureWaveformParallel(vi_ctype, pin_list_ctype, waveform_name_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + pin_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + waveform_name_ctype = ctypes.create_string_buffer( + waveform_name.encode(self._encoding) + ) # case C020 + error_code = self._library.niDigital_CreateCaptureWaveformParallel( + vi_ctype, pin_list_ctype, waveform_name_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def create_capture_waveform_serial(self, waveform_name, sample_width, bit_order): - r'''create_capture_waveform_serial + r"""create_capture_waveform_serial Sets the capture waveform settings for serial acquisition. Settings apply across all sites if multiple sites are configured in the pin map. You cannot reconfigure settings after waveforms are created. @@ -1920,21 +2248,35 @@ def create_capture_waveform_serial(self, waveform_name, sample_width, bit_order) - BitOrder.MSB: Specifies the bit order by most significant bit first. - BitOrder.LSB: Specifies the bit order by least significant bit first. - ''' + """ if type(bit_order) is not enums.BitOrder: - raise TypeError('Parameter bit_order must be of type ' + str(enums.BitOrder)) + raise TypeError( + "Parameter bit_order must be of type " + str(enums.BitOrder) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 + pin_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + waveform_name_ctype = ctypes.create_string_buffer( + waveform_name.encode(self._encoding) + ) # case C020 sample_width_ctype = _visatype.ViUInt32(sample_width) # case S150 bit_order_ctype = _visatype.ViInt32(bit_order.value) # case S130 - error_code = self._library.niDigital_CreateCaptureWaveformSerial(vi_ctype, pin_list_ctype, waveform_name_ctype, sample_width_ctype, bit_order_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_CreateCaptureWaveformSerial( + vi_ctype, + pin_list_ctype, + waveform_name_ctype, + sample_width_ctype, + bit_order_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def create_source_waveform_parallel(self, waveform_name, data_mapping): - r'''create_source_waveform_parallel + r"""create_source_waveform_parallel Sets the source waveform settings required for parallel sourcing. Settings apply across all sites if multiple sites are configured in the pin map. You cannot reconfigure settings after waveforms are created. @@ -1957,20 +2299,32 @@ def create_source_waveform_parallel(self, waveform_name, data_mapping): - SourceDataMapping.BROADCAST: Broadcasts the waveform you specify to all sites. - SourceDataMapping.SITE_UNIQUE: Sources unique waveform data to each site. - ''' + """ if type(data_mapping) is not enums.SourceDataMapping: - raise TypeError('Parameter data_mapping must be of type ' + str(enums.SourceDataMapping)) + raise TypeError( + "Parameter data_mapping must be of type " + str(enums.SourceDataMapping) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 + pin_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + waveform_name_ctype = ctypes.create_string_buffer( + waveform_name.encode(self._encoding) + ) # case C020 data_mapping_ctype = _visatype.ViInt32(data_mapping.value) # case S130 - error_code = self._library.niDigital_CreateSourceWaveformParallel(vi_ctype, pin_list_ctype, waveform_name_ctype, data_mapping_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_CreateSourceWaveformParallel( + vi_ctype, pin_list_ctype, waveform_name_ctype, data_mapping_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def create_source_waveform_serial(self, waveform_name, data_mapping, sample_width, bit_order): - r'''create_source_waveform_serial + def create_source_waveform_serial( + self, waveform_name, data_mapping, sample_width, bit_order + ): + r"""create_source_waveform_serial Sets the source waveform settings required for serial sourcing. Settings apply across all sites if multiple sites are configured in the pin map. You cannot reconfigure settings after waveforms are created. @@ -2000,24 +2354,41 @@ def create_source_waveform_serial(self, waveform_name, data_mapping, sample_widt - BitOrder.MSB: Specifies the bit order by most significant bit first. - BitOrder.LSB: Specifies the bit order by least significant bit first. - ''' + """ if type(data_mapping) is not enums.SourceDataMapping: - raise TypeError('Parameter data_mapping must be of type ' + str(enums.SourceDataMapping)) + raise TypeError( + "Parameter data_mapping must be of type " + str(enums.SourceDataMapping) + ) if type(bit_order) is not enums.BitOrder: - raise TypeError('Parameter bit_order must be of type ' + str(enums.BitOrder)) + raise TypeError( + "Parameter bit_order must be of type " + str(enums.BitOrder) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 + pin_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + waveform_name_ctype = ctypes.create_string_buffer( + waveform_name.encode(self._encoding) + ) # case C020 data_mapping_ctype = _visatype.ViInt32(data_mapping.value) # case S130 sample_width_ctype = _visatype.ViUInt32(sample_width) # case S150 bit_order_ctype = _visatype.ViInt32(bit_order.value) # case S130 - error_code = self._library.niDigital_CreateSourceWaveformSerial(vi_ctype, pin_list_ctype, waveform_name_ctype, data_mapping_ctype, sample_width_ctype, bit_order_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_CreateSourceWaveformSerial( + vi_ctype, + pin_list_ctype, + waveform_name_ctype, + data_mapping_ctype, + sample_width_ctype, + bit_order_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def disable_sites(self): - r'''disable_sites + r"""disable_sites Disables specified sites. Disabled sites are not included in pattern bursts initiated by the initiate method or the burst_pattern method, even if the site is specified in the list of pattern burst sites in configure_pattern_burst_sites method or in the repeated capabilities for the burst_pattern method. Additionally, if you specify a list of pin or pin group names in repeated capabilities in any NI-Digital method, digital pattern instrument channels mapped to disabled sites are not affected by the method. The methods that return per-pin data, such as the ppmu_measure method, do not return data for channels mapped to disabled sites. The digital pattern instrument channels mapped to the sites specified are left in their current state. NI TestStand Semiconductor Module requires all sites to always be enabled, and manages the set of active sites without disabling the sites in the digital instrument session. Do not use this method with the Semiconductor Module. @@ -2031,16 +2402,20 @@ def disable_sites(self): To call the method on all sites, you can call it directly on the :py:class:`nidigital.Session`. Example: :py:meth:`my_session.disable_sites` - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + site_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 error_code = self._library.niDigital_DisableSites(vi_ctype, site_list_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def enable_sites(self): - r'''enable_sites + r"""enable_sites Enables the sites you specify. All sites are enabled by default. @@ -2054,16 +2429,26 @@ def enable_sites(self): To call the method on all sites, you can call it directly on the :py:class:`nidigital.Session`. Example: :py:meth:`my_session.enable_sites` - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + site_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 error_code = self._library.niDigital_EnableSites(vi_ctype, site_list_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def burst_pattern(self, start_label, select_digital_function=True, wait_until_done=True, timeout=hightime.timedelta(seconds=10.0)): - '''burst_pattern + def burst_pattern( + self, + start_label, + select_digital_function=True, + wait_until_done=True, + timeout=hightime.timedelta(seconds=10.0), + ): + """burst_pattern Uses the start_label you specify to burst the pattern on the sites you specify. If you specify wait_until_done as True, waits for the burst to complete, and returns comparison results for each site. @@ -2096,8 +2481,10 @@ def burst_pattern(self, start_label, select_digital_function=True, wait_until_do pass_fail ({ int: bool, int: bool, ... }): Dictionary where each key is a site number and value is pass/fail, if wait_until_done is specified as True. Else, None. - ''' - self._burst_pattern(start_label, select_digital_function, wait_until_done, timeout) + """ + self._burst_pattern( + start_label, select_digital_function, wait_until_done, timeout + ) if wait_until_done: return self.get_site_pass_fail() @@ -2105,8 +2492,10 @@ def burst_pattern(self, start_label, select_digital_function=True, wait_until_do return None @ivi_synchronized - def fetch_capture_waveform(self, waveform_name, samples_to_read, timeout=hightime.timedelta(seconds=10.0)): - '''fetch_capture_waveform + def fetch_capture_waveform( + self, waveform_name, samples_to_read, timeout=hightime.timedelta(seconds=10.0) + ): + """fetch_capture_waveform Returns dictionary where each key is a site number and value is a collection of digital states representing capture waveform data @@ -2132,11 +2521,17 @@ def fetch_capture_waveform(self, waveform_name, samples_to_read, timeout=hightim Returns: waveform ({ int: memoryview of array.array of unsigned int, int: memoryview of array.array of unsigned int, ... }): Dictionary where each key is a site number and value is a collection of digital states representing capture waveform data - ''' - data, actual_num_waveforms, actual_samples_per_waveform = self._fetch_capture_waveform(waveform_name, samples_to_read, timeout) + """ + ( + data, + actual_num_waveforms, + actual_samples_per_waveform, + ) = self._fetch_capture_waveform(waveform_name, samples_to_read, timeout) # Get the site list - site_list = self._get_site_results_site_numbers(enums._SiteResultType.CAPTURE_WAVEFORM) + site_list = self._get_site_results_site_numbers( + enums._SiteResultType.CAPTURE_WAVEFORM + ) assert len(site_list) == actual_num_waveforms waveforms = {} @@ -2157,27 +2552,75 @@ def _fetch_capture_waveform(self, waveform_name, samples_to_read, timeout): # the (modified) line below # Also, we want to return the two sized that normally wouldn't be returned vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 + site_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + waveform_name_ctype = ctypes.create_string_buffer( + waveform_name.encode(self._encoding) + ) # case C020 samples_to_read_ctype = _visatype.ViInt32(samples_to_read) # case S150 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64( + timeout + ) # case S140 data_buffer_size_ctype = _visatype.ViInt32(0) # case S190 data_ctype = None # case B610 actual_num_waveforms_ctype = _visatype.ViInt32() # case S220 actual_samples_per_waveform_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_FetchCaptureWaveformU32(vi_ctype, site_list_ctype, waveform_name_ctype, samples_to_read_ctype, timeout_ctype, data_buffer_size_ctype, data_ctype, None if actual_num_waveforms_ctype is None else (ctypes.pointer(actual_num_waveforms_ctype)), None if actual_samples_per_waveform_ctype is None else (ctypes.pointer(actual_samples_per_waveform_ctype))) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) - data_buffer_size_ctype = _visatype.ViInt32(actual_num_waveforms_ctype.value * actual_samples_per_waveform_ctype.value) # case S200 (modified) - data_size = actual_num_waveforms_ctype.value * actual_samples_per_waveform_ctype.value # case B620 (modified) + error_code = self._library.niDigital_FetchCaptureWaveformU32( + vi_ctype, + site_list_ctype, + waveform_name_ctype, + samples_to_read_ctype, + timeout_ctype, + data_buffer_size_ctype, + data_ctype, + None + if actual_num_waveforms_ctype is None + else (ctypes.pointer(actual_num_waveforms_ctype)), + None + if actual_samples_per_waveform_ctype is None + else (ctypes.pointer(actual_samples_per_waveform_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) + data_buffer_size_ctype = _visatype.ViInt32( + actual_num_waveforms_ctype.value * actual_samples_per_waveform_ctype.value + ) # case S200 (modified) + data_size = ( + actual_num_waveforms_ctype.value * actual_samples_per_waveform_ctype.value + ) # case B620 (modified) data_array = array.array("L", [0] * data_size) # case B620 - data_ctype = get_ctypes_pointer_for_buffer(value=data_array, library_type=_visatype.ViUInt32) # case B620 - error_code = self._library.niDigital_FetchCaptureWaveformU32(vi_ctype, site_list_ctype, waveform_name_ctype, samples_to_read_ctype, timeout_ctype, data_buffer_size_ctype, data_ctype, None if actual_num_waveforms_ctype is None else (ctypes.pointer(actual_num_waveforms_ctype)), None if actual_samples_per_waveform_ctype is None else (ctypes.pointer(actual_samples_per_waveform_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return data_array, actual_num_waveforms_ctype.value, actual_samples_per_waveform_ctype.value # (modified) + data_ctype = get_ctypes_pointer_for_buffer( + value=data_array, library_type=_visatype.ViUInt32 + ) # case B620 + error_code = self._library.niDigital_FetchCaptureWaveformU32( + vi_ctype, + site_list_ctype, + waveform_name_ctype, + samples_to_read_ctype, + timeout_ctype, + data_buffer_size_ctype, + data_ctype, + None + if actual_num_waveforms_ctype is None + else (ctypes.pointer(actual_num_waveforms_ctype)), + None + if actual_samples_per_waveform_ctype is None + else (ctypes.pointer(actual_samples_per_waveform_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return ( + data_array, + actual_num_waveforms_ctype.value, + actual_samples_per_waveform_ctype.value, + ) # (modified) @ivi_synchronized def fetch_history_ram_cycle_information(self, position, samples_to_read): - '''fetch_history_ram_cycle_information + """fetch_history_ram_cycle_information Returns the pattern information acquired for the specified cycles. @@ -2266,41 +2709,56 @@ def fetch_history_ram_cycle_information(self, position, samples_to_read): Length of the outer list will be equal to the value of edge multiplier for the given vector. Length of the inner list will be equal to the number of pins requested. - ''' + """ # Extract the site number and pin list from repeated capability - repeated_capability_lists = _converters.convert_chained_repeated_capability_to_parts(self._repeated_capability) + repeated_capability_lists = ( + _converters.convert_chained_repeated_capability_to_parts( + self._repeated_capability + ) + ) site = repeated_capability_lists[0] - if not site.startswith('site'): - raise ValueError('Site number on which to retrieve pattern information must be specified via sites repeated capability.') - pins = '' if len(repeated_capability_lists) == 1 else repeated_capability_lists[1] + if not site.startswith("site"): + raise ValueError( + "Site number on which to retrieve pattern information must be specified via sites repeated capability." + ) + pins = ( + "" if len(repeated_capability_lists) == 1 else repeated_capability_lists[1] + ) # Put site back into repeated capability container; it will be used by other # sites-rep-cap-based methods that will be called later. self._repeated_capability = site if position < 0: - raise ValueError('position should be greater than or equal to 0.') + raise ValueError("position should be greater than or equal to 0.") if samples_to_read < -1: - raise ValueError('samples_to_read should be greater than or equal to -1.') + raise ValueError("samples_to_read should be greater than or equal to -1.") # site is passed as repeated capability samples_available = self.get_history_ram_sample_count() if position > samples_available: - raise ValueError('position: Specified value = {0}, Maximum value = {1}.'.format(position, samples_available - 1)) + raise ValueError( + "position: Specified value = {0}, Maximum value = {1}.".format( + position, samples_available - 1 + ) + ) if samples_to_read == -1: with _NoChannel(session=self): if not self.history_ram_number_of_samples_is_finite: raise RuntimeError( - 'Specifying -1 to fetch all History RAM samples is not supported when the digital pattern instrument is ' - 'configured for continuous History RAM acquisition. You must specify an exact number of samples to fetch.') + "Specifying -1 to fetch all History RAM samples is not supported when the digital pattern instrument is " + "configured for continuous History RAM acquisition. You must specify an exact number of samples to fetch." + ) samples_to_read = samples_available - position if position + samples_to_read > samples_available: raise ValueError( - 'position: Specified value = {0}, samples_to_read: Specified value = {1}; Samples available = {2}.' - .format(position, samples_to_read, samples_available - position)) + "position: Specified value = {0}, samples_to_read: Specified value = {1}; Samples available = {2}.".format( + position, samples_to_read, samples_available - position + ) + ) pattern_names = {} time_set_names = {} @@ -2308,7 +2766,13 @@ def fetch_history_ram_cycle_information(self, position, samples_to_read): for _ in range(samples_to_read): # site is passed as repeated capability - pattern_index, time_set_index, vector_number, cycle_number, num_dut_cycles = self._fetch_history_ram_cycle_information(position) + ( + pattern_index, + time_set_index, + vector_number, + cycle_number, + num_dut_cycles, + ) = self._fetch_history_ram_cycle_information(position) if pattern_index not in pattern_names: # Repeated capability is not used @@ -2328,27 +2792,36 @@ def fetch_history_ram_cycle_information(self, position, samples_to_read): vector_per_pin_pass_fail = [] for dut_cycle_index in range(num_dut_cycles): # site is passed as repeated capability - cycle_expected_pin_states, cycle_actual_pin_states, cycle_per_pin_pass_fail = self._fetch_history_ram_cycle_pin_data(pins, position, dut_cycle_index) + ( + cycle_expected_pin_states, + cycle_actual_pin_states, + cycle_per_pin_pass_fail, + ) = self._fetch_history_ram_cycle_pin_data( + pins, position, dut_cycle_index + ) vector_expected_pin_states.append(cycle_expected_pin_states) vector_actual_pin_states.append(cycle_actual_pin_states) vector_per_pin_pass_fail.append(cycle_per_pin_pass_fail) - cycle_infos.append(history_ram_cycle_information.HistoryRAMCycleInformation( - pattern_name=pattern_name, - time_set_name=time_set_name, - vector_number=vector_number, - cycle_number=cycle_number, - scan_cycle_number=scan_cycle_number, - expected_pin_states=vector_expected_pin_states, - actual_pin_states=vector_actual_pin_states, - per_pin_pass_fail=vector_per_pin_pass_fail)) + cycle_infos.append( + history_ram_cycle_information.HistoryRAMCycleInformation( + pattern_name=pattern_name, + time_set_name=time_set_name, + vector_number=vector_number, + cycle_number=cycle_number, + scan_cycle_number=scan_cycle_number, + expected_pin_states=vector_expected_pin_states, + actual_pin_states=vector_actual_pin_states, + per_pin_pass_fail=vector_per_pin_pass_fail, + ) + ) position += 1 return cycle_infos @ivi_synchronized def get_pin_results_pin_information(self): - '''get_pin_results_pin_information + """get_pin_results_pin_information Returns the pin names, site numbers, and channel names that correspond to per-pin data read from the digital pattern instrument. The method returns pin information in the same order as values read using the read_static method, ppmu_measure method, and get_fail_count method. Use this method to match values the previously listed methods return with pins, sites, and instrument channels. @@ -2370,26 +2843,47 @@ def get_pin_results_pin_information(self): - **site_number** (int) - **channel_name** (str) - ''' + """ import collections - PinInfo = collections.namedtuple('PinInformation', ['pin_name', 'site_number', 'channel_name']) - pin_indexes, site_numbers, channel_indexes = self._get_pin_results_pin_information() - assert len(pin_indexes) == len(site_numbers), "length of returned arrays don't match" - assert len(pin_indexes) == len(channel_indexes), "length of returned arrays don't match" + PinInfo = collections.namedtuple( + "PinInformation", ["pin_name", "site_number", "channel_name"] + ) + + ( + pin_indexes, + site_numbers, + channel_indexes, + ) = self._get_pin_results_pin_information() + assert len(pin_indexes) == len( + site_numbers + ), "length of returned arrays don't match" + assert len(pin_indexes) == len( + channel_indexes + ), "length of returned arrays don't match" pin_infos = [] for i in range(len(pin_indexes)): - pin_name = "" if pin_indexes[i] == -1 else self._get_pin_name(pin_indexes[i]) - channel_names = self.get_channel_names(channel_indexes[i] - 1) # channel_indexes are 1-based + pin_name = ( + "" if pin_indexes[i] == -1 else self._get_pin_name(pin_indexes[i]) + ) + channel_names = self.get_channel_names( + channel_indexes[i] - 1 + ) # channel_indexes are 1-based assert 1 == len(channel_names) - pin_infos.append(PinInfo(pin_name=pin_name, site_number=site_numbers[i], channel_name=channel_names[0])) + pin_infos.append( + PinInfo( + pin_name=pin_name, + site_number=site_numbers[i], + channel_name=channel_names[0], + ) + ) return pin_infos @ivi_synchronized def get_site_pass_fail(self): - '''get_site_pass_fail + """get_site_pass_fail Returns dictionary where each key is a site number and value is pass/fail @@ -2407,7 +2901,7 @@ def get_site_pass_fail(self): Returns: pass_fail ({ int: bool, int: bool, ... }): Dictionary where each key is a site number and value is pass/fail - ''' + """ # For site_list, we just use the repeated capability result_list = self._get_site_pass_fail() site_list = self._get_site_results_site_numbers(enums._SiteResultType.PASS_FAIL) @@ -2417,7 +2911,7 @@ def get_site_pass_fail(self): @ivi_synchronized def _fetch_history_ram_cycle_information(self, sample_index): - r'''_fetch_history_ram_cycle_information + r"""_fetch_history_ram_cycle_information Gets the per-cycle pattern information acquired for the specified cycle. @@ -2447,22 +2941,53 @@ def _fetch_history_ram_cycle_information(self, sample_index): num_dut_cycles (int): The returned number of DUT cycles contained in the cycle acquired by this History RAM sample. This is only needed if the pattern uses the edge multiplier feature. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + site_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 sample_index_ctype = _visatype.ViInt64(sample_index) # case S150 pattern_index_ctype = _visatype.ViInt32() # case S220 time_set_index_ctype = _visatype.ViInt32() # case S220 vector_number_ctype = _visatype.ViInt64() # case S220 cycle_number_ctype = _visatype.ViInt64() # case S220 num_dut_cycles_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_FetchHistoryRAMCycleInformation(vi_ctype, site_ctype, sample_index_ctype, None if pattern_index_ctype is None else (ctypes.pointer(pattern_index_ctype)), None if time_set_index_ctype is None else (ctypes.pointer(time_set_index_ctype)), None if vector_number_ctype is None else (ctypes.pointer(vector_number_ctype)), None if cycle_number_ctype is None else (ctypes.pointer(cycle_number_ctype)), None if num_dut_cycles_ctype is None else (ctypes.pointer(num_dut_cycles_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return int(pattern_index_ctype.value), int(time_set_index_ctype.value), int(vector_number_ctype.value), int(cycle_number_ctype.value), int(num_dut_cycles_ctype.value) + error_code = self._library.niDigital_FetchHistoryRAMCycleInformation( + vi_ctype, + site_ctype, + sample_index_ctype, + None + if pattern_index_ctype is None + else (ctypes.pointer(pattern_index_ctype)), + None + if time_set_index_ctype is None + else (ctypes.pointer(time_set_index_ctype)), + None + if vector_number_ctype is None + else (ctypes.pointer(vector_number_ctype)), + None + if cycle_number_ctype is None + else (ctypes.pointer(cycle_number_ctype)), + None + if num_dut_cycles_ctype is None + else (ctypes.pointer(num_dut_cycles_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return ( + int(pattern_index_ctype.value), + int(time_set_index_ctype.value), + int(vector_number_ctype.value), + int(cycle_number_ctype.value), + int(num_dut_cycles_ctype.value), + ) @ivi_synchronized - def _fetch_history_ram_cycle_pin_data(self, pin_list, sample_index, dut_cycle_index): - r'''_fetch_history_ram_cycle_pin_data + def _fetch_history_ram_cycle_pin_data( + self, pin_list, sample_index, dut_cycle_index + ): + r"""_fetch_history_ram_cycle_pin_data Gets the per-pin pattern data acquired for the specified cycle. @@ -2495,10 +3020,14 @@ def _fetch_history_ram_cycle_pin_data(self, pin_list, sample_index, dut_cycle_in per_pin_pass_fail (list of bool): The returned pass fail information for pins in the order specified in **pinList**. Pins without defined edges in the specified DUT cycle will return pass (True). - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - pin_list_ctype = ctypes.create_string_buffer(pin_list.encode(self._encoding)) # case C020 + site_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + pin_list_ctype = ctypes.create_string_buffer( + pin_list.encode(self._encoding) + ) # case C020 sample_index_ctype = _visatype.ViInt64(sample_index) # case S150 dut_cycle_index_ctype = _visatype.ViInt32(dut_cycle_index) # case S150 pin_data_buffer_size_ctype = _visatype.ViInt32(0) # case S190 @@ -2506,22 +3035,73 @@ def _fetch_history_ram_cycle_pin_data(self, pin_list, sample_index, dut_cycle_in actual_pin_states_ctype = None # case B610 per_pin_pass_fail_ctype = None # case B610 actual_num_pin_data_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_FetchHistoryRAMCyclePinData(vi_ctype, site_ctype, pin_list_ctype, sample_index_ctype, dut_cycle_index_ctype, pin_data_buffer_size_ctype, expected_pin_states_ctype, actual_pin_states_ctype, per_pin_pass_fail_ctype, None if actual_num_pin_data_ctype is None else (ctypes.pointer(actual_num_pin_data_ctype))) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) - pin_data_buffer_size_ctype = _visatype.ViInt32(actual_num_pin_data_ctype.value) # case S200 + error_code = self._library.niDigital_FetchHistoryRAMCyclePinData( + vi_ctype, + site_ctype, + pin_list_ctype, + sample_index_ctype, + dut_cycle_index_ctype, + pin_data_buffer_size_ctype, + expected_pin_states_ctype, + actual_pin_states_ctype, + per_pin_pass_fail_ctype, + None + if actual_num_pin_data_ctype is None + else (ctypes.pointer(actual_num_pin_data_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) + pin_data_buffer_size_ctype = _visatype.ViInt32( + actual_num_pin_data_ctype.value + ) # case S200 expected_pin_states_size = actual_num_pin_data_ctype.value # case B620 - expected_pin_states_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViUInt8, size=expected_pin_states_size) # case B620 + expected_pin_states_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViUInt8, size=expected_pin_states_size + ) # case B620 actual_pin_states_size = actual_num_pin_data_ctype.value # case B620 - actual_pin_states_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViUInt8, size=actual_pin_states_size) # case B620 + actual_pin_states_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViUInt8, size=actual_pin_states_size + ) # case B620 per_pin_pass_fail_size = actual_num_pin_data_ctype.value # case B620 - per_pin_pass_fail_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViBoolean, size=per_pin_pass_fail_size) # case B620 - error_code = self._library.niDigital_FetchHistoryRAMCyclePinData(vi_ctype, site_ctype, pin_list_ctype, sample_index_ctype, dut_cycle_index_ctype, pin_data_buffer_size_ctype, expected_pin_states_ctype, actual_pin_states_ctype, per_pin_pass_fail_ctype, None if actual_num_pin_data_ctype is None else (ctypes.pointer(actual_num_pin_data_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return [enums.PinState(expected_pin_states_ctype[i]) for i in range(pin_data_buffer_size_ctype.value)], [enums.PinState(actual_pin_states_ctype[i]) for i in range(pin_data_buffer_size_ctype.value)], [bool(per_pin_pass_fail_ctype[i]) for i in range(pin_data_buffer_size_ctype.value)] + per_pin_pass_fail_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViBoolean, size=per_pin_pass_fail_size + ) # case B620 + error_code = self._library.niDigital_FetchHistoryRAMCyclePinData( + vi_ctype, + site_ctype, + pin_list_ctype, + sample_index_ctype, + dut_cycle_index_ctype, + pin_data_buffer_size_ctype, + expected_pin_states_ctype, + actual_pin_states_ctype, + per_pin_pass_fail_ctype, + None + if actual_num_pin_data_ctype is None + else (ctypes.pointer(actual_num_pin_data_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return ( + [ + enums.PinState(expected_pin_states_ctype[i]) + for i in range(pin_data_buffer_size_ctype.value) + ], + [ + enums.PinState(actual_pin_states_ctype[i]) + for i in range(pin_data_buffer_size_ctype.value) + ], + [ + bool(per_pin_pass_fail_ctype[i]) + for i in range(pin_data_buffer_size_ctype.value) + ], + ) @ivi_synchronized def _fetch_history_ram_scan_cycle_number(self, sample_index): - r'''_fetch_history_ram_scan_cycle_number + r"""_fetch_history_ram_scan_cycle_number Fetches the History RAM Scan Cycle Number for the sample index. If the sample is not from a scan vector, the scan cycle number will be returned as -1. @@ -2543,18 +3123,29 @@ def _fetch_history_ram_scan_cycle_number(self, sample_index): Returns: scan_cycle_number (int): Returns the scan cycle number acquired by this History RAM sample. Scan cycle numbers start at 0 from the first cycle of the scan vector. Scan cycle numbers are -1 for cycles that do not have a scan opcode. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + site_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 sample_index_ctype = _visatype.ViInt64(sample_index) # case S150 scan_cycle_number_ctype = _visatype.ViInt64() # case S220 - error_code = self._library.niDigital_FetchHistoryRAMScanCycleNumber(vi_ctype, site_ctype, sample_index_ctype, None if scan_cycle_number_ctype is None else (ctypes.pointer(scan_cycle_number_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_FetchHistoryRAMScanCycleNumber( + vi_ctype, + site_ctype, + sample_index_ctype, + None + if scan_cycle_number_ctype is None + else (ctypes.pointer(scan_cycle_number_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(scan_cycle_number_ctype.value) @ivi_synchronized def frequency_counter_measure_frequency(self): - r'''frequency_counter_measure_frequency + r"""frequency_counter_measure_frequency Measures the frequency on the specified channel(s) over the specified measurement time. All channels in the repeated capabilities should have the same measurement time. @@ -2572,24 +3163,53 @@ def frequency_counter_measure_frequency(self): Returns: frequencies (list of float): The returned frequency counter measurement, in Hz.This method returns -1 if the measurement is invalid for the channel. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 frequencies_buffer_size_ctype = _visatype.ViInt32(0) # case S190 frequencies_ctype = None # case B610 actual_num_frequencies_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_FrequencyCounter_MeasureFrequency(vi_ctype, channel_list_ctype, frequencies_buffer_size_ctype, frequencies_ctype, None if actual_num_frequencies_ctype is None else (ctypes.pointer(actual_num_frequencies_ctype))) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) - frequencies_buffer_size_ctype = _visatype.ViInt32(actual_num_frequencies_ctype.value) # case S200 + error_code = self._library.niDigital_FrequencyCounter_MeasureFrequency( + vi_ctype, + channel_list_ctype, + frequencies_buffer_size_ctype, + frequencies_ctype, + None + if actual_num_frequencies_ctype is None + else (ctypes.pointer(actual_num_frequencies_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) + frequencies_buffer_size_ctype = _visatype.ViInt32( + actual_num_frequencies_ctype.value + ) # case S200 frequencies_size = actual_num_frequencies_ctype.value # case B620 - frequencies_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=frequencies_size) # case B620 - error_code = self._library.niDigital_FrequencyCounter_MeasureFrequency(vi_ctype, channel_list_ctype, frequencies_buffer_size_ctype, frequencies_ctype, None if actual_num_frequencies_ctype is None else (ctypes.pointer(actual_num_frequencies_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return [float(frequencies_ctype[i]) for i in range(frequencies_buffer_size_ctype.value)] + frequencies_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViReal64, size=frequencies_size + ) # case B620 + error_code = self._library.niDigital_FrequencyCounter_MeasureFrequency( + vi_ctype, + channel_list_ctype, + frequencies_buffer_size_ctype, + frequencies_ctype, + None + if actual_num_frequencies_ctype is None + else (ctypes.pointer(actual_num_frequencies_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return [ + float(frequencies_ctype[i]) + for i in range(frequencies_buffer_size_ctype.value) + ] @ivi_synchronized def _get_attribute_vi_boolean(self, attribute): - r'''_get_attribute_vi_boolean + r"""_get_attribute_vi_boolean Queries the value of a ViBoolean property. Use this method to get the values of digital pattern instrument-specific properties and inherent IVI properties. @@ -2611,18 +3231,27 @@ def _get_attribute_vi_boolean(self, attribute): Returns: value (bool): The returned current value of the property; pass the address of a ViBoolean variable. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 value_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niDigital_GetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_GetAttributeViBoolean( + vi_ctype, + channel_name_ctype, + attribute_ctype, + None if value_ctype is None else (ctypes.pointer(value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return bool(value_ctype.value) @ivi_synchronized def _get_attribute_vi_int32(self, attribute): - r'''_get_attribute_vi_int32 + r"""_get_attribute_vi_int32 Queries the value of a ViInt32 property. Use this method to get the values of digital pattern instrument-specific properties and inherent IVI properties. @@ -2644,18 +3273,27 @@ def _get_attribute_vi_int32(self, attribute): Returns: value (int): The returned current value of the property; pass the address of a ViInt32 variable. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 value_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_GetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_GetAttributeViInt32( + vi_ctype, + channel_name_ctype, + attribute_ctype, + None if value_ctype is None else (ctypes.pointer(value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(value_ctype.value) @ivi_synchronized def _get_attribute_vi_int64(self, attribute): - r'''_get_attribute_vi_int64 + r"""_get_attribute_vi_int64 Queries the value of a ViInt64 property. Use this method to get the values of digital pattern instrument-specific properties and inherent IVI properties. @@ -2677,18 +3315,27 @@ def _get_attribute_vi_int64(self, attribute): Returns: value (int): The returned current value of the property; pass the address of a ViInt64 variable. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 value_ctype = _visatype.ViInt64() # case S220 - error_code = self._library.niDigital_GetAttributeViInt64(vi_ctype, channel_name_ctype, attribute_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_GetAttributeViInt64( + vi_ctype, + channel_name_ctype, + attribute_ctype, + None if value_ctype is None else (ctypes.pointer(value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(value_ctype.value) @ivi_synchronized def _get_attribute_vi_real64(self, attribute): - r'''_get_attribute_vi_real64 + r"""_get_attribute_vi_real64 This method queries the value of a ViReal64 property. Use this method to get the values of digital pattern instrument-specific properties and inherent IVI properties. @@ -2710,18 +3357,27 @@ def _get_attribute_vi_real64(self, attribute): Returns: value (float): The returned current value of the property; pass the address of a ViReal64 variable. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 value_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDigital_GetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_GetAttributeViReal64( + vi_ctype, + channel_name_ctype, + attribute_ctype, + None if value_ctype is None else (ctypes.pointer(value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(value_ctype.value) @ivi_synchronized def _get_attribute_vi_string(self, attribute): - r'''_get_attribute_vi_string + r"""_get_attribute_vi_string Queries the value of a ViString property. Use this method to get the values of digital pattern instrument-specific properties and inherent IVI properties. You must provide a ViChar array to serve as a buffer for the value. You pass the number of bytes in the buffer as the **bufferSize**. If the current value of the property, including the terminating NULL byte, is larger than the size you indicate in the **bufferSize**, the method copies (bufferSize - 1) bytes into the buffer, places an ASCII NULL byte at the end of the buffer, and returns the **bufferSize** you must pass to get the entire value. For example, if the value is "123456" and the **bufferSize** is 4, the method places "123" into the buffer and returns 7. If you want to call this method just to get the required buffer size, you can pass 0 for the **bufferSize** and VI_NULL for the value. @@ -2743,23 +3399,41 @@ def _get_attribute_vi_string(self, attribute): Returns: value (str): The buffer in which the method returns the current value of the property; the buffer must be of type ViChar and have at least as many bytes as indicated in the **bufferSize**. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 buffer_size_ctype = _visatype.ViInt32() # case S170 value_ctype = None # case C050 - error_code = self._library.niDigital_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_ctype, buffer_size_ctype, value_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niDigital_GetAttributeViString( + vi_ctype, + channel_name_ctype, + attribute_ctype, + buffer_size_ctype, + value_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 value_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niDigital_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_ctype, buffer_size_ctype, value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_GetAttributeViString( + vi_ctype, + channel_name_ctype, + attribute_ctype, + buffer_size_ctype, + value_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return value_ctype.value.decode(self._encoding) @ivi_synchronized def get_channel_names(self, indices): - r'''get_channel_names + r"""get_channel_names Returns a list of channel names for given channel indices. @@ -2776,21 +3450,35 @@ def get_channel_names(self, indices): Returns: names (list of str): The channel name(s) at the specified indices. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - indices_ctype = ctypes.create_string_buffer(_converters.convert_repeated_capabilities_without_prefix(indices).encode(self._encoding)) # case C040 + indices_ctype = ctypes.create_string_buffer( + _converters.convert_repeated_capabilities_without_prefix(indices).encode( + self._encoding + ) + ) # case C040 name_buffer_size_ctype = _visatype.ViInt32() # case S170 names_ctype = None # case C050 - error_code = self._library.niDigital_GetChannelNameFromString(vi_ctype, indices_ctype, name_buffer_size_ctype, names_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niDigital_GetChannelNameFromString( + vi_ctype, indices_ctype, name_buffer_size_ctype, names_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) name_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 names_ctype = (_visatype.ViChar * name_buffer_size_ctype.value)() # case C060 - error_code = self._library.niDigital_GetChannelNameFromString(vi_ctype, indices_ctype, name_buffer_size_ctype, names_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return _converters.convert_comma_separated_string_to_list(names_ctype.value.decode(self._encoding)) + error_code = self._library.niDigital_GetChannelNameFromString( + vi_ctype, indices_ctype, name_buffer_size_ctype, names_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return _converters.convert_comma_separated_string_to_list( + names_ctype.value.decode(self._encoding) + ) def _get_error(self): - r'''_get_error + r"""_get_error Returns the error information associated with the digital pattern instrument handle. This method retrieves and then clears the error information for the session. If **vi** is VI_NULL, this method retrieves and then clears the error information for the current thread. You must provide a ViChar array to serve as a buffer for the value. You pass the number of bytes in the buffer as the buffer size. If the current value of the error description, including the terminating NULL byte, is larger than the size you indicate in the buffer size, the method copies (buffer size -1) bytes into the buffer, places an ASCII NULL byte at the end of the buffer, and returns the buffer size you must pass to get the entire value. For example, if the value is "123456" and the buffer size is 4, the method places "123" into the buffer and returns 7. If you want to call this method just to get the required buffer size, you can pass 0 for the buffer size and VI_NULL for **errorDescription**. @@ -2801,22 +3489,40 @@ def _get_error(self): If there is no description, the method returns an empty string. The buffer must contain at least as many elements as the value you specify with the buffer size parameter. If you pass 0 for **errorDescriptionBufferSize**, you can pass VI_NULL for this parameter. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus() # case S220 error_description_buffer_size_ctype = _visatype.ViInt32() # case S170 error_description_ctype = None # case C050 - error_code = self._library.niDigital_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), error_description_buffer_size_ctype, error_description_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True) + error_code = self._library.niDigital_GetError( + vi_ctype, + None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), + error_description_buffer_size_ctype, + error_description_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=True + ) error_description_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - error_description_ctype = (_visatype.ViChar * error_description_buffer_size_ctype.value)() # case C060 - error_code = self._library.niDigital_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), error_description_buffer_size_ctype, error_description_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) - return int(error_code_ctype.value), error_description_ctype.value.decode(self._encoding) + error_description_ctype = ( + _visatype.ViChar * error_description_buffer_size_ctype.value + )() # case C060 + error_code = self._library.niDigital_GetError( + vi_ctype, + None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), + error_description_buffer_size_ctype, + error_description_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) + return int(error_code_ctype.value), error_description_ctype.value.decode( + self._encoding + ) @ivi_synchronized def get_fail_count(self): - r'''get_fail_count + r"""get_fail_count Returns the comparison fail count for pins in the repeated capabilities. @@ -2834,24 +3540,48 @@ def get_fail_count(self): Returns: failure_count (list of int): Number of failures in an array. If a site is disabled or not enabled for burst, the method does not return data for that site. You can also use the get_pin_results_pin_information method to obtain a sorted list of returned sites and channels. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 buffer_size_ctype = _visatype.ViInt32(0) # case S190 failure_count_ctype = None # case B610 actual_num_read_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_GetFailCount(vi_ctype, channel_list_ctype, buffer_size_ctype, failure_count_ctype, None if actual_num_read_ctype is None else (ctypes.pointer(actual_num_read_ctype))) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niDigital_GetFailCount( + vi_ctype, + channel_list_ctype, + buffer_size_ctype, + failure_count_ctype, + None + if actual_num_read_ctype is None + else (ctypes.pointer(actual_num_read_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) buffer_size_ctype = _visatype.ViInt32(actual_num_read_ctype.value) # case S200 failure_count_size = actual_num_read_ctype.value # case B620 - failure_count_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViInt64, size=failure_count_size) # case B620 - error_code = self._library.niDigital_GetFailCount(vi_ctype, channel_list_ctype, buffer_size_ctype, failure_count_ctype, None if actual_num_read_ctype is None else (ctypes.pointer(actual_num_read_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + failure_count_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViInt64, size=failure_count_size + ) # case B620 + error_code = self._library.niDigital_GetFailCount( + vi_ctype, + channel_list_ctype, + buffer_size_ctype, + failure_count_ctype, + None + if actual_num_read_ctype is None + else (ctypes.pointer(actual_num_read_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return [int(failure_count_ctype[i]) for i in range(buffer_size_ctype.value)] @ivi_synchronized def get_history_ram_sample_count(self): - r'''get_history_ram_sample_count + r"""get_history_ram_sample_count Returns the number of samples History RAM acquired on the last pattern burst. @@ -2894,17 +3624,27 @@ def get_history_ram_sample_count(self): Returns: sample_count (int): The returned number of samples that History RAM acquired. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + site_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 sample_count_ctype = _visatype.ViInt64() # case S220 - error_code = self._library.niDigital_GetHistoryRAMSampleCount(vi_ctype, site_ctype, None if sample_count_ctype is None else (ctypes.pointer(sample_count_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_GetHistoryRAMSampleCount( + vi_ctype, + site_ctype, + None + if sample_count_ctype is None + else (ctypes.pointer(sample_count_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(sample_count_ctype.value) @ivi_synchronized def _get_pattern_name(self, pattern_index): - r'''_get_pattern_name + r"""_get_pattern_name TBD @@ -2915,22 +3655,30 @@ def _get_pattern_name(self, pattern_index): Returns: name (str): - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 pattern_index_ctype = _visatype.ViInt32(pattern_index) # case S150 name_buffer_size_ctype = _visatype.ViInt32() # case S170 name_ctype = None # case C050 - error_code = self._library.niDigital_GetPatternName(vi_ctype, pattern_index_ctype, name_buffer_size_ctype, name_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niDigital_GetPatternName( + vi_ctype, pattern_index_ctype, name_buffer_size_ctype, name_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) name_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 name_ctype = (_visatype.ViChar * name_buffer_size_ctype.value)() # case C060 - error_code = self._library.niDigital_GetPatternName(vi_ctype, pattern_index_ctype, name_buffer_size_ctype, name_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_GetPatternName( + vi_ctype, pattern_index_ctype, name_buffer_size_ctype, name_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return name_ctype.value.decode(self._encoding) @ivi_synchronized def _get_pin_name(self, pin_index): - r'''_get_pin_name + r"""_get_pin_name Returns the name of the pin at the index you specify. You must provide a ViChar array to serve as a buffer for the value. You pass the number of bytes in the buffer as the **nameBufferSize**. If the current value of the property, including the terminating NULL byte, is larger than the size you indicate in the buffer size, the method copies (buffer size - 1) bytes into the buffer, places an ASCII NULL byte at the end of the buffer, and returns the buffer size you must pass to get the entire value. For example, if the value is "123456" and the buffer size is 4, the method places "123" into the buffer and returns 7. If you want to call this method just to get the required buffer size, you can pass 0 for **nameBufferSize** and VI_NULL for the name. @@ -2941,22 +3689,30 @@ def _get_pin_name(self, pin_index): Returns: name (str): Returns the pin name at the specified **pinIndex**. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 pin_index_ctype = _visatype.ViInt32(pin_index) # case S150 name_buffer_size_ctype = _visatype.ViInt32() # case S170 name_ctype = None # case C050 - error_code = self._library.niDigital_GetPinName(vi_ctype, pin_index_ctype, name_buffer_size_ctype, name_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niDigital_GetPinName( + vi_ctype, pin_index_ctype, name_buffer_size_ctype, name_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) name_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 name_ctype = (_visatype.ViChar * name_buffer_size_ctype.value)() # case C060 - error_code = self._library.niDigital_GetPinName(vi_ctype, pin_index_ctype, name_buffer_size_ctype, name_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_GetPinName( + vi_ctype, pin_index_ctype, name_buffer_size_ctype, name_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return name_ctype.value.decode(self._encoding) @ivi_synchronized def _get_pin_results_pin_information(self): - r'''_get_pin_results_pin_information + r"""_get_pin_results_pin_information Returns the pin names, site numbers, and channel names that correspond to per-pin data read from the digital pattern instrument. The method returns pin information in the same order as values read using the read_static method, ppmu_measure method, and get_fail_count method. Use this method to match values the previously listed methods return with pins, sites, and instrument channels. @@ -2980,30 +3736,68 @@ def _get_pin_results_pin_information(self): channel_indexes (list of int): The returned index of channels corresponding to data read from the digital pattern instrument using the specified repeated capabilities. If you do not want to use this parameter, pass VI_NULL. Call get_channel_name to get the name of the channel associated with an index. Channel indexes are one-based. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 buffer_size_ctype = _visatype.ViInt32(0) # case S190 pin_indexes_ctype = None # case B610 site_numbers_ctype = None # case B610 channel_indexes_ctype = None # case B610 actual_num_values_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_GetPinResultsPinInformation(vi_ctype, channel_list_ctype, buffer_size_ctype, pin_indexes_ctype, site_numbers_ctype, channel_indexes_ctype, None if actual_num_values_ctype is None else (ctypes.pointer(actual_num_values_ctype))) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) - buffer_size_ctype = _visatype.ViInt32(actual_num_values_ctype.value) # case S200 + error_code = self._library.niDigital_GetPinResultsPinInformation( + vi_ctype, + channel_list_ctype, + buffer_size_ctype, + pin_indexes_ctype, + site_numbers_ctype, + channel_indexes_ctype, + None + if actual_num_values_ctype is None + else (ctypes.pointer(actual_num_values_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) + buffer_size_ctype = _visatype.ViInt32( + actual_num_values_ctype.value + ) # case S200 pin_indexes_size = actual_num_values_ctype.value # case B620 - pin_indexes_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViInt32, size=pin_indexes_size) # case B620 + pin_indexes_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViInt32, size=pin_indexes_size + ) # case B620 site_numbers_size = actual_num_values_ctype.value # case B620 - site_numbers_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViInt32, size=site_numbers_size) # case B620 + site_numbers_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViInt32, size=site_numbers_size + ) # case B620 channel_indexes_size = actual_num_values_ctype.value # case B620 - channel_indexes_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViInt32, size=channel_indexes_size) # case B620 - error_code = self._library.niDigital_GetPinResultsPinInformation(vi_ctype, channel_list_ctype, buffer_size_ctype, pin_indexes_ctype, site_numbers_ctype, channel_indexes_ctype, None if actual_num_values_ctype is None else (ctypes.pointer(actual_num_values_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return [int(pin_indexes_ctype[i]) for i in range(buffer_size_ctype.value)], [int(site_numbers_ctype[i]) for i in range(buffer_size_ctype.value)], [int(channel_indexes_ctype[i]) for i in range(buffer_size_ctype.value)] + channel_indexes_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViInt32, size=channel_indexes_size + ) # case B620 + error_code = self._library.niDigital_GetPinResultsPinInformation( + vi_ctype, + channel_list_ctype, + buffer_size_ctype, + pin_indexes_ctype, + site_numbers_ctype, + channel_indexes_ctype, + None + if actual_num_values_ctype is None + else (ctypes.pointer(actual_num_values_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return ( + [int(pin_indexes_ctype[i]) for i in range(buffer_size_ctype.value)], + [int(site_numbers_ctype[i]) for i in range(buffer_size_ctype.value)], + [int(channel_indexes_ctype[i]) for i in range(buffer_size_ctype.value)], + ) @ivi_synchronized def _get_site_pass_fail(self): - r'''_get_site_pass_fail + r"""_get_site_pass_fail Returns the pass or fail results for each site. @@ -3024,24 +3818,52 @@ def _get_site_pass_fail(self): Note: One or more of the referenced methods are not in the Python API for this driver. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + site_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 pass_fail_buffer_size_ctype = _visatype.ViInt32(0) # case S190 pass_fail_ctype = None # case B610 actual_num_sites_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_GetSitePassFail(vi_ctype, site_list_ctype, pass_fail_buffer_size_ctype, pass_fail_ctype, None if actual_num_sites_ctype is None else (ctypes.pointer(actual_num_sites_ctype))) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) - pass_fail_buffer_size_ctype = _visatype.ViInt32(actual_num_sites_ctype.value) # case S200 + error_code = self._library.niDigital_GetSitePassFail( + vi_ctype, + site_list_ctype, + pass_fail_buffer_size_ctype, + pass_fail_ctype, + None + if actual_num_sites_ctype is None + else (ctypes.pointer(actual_num_sites_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) + pass_fail_buffer_size_ctype = _visatype.ViInt32( + actual_num_sites_ctype.value + ) # case S200 pass_fail_size = actual_num_sites_ctype.value # case B620 - pass_fail_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViBoolean, size=pass_fail_size) # case B620 - error_code = self._library.niDigital_GetSitePassFail(vi_ctype, site_list_ctype, pass_fail_buffer_size_ctype, pass_fail_ctype, None if actual_num_sites_ctype is None else (ctypes.pointer(actual_num_sites_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return [bool(pass_fail_ctype[i]) for i in range(pass_fail_buffer_size_ctype.value)] + pass_fail_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViBoolean, size=pass_fail_size + ) # case B620 + error_code = self._library.niDigital_GetSitePassFail( + vi_ctype, + site_list_ctype, + pass_fail_buffer_size_ctype, + pass_fail_ctype, + None + if actual_num_sites_ctype is None + else (ctypes.pointer(actual_num_sites_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return [ + bool(pass_fail_ctype[i]) for i in range(pass_fail_buffer_size_ctype.value) + ] @ivi_synchronized def _get_site_results_site_numbers(self, site_result_type): - r'''_get_site_results_site_numbers + r"""_get_site_results_site_numbers Returns the site numbers that correspond to per-site data read from the digital pattern instrument. The method returns site numbers in the same order as values read using the _get_site_pass_fail and fetch_capture_waveform_u32 methods. Use this method to match values the previously listed methods return with site numbers. @@ -3066,27 +3888,61 @@ def _get_site_results_site_numbers(self, site_result_type): Returns: site_numbers (list of int): The returned array of site numbers that correspond to the values specified by **siteResultType**. - ''' + """ if type(site_result_type) is not enums._SiteResultType: - raise TypeError('Parameter site_result_type must be of type ' + str(enums._SiteResultType)) + raise TypeError( + "Parameter site_result_type must be of type " + + str(enums._SiteResultType) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + site_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 site_result_type_ctype = _visatype.ViInt32(site_result_type.value) # case S130 site_numbers_buffer_size_ctype = _visatype.ViInt32(0) # case S190 site_numbers_ctype = None # case B610 actual_num_site_numbers_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_GetSiteResultsSiteNumbers(vi_ctype, site_list_ctype, site_result_type_ctype, site_numbers_buffer_size_ctype, site_numbers_ctype, None if actual_num_site_numbers_ctype is None else (ctypes.pointer(actual_num_site_numbers_ctype))) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) - site_numbers_buffer_size_ctype = _visatype.ViInt32(actual_num_site_numbers_ctype.value) # case S200 + error_code = self._library.niDigital_GetSiteResultsSiteNumbers( + vi_ctype, + site_list_ctype, + site_result_type_ctype, + site_numbers_buffer_size_ctype, + site_numbers_ctype, + None + if actual_num_site_numbers_ctype is None + else (ctypes.pointer(actual_num_site_numbers_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) + site_numbers_buffer_size_ctype = _visatype.ViInt32( + actual_num_site_numbers_ctype.value + ) # case S200 site_numbers_size = actual_num_site_numbers_ctype.value # case B620 - site_numbers_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViInt32, size=site_numbers_size) # case B620 - error_code = self._library.niDigital_GetSiteResultsSiteNumbers(vi_ctype, site_list_ctype, site_result_type_ctype, site_numbers_buffer_size_ctype, site_numbers_ctype, None if actual_num_site_numbers_ctype is None else (ctypes.pointer(actual_num_site_numbers_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return [int(site_numbers_ctype[i]) for i in range(site_numbers_buffer_size_ctype.value)] + site_numbers_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViInt32, size=site_numbers_size + ) # case B620 + error_code = self._library.niDigital_GetSiteResultsSiteNumbers( + vi_ctype, + site_list_ctype, + site_result_type_ctype, + site_numbers_buffer_size_ctype, + site_numbers_ctype, + None + if actual_num_site_numbers_ctype is None + else (ctypes.pointer(actual_num_site_numbers_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return [ + int(site_numbers_ctype[i]) + for i in range(site_numbers_buffer_size_ctype.value) + ] @ivi_synchronized def get_time_set_drive_format(self, time_set_name): - r'''get_time_set_drive_format + r"""get_time_set_drive_format Returns the drive format of a pin in the specified time set. @@ -3108,18 +3964,29 @@ def get_time_set_drive_format(self, time_set_name): Returns: format (enums.DriveFormat): Returned drive format of the time set for the specified pin. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 + pin_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + time_set_name_ctype = ctypes.create_string_buffer( + time_set_name.encode(self._encoding) + ) # case C020 format_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_GetTimeSetDriveFormat(vi_ctype, pin_ctype, time_set_name_ctype, None if format_ctype is None else (ctypes.pointer(format_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_GetTimeSetDriveFormat( + vi_ctype, + pin_ctype, + time_set_name_ctype, + None if format_ctype is None else (ctypes.pointer(format_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return enums.DriveFormat(format_ctype.value) @ivi_synchronized def get_time_set_edge(self, time_set_name, edge): - r'''get_time_set_edge + r"""get_time_set_edge Returns the edge time of a pin in the specified time set. @@ -3152,21 +4019,35 @@ def get_time_set_edge(self, time_set_name, edge): Returns: time (hightime.timedelta): Time from the beginning of the vector period in which to place the edge. - ''' + """ if type(edge) is not enums.TimeSetEdgeType: - raise TypeError('Parameter edge must be of type ' + str(enums.TimeSetEdgeType)) + raise TypeError( + "Parameter edge must be of type " + str(enums.TimeSetEdgeType) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 + pin_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + time_set_name_ctype = ctypes.create_string_buffer( + time_set_name.encode(self._encoding) + ) # case C020 edge_ctype = _visatype.ViInt32(edge.value) # case S130 time_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDigital_GetTimeSetEdge(vi_ctype, pin_ctype, time_set_name_ctype, edge_ctype, None if time_ctype is None else (ctypes.pointer(time_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_GetTimeSetEdge( + vi_ctype, + pin_ctype, + time_set_name_ctype, + edge_ctype, + None if time_ctype is None else (ctypes.pointer(time_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return _converters.convert_seconds_real64_to_timedelta(float(time_ctype.value)) @ivi_synchronized def get_time_set_edge_multiplier(self, time_set_name): - r'''get_time_set_edge_multiplier + r"""get_time_set_edge_multiplier Returns the edge multiplier of the specified time set. @@ -3188,18 +4069,31 @@ def get_time_set_edge_multiplier(self, time_set_name): Returns: edge_multiplier (int): Returned edge multiplier of the time set for the specified pin. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 + pin_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + time_set_name_ctype = ctypes.create_string_buffer( + time_set_name.encode(self._encoding) + ) # case C020 edge_multiplier_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_GetTimeSetEdgeMultiplier(vi_ctype, pin_ctype, time_set_name_ctype, None if edge_multiplier_ctype is None else (ctypes.pointer(edge_multiplier_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_GetTimeSetEdgeMultiplier( + vi_ctype, + pin_ctype, + time_set_name_ctype, + None + if edge_multiplier_ctype is None + else (ctypes.pointer(edge_multiplier_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(edge_multiplier_ctype.value) @ivi_synchronized def _get_time_set_name(self, time_set_index): - r'''_get_time_set_name + r"""_get_time_set_name TBD @@ -3210,22 +4104,30 @@ def _get_time_set_name(self, time_set_index): Returns: name (str): - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 time_set_index_ctype = _visatype.ViInt32(time_set_index) # case S150 name_buffer_size_ctype = _visatype.ViInt32() # case S170 name_ctype = None # case C050 - error_code = self._library.niDigital_GetTimeSetName(vi_ctype, time_set_index_ctype, name_buffer_size_ctype, name_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niDigital_GetTimeSetName( + vi_ctype, time_set_index_ctype, name_buffer_size_ctype, name_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) name_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 name_ctype = (_visatype.ViChar * name_buffer_size_ctype.value)() # case C060 - error_code = self._library.niDigital_GetTimeSetName(vi_ctype, time_set_index_ctype, name_buffer_size_ctype, name_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_GetTimeSetName( + vi_ctype, time_set_index_ctype, name_buffer_size_ctype, name_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return name_ctype.value.decode(self._encoding) @ivi_synchronized def is_site_enabled(self): - r'''is_site_enabled + r"""is_site_enabled Checks if a specified site is enabled. @@ -3245,16 +4147,24 @@ def is_site_enabled(self): Returns: enable (bool): Boolean value that returns whether the site is enabled or disabled. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + site_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 enable_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niDigital_IsSiteEnabled(vi_ctype, site_ctype, None if enable_ctype is None else (ctypes.pointer(enable_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_IsSiteEnabled( + vi_ctype, + site_ctype, + None if enable_ctype is None else (ctypes.pointer(enable_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return bool(enable_ctype.value) def lock(self): - '''lock + """lock Obtains a multithread lock on the device session. Before doing so, the software waits until all other execution threads release their locks @@ -3282,25 +4192,27 @@ def lock(self): Returns: lock (context manager): When used in a with statement, nidigital.Session.lock acts as a context manager and unlock will be called when the with block is exited - ''' + """ self._lock_session() # We do not call _lock_session() in the context manager so that this function can # act standalone as well and let the client call unlock() explicitly. If they do use the context manager, # that will handle the unlock for them return _Lock(self) def _lock_session(self): - '''_lock_session + """_lock_session Actual call to driver - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDigital_LockSession(vi_ctype, None) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return @ivi_synchronized def ppmu_measure(self, measurement_type): - r'''ppmu_measure + r"""ppmu_measure Instructs the PPMU to measure voltage or current. This method can be called to take a voltage measurement even if the pin method is not set to PPMU. @@ -3325,27 +4237,56 @@ def ppmu_measure(self, measurement_type): Returns: measurements (list of float): The returned array of measurements in the order you specify in the repeated capabilities. If a site is disabled, the method does not return data for that site. You can also use the get_pin_results_pin_information method to obtain a sorted list of returned sites and channels. - ''' + """ if type(measurement_type) is not enums.PPMUMeasurementType: - raise TypeError('Parameter measurement_type must be of type ' + str(enums.PPMUMeasurementType)) + raise TypeError( + "Parameter measurement_type must be of type " + + str(enums.PPMUMeasurementType) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 measurement_type_ctype = _visatype.ViInt32(measurement_type.value) # case S130 buffer_size_ctype = _visatype.ViInt32(0) # case S190 measurements_ctype = None # case B610 actual_num_read_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_PPMU_Measure(vi_ctype, channel_list_ctype, measurement_type_ctype, buffer_size_ctype, measurements_ctype, None if actual_num_read_ctype is None else (ctypes.pointer(actual_num_read_ctype))) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niDigital_PPMU_Measure( + vi_ctype, + channel_list_ctype, + measurement_type_ctype, + buffer_size_ctype, + measurements_ctype, + None + if actual_num_read_ctype is None + else (ctypes.pointer(actual_num_read_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) buffer_size_ctype = _visatype.ViInt32(actual_num_read_ctype.value) # case S200 measurements_size = actual_num_read_ctype.value # case B620 - measurements_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=measurements_size) # case B620 - error_code = self._library.niDigital_PPMU_Measure(vi_ctype, channel_list_ctype, measurement_type_ctype, buffer_size_ctype, measurements_ctype, None if actual_num_read_ctype is None else (ctypes.pointer(actual_num_read_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + measurements_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViReal64, size=measurements_size + ) # case B620 + error_code = self._library.niDigital_PPMU_Measure( + vi_ctype, + channel_list_ctype, + measurement_type_ctype, + buffer_size_ctype, + measurements_ctype, + None + if actual_num_read_ctype is None + else (ctypes.pointer(actual_num_read_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return [float(measurements_ctype[i]) for i in range(buffer_size_ctype.value)] @ivi_synchronized def ppmu_source(self): - r'''ppmu_source + r"""ppmu_source Starts sourcing voltage or current from the PPMU. This method automatically selects the PPMU method. Changes to PPMU source settings do not take effect until you call this method. If you modify source settings after you call this method, you must call this method again for changes in the configuration to take effect. @@ -3359,16 +4300,20 @@ def ppmu_source(self): To call the method on all channels, you can call it directly on the :py:class:`nidigital.Session`. Example: :py:meth:`my_session.ppmu_source` - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 error_code = self._library.niDigital_PPMU_Source(vi_ctype, channel_list_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def read_static(self): - r'''read_static + r"""read_static Reads the current state of comparators for pins you specify in the repeated capabilities. If there are uncommitted changes to levels or the termination mode, this method commits the changes to the pins. @@ -3391,24 +4336,48 @@ def read_static(self): - PinState.M: The comparators read a midband pin state. - PinState.V: The comparators read a value that is above VOH and below VOL, which can occur when you set VOL higher than VOH. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 buffer_size_ctype = _visatype.ViInt32(0) # case S190 data_ctype = None # case B610 actual_num_read_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_ReadStatic(vi_ctype, channel_list_ctype, buffer_size_ctype, data_ctype, None if actual_num_read_ctype is None else (ctypes.pointer(actual_num_read_ctype))) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niDigital_ReadStatic( + vi_ctype, + channel_list_ctype, + buffer_size_ctype, + data_ctype, + None + if actual_num_read_ctype is None + else (ctypes.pointer(actual_num_read_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) buffer_size_ctype = _visatype.ViInt32(actual_num_read_ctype.value) # case S200 data_size = actual_num_read_ctype.value # case B620 - data_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViUInt8, size=data_size) # case B620 - error_code = self._library.niDigital_ReadStatic(vi_ctype, channel_list_ctype, buffer_size_ctype, data_ctype, None if actual_num_read_ctype is None else (ctypes.pointer(actual_num_read_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + data_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViUInt8, size=data_size + ) # case B620 + error_code = self._library.niDigital_ReadStatic( + vi_ctype, + channel_list_ctype, + buffer_size_ctype, + data_ctype, + None + if actual_num_read_ctype is None + else (ctypes.pointer(actual_num_read_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return [enums.PinState(data_ctype[i]) for i in range(buffer_size_ctype.value)] @ivi_synchronized def _set_attribute_vi_boolean(self, attribute, value): - r'''_set_attribute_vi_boolean + r"""_set_attribute_vi_boolean Sets the value of a ViBoolean property. Use this method to set the values of digital pattern instrument-specific properties and inherent IVI properties. @@ -3428,18 +4397,24 @@ def _set_attribute_vi_boolean(self, attribute, value): value (bool): The value to which you want to set the property; some of the values might not be valid depending on the current settings of the instrument session. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 value_ctype = _visatype.ViBoolean(value) # case S150 - error_code = self._library.niDigital_SetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_ctype, value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_SetAttributeViBoolean( + vi_ctype, channel_name_ctype, attribute_ctype, value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_int32(self, attribute, value): - r'''_set_attribute_vi_int32 + r"""_set_attribute_vi_int32 Sets the value of a ViInt32 property. Use this method to set the values of digital pattern instrument-specific properties and inherent IVI properties. @@ -3459,18 +4434,24 @@ def _set_attribute_vi_int32(self, attribute, value): value (int): The value to which you want to set the property; some of the values might not be valid depending on the current settings of the instrument session. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 value_ctype = _visatype.ViInt32(value) # case S150 - error_code = self._library.niDigital_SetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_ctype, value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_SetAttributeViInt32( + vi_ctype, channel_name_ctype, attribute_ctype, value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_int64(self, attribute, value): - r'''_set_attribute_vi_int64 + r"""_set_attribute_vi_int64 Sets the value of a ViInt64 property. Use this method to set the values of digital pattern instrument-specific properties and inherent IVI properties. @@ -3490,18 +4471,24 @@ def _set_attribute_vi_int64(self, attribute, value): value (int): The value to which you want to set the property; some of the values might not be valid depending on the current settings of the instrument session. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 value_ctype = _visatype.ViInt64(value) # case S150 - error_code = self._library.niDigital_SetAttributeViInt64(vi_ctype, channel_name_ctype, attribute_ctype, value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_SetAttributeViInt64( + vi_ctype, channel_name_ctype, attribute_ctype, value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_real64(self, attribute, value): - r'''_set_attribute_vi_real64 + r"""_set_attribute_vi_real64 Sets the value of a ViIntReal64 property. Use this method to set the values of digital pattern instrument-specific properties and inherent IVI properties. @@ -3521,18 +4508,24 @@ def _set_attribute_vi_real64(self, attribute, value): value (float): The value to which you want to set the property; some of the values might not be valid depending on the current settings of the instrument session. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 value_ctype = _visatype.ViReal64(value) # case S150 - error_code = self._library.niDigital_SetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_ctype, value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_SetAttributeViReal64( + vi_ctype, channel_name_ctype, attribute_ctype, value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_string(self, attribute, value): - r'''_set_attribute_vi_string + r"""_set_attribute_vi_string Sets the value of a ViString property. Use this method to set the values of digital pattern instrument-specific properties and inherent IVI properties. @@ -3552,18 +4545,26 @@ def _set_attribute_vi_string(self, attribute, value): value (str): The value to which you want to set the property; some of the values might not be valid depending on the current settings of the instrument session. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 - value_ctype = ctypes.create_string_buffer(value.encode(self._encoding)) # case C020 - error_code = self._library.niDigital_SetAttributeViString(vi_ctype, channel_name_ctype, attribute_ctype, value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + value_ctype = ctypes.create_string_buffer( + value.encode(self._encoding) + ) # case C020 + error_code = self._library.niDigital_SetAttributeViString( + vi_ctype, channel_name_ctype, attribute_ctype, value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def tdr(self, apply_offsets=True): - r'''tdr + r"""tdr Measures propagation delays through cables, connectors, and load boards using Time-Domain Reflectometry (TDR). Ensure that the channels and pins you select are connected to an open circuit. @@ -3585,37 +4586,71 @@ def tdr(self, apply_offsets=True): Returns: offsets (list of hightime.timedelta): Measured TDR offsets specified in seconds. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 apply_offsets_ctype = _visatype.ViBoolean(apply_offsets) # case S150 offsets_buffer_size_ctype = _visatype.ViInt32(0) # case S190 offsets_ctype = None # case B610 actual_num_offsets_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_TDR(vi_ctype, channel_list_ctype, apply_offsets_ctype, offsets_buffer_size_ctype, offsets_ctype, None if actual_num_offsets_ctype is None else (ctypes.pointer(actual_num_offsets_ctype))) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) - offsets_buffer_size_ctype = _visatype.ViInt32(actual_num_offsets_ctype.value) # case S200 + error_code = self._library.niDigital_TDR( + vi_ctype, + channel_list_ctype, + apply_offsets_ctype, + offsets_buffer_size_ctype, + offsets_ctype, + None + if actual_num_offsets_ctype is None + else (ctypes.pointer(actual_num_offsets_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) + offsets_buffer_size_ctype = _visatype.ViInt32( + actual_num_offsets_ctype.value + ) # case S200 offsets_size = actual_num_offsets_ctype.value # case B620 - offsets_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=offsets_size) # case B620 - error_code = self._library.niDigital_TDR(vi_ctype, channel_list_ctype, apply_offsets_ctype, offsets_buffer_size_ctype, offsets_ctype, None if actual_num_offsets_ctype is None else (ctypes.pointer(actual_num_offsets_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return _converters.convert_seconds_real64_to_timedeltas([float(offsets_ctype[i]) for i in range(offsets_buffer_size_ctype.value)]) + offsets_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViReal64, size=offsets_size + ) # case B620 + error_code = self._library.niDigital_TDR( + vi_ctype, + channel_list_ctype, + apply_offsets_ctype, + offsets_buffer_size_ctype, + offsets_ctype, + None + if actual_num_offsets_ctype is None + else (ctypes.pointer(actual_num_offsets_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return _converters.convert_seconds_real64_to_timedeltas( + [float(offsets_ctype[i]) for i in range(offsets_buffer_size_ctype.value)] + ) def unlock(self): - '''unlock + """unlock Releases a lock that you acquired on an device session using lock. Refer to lock for additional information on session locks. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDigital_UnlockSession(vi_ctype, None) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return @ivi_synchronized - def _write_source_waveform_site_unique_u32(self, waveform_name, num_waveforms, samples_per_waveform, waveform_data): - r'''_write_source_waveform_site_unique_u32 + def _write_source_waveform_site_unique_u32( + self, waveform_name, num_waveforms, samples_per_waveform, waveform_data + ): + r"""_write_source_waveform_site_unique_u32 Writes one waveform per site. Use this write method if you set the parameter of the create source waveform method to Site Unique. @@ -3639,21 +4674,40 @@ def _write_source_waveform_site_unique_u32(self, waveform_name, num_waveforms, s waveform_data (array.array("L")): An array of samples to use as source data. Data for each site must be appended sequentially in the array (non-interleaved). - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 + site_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + waveform_name_ctype = ctypes.create_string_buffer( + waveform_name.encode(self._encoding) + ) # case C020 num_waveforms_ctype = _visatype.ViInt32(num_waveforms) # case S150 - samples_per_waveform_ctype = _visatype.ViInt32(samples_per_waveform) # case S150 - waveform_data_array = get_ctypes_and_array(value=waveform_data, array_type="L") # case B550 - waveform_data_ctype = get_ctypes_pointer_for_buffer(value=waveform_data_array, library_type=_visatype.ViUInt32) # case B550 - error_code = self._library.niDigital_WriteSourceWaveformSiteUniqueU32(vi_ctype, site_list_ctype, waveform_name_ctype, num_waveforms_ctype, samples_per_waveform_ctype, waveform_data_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + samples_per_waveform_ctype = _visatype.ViInt32( + samples_per_waveform + ) # case S150 + waveform_data_array = get_ctypes_and_array( + value=waveform_data, array_type="L" + ) # case B550 + waveform_data_ctype = get_ctypes_pointer_for_buffer( + value=waveform_data_array, library_type=_visatype.ViUInt32 + ) # case B550 + error_code = self._library.niDigital_WriteSourceWaveformSiteUniqueU32( + vi_ctype, + site_list_ctype, + waveform_name_ctype, + num_waveforms_ctype, + samples_per_waveform_ctype, + waveform_data_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def write_static(self, state): - r'''write_static + r"""write_static Writes a static state to the specified pins. The selected pins remain in the specified state until the next pattern burst or call to this method. If there are uncommitted changes to levels or the termination mode, this method commits the changes to the pins. This method does not change the selected pin method. If you write a static state to a pin that does not have the Digital method selected, the new static state is stored by the instrument, and affects the state of the pin the next time you change the selected method to Digital. @@ -3678,18 +4732,26 @@ def write_static(self, state): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - ''' + """ if type(state) is not enums.WriteStaticPinState: - raise TypeError('Parameter state must be of type ' + str(enums.WriteStaticPinState)) + raise TypeError( + "Parameter state must be of type " + str(enums.WriteStaticPinState) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 state_ctype = _visatype.ViUInt8(state.value) # case S130 - error_code = self._library.niDigital_WriteStatic(vi_ctype, channel_list_ctype, state_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_WriteStatic( + vi_ctype, channel_list_ctype, state_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def _error_message(self, error_code): - r'''_error_message + r"""_error_message Takes the error code returned by the digital pattern instrument driver methods, interprets it, and returns it as a user readable string. @@ -3700,20 +4762,24 @@ def _error_message(self, error_code): Returns: error_message (str): The error information formatted as a string. The array must contain at least 256 characters. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus(error_code) # case S150 error_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niDigital_error_message(vi_ctype, error_code_ctype, error_message_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + error_code = self._library.niDigital_error_message( + vi_ctype, error_code_ctype, error_message_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return error_message_ctype.value.decode(self._encoding) class Session(_SessionBase): - '''An NI-Digital Pattern Driver session''' + """An NI-Digital Pattern Driver session""" def __init__(self, resource_name, id_query=False, reset_device=False, options={}): - r'''An NI-Digital Pattern Driver session + r"""An NI-Digital Pattern Driver session Creates and returns a new session to the specified digital pattern instrument to use in all subsequent method calls. To place the instrument in a known startup state when creating a new session, set the reset parameter to True, which is equivalent to calling the reset method immediately after initializing the session. @@ -3764,15 +4830,23 @@ def __init__(self, resource_name, id_query=False, reset_device=False, options={} Returns: new_vi (int): The returned instrument session. - ''' - super(Session, self).__init__(repeated_capability_list=[], vi=None, library=None, encoding=None, freeze_it=False) + """ + super(Session, self).__init__( + repeated_capability_list=[], + vi=None, + library=None, + encoding=None, + freeze_it=False, + ) options = _converters.convert_init_with_options_dictionary(options) self._library = _library_singleton.get() - self._encoding = 'windows-1251' + self._encoding = "windows-1251" # Call specified init function self._vi = 0 # This must be set before calling _init_with_options(). - self._vi = self._init_with_options(resource_name, id_query, reset_device, options) + self._vi = self._init_with_options( + resource_name, id_query, reset_device, options + ) self.tclk = nitclk.SessionReference(self._vi) @@ -3781,7 +4855,7 @@ def __init__(self, resource_name, id_query=False, reset_device=False, options={} param_list.append("resource_name=" + pp.pformat(resource_name)) param_list.append("reset_device=" + pp.pformat(reset_device)) param_list.append("options=" + pp.pformat(options)) - self._param_list = ', '.join(param_list) + self._param_list = ", ".join(param_list) self._is_frozen = True @@ -3792,23 +4866,23 @@ def __exit__(self, exc_type, exc_value, traceback): self.close() def initiate(self): - '''initiate + """initiate Starts bursting the pattern configured by start_label, causing the NI-Digital session to be committed. To stop the pattern burst, call abort. If keep alive pattern is bursting when abort is called or upon exiting the context manager, keep alive pattern will not be stopped. To stop the keep alive pattern, call abort_keep_alive. Note: This method will return a Python context manager that will initiate on entering and abort on exit. - ''' + """ return _Burst(self) def close(self): - '''close + """close Closes the specified instrument session to a digital pattern instrument, aborts pattern execution, and unloads pattern memory. The channels on a digital pattern instrument remain in their current state. Note: This method is not needed when using the session context manager - ''' + """ try: self._close() except errors.DriverError: @@ -3816,44 +4890,50 @@ def close(self): raise self._vi = 0 - ''' These are code-generated ''' + """ These are code-generated """ @ivi_synchronized def abort(self): - r'''abort + r"""abort Stops bursting the pattern. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDigital_Abort(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def abort_keep_alive(self): - r'''abort_keep_alive + r"""abort_keep_alive Stops the keep alive pattern if it is currently running. If a pattern burst is in progress, the method aborts the pattern burst. If you start a new pattern burst while a keep alive pattern is running, the keep alive pattern runs to the last keep alive vector, and the new pattern burst starts on the next cycle. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDigital_AbortKeepAlive(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def commit(self): - r'''commit + r"""commit Applies all previously configured pin levels, termination modes, clocks, triggers, and pattern timing to a digital pattern instrument. If you do not call the commit method, then the initiate method or the burst_pattern method will implicitly call this method for you. Calling this method moves the session from the Uncommitted state to the Committed state. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDigital_Commit(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def configure_time_set_period(self, time_set_name, period): - r'''configure_time_set_period + r"""configure_time_set_period Configures the period of a time set. Use this method to modify time set values after applying a timing sheet with the apply_levels_and_timing method, or to create time sets programmatically without the use of timing sheets. This method does not modify the timing sheet file or the timing sheet contents that will be used in future calls to apply_levels_and_timing; it only affects the values of the current timing context. @@ -3862,17 +4942,27 @@ def configure_time_set_period(self, time_set_name, period): period (hightime.timedelta, datetime.timedelta, or float in seconds): Period for this time set, in seconds. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 - period_ctype = _converters.convert_timedelta_to_seconds_real64(period) # case S140 - error_code = self._library.niDigital_ConfigureTimeSetPeriod(vi_ctype, time_set_name_ctype, period_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + time_set_name_ctype = ctypes.create_string_buffer( + time_set_name.encode(self._encoding) + ) # case C020 + period_ctype = _converters.convert_timedelta_to_seconds_real64( + period + ) # case S140 + error_code = self._library.niDigital_ConfigureTimeSetPeriod( + vi_ctype, time_set_name_ctype, period_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def create_capture_waveform_from_file_digicapture(self, waveform_name, waveform_file_path): - r'''create_capture_waveform_from_file_digicapture + def create_capture_waveform_from_file_digicapture( + self, waveform_name, waveform_file_path + ): + r"""create_capture_waveform_from_file_digicapture Creates a capture waveform with the configuration information from a Digicapture file generated by the Digital Pattern Editor. @@ -3881,17 +4971,27 @@ def create_capture_waveform_from_file_digicapture(self, waveform_name, waveform_ waveform_file_path (str): Absolute file path to the capture waveform file (.digicapture) you want to load. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 - waveform_file_path_ctype = ctypes.create_string_buffer(waveform_file_path.encode(self._encoding)) # case C020 - error_code = self._library.niDigital_CreateCaptureWaveformFromFileDigicapture(vi_ctype, waveform_name_ctype, waveform_file_path_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + waveform_name_ctype = ctypes.create_string_buffer( + waveform_name.encode(self._encoding) + ) # case C020 + waveform_file_path_ctype = ctypes.create_string_buffer( + waveform_file_path.encode(self._encoding) + ) # case C020 + error_code = self._library.niDigital_CreateCaptureWaveformFromFileDigicapture( + vi_ctype, waveform_name_ctype, waveform_file_path_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def create_source_waveform_from_file_tdms(self, waveform_name, waveform_file_path, write_waveform_data=True): - r'''create_source_waveform_from_file_tdms + def create_source_waveform_from_file_tdms( + self, waveform_name, waveform_file_path, write_waveform_data=True + ): + r"""create_source_waveform_from_file_tdms Creates a source waveform with configuration information from a TDMS file generated by the Digital Pattern Editor. It also optionally writes waveform data from the file. @@ -3902,45 +5002,69 @@ def create_source_waveform_from_file_tdms(self, waveform_name, waveform_file_pat write_waveform_data (bool): A Boolean that writes waveform data to source memory if True and the waveform data is in the file. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 - waveform_file_path_ctype = ctypes.create_string_buffer(waveform_file_path.encode(self._encoding)) # case C020 - write_waveform_data_ctype = _visatype.ViBoolean(write_waveform_data) # case S150 - error_code = self._library.niDigital_CreateSourceWaveformFromFileTDMS(vi_ctype, waveform_name_ctype, waveform_file_path_ctype, write_waveform_data_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + waveform_name_ctype = ctypes.create_string_buffer( + waveform_name.encode(self._encoding) + ) # case C020 + waveform_file_path_ctype = ctypes.create_string_buffer( + waveform_file_path.encode(self._encoding) + ) # case C020 + write_waveform_data_ctype = _visatype.ViBoolean( + write_waveform_data + ) # case S150 + error_code = self._library.niDigital_CreateSourceWaveformFromFileTDMS( + vi_ctype, + waveform_name_ctype, + waveform_file_path_ctype, + write_waveform_data_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def create_time_set(self, name): - r'''create_time_set + r"""create_time_set Creates a time set with the name that you specify. Use this method when you want to create time sets programmatically rather than with a timing sheet. Args: name (str): The specified name of the new time set. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - name_ctype = ctypes.create_string_buffer(name.encode(self._encoding)) # case C020 + name_ctype = ctypes.create_string_buffer( + name.encode(self._encoding) + ) # case C020 error_code = self._library.niDigital_CreateTimeSet(vi_ctype, name_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def delete_all_time_sets(self): - r'''delete_all_time_sets + r"""delete_all_time_sets Deletes all time sets from instrument memory. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDigital_DeleteAllTimeSets(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def load_specifications_levels_and_timing(self, specifications_file_paths=None, levels_file_paths=None, timing_file_paths=None): - '''load_specifications_levels_and_timing + def load_specifications_levels_and_timing( + self, + specifications_file_paths=None, + levels_file_paths=None, + timing_file_paths=None, + ): + """load_specifications_levels_and_timing Loads settings in specifications, levels, and timing sheets. These settings are not applied to the digital pattern instrument until apply_levels_and_timing is called. @@ -3956,8 +5080,10 @@ def load_specifications_levels_and_timing(self, specifications_file_paths=None, timing_file_paths (str or basic sequence of str): Absolute file path of one or more timing sheet files. - ''' - self._call_method_with_iterable(self._load_specifications, specifications_file_paths) + """ + self._call_method_with_iterable( + self._load_specifications, specifications_file_paths + ) self._call_method_with_iterable(self._load_levels, levels_file_paths) self._call_method_with_iterable(self._load_timing, timing_file_paths) @@ -3971,7 +5097,7 @@ def _call_method_with_iterable(self, method, files): @ivi_synchronized def self_test(self): - '''self_test + """self_test Returns self test results from a digital pattern instrument. This test requires several minutes to execute. @@ -3987,7 +5113,7 @@ def self_test(self): +----------------+-------------------+ | 1 | Self test failed. | +----------------+-------------------+ - ''' + """ code, msg = self._self_test() if code: raise errors.SelfTestError(code, msg) @@ -3995,7 +5121,7 @@ def self_test(self): @ivi_synchronized def unload_specifications(self, file_paths): - '''unload_specifications + """unload_specifications Unloads the given specifications sheets present in the previously loaded specifications files that you select. @@ -4007,12 +5133,12 @@ def unload_specifications(self, file_paths): Args: file_paths (str or basic sequence of str): Absolute file path of one or more loaded specifications files. - ''' + """ self._call_method_with_iterable(self._unload_specifications, file_paths) @ivi_synchronized def write_source_waveform_site_unique(self, waveform_name, waveform_data): - '''write_source_waveform_site_unique + """write_source_waveform_site_unique Writes one waveform per site. Use this write method if you set the parameter of the create source waveform method to Site Unique. @@ -4021,10 +5147,15 @@ def write_source_waveform_site_unique(self, waveform_name, waveform_data): waveform_data ({ int: basic sequence of unsigned int, int: basic sequence of unsigned int, ... }): Dictionary where each key is a site number and value is a collection of samples to use as source data - ''' + """ from collections.abc import Mapping + if not isinstance(waveform_data, Mapping): - raise TypeError("Expecting waveform_data to be a dictionary but got {}".format(type(waveform_data))) + raise TypeError( + "Expecting waveform_data to be a dictionary but got {}".format( + type(waveform_data) + ) + ) site_list = [] # We assume all the entries are the same length (we'll check later) to make the array the correct size # Get an entry from the dictionary from https://stackoverflow.com/questions/30362391/how-do-you-find-the-first-key-in-a-dictionary @@ -4032,32 +5163,47 @@ def write_source_waveform_site_unique(self, waveform_name, waveform_data): actual_samples_per_waveform = 0 else: actual_samples_per_waveform = len(waveform_data[next(iter(waveform_data))]) - data = array.array('L', [0] * (len(waveform_data) * actual_samples_per_waveform)) + data = array.array( + "L", [0] * (len(waveform_data) * actual_samples_per_waveform) + ) mv = memoryview(data) i = 0 for site in waveform_data: if len(waveform_data[site]) != actual_samples_per_waveform: - raise ValueError('Mismatched length of waveforms. All must be the same length.') + raise ValueError( + "Mismatched length of waveforms. All must be the same length." + ) # Check the type by using string comparison so that we don't import numpy unnecessarily. if str(type(waveform_data[site])).find("'numpy.ndarray'") != -1: import numpy + if waveform_data[site].dtype == numpy.uint32: - wfm = array.array('L', waveform_data[site]) + wfm = array.array("L", waveform_data[site]) else: - raise TypeError("Unsupported dtype for waveform_data array element type. Is {0}, expected {1}".format(waveform_data[site].dtype, numpy.int32)) + raise TypeError( + "Unsupported dtype for waveform_data array element type. Is {0}, expected {1}".format( + waveform_data[site].dtype, numpy.int32 + ) + ) elif isinstance(waveform_data[site], array.array): - if waveform_data[site].typecode == 'L': + if waveform_data[site].typecode == "L": wfm = waveform_data[site] else: - raise TypeError('Wrong waveform_data array element type. Must be unsigned 32 bit int ("L"), was {}'.format(waveform_data[site].typecode)) + raise TypeError( + 'Wrong waveform_data array element type. Must be unsigned 32 bit int ("L"), was {}'.format( + waveform_data[site].typecode + ) + ) elif isinstance(waveform_data[site], list): - wfm = array.array('L', waveform_data[site]) + wfm = array.array("L", waveform_data[site]) else: - raise TypeError('Unknown array type: {}'.format(type(waveform_data[site]))) + raise TypeError( + "Unknown array type: {}".format(type(waveform_data[site])) + ) site_list.append(site) @@ -4067,11 +5213,13 @@ def write_source_waveform_site_unique(self, waveform_name, waveform_data): i += 1 - self.sites[site_list]._write_source_waveform_site_unique_u32(waveform_name, len(waveform_data), actual_samples_per_waveform, data) + self.sites[site_list]._write_source_waveform_site_unique_u32( + waveform_name, len(waveform_data), actual_samples_per_waveform, data + ) @ivi_synchronized def get_pattern_pin_names(self, start_label): - r'''get_pattern_pin_names + r"""get_pattern_pin_names Returns the pattern pin list. @@ -4082,22 +5230,36 @@ def get_pattern_pin_names(self, start_label): Returns: pin_list (list of str): List of pins referenced by the pattern with the **startLabel**. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - start_label_ctype = ctypes.create_string_buffer(start_label.encode(self._encoding)) # case C020 + start_label_ctype = ctypes.create_string_buffer( + start_label.encode(self._encoding) + ) # case C020 pin_list_buffer_size_ctype = _visatype.ViInt32() # case S170 pin_list_ctype = None # case C050 - error_code = self._library.niDigital_GetPatternPinList(vi_ctype, start_label_ctype, pin_list_buffer_size_ctype, pin_list_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niDigital_GetPatternPinList( + vi_ctype, start_label_ctype, pin_list_buffer_size_ctype, pin_list_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) pin_list_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - pin_list_ctype = (_visatype.ViChar * pin_list_buffer_size_ctype.value)() # case C060 - error_code = self._library.niDigital_GetPatternPinList(vi_ctype, start_label_ctype, pin_list_buffer_size_ctype, pin_list_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return _converters.convert_comma_separated_string_to_list(pin_list_ctype.value.decode(self._encoding)) + pin_list_ctype = ( + _visatype.ViChar * pin_list_buffer_size_ctype.value + )() # case C060 + error_code = self._library.niDigital_GetPatternPinList( + vi_ctype, start_label_ctype, pin_list_buffer_size_ctype, pin_list_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return _converters.convert_comma_separated_string_to_list( + pin_list_ctype.value.decode(self._encoding) + ) @ivi_synchronized def get_time_set_period(self, time_set_name): - r'''get_time_set_period + r"""get_time_set_period Returns the period of the specified time set. @@ -4108,16 +5270,28 @@ def get_time_set_period(self, time_set_name): Returns: period (hightime.timedelta): Returned period, in seconds, that the edge is configured to. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 + time_set_name_ctype = ctypes.create_string_buffer( + time_set_name.encode(self._encoding) + ) # case C020 period_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDigital_GetTimeSetPeriod(vi_ctype, time_set_name_ctype, None if period_ctype is None else (ctypes.pointer(period_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return _converters.convert_seconds_real64_to_timedelta(float(period_ctype.value)) - - def _init_with_options(self, resource_name, id_query=False, reset_device=False, option_string=""): - r'''_init_with_options + error_code = self._library.niDigital_GetTimeSetPeriod( + vi_ctype, + time_set_name_ctype, + None if period_ctype is None else (ctypes.pointer(period_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return _converters.convert_seconds_real64_to_timedelta( + float(period_ctype.value) + ) + + def _init_with_options( + self, resource_name, id_query=False, reset_device=False, option_string="" + ): + r"""_init_with_options Creates and returns a new session to the specified digital pattern instrument to use in all subsequent method calls. To place the instrument in a known startup state when creating a new session, set the reset parameter to True, which is equivalent to calling the reset method immediately after initializing the session. @@ -4142,126 +5316,168 @@ def _init_with_options(self, resource_name, id_query=False, reset_device=False, Returns: new_vi (int): The returned instrument session. - ''' - resource_name_ctype = ctypes.create_string_buffer(resource_name.encode(self._encoding)) # case C020 + """ + resource_name_ctype = ctypes.create_string_buffer( + resource_name.encode(self._encoding) + ) # case C020 id_query_ctype = _visatype.ViBoolean(id_query) # case S150 reset_device_ctype = _visatype.ViBoolean(reset_device) # case S150 - option_string_ctype = ctypes.create_string_buffer(_converters.convert_init_with_options_dictionary(option_string).encode(self._encoding)) # case C040 + option_string_ctype = ctypes.create_string_buffer( + _converters.convert_init_with_options_dictionary(option_string).encode( + self._encoding + ) + ) # case C040 new_vi_ctype = _visatype.ViSession() # case S220 - error_code = self._library.niDigital_InitWithOptions(resource_name_ctype, id_query_ctype, reset_device_ctype, option_string_ctype, None if new_vi_ctype is None else (ctypes.pointer(new_vi_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_InitWithOptions( + resource_name_ctype, + id_query_ctype, + reset_device_ctype, + option_string_ctype, + None if new_vi_ctype is None else (ctypes.pointer(new_vi_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(new_vi_ctype.value) @ivi_synchronized def _initiate(self): - r'''_initiate + r"""_initiate Starts bursting the pattern configured by start_label, causing the NI-Digital session to be committed. To stop the pattern burst, call abort. If keep alive pattern is bursting when abort is called or upon exiting the context manager, keep alive pattern will not be stopped. To stop the keep alive pattern, call abort_keep_alive. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDigital_Initiate(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def is_done(self): - r'''is_done + r"""is_done Checks the hardware to determine if the pattern burst has completed or if any errors have occurred. Returns: done (bool): A Boolean that indicates whether the pattern burst completed. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 done_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niDigital_IsDone(vi_ctype, None if done_ctype is None else (ctypes.pointer(done_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_IsDone( + vi_ctype, None if done_ctype is None else (ctypes.pointer(done_ctype)) + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return bool(done_ctype.value) @ivi_synchronized def _load_levels(self, file_path): - r'''_load_levels + r"""_load_levels Loads a levels sheet from a specified file. Args: file_path (str): Absolute file path to the specified levels sheet file. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 + file_path_ctype = ctypes.create_string_buffer( + file_path.encode(self._encoding) + ) # case C020 error_code = self._library.niDigital_LoadLevels(vi_ctype, file_path_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def load_pattern(self, file_path): - r'''load_pattern + r"""load_pattern Loads the specified pattern file. Args: file_path (str): Absolute file path of the binary .digipat pattern file to load. Specify the pattern to burst using start_label or the start_label parameter of the burst_pattern method. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 + file_path_ctype = ctypes.create_string_buffer( + file_path.encode(self._encoding) + ) # case C020 error_code = self._library.niDigital_LoadPattern(vi_ctype, file_path_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def load_pin_map(self, file_path): - r'''load_pin_map + r"""load_pin_map Loads a pin map file. You can load only a single pin and channel map file during an NI-Digital Pattern Driver session. To switch pin maps, create a new session or call the reset method. Args: file_path (str): Absolute file path to a pin map file created with the Digital Pattern Editor or the NI TestStand Semiconductor Module. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 + file_path_ctype = ctypes.create_string_buffer( + file_path.encode(self._encoding) + ) # case C020 error_code = self._library.niDigital_LoadPinMap(vi_ctype, file_path_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _load_specifications(self, file_path): - r'''_load_specifications + r"""_load_specifications Loads a specifications sheet from a specified file. Args: file_path (str): Absolute file path to a specifications file. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 - error_code = self._library.niDigital_LoadSpecifications(vi_ctype, file_path_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + file_path_ctype = ctypes.create_string_buffer( + file_path.encode(self._encoding) + ) # case C020 + error_code = self._library.niDigital_LoadSpecifications( + vi_ctype, file_path_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _load_timing(self, file_path): - r'''_load_timing + r"""_load_timing Loads a timing sheet from a specified file. Args: file_path (str): Absolute file path to the specified timing sheet file. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 + file_path_ctype = ctypes.create_string_buffer( + file_path.encode(self._encoding) + ) # case C020 error_code = self._library.niDigital_LoadTiming(vi_ctype, file_path_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def read_sequencer_flag(self, flag): - r'''read_sequencer_flag + r"""read_sequencer_flag Reads the state of a pattern sequencer flag. Use pattern sequencer flags to coordinate execution between the pattern sequencer and a runtime test program. @@ -4277,19 +5493,29 @@ def read_sequencer_flag(self, flag): Returns: value (bool): A Boolean that indicates the state of the pattern sequencer flag you specify. - ''' + """ if type(flag) is not enums.SequencerFlag: - raise TypeError('Parameter flag must be of type ' + str(enums.SequencerFlag)) + raise TypeError( + "Parameter flag must be of type " + str(enums.SequencerFlag) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - flag_ctype = ctypes.create_string_buffer(flag.value.encode(self._encoding)) # case C030 + flag_ctype = ctypes.create_string_buffer( + flag.value.encode(self._encoding) + ) # case C030 value_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niDigital_ReadSequencerFlag(vi_ctype, flag_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_ReadSequencerFlag( + vi_ctype, + flag_ctype, + None if value_ctype is None else (ctypes.pointer(value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return bool(value_ctype.value) @ivi_synchronized def read_sequencer_register(self, reg): - r'''read_sequencer_register + r"""read_sequencer_register Reads the value of a pattern sequencer register. Use pattern sequencer registers to pass numeric values between the pattern sequencer and a runtime test program. For example, you can use this method to read a register modified by the write_reg opcode during a pattern burst. @@ -4317,19 +5543,29 @@ def read_sequencer_register(self, reg): Returns: value (int): Value read from the sequencer register. - ''' + """ if type(reg) is not enums.SequencerRegister: - raise TypeError('Parameter reg must be of type ' + str(enums.SequencerRegister)) + raise TypeError( + "Parameter reg must be of type " + str(enums.SequencerRegister) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - reg_ctype = ctypes.create_string_buffer(reg.value.encode(self._encoding)) # case C030 + reg_ctype = ctypes.create_string_buffer( + reg.value.encode(self._encoding) + ) # case C030 value_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_ReadSequencerRegister(vi_ctype, reg_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_ReadSequencerRegister( + vi_ctype, + reg_ctype, + None if value_ctype is None else (ctypes.pointer(value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(value_ctype.value) @ivi_synchronized def reset_device(self): - r'''reset_device + r"""reset_device Returns a digital pattern instrument to a known state. This method performs the following actions: @@ -4338,26 +5574,30 @@ def reset_device(self): - Resets all properties to default values, including the selected_function property that is set to SelectedFunction.DISCONNECT, causing the I/O switches to open. - Stops export of all external signals and events. - Clears over-temperature and over-power conditions. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDigital_ResetDevice(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def self_calibrate(self): - r'''self_calibrate + r"""self_calibrate Performs self-calibration on a digital pattern instrument. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDigital_SelfCalibrate(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def send_software_edge_trigger(self, trigger, trigger_identifier): - r'''send_software_edge_trigger + r"""send_software_edge_trigger Forces a particular edge-based trigger to occur regardless of how the specified trigger is configured. You can use this method as a software override. @@ -4383,67 +5623,91 @@ def send_software_edge_trigger(self, trigger, trigger_identifier): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - ''' + """ if type(trigger) is not enums.SoftwareTrigger: - raise TypeError('Parameter trigger must be of type ' + str(enums.SoftwareTrigger)) + raise TypeError( + "Parameter trigger must be of type " + str(enums.SoftwareTrigger) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 trigger_ctype = _visatype.ViInt32(trigger.value) # case S130 - trigger_identifier_ctype = ctypes.create_string_buffer(trigger_identifier.encode(self._encoding)) # case C020 - error_code = self._library.niDigital_SendSoftwareEdgeTrigger(vi_ctype, trigger_ctype, trigger_identifier_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + trigger_identifier_ctype = ctypes.create_string_buffer( + trigger_identifier.encode(self._encoding) + ) # case C020 + error_code = self._library.niDigital_SendSoftwareEdgeTrigger( + vi_ctype, trigger_ctype, trigger_identifier_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def unload_all_patterns(self, unload_keep_alive_pattern=False): - r'''unload_all_patterns + r"""unload_all_patterns Unloads all patterns, source waveforms, and capture waveforms from a digital pattern instrument. Args: unload_keep_alive_pattern (bool): A Boolean that specifies whether to keep or unload the keep alive pattern. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - unload_keep_alive_pattern_ctype = _visatype.ViBoolean(unload_keep_alive_pattern) # case S150 - error_code = self._library.niDigital_UnloadAllPatterns(vi_ctype, unload_keep_alive_pattern_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + unload_keep_alive_pattern_ctype = _visatype.ViBoolean( + unload_keep_alive_pattern + ) # case S150 + error_code = self._library.niDigital_UnloadAllPatterns( + vi_ctype, unload_keep_alive_pattern_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _unload_specifications(self, file_path): - r'''_unload_specifications + r"""_unload_specifications Unloads the given specifications sheet present in the previously loaded specifications file that you select. You must call the _load_specifications method to reload the file with updated specifications values. You must then call the apply_levels_and_timing method in order to apply the levels and timing values that reference the updated specifications values. Args: file_path (str): Absolute file path to a loaded specifications file. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 - error_code = self._library.niDigital_UnloadSpecifications(vi_ctype, file_path_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + file_path_ctype = ctypes.create_string_buffer( + file_path.encode(self._encoding) + ) # case C020 + error_code = self._library.niDigital_UnloadSpecifications( + vi_ctype, file_path_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def wait_until_done(self, timeout=hightime.timedelta(seconds=10.0)): - r'''wait_until_done + r"""wait_until_done Waits until the pattern burst has completed or the timeout has expired. Args: timeout (hightime.timedelta, datetime.timedelta, or float in seconds): Maximum time (in seconds) allowed for this method to complete. If this method does not complete within this time interval, this method returns an error. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64( + timeout + ) # case S140 error_code = self._library.niDigital_WaitUntilDone(vi_ctype, timeout_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def write_sequencer_flag(self, flag, value): - r'''write_sequencer_flag + r"""write_sequencer_flag Writes the state of a pattern sequencer flag. Use pattern sequencer flags to coordinate execution between the pattern sequencer and a runtime test program. @@ -4457,19 +5721,27 @@ def write_sequencer_flag(self, flag, value): value (bool): A Boolean that assigns a state to the pattern sequencer flag you specify. - ''' + """ if type(flag) is not enums.SequencerFlag: - raise TypeError('Parameter flag must be of type ' + str(enums.SequencerFlag)) + raise TypeError( + "Parameter flag must be of type " + str(enums.SequencerFlag) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - flag_ctype = ctypes.create_string_buffer(flag.value.encode(self._encoding)) # case C030 + flag_ctype = ctypes.create_string_buffer( + flag.value.encode(self._encoding) + ) # case C030 value_ctype = _visatype.ViBoolean(value) # case S150 - error_code = self._library.niDigital_WriteSequencerFlag(vi_ctype, flag_ctype, value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_WriteSequencerFlag( + vi_ctype, flag_ctype, value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def write_sequencer_register(self, reg, value): - r'''write_sequencer_register + r"""write_sequencer_register Writes a value to a pattern sequencer register. Use pattern sequencer registers to pass numeric values between the pattern sequencer and a runtime test program. @@ -4495,19 +5767,27 @@ def write_sequencer_register(self, reg, value): value (int): The value you want to write to the register. - ''' + """ if type(reg) is not enums.SequencerRegister: - raise TypeError('Parameter reg must be of type ' + str(enums.SequencerRegister)) + raise TypeError( + "Parameter reg must be of type " + str(enums.SequencerRegister) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - reg_ctype = ctypes.create_string_buffer(reg.value.encode(self._encoding)) # case C030 + reg_ctype = ctypes.create_string_buffer( + reg.value.encode(self._encoding) + ) # case C030 value_ctype = _visatype.ViInt32(value) # case S150 - error_code = self._library.niDigital_WriteSequencerRegister(vi_ctype, reg_ctype, value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDigital_WriteSequencerRegister( + vi_ctype, reg_ctype, value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def write_source_waveform_broadcast(self, waveform_name, waveform_data): - r'''write_source_waveform_broadcast + r"""write_source_waveform_broadcast Writes the same waveform data to all sites. Use this write method if you set the data_mapping parameter of the create source waveform method to SourceDataMapping.BROADCAST. @@ -4516,18 +5796,30 @@ def write_source_waveform_broadcast(self, waveform_name, waveform_data): waveform_data (list of int): 1D array of samples to use as source data to apply to all sites. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 - waveform_size_ctype = _visatype.ViInt32(0 if waveform_data is None else len(waveform_data)) # case S160 - waveform_data_ctype = get_ctypes_pointer_for_buffer(value=waveform_data, library_type=_visatype.ViUInt32) # case B550 - error_code = self._library.niDigital_WriteSourceWaveformBroadcastU32(vi_ctype, waveform_name_ctype, waveform_size_ctype, waveform_data_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + waveform_name_ctype = ctypes.create_string_buffer( + waveform_name.encode(self._encoding) + ) # case C020 + waveform_size_ctype = _visatype.ViInt32( + 0 if waveform_data is None else len(waveform_data) + ) # case S160 + waveform_data_ctype = get_ctypes_pointer_for_buffer( + value=waveform_data, library_type=_visatype.ViUInt32 + ) # case B550 + error_code = self._library.niDigital_WriteSourceWaveformBroadcastU32( + vi_ctype, waveform_name_ctype, waveform_size_ctype, waveform_data_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def write_source_waveform_data_from_file_tdms(self, waveform_name, waveform_file_path): - r'''write_source_waveform_data_from_file_tdms + def write_source_waveform_data_from_file_tdms( + self, waveform_name, waveform_file_path + ): + r"""write_source_waveform_data_from_file_tdms Writes a source waveform based on the waveform data and configuration information the file contains. @@ -4536,27 +5828,37 @@ def write_source_waveform_data_from_file_tdms(self, waveform_name, waveform_file waveform_file_path (str): Absolute file path to the load source waveform file (.tdms). - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 - waveform_file_path_ctype = ctypes.create_string_buffer(waveform_file_path.encode(self._encoding)) # case C020 - error_code = self._library.niDigital_WriteSourceWaveformDataFromFileTDMS(vi_ctype, waveform_name_ctype, waveform_file_path_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + waveform_name_ctype = ctypes.create_string_buffer( + waveform_name.encode(self._encoding) + ) # case C020 + waveform_file_path_ctype = ctypes.create_string_buffer( + waveform_file_path.encode(self._encoding) + ) # case C020 + error_code = self._library.niDigital_WriteSourceWaveformDataFromFileTDMS( + vi_ctype, waveform_name_ctype, waveform_file_path_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def _close(self): - r'''_close + r"""_close Closes the specified instrument session to a digital pattern instrument, aborts pattern execution, and unloads pattern memory. The channels on a digital pattern instrument remain in their current state. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDigital_close(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def reset(self): - r'''reset + r"""reset Returns a digital pattern instrument to a known state. This method performs the following actions: @@ -4564,15 +5866,17 @@ def reset(self): - Clears pin maps, time sets, source and capture waveforms, and patterns. - Resets all properties to default values, including the selected_function property that is set to SelectedFunction.DISCONNECT, causing the I/O switches to open. - Stops exporting all external signals and events. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDigital_reset(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _self_test(self): - r'''_self_test + r"""_self_test Returns self test results from a digital pattern instrument. This test requires several minutes to execute. @@ -4581,13 +5885,18 @@ def _self_test(self): test_message (str): The returned self test status message. The array must contain at least 256 characters. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 test_result_ctype = _visatype.ViInt16() # case S220 test_message_ctype = (_visatype.ViChar * 2048)() # case C070 - error_code = self._library.niDigital_self_test(vi_ctype, None if test_result_ctype is None else (ctypes.pointer(test_result_ctype)), test_message_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return int(test_result_ctype.value), test_message_ctype.value.decode(self._encoding) - - - + error_code = self._library.niDigital_self_test( + vi_ctype, + None if test_result_ctype is None else (ctypes.pointer(test_result_ctype)), + test_message_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return int(test_result_ctype.value), test_message_ctype.value.decode( + self._encoding + ) diff --git a/generated/nidigital/nidigital/unit_tests/_matchers.py b/generated/nidigital/nidigital/unit_tests/_matchers.py index d451b50a2..cf5d2362b 100644 --- a/generated/nidigital/nidigital/unit_tests/_matchers.py +++ b/generated/nidigital/nidigital/unit_tests/_matchers.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # This file was generated -'''Matcher classes used by unit tests in order to set mock expectations. +"""Matcher classes used by unit tests in order to set mock expectations. These work well with our visatype definitions. -''' +""" import ctypes import nidigital._visatype as _visatype @@ -21,15 +21,27 @@ def __init__(self, expected_type, expected_value): def __eq__(self, other): if not isinstance(other, self.expected_type): - print("{0}: Unexpected type. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_type, type(other))) + print( + "{0}: Unexpected type. Expected: {1}. Received: {2}".format( + self.__class__.__name__, self.expected_type, type(other) + ) + ) return False if other.value != self.expected_value: - print("{0}: Unexpected value. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_value, other.value)) + print( + "{0}: Unexpected value. Expected: {1}. Received: {2}".format( + self.__class__.__name__, self.expected_value, other.value + ) + ) return False return True def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_type), + pp.pformat(self.expected_value), + ) class _PointerMatcher(object): @@ -38,12 +50,18 @@ def __init__(self, expected_type): def __eq__(self, other): if not isinstance(other, ctypes.POINTER(self.expected_type)): - print("Unexpected type. Expected: {0}. Received: {1}".format(ctypes.POINTER(self.expected_type), type(other))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + ctypes.POINTER(self.expected_type), type(other) + ) + ) return False return True def __repr__(self): - return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_type)) + return "{0}({1})".format( + self.__class__.__name__, pp.pformat(self.expected_type) + ) class _BufferMatcher(object): @@ -70,29 +88,47 @@ def __eq__(self, other): pass # Because of object lifetimes, we may need to mock the other instance and provide lists instead of the actual array - if not isinstance(other, self.expected_type) and not isinstance(other, list): - print("Unexpected type. Expected: {0} or {1}. Received: {2}".format(self.expected_type, list, type(other))) + if not isinstance(other, self.expected_type) and not isinstance( + other, list + ): + print( + "Unexpected type. Expected: {0} or {1}. Received: {2}".format( + self.expected_type, list, type(other) + ) + ) return False if self.expected_size != len(other): - print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(other))) + print( + "Unexpected length. Expected: {0}. Received: {1}".format( + self.expected_size, len(other) + ) + ) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for i in range(0, len(self.expected_value)): if self.expected_value[i] != other[i]: - print("Unexpected value at index {0}. Expected: {1}. Received: {2}".format(i, self.expected_value[i], other[i])) + print( + "Unexpected value at index {0}. Expected: {1}. Received: {2}".format( + i, self.expected_value[i], other[i] + ) + ) return False return True def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self._expected_element_type), pp.pformat(self._expected_size_or_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self._expected_element_type), + pp.pformat(self._expected_size_or_value), + ) def __str__(self): - ret_str = self.__repr__() + '\n' - ret_str += ' expected_type = ' + str(self.expected_type) + '\n' - ret_str += ' expected_value = ' + str(self.expected_value) + '\n' - ret_str += ' expected_size = ' + str(self.expected_size) + '\n' + ret_str = self.__repr__() + "\n" + ret_str += " expected_type = " + str(self.expected_type) + "\n" + ret_str += " expected_value = " + str(self.expected_value) + "\n" + ret_str += " expected_size = " + str(self.expected_size) + "\n" return ret_str @@ -112,21 +148,37 @@ def __eq__(self, other): pass if not isinstance(other, ctypes.Array): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(other))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_type, type(other) + ) + ) return False - if len(other) < len(self.expected_string_value) + 1: # +1 for NULL terminating character - print("Unexpected length in C string. Expected at least: {0}. Received {1}".format(len(other), len(self.expected_string_value) + 1)) + if ( + len(other) < len(self.expected_string_value) + 1 + ): # +1 for NULL terminating character + print( + "Unexpected length in C string. Expected at least: {0}. Received {1}".format( + len(other), len(self.expected_string_value) + 1 + ) + ) return False if not isinstance(other[0], bytes): print("Unexpected type. Not a string. Received: {0}".format(type(other[0]))) return False if other.value.decode("ascii") != self.expected_string_value: - print("Unexpected value. Expected {0}. Received: {1}".format(self.expected_string_value, other.value.decode)) + print( + "Unexpected value. Expected {0}. Received: {1}".format( + self.expected_string_value, other.value.decode + ) + ) return False return True def __repr__(self): - return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_string_value)) + return "{0}({1})".format( + self.__class__.__name__, pp.pformat(self.expected_string_value) + ) # Custom Type @@ -139,7 +191,11 @@ def _compare_ctype_structs(expected, actual): expected_val = getattr(expected, field_name) actual_val = getattr(actual, field_name) if expected_val != actual_val: - print("Unexpected value field {0}. Expected: {1}. Received: {2}".format(field_name, expected_val, actual_val)) + print( + "Unexpected value field {0}. Expected: {1}. Received: {2}".format( + field_name, expected_val, actual_val + ) + ) return False return True @@ -151,12 +207,20 @@ def __init__(self, expected_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_type, type(actual) + ) + ) return False return _compare_ctype_structs(self.expected_value, actual) def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_type), + pp.pformat(self.expected_value), + ) class CustomTypeBufferMatcher(object): @@ -168,30 +232,48 @@ def __init__(self, expected_element_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print("Unexpected array type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) + print( + "Unexpected array type. Expected: {0}. Received: {1}".format( + self.expected_type, type(actual) + ) + ) return False if self.expected_size != len(actual): - print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(actual))) + print( + "Unexpected length. Expected: {0}. Received: {1}".format( + self.expected_size, len(actual) + ) + ) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for a, e in zip(actual, self.expected_value): if not isinstance(a, self.expected_element_type): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_element_type, type(a))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_element_type, type(a) + ) + ) return False if not _compare_ctype_structs(e, a): return False return True def __repr__(self): - expected_val_repr = '[' + ', '.join([x.__repr__() for x in self.expected_value]) + ']' - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_element_type), expected_val_repr) + expected_val_repr = ( + "[" + ", ".join([x.__repr__() for x in self.expected_value]) + "]" + ) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_element_type), + expected_val_repr, + ) def __str__(self): - ret_str = self.__repr__() + '\n' - ret_str += ' expected_type = ' + str(self.expected_type) + '\n' - ret_str += ' expected_size = ' + str(self.expected_size) + '\n' + ret_str = self.__repr__() + "\n" + ret_str += " expected_type = " + str(self.expected_type) + "\n" + ret_str += " expected_size = " + str(self.expected_size) + "\n" return ret_str @@ -200,7 +282,9 @@ def __str__(self): class ViBooleanMatcher(_ScalarMatcher): def __init__(self, expected_value): - _ScalarMatcher.__init__(self, _visatype.ViBoolean, 1 if expected_value is True else 0) + _ScalarMatcher.__init__( + self, _visatype.ViBoolean, 1 if expected_value is True else 0 + ) class ViSessionMatcher(_ScalarMatcher): @@ -312,6 +396,3 @@ def __init__(self, expected_size_or_value): class ViSessionBufferMatcher(_BufferMatcher): def __init__(self, expected_size_or_value): _BufferMatcher.__init__(self, _visatype.ViSession, expected_size_or_value) - - - diff --git a/generated/nidigital/nidigital/unit_tests/_mock_helper.py b/generated/nidigital/nidigital/unit_tests/_mock_helper.py index 1d3ab77f6..ea9d7da9f 100644 --- a/generated/nidigital/nidigital/unit_tests/_mock_helper.py +++ b/generated/nidigital/nidigital/unit_tests/_mock_helper.py @@ -16,243 +16,245 @@ def __init__(self, function, param=None): class SideEffectsHelper(object): def __init__(self): self._defaults = {} - self._defaults['Abort'] = {} - self._defaults['Abort']['return'] = 0 - self._defaults['AbortKeepAlive'] = {} - self._defaults['AbortKeepAlive']['return'] = 0 - self._defaults['ApplyLevelsAndTiming'] = {} - self._defaults['ApplyLevelsAndTiming']['return'] = 0 - self._defaults['ApplyTDROffsets'] = {} - self._defaults['ApplyTDROffsets']['return'] = 0 - self._defaults['BurstPattern'] = {} - self._defaults['BurstPattern']['return'] = 0 - self._defaults['ClockGenerator_Abort'] = {} - self._defaults['ClockGenerator_Abort']['return'] = 0 - self._defaults['ClockGenerator_GenerateClock'] = {} - self._defaults['ClockGenerator_GenerateClock']['return'] = 0 - self._defaults['Commit'] = {} - self._defaults['Commit']['return'] = 0 - self._defaults['ConfigureActiveLoadLevels'] = {} - self._defaults['ConfigureActiveLoadLevels']['return'] = 0 - self._defaults['ConfigurePatternBurstSites'] = {} - self._defaults['ConfigurePatternBurstSites']['return'] = 0 - self._defaults['ConfigureTimeSetCompareEdgesStrobe'] = {} - self._defaults['ConfigureTimeSetCompareEdgesStrobe']['return'] = 0 - self._defaults['ConfigureTimeSetCompareEdgesStrobe2x'] = {} - self._defaults['ConfigureTimeSetCompareEdgesStrobe2x']['return'] = 0 - self._defaults['ConfigureTimeSetDriveEdges'] = {} - self._defaults['ConfigureTimeSetDriveEdges']['return'] = 0 - self._defaults['ConfigureTimeSetDriveEdges2x'] = {} - self._defaults['ConfigureTimeSetDriveEdges2x']['return'] = 0 - self._defaults['ConfigureTimeSetDriveFormat'] = {} - self._defaults['ConfigureTimeSetDriveFormat']['return'] = 0 - self._defaults['ConfigureTimeSetEdge'] = {} - self._defaults['ConfigureTimeSetEdge']['return'] = 0 - self._defaults['ConfigureTimeSetEdgeMultiplier'] = {} - self._defaults['ConfigureTimeSetEdgeMultiplier']['return'] = 0 - self._defaults['ConfigureTimeSetPeriod'] = {} - self._defaults['ConfigureTimeSetPeriod']['return'] = 0 - self._defaults['ConfigureVoltageLevels'] = {} - self._defaults['ConfigureVoltageLevels']['return'] = 0 - self._defaults['CreateCaptureWaveformFromFileDigicapture'] = {} - self._defaults['CreateCaptureWaveformFromFileDigicapture']['return'] = 0 - self._defaults['CreateCaptureWaveformParallel'] = {} - self._defaults['CreateCaptureWaveformParallel']['return'] = 0 - self._defaults['CreateCaptureWaveformSerial'] = {} - self._defaults['CreateCaptureWaveformSerial']['return'] = 0 - self._defaults['CreateSourceWaveformFromFileTDMS'] = {} - self._defaults['CreateSourceWaveformFromFileTDMS']['return'] = 0 - self._defaults['CreateSourceWaveformParallel'] = {} - self._defaults['CreateSourceWaveformParallel']['return'] = 0 - self._defaults['CreateSourceWaveformSerial'] = {} - self._defaults['CreateSourceWaveformSerial']['return'] = 0 - self._defaults['CreateTimeSet'] = {} - self._defaults['CreateTimeSet']['return'] = 0 - self._defaults['DeleteAllTimeSets'] = {} - self._defaults['DeleteAllTimeSets']['return'] = 0 - self._defaults['DisableSites'] = {} - self._defaults['DisableSites']['return'] = 0 - self._defaults['EnableSites'] = {} - self._defaults['EnableSites']['return'] = 0 - self._defaults['FetchHistoryRAMCycleInformation'] = {} - self._defaults['FetchHistoryRAMCycleInformation']['return'] = 0 - self._defaults['FetchHistoryRAMCycleInformation']['patternIndex'] = None - self._defaults['FetchHistoryRAMCycleInformation']['timeSetIndex'] = None - self._defaults['FetchHistoryRAMCycleInformation']['vectorNumber'] = None - self._defaults['FetchHistoryRAMCycleInformation']['cycleNumber'] = None - self._defaults['FetchHistoryRAMCycleInformation']['numDutCycles'] = None - self._defaults['FetchHistoryRAMCyclePinData'] = {} - self._defaults['FetchHistoryRAMCyclePinData']['return'] = 0 - self._defaults['FetchHistoryRAMCyclePinData']['actualNumPinData'] = None - self._defaults['FetchHistoryRAMCyclePinData']['expectedPinStates'] = None - self._defaults['FetchHistoryRAMCyclePinData']['actualPinStates'] = None - self._defaults['FetchHistoryRAMCyclePinData']['perPinPassFail'] = None - self._defaults['FetchHistoryRAMScanCycleNumber'] = {} - self._defaults['FetchHistoryRAMScanCycleNumber']['return'] = 0 - self._defaults['FetchHistoryRAMScanCycleNumber']['scanCycleNumber'] = None - self._defaults['FrequencyCounter_MeasureFrequency'] = {} - self._defaults['FrequencyCounter_MeasureFrequency']['return'] = 0 - self._defaults['FrequencyCounter_MeasureFrequency']['actualNumFrequencies'] = None - self._defaults['FrequencyCounter_MeasureFrequency']['frequencies'] = None - self._defaults['GetAttributeViBoolean'] = {} - self._defaults['GetAttributeViBoolean']['return'] = 0 - self._defaults['GetAttributeViBoolean']['value'] = None - self._defaults['GetAttributeViInt32'] = {} - self._defaults['GetAttributeViInt32']['return'] = 0 - self._defaults['GetAttributeViInt32']['value'] = None - self._defaults['GetAttributeViInt64'] = {} - self._defaults['GetAttributeViInt64']['return'] = 0 - self._defaults['GetAttributeViInt64']['value'] = None - self._defaults['GetAttributeViReal64'] = {} - self._defaults['GetAttributeViReal64']['return'] = 0 - self._defaults['GetAttributeViReal64']['value'] = None - self._defaults['GetAttributeViString'] = {} - self._defaults['GetAttributeViString']['return'] = 0 - self._defaults['GetAttributeViString']['value'] = None - self._defaults['GetChannelNameFromString'] = {} - self._defaults['GetChannelNameFromString']['return'] = 0 - self._defaults['GetChannelNameFromString']['names'] = None - self._defaults['GetError'] = {} - self._defaults['GetError']['return'] = 0 - self._defaults['GetError']['errorCode'] = None - self._defaults['GetError']['errorDescription'] = None - self._defaults['GetFailCount'] = {} - self._defaults['GetFailCount']['return'] = 0 - self._defaults['GetFailCount']['actualNumRead'] = None - self._defaults['GetFailCount']['failureCount'] = None - self._defaults['GetHistoryRAMSampleCount'] = {} - self._defaults['GetHistoryRAMSampleCount']['return'] = 0 - self._defaults['GetHistoryRAMSampleCount']['sampleCount'] = None - self._defaults['GetPatternName'] = {} - self._defaults['GetPatternName']['return'] = 0 - self._defaults['GetPatternName']['name'] = None - self._defaults['GetPatternPinList'] = {} - self._defaults['GetPatternPinList']['return'] = 0 - self._defaults['GetPatternPinList']['pinList'] = None - self._defaults['GetPinName'] = {} - self._defaults['GetPinName']['return'] = 0 - self._defaults['GetPinName']['name'] = None - self._defaults['GetPinResultsPinInformation'] = {} - self._defaults['GetPinResultsPinInformation']['return'] = 0 - self._defaults['GetPinResultsPinInformation']['actualNumValues'] = None - self._defaults['GetPinResultsPinInformation']['pinIndexes'] = None - self._defaults['GetPinResultsPinInformation']['siteNumbers'] = None - self._defaults['GetPinResultsPinInformation']['channelIndexes'] = None - self._defaults['GetSitePassFail'] = {} - self._defaults['GetSitePassFail']['return'] = 0 - self._defaults['GetSitePassFail']['actualNumSites'] = None - self._defaults['GetSitePassFail']['passFail'] = None - self._defaults['GetSiteResultsSiteNumbers'] = {} - self._defaults['GetSiteResultsSiteNumbers']['return'] = 0 - self._defaults['GetSiteResultsSiteNumbers']['actualNumSiteNumbers'] = None - self._defaults['GetSiteResultsSiteNumbers']['siteNumbers'] = None - self._defaults['GetTimeSetDriveFormat'] = {} - self._defaults['GetTimeSetDriveFormat']['return'] = 0 - self._defaults['GetTimeSetDriveFormat']['format'] = None - self._defaults['GetTimeSetEdge'] = {} - self._defaults['GetTimeSetEdge']['return'] = 0 - self._defaults['GetTimeSetEdge']['time'] = None - self._defaults['GetTimeSetEdgeMultiplier'] = {} - self._defaults['GetTimeSetEdgeMultiplier']['return'] = 0 - self._defaults['GetTimeSetEdgeMultiplier']['edgeMultiplier'] = None - self._defaults['GetTimeSetName'] = {} - self._defaults['GetTimeSetName']['return'] = 0 - self._defaults['GetTimeSetName']['name'] = None - self._defaults['GetTimeSetPeriod'] = {} - self._defaults['GetTimeSetPeriod']['return'] = 0 - self._defaults['GetTimeSetPeriod']['period'] = None - self._defaults['InitWithOptions'] = {} - self._defaults['InitWithOptions']['return'] = 0 - self._defaults['InitWithOptions']['newVi'] = None - self._defaults['Initiate'] = {} - self._defaults['Initiate']['return'] = 0 - self._defaults['IsDone'] = {} - self._defaults['IsDone']['return'] = 0 - self._defaults['IsDone']['done'] = None - self._defaults['IsSiteEnabled'] = {} - self._defaults['IsSiteEnabled']['return'] = 0 - self._defaults['IsSiteEnabled']['enable'] = None - self._defaults['LoadLevels'] = {} - self._defaults['LoadLevels']['return'] = 0 - self._defaults['LoadPattern'] = {} - self._defaults['LoadPattern']['return'] = 0 - self._defaults['LoadPinMap'] = {} - self._defaults['LoadPinMap']['return'] = 0 - self._defaults['LoadSpecifications'] = {} - self._defaults['LoadSpecifications']['return'] = 0 - self._defaults['LoadTiming'] = {} - self._defaults['LoadTiming']['return'] = 0 - self._defaults['LockSession'] = {} - self._defaults['LockSession']['return'] = 0 - self._defaults['LockSession']['callerHasLock'] = None - self._defaults['PPMU_Measure'] = {} - self._defaults['PPMU_Measure']['return'] = 0 - self._defaults['PPMU_Measure']['actualNumRead'] = None - self._defaults['PPMU_Measure']['measurements'] = None - self._defaults['PPMU_Source'] = {} - self._defaults['PPMU_Source']['return'] = 0 - self._defaults['ReadSequencerFlag'] = {} - self._defaults['ReadSequencerFlag']['return'] = 0 - self._defaults['ReadSequencerFlag']['value'] = None - self._defaults['ReadSequencerRegister'] = {} - self._defaults['ReadSequencerRegister']['return'] = 0 - self._defaults['ReadSequencerRegister']['value'] = None - self._defaults['ReadStatic'] = {} - self._defaults['ReadStatic']['return'] = 0 - self._defaults['ReadStatic']['actualNumRead'] = None - self._defaults['ReadStatic']['data'] = None - self._defaults['ResetDevice'] = {} - self._defaults['ResetDevice']['return'] = 0 - self._defaults['SelfCalibrate'] = {} - self._defaults['SelfCalibrate']['return'] = 0 - self._defaults['SendSoftwareEdgeTrigger'] = {} - self._defaults['SendSoftwareEdgeTrigger']['return'] = 0 - self._defaults['SetAttributeViBoolean'] = {} - self._defaults['SetAttributeViBoolean']['return'] = 0 - self._defaults['SetAttributeViInt32'] = {} - self._defaults['SetAttributeViInt32']['return'] = 0 - self._defaults['SetAttributeViInt64'] = {} - self._defaults['SetAttributeViInt64']['return'] = 0 - self._defaults['SetAttributeViReal64'] = {} - self._defaults['SetAttributeViReal64']['return'] = 0 - self._defaults['SetAttributeViString'] = {} - self._defaults['SetAttributeViString']['return'] = 0 - self._defaults['TDR'] = {} - self._defaults['TDR']['return'] = 0 - self._defaults['TDR']['actualNumOffsets'] = None - self._defaults['TDR']['offsets'] = None - self._defaults['UnloadAllPatterns'] = {} - self._defaults['UnloadAllPatterns']['return'] = 0 - self._defaults['UnloadSpecifications'] = {} - self._defaults['UnloadSpecifications']['return'] = 0 - self._defaults['UnlockSession'] = {} - self._defaults['UnlockSession']['return'] = 0 - self._defaults['UnlockSession']['callerHasLock'] = None - self._defaults['WaitUntilDone'] = {} - self._defaults['WaitUntilDone']['return'] = 0 - self._defaults['WriteSequencerFlag'] = {} - self._defaults['WriteSequencerFlag']['return'] = 0 - self._defaults['WriteSequencerRegister'] = {} - self._defaults['WriteSequencerRegister']['return'] = 0 - self._defaults['WriteSourceWaveformBroadcastU32'] = {} - self._defaults['WriteSourceWaveformBroadcastU32']['return'] = 0 - self._defaults['WriteSourceWaveformDataFromFileTDMS'] = {} - self._defaults['WriteSourceWaveformDataFromFileTDMS']['return'] = 0 - self._defaults['WriteSourceWaveformSiteUniqueU32'] = {} - self._defaults['WriteSourceWaveformSiteUniqueU32']['return'] = 0 - self._defaults['WriteStatic'] = {} - self._defaults['WriteStatic']['return'] = 0 - self._defaults['close'] = {} - self._defaults['close']['return'] = 0 - self._defaults['error_message'] = {} - self._defaults['error_message']['return'] = 0 - self._defaults['error_message']['errorMessage'] = None - self._defaults['reset'] = {} - self._defaults['reset']['return'] = 0 - self._defaults['self_test'] = {} - self._defaults['self_test']['return'] = 0 - self._defaults['self_test']['testResult'] = None - self._defaults['self_test']['testMessage'] = None + self._defaults["Abort"] = {} + self._defaults["Abort"]["return"] = 0 + self._defaults["AbortKeepAlive"] = {} + self._defaults["AbortKeepAlive"]["return"] = 0 + self._defaults["ApplyLevelsAndTiming"] = {} + self._defaults["ApplyLevelsAndTiming"]["return"] = 0 + self._defaults["ApplyTDROffsets"] = {} + self._defaults["ApplyTDROffsets"]["return"] = 0 + self._defaults["BurstPattern"] = {} + self._defaults["BurstPattern"]["return"] = 0 + self._defaults["ClockGenerator_Abort"] = {} + self._defaults["ClockGenerator_Abort"]["return"] = 0 + self._defaults["ClockGenerator_GenerateClock"] = {} + self._defaults["ClockGenerator_GenerateClock"]["return"] = 0 + self._defaults["Commit"] = {} + self._defaults["Commit"]["return"] = 0 + self._defaults["ConfigureActiveLoadLevels"] = {} + self._defaults["ConfigureActiveLoadLevels"]["return"] = 0 + self._defaults["ConfigurePatternBurstSites"] = {} + self._defaults["ConfigurePatternBurstSites"]["return"] = 0 + self._defaults["ConfigureTimeSetCompareEdgesStrobe"] = {} + self._defaults["ConfigureTimeSetCompareEdgesStrobe"]["return"] = 0 + self._defaults["ConfigureTimeSetCompareEdgesStrobe2x"] = {} + self._defaults["ConfigureTimeSetCompareEdgesStrobe2x"]["return"] = 0 + self._defaults["ConfigureTimeSetDriveEdges"] = {} + self._defaults["ConfigureTimeSetDriveEdges"]["return"] = 0 + self._defaults["ConfigureTimeSetDriveEdges2x"] = {} + self._defaults["ConfigureTimeSetDriveEdges2x"]["return"] = 0 + self._defaults["ConfigureTimeSetDriveFormat"] = {} + self._defaults["ConfigureTimeSetDriveFormat"]["return"] = 0 + self._defaults["ConfigureTimeSetEdge"] = {} + self._defaults["ConfigureTimeSetEdge"]["return"] = 0 + self._defaults["ConfigureTimeSetEdgeMultiplier"] = {} + self._defaults["ConfigureTimeSetEdgeMultiplier"]["return"] = 0 + self._defaults["ConfigureTimeSetPeriod"] = {} + self._defaults["ConfigureTimeSetPeriod"]["return"] = 0 + self._defaults["ConfigureVoltageLevels"] = {} + self._defaults["ConfigureVoltageLevels"]["return"] = 0 + self._defaults["CreateCaptureWaveformFromFileDigicapture"] = {} + self._defaults["CreateCaptureWaveformFromFileDigicapture"]["return"] = 0 + self._defaults["CreateCaptureWaveformParallel"] = {} + self._defaults["CreateCaptureWaveformParallel"]["return"] = 0 + self._defaults["CreateCaptureWaveformSerial"] = {} + self._defaults["CreateCaptureWaveformSerial"]["return"] = 0 + self._defaults["CreateSourceWaveformFromFileTDMS"] = {} + self._defaults["CreateSourceWaveformFromFileTDMS"]["return"] = 0 + self._defaults["CreateSourceWaveformParallel"] = {} + self._defaults["CreateSourceWaveformParallel"]["return"] = 0 + self._defaults["CreateSourceWaveformSerial"] = {} + self._defaults["CreateSourceWaveformSerial"]["return"] = 0 + self._defaults["CreateTimeSet"] = {} + self._defaults["CreateTimeSet"]["return"] = 0 + self._defaults["DeleteAllTimeSets"] = {} + self._defaults["DeleteAllTimeSets"]["return"] = 0 + self._defaults["DisableSites"] = {} + self._defaults["DisableSites"]["return"] = 0 + self._defaults["EnableSites"] = {} + self._defaults["EnableSites"]["return"] = 0 + self._defaults["FetchHistoryRAMCycleInformation"] = {} + self._defaults["FetchHistoryRAMCycleInformation"]["return"] = 0 + self._defaults["FetchHistoryRAMCycleInformation"]["patternIndex"] = None + self._defaults["FetchHistoryRAMCycleInformation"]["timeSetIndex"] = None + self._defaults["FetchHistoryRAMCycleInformation"]["vectorNumber"] = None + self._defaults["FetchHistoryRAMCycleInformation"]["cycleNumber"] = None + self._defaults["FetchHistoryRAMCycleInformation"]["numDutCycles"] = None + self._defaults["FetchHistoryRAMCyclePinData"] = {} + self._defaults["FetchHistoryRAMCyclePinData"]["return"] = 0 + self._defaults["FetchHistoryRAMCyclePinData"]["actualNumPinData"] = None + self._defaults["FetchHistoryRAMCyclePinData"]["expectedPinStates"] = None + self._defaults["FetchHistoryRAMCyclePinData"]["actualPinStates"] = None + self._defaults["FetchHistoryRAMCyclePinData"]["perPinPassFail"] = None + self._defaults["FetchHistoryRAMScanCycleNumber"] = {} + self._defaults["FetchHistoryRAMScanCycleNumber"]["return"] = 0 + self._defaults["FetchHistoryRAMScanCycleNumber"]["scanCycleNumber"] = None + self._defaults["FrequencyCounter_MeasureFrequency"] = {} + self._defaults["FrequencyCounter_MeasureFrequency"]["return"] = 0 + self._defaults["FrequencyCounter_MeasureFrequency"][ + "actualNumFrequencies" + ] = None + self._defaults["FrequencyCounter_MeasureFrequency"]["frequencies"] = None + self._defaults["GetAttributeViBoolean"] = {} + self._defaults["GetAttributeViBoolean"]["return"] = 0 + self._defaults["GetAttributeViBoolean"]["value"] = None + self._defaults["GetAttributeViInt32"] = {} + self._defaults["GetAttributeViInt32"]["return"] = 0 + self._defaults["GetAttributeViInt32"]["value"] = None + self._defaults["GetAttributeViInt64"] = {} + self._defaults["GetAttributeViInt64"]["return"] = 0 + self._defaults["GetAttributeViInt64"]["value"] = None + self._defaults["GetAttributeViReal64"] = {} + self._defaults["GetAttributeViReal64"]["return"] = 0 + self._defaults["GetAttributeViReal64"]["value"] = None + self._defaults["GetAttributeViString"] = {} + self._defaults["GetAttributeViString"]["return"] = 0 + self._defaults["GetAttributeViString"]["value"] = None + self._defaults["GetChannelNameFromString"] = {} + self._defaults["GetChannelNameFromString"]["return"] = 0 + self._defaults["GetChannelNameFromString"]["names"] = None + self._defaults["GetError"] = {} + self._defaults["GetError"]["return"] = 0 + self._defaults["GetError"]["errorCode"] = None + self._defaults["GetError"]["errorDescription"] = None + self._defaults["GetFailCount"] = {} + self._defaults["GetFailCount"]["return"] = 0 + self._defaults["GetFailCount"]["actualNumRead"] = None + self._defaults["GetFailCount"]["failureCount"] = None + self._defaults["GetHistoryRAMSampleCount"] = {} + self._defaults["GetHistoryRAMSampleCount"]["return"] = 0 + self._defaults["GetHistoryRAMSampleCount"]["sampleCount"] = None + self._defaults["GetPatternName"] = {} + self._defaults["GetPatternName"]["return"] = 0 + self._defaults["GetPatternName"]["name"] = None + self._defaults["GetPatternPinList"] = {} + self._defaults["GetPatternPinList"]["return"] = 0 + self._defaults["GetPatternPinList"]["pinList"] = None + self._defaults["GetPinName"] = {} + self._defaults["GetPinName"]["return"] = 0 + self._defaults["GetPinName"]["name"] = None + self._defaults["GetPinResultsPinInformation"] = {} + self._defaults["GetPinResultsPinInformation"]["return"] = 0 + self._defaults["GetPinResultsPinInformation"]["actualNumValues"] = None + self._defaults["GetPinResultsPinInformation"]["pinIndexes"] = None + self._defaults["GetPinResultsPinInformation"]["siteNumbers"] = None + self._defaults["GetPinResultsPinInformation"]["channelIndexes"] = None + self._defaults["GetSitePassFail"] = {} + self._defaults["GetSitePassFail"]["return"] = 0 + self._defaults["GetSitePassFail"]["actualNumSites"] = None + self._defaults["GetSitePassFail"]["passFail"] = None + self._defaults["GetSiteResultsSiteNumbers"] = {} + self._defaults["GetSiteResultsSiteNumbers"]["return"] = 0 + self._defaults["GetSiteResultsSiteNumbers"]["actualNumSiteNumbers"] = None + self._defaults["GetSiteResultsSiteNumbers"]["siteNumbers"] = None + self._defaults["GetTimeSetDriveFormat"] = {} + self._defaults["GetTimeSetDriveFormat"]["return"] = 0 + self._defaults["GetTimeSetDriveFormat"]["format"] = None + self._defaults["GetTimeSetEdge"] = {} + self._defaults["GetTimeSetEdge"]["return"] = 0 + self._defaults["GetTimeSetEdge"]["time"] = None + self._defaults["GetTimeSetEdgeMultiplier"] = {} + self._defaults["GetTimeSetEdgeMultiplier"]["return"] = 0 + self._defaults["GetTimeSetEdgeMultiplier"]["edgeMultiplier"] = None + self._defaults["GetTimeSetName"] = {} + self._defaults["GetTimeSetName"]["return"] = 0 + self._defaults["GetTimeSetName"]["name"] = None + self._defaults["GetTimeSetPeriod"] = {} + self._defaults["GetTimeSetPeriod"]["return"] = 0 + self._defaults["GetTimeSetPeriod"]["period"] = None + self._defaults["InitWithOptions"] = {} + self._defaults["InitWithOptions"]["return"] = 0 + self._defaults["InitWithOptions"]["newVi"] = None + self._defaults["Initiate"] = {} + self._defaults["Initiate"]["return"] = 0 + self._defaults["IsDone"] = {} + self._defaults["IsDone"]["return"] = 0 + self._defaults["IsDone"]["done"] = None + self._defaults["IsSiteEnabled"] = {} + self._defaults["IsSiteEnabled"]["return"] = 0 + self._defaults["IsSiteEnabled"]["enable"] = None + self._defaults["LoadLevels"] = {} + self._defaults["LoadLevels"]["return"] = 0 + self._defaults["LoadPattern"] = {} + self._defaults["LoadPattern"]["return"] = 0 + self._defaults["LoadPinMap"] = {} + self._defaults["LoadPinMap"]["return"] = 0 + self._defaults["LoadSpecifications"] = {} + self._defaults["LoadSpecifications"]["return"] = 0 + self._defaults["LoadTiming"] = {} + self._defaults["LoadTiming"]["return"] = 0 + self._defaults["LockSession"] = {} + self._defaults["LockSession"]["return"] = 0 + self._defaults["LockSession"]["callerHasLock"] = None + self._defaults["PPMU_Measure"] = {} + self._defaults["PPMU_Measure"]["return"] = 0 + self._defaults["PPMU_Measure"]["actualNumRead"] = None + self._defaults["PPMU_Measure"]["measurements"] = None + self._defaults["PPMU_Source"] = {} + self._defaults["PPMU_Source"]["return"] = 0 + self._defaults["ReadSequencerFlag"] = {} + self._defaults["ReadSequencerFlag"]["return"] = 0 + self._defaults["ReadSequencerFlag"]["value"] = None + self._defaults["ReadSequencerRegister"] = {} + self._defaults["ReadSequencerRegister"]["return"] = 0 + self._defaults["ReadSequencerRegister"]["value"] = None + self._defaults["ReadStatic"] = {} + self._defaults["ReadStatic"]["return"] = 0 + self._defaults["ReadStatic"]["actualNumRead"] = None + self._defaults["ReadStatic"]["data"] = None + self._defaults["ResetDevice"] = {} + self._defaults["ResetDevice"]["return"] = 0 + self._defaults["SelfCalibrate"] = {} + self._defaults["SelfCalibrate"]["return"] = 0 + self._defaults["SendSoftwareEdgeTrigger"] = {} + self._defaults["SendSoftwareEdgeTrigger"]["return"] = 0 + self._defaults["SetAttributeViBoolean"] = {} + self._defaults["SetAttributeViBoolean"]["return"] = 0 + self._defaults["SetAttributeViInt32"] = {} + self._defaults["SetAttributeViInt32"]["return"] = 0 + self._defaults["SetAttributeViInt64"] = {} + self._defaults["SetAttributeViInt64"]["return"] = 0 + self._defaults["SetAttributeViReal64"] = {} + self._defaults["SetAttributeViReal64"]["return"] = 0 + self._defaults["SetAttributeViString"] = {} + self._defaults["SetAttributeViString"]["return"] = 0 + self._defaults["TDR"] = {} + self._defaults["TDR"]["return"] = 0 + self._defaults["TDR"]["actualNumOffsets"] = None + self._defaults["TDR"]["offsets"] = None + self._defaults["UnloadAllPatterns"] = {} + self._defaults["UnloadAllPatterns"]["return"] = 0 + self._defaults["UnloadSpecifications"] = {} + self._defaults["UnloadSpecifications"]["return"] = 0 + self._defaults["UnlockSession"] = {} + self._defaults["UnlockSession"]["return"] = 0 + self._defaults["UnlockSession"]["callerHasLock"] = None + self._defaults["WaitUntilDone"] = {} + self._defaults["WaitUntilDone"]["return"] = 0 + self._defaults["WriteSequencerFlag"] = {} + self._defaults["WriteSequencerFlag"]["return"] = 0 + self._defaults["WriteSequencerRegister"] = {} + self._defaults["WriteSequencerRegister"]["return"] = 0 + self._defaults["WriteSourceWaveformBroadcastU32"] = {} + self._defaults["WriteSourceWaveformBroadcastU32"]["return"] = 0 + self._defaults["WriteSourceWaveformDataFromFileTDMS"] = {} + self._defaults["WriteSourceWaveformDataFromFileTDMS"]["return"] = 0 + self._defaults["WriteSourceWaveformSiteUniqueU32"] = {} + self._defaults["WriteSourceWaveformSiteUniqueU32"]["return"] = 0 + self._defaults["WriteStatic"] = {} + self._defaults["WriteStatic"]["return"] = 0 + self._defaults["close"] = {} + self._defaults["close"]["return"] = 0 + self._defaults["error_message"] = {} + self._defaults["error_message"]["return"] = 0 + self._defaults["error_message"]["errorMessage"] = None + self._defaults["reset"] = {} + self._defaults["reset"]["return"] = 0 + self._defaults["self_test"] = {} + self._defaults["self_test"]["return"] = 0 + self._defaults["self_test"]["testResult"] = None + self._defaults["self_test"]["testMessage"] = None def __getitem__(self, func): return self._defaults[func] @@ -261,989 +263,1492 @@ def __setitem__(self, func, val): self._defaults[func] = val def niDigital_Abort(self, vi): # noqa: N802 - if self._defaults['Abort']['return'] != 0: - return self._defaults['Abort']['return'] - return self._defaults['Abort']['return'] + if self._defaults["Abort"]["return"] != 0: + return self._defaults["Abort"]["return"] + return self._defaults["Abort"]["return"] def niDigital_AbortKeepAlive(self, vi): # noqa: N802 - if self._defaults['AbortKeepAlive']['return'] != 0: - return self._defaults['AbortKeepAlive']['return'] - return self._defaults['AbortKeepAlive']['return'] - - def niDigital_ApplyLevelsAndTiming(self, vi, site_list, levels_sheet, timing_sheet, initial_state_high_pins, initial_state_low_pins, initial_state_tristate_pins): # noqa: N802 - if self._defaults['ApplyLevelsAndTiming']['return'] != 0: - return self._defaults['ApplyLevelsAndTiming']['return'] - return self._defaults['ApplyLevelsAndTiming']['return'] - - def niDigital_ApplyTDROffsets(self, vi, channel_list, num_offsets, offsets): # noqa: N802 - if self._defaults['ApplyTDROffsets']['return'] != 0: - return self._defaults['ApplyTDROffsets']['return'] - return self._defaults['ApplyTDROffsets']['return'] - - def niDigital_BurstPattern(self, vi, site_list, start_label, select_digital_function, wait_until_done, timeout): # noqa: N802 - if self._defaults['BurstPattern']['return'] != 0: - return self._defaults['BurstPattern']['return'] - return self._defaults['BurstPattern']['return'] + if self._defaults["AbortKeepAlive"]["return"] != 0: + return self._defaults["AbortKeepAlive"]["return"] + return self._defaults["AbortKeepAlive"]["return"] + + def niDigital_ApplyLevelsAndTiming( + self, + vi, + site_list, + levels_sheet, + timing_sheet, + initial_state_high_pins, + initial_state_low_pins, + initial_state_tristate_pins, + ): # noqa: N802 + if self._defaults["ApplyLevelsAndTiming"]["return"] != 0: + return self._defaults["ApplyLevelsAndTiming"]["return"] + return self._defaults["ApplyLevelsAndTiming"]["return"] + + def niDigital_ApplyTDROffsets( + self, vi, channel_list, num_offsets, offsets + ): # noqa: N802 + if self._defaults["ApplyTDROffsets"]["return"] != 0: + return self._defaults["ApplyTDROffsets"]["return"] + return self._defaults["ApplyTDROffsets"]["return"] + + def niDigital_BurstPattern( + self, + vi, + site_list, + start_label, + select_digital_function, + wait_until_done, + timeout, + ): # noqa: N802 + if self._defaults["BurstPattern"]["return"] != 0: + return self._defaults["BurstPattern"]["return"] + return self._defaults["BurstPattern"]["return"] def niDigital_ClockGenerator_Abort(self, vi, channel_list): # noqa: N802 - if self._defaults['ClockGenerator_Abort']['return'] != 0: - return self._defaults['ClockGenerator_Abort']['return'] - return self._defaults['ClockGenerator_Abort']['return'] + if self._defaults["ClockGenerator_Abort"]["return"] != 0: + return self._defaults["ClockGenerator_Abort"]["return"] + return self._defaults["ClockGenerator_Abort"]["return"] - def niDigital_ClockGenerator_GenerateClock(self, vi, channel_list, frequency, select_digital_function): # noqa: N802 - if self._defaults['ClockGenerator_GenerateClock']['return'] != 0: - return self._defaults['ClockGenerator_GenerateClock']['return'] - return self._defaults['ClockGenerator_GenerateClock']['return'] + def niDigital_ClockGenerator_GenerateClock( + self, vi, channel_list, frequency, select_digital_function + ): # noqa: N802 + if self._defaults["ClockGenerator_GenerateClock"]["return"] != 0: + return self._defaults["ClockGenerator_GenerateClock"]["return"] + return self._defaults["ClockGenerator_GenerateClock"]["return"] def niDigital_Commit(self, vi): # noqa: N802 - if self._defaults['Commit']['return'] != 0: - return self._defaults['Commit']['return'] - return self._defaults['Commit']['return'] + if self._defaults["Commit"]["return"] != 0: + return self._defaults["Commit"]["return"] + return self._defaults["Commit"]["return"] - def niDigital_ConfigureActiveLoadLevels(self, vi, channel_list, iol, ioh, vcom): # noqa: N802 - if self._defaults['ConfigureActiveLoadLevels']['return'] != 0: - return self._defaults['ConfigureActiveLoadLevels']['return'] - return self._defaults['ConfigureActiveLoadLevels']['return'] + def niDigital_ConfigureActiveLoadLevels( + self, vi, channel_list, iol, ioh, vcom + ): # noqa: N802 + if self._defaults["ConfigureActiveLoadLevels"]["return"] != 0: + return self._defaults["ConfigureActiveLoadLevels"]["return"] + return self._defaults["ConfigureActiveLoadLevels"]["return"] def niDigital_ConfigurePatternBurstSites(self, vi, site_list): # noqa: N802 - if self._defaults['ConfigurePatternBurstSites']['return'] != 0: - return self._defaults['ConfigurePatternBurstSites']['return'] - return self._defaults['ConfigurePatternBurstSites']['return'] - - def niDigital_ConfigureTimeSetCompareEdgesStrobe(self, vi, pin_list, time_set_name, strobe_edge): # noqa: N802 - if self._defaults['ConfigureTimeSetCompareEdgesStrobe']['return'] != 0: - return self._defaults['ConfigureTimeSetCompareEdgesStrobe']['return'] - return self._defaults['ConfigureTimeSetCompareEdgesStrobe']['return'] - - def niDigital_ConfigureTimeSetCompareEdgesStrobe2x(self, vi, pin_list, time_set_name, strobe_edge, strobe2_edge): # noqa: N802 - if self._defaults['ConfigureTimeSetCompareEdgesStrobe2x']['return'] != 0: - return self._defaults['ConfigureTimeSetCompareEdgesStrobe2x']['return'] - return self._defaults['ConfigureTimeSetCompareEdgesStrobe2x']['return'] - - def niDigital_ConfigureTimeSetDriveEdges(self, vi, pin_list, time_set_name, format, drive_on_edge, drive_data_edge, drive_return_edge, drive_off_edge): # noqa: N802 - if self._defaults['ConfigureTimeSetDriveEdges']['return'] != 0: - return self._defaults['ConfigureTimeSetDriveEdges']['return'] - return self._defaults['ConfigureTimeSetDriveEdges']['return'] - - def niDigital_ConfigureTimeSetDriveEdges2x(self, vi, pin_list, time_set_name, format, drive_on_edge, drive_data_edge, drive_return_edge, drive_off_edge, drive_data2_edge, drive_return2_edge): # noqa: N802 - if self._defaults['ConfigureTimeSetDriveEdges2x']['return'] != 0: - return self._defaults['ConfigureTimeSetDriveEdges2x']['return'] - return self._defaults['ConfigureTimeSetDriveEdges2x']['return'] - - def niDigital_ConfigureTimeSetDriveFormat(self, vi, pin_list, time_set_name, drive_format): # noqa: N802 - if self._defaults['ConfigureTimeSetDriveFormat']['return'] != 0: - return self._defaults['ConfigureTimeSetDriveFormat']['return'] - return self._defaults['ConfigureTimeSetDriveFormat']['return'] - - def niDigital_ConfigureTimeSetEdge(self, vi, pin_list, time_set_name, edge, time): # noqa: N802 - if self._defaults['ConfigureTimeSetEdge']['return'] != 0: - return self._defaults['ConfigureTimeSetEdge']['return'] - return self._defaults['ConfigureTimeSetEdge']['return'] - - def niDigital_ConfigureTimeSetEdgeMultiplier(self, vi, pin_list, time_set_name, edge_multiplier): # noqa: N802 - if self._defaults['ConfigureTimeSetEdgeMultiplier']['return'] != 0: - return self._defaults['ConfigureTimeSetEdgeMultiplier']['return'] - return self._defaults['ConfigureTimeSetEdgeMultiplier']['return'] + if self._defaults["ConfigurePatternBurstSites"]["return"] != 0: + return self._defaults["ConfigurePatternBurstSites"]["return"] + return self._defaults["ConfigurePatternBurstSites"]["return"] + + def niDigital_ConfigureTimeSetCompareEdgesStrobe( + self, vi, pin_list, time_set_name, strobe_edge + ): # noqa: N802 + if self._defaults["ConfigureTimeSetCompareEdgesStrobe"]["return"] != 0: + return self._defaults["ConfigureTimeSetCompareEdgesStrobe"]["return"] + return self._defaults["ConfigureTimeSetCompareEdgesStrobe"]["return"] + + def niDigital_ConfigureTimeSetCompareEdgesStrobe2x( + self, vi, pin_list, time_set_name, strobe_edge, strobe2_edge + ): # noqa: N802 + if self._defaults["ConfigureTimeSetCompareEdgesStrobe2x"]["return"] != 0: + return self._defaults["ConfigureTimeSetCompareEdgesStrobe2x"]["return"] + return self._defaults["ConfigureTimeSetCompareEdgesStrobe2x"]["return"] + + def niDigital_ConfigureTimeSetDriveEdges( + self, + vi, + pin_list, + time_set_name, + format, + drive_on_edge, + drive_data_edge, + drive_return_edge, + drive_off_edge, + ): # noqa: N802 + if self._defaults["ConfigureTimeSetDriveEdges"]["return"] != 0: + return self._defaults["ConfigureTimeSetDriveEdges"]["return"] + return self._defaults["ConfigureTimeSetDriveEdges"]["return"] + + def niDigital_ConfigureTimeSetDriveEdges2x( + self, + vi, + pin_list, + time_set_name, + format, + drive_on_edge, + drive_data_edge, + drive_return_edge, + drive_off_edge, + drive_data2_edge, + drive_return2_edge, + ): # noqa: N802 + if self._defaults["ConfigureTimeSetDriveEdges2x"]["return"] != 0: + return self._defaults["ConfigureTimeSetDriveEdges2x"]["return"] + return self._defaults["ConfigureTimeSetDriveEdges2x"]["return"] + + def niDigital_ConfigureTimeSetDriveFormat( + self, vi, pin_list, time_set_name, drive_format + ): # noqa: N802 + if self._defaults["ConfigureTimeSetDriveFormat"]["return"] != 0: + return self._defaults["ConfigureTimeSetDriveFormat"]["return"] + return self._defaults["ConfigureTimeSetDriveFormat"]["return"] + + def niDigital_ConfigureTimeSetEdge( + self, vi, pin_list, time_set_name, edge, time + ): # noqa: N802 + if self._defaults["ConfigureTimeSetEdge"]["return"] != 0: + return self._defaults["ConfigureTimeSetEdge"]["return"] + return self._defaults["ConfigureTimeSetEdge"]["return"] + + def niDigital_ConfigureTimeSetEdgeMultiplier( + self, vi, pin_list, time_set_name, edge_multiplier + ): # noqa: N802 + if self._defaults["ConfigureTimeSetEdgeMultiplier"]["return"] != 0: + return self._defaults["ConfigureTimeSetEdgeMultiplier"]["return"] + return self._defaults["ConfigureTimeSetEdgeMultiplier"]["return"] def niDigital_ConfigureTimeSetPeriod(self, vi, time_set_name, period): # noqa: N802 - if self._defaults['ConfigureTimeSetPeriod']['return'] != 0: - return self._defaults['ConfigureTimeSetPeriod']['return'] - return self._defaults['ConfigureTimeSetPeriod']['return'] - - def niDigital_ConfigureVoltageLevels(self, vi, channel_list, vil, vih, vol, voh, vterm): # noqa: N802 - if self._defaults['ConfigureVoltageLevels']['return'] != 0: - return self._defaults['ConfigureVoltageLevels']['return'] - return self._defaults['ConfigureVoltageLevels']['return'] - - def niDigital_CreateCaptureWaveformFromFileDigicapture(self, vi, waveform_name, waveform_file_path): # noqa: N802 - if self._defaults['CreateCaptureWaveformFromFileDigicapture']['return'] != 0: - return self._defaults['CreateCaptureWaveformFromFileDigicapture']['return'] - return self._defaults['CreateCaptureWaveformFromFileDigicapture']['return'] - - def niDigital_CreateCaptureWaveformParallel(self, vi, pin_list, waveform_name): # noqa: N802 - if self._defaults['CreateCaptureWaveformParallel']['return'] != 0: - return self._defaults['CreateCaptureWaveformParallel']['return'] - return self._defaults['CreateCaptureWaveformParallel']['return'] - - def niDigital_CreateCaptureWaveformSerial(self, vi, pin_list, waveform_name, sample_width, bit_order): # noqa: N802 - if self._defaults['CreateCaptureWaveformSerial']['return'] != 0: - return self._defaults['CreateCaptureWaveformSerial']['return'] - return self._defaults['CreateCaptureWaveformSerial']['return'] - - def niDigital_CreateSourceWaveformFromFileTDMS(self, vi, waveform_name, waveform_file_path, write_waveform_data): # noqa: N802 - if self._defaults['CreateSourceWaveformFromFileTDMS']['return'] != 0: - return self._defaults['CreateSourceWaveformFromFileTDMS']['return'] - return self._defaults['CreateSourceWaveformFromFileTDMS']['return'] - - def niDigital_CreateSourceWaveformParallel(self, vi, pin_list, waveform_name, data_mapping): # noqa: N802 - if self._defaults['CreateSourceWaveformParallel']['return'] != 0: - return self._defaults['CreateSourceWaveformParallel']['return'] - return self._defaults['CreateSourceWaveformParallel']['return'] - - def niDigital_CreateSourceWaveformSerial(self, vi, pin_list, waveform_name, data_mapping, sample_width, bit_order): # noqa: N802 - if self._defaults['CreateSourceWaveformSerial']['return'] != 0: - return self._defaults['CreateSourceWaveformSerial']['return'] - return self._defaults['CreateSourceWaveformSerial']['return'] + if self._defaults["ConfigureTimeSetPeriod"]["return"] != 0: + return self._defaults["ConfigureTimeSetPeriod"]["return"] + return self._defaults["ConfigureTimeSetPeriod"]["return"] + + def niDigital_ConfigureVoltageLevels( + self, vi, channel_list, vil, vih, vol, voh, vterm + ): # noqa: N802 + if self._defaults["ConfigureVoltageLevels"]["return"] != 0: + return self._defaults["ConfigureVoltageLevels"]["return"] + return self._defaults["ConfigureVoltageLevels"]["return"] + + def niDigital_CreateCaptureWaveformFromFileDigicapture( + self, vi, waveform_name, waveform_file_path + ): # noqa: N802 + if self._defaults["CreateCaptureWaveformFromFileDigicapture"]["return"] != 0: + return self._defaults["CreateCaptureWaveformFromFileDigicapture"]["return"] + return self._defaults["CreateCaptureWaveformFromFileDigicapture"]["return"] + + def niDigital_CreateCaptureWaveformParallel( + self, vi, pin_list, waveform_name + ): # noqa: N802 + if self._defaults["CreateCaptureWaveformParallel"]["return"] != 0: + return self._defaults["CreateCaptureWaveformParallel"]["return"] + return self._defaults["CreateCaptureWaveformParallel"]["return"] + + def niDigital_CreateCaptureWaveformSerial( + self, vi, pin_list, waveform_name, sample_width, bit_order + ): # noqa: N802 + if self._defaults["CreateCaptureWaveformSerial"]["return"] != 0: + return self._defaults["CreateCaptureWaveformSerial"]["return"] + return self._defaults["CreateCaptureWaveformSerial"]["return"] + + def niDigital_CreateSourceWaveformFromFileTDMS( + self, vi, waveform_name, waveform_file_path, write_waveform_data + ): # noqa: N802 + if self._defaults["CreateSourceWaveformFromFileTDMS"]["return"] != 0: + return self._defaults["CreateSourceWaveformFromFileTDMS"]["return"] + return self._defaults["CreateSourceWaveformFromFileTDMS"]["return"] + + def niDigital_CreateSourceWaveformParallel( + self, vi, pin_list, waveform_name, data_mapping + ): # noqa: N802 + if self._defaults["CreateSourceWaveformParallel"]["return"] != 0: + return self._defaults["CreateSourceWaveformParallel"]["return"] + return self._defaults["CreateSourceWaveformParallel"]["return"] + + def niDigital_CreateSourceWaveformSerial( + self, vi, pin_list, waveform_name, data_mapping, sample_width, bit_order + ): # noqa: N802 + if self._defaults["CreateSourceWaveformSerial"]["return"] != 0: + return self._defaults["CreateSourceWaveformSerial"]["return"] + return self._defaults["CreateSourceWaveformSerial"]["return"] def niDigital_CreateTimeSet(self, vi, name): # noqa: N802 - if self._defaults['CreateTimeSet']['return'] != 0: - return self._defaults['CreateTimeSet']['return'] - return self._defaults['CreateTimeSet']['return'] + if self._defaults["CreateTimeSet"]["return"] != 0: + return self._defaults["CreateTimeSet"]["return"] + return self._defaults["CreateTimeSet"]["return"] def niDigital_DeleteAllTimeSets(self, vi): # noqa: N802 - if self._defaults['DeleteAllTimeSets']['return'] != 0: - return self._defaults['DeleteAllTimeSets']['return'] - return self._defaults['DeleteAllTimeSets']['return'] + if self._defaults["DeleteAllTimeSets"]["return"] != 0: + return self._defaults["DeleteAllTimeSets"]["return"] + return self._defaults["DeleteAllTimeSets"]["return"] def niDigital_DisableSites(self, vi, site_list): # noqa: N802 - if self._defaults['DisableSites']['return'] != 0: - return self._defaults['DisableSites']['return'] - return self._defaults['DisableSites']['return'] + if self._defaults["DisableSites"]["return"] != 0: + return self._defaults["DisableSites"]["return"] + return self._defaults["DisableSites"]["return"] def niDigital_EnableSites(self, vi, site_list): # noqa: N802 - if self._defaults['EnableSites']['return'] != 0: - return self._defaults['EnableSites']['return'] - return self._defaults['EnableSites']['return'] - - def niDigital_FetchHistoryRAMCycleInformation(self, vi, site, sample_index, pattern_index, time_set_index, vector_number, cycle_number, num_dut_cycles): # noqa: N802 - if self._defaults['FetchHistoryRAMCycleInformation']['return'] != 0: - return self._defaults['FetchHistoryRAMCycleInformation']['return'] + if self._defaults["EnableSites"]["return"] != 0: + return self._defaults["EnableSites"]["return"] + return self._defaults["EnableSites"]["return"] + + def niDigital_FetchHistoryRAMCycleInformation( + self, + vi, + site, + sample_index, + pattern_index, + time_set_index, + vector_number, + cycle_number, + num_dut_cycles, + ): # noqa: N802 + if self._defaults["FetchHistoryRAMCycleInformation"]["return"] != 0: + return self._defaults["FetchHistoryRAMCycleInformation"]["return"] # pattern_index - if self._defaults['FetchHistoryRAMCycleInformation']['patternIndex'] is None: - raise MockFunctionCallError("niDigital_FetchHistoryRAMCycleInformation", param='patternIndex') + if self._defaults["FetchHistoryRAMCycleInformation"]["patternIndex"] is None: + raise MockFunctionCallError( + "niDigital_FetchHistoryRAMCycleInformation", param="patternIndex" + ) if pattern_index is not None: - pattern_index.contents.value = self._defaults['FetchHistoryRAMCycleInformation']['patternIndex'] + pattern_index.contents.value = self._defaults[ + "FetchHistoryRAMCycleInformation" + ]["patternIndex"] # time_set_index - if self._defaults['FetchHistoryRAMCycleInformation']['timeSetIndex'] is None: - raise MockFunctionCallError("niDigital_FetchHistoryRAMCycleInformation", param='timeSetIndex') + if self._defaults["FetchHistoryRAMCycleInformation"]["timeSetIndex"] is None: + raise MockFunctionCallError( + "niDigital_FetchHistoryRAMCycleInformation", param="timeSetIndex" + ) if time_set_index is not None: - time_set_index.contents.value = self._defaults['FetchHistoryRAMCycleInformation']['timeSetIndex'] + time_set_index.contents.value = self._defaults[ + "FetchHistoryRAMCycleInformation" + ]["timeSetIndex"] # vector_number - if self._defaults['FetchHistoryRAMCycleInformation']['vectorNumber'] is None: - raise MockFunctionCallError("niDigital_FetchHistoryRAMCycleInformation", param='vectorNumber') + if self._defaults["FetchHistoryRAMCycleInformation"]["vectorNumber"] is None: + raise MockFunctionCallError( + "niDigital_FetchHistoryRAMCycleInformation", param="vectorNumber" + ) if vector_number is not None: - vector_number.contents.value = self._defaults['FetchHistoryRAMCycleInformation']['vectorNumber'] + vector_number.contents.value = self._defaults[ + "FetchHistoryRAMCycleInformation" + ]["vectorNumber"] # cycle_number - if self._defaults['FetchHistoryRAMCycleInformation']['cycleNumber'] is None: - raise MockFunctionCallError("niDigital_FetchHistoryRAMCycleInformation", param='cycleNumber') + if self._defaults["FetchHistoryRAMCycleInformation"]["cycleNumber"] is None: + raise MockFunctionCallError( + "niDigital_FetchHistoryRAMCycleInformation", param="cycleNumber" + ) if cycle_number is not None: - cycle_number.contents.value = self._defaults['FetchHistoryRAMCycleInformation']['cycleNumber'] + cycle_number.contents.value = self._defaults[ + "FetchHistoryRAMCycleInformation" + ]["cycleNumber"] # num_dut_cycles - if self._defaults['FetchHistoryRAMCycleInformation']['numDutCycles'] is None: - raise MockFunctionCallError("niDigital_FetchHistoryRAMCycleInformation", param='numDutCycles') + if self._defaults["FetchHistoryRAMCycleInformation"]["numDutCycles"] is None: + raise MockFunctionCallError( + "niDigital_FetchHistoryRAMCycleInformation", param="numDutCycles" + ) if num_dut_cycles is not None: - num_dut_cycles.contents.value = self._defaults['FetchHistoryRAMCycleInformation']['numDutCycles'] - return self._defaults['FetchHistoryRAMCycleInformation']['return'] - - def niDigital_FetchHistoryRAMCyclePinData(self, vi, site, pin_list, sample_index, dut_cycle_index, pin_data_buffer_size, expected_pin_states, actual_pin_states, per_pin_pass_fail, actual_num_pin_data): # noqa: N802 - if self._defaults['FetchHistoryRAMCyclePinData']['return'] != 0: - return self._defaults['FetchHistoryRAMCyclePinData']['return'] + num_dut_cycles.contents.value = self._defaults[ + "FetchHistoryRAMCycleInformation" + ]["numDutCycles"] + return self._defaults["FetchHistoryRAMCycleInformation"]["return"] + + def niDigital_FetchHistoryRAMCyclePinData( + self, + vi, + site, + pin_list, + sample_index, + dut_cycle_index, + pin_data_buffer_size, + expected_pin_states, + actual_pin_states, + per_pin_pass_fail, + actual_num_pin_data, + ): # noqa: N802 + if self._defaults["FetchHistoryRAMCyclePinData"]["return"] != 0: + return self._defaults["FetchHistoryRAMCyclePinData"]["return"] # actual_num_pin_data - if self._defaults['FetchHistoryRAMCyclePinData']['actualNumPinData'] is None: - raise MockFunctionCallError("niDigital_FetchHistoryRAMCyclePinData", param='actualNumPinData') + if self._defaults["FetchHistoryRAMCyclePinData"]["actualNumPinData"] is None: + raise MockFunctionCallError( + "niDigital_FetchHistoryRAMCyclePinData", param="actualNumPinData" + ) if actual_num_pin_data is not None: - actual_num_pin_data.contents.value = self._defaults['FetchHistoryRAMCyclePinData']['actualNumPinData'] - if self._defaults['FetchHistoryRAMCyclePinData']['expectedPinStates'] is None: - raise MockFunctionCallError("niDigital_FetchHistoryRAMCyclePinData", param='expectedPinStates') + actual_num_pin_data.contents.value = self._defaults[ + "FetchHistoryRAMCyclePinData" + ]["actualNumPinData"] + if self._defaults["FetchHistoryRAMCyclePinData"]["expectedPinStates"] is None: + raise MockFunctionCallError( + "niDigital_FetchHistoryRAMCyclePinData", param="expectedPinStates" + ) if pin_data_buffer_size.value == 0: - return len(self._defaults['FetchHistoryRAMCyclePinData']['expectedPinStates']) + return len( + self._defaults["FetchHistoryRAMCyclePinData"]["expectedPinStates"] + ) try: expected_pin_states_ref = expected_pin_states.contents except AttributeError: expected_pin_states_ref = expected_pin_states - for i in range(len(self._defaults['FetchHistoryRAMCyclePinData']['expectedPinStates'])): - expected_pin_states_ref[i] = self._defaults['FetchHistoryRAMCyclePinData']['expectedPinStates'][i] - if self._defaults['FetchHistoryRAMCyclePinData']['actualPinStates'] is None: - raise MockFunctionCallError("niDigital_FetchHistoryRAMCyclePinData", param='actualPinStates') + for i in range( + len(self._defaults["FetchHistoryRAMCyclePinData"]["expectedPinStates"]) + ): + expected_pin_states_ref[i] = self._defaults["FetchHistoryRAMCyclePinData"][ + "expectedPinStates" + ][i] + if self._defaults["FetchHistoryRAMCyclePinData"]["actualPinStates"] is None: + raise MockFunctionCallError( + "niDigital_FetchHistoryRAMCyclePinData", param="actualPinStates" + ) if pin_data_buffer_size.value == 0: - return len(self._defaults['FetchHistoryRAMCyclePinData']['actualPinStates']) + return len(self._defaults["FetchHistoryRAMCyclePinData"]["actualPinStates"]) try: actual_pin_states_ref = actual_pin_states.contents except AttributeError: actual_pin_states_ref = actual_pin_states - for i in range(len(self._defaults['FetchHistoryRAMCyclePinData']['actualPinStates'])): - actual_pin_states_ref[i] = self._defaults['FetchHistoryRAMCyclePinData']['actualPinStates'][i] - if self._defaults['FetchHistoryRAMCyclePinData']['perPinPassFail'] is None: - raise MockFunctionCallError("niDigital_FetchHistoryRAMCyclePinData", param='perPinPassFail') + for i in range( + len(self._defaults["FetchHistoryRAMCyclePinData"]["actualPinStates"]) + ): + actual_pin_states_ref[i] = self._defaults["FetchHistoryRAMCyclePinData"][ + "actualPinStates" + ][i] + if self._defaults["FetchHistoryRAMCyclePinData"]["perPinPassFail"] is None: + raise MockFunctionCallError( + "niDigital_FetchHistoryRAMCyclePinData", param="perPinPassFail" + ) if pin_data_buffer_size.value == 0: - return len(self._defaults['FetchHistoryRAMCyclePinData']['perPinPassFail']) + return len(self._defaults["FetchHistoryRAMCyclePinData"]["perPinPassFail"]) try: per_pin_pass_fail_ref = per_pin_pass_fail.contents except AttributeError: per_pin_pass_fail_ref = per_pin_pass_fail - for i in range(len(self._defaults['FetchHistoryRAMCyclePinData']['perPinPassFail'])): - per_pin_pass_fail_ref[i] = self._defaults['FetchHistoryRAMCyclePinData']['perPinPassFail'][i] - return self._defaults['FetchHistoryRAMCyclePinData']['return'] - - def niDigital_FetchHistoryRAMScanCycleNumber(self, vi, site, sample_index, scan_cycle_number): # noqa: N802 - if self._defaults['FetchHistoryRAMScanCycleNumber']['return'] != 0: - return self._defaults['FetchHistoryRAMScanCycleNumber']['return'] + for i in range( + len(self._defaults["FetchHistoryRAMCyclePinData"]["perPinPassFail"]) + ): + per_pin_pass_fail_ref[i] = self._defaults["FetchHistoryRAMCyclePinData"][ + "perPinPassFail" + ][i] + return self._defaults["FetchHistoryRAMCyclePinData"]["return"] + + def niDigital_FetchHistoryRAMScanCycleNumber( + self, vi, site, sample_index, scan_cycle_number + ): # noqa: N802 + if self._defaults["FetchHistoryRAMScanCycleNumber"]["return"] != 0: + return self._defaults["FetchHistoryRAMScanCycleNumber"]["return"] # scan_cycle_number - if self._defaults['FetchHistoryRAMScanCycleNumber']['scanCycleNumber'] is None: - raise MockFunctionCallError("niDigital_FetchHistoryRAMScanCycleNumber", param='scanCycleNumber') + if self._defaults["FetchHistoryRAMScanCycleNumber"]["scanCycleNumber"] is None: + raise MockFunctionCallError( + "niDigital_FetchHistoryRAMScanCycleNumber", param="scanCycleNumber" + ) if scan_cycle_number is not None: - scan_cycle_number.contents.value = self._defaults['FetchHistoryRAMScanCycleNumber']['scanCycleNumber'] - return self._defaults['FetchHistoryRAMScanCycleNumber']['return'] - - def niDigital_FrequencyCounter_MeasureFrequency(self, vi, channel_list, frequencies_buffer_size, frequencies, actual_num_frequencies): # noqa: N802 - if self._defaults['FrequencyCounter_MeasureFrequency']['return'] != 0: - return self._defaults['FrequencyCounter_MeasureFrequency']['return'] + scan_cycle_number.contents.value = self._defaults[ + "FetchHistoryRAMScanCycleNumber" + ]["scanCycleNumber"] + return self._defaults["FetchHistoryRAMScanCycleNumber"]["return"] + + def niDigital_FrequencyCounter_MeasureFrequency( + self, + vi, + channel_list, + frequencies_buffer_size, + frequencies, + actual_num_frequencies, + ): # noqa: N802 + if self._defaults["FrequencyCounter_MeasureFrequency"]["return"] != 0: + return self._defaults["FrequencyCounter_MeasureFrequency"]["return"] # actual_num_frequencies - if self._defaults['FrequencyCounter_MeasureFrequency']['actualNumFrequencies'] is None: - raise MockFunctionCallError("niDigital_FrequencyCounter_MeasureFrequency", param='actualNumFrequencies') + if ( + self._defaults["FrequencyCounter_MeasureFrequency"]["actualNumFrequencies"] + is None + ): + raise MockFunctionCallError( + "niDigital_FrequencyCounter_MeasureFrequency", + param="actualNumFrequencies", + ) if actual_num_frequencies is not None: - actual_num_frequencies.contents.value = self._defaults['FrequencyCounter_MeasureFrequency']['actualNumFrequencies'] - if self._defaults['FrequencyCounter_MeasureFrequency']['frequencies'] is None: - raise MockFunctionCallError("niDigital_FrequencyCounter_MeasureFrequency", param='frequencies') + actual_num_frequencies.contents.value = self._defaults[ + "FrequencyCounter_MeasureFrequency" + ]["actualNumFrequencies"] + if self._defaults["FrequencyCounter_MeasureFrequency"]["frequencies"] is None: + raise MockFunctionCallError( + "niDigital_FrequencyCounter_MeasureFrequency", param="frequencies" + ) if frequencies_buffer_size.value == 0: - return len(self._defaults['FrequencyCounter_MeasureFrequency']['frequencies']) + return len( + self._defaults["FrequencyCounter_MeasureFrequency"]["frequencies"] + ) try: frequencies_ref = frequencies.contents except AttributeError: frequencies_ref = frequencies - for i in range(len(self._defaults['FrequencyCounter_MeasureFrequency']['frequencies'])): - frequencies_ref[i] = self._defaults['FrequencyCounter_MeasureFrequency']['frequencies'][i] - return self._defaults['FrequencyCounter_MeasureFrequency']['return'] - - def niDigital_GetAttributeViBoolean(self, vi, channel_name, attribute, value): # noqa: N802 - if self._defaults['GetAttributeViBoolean']['return'] != 0: - return self._defaults['GetAttributeViBoolean']['return'] + for i in range( + len(self._defaults["FrequencyCounter_MeasureFrequency"]["frequencies"]) + ): + frequencies_ref[i] = self._defaults["FrequencyCounter_MeasureFrequency"][ + "frequencies" + ][i] + return self._defaults["FrequencyCounter_MeasureFrequency"]["return"] + + def niDigital_GetAttributeViBoolean( + self, vi, channel_name, attribute, value + ): # noqa: N802 + if self._defaults["GetAttributeViBoolean"]["return"] != 0: + return self._defaults["GetAttributeViBoolean"]["return"] # value - if self._defaults['GetAttributeViBoolean']['value'] is None: - raise MockFunctionCallError("niDigital_GetAttributeViBoolean", param='value') + if self._defaults["GetAttributeViBoolean"]["value"] is None: + raise MockFunctionCallError( + "niDigital_GetAttributeViBoolean", param="value" + ) if value is not None: - value.contents.value = self._defaults['GetAttributeViBoolean']['value'] - return self._defaults['GetAttributeViBoolean']['return'] - - def niDigital_GetAttributeViInt32(self, vi, channel_name, attribute, value): # noqa: N802 - if self._defaults['GetAttributeViInt32']['return'] != 0: - return self._defaults['GetAttributeViInt32']['return'] + value.contents.value = self._defaults["GetAttributeViBoolean"]["value"] + return self._defaults["GetAttributeViBoolean"]["return"] + + def niDigital_GetAttributeViInt32( + self, vi, channel_name, attribute, value + ): # noqa: N802 + if self._defaults["GetAttributeViInt32"]["return"] != 0: + return self._defaults["GetAttributeViInt32"]["return"] # value - if self._defaults['GetAttributeViInt32']['value'] is None: - raise MockFunctionCallError("niDigital_GetAttributeViInt32", param='value') + if self._defaults["GetAttributeViInt32"]["value"] is None: + raise MockFunctionCallError("niDigital_GetAttributeViInt32", param="value") if value is not None: - value.contents.value = self._defaults['GetAttributeViInt32']['value'] - return self._defaults['GetAttributeViInt32']['return'] - - def niDigital_GetAttributeViInt64(self, vi, channel_name, attribute, value): # noqa: N802 - if self._defaults['GetAttributeViInt64']['return'] != 0: - return self._defaults['GetAttributeViInt64']['return'] + value.contents.value = self._defaults["GetAttributeViInt32"]["value"] + return self._defaults["GetAttributeViInt32"]["return"] + + def niDigital_GetAttributeViInt64( + self, vi, channel_name, attribute, value + ): # noqa: N802 + if self._defaults["GetAttributeViInt64"]["return"] != 0: + return self._defaults["GetAttributeViInt64"]["return"] # value - if self._defaults['GetAttributeViInt64']['value'] is None: - raise MockFunctionCallError("niDigital_GetAttributeViInt64", param='value') + if self._defaults["GetAttributeViInt64"]["value"] is None: + raise MockFunctionCallError("niDigital_GetAttributeViInt64", param="value") if value is not None: - value.contents.value = self._defaults['GetAttributeViInt64']['value'] - return self._defaults['GetAttributeViInt64']['return'] - - def niDigital_GetAttributeViReal64(self, vi, channel_name, attribute, value): # noqa: N802 - if self._defaults['GetAttributeViReal64']['return'] != 0: - return self._defaults['GetAttributeViReal64']['return'] + value.contents.value = self._defaults["GetAttributeViInt64"]["value"] + return self._defaults["GetAttributeViInt64"]["return"] + + def niDigital_GetAttributeViReal64( + self, vi, channel_name, attribute, value + ): # noqa: N802 + if self._defaults["GetAttributeViReal64"]["return"] != 0: + return self._defaults["GetAttributeViReal64"]["return"] # value - if self._defaults['GetAttributeViReal64']['value'] is None: - raise MockFunctionCallError("niDigital_GetAttributeViReal64", param='value') + if self._defaults["GetAttributeViReal64"]["value"] is None: + raise MockFunctionCallError("niDigital_GetAttributeViReal64", param="value") if value is not None: - value.contents.value = self._defaults['GetAttributeViReal64']['value'] - return self._defaults['GetAttributeViReal64']['return'] - - def niDigital_GetAttributeViString(self, vi, channel_name, attribute, buffer_size, value): # noqa: N802 - if self._defaults['GetAttributeViString']['return'] != 0: - return self._defaults['GetAttributeViString']['return'] - if self._defaults['GetAttributeViString']['value'] is None: - raise MockFunctionCallError("niDigital_GetAttributeViString", param='value') + value.contents.value = self._defaults["GetAttributeViReal64"]["value"] + return self._defaults["GetAttributeViReal64"]["return"] + + def niDigital_GetAttributeViString( + self, vi, channel_name, attribute, buffer_size, value + ): # noqa: N802 + if self._defaults["GetAttributeViString"]["return"] != 0: + return self._defaults["GetAttributeViString"]["return"] + if self._defaults["GetAttributeViString"]["value"] is None: + raise MockFunctionCallError("niDigital_GetAttributeViString", param="value") if buffer_size.value == 0: - return len(self._defaults['GetAttributeViString']['value']) - value.value = self._defaults['GetAttributeViString']['value'].encode('ascii') - return self._defaults['GetAttributeViString']['return'] - - def niDigital_GetChannelNameFromString(self, vi, indices, name_buffer_size, names): # noqa: N802 - if self._defaults['GetChannelNameFromString']['return'] != 0: - return self._defaults['GetChannelNameFromString']['return'] - if self._defaults['GetChannelNameFromString']['names'] is None: - raise MockFunctionCallError("niDigital_GetChannelNameFromString", param='names') + return len(self._defaults["GetAttributeViString"]["value"]) + value.value = self._defaults["GetAttributeViString"]["value"].encode("ascii") + return self._defaults["GetAttributeViString"]["return"] + + def niDigital_GetChannelNameFromString( + self, vi, indices, name_buffer_size, names + ): # noqa: N802 + if self._defaults["GetChannelNameFromString"]["return"] != 0: + return self._defaults["GetChannelNameFromString"]["return"] + if self._defaults["GetChannelNameFromString"]["names"] is None: + raise MockFunctionCallError( + "niDigital_GetChannelNameFromString", param="names" + ) if name_buffer_size.value == 0: - return len(self._defaults['GetChannelNameFromString']['names']) - names.value = self._defaults['GetChannelNameFromString']['names'].encode('ascii') - return self._defaults['GetChannelNameFromString']['return'] - - def niDigital_GetError(self, vi, error_code, error_description_buffer_size, error_description): # noqa: N802 - if self._defaults['GetError']['return'] != 0: - return self._defaults['GetError']['return'] + return len(self._defaults["GetChannelNameFromString"]["names"]) + names.value = self._defaults["GetChannelNameFromString"]["names"].encode( + "ascii" + ) + return self._defaults["GetChannelNameFromString"]["return"] + + def niDigital_GetError( + self, vi, error_code, error_description_buffer_size, error_description + ): # noqa: N802 + if self._defaults["GetError"]["return"] != 0: + return self._defaults["GetError"]["return"] # error_code - if self._defaults['GetError']['errorCode'] is None: - raise MockFunctionCallError("niDigital_GetError", param='errorCode') + if self._defaults["GetError"]["errorCode"] is None: + raise MockFunctionCallError("niDigital_GetError", param="errorCode") if error_code is not None: - error_code.contents.value = self._defaults['GetError']['errorCode'] - if self._defaults['GetError']['errorDescription'] is None: - raise MockFunctionCallError("niDigital_GetError", param='errorDescription') + error_code.contents.value = self._defaults["GetError"]["errorCode"] + if self._defaults["GetError"]["errorDescription"] is None: + raise MockFunctionCallError("niDigital_GetError", param="errorDescription") if error_description_buffer_size.value == 0: - return len(self._defaults['GetError']['errorDescription']) - error_description.value = self._defaults['GetError']['errorDescription'].encode('ascii') - return self._defaults['GetError']['return'] - - def niDigital_GetFailCount(self, vi, channel_list, buffer_size, failure_count, actual_num_read): # noqa: N802 - if self._defaults['GetFailCount']['return'] != 0: - return self._defaults['GetFailCount']['return'] + return len(self._defaults["GetError"]["errorDescription"]) + error_description.value = self._defaults["GetError"]["errorDescription"].encode( + "ascii" + ) + return self._defaults["GetError"]["return"] + + def niDigital_GetFailCount( + self, vi, channel_list, buffer_size, failure_count, actual_num_read + ): # noqa: N802 + if self._defaults["GetFailCount"]["return"] != 0: + return self._defaults["GetFailCount"]["return"] # actual_num_read - if self._defaults['GetFailCount']['actualNumRead'] is None: - raise MockFunctionCallError("niDigital_GetFailCount", param='actualNumRead') + if self._defaults["GetFailCount"]["actualNumRead"] is None: + raise MockFunctionCallError("niDigital_GetFailCount", param="actualNumRead") if actual_num_read is not None: - actual_num_read.contents.value = self._defaults['GetFailCount']['actualNumRead'] - if self._defaults['GetFailCount']['failureCount'] is None: - raise MockFunctionCallError("niDigital_GetFailCount", param='failureCount') + actual_num_read.contents.value = self._defaults["GetFailCount"][ + "actualNumRead" + ] + if self._defaults["GetFailCount"]["failureCount"] is None: + raise MockFunctionCallError("niDigital_GetFailCount", param="failureCount") if buffer_size.value == 0: - return len(self._defaults['GetFailCount']['failureCount']) + return len(self._defaults["GetFailCount"]["failureCount"]) try: failure_count_ref = failure_count.contents except AttributeError: failure_count_ref = failure_count - for i in range(len(self._defaults['GetFailCount']['failureCount'])): - failure_count_ref[i] = self._defaults['GetFailCount']['failureCount'][i] - return self._defaults['GetFailCount']['return'] + for i in range(len(self._defaults["GetFailCount"]["failureCount"])): + failure_count_ref[i] = self._defaults["GetFailCount"]["failureCount"][i] + return self._defaults["GetFailCount"]["return"] def niDigital_GetHistoryRAMSampleCount(self, vi, site, sample_count): # noqa: N802 - if self._defaults['GetHistoryRAMSampleCount']['return'] != 0: - return self._defaults['GetHistoryRAMSampleCount']['return'] + if self._defaults["GetHistoryRAMSampleCount"]["return"] != 0: + return self._defaults["GetHistoryRAMSampleCount"]["return"] # sample_count - if self._defaults['GetHistoryRAMSampleCount']['sampleCount'] is None: - raise MockFunctionCallError("niDigital_GetHistoryRAMSampleCount", param='sampleCount') + if self._defaults["GetHistoryRAMSampleCount"]["sampleCount"] is None: + raise MockFunctionCallError( + "niDigital_GetHistoryRAMSampleCount", param="sampleCount" + ) if sample_count is not None: - sample_count.contents.value = self._defaults['GetHistoryRAMSampleCount']['sampleCount'] - return self._defaults['GetHistoryRAMSampleCount']['return'] - - def niDigital_GetPatternName(self, vi, pattern_index, name_buffer_size, name): # noqa: N802 - if self._defaults['GetPatternName']['return'] != 0: - return self._defaults['GetPatternName']['return'] - if self._defaults['GetPatternName']['name'] is None: - raise MockFunctionCallError("niDigital_GetPatternName", param='name') + sample_count.contents.value = self._defaults["GetHistoryRAMSampleCount"][ + "sampleCount" + ] + return self._defaults["GetHistoryRAMSampleCount"]["return"] + + def niDigital_GetPatternName( + self, vi, pattern_index, name_buffer_size, name + ): # noqa: N802 + if self._defaults["GetPatternName"]["return"] != 0: + return self._defaults["GetPatternName"]["return"] + if self._defaults["GetPatternName"]["name"] is None: + raise MockFunctionCallError("niDigital_GetPatternName", param="name") if name_buffer_size.value == 0: - return len(self._defaults['GetPatternName']['name']) - name.value = self._defaults['GetPatternName']['name'].encode('ascii') - return self._defaults['GetPatternName']['return'] - - def niDigital_GetPatternPinList(self, vi, start_label, pin_list_buffer_size, pin_list): # noqa: N802 - if self._defaults['GetPatternPinList']['return'] != 0: - return self._defaults['GetPatternPinList']['return'] - if self._defaults['GetPatternPinList']['pinList'] is None: - raise MockFunctionCallError("niDigital_GetPatternPinList", param='pinList') + return len(self._defaults["GetPatternName"]["name"]) + name.value = self._defaults["GetPatternName"]["name"].encode("ascii") + return self._defaults["GetPatternName"]["return"] + + def niDigital_GetPatternPinList( + self, vi, start_label, pin_list_buffer_size, pin_list + ): # noqa: N802 + if self._defaults["GetPatternPinList"]["return"] != 0: + return self._defaults["GetPatternPinList"]["return"] + if self._defaults["GetPatternPinList"]["pinList"] is None: + raise MockFunctionCallError("niDigital_GetPatternPinList", param="pinList") if pin_list_buffer_size.value == 0: - return len(self._defaults['GetPatternPinList']['pinList']) - pin_list.value = self._defaults['GetPatternPinList']['pinList'].encode('ascii') - return self._defaults['GetPatternPinList']['return'] + return len(self._defaults["GetPatternPinList"]["pinList"]) + pin_list.value = self._defaults["GetPatternPinList"]["pinList"].encode("ascii") + return self._defaults["GetPatternPinList"]["return"] def niDigital_GetPinName(self, vi, pin_index, name_buffer_size, name): # noqa: N802 - if self._defaults['GetPinName']['return'] != 0: - return self._defaults['GetPinName']['return'] - if self._defaults['GetPinName']['name'] is None: - raise MockFunctionCallError("niDigital_GetPinName", param='name') + if self._defaults["GetPinName"]["return"] != 0: + return self._defaults["GetPinName"]["return"] + if self._defaults["GetPinName"]["name"] is None: + raise MockFunctionCallError("niDigital_GetPinName", param="name") if name_buffer_size.value == 0: - return len(self._defaults['GetPinName']['name']) - name.value = self._defaults['GetPinName']['name'].encode('ascii') - return self._defaults['GetPinName']['return'] - - def niDigital_GetPinResultsPinInformation(self, vi, channel_list, buffer_size, pin_indexes, site_numbers, channel_indexes, actual_num_values): # noqa: N802 - if self._defaults['GetPinResultsPinInformation']['return'] != 0: - return self._defaults['GetPinResultsPinInformation']['return'] + return len(self._defaults["GetPinName"]["name"]) + name.value = self._defaults["GetPinName"]["name"].encode("ascii") + return self._defaults["GetPinName"]["return"] + + def niDigital_GetPinResultsPinInformation( + self, + vi, + channel_list, + buffer_size, + pin_indexes, + site_numbers, + channel_indexes, + actual_num_values, + ): # noqa: N802 + if self._defaults["GetPinResultsPinInformation"]["return"] != 0: + return self._defaults["GetPinResultsPinInformation"]["return"] # actual_num_values - if self._defaults['GetPinResultsPinInformation']['actualNumValues'] is None: - raise MockFunctionCallError("niDigital_GetPinResultsPinInformation", param='actualNumValues') + if self._defaults["GetPinResultsPinInformation"]["actualNumValues"] is None: + raise MockFunctionCallError( + "niDigital_GetPinResultsPinInformation", param="actualNumValues" + ) if actual_num_values is not None: - actual_num_values.contents.value = self._defaults['GetPinResultsPinInformation']['actualNumValues'] - if self._defaults['GetPinResultsPinInformation']['pinIndexes'] is None: - raise MockFunctionCallError("niDigital_GetPinResultsPinInformation", param='pinIndexes') + actual_num_values.contents.value = self._defaults[ + "GetPinResultsPinInformation" + ]["actualNumValues"] + if self._defaults["GetPinResultsPinInformation"]["pinIndexes"] is None: + raise MockFunctionCallError( + "niDigital_GetPinResultsPinInformation", param="pinIndexes" + ) if buffer_size.value == 0: - return len(self._defaults['GetPinResultsPinInformation']['pinIndexes']) + return len(self._defaults["GetPinResultsPinInformation"]["pinIndexes"]) try: pin_indexes_ref = pin_indexes.contents except AttributeError: pin_indexes_ref = pin_indexes - for i in range(len(self._defaults['GetPinResultsPinInformation']['pinIndexes'])): - pin_indexes_ref[i] = self._defaults['GetPinResultsPinInformation']['pinIndexes'][i] - if self._defaults['GetPinResultsPinInformation']['siteNumbers'] is None: - raise MockFunctionCallError("niDigital_GetPinResultsPinInformation", param='siteNumbers') + for i in range( + len(self._defaults["GetPinResultsPinInformation"]["pinIndexes"]) + ): + pin_indexes_ref[i] = self._defaults["GetPinResultsPinInformation"][ + "pinIndexes" + ][i] + if self._defaults["GetPinResultsPinInformation"]["siteNumbers"] is None: + raise MockFunctionCallError( + "niDigital_GetPinResultsPinInformation", param="siteNumbers" + ) if buffer_size.value == 0: - return len(self._defaults['GetPinResultsPinInformation']['siteNumbers']) + return len(self._defaults["GetPinResultsPinInformation"]["siteNumbers"]) try: site_numbers_ref = site_numbers.contents except AttributeError: site_numbers_ref = site_numbers - for i in range(len(self._defaults['GetPinResultsPinInformation']['siteNumbers'])): - site_numbers_ref[i] = self._defaults['GetPinResultsPinInformation']['siteNumbers'][i] - if self._defaults['GetPinResultsPinInformation']['channelIndexes'] is None: - raise MockFunctionCallError("niDigital_GetPinResultsPinInformation", param='channelIndexes') + for i in range( + len(self._defaults["GetPinResultsPinInformation"]["siteNumbers"]) + ): + site_numbers_ref[i] = self._defaults["GetPinResultsPinInformation"][ + "siteNumbers" + ][i] + if self._defaults["GetPinResultsPinInformation"]["channelIndexes"] is None: + raise MockFunctionCallError( + "niDigital_GetPinResultsPinInformation", param="channelIndexes" + ) if buffer_size.value == 0: - return len(self._defaults['GetPinResultsPinInformation']['channelIndexes']) + return len(self._defaults["GetPinResultsPinInformation"]["channelIndexes"]) try: channel_indexes_ref = channel_indexes.contents except AttributeError: channel_indexes_ref = channel_indexes - for i in range(len(self._defaults['GetPinResultsPinInformation']['channelIndexes'])): - channel_indexes_ref[i] = self._defaults['GetPinResultsPinInformation']['channelIndexes'][i] - return self._defaults['GetPinResultsPinInformation']['return'] - - def niDigital_GetSitePassFail(self, vi, site_list, pass_fail_buffer_size, pass_fail, actual_num_sites): # noqa: N802 - if self._defaults['GetSitePassFail']['return'] != 0: - return self._defaults['GetSitePassFail']['return'] + for i in range( + len(self._defaults["GetPinResultsPinInformation"]["channelIndexes"]) + ): + channel_indexes_ref[i] = self._defaults["GetPinResultsPinInformation"][ + "channelIndexes" + ][i] + return self._defaults["GetPinResultsPinInformation"]["return"] + + def niDigital_GetSitePassFail( + self, vi, site_list, pass_fail_buffer_size, pass_fail, actual_num_sites + ): # noqa: N802 + if self._defaults["GetSitePassFail"]["return"] != 0: + return self._defaults["GetSitePassFail"]["return"] # actual_num_sites - if self._defaults['GetSitePassFail']['actualNumSites'] is None: - raise MockFunctionCallError("niDigital_GetSitePassFail", param='actualNumSites') + if self._defaults["GetSitePassFail"]["actualNumSites"] is None: + raise MockFunctionCallError( + "niDigital_GetSitePassFail", param="actualNumSites" + ) if actual_num_sites is not None: - actual_num_sites.contents.value = self._defaults['GetSitePassFail']['actualNumSites'] - if self._defaults['GetSitePassFail']['passFail'] is None: - raise MockFunctionCallError("niDigital_GetSitePassFail", param='passFail') + actual_num_sites.contents.value = self._defaults["GetSitePassFail"][ + "actualNumSites" + ] + if self._defaults["GetSitePassFail"]["passFail"] is None: + raise MockFunctionCallError("niDigital_GetSitePassFail", param="passFail") if pass_fail_buffer_size.value == 0: - return len(self._defaults['GetSitePassFail']['passFail']) + return len(self._defaults["GetSitePassFail"]["passFail"]) try: pass_fail_ref = pass_fail.contents except AttributeError: pass_fail_ref = pass_fail - for i in range(len(self._defaults['GetSitePassFail']['passFail'])): - pass_fail_ref[i] = self._defaults['GetSitePassFail']['passFail'][i] - return self._defaults['GetSitePassFail']['return'] - - def niDigital_GetSiteResultsSiteNumbers(self, vi, site_list, site_result_type, site_numbers_buffer_size, site_numbers, actual_num_site_numbers): # noqa: N802 - if self._defaults['GetSiteResultsSiteNumbers']['return'] != 0: - return self._defaults['GetSiteResultsSiteNumbers']['return'] + for i in range(len(self._defaults["GetSitePassFail"]["passFail"])): + pass_fail_ref[i] = self._defaults["GetSitePassFail"]["passFail"][i] + return self._defaults["GetSitePassFail"]["return"] + + def niDigital_GetSiteResultsSiteNumbers( + self, + vi, + site_list, + site_result_type, + site_numbers_buffer_size, + site_numbers, + actual_num_site_numbers, + ): # noqa: N802 + if self._defaults["GetSiteResultsSiteNumbers"]["return"] != 0: + return self._defaults["GetSiteResultsSiteNumbers"]["return"] # actual_num_site_numbers - if self._defaults['GetSiteResultsSiteNumbers']['actualNumSiteNumbers'] is None: - raise MockFunctionCallError("niDigital_GetSiteResultsSiteNumbers", param='actualNumSiteNumbers') + if self._defaults["GetSiteResultsSiteNumbers"]["actualNumSiteNumbers"] is None: + raise MockFunctionCallError( + "niDigital_GetSiteResultsSiteNumbers", param="actualNumSiteNumbers" + ) if actual_num_site_numbers is not None: - actual_num_site_numbers.contents.value = self._defaults['GetSiteResultsSiteNumbers']['actualNumSiteNumbers'] - if self._defaults['GetSiteResultsSiteNumbers']['siteNumbers'] is None: - raise MockFunctionCallError("niDigital_GetSiteResultsSiteNumbers", param='siteNumbers') + actual_num_site_numbers.contents.value = self._defaults[ + "GetSiteResultsSiteNumbers" + ]["actualNumSiteNumbers"] + if self._defaults["GetSiteResultsSiteNumbers"]["siteNumbers"] is None: + raise MockFunctionCallError( + "niDigital_GetSiteResultsSiteNumbers", param="siteNumbers" + ) if site_numbers_buffer_size.value == 0: - return len(self._defaults['GetSiteResultsSiteNumbers']['siteNumbers']) + return len(self._defaults["GetSiteResultsSiteNumbers"]["siteNumbers"]) try: site_numbers_ref = site_numbers.contents except AttributeError: site_numbers_ref = site_numbers - for i in range(len(self._defaults['GetSiteResultsSiteNumbers']['siteNumbers'])): - site_numbers_ref[i] = self._defaults['GetSiteResultsSiteNumbers']['siteNumbers'][i] - return self._defaults['GetSiteResultsSiteNumbers']['return'] - - def niDigital_GetTimeSetDriveFormat(self, vi, pin, time_set_name, format): # noqa: N802 - if self._defaults['GetTimeSetDriveFormat']['return'] != 0: - return self._defaults['GetTimeSetDriveFormat']['return'] + for i in range(len(self._defaults["GetSiteResultsSiteNumbers"]["siteNumbers"])): + site_numbers_ref[i] = self._defaults["GetSiteResultsSiteNumbers"][ + "siteNumbers" + ][i] + return self._defaults["GetSiteResultsSiteNumbers"]["return"] + + def niDigital_GetTimeSetDriveFormat( + self, vi, pin, time_set_name, format + ): # noqa: N802 + if self._defaults["GetTimeSetDriveFormat"]["return"] != 0: + return self._defaults["GetTimeSetDriveFormat"]["return"] # format - if self._defaults['GetTimeSetDriveFormat']['format'] is None: - raise MockFunctionCallError("niDigital_GetTimeSetDriveFormat", param='format') + if self._defaults["GetTimeSetDriveFormat"]["format"] is None: + raise MockFunctionCallError( + "niDigital_GetTimeSetDriveFormat", param="format" + ) if format is not None: - format.contents.value = self._defaults['GetTimeSetDriveFormat']['format'] - return self._defaults['GetTimeSetDriveFormat']['return'] - - def niDigital_GetTimeSetEdge(self, vi, pin, time_set_name, edge, time): # noqa: N802 - if self._defaults['GetTimeSetEdge']['return'] != 0: - return self._defaults['GetTimeSetEdge']['return'] + format.contents.value = self._defaults["GetTimeSetDriveFormat"]["format"] + return self._defaults["GetTimeSetDriveFormat"]["return"] + + def niDigital_GetTimeSetEdge( + self, vi, pin, time_set_name, edge, time + ): # noqa: N802 + if self._defaults["GetTimeSetEdge"]["return"] != 0: + return self._defaults["GetTimeSetEdge"]["return"] # time - if self._defaults['GetTimeSetEdge']['time'] is None: - raise MockFunctionCallError("niDigital_GetTimeSetEdge", param='time') + if self._defaults["GetTimeSetEdge"]["time"] is None: + raise MockFunctionCallError("niDigital_GetTimeSetEdge", param="time") if time is not None: - time.contents.value = self._defaults['GetTimeSetEdge']['time'] - return self._defaults['GetTimeSetEdge']['return'] - - def niDigital_GetTimeSetEdgeMultiplier(self, vi, pin, time_set_name, edge_multiplier): # noqa: N802 - if self._defaults['GetTimeSetEdgeMultiplier']['return'] != 0: - return self._defaults['GetTimeSetEdgeMultiplier']['return'] + time.contents.value = self._defaults["GetTimeSetEdge"]["time"] + return self._defaults["GetTimeSetEdge"]["return"] + + def niDigital_GetTimeSetEdgeMultiplier( + self, vi, pin, time_set_name, edge_multiplier + ): # noqa: N802 + if self._defaults["GetTimeSetEdgeMultiplier"]["return"] != 0: + return self._defaults["GetTimeSetEdgeMultiplier"]["return"] # edge_multiplier - if self._defaults['GetTimeSetEdgeMultiplier']['edgeMultiplier'] is None: - raise MockFunctionCallError("niDigital_GetTimeSetEdgeMultiplier", param='edgeMultiplier') + if self._defaults["GetTimeSetEdgeMultiplier"]["edgeMultiplier"] is None: + raise MockFunctionCallError( + "niDigital_GetTimeSetEdgeMultiplier", param="edgeMultiplier" + ) if edge_multiplier is not None: - edge_multiplier.contents.value = self._defaults['GetTimeSetEdgeMultiplier']['edgeMultiplier'] - return self._defaults['GetTimeSetEdgeMultiplier']['return'] - - def niDigital_GetTimeSetName(self, vi, time_set_index, name_buffer_size, name): # noqa: N802 - if self._defaults['GetTimeSetName']['return'] != 0: - return self._defaults['GetTimeSetName']['return'] - if self._defaults['GetTimeSetName']['name'] is None: - raise MockFunctionCallError("niDigital_GetTimeSetName", param='name') + edge_multiplier.contents.value = self._defaults["GetTimeSetEdgeMultiplier"][ + "edgeMultiplier" + ] + return self._defaults["GetTimeSetEdgeMultiplier"]["return"] + + def niDigital_GetTimeSetName( + self, vi, time_set_index, name_buffer_size, name + ): # noqa: N802 + if self._defaults["GetTimeSetName"]["return"] != 0: + return self._defaults["GetTimeSetName"]["return"] + if self._defaults["GetTimeSetName"]["name"] is None: + raise MockFunctionCallError("niDigital_GetTimeSetName", param="name") if name_buffer_size.value == 0: - return len(self._defaults['GetTimeSetName']['name']) - name.value = self._defaults['GetTimeSetName']['name'].encode('ascii') - return self._defaults['GetTimeSetName']['return'] + return len(self._defaults["GetTimeSetName"]["name"]) + name.value = self._defaults["GetTimeSetName"]["name"].encode("ascii") + return self._defaults["GetTimeSetName"]["return"] def niDigital_GetTimeSetPeriod(self, vi, time_set_name, period): # noqa: N802 - if self._defaults['GetTimeSetPeriod']['return'] != 0: - return self._defaults['GetTimeSetPeriod']['return'] + if self._defaults["GetTimeSetPeriod"]["return"] != 0: + return self._defaults["GetTimeSetPeriod"]["return"] # period - if self._defaults['GetTimeSetPeriod']['period'] is None: - raise MockFunctionCallError("niDigital_GetTimeSetPeriod", param='period') + if self._defaults["GetTimeSetPeriod"]["period"] is None: + raise MockFunctionCallError("niDigital_GetTimeSetPeriod", param="period") if period is not None: - period.contents.value = self._defaults['GetTimeSetPeriod']['period'] - return self._defaults['GetTimeSetPeriod']['return'] - - def niDigital_InitWithOptions(self, resource_name, id_query, reset_device, option_string, new_vi): # noqa: N802 - if self._defaults['InitWithOptions']['return'] != 0: - return self._defaults['InitWithOptions']['return'] + period.contents.value = self._defaults["GetTimeSetPeriod"]["period"] + return self._defaults["GetTimeSetPeriod"]["return"] + + def niDigital_InitWithOptions( + self, resource_name, id_query, reset_device, option_string, new_vi + ): # noqa: N802 + if self._defaults["InitWithOptions"]["return"] != 0: + return self._defaults["InitWithOptions"]["return"] # new_vi - if self._defaults['InitWithOptions']['newVi'] is None: - raise MockFunctionCallError("niDigital_InitWithOptions", param='newVi') + if self._defaults["InitWithOptions"]["newVi"] is None: + raise MockFunctionCallError("niDigital_InitWithOptions", param="newVi") if new_vi is not None: - new_vi.contents.value = self._defaults['InitWithOptions']['newVi'] - return self._defaults['InitWithOptions']['return'] + new_vi.contents.value = self._defaults["InitWithOptions"]["newVi"] + return self._defaults["InitWithOptions"]["return"] def niDigital_Initiate(self, vi): # noqa: N802 - if self._defaults['Initiate']['return'] != 0: - return self._defaults['Initiate']['return'] - return self._defaults['Initiate']['return'] + if self._defaults["Initiate"]["return"] != 0: + return self._defaults["Initiate"]["return"] + return self._defaults["Initiate"]["return"] def niDigital_IsDone(self, vi, done): # noqa: N802 - if self._defaults['IsDone']['return'] != 0: - return self._defaults['IsDone']['return'] + if self._defaults["IsDone"]["return"] != 0: + return self._defaults["IsDone"]["return"] # done - if self._defaults['IsDone']['done'] is None: - raise MockFunctionCallError("niDigital_IsDone", param='done') + if self._defaults["IsDone"]["done"] is None: + raise MockFunctionCallError("niDigital_IsDone", param="done") if done is not None: - done.contents.value = self._defaults['IsDone']['done'] - return self._defaults['IsDone']['return'] + done.contents.value = self._defaults["IsDone"]["done"] + return self._defaults["IsDone"]["return"] def niDigital_IsSiteEnabled(self, vi, site, enable): # noqa: N802 - if self._defaults['IsSiteEnabled']['return'] != 0: - return self._defaults['IsSiteEnabled']['return'] + if self._defaults["IsSiteEnabled"]["return"] != 0: + return self._defaults["IsSiteEnabled"]["return"] # enable - if self._defaults['IsSiteEnabled']['enable'] is None: - raise MockFunctionCallError("niDigital_IsSiteEnabled", param='enable') + if self._defaults["IsSiteEnabled"]["enable"] is None: + raise MockFunctionCallError("niDigital_IsSiteEnabled", param="enable") if enable is not None: - enable.contents.value = self._defaults['IsSiteEnabled']['enable'] - return self._defaults['IsSiteEnabled']['return'] + enable.contents.value = self._defaults["IsSiteEnabled"]["enable"] + return self._defaults["IsSiteEnabled"]["return"] def niDigital_LoadLevels(self, vi, file_path): # noqa: N802 - if self._defaults['LoadLevels']['return'] != 0: - return self._defaults['LoadLevels']['return'] - return self._defaults['LoadLevels']['return'] + if self._defaults["LoadLevels"]["return"] != 0: + return self._defaults["LoadLevels"]["return"] + return self._defaults["LoadLevels"]["return"] def niDigital_LoadPattern(self, vi, file_path): # noqa: N802 - if self._defaults['LoadPattern']['return'] != 0: - return self._defaults['LoadPattern']['return'] - return self._defaults['LoadPattern']['return'] + if self._defaults["LoadPattern"]["return"] != 0: + return self._defaults["LoadPattern"]["return"] + return self._defaults["LoadPattern"]["return"] def niDigital_LoadPinMap(self, vi, file_path): # noqa: N802 - if self._defaults['LoadPinMap']['return'] != 0: - return self._defaults['LoadPinMap']['return'] - return self._defaults['LoadPinMap']['return'] + if self._defaults["LoadPinMap"]["return"] != 0: + return self._defaults["LoadPinMap"]["return"] + return self._defaults["LoadPinMap"]["return"] def niDigital_LoadSpecifications(self, vi, file_path): # noqa: N802 - if self._defaults['LoadSpecifications']['return'] != 0: - return self._defaults['LoadSpecifications']['return'] - return self._defaults['LoadSpecifications']['return'] + if self._defaults["LoadSpecifications"]["return"] != 0: + return self._defaults["LoadSpecifications"]["return"] + return self._defaults["LoadSpecifications"]["return"] def niDigital_LoadTiming(self, vi, file_path): # noqa: N802 - if self._defaults['LoadTiming']['return'] != 0: - return self._defaults['LoadTiming']['return'] - return self._defaults['LoadTiming']['return'] + if self._defaults["LoadTiming"]["return"] != 0: + return self._defaults["LoadTiming"]["return"] + return self._defaults["LoadTiming"]["return"] def niDigital_LockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults['LockSession']['return'] != 0: - return self._defaults['LockSession']['return'] + if self._defaults["LockSession"]["return"] != 0: + return self._defaults["LockSession"]["return"] # caller_has_lock - if self._defaults['LockSession']['callerHasLock'] is None: - raise MockFunctionCallError("niDigital_LockSession", param='callerHasLock') + if self._defaults["LockSession"]["callerHasLock"] is None: + raise MockFunctionCallError("niDigital_LockSession", param="callerHasLock") if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults['LockSession']['callerHasLock'] - return self._defaults['LockSession']['return'] - - def niDigital_PPMU_Measure(self, vi, channel_list, measurement_type, buffer_size, measurements, actual_num_read): # noqa: N802 - if self._defaults['PPMU_Measure']['return'] != 0: - return self._defaults['PPMU_Measure']['return'] + caller_has_lock.contents.value = self._defaults["LockSession"][ + "callerHasLock" + ] + return self._defaults["LockSession"]["return"] + + def niDigital_PPMU_Measure( + self, + vi, + channel_list, + measurement_type, + buffer_size, + measurements, + actual_num_read, + ): # noqa: N802 + if self._defaults["PPMU_Measure"]["return"] != 0: + return self._defaults["PPMU_Measure"]["return"] # actual_num_read - if self._defaults['PPMU_Measure']['actualNumRead'] is None: - raise MockFunctionCallError("niDigital_PPMU_Measure", param='actualNumRead') + if self._defaults["PPMU_Measure"]["actualNumRead"] is None: + raise MockFunctionCallError("niDigital_PPMU_Measure", param="actualNumRead") if actual_num_read is not None: - actual_num_read.contents.value = self._defaults['PPMU_Measure']['actualNumRead'] - if self._defaults['PPMU_Measure']['measurements'] is None: - raise MockFunctionCallError("niDigital_PPMU_Measure", param='measurements') + actual_num_read.contents.value = self._defaults["PPMU_Measure"][ + "actualNumRead" + ] + if self._defaults["PPMU_Measure"]["measurements"] is None: + raise MockFunctionCallError("niDigital_PPMU_Measure", param="measurements") if buffer_size.value == 0: - return len(self._defaults['PPMU_Measure']['measurements']) + return len(self._defaults["PPMU_Measure"]["measurements"]) try: measurements_ref = measurements.contents except AttributeError: measurements_ref = measurements - for i in range(len(self._defaults['PPMU_Measure']['measurements'])): - measurements_ref[i] = self._defaults['PPMU_Measure']['measurements'][i] - return self._defaults['PPMU_Measure']['return'] + for i in range(len(self._defaults["PPMU_Measure"]["measurements"])): + measurements_ref[i] = self._defaults["PPMU_Measure"]["measurements"][i] + return self._defaults["PPMU_Measure"]["return"] def niDigital_PPMU_Source(self, vi, channel_list): # noqa: N802 - if self._defaults['PPMU_Source']['return'] != 0: - return self._defaults['PPMU_Source']['return'] - return self._defaults['PPMU_Source']['return'] + if self._defaults["PPMU_Source"]["return"] != 0: + return self._defaults["PPMU_Source"]["return"] + return self._defaults["PPMU_Source"]["return"] def niDigital_ReadSequencerFlag(self, vi, flag, value): # noqa: N802 - if self._defaults['ReadSequencerFlag']['return'] != 0: - return self._defaults['ReadSequencerFlag']['return'] + if self._defaults["ReadSequencerFlag"]["return"] != 0: + return self._defaults["ReadSequencerFlag"]["return"] # value - if self._defaults['ReadSequencerFlag']['value'] is None: - raise MockFunctionCallError("niDigital_ReadSequencerFlag", param='value') + if self._defaults["ReadSequencerFlag"]["value"] is None: + raise MockFunctionCallError("niDigital_ReadSequencerFlag", param="value") if value is not None: - value.contents.value = self._defaults['ReadSequencerFlag']['value'] - return self._defaults['ReadSequencerFlag']['return'] + value.contents.value = self._defaults["ReadSequencerFlag"]["value"] + return self._defaults["ReadSequencerFlag"]["return"] def niDigital_ReadSequencerRegister(self, vi, reg, value): # noqa: N802 - if self._defaults['ReadSequencerRegister']['return'] != 0: - return self._defaults['ReadSequencerRegister']['return'] + if self._defaults["ReadSequencerRegister"]["return"] != 0: + return self._defaults["ReadSequencerRegister"]["return"] # value - if self._defaults['ReadSequencerRegister']['value'] is None: - raise MockFunctionCallError("niDigital_ReadSequencerRegister", param='value') + if self._defaults["ReadSequencerRegister"]["value"] is None: + raise MockFunctionCallError( + "niDigital_ReadSequencerRegister", param="value" + ) if value is not None: - value.contents.value = self._defaults['ReadSequencerRegister']['value'] - return self._defaults['ReadSequencerRegister']['return'] - - def niDigital_ReadStatic(self, vi, channel_list, buffer_size, data, actual_num_read): # noqa: N802 - if self._defaults['ReadStatic']['return'] != 0: - return self._defaults['ReadStatic']['return'] + value.contents.value = self._defaults["ReadSequencerRegister"]["value"] + return self._defaults["ReadSequencerRegister"]["return"] + + def niDigital_ReadStatic( + self, vi, channel_list, buffer_size, data, actual_num_read + ): # noqa: N802 + if self._defaults["ReadStatic"]["return"] != 0: + return self._defaults["ReadStatic"]["return"] # actual_num_read - if self._defaults['ReadStatic']['actualNumRead'] is None: - raise MockFunctionCallError("niDigital_ReadStatic", param='actualNumRead') + if self._defaults["ReadStatic"]["actualNumRead"] is None: + raise MockFunctionCallError("niDigital_ReadStatic", param="actualNumRead") if actual_num_read is not None: - actual_num_read.contents.value = self._defaults['ReadStatic']['actualNumRead'] - if self._defaults['ReadStatic']['data'] is None: - raise MockFunctionCallError("niDigital_ReadStatic", param='data') + actual_num_read.contents.value = self._defaults["ReadStatic"][ + "actualNumRead" + ] + if self._defaults["ReadStatic"]["data"] is None: + raise MockFunctionCallError("niDigital_ReadStatic", param="data") if buffer_size.value == 0: - return len(self._defaults['ReadStatic']['data']) + return len(self._defaults["ReadStatic"]["data"]) try: data_ref = data.contents except AttributeError: data_ref = data - for i in range(len(self._defaults['ReadStatic']['data'])): - data_ref[i] = self._defaults['ReadStatic']['data'][i] - return self._defaults['ReadStatic']['return'] + for i in range(len(self._defaults["ReadStatic"]["data"])): + data_ref[i] = self._defaults["ReadStatic"]["data"][i] + return self._defaults["ReadStatic"]["return"] def niDigital_ResetDevice(self, vi): # noqa: N802 - if self._defaults['ResetDevice']['return'] != 0: - return self._defaults['ResetDevice']['return'] - return self._defaults['ResetDevice']['return'] + if self._defaults["ResetDevice"]["return"] != 0: + return self._defaults["ResetDevice"]["return"] + return self._defaults["ResetDevice"]["return"] def niDigital_SelfCalibrate(self, vi): # noqa: N802 - if self._defaults['SelfCalibrate']['return'] != 0: - return self._defaults['SelfCalibrate']['return'] - return self._defaults['SelfCalibrate']['return'] - - def niDigital_SendSoftwareEdgeTrigger(self, vi, trigger, trigger_identifier): # noqa: N802 - if self._defaults['SendSoftwareEdgeTrigger']['return'] != 0: - return self._defaults['SendSoftwareEdgeTrigger']['return'] - return self._defaults['SendSoftwareEdgeTrigger']['return'] - - def niDigital_SetAttributeViBoolean(self, vi, channel_name, attribute, value): # noqa: N802 - if self._defaults['SetAttributeViBoolean']['return'] != 0: - return self._defaults['SetAttributeViBoolean']['return'] - return self._defaults['SetAttributeViBoolean']['return'] - - def niDigital_SetAttributeViInt32(self, vi, channel_name, attribute, value): # noqa: N802 - if self._defaults['SetAttributeViInt32']['return'] != 0: - return self._defaults['SetAttributeViInt32']['return'] - return self._defaults['SetAttributeViInt32']['return'] - - def niDigital_SetAttributeViInt64(self, vi, channel_name, attribute, value): # noqa: N802 - if self._defaults['SetAttributeViInt64']['return'] != 0: - return self._defaults['SetAttributeViInt64']['return'] - return self._defaults['SetAttributeViInt64']['return'] - - def niDigital_SetAttributeViReal64(self, vi, channel_name, attribute, value): # noqa: N802 - if self._defaults['SetAttributeViReal64']['return'] != 0: - return self._defaults['SetAttributeViReal64']['return'] - return self._defaults['SetAttributeViReal64']['return'] - - def niDigital_SetAttributeViString(self, vi, channel_name, attribute, value): # noqa: N802 - if self._defaults['SetAttributeViString']['return'] != 0: - return self._defaults['SetAttributeViString']['return'] - return self._defaults['SetAttributeViString']['return'] - - def niDigital_TDR(self, vi, channel_list, apply_offsets, offsets_buffer_size, offsets, actual_num_offsets): # noqa: N802 - if self._defaults['TDR']['return'] != 0: - return self._defaults['TDR']['return'] + if self._defaults["SelfCalibrate"]["return"] != 0: + return self._defaults["SelfCalibrate"]["return"] + return self._defaults["SelfCalibrate"]["return"] + + def niDigital_SendSoftwareEdgeTrigger( + self, vi, trigger, trigger_identifier + ): # noqa: N802 + if self._defaults["SendSoftwareEdgeTrigger"]["return"] != 0: + return self._defaults["SendSoftwareEdgeTrigger"]["return"] + return self._defaults["SendSoftwareEdgeTrigger"]["return"] + + def niDigital_SetAttributeViBoolean( + self, vi, channel_name, attribute, value + ): # noqa: N802 + if self._defaults["SetAttributeViBoolean"]["return"] != 0: + return self._defaults["SetAttributeViBoolean"]["return"] + return self._defaults["SetAttributeViBoolean"]["return"] + + def niDigital_SetAttributeViInt32( + self, vi, channel_name, attribute, value + ): # noqa: N802 + if self._defaults["SetAttributeViInt32"]["return"] != 0: + return self._defaults["SetAttributeViInt32"]["return"] + return self._defaults["SetAttributeViInt32"]["return"] + + def niDigital_SetAttributeViInt64( + self, vi, channel_name, attribute, value + ): # noqa: N802 + if self._defaults["SetAttributeViInt64"]["return"] != 0: + return self._defaults["SetAttributeViInt64"]["return"] + return self._defaults["SetAttributeViInt64"]["return"] + + def niDigital_SetAttributeViReal64( + self, vi, channel_name, attribute, value + ): # noqa: N802 + if self._defaults["SetAttributeViReal64"]["return"] != 0: + return self._defaults["SetAttributeViReal64"]["return"] + return self._defaults["SetAttributeViReal64"]["return"] + + def niDigital_SetAttributeViString( + self, vi, channel_name, attribute, value + ): # noqa: N802 + if self._defaults["SetAttributeViString"]["return"] != 0: + return self._defaults["SetAttributeViString"]["return"] + return self._defaults["SetAttributeViString"]["return"] + + def niDigital_TDR( + self, + vi, + channel_list, + apply_offsets, + offsets_buffer_size, + offsets, + actual_num_offsets, + ): # noqa: N802 + if self._defaults["TDR"]["return"] != 0: + return self._defaults["TDR"]["return"] # actual_num_offsets - if self._defaults['TDR']['actualNumOffsets'] is None: - raise MockFunctionCallError("niDigital_TDR", param='actualNumOffsets') + if self._defaults["TDR"]["actualNumOffsets"] is None: + raise MockFunctionCallError("niDigital_TDR", param="actualNumOffsets") if actual_num_offsets is not None: - actual_num_offsets.contents.value = self._defaults['TDR']['actualNumOffsets'] - if self._defaults['TDR']['offsets'] is None: - raise MockFunctionCallError("niDigital_TDR", param='offsets') + actual_num_offsets.contents.value = self._defaults["TDR"][ + "actualNumOffsets" + ] + if self._defaults["TDR"]["offsets"] is None: + raise MockFunctionCallError("niDigital_TDR", param="offsets") if offsets_buffer_size.value == 0: - return len(self._defaults['TDR']['offsets']) + return len(self._defaults["TDR"]["offsets"]) try: offsets_ref = offsets.contents except AttributeError: offsets_ref = offsets - for i in range(len(self._defaults['TDR']['offsets'])): - offsets_ref[i] = self._defaults['TDR']['offsets'][i] - return self._defaults['TDR']['return'] + for i in range(len(self._defaults["TDR"]["offsets"])): + offsets_ref[i] = self._defaults["TDR"]["offsets"][i] + return self._defaults["TDR"]["return"] def niDigital_UnloadAllPatterns(self, vi, unload_keep_alive_pattern): # noqa: N802 - if self._defaults['UnloadAllPatterns']['return'] != 0: - return self._defaults['UnloadAllPatterns']['return'] - return self._defaults['UnloadAllPatterns']['return'] + if self._defaults["UnloadAllPatterns"]["return"] != 0: + return self._defaults["UnloadAllPatterns"]["return"] + return self._defaults["UnloadAllPatterns"]["return"] def niDigital_UnloadSpecifications(self, vi, file_path): # noqa: N802 - if self._defaults['UnloadSpecifications']['return'] != 0: - return self._defaults['UnloadSpecifications']['return'] - return self._defaults['UnloadSpecifications']['return'] + if self._defaults["UnloadSpecifications"]["return"] != 0: + return self._defaults["UnloadSpecifications"]["return"] + return self._defaults["UnloadSpecifications"]["return"] def niDigital_UnlockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults['UnlockSession']['return'] != 0: - return self._defaults['UnlockSession']['return'] + if self._defaults["UnlockSession"]["return"] != 0: + return self._defaults["UnlockSession"]["return"] # caller_has_lock - if self._defaults['UnlockSession']['callerHasLock'] is None: - raise MockFunctionCallError("niDigital_UnlockSession", param='callerHasLock') + if self._defaults["UnlockSession"]["callerHasLock"] is None: + raise MockFunctionCallError( + "niDigital_UnlockSession", param="callerHasLock" + ) if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults['UnlockSession']['callerHasLock'] - return self._defaults['UnlockSession']['return'] + caller_has_lock.contents.value = self._defaults["UnlockSession"][ + "callerHasLock" + ] + return self._defaults["UnlockSession"]["return"] def niDigital_WaitUntilDone(self, vi, timeout): # noqa: N802 - if self._defaults['WaitUntilDone']['return'] != 0: - return self._defaults['WaitUntilDone']['return'] - return self._defaults['WaitUntilDone']['return'] + if self._defaults["WaitUntilDone"]["return"] != 0: + return self._defaults["WaitUntilDone"]["return"] + return self._defaults["WaitUntilDone"]["return"] def niDigital_WriteSequencerFlag(self, vi, flag, value): # noqa: N802 - if self._defaults['WriteSequencerFlag']['return'] != 0: - return self._defaults['WriteSequencerFlag']['return'] - return self._defaults['WriteSequencerFlag']['return'] + if self._defaults["WriteSequencerFlag"]["return"] != 0: + return self._defaults["WriteSequencerFlag"]["return"] + return self._defaults["WriteSequencerFlag"]["return"] def niDigital_WriteSequencerRegister(self, vi, reg, value): # noqa: N802 - if self._defaults['WriteSequencerRegister']['return'] != 0: - return self._defaults['WriteSequencerRegister']['return'] - return self._defaults['WriteSequencerRegister']['return'] - - def niDigital_WriteSourceWaveformBroadcastU32(self, vi, waveform_name, waveform_size, waveform_data): # noqa: N802 - if self._defaults['WriteSourceWaveformBroadcastU32']['return'] != 0: - return self._defaults['WriteSourceWaveformBroadcastU32']['return'] - return self._defaults['WriteSourceWaveformBroadcastU32']['return'] - - def niDigital_WriteSourceWaveformDataFromFileTDMS(self, vi, waveform_name, waveform_file_path): # noqa: N802 - if self._defaults['WriteSourceWaveformDataFromFileTDMS']['return'] != 0: - return self._defaults['WriteSourceWaveformDataFromFileTDMS']['return'] - return self._defaults['WriteSourceWaveformDataFromFileTDMS']['return'] - - def niDigital_WriteSourceWaveformSiteUniqueU32(self, vi, site_list, waveform_name, num_waveforms, samples_per_waveform, waveform_data): # noqa: N802 - if self._defaults['WriteSourceWaveformSiteUniqueU32']['return'] != 0: - return self._defaults['WriteSourceWaveformSiteUniqueU32']['return'] - return self._defaults['WriteSourceWaveformSiteUniqueU32']['return'] + if self._defaults["WriteSequencerRegister"]["return"] != 0: + return self._defaults["WriteSequencerRegister"]["return"] + return self._defaults["WriteSequencerRegister"]["return"] + + def niDigital_WriteSourceWaveformBroadcastU32( + self, vi, waveform_name, waveform_size, waveform_data + ): # noqa: N802 + if self._defaults["WriteSourceWaveformBroadcastU32"]["return"] != 0: + return self._defaults["WriteSourceWaveformBroadcastU32"]["return"] + return self._defaults["WriteSourceWaveformBroadcastU32"]["return"] + + def niDigital_WriteSourceWaveformDataFromFileTDMS( + self, vi, waveform_name, waveform_file_path + ): # noqa: N802 + if self._defaults["WriteSourceWaveformDataFromFileTDMS"]["return"] != 0: + return self._defaults["WriteSourceWaveformDataFromFileTDMS"]["return"] + return self._defaults["WriteSourceWaveformDataFromFileTDMS"]["return"] + + def niDigital_WriteSourceWaveformSiteUniqueU32( + self, + vi, + site_list, + waveform_name, + num_waveforms, + samples_per_waveform, + waveform_data, + ): # noqa: N802 + if self._defaults["WriteSourceWaveformSiteUniqueU32"]["return"] != 0: + return self._defaults["WriteSourceWaveformSiteUniqueU32"]["return"] + return self._defaults["WriteSourceWaveformSiteUniqueU32"]["return"] def niDigital_WriteStatic(self, vi, channel_list, state): # noqa: N802 - if self._defaults['WriteStatic']['return'] != 0: - return self._defaults['WriteStatic']['return'] - return self._defaults['WriteStatic']['return'] + if self._defaults["WriteStatic"]["return"] != 0: + return self._defaults["WriteStatic"]["return"] + return self._defaults["WriteStatic"]["return"] def niDigital_close(self, vi): # noqa: N802 - if self._defaults['close']['return'] != 0: - return self._defaults['close']['return'] - return self._defaults['close']['return'] + if self._defaults["close"]["return"] != 0: + return self._defaults["close"]["return"] + return self._defaults["close"]["return"] def niDigital_error_message(self, vi, error_code, error_message): # noqa: N802 - if self._defaults['error_message']['return'] != 0: - return self._defaults['error_message']['return'] + if self._defaults["error_message"]["return"] != 0: + return self._defaults["error_message"]["return"] # error_message - if self._defaults['error_message']['errorMessage'] is None: - raise MockFunctionCallError("niDigital_error_message", param='errorMessage') - test_value = self._defaults['error_message']['errorMessage'] + if self._defaults["error_message"]["errorMessage"] is None: + raise MockFunctionCallError("niDigital_error_message", param="errorMessage") + test_value = self._defaults["error_message"]["errorMessage"] if type(test_value) is str: - test_value = test_value.encode('ascii') + test_value = test_value.encode("ascii") assert len(error_message) >= len(test_value) for i in range(len(test_value)): error_message[i] = test_value[i] - return self._defaults['error_message']['return'] + return self._defaults["error_message"]["return"] def niDigital_reset(self, vi): # noqa: N802 - if self._defaults['reset']['return'] != 0: - return self._defaults['reset']['return'] - return self._defaults['reset']['return'] + if self._defaults["reset"]["return"] != 0: + return self._defaults["reset"]["return"] + return self._defaults["reset"]["return"] def niDigital_self_test(self, vi, test_result, test_message): # noqa: N802 - if self._defaults['self_test']['return'] != 0: - return self._defaults['self_test']['return'] + if self._defaults["self_test"]["return"] != 0: + return self._defaults["self_test"]["return"] # test_result - if self._defaults['self_test']['testResult'] is None: - raise MockFunctionCallError("niDigital_self_test", param='testResult') + if self._defaults["self_test"]["testResult"] is None: + raise MockFunctionCallError("niDigital_self_test", param="testResult") if test_result is not None: - test_result.contents.value = self._defaults['self_test']['testResult'] + test_result.contents.value = self._defaults["self_test"]["testResult"] # test_message - if self._defaults['self_test']['testMessage'] is None: - raise MockFunctionCallError("niDigital_self_test", param='testMessage') - test_value = self._defaults['self_test']['testMessage'] + if self._defaults["self_test"]["testMessage"] is None: + raise MockFunctionCallError("niDigital_self_test", param="testMessage") + test_value = self._defaults["self_test"]["testMessage"] if type(test_value) is str: - test_value = test_value.encode('ascii') + test_value = test_value.encode("ascii") assert len(test_message) >= len(test_value) for i in range(len(test_value)): test_message[i] = test_value[i] - return self._defaults['self_test']['return'] + return self._defaults["self_test"]["return"] # Helper function to setup Mock object with default side effects and return values def set_side_effects_and_return_values(self, mock_library): - mock_library.niDigital_Abort.side_effect = MockFunctionCallError("niDigital_Abort") + mock_library.niDigital_Abort.side_effect = MockFunctionCallError( + "niDigital_Abort" + ) mock_library.niDigital_Abort.return_value = 0 - mock_library.niDigital_AbortKeepAlive.side_effect = MockFunctionCallError("niDigital_AbortKeepAlive") + mock_library.niDigital_AbortKeepAlive.side_effect = MockFunctionCallError( + "niDigital_AbortKeepAlive" + ) mock_library.niDigital_AbortKeepAlive.return_value = 0 - mock_library.niDigital_ApplyLevelsAndTiming.side_effect = MockFunctionCallError("niDigital_ApplyLevelsAndTiming") + mock_library.niDigital_ApplyLevelsAndTiming.side_effect = MockFunctionCallError( + "niDigital_ApplyLevelsAndTiming" + ) mock_library.niDigital_ApplyLevelsAndTiming.return_value = 0 - mock_library.niDigital_ApplyTDROffsets.side_effect = MockFunctionCallError("niDigital_ApplyTDROffsets") + mock_library.niDigital_ApplyTDROffsets.side_effect = MockFunctionCallError( + "niDigital_ApplyTDROffsets" + ) mock_library.niDigital_ApplyTDROffsets.return_value = 0 - mock_library.niDigital_BurstPattern.side_effect = MockFunctionCallError("niDigital_BurstPattern") + mock_library.niDigital_BurstPattern.side_effect = MockFunctionCallError( + "niDigital_BurstPattern" + ) mock_library.niDigital_BurstPattern.return_value = 0 - mock_library.niDigital_ClockGenerator_Abort.side_effect = MockFunctionCallError("niDigital_ClockGenerator_Abort") + mock_library.niDigital_ClockGenerator_Abort.side_effect = MockFunctionCallError( + "niDigital_ClockGenerator_Abort" + ) mock_library.niDigital_ClockGenerator_Abort.return_value = 0 - mock_library.niDigital_ClockGenerator_GenerateClock.side_effect = MockFunctionCallError("niDigital_ClockGenerator_GenerateClock") + mock_library.niDigital_ClockGenerator_GenerateClock.side_effect = ( + MockFunctionCallError("niDigital_ClockGenerator_GenerateClock") + ) mock_library.niDigital_ClockGenerator_GenerateClock.return_value = 0 - mock_library.niDigital_Commit.side_effect = MockFunctionCallError("niDigital_Commit") + mock_library.niDigital_Commit.side_effect = MockFunctionCallError( + "niDigital_Commit" + ) mock_library.niDigital_Commit.return_value = 0 - mock_library.niDigital_ConfigureActiveLoadLevels.side_effect = MockFunctionCallError("niDigital_ConfigureActiveLoadLevels") + mock_library.niDigital_ConfigureActiveLoadLevels.side_effect = ( + MockFunctionCallError("niDigital_ConfigureActiveLoadLevels") + ) mock_library.niDigital_ConfigureActiveLoadLevels.return_value = 0 - mock_library.niDigital_ConfigurePatternBurstSites.side_effect = MockFunctionCallError("niDigital_ConfigurePatternBurstSites") + mock_library.niDigital_ConfigurePatternBurstSites.side_effect = ( + MockFunctionCallError("niDigital_ConfigurePatternBurstSites") + ) mock_library.niDigital_ConfigurePatternBurstSites.return_value = 0 - mock_library.niDigital_ConfigureTimeSetCompareEdgesStrobe.side_effect = MockFunctionCallError("niDigital_ConfigureTimeSetCompareEdgesStrobe") + mock_library.niDigital_ConfigureTimeSetCompareEdgesStrobe.side_effect = ( + MockFunctionCallError("niDigital_ConfigureTimeSetCompareEdgesStrobe") + ) mock_library.niDigital_ConfigureTimeSetCompareEdgesStrobe.return_value = 0 - mock_library.niDigital_ConfigureTimeSetCompareEdgesStrobe2x.side_effect = MockFunctionCallError("niDigital_ConfigureTimeSetCompareEdgesStrobe2x") + mock_library.niDigital_ConfigureTimeSetCompareEdgesStrobe2x.side_effect = ( + MockFunctionCallError("niDigital_ConfigureTimeSetCompareEdgesStrobe2x") + ) mock_library.niDigital_ConfigureTimeSetCompareEdgesStrobe2x.return_value = 0 - mock_library.niDigital_ConfigureTimeSetDriveEdges.side_effect = MockFunctionCallError("niDigital_ConfigureTimeSetDriveEdges") + mock_library.niDigital_ConfigureTimeSetDriveEdges.side_effect = ( + MockFunctionCallError("niDigital_ConfigureTimeSetDriveEdges") + ) mock_library.niDigital_ConfigureTimeSetDriveEdges.return_value = 0 - mock_library.niDigital_ConfigureTimeSetDriveEdges2x.side_effect = MockFunctionCallError("niDigital_ConfigureTimeSetDriveEdges2x") + mock_library.niDigital_ConfigureTimeSetDriveEdges2x.side_effect = ( + MockFunctionCallError("niDigital_ConfigureTimeSetDriveEdges2x") + ) mock_library.niDigital_ConfigureTimeSetDriveEdges2x.return_value = 0 - mock_library.niDigital_ConfigureTimeSetDriveFormat.side_effect = MockFunctionCallError("niDigital_ConfigureTimeSetDriveFormat") + mock_library.niDigital_ConfigureTimeSetDriveFormat.side_effect = ( + MockFunctionCallError("niDigital_ConfigureTimeSetDriveFormat") + ) mock_library.niDigital_ConfigureTimeSetDriveFormat.return_value = 0 - mock_library.niDigital_ConfigureTimeSetEdge.side_effect = MockFunctionCallError("niDigital_ConfigureTimeSetEdge") + mock_library.niDigital_ConfigureTimeSetEdge.side_effect = MockFunctionCallError( + "niDigital_ConfigureTimeSetEdge" + ) mock_library.niDigital_ConfigureTimeSetEdge.return_value = 0 - mock_library.niDigital_ConfigureTimeSetEdgeMultiplier.side_effect = MockFunctionCallError("niDigital_ConfigureTimeSetEdgeMultiplier") + mock_library.niDigital_ConfigureTimeSetEdgeMultiplier.side_effect = ( + MockFunctionCallError("niDigital_ConfigureTimeSetEdgeMultiplier") + ) mock_library.niDigital_ConfigureTimeSetEdgeMultiplier.return_value = 0 - mock_library.niDigital_ConfigureTimeSetPeriod.side_effect = MockFunctionCallError("niDigital_ConfigureTimeSetPeriod") + mock_library.niDigital_ConfigureTimeSetPeriod.side_effect = ( + MockFunctionCallError("niDigital_ConfigureTimeSetPeriod") + ) mock_library.niDigital_ConfigureTimeSetPeriod.return_value = 0 - mock_library.niDigital_ConfigureVoltageLevels.side_effect = MockFunctionCallError("niDigital_ConfigureVoltageLevels") + mock_library.niDigital_ConfigureVoltageLevels.side_effect = ( + MockFunctionCallError("niDigital_ConfigureVoltageLevels") + ) mock_library.niDigital_ConfigureVoltageLevels.return_value = 0 - mock_library.niDigital_CreateCaptureWaveformFromFileDigicapture.side_effect = MockFunctionCallError("niDigital_CreateCaptureWaveformFromFileDigicapture") + mock_library.niDigital_CreateCaptureWaveformFromFileDigicapture.side_effect = ( + MockFunctionCallError("niDigital_CreateCaptureWaveformFromFileDigicapture") + ) mock_library.niDigital_CreateCaptureWaveformFromFileDigicapture.return_value = 0 - mock_library.niDigital_CreateCaptureWaveformParallel.side_effect = MockFunctionCallError("niDigital_CreateCaptureWaveformParallel") + mock_library.niDigital_CreateCaptureWaveformParallel.side_effect = ( + MockFunctionCallError("niDigital_CreateCaptureWaveformParallel") + ) mock_library.niDigital_CreateCaptureWaveformParallel.return_value = 0 - mock_library.niDigital_CreateCaptureWaveformSerial.side_effect = MockFunctionCallError("niDigital_CreateCaptureWaveformSerial") + mock_library.niDigital_CreateCaptureWaveformSerial.side_effect = ( + MockFunctionCallError("niDigital_CreateCaptureWaveformSerial") + ) mock_library.niDigital_CreateCaptureWaveformSerial.return_value = 0 - mock_library.niDigital_CreateSourceWaveformFromFileTDMS.side_effect = MockFunctionCallError("niDigital_CreateSourceWaveformFromFileTDMS") + mock_library.niDigital_CreateSourceWaveformFromFileTDMS.side_effect = ( + MockFunctionCallError("niDigital_CreateSourceWaveformFromFileTDMS") + ) mock_library.niDigital_CreateSourceWaveformFromFileTDMS.return_value = 0 - mock_library.niDigital_CreateSourceWaveformParallel.side_effect = MockFunctionCallError("niDigital_CreateSourceWaveformParallel") + mock_library.niDigital_CreateSourceWaveformParallel.side_effect = ( + MockFunctionCallError("niDigital_CreateSourceWaveformParallel") + ) mock_library.niDigital_CreateSourceWaveformParallel.return_value = 0 - mock_library.niDigital_CreateSourceWaveformSerial.side_effect = MockFunctionCallError("niDigital_CreateSourceWaveformSerial") + mock_library.niDigital_CreateSourceWaveformSerial.side_effect = ( + MockFunctionCallError("niDigital_CreateSourceWaveformSerial") + ) mock_library.niDigital_CreateSourceWaveformSerial.return_value = 0 - mock_library.niDigital_CreateTimeSet.side_effect = MockFunctionCallError("niDigital_CreateTimeSet") + mock_library.niDigital_CreateTimeSet.side_effect = MockFunctionCallError( + "niDigital_CreateTimeSet" + ) mock_library.niDigital_CreateTimeSet.return_value = 0 - mock_library.niDigital_DeleteAllTimeSets.side_effect = MockFunctionCallError("niDigital_DeleteAllTimeSets") + mock_library.niDigital_DeleteAllTimeSets.side_effect = MockFunctionCallError( + "niDigital_DeleteAllTimeSets" + ) mock_library.niDigital_DeleteAllTimeSets.return_value = 0 - mock_library.niDigital_DisableSites.side_effect = MockFunctionCallError("niDigital_DisableSites") + mock_library.niDigital_DisableSites.side_effect = MockFunctionCallError( + "niDigital_DisableSites" + ) mock_library.niDigital_DisableSites.return_value = 0 - mock_library.niDigital_EnableSites.side_effect = MockFunctionCallError("niDigital_EnableSites") + mock_library.niDigital_EnableSites.side_effect = MockFunctionCallError( + "niDigital_EnableSites" + ) mock_library.niDigital_EnableSites.return_value = 0 - mock_library.niDigital_FetchHistoryRAMCycleInformation.side_effect = MockFunctionCallError("niDigital_FetchHistoryRAMCycleInformation") + mock_library.niDigital_FetchHistoryRAMCycleInformation.side_effect = ( + MockFunctionCallError("niDigital_FetchHistoryRAMCycleInformation") + ) mock_library.niDigital_FetchHistoryRAMCycleInformation.return_value = 0 - mock_library.niDigital_FetchHistoryRAMCyclePinData.side_effect = MockFunctionCallError("niDigital_FetchHistoryRAMCyclePinData") + mock_library.niDigital_FetchHistoryRAMCyclePinData.side_effect = ( + MockFunctionCallError("niDigital_FetchHistoryRAMCyclePinData") + ) mock_library.niDigital_FetchHistoryRAMCyclePinData.return_value = 0 - mock_library.niDigital_FetchHistoryRAMScanCycleNumber.side_effect = MockFunctionCallError("niDigital_FetchHistoryRAMScanCycleNumber") + mock_library.niDigital_FetchHistoryRAMScanCycleNumber.side_effect = ( + MockFunctionCallError("niDigital_FetchHistoryRAMScanCycleNumber") + ) mock_library.niDigital_FetchHistoryRAMScanCycleNumber.return_value = 0 - mock_library.niDigital_FrequencyCounter_MeasureFrequency.side_effect = MockFunctionCallError("niDigital_FrequencyCounter_MeasureFrequency") + mock_library.niDigital_FrequencyCounter_MeasureFrequency.side_effect = ( + MockFunctionCallError("niDigital_FrequencyCounter_MeasureFrequency") + ) mock_library.niDigital_FrequencyCounter_MeasureFrequency.return_value = 0 - mock_library.niDigital_GetAttributeViBoolean.side_effect = MockFunctionCallError("niDigital_GetAttributeViBoolean") + mock_library.niDigital_GetAttributeViBoolean.side_effect = ( + MockFunctionCallError("niDigital_GetAttributeViBoolean") + ) mock_library.niDigital_GetAttributeViBoolean.return_value = 0 - mock_library.niDigital_GetAttributeViInt32.side_effect = MockFunctionCallError("niDigital_GetAttributeViInt32") + mock_library.niDigital_GetAttributeViInt32.side_effect = MockFunctionCallError( + "niDigital_GetAttributeViInt32" + ) mock_library.niDigital_GetAttributeViInt32.return_value = 0 - mock_library.niDigital_GetAttributeViInt64.side_effect = MockFunctionCallError("niDigital_GetAttributeViInt64") + mock_library.niDigital_GetAttributeViInt64.side_effect = MockFunctionCallError( + "niDigital_GetAttributeViInt64" + ) mock_library.niDigital_GetAttributeViInt64.return_value = 0 - mock_library.niDigital_GetAttributeViReal64.side_effect = MockFunctionCallError("niDigital_GetAttributeViReal64") + mock_library.niDigital_GetAttributeViReal64.side_effect = MockFunctionCallError( + "niDigital_GetAttributeViReal64" + ) mock_library.niDigital_GetAttributeViReal64.return_value = 0 - mock_library.niDigital_GetAttributeViString.side_effect = MockFunctionCallError("niDigital_GetAttributeViString") + mock_library.niDigital_GetAttributeViString.side_effect = MockFunctionCallError( + "niDigital_GetAttributeViString" + ) mock_library.niDigital_GetAttributeViString.return_value = 0 - mock_library.niDigital_GetChannelNameFromString.side_effect = MockFunctionCallError("niDigital_GetChannelNameFromString") + mock_library.niDigital_GetChannelNameFromString.side_effect = ( + MockFunctionCallError("niDigital_GetChannelNameFromString") + ) mock_library.niDigital_GetChannelNameFromString.return_value = 0 - mock_library.niDigital_GetError.side_effect = MockFunctionCallError("niDigital_GetError") + mock_library.niDigital_GetError.side_effect = MockFunctionCallError( + "niDigital_GetError" + ) mock_library.niDigital_GetError.return_value = 0 - mock_library.niDigital_GetFailCount.side_effect = MockFunctionCallError("niDigital_GetFailCount") + mock_library.niDigital_GetFailCount.side_effect = MockFunctionCallError( + "niDigital_GetFailCount" + ) mock_library.niDigital_GetFailCount.return_value = 0 - mock_library.niDigital_GetHistoryRAMSampleCount.side_effect = MockFunctionCallError("niDigital_GetHistoryRAMSampleCount") + mock_library.niDigital_GetHistoryRAMSampleCount.side_effect = ( + MockFunctionCallError("niDigital_GetHistoryRAMSampleCount") + ) mock_library.niDigital_GetHistoryRAMSampleCount.return_value = 0 - mock_library.niDigital_GetPatternName.side_effect = MockFunctionCallError("niDigital_GetPatternName") + mock_library.niDigital_GetPatternName.side_effect = MockFunctionCallError( + "niDigital_GetPatternName" + ) mock_library.niDigital_GetPatternName.return_value = 0 - mock_library.niDigital_GetPatternPinList.side_effect = MockFunctionCallError("niDigital_GetPatternPinList") + mock_library.niDigital_GetPatternPinList.side_effect = MockFunctionCallError( + "niDigital_GetPatternPinList" + ) mock_library.niDigital_GetPatternPinList.return_value = 0 - mock_library.niDigital_GetPinName.side_effect = MockFunctionCallError("niDigital_GetPinName") + mock_library.niDigital_GetPinName.side_effect = MockFunctionCallError( + "niDigital_GetPinName" + ) mock_library.niDigital_GetPinName.return_value = 0 - mock_library.niDigital_GetPinResultsPinInformation.side_effect = MockFunctionCallError("niDigital_GetPinResultsPinInformation") + mock_library.niDigital_GetPinResultsPinInformation.side_effect = ( + MockFunctionCallError("niDigital_GetPinResultsPinInformation") + ) mock_library.niDigital_GetPinResultsPinInformation.return_value = 0 - mock_library.niDigital_GetSitePassFail.side_effect = MockFunctionCallError("niDigital_GetSitePassFail") + mock_library.niDigital_GetSitePassFail.side_effect = MockFunctionCallError( + "niDigital_GetSitePassFail" + ) mock_library.niDigital_GetSitePassFail.return_value = 0 - mock_library.niDigital_GetSiteResultsSiteNumbers.side_effect = MockFunctionCallError("niDigital_GetSiteResultsSiteNumbers") + mock_library.niDigital_GetSiteResultsSiteNumbers.side_effect = ( + MockFunctionCallError("niDigital_GetSiteResultsSiteNumbers") + ) mock_library.niDigital_GetSiteResultsSiteNumbers.return_value = 0 - mock_library.niDigital_GetTimeSetDriveFormat.side_effect = MockFunctionCallError("niDigital_GetTimeSetDriveFormat") + mock_library.niDigital_GetTimeSetDriveFormat.side_effect = ( + MockFunctionCallError("niDigital_GetTimeSetDriveFormat") + ) mock_library.niDigital_GetTimeSetDriveFormat.return_value = 0 - mock_library.niDigital_GetTimeSetEdge.side_effect = MockFunctionCallError("niDigital_GetTimeSetEdge") + mock_library.niDigital_GetTimeSetEdge.side_effect = MockFunctionCallError( + "niDigital_GetTimeSetEdge" + ) mock_library.niDigital_GetTimeSetEdge.return_value = 0 - mock_library.niDigital_GetTimeSetEdgeMultiplier.side_effect = MockFunctionCallError("niDigital_GetTimeSetEdgeMultiplier") + mock_library.niDigital_GetTimeSetEdgeMultiplier.side_effect = ( + MockFunctionCallError("niDigital_GetTimeSetEdgeMultiplier") + ) mock_library.niDigital_GetTimeSetEdgeMultiplier.return_value = 0 - mock_library.niDigital_GetTimeSetName.side_effect = MockFunctionCallError("niDigital_GetTimeSetName") + mock_library.niDigital_GetTimeSetName.side_effect = MockFunctionCallError( + "niDigital_GetTimeSetName" + ) mock_library.niDigital_GetTimeSetName.return_value = 0 - mock_library.niDigital_GetTimeSetPeriod.side_effect = MockFunctionCallError("niDigital_GetTimeSetPeriod") + mock_library.niDigital_GetTimeSetPeriod.side_effect = MockFunctionCallError( + "niDigital_GetTimeSetPeriod" + ) mock_library.niDigital_GetTimeSetPeriod.return_value = 0 - mock_library.niDigital_InitWithOptions.side_effect = MockFunctionCallError("niDigital_InitWithOptions") + mock_library.niDigital_InitWithOptions.side_effect = MockFunctionCallError( + "niDigital_InitWithOptions" + ) mock_library.niDigital_InitWithOptions.return_value = 0 - mock_library.niDigital_Initiate.side_effect = MockFunctionCallError("niDigital_Initiate") + mock_library.niDigital_Initiate.side_effect = MockFunctionCallError( + "niDigital_Initiate" + ) mock_library.niDigital_Initiate.return_value = 0 - mock_library.niDigital_IsDone.side_effect = MockFunctionCallError("niDigital_IsDone") + mock_library.niDigital_IsDone.side_effect = MockFunctionCallError( + "niDigital_IsDone" + ) mock_library.niDigital_IsDone.return_value = 0 - mock_library.niDigital_IsSiteEnabled.side_effect = MockFunctionCallError("niDigital_IsSiteEnabled") + mock_library.niDigital_IsSiteEnabled.side_effect = MockFunctionCallError( + "niDigital_IsSiteEnabled" + ) mock_library.niDigital_IsSiteEnabled.return_value = 0 - mock_library.niDigital_LoadLevels.side_effect = MockFunctionCallError("niDigital_LoadLevels") + mock_library.niDigital_LoadLevels.side_effect = MockFunctionCallError( + "niDigital_LoadLevels" + ) mock_library.niDigital_LoadLevels.return_value = 0 - mock_library.niDigital_LoadPattern.side_effect = MockFunctionCallError("niDigital_LoadPattern") + mock_library.niDigital_LoadPattern.side_effect = MockFunctionCallError( + "niDigital_LoadPattern" + ) mock_library.niDigital_LoadPattern.return_value = 0 - mock_library.niDigital_LoadPinMap.side_effect = MockFunctionCallError("niDigital_LoadPinMap") + mock_library.niDigital_LoadPinMap.side_effect = MockFunctionCallError( + "niDigital_LoadPinMap" + ) mock_library.niDigital_LoadPinMap.return_value = 0 - mock_library.niDigital_LoadSpecifications.side_effect = MockFunctionCallError("niDigital_LoadSpecifications") + mock_library.niDigital_LoadSpecifications.side_effect = MockFunctionCallError( + "niDigital_LoadSpecifications" + ) mock_library.niDigital_LoadSpecifications.return_value = 0 - mock_library.niDigital_LoadTiming.side_effect = MockFunctionCallError("niDigital_LoadTiming") + mock_library.niDigital_LoadTiming.side_effect = MockFunctionCallError( + "niDigital_LoadTiming" + ) mock_library.niDigital_LoadTiming.return_value = 0 - mock_library.niDigital_LockSession.side_effect = MockFunctionCallError("niDigital_LockSession") + mock_library.niDigital_LockSession.side_effect = MockFunctionCallError( + "niDigital_LockSession" + ) mock_library.niDigital_LockSession.return_value = 0 - mock_library.niDigital_PPMU_Measure.side_effect = MockFunctionCallError("niDigital_PPMU_Measure") + mock_library.niDigital_PPMU_Measure.side_effect = MockFunctionCallError( + "niDigital_PPMU_Measure" + ) mock_library.niDigital_PPMU_Measure.return_value = 0 - mock_library.niDigital_PPMU_Source.side_effect = MockFunctionCallError("niDigital_PPMU_Source") + mock_library.niDigital_PPMU_Source.side_effect = MockFunctionCallError( + "niDigital_PPMU_Source" + ) mock_library.niDigital_PPMU_Source.return_value = 0 - mock_library.niDigital_ReadSequencerFlag.side_effect = MockFunctionCallError("niDigital_ReadSequencerFlag") + mock_library.niDigital_ReadSequencerFlag.side_effect = MockFunctionCallError( + "niDigital_ReadSequencerFlag" + ) mock_library.niDigital_ReadSequencerFlag.return_value = 0 - mock_library.niDigital_ReadSequencerRegister.side_effect = MockFunctionCallError("niDigital_ReadSequencerRegister") + mock_library.niDigital_ReadSequencerRegister.side_effect = ( + MockFunctionCallError("niDigital_ReadSequencerRegister") + ) mock_library.niDigital_ReadSequencerRegister.return_value = 0 - mock_library.niDigital_ReadStatic.side_effect = MockFunctionCallError("niDigital_ReadStatic") + mock_library.niDigital_ReadStatic.side_effect = MockFunctionCallError( + "niDigital_ReadStatic" + ) mock_library.niDigital_ReadStatic.return_value = 0 - mock_library.niDigital_ResetDevice.side_effect = MockFunctionCallError("niDigital_ResetDevice") + mock_library.niDigital_ResetDevice.side_effect = MockFunctionCallError( + "niDigital_ResetDevice" + ) mock_library.niDigital_ResetDevice.return_value = 0 - mock_library.niDigital_SelfCalibrate.side_effect = MockFunctionCallError("niDigital_SelfCalibrate") + mock_library.niDigital_SelfCalibrate.side_effect = MockFunctionCallError( + "niDigital_SelfCalibrate" + ) mock_library.niDigital_SelfCalibrate.return_value = 0 - mock_library.niDigital_SendSoftwareEdgeTrigger.side_effect = MockFunctionCallError("niDigital_SendSoftwareEdgeTrigger") + mock_library.niDigital_SendSoftwareEdgeTrigger.side_effect = ( + MockFunctionCallError("niDigital_SendSoftwareEdgeTrigger") + ) mock_library.niDigital_SendSoftwareEdgeTrigger.return_value = 0 - mock_library.niDigital_SetAttributeViBoolean.side_effect = MockFunctionCallError("niDigital_SetAttributeViBoolean") + mock_library.niDigital_SetAttributeViBoolean.side_effect = ( + MockFunctionCallError("niDigital_SetAttributeViBoolean") + ) mock_library.niDigital_SetAttributeViBoolean.return_value = 0 - mock_library.niDigital_SetAttributeViInt32.side_effect = MockFunctionCallError("niDigital_SetAttributeViInt32") + mock_library.niDigital_SetAttributeViInt32.side_effect = MockFunctionCallError( + "niDigital_SetAttributeViInt32" + ) mock_library.niDigital_SetAttributeViInt32.return_value = 0 - mock_library.niDigital_SetAttributeViInt64.side_effect = MockFunctionCallError("niDigital_SetAttributeViInt64") + mock_library.niDigital_SetAttributeViInt64.side_effect = MockFunctionCallError( + "niDigital_SetAttributeViInt64" + ) mock_library.niDigital_SetAttributeViInt64.return_value = 0 - mock_library.niDigital_SetAttributeViReal64.side_effect = MockFunctionCallError("niDigital_SetAttributeViReal64") + mock_library.niDigital_SetAttributeViReal64.side_effect = MockFunctionCallError( + "niDigital_SetAttributeViReal64" + ) mock_library.niDigital_SetAttributeViReal64.return_value = 0 - mock_library.niDigital_SetAttributeViString.side_effect = MockFunctionCallError("niDigital_SetAttributeViString") + mock_library.niDigital_SetAttributeViString.side_effect = MockFunctionCallError( + "niDigital_SetAttributeViString" + ) mock_library.niDigital_SetAttributeViString.return_value = 0 mock_library.niDigital_TDR.side_effect = MockFunctionCallError("niDigital_TDR") mock_library.niDigital_TDR.return_value = 0 - mock_library.niDigital_UnloadAllPatterns.side_effect = MockFunctionCallError("niDigital_UnloadAllPatterns") + mock_library.niDigital_UnloadAllPatterns.side_effect = MockFunctionCallError( + "niDigital_UnloadAllPatterns" + ) mock_library.niDigital_UnloadAllPatterns.return_value = 0 - mock_library.niDigital_UnloadSpecifications.side_effect = MockFunctionCallError("niDigital_UnloadSpecifications") + mock_library.niDigital_UnloadSpecifications.side_effect = MockFunctionCallError( + "niDigital_UnloadSpecifications" + ) mock_library.niDigital_UnloadSpecifications.return_value = 0 - mock_library.niDigital_UnlockSession.side_effect = MockFunctionCallError("niDigital_UnlockSession") + mock_library.niDigital_UnlockSession.side_effect = MockFunctionCallError( + "niDigital_UnlockSession" + ) mock_library.niDigital_UnlockSession.return_value = 0 - mock_library.niDigital_WaitUntilDone.side_effect = MockFunctionCallError("niDigital_WaitUntilDone") + mock_library.niDigital_WaitUntilDone.side_effect = MockFunctionCallError( + "niDigital_WaitUntilDone" + ) mock_library.niDigital_WaitUntilDone.return_value = 0 - mock_library.niDigital_WriteSequencerFlag.side_effect = MockFunctionCallError("niDigital_WriteSequencerFlag") + mock_library.niDigital_WriteSequencerFlag.side_effect = MockFunctionCallError( + "niDigital_WriteSequencerFlag" + ) mock_library.niDigital_WriteSequencerFlag.return_value = 0 - mock_library.niDigital_WriteSequencerRegister.side_effect = MockFunctionCallError("niDigital_WriteSequencerRegister") + mock_library.niDigital_WriteSequencerRegister.side_effect = ( + MockFunctionCallError("niDigital_WriteSequencerRegister") + ) mock_library.niDigital_WriteSequencerRegister.return_value = 0 - mock_library.niDigital_WriteSourceWaveformBroadcastU32.side_effect = MockFunctionCallError("niDigital_WriteSourceWaveformBroadcastU32") + mock_library.niDigital_WriteSourceWaveformBroadcastU32.side_effect = ( + MockFunctionCallError("niDigital_WriteSourceWaveformBroadcastU32") + ) mock_library.niDigital_WriteSourceWaveformBroadcastU32.return_value = 0 - mock_library.niDigital_WriteSourceWaveformDataFromFileTDMS.side_effect = MockFunctionCallError("niDigital_WriteSourceWaveformDataFromFileTDMS") + mock_library.niDigital_WriteSourceWaveformDataFromFileTDMS.side_effect = ( + MockFunctionCallError("niDigital_WriteSourceWaveformDataFromFileTDMS") + ) mock_library.niDigital_WriteSourceWaveformDataFromFileTDMS.return_value = 0 - mock_library.niDigital_WriteSourceWaveformSiteUniqueU32.side_effect = MockFunctionCallError("niDigital_WriteSourceWaveformSiteUniqueU32") + mock_library.niDigital_WriteSourceWaveformSiteUniqueU32.side_effect = ( + MockFunctionCallError("niDigital_WriteSourceWaveformSiteUniqueU32") + ) mock_library.niDigital_WriteSourceWaveformSiteUniqueU32.return_value = 0 - mock_library.niDigital_WriteStatic.side_effect = MockFunctionCallError("niDigital_WriteStatic") + mock_library.niDigital_WriteStatic.side_effect = MockFunctionCallError( + "niDigital_WriteStatic" + ) mock_library.niDigital_WriteStatic.return_value = 0 - mock_library.niDigital_close.side_effect = MockFunctionCallError("niDigital_close") + mock_library.niDigital_close.side_effect = MockFunctionCallError( + "niDigital_close" + ) mock_library.niDigital_close.return_value = 0 - mock_library.niDigital_error_message.side_effect = MockFunctionCallError("niDigital_error_message") + mock_library.niDigital_error_message.side_effect = MockFunctionCallError( + "niDigital_error_message" + ) mock_library.niDigital_error_message.return_value = 0 - mock_library.niDigital_reset.side_effect = MockFunctionCallError("niDigital_reset") + mock_library.niDigital_reset.side_effect = MockFunctionCallError( + "niDigital_reset" + ) mock_library.niDigital_reset.return_value = 0 - mock_library.niDigital_self_test.side_effect = MockFunctionCallError("niDigital_self_test") + mock_library.niDigital_self_test.side_effect = MockFunctionCallError( + "niDigital_self_test" + ) mock_library.niDigital_self_test.return_value = 0 diff --git a/generated/nidigital/nidigital/unit_tests/test_nidigital.py b/generated/nidigital/nidigital/unit_tests/test_nidigital.py index 547299d68..c2c63b41a 100644 --- a/generated/nidigital/nidigital/unit_tests/test_nidigital.py +++ b/generated/nidigital/nidigital/unit_tests/test_nidigital.py @@ -10,24 +10,39 @@ class TestSession(object): def setup_method(self, method): - self.patched_library_patcher = patch('nidigital._library.Library', autospec=True) + self.patched_library_patcher = patch( + "nidigital._library.Library", autospec=True + ) self.patched_library = self.patched_library_patcher.start() - self.patched_library_singleton_get = patch('nidigital.session._library_singleton.get', return_value=self.patched_library) + self.patched_library_singleton_get = patch( + "nidigital.session._library_singleton.get", + return_value=self.patched_library, + ) self.patched_library_singleton_get.start() self.side_effects_helper = _mock_helper.SideEffectsHelper() - self.side_effects_helper.set_side_effects_and_return_values(self.patched_library) + self.side_effects_helper.set_side_effects_and_return_values( + self.patched_library + ) - self.patched_library.niDigital_InitWithOptions.side_effect = self.side_effects_helper.niDigital_InitWithOptions - self.side_effects_helper['InitWithOptions']['newVi'] = session_id_for_test + self.patched_library.niDigital_InitWithOptions.side_effect = ( + self.side_effects_helper.niDigital_InitWithOptions + ) + self.side_effects_helper["InitWithOptions"]["newVi"] = session_id_for_test - self.patched_library.niDigital_close.side_effect = self.side_effects_helper.niDigital_close + self.patched_library.niDigital_close.side_effect = ( + self.side_effects_helper.niDigital_close + ) - self.patched_library.niDigital_LockSession.side_effect = self.side_effects_helper.niDigital_LockSession - self.side_effects_helper['LockSession']['callerHasLock'] = True + self.patched_library.niDigital_LockSession.side_effect = ( + self.side_effects_helper.niDigital_LockSession + ) + self.side_effects_helper["LockSession"]["callerHasLock"] = True - self.patched_library.niDigital_UnlockSession.side_effect = self.side_effects_helper.niDigital_UnlockSession - self.side_effects_helper['UnlockSession']['callerHasLock'] = True + self.patched_library.niDigital_UnlockSession.side_effect = ( + self.side_effects_helper.niDigital_UnlockSession + ) + self.side_effects_helper["UnlockSession"]["callerHasLock"] = True # for niDigital_FetchHistoryRAMCycleInformation_looping self.pattern_indices_looping = [0, 0, 0, 0, 0, 0, 0] @@ -37,50 +52,271 @@ def setup_method(self, method): self.num_duty_cycles_looping = [1, 1, 1, 2, 2, 2, 1] # for niDigital_GetTimeSetName_looping - self.time_set_name_looping = ['t0', 'tScan', 't2X'] + self.time_set_name_looping = ["t0", "tScan", "t2X"] # for niDigital_FetchHistoryRAMScanCycleNumber_looping self.scan_cycle_number_looping = [-1, 0, 1, -1, -1, -1, -1] # for niDigital_FetchHistoryRAMCyclePinData_looping self.expected_pin_states_looping = [ - [[nidigital.PinState.ZERO, nidigital.PinState.H, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.H, nidigital.PinState.ZERO, nidigital.PinState.X, nidigital.PinState.X]], - [[nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.ZERO, nidigital.PinState.ONE, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.L, nidigital.PinState.H]], - [[nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.ONE, nidigital.PinState.ZERO, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.H, nidigital.PinState.L]], - [[nidigital.PinState.ONE, nidigital.PinState.ONE, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.H, nidigital.PinState.H, nidigital.PinState.X, nidigital.PinState.X], - [nidigital.PinState.ZERO, nidigital.PinState.ZERO, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.L, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X]], - [[nidigital.PinState.ONE, nidigital.PinState.ONE, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.H, nidigital.PinState.H, nidigital.PinState.X, nidigital.PinState.X], - [nidigital.PinState.ZERO, nidigital.PinState.ZERO, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.L, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X]], - [[nidigital.PinState.ZERO, nidigital.PinState.ONE, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.L, nidigital.PinState.H, nidigital.PinState.X, nidigital.PinState.X], - [nidigital.PinState.ONE, nidigital.PinState.ZERO, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.H, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X]], - [[nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X]] + [ + [ + nidigital.PinState.ZERO, + nidigital.PinState.H, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.H, + nidigital.PinState.ZERO, + nidigital.PinState.X, + nidigital.PinState.X, + ] + ], + [ + [ + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.ZERO, + nidigital.PinState.ONE, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.L, + nidigital.PinState.H, + ] + ], + [ + [ + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.ONE, + nidigital.PinState.ZERO, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.H, + nidigital.PinState.L, + ] + ], + [ + [ + nidigital.PinState.ONE, + nidigital.PinState.ONE, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.H, + nidigital.PinState.H, + nidigital.PinState.X, + nidigital.PinState.X, + ], + [ + nidigital.PinState.ZERO, + nidigital.PinState.ZERO, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.L, + nidigital.PinState.L, + nidigital.PinState.X, + nidigital.PinState.X, + ], + ], + [ + [ + nidigital.PinState.ONE, + nidigital.PinState.ONE, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.H, + nidigital.PinState.H, + nidigital.PinState.X, + nidigital.PinState.X, + ], + [ + nidigital.PinState.ZERO, + nidigital.PinState.ZERO, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.L, + nidigital.PinState.L, + nidigital.PinState.X, + nidigital.PinState.X, + ], + ], + [ + [ + nidigital.PinState.ZERO, + nidigital.PinState.ONE, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.L, + nidigital.PinState.H, + nidigital.PinState.X, + nidigital.PinState.X, + ], + [ + nidigital.PinState.ONE, + nidigital.PinState.ZERO, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.H, + nidigital.PinState.L, + nidigital.PinState.X, + nidigital.PinState.X, + ], + ], + [ + [ + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.X, + ] + ], ] self.actual_pin_states_looping = [ - [[nidigital.PinState.L, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.L, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X]], - [[nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.L, nidigital.PinState.H, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.L, nidigital.PinState.H]], - [[nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.H, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.H, nidigital.PinState.L]], - [[nidigital.PinState.H, nidigital.PinState.H, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.H, nidigital.PinState.H, nidigital.PinState.X, nidigital.PinState.X], - [nidigital.PinState.L, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.L, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X]], - [[nidigital.PinState.H, nidigital.PinState.H, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.H, nidigital.PinState.H, nidigital.PinState.X, nidigital.PinState.X], - [nidigital.PinState.L, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.L, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X]], - [[nidigital.PinState.L, nidigital.PinState.H, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.L, nidigital.PinState.H, nidigital.PinState.X, nidigital.PinState.X], - [nidigital.PinState.H, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.H, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X]], - [[nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X]] + [ + [ + nidigital.PinState.L, + nidigital.PinState.L, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.L, + nidigital.PinState.L, + nidigital.PinState.X, + nidigital.PinState.X, + ] + ], + [ + [ + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.L, + nidigital.PinState.H, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.L, + nidigital.PinState.H, + ] + ], + [ + [ + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.H, + nidigital.PinState.L, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.H, + nidigital.PinState.L, + ] + ], + [ + [ + nidigital.PinState.H, + nidigital.PinState.H, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.H, + nidigital.PinState.H, + nidigital.PinState.X, + nidigital.PinState.X, + ], + [ + nidigital.PinState.L, + nidigital.PinState.L, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.L, + nidigital.PinState.L, + nidigital.PinState.X, + nidigital.PinState.X, + ], + ], + [ + [ + nidigital.PinState.H, + nidigital.PinState.H, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.H, + nidigital.PinState.H, + nidigital.PinState.X, + nidigital.PinState.X, + ], + [ + nidigital.PinState.L, + nidigital.PinState.L, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.L, + nidigital.PinState.L, + nidigital.PinState.X, + nidigital.PinState.X, + ], + ], + [ + [ + nidigital.PinState.L, + nidigital.PinState.H, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.L, + nidigital.PinState.H, + nidigital.PinState.X, + nidigital.PinState.X, + ], + [ + nidigital.PinState.H, + nidigital.PinState.L, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.H, + nidigital.PinState.L, + nidigital.PinState.X, + nidigital.PinState.X, + ], + ], + [ + [ + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.X, + nidigital.PinState.X, + ] + ], ] self.per_pin_pass_fail_looping = [ [[True, False, True, True, False, True, True, True]], [[True, True, True, True, True, True, True, True]], [[True, True, True, True, True, True, True, True]], - [[True, True, True, True, True, True, True, True], [True, True, True, True, True, True, True, True]], - [[True, True, True, True, True, True, True, True], [True, True, True, True, True, True, True, True]], - [[True, True, True, True, True, True, True, True], [True, True, True, True, True, True, True, True]], + [ + [True, True, True, True, True, True, True, True], + [True, True, True, True, True, True, True, True], + ], + [ + [True, True, True, True, True, True, True, True], + [True, True, True, True, True, True, True, True], + ], + [ + [True, True, True, True, True, True, True, True], + [True, True, True, True, True, True, True, True], + ], [[True, True, True, True, True, True, True, True]], ] # for niDigital_FetchHistoryRAMCyclePinData_check_pins_looping self.expected_pin_list_check_pins_looping = None - self.expected_pin_states_check_pins_looping = [[[nidigital.PinState.ZERO, nidigital.PinState.H]]] - self.actual_pin_states_check_pins_looping = [[[nidigital.PinState.L, nidigital.PinState.L]]] + self.expected_pin_states_check_pins_looping = [ + [[nidigital.PinState.ZERO, nidigital.PinState.H]] + ] + self.actual_pin_states_check_pins_looping = [ + [[nidigital.PinState.L, nidigital.PinState.L]] + ] self.per_pin_pass_fail_check_pins_looping = [[[True, False]]] # for niDigital_GetHistoryRAMSampleCount_check_site_looping @@ -97,46 +333,79 @@ def teardown_method(self, method): # this test should be converted to a system test. (GitHub issue# 1353). def test_fetch_history_ram_cycle_information_position_out_of_bound(self): - self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = self.side_effects_helper.niDigital_GetHistoryRAMSampleCount - self.side_effects_helper['GetHistoryRAMSampleCount']['sampleCount'] = 7 - with nidigital.Session('') as session: - with pytest.raises(ValueError, match='position: Specified value = 8, Maximum value = 6.'): - session.sites[1].fetch_history_ram_cycle_information(position=8, samples_to_read=-1) + self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = ( + self.side_effects_helper.niDigital_GetHistoryRAMSampleCount + ) + self.side_effects_helper["GetHistoryRAMSampleCount"]["sampleCount"] = 7 + with nidigital.Session("") as session: + with pytest.raises( + ValueError, match="position: Specified value = 8, Maximum value = 6." + ): + session.sites[1].fetch_history_ram_cycle_information( + position=8, samples_to_read=-1 + ) # TODO(sbethur): When nidigital driver provides better simulation support (internal bug# 992370), # this test should be converted to a system test. (GitHub issue# 1353). def test_fetch_history_ram_cycle_information_position_last(self): - self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = self.side_effects_helper.niDigital_GetHistoryRAMSampleCount - self.side_effects_helper['GetHistoryRAMSampleCount']['sampleCount'] = 7 - self.patched_library.niDigital_GetAttributeViBoolean.side_effect = self.side_effects_helper.niDigital_GetAttributeViBoolean - self.side_effects_helper['GetAttributeViBoolean']['value'] = True # history_ram_number_of_samples_is_finite - self.patched_library.niDigital_FetchHistoryRAMCycleInformation.side_effect = self.side_effects_helper.niDigital_FetchHistoryRAMCycleInformation - self.side_effects_helper['FetchHistoryRAMCycleInformation']['patternIndex'] = 0 - self.side_effects_helper['FetchHistoryRAMCycleInformation']['timeSetIndex'] = 0 - self.side_effects_helper['FetchHistoryRAMCycleInformation']['vectorNumber'] = 9 - self.side_effects_helper['FetchHistoryRAMCycleInformation']['cycleNumber'] = 11 - self.side_effects_helper['FetchHistoryRAMCycleInformation']['numDutCycles'] = 1 - self.patched_library.niDigital_GetPatternName.side_effect = self.side_effects_helper.niDigital_GetPatternName - self.side_effects_helper['GetPatternName']['name'] = 'new_pattern' - self.patched_library.niDigital_GetTimeSetName.side_effect = self.side_effects_helper.niDigital_GetTimeSetName - self.side_effects_helper['GetTimeSetName']['name'] = 't0' - self.patched_library.niDigital_FetchHistoryRAMScanCycleNumber.side_effect = self.side_effects_helper.niDigital_FetchHistoryRAMScanCycleNumber - self.side_effects_helper['FetchHistoryRAMScanCycleNumber']['scanCycleNumber'] = -1 - self.patched_library.niDigital_FetchHistoryRAMCyclePinData.side_effect = self.side_effects_helper.niDigital_FetchHistoryRAMCyclePinData - self.side_effects_helper['FetchHistoryRAMCyclePinData']['actualNumPinData'] = 8 - self.side_effects_helper['FetchHistoryRAMCyclePinData']['expectedPinStates'] = [nidigital.PinState.X.value] * 8 - self.side_effects_helper['FetchHistoryRAMCyclePinData']['actualPinStates'] = [nidigital.PinState.NOT_A_PIN_STATE.value] * 8 - self.side_effects_helper['FetchHistoryRAMCyclePinData']['perPinPassFail'] = [True] * 8 - with nidigital.Session('') as session: - history_ram_cycle_info = session.sites[1].fetch_history_ram_cycle_information( - position=6, - samples_to_read=-1) + self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = ( + self.side_effects_helper.niDigital_GetHistoryRAMSampleCount + ) + self.side_effects_helper["GetHistoryRAMSampleCount"]["sampleCount"] = 7 + self.patched_library.niDigital_GetAttributeViBoolean.side_effect = ( + self.side_effects_helper.niDigital_GetAttributeViBoolean + ) + self.side_effects_helper["GetAttributeViBoolean"][ + "value" + ] = True # history_ram_number_of_samples_is_finite + self.patched_library.niDigital_FetchHistoryRAMCycleInformation.side_effect = ( + self.side_effects_helper.niDigital_FetchHistoryRAMCycleInformation + ) + self.side_effects_helper["FetchHistoryRAMCycleInformation"]["patternIndex"] = 0 + self.side_effects_helper["FetchHistoryRAMCycleInformation"]["timeSetIndex"] = 0 + self.side_effects_helper["FetchHistoryRAMCycleInformation"]["vectorNumber"] = 9 + self.side_effects_helper["FetchHistoryRAMCycleInformation"]["cycleNumber"] = 11 + self.side_effects_helper["FetchHistoryRAMCycleInformation"]["numDutCycles"] = 1 + self.patched_library.niDigital_GetPatternName.side_effect = ( + self.side_effects_helper.niDigital_GetPatternName + ) + self.side_effects_helper["GetPatternName"]["name"] = "new_pattern" + self.patched_library.niDigital_GetTimeSetName.side_effect = ( + self.side_effects_helper.niDigital_GetTimeSetName + ) + self.side_effects_helper["GetTimeSetName"]["name"] = "t0" + self.patched_library.niDigital_FetchHistoryRAMScanCycleNumber.side_effect = ( + self.side_effects_helper.niDigital_FetchHistoryRAMScanCycleNumber + ) + self.side_effects_helper["FetchHistoryRAMScanCycleNumber"][ + "scanCycleNumber" + ] = -1 + self.patched_library.niDigital_FetchHistoryRAMCyclePinData.side_effect = ( + self.side_effects_helper.niDigital_FetchHistoryRAMCyclePinData + ) + self.side_effects_helper["FetchHistoryRAMCyclePinData"]["actualNumPinData"] = 8 + self.side_effects_helper["FetchHistoryRAMCyclePinData"]["expectedPinStates"] = [ + nidigital.PinState.X.value + ] * 8 + self.side_effects_helper["FetchHistoryRAMCyclePinData"]["actualPinStates"] = [ + nidigital.PinState.NOT_A_PIN_STATE.value + ] * 8 + self.side_effects_helper["FetchHistoryRAMCyclePinData"]["perPinPassFail"] = [ + True + ] * 8 + with nidigital.Session("") as session: + history_ram_cycle_info = session.sites[ + 1 + ].fetch_history_ram_cycle_information(position=6, samples_to_read=-1) self.patched_library.niDigital_FetchHistoryRAMCycleInformation.assert_called_once() assert self.patched_library.niDigital_GetPatternName.call_count == 2 assert self.patched_library.niDigital_GetTimeSetName.call_count == 2 self.patched_library.niDigital_FetchHistoryRAMScanCycleNumber.assert_called_once() - assert self.patched_library.niDigital_FetchHistoryRAMCyclePinData.call_count == 2 + assert ( + self.patched_library.niDigital_FetchHistoryRAMCyclePinData.call_count + == 2 + ) assert len(history_ram_cycle_info) == 1 assert history_ram_cycle_info[0].vector_number == 9 @@ -146,21 +415,38 @@ def test_fetch_history_ram_cycle_information_position_last(self): # this test should be converted to a system test. (GitHub issue# 1353). def test_fetch_history_ram_cycle_information_samples_to_read_too_much(self): - self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = self.side_effects_helper.niDigital_GetHistoryRAMSampleCount - self.side_effects_helper['GetHistoryRAMSampleCount']['sampleCount'] = 7 - self.patched_library.niDigital_GetAttributeViBoolean.side_effect = self.side_effects_helper.niDigital_GetAttributeViBoolean - self.side_effects_helper['GetAttributeViBoolean']['value'] = True # history_ram_number_of_samples_is_finite - - with nidigital.Session('') as session: + self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = ( + self.side_effects_helper.niDigital_GetHistoryRAMSampleCount + ) + self.side_effects_helper["GetHistoryRAMSampleCount"]["sampleCount"] = 7 + self.patched_library.niDigital_GetAttributeViBoolean.side_effect = ( + self.side_effects_helper.niDigital_GetAttributeViBoolean + ) + self.side_effects_helper["GetAttributeViBoolean"][ + "value" + ] = True # history_ram_number_of_samples_is_finite + + with nidigital.Session("") as session: assert session.sites[1].get_history_ram_sample_count() == 7 - expected_error_description = ( - 'position: Specified value = 3, samples_to_read: Specified value = 5; Samples available = 4.') + expected_error_description = "position: Specified value = 3, samples_to_read: Specified value = 5; Samples available = 4." with pytest.raises(ValueError, match=expected_error_description): - session.sites[1].fetch_history_ram_cycle_information(position=3, samples_to_read=5) + session.sites[1].fetch_history_ram_cycle_information( + position=3, samples_to_read=5 + ) # Helper function for mocking multiple calls - def niDigital_FetchHistoryRAMCycleInformation_looping(self, vi, site, sample_index, pattern_index, time_set_index, vector_number, cycle_number, num_dut_cycles): # noqa: N802 + def niDigital_FetchHistoryRAMCycleInformation_looping( + self, + vi, + site, + sample_index, + pattern_index, + time_set_index, + vector_number, + cycle_number, + num_dut_cycles, + ): # noqa: N802 sample_index_int = int(sample_index.value) pattern_index.contents.value = self.pattern_indices_looping[sample_index_int] time_set_index.contents.value = self.time_set_indices_looping[sample_index_int] @@ -170,66 +456,125 @@ def niDigital_FetchHistoryRAMCycleInformation_looping(self, vi, site, sample_ind return 0 # Helper function for mocking multiple calls - def niDigital_GetTimeSetName_looping(self, vi, time_set_index, name_buffer_size, name): # noqa: N802 + def niDigital_GetTimeSetName_looping( + self, vi, time_set_index, name_buffer_size, name + ): # noqa: N802 time_set_index_int = int(time_set_index.value) if int(name_buffer_size.value) == 0: - return (len(self.time_set_name_looping[time_set_index_int])) - bytes_to_copy = self.time_set_name_looping[time_set_index_int].encode('ascii') + return len(self.time_set_name_looping[time_set_index_int]) + bytes_to_copy = self.time_set_name_looping[time_set_index_int].encode("ascii") for i in range(0, len(bytes_to_copy)): name[i] = bytes_to_copy[i] return 0 # Helper function for mocking multiple calls - def niDigital_FetchHistoryRAMScanCycleNumber_looping(self, vi, site, sample_index, scan_cycle_number): # noqa: N802 + def niDigital_FetchHistoryRAMScanCycleNumber_looping( + self, vi, site, sample_index, scan_cycle_number + ): # noqa: N802 sample_index_int = int(sample_index.value) - scan_cycle_number.contents.value = self.scan_cycle_number_looping[sample_index_int] + scan_cycle_number.contents.value = self.scan_cycle_number_looping[ + sample_index_int + ] return 0 # Helper function for mocking multiple calls - def niDigital_FetchHistoryRAMCyclePinData_looping(self, vi, site, pin_list, sample_index, dut_cycle_index, pin_data_buffer_size, expected_pin_states, actual_pin_states, per_pin_pass_fail, actual_num_pin_data): # noqa: N802 + def niDigital_FetchHistoryRAMCyclePinData_looping( + self, + vi, + site, + pin_list, + sample_index, + dut_cycle_index, + pin_data_buffer_size, + expected_pin_states, + actual_pin_states, + per_pin_pass_fail, + actual_num_pin_data, + ): # noqa: N802 sample_index_int = int(sample_index.value) dut_cycle_index_int = int(dut_cycle_index.value) if int(pin_data_buffer_size.value) == 0: - actual_num_pin_data.contents.value = len(self.expected_pin_states_looping[sample_index_int][dut_cycle_index_int]) + actual_num_pin_data.contents.value = len( + self.expected_pin_states_looping[sample_index_int][dut_cycle_index_int] + ) return actual_num_pin_data.contents.value for i in range(0, int(pin_data_buffer_size.value)): - expected_pin_states[i] = self.expected_pin_states_looping[sample_index_int][dut_cycle_index_int][i].value - actual_pin_states[i] = self.actual_pin_states_looping[sample_index_int][dut_cycle_index_int][i].value - per_pin_pass_fail[i] = self.per_pin_pass_fail_looping[sample_index_int][dut_cycle_index_int][i] + expected_pin_states[i] = self.expected_pin_states_looping[sample_index_int][ + dut_cycle_index_int + ][i].value + actual_pin_states[i] = self.actual_pin_states_looping[sample_index_int][ + dut_cycle_index_int + ][i].value + per_pin_pass_fail[i] = self.per_pin_pass_fail_looping[sample_index_int][ + dut_cycle_index_int + ][i] return 0 # TODO(sbethur): When nidigital driver provides better simulation support (internal bug# 992370), # this test should be converted to a system test. (GitHub issue# 1353). def test_fetch_history_ram_cycle_information_samples_to_read_all(self): - self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = self.side_effects_helper.niDigital_GetHistoryRAMSampleCount - self.side_effects_helper['GetHistoryRAMSampleCount']['sampleCount'] = 7 - self.patched_library.niDigital_GetAttributeViBoolean.side_effect = self.side_effects_helper.niDigital_GetAttributeViBoolean - self.side_effects_helper['GetAttributeViBoolean']['value'] = True # history_ram_number_of_samples_is_finite - self.patched_library.niDigital_FetchHistoryRAMCycleInformation.side_effect = self.niDigital_FetchHistoryRAMCycleInformation_looping - self.patched_library.niDigital_GetPatternName.side_effect = self.side_effects_helper.niDigital_GetPatternName - self.side_effects_helper['GetPatternName']['name'] = 'new_pattern' - self.patched_library.niDigital_GetTimeSetName.side_effect = self.niDigital_GetTimeSetName_looping - self.patched_library.niDigital_FetchHistoryRAMScanCycleNumber.side_effect = self.niDigital_FetchHistoryRAMScanCycleNumber_looping - self.patched_library.niDigital_FetchHistoryRAMCyclePinData.side_effect = self.niDigital_FetchHistoryRAMCyclePinData_looping - self.patched_library.niDigital_GetPatternPinList.side_effect = self.side_effects_helper.niDigital_GetPatternPinList - pin_list = ['LO' + str(i) for i in range(4)] + ['HI' + str(i) for i in range(4)] - self.side_effects_helper['GetPatternPinList']['pinList'] = ','.join(pin_list) - with nidigital.Session('') as session: - history_ram_cycle_info = session.sites[1].fetch_history_ram_cycle_information( - position=0, - samples_to_read=-1) - assert self.patched_library.niDigital_FetchHistoryRAMCycleInformation.call_count == 7 - assert self.patched_library.niDigital_GetPatternName.call_count == 2 # there's only one pattern, so this is a 2 - assert self.patched_library.niDigital_GetTimeSetName.call_count == 6 # 3 time sets, so this is a 6 - assert self.patched_library.niDigital_FetchHistoryRAMScanCycleNumber.call_count == 7 - assert self.patched_library.niDigital_FetchHistoryRAMCyclePinData.call_count == 20 # 10 DUT cycles + self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = ( + self.side_effects_helper.niDigital_GetHistoryRAMSampleCount + ) + self.side_effects_helper["GetHistoryRAMSampleCount"]["sampleCount"] = 7 + self.patched_library.niDigital_GetAttributeViBoolean.side_effect = ( + self.side_effects_helper.niDigital_GetAttributeViBoolean + ) + self.side_effects_helper["GetAttributeViBoolean"][ + "value" + ] = True # history_ram_number_of_samples_is_finite + self.patched_library.niDigital_FetchHistoryRAMCycleInformation.side_effect = ( + self.niDigital_FetchHistoryRAMCycleInformation_looping + ) + self.patched_library.niDigital_GetPatternName.side_effect = ( + self.side_effects_helper.niDigital_GetPatternName + ) + self.side_effects_helper["GetPatternName"]["name"] = "new_pattern" + self.patched_library.niDigital_GetTimeSetName.side_effect = ( + self.niDigital_GetTimeSetName_looping + ) + self.patched_library.niDigital_FetchHistoryRAMScanCycleNumber.side_effect = ( + self.niDigital_FetchHistoryRAMScanCycleNumber_looping + ) + self.patched_library.niDigital_FetchHistoryRAMCyclePinData.side_effect = ( + self.niDigital_FetchHistoryRAMCyclePinData_looping + ) + self.patched_library.niDigital_GetPatternPinList.side_effect = ( + self.side_effects_helper.niDigital_GetPatternPinList + ) + pin_list = ["LO" + str(i) for i in range(4)] + ["HI" + str(i) for i in range(4)] + self.side_effects_helper["GetPatternPinList"]["pinList"] = ",".join(pin_list) + with nidigital.Session("") as session: + history_ram_cycle_info = session.sites[ + 1 + ].fetch_history_ram_cycle_information(position=0, samples_to_read=-1) + assert ( + self.patched_library.niDigital_FetchHistoryRAMCycleInformation.call_count + == 7 + ) + assert ( + self.patched_library.niDigital_GetPatternName.call_count == 2 + ) # there's only one pattern, so this is a 2 + assert ( + self.patched_library.niDigital_GetTimeSetName.call_count == 6 + ) # 3 time sets, so this is a 6 + assert ( + self.patched_library.niDigital_FetchHistoryRAMScanCycleNumber.call_count + == 7 + ) + assert ( + self.patched_library.niDigital_FetchHistoryRAMCyclePinData.call_count + == 20 + ) # 10 DUT cycles assert len(history_ram_cycle_info) == 7 - assert all([i.pattern_name == 'new_pattern' for i in history_ram_cycle_info]) + assert all( + [i.pattern_name == "new_pattern" for i in history_ram_cycle_info] + ) time_set_names = [i.time_set_name for i in history_ram_cycle_info] - assert time_set_names == ['t0', 'tScan', 'tScan', 't2X', 't2X', 't2X', 't0'] + assert time_set_names == ["t0", "tScan", "tScan", "t2X", "t2X", "t2X", "t0"] vector_numbers = [i.vector_number for i in history_ram_cycle_info] assert vector_numbers == [5, 6, 6, 7, 7, 8, 9] @@ -240,7 +585,7 @@ def test_fetch_history_ram_cycle_information_samples_to_read_all(self): scan_cycle_numbers = [i.scan_cycle_number for i in history_ram_cycle_info] assert scan_cycle_numbers == [-1, 0, 1, -1, -1, -1, -1] - pin_names = session.get_pattern_pin_names('new_pattern') + pin_names = session.get_pattern_pin_names("new_pattern") assert self.patched_library.niDigital_GetPatternPinList.call_count == 2 assert pin_names == pin_list @@ -251,9 +596,15 @@ def test_fetch_history_ram_cycle_information_samples_to_read_all(self): # So, need to skip those pin states while comparing. actual_pin_states = [i.actual_pin_states for i in history_ram_cycle_info] assert len(actual_pin_states) == len(self.actual_pin_states_looping) - for vector_pin_states, vector_pin_states_expected_by_test in zip(actual_pin_states, self.actual_pin_states_looping): - for cycle_pin_states, cycle_pin_states_expected_by_test in zip(vector_pin_states, vector_pin_states_expected_by_test): - for pin_state, pin_state_expected_by_test in zip(cycle_pin_states, cycle_pin_states_expected_by_test): + for vector_pin_states, vector_pin_states_expected_by_test in zip( + actual_pin_states, self.actual_pin_states_looping + ): + for cycle_pin_states, cycle_pin_states_expected_by_test in zip( + vector_pin_states, vector_pin_states_expected_by_test + ): + for pin_state, pin_state_expected_by_test in zip( + cycle_pin_states, cycle_pin_states_expected_by_test + ): if pin_state_expected_by_test is not nidigital.PinState.X: assert pin_state == pin_state_expected_by_test @@ -262,79 +613,143 @@ def test_fetch_history_ram_cycle_information_samples_to_read_all(self): assert per_pin_pass_fail == self.per_pin_pass_fail_looping # Helper function for validating pin list behavior in fetch_history_ram_cycle_information. - def niDigital_FetchHistoryRAMCyclePinData_check_pins_looping(self, vi, site, pin_list, sample_index, dut_cycle_index, pin_data_buffer_size, expected_pin_states, actual_pin_states, per_pin_pass_fail, actual_num_pin_data): # noqa: N802 + def niDigital_FetchHistoryRAMCyclePinData_check_pins_looping( + self, + vi, + site, + pin_list, + sample_index, + dut_cycle_index, + pin_data_buffer_size, + expected_pin_states, + actual_pin_states, + per_pin_pass_fail, + actual_num_pin_data, + ): # noqa: N802 sample_index_int = int(sample_index.value) dut_cycle_index_int = int(dut_cycle_index.value) if int(pin_data_buffer_size.value) == 0: - actual_num_pin_data.contents.value = len(self.expected_pin_states_check_pins_looping[sample_index_int][dut_cycle_index_int]) + actual_num_pin_data.contents.value = len( + self.expected_pin_states_check_pins_looping[sample_index_int][ + dut_cycle_index_int + ] + ) return actual_num_pin_data.contents.value for i in range(0, int(pin_data_buffer_size.value)): - expected_pin_states[i] = self.expected_pin_states_check_pins_looping[sample_index_int][dut_cycle_index_int][i].value - actual_pin_states[i] = self.actual_pin_states_check_pins_looping[sample_index_int][dut_cycle_index_int][i].value - per_pin_pass_fail[i] = self.per_pin_pass_fail_check_pins_looping[sample_index_int][dut_cycle_index_int][i] + expected_pin_states[i] = self.expected_pin_states_check_pins_looping[ + sample_index_int + ][dut_cycle_index_int][i].value + actual_pin_states[i] = self.actual_pin_states_check_pins_looping[ + sample_index_int + ][dut_cycle_index_int][i].value + per_pin_pass_fail[i] = self.per_pin_pass_fail_check_pins_looping[ + sample_index_int + ][dut_cycle_index_int][i] assert self.expected_pin_list_check_pins_looping is not None - assert pin_list.value.decode('ascii') == self.expected_pin_list_check_pins_looping + assert ( + pin_list.value.decode("ascii") == self.expected_pin_list_check_pins_looping + ) return 0 def test_fetch_history_ram_cycle_information_pin_list(self): - self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = self.side_effects_helper.niDigital_GetHistoryRAMSampleCount - self.side_effects_helper['GetHistoryRAMSampleCount']['sampleCount'] = 1 - self.patched_library.niDigital_GetAttributeViBoolean.side_effect = self.side_effects_helper.niDigital_GetAttributeViBoolean - self.side_effects_helper['GetAttributeViBoolean']['value'] = True # history_ram_number_of_samples_is_finite - self.patched_library.niDigital_FetchHistoryRAMCycleInformation.side_effect = self.side_effects_helper.niDigital_FetchHistoryRAMCycleInformation - self.side_effects_helper['FetchHistoryRAMCycleInformation']['patternIndex'] = 0 - self.side_effects_helper['FetchHistoryRAMCycleInformation']['timeSetIndex'] = 0 - self.side_effects_helper['FetchHistoryRAMCycleInformation']['vectorNumber'] = 0 - self.side_effects_helper['FetchHistoryRAMCycleInformation']['cycleNumber'] = 0 - self.side_effects_helper['FetchHistoryRAMCycleInformation']['numDutCycles'] = 1 - self.patched_library.niDigital_GetPatternName.side_effect = self.side_effects_helper.niDigital_GetPatternName - self.side_effects_helper['GetPatternName']['name'] = 'new_pattern' - self.patched_library.niDigital_GetTimeSetName.side_effect = self.side_effects_helper.niDigital_GetTimeSetName - self.side_effects_helper['GetTimeSetName']['name'] = 't0' - self.patched_library.niDigital_FetchHistoryRAMScanCycleNumber.side_effect = self.side_effects_helper.niDigital_FetchHistoryRAMScanCycleNumber - self.side_effects_helper['FetchHistoryRAMScanCycleNumber']['scanCycleNumber'] = -1 - self.patched_library.niDigital_FetchHistoryRAMCyclePinData.side_effect = self.niDigital_FetchHistoryRAMCyclePinData_check_pins_looping - with nidigital.Session('') as session: - self.expected_pin_list_check_pins_looping = 'PinA,PinB' - session.sites[0].pins['PinA', 'PinB'].fetch_history_ram_cycle_information(position=0, samples_to_read=-1) - self.expected_pin_list_check_pins_looping = '' - session.sites[0].fetch_history_ram_cycle_information(position=0, samples_to_read=-1) - assert self.patched_library.niDigital_FetchHistoryRAMCyclePinData.call_count == 4 + self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = ( + self.side_effects_helper.niDigital_GetHistoryRAMSampleCount + ) + self.side_effects_helper["GetHistoryRAMSampleCount"]["sampleCount"] = 1 + self.patched_library.niDigital_GetAttributeViBoolean.side_effect = ( + self.side_effects_helper.niDigital_GetAttributeViBoolean + ) + self.side_effects_helper["GetAttributeViBoolean"][ + "value" + ] = True # history_ram_number_of_samples_is_finite + self.patched_library.niDigital_FetchHistoryRAMCycleInformation.side_effect = ( + self.side_effects_helper.niDigital_FetchHistoryRAMCycleInformation + ) + self.side_effects_helper["FetchHistoryRAMCycleInformation"]["patternIndex"] = 0 + self.side_effects_helper["FetchHistoryRAMCycleInformation"]["timeSetIndex"] = 0 + self.side_effects_helper["FetchHistoryRAMCycleInformation"]["vectorNumber"] = 0 + self.side_effects_helper["FetchHistoryRAMCycleInformation"]["cycleNumber"] = 0 + self.side_effects_helper["FetchHistoryRAMCycleInformation"]["numDutCycles"] = 1 + self.patched_library.niDigital_GetPatternName.side_effect = ( + self.side_effects_helper.niDigital_GetPatternName + ) + self.side_effects_helper["GetPatternName"]["name"] = "new_pattern" + self.patched_library.niDigital_GetTimeSetName.side_effect = ( + self.side_effects_helper.niDigital_GetTimeSetName + ) + self.side_effects_helper["GetTimeSetName"]["name"] = "t0" + self.patched_library.niDigital_FetchHistoryRAMScanCycleNumber.side_effect = ( + self.side_effects_helper.niDigital_FetchHistoryRAMScanCycleNumber + ) + self.side_effects_helper["FetchHistoryRAMScanCycleNumber"][ + "scanCycleNumber" + ] = -1 + self.patched_library.niDigital_FetchHistoryRAMCyclePinData.side_effect = ( + self.niDigital_FetchHistoryRAMCyclePinData_check_pins_looping + ) + with nidigital.Session("") as session: + self.expected_pin_list_check_pins_looping = "PinA,PinB" + session.sites[0].pins["PinA", "PinB"].fetch_history_ram_cycle_information( + position=0, samples_to_read=-1 + ) + self.expected_pin_list_check_pins_looping = "" + session.sites[0].fetch_history_ram_cycle_information( + position=0, samples_to_read=-1 + ) + assert ( + self.patched_library.niDigital_FetchHistoryRAMCyclePinData.call_count + == 4 + ) # Helper function for validating site behavior in fetch_history_ram_cycle_information. - def niDigital_GetHistoryRAMSampleCount_check_site_looping(self, vi, site, sample_count): # noqa: N802 - assert site.value.decode('ascii') == 'site{}'.format(self.site_numbers_looping[self.iteration_check_site_looping]) - sample_count.contents.value = 0 # we don't care if this is right as long as the fetch does not error + def niDigital_GetHistoryRAMSampleCount_check_site_looping( + self, vi, site, sample_count + ): # noqa: N802 + assert site.value.decode("ascii") == "site{}".format( + self.site_numbers_looping[self.iteration_check_site_looping] + ) + sample_count.contents.value = ( + 0 # we don't care if this is right as long as the fetch does not error + ) self.iteration_check_site_looping += 1 return 0 def test_fetch_history_ram_cycle_information_site_n(self): - self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = self.niDigital_GetHistoryRAMSampleCount_check_site_looping - self.side_effects_helper['GetHistoryRAMSampleCount']['sampleCount'] = 1 + self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = ( + self.niDigital_GetHistoryRAMSampleCount_check_site_looping + ) + self.side_effects_helper["GetHistoryRAMSampleCount"]["sampleCount"] = 1 - with nidigital.Session('') as session: + with nidigital.Session("") as session: for s in self.site_numbers_looping: - session.sites[s].fetch_history_ram_cycle_information(position=0, samples_to_read=0) - assert self.patched_library.niDigital_GetHistoryRAMSampleCount.call_count == len(self.site_numbers_looping) + session.sites[s].fetch_history_ram_cycle_information( + position=0, samples_to_read=0 + ) + assert ( + self.patched_library.niDigital_GetHistoryRAMSampleCount.call_count + == len(self.site_numbers_looping) + ) def test_pin_state_enum_print(self): - assert str(nidigital.PinState.ZERO) == '0' - assert str(nidigital.PinState.ONE) == '1' - assert str(nidigital.PinState.NOT_A_PIN_STATE) == 'Not a Pin State' - assert str(nidigital.PinState.PIN_STATE_NOT_ACQUIRED) == 'Pin State Not Acquired' - assert str(nidigital.PinState.L) == 'L' - assert str(nidigital.PinState.H) == 'H' - assert str(nidigital.PinState.X) == 'X' - assert str(nidigital.PinState.M) == 'M' - assert str(nidigital.PinState.V) == 'V' - assert str(nidigital.PinState.D) == 'D' - assert str(nidigital.PinState.E) == 'E' + assert str(nidigital.PinState.ZERO) == "0" + assert str(nidigital.PinState.ONE) == "1" + assert str(nidigital.PinState.NOT_A_PIN_STATE) == "Not a Pin State" + assert ( + str(nidigital.PinState.PIN_STATE_NOT_ACQUIRED) == "Pin State Not Acquired" + ) + assert str(nidigital.PinState.L) == "L" + assert str(nidigital.PinState.H) == "H" + assert str(nidigital.PinState.X) == "X" + assert str(nidigital.PinState.M) == "M" + assert str(nidigital.PinState.V) == "V" + assert str(nidigital.PinState.D) == "D" + assert str(nidigital.PinState.E) == "E" def test_write_static_pin_state_enum_print(self): - assert str(nidigital.WriteStaticPinState.ZERO) == '0' - assert str(nidigital.WriteStaticPinState.ONE) == '1' - assert str(nidigital.WriteStaticPinState.X) == 'X' + assert str(nidigital.WriteStaticPinState.ZERO) == "0" + assert str(nidigital.WriteStaticPinState.ONE) == "1" + assert str(nidigital.WriteStaticPinState.X) == "X" diff --git a/generated/nidigital/setup.py b/generated/nidigital/setup.py index d26953bee..4094715b1 100644 --- a/generated/nidigital/setup.py +++ b/generated/nidigital/setup.py @@ -15,42 +15,45 @@ def finalize_options(self): def run_tests(self): import pytest + pytest.main(self.test_args) -pypi_name = 'nidigital' +pypi_name = "nidigital" def read_contents(file_to_read): - with open(file_to_read, 'r') as f: + with open(file_to_read, "r") as f: return f.read() setup( name=pypi_name, zip_safe=True, - version='1.4.2.dev0', - description='NI-Digital Pattern Driver Python API', - long_description=read_contents('README.rst'), - long_description_content_type='text/x-rst', - author='NI', + version="1.4.2.dev0", + description="NI-Digital Pattern Driver Python API", + long_description=read_contents("README.rst"), + long_description_content_type="text/x-rst", + author="NI", author_email="opensource@ni.com", url="https://github.com/ni/nimi-python", maintainer="NI", maintainer_email="opensource@ni.com", - keywords=['nidigital'], - license='MIT', + keywords=["nidigital"], + license="MIT", include_package_data=True, - packages=['nidigital'], + packages=["nidigital"], install_requires=[ 'enum34;python_version<"3.4"', 'singledispatch;python_version<"3.4"', - 'hightime>=0.2.0', - 'nitclk', + "hightime>=0.2.0", + "nitclk", + ], + setup_requires=[ + "pytest-runner", ], - setup_requires=['pytest-runner', ], - tests_require=['pytest'], - test_suite='tests', + tests_require=["pytest"], + test_suite="tests", classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -65,8 +68,8 @@ def read_contents(file_to_read): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", - "Topic :: System :: Hardware :: Hardware Drivers" + "Topic :: System :: Hardware :: Hardware Drivers", ], - cmdclass={'test': PyTest}, - package_data={pypi_name: ['VERSION']}, + cmdclass={"test": PyTest}, + package_data={pypi_name: ["VERSION"]}, ) diff --git a/generated/nidmm/nidmm/__init__.py b/generated/nidmm/nidmm/__init__.py index 6df35e03c..33492769b 100644 --- a/generated/nidmm/nidmm/__init__.py +++ b/generated/nidmm/nidmm/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = '1.4.2.dev0' +__version__ = "1.4.2.dev0" from nidmm.enums import * # noqa: F403,F401,H303 from nidmm.errors import DriverWarning # noqa: F401 @@ -11,12 +11,12 @@ def get_diagnostic_information(): - '''Get diagnostic information about the system state that is suitable for printing or logging + """Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - ''' + """ import os import pkg_resources import platform @@ -24,73 +24,80 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return (struct.calcsize("P") == 8) + return struct.calcsize("P") == 8 def is_os_64bit(): - return platform.machine().endswith('64') + return platform.machine().endswith("64") def is_venv(): - return 'VIRTUAL_ENV' in os.environ + return "VIRTUAL_ENV" in os.environ info = {} - info['os'] = {} - info['python'] = {} - info['driver'] = {} - info['module'] = {} - if platform.system() == 'Windows': + info["os"] = {} + info["python"] = {} + info["driver"] = {} + info["module"] = {} + if platform.system() == "Windows": try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = 'Windows' + os_name = "Windows" try: - driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-DMM\CurrentVersion") + driver_version_key = winreg.OpenKey( + winreg.HKEY_LOCAL_MACHINE, + r"SOFTWARE\National Instruments\NI-DMM\CurrentVersion", + ) driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = 'Unknown' - elif platform.system() == 'Linux': - os_name = 'Linux' - driver_version = 'Unknown' + driver_version = "Unknown" + elif platform.system() == "Linux": + os_name = "Linux" + driver_version = "Unknown" else: - raise SystemError('Unsupported platform: {}'.format(platform.system())) + raise SystemError("Unsupported platform: {}".format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] - - info['os']['name'] = os_name - info['os']['version'] = platform.version() - info['os']['bits'] = '64' if is_os_64bit() else '32' - info['driver']['name'] = "NI-DMM" - info['driver']['version'] = driver_version - info['module']['name'] = 'nidmm' - info['module']['version'] = "1.4.2.dev0" - info['python']['version'] = sys.version - info['python']['bits'] = '64' if is_python_64bit() else '32' - info['python']['is_venv'] = is_venv() - info['python']['packages'] = installed_packages_list + installed_packages_list = [ + { + "name": i.key, + "version": i.version, + } + for i in installed_packages + ] + + info["os"]["name"] = os_name + info["os"]["version"] = platform.version() + info["os"]["bits"] = "64" if is_os_64bit() else "32" + info["driver"]["name"] = "NI-DMM" + info["driver"]["version"] = driver_version + info["module"]["name"] = "nidmm" + info["module"]["version"] = "1.4.2.dev0" + info["python"]["version"] = sys.version + info["python"]["bits"] = "64" if is_python_64bit() else "32" + info["python"]["is_venv"] = is_venv() + info["python"]["packages"] = installed_packages_list return info def print_diagnostic_information(): - '''Print diagnostic information in a format suitable for issue report + """Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - ''' + """ info = get_diagnostic_information() - row_format = ' {:<10} {}' - for type in ['OS', 'Driver', 'Module', 'Python']: + row_format = " {:<10} {}" + for type in ["OS", "Driver", "Module", "Python"]: typename = type.lower() - print(type + ':') + print(type + ":") for item in info[typename]: - if item != 'packages': - print(row_format.format(item.title() + ':', info[typename][item])) - print(' Installed Packages:') - for p in info['python']['packages']: - print((' ' * 8) + p['name'] + '==' + p['version']) + if item != "packages": + print(row_format.format(item.title() + ":", info[typename][item])) + print(" Installed Packages:") + for p in info["python"]["packages"]: + print((" " * 8) + p["name"] + "==" + p["version"]) return info - - diff --git a/generated/nidmm/nidmm/_attributes.py b/generated/nidmm/nidmm/_attributes.py index c4df48ab4..c282889a3 100644 --- a/generated/nidmm/nidmm/_attributes.py +++ b/generated/nidmm/nidmm/_attributes.py @@ -6,14 +6,13 @@ class Attribute(object): - '''Base class for all typed attributes.''' + """Base class for all typed attributes.""" def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -22,16 +21,19 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) + return hightime.timedelta( + milliseconds=session._get_attribute_vi_int32(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) + session._set_attribute_vi_int32( + self._attribute_id, + _converters.convert_timedelta_to_milliseconds_int32(value).value, + ) class AttributeViInt64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -40,7 +42,6 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -49,16 +50,19 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) + return hightime.timedelta( + seconds=session._get_attribute_vi_real64(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) + session._set_attribute_vi_real64( + self._attribute_id, + _converters.convert_timedelta_to_seconds_real64(value).value, + ) class AttributeViString(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -67,16 +71,17 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) + session._set_attribute_vi_string( + self._attribute_id, + _converters.convert_repeated_capabilities_without_prefix(value), + ) class AttributeViBoolean(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -85,31 +90,36 @@ def __set__(self, session, value): class AttributeEnum(object): - def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) + return self._attribute_type( + self._underlying_attribute.__get__(session, session_type) + ) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) + raise TypeError( + "must be " + + str(self._attribute_type.__name__) + + " not " + + str(type(value).__name__) + ) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): - def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from nidmm.session import SessionReference + return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) - - - + session._set_attribute_vi_session( + self._attribute_id, _converters.convert_to_nitclk_session_number(value) + ) diff --git a/generated/nidmm/nidmm/_converters.py b/generated/nidmm/nidmm/_converters.py index 5248b0b4b..a9c4436af 100644 --- a/generated/nidmm/nidmm/_converters.py +++ b/generated/nidmm/nidmm/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - '''Base version that should not be called + """Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,36 +40,38 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - ''' - raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + """ + raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - '''Integer version''' + """Integer version""" return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - '''String version (this is the most complex) + """String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - ''' + """ # First we deal with a list - rep_cap_list = repeated_capability.split(',') + rep_cap_list = repeated_capability.split(",") if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, '').replace(':', '-') - rc = r.split('-') + r = repeated_capability.strip().replace(prefix, "").replace(":", "-") + rc = r.split("-") if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + raise errors.InvalidRepeatedCapabilityError( + "Multiple '-' or ':'", repeated_capability + ) try: start = int(rc[0]) end = int(rc[1]) @@ -85,7 +87,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, '').strip()] + return [repeated_capability.replace(prefix, "").strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -94,7 +96,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - '''Iterable version - can handle lists, ranges, and tuples''' + """Iterable version - can handle lists, ranges, and tuples""" rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -103,16 +105,22 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - '''slice version''' + """slice version""" + def ifnone(a, b): return b if a is None else a + # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) + rng = range( + ifnone(repeated_capability.start, 0), + repeated_capability.stop, + ifnone(repeated_capability.step, 1), + ) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=''): - '''Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=""): + """Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -120,15 +128,17 @@ def convert_repeated_capabilities(repeated_capability, prefix=''): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - ''' + """ # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] + return [ + prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) + ] def convert_repeated_capabilities_without_prefix(repeated_capability): - '''Convert a repeated capabilities object, without any prefix, to a comma delimited list + """Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -144,8 +154,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - ''' - return ','.join(convert_repeated_capabilities(repeated_capability, '')) + """ + return ",".join(convert_repeated_capabilities(repeated_capability, "")) def _convert_timedelta(value, library_type, scaling): @@ -158,7 +168,14 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: + if library_type in [ + _visatype.ViInt64, + _visatype.ViInt32, + _visatype.ViUInt32, + _visatype.ViInt16, + _visatype.ViUInt16, + _visatype.ViInt8, + ]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -195,34 +212,36 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - 'rangecheck': 'RangeCheck', - 'queryinstrstatus': 'QueryInstrStatus', - 'cache': 'Cache', - 'simulate': 'Simulate', - 'recordcoercions': 'RecordCoercions', - 'interchangecheck': 'InterchangeCheck', - 'driversetup': 'DriverSetup', - 'range_check': 'RangeCheck', - 'query_instr_status': 'QueryInstrStatus', - 'record_coercions': 'RecordCoercions', - 'interchange_check': 'InterchangeCheck', - 'driver_setup': 'DriverSetup', + "rangecheck": "RangeCheck", + "queryinstrstatus": "QueryInstrStatus", + "cache": "Cache", + "simulate": "Simulate", + "recordcoercions": "RecordCoercions", + "interchangecheck": "InterchangeCheck", + "driversetup": "DriverSetup", + "range_check": "RangeCheck", + "query_instr_status": "QueryInstrStatus", + "record_coercions": "RecordCoercions", + "interchange_check": "InterchangeCheck", + "driver_setup": "DriverSetup", } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': - value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') - elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': + if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": + value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") + elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": if not isinstance(values[k], dict): - raise TypeError('DriverSetup must be a dictionary') - value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) + raise TypeError("DriverSetup must be a dictionary") + value = "DriverSetup=" + ( + ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) + ) else: - value = k + ('=1' if values[k] is True else '=0') + value = k + ("=1" if values[k] is True else "=0") init_with_options.append(value) - init_with_options_string = ','.join(init_with_options) + init_with_options_string = ",".join(init_with_options) return init_with_options_string @@ -251,11 +270,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(',')] + return [x.strip() for x in comma_separated_string.split(",")] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -267,11 +286,17 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - ''' - chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) - repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] + """ + chained_repeated_capability_items = convert_comma_separated_string_to_list( + chained_repeated_capability + ) + repeated_capability_lists = [ + [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) + ] for item in chained_repeated_capability_items: - repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] - return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] - - + repeated_capability_lists = [ + x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) + ] + return [ + ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists + ] diff --git a/generated/nidmm/nidmm/_library.py b/generated/nidmm/nidmm/_library.py index f340b4096..c8c81ea39 100644 --- a/generated/nidmm/nidmm/_library.py +++ b/generated/nidmm/nidmm/_library.py @@ -9,11 +9,11 @@ class Library(object): - '''Library + """Library Wrapper around driver library. Class will setup the correct ctypes information for every function on first call. - ''' + """ def __init__(self, ctypes_library): self._func_lock = threading.Lock() @@ -79,239 +79,503 @@ def _get_library_function(self, name): def niDMM_Abort(self, vi): # noqa: N802 with self._func_lock: if self.niDMM_Abort_cfunc is None: - self.niDMM_Abort_cfunc = self._get_library_function('niDMM_Abort') + self.niDMM_Abort_cfunc = self._get_library_function("niDMM_Abort") self.niDMM_Abort_cfunc.argtypes = [ViSession] # noqa: F405 self.niDMM_Abort_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_Abort_cfunc(vi) - def niDMM_ConfigureMeasurementAbsolute(self, vi, measurement_function, range, resolution_absolute): # noqa: N802 + def niDMM_ConfigureMeasurementAbsolute( + self, vi, measurement_function, range, resolution_absolute + ): # noqa: N802 with self._func_lock: if self.niDMM_ConfigureMeasurementAbsolute_cfunc is None: - self.niDMM_ConfigureMeasurementAbsolute_cfunc = self._get_library_function('niDMM_ConfigureMeasurementAbsolute') - self.niDMM_ConfigureMeasurementAbsolute_cfunc.argtypes = [ViSession, ViInt32, ViReal64, ViReal64] # noqa: F405 - self.niDMM_ConfigureMeasurementAbsolute_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_ConfigureMeasurementAbsolute_cfunc(vi, measurement_function, range, resolution_absolute) - - def niDMM_ConfigureMeasurementDigits(self, vi, measurement_function, range, resolution_digits): # noqa: N802 + self.niDMM_ConfigureMeasurementAbsolute_cfunc = ( + self._get_library_function("niDMM_ConfigureMeasurementAbsolute") + ) + self.niDMM_ConfigureMeasurementAbsolute_cfunc.argtypes = [ + ViSession, + ViInt32, + ViReal64, + ViReal64, + ] # noqa: F405 + self.niDMM_ConfigureMeasurementAbsolute_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDMM_ConfigureMeasurementAbsolute_cfunc( + vi, measurement_function, range, resolution_absolute + ) + + def niDMM_ConfigureMeasurementDigits( + self, vi, measurement_function, range, resolution_digits + ): # noqa: N802 with self._func_lock: if self.niDMM_ConfigureMeasurementDigits_cfunc is None: - self.niDMM_ConfigureMeasurementDigits_cfunc = self._get_library_function('niDMM_ConfigureMeasurementDigits') - self.niDMM_ConfigureMeasurementDigits_cfunc.argtypes = [ViSession, ViInt32, ViReal64, ViReal64] # noqa: F405 - self.niDMM_ConfigureMeasurementDigits_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_ConfigureMeasurementDigits_cfunc(vi, measurement_function, range, resolution_digits) - - def niDMM_ConfigureMultiPoint(self, vi, trigger_count, sample_count, sample_trigger, sample_interval): # noqa: N802 + self.niDMM_ConfigureMeasurementDigits_cfunc = ( + self._get_library_function("niDMM_ConfigureMeasurementDigits") + ) + self.niDMM_ConfigureMeasurementDigits_cfunc.argtypes = [ + ViSession, + ViInt32, + ViReal64, + ViReal64, + ] # noqa: F405 + self.niDMM_ConfigureMeasurementDigits_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDMM_ConfigureMeasurementDigits_cfunc( + vi, measurement_function, range, resolution_digits + ) + + def niDMM_ConfigureMultiPoint( + self, vi, trigger_count, sample_count, sample_trigger, sample_interval + ): # noqa: N802 with self._func_lock: if self.niDMM_ConfigureMultiPoint_cfunc is None: - self.niDMM_ConfigureMultiPoint_cfunc = self._get_library_function('niDMM_ConfigureMultiPoint') - self.niDMM_ConfigureMultiPoint_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ViInt32, ViReal64] # noqa: F405 + self.niDMM_ConfigureMultiPoint_cfunc = self._get_library_function( + "niDMM_ConfigureMultiPoint" + ) + self.niDMM_ConfigureMultiPoint_cfunc.argtypes = [ + ViSession, + ViInt32, + ViInt32, + ViInt32, + ViReal64, + ] # noqa: F405 self.niDMM_ConfigureMultiPoint_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_ConfigureMultiPoint_cfunc(vi, trigger_count, sample_count, sample_trigger, sample_interval) + return self.niDMM_ConfigureMultiPoint_cfunc( + vi, trigger_count, sample_count, sample_trigger, sample_interval + ) def niDMM_ConfigureRTDCustom(self, vi, rtd_a, rtd_b, rtd_c): # noqa: N802 with self._func_lock: if self.niDMM_ConfigureRTDCustom_cfunc is None: - self.niDMM_ConfigureRTDCustom_cfunc = self._get_library_function('niDMM_ConfigureRTDCustom') - self.niDMM_ConfigureRTDCustom_cfunc.argtypes = [ViSession, ViReal64, ViReal64, ViReal64] # noqa: F405 + self.niDMM_ConfigureRTDCustom_cfunc = self._get_library_function( + "niDMM_ConfigureRTDCustom" + ) + self.niDMM_ConfigureRTDCustom_cfunc.argtypes = [ + ViSession, + ViReal64, + ViReal64, + ViReal64, + ] # noqa: F405 self.niDMM_ConfigureRTDCustom_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_ConfigureRTDCustom_cfunc(vi, rtd_a, rtd_b, rtd_c) def niDMM_ConfigureRTDType(self, vi, rtd_type, rtd_resistance): # noqa: N802 with self._func_lock: if self.niDMM_ConfigureRTDType_cfunc is None: - self.niDMM_ConfigureRTDType_cfunc = self._get_library_function('niDMM_ConfigureRTDType') - self.niDMM_ConfigureRTDType_cfunc.argtypes = [ViSession, ViInt32, ViReal64] # noqa: F405 + self.niDMM_ConfigureRTDType_cfunc = self._get_library_function( + "niDMM_ConfigureRTDType" + ) + self.niDMM_ConfigureRTDType_cfunc.argtypes = [ + ViSession, + ViInt32, + ViReal64, + ] # noqa: F405 self.niDMM_ConfigureRTDType_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_ConfigureRTDType_cfunc(vi, rtd_type, rtd_resistance) - def niDMM_ConfigureThermistorCustom(self, vi, thermistor_a, thermistor_b, thermistor_c): # noqa: N802 + def niDMM_ConfigureThermistorCustom( + self, vi, thermistor_a, thermistor_b, thermistor_c + ): # noqa: N802 with self._func_lock: if self.niDMM_ConfigureThermistorCustom_cfunc is None: - self.niDMM_ConfigureThermistorCustom_cfunc = self._get_library_function('niDMM_ConfigureThermistorCustom') - self.niDMM_ConfigureThermistorCustom_cfunc.argtypes = [ViSession, ViReal64, ViReal64, ViReal64] # noqa: F405 - self.niDMM_ConfigureThermistorCustom_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_ConfigureThermistorCustom_cfunc(vi, thermistor_a, thermistor_b, thermistor_c) - - def niDMM_ConfigureThermocouple(self, vi, thermocouple_type, reference_junction_type): # noqa: N802 + self.niDMM_ConfigureThermistorCustom_cfunc = self._get_library_function( + "niDMM_ConfigureThermistorCustom" + ) + self.niDMM_ConfigureThermistorCustom_cfunc.argtypes = [ + ViSession, + ViReal64, + ViReal64, + ViReal64, + ] # noqa: F405 + self.niDMM_ConfigureThermistorCustom_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDMM_ConfigureThermistorCustom_cfunc( + vi, thermistor_a, thermistor_b, thermistor_c + ) + + def niDMM_ConfigureThermocouple( + self, vi, thermocouple_type, reference_junction_type + ): # noqa: N802 with self._func_lock: if self.niDMM_ConfigureThermocouple_cfunc is None: - self.niDMM_ConfigureThermocouple_cfunc = self._get_library_function('niDMM_ConfigureThermocouple') - self.niDMM_ConfigureThermocouple_cfunc.argtypes = [ViSession, ViInt32, ViInt32] # noqa: F405 + self.niDMM_ConfigureThermocouple_cfunc = self._get_library_function( + "niDMM_ConfigureThermocouple" + ) + self.niDMM_ConfigureThermocouple_cfunc.argtypes = [ + ViSession, + ViInt32, + ViInt32, + ] # noqa: F405 self.niDMM_ConfigureThermocouple_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_ConfigureThermocouple_cfunc(vi, thermocouple_type, reference_junction_type) + return self.niDMM_ConfigureThermocouple_cfunc( + vi, thermocouple_type, reference_junction_type + ) def niDMM_ConfigureTrigger(self, vi, trigger_source, trigger_delay): # noqa: N802 with self._func_lock: if self.niDMM_ConfigureTrigger_cfunc is None: - self.niDMM_ConfigureTrigger_cfunc = self._get_library_function('niDMM_ConfigureTrigger') - self.niDMM_ConfigureTrigger_cfunc.argtypes = [ViSession, ViInt32, ViReal64] # noqa: F405 + self.niDMM_ConfigureTrigger_cfunc = self._get_library_function( + "niDMM_ConfigureTrigger" + ) + self.niDMM_ConfigureTrigger_cfunc.argtypes = [ + ViSession, + ViInt32, + ViReal64, + ] # noqa: F405 self.niDMM_ConfigureTrigger_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_ConfigureTrigger_cfunc(vi, trigger_source, trigger_delay) - def niDMM_ConfigureWaveformAcquisition(self, vi, measurement_function, range, rate, waveform_points): # noqa: N802 + def niDMM_ConfigureWaveformAcquisition( + self, vi, measurement_function, range, rate, waveform_points + ): # noqa: N802 with self._func_lock: if self.niDMM_ConfigureWaveformAcquisition_cfunc is None: - self.niDMM_ConfigureWaveformAcquisition_cfunc = self._get_library_function('niDMM_ConfigureWaveformAcquisition') - self.niDMM_ConfigureWaveformAcquisition_cfunc.argtypes = [ViSession, ViInt32, ViReal64, ViReal64, ViInt32] # noqa: F405 - self.niDMM_ConfigureWaveformAcquisition_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_ConfigureWaveformAcquisition_cfunc(vi, measurement_function, range, rate, waveform_points) + self.niDMM_ConfigureWaveformAcquisition_cfunc = ( + self._get_library_function("niDMM_ConfigureWaveformAcquisition") + ) + self.niDMM_ConfigureWaveformAcquisition_cfunc.argtypes = [ + ViSession, + ViInt32, + ViReal64, + ViReal64, + ViInt32, + ] # noqa: F405 + self.niDMM_ConfigureWaveformAcquisition_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDMM_ConfigureWaveformAcquisition_cfunc( + vi, measurement_function, range, rate, waveform_points + ) def niDMM_Disable(self, vi): # noqa: N802 with self._func_lock: if self.niDMM_Disable_cfunc is None: - self.niDMM_Disable_cfunc = self._get_library_function('niDMM_Disable') + self.niDMM_Disable_cfunc = self._get_library_function("niDMM_Disable") self.niDMM_Disable_cfunc.argtypes = [ViSession] # noqa: F405 self.niDMM_Disable_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_Disable_cfunc(vi) - def niDMM_ExportAttributeConfigurationBuffer(self, vi, size, configuration): # noqa: N802 + def niDMM_ExportAttributeConfigurationBuffer( + self, vi, size, configuration + ): # noqa: N802 with self._func_lock: if self.niDMM_ExportAttributeConfigurationBuffer_cfunc is None: - self.niDMM_ExportAttributeConfigurationBuffer_cfunc = self._get_library_function('niDMM_ExportAttributeConfigurationBuffer') - self.niDMM_ExportAttributeConfigurationBuffer_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt8)] # noqa: F405 - self.niDMM_ExportAttributeConfigurationBuffer_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_ExportAttributeConfigurationBuffer_cfunc(vi, size, configuration) + self.niDMM_ExportAttributeConfigurationBuffer_cfunc = ( + self._get_library_function( + "niDMM_ExportAttributeConfigurationBuffer" + ) + ) + self.niDMM_ExportAttributeConfigurationBuffer_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViInt8), + ] # noqa: F405 + self.niDMM_ExportAttributeConfigurationBuffer_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDMM_ExportAttributeConfigurationBuffer_cfunc( + vi, size, configuration + ) def niDMM_ExportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niDMM_ExportAttributeConfigurationFile_cfunc is None: - self.niDMM_ExportAttributeConfigurationFile_cfunc = self._get_library_function('niDMM_ExportAttributeConfigurationFile') - self.niDMM_ExportAttributeConfigurationFile_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 - self.niDMM_ExportAttributeConfigurationFile_cfunc.restype = ViStatus # noqa: F405 + self.niDMM_ExportAttributeConfigurationFile_cfunc = ( + self._get_library_function("niDMM_ExportAttributeConfigurationFile") + ) + self.niDMM_ExportAttributeConfigurationFile_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niDMM_ExportAttributeConfigurationFile_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niDMM_ExportAttributeConfigurationFile_cfunc(vi, file_path) def niDMM_Fetch(self, vi, maximum_time, reading): # noqa: N802 with self._func_lock: if self.niDMM_Fetch_cfunc is None: - self.niDMM_Fetch_cfunc = self._get_library_function('niDMM_Fetch') - self.niDMM_Fetch_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niDMM_Fetch_cfunc = self._get_library_function("niDMM_Fetch") + self.niDMM_Fetch_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niDMM_Fetch_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_Fetch_cfunc(vi, maximum_time, reading) - def niDMM_FetchMultiPoint(self, vi, maximum_time, array_size, reading_array, actual_number_of_points): # noqa: N802 + def niDMM_FetchMultiPoint( + self, vi, maximum_time, array_size, reading_array, actual_number_of_points + ): # noqa: N802 with self._func_lock: if self.niDMM_FetchMultiPoint_cfunc is None: - self.niDMM_FetchMultiPoint_cfunc = self._get_library_function('niDMM_FetchMultiPoint') - self.niDMM_FetchMultiPoint_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDMM_FetchMultiPoint_cfunc = self._get_library_function( + "niDMM_FetchMultiPoint" + ) + self.niDMM_FetchMultiPoint_cfunc.argtypes = [ + ViSession, + ViInt32, + ViInt32, + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niDMM_FetchMultiPoint_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_FetchMultiPoint_cfunc(vi, maximum_time, array_size, reading_array, actual_number_of_points) + return self.niDMM_FetchMultiPoint_cfunc( + vi, maximum_time, array_size, reading_array, actual_number_of_points + ) - def niDMM_FetchWaveform(self, vi, maximum_time, array_size, waveform_array, actual_number_of_points): # noqa: N802 + def niDMM_FetchWaveform( + self, vi, maximum_time, array_size, waveform_array, actual_number_of_points + ): # noqa: N802 with self._func_lock: if self.niDMM_FetchWaveform_cfunc is None: - self.niDMM_FetchWaveform_cfunc = self._get_library_function('niDMM_FetchWaveform') - self.niDMM_FetchWaveform_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDMM_FetchWaveform_cfunc = self._get_library_function( + "niDMM_FetchWaveform" + ) + self.niDMM_FetchWaveform_cfunc.argtypes = [ + ViSession, + ViInt32, + ViInt32, + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niDMM_FetchWaveform_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_FetchWaveform_cfunc(vi, maximum_time, array_size, waveform_array, actual_number_of_points) + return self.niDMM_FetchWaveform_cfunc( + vi, maximum_time, array_size, waveform_array, actual_number_of_points + ) - def niDMM_GetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niDMM_GetAttributeViBoolean( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niDMM_GetAttributeViBoolean_cfunc is None: - self.niDMM_GetAttributeViBoolean_cfunc = self._get_library_function('niDMM_GetAttributeViBoolean') - self.niDMM_GetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niDMM_GetAttributeViBoolean_cfunc = self._get_library_function( + "niDMM_GetAttributeViBoolean" + ) + self.niDMM_GetAttributeViBoolean_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niDMM_GetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_GetAttributeViBoolean_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niDMM_GetAttributeViBoolean_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niDMM_GetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niDMM_GetAttributeViInt32( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niDMM_GetAttributeViInt32_cfunc is None: - self.niDMM_GetAttributeViInt32_cfunc = self._get_library_function('niDMM_GetAttributeViInt32') - self.niDMM_GetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDMM_GetAttributeViInt32_cfunc = self._get_library_function( + "niDMM_GetAttributeViInt32" + ) + self.niDMM_GetAttributeViInt32_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niDMM_GetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_GetAttributeViInt32_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niDMM_GetAttributeViInt32_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niDMM_GetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niDMM_GetAttributeViReal64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niDMM_GetAttributeViReal64_cfunc is None: - self.niDMM_GetAttributeViReal64_cfunc = self._get_library_function('niDMM_GetAttributeViReal64') - self.niDMM_GetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niDMM_GetAttributeViReal64_cfunc = self._get_library_function( + "niDMM_GetAttributeViReal64" + ) + self.niDMM_GetAttributeViReal64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niDMM_GetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_GetAttributeViReal64_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niDMM_GetAttributeViReal64_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niDMM_GetAttributeViString(self, vi, channel_name, attribute_id, buffer_size, attribute_value): # noqa: N802 + def niDMM_GetAttributeViString( + self, vi, channel_name, attribute_id, buffer_size, attribute_value + ): # noqa: N802 with self._func_lock: if self.niDMM_GetAttributeViString_cfunc is None: - self.niDMM_GetAttributeViString_cfunc = self._get_library_function('niDMM_GetAttributeViString') - self.niDMM_GetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDMM_GetAttributeViString_cfunc = self._get_library_function( + "niDMM_GetAttributeViString" + ) + self.niDMM_GetAttributeViString_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDMM_GetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_GetAttributeViString_cfunc(vi, channel_name, attribute_id, buffer_size, attribute_value) + return self.niDMM_GetAttributeViString_cfunc( + vi, channel_name, attribute_id, buffer_size, attribute_value + ) - def niDMM_GetCalDateAndTime(self, vi, cal_type, month, day, year, hour, minute): # noqa: N802 + def niDMM_GetCalDateAndTime( + self, vi, cal_type, month, day, year, hour, minute + ): # noqa: N802 with self._func_lock: if self.niDMM_GetCalDateAndTime_cfunc is None: - self.niDMM_GetCalDateAndTime_cfunc = self._get_library_function('niDMM_GetCalDateAndTime') - self.niDMM_GetCalDateAndTime_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDMM_GetCalDateAndTime_cfunc = self._get_library_function( + "niDMM_GetCalDateAndTime" + ) + self.niDMM_GetCalDateAndTime_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niDMM_GetCalDateAndTime_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_GetCalDateAndTime_cfunc(vi, cal_type, month, day, year, hour, minute) + return self.niDMM_GetCalDateAndTime_cfunc( + vi, cal_type, month, day, year, hour, minute + ) def niDMM_GetDevTemp(self, vi, options, temperature): # noqa: N802 with self._func_lock: if self.niDMM_GetDevTemp_cfunc is None: - self.niDMM_GetDevTemp_cfunc = self._get_library_function('niDMM_GetDevTemp') - self.niDMM_GetDevTemp_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViReal64)] # noqa: F405 + self.niDMM_GetDevTemp_cfunc = self._get_library_function( + "niDMM_GetDevTemp" + ) + self.niDMM_GetDevTemp_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niDMM_GetDevTemp_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_GetDevTemp_cfunc(vi, options, temperature) def niDMM_GetError(self, vi, error_code, buffer_size, description): # noqa: N802 with self._func_lock: if self.niDMM_GetError_cfunc is None: - self.niDMM_GetError_cfunc = self._get_library_function('niDMM_GetError') - self.niDMM_GetError_cfunc.argtypes = [ViSession, ctypes.POINTER(ViStatus), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDMM_GetError_cfunc = self._get_library_function("niDMM_GetError") + self.niDMM_GetError_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViStatus), + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDMM_GetError_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_GetError_cfunc(vi, error_code, buffer_size, description) def niDMM_GetExtCalRecommendedInterval(self, vi, months): # noqa: N802 with self._func_lock: if self.niDMM_GetExtCalRecommendedInterval_cfunc is None: - self.niDMM_GetExtCalRecommendedInterval_cfunc = self._get_library_function('niDMM_GetExtCalRecommendedInterval') - self.niDMM_GetExtCalRecommendedInterval_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32)] # noqa: F405 - self.niDMM_GetExtCalRecommendedInterval_cfunc.restype = ViStatus # noqa: F405 + self.niDMM_GetExtCalRecommendedInterval_cfunc = ( + self._get_library_function("niDMM_GetExtCalRecommendedInterval") + ) + self.niDMM_GetExtCalRecommendedInterval_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niDMM_GetExtCalRecommendedInterval_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niDMM_GetExtCalRecommendedInterval_cfunc(vi, months) def niDMM_GetLastCalTemp(self, vi, cal_type, temperature): # noqa: N802 with self._func_lock: if self.niDMM_GetLastCalTemp_cfunc is None: - self.niDMM_GetLastCalTemp_cfunc = self._get_library_function('niDMM_GetLastCalTemp') - self.niDMM_GetLastCalTemp_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niDMM_GetLastCalTemp_cfunc = self._get_library_function( + "niDMM_GetLastCalTemp" + ) + self.niDMM_GetLastCalTemp_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niDMM_GetLastCalTemp_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_GetLastCalTemp_cfunc(vi, cal_type, temperature) def niDMM_GetSelfCalSupported(self, vi, self_cal_supported): # noqa: N802 with self._func_lock: if self.niDMM_GetSelfCalSupported_cfunc is None: - self.niDMM_GetSelfCalSupported_cfunc = self._get_library_function('niDMM_GetSelfCalSupported') - self.niDMM_GetSelfCalSupported_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niDMM_GetSelfCalSupported_cfunc = self._get_library_function( + "niDMM_GetSelfCalSupported" + ) + self.niDMM_GetSelfCalSupported_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niDMM_GetSelfCalSupported_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_GetSelfCalSupported_cfunc(vi, self_cal_supported) - def niDMM_ImportAttributeConfigurationBuffer(self, vi, size, configuration): # noqa: N802 + def niDMM_ImportAttributeConfigurationBuffer( + self, vi, size, configuration + ): # noqa: N802 with self._func_lock: if self.niDMM_ImportAttributeConfigurationBuffer_cfunc is None: - self.niDMM_ImportAttributeConfigurationBuffer_cfunc = self._get_library_function('niDMM_ImportAttributeConfigurationBuffer') - self.niDMM_ImportAttributeConfigurationBuffer_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt8)] # noqa: F405 - self.niDMM_ImportAttributeConfigurationBuffer_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_ImportAttributeConfigurationBuffer_cfunc(vi, size, configuration) + self.niDMM_ImportAttributeConfigurationBuffer_cfunc = ( + self._get_library_function( + "niDMM_ImportAttributeConfigurationBuffer" + ) + ) + self.niDMM_ImportAttributeConfigurationBuffer_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViInt8), + ] # noqa: F405 + self.niDMM_ImportAttributeConfigurationBuffer_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niDMM_ImportAttributeConfigurationBuffer_cfunc( + vi, size, configuration + ) def niDMM_ImportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niDMM_ImportAttributeConfigurationFile_cfunc is None: - self.niDMM_ImportAttributeConfigurationFile_cfunc = self._get_library_function('niDMM_ImportAttributeConfigurationFile') - self.niDMM_ImportAttributeConfigurationFile_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 - self.niDMM_ImportAttributeConfigurationFile_cfunc.restype = ViStatus # noqa: F405 + self.niDMM_ImportAttributeConfigurationFile_cfunc = ( + self._get_library_function("niDMM_ImportAttributeConfigurationFile") + ) + self.niDMM_ImportAttributeConfigurationFile_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niDMM_ImportAttributeConfigurationFile_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niDMM_ImportAttributeConfigurationFile_cfunc(vi, file_path) - def niDMM_InitWithOptions(self, resource_name, id_query, reset_device, option_string, vi): # noqa: N802 + def niDMM_InitWithOptions( + self, resource_name, id_query, reset_device, option_string, vi + ): # noqa: N802 with self._func_lock: if self.niDMM_InitWithOptions_cfunc is None: - self.niDMM_InitWithOptions_cfunc = self._get_library_function('niDMM_InitWithOptions') - self.niDMM_InitWithOptions_cfunc.argtypes = [ctypes.POINTER(ViChar), ViBoolean, ViBoolean, ctypes.POINTER(ViChar), ctypes.POINTER(ViSession)] # noqa: F405 + self.niDMM_InitWithOptions_cfunc = self._get_library_function( + "niDMM_InitWithOptions" + ) + self.niDMM_InitWithOptions_cfunc.argtypes = [ + ctypes.POINTER(ViChar), + ViBoolean, + ViBoolean, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViSession), + ] # noqa: F405 self.niDMM_InitWithOptions_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_InitWithOptions_cfunc(resource_name, id_query, reset_device, option_string, vi) + return self.niDMM_InitWithOptions_cfunc( + resource_name, id_query, reset_device, option_string, vi + ) def niDMM_Initiate(self, vi): # noqa: N802 with self._func_lock: if self.niDMM_Initiate_cfunc is None: - self.niDMM_Initiate_cfunc = self._get_library_function('niDMM_Initiate') + self.niDMM_Initiate_cfunc = self._get_library_function("niDMM_Initiate") self.niDMM_Initiate_cfunc.argtypes = [ViSession] # noqa: F405 self.niDMM_Initiate_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_Initiate_cfunc(vi) @@ -319,63 +583,118 @@ def niDMM_Initiate(self, vi): # noqa: N802 def niDMM_LockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niDMM_LockSession_cfunc is None: - self.niDMM_LockSession_cfunc = self._get_library_function('niDMM_LockSession') - self.niDMM_LockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niDMM_LockSession_cfunc = self._get_library_function( + "niDMM_LockSession" + ) + self.niDMM_LockSession_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niDMM_LockSession_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_LockSession_cfunc(vi, caller_has_lock) def niDMM_PerformOpenCableComp(self, vi, conductance, susceptance): # noqa: N802 with self._func_lock: if self.niDMM_PerformOpenCableComp_cfunc is None: - self.niDMM_PerformOpenCableComp_cfunc = self._get_library_function('niDMM_PerformOpenCableComp') - self.niDMM_PerformOpenCableComp_cfunc.argtypes = [ViSession, ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64)] # noqa: F405 + self.niDMM_PerformOpenCableComp_cfunc = self._get_library_function( + "niDMM_PerformOpenCableComp" + ) + self.niDMM_PerformOpenCableComp_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niDMM_PerformOpenCableComp_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_PerformOpenCableComp_cfunc(vi, conductance, susceptance) def niDMM_PerformShortCableComp(self, vi, resistance, reactance): # noqa: N802 with self._func_lock: if self.niDMM_PerformShortCableComp_cfunc is None: - self.niDMM_PerformShortCableComp_cfunc = self._get_library_function('niDMM_PerformShortCableComp') - self.niDMM_PerformShortCableComp_cfunc.argtypes = [ViSession, ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64)] # noqa: F405 + self.niDMM_PerformShortCableComp_cfunc = self._get_library_function( + "niDMM_PerformShortCableComp" + ) + self.niDMM_PerformShortCableComp_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niDMM_PerformShortCableComp_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_PerformShortCableComp_cfunc(vi, resistance, reactance) def niDMM_Read(self, vi, maximum_time, reading): # noqa: N802 with self._func_lock: if self.niDMM_Read_cfunc is None: - self.niDMM_Read_cfunc = self._get_library_function('niDMM_Read') - self.niDMM_Read_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niDMM_Read_cfunc = self._get_library_function("niDMM_Read") + self.niDMM_Read_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niDMM_Read_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_Read_cfunc(vi, maximum_time, reading) - def niDMM_ReadMultiPoint(self, vi, maximum_time, array_size, reading_array, actual_number_of_points): # noqa: N802 + def niDMM_ReadMultiPoint( + self, vi, maximum_time, array_size, reading_array, actual_number_of_points + ): # noqa: N802 with self._func_lock: if self.niDMM_ReadMultiPoint_cfunc is None: - self.niDMM_ReadMultiPoint_cfunc = self._get_library_function('niDMM_ReadMultiPoint') - self.niDMM_ReadMultiPoint_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDMM_ReadMultiPoint_cfunc = self._get_library_function( + "niDMM_ReadMultiPoint" + ) + self.niDMM_ReadMultiPoint_cfunc.argtypes = [ + ViSession, + ViInt32, + ViInt32, + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niDMM_ReadMultiPoint_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_ReadMultiPoint_cfunc(vi, maximum_time, array_size, reading_array, actual_number_of_points) + return self.niDMM_ReadMultiPoint_cfunc( + vi, maximum_time, array_size, reading_array, actual_number_of_points + ) - def niDMM_ReadStatus(self, vi, acquisition_backlog, acquisition_status): # noqa: N802 + def niDMM_ReadStatus( + self, vi, acquisition_backlog, acquisition_status + ): # noqa: N802 with self._func_lock: if self.niDMM_ReadStatus_cfunc is None: - self.niDMM_ReadStatus_cfunc = self._get_library_function('niDMM_ReadStatus') - self.niDMM_ReadStatus_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt16)] # noqa: F405 + self.niDMM_ReadStatus_cfunc = self._get_library_function( + "niDMM_ReadStatus" + ) + self.niDMM_ReadStatus_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt16), + ] # noqa: F405 self.niDMM_ReadStatus_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_ReadStatus_cfunc(vi, acquisition_backlog, acquisition_status) - def niDMM_ReadWaveform(self, vi, maximum_time, array_size, waveform_array, actual_number_of_points): # noqa: N802 + def niDMM_ReadWaveform( + self, vi, maximum_time, array_size, waveform_array, actual_number_of_points + ): # noqa: N802 with self._func_lock: if self.niDMM_ReadWaveform_cfunc is None: - self.niDMM_ReadWaveform_cfunc = self._get_library_function('niDMM_ReadWaveform') - self.niDMM_ReadWaveform_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDMM_ReadWaveform_cfunc = self._get_library_function( + "niDMM_ReadWaveform" + ) + self.niDMM_ReadWaveform_cfunc.argtypes = [ + ViSession, + ViInt32, + ViInt32, + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niDMM_ReadWaveform_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_ReadWaveform_cfunc(vi, maximum_time, array_size, waveform_array, actual_number_of_points) + return self.niDMM_ReadWaveform_cfunc( + vi, maximum_time, array_size, waveform_array, actual_number_of_points + ) def niDMM_ResetWithDefaults(self, vi): # noqa: N802 with self._func_lock: if self.niDMM_ResetWithDefaults_cfunc is None: - self.niDMM_ResetWithDefaults_cfunc = self._get_library_function('niDMM_ResetWithDefaults') + self.niDMM_ResetWithDefaults_cfunc = self._get_library_function( + "niDMM_ResetWithDefaults" + ) self.niDMM_ResetWithDefaults_cfunc.argtypes = [ViSession] # noqa: F405 self.niDMM_ResetWithDefaults_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_ResetWithDefaults_cfunc(vi) @@ -383,7 +702,7 @@ def niDMM_ResetWithDefaults(self, vi): # noqa: N802 def niDMM_SelfCal(self, vi): # noqa: N802 with self._func_lock: if self.niDMM_SelfCal_cfunc is None: - self.niDMM_SelfCal_cfunc = self._get_library_function('niDMM_SelfCal') + self.niDMM_SelfCal_cfunc = self._get_library_function("niDMM_SelfCal") self.niDMM_SelfCal_cfunc.argtypes = [ViSession] # noqa: F405 self.niDMM_SelfCal_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_SelfCal_cfunc(vi) @@ -391,55 +710,108 @@ def niDMM_SelfCal(self, vi): # noqa: N802 def niDMM_SendSoftwareTrigger(self, vi): # noqa: N802 with self._func_lock: if self.niDMM_SendSoftwareTrigger_cfunc is None: - self.niDMM_SendSoftwareTrigger_cfunc = self._get_library_function('niDMM_SendSoftwareTrigger') - self.niDMM_SendSoftwareTrigger_cfunc.argtypes = [ViSession] # noqa: F405 + self.niDMM_SendSoftwareTrigger_cfunc = self._get_library_function( + "niDMM_SendSoftwareTrigger" + ) + self.niDMM_SendSoftwareTrigger_cfunc.argtypes = [ + ViSession + ] # noqa: F405 self.niDMM_SendSoftwareTrigger_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_SendSoftwareTrigger_cfunc(vi) - def niDMM_SetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niDMM_SetAttributeViBoolean( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niDMM_SetAttributeViBoolean_cfunc is None: - self.niDMM_SetAttributeViBoolean_cfunc = self._get_library_function('niDMM_SetAttributeViBoolean') - self.niDMM_SetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViBoolean] # noqa: F405 + self.niDMM_SetAttributeViBoolean_cfunc = self._get_library_function( + "niDMM_SetAttributeViBoolean" + ) + self.niDMM_SetAttributeViBoolean_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViBoolean, + ] # noqa: F405 self.niDMM_SetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_SetAttributeViBoolean_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niDMM_SetAttributeViBoolean_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niDMM_SetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niDMM_SetAttributeViInt32( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niDMM_SetAttributeViInt32_cfunc is None: - self.niDMM_SetAttributeViInt32_cfunc = self._get_library_function('niDMM_SetAttributeViInt32') - self.niDMM_SetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32] # noqa: F405 + self.niDMM_SetAttributeViInt32_cfunc = self._get_library_function( + "niDMM_SetAttributeViInt32" + ) + self.niDMM_SetAttributeViInt32_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViInt32, + ] # noqa: F405 self.niDMM_SetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_SetAttributeViInt32_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niDMM_SetAttributeViInt32_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niDMM_SetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niDMM_SetAttributeViReal64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niDMM_SetAttributeViReal64_cfunc is None: - self.niDMM_SetAttributeViReal64_cfunc = self._get_library_function('niDMM_SetAttributeViReal64') - self.niDMM_SetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViReal64] # noqa: F405 + self.niDMM_SetAttributeViReal64_cfunc = self._get_library_function( + "niDMM_SetAttributeViReal64" + ) + self.niDMM_SetAttributeViReal64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViReal64, + ] # noqa: F405 self.niDMM_SetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_SetAttributeViReal64_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niDMM_SetAttributeViReal64_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niDMM_SetAttributeViString(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niDMM_SetAttributeViString( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niDMM_SetAttributeViString_cfunc is None: - self.niDMM_SetAttributeViString_cfunc = self._get_library_function('niDMM_SetAttributeViString') - self.niDMM_SetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDMM_SetAttributeViString_cfunc = self._get_library_function( + "niDMM_SetAttributeViString" + ) + self.niDMM_SetAttributeViString_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDMM_SetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_SetAttributeViString_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niDMM_SetAttributeViString_cfunc( + vi, channel_name, attribute_id, attribute_value + ) def niDMM_UnlockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niDMM_UnlockSession_cfunc is None: - self.niDMM_UnlockSession_cfunc = self._get_library_function('niDMM_UnlockSession') - self.niDMM_UnlockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niDMM_UnlockSession_cfunc = self._get_library_function( + "niDMM_UnlockSession" + ) + self.niDMM_UnlockSession_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niDMM_UnlockSession_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_UnlockSession_cfunc(vi, caller_has_lock) def niDMM_close(self, vi): # noqa: N802 with self._func_lock: if self.niDMM_close_cfunc is None: - self.niDMM_close_cfunc = self._get_library_function('niDMM_close') + self.niDMM_close_cfunc = self._get_library_function("niDMM_close") self.niDMM_close_cfunc.argtypes = [ViSession] # noqa: F405 self.niDMM_close_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_close_cfunc(vi) @@ -447,15 +819,21 @@ def niDMM_close(self, vi): # noqa: N802 def niDMM_error_message(self, vi, error_code, error_message): # noqa: N802 with self._func_lock: if self.niDMM_error_message_cfunc is None: - self.niDMM_error_message_cfunc = self._get_library_function('niDMM_error_message') - self.niDMM_error_message_cfunc.argtypes = [ViSession, ViStatus, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDMM_error_message_cfunc = self._get_library_function( + "niDMM_error_message" + ) + self.niDMM_error_message_cfunc.argtypes = [ + ViSession, + ViStatus, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDMM_error_message_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_error_message_cfunc(vi, error_code, error_message) def niDMM_reset(self, vi): # noqa: N802 with self._func_lock: if self.niDMM_reset_cfunc is None: - self.niDMM_reset_cfunc = self._get_library_function('niDMM_reset') + self.niDMM_reset_cfunc = self._get_library_function("niDMM_reset") self.niDMM_reset_cfunc.argtypes = [ViSession] # noqa: F405 self.niDMM_reset_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_reset_cfunc(vi) @@ -463,7 +841,13 @@ def niDMM_reset(self, vi): # noqa: N802 def niDMM_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 with self._func_lock: if self.niDMM_self_test_cfunc is None: - self.niDMM_self_test_cfunc = self._get_library_function('niDMM_self_test') - self.niDMM_self_test_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt16), ctypes.POINTER(ViChar)] # noqa: F405 + self.niDMM_self_test_cfunc = self._get_library_function( + "niDMM_self_test" + ) + self.niDMM_self_test_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt16), + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niDMM_self_test_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_self_test_cfunc(vi, self_test_result, self_test_message) diff --git a/generated/nidmm/nidmm/_library_singleton.py b/generated/nidmm/nidmm/_library_singleton.py index 40d500f36..34b5a9ca3 100644 --- a/generated/nidmm/nidmm/_library_singleton.py +++ b/generated/nidmm/nidmm/_library_singleton.py @@ -12,30 +12,36 @@ _instance = None _instance_lock = threading.Lock() -_library_info = {'Linux': {'64bit': {'name': 'nidmm', 'type': 'cdll'}}, - 'Windows': {'32bit': {'name': 'nidmm_32.dll', 'type': 'windll'}, - '64bit': {'name': 'nidmm_64.dll', 'type': 'cdll'}}} +_library_info = { + "Linux": {"64bit": {"name": "nidmm", "type": "cdll"}}, + "Windows": { + "32bit": {"name": "nidmm_32.dll", "type": "windll"}, + "64bit": {"name": "nidmm_64.dll", "type": "cdll"}, + }, +} def _get_library_name(): try: - return ctypes.util.find_library(_library_info[platform.system()][platform.architecture()[0]]['name']) # We find and return full path to the DLL + return ctypes.util.find_library( + _library_info[platform.system()][platform.architecture()[0]]["name"] + ) # We find and return full path to the DLL except KeyError: raise errors.UnsupportedConfigurationError def _get_library_type(): try: - return _library_info[platform.system()][platform.architecture()[0]]['type'] + return _library_info[platform.system()][platform.architecture()[0]]["type"] except KeyError: raise errors.UnsupportedConfigurationError def get(): - '''get + """get Returns the library.Library singleton for nidmm. - ''' + """ global _instance global _instance_lock @@ -43,13 +49,12 @@ def get(): if _instance is None: try: library_type = _get_library_type() - if library_type == 'windll': + if library_type == "windll": ctypes_library = ctypes.WinDLL(_get_library_name()) else: - assert library_type == 'cdll' + assert library_type == "cdll" ctypes_library = ctypes.CDLL(_get_library_name()) except OSError: raise errors.DriverNotInstalledError() _instance = _library.Library(ctypes_library) return _instance - diff --git a/generated/nidmm/nidmm/_visatype.py b/generated/nidmm/nidmm/_visatype.py index 02cc41d1b..bf96c3cfb 100644 --- a/generated/nidmm/nidmm/_visatype.py +++ b/generated/nidmm/nidmm/_visatype.py @@ -2,9 +2,9 @@ import ctypes -'''Definitions of the VISA types used by the C API of the driver runtime. +"""Definitions of the VISA types used by the C API of the driver runtime. These are aliased directly to ctypes types so can be used directly to call into the library. -''' +""" ViChar = ctypes.c_char @@ -26,4 +26,3 @@ ViAttr = ViUInt32 ViConstString = ViString ViRsrc = ViString - diff --git a/generated/nidmm/nidmm/enums.py b/generated/nidmm/nidmm/enums.py index b476424ce..c20c6025f 100644 --- a/generated/nidmm/nidmm/enums.py +++ b/generated/nidmm/nidmm/enums.py @@ -6,487 +6,487 @@ class ADCCalibration(Enum): AUTO = -1 - r''' + r""" The DMM enables or disables ADC calibration for you. - ''' + """ OFF = 0 - r''' + r""" The DMM does not compensate for changes to the gain. - ''' + """ ON = 1 - r''' + r""" The DMM measures an internal reference to calculate the correct gain for the measurement. - ''' + """ class AcquisitionStatus(Enum): RUNNING = 0 - r''' + r""" Running - ''' + """ FINISHED_WITH_BACKLOG = 1 - r''' + r""" Finished with **Backlog** - ''' + """ FINISHED_WITH_NO_BACKLOG = 2 - r''' + r""" Finished with no **Backlog** - ''' + """ PAUSED = 3 - r''' + r""" Paused - ''' + """ NO_ACQUISITION_IN_PROGRESS = 4 - r''' + r""" No acquisition in progress - ''' + """ class ApertureTimeUnits(Enum): SECONDS = 0 - r''' + r""" Seconds - ''' + """ POWER_LINE_CYCLES = 1 - r''' + r""" Powerline Cycles - ''' + """ class AutoZero(Enum): AUTO = -1 - r''' + r""" The drivers chooses the AutoZero setting based on the configured method and resolution. - ''' + """ OFF = 0 - r''' + r""" Disables AutoZero. - ''' + """ ON = 1 - r''' + r""" The DMM internally disconnects the input signal following each measurement and takes a zero reading. It then subtracts the zero reading from the preceding reading. - ''' + """ ONCE = 2 - r''' + r""" The DMM internally disconnects the input signal for the first measurement and takes a zero reading. It then subtracts the zero reading from the first reading and the following readings. - ''' + """ class CableCompensationType(Enum): NONE = 0 - r''' + r""" No Cable Compensation - ''' + """ OPEN = 1 - r''' + r""" Open Cable Compensation - ''' + """ SHORT = 2 - r''' + r""" Short Cable Compensation - ''' + """ OPEN_AND_SHORT = 3 - r''' + r""" Open and Short Cable Compensation - ''' + """ class DCNoiseRejection(Enum): AUTO = -1 - r''' + r""" The driver chooses the DC noise rejection setting based on the configured method and resolution. - ''' + """ NORMAL = 0 - r''' + r""" NI-DMM weighs all samples equally. - ''' + """ SECOND_ORDER = 1 - r''' + r""" NI-DMM weighs the samples taken in the middle of the aperture time more than samples taken at the beginning and the end of the measurement using a triangular weighing method. - ''' + """ HIGH_ORDER = 2 - r''' + r""" NI-DMM weighs the samples taken in the middle of the aperture time more than samples taken at the beginning and the end of the measurement using a bell-curve weighing method. - ''' + """ class Function(Enum): DC_VOLTS = 1 - r''' + r""" DC Voltage - ''' + """ AC_VOLTS = 2 - r''' + r""" AC Voltage - ''' + """ DC_CURRENT = 3 - r''' + r""" DC Current - ''' + """ AC_CURRENT = 4 - r''' + r""" AC Current - ''' + """ TWO_WIRE_RES = 5 - r''' + r""" 2-Wire Resistance - ''' + """ FOUR_WIRE_RES = 101 - r''' + r""" 4-Wire Resistance - ''' + """ FREQ = 104 - r''' + r""" Frequency - ''' + """ PERIOD = 105 - r''' + r""" Period - ''' + """ TEMPERATURE = 108 - r''' + r""" NI 4065, NI 4070/4071/4072, and NI 4080/4081/4182 supported. - ''' + """ AC_VOLTS_DC_COUPLED = 1001 - r''' + r""" AC Voltage with DC Coupling - ''' + """ DIODE = 1002 - r''' + r""" Diode - ''' + """ WAVEFORM_VOLTAGE = 1003 - r''' + r""" Waveform voltage - ''' + """ WAVEFORM_CURRENT = 1004 - r''' + r""" Waveform current - ''' + """ CAPACITANCE = 1005 - r''' + r""" Capacitance - ''' + """ INDUCTANCE = 1006 - r''' + r""" Inductance - ''' + """ class LCCalculationModel(Enum): AUTO = -1 - r''' + r""" NI-DMM chooses the algorithm based on method and range - ''' + """ SERIES = 0 - r''' + r""" NI-DMM uses the series impedance model to calculate capacitance and inductance - ''' + """ PARALLEL = 1 - r''' + r""" NI-DMM uses the parallel admittance model to calculate capacitance and inductance - ''' + """ class MeasurementCompleteDest(Enum): NONE = -1 - r''' + r""" No Trigger - ''' + """ EXTERNAL = 2 - r''' + r""" AUX I/O Connector - ''' + """ PXI_TRIG0 = 111 - r''' + r""" PXI Trigger Line 0 - ''' + """ PXI_TRIG1 = 112 - r''' + r""" PXI Trigger Line 1 - ''' + """ PXI_TRIG2 = 113 - r''' + r""" PXI Trigger Line 2 - ''' + """ PXI_TRIG3 = 114 - r''' + r""" PXI Trigger Line 3 - ''' + """ PXI_TRIG4 = 115 - r''' + r""" PXI Trigger Line 4 - ''' + """ PXI_TRIG5 = 116 - r''' + r""" PXI Trigger Line 5 - ''' + """ PXI_TRIG6 = 117 - r''' + r""" PXI Trigger Line 6 - ''' + """ PXI_TRIG7 = 118 - r''' + r""" PXI Trigger Line 7 - ''' + """ LBR_TRIG0 = 1003 - r''' + r""" Internal Trigger Line of a PXI/SCXI Combination Chassis - ''' + """ class OperationMode(Enum): IVIDMM = 0 - r''' + r""" IviDmm Mode - ''' + """ WAVEFORM = 1 - r''' + r""" Waveform acquisition mode - ''' + """ class RTDType(Enum): CUSTOM = 0 - r''' + r""" Performs Callendar-Van Dusen RTD scaling with the user-specified A, B, and C coefficients. - ''' + """ PT3750 = 1 - r''' + r""" Performs scaling for a Pt 3750 RTD. - ''' + """ PT3851 = 2 - r''' + r""" Performs scaling for a Pt 3851 RTD. - ''' + """ PT3911 = 3 - r''' + r""" Performs scaling for a Pt 3911 RTD. - ''' + """ PT3916 = 4 - r''' + r""" Performs scaling for a Pt 3916 RTD. - ''' + """ PT3920 = 5 - r''' + r""" Performs scaling for a Pt 3920 RTD. - ''' + """ PT3928 = 6 - r''' + r""" Performs scaling for a Pt 3928 RTD. - ''' + """ class SampleTrigger(Enum): IMMEDIATE = 1 - r''' + r""" No Trigger - ''' + """ EXTERNAL = 2 - r''' + r""" AUX I/O Connector Trigger Line 0 - ''' + """ SOFTWARE_TRIG = 3 - r''' + r""" Software Trigger - ''' + """ INTERVAL = 10 - r''' + r""" Interval Trigger - ''' + """ PXI_TRIG0 = 111 - r''' + r""" PXI Trigger Line 0 - ''' + """ PXI_TRIG1 = 112 - r''' + r""" PXI Trigger Line 1 - ''' + """ PXI_TRIG2 = 113 - r''' + r""" PXI Trigger Line 2 - ''' + """ PXI_TRIG3 = 114 - r''' + r""" PXI Trigger Line 3 - ''' + """ PXI_TRIG4 = 115 - r''' + r""" PXI Trigger Line 4 - ''' + """ PXI_TRIG5 = 116 - r''' + r""" PXI Trigger Line 5 - ''' + """ PXI_TRIG6 = 117 - r''' + r""" PXI Trigger Line 6 - ''' + """ PXI_TRIG7 = 118 - r''' + r""" PXI Trigger Line 7 - ''' + """ PXI_STAR = 131 - r''' + r""" PXI Star Trigger Line - ''' + """ AUX_TRIG1 = 1001 - r''' + r""" AUX I/0 Connector Trigger Line 1 - ''' + """ LBR_TRIG1 = 1004 - r''' + r""" Internal Trigger Line of a PXI/SCXI Combination Chassis - ''' + """ class ThermistorType(Enum): CUSTOM = 0 - r''' + r""" Custom - ''' + """ THERMISTOR_44004 = 1 - r''' + r""" 44004 - ''' + """ THERMISTOR_44006 = 2 - r''' + r""" 44006 - ''' + """ THERMISTOR_44007 = 3 - r''' + r""" 44007 - ''' + """ class ThermocoupleReferenceJunctionType(Enum): FIXED = 2 - r''' + r""" Thermocouple reference juction is fixed at the user-specified temperature. - ''' + """ class ThermocoupleType(Enum): B = 1 - r''' + r""" Thermocouple type B - ''' + """ E = 4 - r''' + r""" Thermocouple type E - ''' + """ J = 6 - r''' + r""" Thermocouple type J - ''' + """ K = 7 - r''' + r""" Thermocouple type K - ''' + """ N = 8 - r''' + r""" Thermocouple type N - ''' + """ R = 9 - r''' + r""" Thermocouple type R - ''' + """ S = 10 - r''' + r""" Thermocouple type S - ''' + """ T = 11 - r''' + r""" Thermocouple type T - ''' + """ class TransducerType(Enum): THERMOCOUPLE = 1 - r''' + r""" Thermocouple - ''' + """ THERMISTOR = 2 - r''' + r""" Thermistor - ''' + """ TWO_WIRE_RTD = 3 - r''' + r""" 2-wire RTD - ''' + """ FOUR_WIRE_RTD = 4 - r''' + r""" 4-wire RTD - ''' + """ class TriggerSource(Enum): IMMEDIATE = 1 - r''' + r""" No Trigger - ''' + """ EXTERNAL = 2 - r''' + r""" AUX I/O Connector Trigger Line 0 - ''' + """ SOFTWARE_TRIG = 3 - r''' + r""" Software Trigger - ''' + """ PXI_TRIG0 = 111 - r''' + r""" PXI Trigger Line 0 - ''' + """ PXI_TRIG1 = 112 - r''' + r""" PXI Trigger Line 1 - ''' + """ PXI_TRIG2 = 113 - r''' + r""" PXI Trigger Line 2 - ''' + """ PXI_TRIG3 = 114 - r''' + r""" PXI Trigger Line 3 - ''' + """ PXI_TRIG4 = 115 - r''' + r""" PXI Trigger Line 4 - ''' + """ PXI_TRIG5 = 116 - r''' + r""" PXI Trigger Line 5 - ''' + """ PXI_TRIG6 = 117 - r''' + r""" PXI Trigger Line 6 - ''' + """ PXI_TRIG7 = 118 - r''' + r""" PXI Trigger Line 7 - ''' + """ PXI_STAR = 131 - r''' + r""" PXI Star Trigger Line - ''' + """ AUX_TRIG1 = 1001 - r''' + r""" AUX I/O Connector Trigger Line 1 - ''' + """ LBR_TRIG1 = 1004 - r''' + r""" Internal Trigger Line of a PXI/SCXI Combination Chassis - ''' + """ class WaveformCoupling(Enum): AC = 0 - r''' + r""" AC Coupled - ''' + """ DC = 1 - r''' + r""" DC Coupled - ''' + """ diff --git a/generated/nidmm/nidmm/errors.py b/generated/nidmm/nidmm/errors.py index ba47b30ce..468f08e69 100644 --- a/generated/nidmm/nidmm/errors.py +++ b/generated/nidmm/nidmm/errors.py @@ -7,86 +7,103 @@ def _is_success(code): - return (code == 0) + return code == 0 def _is_error(code): - return (code < 0) + return code < 0 def _is_warning(code): - return (code > 0) + return code > 0 class Error(Exception): - '''Base error class for NI-DMM''' + """Base error class for NI-DMM""" def __init__(self, message): super(Error, self).__init__(message) class DriverError(Error): - '''An error originating from the NI-DMM driver''' + """An error originating from the NI-DMM driver""" def __init__(self, code, description): - assert (_is_error(code)), "Should not raise Error if code is not fatal." + assert _is_error(code), "Should not raise Error if code is not fatal." self.code = code self.description = description super(DriverError, self).__init__(str(self.code) + ": " + self.description) class DriverWarning(Warning): - '''A warning originating from the NI-DMM driver''' + """A warning originating from the NI-DMM driver""" def __init__(self, code, description): - assert (_is_warning(code)), "Should not create Warning if code is not positive." - super(DriverWarning, self).__init__('Warning {0} occurred.\n\n{1}'.format(code, description)) + assert _is_warning(code), "Should not create Warning if code is not positive." + super(DriverWarning, self).__init__( + "Warning {0} occurred.\n\n{1}".format(code, description) + ) class UnsupportedConfigurationError(Error): - '''An error due to using this module in an usupported platform.''' + """An error due to using this module in an usupported platform.""" def __init__(self): - super(UnsupportedConfigurationError, self).__init__('System configuration is unsupported: ' + platform.architecture()[0] + ' ' + platform.system()) + super(UnsupportedConfigurationError, self).__init__( + "System configuration is unsupported: " + + platform.architecture()[0] + + " " + + platform.system() + ) class DriverNotInstalledError(Error): - '''An error due to using this module without the driver runtime installed.''' + """An error due to using this module without the driver runtime installed.""" def __init__(self): - super(DriverNotInstalledError, self).__init__('The NI-DMM runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it.') + super(DriverNotInstalledError, self).__init__( + "The NI-DMM runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it." + ) class DriverTooOldError(Error): - '''An error due to using this module with an older version of the driver runtime.''' + """An error due to using this module with an older version of the driver runtime.""" def __init__(self): - super(DriverTooOldError, self).__init__('A function was not found in the NI-DMM runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it.') + super(DriverTooOldError, self).__init__( + "A function was not found in the NI-DMM runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it." + ) class InvalidRepeatedCapabilityError(Error): - '''An error due to an invalid character in a repeated capability''' + """An error due to an invalid character in a repeated capability""" def __init__(self, invalid_character, invalid_string): - super(InvalidRepeatedCapabilityError, self).__init__('An invalid character ({0}) was found in repeated capability string ({1})'.format(invalid_character, invalid_string)) + super(InvalidRepeatedCapabilityError, self).__init__( + "An invalid character ({0}) was found in repeated capability string ({1})".format( + invalid_character, invalid_string + ) + ) class SelfTestError(Error): - '''An error due to a failed self-test''' + """An error due to a failed self-test""" def __init__(self, code, msg): self.code = code self.message = msg - super(SelfTestError, self).__init__('Self-test failed with code {0}: {1}'.format(code, msg)) + super(SelfTestError, self).__init__( + "Self-test failed with code {0}: {1}".format(code, msg) + ) def handle_error(session, code, ignore_warnings, is_error_handling): - '''handle_error + """handle_error Helper function for handling errors returned by nidmm.Library. It calls back into the session to get the corresponding error description and raises if necessary. - ''' + """ if _is_success(code) or (_is_warning(code) and ignore_warnings): return @@ -94,7 +111,7 @@ def handle_error(session, code, ignore_warnings, is_error_handling): if is_error_handling: # The caller is in the midst of error handling and an error occurred. # Don't try to get the description or we'll start recursing until the stack overflows. - description = '' + description = "" else: description = session._get_error_description(code) @@ -103,5 +120,3 @@ def handle_error(session, code, ignore_warnings, is_error_handling): assert _is_warning(code) warnings.warn(DriverWarning(code, description)) - - diff --git a/generated/nidmm/nidmm/session.py b/generated/nidmm/nidmm/session.py index ad9fabd46..80093e14b 100644 --- a/generated/nidmm/nidmm/session.py +++ b/generated/nidmm/nidmm/session.py @@ -2,6 +2,7 @@ # This file was generated import array # noqa: F401 import ctypes + # Used by @ivi_synchronized from functools import wraps @@ -16,22 +17,24 @@ # Used for __repr__ import pprint + pp = pprint.PrettyPrinter(indent=4) # Helper functions for creating ctypes needed for calling into the driver DLL def get_ctypes_pointer_for_buffer(value=None, library_type=None, size=None): if isinstance(value, array.array): - assert library_type is not None, 'library_type is required for array.array' + assert library_type is not None, "library_type is required for array.array" addr, _ = value.buffer_info() return ctypes.cast(addr, ctypes.POINTER(library_type)) elif str(type(value)).find("'numpy.ndarray'") != -1: import numpy + return numpy.ctypeslib.as_ctypes(value) elif isinstance(value, bytes): return ctypes.cast(value, ctypes.POINTER(library_type)) elif isinstance(value, list): - assert library_type is not None, 'library_type is required for list' + assert library_type is not None, "library_type is required for list" return (library_type * len(value))(*value) else: if library_type is not None and size is not None: @@ -71,6 +74,7 @@ def aux(*xs, **kws): session = xs[0] # parameter 0 is 'self' which is the session object with session.lock(): return f(*xs, **kws) + return aux @@ -87,30 +91,32 @@ def __exit__(self, exc_type, exc_value, traceback): class _SessionBase(object): - '''Base class for all NI-DMM sessions.''' + """Base class for all NI-DMM sessions.""" # This is needed during __init__. Without it, __setattr__ raises an exception _is_frozen = False ac_max_freq = _attributes.AttributeViReal64(1250007) - '''Type: float + """Type: float Specifies the maximum frequency component of the input signal for AC measurements. This property is used only for error checking and verifies that the value of this parameter is less than the maximum frequency of the device. This property affects the DMM only when you set the method property to AC measurements. The valid range is 1 Hz-300 kHz for the NI 4070/4071/4072, 10 Hz-100 kHz for the NI 4065, and 20 Hz-25 kHz for the NI 4050 and NI 4060. - ''' + """ ac_min_freq = _attributes.AttributeViReal64(1250006) - '''Type: float + """Type: float Specifies the minimum frequency component of the input signal for AC measurements. This property affects the DMM only when you set the method property to AC measurements. The valid range is 1 Hz-300 kHz for the NI 4070/4071/4072, 10 Hz-100 kHz for the NI 4065, and 20 Hz-25 kHz for the NI 4050 and NI 4060. - ''' - adc_calibration = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ADCCalibration, 1150022) - '''Type: enums.ADCCalibration + """ + adc_calibration = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.ADCCalibration, 1150022 + ) + """Type: enums.ADCCalibration For the NI 4070/4071/4072 only, specifies the ADC calibration mode. - ''' + """ aperture_time = _attributes.AttributeViReal64(1250321) - '''Type: float + """Type: float Specifies the measurement aperture time for the current configuration. Aperture time is specified in units set by aperture_time_units. To override the default aperture, set this property to the desired aperture time after calling ConfigureMeasurement. To return to the default, set this property to NIDMM_VAL_APERTURE_TIME_AUTO (-1). On the NI 4070/4071/4072, the minimum aperture time is 8.89 usec, and the maximum aperture time is 149 sec. Any number of powerline cycles (PLCs) within the minimum and maximum ranges is allowed on the NI 4070/4071/4072. @@ -122,173 +128,189 @@ class _SessionBase(object): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - ''' - aperture_time_units = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ApertureTimeUnits, 1250322) - '''Type: enums.ApertureTimeUnits + """ + aperture_time_units = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.ApertureTimeUnits, 1250322 + ) + """Type: enums.ApertureTimeUnits Specifies the units of aperture time for the current configuration. The NI 4060 does not support an aperture time set in seconds. - ''' + """ auto_range_value = _attributes.AttributeViReal64(1250331) - '''Type: float + """Type: float Specifies the value of the range. If auto ranging, shows the actual value of the active range. The value of this property is set during a read operation. - ''' - auto_zero = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.AutoZero, 1250332) - '''Type: enums.AutoZero + """ + auto_zero = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.AutoZero, 1250332 + ) + """Type: enums.AutoZero Specifies the AutoZero mode. The NI 4050 is not supported. - ''' + """ buffer_size = _attributes.AttributeViInt32(1150037) - '''Type: int + """Type: int Size in samples of the internal data buffer. Maximum is 134,217,727 (OX7FFFFFF) samples. When set to NIDMM_VAL_BUFFER_SIZE_AUTO (-1), NI-DMM chooses the buffer size. Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - ''' - cable_comp_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.CableCompensationType, 1150045) - '''Type: enums.CableCompensationType + """ + cable_comp_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.CableCompensationType, 1150045 + ) + """Type: enums.CableCompensationType For the NI 4072 only, the type of cable compensation that is applied to the current capacitance or inductance measurement for the current range. Changing the method or the range through this property or through configure_measurement_digits resets the value of this property to the default value. - ''' + """ channel_count = _attributes.AttributeViInt32(1050203) - '''Type: int + """Type: int Indicates the number of channels that the specific instrument driver supports. For each property for which the IVI_VAL_MULTI_CHANNEL flag property is set, the IVI engine maintains a separate cache value for each channel. - ''' + """ current_source = _attributes.AttributeViReal64(1150025) - '''Type: float + """Type: float Specifies the current source provided during diode measurements. The NI 4050 and NI 4060 are not supported. - ''' + """ dc_bias = _attributes.AttributeViInt32(1150053) - '''Type: int + """Type: int For the NI 4072 only, controls the available DC bias for capacitance measurements. - ''' - dc_noise_rejection = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.DCNoiseRejection, 1150026) - '''Type: enums.DCNoiseRejection + """ + dc_noise_rejection = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.DCNoiseRejection, 1150026 + ) + """Type: enums.DCNoiseRejection Specifies the DC noise rejection mode. The NI 4050 and NI 4060 are not supported. - ''' + """ driver_setup = _attributes.AttributeViString(1050007) - '''Type: str + """Type: str This property indicates the Driver Setup string that the user specified when initializing the driver. Some cases exist where the end-user must specify instrument driver options at initialization time. An example of this is specifying a particular instrument model from among a family of instruments that the driver supports. This is useful when using simulation. The end-user can specify driver-specific options through the DriverSetup keyword in the optionsString parameter to the niDMM Init With Options.vi. If the user does not specify a Driver Setup string, this property returns an empty string. - ''' + """ freq_voltage_auto_range = _attributes.AttributeViReal64(1150044) - '''Type: float + """Type: float For the NI 4070/4071/4072 only, specifies the value of the frequency voltage range. If Auto Ranging, shows the actual value of the active frequency voltage range. If not Auto Ranging, the value of this property is the same as that of freq_voltage_range. - ''' + """ freq_voltage_range = _attributes.AttributeViReal64(1250101) - '''Type: float + """Type: float Specifies the maximum amplitude of the input signal for frequency measurements. - ''' - function = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.Function, 1250001) - '''Type: enums.Function + """ + function = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.Function, 1250001 + ) + """Type: enums.Function Specifies the measurement method. Refer to the method topic in the NI Digital Multimeters Help for device-specific information. If you are setting this property directly, you must also set the operation_mode property, which controls whether the DMM takes standard single or multipoint measurements, or acquires a waveform. If you are programming properties directly, you must set the operation_mode property before setting other configuration properties. If the operation_mode property is set to OperationMode.WAVEFORM, the only valid method types are Method.WAVEFORM_VOLTAGE and Method.WAVEFORM_CURRENT. Set the operation_mode property to OperationMode.IVIDMM to set all other method values. - ''' + """ input_resistance = _attributes.AttributeViReal64(1150029) - '''Type: float + """Type: float Specifies the input resistance of the instrument. The NI 4050 and NI 4060 are not supported. - ''' + """ instrument_firmware_revision = _attributes.AttributeViString(1050510) - '''Type: str + """Type: str A string containing the instrument firmware revision number. - ''' + """ instrument_manufacturer = _attributes.AttributeViString(1050511) - '''Type: str + """Type: str A string containing the manufacturer of the instrument. - ''' + """ instrument_model = _attributes.AttributeViString(1050512) - '''Type: str + """Type: str A string containing the instrument model. - ''' + """ instrument_product_id = _attributes.AttributeViInt32(1150061) - '''Type: int + """Type: int The PCI product ID. - ''' + """ io_resource_descriptor = _attributes.AttributeViString(1050304) - '''Type: str + """Type: str A string containing the resource descriptor of the instrument. - ''' - lc_calculation_model = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.LCCalculationModel, 1150052) - '''Type: enums.LCCalculationModel + """ + lc_calculation_model = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.LCCalculationModel, 1150052 + ) + """Type: enums.LCCalculationModel For the NI 4072 only, specifies the type of algorithm that the measurement processing uses for capacitance and inductance measurements. - ''' + """ lc_number_meas_to_average = _attributes.AttributeViInt32(1150055) - '''Type: int + """Type: int For the NI 4072 only, specifies the number of LC measurements that are averaged to produce one reading. - ''' + """ logical_name = _attributes.AttributeViString(1050305) - '''Type: str + """Type: str A string containing the logical name of the instrument. - ''' - meas_complete_dest = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.MeasurementCompleteDest, 1250305) - '''Type: enums.MeasurementCompleteDest + """ + meas_complete_dest = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.MeasurementCompleteDest, 1250305 + ) + """Type: enums.MeasurementCompleteDest Specifies the destination of the measurement complete (MC) signal. The NI 4050 is not supported. To determine which values are supported by each device, refer to the LabWindows/CVI Trigger Routing section in the NI Digital Multimeters Help. - ''' + """ number_of_averages = _attributes.AttributeViInt32(1150032) - '''Type: int + """Type: int Specifies the number of averages to perform in a measurement. For the NI 4070/4071/4072, applies only when the aperture time is not set to AUTO and Auto Zero is ON. The default is 1. The NI 4050 and NI 4060 are not supported. - ''' + """ offset_comp_ohms = _attributes.AttributeViInt32(1150023) - '''Type: int + """Type: int For the NI 4070/4071/4072 only, enables or disables offset compensated ohms. - ''' + """ open_cable_comp_conductance = _attributes.AttributeViReal64(1150049) - '''Type: float + """Type: float For the NI 4072 only, specifies the active part (conductance) of the open cable compensation. The valid range is any real number greater than 0. The default value (-1.0) indicates that compensation has not taken place. Changing the method or the range through this property or through configure_measurement_digits resets the value of this property to the default value. - ''' + """ open_cable_comp_susceptance = _attributes.AttributeViReal64(1150048) - '''Type: float + """Type: float For the NI 4072 only, specifies the reactive part (susceptance) of the open cable compensation. The valid range is any real number greater than 0. The default value (-1.0) indicates that compensation has not taken place. Changing the method or the range through this property or through configure_measurement_digits resets the value of this property to the default value. - ''' - operation_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.OperationMode, 1150014) - '''Type: enums.OperationMode + """ + operation_mode = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.OperationMode, 1150014 + ) + """Type: enums.OperationMode Specifies how the NI 4065 and NI 4070/4071/4072 acquire data. When you call configure_measurement_digits, NI-DMM sets this property to OperationMode.IVIDMM. When you call configure_waveform_acquisition, NI-DMM sets this property to OperationMode.WAVEFORM. If you are programming properties directly, you must set this property before setting other configuration properties. - ''' + """ powerline_freq = _attributes.AttributeViReal64(1250333) - '''Type: float + """Type: float Specifies the powerline frequency. The NI 4050 and NI 4060 use this value to select an aperture time to reject powerline noise by selecting the appropriate internal sample clock and filter. The NI 4065 and NI 4070/4071/4072 use this value to select a timebase for setting the aperture_time property in powerline cycles (PLCs). After configuring powerline frequency, set the aperture_time_units property to PLCs. When setting the aperture_time property, select the number of PLCs for the powerline frequency. For example, if powerline frequency = 50 Hz (or 20ms) and aperture time in PLCs = 5, then aperture time in Seconds = 20ms * 5 PLCs = 100 ms. Similarly, if powerline frequency = 60 Hz (or 16.667 ms) and aperture time in PLCs = 6, then aperture time in Seconds = 16.667 ms * 6 PLCs = 100 ms. - ''' + """ range = _attributes.AttributeViReal64(1250002) - '''Type: float + """Type: float Specifies the measurement range. Use positive values to represent the absolute value of the maximum expected measurement. The value is in units appropriate for the current value of the method property. For example, if method is set to NIDMM_VAL_VOLTS, the units are volts. The NI 4050 and NI 4060 only support Auto Range when the trigger and sample trigger is set to IMMEDIATE. @@ -301,185 +323,197 @@ class _SessionBase(object): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - ''' + """ resolution_absolute = _attributes.AttributeViReal64(1250008) - '''Type: float + """Type: float Specifies the measurement resolution in absolute units. Setting this property to higher values increases the measurement accuracy. Setting this property to lower values increases the measurement speed. NI-DMM ignores this property for capacitance and inductance measurements on the NI 4072. To achieve better resolution for such measurements, use the lc_number_meas_to_average property. - ''' + """ resolution_digits = _attributes.AttributeViReal64(1250003) - '''Type: float + """Type: float Specifies the measurement resolution in digits. Setting this property to higher values increases the measurement accuracy. Setting this property to lower values increases the measurement speed. NI-DMM ignores this property for capacitance and inductance measurements on the NI 4072. To achieve better resolution for such measurements, use the lc_number_meas_to_average property. - ''' + """ sample_count = _attributes.AttributeViInt32(1250301) - '''Type: int + """Type: int Specifies the number of measurements the DMM takes each time it receives a trigger in a multiple point acquisition. - ''' + """ sample_interval = _attributes.AttributeViReal64TimeDeltaSeconds(1250303) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the amount of time in seconds the DMM waits between measurement cycles. This property only applies when the sample_trigger property is set to INTERVAL. On the NI 4060, the value for this property is used as the settling time. When this property is set to 0, the NI 4060 does not settle between measurement cycles. The onboard timing resolution is 1 µs on the NI 4060. The NI 4065 and NI 4070/4071/4072 use the value specified in this property as additional delay. On the NI 4065 and NI 4070/4071/4072, the onboard timing resolution is 34.72 ns and the valid range is 0-149 s. Only positive values are valid when setting the sample interval. The NI 4050 is not supported. - ''' - sample_trigger = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.SampleTrigger, 1250302) - '''Type: enums.SampleTrigger + """ + sample_trigger = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.SampleTrigger, 1250302 + ) + """Type: enums.SampleTrigger Specifies the sample trigger source. To determine which values are supported by each device, refer to the LabWindows/CVI Trigger Routing section in the NI Digital Multimeters Help. - ''' + """ serial_number = _attributes.AttributeViString(1150054) - '''Type: str + """Type: str A string containing the serial number of the instrument. This property corresponds to the serial number label that is attached to most products. - ''' + """ settle_time = _attributes.AttributeViReal64TimeDeltaSeconds(1150028) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the settling time in seconds. To override the default settling time, set this property. To return to the default, set this property to NIDMM_VAL_SETTLE_TIME_AUTO (-1). The NI 4050 and NI 4060 are not supported. Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - ''' + """ short_cable_comp_reactance = _attributes.AttributeViReal64(1150046) - '''Type: float + """Type: float For the NI 4072 only, represents the reactive part (reactance) of the short cable compensation. The valid range is any real number greater than 0. The default value (-1) indicates that compensation has not taken place. Changing the method or the range through this property or through configure_measurement_digits resets the value of this property to the default value. - ''' + """ short_cable_comp_resistance = _attributes.AttributeViReal64(1150047) - '''Type: float + """Type: float For the NI 4072 only, represents the active part (resistance) of the short cable compensation. The valid range is any real number greater than 0. The default value (-1) indicates that compensation has not taken place. Changing the method or the range through this property or through configure_measurement_digits resets the value of this property to the default value. - ''' + """ simulate = _attributes.AttributeViBoolean(1050005) - '''Type: bool + """Type: bool Specifies whether or not to simulate instrument driver I/O operations. If simulation is enabled, instrument driver methods perform range checking and call IVI Get and Set methods, but they do not perform instrument I/O. For output parameters that represent instrument data, the instrument driver methods return calculated values. The default value is False (0). Use the __init__ method to override this setting. Simulate can only be set within the InitWithOptions method. The property value cannot be changed outside of the method. - ''' + """ specific_driver_description = _attributes.AttributeViString(1050514) - '''Type: str + """Type: str A string containing a description of the specific driver. - ''' + """ specific_driver_major_version = _attributes.AttributeViInt32(1050503) - '''Type: int + """Type: int Returns the major version number of this instrument driver. - ''' + """ specific_driver_minor_version = _attributes.AttributeViInt32(1050504) - '''Type: int + """Type: int The minor version number of this instrument driver. - ''' + """ specific_driver_revision = _attributes.AttributeViString(1050551) - '''Type: str + """Type: str A string that contains additional version information about this specific instrument driver. - ''' + """ specific_driver_vendor = _attributes.AttributeViString(1050513) - '''Type: str + """Type: str A string containing the vendor of the specific driver. - ''' + """ supported_instrument_models = _attributes.AttributeViString(1050327) - '''Type: str + """Type: str A string containing the instrument models supported by the specific driver. - ''' + """ temp_rtd_a = _attributes.AttributeViReal64(1150121) - '''Type: float + """Type: float Specifies the Callendar-Van Dusen A coefficient for RTD scaling when the RTD Type property is set to Custom. The default value is 3.9083e-3 (Pt3851). - ''' + """ temp_rtd_b = _attributes.AttributeViReal64(1150122) - '''Type: float + """Type: float Specifies the Callendar-Van Dusen B coefficient for RTD scaling when the RTD Type property is set to Custom. The default value is -5.775e-7(Pt3851). - ''' + """ temp_rtd_c = _attributes.AttributeViReal64(1150123) - '''Type: float + """Type: float Specifies the Callendar-Van Dusen C coefficient for RTD scaling when the RTD Type property is set to Custom. The default value is -4.183e-12(Pt3851). - ''' + """ temp_rtd_res = _attributes.AttributeViReal64(1250242) - '''Type: float + """Type: float Specifies the RTD resistance at 0 degrees Celsius. This applies to all supported RTDs, including custom RTDs. The default value is 100 (?). - ''' - temp_rtd_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.RTDType, 1150120) - '''Type: enums.RTDType + """ + temp_rtd_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.RTDType, 1150120 + ) + """Type: enums.RTDType Specifies the type of RTD used to measure temperature. The default value is RTDType.PT3851. Refer to the temp_rtd_type topic in the NI Digital Multimeters Help for additional information about defined values. - ''' + """ temp_tc_fixed_ref_junc = _attributes.AttributeViReal64(1250233) - '''Type: float + """Type: float Specifies the reference junction temperature when a fixed reference junction is used to take a thermocouple measurement. The default value is 25.0 (°C). - ''' - temp_tc_ref_junc_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ThermocoupleReferenceJunctionType, 1250232) - '''Type: enums.ThermocoupleReferenceJunctionType + """ + temp_tc_ref_junc_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.ThermocoupleReferenceJunctionType, 1250232 + ) + """Type: enums.ThermocoupleReferenceJunctionType Specifies the type of reference junction to be used in the reference junction compensation of a thermocouple. The only supported value, NIDMM_VAL_TEMP_REF_JUNC_FIXED, is fixed. Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - ''' - temp_tc_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ThermocoupleType, 1250231) - '''Type: enums.ThermocoupleType + """ + temp_tc_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.ThermocoupleType, 1250231 + ) + """Type: enums.ThermocoupleType Specifies the type of thermocouple used to measure the temperature. The default value is ThermocoupleType.J. - ''' + """ temp_thermistor_a = _attributes.AttributeViReal64(1150125) - '''Type: float + """Type: float Specifies the Steinhart-Hart A coefficient for thermistor scaling when the Thermistor Type property is set to Custom. The default value is 0.0010295 (44006). - ''' + """ temp_thermistor_b = _attributes.AttributeViReal64(1150126) - '''Type: float + """Type: float Specifies the Steinhart-Hart B coefficient for thermistor scaling when the Thermistor Type proerty is set to Custom. The default value is 0.0002391 (44006). - ''' + """ temp_thermistor_c = _attributes.AttributeViReal64(1150127) - '''Type: float + """Type: float Specifies the Steinhart-Hart C coefficient for thermistor scaling when the Thermistor Type property is set to Custom. The default value is 1.568e-7 (44006). - ''' - temp_thermistor_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ThermistorType, 1150124) - '''Type: enums.ThermistorType + """ + temp_thermistor_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.ThermistorType, 1150124 + ) + """Type: enums.ThermistorType Specifies the type of thermistor used to measure the temperature. The default value is ThermistorType.THERMISTOR_44006. Refer to the temp_thermistor_type topic in the NI Digital Multimeters Help for additional information about defined values. - ''' - temp_transducer_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TransducerType, 1250201) - '''Type: enums.TransducerType + """ + temp_transducer_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TransducerType, 1250201 + ) + """Type: enums.TransducerType Specifies the type of device used to measure the temperature. The default value is NIDMM_VAL_4_THERMOCOUPLE. Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - ''' + """ trigger_count = _attributes.AttributeViInt32(1250304) - '''Type: int + """Type: int Specifies the number of triggers the DMM receives before returning to the Idle state. This property can be set to any positive ViInt32 value for the NI 4065 and NI 4070/4071/4072. The NI 4050 and NI 4060 support this property being set to 1. Refer to the Multiple Point Acquisitions section of the NI Digital Multimeters Help for more information. - ''' + """ trigger_delay = _attributes.AttributeViReal64TimeDeltaSeconds(1250005) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the time (in seconds) that the DMM waits after it has received a trigger before taking a measurement. The default value is AUTO DELAY (-1), which means that the DMM waits an appropriate settling time before taking the measurement. (-1) signifies that AUTO DELAY is on, and (-2) signifies that AUTO DELAY is off. The NI 4065 and NI 4070/4071/4072 use the value specified in this property as additional settling time. For the The NI 4065 and NI 4070/4071/4072, the valid range for Trigger Delay is AUTO DELAY (-1) or 0.0-149.0 seconds and the onboard timing resolution is 34.72 ns. @@ -491,60 +525,70 @@ class _SessionBase(object): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - ''' - trigger_source = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerSource, 1250004) - '''Type: enums.TriggerSource + """ + trigger_source = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TriggerSource, 1250004 + ) + """Type: enums.TriggerSource Specifies the trigger source. When _initiate is called, the DMM waits for the trigger specified with this property. After it receives the trigger, the DMM waits the length of time specified with the trigger_delay property. The DMM then takes a measurement. This property is not supported on the NI 4050. To determine which values are supported by each device, refer to the LabWindows/CVI Trigger Routing section in the NI Digital Multimeters Help. - ''' - waveform_coupling = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.WaveformCoupling, 1150027) - '''Type: enums.WaveformCoupling + """ + waveform_coupling = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.WaveformCoupling, 1150027 + ) + """Type: enums.WaveformCoupling For the NI 4070/4071/4072 only, specifies the coupling during a waveform acquisition. - ''' + """ waveform_points = _attributes.AttributeViInt32(1150019) - '''Type: int + """Type: int For the NI 4070/4071/4072 only, specifies the number of points to acquire in a waveform acquisition. - ''' + """ waveform_rate = _attributes.AttributeViReal64(1150018) - '''Type: float + """Type: float For the NI 4070/4071/4072 only, specifies the rate of the waveform acquisition in Samples per second (S/s). The valid Range is 10.0-1,800,000 S/s. Values are coerced to the closest integer divisor of 1,800,000. The default value is 1,800,000. - ''' + """ - def __init__(self, repeated_capability_list, vi, library, encoding, freeze_it=False): + def __init__( + self, repeated_capability_list, vi, library, encoding, freeze_it=False + ): self._repeated_capability_list = repeated_capability_list - self._repeated_capability = ','.join(repeated_capability_list) + self._repeated_capability = ",".join(repeated_capability_list) self._vi = vi self._library = library self._encoding = encoding # Store the parameter list for later printing in __repr__ param_list = [] - param_list.append("repeated_capability_list=" + pp.pformat(repeated_capability_list)) + param_list.append( + "repeated_capability_list=" + pp.pformat(repeated_capability_list) + ) param_list.append("vi=" + pp.pformat(vi)) param_list.append("library=" + pp.pformat(library)) param_list.append("encoding=" + pp.pformat(encoding)) - self._param_list = ', '.join(param_list) + self._param_list = ", ".join(param_list) self._is_frozen = freeze_it def __repr__(self): - return '{0}.{1}({2})'.format('nidmm', self.__class__.__name__, self._param_list) + return "{0}.{1}({2})".format("nidmm", self.__class__.__name__, self._param_list) def __setattr__(self, key, value): if self._is_frozen and key not in dir(self): - raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) + raise AttributeError( + "'{0}' object has no attribute '{1}'".format(type(self).__name__, key) + ) object.__setattr__(self, key, value) def _get_error_description(self, error_code): - '''_get_error_description + """_get_error_description Returns the error description. - ''' + """ try: _, error_string = self._get_error() return error_string @@ -552,21 +596,21 @@ def _get_error_description(self, error_code): pass try: - ''' + """ It is expected for _get_error to raise when the session is invalid (IVI spec requires GetError to fail). Use _error_message instead. It doesn't require a session. - ''' + """ error_string = self._error_message(error_code) return error_string except errors.Error: return "Failed to retrieve error description." - ''' These are code-generated ''' + """ These are code-generated """ @ivi_synchronized def _get_attribute_vi_boolean(self, attribute_id): - r'''_get_attribute_vi_boolean + r"""_get_attribute_vi_boolean Queries the value of a ViBoolean property. You can use this method to get the values of instrument-specific properties and inherent IVI @@ -598,18 +642,29 @@ def _get_attribute_vi_boolean(self, attribute_id): attribute_value (bool): Returns the current value of the property. Pass the address of a ViBoolean variable. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niDMM_GetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_GetAttributeViBoolean( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + None + if attribute_value_ctype is None + else (ctypes.pointer(attribute_value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return bool(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_int32(self, attribute_id): - r'''_get_attribute_vi_int32 + r"""_get_attribute_vi_int32 Queries the value of a ViInt32 property. You can use this method to get the values of instrument-specific properties and inherent IVI @@ -641,18 +696,29 @@ def _get_attribute_vi_int32(self, attribute_id): attribute_value (int): Returns the current value of the property. Pass the address of a ViInt32 variable. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDMM_GetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_GetAttributeViInt32( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + None + if attribute_value_ctype is None + else (ctypes.pointer(attribute_value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_real64(self, attribute_id): - r'''_get_attribute_vi_real64 + r"""_get_attribute_vi_real64 Queries the value of a ViReal64 property. You can use this method to get the values of instrument-specific properties and inherent IVI @@ -684,18 +750,29 @@ def _get_attribute_vi_real64(self, attribute_id): attribute_value (float): Returns the current value of the property. Pass the address of a ViReal64 variable. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDMM_GetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_GetAttributeViReal64( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + None + if attribute_value_ctype is None + else (ctypes.pointer(attribute_value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_string(self, attribute_id): - r'''_get_attribute_vi_string + r"""_get_attribute_vi_string Queries the value of a ViString property. You can use this method to get the values of instrument-specific properties and inherent IVI @@ -734,22 +811,42 @@ def _get_attribute_vi_string(self, attribute_id): If you specify 0 for the **Buffer_Size** parameter, you can pass VI_NULL for this parameter. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 buffer_size_ctype = _visatype.ViInt32() # case S170 attribute_value_ctype = None # case C050 - error_code = self._library.niDMM_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, buffer_size_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niDMM_GetAttributeViString( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + buffer_size_ctype, + attribute_value_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - attribute_value_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niDMM_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, buffer_size_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + attribute_value_ctype = ( + _visatype.ViChar * buffer_size_ctype.value + )() # case C060 + error_code = self._library.niDMM_GetAttributeViString( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + buffer_size_ctype, + attribute_value_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return attribute_value_ctype.value.decode(self._encoding) def _get_error(self): - r'''_get_error + r"""_get_error Returns the error information associated with the **Instrument_Handle**. This method retrieves and then clears the @@ -768,21 +865,37 @@ def _get_error(self): you specify with the **Buffer_Size** parameter. If you pass 0 for the **Buffer_Size**, you can pass VI_NULL for this parameter. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus() # case S220 buffer_size_ctype = _visatype.ViInt32() # case S170 description_ctype = None # case C050 - error_code = self._library.niDMM_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), buffer_size_ctype, description_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True) + error_code = self._library.niDMM_GetError( + vi_ctype, + None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), + buffer_size_ctype, + description_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=True + ) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 description_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niDMM_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), buffer_size_ctype, description_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) - return int(error_code_ctype.value), description_ctype.value.decode(self._encoding) + error_code = self._library.niDMM_GetError( + vi_ctype, + None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), + buffer_size_ctype, + description_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) + return int(error_code_ctype.value), description_ctype.value.decode( + self._encoding + ) def lock(self): - '''lock + """lock Obtains a multithread lock on the device session. Before doing so, the software waits until all other execution threads release their locks @@ -810,25 +923,27 @@ def lock(self): Returns: lock (context manager): When used in a with statement, nidmm.Session.lock acts as a context manager and unlock will be called when the with block is exited - ''' + """ self._lock_session() # We do not call _lock_session() in the context manager so that this function can # act standalone as well and let the client call unlock() explicitly. If they do use the context manager, # that will handle the unlock for them return _Lock(self) def _lock_session(self): - '''_lock_session + """_lock_session Actual call to driver - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDMM_LockSession(vi_ctype, None) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return @ivi_synchronized def _set_attribute_vi_boolean(self, attribute_id, attribute_value): - r'''_set_attribute_vi_boolean + r"""_set_attribute_vi_boolean This method sets the value of a ViBoolean property. @@ -872,18 +987,24 @@ def _set_attribute_vi_boolean(self, attribute_id, attribute_value): attribute_value (bool): Pass the value that you want to set the property to. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViBoolean(attribute_value) # case S150 - error_code = self._library.niDMM_SetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_SetAttributeViBoolean( + vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_int32(self, attribute_id, attribute_value): - r'''_set_attribute_vi_int32 + r"""_set_attribute_vi_int32 This method sets the value of a ViInt32 property. @@ -927,18 +1048,24 @@ def _set_attribute_vi_int32(self, attribute_id, attribute_value): attribute_value (int): Pass the value that you want to set the property to. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt32(attribute_value) # case S150 - error_code = self._library.niDMM_SetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_SetAttributeViInt32( + vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_real64(self, attribute_id, attribute_value): - r'''_set_attribute_vi_real64 + r"""_set_attribute_vi_real64 This method sets the value of a ViReal64 property. @@ -982,18 +1109,24 @@ def _set_attribute_vi_real64(self, attribute_id, attribute_value): attribute_value (float): Pass the value that you want to set the property to. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViReal64(attribute_value) # case S150 - error_code = self._library.niDMM_SetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_SetAttributeViReal64( + vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_string(self, attribute_id, attribute_value): - r'''_set_attribute_vi_string + r"""_set_attribute_vi_string This method sets the value of a ViString property. @@ -1037,29 +1170,39 @@ def _set_attribute_vi_string(self, attribute_id, attribute_value): attribute_value (str): Pass the value that you want to set the property to. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 - attribute_value_ctype = ctypes.create_string_buffer(attribute_value.encode(self._encoding)) # case C020 - error_code = self._library.niDMM_SetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + attribute_value_ctype = ctypes.create_string_buffer( + attribute_value.encode(self._encoding) + ) # case C020 + error_code = self._library.niDMM_SetAttributeViString( + vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def unlock(self): - '''unlock + """unlock Releases a lock that you acquired on an device session using lock. Refer to lock for additional information on session locks. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDMM_UnlockSession(vi_ctype, None) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return def _error_message(self, error_code): - r'''_error_message + r"""_error_message Takes the **Error_Code** returned by the instrument driver methods, interprets it, and returns it as a user-readable string. @@ -1072,20 +1215,24 @@ def _error_message(self, error_code): Returns: error_message (str): The error information formatted into a string. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus(error_code) # case S150 error_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niDMM_error_message(vi_ctype, error_code_ctype, error_message_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + error_code = self._library.niDMM_error_message( + vi_ctype, error_code_ctype, error_message_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return error_message_ctype.value.decode(self._encoding) class Session(_SessionBase): - '''An NI-DMM session to a National Instruments Digital Multimeter''' + """An NI-DMM session to a National Instruments Digital Multimeter""" def __init__(self, resource_name, id_query=False, reset_device=False, options={}): - r'''An NI-DMM session to a National Instruments Digital Multimeter + r"""An NI-DMM session to a National Instruments Digital Multimeter This method completes the following tasks: @@ -1183,22 +1330,30 @@ def __init__(self, resource_name, id_query=False, reset_device=False, options={} Returns: session (nidmm.Session): A session object representing the device. - ''' - super(Session, self).__init__(repeated_capability_list=[], vi=None, library=None, encoding=None, freeze_it=False) + """ + super(Session, self).__init__( + repeated_capability_list=[], + vi=None, + library=None, + encoding=None, + freeze_it=False, + ) options = _converters.convert_init_with_options_dictionary(options) self._library = _library_singleton.get() - self._encoding = 'windows-1251' + self._encoding = "windows-1251" # Call specified init function self._vi = 0 # This must be set before calling _init_with_options(). - self._vi = self._init_with_options(resource_name, id_query, reset_device, options) + self._vi = self._init_with_options( + resource_name, id_query, reset_device, options + ) # Store the parameter list for later printing in __repr__ param_list = [] param_list.append("resource_name=" + pp.pformat(resource_name)) param_list.append("reset_device=" + pp.pformat(reset_device)) param_list.append("options=" + pp.pformat(options)) - self._param_list = ', '.join(param_list) + self._param_list = ", ".join(param_list) self._is_frozen = True @@ -1209,7 +1364,7 @@ def __exit__(self, exc_type, exc_value, traceback): self.close() def initiate(self): - '''initiate + """initiate Initiates an acquisition. After you call this method, the DMM leaves the Idle state and enters the Wait-for-Trigger state. If trigger is set @@ -1219,17 +1374,17 @@ def initiate(self): Note: This method will return a Python context manager that will initiate on entering and abort on exit. - ''' + """ return _Acquisition(self) def close(self): - '''close + """close Closes the specified session and deallocates resources that it reserved. Note: This method is not needed when using the session context manager - ''' + """ try: self._close() except errors.DriverError: @@ -1237,23 +1392,27 @@ def close(self): raise self._vi = 0 - ''' These are code-generated ''' + """ These are code-generated """ @ivi_synchronized def abort(self): - r'''abort + r"""abort Aborts a previously initiated measurement and returns the DMM to the Idle state. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDMM_Abort(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def configure_measurement_absolute(self, measurement_function, range, resolution_absolute): - r'''configure_measurement_absolute + def configure_measurement_absolute( + self, measurement_function, range, resolution_absolute + ): + r"""configure_measurement_absolute Configures the common properties of the measurement. These properties include method, range, and @@ -1307,20 +1466,30 @@ def configure_measurement_absolute(self, measurement_function, range, resolution Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - ''' + """ if type(measurement_function) is not enums.Function: - raise TypeError('Parameter measurement_function must be of type ' + str(enums.Function)) + raise TypeError( + "Parameter measurement_function must be of type " + str(enums.Function) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - measurement_function_ctype = _visatype.ViInt32(measurement_function.value) # case S130 + measurement_function_ctype = _visatype.ViInt32( + measurement_function.value + ) # case S130 range_ctype = _visatype.ViReal64(range) # case S150 resolution_absolute_ctype = _visatype.ViReal64(resolution_absolute) # case S150 - error_code = self._library.niDMM_ConfigureMeasurementAbsolute(vi_ctype, measurement_function_ctype, range_ctype, resolution_absolute_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_ConfigureMeasurementAbsolute( + vi_ctype, measurement_function_ctype, range_ctype, resolution_absolute_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def configure_measurement_digits(self, measurement_function, range, resolution_digits): - r'''configure_measurement_digits + def configure_measurement_digits( + self, measurement_function, range, resolution_digits + ): + r"""configure_measurement_digits Configures the common properties of the measurement. These properties include method, range, and @@ -1375,20 +1544,34 @@ def configure_measurement_digits(self, measurement_function, range, resolution_d Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - ''' + """ if type(measurement_function) is not enums.Function: - raise TypeError('Parameter measurement_function must be of type ' + str(enums.Function)) + raise TypeError( + "Parameter measurement_function must be of type " + str(enums.Function) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - measurement_function_ctype = _visatype.ViInt32(measurement_function.value) # case S130 + measurement_function_ctype = _visatype.ViInt32( + measurement_function.value + ) # case S130 range_ctype = _visatype.ViReal64(range) # case S150 resolution_digits_ctype = _visatype.ViReal64(resolution_digits) # case S150 - error_code = self._library.niDMM_ConfigureMeasurementDigits(vi_ctype, measurement_function_ctype, range_ctype, resolution_digits_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_ConfigureMeasurementDigits( + vi_ctype, measurement_function_ctype, range_ctype, resolution_digits_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def configure_multi_point(self, trigger_count, sample_count, sample_trigger=enums.SampleTrigger.IMMEDIATE, sample_interval=hightime.timedelta(seconds=-1)): - r'''configure_multi_point + def configure_multi_point( + self, + trigger_count, + sample_count, + sample_trigger=enums.SampleTrigger.IMMEDIATE, + sample_interval=hightime.timedelta(seconds=-1), + ): + r"""configure_multi_point Configures the properties for multipoint measurements. These properties include trigger_count, sample_count, @@ -1434,21 +1617,33 @@ def configure_multi_point(self, trigger_count, sample_count, sample_trigger=enum Note: This property is not used on the NI 4080/4081/4082 and the NI 4050. - ''' + """ if type(sample_trigger) is not enums.SampleTrigger: - raise TypeError('Parameter sample_trigger must be of type ' + str(enums.SampleTrigger)) + raise TypeError( + "Parameter sample_trigger must be of type " + str(enums.SampleTrigger) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 trigger_count_ctype = _visatype.ViInt32(trigger_count) # case S150 sample_count_ctype = _visatype.ViInt32(sample_count) # case S150 sample_trigger_ctype = _visatype.ViInt32(sample_trigger.value) # case S130 - sample_interval_ctype = _converters.convert_timedelta_to_seconds_real64(sample_interval) # case S140 - error_code = self._library.niDMM_ConfigureMultiPoint(vi_ctype, trigger_count_ctype, sample_count_ctype, sample_trigger_ctype, sample_interval_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + sample_interval_ctype = _converters.convert_timedelta_to_seconds_real64( + sample_interval + ) # case S140 + error_code = self._library.niDMM_ConfigureMultiPoint( + vi_ctype, + trigger_count_ctype, + sample_count_ctype, + sample_trigger_ctype, + sample_interval_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def configure_rtd_custom(self, rtd_a, rtd_b, rtd_c): - r'''configure_rtd_custom + r"""configure_rtd_custom Configures the A, B, and C parameters for a custom RTD. @@ -1465,18 +1660,22 @@ def configure_rtd_custom(self, rtd_a, rtd_b, rtd_c): Type parameter is set to Custom in the configure_rtd_type method. The default is -4.183e-12 (Pt3851). - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 rtd_a_ctype = _visatype.ViReal64(rtd_a) # case S150 rtd_b_ctype = _visatype.ViReal64(rtd_b) # case S150 rtd_c_ctype = _visatype.ViReal64(rtd_c) # case S150 - error_code = self._library.niDMM_ConfigureRTDCustom(vi_ctype, rtd_a_ctype, rtd_b_ctype, rtd_c_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_ConfigureRTDCustom( + vi_ctype, rtd_a_ctype, rtd_b_ctype, rtd_c_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def configure_rtd_type(self, rtd_type, rtd_resistance): - r'''configure_rtd_type + r"""configure_rtd_type Configures the RTD Type and RTD Resistance parameters for an RTD. @@ -1508,19 +1707,23 @@ def configure_rtd_type(self, rtd_type, rtd_resistance): rtd_resistance (float): Specifies the RTD resistance in ohms at 0 °C. NI-DMM uses this value to set the RTD Resistance property. The default is 100 (Ω). - ''' + """ if type(rtd_type) is not enums.RTDType: - raise TypeError('Parameter rtd_type must be of type ' + str(enums.RTDType)) + raise TypeError("Parameter rtd_type must be of type " + str(enums.RTDType)) vi_ctype = _visatype.ViSession(self._vi) # case S110 rtd_type_ctype = _visatype.ViInt32(rtd_type.value) # case S130 rtd_resistance_ctype = _visatype.ViReal64(rtd_resistance) # case S150 - error_code = self._library.niDMM_ConfigureRTDType(vi_ctype, rtd_type_ctype, rtd_resistance_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_ConfigureRTDType( + vi_ctype, rtd_type_ctype, rtd_resistance_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def configure_thermistor_custom(self, thermistor_a, thermistor_b, thermistor_c): - r'''configure_thermistor_custom + r"""configure_thermistor_custom Configures the A, B, and C parameters for a custom thermistor. @@ -1546,18 +1749,26 @@ def configure_thermistor_custom(self, thermistor_a, thermistor_b, thermistor_c): Note: One or more of the referenced methods are not in the Python API for this driver. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 thermistor_a_ctype = _visatype.ViReal64(thermistor_a) # case S150 thermistor_b_ctype = _visatype.ViReal64(thermistor_b) # case S150 thermistor_c_ctype = _visatype.ViReal64(thermistor_c) # case S150 - error_code = self._library.niDMM_ConfigureThermistorCustom(vi_ctype, thermistor_a_ctype, thermistor_b_ctype, thermistor_c_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_ConfigureThermistorCustom( + vi_ctype, thermistor_a_ctype, thermistor_b_ctype, thermistor_c_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def configure_thermocouple(self, thermocouple_type, reference_junction_type=enums.ThermocoupleReferenceJunctionType.FIXED): - r'''configure_thermocouple + def configure_thermocouple( + self, + thermocouple_type, + reference_junction_type=enums.ThermocoupleReferenceJunctionType.FIXED, + ): + r"""configure_thermocouple Configures the thermocouple type and reference junction type for a chosen thermocouple. @@ -1593,21 +1804,37 @@ def configure_thermocouple(self, thermocouple_type, reference_junction_type=enum Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - ''' + """ if type(thermocouple_type) is not enums.ThermocoupleType: - raise TypeError('Parameter thermocouple_type must be of type ' + str(enums.ThermocoupleType)) + raise TypeError( + "Parameter thermocouple_type must be of type " + + str(enums.ThermocoupleType) + ) if type(reference_junction_type) is not enums.ThermocoupleReferenceJunctionType: - raise TypeError('Parameter reference_junction_type must be of type ' + str(enums.ThermocoupleReferenceJunctionType)) + raise TypeError( + "Parameter reference_junction_type must be of type " + + str(enums.ThermocoupleReferenceJunctionType) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - thermocouple_type_ctype = _visatype.ViInt32(thermocouple_type.value) # case S130 - reference_junction_type_ctype = _visatype.ViInt32(reference_junction_type.value) # case S130 - error_code = self._library.niDMM_ConfigureThermocouple(vi_ctype, thermocouple_type_ctype, reference_junction_type_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + thermocouple_type_ctype = _visatype.ViInt32( + thermocouple_type.value + ) # case S130 + reference_junction_type_ctype = _visatype.ViInt32( + reference_junction_type.value + ) # case S130 + error_code = self._library.niDMM_ConfigureThermocouple( + vi_ctype, thermocouple_type_ctype, reference_junction_type_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def configure_trigger(self, trigger_source, trigger_delay=hightime.timedelta(seconds=-1)): - r'''configure_trigger + def configure_trigger( + self, trigger_source, trigger_delay=hightime.timedelta(seconds=-1) + ): + r"""configure_trigger Configures the DMM **Trigger_Source** and **Trigger_Delay**. Refer to `Triggering `__ and `Using @@ -1641,19 +1868,29 @@ def configure_trigger(self, trigger_source, trigger_delay=hightime.timedelta(sec Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - ''' + """ if type(trigger_source) is not enums.TriggerSource: - raise TypeError('Parameter trigger_source must be of type ' + str(enums.TriggerSource)) + raise TypeError( + "Parameter trigger_source must be of type " + str(enums.TriggerSource) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 trigger_source_ctype = _visatype.ViInt32(trigger_source.value) # case S130 - trigger_delay_ctype = _converters.convert_timedelta_to_seconds_real64(trigger_delay) # case S140 - error_code = self._library.niDMM_ConfigureTrigger(vi_ctype, trigger_source_ctype, trigger_delay_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + trigger_delay_ctype = _converters.convert_timedelta_to_seconds_real64( + trigger_delay + ) # case S140 + error_code = self._library.niDMM_ConfigureTrigger( + vi_ctype, trigger_source_ctype, trigger_delay_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def configure_waveform_acquisition(self, measurement_function, range, rate, waveform_points): - r'''configure_waveform_acquisition + def configure_waveform_acquisition( + self, measurement_function, range, rate, waveform_points + ): + r"""configure_waveform_acquisition Configures the DMM for waveform acquisitions. This feature is supported on the NI 4080/4081/4082 and the NI 4070/4071/4072. @@ -1695,34 +1932,48 @@ def configure_waveform_acquisition(self, measurement_function, range, rate, wave The default value is 500. - ''' + """ if type(measurement_function) is not enums.Function: - raise TypeError('Parameter measurement_function must be of type ' + str(enums.Function)) + raise TypeError( + "Parameter measurement_function must be of type " + str(enums.Function) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - measurement_function_ctype = _visatype.ViInt32(measurement_function.value) # case S130 + measurement_function_ctype = _visatype.ViInt32( + measurement_function.value + ) # case S130 range_ctype = _visatype.ViReal64(range) # case S150 rate_ctype = _visatype.ViReal64(rate) # case S150 waveform_points_ctype = _visatype.ViInt32(waveform_points) # case S150 - error_code = self._library.niDMM_ConfigureWaveformAcquisition(vi_ctype, measurement_function_ctype, range_ctype, rate_ctype, waveform_points_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_ConfigureWaveformAcquisition( + vi_ctype, + measurement_function_ctype, + range_ctype, + rate_ctype, + waveform_points_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def disable(self): - r'''disable + r"""disable Places the instrument in a quiescent state where it has minimal or no impact on the system to which it is connected. If a measurement is in progress when this method is called, the measurement is aborted. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDMM_Disable(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def export_attribute_configuration_buffer(self): - r'''export_attribute_configuration_buffer + r"""export_attribute_configuration_buffer Exports the property configuration of the session to the specified configuration buffer. @@ -1764,23 +2015,33 @@ def export_attribute_configuration_buffer(self): configuration (bytes): Specifies the byte array buffer to be populated with the exported property configuration. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 size_ctype = _visatype.ViInt32() # case S170 configuration_ctype = None # case B580 - error_code = self._library.niDMM_ExportAttributeConfigurationBuffer(vi_ctype, size_ctype, configuration_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niDMM_ExportAttributeConfigurationBuffer( + vi_ctype, size_ctype, configuration_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) size_ctype = _visatype.ViInt32(error_code) # case S180 configuration_size = size_ctype.value # case B590 configuration_array = array.array("b", [0] * configuration_size) # case B590 - configuration_ctype = get_ctypes_pointer_for_buffer(value=configuration_array, library_type=_visatype.ViInt8) # case B590 - error_code = self._library.niDMM_ExportAttributeConfigurationBuffer(vi_ctype, size_ctype, configuration_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + configuration_ctype = get_ctypes_pointer_for_buffer( + value=configuration_array, library_type=_visatype.ViInt8 + ) # case B590 + error_code = self._library.niDMM_ExportAttributeConfigurationBuffer( + vi_ctype, size_ctype, configuration_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return _converters.convert_to_bytes(configuration_array) @ivi_synchronized def export_attribute_configuration_file(self, file_path): - r'''export_attribute_configuration_file + r"""export_attribute_configuration_file Exports the property configuration of the session to the specified file. @@ -1824,16 +2085,22 @@ def export_attribute_configuration_file(self, file_path): method returns an error. **Default file extension:**\ .nidmmconfig - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 - error_code = self._library.niDMM_ExportAttributeConfigurationFile(vi_ctype, file_path_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + file_path_ctype = ctypes.create_string_buffer( + file_path.encode(self._encoding) + ) # case C020 + error_code = self._library.niDMM_ExportAttributeConfigurationFile( + vi_ctype, file_path_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def fetch(self, maximum_time=hightime.timedelta(milliseconds=-1)): - r'''fetch + r"""fetch Returns the value from a previously initiated measurement. You must call _initiate before calling this method. @@ -1857,17 +2124,27 @@ def fetch(self, maximum_time=hightime.timedelta(milliseconds=-1)): Returns: reading (float): The measured value returned from the DMM. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32(maximum_time) # case S140 + maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32( + maximum_time + ) # case S140 reading_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDMM_Fetch(vi_ctype, maximum_time_ctype, None if reading_ctype is None else (ctypes.pointer(reading_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_Fetch( + vi_ctype, + maximum_time_ctype, + None if reading_ctype is None else (ctypes.pointer(reading_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(reading_ctype.value) @ivi_synchronized - def fetch_multi_point(self, array_size, maximum_time=hightime.timedelta(milliseconds=-1)): - r'''fetch_multi_point + def fetch_multi_point( + self, array_size, maximum_time=hightime.timedelta(milliseconds=-1) + ): + r"""fetch_multi_point Returns an array of values from a previously initiated multipoint measurement. The number of measurements the DMM makes is determined by @@ -1908,21 +2185,37 @@ def fetch_multi_point(self, array_size, maximum_time=hightime.timedelta(millisec actual_number_of_points (int): Indicates the number of measured values actually retrieved from the DMM. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32(maximum_time) # case S140 + maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32( + maximum_time + ) # case S140 array_size_ctype = _visatype.ViInt32(array_size) # case S210 reading_array_size = array_size # case B600 reading_array_array = array.array("d", [0] * reading_array_size) # case B600 - reading_array_ctype = get_ctypes_pointer_for_buffer(value=reading_array_array, library_type=_visatype.ViReal64) # case B600 + reading_array_ctype = get_ctypes_pointer_for_buffer( + value=reading_array_array, library_type=_visatype.ViReal64 + ) # case B600 actual_number_of_points_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDMM_FetchMultiPoint(vi_ctype, maximum_time_ctype, array_size_ctype, reading_array_ctype, None if actual_number_of_points_ctype is None else (ctypes.pointer(actual_number_of_points_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_FetchMultiPoint( + vi_ctype, + maximum_time_ctype, + array_size_ctype, + reading_array_ctype, + None + if actual_number_of_points_ctype is None + else (ctypes.pointer(actual_number_of_points_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return reading_array_array @ivi_synchronized - def fetch_waveform(self, array_size, maximum_time=hightime.timedelta(milliseconds=-1)): - r'''fetch_waveform + def fetch_waveform( + self, array_size, maximum_time=hightime.timedelta(milliseconds=-1) + ): + r"""fetch_waveform For the NI 4080/4081/4082 and the NI 4070/4071/4072, returns an array of values from a previously initiated waveform acquisition. You must call @@ -1955,21 +2248,37 @@ def fetch_waveform(self, array_size, maximum_time=hightime.timedelta(millisecond actual_number_of_points (int): Indicates the number of measured values actually retrieved from the DMM. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32(maximum_time) # case S140 + maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32( + maximum_time + ) # case S140 array_size_ctype = _visatype.ViInt32(array_size) # case S210 waveform_array_size = array_size # case B600 waveform_array_array = array.array("d", [0] * waveform_array_size) # case B600 - waveform_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_array_array, library_type=_visatype.ViReal64) # case B600 + waveform_array_ctype = get_ctypes_pointer_for_buffer( + value=waveform_array_array, library_type=_visatype.ViReal64 + ) # case B600 actual_number_of_points_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDMM_FetchWaveform(vi_ctype, maximum_time_ctype, array_size_ctype, waveform_array_ctype, None if actual_number_of_points_ctype is None else (ctypes.pointer(actual_number_of_points_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_FetchWaveform( + vi_ctype, + maximum_time_ctype, + array_size_ctype, + waveform_array_ctype, + None + if actual_number_of_points_ctype is None + else (ctypes.pointer(actual_number_of_points_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return waveform_array_array @ivi_synchronized - def fetch_waveform_into(self, waveform_array, maximum_time=hightime.timedelta(milliseconds=-1)): - r'''fetch_waveform + def fetch_waveform_into( + self, waveform_array, maximum_time=hightime.timedelta(milliseconds=-1) + ): + r"""fetch_waveform For the NI 4080/4081/4082 and the NI 4070/4071/4072, returns an array of values from a previously initiated waveform acquisition. You must call @@ -2000,29 +2309,50 @@ def fetch_waveform_into(self, waveform_array, maximum_time=hightime.timedelta(mi actual_number_of_points (int): Indicates the number of measured values actually retrieved from the DMM. - ''' + """ import numpy if type(waveform_array) is not numpy.ndarray: - raise TypeError('waveform_array must be {0}, is {1}'.format(numpy.ndarray, type(waveform_array))) + raise TypeError( + "waveform_array must be {0}, is {1}".format( + numpy.ndarray, type(waveform_array) + ) + ) if numpy.isfortran(waveform_array) is True: - raise TypeError('waveform_array must be in C-order') - if waveform_array.dtype is not numpy.dtype('float64'): - raise TypeError('waveform_array must be numpy.ndarray of dtype=float64, is ' + str(waveform_array.dtype)) + raise TypeError("waveform_array must be in C-order") + if waveform_array.dtype is not numpy.dtype("float64"): + raise TypeError( + "waveform_array must be numpy.ndarray of dtype=float64, is " + + str(waveform_array.dtype) + ) array_size = len(waveform_array) vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32(maximum_time) # case S140 + maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32( + maximum_time + ) # case S140 array_size_ctype = _visatype.ViInt32(array_size) # case S210 - waveform_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_array) # case B510 + waveform_array_ctype = get_ctypes_pointer_for_buffer( + value=waveform_array + ) # case B510 actual_number_of_points_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDMM_FetchWaveform(vi_ctype, maximum_time_ctype, array_size_ctype, waveform_array_ctype, None if actual_number_of_points_ctype is None else (ctypes.pointer(actual_number_of_points_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_FetchWaveform( + vi_ctype, + maximum_time_ctype, + array_size_ctype, + waveform_array_ctype, + None + if actual_number_of_points_ctype is None + else (ctypes.pointer(actual_number_of_points_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _get_cal_date_and_time(self, cal_type): - r'''_get_cal_date_and_time + r"""_get_cal_date_and_time Returns the date and time of the last calibration performed. @@ -2055,7 +2385,7 @@ def _get_cal_date_and_time(self, cal_type): minute (int): Indicates the **minute** of the last calibration. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 cal_type_ctype = _visatype.ViInt32(cal_type) # case S150 month_ctype = _visatype.ViInt32() # case S220 @@ -2063,13 +2393,29 @@ def _get_cal_date_and_time(self, cal_type): year_ctype = _visatype.ViInt32() # case S220 hour_ctype = _visatype.ViInt32() # case S220 minute_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDMM_GetCalDateAndTime(vi_ctype, cal_type_ctype, None if month_ctype is None else (ctypes.pointer(month_ctype)), None if day_ctype is None else (ctypes.pointer(day_ctype)), None if year_ctype is None else (ctypes.pointer(year_ctype)), None if hour_ctype is None else (ctypes.pointer(hour_ctype)), None if minute_ctype is None else (ctypes.pointer(minute_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return int(month_ctype.value), int(day_ctype.value), int(year_ctype.value), int(hour_ctype.value), int(minute_ctype.value) + error_code = self._library.niDMM_GetCalDateAndTime( + vi_ctype, + cal_type_ctype, + None if month_ctype is None else (ctypes.pointer(month_ctype)), + None if day_ctype is None else (ctypes.pointer(day_ctype)), + None if year_ctype is None else (ctypes.pointer(year_ctype)), + None if hour_ctype is None else (ctypes.pointer(hour_ctype)), + None if minute_ctype is None else (ctypes.pointer(minute_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return ( + int(month_ctype.value), + int(day_ctype.value), + int(year_ctype.value), + int(hour_ctype.value), + int(minute_ctype.value), + ) @ivi_synchronized def get_dev_temp(self, options=""): - r'''get_dev_temp + r"""get_dev_temp Returns the current **Temperature** of the device. @@ -2082,17 +2428,25 @@ def get_dev_temp(self, options=""): Returns: temperature (float): Returns the current **temperature** of the device. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - options_ctype = ctypes.create_string_buffer(options.encode(self._encoding)) # case C020 + options_ctype = ctypes.create_string_buffer( + options.encode(self._encoding) + ) # case C020 temperature_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDMM_GetDevTemp(vi_ctype, options_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_GetDevTemp( + vi_ctype, + options_ctype, + None if temperature_ctype is None else (ctypes.pointer(temperature_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(temperature_ctype.value) @ivi_synchronized def get_ext_cal_recommended_interval(self): - r'''get_ext_cal_recommended_interval + r"""get_ext_cal_recommended_interval Returns the recommended interval between external recalibration in **Months**. @@ -2103,16 +2457,20 @@ def get_ext_cal_recommended_interval(self): months (hightime.timedelta): Returns the recommended number of **months** between external calibrations. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 months_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDMM_GetExtCalRecommendedInterval(vi_ctype, None if months_ctype is None else (ctypes.pointer(months_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_GetExtCalRecommendedInterval( + vi_ctype, None if months_ctype is None else (ctypes.pointer(months_ctype)) + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return _converters.convert_month_to_timedelta(int(months_ctype.value)) @ivi_synchronized def get_cal_date_and_time(self, cal_type): - '''get_cal_date_and_time + """get_cal_date_and_time Returns the date and time of the last calibration performed. @@ -2136,13 +2494,13 @@ def get_cal_date_and_time(self, cal_type): Returns: month (hightime.datetime): Indicates date and time of the last calibration. - ''' + """ month, day, year, hour, minute = self._get_cal_date_and_time(cal_type) return hightime.datetime(year, month, day, hour, minute) @ivi_synchronized def get_last_cal_temp(self, cal_type): - r'''get_last_cal_temp + r"""get_last_cal_temp Returns the **Temperature** during the last calibration procedure. @@ -2167,17 +2525,23 @@ def get_last_cal_temp(self, cal_type): Returns: temperature (float): Returns the **temperature** during the last calibration. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 cal_type_ctype = _visatype.ViInt32(cal_type) # case S150 temperature_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDMM_GetLastCalTemp(vi_ctype, cal_type_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_GetLastCalTemp( + vi_ctype, + cal_type_ctype, + None if temperature_ctype is None else (ctypes.pointer(temperature_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(temperature_ctype.value) @ivi_synchronized def get_self_cal_supported(self): - r'''get_self_cal_supported + r"""get_self_cal_supported Returns a Boolean value that expresses whether or not the DMM that you are using can perform self-calibration. @@ -2192,16 +2556,23 @@ def get_self_cal_supported(self): | False | 0 | The DMM that you are using cannot perform self-calibration. | +-------+---+-------------------------------------------------------------+ - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 self_cal_supported_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niDMM_GetSelfCalSupported(vi_ctype, None if self_cal_supported_ctype is None else (ctypes.pointer(self_cal_supported_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_GetSelfCalSupported( + vi_ctype, + None + if self_cal_supported_ctype is None + else (ctypes.pointer(self_cal_supported_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return bool(self_cal_supported_ctype.value) @ivi_synchronized def import_attribute_configuration_buffer(self, configuration): - r'''import_attribute_configuration_buffer + r"""import_attribute_configuration_buffer Imports a property configuration to the session from the specified configuration buffer. @@ -2239,18 +2610,28 @@ def import_attribute_configuration_buffer(self, configuration): configuration (bytes): Specifies the byte array buffer that contains the property configuration to import. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - size_ctype = _visatype.ViInt32(0 if configuration is None else len(configuration)) # case S160 - configuration_converted = _converters.convert_to_bytes(configuration) # case B520 - configuration_ctype = get_ctypes_pointer_for_buffer(value=configuration_converted, library_type=_visatype.ViInt8) # case B520 - error_code = self._library.niDMM_ImportAttributeConfigurationBuffer(vi_ctype, size_ctype, configuration_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + size_ctype = _visatype.ViInt32( + 0 if configuration is None else len(configuration) + ) # case S160 + configuration_converted = _converters.convert_to_bytes( + configuration + ) # case B520 + configuration_ctype = get_ctypes_pointer_for_buffer( + value=configuration_converted, library_type=_visatype.ViInt8 + ) # case B520 + error_code = self._library.niDMM_ImportAttributeConfigurationBuffer( + vi_ctype, size_ctype, configuration_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def import_attribute_configuration_file(self, file_path): - r'''import_attribute_configuration_file + r"""import_attribute_configuration_file Imports a property configuration to the session from the specified file. @@ -2290,15 +2671,23 @@ def import_attribute_configuration_file(self, file_path): method returns an error. **Default File Extension:**\ .nidmmconfig - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 - error_code = self._library.niDMM_ImportAttributeConfigurationFile(vi_ctype, file_path_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + file_path_ctype = ctypes.create_string_buffer( + file_path.encode(self._encoding) + ) # case C020 + error_code = self._library.niDMM_ImportAttributeConfigurationFile( + vi_ctype, file_path_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return - def _init_with_options(self, resource_name, id_query=False, reset_device=False, option_string=""): - r'''_init_with_options + def _init_with_options( + self, resource_name, id_query=False, reset_device=False, option_string="" + ): + r"""_init_with_options This method completes the following tasks: @@ -2403,34 +2792,50 @@ def _init_with_options(self, resource_name, id_query=False, reset_device=False, vi (int): Returns a ViSession handle that you use to identify the instrument in all subsequent instrument driver method calls. - ''' - resource_name_ctype = ctypes.create_string_buffer(resource_name.encode(self._encoding)) # case C020 + """ + resource_name_ctype = ctypes.create_string_buffer( + resource_name.encode(self._encoding) + ) # case C020 id_query_ctype = _visatype.ViBoolean(id_query) # case S150 reset_device_ctype = _visatype.ViBoolean(reset_device) # case S150 - option_string_ctype = ctypes.create_string_buffer(_converters.convert_init_with_options_dictionary(option_string).encode(self._encoding)) # case C040 + option_string_ctype = ctypes.create_string_buffer( + _converters.convert_init_with_options_dictionary(option_string).encode( + self._encoding + ) + ) # case C040 vi_ctype = _visatype.ViSession() # case S220 - error_code = self._library.niDMM_InitWithOptions(resource_name_ctype, id_query_ctype, reset_device_ctype, option_string_ctype, None if vi_ctype is None else (ctypes.pointer(vi_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_InitWithOptions( + resource_name_ctype, + id_query_ctype, + reset_device_ctype, + option_string_ctype, + None if vi_ctype is None else (ctypes.pointer(vi_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(vi_ctype.value) @ivi_synchronized def _initiate(self): - r'''_initiate + r"""_initiate Initiates an acquisition. After you call this method, the DMM leaves the Idle state and enters the Wait-for-Trigger state. If trigger is set to Immediate mode, the DMM begins acquiring measurement data. Use fetch, fetch_multi_point, or fetch_waveform to retrieve the measurement data. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDMM_Initiate(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def perform_open_cable_comp(self): - r'''perform_open_cable_comp + r"""perform_open_cable_comp For the NI 4082 and NI 4072 only, performs the open cable compensation measurements for the current capacitance/inductance range, and returns @@ -2452,17 +2857,23 @@ def perform_open_cable_comp(self): susceptance (float): **susceptance** is the measured value of open cable compensation **susceptance**. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 conductance_ctype = _visatype.ViReal64() # case S220 susceptance_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDMM_PerformOpenCableComp(vi_ctype, None if conductance_ctype is None else (ctypes.pointer(conductance_ctype)), None if susceptance_ctype is None else (ctypes.pointer(susceptance_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_PerformOpenCableComp( + vi_ctype, + None if conductance_ctype is None else (ctypes.pointer(conductance_ctype)), + None if susceptance_ctype is None else (ctypes.pointer(susceptance_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(conductance_ctype.value), float(susceptance_ctype.value) @ivi_synchronized def perform_short_cable_comp(self): - r'''perform_short_cable_comp + r"""perform_short_cable_comp Performs the short cable compensation measurements for the current capacitance/inductance range, and returns short cable compensation @@ -2483,17 +2894,23 @@ def perform_short_cable_comp(self): reactance (float): **reactance** is the measured value of short cable compensation **reactance**. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 resistance_ctype = _visatype.ViReal64() # case S220 reactance_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDMM_PerformShortCableComp(vi_ctype, None if resistance_ctype is None else (ctypes.pointer(resistance_ctype)), None if reactance_ctype is None else (ctypes.pointer(reactance_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_PerformShortCableComp( + vi_ctype, + None if resistance_ctype is None else (ctypes.pointer(resistance_ctype)), + None if reactance_ctype is None else (ctypes.pointer(reactance_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(resistance_ctype.value), float(reactance_ctype.value) @ivi_synchronized def read(self, maximum_time=hightime.timedelta(milliseconds=-1)): - r'''read + r"""read Acquires a single measurement and returns the measured value. @@ -2516,17 +2933,27 @@ def read(self, maximum_time=hightime.timedelta(milliseconds=-1)): Returns: reading (float): The measured value returned from the DMM. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32(maximum_time) # case S140 + maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32( + maximum_time + ) # case S140 reading_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDMM_Read(vi_ctype, maximum_time_ctype, None if reading_ctype is None else (ctypes.pointer(reading_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_Read( + vi_ctype, + maximum_time_ctype, + None if reading_ctype is None else (ctypes.pointer(reading_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(reading_ctype.value) @ivi_synchronized - def read_multi_point(self, array_size, maximum_time=hightime.timedelta(milliseconds=-1)): - r'''read_multi_point + def read_multi_point( + self, array_size, maximum_time=hightime.timedelta(milliseconds=-1) + ): + r"""read_multi_point Acquires multiple measurements and returns an array of measured values. The number of measurements the DMM makes is determined by the values you @@ -2566,21 +2993,35 @@ def read_multi_point(self, array_size, maximum_time=hightime.timedelta(milliseco actual_number_of_points (int): Indicates the number of measured values actually retrieved from the DMM. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32(maximum_time) # case S140 + maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32( + maximum_time + ) # case S140 array_size_ctype = _visatype.ViInt32(array_size) # case S210 reading_array_size = array_size # case B600 reading_array_array = array.array("d", [0] * reading_array_size) # case B600 - reading_array_ctype = get_ctypes_pointer_for_buffer(value=reading_array_array, library_type=_visatype.ViReal64) # case B600 + reading_array_ctype = get_ctypes_pointer_for_buffer( + value=reading_array_array, library_type=_visatype.ViReal64 + ) # case B600 actual_number_of_points_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDMM_ReadMultiPoint(vi_ctype, maximum_time_ctype, array_size_ctype, reading_array_ctype, None if actual_number_of_points_ctype is None else (ctypes.pointer(actual_number_of_points_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_ReadMultiPoint( + vi_ctype, + maximum_time_ctype, + array_size_ctype, + reading_array_ctype, + None + if actual_number_of_points_ctype is None + else (ctypes.pointer(actual_number_of_points_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return reading_array_array @ivi_synchronized def read_status(self): - r'''read_status + r"""read_status Returns measurement backlog and acquisition status. Use this method to determine how many measurements are available before calling @@ -2615,17 +3056,31 @@ def read_status(self): | 4 | No acquisition in progress | +---+----------------------------+ - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 acquisition_backlog_ctype = _visatype.ViInt32() # case S220 acquisition_status_ctype = _visatype.ViInt16() # case S220 - error_code = self._library.niDMM_ReadStatus(vi_ctype, None if acquisition_backlog_ctype is None else (ctypes.pointer(acquisition_backlog_ctype)), None if acquisition_status_ctype is None else (ctypes.pointer(acquisition_status_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return int(acquisition_backlog_ctype.value), enums.AcquisitionStatus(acquisition_status_ctype.value) + error_code = self._library.niDMM_ReadStatus( + vi_ctype, + None + if acquisition_backlog_ctype is None + else (ctypes.pointer(acquisition_backlog_ctype)), + None + if acquisition_status_ctype is None + else (ctypes.pointer(acquisition_status_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return int(acquisition_backlog_ctype.value), enums.AcquisitionStatus( + acquisition_status_ctype.value + ) @ivi_synchronized - def read_waveform(self, array_size, maximum_time=hightime.timedelta(milliseconds=-1)): - r'''read_waveform + def read_waveform( + self, array_size, maximum_time=hightime.timedelta(milliseconds=-1) + ): + r"""read_waveform For the NI 4080/4081/4082 and the NI 4070/4071/4072, acquires a waveform and returns data as an array of values or as a waveform data type. The @@ -2663,35 +3118,51 @@ def read_waveform(self, array_size, maximum_time=hightime.timedelta(milliseconds actual_number_of_points (int): Indicates the number of measured values actually retrieved from the DMM. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32(maximum_time) # case S140 + maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32( + maximum_time + ) # case S140 array_size_ctype = _visatype.ViInt32(array_size) # case S210 waveform_array_size = array_size # case B600 waveform_array_array = array.array("d", [0] * waveform_array_size) # case B600 - waveform_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_array_array, library_type=_visatype.ViReal64) # case B600 + waveform_array_ctype = get_ctypes_pointer_for_buffer( + value=waveform_array_array, library_type=_visatype.ViReal64 + ) # case B600 actual_number_of_points_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDMM_ReadWaveform(vi_ctype, maximum_time_ctype, array_size_ctype, waveform_array_ctype, None if actual_number_of_points_ctype is None else (ctypes.pointer(actual_number_of_points_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niDMM_ReadWaveform( + vi_ctype, + maximum_time_ctype, + array_size_ctype, + waveform_array_ctype, + None + if actual_number_of_points_ctype is None + else (ctypes.pointer(actual_number_of_points_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return waveform_array_array @ivi_synchronized def reset_with_defaults(self): - r'''reset_with_defaults + r"""reset_with_defaults Resets the instrument to a known state and sends initialization commands to the DMM. The initialization commands set the DMM settings to the state necessary for the operation of NI-DMM. All user-defined default values associated with a logical name are applied after setting the DMM. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDMM_ResetWithDefaults(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def self_cal(self): - r'''self_cal + r"""self_cal For the NI 4080/4081/4082 and the NI 4070/4071/4072, executes the self-calibration routine to maintain measurement accuracy. @@ -2700,15 +3171,17 @@ def self_cal(self): This method calls reset, and any configurations previous to the call will be lost. All properties will be set to their default values after the call returns. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDMM_SelfCal(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def send_software_trigger(self): - r'''send_software_trigger + r"""send_software_trigger Sends a command to trigger the DMM. Call this method if you have configured either the trigger_source or @@ -2720,25 +3193,29 @@ def send_software_trigger(self): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDMM_SendSoftwareTrigger(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def _close(self): - r'''_close + r"""_close Closes the specified session and deallocates resources that it reserved. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDMM_close(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def self_test(self): - '''self_test + """self_test Performs a self-test on the DMM to ensure that the DMM is functioning properly. Self-test does not calibrate the DMM. Zero @@ -2755,7 +3232,7 @@ def self_test(self): Note: Self-test does not check the fuse on the NI 4065, NI 4071, and NI 4081. Hence, even if the fuse is blown on the device, self-test does not return error code 1013. Note: This method calls reset, and any configurations previous to the call will be lost. All properties will be set to their default values after the call returns. - ''' + """ code, msg = self._self_test() if code: raise errors.SelfTestError(code, msg) @@ -2763,20 +3240,22 @@ def self_test(self): @ivi_synchronized def reset(self): - r'''reset + r"""reset Resets the instrument to a known state and sends initialization commands to the instrument. The initialization commands set instrument settings to the state necessary for the operation of the instrument driver. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDMM_reset(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _self_test(self): - r'''_self_test + r"""_self_test Performs a self-test on the DMM to ensure that the DMM is functioning properly. Self-test does not calibrate the DMM. @@ -2814,13 +3293,20 @@ def _self_test(self): returned for a self-test failure is NIDMM_ERROR_SELF_TEST_FAILURE. This error code indicates that the DMM should be repaired. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 self_test_result_ctype = _visatype.ViInt16() # case S220 self_test_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niDMM_self_test(vi_ctype, None if self_test_result_ctype is None else (ctypes.pointer(self_test_result_ctype)), self_test_message_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return int(self_test_result_ctype.value), self_test_message_ctype.value.decode(self._encoding) - - - + error_code = self._library.niDMM_self_test( + vi_ctype, + None + if self_test_result_ctype is None + else (ctypes.pointer(self_test_result_ctype)), + self_test_message_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return int(self_test_result_ctype.value), self_test_message_ctype.value.decode( + self._encoding + ) diff --git a/generated/nidmm/nidmm/unit_tests/_matchers.py b/generated/nidmm/nidmm/unit_tests/_matchers.py index 82b1c614a..e6efe7c2f 100644 --- a/generated/nidmm/nidmm/unit_tests/_matchers.py +++ b/generated/nidmm/nidmm/unit_tests/_matchers.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # This file was generated -'''Matcher classes used by unit tests in order to set mock expectations. +"""Matcher classes used by unit tests in order to set mock expectations. These work well with our visatype definitions. -''' +""" import ctypes import nidmm._visatype as _visatype @@ -21,15 +21,27 @@ def __init__(self, expected_type, expected_value): def __eq__(self, other): if not isinstance(other, self.expected_type): - print("{0}: Unexpected type. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_type, type(other))) + print( + "{0}: Unexpected type. Expected: {1}. Received: {2}".format( + self.__class__.__name__, self.expected_type, type(other) + ) + ) return False if other.value != self.expected_value: - print("{0}: Unexpected value. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_value, other.value)) + print( + "{0}: Unexpected value. Expected: {1}. Received: {2}".format( + self.__class__.__name__, self.expected_value, other.value + ) + ) return False return True def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_type), + pp.pformat(self.expected_value), + ) class _PointerMatcher(object): @@ -38,12 +50,18 @@ def __init__(self, expected_type): def __eq__(self, other): if not isinstance(other, ctypes.POINTER(self.expected_type)): - print("Unexpected type. Expected: {0}. Received: {1}".format(ctypes.POINTER(self.expected_type), type(other))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + ctypes.POINTER(self.expected_type), type(other) + ) + ) return False return True def __repr__(self): - return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_type)) + return "{0}({1})".format( + self.__class__.__name__, pp.pformat(self.expected_type) + ) class _BufferMatcher(object): @@ -70,29 +88,47 @@ def __eq__(self, other): pass # Because of object lifetimes, we may need to mock the other instance and provide lists instead of the actual array - if not isinstance(other, self.expected_type) and not isinstance(other, list): - print("Unexpected type. Expected: {0} or {1}. Received: {2}".format(self.expected_type, list, type(other))) + if not isinstance(other, self.expected_type) and not isinstance( + other, list + ): + print( + "Unexpected type. Expected: {0} or {1}. Received: {2}".format( + self.expected_type, list, type(other) + ) + ) return False if self.expected_size != len(other): - print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(other))) + print( + "Unexpected length. Expected: {0}. Received: {1}".format( + self.expected_size, len(other) + ) + ) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for i in range(0, len(self.expected_value)): if self.expected_value[i] != other[i]: - print("Unexpected value at index {0}. Expected: {1}. Received: {2}".format(i, self.expected_value[i], other[i])) + print( + "Unexpected value at index {0}. Expected: {1}. Received: {2}".format( + i, self.expected_value[i], other[i] + ) + ) return False return True def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self._expected_element_type), pp.pformat(self._expected_size_or_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self._expected_element_type), + pp.pformat(self._expected_size_or_value), + ) def __str__(self): - ret_str = self.__repr__() + '\n' - ret_str += ' expected_type = ' + str(self.expected_type) + '\n' - ret_str += ' expected_value = ' + str(self.expected_value) + '\n' - ret_str += ' expected_size = ' + str(self.expected_size) + '\n' + ret_str = self.__repr__() + "\n" + ret_str += " expected_type = " + str(self.expected_type) + "\n" + ret_str += " expected_value = " + str(self.expected_value) + "\n" + ret_str += " expected_size = " + str(self.expected_size) + "\n" return ret_str @@ -112,21 +148,37 @@ def __eq__(self, other): pass if not isinstance(other, ctypes.Array): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(other))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_type, type(other) + ) + ) return False - if len(other) < len(self.expected_string_value) + 1: # +1 for NULL terminating character - print("Unexpected length in C string. Expected at least: {0}. Received {1}".format(len(other), len(self.expected_string_value) + 1)) + if ( + len(other) < len(self.expected_string_value) + 1 + ): # +1 for NULL terminating character + print( + "Unexpected length in C string. Expected at least: {0}. Received {1}".format( + len(other), len(self.expected_string_value) + 1 + ) + ) return False if not isinstance(other[0], bytes): print("Unexpected type. Not a string. Received: {0}".format(type(other[0]))) return False if other.value.decode("ascii") != self.expected_string_value: - print("Unexpected value. Expected {0}. Received: {1}".format(self.expected_string_value, other.value.decode)) + print( + "Unexpected value. Expected {0}. Received: {1}".format( + self.expected_string_value, other.value.decode + ) + ) return False return True def __repr__(self): - return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_string_value)) + return "{0}({1})".format( + self.__class__.__name__, pp.pformat(self.expected_string_value) + ) # Custom Type @@ -139,7 +191,11 @@ def _compare_ctype_structs(expected, actual): expected_val = getattr(expected, field_name) actual_val = getattr(actual, field_name) if expected_val != actual_val: - print("Unexpected value field {0}. Expected: {1}. Received: {2}".format(field_name, expected_val, actual_val)) + print( + "Unexpected value field {0}. Expected: {1}. Received: {2}".format( + field_name, expected_val, actual_val + ) + ) return False return True @@ -151,12 +207,20 @@ def __init__(self, expected_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_type, type(actual) + ) + ) return False return _compare_ctype_structs(self.expected_value, actual) def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_type), + pp.pformat(self.expected_value), + ) class CustomTypeBufferMatcher(object): @@ -168,30 +232,48 @@ def __init__(self, expected_element_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print("Unexpected array type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) + print( + "Unexpected array type. Expected: {0}. Received: {1}".format( + self.expected_type, type(actual) + ) + ) return False if self.expected_size != len(actual): - print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(actual))) + print( + "Unexpected length. Expected: {0}. Received: {1}".format( + self.expected_size, len(actual) + ) + ) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for a, e in zip(actual, self.expected_value): if not isinstance(a, self.expected_element_type): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_element_type, type(a))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_element_type, type(a) + ) + ) return False if not _compare_ctype_structs(e, a): return False return True def __repr__(self): - expected_val_repr = '[' + ', '.join([x.__repr__() for x in self.expected_value]) + ']' - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_element_type), expected_val_repr) + expected_val_repr = ( + "[" + ", ".join([x.__repr__() for x in self.expected_value]) + "]" + ) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_element_type), + expected_val_repr, + ) def __str__(self): - ret_str = self.__repr__() + '\n' - ret_str += ' expected_type = ' + str(self.expected_type) + '\n' - ret_str += ' expected_size = ' + str(self.expected_size) + '\n' + ret_str = self.__repr__() + "\n" + ret_str += " expected_type = " + str(self.expected_type) + "\n" + ret_str += " expected_size = " + str(self.expected_size) + "\n" return ret_str @@ -200,7 +282,9 @@ def __str__(self): class ViBooleanMatcher(_ScalarMatcher): def __init__(self, expected_value): - _ScalarMatcher.__init__(self, _visatype.ViBoolean, 1 if expected_value is True else 0) + _ScalarMatcher.__init__( + self, _visatype.ViBoolean, 1 if expected_value is True else 0 + ) class ViSessionMatcher(_ScalarMatcher): @@ -312,6 +396,3 @@ def __init__(self, expected_size_or_value): class ViSessionBufferMatcher(_BufferMatcher): def __init__(self, expected_size_or_value): _BufferMatcher.__init__(self, _visatype.ViSession, expected_size_or_value) - - - diff --git a/generated/nidmm/nidmm/unit_tests/_mock_helper.py b/generated/nidmm/nidmm/unit_tests/_mock_helper.py index e3ac3ba12..958036fa1 100644 --- a/generated/nidmm/nidmm/unit_tests/_mock_helper.py +++ b/generated/nidmm/nidmm/unit_tests/_mock_helper.py @@ -16,142 +16,142 @@ def __init__(self, function, param=None): class SideEffectsHelper(object): def __init__(self): self._defaults = {} - self._defaults['Abort'] = {} - self._defaults['Abort']['return'] = 0 - self._defaults['ConfigureMeasurementAbsolute'] = {} - self._defaults['ConfigureMeasurementAbsolute']['return'] = 0 - self._defaults['ConfigureMeasurementDigits'] = {} - self._defaults['ConfigureMeasurementDigits']['return'] = 0 - self._defaults['ConfigureMultiPoint'] = {} - self._defaults['ConfigureMultiPoint']['return'] = 0 - self._defaults['ConfigureRTDCustom'] = {} - self._defaults['ConfigureRTDCustom']['return'] = 0 - self._defaults['ConfigureRTDType'] = {} - self._defaults['ConfigureRTDType']['return'] = 0 - self._defaults['ConfigureThermistorCustom'] = {} - self._defaults['ConfigureThermistorCustom']['return'] = 0 - self._defaults['ConfigureThermocouple'] = {} - self._defaults['ConfigureThermocouple']['return'] = 0 - self._defaults['ConfigureTrigger'] = {} - self._defaults['ConfigureTrigger']['return'] = 0 - self._defaults['ConfigureWaveformAcquisition'] = {} - self._defaults['ConfigureWaveformAcquisition']['return'] = 0 - self._defaults['Disable'] = {} - self._defaults['Disable']['return'] = 0 - self._defaults['ExportAttributeConfigurationBuffer'] = {} - self._defaults['ExportAttributeConfigurationBuffer']['return'] = 0 - self._defaults['ExportAttributeConfigurationBuffer']['configuration'] = None - self._defaults['ExportAttributeConfigurationFile'] = {} - self._defaults['ExportAttributeConfigurationFile']['return'] = 0 - self._defaults['Fetch'] = {} - self._defaults['Fetch']['return'] = 0 - self._defaults['Fetch']['reading'] = None - self._defaults['FetchMultiPoint'] = {} - self._defaults['FetchMultiPoint']['return'] = 0 - self._defaults['FetchMultiPoint']['readingArray'] = None - self._defaults['FetchMultiPoint']['actualNumberOfPoints'] = None - self._defaults['FetchWaveform'] = {} - self._defaults['FetchWaveform']['return'] = 0 - self._defaults['FetchWaveform']['waveformArray'] = None - self._defaults['FetchWaveform']['actualNumberOfPoints'] = None - self._defaults['GetAttributeViBoolean'] = {} - self._defaults['GetAttributeViBoolean']['return'] = 0 - self._defaults['GetAttributeViBoolean']['attributeValue'] = None - self._defaults['GetAttributeViInt32'] = {} - self._defaults['GetAttributeViInt32']['return'] = 0 - self._defaults['GetAttributeViInt32']['attributeValue'] = None - self._defaults['GetAttributeViReal64'] = {} - self._defaults['GetAttributeViReal64']['return'] = 0 - self._defaults['GetAttributeViReal64']['attributeValue'] = None - self._defaults['GetAttributeViString'] = {} - self._defaults['GetAttributeViString']['return'] = 0 - self._defaults['GetAttributeViString']['attributeValue'] = None - self._defaults['GetCalDateAndTime'] = {} - self._defaults['GetCalDateAndTime']['return'] = 0 - self._defaults['GetCalDateAndTime']['month'] = None - self._defaults['GetCalDateAndTime']['day'] = None - self._defaults['GetCalDateAndTime']['year'] = None - self._defaults['GetCalDateAndTime']['hour'] = None - self._defaults['GetCalDateAndTime']['minute'] = None - self._defaults['GetDevTemp'] = {} - self._defaults['GetDevTemp']['return'] = 0 - self._defaults['GetDevTemp']['temperature'] = None - self._defaults['GetError'] = {} - self._defaults['GetError']['return'] = 0 - self._defaults['GetError']['errorCode'] = None - self._defaults['GetError']['description'] = None - self._defaults['GetExtCalRecommendedInterval'] = {} - self._defaults['GetExtCalRecommendedInterval']['return'] = 0 - self._defaults['GetExtCalRecommendedInterval']['months'] = None - self._defaults['GetLastCalTemp'] = {} - self._defaults['GetLastCalTemp']['return'] = 0 - self._defaults['GetLastCalTemp']['temperature'] = None - self._defaults['GetSelfCalSupported'] = {} - self._defaults['GetSelfCalSupported']['return'] = 0 - self._defaults['GetSelfCalSupported']['selfCalSupported'] = None - self._defaults['ImportAttributeConfigurationBuffer'] = {} - self._defaults['ImportAttributeConfigurationBuffer']['return'] = 0 - self._defaults['ImportAttributeConfigurationFile'] = {} - self._defaults['ImportAttributeConfigurationFile']['return'] = 0 - self._defaults['InitWithOptions'] = {} - self._defaults['InitWithOptions']['return'] = 0 - self._defaults['InitWithOptions']['vi'] = None - self._defaults['Initiate'] = {} - self._defaults['Initiate']['return'] = 0 - self._defaults['LockSession'] = {} - self._defaults['LockSession']['return'] = 0 - self._defaults['LockSession']['callerHasLock'] = None - self._defaults['PerformOpenCableComp'] = {} - self._defaults['PerformOpenCableComp']['return'] = 0 - self._defaults['PerformOpenCableComp']['conductance'] = None - self._defaults['PerformOpenCableComp']['susceptance'] = None - self._defaults['PerformShortCableComp'] = {} - self._defaults['PerformShortCableComp']['return'] = 0 - self._defaults['PerformShortCableComp']['resistance'] = None - self._defaults['PerformShortCableComp']['reactance'] = None - self._defaults['Read'] = {} - self._defaults['Read']['return'] = 0 - self._defaults['Read']['reading'] = None - self._defaults['ReadMultiPoint'] = {} - self._defaults['ReadMultiPoint']['return'] = 0 - self._defaults['ReadMultiPoint']['readingArray'] = None - self._defaults['ReadMultiPoint']['actualNumberOfPoints'] = None - self._defaults['ReadStatus'] = {} - self._defaults['ReadStatus']['return'] = 0 - self._defaults['ReadStatus']['acquisitionBacklog'] = None - self._defaults['ReadStatus']['acquisitionStatus'] = None - self._defaults['ReadWaveform'] = {} - self._defaults['ReadWaveform']['return'] = 0 - self._defaults['ReadWaveform']['waveformArray'] = None - self._defaults['ReadWaveform']['actualNumberOfPoints'] = None - self._defaults['ResetWithDefaults'] = {} - self._defaults['ResetWithDefaults']['return'] = 0 - self._defaults['SelfCal'] = {} - self._defaults['SelfCal']['return'] = 0 - self._defaults['SendSoftwareTrigger'] = {} - self._defaults['SendSoftwareTrigger']['return'] = 0 - self._defaults['SetAttributeViBoolean'] = {} - self._defaults['SetAttributeViBoolean']['return'] = 0 - self._defaults['SetAttributeViInt32'] = {} - self._defaults['SetAttributeViInt32']['return'] = 0 - self._defaults['SetAttributeViReal64'] = {} - self._defaults['SetAttributeViReal64']['return'] = 0 - self._defaults['SetAttributeViString'] = {} - self._defaults['SetAttributeViString']['return'] = 0 - self._defaults['UnlockSession'] = {} - self._defaults['UnlockSession']['return'] = 0 - self._defaults['UnlockSession']['callerHasLock'] = None - self._defaults['close'] = {} - self._defaults['close']['return'] = 0 - self._defaults['error_message'] = {} - self._defaults['error_message']['return'] = 0 - self._defaults['error_message']['errorMessage'] = None - self._defaults['reset'] = {} - self._defaults['reset']['return'] = 0 - self._defaults['self_test'] = {} - self._defaults['self_test']['return'] = 0 - self._defaults['self_test']['selfTestResult'] = None - self._defaults['self_test']['selfTestMessage'] = None + self._defaults["Abort"] = {} + self._defaults["Abort"]["return"] = 0 + self._defaults["ConfigureMeasurementAbsolute"] = {} + self._defaults["ConfigureMeasurementAbsolute"]["return"] = 0 + self._defaults["ConfigureMeasurementDigits"] = {} + self._defaults["ConfigureMeasurementDigits"]["return"] = 0 + self._defaults["ConfigureMultiPoint"] = {} + self._defaults["ConfigureMultiPoint"]["return"] = 0 + self._defaults["ConfigureRTDCustom"] = {} + self._defaults["ConfigureRTDCustom"]["return"] = 0 + self._defaults["ConfigureRTDType"] = {} + self._defaults["ConfigureRTDType"]["return"] = 0 + self._defaults["ConfigureThermistorCustom"] = {} + self._defaults["ConfigureThermistorCustom"]["return"] = 0 + self._defaults["ConfigureThermocouple"] = {} + self._defaults["ConfigureThermocouple"]["return"] = 0 + self._defaults["ConfigureTrigger"] = {} + self._defaults["ConfigureTrigger"]["return"] = 0 + self._defaults["ConfigureWaveformAcquisition"] = {} + self._defaults["ConfigureWaveformAcquisition"]["return"] = 0 + self._defaults["Disable"] = {} + self._defaults["Disable"]["return"] = 0 + self._defaults["ExportAttributeConfigurationBuffer"] = {} + self._defaults["ExportAttributeConfigurationBuffer"]["return"] = 0 + self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] = None + self._defaults["ExportAttributeConfigurationFile"] = {} + self._defaults["ExportAttributeConfigurationFile"]["return"] = 0 + self._defaults["Fetch"] = {} + self._defaults["Fetch"]["return"] = 0 + self._defaults["Fetch"]["reading"] = None + self._defaults["FetchMultiPoint"] = {} + self._defaults["FetchMultiPoint"]["return"] = 0 + self._defaults["FetchMultiPoint"]["readingArray"] = None + self._defaults["FetchMultiPoint"]["actualNumberOfPoints"] = None + self._defaults["FetchWaveform"] = {} + self._defaults["FetchWaveform"]["return"] = 0 + self._defaults["FetchWaveform"]["waveformArray"] = None + self._defaults["FetchWaveform"]["actualNumberOfPoints"] = None + self._defaults["GetAttributeViBoolean"] = {} + self._defaults["GetAttributeViBoolean"]["return"] = 0 + self._defaults["GetAttributeViBoolean"]["attributeValue"] = None + self._defaults["GetAttributeViInt32"] = {} + self._defaults["GetAttributeViInt32"]["return"] = 0 + self._defaults["GetAttributeViInt32"]["attributeValue"] = None + self._defaults["GetAttributeViReal64"] = {} + self._defaults["GetAttributeViReal64"]["return"] = 0 + self._defaults["GetAttributeViReal64"]["attributeValue"] = None + self._defaults["GetAttributeViString"] = {} + self._defaults["GetAttributeViString"]["return"] = 0 + self._defaults["GetAttributeViString"]["attributeValue"] = None + self._defaults["GetCalDateAndTime"] = {} + self._defaults["GetCalDateAndTime"]["return"] = 0 + self._defaults["GetCalDateAndTime"]["month"] = None + self._defaults["GetCalDateAndTime"]["day"] = None + self._defaults["GetCalDateAndTime"]["year"] = None + self._defaults["GetCalDateAndTime"]["hour"] = None + self._defaults["GetCalDateAndTime"]["minute"] = None + self._defaults["GetDevTemp"] = {} + self._defaults["GetDevTemp"]["return"] = 0 + self._defaults["GetDevTemp"]["temperature"] = None + self._defaults["GetError"] = {} + self._defaults["GetError"]["return"] = 0 + self._defaults["GetError"]["errorCode"] = None + self._defaults["GetError"]["description"] = None + self._defaults["GetExtCalRecommendedInterval"] = {} + self._defaults["GetExtCalRecommendedInterval"]["return"] = 0 + self._defaults["GetExtCalRecommendedInterval"]["months"] = None + self._defaults["GetLastCalTemp"] = {} + self._defaults["GetLastCalTemp"]["return"] = 0 + self._defaults["GetLastCalTemp"]["temperature"] = None + self._defaults["GetSelfCalSupported"] = {} + self._defaults["GetSelfCalSupported"]["return"] = 0 + self._defaults["GetSelfCalSupported"]["selfCalSupported"] = None + self._defaults["ImportAttributeConfigurationBuffer"] = {} + self._defaults["ImportAttributeConfigurationBuffer"]["return"] = 0 + self._defaults["ImportAttributeConfigurationFile"] = {} + self._defaults["ImportAttributeConfigurationFile"]["return"] = 0 + self._defaults["InitWithOptions"] = {} + self._defaults["InitWithOptions"]["return"] = 0 + self._defaults["InitWithOptions"]["vi"] = None + self._defaults["Initiate"] = {} + self._defaults["Initiate"]["return"] = 0 + self._defaults["LockSession"] = {} + self._defaults["LockSession"]["return"] = 0 + self._defaults["LockSession"]["callerHasLock"] = None + self._defaults["PerformOpenCableComp"] = {} + self._defaults["PerformOpenCableComp"]["return"] = 0 + self._defaults["PerformOpenCableComp"]["conductance"] = None + self._defaults["PerformOpenCableComp"]["susceptance"] = None + self._defaults["PerformShortCableComp"] = {} + self._defaults["PerformShortCableComp"]["return"] = 0 + self._defaults["PerformShortCableComp"]["resistance"] = None + self._defaults["PerformShortCableComp"]["reactance"] = None + self._defaults["Read"] = {} + self._defaults["Read"]["return"] = 0 + self._defaults["Read"]["reading"] = None + self._defaults["ReadMultiPoint"] = {} + self._defaults["ReadMultiPoint"]["return"] = 0 + self._defaults["ReadMultiPoint"]["readingArray"] = None + self._defaults["ReadMultiPoint"]["actualNumberOfPoints"] = None + self._defaults["ReadStatus"] = {} + self._defaults["ReadStatus"]["return"] = 0 + self._defaults["ReadStatus"]["acquisitionBacklog"] = None + self._defaults["ReadStatus"]["acquisitionStatus"] = None + self._defaults["ReadWaveform"] = {} + self._defaults["ReadWaveform"]["return"] = 0 + self._defaults["ReadWaveform"]["waveformArray"] = None + self._defaults["ReadWaveform"]["actualNumberOfPoints"] = None + self._defaults["ResetWithDefaults"] = {} + self._defaults["ResetWithDefaults"]["return"] = 0 + self._defaults["SelfCal"] = {} + self._defaults["SelfCal"]["return"] = 0 + self._defaults["SendSoftwareTrigger"] = {} + self._defaults["SendSoftwareTrigger"]["return"] = 0 + self._defaults["SetAttributeViBoolean"] = {} + self._defaults["SetAttributeViBoolean"]["return"] = 0 + self._defaults["SetAttributeViInt32"] = {} + self._defaults["SetAttributeViInt32"]["return"] = 0 + self._defaults["SetAttributeViReal64"] = {} + self._defaults["SetAttributeViReal64"]["return"] = 0 + self._defaults["SetAttributeViString"] = {} + self._defaults["SetAttributeViString"]["return"] = 0 + self._defaults["UnlockSession"] = {} + self._defaults["UnlockSession"]["return"] = 0 + self._defaults["UnlockSession"]["callerHasLock"] = None + self._defaults["close"] = {} + self._defaults["close"]["return"] = 0 + self._defaults["error_message"] = {} + self._defaults["error_message"]["return"] = 0 + self._defaults["error_message"]["errorMessage"] = None + self._defaults["reset"] = {} + self._defaults["reset"]["return"] = 0 + self._defaults["self_test"] = {} + self._defaults["self_test"]["return"] = 0 + self._defaults["self_test"]["selfTestResult"] = None + self._defaults["self_test"]["selfTestMessage"] = None def __getitem__(self, func): return self._defaults[func] @@ -160,97 +160,124 @@ def __setitem__(self, func, val): self._defaults[func] = val def niDMM_Abort(self, vi): # noqa: N802 - if self._defaults['Abort']['return'] != 0: - return self._defaults['Abort']['return'] - return self._defaults['Abort']['return'] - - def niDMM_ConfigureMeasurementAbsolute(self, vi, measurement_function, range, resolution_absolute): # noqa: N802 - if self._defaults['ConfigureMeasurementAbsolute']['return'] != 0: - return self._defaults['ConfigureMeasurementAbsolute']['return'] - return self._defaults['ConfigureMeasurementAbsolute']['return'] - - def niDMM_ConfigureMeasurementDigits(self, vi, measurement_function, range, resolution_digits): # noqa: N802 - if self._defaults['ConfigureMeasurementDigits']['return'] != 0: - return self._defaults['ConfigureMeasurementDigits']['return'] - return self._defaults['ConfigureMeasurementDigits']['return'] - - def niDMM_ConfigureMultiPoint(self, vi, trigger_count, sample_count, sample_trigger, sample_interval): # noqa: N802 - if self._defaults['ConfigureMultiPoint']['return'] != 0: - return self._defaults['ConfigureMultiPoint']['return'] - return self._defaults['ConfigureMultiPoint']['return'] + if self._defaults["Abort"]["return"] != 0: + return self._defaults["Abort"]["return"] + return self._defaults["Abort"]["return"] + + def niDMM_ConfigureMeasurementAbsolute( + self, vi, measurement_function, range, resolution_absolute + ): # noqa: N802 + if self._defaults["ConfigureMeasurementAbsolute"]["return"] != 0: + return self._defaults["ConfigureMeasurementAbsolute"]["return"] + return self._defaults["ConfigureMeasurementAbsolute"]["return"] + + def niDMM_ConfigureMeasurementDigits( + self, vi, measurement_function, range, resolution_digits + ): # noqa: N802 + if self._defaults["ConfigureMeasurementDigits"]["return"] != 0: + return self._defaults["ConfigureMeasurementDigits"]["return"] + return self._defaults["ConfigureMeasurementDigits"]["return"] + + def niDMM_ConfigureMultiPoint( + self, vi, trigger_count, sample_count, sample_trigger, sample_interval + ): # noqa: N802 + if self._defaults["ConfigureMultiPoint"]["return"] != 0: + return self._defaults["ConfigureMultiPoint"]["return"] + return self._defaults["ConfigureMultiPoint"]["return"] def niDMM_ConfigureRTDCustom(self, vi, rtd_a, rtd_b, rtd_c): # noqa: N802 - if self._defaults['ConfigureRTDCustom']['return'] != 0: - return self._defaults['ConfigureRTDCustom']['return'] - return self._defaults['ConfigureRTDCustom']['return'] + if self._defaults["ConfigureRTDCustom"]["return"] != 0: + return self._defaults["ConfigureRTDCustom"]["return"] + return self._defaults["ConfigureRTDCustom"]["return"] def niDMM_ConfigureRTDType(self, vi, rtd_type, rtd_resistance): # noqa: N802 - if self._defaults['ConfigureRTDType']['return'] != 0: - return self._defaults['ConfigureRTDType']['return'] - return self._defaults['ConfigureRTDType']['return'] - - def niDMM_ConfigureThermistorCustom(self, vi, thermistor_a, thermistor_b, thermistor_c): # noqa: N802 - if self._defaults['ConfigureThermistorCustom']['return'] != 0: - return self._defaults['ConfigureThermistorCustom']['return'] - return self._defaults['ConfigureThermistorCustom']['return'] - - def niDMM_ConfigureThermocouple(self, vi, thermocouple_type, reference_junction_type): # noqa: N802 - if self._defaults['ConfigureThermocouple']['return'] != 0: - return self._defaults['ConfigureThermocouple']['return'] - return self._defaults['ConfigureThermocouple']['return'] + if self._defaults["ConfigureRTDType"]["return"] != 0: + return self._defaults["ConfigureRTDType"]["return"] + return self._defaults["ConfigureRTDType"]["return"] + + def niDMM_ConfigureThermistorCustom( + self, vi, thermistor_a, thermistor_b, thermistor_c + ): # noqa: N802 + if self._defaults["ConfigureThermistorCustom"]["return"] != 0: + return self._defaults["ConfigureThermistorCustom"]["return"] + return self._defaults["ConfigureThermistorCustom"]["return"] + + def niDMM_ConfigureThermocouple( + self, vi, thermocouple_type, reference_junction_type + ): # noqa: N802 + if self._defaults["ConfigureThermocouple"]["return"] != 0: + return self._defaults["ConfigureThermocouple"]["return"] + return self._defaults["ConfigureThermocouple"]["return"] def niDMM_ConfigureTrigger(self, vi, trigger_source, trigger_delay): # noqa: N802 - if self._defaults['ConfigureTrigger']['return'] != 0: - return self._defaults['ConfigureTrigger']['return'] - return self._defaults['ConfigureTrigger']['return'] + if self._defaults["ConfigureTrigger"]["return"] != 0: + return self._defaults["ConfigureTrigger"]["return"] + return self._defaults["ConfigureTrigger"]["return"] - def niDMM_ConfigureWaveformAcquisition(self, vi, measurement_function, range, rate, waveform_points): # noqa: N802 - if self._defaults['ConfigureWaveformAcquisition']['return'] != 0: - return self._defaults['ConfigureWaveformAcquisition']['return'] - return self._defaults['ConfigureWaveformAcquisition']['return'] + def niDMM_ConfigureWaveformAcquisition( + self, vi, measurement_function, range, rate, waveform_points + ): # noqa: N802 + if self._defaults["ConfigureWaveformAcquisition"]["return"] != 0: + return self._defaults["ConfigureWaveformAcquisition"]["return"] + return self._defaults["ConfigureWaveformAcquisition"]["return"] def niDMM_Disable(self, vi): # noqa: N802 - if self._defaults['Disable']['return'] != 0: - return self._defaults['Disable']['return'] - return self._defaults['Disable']['return'] - - def niDMM_ExportAttributeConfigurationBuffer(self, vi, size, configuration): # noqa: N802 - if self._defaults['ExportAttributeConfigurationBuffer']['return'] != 0: - return self._defaults['ExportAttributeConfigurationBuffer']['return'] - if self._defaults['ExportAttributeConfigurationBuffer']['configuration'] is None: - raise MockFunctionCallError("niDMM_ExportAttributeConfigurationBuffer", param='configuration') + if self._defaults["Disable"]["return"] != 0: + return self._defaults["Disable"]["return"] + return self._defaults["Disable"]["return"] + + def niDMM_ExportAttributeConfigurationBuffer( + self, vi, size, configuration + ): # noqa: N802 + if self._defaults["ExportAttributeConfigurationBuffer"]["return"] != 0: + return self._defaults["ExportAttributeConfigurationBuffer"]["return"] + if ( + self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] + is None + ): + raise MockFunctionCallError( + "niDMM_ExportAttributeConfigurationBuffer", param="configuration" + ) if size.value == 0: - return len(self._defaults['ExportAttributeConfigurationBuffer']['configuration']) + return len( + self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] + ) try: configuration_ref = configuration.contents except AttributeError: configuration_ref = configuration - for i in range(len(self._defaults['ExportAttributeConfigurationBuffer']['configuration'])): - configuration_ref[i] = self._defaults['ExportAttributeConfigurationBuffer']['configuration'][i] - return self._defaults['ExportAttributeConfigurationBuffer']['return'] + for i in range( + len(self._defaults["ExportAttributeConfigurationBuffer"]["configuration"]) + ): + configuration_ref[i] = self._defaults["ExportAttributeConfigurationBuffer"][ + "configuration" + ][i] + return self._defaults["ExportAttributeConfigurationBuffer"]["return"] def niDMM_ExportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 - if self._defaults['ExportAttributeConfigurationFile']['return'] != 0: - return self._defaults['ExportAttributeConfigurationFile']['return'] - return self._defaults['ExportAttributeConfigurationFile']['return'] + if self._defaults["ExportAttributeConfigurationFile"]["return"] != 0: + return self._defaults["ExportAttributeConfigurationFile"]["return"] + return self._defaults["ExportAttributeConfigurationFile"]["return"] def niDMM_Fetch(self, vi, maximum_time, reading): # noqa: N802 - if self._defaults['Fetch']['return'] != 0: - return self._defaults['Fetch']['return'] + if self._defaults["Fetch"]["return"] != 0: + return self._defaults["Fetch"]["return"] # reading - if self._defaults['Fetch']['reading'] is None: - raise MockFunctionCallError("niDMM_Fetch", param='reading') + if self._defaults["Fetch"]["reading"] is None: + raise MockFunctionCallError("niDMM_Fetch", param="reading") if reading is not None: - reading.contents.value = self._defaults['Fetch']['reading'] - return self._defaults['Fetch']['return'] - - def niDMM_FetchMultiPoint(self, vi, maximum_time, array_size, reading_array, actual_number_of_points): # noqa: N802 - if self._defaults['FetchMultiPoint']['return'] != 0: - return self._defaults['FetchMultiPoint']['return'] + reading.contents.value = self._defaults["Fetch"]["reading"] + return self._defaults["Fetch"]["return"] + + def niDMM_FetchMultiPoint( + self, vi, maximum_time, array_size, reading_array, actual_number_of_points + ): # noqa: N802 + if self._defaults["FetchMultiPoint"]["return"] != 0: + return self._defaults["FetchMultiPoint"]["return"] # reading_array - if self._defaults['FetchMultiPoint']['readingArray'] is None: - raise MockFunctionCallError("niDMM_FetchMultiPoint", param='readingArray') - test_value = self._defaults['FetchMultiPoint']['readingArray'] + if self._defaults["FetchMultiPoint"]["readingArray"] is None: + raise MockFunctionCallError("niDMM_FetchMultiPoint", param="readingArray") + test_value = self._defaults["FetchMultiPoint"]["readingArray"] try: reading_array_ref = reading_array.contents except AttributeError: @@ -259,19 +286,25 @@ def niDMM_FetchMultiPoint(self, vi, maximum_time, array_size, reading_array, act for i in range(len(test_value)): reading_array_ref[i] = test_value[i] # actual_number_of_points - if self._defaults['FetchMultiPoint']['actualNumberOfPoints'] is None: - raise MockFunctionCallError("niDMM_FetchMultiPoint", param='actualNumberOfPoints') + if self._defaults["FetchMultiPoint"]["actualNumberOfPoints"] is None: + raise MockFunctionCallError( + "niDMM_FetchMultiPoint", param="actualNumberOfPoints" + ) if actual_number_of_points is not None: - actual_number_of_points.contents.value = self._defaults['FetchMultiPoint']['actualNumberOfPoints'] - return self._defaults['FetchMultiPoint']['return'] - - def niDMM_FetchWaveform(self, vi, maximum_time, array_size, waveform_array, actual_number_of_points): # noqa: N802 - if self._defaults['FetchWaveform']['return'] != 0: - return self._defaults['FetchWaveform']['return'] + actual_number_of_points.contents.value = self._defaults["FetchMultiPoint"][ + "actualNumberOfPoints" + ] + return self._defaults["FetchMultiPoint"]["return"] + + def niDMM_FetchWaveform( + self, vi, maximum_time, array_size, waveform_array, actual_number_of_points + ): # noqa: N802 + if self._defaults["FetchWaveform"]["return"] != 0: + return self._defaults["FetchWaveform"]["return"] # waveform_array - if self._defaults['FetchWaveform']['waveformArray'] is None: - raise MockFunctionCallError("niDMM_FetchWaveform", param='waveformArray') - test_value = self._defaults['FetchWaveform']['waveformArray'] + if self._defaults["FetchWaveform"]["waveformArray"] is None: + raise MockFunctionCallError("niDMM_FetchWaveform", param="waveformArray") + test_value = self._defaults["FetchWaveform"]["waveformArray"] try: waveform_array_ref = waveform_array.contents except AttributeError: @@ -280,219 +313,281 @@ def niDMM_FetchWaveform(self, vi, maximum_time, array_size, waveform_array, actu for i in range(len(test_value)): waveform_array_ref[i] = test_value[i] # actual_number_of_points - if self._defaults['FetchWaveform']['actualNumberOfPoints'] is None: - raise MockFunctionCallError("niDMM_FetchWaveform", param='actualNumberOfPoints') + if self._defaults["FetchWaveform"]["actualNumberOfPoints"] is None: + raise MockFunctionCallError( + "niDMM_FetchWaveform", param="actualNumberOfPoints" + ) if actual_number_of_points is not None: - actual_number_of_points.contents.value = self._defaults['FetchWaveform']['actualNumberOfPoints'] - return self._defaults['FetchWaveform']['return'] - - def niDMM_GetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['GetAttributeViBoolean']['return'] != 0: - return self._defaults['GetAttributeViBoolean']['return'] + actual_number_of_points.contents.value = self._defaults["FetchWaveform"][ + "actualNumberOfPoints" + ] + return self._defaults["FetchWaveform"]["return"] + + def niDMM_GetAttributeViBoolean( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["GetAttributeViBoolean"]["return"] != 0: + return self._defaults["GetAttributeViBoolean"]["return"] # attribute_value - if self._defaults['GetAttributeViBoolean']['attributeValue'] is None: - raise MockFunctionCallError("niDMM_GetAttributeViBoolean", param='attributeValue') + if self._defaults["GetAttributeViBoolean"]["attributeValue"] is None: + raise MockFunctionCallError( + "niDMM_GetAttributeViBoolean", param="attributeValue" + ) if attribute_value is not None: - attribute_value.contents.value = self._defaults['GetAttributeViBoolean']['attributeValue'] - return self._defaults['GetAttributeViBoolean']['return'] - - def niDMM_GetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['GetAttributeViInt32']['return'] != 0: - return self._defaults['GetAttributeViInt32']['return'] + attribute_value.contents.value = self._defaults["GetAttributeViBoolean"][ + "attributeValue" + ] + return self._defaults["GetAttributeViBoolean"]["return"] + + def niDMM_GetAttributeViInt32( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["GetAttributeViInt32"]["return"] != 0: + return self._defaults["GetAttributeViInt32"]["return"] # attribute_value - if self._defaults['GetAttributeViInt32']['attributeValue'] is None: - raise MockFunctionCallError("niDMM_GetAttributeViInt32", param='attributeValue') + if self._defaults["GetAttributeViInt32"]["attributeValue"] is None: + raise MockFunctionCallError( + "niDMM_GetAttributeViInt32", param="attributeValue" + ) if attribute_value is not None: - attribute_value.contents.value = self._defaults['GetAttributeViInt32']['attributeValue'] - return self._defaults['GetAttributeViInt32']['return'] - - def niDMM_GetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['GetAttributeViReal64']['return'] != 0: - return self._defaults['GetAttributeViReal64']['return'] + attribute_value.contents.value = self._defaults["GetAttributeViInt32"][ + "attributeValue" + ] + return self._defaults["GetAttributeViInt32"]["return"] + + def niDMM_GetAttributeViReal64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["GetAttributeViReal64"]["return"] != 0: + return self._defaults["GetAttributeViReal64"]["return"] # attribute_value - if self._defaults['GetAttributeViReal64']['attributeValue'] is None: - raise MockFunctionCallError("niDMM_GetAttributeViReal64", param='attributeValue') + if self._defaults["GetAttributeViReal64"]["attributeValue"] is None: + raise MockFunctionCallError( + "niDMM_GetAttributeViReal64", param="attributeValue" + ) if attribute_value is not None: - attribute_value.contents.value = self._defaults['GetAttributeViReal64']['attributeValue'] - return self._defaults['GetAttributeViReal64']['return'] - - def niDMM_GetAttributeViString(self, vi, channel_name, attribute_id, buffer_size, attribute_value): # noqa: N802 - if self._defaults['GetAttributeViString']['return'] != 0: - return self._defaults['GetAttributeViString']['return'] - if self._defaults['GetAttributeViString']['attributeValue'] is None: - raise MockFunctionCallError("niDMM_GetAttributeViString", param='attributeValue') + attribute_value.contents.value = self._defaults["GetAttributeViReal64"][ + "attributeValue" + ] + return self._defaults["GetAttributeViReal64"]["return"] + + def niDMM_GetAttributeViString( + self, vi, channel_name, attribute_id, buffer_size, attribute_value + ): # noqa: N802 + if self._defaults["GetAttributeViString"]["return"] != 0: + return self._defaults["GetAttributeViString"]["return"] + if self._defaults["GetAttributeViString"]["attributeValue"] is None: + raise MockFunctionCallError( + "niDMM_GetAttributeViString", param="attributeValue" + ) if buffer_size.value == 0: - return len(self._defaults['GetAttributeViString']['attributeValue']) - attribute_value.value = self._defaults['GetAttributeViString']['attributeValue'].encode('ascii') - return self._defaults['GetAttributeViString']['return'] - - def niDMM_GetCalDateAndTime(self, vi, cal_type, month, day, year, hour, minute): # noqa: N802 - if self._defaults['GetCalDateAndTime']['return'] != 0: - return self._defaults['GetCalDateAndTime']['return'] + return len(self._defaults["GetAttributeViString"]["attributeValue"]) + attribute_value.value = self._defaults["GetAttributeViString"][ + "attributeValue" + ].encode("ascii") + return self._defaults["GetAttributeViString"]["return"] + + def niDMM_GetCalDateAndTime( + self, vi, cal_type, month, day, year, hour, minute + ): # noqa: N802 + if self._defaults["GetCalDateAndTime"]["return"] != 0: + return self._defaults["GetCalDateAndTime"]["return"] # month - if self._defaults['GetCalDateAndTime']['month'] is None: - raise MockFunctionCallError("niDMM_GetCalDateAndTime", param='month') + if self._defaults["GetCalDateAndTime"]["month"] is None: + raise MockFunctionCallError("niDMM_GetCalDateAndTime", param="month") if month is not None: - month.contents.value = self._defaults['GetCalDateAndTime']['month'] + month.contents.value = self._defaults["GetCalDateAndTime"]["month"] # day - if self._defaults['GetCalDateAndTime']['day'] is None: - raise MockFunctionCallError("niDMM_GetCalDateAndTime", param='day') + if self._defaults["GetCalDateAndTime"]["day"] is None: + raise MockFunctionCallError("niDMM_GetCalDateAndTime", param="day") if day is not None: - day.contents.value = self._defaults['GetCalDateAndTime']['day'] + day.contents.value = self._defaults["GetCalDateAndTime"]["day"] # year - if self._defaults['GetCalDateAndTime']['year'] is None: - raise MockFunctionCallError("niDMM_GetCalDateAndTime", param='year') + if self._defaults["GetCalDateAndTime"]["year"] is None: + raise MockFunctionCallError("niDMM_GetCalDateAndTime", param="year") if year is not None: - year.contents.value = self._defaults['GetCalDateAndTime']['year'] + year.contents.value = self._defaults["GetCalDateAndTime"]["year"] # hour - if self._defaults['GetCalDateAndTime']['hour'] is None: - raise MockFunctionCallError("niDMM_GetCalDateAndTime", param='hour') + if self._defaults["GetCalDateAndTime"]["hour"] is None: + raise MockFunctionCallError("niDMM_GetCalDateAndTime", param="hour") if hour is not None: - hour.contents.value = self._defaults['GetCalDateAndTime']['hour'] + hour.contents.value = self._defaults["GetCalDateAndTime"]["hour"] # minute - if self._defaults['GetCalDateAndTime']['minute'] is None: - raise MockFunctionCallError("niDMM_GetCalDateAndTime", param='minute') + if self._defaults["GetCalDateAndTime"]["minute"] is None: + raise MockFunctionCallError("niDMM_GetCalDateAndTime", param="minute") if minute is not None: - minute.contents.value = self._defaults['GetCalDateAndTime']['minute'] - return self._defaults['GetCalDateAndTime']['return'] + minute.contents.value = self._defaults["GetCalDateAndTime"]["minute"] + return self._defaults["GetCalDateAndTime"]["return"] def niDMM_GetDevTemp(self, vi, options, temperature): # noqa: N802 - if self._defaults['GetDevTemp']['return'] != 0: - return self._defaults['GetDevTemp']['return'] + if self._defaults["GetDevTemp"]["return"] != 0: + return self._defaults["GetDevTemp"]["return"] # temperature - if self._defaults['GetDevTemp']['temperature'] is None: - raise MockFunctionCallError("niDMM_GetDevTemp", param='temperature') + if self._defaults["GetDevTemp"]["temperature"] is None: + raise MockFunctionCallError("niDMM_GetDevTemp", param="temperature") if temperature is not None: - temperature.contents.value = self._defaults['GetDevTemp']['temperature'] - return self._defaults['GetDevTemp']['return'] + temperature.contents.value = self._defaults["GetDevTemp"]["temperature"] + return self._defaults["GetDevTemp"]["return"] def niDMM_GetError(self, vi, error_code, buffer_size, description): # noqa: N802 - if self._defaults['GetError']['return'] != 0: - return self._defaults['GetError']['return'] + if self._defaults["GetError"]["return"] != 0: + return self._defaults["GetError"]["return"] # error_code - if self._defaults['GetError']['errorCode'] is None: - raise MockFunctionCallError("niDMM_GetError", param='errorCode') + if self._defaults["GetError"]["errorCode"] is None: + raise MockFunctionCallError("niDMM_GetError", param="errorCode") if error_code is not None: - error_code.contents.value = self._defaults['GetError']['errorCode'] - if self._defaults['GetError']['description'] is None: - raise MockFunctionCallError("niDMM_GetError", param='description') + error_code.contents.value = self._defaults["GetError"]["errorCode"] + if self._defaults["GetError"]["description"] is None: + raise MockFunctionCallError("niDMM_GetError", param="description") if buffer_size.value == 0: - return len(self._defaults['GetError']['description']) - description.value = self._defaults['GetError']['description'].encode('ascii') - return self._defaults['GetError']['return'] + return len(self._defaults["GetError"]["description"]) + description.value = self._defaults["GetError"]["description"].encode("ascii") + return self._defaults["GetError"]["return"] def niDMM_GetExtCalRecommendedInterval(self, vi, months): # noqa: N802 - if self._defaults['GetExtCalRecommendedInterval']['return'] != 0: - return self._defaults['GetExtCalRecommendedInterval']['return'] + if self._defaults["GetExtCalRecommendedInterval"]["return"] != 0: + return self._defaults["GetExtCalRecommendedInterval"]["return"] # months - if self._defaults['GetExtCalRecommendedInterval']['months'] is None: - raise MockFunctionCallError("niDMM_GetExtCalRecommendedInterval", param='months') + if self._defaults["GetExtCalRecommendedInterval"]["months"] is None: + raise MockFunctionCallError( + "niDMM_GetExtCalRecommendedInterval", param="months" + ) if months is not None: - months.contents.value = self._defaults['GetExtCalRecommendedInterval']['months'] - return self._defaults['GetExtCalRecommendedInterval']['return'] + months.contents.value = self._defaults["GetExtCalRecommendedInterval"][ + "months" + ] + return self._defaults["GetExtCalRecommendedInterval"]["return"] def niDMM_GetLastCalTemp(self, vi, cal_type, temperature): # noqa: N802 - if self._defaults['GetLastCalTemp']['return'] != 0: - return self._defaults['GetLastCalTemp']['return'] + if self._defaults["GetLastCalTemp"]["return"] != 0: + return self._defaults["GetLastCalTemp"]["return"] # temperature - if self._defaults['GetLastCalTemp']['temperature'] is None: - raise MockFunctionCallError("niDMM_GetLastCalTemp", param='temperature') + if self._defaults["GetLastCalTemp"]["temperature"] is None: + raise MockFunctionCallError("niDMM_GetLastCalTemp", param="temperature") if temperature is not None: - temperature.contents.value = self._defaults['GetLastCalTemp']['temperature'] - return self._defaults['GetLastCalTemp']['return'] + temperature.contents.value = self._defaults["GetLastCalTemp"]["temperature"] + return self._defaults["GetLastCalTemp"]["return"] def niDMM_GetSelfCalSupported(self, vi, self_cal_supported): # noqa: N802 - if self._defaults['GetSelfCalSupported']['return'] != 0: - return self._defaults['GetSelfCalSupported']['return'] + if self._defaults["GetSelfCalSupported"]["return"] != 0: + return self._defaults["GetSelfCalSupported"]["return"] # self_cal_supported - if self._defaults['GetSelfCalSupported']['selfCalSupported'] is None: - raise MockFunctionCallError("niDMM_GetSelfCalSupported", param='selfCalSupported') + if self._defaults["GetSelfCalSupported"]["selfCalSupported"] is None: + raise MockFunctionCallError( + "niDMM_GetSelfCalSupported", param="selfCalSupported" + ) if self_cal_supported is not None: - self_cal_supported.contents.value = self._defaults['GetSelfCalSupported']['selfCalSupported'] - return self._defaults['GetSelfCalSupported']['return'] - - def niDMM_ImportAttributeConfigurationBuffer(self, vi, size, configuration): # noqa: N802 - if self._defaults['ImportAttributeConfigurationBuffer']['return'] != 0: - return self._defaults['ImportAttributeConfigurationBuffer']['return'] - return self._defaults['ImportAttributeConfigurationBuffer']['return'] + self_cal_supported.contents.value = self._defaults["GetSelfCalSupported"][ + "selfCalSupported" + ] + return self._defaults["GetSelfCalSupported"]["return"] + + def niDMM_ImportAttributeConfigurationBuffer( + self, vi, size, configuration + ): # noqa: N802 + if self._defaults["ImportAttributeConfigurationBuffer"]["return"] != 0: + return self._defaults["ImportAttributeConfigurationBuffer"]["return"] + return self._defaults["ImportAttributeConfigurationBuffer"]["return"] def niDMM_ImportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 - if self._defaults['ImportAttributeConfigurationFile']['return'] != 0: - return self._defaults['ImportAttributeConfigurationFile']['return'] - return self._defaults['ImportAttributeConfigurationFile']['return'] - - def niDMM_InitWithOptions(self, resource_name, id_query, reset_device, option_string, vi): # noqa: N802 - if self._defaults['InitWithOptions']['return'] != 0: - return self._defaults['InitWithOptions']['return'] + if self._defaults["ImportAttributeConfigurationFile"]["return"] != 0: + return self._defaults["ImportAttributeConfigurationFile"]["return"] + return self._defaults["ImportAttributeConfigurationFile"]["return"] + + def niDMM_InitWithOptions( + self, resource_name, id_query, reset_device, option_string, vi + ): # noqa: N802 + if self._defaults["InitWithOptions"]["return"] != 0: + return self._defaults["InitWithOptions"]["return"] # vi - if self._defaults['InitWithOptions']['vi'] is None: - raise MockFunctionCallError("niDMM_InitWithOptions", param='vi') + if self._defaults["InitWithOptions"]["vi"] is None: + raise MockFunctionCallError("niDMM_InitWithOptions", param="vi") if vi is not None: - vi.contents.value = self._defaults['InitWithOptions']['vi'] - return self._defaults['InitWithOptions']['return'] + vi.contents.value = self._defaults["InitWithOptions"]["vi"] + return self._defaults["InitWithOptions"]["return"] def niDMM_Initiate(self, vi): # noqa: N802 - if self._defaults['Initiate']['return'] != 0: - return self._defaults['Initiate']['return'] - return self._defaults['Initiate']['return'] + if self._defaults["Initiate"]["return"] != 0: + return self._defaults["Initiate"]["return"] + return self._defaults["Initiate"]["return"] def niDMM_LockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults['LockSession']['return'] != 0: - return self._defaults['LockSession']['return'] + if self._defaults["LockSession"]["return"] != 0: + return self._defaults["LockSession"]["return"] # caller_has_lock - if self._defaults['LockSession']['callerHasLock'] is None: - raise MockFunctionCallError("niDMM_LockSession", param='callerHasLock') + if self._defaults["LockSession"]["callerHasLock"] is None: + raise MockFunctionCallError("niDMM_LockSession", param="callerHasLock") if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults['LockSession']['callerHasLock'] - return self._defaults['LockSession']['return'] + caller_has_lock.contents.value = self._defaults["LockSession"][ + "callerHasLock" + ] + return self._defaults["LockSession"]["return"] def niDMM_PerformOpenCableComp(self, vi, conductance, susceptance): # noqa: N802 - if self._defaults['PerformOpenCableComp']['return'] != 0: - return self._defaults['PerformOpenCableComp']['return'] + if self._defaults["PerformOpenCableComp"]["return"] != 0: + return self._defaults["PerformOpenCableComp"]["return"] # conductance - if self._defaults['PerformOpenCableComp']['conductance'] is None: - raise MockFunctionCallError("niDMM_PerformOpenCableComp", param='conductance') + if self._defaults["PerformOpenCableComp"]["conductance"] is None: + raise MockFunctionCallError( + "niDMM_PerformOpenCableComp", param="conductance" + ) if conductance is not None: - conductance.contents.value = self._defaults['PerformOpenCableComp']['conductance'] + conductance.contents.value = self._defaults["PerformOpenCableComp"][ + "conductance" + ] # susceptance - if self._defaults['PerformOpenCableComp']['susceptance'] is None: - raise MockFunctionCallError("niDMM_PerformOpenCableComp", param='susceptance') + if self._defaults["PerformOpenCableComp"]["susceptance"] is None: + raise MockFunctionCallError( + "niDMM_PerformOpenCableComp", param="susceptance" + ) if susceptance is not None: - susceptance.contents.value = self._defaults['PerformOpenCableComp']['susceptance'] - return self._defaults['PerformOpenCableComp']['return'] + susceptance.contents.value = self._defaults["PerformOpenCableComp"][ + "susceptance" + ] + return self._defaults["PerformOpenCableComp"]["return"] def niDMM_PerformShortCableComp(self, vi, resistance, reactance): # noqa: N802 - if self._defaults['PerformShortCableComp']['return'] != 0: - return self._defaults['PerformShortCableComp']['return'] + if self._defaults["PerformShortCableComp"]["return"] != 0: + return self._defaults["PerformShortCableComp"]["return"] # resistance - if self._defaults['PerformShortCableComp']['resistance'] is None: - raise MockFunctionCallError("niDMM_PerformShortCableComp", param='resistance') + if self._defaults["PerformShortCableComp"]["resistance"] is None: + raise MockFunctionCallError( + "niDMM_PerformShortCableComp", param="resistance" + ) if resistance is not None: - resistance.contents.value = self._defaults['PerformShortCableComp']['resistance'] + resistance.contents.value = self._defaults["PerformShortCableComp"][ + "resistance" + ] # reactance - if self._defaults['PerformShortCableComp']['reactance'] is None: - raise MockFunctionCallError("niDMM_PerformShortCableComp", param='reactance') + if self._defaults["PerformShortCableComp"]["reactance"] is None: + raise MockFunctionCallError( + "niDMM_PerformShortCableComp", param="reactance" + ) if reactance is not None: - reactance.contents.value = self._defaults['PerformShortCableComp']['reactance'] - return self._defaults['PerformShortCableComp']['return'] + reactance.contents.value = self._defaults["PerformShortCableComp"][ + "reactance" + ] + return self._defaults["PerformShortCableComp"]["return"] def niDMM_Read(self, vi, maximum_time, reading): # noqa: N802 - if self._defaults['Read']['return'] != 0: - return self._defaults['Read']['return'] + if self._defaults["Read"]["return"] != 0: + return self._defaults["Read"]["return"] # reading - if self._defaults['Read']['reading'] is None: - raise MockFunctionCallError("niDMM_Read", param='reading') + if self._defaults["Read"]["reading"] is None: + raise MockFunctionCallError("niDMM_Read", param="reading") if reading is not None: - reading.contents.value = self._defaults['Read']['reading'] - return self._defaults['Read']['return'] - - def niDMM_ReadMultiPoint(self, vi, maximum_time, array_size, reading_array, actual_number_of_points): # noqa: N802 - if self._defaults['ReadMultiPoint']['return'] != 0: - return self._defaults['ReadMultiPoint']['return'] + reading.contents.value = self._defaults["Read"]["reading"] + return self._defaults["Read"]["return"] + + def niDMM_ReadMultiPoint( + self, vi, maximum_time, array_size, reading_array, actual_number_of_points + ): # noqa: N802 + if self._defaults["ReadMultiPoint"]["return"] != 0: + return self._defaults["ReadMultiPoint"]["return"] # reading_array - if self._defaults['ReadMultiPoint']['readingArray'] is None: - raise MockFunctionCallError("niDMM_ReadMultiPoint", param='readingArray') - test_value = self._defaults['ReadMultiPoint']['readingArray'] + if self._defaults["ReadMultiPoint"]["readingArray"] is None: + raise MockFunctionCallError("niDMM_ReadMultiPoint", param="readingArray") + test_value = self._defaults["ReadMultiPoint"]["readingArray"] try: reading_array_ref = reading_array.contents except AttributeError: @@ -501,34 +596,46 @@ def niDMM_ReadMultiPoint(self, vi, maximum_time, array_size, reading_array, actu for i in range(len(test_value)): reading_array_ref[i] = test_value[i] # actual_number_of_points - if self._defaults['ReadMultiPoint']['actualNumberOfPoints'] is None: - raise MockFunctionCallError("niDMM_ReadMultiPoint", param='actualNumberOfPoints') + if self._defaults["ReadMultiPoint"]["actualNumberOfPoints"] is None: + raise MockFunctionCallError( + "niDMM_ReadMultiPoint", param="actualNumberOfPoints" + ) if actual_number_of_points is not None: - actual_number_of_points.contents.value = self._defaults['ReadMultiPoint']['actualNumberOfPoints'] - return self._defaults['ReadMultiPoint']['return'] - - def niDMM_ReadStatus(self, vi, acquisition_backlog, acquisition_status): # noqa: N802 - if self._defaults['ReadStatus']['return'] != 0: - return self._defaults['ReadStatus']['return'] + actual_number_of_points.contents.value = self._defaults["ReadMultiPoint"][ + "actualNumberOfPoints" + ] + return self._defaults["ReadMultiPoint"]["return"] + + def niDMM_ReadStatus( + self, vi, acquisition_backlog, acquisition_status + ): # noqa: N802 + if self._defaults["ReadStatus"]["return"] != 0: + return self._defaults["ReadStatus"]["return"] # acquisition_backlog - if self._defaults['ReadStatus']['acquisitionBacklog'] is None: - raise MockFunctionCallError("niDMM_ReadStatus", param='acquisitionBacklog') + if self._defaults["ReadStatus"]["acquisitionBacklog"] is None: + raise MockFunctionCallError("niDMM_ReadStatus", param="acquisitionBacklog") if acquisition_backlog is not None: - acquisition_backlog.contents.value = self._defaults['ReadStatus']['acquisitionBacklog'] + acquisition_backlog.contents.value = self._defaults["ReadStatus"][ + "acquisitionBacklog" + ] # acquisition_status - if self._defaults['ReadStatus']['acquisitionStatus'] is None: - raise MockFunctionCallError("niDMM_ReadStatus", param='acquisitionStatus') + if self._defaults["ReadStatus"]["acquisitionStatus"] is None: + raise MockFunctionCallError("niDMM_ReadStatus", param="acquisitionStatus") if acquisition_status is not None: - acquisition_status.contents.value = self._defaults['ReadStatus']['acquisitionStatus'] - return self._defaults['ReadStatus']['return'] - - def niDMM_ReadWaveform(self, vi, maximum_time, array_size, waveform_array, actual_number_of_points): # noqa: N802 - if self._defaults['ReadWaveform']['return'] != 0: - return self._defaults['ReadWaveform']['return'] + acquisition_status.contents.value = self._defaults["ReadStatus"][ + "acquisitionStatus" + ] + return self._defaults["ReadStatus"]["return"] + + def niDMM_ReadWaveform( + self, vi, maximum_time, array_size, waveform_array, actual_number_of_points + ): # noqa: N802 + if self._defaults["ReadWaveform"]["return"] != 0: + return self._defaults["ReadWaveform"]["return"] # waveform_array - if self._defaults['ReadWaveform']['waveformArray'] is None: - raise MockFunctionCallError("niDMM_ReadWaveform", param='waveformArray') - test_value = self._defaults['ReadWaveform']['waveformArray'] + if self._defaults["ReadWaveform"]["waveformArray"] is None: + raise MockFunctionCallError("niDMM_ReadWaveform", param="waveformArray") + test_value = self._defaults["ReadWaveform"]["waveformArray"] try: waveform_array_ref = waveform_array.contents except AttributeError: @@ -537,197 +644,297 @@ def niDMM_ReadWaveform(self, vi, maximum_time, array_size, waveform_array, actua for i in range(len(test_value)): waveform_array_ref[i] = test_value[i] # actual_number_of_points - if self._defaults['ReadWaveform']['actualNumberOfPoints'] is None: - raise MockFunctionCallError("niDMM_ReadWaveform", param='actualNumberOfPoints') + if self._defaults["ReadWaveform"]["actualNumberOfPoints"] is None: + raise MockFunctionCallError( + "niDMM_ReadWaveform", param="actualNumberOfPoints" + ) if actual_number_of_points is not None: - actual_number_of_points.contents.value = self._defaults['ReadWaveform']['actualNumberOfPoints'] - return self._defaults['ReadWaveform']['return'] + actual_number_of_points.contents.value = self._defaults["ReadWaveform"][ + "actualNumberOfPoints" + ] + return self._defaults["ReadWaveform"]["return"] def niDMM_ResetWithDefaults(self, vi): # noqa: N802 - if self._defaults['ResetWithDefaults']['return'] != 0: - return self._defaults['ResetWithDefaults']['return'] - return self._defaults['ResetWithDefaults']['return'] + if self._defaults["ResetWithDefaults"]["return"] != 0: + return self._defaults["ResetWithDefaults"]["return"] + return self._defaults["ResetWithDefaults"]["return"] def niDMM_SelfCal(self, vi): # noqa: N802 - if self._defaults['SelfCal']['return'] != 0: - return self._defaults['SelfCal']['return'] - return self._defaults['SelfCal']['return'] + if self._defaults["SelfCal"]["return"] != 0: + return self._defaults["SelfCal"]["return"] + return self._defaults["SelfCal"]["return"] def niDMM_SendSoftwareTrigger(self, vi): # noqa: N802 - if self._defaults['SendSoftwareTrigger']['return'] != 0: - return self._defaults['SendSoftwareTrigger']['return'] - return self._defaults['SendSoftwareTrigger']['return'] - - def niDMM_SetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['SetAttributeViBoolean']['return'] != 0: - return self._defaults['SetAttributeViBoolean']['return'] - return self._defaults['SetAttributeViBoolean']['return'] - - def niDMM_SetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['SetAttributeViInt32']['return'] != 0: - return self._defaults['SetAttributeViInt32']['return'] - return self._defaults['SetAttributeViInt32']['return'] - - def niDMM_SetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['SetAttributeViReal64']['return'] != 0: - return self._defaults['SetAttributeViReal64']['return'] - return self._defaults['SetAttributeViReal64']['return'] - - def niDMM_SetAttributeViString(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['SetAttributeViString']['return'] != 0: - return self._defaults['SetAttributeViString']['return'] - return self._defaults['SetAttributeViString']['return'] + if self._defaults["SendSoftwareTrigger"]["return"] != 0: + return self._defaults["SendSoftwareTrigger"]["return"] + return self._defaults["SendSoftwareTrigger"]["return"] + + def niDMM_SetAttributeViBoolean( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["SetAttributeViBoolean"]["return"] != 0: + return self._defaults["SetAttributeViBoolean"]["return"] + return self._defaults["SetAttributeViBoolean"]["return"] + + def niDMM_SetAttributeViInt32( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["SetAttributeViInt32"]["return"] != 0: + return self._defaults["SetAttributeViInt32"]["return"] + return self._defaults["SetAttributeViInt32"]["return"] + + def niDMM_SetAttributeViReal64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["SetAttributeViReal64"]["return"] != 0: + return self._defaults["SetAttributeViReal64"]["return"] + return self._defaults["SetAttributeViReal64"]["return"] + + def niDMM_SetAttributeViString( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["SetAttributeViString"]["return"] != 0: + return self._defaults["SetAttributeViString"]["return"] + return self._defaults["SetAttributeViString"]["return"] def niDMM_UnlockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults['UnlockSession']['return'] != 0: - return self._defaults['UnlockSession']['return'] + if self._defaults["UnlockSession"]["return"] != 0: + return self._defaults["UnlockSession"]["return"] # caller_has_lock - if self._defaults['UnlockSession']['callerHasLock'] is None: - raise MockFunctionCallError("niDMM_UnlockSession", param='callerHasLock') + if self._defaults["UnlockSession"]["callerHasLock"] is None: + raise MockFunctionCallError("niDMM_UnlockSession", param="callerHasLock") if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults['UnlockSession']['callerHasLock'] - return self._defaults['UnlockSession']['return'] + caller_has_lock.contents.value = self._defaults["UnlockSession"][ + "callerHasLock" + ] + return self._defaults["UnlockSession"]["return"] def niDMM_close(self, vi): # noqa: N802 - if self._defaults['close']['return'] != 0: - return self._defaults['close']['return'] - return self._defaults['close']['return'] + if self._defaults["close"]["return"] != 0: + return self._defaults["close"]["return"] + return self._defaults["close"]["return"] def niDMM_error_message(self, vi, error_code, error_message): # noqa: N802 - if self._defaults['error_message']['return'] != 0: - return self._defaults['error_message']['return'] + if self._defaults["error_message"]["return"] != 0: + return self._defaults["error_message"]["return"] # error_message - if self._defaults['error_message']['errorMessage'] is None: - raise MockFunctionCallError("niDMM_error_message", param='errorMessage') - test_value = self._defaults['error_message']['errorMessage'] + if self._defaults["error_message"]["errorMessage"] is None: + raise MockFunctionCallError("niDMM_error_message", param="errorMessage") + test_value = self._defaults["error_message"]["errorMessage"] if type(test_value) is str: - test_value = test_value.encode('ascii') + test_value = test_value.encode("ascii") assert len(error_message) >= len(test_value) for i in range(len(test_value)): error_message[i] = test_value[i] - return self._defaults['error_message']['return'] + return self._defaults["error_message"]["return"] def niDMM_reset(self, vi): # noqa: N802 - if self._defaults['reset']['return'] != 0: - return self._defaults['reset']['return'] - return self._defaults['reset']['return'] + if self._defaults["reset"]["return"] != 0: + return self._defaults["reset"]["return"] + return self._defaults["reset"]["return"] def niDMM_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 - if self._defaults['self_test']['return'] != 0: - return self._defaults['self_test']['return'] + if self._defaults["self_test"]["return"] != 0: + return self._defaults["self_test"]["return"] # self_test_result - if self._defaults['self_test']['selfTestResult'] is None: - raise MockFunctionCallError("niDMM_self_test", param='selfTestResult') + if self._defaults["self_test"]["selfTestResult"] is None: + raise MockFunctionCallError("niDMM_self_test", param="selfTestResult") if self_test_result is not None: - self_test_result.contents.value = self._defaults['self_test']['selfTestResult'] + self_test_result.contents.value = self._defaults["self_test"][ + "selfTestResult" + ] # self_test_message - if self._defaults['self_test']['selfTestMessage'] is None: - raise MockFunctionCallError("niDMM_self_test", param='selfTestMessage') - test_value = self._defaults['self_test']['selfTestMessage'] + if self._defaults["self_test"]["selfTestMessage"] is None: + raise MockFunctionCallError("niDMM_self_test", param="selfTestMessage") + test_value = self._defaults["self_test"]["selfTestMessage"] if type(test_value) is str: - test_value = test_value.encode('ascii') + test_value = test_value.encode("ascii") assert len(self_test_message) >= len(test_value) for i in range(len(test_value)): self_test_message[i] = test_value[i] - return self._defaults['self_test']['return'] + return self._defaults["self_test"]["return"] # Helper function to setup Mock object with default side effects and return values def set_side_effects_and_return_values(self, mock_library): mock_library.niDMM_Abort.side_effect = MockFunctionCallError("niDMM_Abort") mock_library.niDMM_Abort.return_value = 0 - mock_library.niDMM_ConfigureMeasurementAbsolute.side_effect = MockFunctionCallError("niDMM_ConfigureMeasurementAbsolute") + mock_library.niDMM_ConfigureMeasurementAbsolute.side_effect = ( + MockFunctionCallError("niDMM_ConfigureMeasurementAbsolute") + ) mock_library.niDMM_ConfigureMeasurementAbsolute.return_value = 0 - mock_library.niDMM_ConfigureMeasurementDigits.side_effect = MockFunctionCallError("niDMM_ConfigureMeasurementDigits") + mock_library.niDMM_ConfigureMeasurementDigits.side_effect = ( + MockFunctionCallError("niDMM_ConfigureMeasurementDigits") + ) mock_library.niDMM_ConfigureMeasurementDigits.return_value = 0 - mock_library.niDMM_ConfigureMultiPoint.side_effect = MockFunctionCallError("niDMM_ConfigureMultiPoint") + mock_library.niDMM_ConfigureMultiPoint.side_effect = MockFunctionCallError( + "niDMM_ConfigureMultiPoint" + ) mock_library.niDMM_ConfigureMultiPoint.return_value = 0 - mock_library.niDMM_ConfigureRTDCustom.side_effect = MockFunctionCallError("niDMM_ConfigureRTDCustom") + mock_library.niDMM_ConfigureRTDCustom.side_effect = MockFunctionCallError( + "niDMM_ConfigureRTDCustom" + ) mock_library.niDMM_ConfigureRTDCustom.return_value = 0 - mock_library.niDMM_ConfigureRTDType.side_effect = MockFunctionCallError("niDMM_ConfigureRTDType") + mock_library.niDMM_ConfigureRTDType.side_effect = MockFunctionCallError( + "niDMM_ConfigureRTDType" + ) mock_library.niDMM_ConfigureRTDType.return_value = 0 - mock_library.niDMM_ConfigureThermistorCustom.side_effect = MockFunctionCallError("niDMM_ConfigureThermistorCustom") + mock_library.niDMM_ConfigureThermistorCustom.side_effect = ( + MockFunctionCallError("niDMM_ConfigureThermistorCustom") + ) mock_library.niDMM_ConfigureThermistorCustom.return_value = 0 - mock_library.niDMM_ConfigureThermocouple.side_effect = MockFunctionCallError("niDMM_ConfigureThermocouple") + mock_library.niDMM_ConfigureThermocouple.side_effect = MockFunctionCallError( + "niDMM_ConfigureThermocouple" + ) mock_library.niDMM_ConfigureThermocouple.return_value = 0 - mock_library.niDMM_ConfigureTrigger.side_effect = MockFunctionCallError("niDMM_ConfigureTrigger") + mock_library.niDMM_ConfigureTrigger.side_effect = MockFunctionCallError( + "niDMM_ConfigureTrigger" + ) mock_library.niDMM_ConfigureTrigger.return_value = 0 - mock_library.niDMM_ConfigureWaveformAcquisition.side_effect = MockFunctionCallError("niDMM_ConfigureWaveformAcquisition") + mock_library.niDMM_ConfigureWaveformAcquisition.side_effect = ( + MockFunctionCallError("niDMM_ConfigureWaveformAcquisition") + ) mock_library.niDMM_ConfigureWaveformAcquisition.return_value = 0 mock_library.niDMM_Disable.side_effect = MockFunctionCallError("niDMM_Disable") mock_library.niDMM_Disable.return_value = 0 - mock_library.niDMM_ExportAttributeConfigurationBuffer.side_effect = MockFunctionCallError("niDMM_ExportAttributeConfigurationBuffer") + mock_library.niDMM_ExportAttributeConfigurationBuffer.side_effect = ( + MockFunctionCallError("niDMM_ExportAttributeConfigurationBuffer") + ) mock_library.niDMM_ExportAttributeConfigurationBuffer.return_value = 0 - mock_library.niDMM_ExportAttributeConfigurationFile.side_effect = MockFunctionCallError("niDMM_ExportAttributeConfigurationFile") + mock_library.niDMM_ExportAttributeConfigurationFile.side_effect = ( + MockFunctionCallError("niDMM_ExportAttributeConfigurationFile") + ) mock_library.niDMM_ExportAttributeConfigurationFile.return_value = 0 mock_library.niDMM_Fetch.side_effect = MockFunctionCallError("niDMM_Fetch") mock_library.niDMM_Fetch.return_value = 0 - mock_library.niDMM_FetchMultiPoint.side_effect = MockFunctionCallError("niDMM_FetchMultiPoint") + mock_library.niDMM_FetchMultiPoint.side_effect = MockFunctionCallError( + "niDMM_FetchMultiPoint" + ) mock_library.niDMM_FetchMultiPoint.return_value = 0 - mock_library.niDMM_FetchWaveform.side_effect = MockFunctionCallError("niDMM_FetchWaveform") + mock_library.niDMM_FetchWaveform.side_effect = MockFunctionCallError( + "niDMM_FetchWaveform" + ) mock_library.niDMM_FetchWaveform.return_value = 0 - mock_library.niDMM_GetAttributeViBoolean.side_effect = MockFunctionCallError("niDMM_GetAttributeViBoolean") + mock_library.niDMM_GetAttributeViBoolean.side_effect = MockFunctionCallError( + "niDMM_GetAttributeViBoolean" + ) mock_library.niDMM_GetAttributeViBoolean.return_value = 0 - mock_library.niDMM_GetAttributeViInt32.side_effect = MockFunctionCallError("niDMM_GetAttributeViInt32") + mock_library.niDMM_GetAttributeViInt32.side_effect = MockFunctionCallError( + "niDMM_GetAttributeViInt32" + ) mock_library.niDMM_GetAttributeViInt32.return_value = 0 - mock_library.niDMM_GetAttributeViReal64.side_effect = MockFunctionCallError("niDMM_GetAttributeViReal64") + mock_library.niDMM_GetAttributeViReal64.side_effect = MockFunctionCallError( + "niDMM_GetAttributeViReal64" + ) mock_library.niDMM_GetAttributeViReal64.return_value = 0 - mock_library.niDMM_GetAttributeViString.side_effect = MockFunctionCallError("niDMM_GetAttributeViString") + mock_library.niDMM_GetAttributeViString.side_effect = MockFunctionCallError( + "niDMM_GetAttributeViString" + ) mock_library.niDMM_GetAttributeViString.return_value = 0 - mock_library.niDMM_GetCalDateAndTime.side_effect = MockFunctionCallError("niDMM_GetCalDateAndTime") + mock_library.niDMM_GetCalDateAndTime.side_effect = MockFunctionCallError( + "niDMM_GetCalDateAndTime" + ) mock_library.niDMM_GetCalDateAndTime.return_value = 0 - mock_library.niDMM_GetDevTemp.side_effect = MockFunctionCallError("niDMM_GetDevTemp") + mock_library.niDMM_GetDevTemp.side_effect = MockFunctionCallError( + "niDMM_GetDevTemp" + ) mock_library.niDMM_GetDevTemp.return_value = 0 - mock_library.niDMM_GetError.side_effect = MockFunctionCallError("niDMM_GetError") + mock_library.niDMM_GetError.side_effect = MockFunctionCallError( + "niDMM_GetError" + ) mock_library.niDMM_GetError.return_value = 0 - mock_library.niDMM_GetExtCalRecommendedInterval.side_effect = MockFunctionCallError("niDMM_GetExtCalRecommendedInterval") + mock_library.niDMM_GetExtCalRecommendedInterval.side_effect = ( + MockFunctionCallError("niDMM_GetExtCalRecommendedInterval") + ) mock_library.niDMM_GetExtCalRecommendedInterval.return_value = 0 - mock_library.niDMM_GetLastCalTemp.side_effect = MockFunctionCallError("niDMM_GetLastCalTemp") + mock_library.niDMM_GetLastCalTemp.side_effect = MockFunctionCallError( + "niDMM_GetLastCalTemp" + ) mock_library.niDMM_GetLastCalTemp.return_value = 0 - mock_library.niDMM_GetSelfCalSupported.side_effect = MockFunctionCallError("niDMM_GetSelfCalSupported") + mock_library.niDMM_GetSelfCalSupported.side_effect = MockFunctionCallError( + "niDMM_GetSelfCalSupported" + ) mock_library.niDMM_GetSelfCalSupported.return_value = 0 - mock_library.niDMM_ImportAttributeConfigurationBuffer.side_effect = MockFunctionCallError("niDMM_ImportAttributeConfigurationBuffer") + mock_library.niDMM_ImportAttributeConfigurationBuffer.side_effect = ( + MockFunctionCallError("niDMM_ImportAttributeConfigurationBuffer") + ) mock_library.niDMM_ImportAttributeConfigurationBuffer.return_value = 0 - mock_library.niDMM_ImportAttributeConfigurationFile.side_effect = MockFunctionCallError("niDMM_ImportAttributeConfigurationFile") + mock_library.niDMM_ImportAttributeConfigurationFile.side_effect = ( + MockFunctionCallError("niDMM_ImportAttributeConfigurationFile") + ) mock_library.niDMM_ImportAttributeConfigurationFile.return_value = 0 - mock_library.niDMM_InitWithOptions.side_effect = MockFunctionCallError("niDMM_InitWithOptions") + mock_library.niDMM_InitWithOptions.side_effect = MockFunctionCallError( + "niDMM_InitWithOptions" + ) mock_library.niDMM_InitWithOptions.return_value = 0 - mock_library.niDMM_Initiate.side_effect = MockFunctionCallError("niDMM_Initiate") + mock_library.niDMM_Initiate.side_effect = MockFunctionCallError( + "niDMM_Initiate" + ) mock_library.niDMM_Initiate.return_value = 0 - mock_library.niDMM_LockSession.side_effect = MockFunctionCallError("niDMM_LockSession") + mock_library.niDMM_LockSession.side_effect = MockFunctionCallError( + "niDMM_LockSession" + ) mock_library.niDMM_LockSession.return_value = 0 - mock_library.niDMM_PerformOpenCableComp.side_effect = MockFunctionCallError("niDMM_PerformOpenCableComp") + mock_library.niDMM_PerformOpenCableComp.side_effect = MockFunctionCallError( + "niDMM_PerformOpenCableComp" + ) mock_library.niDMM_PerformOpenCableComp.return_value = 0 - mock_library.niDMM_PerformShortCableComp.side_effect = MockFunctionCallError("niDMM_PerformShortCableComp") + mock_library.niDMM_PerformShortCableComp.side_effect = MockFunctionCallError( + "niDMM_PerformShortCableComp" + ) mock_library.niDMM_PerformShortCableComp.return_value = 0 mock_library.niDMM_Read.side_effect = MockFunctionCallError("niDMM_Read") mock_library.niDMM_Read.return_value = 0 - mock_library.niDMM_ReadMultiPoint.side_effect = MockFunctionCallError("niDMM_ReadMultiPoint") + mock_library.niDMM_ReadMultiPoint.side_effect = MockFunctionCallError( + "niDMM_ReadMultiPoint" + ) mock_library.niDMM_ReadMultiPoint.return_value = 0 - mock_library.niDMM_ReadStatus.side_effect = MockFunctionCallError("niDMM_ReadStatus") + mock_library.niDMM_ReadStatus.side_effect = MockFunctionCallError( + "niDMM_ReadStatus" + ) mock_library.niDMM_ReadStatus.return_value = 0 - mock_library.niDMM_ReadWaveform.side_effect = MockFunctionCallError("niDMM_ReadWaveform") + mock_library.niDMM_ReadWaveform.side_effect = MockFunctionCallError( + "niDMM_ReadWaveform" + ) mock_library.niDMM_ReadWaveform.return_value = 0 - mock_library.niDMM_ResetWithDefaults.side_effect = MockFunctionCallError("niDMM_ResetWithDefaults") + mock_library.niDMM_ResetWithDefaults.side_effect = MockFunctionCallError( + "niDMM_ResetWithDefaults" + ) mock_library.niDMM_ResetWithDefaults.return_value = 0 mock_library.niDMM_SelfCal.side_effect = MockFunctionCallError("niDMM_SelfCal") mock_library.niDMM_SelfCal.return_value = 0 - mock_library.niDMM_SendSoftwareTrigger.side_effect = MockFunctionCallError("niDMM_SendSoftwareTrigger") + mock_library.niDMM_SendSoftwareTrigger.side_effect = MockFunctionCallError( + "niDMM_SendSoftwareTrigger" + ) mock_library.niDMM_SendSoftwareTrigger.return_value = 0 - mock_library.niDMM_SetAttributeViBoolean.side_effect = MockFunctionCallError("niDMM_SetAttributeViBoolean") + mock_library.niDMM_SetAttributeViBoolean.side_effect = MockFunctionCallError( + "niDMM_SetAttributeViBoolean" + ) mock_library.niDMM_SetAttributeViBoolean.return_value = 0 - mock_library.niDMM_SetAttributeViInt32.side_effect = MockFunctionCallError("niDMM_SetAttributeViInt32") + mock_library.niDMM_SetAttributeViInt32.side_effect = MockFunctionCallError( + "niDMM_SetAttributeViInt32" + ) mock_library.niDMM_SetAttributeViInt32.return_value = 0 - mock_library.niDMM_SetAttributeViReal64.side_effect = MockFunctionCallError("niDMM_SetAttributeViReal64") + mock_library.niDMM_SetAttributeViReal64.side_effect = MockFunctionCallError( + "niDMM_SetAttributeViReal64" + ) mock_library.niDMM_SetAttributeViReal64.return_value = 0 - mock_library.niDMM_SetAttributeViString.side_effect = MockFunctionCallError("niDMM_SetAttributeViString") + mock_library.niDMM_SetAttributeViString.side_effect = MockFunctionCallError( + "niDMM_SetAttributeViString" + ) mock_library.niDMM_SetAttributeViString.return_value = 0 - mock_library.niDMM_UnlockSession.side_effect = MockFunctionCallError("niDMM_UnlockSession") + mock_library.niDMM_UnlockSession.side_effect = MockFunctionCallError( + "niDMM_UnlockSession" + ) mock_library.niDMM_UnlockSession.return_value = 0 mock_library.niDMM_close.side_effect = MockFunctionCallError("niDMM_close") mock_library.niDMM_close.return_value = 0 - mock_library.niDMM_error_message.side_effect = MockFunctionCallError("niDMM_error_message") + mock_library.niDMM_error_message.side_effect = MockFunctionCallError( + "niDMM_error_message" + ) mock_library.niDMM_error_message.return_value = 0 mock_library.niDMM_reset.side_effect = MockFunctionCallError("niDMM_reset") mock_library.niDMM_reset.return_value = 0 - mock_library.niDMM_self_test.side_effect = MockFunctionCallError("niDMM_self_test") + mock_library.niDMM_self_test.side_effect = MockFunctionCallError( + "niDMM_self_test" + ) mock_library.niDMM_self_test.return_value = 0 diff --git a/generated/nidmm/setup.py b/generated/nidmm/setup.py index 2d094e8fe..c35d4f511 100644 --- a/generated/nidmm/setup.py +++ b/generated/nidmm/setup.py @@ -15,41 +15,44 @@ def finalize_options(self): def run_tests(self): import pytest + pytest.main(self.test_args) -pypi_name = 'nidmm' +pypi_name = "nidmm" def read_contents(file_to_read): - with open(file_to_read, 'r') as f: + with open(file_to_read, "r") as f: return f.read() setup( name=pypi_name, zip_safe=True, - version='1.4.2.dev0', - description='NI-DMM Python API', - long_description=read_contents('README.rst'), - long_description_content_type='text/x-rst', - author='NI', + version="1.4.2.dev0", + description="NI-DMM Python API", + long_description=read_contents("README.rst"), + long_description_content_type="text/x-rst", + author="NI", author_email="opensource@ni.com", url="https://github.com/ni/nimi-python", maintainer="NI", maintainer_email="opensource@ni.com", - keywords=['nidmm'], - license='MIT', + keywords=["nidmm"], + license="MIT", include_package_data=True, - packages=['nidmm'], + packages=["nidmm"], install_requires=[ 'enum34;python_version<"3.4"', 'singledispatch;python_version<"3.4"', - 'hightime>=0.2.0', + "hightime>=0.2.0", + ], + setup_requires=[ + "pytest-runner", ], - setup_requires=['pytest-runner', ], - tests_require=['pytest'], - test_suite='tests', + tests_require=["pytest"], + test_suite="tests", classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -64,8 +67,8 @@ def read_contents(file_to_read): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", - "Topic :: System :: Hardware :: Hardware Drivers" + "Topic :: System :: Hardware :: Hardware Drivers", ], - cmdclass={'test': PyTest}, - package_data={pypi_name: ['VERSION']}, + cmdclass={"test": PyTest}, + package_data={pypi_name: ["VERSION"]}, ) diff --git a/generated/nifake/nifake/__init__.py b/generated/nifake/nifake/__init__.py index ae0e67e8e..646bbfef1 100644 --- a/generated/nifake/nifake/__init__.py +++ b/generated/nifake/nifake/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = '1.4.2.dev0' +__version__ = "1.4.2.dev0" from nifake.enums import * # noqa: F403,F401,H303 from nifake.errors import DriverWarning # noqa: F401 @@ -15,12 +15,12 @@ def get_diagnostic_information(): - '''Get diagnostic information about the system state that is suitable for printing or logging + """Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - ''' + """ import os import pkg_resources import platform @@ -28,73 +28,80 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return (struct.calcsize("P") == 8) + return struct.calcsize("P") == 8 def is_os_64bit(): - return platform.machine().endswith('64') + return platform.machine().endswith("64") def is_venv(): - return 'VIRTUAL_ENV' in os.environ + return "VIRTUAL_ENV" in os.environ info = {} - info['os'] = {} - info['python'] = {} - info['driver'] = {} - info['module'] = {} - if platform.system() == 'Windows': + info["os"] = {} + info["python"] = {} + info["driver"] = {} + info["module"] = {} + if platform.system() == "Windows": try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = 'Windows' + os_name = "Windows" try: - driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-FAKE\CurrentVersion") + driver_version_key = winreg.OpenKey( + winreg.HKEY_LOCAL_MACHINE, + r"SOFTWARE\National Instruments\NI-FAKE\CurrentVersion", + ) driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = 'Unknown' - elif platform.system() == 'Linux': - os_name = 'Linux' - driver_version = 'Unknown' + driver_version = "Unknown" + elif platform.system() == "Linux": + os_name = "Linux" + driver_version = "Unknown" else: - raise SystemError('Unsupported platform: {}'.format(platform.system())) + raise SystemError("Unsupported platform: {}".format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] - - info['os']['name'] = os_name - info['os']['version'] = platform.version() - info['os']['bits'] = '64' if is_os_64bit() else '32' - info['driver']['name'] = "NI-FAKE" - info['driver']['version'] = driver_version - info['module']['name'] = 'nifake' - info['module']['version'] = "1.4.2.dev0" - info['python']['version'] = sys.version - info['python']['bits'] = '64' if is_python_64bit() else '32' - info['python']['is_venv'] = is_venv() - info['python']['packages'] = installed_packages_list + installed_packages_list = [ + { + "name": i.key, + "version": i.version, + } + for i in installed_packages + ] + + info["os"]["name"] = os_name + info["os"]["version"] = platform.version() + info["os"]["bits"] = "64" if is_os_64bit() else "32" + info["driver"]["name"] = "NI-FAKE" + info["driver"]["version"] = driver_version + info["module"]["name"] = "nifake" + info["module"]["version"] = "1.4.2.dev0" + info["python"]["version"] = sys.version + info["python"]["bits"] = "64" if is_python_64bit() else "32" + info["python"]["is_venv"] = is_venv() + info["python"]["packages"] = installed_packages_list return info def print_diagnostic_information(): - '''Print diagnostic information in a format suitable for issue report + """Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - ''' + """ info = get_diagnostic_information() - row_format = ' {:<10} {}' - for type in ['OS', 'Driver', 'Module', 'Python']: + row_format = " {:<10} {}" + for type in ["OS", "Driver", "Module", "Python"]: typename = type.lower() - print(type + ':') + print(type + ":") for item in info[typename]: - if item != 'packages': - print(row_format.format(item.title() + ':', info[typename][item])) - print(' Installed Packages:') - for p in info['python']['packages']: - print((' ' * 8) + p['name'] + '==' + p['version']) + if item != "packages": + print(row_format.format(item.title() + ":", info[typename][item])) + print(" Installed Packages:") + for p in info["python"]["packages"]: + print((" " * 8) + p["name"] + "==" + p["version"]) return info - - diff --git a/generated/nifake/nifake/_attributes.py b/generated/nifake/nifake/_attributes.py index 1b8c55874..00744f460 100644 --- a/generated/nifake/nifake/_attributes.py +++ b/generated/nifake/nifake/_attributes.py @@ -6,14 +6,13 @@ class Attribute(object): - '''Base class for all typed attributes.''' + """Base class for all typed attributes.""" def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -22,16 +21,19 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) + return hightime.timedelta( + milliseconds=session._get_attribute_vi_int32(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) + session._set_attribute_vi_int32( + self._attribute_id, + _converters.convert_timedelta_to_milliseconds_int32(value).value, + ) class AttributeViInt64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -40,7 +42,6 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -49,16 +50,19 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) + return hightime.timedelta( + seconds=session._get_attribute_vi_real64(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) + session._set_attribute_vi_real64( + self._attribute_id, + _converters.convert_timedelta_to_seconds_real64(value).value, + ) class AttributeViString(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -67,16 +71,17 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) + session._set_attribute_vi_string( + self._attribute_id, + _converters.convert_repeated_capabilities_without_prefix(value), + ) class AttributeViBoolean(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -85,31 +90,36 @@ def __set__(self, session, value): class AttributeEnum(object): - def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) + return self._attribute_type( + self._underlying_attribute.__get__(session, session_type) + ) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) + raise TypeError( + "must be " + + str(self._attribute_type.__name__) + + " not " + + str(type(value).__name__) + ) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): - def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from nifake.session import SessionReference + return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) - - - + session._set_attribute_vi_session( + self._attribute_id, _converters.convert_to_nitclk_session_number(value) + ) diff --git a/generated/nifake/nifake/_converters.py b/generated/nifake/nifake/_converters.py index 608ae5753..8b81598c1 100644 --- a/generated/nifake/nifake/_converters.py +++ b/generated/nifake/nifake/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - '''Base version that should not be called + """Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,36 +40,38 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - ''' - raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + """ + raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - '''Integer version''' + """Integer version""" return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - '''String version (this is the most complex) + """String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - ''' + """ # First we deal with a list - rep_cap_list = repeated_capability.split(',') + rep_cap_list = repeated_capability.split(",") if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, '').replace(':', '-') - rc = r.split('-') + r = repeated_capability.strip().replace(prefix, "").replace(":", "-") + rc = r.split("-") if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + raise errors.InvalidRepeatedCapabilityError( + "Multiple '-' or ':'", repeated_capability + ) try: start = int(rc[0]) end = int(rc[1]) @@ -85,7 +87,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, '').strip()] + return [repeated_capability.replace(prefix, "").strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -94,7 +96,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - '''Iterable version - can handle lists, ranges, and tuples''' + """Iterable version - can handle lists, ranges, and tuples""" rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -103,16 +105,22 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - '''slice version''' + """slice version""" + def ifnone(a, b): return b if a is None else a + # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) + rng = range( + ifnone(repeated_capability.start, 0), + repeated_capability.stop, + ifnone(repeated_capability.step, 1), + ) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=''): - '''Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=""): + """Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -120,15 +128,17 @@ def convert_repeated_capabilities(repeated_capability, prefix=''): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - ''' + """ # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] + return [ + prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) + ] def convert_repeated_capabilities_without_prefix(repeated_capability): - '''Convert a repeated capabilities object, without any prefix, to a comma delimited list + """Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -144,8 +154,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - ''' - return ','.join(convert_repeated_capabilities(repeated_capability, '')) + """ + return ",".join(convert_repeated_capabilities(repeated_capability, "")) def _convert_timedelta(value, library_type, scaling): @@ -158,7 +168,14 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: + if library_type in [ + _visatype.ViInt64, + _visatype.ViInt32, + _visatype.ViUInt32, + _visatype.ViInt16, + _visatype.ViUInt16, + _visatype.ViInt8, + ]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -195,34 +212,36 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - 'rangecheck': 'RangeCheck', - 'queryinstrstatus': 'QueryInstrStatus', - 'cache': 'Cache', - 'simulate': 'Simulate', - 'recordcoercions': 'RecordCoercions', - 'interchangecheck': 'InterchangeCheck', - 'driversetup': 'DriverSetup', - 'range_check': 'RangeCheck', - 'query_instr_status': 'QueryInstrStatus', - 'record_coercions': 'RecordCoercions', - 'interchange_check': 'InterchangeCheck', - 'driver_setup': 'DriverSetup', + "rangecheck": "RangeCheck", + "queryinstrstatus": "QueryInstrStatus", + "cache": "Cache", + "simulate": "Simulate", + "recordcoercions": "RecordCoercions", + "interchangecheck": "InterchangeCheck", + "driversetup": "DriverSetup", + "range_check": "RangeCheck", + "query_instr_status": "QueryInstrStatus", + "record_coercions": "RecordCoercions", + "interchange_check": "InterchangeCheck", + "driver_setup": "DriverSetup", } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': - value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') - elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': + if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": + value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") + elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": if not isinstance(values[k], dict): - raise TypeError('DriverSetup must be a dictionary') - value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) + raise TypeError("DriverSetup must be a dictionary") + value = "DriverSetup=" + ( + ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) + ) else: - value = k + ('=1' if values[k] is True else '=0') + value = k + ("=1" if values[k] is True else "=0") init_with_options.append(value) - init_with_options_string = ','.join(init_with_options) + init_with_options_string = ",".join(init_with_options) return init_with_options_string @@ -251,11 +270,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(',')] + return [x.strip() for x in comma_separated_string.split(",")] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -267,16 +286,22 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - ''' - chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) - repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] + """ + chained_repeated_capability_items = convert_comma_separated_string_to_list( + chained_repeated_capability + ) + repeated_capability_lists = [ + [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) + ] for item in chained_repeated_capability_items: - repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] - return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] + repeated_capability_lists = [ + x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) + ] + return [ + ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists + ] # nifake specific converter(s) - used only for testing def convert_double_each_element(numbers): return [x * 2 for x in numbers] - - diff --git a/generated/nifake/nifake/_library.py b/generated/nifake/nifake/_library.py index 293ea9d04..1b2df9b00 100644 --- a/generated/nifake/nifake/_library.py +++ b/generated/nifake/nifake/_library.py @@ -11,11 +11,11 @@ class Library(object): - '''Library + """Library Wrapper around driver library. Class will setup the correct ctypes information for every function on first call. - ''' + """ def __init__(self, ctypes_library): self._func_lock = threading.Lock() @@ -91,7 +91,7 @@ def _get_library_function(self, name): def niFake_Abort(self, vi): # noqa: N802 with self._func_lock: if self.niFake_Abort_cfunc is None: - self.niFake_Abort_cfunc = self._get_library_function('niFake_Abort') + self.niFake_Abort_cfunc = self._get_library_function("niFake_Abort") self.niFake_Abort_cfunc.argtypes = [ViSession] # noqa: F405 self.niFake_Abort_cfunc.restype = ViStatus # noqa: F405 return self.niFake_Abort_cfunc(vi) @@ -99,247 +99,525 @@ def niFake_Abort(self, vi): # noqa: N802 def niFake_AcceptListOfDurationsInSeconds(self, vi, count, delays): # noqa: N802 with self._func_lock: if self.niFake_AcceptListOfDurationsInSeconds_cfunc is None: - self.niFake_AcceptListOfDurationsInSeconds_cfunc = self._get_library_function('niFake_AcceptListOfDurationsInSeconds') - self.niFake_AcceptListOfDurationsInSeconds_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 - self.niFake_AcceptListOfDurationsInSeconds_cfunc.restype = ViStatus # noqa: F405 + self.niFake_AcceptListOfDurationsInSeconds_cfunc = ( + self._get_library_function("niFake_AcceptListOfDurationsInSeconds") + ) + self.niFake_AcceptListOfDurationsInSeconds_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViReal64), + ] # noqa: F405 + self.niFake_AcceptListOfDurationsInSeconds_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niFake_AcceptListOfDurationsInSeconds_cfunc(vi, count, delays) - def niFake_BoolArrayOutputFunction(self, vi, number_of_elements, an_array): # noqa: N802 + def niFake_BoolArrayOutputFunction( + self, vi, number_of_elements, an_array + ): # noqa: N802 with self._func_lock: if self.niFake_BoolArrayOutputFunction_cfunc is None: - self.niFake_BoolArrayOutputFunction_cfunc = self._get_library_function('niFake_BoolArrayOutputFunction') - self.niFake_BoolArrayOutputFunction_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViBoolean)] # noqa: F405 - self.niFake_BoolArrayOutputFunction_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_BoolArrayOutputFunction_cfunc(vi, number_of_elements, an_array) + self.niFake_BoolArrayOutputFunction_cfunc = self._get_library_function( + "niFake_BoolArrayOutputFunction" + ) + self.niFake_BoolArrayOutputFunction_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 + self.niFake_BoolArrayOutputFunction_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFake_BoolArrayOutputFunction_cfunc( + vi, number_of_elements, an_array + ) def niFake_DoubleAllTheNums(self, vi, number_count, numbers): # noqa: N802 with self._func_lock: if self.niFake_DoubleAllTheNums_cfunc is None: - self.niFake_DoubleAllTheNums_cfunc = self._get_library_function('niFake_DoubleAllTheNums') - self.niFake_DoubleAllTheNums_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niFake_DoubleAllTheNums_cfunc = self._get_library_function( + "niFake_DoubleAllTheNums" + ) + self.niFake_DoubleAllTheNums_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niFake_DoubleAllTheNums_cfunc.restype = ViStatus # noqa: F405 return self.niFake_DoubleAllTheNums_cfunc(vi, number_count, numbers) - def niFake_EnumArrayOutputFunction(self, vi, number_of_elements, an_array): # noqa: N802 + def niFake_EnumArrayOutputFunction( + self, vi, number_of_elements, an_array + ): # noqa: N802 with self._func_lock: if self.niFake_EnumArrayOutputFunction_cfunc is None: - self.niFake_EnumArrayOutputFunction_cfunc = self._get_library_function('niFake_EnumArrayOutputFunction') - self.niFake_EnumArrayOutputFunction_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt16)] # noqa: F405 - self.niFake_EnumArrayOutputFunction_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_EnumArrayOutputFunction_cfunc(vi, number_of_elements, an_array) + self.niFake_EnumArrayOutputFunction_cfunc = self._get_library_function( + "niFake_EnumArrayOutputFunction" + ) + self.niFake_EnumArrayOutputFunction_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViInt16), + ] # noqa: F405 + self.niFake_EnumArrayOutputFunction_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFake_EnumArrayOutputFunction_cfunc( + vi, number_of_elements, an_array + ) def niFake_EnumInputFunctionWithDefaults(self, vi, a_turtle): # noqa: N802 with self._func_lock: if self.niFake_EnumInputFunctionWithDefaults_cfunc is None: - self.niFake_EnumInputFunctionWithDefaults_cfunc = self._get_library_function('niFake_EnumInputFunctionWithDefaults') - self.niFake_EnumInputFunctionWithDefaults_cfunc.argtypes = [ViSession, ViInt16] # noqa: F405 - self.niFake_EnumInputFunctionWithDefaults_cfunc.restype = ViStatus # noqa: F405 + self.niFake_EnumInputFunctionWithDefaults_cfunc = ( + self._get_library_function("niFake_EnumInputFunctionWithDefaults") + ) + self.niFake_EnumInputFunctionWithDefaults_cfunc.argtypes = [ + ViSession, + ViInt16, + ] # noqa: F405 + self.niFake_EnumInputFunctionWithDefaults_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niFake_EnumInputFunctionWithDefaults_cfunc(vi, a_turtle) - def niFake_ExportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 + def niFake_ExportAttributeConfigurationBuffer( + self, vi, size_in_bytes, configuration + ): # noqa: N802 with self._func_lock: if self.niFake_ExportAttributeConfigurationBuffer_cfunc is None: - self.niFake_ExportAttributeConfigurationBuffer_cfunc = self._get_library_function('niFake_ExportAttributeConfigurationBuffer') - self.niFake_ExportAttributeConfigurationBuffer_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt8)] # noqa: F405 - self.niFake_ExportAttributeConfigurationBuffer_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_ExportAttributeConfigurationBuffer_cfunc(vi, size_in_bytes, configuration) - - def niFake_FetchWaveform(self, vi, number_of_samples, waveform_data, actual_number_of_samples): # noqa: N802 + self.niFake_ExportAttributeConfigurationBuffer_cfunc = ( + self._get_library_function( + "niFake_ExportAttributeConfigurationBuffer" + ) + ) + self.niFake_ExportAttributeConfigurationBuffer_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViInt8), + ] # noqa: F405 + self.niFake_ExportAttributeConfigurationBuffer_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFake_ExportAttributeConfigurationBuffer_cfunc( + vi, size_in_bytes, configuration + ) + + def niFake_FetchWaveform( + self, vi, number_of_samples, waveform_data, actual_number_of_samples + ): # noqa: N802 with self._func_lock: if self.niFake_FetchWaveform_cfunc is None: - self.niFake_FetchWaveform_cfunc = self._get_library_function('niFake_FetchWaveform') - self.niFake_FetchWaveform_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niFake_FetchWaveform_cfunc = self._get_library_function( + "niFake_FetchWaveform" + ) + self.niFake_FetchWaveform_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niFake_FetchWaveform_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_FetchWaveform_cfunc(vi, number_of_samples, waveform_data, actual_number_of_samples) + return self.niFake_FetchWaveform_cfunc( + vi, number_of_samples, waveform_data, actual_number_of_samples + ) def niFake_GetABoolean(self, vi, a_boolean): # noqa: N802 with self._func_lock: if self.niFake_GetABoolean_cfunc is None: - self.niFake_GetABoolean_cfunc = self._get_library_function('niFake_GetABoolean') - self.niFake_GetABoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niFake_GetABoolean_cfunc = self._get_library_function( + "niFake_GetABoolean" + ) + self.niFake_GetABoolean_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niFake_GetABoolean_cfunc.restype = ViStatus # noqa: F405 return self.niFake_GetABoolean_cfunc(vi, a_boolean) def niFake_GetANumber(self, vi, a_number): # noqa: N802 with self._func_lock: if self.niFake_GetANumber_cfunc is None: - self.niFake_GetANumber_cfunc = self._get_library_function('niFake_GetANumber') - self.niFake_GetANumber_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt16)] # noqa: F405 + self.niFake_GetANumber_cfunc = self._get_library_function( + "niFake_GetANumber" + ) + self.niFake_GetANumber_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt16), + ] # noqa: F405 self.niFake_GetANumber_cfunc.restype = ViStatus # noqa: F405 return self.niFake_GetANumber_cfunc(vi, a_number) def niFake_GetAStringOfFixedMaximumSize(self, vi, a_string): # noqa: N802 with self._func_lock: if self.niFake_GetAStringOfFixedMaximumSize_cfunc is None: - self.niFake_GetAStringOfFixedMaximumSize_cfunc = self._get_library_function('niFake_GetAStringOfFixedMaximumSize') - self.niFake_GetAStringOfFixedMaximumSize_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 - self.niFake_GetAStringOfFixedMaximumSize_cfunc.restype = ViStatus # noqa: F405 + self.niFake_GetAStringOfFixedMaximumSize_cfunc = ( + self._get_library_function("niFake_GetAStringOfFixedMaximumSize") + ) + self.niFake_GetAStringOfFixedMaximumSize_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niFake_GetAStringOfFixedMaximumSize_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niFake_GetAStringOfFixedMaximumSize_cfunc(vi, a_string) def niFake_GetAStringUsingPythonCode(self, vi, a_number, a_string): # noqa: N802 with self._func_lock: if self.niFake_GetAStringUsingPythonCode_cfunc is None: - self.niFake_GetAStringUsingPythonCode_cfunc = self._get_library_function('niFake_GetAStringUsingPythonCode') - self.niFake_GetAStringUsingPythonCode_cfunc.argtypes = [ViSession, ViInt16, ctypes.POINTER(ViChar)] # noqa: F405 - self.niFake_GetAStringUsingPythonCode_cfunc.restype = ViStatus # noqa: F405 + self.niFake_GetAStringUsingPythonCode_cfunc = ( + self._get_library_function("niFake_GetAStringUsingPythonCode") + ) + self.niFake_GetAStringUsingPythonCode_cfunc.argtypes = [ + ViSession, + ViInt16, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niFake_GetAStringUsingPythonCode_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niFake_GetAStringUsingPythonCode_cfunc(vi, a_number, a_string) def niFake_GetAnIviDanceString(self, vi, buffer_size, a_string): # noqa: N802 with self._func_lock: if self.niFake_GetAnIviDanceString_cfunc is None: - self.niFake_GetAnIviDanceString_cfunc = self._get_library_function('niFake_GetAnIviDanceString') - self.niFake_GetAnIviDanceString_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niFake_GetAnIviDanceString_cfunc = self._get_library_function( + "niFake_GetAnIviDanceString" + ) + self.niFake_GetAnIviDanceString_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niFake_GetAnIviDanceString_cfunc.restype = ViStatus # noqa: F405 return self.niFake_GetAnIviDanceString_cfunc(vi, buffer_size, a_string) - def niFake_GetAnIviDanceWithATwistString(self, vi, buffer_size, a_string, actual_size): # noqa: N802 + def niFake_GetAnIviDanceWithATwistString( + self, vi, buffer_size, a_string, actual_size + ): # noqa: N802 with self._func_lock: if self.niFake_GetAnIviDanceWithATwistString_cfunc is None: - self.niFake_GetAnIviDanceWithATwistString_cfunc = self._get_library_function('niFake_GetAnIviDanceWithATwistString') - self.niFake_GetAnIviDanceWithATwistString_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32)] # noqa: F405 - self.niFake_GetAnIviDanceWithATwistString_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_GetAnIviDanceWithATwistString_cfunc(vi, buffer_size, a_string, actual_size) - - def niFake_GetArrayForPythonCodeCustomType(self, vi, number_of_elements, array_out): # noqa: N802 + self.niFake_GetAnIviDanceWithATwistString_cfunc = ( + self._get_library_function("niFake_GetAnIviDanceWithATwistString") + ) + self.niFake_GetAnIviDanceWithATwistString_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niFake_GetAnIviDanceWithATwistString_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFake_GetAnIviDanceWithATwistString_cfunc( + vi, buffer_size, a_string, actual_size + ) + + def niFake_GetArrayForPythonCodeCustomType( + self, vi, number_of_elements, array_out + ): # noqa: N802 with self._func_lock: if self.niFake_GetArrayForPythonCodeCustomType_cfunc is None: - self.niFake_GetArrayForPythonCodeCustomType_cfunc = self._get_library_function('niFake_GetArrayForPythonCodeCustomType') - self.niFake_GetArrayForPythonCodeCustomType_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(custom_struct.struct_CustomStruct)] # noqa: F405 - self.niFake_GetArrayForPythonCodeCustomType_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_GetArrayForPythonCodeCustomType_cfunc(vi, number_of_elements, array_out) - - def niFake_GetArrayForPythonCodeDouble(self, vi, number_of_elements, array_out): # noqa: N802 + self.niFake_GetArrayForPythonCodeCustomType_cfunc = ( + self._get_library_function("niFake_GetArrayForPythonCodeCustomType") + ) + self.niFake_GetArrayForPythonCodeCustomType_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(custom_struct.struct_CustomStruct), + ] # noqa: F405 + self.niFake_GetArrayForPythonCodeCustomType_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFake_GetArrayForPythonCodeCustomType_cfunc( + vi, number_of_elements, array_out + ) + + def niFake_GetArrayForPythonCodeDouble( + self, vi, number_of_elements, array_out + ): # noqa: N802 with self._func_lock: if self.niFake_GetArrayForPythonCodeDouble_cfunc is None: - self.niFake_GetArrayForPythonCodeDouble_cfunc = self._get_library_function('niFake_GetArrayForPythonCodeDouble') - self.niFake_GetArrayForPythonCodeDouble_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 - self.niFake_GetArrayForPythonCodeDouble_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_GetArrayForPythonCodeDouble_cfunc(vi, number_of_elements, array_out) + self.niFake_GetArrayForPythonCodeDouble_cfunc = ( + self._get_library_function("niFake_GetArrayForPythonCodeDouble") + ) + self.niFake_GetArrayForPythonCodeDouble_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViReal64), + ] # noqa: F405 + self.niFake_GetArrayForPythonCodeDouble_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFake_GetArrayForPythonCodeDouble_cfunc( + vi, number_of_elements, array_out + ) def niFake_GetArraySizeForPythonCode(self, vi, size_out): # noqa: N802 with self._func_lock: if self.niFake_GetArraySizeForPythonCode_cfunc is None: - self.niFake_GetArraySizeForPythonCode_cfunc = self._get_library_function('niFake_GetArraySizeForPythonCode') - self.niFake_GetArraySizeForPythonCode_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32)] # noqa: F405 - self.niFake_GetArraySizeForPythonCode_cfunc.restype = ViStatus # noqa: F405 + self.niFake_GetArraySizeForPythonCode_cfunc = ( + self._get_library_function("niFake_GetArraySizeForPythonCode") + ) + self.niFake_GetArraySizeForPythonCode_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niFake_GetArraySizeForPythonCode_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niFake_GetArraySizeForPythonCode_cfunc(vi, size_out) def niFake_GetArrayUsingIviDance(self, vi, array_size, array_out): # noqa: N802 with self._func_lock: if self.niFake_GetArrayUsingIviDance_cfunc is None: - self.niFake_GetArrayUsingIviDance_cfunc = self._get_library_function('niFake_GetArrayUsingIviDance') - self.niFake_GetArrayUsingIviDance_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niFake_GetArrayUsingIviDance_cfunc = self._get_library_function( + "niFake_GetArrayUsingIviDance" + ) + self.niFake_GetArrayUsingIviDance_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niFake_GetArrayUsingIviDance_cfunc.restype = ViStatus # noqa: F405 return self.niFake_GetArrayUsingIviDance_cfunc(vi, array_size, array_out) - def niFake_GetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niFake_GetAttributeViBoolean( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niFake_GetAttributeViBoolean_cfunc is None: - self.niFake_GetAttributeViBoolean_cfunc = self._get_library_function('niFake_GetAttributeViBoolean') - self.niFake_GetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niFake_GetAttributeViBoolean_cfunc = self._get_library_function( + "niFake_GetAttributeViBoolean" + ) + self.niFake_GetAttributeViBoolean_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niFake_GetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_GetAttributeViBoolean_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niFake_GetAttributeViBoolean_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niFake_GetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niFake_GetAttributeViInt32( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niFake_GetAttributeViInt32_cfunc is None: - self.niFake_GetAttributeViInt32_cfunc = self._get_library_function('niFake_GetAttributeViInt32') - self.niFake_GetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViInt32)] # noqa: F405 + self.niFake_GetAttributeViInt32_cfunc = self._get_library_function( + "niFake_GetAttributeViInt32" + ) + self.niFake_GetAttributeViInt32_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niFake_GetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_GetAttributeViInt32_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niFake_GetAttributeViInt32_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niFake_GetAttributeViInt64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niFake_GetAttributeViInt64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niFake_GetAttributeViInt64_cfunc is None: - self.niFake_GetAttributeViInt64_cfunc = self._get_library_function('niFake_GetAttributeViInt64') - self.niFake_GetAttributeViInt64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViInt64)] # noqa: F405 + self.niFake_GetAttributeViInt64_cfunc = self._get_library_function( + "niFake_GetAttributeViInt64" + ) + self.niFake_GetAttributeViInt64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViInt64), + ] # noqa: F405 self.niFake_GetAttributeViInt64_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_GetAttributeViInt64_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niFake_GetAttributeViInt64_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niFake_GetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niFake_GetAttributeViReal64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niFake_GetAttributeViReal64_cfunc is None: - self.niFake_GetAttributeViReal64_cfunc = self._get_library_function('niFake_GetAttributeViReal64') - self.niFake_GetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niFake_GetAttributeViReal64_cfunc = self._get_library_function( + "niFake_GetAttributeViReal64" + ) + self.niFake_GetAttributeViReal64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niFake_GetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_GetAttributeViReal64_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niFake_GetAttributeViReal64_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niFake_GetAttributeViString(self, vi, channel_name, attribute_id, buffer_size, attribute_value): # noqa: N802 + def niFake_GetAttributeViString( + self, vi, channel_name, attribute_id, buffer_size, attribute_value + ): # noqa: N802 with self._func_lock: if self.niFake_GetAttributeViString_cfunc is None: - self.niFake_GetAttributeViString_cfunc = self._get_library_function('niFake_GetAttributeViString') - self.niFake_GetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niFake_GetAttributeViString_cfunc = self._get_library_function( + "niFake_GetAttributeViString" + ) + self.niFake_GetAttributeViString_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niFake_GetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_GetAttributeViString_cfunc(vi, channel_name, attribute_id, buffer_size, attribute_value) + return self.niFake_GetAttributeViString_cfunc( + vi, channel_name, attribute_id, buffer_size, attribute_value + ) - def niFake_GetCalDateAndTime(self, vi, cal_type, month, day, year, hour, minute): # noqa: N802 + def niFake_GetCalDateAndTime( + self, vi, cal_type, month, day, year, hour, minute + ): # noqa: N802 with self._func_lock: if self.niFake_GetCalDateAndTime_cfunc is None: - self.niFake_GetCalDateAndTime_cfunc = self._get_library_function('niFake_GetCalDateAndTime') - self.niFake_GetCalDateAndTime_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niFake_GetCalDateAndTime_cfunc = self._get_library_function( + "niFake_GetCalDateAndTime" + ) + self.niFake_GetCalDateAndTime_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niFake_GetCalDateAndTime_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_GetCalDateAndTime_cfunc(vi, cal_type, month, day, year, hour, minute) + return self.niFake_GetCalDateAndTime_cfunc( + vi, cal_type, month, day, year, hour, minute + ) def niFake_GetCalInterval(self, vi, months): # noqa: N802 with self._func_lock: if self.niFake_GetCalInterval_cfunc is None: - self.niFake_GetCalInterval_cfunc = self._get_library_function('niFake_GetCalInterval') - self.niFake_GetCalInterval_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32)] # noqa: F405 + self.niFake_GetCalInterval_cfunc = self._get_library_function( + "niFake_GetCalInterval" + ) + self.niFake_GetCalInterval_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niFake_GetCalInterval_cfunc.restype = ViStatus # noqa: F405 return self.niFake_GetCalInterval_cfunc(vi, months) def niFake_GetCustomType(self, vi, cs): # noqa: N802 with self._func_lock: if self.niFake_GetCustomType_cfunc is None: - self.niFake_GetCustomType_cfunc = self._get_library_function('niFake_GetCustomType') - self.niFake_GetCustomType_cfunc.argtypes = [ViSession, ctypes.POINTER(custom_struct.struct_CustomStruct)] # noqa: F405 + self.niFake_GetCustomType_cfunc = self._get_library_function( + "niFake_GetCustomType" + ) + self.niFake_GetCustomType_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(custom_struct.struct_CustomStruct), + ] # noqa: F405 self.niFake_GetCustomType_cfunc.restype = ViStatus # noqa: F405 return self.niFake_GetCustomType_cfunc(vi, cs) def niFake_GetCustomTypeArray(self, vi, number_of_elements, cs): # noqa: N802 with self._func_lock: if self.niFake_GetCustomTypeArray_cfunc is None: - self.niFake_GetCustomTypeArray_cfunc = self._get_library_function('niFake_GetCustomTypeArray') - self.niFake_GetCustomTypeArray_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(custom_struct.struct_CustomStruct)] # noqa: F405 + self.niFake_GetCustomTypeArray_cfunc = self._get_library_function( + "niFake_GetCustomTypeArray" + ) + self.niFake_GetCustomTypeArray_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(custom_struct.struct_CustomStruct), + ] # noqa: F405 self.niFake_GetCustomTypeArray_cfunc.restype = ViStatus # noqa: F405 return self.niFake_GetCustomTypeArray_cfunc(vi, number_of_elements, cs) def niFake_GetEnumValue(self, vi, a_quantity, a_turtle): # noqa: N802 with self._func_lock: if self.niFake_GetEnumValue_cfunc is None: - self.niFake_GetEnumValue_cfunc = self._get_library_function('niFake_GetEnumValue') - self.niFake_GetEnumValue_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt16)] # noqa: F405 + self.niFake_GetEnumValue_cfunc = self._get_library_function( + "niFake_GetEnumValue" + ) + self.niFake_GetEnumValue_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt16), + ] # noqa: F405 self.niFake_GetEnumValue_cfunc.restype = ViStatus # noqa: F405 return self.niFake_GetEnumValue_cfunc(vi, a_quantity, a_turtle) def niFake_GetError(self, vi, error_code, buffer_size, description): # noqa: N802 with self._func_lock: if self.niFake_GetError_cfunc is None: - self.niFake_GetError_cfunc = self._get_library_function('niFake_GetError') - self.niFake_GetError_cfunc.argtypes = [ViSession, ctypes.POINTER(ViStatus), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niFake_GetError_cfunc = self._get_library_function( + "niFake_GetError" + ) + self.niFake_GetError_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViStatus), + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niFake_GetError_cfunc.restype = ViStatus # noqa: F405 return self.niFake_GetError_cfunc(vi, error_code, buffer_size, description) - def niFake_ImportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 + def niFake_ImportAttributeConfigurationBuffer( + self, vi, size_in_bytes, configuration + ): # noqa: N802 with self._func_lock: if self.niFake_ImportAttributeConfigurationBuffer_cfunc is None: - self.niFake_ImportAttributeConfigurationBuffer_cfunc = self._get_library_function('niFake_ImportAttributeConfigurationBuffer') - self.niFake_ImportAttributeConfigurationBuffer_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt8)] # noqa: F405 - self.niFake_ImportAttributeConfigurationBuffer_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_ImportAttributeConfigurationBuffer_cfunc(vi, size_in_bytes, configuration) - - def niFake_InitWithOptions(self, resource_name, id_query, reset_device, option_string, vi): # noqa: N802 + self.niFake_ImportAttributeConfigurationBuffer_cfunc = ( + self._get_library_function( + "niFake_ImportAttributeConfigurationBuffer" + ) + ) + self.niFake_ImportAttributeConfigurationBuffer_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViInt8), + ] # noqa: F405 + self.niFake_ImportAttributeConfigurationBuffer_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFake_ImportAttributeConfigurationBuffer_cfunc( + vi, size_in_bytes, configuration + ) + + def niFake_InitWithOptions( + self, resource_name, id_query, reset_device, option_string, vi + ): # noqa: N802 with self._func_lock: if self.niFake_InitWithOptions_cfunc is None: - self.niFake_InitWithOptions_cfunc = self._get_library_function('niFake_InitWithOptions') - self.niFake_InitWithOptions_cfunc.argtypes = [ctypes.POINTER(ViChar), ViBoolean, ViBoolean, ctypes.POINTER(ViChar), ctypes.POINTER(ViSession)] # noqa: F405 + self.niFake_InitWithOptions_cfunc = self._get_library_function( + "niFake_InitWithOptions" + ) + self.niFake_InitWithOptions_cfunc.argtypes = [ + ctypes.POINTER(ViChar), + ViBoolean, + ViBoolean, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViSession), + ] # noqa: F405 self.niFake_InitWithOptions_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_InitWithOptions_cfunc(resource_name, id_query, reset_device, option_string, vi) + return self.niFake_InitWithOptions_cfunc( + resource_name, id_query, reset_device, option_string, vi + ) def niFake_Initiate(self, vi): # noqa: N802 with self._func_lock: if self.niFake_Initiate_cfunc is None: - self.niFake_Initiate_cfunc = self._get_library_function('niFake_Initiate') + self.niFake_Initiate_cfunc = self._get_library_function( + "niFake_Initiate" + ) self.niFake_Initiate_cfunc.argtypes = [ViSession] # noqa: F405 self.niFake_Initiate_cfunc.restype = ViStatus # noqa: F405 return self.niFake_Initiate_cfunc(vi) @@ -347,199 +625,475 @@ def niFake_Initiate(self, vi): # noqa: N802 def niFake_LockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niFake_LockSession_cfunc is None: - self.niFake_LockSession_cfunc = self._get_library_function('niFake_LockSession') - self.niFake_LockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niFake_LockSession_cfunc = self._get_library_function( + "niFake_LockSession" + ) + self.niFake_LockSession_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niFake_LockSession_cfunc.restype = ViStatus # noqa: F405 return self.niFake_LockSession_cfunc(vi, caller_has_lock) - def niFake_MultipleArrayTypes(self, vi, output_array_size, output_array, output_array_of_fixed_length, input_array_sizes, input_array_of_floats, input_array_of_integers): # noqa: N802 + def niFake_MultipleArrayTypes( + self, + vi, + output_array_size, + output_array, + output_array_of_fixed_length, + input_array_sizes, + input_array_of_floats, + input_array_of_integers, + ): # noqa: N802 with self._func_lock: if self.niFake_MultipleArrayTypes_cfunc is None: - self.niFake_MultipleArrayTypes_cfunc = self._get_library_function('niFake_MultipleArrayTypes') - self.niFake_MultipleArrayTypes_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt16)] # noqa: F405 + self.niFake_MultipleArrayTypes_cfunc = self._get_library_function( + "niFake_MultipleArrayTypes" + ) + self.niFake_MultipleArrayTypes_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViReal64), + ViInt32, + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViInt16), + ] # noqa: F405 self.niFake_MultipleArrayTypes_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_MultipleArrayTypes_cfunc(vi, output_array_size, output_array, output_array_of_fixed_length, input_array_sizes, input_array_of_floats, input_array_of_integers) - - def niFake_MultipleArraysSameSize(self, vi, values1, values2, values3, values4, size): # noqa: N802 + return self.niFake_MultipleArrayTypes_cfunc( + vi, + output_array_size, + output_array, + output_array_of_fixed_length, + input_array_sizes, + input_array_of_floats, + input_array_of_integers, + ) + + def niFake_MultipleArraysSameSize( + self, vi, values1, values2, values3, values4, size + ): # noqa: N802 with self._func_lock: if self.niFake_MultipleArraysSameSize_cfunc is None: - self.niFake_MultipleArraysSameSize_cfunc = self._get_library_function('niFake_MultipleArraysSameSize') - self.niFake_MultipleArraysSameSize_cfunc.argtypes = [ViSession, ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ViInt32] # noqa: F405 - self.niFake_MultipleArraysSameSize_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_MultipleArraysSameSize_cfunc(vi, values1, values2, values3, values4, size) + self.niFake_MultipleArraysSameSize_cfunc = self._get_library_function( + "niFake_MultipleArraysSameSize" + ) + self.niFake_MultipleArraysSameSize_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViReal64), + ViInt32, + ] # noqa: F405 + self.niFake_MultipleArraysSameSize_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFake_MultipleArraysSameSize_cfunc( + vi, values1, values2, values3, values4, size + ) def niFake_OneInputFunction(self, vi, a_number): # noqa: N802 with self._func_lock: if self.niFake_OneInputFunction_cfunc is None: - self.niFake_OneInputFunction_cfunc = self._get_library_function('niFake_OneInputFunction') - self.niFake_OneInputFunction_cfunc.argtypes = [ViSession, ViInt32] # noqa: F405 + self.niFake_OneInputFunction_cfunc = self._get_library_function( + "niFake_OneInputFunction" + ) + self.niFake_OneInputFunction_cfunc.argtypes = [ + ViSession, + ViInt32, + ] # noqa: F405 self.niFake_OneInputFunction_cfunc.restype = ViStatus # noqa: F405 return self.niFake_OneInputFunction_cfunc(vi, a_number) - def niFake_ParametersAreMultipleTypes(self, vi, a_boolean, an_int32, an_int64, an_int_enum, a_float, a_float_enum, string_size, a_string): # noqa: N802 + def niFake_ParametersAreMultipleTypes( + self, + vi, + a_boolean, + an_int32, + an_int64, + an_int_enum, + a_float, + a_float_enum, + string_size, + a_string, + ): # noqa: N802 with self._func_lock: if self.niFake_ParametersAreMultipleTypes_cfunc is None: - self.niFake_ParametersAreMultipleTypes_cfunc = self._get_library_function('niFake_ParametersAreMultipleTypes') - self.niFake_ParametersAreMultipleTypes_cfunc.argtypes = [ViSession, ViBoolean, ViInt32, ViInt64, ViInt16, ViReal64, ViReal64, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 - self.niFake_ParametersAreMultipleTypes_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_ParametersAreMultipleTypes_cfunc(vi, a_boolean, an_int32, an_int64, an_int_enum, a_float, a_float_enum, string_size, a_string) + self.niFake_ParametersAreMultipleTypes_cfunc = ( + self._get_library_function("niFake_ParametersAreMultipleTypes") + ) + self.niFake_ParametersAreMultipleTypes_cfunc.argtypes = [ + ViSession, + ViBoolean, + ViInt32, + ViInt64, + ViInt16, + ViReal64, + ViReal64, + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niFake_ParametersAreMultipleTypes_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFake_ParametersAreMultipleTypes_cfunc( + vi, + a_boolean, + an_int32, + an_int64, + an_int_enum, + a_float, + a_float_enum, + string_size, + a_string, + ) def niFake_PoorlyNamedSimpleFunction(self, vi): # noqa: N802 with self._func_lock: if self.niFake_PoorlyNamedSimpleFunction_cfunc is None: - self.niFake_PoorlyNamedSimpleFunction_cfunc = self._get_library_function('niFake_PoorlyNamedSimpleFunction') - self.niFake_PoorlyNamedSimpleFunction_cfunc.argtypes = [ViSession] # noqa: F405 - self.niFake_PoorlyNamedSimpleFunction_cfunc.restype = ViStatus # noqa: F405 + self.niFake_PoorlyNamedSimpleFunction_cfunc = ( + self._get_library_function("niFake_PoorlyNamedSimpleFunction") + ) + self.niFake_PoorlyNamedSimpleFunction_cfunc.argtypes = [ + ViSession + ] # noqa: F405 + self.niFake_PoorlyNamedSimpleFunction_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niFake_PoorlyNamedSimpleFunction_cfunc(vi) def niFake_Read(self, vi, maximum_time, reading): # noqa: N802 with self._func_lock: if self.niFake_Read_cfunc is None: - self.niFake_Read_cfunc = self._get_library_function('niFake_Read') - self.niFake_Read_cfunc.argtypes = [ViSession, ViReal64, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niFake_Read_cfunc = self._get_library_function("niFake_Read") + self.niFake_Read_cfunc.argtypes = [ + ViSession, + ViReal64, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niFake_Read_cfunc.restype = ViStatus # noqa: F405 return self.niFake_Read_cfunc(vi, maximum_time, reading) - def niFake_ReadFromChannel(self, vi, channel_name, maximum_time, reading): # noqa: N802 + def niFake_ReadFromChannel( + self, vi, channel_name, maximum_time, reading + ): # noqa: N802 with self._func_lock: if self.niFake_ReadFromChannel_cfunc is None: - self.niFake_ReadFromChannel_cfunc = self._get_library_function('niFake_ReadFromChannel') - self.niFake_ReadFromChannel_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niFake_ReadFromChannel_cfunc = self._get_library_function( + "niFake_ReadFromChannel" + ) + self.niFake_ReadFromChannel_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niFake_ReadFromChannel_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_ReadFromChannel_cfunc(vi, channel_name, maximum_time, reading) + return self.niFake_ReadFromChannel_cfunc( + vi, channel_name, maximum_time, reading + ) def niFake_ReturnANumberAndAString(self, vi, a_number, a_string): # noqa: N802 with self._func_lock: if self.niFake_ReturnANumberAndAString_cfunc is None: - self.niFake_ReturnANumberAndAString_cfunc = self._get_library_function('niFake_ReturnANumberAndAString') - self.niFake_ReturnANumberAndAString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt16), ctypes.POINTER(ViChar)] # noqa: F405 - self.niFake_ReturnANumberAndAString_cfunc.restype = ViStatus # noqa: F405 + self.niFake_ReturnANumberAndAString_cfunc = self._get_library_function( + "niFake_ReturnANumberAndAString" + ) + self.niFake_ReturnANumberAndAString_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt16), + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niFake_ReturnANumberAndAString_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niFake_ReturnANumberAndAString_cfunc(vi, a_number, a_string) def niFake_ReturnDurationInSeconds(self, vi, timedelta): # noqa: N802 with self._func_lock: if self.niFake_ReturnDurationInSeconds_cfunc is None: - self.niFake_ReturnDurationInSeconds_cfunc = self._get_library_function('niFake_ReturnDurationInSeconds') - self.niFake_ReturnDurationInSeconds_cfunc.argtypes = [ViSession, ctypes.POINTER(ViReal64)] # noqa: F405 - self.niFake_ReturnDurationInSeconds_cfunc.restype = ViStatus # noqa: F405 + self.niFake_ReturnDurationInSeconds_cfunc = self._get_library_function( + "niFake_ReturnDurationInSeconds" + ) + self.niFake_ReturnDurationInSeconds_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViReal64), + ] # noqa: F405 + self.niFake_ReturnDurationInSeconds_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niFake_ReturnDurationInSeconds_cfunc(vi, timedelta) - def niFake_ReturnListOfDurationsInSeconds(self, vi, number_of_elements, timedeltas): # noqa: N802 + def niFake_ReturnListOfDurationsInSeconds( + self, vi, number_of_elements, timedeltas + ): # noqa: N802 with self._func_lock: if self.niFake_ReturnListOfDurationsInSeconds_cfunc is None: - self.niFake_ReturnListOfDurationsInSeconds_cfunc = self._get_library_function('niFake_ReturnListOfDurationsInSeconds') - self.niFake_ReturnListOfDurationsInSeconds_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 - self.niFake_ReturnListOfDurationsInSeconds_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_ReturnListOfDurationsInSeconds_cfunc(vi, number_of_elements, timedeltas) - - def niFake_ReturnMultipleTypes(self, vi, a_boolean, an_int32, an_int64, an_int_enum, a_float, a_float_enum, array_size, an_array, string_size, a_string): # noqa: N802 + self.niFake_ReturnListOfDurationsInSeconds_cfunc = ( + self._get_library_function("niFake_ReturnListOfDurationsInSeconds") + ) + self.niFake_ReturnListOfDurationsInSeconds_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViReal64), + ] # noqa: F405 + self.niFake_ReturnListOfDurationsInSeconds_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFake_ReturnListOfDurationsInSeconds_cfunc( + vi, number_of_elements, timedeltas + ) + + def niFake_ReturnMultipleTypes( + self, + vi, + a_boolean, + an_int32, + an_int64, + an_int_enum, + a_float, + a_float_enum, + array_size, + an_array, + string_size, + a_string, + ): # noqa: N802 with self._func_lock: if self.niFake_ReturnMultipleTypes_cfunc is None: - self.niFake_ReturnMultipleTypes_cfunc = self._get_library_function('niFake_ReturnMultipleTypes') - self.niFake_ReturnMultipleTypes_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt64), ctypes.POINTER(ViInt16), ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ViInt32, ctypes.POINTER(ViReal64), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niFake_ReturnMultipleTypes_cfunc = self._get_library_function( + "niFake_ReturnMultipleTypes" + ) + self.niFake_ReturnMultipleTypes_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViBoolean), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt64), + ctypes.POINTER(ViInt16), + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViReal64), + ViInt32, + ctypes.POINTER(ViReal64), + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niFake_ReturnMultipleTypes_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_ReturnMultipleTypes_cfunc(vi, a_boolean, an_int32, an_int64, an_int_enum, a_float, a_float_enum, array_size, an_array, string_size, a_string) - - def niFake_SetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + return self.niFake_ReturnMultipleTypes_cfunc( + vi, + a_boolean, + an_int32, + an_int64, + an_int_enum, + a_float, + a_float_enum, + array_size, + an_array, + string_size, + a_string, + ) + + def niFake_SetAttributeViBoolean( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niFake_SetAttributeViBoolean_cfunc is None: - self.niFake_SetAttributeViBoolean_cfunc = self._get_library_function('niFake_SetAttributeViBoolean') - self.niFake_SetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViBoolean] # noqa: F405 + self.niFake_SetAttributeViBoolean_cfunc = self._get_library_function( + "niFake_SetAttributeViBoolean" + ) + self.niFake_SetAttributeViBoolean_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViBoolean, + ] # noqa: F405 self.niFake_SetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_SetAttributeViBoolean_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niFake_SetAttributeViBoolean_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niFake_SetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niFake_SetAttributeViInt32( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niFake_SetAttributeViInt32_cfunc is None: - self.niFake_SetAttributeViInt32_cfunc = self._get_library_function('niFake_SetAttributeViInt32') - self.niFake_SetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32] # noqa: F405 + self.niFake_SetAttributeViInt32_cfunc = self._get_library_function( + "niFake_SetAttributeViInt32" + ) + self.niFake_SetAttributeViInt32_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViInt32, + ] # noqa: F405 self.niFake_SetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_SetAttributeViInt32_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niFake_SetAttributeViInt32_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niFake_SetAttributeViInt64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niFake_SetAttributeViInt64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niFake_SetAttributeViInt64_cfunc is None: - self.niFake_SetAttributeViInt64_cfunc = self._get_library_function('niFake_SetAttributeViInt64') - self.niFake_SetAttributeViInt64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt64] # noqa: F405 + self.niFake_SetAttributeViInt64_cfunc = self._get_library_function( + "niFake_SetAttributeViInt64" + ) + self.niFake_SetAttributeViInt64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViInt64, + ] # noqa: F405 self.niFake_SetAttributeViInt64_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_SetAttributeViInt64_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niFake_SetAttributeViInt64_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niFake_SetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niFake_SetAttributeViReal64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niFake_SetAttributeViReal64_cfunc is None: - self.niFake_SetAttributeViReal64_cfunc = self._get_library_function('niFake_SetAttributeViReal64') - self.niFake_SetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViReal64] # noqa: F405 + self.niFake_SetAttributeViReal64_cfunc = self._get_library_function( + "niFake_SetAttributeViReal64" + ) + self.niFake_SetAttributeViReal64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViReal64, + ] # noqa: F405 self.niFake_SetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_SetAttributeViReal64_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niFake_SetAttributeViReal64_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niFake_SetAttributeViString(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niFake_SetAttributeViString( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niFake_SetAttributeViString_cfunc is None: - self.niFake_SetAttributeViString_cfunc = self._get_library_function('niFake_SetAttributeViString') - self.niFake_SetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViChar)] # noqa: F405 + self.niFake_SetAttributeViString_cfunc = self._get_library_function( + "niFake_SetAttributeViString" + ) + self.niFake_SetAttributeViString_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niFake_SetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_SetAttributeViString_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niFake_SetAttributeViString_cfunc( + vi, channel_name, attribute_id, attribute_value + ) def niFake_SetCustomType(self, vi, cs): # noqa: N802 with self._func_lock: if self.niFake_SetCustomType_cfunc is None: - self.niFake_SetCustomType_cfunc = self._get_library_function('niFake_SetCustomType') - self.niFake_SetCustomType_cfunc.argtypes = [ViSession, custom_struct.struct_CustomStruct] # noqa: F405 + self.niFake_SetCustomType_cfunc = self._get_library_function( + "niFake_SetCustomType" + ) + self.niFake_SetCustomType_cfunc.argtypes = [ + ViSession, + custom_struct.struct_CustomStruct, + ] # noqa: F405 self.niFake_SetCustomType_cfunc.restype = ViStatus # noqa: F405 return self.niFake_SetCustomType_cfunc(vi, cs) def niFake_SetCustomTypeArray(self, vi, number_of_elements, cs): # noqa: N802 with self._func_lock: if self.niFake_SetCustomTypeArray_cfunc is None: - self.niFake_SetCustomTypeArray_cfunc = self._get_library_function('niFake_SetCustomTypeArray') - self.niFake_SetCustomTypeArray_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(custom_struct.struct_CustomStruct)] # noqa: F405 + self.niFake_SetCustomTypeArray_cfunc = self._get_library_function( + "niFake_SetCustomTypeArray" + ) + self.niFake_SetCustomTypeArray_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(custom_struct.struct_CustomStruct), + ] # noqa: F405 self.niFake_SetCustomTypeArray_cfunc.restype = ViStatus # noqa: F405 return self.niFake_SetCustomTypeArray_cfunc(vi, number_of_elements, cs) - def niFake_StringValuedEnumInputFunctionWithDefaults(self, vi, a_mobile_os_name): # noqa: N802 + def niFake_StringValuedEnumInputFunctionWithDefaults( + self, vi, a_mobile_os_name + ): # noqa: N802 with self._func_lock: if self.niFake_StringValuedEnumInputFunctionWithDefaults_cfunc is None: - self.niFake_StringValuedEnumInputFunctionWithDefaults_cfunc = self._get_library_function('niFake_StringValuedEnumInputFunctionWithDefaults') - self.niFake_StringValuedEnumInputFunctionWithDefaults_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 - self.niFake_StringValuedEnumInputFunctionWithDefaults_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_StringValuedEnumInputFunctionWithDefaults_cfunc(vi, a_mobile_os_name) + self.niFake_StringValuedEnumInputFunctionWithDefaults_cfunc = ( + self._get_library_function( + "niFake_StringValuedEnumInputFunctionWithDefaults" + ) + ) + self.niFake_StringValuedEnumInputFunctionWithDefaults_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niFake_StringValuedEnumInputFunctionWithDefaults_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFake_StringValuedEnumInputFunctionWithDefaults_cfunc( + vi, a_mobile_os_name + ) def niFake_TwoInputFunction(self, vi, a_number, a_string): # noqa: N802 with self._func_lock: if self.niFake_TwoInputFunction_cfunc is None: - self.niFake_TwoInputFunction_cfunc = self._get_library_function('niFake_TwoInputFunction') - self.niFake_TwoInputFunction_cfunc.argtypes = [ViSession, ViReal64, ctypes.POINTER(ViChar)] # noqa: F405 + self.niFake_TwoInputFunction_cfunc = self._get_library_function( + "niFake_TwoInputFunction" + ) + self.niFake_TwoInputFunction_cfunc.argtypes = [ + ViSession, + ViReal64, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niFake_TwoInputFunction_cfunc.restype = ViStatus # noqa: F405 return self.niFake_TwoInputFunction_cfunc(vi, a_number, a_string) def niFake_UnlockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niFake_UnlockSession_cfunc is None: - self.niFake_UnlockSession_cfunc = self._get_library_function('niFake_UnlockSession') - self.niFake_UnlockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niFake_UnlockSession_cfunc = self._get_library_function( + "niFake_UnlockSession" + ) + self.niFake_UnlockSession_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niFake_UnlockSession_cfunc.restype = ViStatus # noqa: F405 return self.niFake_UnlockSession_cfunc(vi, caller_has_lock) def niFake_Use64BitNumber(self, vi, input, output): # noqa: N802 with self._func_lock: if self.niFake_Use64BitNumber_cfunc is None: - self.niFake_Use64BitNumber_cfunc = self._get_library_function('niFake_Use64BitNumber') - self.niFake_Use64BitNumber_cfunc.argtypes = [ViSession, ViInt64, ctypes.POINTER(ViInt64)] # noqa: F405 + self.niFake_Use64BitNumber_cfunc = self._get_library_function( + "niFake_Use64BitNumber" + ) + self.niFake_Use64BitNumber_cfunc.argtypes = [ + ViSession, + ViInt64, + ctypes.POINTER(ViInt64), + ] # noqa: F405 self.niFake_Use64BitNumber_cfunc.restype = ViStatus # noqa: F405 return self.niFake_Use64BitNumber_cfunc(vi, input, output) def niFake_WriteWaveform(self, vi, number_of_samples, waveform): # noqa: N802 with self._func_lock: if self.niFake_WriteWaveform_cfunc is None: - self.niFake_WriteWaveform_cfunc = self._get_library_function('niFake_WriteWaveform') - self.niFake_WriteWaveform_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niFake_WriteWaveform_cfunc = self._get_library_function( + "niFake_WriteWaveform" + ) + self.niFake_WriteWaveform_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niFake_WriteWaveform_cfunc.restype = ViStatus # noqa: F405 return self.niFake_WriteWaveform_cfunc(vi, number_of_samples, waveform) def niFake_close(self, vi): # noqa: N802 with self._func_lock: if self.niFake_close_cfunc is None: - self.niFake_close_cfunc = self._get_library_function('niFake_close') + self.niFake_close_cfunc = self._get_library_function("niFake_close") self.niFake_close_cfunc.argtypes = [ViSession] # noqa: F405 self.niFake_close_cfunc.restype = ViStatus # noqa: F405 return self.niFake_close_cfunc(vi) @@ -547,15 +1101,27 @@ def niFake_close(self, vi): # noqa: N802 def niFake_error_message(self, vi, error_code, error_message): # noqa: N802 with self._func_lock: if self.niFake_error_message_cfunc is None: - self.niFake_error_message_cfunc = self._get_library_function('niFake_error_message') - self.niFake_error_message_cfunc.argtypes = [ViSession, ViStatus, ctypes.POINTER(ViChar)] # noqa: F405 + self.niFake_error_message_cfunc = self._get_library_function( + "niFake_error_message" + ) + self.niFake_error_message_cfunc.argtypes = [ + ViSession, + ViStatus, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niFake_error_message_cfunc.restype = ViStatus # noqa: F405 return self.niFake_error_message_cfunc(vi, error_code, error_message) def niFake_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 with self._func_lock: if self.niFake_self_test_cfunc is None: - self.niFake_self_test_cfunc = self._get_library_function('niFake_self_test') - self.niFake_self_test_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt16), ctypes.POINTER(ViChar)] # noqa: F405 + self.niFake_self_test_cfunc = self._get_library_function( + "niFake_self_test" + ) + self.niFake_self_test_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt16), + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niFake_self_test_cfunc.restype = ViStatus # noqa: F405 return self.niFake_self_test_cfunc(vi, self_test_result, self_test_message) diff --git a/generated/nifake/nifake/_library_singleton.py b/generated/nifake/nifake/_library_singleton.py index f8353e299..090defcf4 100644 --- a/generated/nifake/nifake/_library_singleton.py +++ b/generated/nifake/nifake/_library_singleton.py @@ -12,30 +12,36 @@ _instance = None _instance_lock = threading.Lock() -_library_info = {'Linux': {'64bit': {'name': 'nifake', 'type': 'cdll'}}, - 'Windows': {'32bit': {'name': 'nifake_32.dll', 'type': 'windll'}, - '64bit': {'name': 'nifake_64.dll', 'type': 'cdll'}}} +_library_info = { + "Linux": {"64bit": {"name": "nifake", "type": "cdll"}}, + "Windows": { + "32bit": {"name": "nifake_32.dll", "type": "windll"}, + "64bit": {"name": "nifake_64.dll", "type": "cdll"}, + }, +} def _get_library_name(): try: - return ctypes.util.find_library(_library_info[platform.system()][platform.architecture()[0]]['name']) # We find and return full path to the DLL + return ctypes.util.find_library( + _library_info[platform.system()][platform.architecture()[0]]["name"] + ) # We find and return full path to the DLL except KeyError: raise errors.UnsupportedConfigurationError def _get_library_type(): try: - return _library_info[platform.system()][platform.architecture()[0]]['type'] + return _library_info[platform.system()][platform.architecture()[0]]["type"] except KeyError: raise errors.UnsupportedConfigurationError def get(): - '''get + """get Returns the library.Library singleton for nifake. - ''' + """ global _instance global _instance_lock @@ -43,13 +49,12 @@ def get(): if _instance is None: try: library_type = _get_library_type() - if library_type == 'windll': + if library_type == "windll": ctypes_library = ctypes.WinDLL(_get_library_name()) else: - assert library_type == 'cdll' + assert library_type == "cdll" ctypes_library = ctypes.CDLL(_get_library_name()) except OSError: raise errors.DriverNotInstalledError() _instance = _library.Library(ctypes_library) return _instance - diff --git a/generated/nifake/nifake/_visatype.py b/generated/nifake/nifake/_visatype.py index 02cc41d1b..bf96c3cfb 100644 --- a/generated/nifake/nifake/_visatype.py +++ b/generated/nifake/nifake/_visatype.py @@ -2,9 +2,9 @@ import ctypes -'''Definitions of the VISA types used by the C API of the driver runtime. +"""Definitions of the VISA types used by the C API of the driver runtime. These are aliased directly to ctypes types so can be used directly to call into the library. -''' +""" ViChar = ctypes.c_char @@ -26,4 +26,3 @@ ViAttr = ViUInt32 ViConstString = ViString ViRsrc = ViString - diff --git a/generated/nifake/nifake/custom_struct.py b/generated/nifake/nifake/custom_struct.py index 0778036fb..90fb0fb24 100644 --- a/generated/nifake/nifake/custom_struct.py +++ b/generated/nifake/nifake/custom_struct.py @@ -8,8 +8,8 @@ # Name must match exactly what the name of the structure type is named in the C API. class struct_CustomStruct(ctypes.Structure): # noqa N801 _fields_ = [ - ('struct_int', nifake._visatype.ViInt32), - ('struct_double', nifake._visatype.ViReal64), + ("struct_int", nifake._visatype.ViInt32), + ("struct_double", nifake._visatype.ViReal64), ] def __init__(self, data=None, struct_int=0, struct_double=0.0): @@ -22,7 +22,9 @@ def __init__(self, data=None, struct_int=0, struct_double=0.0): self.struct_double = struct_double def __repr__(self): - return '{0}(data=None, struct_int={1}, struct_double={2})'.format(self.__class__.__name__, self.struct_int, self.struct_double) + return "{0}(data=None, struct_int={1}, struct_double={2})".format( + self.__class__.__name__, self.struct_int, self.struct_double + ) def __str__(self): return self.__repr__() @@ -38,9 +40,9 @@ def __init__(self, data=None, struct_int=0, struct_double=0.0): self.struct_double = struct_double def __repr__(self): - return '{0}(data=None, struct_int={1}, struct_double={2})'.format(self.__class__.__name__, self.struct_int, self.struct_double) + return "{0}(data=None, struct_int={1}, struct_double={2})".format( + self.__class__.__name__, self.struct_int, self.struct_double + ) def __str__(self): return self.__repr__() - - diff --git a/generated/nifake/nifake/enums.py b/generated/nifake/nifake/enums.py index 7414d6ca2..e23e70b21 100644 --- a/generated/nifake/nifake/enums.py +++ b/generated/nifake/nifake/enums.py @@ -6,75 +6,75 @@ class Color(Enum): RED = 1 - r''' + r""" Like blood. - ''' + """ BLUE = 2 - r''' + r""" Like the sky. - ''' + """ YELLOW = 5 - r''' + r""" Like a banana. - ''' + """ BLACK = 42 - r''' + r""" Like this developer's conscience. - ''' + """ class FloatEnum(Enum): THREE_POINT_FIVE = 3.5 - r''' + r""" Specifies 3.5 digits resolution. - ''' + """ FOUR_POINT_FIVE = 4.5 - r''' + r""" Specifies 4.5 digits resolution. - ''' + """ FIVE_POINT_FIVE = 5.5 - r''' + r""" Specifies 5.5 digits resolution. - ''' + """ SIX_POINT_FIVE = 6.5 - r''' + r""" Specifies 6.5 digits resolution. - ''' + """ SEVEN_POINT_FIVE = 7.5 - r''' + r""" Specifies 7.5 digits resolution. - ''' + """ class MobileOSNames(Enum): - ANDROID = 'Android' - r''' + ANDROID = "Android" + r""" Most popular OS. - ''' - IOS = 'iOS' - r''' + """ + IOS = "iOS" + r""" Most secure OS. - ''' - NONE = 'None' - r''' + """ + NONE = "None" + r""" Remember Symbian?. - ''' + """ class Turtle(Enum): LEONARDO = 0 - r''' + r""" Wields two katanas. - ''' + """ DONATELLO = 1 - r''' + r""" Uses a bo staff. - ''' + """ RAPHAEL = 2 - r''' + r""" Has a pair of sai. - ''' + """ MICHELANGELO = 3 - r''' + r""" Owns nunchucks. - ''' + """ diff --git a/generated/nifake/nifake/errors.py b/generated/nifake/nifake/errors.py index df501045f..a3ddf4472 100644 --- a/generated/nifake/nifake/errors.py +++ b/generated/nifake/nifake/errors.py @@ -7,86 +7,103 @@ def _is_success(code): - return (code == 0) + return code == 0 def _is_error(code): - return (code < 0) + return code < 0 def _is_warning(code): - return (code > 0) + return code > 0 class Error(Exception): - '''Base error class for NI-FAKE''' + """Base error class for NI-FAKE""" def __init__(self, message): super(Error, self).__init__(message) class DriverError(Error): - '''An error originating from the NI-FAKE driver''' + """An error originating from the NI-FAKE driver""" def __init__(self, code, description): - assert (_is_error(code)), "Should not raise Error if code is not fatal." + assert _is_error(code), "Should not raise Error if code is not fatal." self.code = code self.description = description super(DriverError, self).__init__(str(self.code) + ": " + self.description) class DriverWarning(Warning): - '''A warning originating from the NI-FAKE driver''' + """A warning originating from the NI-FAKE driver""" def __init__(self, code, description): - assert (_is_warning(code)), "Should not create Warning if code is not positive." - super(DriverWarning, self).__init__('Warning {0} occurred.\n\n{1}'.format(code, description)) + assert _is_warning(code), "Should not create Warning if code is not positive." + super(DriverWarning, self).__init__( + "Warning {0} occurred.\n\n{1}".format(code, description) + ) class UnsupportedConfigurationError(Error): - '''An error due to using this module in an usupported platform.''' + """An error due to using this module in an usupported platform.""" def __init__(self): - super(UnsupportedConfigurationError, self).__init__('System configuration is unsupported: ' + platform.architecture()[0] + ' ' + platform.system()) + super(UnsupportedConfigurationError, self).__init__( + "System configuration is unsupported: " + + platform.architecture()[0] + + " " + + platform.system() + ) class DriverNotInstalledError(Error): - '''An error due to using this module without the driver runtime installed.''' + """An error due to using this module without the driver runtime installed.""" def __init__(self): - super(DriverNotInstalledError, self).__init__('The NI-FAKE runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it.') + super(DriverNotInstalledError, self).__init__( + "The NI-FAKE runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it." + ) class DriverTooOldError(Error): - '''An error due to using this module with an older version of the driver runtime.''' + """An error due to using this module with an older version of the driver runtime.""" def __init__(self): - super(DriverTooOldError, self).__init__('A function was not found in the NI-FAKE runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it.') + super(DriverTooOldError, self).__init__( + "A function was not found in the NI-FAKE runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it." + ) class InvalidRepeatedCapabilityError(Error): - '''An error due to an invalid character in a repeated capability''' + """An error due to an invalid character in a repeated capability""" def __init__(self, invalid_character, invalid_string): - super(InvalidRepeatedCapabilityError, self).__init__('An invalid character ({0}) was found in repeated capability string ({1})'.format(invalid_character, invalid_string)) + super(InvalidRepeatedCapabilityError, self).__init__( + "An invalid character ({0}) was found in repeated capability string ({1})".format( + invalid_character, invalid_string + ) + ) class SelfTestError(Error): - '''An error due to a failed self-test''' + """An error due to a failed self-test""" def __init__(self, code, msg): self.code = code self.message = msg - super(SelfTestError, self).__init__('Self-test failed with code {0}: {1}'.format(code, msg)) + super(SelfTestError, self).__init__( + "Self-test failed with code {0}: {1}".format(code, msg) + ) def handle_error(session, code, ignore_warnings, is_error_handling): - '''handle_error + """handle_error Helper function for handling errors returned by nifake.Library. It calls back into the session to get the corresponding error description and raises if necessary. - ''' + """ if _is_success(code) or (_is_warning(code) and ignore_warnings): return @@ -94,7 +111,7 @@ def handle_error(session, code, ignore_warnings, is_error_handling): if is_error_handling: # The caller is in the midst of error handling and an error occurred. # Don't try to get the description or we'll start recursing until the stack overflows. - description = '' + description = "" else: description = session._get_error_description(code) @@ -103,5 +120,3 @@ def handle_error(session, code, ignore_warnings, is_error_handling): assert _is_warning(code) warnings.warn(DriverWarning(code, description)) - - diff --git a/generated/nifake/nifake/session.py b/generated/nifake/nifake/session.py index cc1e5c0ea..d75af960d 100644 --- a/generated/nifake/nifake/session.py +++ b/generated/nifake/nifake/session.py @@ -2,6 +2,7 @@ # This file was generated import array # noqa: F401 import ctypes + # Used by @ivi_synchronized from functools import wraps @@ -19,22 +20,24 @@ # Used for __repr__ import pprint + pp = pprint.PrettyPrinter(indent=4) # Helper functions for creating ctypes needed for calling into the driver DLL def get_ctypes_pointer_for_buffer(value=None, library_type=None, size=None): if isinstance(value, array.array): - assert library_type is not None, 'library_type is required for array.array' + assert library_type is not None, "library_type is required for array.array" addr, _ = value.buffer_info() return ctypes.cast(addr, ctypes.POINTER(library_type)) elif str(type(value)).find("'numpy.ndarray'") != -1: import numpy + return numpy.ctypeslib.as_ctypes(value) elif isinstance(value, bytes): return ctypes.cast(value, ctypes.POINTER(library_type)) elif isinstance(value, list): - assert library_type is not None, 'library_type is required for list' + assert library_type is not None, "library_type is required for list" return (library_type * len(value))(*value) else: if library_type is not None and size is not None: @@ -74,6 +77,7 @@ def aux(*xs, **kws): session = xs[0] # parameter 0 is 'self' which is the session object with session.lock(): return f(*xs, **kws) + return aux @@ -94,16 +98,34 @@ def __init__(self, session, prefix, current_repeated_capability_list): self._session = session self._prefix = prefix # We need at least one element. If we get an empty list, make the one element an empty string - self._current_repeated_capability_list = current_repeated_capability_list if len(current_repeated_capability_list) > 0 else [''] + self._current_repeated_capability_list = ( + current_repeated_capability_list + if len(current_repeated_capability_list) > 0 + else [""] + ) # Now we know there is at lease one entry, so we look if it is an empty string or not - self._separator = '/' if len(self._current_repeated_capability_list[0]) > 0 else '' + self._separator = ( + "/" if len(self._current_repeated_capability_list[0]) > 0 else "" + ) def __getitem__(self, repeated_capability): - '''Set/get properties or call methods with a repeated capability (i.e. channels)''' - rep_caps_list = _converters.convert_repeated_capabilities(repeated_capability, self._prefix) - complete_rep_cap_list = [current_rep_cap + self._separator + rep_cap for current_rep_cap in self._current_repeated_capability_list for rep_cap in rep_caps_list] - - return _SessionBase(vi=self._session._vi, repeated_capability_list=complete_rep_cap_list, library=self._session._library, encoding=self._session._encoding, freeze_it=True) + """Set/get properties or call methods with a repeated capability (i.e. channels)""" + rep_caps_list = _converters.convert_repeated_capabilities( + repeated_capability, self._prefix + ) + complete_rep_cap_list = [ + current_rep_cap + self._separator + rep_cap + for current_rep_cap in self._current_repeated_capability_list + for rep_cap in rep_caps_list + ] + + return _SessionBase( + vi=self._session._vi, + repeated_capability_list=complete_rep_cap_list, + library=self._session._library, + encoding=self._session._encoding, + freeze_it=True, + ) # This is a very simple context manager we can use when we need to set/get attributes @@ -115,45 +137,51 @@ def __init__(self, session): def __enter__(self): self._repeated_capability_cache = self._session._repeated_capability - self._session._repeated_capability = '' + self._session._repeated_capability = "" def __exit__(self, exc_type, exc_value, traceback): self._session._repeated_capability = self._repeated_capability_cache class _SessionBase(object): - '''Base class for all NI-FAKE sessions.''' + """Base class for all NI-FAKE sessions.""" # This is needed during __init__. Without it, __setattr__ raises an exception _is_frozen = False - float_enum = _attributes.AttributeEnum(_attributes.AttributeViReal64, enums.FloatEnum, 1000005) - '''Type: enums.FloatEnum + float_enum = _attributes.AttributeEnum( + _attributes.AttributeViReal64, enums.FloatEnum, 1000005 + ) + """Type: enums.FloatEnum A property with an enum that is also a float - ''' + """ read_write_bool = _attributes.AttributeViBoolean(1000000) - '''Type: bool + """Type: bool A property of type bool with read/write access. - ''' - read_write_color = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.Color, 1000003) - '''Type: enums.Color + """ + read_write_color = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.Color, 1000003 + ) + """Type: enums.Color A property of type Color with read/write access. - ''' + """ read_write_double = _attributes.AttributeViReal64(1000001) - '''Type: float + """Type: float A property of type float with read/write access. - ''' - read_write_double_with_converter = _attributes.AttributeViReal64TimeDeltaSeconds(1000007) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """ + read_write_double_with_converter = _attributes.AttributeViReal64TimeDeltaSeconds( + 1000007 + ) + """Type: hightime.timedelta, datetime.timedelta, or float in seconds Property in seconds - ''' + """ read_write_double_with_repeated_capability = _attributes.AttributeViReal64(1000009) - '''Type: float + """Type: float Tip: This property can be set/get on specific channels within your :py:class:`nifake.Session` instance. @@ -164,29 +192,33 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifake.Session`. Example: :py:attr:`my_session.read_write_double_with_repeated_capability` - ''' + """ read_write_int64 = _attributes.AttributeViInt64(1000006) - '''Type: int + """Type: int A property of type 64-bit integer with read/write access. - ''' + """ read_write_integer = _attributes.AttributeViInt32(1000004) - '''Type: int + """Type: int A property of type integer with read/write access. - ''' - read_write_integer_with_converter = _attributes.AttributeViInt32TimeDeltaMilliseconds(1000008) - '''Type: hightime.timedelta, datetime.timedelta, or int in milliseconds + """ + read_write_integer_with_converter = ( + _attributes.AttributeViInt32TimeDeltaMilliseconds(1000008) + ) + """Type: hightime.timedelta, datetime.timedelta, or int in milliseconds Property in milliseconds - ''' + """ read_write_string = _attributes.AttributeViString(1000002) - '''Type: str + """Type: str A property of type string with read/write access. - ''' - read_write_string_repeated_capability = _attributes.AttributeViStringRepeatedCapability(1000010) - '''Type: Any repeated capability type, as defined in nimi-python: + """ + read_write_string_repeated_capability = ( + _attributes.AttributeViStringRepeatedCapability(1000010) + ) + """Type: Any repeated capability type, as defined in nimi-python: - str - str - Comma delimited list - str - Range (using '-' or ':') @@ -204,43 +236,51 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`nifake.Session`. Example: :py:attr:`my_session.read_write_string_repeated_capability` - ''' + """ - def __init__(self, repeated_capability_list, vi, library, encoding, freeze_it=False): + def __init__( + self, repeated_capability_list, vi, library, encoding, freeze_it=False + ): self._repeated_capability_list = repeated_capability_list - self._repeated_capability = ','.join(repeated_capability_list) + self._repeated_capability = ",".join(repeated_capability_list) self._vi = vi self._library = library self._encoding = encoding # Store the parameter list for later printing in __repr__ param_list = [] - param_list.append("repeated_capability_list=" + pp.pformat(repeated_capability_list)) + param_list.append( + "repeated_capability_list=" + pp.pformat(repeated_capability_list) + ) param_list.append("vi=" + pp.pformat(vi)) param_list.append("library=" + pp.pformat(library)) param_list.append("encoding=" + pp.pformat(encoding)) - self._param_list = ', '.join(param_list) + self._param_list = ", ".join(param_list) # Instantiate any repeated capability objects - self.channels = _RepeatedCapabilities(self, '', repeated_capability_list) - self.sites = _RepeatedCapabilities(self, 'site', repeated_capability_list) - self.instruments = _RepeatedCapabilities(self, '', repeated_capability_list) + self.channels = _RepeatedCapabilities(self, "", repeated_capability_list) + self.sites = _RepeatedCapabilities(self, "site", repeated_capability_list) + self.instruments = _RepeatedCapabilities(self, "", repeated_capability_list) self._is_frozen = freeze_it def __repr__(self): - return '{0}.{1}({2})'.format('nifake', self.__class__.__name__, self._param_list) + return "{0}.{1}({2})".format( + "nifake", self.__class__.__name__, self._param_list + ) def __setattr__(self, key, value): if self._is_frozen and key not in dir(self): - raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) + raise AttributeError( + "'{0}' object has no attribute '{1}'".format(type(self).__name__, key) + ) object.__setattr__(self, key, value) def _get_error_description(self, error_code): - '''_get_error_description + """_get_error_description Returns the error description. - ''' + """ try: _, error_string = self._get_error() return error_string @@ -248,21 +288,21 @@ def _get_error_description(self, error_code): pass try: - ''' + """ It is expected for _get_error to raise when the session is invalid (IVI spec requires GetError to fail). Use _error_message instead. It doesn't require a session. - ''' + """ error_string = self._error_message(error_code) return error_string except errors.Error: return "Failed to retrieve error description." - ''' These are code-generated ''' + """ These are code-generated """ @ivi_synchronized def _get_attribute_vi_boolean(self, attribute_id): - r'''_get_attribute_vi_boolean + r"""_get_attribute_vi_boolean Queries the value of a ViBoolean property. @@ -284,18 +324,29 @@ def _get_attribute_vi_boolean(self, attribute_id): Returns: attribute_value (bool): Returns the value of the property. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niFake_GetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_GetAttributeViBoolean( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + None + if attribute_value_ctype is None + else (ctypes.pointer(attribute_value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return bool(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_int32(self, attribute_id): - r'''_get_attribute_vi_int32 + r"""_get_attribute_vi_int32 Queries the value of a ViInt32 property. @@ -317,18 +368,29 @@ def _get_attribute_vi_int32(self, attribute_id): Returns: attribute_value (int): Returns the value of the property. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFake_GetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_GetAttributeViInt32( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + None + if attribute_value_ctype is None + else (ctypes.pointer(attribute_value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_int64(self, attribute_id): - r'''_get_attribute_vi_int64 + r"""_get_attribute_vi_int64 Queries the value of a ViInt64 property. @@ -350,18 +412,29 @@ def _get_attribute_vi_int64(self, attribute_id): Returns: attribute_value (int): Returns the value of the property. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt64() # case S220 - error_code = self._library.niFake_GetAttributeViInt64(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_GetAttributeViInt64( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + None + if attribute_value_ctype is None + else (ctypes.pointer(attribute_value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_real64(self, attribute_id): - r'''_get_attribute_vi_real64 + r"""_get_attribute_vi_real64 Queries the value of a ViReal property. @@ -383,18 +456,29 @@ def _get_attribute_vi_real64(self, attribute_id): Returns: attribute_value (float): Returns the value of the property. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niFake_GetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_GetAttributeViReal64( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + None + if attribute_value_ctype is None + else (ctypes.pointer(attribute_value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_string(self, attribute_id): - r'''_get_attribute_vi_string + r"""_get_attribute_vi_string Queries the value of a ViBoolean property. @@ -416,22 +500,42 @@ def _get_attribute_vi_string(self, attribute_id): Returns: attribute_value (str): Returns the value of the property. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 buffer_size_ctype = _visatype.ViInt32() # case S170 attribute_value_ctype = None # case C050 - error_code = self._library.niFake_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, buffer_size_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niFake_GetAttributeViString( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + buffer_size_ctype, + attribute_value_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - attribute_value_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niFake_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, buffer_size_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + attribute_value_ctype = ( + _visatype.ViChar * buffer_size_ctype.value + )() # case C060 + error_code = self._library.niFake_GetAttributeViString( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + buffer_size_ctype, + attribute_value_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return attribute_value_ctype.value.decode(self._encoding) def _get_error(self): - r'''_get_error + r"""_get_error Returns the error information associated with the session. @@ -440,21 +544,37 @@ def _get_error(self): description (str): At least bufferSize big, string comes out here. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus() # case S220 buffer_size_ctype = _visatype.ViInt32() # case S170 description_ctype = None # case C050 - error_code = self._library.niFake_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), buffer_size_ctype, description_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True) + error_code = self._library.niFake_GetError( + vi_ctype, + None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), + buffer_size_ctype, + description_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=True + ) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 description_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niFake_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), buffer_size_ctype, description_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) - return int(error_code_ctype.value), description_ctype.value.decode(self._encoding) + error_code = self._library.niFake_GetError( + vi_ctype, + None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), + buffer_size_ctype, + description_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) + return int(error_code_ctype.value), description_ctype.value.decode( + self._encoding + ) def lock(self): - '''lock + """lock Obtains a multithread lock on the device session. Before doing so, the software waits until all other execution threads release their locks @@ -482,25 +602,27 @@ def lock(self): Returns: lock (context manager): When used in a with statement, nifake.Session.lock acts as a context manager and unlock will be called when the with block is exited - ''' + """ self._lock_session() # We do not call _lock_session() in the context manager so that this function can # act standalone as well and let the client call unlock() explicitly. If they do use the context manager, # that will handle the unlock for them return _Lock(self) def _lock_session(self): - '''_lock_session + """_lock_session Actual call to driver - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFake_LockSession(vi_ctype, None) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return @ivi_synchronized def read_from_channel(self, maximum_time): - r'''read_from_channel + r"""read_from_channel Acquires a single measurement and returns the measured value. @@ -522,18 +644,29 @@ def read_from_channel(self, maximum_time): Returns: reading (float): The measured value. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32(maximum_time) # case S140 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32( + maximum_time + ) # case S140 reading_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niFake_ReadFromChannel(vi_ctype, channel_name_ctype, maximum_time_ctype, None if reading_ctype is None else (ctypes.pointer(reading_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_ReadFromChannel( + vi_ctype, + channel_name_ctype, + maximum_time_ctype, + None if reading_ctype is None else (ctypes.pointer(reading_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(reading_ctype.value) @ivi_synchronized def _set_attribute_vi_boolean(self, attribute_id, attribute_value): - r'''_set_attribute_vi_boolean + r"""_set_attribute_vi_boolean This method sets the value of a ViBoolean property. @@ -553,18 +686,24 @@ def _set_attribute_vi_boolean(self, attribute_id, attribute_value): attribute_value (bool): Pass the value that you want to set the property to. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViBoolean(attribute_value) # case S150 - error_code = self._library.niFake_SetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_SetAttributeViBoolean( + vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_int32(self, attribute_id, attribute_value): - r'''_set_attribute_vi_int32 + r"""_set_attribute_vi_int32 This method sets the value of a ViInt32 property. @@ -584,18 +723,24 @@ def _set_attribute_vi_int32(self, attribute_id, attribute_value): attribute_value (int): Pass the value that you want to set the property to. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt32(attribute_value) # case S150 - error_code = self._library.niFake_SetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_SetAttributeViInt32( + vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_int64(self, attribute_id, attribute_value): - r'''_set_attribute_vi_int64 + r"""_set_attribute_vi_int64 This method sets the value of a ViInt64 property. @@ -615,18 +760,24 @@ def _set_attribute_vi_int64(self, attribute_id, attribute_value): attribute_value (int): Pass the value that you want to set the property to. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt64(attribute_value) # case S150 - error_code = self._library.niFake_SetAttributeViInt64(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_SetAttributeViInt64( + vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_real64(self, attribute_id, attribute_value): - r'''_set_attribute_vi_real64 + r"""_set_attribute_vi_real64 This method sets the value of a ViReal64 property. @@ -646,18 +797,24 @@ def _set_attribute_vi_real64(self, attribute_id, attribute_value): attribute_value (float): Pass the value that you want to set the property to. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViReal64(attribute_value) # case S150 - error_code = self._library.niFake_SetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_SetAttributeViReal64( + vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_string(self, attribute_id, attribute_value): - r'''_set_attribute_vi_string + r"""_set_attribute_vi_string This method sets the value of a ViString property. @@ -677,29 +834,39 @@ def _set_attribute_vi_string(self, attribute_id, attribute_value): attribute_value (str): Pass the value that you want to set the property to. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 - attribute_value_ctype = ctypes.create_string_buffer(attribute_value.encode(self._encoding)) # case C020 - error_code = self._library.niFake_SetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + attribute_value_ctype = ctypes.create_string_buffer( + attribute_value.encode(self._encoding) + ) # case C020 + error_code = self._library.niFake_SetAttributeViString( + vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def unlock(self): - '''unlock + """unlock Releases a lock that you acquired on an device session using lock. Refer to lock for additional information on session locks. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFake_UnlockSession(vi_ctype, None) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return def _error_message(self, error_code): - r'''_error_message + r"""_error_message Takes the errorCode returned by a functiona and returns it as a user-readable string. @@ -710,20 +877,24 @@ def _error_message(self, error_code): Returns: error_message (str): The error information formatted into a string. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus(error_code) # case S150 error_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niFake_error_message(vi_ctype, error_code_ctype, error_message_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + error_code = self._library.niFake_error_message( + vi_ctype, error_code_ctype, error_message_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return error_message_ctype.value.decode(self._encoding) class Session(_SessionBase): - '''An NI-FAKE session to a fake MI driver whose sole purpose is to test nimi-python code generation''' + """An NI-FAKE session to a fake MI driver whose sole purpose is to test nimi-python code generation""" def __init__(self, resource_name, options={}, id_query=False, reset_device=False): - r'''An NI-FAKE session to a fake MI driver whose sole purpose is to test nimi-python code generation + r"""An NI-FAKE session to a fake MI driver whose sole purpose is to test nimi-python code generation Creates a new IVI instrument driver session. @@ -780,15 +951,23 @@ def __init__(self, resource_name, options={}, id_query=False, reset_device=False Returns: session (nifake.Session): A session object representing the device. - ''' - super(Session, self).__init__(repeated_capability_list=[], vi=None, library=None, encoding=None, freeze_it=False) + """ + super(Session, self).__init__( + repeated_capability_list=[], + vi=None, + library=None, + encoding=None, + freeze_it=False, + ) options = _converters.convert_init_with_options_dictionary(options) self._library = _library_singleton.get() - self._encoding = 'windows-1251' + self._encoding = "windows-1251" # Call specified init function self._vi = 0 # This must be set before calling _init_with_options(). - self._vi = self._init_with_options(resource_name, options, id_query, reset_device) + self._vi = self._init_with_options( + resource_name, options, id_query, reset_device + ) self.tclk = nitclk.SessionReference(self._vi) @@ -797,7 +976,7 @@ def __init__(self, resource_name, options={}, id_query=False, reset_device=False param_list.append("resource_name=" + pp.pformat(resource_name)) param_list.append("options=" + pp.pformat(options)) param_list.append("reset_device=" + pp.pformat(reset_device)) - self._param_list = ', '.join(param_list) + self._param_list = ", ".join(param_list) self._is_frozen = True @@ -808,23 +987,23 @@ def __exit__(self, exc_type, exc_value, traceback): self.close() def initiate(self): - '''initiate + """initiate Initiates a thingie. Note: This method will return a Python context manager that will initiate on entering and abort on exit. - ''' + """ return _Acquisition(self) def close(self): - '''close + """close Closes the specified session and deallocates resources that it reserved. Note: This method is not needed when using the session context manager - ''' + """ try: self._close() except errors.DriverError: @@ -832,40 +1011,52 @@ def close(self): raise self._vi = 0 - ''' These are code-generated ''' + """ These are code-generated """ @ivi_synchronized def abort(self): - r'''abort + r"""abort Aborts a previously initiated thingie. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFake_Abort(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def accept_list_of_durations_in_seconds(self, delays): - r'''accept_list_of_durations_in_seconds + r"""accept_list_of_durations_in_seconds Accepts list of hightime.timedelta or datetime.timedelta or float instances representing time delays. Args: delays (hightime.timedelta, datetime.timedelta, or float in seconds): A collection of time delay values. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - count_ctype = _visatype.ViInt32(0 if delays is None else len(delays)) # case S160 - delays_converted = _converters.convert_timedeltas_to_seconds_real64(delays) # case B520 - delays_ctype = get_ctypes_pointer_for_buffer(value=delays_converted, library_type=_visatype.ViReal64) # case B520 - error_code = self._library.niFake_AcceptListOfDurationsInSeconds(vi_ctype, count_ctype, delays_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + count_ctype = _visatype.ViInt32( + 0 if delays is None else len(delays) + ) # case S160 + delays_converted = _converters.convert_timedeltas_to_seconds_real64( + delays + ) # case B520 + delays_ctype = get_ctypes_pointer_for_buffer( + value=delays_converted, library_type=_visatype.ViReal64 + ) # case B520 + error_code = self._library.niFake_AcceptListOfDurationsInSeconds( + vi_ctype, count_ctype, delays_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def bool_array_output_function(self, number_of_elements): - r'''bool_array_output_function + r"""bool_array_output_function This method returns an array of booleans. @@ -876,36 +1067,52 @@ def bool_array_output_function(self, number_of_elements): Returns: an_array (list of bool): Contains an array of booleans - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 number_of_elements_ctype = _visatype.ViInt32(number_of_elements) # case S210 an_array_size = number_of_elements # case B600 - an_array_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViBoolean, size=an_array_size) # case B600 - error_code = self._library.niFake_BoolArrayOutputFunction(vi_ctype, number_of_elements_ctype, an_array_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + an_array_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViBoolean, size=an_array_size + ) # case B600 + error_code = self._library.niFake_BoolArrayOutputFunction( + vi_ctype, number_of_elements_ctype, an_array_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return [bool(an_array_ctype[i]) for i in range(number_of_elements_ctype.value)] @ivi_synchronized def double_all_the_nums(self, numbers): - r'''double_all_the_nums + r"""double_all_the_nums Test for buffer with converter Args: numbers (list of float): numbers is an array of numbers we want to double. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - number_count_ctype = _visatype.ViInt32(0 if numbers is None else len(numbers)) # case S160 - numbers_converted = _converters.convert_double_each_element(numbers) # case B520 - numbers_ctype = get_ctypes_pointer_for_buffer(value=numbers_converted, library_type=_visatype.ViReal64) # case B520 - error_code = self._library.niFake_DoubleAllTheNums(vi_ctype, number_count_ctype, numbers_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + number_count_ctype = _visatype.ViInt32( + 0 if numbers is None else len(numbers) + ) # case S160 + numbers_converted = _converters.convert_double_each_element( + numbers + ) # case B520 + numbers_ctype = get_ctypes_pointer_for_buffer( + value=numbers_converted, library_type=_visatype.ViReal64 + ) # case B520 + error_code = self._library.niFake_DoubleAllTheNums( + vi_ctype, number_count_ctype, numbers_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def enum_array_output_function(self, number_of_elements): - r'''enum_array_output_function + r"""enum_array_output_function This method returns an array of enums, stored as 16 bit integers under the hood. @@ -916,18 +1123,27 @@ def enum_array_output_function(self, number_of_elements): Returns: an_array (list of enums.Turtle): Contains an array of enums, stored as 16 bit integers under the hood - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 number_of_elements_ctype = _visatype.ViInt32(number_of_elements) # case S210 an_array_size = number_of_elements # case B600 - an_array_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViInt16, size=an_array_size) # case B600 - error_code = self._library.niFake_EnumArrayOutputFunction(vi_ctype, number_of_elements_ctype, an_array_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return [enums.Turtle(an_array_ctype[i]) for i in range(number_of_elements_ctype.value)] + an_array_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViInt16, size=an_array_size + ) # case B600 + error_code = self._library.niFake_EnumArrayOutputFunction( + vi_ctype, number_of_elements_ctype, an_array_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return [ + enums.Turtle(an_array_ctype[i]) + for i in range(number_of_elements_ctype.value) + ] @ivi_synchronized def enum_input_function_with_defaults(self, a_turtle=enums.Turtle.LEONARDO): - r'''enum_input_function_with_defaults + r"""enum_input_function_with_defaults This method takes one parameter other than the session, which happens to be an enum and has a default value. @@ -944,41 +1160,55 @@ def enum_input_function_with_defaults(self, a_turtle=enums.Turtle.LEONARDO): | 3 | Mich elangelo | +---+---------------+ - ''' + """ if type(a_turtle) is not enums.Turtle: - raise TypeError('Parameter a_turtle must be of type ' + str(enums.Turtle)) + raise TypeError("Parameter a_turtle must be of type " + str(enums.Turtle)) vi_ctype = _visatype.ViSession(self._vi) # case S110 a_turtle_ctype = _visatype.ViInt16(a_turtle.value) # case S130 - error_code = self._library.niFake_EnumInputFunctionWithDefaults(vi_ctype, a_turtle_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_EnumInputFunctionWithDefaults( + vi_ctype, a_turtle_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def export_attribute_configuration_buffer(self): - r'''export_attribute_configuration_buffer + r"""export_attribute_configuration_buffer Export configuration buffer. Returns: configuration (bytes): - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 size_in_bytes_ctype = _visatype.ViInt32() # case S170 configuration_ctype = None # case B580 - error_code = self._library.niFake_ExportAttributeConfigurationBuffer(vi_ctype, size_in_bytes_ctype, configuration_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niFake_ExportAttributeConfigurationBuffer( + vi_ctype, size_in_bytes_ctype, configuration_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) size_in_bytes_ctype = _visatype.ViInt32(error_code) # case S180 configuration_size = size_in_bytes_ctype.value # case B590 configuration_array = array.array("b", [0] * configuration_size) # case B590 - configuration_ctype = get_ctypes_pointer_for_buffer(value=configuration_array, library_type=_visatype.ViInt8) # case B590 - error_code = self._library.niFake_ExportAttributeConfigurationBuffer(vi_ctype, size_in_bytes_ctype, configuration_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + configuration_ctype = get_ctypes_pointer_for_buffer( + value=configuration_array, library_type=_visatype.ViInt8 + ) # case B590 + error_code = self._library.niFake_ExportAttributeConfigurationBuffer( + vi_ctype, size_in_bytes_ctype, configuration_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return _converters.convert_to_bytes(configuration_array) @ivi_synchronized def fetch_waveform(self, number_of_samples): - r'''fetch_waveform + r"""fetch_waveform Returns waveform data. @@ -991,20 +1221,31 @@ def fetch_waveform(self, number_of_samples): actual_number_of_samples (int): Number of samples actually fetched. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 number_of_samples_ctype = _visatype.ViInt32(number_of_samples) # case S210 waveform_data_size = number_of_samples # case B600 waveform_data_array = array.array("d", [0] * waveform_data_size) # case B600 - waveform_data_ctype = get_ctypes_pointer_for_buffer(value=waveform_data_array, library_type=_visatype.ViReal64) # case B600 + waveform_data_ctype = get_ctypes_pointer_for_buffer( + value=waveform_data_array, library_type=_visatype.ViReal64 + ) # case B600 actual_number_of_samples_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFake_FetchWaveform(vi_ctype, number_of_samples_ctype, waveform_data_ctype, None if actual_number_of_samples_ctype is None else (ctypes.pointer(actual_number_of_samples_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_FetchWaveform( + vi_ctype, + number_of_samples_ctype, + waveform_data_ctype, + None + if actual_number_of_samples_ctype is None + else (ctypes.pointer(actual_number_of_samples_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return waveform_data_array @ivi_synchronized def fetch_waveform_into(self, waveform_data): - r'''fetch_waveform + r"""fetch_waveform Returns waveform data. @@ -1017,28 +1258,46 @@ def fetch_waveform_into(self, waveform_data): actual_number_of_samples (int): Number of samples actually fetched. - ''' + """ import numpy if type(waveform_data) is not numpy.ndarray: - raise TypeError('waveform_data must be {0}, is {1}'.format(numpy.ndarray, type(waveform_data))) + raise TypeError( + "waveform_data must be {0}, is {1}".format( + numpy.ndarray, type(waveform_data) + ) + ) if numpy.isfortran(waveform_data) is True: - raise TypeError('waveform_data must be in C-order') - if waveform_data.dtype is not numpy.dtype('float64'): - raise TypeError('waveform_data must be numpy.ndarray of dtype=float64, is ' + str(waveform_data.dtype)) + raise TypeError("waveform_data must be in C-order") + if waveform_data.dtype is not numpy.dtype("float64"): + raise TypeError( + "waveform_data must be numpy.ndarray of dtype=float64, is " + + str(waveform_data.dtype) + ) number_of_samples = len(waveform_data) vi_ctype = _visatype.ViSession(self._vi) # case S110 number_of_samples_ctype = _visatype.ViInt32(number_of_samples) # case S210 - waveform_data_ctype = get_ctypes_pointer_for_buffer(value=waveform_data) # case B510 + waveform_data_ctype = get_ctypes_pointer_for_buffer( + value=waveform_data + ) # case B510 actual_number_of_samples_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFake_FetchWaveform(vi_ctype, number_of_samples_ctype, waveform_data_ctype, None if actual_number_of_samples_ctype is None else (ctypes.pointer(actual_number_of_samples_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_FetchWaveform( + vi_ctype, + number_of_samples_ctype, + waveform_data_ctype, + None + if actual_number_of_samples_ctype is None + else (ctypes.pointer(actual_number_of_samples_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def get_a_boolean(self): - r'''get_a_boolean + r"""get_a_boolean Returns a boolean. @@ -1047,16 +1306,21 @@ def get_a_boolean(self): Returns: a_boolean (bool): Contains a boolean. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 a_boolean_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niFake_GetABoolean(vi_ctype, None if a_boolean_ctype is None else (ctypes.pointer(a_boolean_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_GetABoolean( + vi_ctype, + None if a_boolean_ctype is None else (ctypes.pointer(a_boolean_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return bool(a_boolean_ctype.value) @ivi_synchronized def get_a_number(self): - r'''get_a_number + r"""get_a_number Returns a number. @@ -1065,32 +1329,41 @@ def get_a_number(self): Returns: a_number (int): Contains a number. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 a_number_ctype = _visatype.ViInt16() # case S220 - error_code = self._library.niFake_GetANumber(vi_ctype, None if a_number_ctype is None else (ctypes.pointer(a_number_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_GetANumber( + vi_ctype, + None if a_number_ctype is None else (ctypes.pointer(a_number_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(a_number_ctype.value) @ivi_synchronized def get_a_string_of_fixed_maximum_size(self): - r'''get_a_string_of_fixed_maximum_size + r"""get_a_string_of_fixed_maximum_size Illustrates returning a string of fixed size. Returns: a_string (str): String comes back here. Buffer must be 256 big. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 a_string_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niFake_GetAStringOfFixedMaximumSize(vi_ctype, a_string_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_GetAStringOfFixedMaximumSize( + vi_ctype, a_string_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return a_string_ctype.value.decode(self._encoding) @ivi_synchronized def get_a_string_using_python_code(self, a_number): - r'''get_a_string_using_python_code + r"""get_a_string_using_python_code Returns a number and a string. @@ -1103,134 +1376,197 @@ def get_a_string_using_python_code(self, a_number): Returns: a_string (str): Contains a string of length aNumber. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 a_number_ctype = _visatype.ViInt16(a_number) # case S150 a_string_ctype = (_visatype.ViChar * a_number)() # case C080 - error_code = self._library.niFake_GetAStringUsingPythonCode(vi_ctype, a_number_ctype, a_string_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_GetAStringUsingPythonCode( + vi_ctype, a_number_ctype, a_string_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return a_string_ctype.value.decode(self._encoding) @ivi_synchronized def get_an_ivi_dance_string(self): - r'''get_an_ivi_dance_string + r"""get_an_ivi_dance_string Returns a string using the IVI dance. Returns: a_string (str): Returns the string. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 buffer_size_ctype = _visatype.ViInt32() # case S170 a_string_ctype = None # case C050 - error_code = self._library.niFake_GetAnIviDanceString(vi_ctype, buffer_size_ctype, a_string_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niFake_GetAnIviDanceString( + vi_ctype, buffer_size_ctype, a_string_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 a_string_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niFake_GetAnIviDanceString(vi_ctype, buffer_size_ctype, a_string_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_GetAnIviDanceString( + vi_ctype, buffer_size_ctype, a_string_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return a_string_ctype.value.decode(self._encoding) @ivi_synchronized def get_an_ivi_dance_with_a_twist_string(self): - r'''get_an_ivi_dance_with_a_twist_string + r"""get_an_ivi_dance_with_a_twist_string TBD Returns: a_string (str): - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 buffer_size_ctype = _visatype.ViInt32(0) # case S190 a_string_ctype = None # case C090 actual_size_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFake_GetAnIviDanceWithATwistString(vi_ctype, buffer_size_ctype, a_string_ctype, None if actual_size_ctype is None else (ctypes.pointer(actual_size_ctype))) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niFake_GetAnIviDanceWithATwistString( + vi_ctype, + buffer_size_ctype, + a_string_ctype, + None if actual_size_ctype is None else (ctypes.pointer(actual_size_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) buffer_size_ctype = _visatype.ViInt32(actual_size_ctype.value) # case S200 a_string_ctype = (_visatype.ViChar * actual_size_ctype.value)() # case C100 - error_code = self._library.niFake_GetAnIviDanceWithATwistString(vi_ctype, buffer_size_ctype, a_string_ctype, None if actual_size_ctype is None else (ctypes.pointer(actual_size_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_GetAnIviDanceWithATwistString( + vi_ctype, + buffer_size_ctype, + a_string_ctype, + None if actual_size_ctype is None else (ctypes.pointer(actual_size_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return a_string_ctype.value.decode(self._encoding) @ivi_synchronized def get_array_for_python_code_custom_type(self): - r'''get_array_for_python_code_custom_type + r"""get_array_for_python_code_custom_type This method returns an array for use in python-code size mechanism. Returns: array_out (list of CustomStruct): Array of custom type using python-code size mechanism - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - number_of_elements_ctype = _visatype.ViInt32(self.get_array_size_for_python_code()) # case S120 + number_of_elements_ctype = _visatype.ViInt32( + self.get_array_size_for_python_code() + ) # case S120 array_out_size = self.get_array_size_for_python_code() # case B560 - array_out_ctype = get_ctypes_pointer_for_buffer(library_type=custom_struct.struct_CustomStruct, size=array_out_size) # case B560 - error_code = self._library.niFake_GetArrayForPythonCodeCustomType(vi_ctype, number_of_elements_ctype, array_out_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return [custom_struct.CustomStruct(array_out_ctype[i]) for i in range(self.get_array_size_for_python_code())] + array_out_ctype = get_ctypes_pointer_for_buffer( + library_type=custom_struct.struct_CustomStruct, size=array_out_size + ) # case B560 + error_code = self._library.niFake_GetArrayForPythonCodeCustomType( + vi_ctype, number_of_elements_ctype, array_out_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return [ + custom_struct.CustomStruct(array_out_ctype[i]) + for i in range(self.get_array_size_for_python_code()) + ] @ivi_synchronized def get_array_for_python_code_double(self): - r'''get_array_for_python_code_double + r"""get_array_for_python_code_double This method returns an array for use in python-code size mechanism. Returns: array_out (list of float): Array of double using python-code size mechanism - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - number_of_elements_ctype = _visatype.ViInt32(self.get_array_size_for_python_code()) # case S120 + number_of_elements_ctype = _visatype.ViInt32( + self.get_array_size_for_python_code() + ) # case S120 array_out_size = self.get_array_size_for_python_code() # case B560 - array_out_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=array_out_size) # case B560 - error_code = self._library.niFake_GetArrayForPythonCodeDouble(vi_ctype, number_of_elements_ctype, array_out_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return [float(array_out_ctype[i]) for i in range(self.get_array_size_for_python_code())] + array_out_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViReal64, size=array_out_size + ) # case B560 + error_code = self._library.niFake_GetArrayForPythonCodeDouble( + vi_ctype, number_of_elements_ctype, array_out_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return [ + float(array_out_ctype[i]) + for i in range(self.get_array_size_for_python_code()) + ] @ivi_synchronized def get_array_size_for_python_code(self): - r'''get_array_size_for_python_code + r"""get_array_size_for_python_code This method returns the size of the array for use in python-code size mechanism. Returns: size_out (int): Size of array - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 size_out_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFake_GetArraySizeForPythonCode(vi_ctype, None if size_out_ctype is None else (ctypes.pointer(size_out_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_GetArraySizeForPythonCode( + vi_ctype, + None if size_out_ctype is None else (ctypes.pointer(size_out_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(size_out_ctype.value) @ivi_synchronized def get_array_using_ivi_dance(self): - r'''get_array_using_ivi_dance + r"""get_array_using_ivi_dance This method returns an array of float whose size is determined with the IVI dance. Returns: array_out (list of float): The array returned by this method - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 array_size_ctype = _visatype.ViInt32() # case S170 array_out_ctype = None # case B580 - error_code = self._library.niFake_GetArrayUsingIviDance(vi_ctype, array_size_ctype, array_out_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niFake_GetArrayUsingIviDance( + vi_ctype, array_size_ctype, array_out_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) array_size_ctype = _visatype.ViInt32(error_code) # case S180 array_out_size = array_size_ctype.value # case B590 - array_out_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=array_out_size) # case B590 - error_code = self._library.niFake_GetArrayUsingIviDance(vi_ctype, array_size_ctype, array_out_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + array_out_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViReal64, size=array_out_size + ) # case B590 + error_code = self._library.niFake_GetArrayUsingIviDance( + vi_ctype, array_size_ctype, array_out_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return [float(array_out_ctype[i]) for i in range(array_size_ctype.value)] @ivi_synchronized def _get_cal_date_and_time(self, cal_type): - r'''_get_cal_date_and_time + r"""_get_cal_date_and_time Returns the date and time of the last calibration performed. @@ -1249,7 +1585,7 @@ def _get_cal_date_and_time(self, cal_type): minute (int): Indicates the **minute** of the last calibration. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 cal_type_ctype = _visatype.ViInt32(cal_type) # case S150 month_ctype = _visatype.ViInt32() # case S220 @@ -1257,45 +1593,69 @@ def _get_cal_date_and_time(self, cal_type): year_ctype = _visatype.ViInt32() # case S220 hour_ctype = _visatype.ViInt32() # case S220 minute_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFake_GetCalDateAndTime(vi_ctype, cal_type_ctype, None if month_ctype is None else (ctypes.pointer(month_ctype)), None if day_ctype is None else (ctypes.pointer(day_ctype)), None if year_ctype is None else (ctypes.pointer(year_ctype)), None if hour_ctype is None else (ctypes.pointer(hour_ctype)), None if minute_ctype is None else (ctypes.pointer(minute_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return int(month_ctype.value), int(day_ctype.value), int(year_ctype.value), int(hour_ctype.value), int(minute_ctype.value) + error_code = self._library.niFake_GetCalDateAndTime( + vi_ctype, + cal_type_ctype, + None if month_ctype is None else (ctypes.pointer(month_ctype)), + None if day_ctype is None else (ctypes.pointer(day_ctype)), + None if year_ctype is None else (ctypes.pointer(year_ctype)), + None if hour_ctype is None else (ctypes.pointer(hour_ctype)), + None if minute_ctype is None else (ctypes.pointer(minute_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return ( + int(month_ctype.value), + int(day_ctype.value), + int(year_ctype.value), + int(hour_ctype.value), + int(minute_ctype.value), + ) @ivi_synchronized def get_cal_interval(self): - r'''get_cal_interval + r"""get_cal_interval Returns the recommended maximum interval, in **months**, between external calibrations. Returns: months (hightime.timedelta): Specifies the recommended maximum interval, in **months**, between external calibrations. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 months_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFake_GetCalInterval(vi_ctype, None if months_ctype is None else (ctypes.pointer(months_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_GetCalInterval( + vi_ctype, None if months_ctype is None else (ctypes.pointer(months_ctype)) + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return _converters.convert_month_to_timedelta(int(months_ctype.value)) @ivi_synchronized def get_custom_type(self): - r'''get_custom_type + r"""get_custom_type This method returns a custom type. Returns: cs (CustomStruct): Set using custom type - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 cs_ctype = custom_struct.struct_CustomStruct() # case S220 - error_code = self._library.niFake_GetCustomType(vi_ctype, None if cs_ctype is None else (ctypes.pointer(cs_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_GetCustomType( + vi_ctype, None if cs_ctype is None else (ctypes.pointer(cs_ctype)) + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return custom_struct.CustomStruct(cs_ctype) @ivi_synchronized def get_custom_type_array(self, number_of_elements): - r'''get_custom_type_array + r"""get_custom_type_array This method returns a custom type. @@ -1306,18 +1666,27 @@ def get_custom_type_array(self, number_of_elements): Returns: cs (list of CustomStruct): Get using custom type - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 number_of_elements_ctype = _visatype.ViInt32(number_of_elements) # case S210 cs_size = number_of_elements # case B600 - cs_ctype = get_ctypes_pointer_for_buffer(library_type=custom_struct.struct_CustomStruct, size=cs_size) # case B600 - error_code = self._library.niFake_GetCustomTypeArray(vi_ctype, number_of_elements_ctype, cs_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return [custom_struct.CustomStruct(cs_ctype[i]) for i in range(number_of_elements_ctype.value)] + cs_ctype = get_ctypes_pointer_for_buffer( + library_type=custom_struct.struct_CustomStruct, size=cs_size + ) # case B600 + error_code = self._library.niFake_GetCustomTypeArray( + vi_ctype, number_of_elements_ctype, cs_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return [ + custom_struct.CustomStruct(cs_ctype[i]) + for i in range(number_of_elements_ctype.value) + ] @ivi_synchronized def get_enum_value(self): - r'''get_enum_value + r"""get_enum_value Returns an enum value @@ -1340,17 +1709,23 @@ def get_enum_value(self): | 3 | Mich elangelo | +---+---------------+ - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 a_quantity_ctype = _visatype.ViInt32() # case S220 a_turtle_ctype = _visatype.ViInt16() # case S220 - error_code = self._library.niFake_GetEnumValue(vi_ctype, None if a_quantity_ctype is None else (ctypes.pointer(a_quantity_ctype)), None if a_turtle_ctype is None else (ctypes.pointer(a_turtle_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_GetEnumValue( + vi_ctype, + None if a_quantity_ctype is None else (ctypes.pointer(a_quantity_ctype)), + None if a_turtle_ctype is None else (ctypes.pointer(a_turtle_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(a_quantity_ctype.value), enums.Turtle(a_turtle_ctype.value) @ivi_synchronized def get_cal_date_and_time(self, cal_type): - '''get_cal_date_and_time + """get_cal_date_and_time Returns the date and time of the last calibration performed. @@ -1361,30 +1736,42 @@ def get_cal_date_and_time(self, cal_type): Returns: month (hightime.datetime): Indicates date and time of the last calibration. - ''' + """ month, day, year, hour, minute = self._get_cal_date_and_time(cal_type) return hightime.datetime(year, month, day, hour, minute) @ivi_synchronized def import_attribute_configuration_buffer(self, configuration): - r'''import_attribute_configuration_buffer + r"""import_attribute_configuration_buffer Import configuration buffer. Args: configuration (bytes): - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - size_in_bytes_ctype = _visatype.ViInt32(0 if configuration is None else len(configuration)) # case S160 - configuration_converted = _converters.convert_to_bytes(configuration) # case B520 - configuration_ctype = get_ctypes_pointer_for_buffer(value=configuration_converted, library_type=_visatype.ViInt8) # case B520 - error_code = self._library.niFake_ImportAttributeConfigurationBuffer(vi_ctype, size_in_bytes_ctype, configuration_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + size_in_bytes_ctype = _visatype.ViInt32( + 0 if configuration is None else len(configuration) + ) # case S160 + configuration_converted = _converters.convert_to_bytes( + configuration + ) # case B520 + configuration_ctype = get_ctypes_pointer_for_buffer( + value=configuration_converted, library_type=_visatype.ViInt8 + ) # case B520 + error_code = self._library.niFake_ImportAttributeConfigurationBuffer( + vi_ctype, size_in_bytes_ctype, configuration_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return - def _init_with_options(self, resource_name, option_string, id_query=False, reset_device=False): - r'''_init_with_options + def _init_with_options( + self, resource_name, option_string, id_query=False, reset_device=False + ): + r"""_init_with_options Creates a new IVI instrument driver session. @@ -1415,30 +1802,48 @@ def _init_with_options(self, resource_name, option_string, id_query=False, reset Returns: vi (int): Returns a ViSession handle that you use. - ''' - resource_name_ctype = ctypes.create_string_buffer(resource_name.encode(self._encoding)) # case C020 + """ + resource_name_ctype = ctypes.create_string_buffer( + resource_name.encode(self._encoding) + ) # case C020 id_query_ctype = _visatype.ViBoolean(id_query) # case S150 reset_device_ctype = _visatype.ViBoolean(reset_device) # case S150 - option_string_ctype = ctypes.create_string_buffer(_converters.convert_init_with_options_dictionary(option_string).encode(self._encoding)) # case C040 + option_string_ctype = ctypes.create_string_buffer( + _converters.convert_init_with_options_dictionary(option_string).encode( + self._encoding + ) + ) # case C040 vi_ctype = _visatype.ViSession() # case S220 - error_code = self._library.niFake_InitWithOptions(resource_name_ctype, id_query_ctype, reset_device_ctype, option_string_ctype, None if vi_ctype is None else (ctypes.pointer(vi_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_InitWithOptions( + resource_name_ctype, + id_query_ctype, + reset_device_ctype, + option_string_ctype, + None if vi_ctype is None else (ctypes.pointer(vi_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(vi_ctype.value) @ivi_synchronized def _initiate(self): - r'''_initiate + r"""_initiate Initiates a thingie. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFake_Initiate(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def multiple_array_types(self, output_array_size, input_array_of_floats, input_array_of_integers=None): - r'''multiple_array_types + def multiple_array_types( + self, output_array_size, input_array_of_floats, input_array_of_integers=None + ): + r"""multiple_array_types Receives and returns multiple types of arrays. @@ -1457,25 +1862,51 @@ def multiple_array_types(self, output_array_size, input_array_of_floats, input_a output_array_of_fixed_length (list of float): An array of doubles with fixed size. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 output_array_size_ctype = _visatype.ViInt32(output_array_size) # case S210 output_array_size = output_array_size # case B600 - output_array_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=output_array_size) # case B600 + output_array_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViReal64, size=output_array_size + ) # case B600 output_array_of_fixed_length_size = 3 # case B570 - output_array_of_fixed_length_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=output_array_of_fixed_length_size) # case B570 - input_array_sizes_ctype = _visatype.ViInt32(0 if input_array_of_floats is None else len(input_array_of_floats)) # case S160 - if input_array_of_integers is not None and len(input_array_of_integers) != len(input_array_of_floats): # case S160 - raise ValueError("Length of input_array_of_integers and input_array_of_floats parameters do not match.") # case S160 - input_array_of_floats_ctype = get_ctypes_pointer_for_buffer(value=input_array_of_floats, library_type=_visatype.ViReal64) # case B550 - input_array_of_integers_ctype = get_ctypes_pointer_for_buffer(value=input_array_of_integers, library_type=_visatype.ViInt16) # case B550 - error_code = self._library.niFake_MultipleArrayTypes(vi_ctype, output_array_size_ctype, output_array_ctype, output_array_of_fixed_length_ctype, input_array_sizes_ctype, input_array_of_floats_ctype, input_array_of_integers_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return [float(output_array_ctype[i]) for i in range(output_array_size_ctype.value)], [float(output_array_of_fixed_length_ctype[i]) for i in range(3)] + output_array_of_fixed_length_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViReal64, size=output_array_of_fixed_length_size + ) # case B570 + input_array_sizes_ctype = _visatype.ViInt32( + 0 if input_array_of_floats is None else len(input_array_of_floats) + ) # case S160 + if input_array_of_integers is not None and len(input_array_of_integers) != len( + input_array_of_floats + ): # case S160 + raise ValueError( + "Length of input_array_of_integers and input_array_of_floats parameters do not match." + ) # case S160 + input_array_of_floats_ctype = get_ctypes_pointer_for_buffer( + value=input_array_of_floats, library_type=_visatype.ViReal64 + ) # case B550 + input_array_of_integers_ctype = get_ctypes_pointer_for_buffer( + value=input_array_of_integers, library_type=_visatype.ViInt16 + ) # case B550 + error_code = self._library.niFake_MultipleArrayTypes( + vi_ctype, + output_array_size_ctype, + output_array_ctype, + output_array_of_fixed_length_ctype, + input_array_sizes_ctype, + input_array_of_floats_ctype, + input_array_of_integers_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return [ + float(output_array_ctype[i]) for i in range(output_array_size_ctype.value) + ], [float(output_array_of_fixed_length_ctype[i]) for i in range(3)] @ivi_synchronized def multiple_arrays_same_size(self, values1, values2, values3, values4): - r'''multiple_arrays_same_size + r"""multiple_arrays_same_size Method to test multiple arrays that use the same size @@ -1488,42 +1919,78 @@ def multiple_arrays_same_size(self, values1, values2, values3, values4): values4 (list of float): Array 4 of same size. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - values1_ctype = get_ctypes_pointer_for_buffer(value=values1, library_type=_visatype.ViReal64) # case B550 - values2_ctype = get_ctypes_pointer_for_buffer(value=values2, library_type=_visatype.ViReal64) # case B550 - values3_ctype = get_ctypes_pointer_for_buffer(value=values3, library_type=_visatype.ViReal64) # case B550 - values4_ctype = get_ctypes_pointer_for_buffer(value=values4, library_type=_visatype.ViReal64) # case B550 - size_ctype = _visatype.ViInt32(0 if values1 is None else len(values1)) # case S160 + values1_ctype = get_ctypes_pointer_for_buffer( + value=values1, library_type=_visatype.ViReal64 + ) # case B550 + values2_ctype = get_ctypes_pointer_for_buffer( + value=values2, library_type=_visatype.ViReal64 + ) # case B550 + values3_ctype = get_ctypes_pointer_for_buffer( + value=values3, library_type=_visatype.ViReal64 + ) # case B550 + values4_ctype = get_ctypes_pointer_for_buffer( + value=values4, library_type=_visatype.ViReal64 + ) # case B550 + size_ctype = _visatype.ViInt32( + 0 if values1 is None else len(values1) + ) # case S160 if values2 is not None and len(values2) != len(values1): # case S160 - raise ValueError("Length of values2 and values1 parameters do not match.") # case S160 + raise ValueError( + "Length of values2 and values1 parameters do not match." + ) # case S160 if values3 is not None and len(values3) != len(values1): # case S160 - raise ValueError("Length of values3 and values1 parameters do not match.") # case S160 + raise ValueError( + "Length of values3 and values1 parameters do not match." + ) # case S160 if values4 is not None and len(values4) != len(values1): # case S160 - raise ValueError("Length of values4 and values1 parameters do not match.") # case S160 - error_code = self._library.niFake_MultipleArraysSameSize(vi_ctype, values1_ctype, values2_ctype, values3_ctype, values4_ctype, size_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + raise ValueError( + "Length of values4 and values1 parameters do not match." + ) # case S160 + error_code = self._library.niFake_MultipleArraysSameSize( + vi_ctype, + values1_ctype, + values2_ctype, + values3_ctype, + values4_ctype, + size_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def one_input_function(self, a_number): - r'''one_input_function + r"""one_input_function This method takes one parameter other than the session. Args: a_number (int): Contains a number - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 a_number_ctype = _visatype.ViInt32(a_number) # case S150 error_code = self._library.niFake_OneInputFunction(vi_ctype, a_number_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def parameters_are_multiple_types(self, a_boolean, an_int32, an_int64, an_int_enum, a_float, a_float_enum, a_string): - r'''parameters_are_multiple_types + def parameters_are_multiple_types( + self, + a_boolean, + an_int32, + an_int64, + an_int_enum, + a_float, + a_float_enum, + a_string, + ): + r"""parameters_are_multiple_types Has parameters of multiple types. @@ -1552,11 +2019,15 @@ def parameters_are_multiple_types(self, a_boolean, an_int32, an_int64, an_int_en a_string (str): An IVI dance string. - ''' + """ if type(an_int_enum) is not enums.Turtle: - raise TypeError('Parameter an_int_enum must be of type ' + str(enums.Turtle)) + raise TypeError( + "Parameter an_int_enum must be of type " + str(enums.Turtle) + ) if type(a_float_enum) is not enums.FloatEnum: - raise TypeError('Parameter a_float_enum must be of type ' + str(enums.FloatEnum)) + raise TypeError( + "Parameter a_float_enum must be of type " + str(enums.FloatEnum) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 a_boolean_ctype = _visatype.ViBoolean(a_boolean) # case S150 an_int32_ctype = _visatype.ViInt32(an_int32) # case S150 @@ -1564,26 +2035,44 @@ def parameters_are_multiple_types(self, a_boolean, an_int32, an_int64, an_int_en an_int_enum_ctype = _visatype.ViInt16(an_int_enum.value) # case S130 a_float_ctype = _visatype.ViReal64(a_float) # case S150 a_float_enum_ctype = _visatype.ViReal64(a_float_enum.value) # case S130 - string_size_ctype = _visatype.ViInt32(0 if a_string is None else len(a_string)) # case S160 - a_string_ctype = ctypes.create_string_buffer(a_string.encode(self._encoding)) # case C020 - error_code = self._library.niFake_ParametersAreMultipleTypes(vi_ctype, a_boolean_ctype, an_int32_ctype, an_int64_ctype, an_int_enum_ctype, a_float_ctype, a_float_enum_ctype, string_size_ctype, a_string_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + string_size_ctype = _visatype.ViInt32( + 0 if a_string is None else len(a_string) + ) # case S160 + a_string_ctype = ctypes.create_string_buffer( + a_string.encode(self._encoding) + ) # case C020 + error_code = self._library.niFake_ParametersAreMultipleTypes( + vi_ctype, + a_boolean_ctype, + an_int32_ctype, + an_int64_ctype, + an_int_enum_ctype, + a_float_ctype, + a_float_enum_ctype, + string_size_ctype, + a_string_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def simple_function(self): - r'''simple_function + r"""simple_function This method takes no parameters other than the session. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFake_PoorlyNamedSimpleFunction(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def read(self, maximum_time): - r'''read + r"""read Acquires a single measurement and returns the measured value. @@ -1594,17 +2083,25 @@ def read(self, maximum_time): Returns: reading (float): The measured value. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_time_ctype = _converters.convert_timedelta_to_seconds_real64(maximum_time) # case S140 + maximum_time_ctype = _converters.convert_timedelta_to_seconds_real64( + maximum_time + ) # case S140 reading_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niFake_Read(vi_ctype, maximum_time_ctype, None if reading_ctype is None else (ctypes.pointer(reading_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_Read( + vi_ctype, + maximum_time_ctype, + None if reading_ctype is None else (ctypes.pointer(reading_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(reading_ctype.value) @ivi_synchronized def return_a_number_and_a_string(self): - r'''return_a_number_and_a_string + r"""return_a_number_and_a_string Returns a number and a string. @@ -1615,33 +2112,46 @@ def return_a_number_and_a_string(self): a_string (str): Contains a string. Buffer must be 256 bytes or larger. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 a_number_ctype = _visatype.ViInt16() # case S220 a_string_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niFake_ReturnANumberAndAString(vi_ctype, None if a_number_ctype is None else (ctypes.pointer(a_number_ctype)), a_string_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_ReturnANumberAndAString( + vi_ctype, + None if a_number_ctype is None else (ctypes.pointer(a_number_ctype)), + a_string_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(a_number_ctype.value), a_string_ctype.value.decode(self._encoding) @ivi_synchronized def return_duration_in_seconds(self): - r'''return_duration_in_seconds + r"""return_duration_in_seconds Returns a hightime.timedelta instance. Returns: timedelta (hightime.timedelta): Duration in seconds. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 timedelta_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niFake_ReturnDurationInSeconds(vi_ctype, None if timedelta_ctype is None else (ctypes.pointer(timedelta_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return _converters.convert_seconds_real64_to_timedelta(float(timedelta_ctype.value)) + error_code = self._library.niFake_ReturnDurationInSeconds( + vi_ctype, + None if timedelta_ctype is None else (ctypes.pointer(timedelta_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return _converters.convert_seconds_real64_to_timedelta( + float(timedelta_ctype.value) + ) @ivi_synchronized def return_list_of_durations_in_seconds(self, number_of_elements): - r'''return_list_of_durations_in_seconds + r"""return_list_of_durations_in_seconds Returns a list of hightime.timedelta instances. @@ -1652,18 +2162,26 @@ def return_list_of_durations_in_seconds(self, number_of_elements): Returns: timedeltas (hightime.timedelta): Contains a list of hightime.timedelta instances. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 number_of_elements_ctype = _visatype.ViInt32(number_of_elements) # case S210 timedeltas_size = number_of_elements # case B600 - timedeltas_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=timedeltas_size) # case B600 - error_code = self._library.niFake_ReturnListOfDurationsInSeconds(vi_ctype, number_of_elements_ctype, timedeltas_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return _converters.convert_seconds_real64_to_timedeltas([float(timedeltas_ctype[i]) for i in range(number_of_elements_ctype.value)]) + timedeltas_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViReal64, size=timedeltas_size + ) # case B600 + error_code = self._library.niFake_ReturnListOfDurationsInSeconds( + vi_ctype, number_of_elements_ctype, timedeltas_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return _converters.convert_seconds_real64_to_timedeltas( + [float(timedeltas_ctype[i]) for i in range(number_of_elements_ctype.value)] + ) @ivi_synchronized def return_multiple_types(self, array_size): - r'''return_multiple_types + r"""return_multiple_types Returns multiple types. @@ -1700,7 +2218,7 @@ def return_multiple_types(self, array_size): a_string (str): An IVI dance string. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 a_boolean_ctype = _visatype.ViBoolean() # case S220 an_int32_ctype = _visatype.ViInt32() # case S220 @@ -1710,53 +2228,109 @@ def return_multiple_types(self, array_size): a_float_enum_ctype = _visatype.ViReal64() # case S220 array_size_ctype = _visatype.ViInt32(array_size) # case S210 an_array_size = array_size # case B600 - an_array_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=an_array_size) # case B600 + an_array_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViReal64, size=an_array_size + ) # case B600 string_size_ctype = _visatype.ViInt32() # case S170 a_string_ctype = None # case C050 - error_code = self._library.niFake_ReturnMultipleTypes(vi_ctype, None if a_boolean_ctype is None else (ctypes.pointer(a_boolean_ctype)), None if an_int32_ctype is None else (ctypes.pointer(an_int32_ctype)), None if an_int64_ctype is None else (ctypes.pointer(an_int64_ctype)), None if an_int_enum_ctype is None else (ctypes.pointer(an_int_enum_ctype)), None if a_float_ctype is None else (ctypes.pointer(a_float_ctype)), None if a_float_enum_ctype is None else (ctypes.pointer(a_float_enum_ctype)), array_size_ctype, an_array_ctype, string_size_ctype, a_string_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niFake_ReturnMultipleTypes( + vi_ctype, + None if a_boolean_ctype is None else (ctypes.pointer(a_boolean_ctype)), + None if an_int32_ctype is None else (ctypes.pointer(an_int32_ctype)), + None if an_int64_ctype is None else (ctypes.pointer(an_int64_ctype)), + None if an_int_enum_ctype is None else (ctypes.pointer(an_int_enum_ctype)), + None if a_float_ctype is None else (ctypes.pointer(a_float_ctype)), + None + if a_float_enum_ctype is None + else (ctypes.pointer(a_float_enum_ctype)), + array_size_ctype, + an_array_ctype, + string_size_ctype, + a_string_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) string_size_ctype = _visatype.ViInt32(error_code) # case S180 a_string_ctype = (_visatype.ViChar * string_size_ctype.value)() # case C060 - error_code = self._library.niFake_ReturnMultipleTypes(vi_ctype, None if a_boolean_ctype is None else (ctypes.pointer(a_boolean_ctype)), None if an_int32_ctype is None else (ctypes.pointer(an_int32_ctype)), None if an_int64_ctype is None else (ctypes.pointer(an_int64_ctype)), None if an_int_enum_ctype is None else (ctypes.pointer(an_int_enum_ctype)), None if a_float_ctype is None else (ctypes.pointer(a_float_ctype)), None if a_float_enum_ctype is None else (ctypes.pointer(a_float_enum_ctype)), array_size_ctype, an_array_ctype, string_size_ctype, a_string_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return bool(a_boolean_ctype.value), int(an_int32_ctype.value), int(an_int64_ctype.value), enums.Turtle(an_int_enum_ctype.value), float(a_float_ctype.value), enums.FloatEnum(a_float_enum_ctype.value), [float(an_array_ctype[i]) for i in range(array_size_ctype.value)], a_string_ctype.value.decode(self._encoding) + error_code = self._library.niFake_ReturnMultipleTypes( + vi_ctype, + None if a_boolean_ctype is None else (ctypes.pointer(a_boolean_ctype)), + None if an_int32_ctype is None else (ctypes.pointer(an_int32_ctype)), + None if an_int64_ctype is None else (ctypes.pointer(an_int64_ctype)), + None if an_int_enum_ctype is None else (ctypes.pointer(an_int_enum_ctype)), + None if a_float_ctype is None else (ctypes.pointer(a_float_ctype)), + None + if a_float_enum_ctype is None + else (ctypes.pointer(a_float_enum_ctype)), + array_size_ctype, + an_array_ctype, + string_size_ctype, + a_string_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return ( + bool(a_boolean_ctype.value), + int(an_int32_ctype.value), + int(an_int64_ctype.value), + enums.Turtle(an_int_enum_ctype.value), + float(a_float_ctype.value), + enums.FloatEnum(a_float_enum_ctype.value), + [float(an_array_ctype[i]) for i in range(array_size_ctype.value)], + a_string_ctype.value.decode(self._encoding), + ) @ivi_synchronized def set_custom_type(self, cs): - r'''set_custom_type + r"""set_custom_type This method takes a custom type. Args: cs (CustomStruct): Set using custom type - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 cs_ctype = custom_struct.struct_CustomStruct(cs) # case S150 error_code = self._library.niFake_SetCustomType(vi_ctype, cs_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def set_custom_type_array(self, cs): - r'''set_custom_type_array + r"""set_custom_type_array This method takes an array of custom types. Args: cs (list of CustomStruct): Set using custom type - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - number_of_elements_ctype = _visatype.ViInt32(0 if cs is None else len(cs)) # case S160 - cs_ctype = get_ctypes_pointer_for_buffer([custom_struct.struct_CustomStruct(c) for c in cs], library_type=custom_struct.struct_CustomStruct) # case B540 - error_code = self._library.niFake_SetCustomTypeArray(vi_ctype, number_of_elements_ctype, cs_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + number_of_elements_ctype = _visatype.ViInt32( + 0 if cs is None else len(cs) + ) # case S160 + cs_ctype = get_ctypes_pointer_for_buffer( + [custom_struct.struct_CustomStruct(c) for c in cs], + library_type=custom_struct.struct_CustomStruct, + ) # case B540 + error_code = self._library.niFake_SetCustomTypeArray( + vi_ctype, number_of_elements_ctype, cs_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def string_valued_enum_input_function_with_defaults(self, a_mobile_os_name=enums.MobileOSNames.ANDROID): - r'''string_valued_enum_input_function_with_defaults + def string_valued_enum_input_function_with_defaults( + self, a_mobile_os_name=enums.MobileOSNames.ANDROID + ): + r"""string_valued_enum_input_function_with_defaults This method takes one parameter other than the session, which happens to be a string-valued enum and has a default value. @@ -1771,18 +2345,26 @@ def string_valued_enum_input_function_with_defaults(self, a_mobile_os_name=enums | NONE | None | +---------+---------+ - ''' + """ if type(a_mobile_os_name) is not enums.MobileOSNames: - raise TypeError('Parameter a_mobile_os_name must be of type ' + str(enums.MobileOSNames)) + raise TypeError( + "Parameter a_mobile_os_name must be of type " + str(enums.MobileOSNames) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - a_mobile_os_name_ctype = ctypes.create_string_buffer(a_mobile_os_name.value.encode(self._encoding)) # case C030 - error_code = self._library.niFake_StringValuedEnumInputFunctionWithDefaults(vi_ctype, a_mobile_os_name_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + a_mobile_os_name_ctype = ctypes.create_string_buffer( + a_mobile_os_name.value.encode(self._encoding) + ) # case C030 + error_code = self._library.niFake_StringValuedEnumInputFunctionWithDefaults( + vi_ctype, a_mobile_os_name_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def two_input_function(self, a_number, a_string): - r'''two_input_function + r"""two_input_function This method takes two parameters other than the session. @@ -1791,17 +2373,23 @@ def two_input_function(self, a_number, a_string): a_string (str): Contains a string - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 a_number_ctype = _visatype.ViReal64(a_number) # case S150 - a_string_ctype = ctypes.create_string_buffer(a_string.encode(self._encoding)) # case C020 - error_code = self._library.niFake_TwoInputFunction(vi_ctype, a_number_ctype, a_string_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + a_string_ctype = ctypes.create_string_buffer( + a_string.encode(self._encoding) + ) # case C020 + error_code = self._library.niFake_TwoInputFunction( + vi_ctype, a_number_ctype, a_string_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def use64_bit_number(self, input): - r'''use64_bit_number + r"""use64_bit_number Returns a number and a string. @@ -1814,73 +2402,102 @@ def use64_bit_number(self, input): Returns: output (int): A big number on its way out. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 input_ctype = _visatype.ViInt64(input) # case S150 output_ctype = _visatype.ViInt64() # case S220 - error_code = self._library.niFake_Use64BitNumber(vi_ctype, input_ctype, None if output_ctype is None else (ctypes.pointer(output_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_Use64BitNumber( + vi_ctype, + input_ctype, + None if output_ctype is None else (ctypes.pointer(output_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(output_ctype.value) @ivi_synchronized def write_waveform(self, waveform): - r'''write_waveform + r"""write_waveform Writes waveform to the driver Args: waveform (array.array("d")): Waveform data. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - number_of_samples_ctype = _visatype.ViInt32(0 if waveform is None else len(waveform)) # case S160 - waveform_array = get_ctypes_and_array(value=waveform, array_type="d") # case B550 - waveform_ctype = get_ctypes_pointer_for_buffer(value=waveform_array, library_type=_visatype.ViReal64) # case B550 - error_code = self._library.niFake_WriteWaveform(vi_ctype, number_of_samples_ctype, waveform_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + number_of_samples_ctype = _visatype.ViInt32( + 0 if waveform is None else len(waveform) + ) # case S160 + waveform_array = get_ctypes_and_array( + value=waveform, array_type="d" + ) # case B550 + waveform_ctype = get_ctypes_pointer_for_buffer( + value=waveform_array, library_type=_visatype.ViReal64 + ) # case B550 + error_code = self._library.niFake_WriteWaveform( + vi_ctype, number_of_samples_ctype, waveform_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def write_waveform_numpy(self, waveform): - r'''write_waveform + r"""write_waveform Writes waveform to the driver Args: waveform (numpy.array(dtype=numpy.float64)): Waveform data. - ''' + """ import numpy if type(waveform) is not numpy.ndarray: - raise TypeError('waveform must be {0}, is {1}'.format(numpy.ndarray, type(waveform))) + raise TypeError( + "waveform must be {0}, is {1}".format(numpy.ndarray, type(waveform)) + ) if numpy.isfortran(waveform) is True: - raise TypeError('waveform must be in C-order') - if waveform.dtype is not numpy.dtype('float64'): - raise TypeError('waveform must be numpy.ndarray of dtype=float64, is ' + str(waveform.dtype)) + raise TypeError("waveform must be in C-order") + if waveform.dtype is not numpy.dtype("float64"): + raise TypeError( + "waveform must be numpy.ndarray of dtype=float64, is " + + str(waveform.dtype) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - number_of_samples_ctype = _visatype.ViInt32(0 if waveform is None else len(waveform)) # case S160 + number_of_samples_ctype = _visatype.ViInt32( + 0 if waveform is None else len(waveform) + ) # case S160 waveform_ctype = get_ctypes_pointer_for_buffer(value=waveform) # case B510 - error_code = self._library.niFake_WriteWaveform(vi_ctype, number_of_samples_ctype, waveform_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFake_WriteWaveform( + vi_ctype, number_of_samples_ctype, waveform_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def _close(self): - r'''_close + r"""_close Closes the specified session and deallocates resources that it reserved. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFake_close(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def self_test(self): - '''self_test + """self_test Performs a self-test - ''' + """ code, msg = self._self_test() if code: raise errors.SelfTestError(code, msg) @@ -1888,7 +2505,7 @@ def self_test(self): @ivi_synchronized def _self_test(self): - r'''_self_test + r"""_self_test Performs a self-test. @@ -1897,13 +2514,20 @@ def _self_test(self): self_test_message (str): This parameter contains the string returned from the instrument self-test. The array must contain at least 256 elements. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 self_test_result_ctype = _visatype.ViInt16() # case S220 self_test_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niFake_self_test(vi_ctype, None if self_test_result_ctype is None else (ctypes.pointer(self_test_result_ctype)), self_test_message_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return int(self_test_result_ctype.value), self_test_message_ctype.value.decode(self._encoding) - - - + error_code = self._library.niFake_self_test( + vi_ctype, + None + if self_test_result_ctype is None + else (ctypes.pointer(self_test_result_ctype)), + self_test_message_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return int(self_test_result_ctype.value), self_test_message_ctype.value.decode( + self._encoding + ) diff --git a/generated/nifake/nifake/unit_tests/_matchers.py b/generated/nifake/nifake/unit_tests/_matchers.py index 1fb27f232..1cc981e9b 100644 --- a/generated/nifake/nifake/unit_tests/_matchers.py +++ b/generated/nifake/nifake/unit_tests/_matchers.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # This file was generated -'''Matcher classes used by unit tests in order to set mock expectations. +"""Matcher classes used by unit tests in order to set mock expectations. These work well with our visatype definitions. -''' +""" import ctypes import nifake._visatype as _visatype @@ -21,15 +21,27 @@ def __init__(self, expected_type, expected_value): def __eq__(self, other): if not isinstance(other, self.expected_type): - print("{0}: Unexpected type. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_type, type(other))) + print( + "{0}: Unexpected type. Expected: {1}. Received: {2}".format( + self.__class__.__name__, self.expected_type, type(other) + ) + ) return False if other.value != self.expected_value: - print("{0}: Unexpected value. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_value, other.value)) + print( + "{0}: Unexpected value. Expected: {1}. Received: {2}".format( + self.__class__.__name__, self.expected_value, other.value + ) + ) return False return True def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_type), + pp.pformat(self.expected_value), + ) class _PointerMatcher(object): @@ -38,12 +50,18 @@ def __init__(self, expected_type): def __eq__(self, other): if not isinstance(other, ctypes.POINTER(self.expected_type)): - print("Unexpected type. Expected: {0}. Received: {1}".format(ctypes.POINTER(self.expected_type), type(other))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + ctypes.POINTER(self.expected_type), type(other) + ) + ) return False return True def __repr__(self): - return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_type)) + return "{0}({1})".format( + self.__class__.__name__, pp.pformat(self.expected_type) + ) class _BufferMatcher(object): @@ -70,29 +88,47 @@ def __eq__(self, other): pass # Because of object lifetimes, we may need to mock the other instance and provide lists instead of the actual array - if not isinstance(other, self.expected_type) and not isinstance(other, list): - print("Unexpected type. Expected: {0} or {1}. Received: {2}".format(self.expected_type, list, type(other))) + if not isinstance(other, self.expected_type) and not isinstance( + other, list + ): + print( + "Unexpected type. Expected: {0} or {1}. Received: {2}".format( + self.expected_type, list, type(other) + ) + ) return False if self.expected_size != len(other): - print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(other))) + print( + "Unexpected length. Expected: {0}. Received: {1}".format( + self.expected_size, len(other) + ) + ) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for i in range(0, len(self.expected_value)): if self.expected_value[i] != other[i]: - print("Unexpected value at index {0}. Expected: {1}. Received: {2}".format(i, self.expected_value[i], other[i])) + print( + "Unexpected value at index {0}. Expected: {1}. Received: {2}".format( + i, self.expected_value[i], other[i] + ) + ) return False return True def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self._expected_element_type), pp.pformat(self._expected_size_or_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self._expected_element_type), + pp.pformat(self._expected_size_or_value), + ) def __str__(self): - ret_str = self.__repr__() + '\n' - ret_str += ' expected_type = ' + str(self.expected_type) + '\n' - ret_str += ' expected_value = ' + str(self.expected_value) + '\n' - ret_str += ' expected_size = ' + str(self.expected_size) + '\n' + ret_str = self.__repr__() + "\n" + ret_str += " expected_type = " + str(self.expected_type) + "\n" + ret_str += " expected_value = " + str(self.expected_value) + "\n" + ret_str += " expected_size = " + str(self.expected_size) + "\n" return ret_str @@ -112,21 +148,37 @@ def __eq__(self, other): pass if not isinstance(other, ctypes.Array): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(other))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_type, type(other) + ) + ) return False - if len(other) < len(self.expected_string_value) + 1: # +1 for NULL terminating character - print("Unexpected length in C string. Expected at least: {0}. Received {1}".format(len(other), len(self.expected_string_value) + 1)) + if ( + len(other) < len(self.expected_string_value) + 1 + ): # +1 for NULL terminating character + print( + "Unexpected length in C string. Expected at least: {0}. Received {1}".format( + len(other), len(self.expected_string_value) + 1 + ) + ) return False if not isinstance(other[0], bytes): print("Unexpected type. Not a string. Received: {0}".format(type(other[0]))) return False if other.value.decode("ascii") != self.expected_string_value: - print("Unexpected value. Expected {0}. Received: {1}".format(self.expected_string_value, other.value.decode)) + print( + "Unexpected value. Expected {0}. Received: {1}".format( + self.expected_string_value, other.value.decode + ) + ) return False return True def __repr__(self): - return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_string_value)) + return "{0}({1})".format( + self.__class__.__name__, pp.pformat(self.expected_string_value) + ) # Custom Type @@ -139,7 +191,11 @@ def _compare_ctype_structs(expected, actual): expected_val = getattr(expected, field_name) actual_val = getattr(actual, field_name) if expected_val != actual_val: - print("Unexpected value field {0}. Expected: {1}. Received: {2}".format(field_name, expected_val, actual_val)) + print( + "Unexpected value field {0}. Expected: {1}. Received: {2}".format( + field_name, expected_val, actual_val + ) + ) return False return True @@ -151,12 +207,20 @@ def __init__(self, expected_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_type, type(actual) + ) + ) return False return _compare_ctype_structs(self.expected_value, actual) def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_type), + pp.pformat(self.expected_value), + ) class CustomTypeBufferMatcher(object): @@ -168,30 +232,48 @@ def __init__(self, expected_element_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print("Unexpected array type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) + print( + "Unexpected array type. Expected: {0}. Received: {1}".format( + self.expected_type, type(actual) + ) + ) return False if self.expected_size != len(actual): - print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(actual))) + print( + "Unexpected length. Expected: {0}. Received: {1}".format( + self.expected_size, len(actual) + ) + ) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for a, e in zip(actual, self.expected_value): if not isinstance(a, self.expected_element_type): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_element_type, type(a))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_element_type, type(a) + ) + ) return False if not _compare_ctype_structs(e, a): return False return True def __repr__(self): - expected_val_repr = '[' + ', '.join([x.__repr__() for x in self.expected_value]) + ']' - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_element_type), expected_val_repr) + expected_val_repr = ( + "[" + ", ".join([x.__repr__() for x in self.expected_value]) + "]" + ) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_element_type), + expected_val_repr, + ) def __str__(self): - ret_str = self.__repr__() + '\n' - ret_str += ' expected_type = ' + str(self.expected_type) + '\n' - ret_str += ' expected_size = ' + str(self.expected_size) + '\n' + ret_str = self.__repr__() + "\n" + ret_str += " expected_type = " + str(self.expected_type) + "\n" + ret_str += " expected_size = " + str(self.expected_size) + "\n" return ret_str @@ -200,7 +282,9 @@ def __str__(self): class ViBooleanMatcher(_ScalarMatcher): def __init__(self, expected_value): - _ScalarMatcher.__init__(self, _visatype.ViBoolean, 1 if expected_value is True else 0) + _ScalarMatcher.__init__( + self, _visatype.ViBoolean, 1 if expected_value is True else 0 + ) class ViSessionMatcher(_ScalarMatcher): @@ -312,6 +396,3 @@ def __init__(self, expected_size_or_value): class ViSessionBufferMatcher(_BufferMatcher): def __init__(self, expected_size_or_value): _BufferMatcher.__init__(self, _visatype.ViSession, expected_size_or_value) - - - diff --git a/generated/nifake/nifake/unit_tests/_mock_helper.py b/generated/nifake/nifake/unit_tests/_mock_helper.py index 5099d6498..c96a11fd2 100644 --- a/generated/nifake/nifake/unit_tests/_mock_helper.py +++ b/generated/nifake/nifake/unit_tests/_mock_helper.py @@ -16,180 +16,180 @@ def __init__(self, function, param=None): class SideEffectsHelper(object): def __init__(self): self._defaults = {} - self._defaults['Abort'] = {} - self._defaults['Abort']['return'] = 0 - self._defaults['AcceptListOfDurationsInSeconds'] = {} - self._defaults['AcceptListOfDurationsInSeconds']['return'] = 0 - self._defaults['BoolArrayOutputFunction'] = {} - self._defaults['BoolArrayOutputFunction']['return'] = 0 - self._defaults['BoolArrayOutputFunction']['anArray'] = None - self._defaults['DoubleAllTheNums'] = {} - self._defaults['DoubleAllTheNums']['return'] = 0 - self._defaults['EnumArrayOutputFunction'] = {} - self._defaults['EnumArrayOutputFunction']['return'] = 0 - self._defaults['EnumArrayOutputFunction']['anArray'] = None - self._defaults['EnumInputFunctionWithDefaults'] = {} - self._defaults['EnumInputFunctionWithDefaults']['return'] = 0 - self._defaults['ExportAttributeConfigurationBuffer'] = {} - self._defaults['ExportAttributeConfigurationBuffer']['return'] = 0 - self._defaults['ExportAttributeConfigurationBuffer']['configuration'] = None - self._defaults['FetchWaveform'] = {} - self._defaults['FetchWaveform']['return'] = 0 - self._defaults['FetchWaveform']['waveformData'] = None - self._defaults['FetchWaveform']['actualNumberOfSamples'] = None - self._defaults['GetABoolean'] = {} - self._defaults['GetABoolean']['return'] = 0 - self._defaults['GetABoolean']['aBoolean'] = None - self._defaults['GetANumber'] = {} - self._defaults['GetANumber']['return'] = 0 - self._defaults['GetANumber']['aNumber'] = None - self._defaults['GetAStringOfFixedMaximumSize'] = {} - self._defaults['GetAStringOfFixedMaximumSize']['return'] = 0 - self._defaults['GetAStringOfFixedMaximumSize']['aString'] = None - self._defaults['GetAStringUsingPythonCode'] = {} - self._defaults['GetAStringUsingPythonCode']['return'] = 0 - self._defaults['GetAStringUsingPythonCode']['aString'] = None - self._defaults['GetAnIviDanceString'] = {} - self._defaults['GetAnIviDanceString']['return'] = 0 - self._defaults['GetAnIviDanceString']['aString'] = None - self._defaults['GetAnIviDanceWithATwistString'] = {} - self._defaults['GetAnIviDanceWithATwistString']['return'] = 0 - self._defaults['GetAnIviDanceWithATwistString']['actualSize'] = None - self._defaults['GetAnIviDanceWithATwistString']['aString'] = None - self._defaults['GetArrayForPythonCodeCustomType'] = {} - self._defaults['GetArrayForPythonCodeCustomType']['return'] = 0 - self._defaults['GetArrayForPythonCodeCustomType']['arrayOut'] = None - self._defaults['GetArrayForPythonCodeDouble'] = {} - self._defaults['GetArrayForPythonCodeDouble']['return'] = 0 - self._defaults['GetArrayForPythonCodeDouble']['arrayOut'] = None - self._defaults['GetArraySizeForPythonCode'] = {} - self._defaults['GetArraySizeForPythonCode']['return'] = 0 - self._defaults['GetArraySizeForPythonCode']['sizeOut'] = None - self._defaults['GetArrayUsingIviDance'] = {} - self._defaults['GetArrayUsingIviDance']['return'] = 0 - self._defaults['GetArrayUsingIviDance']['arrayOut'] = None - self._defaults['GetAttributeViBoolean'] = {} - self._defaults['GetAttributeViBoolean']['return'] = 0 - self._defaults['GetAttributeViBoolean']['attributeValue'] = None - self._defaults['GetAttributeViInt32'] = {} - self._defaults['GetAttributeViInt32']['return'] = 0 - self._defaults['GetAttributeViInt32']['attributeValue'] = None - self._defaults['GetAttributeViInt64'] = {} - self._defaults['GetAttributeViInt64']['return'] = 0 - self._defaults['GetAttributeViInt64']['attributeValue'] = None - self._defaults['GetAttributeViReal64'] = {} - self._defaults['GetAttributeViReal64']['return'] = 0 - self._defaults['GetAttributeViReal64']['attributeValue'] = None - self._defaults['GetAttributeViString'] = {} - self._defaults['GetAttributeViString']['return'] = 0 - self._defaults['GetAttributeViString']['attributeValue'] = None - self._defaults['GetCalDateAndTime'] = {} - self._defaults['GetCalDateAndTime']['return'] = 0 - self._defaults['GetCalDateAndTime']['month'] = None - self._defaults['GetCalDateAndTime']['day'] = None - self._defaults['GetCalDateAndTime']['year'] = None - self._defaults['GetCalDateAndTime']['hour'] = None - self._defaults['GetCalDateAndTime']['minute'] = None - self._defaults['GetCalInterval'] = {} - self._defaults['GetCalInterval']['return'] = 0 - self._defaults['GetCalInterval']['months'] = None - self._defaults['GetCustomType'] = {} - self._defaults['GetCustomType']['return'] = 0 - self._defaults['GetCustomType']['cs'] = None - self._defaults['GetCustomTypeArray'] = {} - self._defaults['GetCustomTypeArray']['return'] = 0 - self._defaults['GetCustomTypeArray']['cs'] = None - self._defaults['GetEnumValue'] = {} - self._defaults['GetEnumValue']['return'] = 0 - self._defaults['GetEnumValue']['aQuantity'] = None - self._defaults['GetEnumValue']['aTurtle'] = None - self._defaults['GetError'] = {} - self._defaults['GetError']['return'] = 0 - self._defaults['GetError']['errorCode'] = None - self._defaults['GetError']['description'] = None - self._defaults['ImportAttributeConfigurationBuffer'] = {} - self._defaults['ImportAttributeConfigurationBuffer']['return'] = 0 - self._defaults['InitWithOptions'] = {} - self._defaults['InitWithOptions']['return'] = 0 - self._defaults['InitWithOptions']['vi'] = None - self._defaults['Initiate'] = {} - self._defaults['Initiate']['return'] = 0 - self._defaults['LockSession'] = {} - self._defaults['LockSession']['return'] = 0 - self._defaults['LockSession']['callerHasLock'] = None - self._defaults['MultipleArrayTypes'] = {} - self._defaults['MultipleArrayTypes']['return'] = 0 - self._defaults['MultipleArrayTypes']['outputArray'] = None - self._defaults['MultipleArrayTypes']['outputArrayOfFixedLength'] = None - self._defaults['MultipleArraysSameSize'] = {} - self._defaults['MultipleArraysSameSize']['return'] = 0 - self._defaults['OneInputFunction'] = {} - self._defaults['OneInputFunction']['return'] = 0 - self._defaults['ParametersAreMultipleTypes'] = {} - self._defaults['ParametersAreMultipleTypes']['return'] = 0 - self._defaults['PoorlyNamedSimpleFunction'] = {} - self._defaults['PoorlyNamedSimpleFunction']['return'] = 0 - self._defaults['Read'] = {} - self._defaults['Read']['return'] = 0 - self._defaults['Read']['reading'] = None - self._defaults['ReadFromChannel'] = {} - self._defaults['ReadFromChannel']['return'] = 0 - self._defaults['ReadFromChannel']['reading'] = None - self._defaults['ReturnANumberAndAString'] = {} - self._defaults['ReturnANumberAndAString']['return'] = 0 - self._defaults['ReturnANumberAndAString']['aNumber'] = None - self._defaults['ReturnANumberAndAString']['aString'] = None - self._defaults['ReturnDurationInSeconds'] = {} - self._defaults['ReturnDurationInSeconds']['return'] = 0 - self._defaults['ReturnDurationInSeconds']['timedelta'] = None - self._defaults['ReturnListOfDurationsInSeconds'] = {} - self._defaults['ReturnListOfDurationsInSeconds']['return'] = 0 - self._defaults['ReturnListOfDurationsInSeconds']['timedeltas'] = None - self._defaults['ReturnMultipleTypes'] = {} - self._defaults['ReturnMultipleTypes']['return'] = 0 - self._defaults['ReturnMultipleTypes']['aBoolean'] = None - self._defaults['ReturnMultipleTypes']['anInt32'] = None - self._defaults['ReturnMultipleTypes']['anInt64'] = None - self._defaults['ReturnMultipleTypes']['anIntEnum'] = None - self._defaults['ReturnMultipleTypes']['aFloat'] = None - self._defaults['ReturnMultipleTypes']['aFloatEnum'] = None - self._defaults['ReturnMultipleTypes']['anArray'] = None - self._defaults['ReturnMultipleTypes']['aString'] = None - self._defaults['SetAttributeViBoolean'] = {} - self._defaults['SetAttributeViBoolean']['return'] = 0 - self._defaults['SetAttributeViInt32'] = {} - self._defaults['SetAttributeViInt32']['return'] = 0 - self._defaults['SetAttributeViInt64'] = {} - self._defaults['SetAttributeViInt64']['return'] = 0 - self._defaults['SetAttributeViReal64'] = {} - self._defaults['SetAttributeViReal64']['return'] = 0 - self._defaults['SetAttributeViString'] = {} - self._defaults['SetAttributeViString']['return'] = 0 - self._defaults['SetCustomType'] = {} - self._defaults['SetCustomType']['return'] = 0 - self._defaults['SetCustomTypeArray'] = {} - self._defaults['SetCustomTypeArray']['return'] = 0 - self._defaults['StringValuedEnumInputFunctionWithDefaults'] = {} - self._defaults['StringValuedEnumInputFunctionWithDefaults']['return'] = 0 - self._defaults['TwoInputFunction'] = {} - self._defaults['TwoInputFunction']['return'] = 0 - self._defaults['UnlockSession'] = {} - self._defaults['UnlockSession']['return'] = 0 - self._defaults['UnlockSession']['callerHasLock'] = None - self._defaults['Use64BitNumber'] = {} - self._defaults['Use64BitNumber']['return'] = 0 - self._defaults['Use64BitNumber']['output'] = None - self._defaults['WriteWaveform'] = {} - self._defaults['WriteWaveform']['return'] = 0 - self._defaults['close'] = {} - self._defaults['close']['return'] = 0 - self._defaults['error_message'] = {} - self._defaults['error_message']['return'] = 0 - self._defaults['error_message']['errorMessage'] = None - self._defaults['self_test'] = {} - self._defaults['self_test']['return'] = 0 - self._defaults['self_test']['selfTestResult'] = None - self._defaults['self_test']['selfTestMessage'] = None + self._defaults["Abort"] = {} + self._defaults["Abort"]["return"] = 0 + self._defaults["AcceptListOfDurationsInSeconds"] = {} + self._defaults["AcceptListOfDurationsInSeconds"]["return"] = 0 + self._defaults["BoolArrayOutputFunction"] = {} + self._defaults["BoolArrayOutputFunction"]["return"] = 0 + self._defaults["BoolArrayOutputFunction"]["anArray"] = None + self._defaults["DoubleAllTheNums"] = {} + self._defaults["DoubleAllTheNums"]["return"] = 0 + self._defaults["EnumArrayOutputFunction"] = {} + self._defaults["EnumArrayOutputFunction"]["return"] = 0 + self._defaults["EnumArrayOutputFunction"]["anArray"] = None + self._defaults["EnumInputFunctionWithDefaults"] = {} + self._defaults["EnumInputFunctionWithDefaults"]["return"] = 0 + self._defaults["ExportAttributeConfigurationBuffer"] = {} + self._defaults["ExportAttributeConfigurationBuffer"]["return"] = 0 + self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] = None + self._defaults["FetchWaveform"] = {} + self._defaults["FetchWaveform"]["return"] = 0 + self._defaults["FetchWaveform"]["waveformData"] = None + self._defaults["FetchWaveform"]["actualNumberOfSamples"] = None + self._defaults["GetABoolean"] = {} + self._defaults["GetABoolean"]["return"] = 0 + self._defaults["GetABoolean"]["aBoolean"] = None + self._defaults["GetANumber"] = {} + self._defaults["GetANumber"]["return"] = 0 + self._defaults["GetANumber"]["aNumber"] = None + self._defaults["GetAStringOfFixedMaximumSize"] = {} + self._defaults["GetAStringOfFixedMaximumSize"]["return"] = 0 + self._defaults["GetAStringOfFixedMaximumSize"]["aString"] = None + self._defaults["GetAStringUsingPythonCode"] = {} + self._defaults["GetAStringUsingPythonCode"]["return"] = 0 + self._defaults["GetAStringUsingPythonCode"]["aString"] = None + self._defaults["GetAnIviDanceString"] = {} + self._defaults["GetAnIviDanceString"]["return"] = 0 + self._defaults["GetAnIviDanceString"]["aString"] = None + self._defaults["GetAnIviDanceWithATwistString"] = {} + self._defaults["GetAnIviDanceWithATwistString"]["return"] = 0 + self._defaults["GetAnIviDanceWithATwistString"]["actualSize"] = None + self._defaults["GetAnIviDanceWithATwistString"]["aString"] = None + self._defaults["GetArrayForPythonCodeCustomType"] = {} + self._defaults["GetArrayForPythonCodeCustomType"]["return"] = 0 + self._defaults["GetArrayForPythonCodeCustomType"]["arrayOut"] = None + self._defaults["GetArrayForPythonCodeDouble"] = {} + self._defaults["GetArrayForPythonCodeDouble"]["return"] = 0 + self._defaults["GetArrayForPythonCodeDouble"]["arrayOut"] = None + self._defaults["GetArraySizeForPythonCode"] = {} + self._defaults["GetArraySizeForPythonCode"]["return"] = 0 + self._defaults["GetArraySizeForPythonCode"]["sizeOut"] = None + self._defaults["GetArrayUsingIviDance"] = {} + self._defaults["GetArrayUsingIviDance"]["return"] = 0 + self._defaults["GetArrayUsingIviDance"]["arrayOut"] = None + self._defaults["GetAttributeViBoolean"] = {} + self._defaults["GetAttributeViBoolean"]["return"] = 0 + self._defaults["GetAttributeViBoolean"]["attributeValue"] = None + self._defaults["GetAttributeViInt32"] = {} + self._defaults["GetAttributeViInt32"]["return"] = 0 + self._defaults["GetAttributeViInt32"]["attributeValue"] = None + self._defaults["GetAttributeViInt64"] = {} + self._defaults["GetAttributeViInt64"]["return"] = 0 + self._defaults["GetAttributeViInt64"]["attributeValue"] = None + self._defaults["GetAttributeViReal64"] = {} + self._defaults["GetAttributeViReal64"]["return"] = 0 + self._defaults["GetAttributeViReal64"]["attributeValue"] = None + self._defaults["GetAttributeViString"] = {} + self._defaults["GetAttributeViString"]["return"] = 0 + self._defaults["GetAttributeViString"]["attributeValue"] = None + self._defaults["GetCalDateAndTime"] = {} + self._defaults["GetCalDateAndTime"]["return"] = 0 + self._defaults["GetCalDateAndTime"]["month"] = None + self._defaults["GetCalDateAndTime"]["day"] = None + self._defaults["GetCalDateAndTime"]["year"] = None + self._defaults["GetCalDateAndTime"]["hour"] = None + self._defaults["GetCalDateAndTime"]["minute"] = None + self._defaults["GetCalInterval"] = {} + self._defaults["GetCalInterval"]["return"] = 0 + self._defaults["GetCalInterval"]["months"] = None + self._defaults["GetCustomType"] = {} + self._defaults["GetCustomType"]["return"] = 0 + self._defaults["GetCustomType"]["cs"] = None + self._defaults["GetCustomTypeArray"] = {} + self._defaults["GetCustomTypeArray"]["return"] = 0 + self._defaults["GetCustomTypeArray"]["cs"] = None + self._defaults["GetEnumValue"] = {} + self._defaults["GetEnumValue"]["return"] = 0 + self._defaults["GetEnumValue"]["aQuantity"] = None + self._defaults["GetEnumValue"]["aTurtle"] = None + self._defaults["GetError"] = {} + self._defaults["GetError"]["return"] = 0 + self._defaults["GetError"]["errorCode"] = None + self._defaults["GetError"]["description"] = None + self._defaults["ImportAttributeConfigurationBuffer"] = {} + self._defaults["ImportAttributeConfigurationBuffer"]["return"] = 0 + self._defaults["InitWithOptions"] = {} + self._defaults["InitWithOptions"]["return"] = 0 + self._defaults["InitWithOptions"]["vi"] = None + self._defaults["Initiate"] = {} + self._defaults["Initiate"]["return"] = 0 + self._defaults["LockSession"] = {} + self._defaults["LockSession"]["return"] = 0 + self._defaults["LockSession"]["callerHasLock"] = None + self._defaults["MultipleArrayTypes"] = {} + self._defaults["MultipleArrayTypes"]["return"] = 0 + self._defaults["MultipleArrayTypes"]["outputArray"] = None + self._defaults["MultipleArrayTypes"]["outputArrayOfFixedLength"] = None + self._defaults["MultipleArraysSameSize"] = {} + self._defaults["MultipleArraysSameSize"]["return"] = 0 + self._defaults["OneInputFunction"] = {} + self._defaults["OneInputFunction"]["return"] = 0 + self._defaults["ParametersAreMultipleTypes"] = {} + self._defaults["ParametersAreMultipleTypes"]["return"] = 0 + self._defaults["PoorlyNamedSimpleFunction"] = {} + self._defaults["PoorlyNamedSimpleFunction"]["return"] = 0 + self._defaults["Read"] = {} + self._defaults["Read"]["return"] = 0 + self._defaults["Read"]["reading"] = None + self._defaults["ReadFromChannel"] = {} + self._defaults["ReadFromChannel"]["return"] = 0 + self._defaults["ReadFromChannel"]["reading"] = None + self._defaults["ReturnANumberAndAString"] = {} + self._defaults["ReturnANumberAndAString"]["return"] = 0 + self._defaults["ReturnANumberAndAString"]["aNumber"] = None + self._defaults["ReturnANumberAndAString"]["aString"] = None + self._defaults["ReturnDurationInSeconds"] = {} + self._defaults["ReturnDurationInSeconds"]["return"] = 0 + self._defaults["ReturnDurationInSeconds"]["timedelta"] = None + self._defaults["ReturnListOfDurationsInSeconds"] = {} + self._defaults["ReturnListOfDurationsInSeconds"]["return"] = 0 + self._defaults["ReturnListOfDurationsInSeconds"]["timedeltas"] = None + self._defaults["ReturnMultipleTypes"] = {} + self._defaults["ReturnMultipleTypes"]["return"] = 0 + self._defaults["ReturnMultipleTypes"]["aBoolean"] = None + self._defaults["ReturnMultipleTypes"]["anInt32"] = None + self._defaults["ReturnMultipleTypes"]["anInt64"] = None + self._defaults["ReturnMultipleTypes"]["anIntEnum"] = None + self._defaults["ReturnMultipleTypes"]["aFloat"] = None + self._defaults["ReturnMultipleTypes"]["aFloatEnum"] = None + self._defaults["ReturnMultipleTypes"]["anArray"] = None + self._defaults["ReturnMultipleTypes"]["aString"] = None + self._defaults["SetAttributeViBoolean"] = {} + self._defaults["SetAttributeViBoolean"]["return"] = 0 + self._defaults["SetAttributeViInt32"] = {} + self._defaults["SetAttributeViInt32"]["return"] = 0 + self._defaults["SetAttributeViInt64"] = {} + self._defaults["SetAttributeViInt64"]["return"] = 0 + self._defaults["SetAttributeViReal64"] = {} + self._defaults["SetAttributeViReal64"]["return"] = 0 + self._defaults["SetAttributeViString"] = {} + self._defaults["SetAttributeViString"]["return"] = 0 + self._defaults["SetCustomType"] = {} + self._defaults["SetCustomType"]["return"] = 0 + self._defaults["SetCustomTypeArray"] = {} + self._defaults["SetCustomTypeArray"]["return"] = 0 + self._defaults["StringValuedEnumInputFunctionWithDefaults"] = {} + self._defaults["StringValuedEnumInputFunctionWithDefaults"]["return"] = 0 + self._defaults["TwoInputFunction"] = {} + self._defaults["TwoInputFunction"]["return"] = 0 + self._defaults["UnlockSession"] = {} + self._defaults["UnlockSession"]["return"] = 0 + self._defaults["UnlockSession"]["callerHasLock"] = None + self._defaults["Use64BitNumber"] = {} + self._defaults["Use64BitNumber"]["return"] = 0 + self._defaults["Use64BitNumber"]["output"] = None + self._defaults["WriteWaveform"] = {} + self._defaults["WriteWaveform"]["return"] = 0 + self._defaults["close"] = {} + self._defaults["close"]["return"] = 0 + self._defaults["error_message"] = {} + self._defaults["error_message"]["return"] = 0 + self._defaults["error_message"]["errorMessage"] = None + self._defaults["self_test"] = {} + self._defaults["self_test"]["return"] = 0 + self._defaults["self_test"]["selfTestResult"] = None + self._defaults["self_test"]["selfTestMessage"] = None def __getitem__(self, func): return self._defaults[func] @@ -198,22 +198,26 @@ def __setitem__(self, func, val): self._defaults[func] = val def niFake_Abort(self, vi): # noqa: N802 - if self._defaults['Abort']['return'] != 0: - return self._defaults['Abort']['return'] - return self._defaults['Abort']['return'] + if self._defaults["Abort"]["return"] != 0: + return self._defaults["Abort"]["return"] + return self._defaults["Abort"]["return"] def niFake_AcceptListOfDurationsInSeconds(self, vi, count, delays): # noqa: N802 - if self._defaults['AcceptListOfDurationsInSeconds']['return'] != 0: - return self._defaults['AcceptListOfDurationsInSeconds']['return'] - return self._defaults['AcceptListOfDurationsInSeconds']['return'] - - def niFake_BoolArrayOutputFunction(self, vi, number_of_elements, an_array): # noqa: N802 - if self._defaults['BoolArrayOutputFunction']['return'] != 0: - return self._defaults['BoolArrayOutputFunction']['return'] + if self._defaults["AcceptListOfDurationsInSeconds"]["return"] != 0: + return self._defaults["AcceptListOfDurationsInSeconds"]["return"] + return self._defaults["AcceptListOfDurationsInSeconds"]["return"] + + def niFake_BoolArrayOutputFunction( + self, vi, number_of_elements, an_array + ): # noqa: N802 + if self._defaults["BoolArrayOutputFunction"]["return"] != 0: + return self._defaults["BoolArrayOutputFunction"]["return"] # an_array - if self._defaults['BoolArrayOutputFunction']['anArray'] is None: - raise MockFunctionCallError("niFake_BoolArrayOutputFunction", param='anArray') - test_value = self._defaults['BoolArrayOutputFunction']['anArray'] + if self._defaults["BoolArrayOutputFunction"]["anArray"] is None: + raise MockFunctionCallError( + "niFake_BoolArrayOutputFunction", param="anArray" + ) + test_value = self._defaults["BoolArrayOutputFunction"]["anArray"] try: an_array_ref = an_array.contents except AttributeError: @@ -221,20 +225,24 @@ def niFake_BoolArrayOutputFunction(self, vi, number_of_elements, an_array): # n assert len(an_array_ref) >= len(test_value) for i in range(len(test_value)): an_array_ref[i] = test_value[i] - return self._defaults['BoolArrayOutputFunction']['return'] + return self._defaults["BoolArrayOutputFunction"]["return"] def niFake_DoubleAllTheNums(self, vi, number_count, numbers): # noqa: N802 - if self._defaults['DoubleAllTheNums']['return'] != 0: - return self._defaults['DoubleAllTheNums']['return'] - return self._defaults['DoubleAllTheNums']['return'] - - def niFake_EnumArrayOutputFunction(self, vi, number_of_elements, an_array): # noqa: N802 - if self._defaults['EnumArrayOutputFunction']['return'] != 0: - return self._defaults['EnumArrayOutputFunction']['return'] + if self._defaults["DoubleAllTheNums"]["return"] != 0: + return self._defaults["DoubleAllTheNums"]["return"] + return self._defaults["DoubleAllTheNums"]["return"] + + def niFake_EnumArrayOutputFunction( + self, vi, number_of_elements, an_array + ): # noqa: N802 + if self._defaults["EnumArrayOutputFunction"]["return"] != 0: + return self._defaults["EnumArrayOutputFunction"]["return"] # an_array - if self._defaults['EnumArrayOutputFunction']['anArray'] is None: - raise MockFunctionCallError("niFake_EnumArrayOutputFunction", param='anArray') - test_value = self._defaults['EnumArrayOutputFunction']['anArray'] + if self._defaults["EnumArrayOutputFunction"]["anArray"] is None: + raise MockFunctionCallError( + "niFake_EnumArrayOutputFunction", param="anArray" + ) + test_value = self._defaults["EnumArrayOutputFunction"]["anArray"] try: an_array_ref = an_array.contents except AttributeError: @@ -242,35 +250,50 @@ def niFake_EnumArrayOutputFunction(self, vi, number_of_elements, an_array): # n assert len(an_array_ref) >= len(test_value) for i in range(len(test_value)): an_array_ref[i] = test_value[i] - return self._defaults['EnumArrayOutputFunction']['return'] + return self._defaults["EnumArrayOutputFunction"]["return"] def niFake_EnumInputFunctionWithDefaults(self, vi, a_turtle): # noqa: N802 - if self._defaults['EnumInputFunctionWithDefaults']['return'] != 0: - return self._defaults['EnumInputFunctionWithDefaults']['return'] - return self._defaults['EnumInputFunctionWithDefaults']['return'] - - def niFake_ExportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 - if self._defaults['ExportAttributeConfigurationBuffer']['return'] != 0: - return self._defaults['ExportAttributeConfigurationBuffer']['return'] - if self._defaults['ExportAttributeConfigurationBuffer']['configuration'] is None: - raise MockFunctionCallError("niFake_ExportAttributeConfigurationBuffer", param='configuration') + if self._defaults["EnumInputFunctionWithDefaults"]["return"] != 0: + return self._defaults["EnumInputFunctionWithDefaults"]["return"] + return self._defaults["EnumInputFunctionWithDefaults"]["return"] + + def niFake_ExportAttributeConfigurationBuffer( + self, vi, size_in_bytes, configuration + ): # noqa: N802 + if self._defaults["ExportAttributeConfigurationBuffer"]["return"] != 0: + return self._defaults["ExportAttributeConfigurationBuffer"]["return"] + if ( + self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] + is None + ): + raise MockFunctionCallError( + "niFake_ExportAttributeConfigurationBuffer", param="configuration" + ) if size_in_bytes.value == 0: - return len(self._defaults['ExportAttributeConfigurationBuffer']['configuration']) + return len( + self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] + ) try: configuration_ref = configuration.contents except AttributeError: configuration_ref = configuration - for i in range(len(self._defaults['ExportAttributeConfigurationBuffer']['configuration'])): - configuration_ref[i] = self._defaults['ExportAttributeConfigurationBuffer']['configuration'][i] - return self._defaults['ExportAttributeConfigurationBuffer']['return'] - - def niFake_FetchWaveform(self, vi, number_of_samples, waveform_data, actual_number_of_samples): # noqa: N802 - if self._defaults['FetchWaveform']['return'] != 0: - return self._defaults['FetchWaveform']['return'] + for i in range( + len(self._defaults["ExportAttributeConfigurationBuffer"]["configuration"]) + ): + configuration_ref[i] = self._defaults["ExportAttributeConfigurationBuffer"][ + "configuration" + ][i] + return self._defaults["ExportAttributeConfigurationBuffer"]["return"] + + def niFake_FetchWaveform( + self, vi, number_of_samples, waveform_data, actual_number_of_samples + ): # noqa: N802 + if self._defaults["FetchWaveform"]["return"] != 0: + return self._defaults["FetchWaveform"]["return"] # waveform_data - if self._defaults['FetchWaveform']['waveformData'] is None: - raise MockFunctionCallError("niFake_FetchWaveform", param='waveformData') - test_value = self._defaults['FetchWaveform']['waveformData'] + if self._defaults["FetchWaveform"]["waveformData"] is None: + raise MockFunctionCallError("niFake_FetchWaveform", param="waveformData") + test_value = self._defaults["FetchWaveform"]["waveformData"] try: waveform_data_ref = waveform_data.contents except AttributeError: @@ -279,92 +302,116 @@ def niFake_FetchWaveform(self, vi, number_of_samples, waveform_data, actual_numb for i in range(len(test_value)): waveform_data_ref[i] = test_value[i] # actual_number_of_samples - if self._defaults['FetchWaveform']['actualNumberOfSamples'] is None: - raise MockFunctionCallError("niFake_FetchWaveform", param='actualNumberOfSamples') + if self._defaults["FetchWaveform"]["actualNumberOfSamples"] is None: + raise MockFunctionCallError( + "niFake_FetchWaveform", param="actualNumberOfSamples" + ) if actual_number_of_samples is not None: - actual_number_of_samples.contents.value = self._defaults['FetchWaveform']['actualNumberOfSamples'] - return self._defaults['FetchWaveform']['return'] + actual_number_of_samples.contents.value = self._defaults["FetchWaveform"][ + "actualNumberOfSamples" + ] + return self._defaults["FetchWaveform"]["return"] def niFake_GetABoolean(self, vi, a_boolean): # noqa: N802 - if self._defaults['GetABoolean']['return'] != 0: - return self._defaults['GetABoolean']['return'] + if self._defaults["GetABoolean"]["return"] != 0: + return self._defaults["GetABoolean"]["return"] # a_boolean - if self._defaults['GetABoolean']['aBoolean'] is None: - raise MockFunctionCallError("niFake_GetABoolean", param='aBoolean') + if self._defaults["GetABoolean"]["aBoolean"] is None: + raise MockFunctionCallError("niFake_GetABoolean", param="aBoolean") if a_boolean is not None: - a_boolean.contents.value = self._defaults['GetABoolean']['aBoolean'] - return self._defaults['GetABoolean']['return'] + a_boolean.contents.value = self._defaults["GetABoolean"]["aBoolean"] + return self._defaults["GetABoolean"]["return"] def niFake_GetANumber(self, vi, a_number): # noqa: N802 - if self._defaults['GetANumber']['return'] != 0: - return self._defaults['GetANumber']['return'] + if self._defaults["GetANumber"]["return"] != 0: + return self._defaults["GetANumber"]["return"] # a_number - if self._defaults['GetANumber']['aNumber'] is None: - raise MockFunctionCallError("niFake_GetANumber", param='aNumber') + if self._defaults["GetANumber"]["aNumber"] is None: + raise MockFunctionCallError("niFake_GetANumber", param="aNumber") if a_number is not None: - a_number.contents.value = self._defaults['GetANumber']['aNumber'] - return self._defaults['GetANumber']['return'] + a_number.contents.value = self._defaults["GetANumber"]["aNumber"] + return self._defaults["GetANumber"]["return"] def niFake_GetAStringOfFixedMaximumSize(self, vi, a_string): # noqa: N802 - if self._defaults['GetAStringOfFixedMaximumSize']['return'] != 0: - return self._defaults['GetAStringOfFixedMaximumSize']['return'] + if self._defaults["GetAStringOfFixedMaximumSize"]["return"] != 0: + return self._defaults["GetAStringOfFixedMaximumSize"]["return"] # a_string - if self._defaults['GetAStringOfFixedMaximumSize']['aString'] is None: - raise MockFunctionCallError("niFake_GetAStringOfFixedMaximumSize", param='aString') - test_value = self._defaults['GetAStringOfFixedMaximumSize']['aString'] + if self._defaults["GetAStringOfFixedMaximumSize"]["aString"] is None: + raise MockFunctionCallError( + "niFake_GetAStringOfFixedMaximumSize", param="aString" + ) + test_value = self._defaults["GetAStringOfFixedMaximumSize"]["aString"] if type(test_value) is str: - test_value = test_value.encode('ascii') + test_value = test_value.encode("ascii") assert len(a_string) >= len(test_value) for i in range(len(test_value)): a_string[i] = test_value[i] - return self._defaults['GetAStringOfFixedMaximumSize']['return'] + return self._defaults["GetAStringOfFixedMaximumSize"]["return"] def niFake_GetAStringUsingPythonCode(self, vi, a_number, a_string): # noqa: N802 - if self._defaults['GetAStringUsingPythonCode']['return'] != 0: - return self._defaults['GetAStringUsingPythonCode']['return'] + if self._defaults["GetAStringUsingPythonCode"]["return"] != 0: + return self._defaults["GetAStringUsingPythonCode"]["return"] # a_string - if self._defaults['GetAStringUsingPythonCode']['aString'] is None: - raise MockFunctionCallError("niFake_GetAStringUsingPythonCode", param='aString') - test_value = self._defaults['GetAStringUsingPythonCode']['aString'] + if self._defaults["GetAStringUsingPythonCode"]["aString"] is None: + raise MockFunctionCallError( + "niFake_GetAStringUsingPythonCode", param="aString" + ) + test_value = self._defaults["GetAStringUsingPythonCode"]["aString"] if type(test_value) is str: - test_value = test_value.encode('ascii') + test_value = test_value.encode("ascii") assert len(a_string) >= len(test_value) for i in range(len(test_value)): a_string[i] = test_value[i] - return self._defaults['GetAStringUsingPythonCode']['return'] + return self._defaults["GetAStringUsingPythonCode"]["return"] def niFake_GetAnIviDanceString(self, vi, buffer_size, a_string): # noqa: N802 - if self._defaults['GetAnIviDanceString']['return'] != 0: - return self._defaults['GetAnIviDanceString']['return'] - if self._defaults['GetAnIviDanceString']['aString'] is None: - raise MockFunctionCallError("niFake_GetAnIviDanceString", param='aString') + if self._defaults["GetAnIviDanceString"]["return"] != 0: + return self._defaults["GetAnIviDanceString"]["return"] + if self._defaults["GetAnIviDanceString"]["aString"] is None: + raise MockFunctionCallError("niFake_GetAnIviDanceString", param="aString") if buffer_size.value == 0: - return len(self._defaults['GetAnIviDanceString']['aString']) - a_string.value = self._defaults['GetAnIviDanceString']['aString'].encode('ascii') - return self._defaults['GetAnIviDanceString']['return'] - - def niFake_GetAnIviDanceWithATwistString(self, vi, buffer_size, a_string, actual_size): # noqa: N802 - if self._defaults['GetAnIviDanceWithATwistString']['return'] != 0: - return self._defaults['GetAnIviDanceWithATwistString']['return'] + return len(self._defaults["GetAnIviDanceString"]["aString"]) + a_string.value = self._defaults["GetAnIviDanceString"]["aString"].encode( + "ascii" + ) + return self._defaults["GetAnIviDanceString"]["return"] + + def niFake_GetAnIviDanceWithATwistString( + self, vi, buffer_size, a_string, actual_size + ): # noqa: N802 + if self._defaults["GetAnIviDanceWithATwistString"]["return"] != 0: + return self._defaults["GetAnIviDanceWithATwistString"]["return"] # actual_size - if self._defaults['GetAnIviDanceWithATwistString']['actualSize'] is None: - raise MockFunctionCallError("niFake_GetAnIviDanceWithATwistString", param='actualSize') + if self._defaults["GetAnIviDanceWithATwistString"]["actualSize"] is None: + raise MockFunctionCallError( + "niFake_GetAnIviDanceWithATwistString", param="actualSize" + ) if actual_size is not None: - actual_size.contents.value = self._defaults['GetAnIviDanceWithATwistString']['actualSize'] - if self._defaults['GetAnIviDanceWithATwistString']['aString'] is None: - raise MockFunctionCallError("niFake_GetAnIviDanceWithATwistString", param='aString') + actual_size.contents.value = self._defaults[ + "GetAnIviDanceWithATwistString" + ]["actualSize"] + if self._defaults["GetAnIviDanceWithATwistString"]["aString"] is None: + raise MockFunctionCallError( + "niFake_GetAnIviDanceWithATwistString", param="aString" + ) if buffer_size.value == 0: - return len(self._defaults['GetAnIviDanceWithATwistString']['aString']) - a_string.value = self._defaults['GetAnIviDanceWithATwistString']['aString'].encode('ascii') - return self._defaults['GetAnIviDanceWithATwistString']['return'] - - def niFake_GetArrayForPythonCodeCustomType(self, vi, number_of_elements, array_out): # noqa: N802 - if self._defaults['GetArrayForPythonCodeCustomType']['return'] != 0: - return self._defaults['GetArrayForPythonCodeCustomType']['return'] + return len(self._defaults["GetAnIviDanceWithATwistString"]["aString"]) + a_string.value = self._defaults["GetAnIviDanceWithATwistString"][ + "aString" + ].encode("ascii") + return self._defaults["GetAnIviDanceWithATwistString"]["return"] + + def niFake_GetArrayForPythonCodeCustomType( + self, vi, number_of_elements, array_out + ): # noqa: N802 + if self._defaults["GetArrayForPythonCodeCustomType"]["return"] != 0: + return self._defaults["GetArrayForPythonCodeCustomType"]["return"] # array_out - if self._defaults['GetArrayForPythonCodeCustomType']['arrayOut'] is None: - raise MockFunctionCallError("niFake_GetArrayForPythonCodeCustomType", param='arrayOut') - test_value = self._defaults['GetArrayForPythonCodeCustomType']['arrayOut'] + if self._defaults["GetArrayForPythonCodeCustomType"]["arrayOut"] is None: + raise MockFunctionCallError( + "niFake_GetArrayForPythonCodeCustomType", param="arrayOut" + ) + test_value = self._defaults["GetArrayForPythonCodeCustomType"]["arrayOut"] try: array_out_ref = array_out.contents except AttributeError: @@ -372,15 +419,19 @@ def niFake_GetArrayForPythonCodeCustomType(self, vi, number_of_elements, array_o assert len(array_out_ref) >= len(test_value) for i in range(len(test_value)): array_out_ref[i] = test_value[i] - return self._defaults['GetArrayForPythonCodeCustomType']['return'] + return self._defaults["GetArrayForPythonCodeCustomType"]["return"] - def niFake_GetArrayForPythonCodeDouble(self, vi, number_of_elements, array_out): # noqa: N802 - if self._defaults['GetArrayForPythonCodeDouble']['return'] != 0: - return self._defaults['GetArrayForPythonCodeDouble']['return'] + def niFake_GetArrayForPythonCodeDouble( + self, vi, number_of_elements, array_out + ): # noqa: N802 + if self._defaults["GetArrayForPythonCodeDouble"]["return"] != 0: + return self._defaults["GetArrayForPythonCodeDouble"]["return"] # array_out - if self._defaults['GetArrayForPythonCodeDouble']['arrayOut'] is None: - raise MockFunctionCallError("niFake_GetArrayForPythonCodeDouble", param='arrayOut') - test_value = self._defaults['GetArrayForPythonCodeDouble']['arrayOut'] + if self._defaults["GetArrayForPythonCodeDouble"]["arrayOut"] is None: + raise MockFunctionCallError( + "niFake_GetArrayForPythonCodeDouble", param="arrayOut" + ) + test_value = self._defaults["GetArrayForPythonCodeDouble"]["arrayOut"] try: array_out_ref = array_out.contents except AttributeError: @@ -388,141 +439,183 @@ def niFake_GetArrayForPythonCodeDouble(self, vi, number_of_elements, array_out): assert len(array_out_ref) >= len(test_value) for i in range(len(test_value)): array_out_ref[i] = test_value[i] - return self._defaults['GetArrayForPythonCodeDouble']['return'] + return self._defaults["GetArrayForPythonCodeDouble"]["return"] def niFake_GetArraySizeForPythonCode(self, vi, size_out): # noqa: N802 - if self._defaults['GetArraySizeForPythonCode']['return'] != 0: - return self._defaults['GetArraySizeForPythonCode']['return'] + if self._defaults["GetArraySizeForPythonCode"]["return"] != 0: + return self._defaults["GetArraySizeForPythonCode"]["return"] # size_out - if self._defaults['GetArraySizeForPythonCode']['sizeOut'] is None: - raise MockFunctionCallError("niFake_GetArraySizeForPythonCode", param='sizeOut') + if self._defaults["GetArraySizeForPythonCode"]["sizeOut"] is None: + raise MockFunctionCallError( + "niFake_GetArraySizeForPythonCode", param="sizeOut" + ) if size_out is not None: - size_out.contents.value = self._defaults['GetArraySizeForPythonCode']['sizeOut'] - return self._defaults['GetArraySizeForPythonCode']['return'] + size_out.contents.value = self._defaults["GetArraySizeForPythonCode"][ + "sizeOut" + ] + return self._defaults["GetArraySizeForPythonCode"]["return"] def niFake_GetArrayUsingIviDance(self, vi, array_size, array_out): # noqa: N802 - if self._defaults['GetArrayUsingIviDance']['return'] != 0: - return self._defaults['GetArrayUsingIviDance']['return'] - if self._defaults['GetArrayUsingIviDance']['arrayOut'] is None: - raise MockFunctionCallError("niFake_GetArrayUsingIviDance", param='arrayOut') + if self._defaults["GetArrayUsingIviDance"]["return"] != 0: + return self._defaults["GetArrayUsingIviDance"]["return"] + if self._defaults["GetArrayUsingIviDance"]["arrayOut"] is None: + raise MockFunctionCallError( + "niFake_GetArrayUsingIviDance", param="arrayOut" + ) if array_size.value == 0: - return len(self._defaults['GetArrayUsingIviDance']['arrayOut']) + return len(self._defaults["GetArrayUsingIviDance"]["arrayOut"]) try: array_out_ref = array_out.contents except AttributeError: array_out_ref = array_out - for i in range(len(self._defaults['GetArrayUsingIviDance']['arrayOut'])): - array_out_ref[i] = self._defaults['GetArrayUsingIviDance']['arrayOut'][i] - return self._defaults['GetArrayUsingIviDance']['return'] - - def niFake_GetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['GetAttributeViBoolean']['return'] != 0: - return self._defaults['GetAttributeViBoolean']['return'] + for i in range(len(self._defaults["GetArrayUsingIviDance"]["arrayOut"])): + array_out_ref[i] = self._defaults["GetArrayUsingIviDance"]["arrayOut"][i] + return self._defaults["GetArrayUsingIviDance"]["return"] + + def niFake_GetAttributeViBoolean( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["GetAttributeViBoolean"]["return"] != 0: + return self._defaults["GetAttributeViBoolean"]["return"] # attribute_value - if self._defaults['GetAttributeViBoolean']['attributeValue'] is None: - raise MockFunctionCallError("niFake_GetAttributeViBoolean", param='attributeValue') + if self._defaults["GetAttributeViBoolean"]["attributeValue"] is None: + raise MockFunctionCallError( + "niFake_GetAttributeViBoolean", param="attributeValue" + ) if attribute_value is not None: - attribute_value.contents.value = self._defaults['GetAttributeViBoolean']['attributeValue'] - return self._defaults['GetAttributeViBoolean']['return'] - - def niFake_GetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['GetAttributeViInt32']['return'] != 0: - return self._defaults['GetAttributeViInt32']['return'] + attribute_value.contents.value = self._defaults["GetAttributeViBoolean"][ + "attributeValue" + ] + return self._defaults["GetAttributeViBoolean"]["return"] + + def niFake_GetAttributeViInt32( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["GetAttributeViInt32"]["return"] != 0: + return self._defaults["GetAttributeViInt32"]["return"] # attribute_value - if self._defaults['GetAttributeViInt32']['attributeValue'] is None: - raise MockFunctionCallError("niFake_GetAttributeViInt32", param='attributeValue') + if self._defaults["GetAttributeViInt32"]["attributeValue"] is None: + raise MockFunctionCallError( + "niFake_GetAttributeViInt32", param="attributeValue" + ) if attribute_value is not None: - attribute_value.contents.value = self._defaults['GetAttributeViInt32']['attributeValue'] - return self._defaults['GetAttributeViInt32']['return'] - - def niFake_GetAttributeViInt64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['GetAttributeViInt64']['return'] != 0: - return self._defaults['GetAttributeViInt64']['return'] + attribute_value.contents.value = self._defaults["GetAttributeViInt32"][ + "attributeValue" + ] + return self._defaults["GetAttributeViInt32"]["return"] + + def niFake_GetAttributeViInt64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["GetAttributeViInt64"]["return"] != 0: + return self._defaults["GetAttributeViInt64"]["return"] # attribute_value - if self._defaults['GetAttributeViInt64']['attributeValue'] is None: - raise MockFunctionCallError("niFake_GetAttributeViInt64", param='attributeValue') + if self._defaults["GetAttributeViInt64"]["attributeValue"] is None: + raise MockFunctionCallError( + "niFake_GetAttributeViInt64", param="attributeValue" + ) if attribute_value is not None: - attribute_value.contents.value = self._defaults['GetAttributeViInt64']['attributeValue'] - return self._defaults['GetAttributeViInt64']['return'] - - def niFake_GetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['GetAttributeViReal64']['return'] != 0: - return self._defaults['GetAttributeViReal64']['return'] + attribute_value.contents.value = self._defaults["GetAttributeViInt64"][ + "attributeValue" + ] + return self._defaults["GetAttributeViInt64"]["return"] + + def niFake_GetAttributeViReal64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["GetAttributeViReal64"]["return"] != 0: + return self._defaults["GetAttributeViReal64"]["return"] # attribute_value - if self._defaults['GetAttributeViReal64']['attributeValue'] is None: - raise MockFunctionCallError("niFake_GetAttributeViReal64", param='attributeValue') + if self._defaults["GetAttributeViReal64"]["attributeValue"] is None: + raise MockFunctionCallError( + "niFake_GetAttributeViReal64", param="attributeValue" + ) if attribute_value is not None: - attribute_value.contents.value = self._defaults['GetAttributeViReal64']['attributeValue'] - return self._defaults['GetAttributeViReal64']['return'] - - def niFake_GetAttributeViString(self, vi, channel_name, attribute_id, buffer_size, attribute_value): # noqa: N802 - if self._defaults['GetAttributeViString']['return'] != 0: - return self._defaults['GetAttributeViString']['return'] - if self._defaults['GetAttributeViString']['attributeValue'] is None: - raise MockFunctionCallError("niFake_GetAttributeViString", param='attributeValue') + attribute_value.contents.value = self._defaults["GetAttributeViReal64"][ + "attributeValue" + ] + return self._defaults["GetAttributeViReal64"]["return"] + + def niFake_GetAttributeViString( + self, vi, channel_name, attribute_id, buffer_size, attribute_value + ): # noqa: N802 + if self._defaults["GetAttributeViString"]["return"] != 0: + return self._defaults["GetAttributeViString"]["return"] + if self._defaults["GetAttributeViString"]["attributeValue"] is None: + raise MockFunctionCallError( + "niFake_GetAttributeViString", param="attributeValue" + ) if buffer_size.value == 0: - return len(self._defaults['GetAttributeViString']['attributeValue']) - attribute_value.value = self._defaults['GetAttributeViString']['attributeValue'].encode('ascii') - return self._defaults['GetAttributeViString']['return'] - - def niFake_GetCalDateAndTime(self, vi, cal_type, month, day, year, hour, minute): # noqa: N802 - if self._defaults['GetCalDateAndTime']['return'] != 0: - return self._defaults['GetCalDateAndTime']['return'] + return len(self._defaults["GetAttributeViString"]["attributeValue"]) + attribute_value.value = self._defaults["GetAttributeViString"][ + "attributeValue" + ].encode("ascii") + return self._defaults["GetAttributeViString"]["return"] + + def niFake_GetCalDateAndTime( + self, vi, cal_type, month, day, year, hour, minute + ): # noqa: N802 + if self._defaults["GetCalDateAndTime"]["return"] != 0: + return self._defaults["GetCalDateAndTime"]["return"] # month - if self._defaults['GetCalDateAndTime']['month'] is None: - raise MockFunctionCallError("niFake_GetCalDateAndTime", param='month') + if self._defaults["GetCalDateAndTime"]["month"] is None: + raise MockFunctionCallError("niFake_GetCalDateAndTime", param="month") if month is not None: - month.contents.value = self._defaults['GetCalDateAndTime']['month'] + month.contents.value = self._defaults["GetCalDateAndTime"]["month"] # day - if self._defaults['GetCalDateAndTime']['day'] is None: - raise MockFunctionCallError("niFake_GetCalDateAndTime", param='day') + if self._defaults["GetCalDateAndTime"]["day"] is None: + raise MockFunctionCallError("niFake_GetCalDateAndTime", param="day") if day is not None: - day.contents.value = self._defaults['GetCalDateAndTime']['day'] + day.contents.value = self._defaults["GetCalDateAndTime"]["day"] # year - if self._defaults['GetCalDateAndTime']['year'] is None: - raise MockFunctionCallError("niFake_GetCalDateAndTime", param='year') + if self._defaults["GetCalDateAndTime"]["year"] is None: + raise MockFunctionCallError("niFake_GetCalDateAndTime", param="year") if year is not None: - year.contents.value = self._defaults['GetCalDateAndTime']['year'] + year.contents.value = self._defaults["GetCalDateAndTime"]["year"] # hour - if self._defaults['GetCalDateAndTime']['hour'] is None: - raise MockFunctionCallError("niFake_GetCalDateAndTime", param='hour') + if self._defaults["GetCalDateAndTime"]["hour"] is None: + raise MockFunctionCallError("niFake_GetCalDateAndTime", param="hour") if hour is not None: - hour.contents.value = self._defaults['GetCalDateAndTime']['hour'] + hour.contents.value = self._defaults["GetCalDateAndTime"]["hour"] # minute - if self._defaults['GetCalDateAndTime']['minute'] is None: - raise MockFunctionCallError("niFake_GetCalDateAndTime", param='minute') + if self._defaults["GetCalDateAndTime"]["minute"] is None: + raise MockFunctionCallError("niFake_GetCalDateAndTime", param="minute") if minute is not None: - minute.contents.value = self._defaults['GetCalDateAndTime']['minute'] - return self._defaults['GetCalDateAndTime']['return'] + minute.contents.value = self._defaults["GetCalDateAndTime"]["minute"] + return self._defaults["GetCalDateAndTime"]["return"] def niFake_GetCalInterval(self, vi, months): # noqa: N802 - if self._defaults['GetCalInterval']['return'] != 0: - return self._defaults['GetCalInterval']['return'] + if self._defaults["GetCalInterval"]["return"] != 0: + return self._defaults["GetCalInterval"]["return"] # months - if self._defaults['GetCalInterval']['months'] is None: - raise MockFunctionCallError("niFake_GetCalInterval", param='months') + if self._defaults["GetCalInterval"]["months"] is None: + raise MockFunctionCallError("niFake_GetCalInterval", param="months") if months is not None: - months.contents.value = self._defaults['GetCalInterval']['months'] - return self._defaults['GetCalInterval']['return'] + months.contents.value = self._defaults["GetCalInterval"]["months"] + return self._defaults["GetCalInterval"]["return"] def niFake_GetCustomType(self, vi, cs): # noqa: N802 - if self._defaults['GetCustomType']['return'] != 0: - return self._defaults['GetCustomType']['return'] + if self._defaults["GetCustomType"]["return"] != 0: + return self._defaults["GetCustomType"]["return"] # cs - if self._defaults['GetCustomType']['cs'] is None: - raise MockFunctionCallError("niFake_GetCustomType", param='cs') - for field in self._defaults['GetCustomType']['cs']._fields_: + if self._defaults["GetCustomType"]["cs"] is None: + raise MockFunctionCallError("niFake_GetCustomType", param="cs") + for field in self._defaults["GetCustomType"]["cs"]._fields_: field_name = field[0] - setattr(cs.contents, field_name, getattr(self._defaults['GetCustomType']['cs'], field_name)) - return self._defaults['GetCustomType']['return'] + setattr( + cs.contents, + field_name, + getattr(self._defaults["GetCustomType"]["cs"], field_name), + ) + return self._defaults["GetCustomType"]["return"] def niFake_GetCustomTypeArray(self, vi, number_of_elements, cs): # noqa: N802 - if self._defaults['GetCustomTypeArray']['return'] != 0: - return self._defaults['GetCustomTypeArray']['return'] + if self._defaults["GetCustomTypeArray"]["return"] != 0: + return self._defaults["GetCustomTypeArray"]["return"] # cs - if self._defaults['GetCustomTypeArray']['cs'] is None: - raise MockFunctionCallError("niFake_GetCustomTypeArray", param='cs') - test_value = self._defaults['GetCustomTypeArray']['cs'] + if self._defaults["GetCustomTypeArray"]["cs"] is None: + raise MockFunctionCallError("niFake_GetCustomTypeArray", param="cs") + test_value = self._defaults["GetCustomTypeArray"]["cs"] try: cs_ref = cs.contents except AttributeError: @@ -530,75 +623,92 @@ def niFake_GetCustomTypeArray(self, vi, number_of_elements, cs): # noqa: N802 assert len(cs_ref) >= len(test_value) for i in range(len(test_value)): cs_ref[i] = test_value[i] - return self._defaults['GetCustomTypeArray']['return'] + return self._defaults["GetCustomTypeArray"]["return"] def niFake_GetEnumValue(self, vi, a_quantity, a_turtle): # noqa: N802 - if self._defaults['GetEnumValue']['return'] != 0: - return self._defaults['GetEnumValue']['return'] + if self._defaults["GetEnumValue"]["return"] != 0: + return self._defaults["GetEnumValue"]["return"] # a_quantity - if self._defaults['GetEnumValue']['aQuantity'] is None: - raise MockFunctionCallError("niFake_GetEnumValue", param='aQuantity') + if self._defaults["GetEnumValue"]["aQuantity"] is None: + raise MockFunctionCallError("niFake_GetEnumValue", param="aQuantity") if a_quantity is not None: - a_quantity.contents.value = self._defaults['GetEnumValue']['aQuantity'] + a_quantity.contents.value = self._defaults["GetEnumValue"]["aQuantity"] # a_turtle - if self._defaults['GetEnumValue']['aTurtle'] is None: - raise MockFunctionCallError("niFake_GetEnumValue", param='aTurtle') + if self._defaults["GetEnumValue"]["aTurtle"] is None: + raise MockFunctionCallError("niFake_GetEnumValue", param="aTurtle") if a_turtle is not None: - a_turtle.contents.value = self._defaults['GetEnumValue']['aTurtle'] - return self._defaults['GetEnumValue']['return'] + a_turtle.contents.value = self._defaults["GetEnumValue"]["aTurtle"] + return self._defaults["GetEnumValue"]["return"] def niFake_GetError(self, vi, error_code, buffer_size, description): # noqa: N802 - if self._defaults['GetError']['return'] != 0: - return self._defaults['GetError']['return'] + if self._defaults["GetError"]["return"] != 0: + return self._defaults["GetError"]["return"] # error_code - if self._defaults['GetError']['errorCode'] is None: - raise MockFunctionCallError("niFake_GetError", param='errorCode') + if self._defaults["GetError"]["errorCode"] is None: + raise MockFunctionCallError("niFake_GetError", param="errorCode") if error_code is not None: - error_code.contents.value = self._defaults['GetError']['errorCode'] - if self._defaults['GetError']['description'] is None: - raise MockFunctionCallError("niFake_GetError", param='description') + error_code.contents.value = self._defaults["GetError"]["errorCode"] + if self._defaults["GetError"]["description"] is None: + raise MockFunctionCallError("niFake_GetError", param="description") if buffer_size.value == 0: - return len(self._defaults['GetError']['description']) - description.value = self._defaults['GetError']['description'].encode('ascii') - return self._defaults['GetError']['return'] - - def niFake_ImportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 - if self._defaults['ImportAttributeConfigurationBuffer']['return'] != 0: - return self._defaults['ImportAttributeConfigurationBuffer']['return'] - return self._defaults['ImportAttributeConfigurationBuffer']['return'] - - def niFake_InitWithOptions(self, resource_name, id_query, reset_device, option_string, vi): # noqa: N802 - if self._defaults['InitWithOptions']['return'] != 0: - return self._defaults['InitWithOptions']['return'] + return len(self._defaults["GetError"]["description"]) + description.value = self._defaults["GetError"]["description"].encode("ascii") + return self._defaults["GetError"]["return"] + + def niFake_ImportAttributeConfigurationBuffer( + self, vi, size_in_bytes, configuration + ): # noqa: N802 + if self._defaults["ImportAttributeConfigurationBuffer"]["return"] != 0: + return self._defaults["ImportAttributeConfigurationBuffer"]["return"] + return self._defaults["ImportAttributeConfigurationBuffer"]["return"] + + def niFake_InitWithOptions( + self, resource_name, id_query, reset_device, option_string, vi + ): # noqa: N802 + if self._defaults["InitWithOptions"]["return"] != 0: + return self._defaults["InitWithOptions"]["return"] # vi - if self._defaults['InitWithOptions']['vi'] is None: - raise MockFunctionCallError("niFake_InitWithOptions", param='vi') + if self._defaults["InitWithOptions"]["vi"] is None: + raise MockFunctionCallError("niFake_InitWithOptions", param="vi") if vi is not None: - vi.contents.value = self._defaults['InitWithOptions']['vi'] - return self._defaults['InitWithOptions']['return'] + vi.contents.value = self._defaults["InitWithOptions"]["vi"] + return self._defaults["InitWithOptions"]["return"] def niFake_Initiate(self, vi): # noqa: N802 - if self._defaults['Initiate']['return'] != 0: - return self._defaults['Initiate']['return'] - return self._defaults['Initiate']['return'] + if self._defaults["Initiate"]["return"] != 0: + return self._defaults["Initiate"]["return"] + return self._defaults["Initiate"]["return"] def niFake_LockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults['LockSession']['return'] != 0: - return self._defaults['LockSession']['return'] + if self._defaults["LockSession"]["return"] != 0: + return self._defaults["LockSession"]["return"] # caller_has_lock - if self._defaults['LockSession']['callerHasLock'] is None: - raise MockFunctionCallError("niFake_LockSession", param='callerHasLock') + if self._defaults["LockSession"]["callerHasLock"] is None: + raise MockFunctionCallError("niFake_LockSession", param="callerHasLock") if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults['LockSession']['callerHasLock'] - return self._defaults['LockSession']['return'] - - def niFake_MultipleArrayTypes(self, vi, output_array_size, output_array, output_array_of_fixed_length, input_array_sizes, input_array_of_floats, input_array_of_integers): # noqa: N802 - if self._defaults['MultipleArrayTypes']['return'] != 0: - return self._defaults['MultipleArrayTypes']['return'] + caller_has_lock.contents.value = self._defaults["LockSession"][ + "callerHasLock" + ] + return self._defaults["LockSession"]["return"] + + def niFake_MultipleArrayTypes( + self, + vi, + output_array_size, + output_array, + output_array_of_fixed_length, + input_array_sizes, + input_array_of_floats, + input_array_of_integers, + ): # noqa: N802 + if self._defaults["MultipleArrayTypes"]["return"] != 0: + return self._defaults["MultipleArrayTypes"]["return"] # output_array - if self._defaults['MultipleArrayTypes']['outputArray'] is None: - raise MockFunctionCallError("niFake_MultipleArrayTypes", param='outputArray') - test_value = self._defaults['MultipleArrayTypes']['outputArray'] + if self._defaults["MultipleArrayTypes"]["outputArray"] is None: + raise MockFunctionCallError( + "niFake_MultipleArrayTypes", param="outputArray" + ) + test_value = self._defaults["MultipleArrayTypes"]["outputArray"] try: output_array_ref = output_array.contents except AttributeError: @@ -607,9 +717,11 @@ def niFake_MultipleArrayTypes(self, vi, output_array_size, output_array, output_ for i in range(len(test_value)): output_array_ref[i] = test_value[i] # output_array_of_fixed_length - if self._defaults['MultipleArrayTypes']['outputArrayOfFixedLength'] is None: - raise MockFunctionCallError("niFake_MultipleArrayTypes", param='outputArrayOfFixedLength') - test_value = self._defaults['MultipleArrayTypes']['outputArrayOfFixedLength'] + if self._defaults["MultipleArrayTypes"]["outputArrayOfFixedLength"] is None: + raise MockFunctionCallError( + "niFake_MultipleArrayTypes", param="outputArrayOfFixedLength" + ) + test_value = self._defaults["MultipleArrayTypes"]["outputArrayOfFixedLength"] try: output_array_of_fixed_length_ref = output_array_of_fixed_length.contents except AttributeError: @@ -617,84 +729,113 @@ def niFake_MultipleArrayTypes(self, vi, output_array_size, output_array, output_ assert len(output_array_of_fixed_length_ref) >= len(test_value) for i in range(len(test_value)): output_array_of_fixed_length_ref[i] = test_value[i] - return self._defaults['MultipleArrayTypes']['return'] + return self._defaults["MultipleArrayTypes"]["return"] - def niFake_MultipleArraysSameSize(self, vi, values1, values2, values3, values4, size): # noqa: N802 - if self._defaults['MultipleArraysSameSize']['return'] != 0: - return self._defaults['MultipleArraysSameSize']['return'] - return self._defaults['MultipleArraysSameSize']['return'] + def niFake_MultipleArraysSameSize( + self, vi, values1, values2, values3, values4, size + ): # noqa: N802 + if self._defaults["MultipleArraysSameSize"]["return"] != 0: + return self._defaults["MultipleArraysSameSize"]["return"] + return self._defaults["MultipleArraysSameSize"]["return"] def niFake_OneInputFunction(self, vi, a_number): # noqa: N802 - if self._defaults['OneInputFunction']['return'] != 0: - return self._defaults['OneInputFunction']['return'] - return self._defaults['OneInputFunction']['return'] - - def niFake_ParametersAreMultipleTypes(self, vi, a_boolean, an_int32, an_int64, an_int_enum, a_float, a_float_enum, string_size, a_string): # noqa: N802 - if self._defaults['ParametersAreMultipleTypes']['return'] != 0: - return self._defaults['ParametersAreMultipleTypes']['return'] - return self._defaults['ParametersAreMultipleTypes']['return'] + if self._defaults["OneInputFunction"]["return"] != 0: + return self._defaults["OneInputFunction"]["return"] + return self._defaults["OneInputFunction"]["return"] + + def niFake_ParametersAreMultipleTypes( + self, + vi, + a_boolean, + an_int32, + an_int64, + an_int_enum, + a_float, + a_float_enum, + string_size, + a_string, + ): # noqa: N802 + if self._defaults["ParametersAreMultipleTypes"]["return"] != 0: + return self._defaults["ParametersAreMultipleTypes"]["return"] + return self._defaults["ParametersAreMultipleTypes"]["return"] def niFake_PoorlyNamedSimpleFunction(self, vi): # noqa: N802 - if self._defaults['PoorlyNamedSimpleFunction']['return'] != 0: - return self._defaults['PoorlyNamedSimpleFunction']['return'] - return self._defaults['PoorlyNamedSimpleFunction']['return'] + if self._defaults["PoorlyNamedSimpleFunction"]["return"] != 0: + return self._defaults["PoorlyNamedSimpleFunction"]["return"] + return self._defaults["PoorlyNamedSimpleFunction"]["return"] def niFake_Read(self, vi, maximum_time, reading): # noqa: N802 - if self._defaults['Read']['return'] != 0: - return self._defaults['Read']['return'] + if self._defaults["Read"]["return"] != 0: + return self._defaults["Read"]["return"] # reading - if self._defaults['Read']['reading'] is None: - raise MockFunctionCallError("niFake_Read", param='reading') + if self._defaults["Read"]["reading"] is None: + raise MockFunctionCallError("niFake_Read", param="reading") if reading is not None: - reading.contents.value = self._defaults['Read']['reading'] - return self._defaults['Read']['return'] - - def niFake_ReadFromChannel(self, vi, channel_name, maximum_time, reading): # noqa: N802 - if self._defaults['ReadFromChannel']['return'] != 0: - return self._defaults['ReadFromChannel']['return'] + reading.contents.value = self._defaults["Read"]["reading"] + return self._defaults["Read"]["return"] + + def niFake_ReadFromChannel( + self, vi, channel_name, maximum_time, reading + ): # noqa: N802 + if self._defaults["ReadFromChannel"]["return"] != 0: + return self._defaults["ReadFromChannel"]["return"] # reading - if self._defaults['ReadFromChannel']['reading'] is None: - raise MockFunctionCallError("niFake_ReadFromChannel", param='reading') + if self._defaults["ReadFromChannel"]["reading"] is None: + raise MockFunctionCallError("niFake_ReadFromChannel", param="reading") if reading is not None: - reading.contents.value = self._defaults['ReadFromChannel']['reading'] - return self._defaults['ReadFromChannel']['return'] + reading.contents.value = self._defaults["ReadFromChannel"]["reading"] + return self._defaults["ReadFromChannel"]["return"] def niFake_ReturnANumberAndAString(self, vi, a_number, a_string): # noqa: N802 - if self._defaults['ReturnANumberAndAString']['return'] != 0: - return self._defaults['ReturnANumberAndAString']['return'] + if self._defaults["ReturnANumberAndAString"]["return"] != 0: + return self._defaults["ReturnANumberAndAString"]["return"] # a_number - if self._defaults['ReturnANumberAndAString']['aNumber'] is None: - raise MockFunctionCallError("niFake_ReturnANumberAndAString", param='aNumber') + if self._defaults["ReturnANumberAndAString"]["aNumber"] is None: + raise MockFunctionCallError( + "niFake_ReturnANumberAndAString", param="aNumber" + ) if a_number is not None: - a_number.contents.value = self._defaults['ReturnANumberAndAString']['aNumber'] + a_number.contents.value = self._defaults["ReturnANumberAndAString"][ + "aNumber" + ] # a_string - if self._defaults['ReturnANumberAndAString']['aString'] is None: - raise MockFunctionCallError("niFake_ReturnANumberAndAString", param='aString') - test_value = self._defaults['ReturnANumberAndAString']['aString'] + if self._defaults["ReturnANumberAndAString"]["aString"] is None: + raise MockFunctionCallError( + "niFake_ReturnANumberAndAString", param="aString" + ) + test_value = self._defaults["ReturnANumberAndAString"]["aString"] if type(test_value) is str: - test_value = test_value.encode('ascii') + test_value = test_value.encode("ascii") assert len(a_string) >= len(test_value) for i in range(len(test_value)): a_string[i] = test_value[i] - return self._defaults['ReturnANumberAndAString']['return'] + return self._defaults["ReturnANumberAndAString"]["return"] def niFake_ReturnDurationInSeconds(self, vi, timedelta): # noqa: N802 - if self._defaults['ReturnDurationInSeconds']['return'] != 0: - return self._defaults['ReturnDurationInSeconds']['return'] + if self._defaults["ReturnDurationInSeconds"]["return"] != 0: + return self._defaults["ReturnDurationInSeconds"]["return"] # timedelta - if self._defaults['ReturnDurationInSeconds']['timedelta'] is None: - raise MockFunctionCallError("niFake_ReturnDurationInSeconds", param='timedelta') + if self._defaults["ReturnDurationInSeconds"]["timedelta"] is None: + raise MockFunctionCallError( + "niFake_ReturnDurationInSeconds", param="timedelta" + ) if timedelta is not None: - timedelta.contents.value = self._defaults['ReturnDurationInSeconds']['timedelta'] - return self._defaults['ReturnDurationInSeconds']['return'] - - def niFake_ReturnListOfDurationsInSeconds(self, vi, number_of_elements, timedeltas): # noqa: N802 - if self._defaults['ReturnListOfDurationsInSeconds']['return'] != 0: - return self._defaults['ReturnListOfDurationsInSeconds']['return'] + timedelta.contents.value = self._defaults["ReturnDurationInSeconds"][ + "timedelta" + ] + return self._defaults["ReturnDurationInSeconds"]["return"] + + def niFake_ReturnListOfDurationsInSeconds( + self, vi, number_of_elements, timedeltas + ): # noqa: N802 + if self._defaults["ReturnListOfDurationsInSeconds"]["return"] != 0: + return self._defaults["ReturnListOfDurationsInSeconds"]["return"] # timedeltas - if self._defaults['ReturnListOfDurationsInSeconds']['timedeltas'] is None: - raise MockFunctionCallError("niFake_ReturnListOfDurationsInSeconds", param='timedeltas') - test_value = self._defaults['ReturnListOfDurationsInSeconds']['timedeltas'] + if self._defaults["ReturnListOfDurationsInSeconds"]["timedeltas"] is None: + raise MockFunctionCallError( + "niFake_ReturnListOfDurationsInSeconds", param="timedeltas" + ) + test_value = self._defaults["ReturnListOfDurationsInSeconds"]["timedeltas"] try: timedeltas_ref = timedeltas.contents except AttributeError: @@ -702,45 +843,64 @@ def niFake_ReturnListOfDurationsInSeconds(self, vi, number_of_elements, timedelt assert len(timedeltas_ref) >= len(test_value) for i in range(len(test_value)): timedeltas_ref[i] = test_value[i] - return self._defaults['ReturnListOfDurationsInSeconds']['return'] - - def niFake_ReturnMultipleTypes(self, vi, a_boolean, an_int32, an_int64, an_int_enum, a_float, a_float_enum, array_size, an_array, string_size, a_string): # noqa: N802 - if self._defaults['ReturnMultipleTypes']['return'] != 0: - return self._defaults['ReturnMultipleTypes']['return'] + return self._defaults["ReturnListOfDurationsInSeconds"]["return"] + + def niFake_ReturnMultipleTypes( + self, + vi, + a_boolean, + an_int32, + an_int64, + an_int_enum, + a_float, + a_float_enum, + array_size, + an_array, + string_size, + a_string, + ): # noqa: N802 + if self._defaults["ReturnMultipleTypes"]["return"] != 0: + return self._defaults["ReturnMultipleTypes"]["return"] # a_boolean - if self._defaults['ReturnMultipleTypes']['aBoolean'] is None: - raise MockFunctionCallError("niFake_ReturnMultipleTypes", param='aBoolean') + if self._defaults["ReturnMultipleTypes"]["aBoolean"] is None: + raise MockFunctionCallError("niFake_ReturnMultipleTypes", param="aBoolean") if a_boolean is not None: - a_boolean.contents.value = self._defaults['ReturnMultipleTypes']['aBoolean'] + a_boolean.contents.value = self._defaults["ReturnMultipleTypes"]["aBoolean"] # an_int32 - if self._defaults['ReturnMultipleTypes']['anInt32'] is None: - raise MockFunctionCallError("niFake_ReturnMultipleTypes", param='anInt32') + if self._defaults["ReturnMultipleTypes"]["anInt32"] is None: + raise MockFunctionCallError("niFake_ReturnMultipleTypes", param="anInt32") if an_int32 is not None: - an_int32.contents.value = self._defaults['ReturnMultipleTypes']['anInt32'] + an_int32.contents.value = self._defaults["ReturnMultipleTypes"]["anInt32"] # an_int64 - if self._defaults['ReturnMultipleTypes']['anInt64'] is None: - raise MockFunctionCallError("niFake_ReturnMultipleTypes", param='anInt64') + if self._defaults["ReturnMultipleTypes"]["anInt64"] is None: + raise MockFunctionCallError("niFake_ReturnMultipleTypes", param="anInt64") if an_int64 is not None: - an_int64.contents.value = self._defaults['ReturnMultipleTypes']['anInt64'] + an_int64.contents.value = self._defaults["ReturnMultipleTypes"]["anInt64"] # an_int_enum - if self._defaults['ReturnMultipleTypes']['anIntEnum'] is None: - raise MockFunctionCallError("niFake_ReturnMultipleTypes", param='anIntEnum') + if self._defaults["ReturnMultipleTypes"]["anIntEnum"] is None: + raise MockFunctionCallError("niFake_ReturnMultipleTypes", param="anIntEnum") if an_int_enum is not None: - an_int_enum.contents.value = self._defaults['ReturnMultipleTypes']['anIntEnum'] + an_int_enum.contents.value = self._defaults["ReturnMultipleTypes"][ + "anIntEnum" + ] # a_float - if self._defaults['ReturnMultipleTypes']['aFloat'] is None: - raise MockFunctionCallError("niFake_ReturnMultipleTypes", param='aFloat') + if self._defaults["ReturnMultipleTypes"]["aFloat"] is None: + raise MockFunctionCallError("niFake_ReturnMultipleTypes", param="aFloat") if a_float is not None: - a_float.contents.value = self._defaults['ReturnMultipleTypes']['aFloat'] + a_float.contents.value = self._defaults["ReturnMultipleTypes"]["aFloat"] # a_float_enum - if self._defaults['ReturnMultipleTypes']['aFloatEnum'] is None: - raise MockFunctionCallError("niFake_ReturnMultipleTypes", param='aFloatEnum') + if self._defaults["ReturnMultipleTypes"]["aFloatEnum"] is None: + raise MockFunctionCallError( + "niFake_ReturnMultipleTypes", param="aFloatEnum" + ) if a_float_enum is not None: - a_float_enum.contents.value = self._defaults['ReturnMultipleTypes']['aFloatEnum'] + a_float_enum.contents.value = self._defaults["ReturnMultipleTypes"][ + "aFloatEnum" + ] # an_array - if self._defaults['ReturnMultipleTypes']['anArray'] is None: - raise MockFunctionCallError("niFake_ReturnMultipleTypes", param='anArray') - test_value = self._defaults['ReturnMultipleTypes']['anArray'] + if self._defaults["ReturnMultipleTypes"]["anArray"] is None: + raise MockFunctionCallError("niFake_ReturnMultipleTypes", param="anArray") + test_value = self._defaults["ReturnMultipleTypes"]["anArray"] try: an_array_ref = an_array.contents except AttributeError: @@ -748,238 +908,368 @@ def niFake_ReturnMultipleTypes(self, vi, a_boolean, an_int32, an_int64, an_int_e assert len(an_array_ref) >= len(test_value) for i in range(len(test_value)): an_array_ref[i] = test_value[i] - if self._defaults['ReturnMultipleTypes']['aString'] is None: - raise MockFunctionCallError("niFake_ReturnMultipleTypes", param='aString') + if self._defaults["ReturnMultipleTypes"]["aString"] is None: + raise MockFunctionCallError("niFake_ReturnMultipleTypes", param="aString") if string_size.value == 0: - return len(self._defaults['ReturnMultipleTypes']['aString']) - a_string.value = self._defaults['ReturnMultipleTypes']['aString'].encode('ascii') - return self._defaults['ReturnMultipleTypes']['return'] - - def niFake_SetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['SetAttributeViBoolean']['return'] != 0: - return self._defaults['SetAttributeViBoolean']['return'] - return self._defaults['SetAttributeViBoolean']['return'] - - def niFake_SetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['SetAttributeViInt32']['return'] != 0: - return self._defaults['SetAttributeViInt32']['return'] - return self._defaults['SetAttributeViInt32']['return'] - - def niFake_SetAttributeViInt64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['SetAttributeViInt64']['return'] != 0: - return self._defaults['SetAttributeViInt64']['return'] - return self._defaults['SetAttributeViInt64']['return'] - - def niFake_SetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['SetAttributeViReal64']['return'] != 0: - return self._defaults['SetAttributeViReal64']['return'] - return self._defaults['SetAttributeViReal64']['return'] - - def niFake_SetAttributeViString(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['SetAttributeViString']['return'] != 0: - return self._defaults['SetAttributeViString']['return'] - return self._defaults['SetAttributeViString']['return'] + return len(self._defaults["ReturnMultipleTypes"]["aString"]) + a_string.value = self._defaults["ReturnMultipleTypes"]["aString"].encode( + "ascii" + ) + return self._defaults["ReturnMultipleTypes"]["return"] + + def niFake_SetAttributeViBoolean( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["SetAttributeViBoolean"]["return"] != 0: + return self._defaults["SetAttributeViBoolean"]["return"] + return self._defaults["SetAttributeViBoolean"]["return"] + + def niFake_SetAttributeViInt32( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["SetAttributeViInt32"]["return"] != 0: + return self._defaults["SetAttributeViInt32"]["return"] + return self._defaults["SetAttributeViInt32"]["return"] + + def niFake_SetAttributeViInt64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["SetAttributeViInt64"]["return"] != 0: + return self._defaults["SetAttributeViInt64"]["return"] + return self._defaults["SetAttributeViInt64"]["return"] + + def niFake_SetAttributeViReal64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["SetAttributeViReal64"]["return"] != 0: + return self._defaults["SetAttributeViReal64"]["return"] + return self._defaults["SetAttributeViReal64"]["return"] + + def niFake_SetAttributeViString( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["SetAttributeViString"]["return"] != 0: + return self._defaults["SetAttributeViString"]["return"] + return self._defaults["SetAttributeViString"]["return"] def niFake_SetCustomType(self, vi, cs): # noqa: N802 - if self._defaults['SetCustomType']['return'] != 0: - return self._defaults['SetCustomType']['return'] - return self._defaults['SetCustomType']['return'] + if self._defaults["SetCustomType"]["return"] != 0: + return self._defaults["SetCustomType"]["return"] + return self._defaults["SetCustomType"]["return"] def niFake_SetCustomTypeArray(self, vi, number_of_elements, cs): # noqa: N802 - if self._defaults['SetCustomTypeArray']['return'] != 0: - return self._defaults['SetCustomTypeArray']['return'] - return self._defaults['SetCustomTypeArray']['return'] + if self._defaults["SetCustomTypeArray"]["return"] != 0: + return self._defaults["SetCustomTypeArray"]["return"] + return self._defaults["SetCustomTypeArray"]["return"] - def niFake_StringValuedEnumInputFunctionWithDefaults(self, vi, a_mobile_os_name): # noqa: N802 - if self._defaults['StringValuedEnumInputFunctionWithDefaults']['return'] != 0: - return self._defaults['StringValuedEnumInputFunctionWithDefaults']['return'] - return self._defaults['StringValuedEnumInputFunctionWithDefaults']['return'] + def niFake_StringValuedEnumInputFunctionWithDefaults( + self, vi, a_mobile_os_name + ): # noqa: N802 + if self._defaults["StringValuedEnumInputFunctionWithDefaults"]["return"] != 0: + return self._defaults["StringValuedEnumInputFunctionWithDefaults"]["return"] + return self._defaults["StringValuedEnumInputFunctionWithDefaults"]["return"] def niFake_TwoInputFunction(self, vi, a_number, a_string): # noqa: N802 - if self._defaults['TwoInputFunction']['return'] != 0: - return self._defaults['TwoInputFunction']['return'] - return self._defaults['TwoInputFunction']['return'] + if self._defaults["TwoInputFunction"]["return"] != 0: + return self._defaults["TwoInputFunction"]["return"] + return self._defaults["TwoInputFunction"]["return"] def niFake_UnlockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults['UnlockSession']['return'] != 0: - return self._defaults['UnlockSession']['return'] + if self._defaults["UnlockSession"]["return"] != 0: + return self._defaults["UnlockSession"]["return"] # caller_has_lock - if self._defaults['UnlockSession']['callerHasLock'] is None: - raise MockFunctionCallError("niFake_UnlockSession", param='callerHasLock') + if self._defaults["UnlockSession"]["callerHasLock"] is None: + raise MockFunctionCallError("niFake_UnlockSession", param="callerHasLock") if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults['UnlockSession']['callerHasLock'] - return self._defaults['UnlockSession']['return'] + caller_has_lock.contents.value = self._defaults["UnlockSession"][ + "callerHasLock" + ] + return self._defaults["UnlockSession"]["return"] def niFake_Use64BitNumber(self, vi, input, output): # noqa: N802 - if self._defaults['Use64BitNumber']['return'] != 0: - return self._defaults['Use64BitNumber']['return'] + if self._defaults["Use64BitNumber"]["return"] != 0: + return self._defaults["Use64BitNumber"]["return"] # output - if self._defaults['Use64BitNumber']['output'] is None: - raise MockFunctionCallError("niFake_Use64BitNumber", param='output') + if self._defaults["Use64BitNumber"]["output"] is None: + raise MockFunctionCallError("niFake_Use64BitNumber", param="output") if output is not None: - output.contents.value = self._defaults['Use64BitNumber']['output'] - return self._defaults['Use64BitNumber']['return'] + output.contents.value = self._defaults["Use64BitNumber"]["output"] + return self._defaults["Use64BitNumber"]["return"] def niFake_WriteWaveform(self, vi, number_of_samples, waveform): # noqa: N802 - if self._defaults['WriteWaveform']['return'] != 0: - return self._defaults['WriteWaveform']['return'] - return self._defaults['WriteWaveform']['return'] + if self._defaults["WriteWaveform"]["return"] != 0: + return self._defaults["WriteWaveform"]["return"] + return self._defaults["WriteWaveform"]["return"] def niFake_close(self, vi): # noqa: N802 - if self._defaults['close']['return'] != 0: - return self._defaults['close']['return'] - return self._defaults['close']['return'] + if self._defaults["close"]["return"] != 0: + return self._defaults["close"]["return"] + return self._defaults["close"]["return"] def niFake_error_message(self, vi, error_code, error_message): # noqa: N802 - if self._defaults['error_message']['return'] != 0: - return self._defaults['error_message']['return'] + if self._defaults["error_message"]["return"] != 0: + return self._defaults["error_message"]["return"] # error_message - if self._defaults['error_message']['errorMessage'] is None: - raise MockFunctionCallError("niFake_error_message", param='errorMessage') - test_value = self._defaults['error_message']['errorMessage'] + if self._defaults["error_message"]["errorMessage"] is None: + raise MockFunctionCallError("niFake_error_message", param="errorMessage") + test_value = self._defaults["error_message"]["errorMessage"] if type(test_value) is str: - test_value = test_value.encode('ascii') + test_value = test_value.encode("ascii") assert len(error_message) >= len(test_value) for i in range(len(test_value)): error_message[i] = test_value[i] - return self._defaults['error_message']['return'] + return self._defaults["error_message"]["return"] def niFake_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 - if self._defaults['self_test']['return'] != 0: - return self._defaults['self_test']['return'] + if self._defaults["self_test"]["return"] != 0: + return self._defaults["self_test"]["return"] # self_test_result - if self._defaults['self_test']['selfTestResult'] is None: - raise MockFunctionCallError("niFake_self_test", param='selfTestResult') + if self._defaults["self_test"]["selfTestResult"] is None: + raise MockFunctionCallError("niFake_self_test", param="selfTestResult") if self_test_result is not None: - self_test_result.contents.value = self._defaults['self_test']['selfTestResult'] + self_test_result.contents.value = self._defaults["self_test"][ + "selfTestResult" + ] # self_test_message - if self._defaults['self_test']['selfTestMessage'] is None: - raise MockFunctionCallError("niFake_self_test", param='selfTestMessage') - test_value = self._defaults['self_test']['selfTestMessage'] + if self._defaults["self_test"]["selfTestMessage"] is None: + raise MockFunctionCallError("niFake_self_test", param="selfTestMessage") + test_value = self._defaults["self_test"]["selfTestMessage"] if type(test_value) is str: - test_value = test_value.encode('ascii') + test_value = test_value.encode("ascii") assert len(self_test_message) >= len(test_value) for i in range(len(test_value)): self_test_message[i] = test_value[i] - return self._defaults['self_test']['return'] + return self._defaults["self_test"]["return"] # Helper function to setup Mock object with default side effects and return values def set_side_effects_and_return_values(self, mock_library): mock_library.niFake_Abort.side_effect = MockFunctionCallError("niFake_Abort") mock_library.niFake_Abort.return_value = 0 - mock_library.niFake_AcceptListOfDurationsInSeconds.side_effect = MockFunctionCallError("niFake_AcceptListOfDurationsInSeconds") + mock_library.niFake_AcceptListOfDurationsInSeconds.side_effect = ( + MockFunctionCallError("niFake_AcceptListOfDurationsInSeconds") + ) mock_library.niFake_AcceptListOfDurationsInSeconds.return_value = 0 - mock_library.niFake_BoolArrayOutputFunction.side_effect = MockFunctionCallError("niFake_BoolArrayOutputFunction") + mock_library.niFake_BoolArrayOutputFunction.side_effect = MockFunctionCallError( + "niFake_BoolArrayOutputFunction" + ) mock_library.niFake_BoolArrayOutputFunction.return_value = 0 - mock_library.niFake_DoubleAllTheNums.side_effect = MockFunctionCallError("niFake_DoubleAllTheNums") + mock_library.niFake_DoubleAllTheNums.side_effect = MockFunctionCallError( + "niFake_DoubleAllTheNums" + ) mock_library.niFake_DoubleAllTheNums.return_value = 0 - mock_library.niFake_EnumArrayOutputFunction.side_effect = MockFunctionCallError("niFake_EnumArrayOutputFunction") + mock_library.niFake_EnumArrayOutputFunction.side_effect = MockFunctionCallError( + "niFake_EnumArrayOutputFunction" + ) mock_library.niFake_EnumArrayOutputFunction.return_value = 0 - mock_library.niFake_EnumInputFunctionWithDefaults.side_effect = MockFunctionCallError("niFake_EnumInputFunctionWithDefaults") + mock_library.niFake_EnumInputFunctionWithDefaults.side_effect = ( + MockFunctionCallError("niFake_EnumInputFunctionWithDefaults") + ) mock_library.niFake_EnumInputFunctionWithDefaults.return_value = 0 - mock_library.niFake_ExportAttributeConfigurationBuffer.side_effect = MockFunctionCallError("niFake_ExportAttributeConfigurationBuffer") + mock_library.niFake_ExportAttributeConfigurationBuffer.side_effect = ( + MockFunctionCallError("niFake_ExportAttributeConfigurationBuffer") + ) mock_library.niFake_ExportAttributeConfigurationBuffer.return_value = 0 - mock_library.niFake_FetchWaveform.side_effect = MockFunctionCallError("niFake_FetchWaveform") + mock_library.niFake_FetchWaveform.side_effect = MockFunctionCallError( + "niFake_FetchWaveform" + ) mock_library.niFake_FetchWaveform.return_value = 0 - mock_library.niFake_GetABoolean.side_effect = MockFunctionCallError("niFake_GetABoolean") + mock_library.niFake_GetABoolean.side_effect = MockFunctionCallError( + "niFake_GetABoolean" + ) mock_library.niFake_GetABoolean.return_value = 0 - mock_library.niFake_GetANumber.side_effect = MockFunctionCallError("niFake_GetANumber") + mock_library.niFake_GetANumber.side_effect = MockFunctionCallError( + "niFake_GetANumber" + ) mock_library.niFake_GetANumber.return_value = 0 - mock_library.niFake_GetAStringOfFixedMaximumSize.side_effect = MockFunctionCallError("niFake_GetAStringOfFixedMaximumSize") + mock_library.niFake_GetAStringOfFixedMaximumSize.side_effect = ( + MockFunctionCallError("niFake_GetAStringOfFixedMaximumSize") + ) mock_library.niFake_GetAStringOfFixedMaximumSize.return_value = 0 - mock_library.niFake_GetAStringUsingPythonCode.side_effect = MockFunctionCallError("niFake_GetAStringUsingPythonCode") + mock_library.niFake_GetAStringUsingPythonCode.side_effect = ( + MockFunctionCallError("niFake_GetAStringUsingPythonCode") + ) mock_library.niFake_GetAStringUsingPythonCode.return_value = 0 - mock_library.niFake_GetAnIviDanceString.side_effect = MockFunctionCallError("niFake_GetAnIviDanceString") + mock_library.niFake_GetAnIviDanceString.side_effect = MockFunctionCallError( + "niFake_GetAnIviDanceString" + ) mock_library.niFake_GetAnIviDanceString.return_value = 0 - mock_library.niFake_GetAnIviDanceWithATwistString.side_effect = MockFunctionCallError("niFake_GetAnIviDanceWithATwistString") + mock_library.niFake_GetAnIviDanceWithATwistString.side_effect = ( + MockFunctionCallError("niFake_GetAnIviDanceWithATwistString") + ) mock_library.niFake_GetAnIviDanceWithATwistString.return_value = 0 - mock_library.niFake_GetArrayForPythonCodeCustomType.side_effect = MockFunctionCallError("niFake_GetArrayForPythonCodeCustomType") + mock_library.niFake_GetArrayForPythonCodeCustomType.side_effect = ( + MockFunctionCallError("niFake_GetArrayForPythonCodeCustomType") + ) mock_library.niFake_GetArrayForPythonCodeCustomType.return_value = 0 - mock_library.niFake_GetArrayForPythonCodeDouble.side_effect = MockFunctionCallError("niFake_GetArrayForPythonCodeDouble") + mock_library.niFake_GetArrayForPythonCodeDouble.side_effect = ( + MockFunctionCallError("niFake_GetArrayForPythonCodeDouble") + ) mock_library.niFake_GetArrayForPythonCodeDouble.return_value = 0 - mock_library.niFake_GetArraySizeForPythonCode.side_effect = MockFunctionCallError("niFake_GetArraySizeForPythonCode") + mock_library.niFake_GetArraySizeForPythonCode.side_effect = ( + MockFunctionCallError("niFake_GetArraySizeForPythonCode") + ) mock_library.niFake_GetArraySizeForPythonCode.return_value = 0 - mock_library.niFake_GetArrayUsingIviDance.side_effect = MockFunctionCallError("niFake_GetArrayUsingIviDance") + mock_library.niFake_GetArrayUsingIviDance.side_effect = MockFunctionCallError( + "niFake_GetArrayUsingIviDance" + ) mock_library.niFake_GetArrayUsingIviDance.return_value = 0 - mock_library.niFake_GetAttributeViBoolean.side_effect = MockFunctionCallError("niFake_GetAttributeViBoolean") + mock_library.niFake_GetAttributeViBoolean.side_effect = MockFunctionCallError( + "niFake_GetAttributeViBoolean" + ) mock_library.niFake_GetAttributeViBoolean.return_value = 0 - mock_library.niFake_GetAttributeViInt32.side_effect = MockFunctionCallError("niFake_GetAttributeViInt32") + mock_library.niFake_GetAttributeViInt32.side_effect = MockFunctionCallError( + "niFake_GetAttributeViInt32" + ) mock_library.niFake_GetAttributeViInt32.return_value = 0 - mock_library.niFake_GetAttributeViInt64.side_effect = MockFunctionCallError("niFake_GetAttributeViInt64") + mock_library.niFake_GetAttributeViInt64.side_effect = MockFunctionCallError( + "niFake_GetAttributeViInt64" + ) mock_library.niFake_GetAttributeViInt64.return_value = 0 - mock_library.niFake_GetAttributeViReal64.side_effect = MockFunctionCallError("niFake_GetAttributeViReal64") + mock_library.niFake_GetAttributeViReal64.side_effect = MockFunctionCallError( + "niFake_GetAttributeViReal64" + ) mock_library.niFake_GetAttributeViReal64.return_value = 0 - mock_library.niFake_GetAttributeViString.side_effect = MockFunctionCallError("niFake_GetAttributeViString") + mock_library.niFake_GetAttributeViString.side_effect = MockFunctionCallError( + "niFake_GetAttributeViString" + ) mock_library.niFake_GetAttributeViString.return_value = 0 - mock_library.niFake_GetCalDateAndTime.side_effect = MockFunctionCallError("niFake_GetCalDateAndTime") + mock_library.niFake_GetCalDateAndTime.side_effect = MockFunctionCallError( + "niFake_GetCalDateAndTime" + ) mock_library.niFake_GetCalDateAndTime.return_value = 0 - mock_library.niFake_GetCalInterval.side_effect = MockFunctionCallError("niFake_GetCalInterval") + mock_library.niFake_GetCalInterval.side_effect = MockFunctionCallError( + "niFake_GetCalInterval" + ) mock_library.niFake_GetCalInterval.return_value = 0 - mock_library.niFake_GetCustomType.side_effect = MockFunctionCallError("niFake_GetCustomType") + mock_library.niFake_GetCustomType.side_effect = MockFunctionCallError( + "niFake_GetCustomType" + ) mock_library.niFake_GetCustomType.return_value = 0 - mock_library.niFake_GetCustomTypeArray.side_effect = MockFunctionCallError("niFake_GetCustomTypeArray") + mock_library.niFake_GetCustomTypeArray.side_effect = MockFunctionCallError( + "niFake_GetCustomTypeArray" + ) mock_library.niFake_GetCustomTypeArray.return_value = 0 - mock_library.niFake_GetEnumValue.side_effect = MockFunctionCallError("niFake_GetEnumValue") + mock_library.niFake_GetEnumValue.side_effect = MockFunctionCallError( + "niFake_GetEnumValue" + ) mock_library.niFake_GetEnumValue.return_value = 0 - mock_library.niFake_GetError.side_effect = MockFunctionCallError("niFake_GetError") + mock_library.niFake_GetError.side_effect = MockFunctionCallError( + "niFake_GetError" + ) mock_library.niFake_GetError.return_value = 0 - mock_library.niFake_ImportAttributeConfigurationBuffer.side_effect = MockFunctionCallError("niFake_ImportAttributeConfigurationBuffer") + mock_library.niFake_ImportAttributeConfigurationBuffer.side_effect = ( + MockFunctionCallError("niFake_ImportAttributeConfigurationBuffer") + ) mock_library.niFake_ImportAttributeConfigurationBuffer.return_value = 0 - mock_library.niFake_InitWithOptions.side_effect = MockFunctionCallError("niFake_InitWithOptions") + mock_library.niFake_InitWithOptions.side_effect = MockFunctionCallError( + "niFake_InitWithOptions" + ) mock_library.niFake_InitWithOptions.return_value = 0 - mock_library.niFake_Initiate.side_effect = MockFunctionCallError("niFake_Initiate") + mock_library.niFake_Initiate.side_effect = MockFunctionCallError( + "niFake_Initiate" + ) mock_library.niFake_Initiate.return_value = 0 - mock_library.niFake_LockSession.side_effect = MockFunctionCallError("niFake_LockSession") + mock_library.niFake_LockSession.side_effect = MockFunctionCallError( + "niFake_LockSession" + ) mock_library.niFake_LockSession.return_value = 0 - mock_library.niFake_MultipleArrayTypes.side_effect = MockFunctionCallError("niFake_MultipleArrayTypes") + mock_library.niFake_MultipleArrayTypes.side_effect = MockFunctionCallError( + "niFake_MultipleArrayTypes" + ) mock_library.niFake_MultipleArrayTypes.return_value = 0 - mock_library.niFake_MultipleArraysSameSize.side_effect = MockFunctionCallError("niFake_MultipleArraysSameSize") + mock_library.niFake_MultipleArraysSameSize.side_effect = MockFunctionCallError( + "niFake_MultipleArraysSameSize" + ) mock_library.niFake_MultipleArraysSameSize.return_value = 0 - mock_library.niFake_OneInputFunction.side_effect = MockFunctionCallError("niFake_OneInputFunction") + mock_library.niFake_OneInputFunction.side_effect = MockFunctionCallError( + "niFake_OneInputFunction" + ) mock_library.niFake_OneInputFunction.return_value = 0 - mock_library.niFake_ParametersAreMultipleTypes.side_effect = MockFunctionCallError("niFake_ParametersAreMultipleTypes") + mock_library.niFake_ParametersAreMultipleTypes.side_effect = ( + MockFunctionCallError("niFake_ParametersAreMultipleTypes") + ) mock_library.niFake_ParametersAreMultipleTypes.return_value = 0 - mock_library.niFake_PoorlyNamedSimpleFunction.side_effect = MockFunctionCallError("niFake_PoorlyNamedSimpleFunction") + mock_library.niFake_PoorlyNamedSimpleFunction.side_effect = ( + MockFunctionCallError("niFake_PoorlyNamedSimpleFunction") + ) mock_library.niFake_PoorlyNamedSimpleFunction.return_value = 0 mock_library.niFake_Read.side_effect = MockFunctionCallError("niFake_Read") mock_library.niFake_Read.return_value = 0 - mock_library.niFake_ReadFromChannel.side_effect = MockFunctionCallError("niFake_ReadFromChannel") + mock_library.niFake_ReadFromChannel.side_effect = MockFunctionCallError( + "niFake_ReadFromChannel" + ) mock_library.niFake_ReadFromChannel.return_value = 0 - mock_library.niFake_ReturnANumberAndAString.side_effect = MockFunctionCallError("niFake_ReturnANumberAndAString") + mock_library.niFake_ReturnANumberAndAString.side_effect = MockFunctionCallError( + "niFake_ReturnANumberAndAString" + ) mock_library.niFake_ReturnANumberAndAString.return_value = 0 - mock_library.niFake_ReturnDurationInSeconds.side_effect = MockFunctionCallError("niFake_ReturnDurationInSeconds") + mock_library.niFake_ReturnDurationInSeconds.side_effect = MockFunctionCallError( + "niFake_ReturnDurationInSeconds" + ) mock_library.niFake_ReturnDurationInSeconds.return_value = 0 - mock_library.niFake_ReturnListOfDurationsInSeconds.side_effect = MockFunctionCallError("niFake_ReturnListOfDurationsInSeconds") + mock_library.niFake_ReturnListOfDurationsInSeconds.side_effect = ( + MockFunctionCallError("niFake_ReturnListOfDurationsInSeconds") + ) mock_library.niFake_ReturnListOfDurationsInSeconds.return_value = 0 - mock_library.niFake_ReturnMultipleTypes.side_effect = MockFunctionCallError("niFake_ReturnMultipleTypes") + mock_library.niFake_ReturnMultipleTypes.side_effect = MockFunctionCallError( + "niFake_ReturnMultipleTypes" + ) mock_library.niFake_ReturnMultipleTypes.return_value = 0 - mock_library.niFake_SetAttributeViBoolean.side_effect = MockFunctionCallError("niFake_SetAttributeViBoolean") + mock_library.niFake_SetAttributeViBoolean.side_effect = MockFunctionCallError( + "niFake_SetAttributeViBoolean" + ) mock_library.niFake_SetAttributeViBoolean.return_value = 0 - mock_library.niFake_SetAttributeViInt32.side_effect = MockFunctionCallError("niFake_SetAttributeViInt32") + mock_library.niFake_SetAttributeViInt32.side_effect = MockFunctionCallError( + "niFake_SetAttributeViInt32" + ) mock_library.niFake_SetAttributeViInt32.return_value = 0 - mock_library.niFake_SetAttributeViInt64.side_effect = MockFunctionCallError("niFake_SetAttributeViInt64") + mock_library.niFake_SetAttributeViInt64.side_effect = MockFunctionCallError( + "niFake_SetAttributeViInt64" + ) mock_library.niFake_SetAttributeViInt64.return_value = 0 - mock_library.niFake_SetAttributeViReal64.side_effect = MockFunctionCallError("niFake_SetAttributeViReal64") + mock_library.niFake_SetAttributeViReal64.side_effect = MockFunctionCallError( + "niFake_SetAttributeViReal64" + ) mock_library.niFake_SetAttributeViReal64.return_value = 0 - mock_library.niFake_SetAttributeViString.side_effect = MockFunctionCallError("niFake_SetAttributeViString") + mock_library.niFake_SetAttributeViString.side_effect = MockFunctionCallError( + "niFake_SetAttributeViString" + ) mock_library.niFake_SetAttributeViString.return_value = 0 - mock_library.niFake_SetCustomType.side_effect = MockFunctionCallError("niFake_SetCustomType") + mock_library.niFake_SetCustomType.side_effect = MockFunctionCallError( + "niFake_SetCustomType" + ) mock_library.niFake_SetCustomType.return_value = 0 - mock_library.niFake_SetCustomTypeArray.side_effect = MockFunctionCallError("niFake_SetCustomTypeArray") + mock_library.niFake_SetCustomTypeArray.side_effect = MockFunctionCallError( + "niFake_SetCustomTypeArray" + ) mock_library.niFake_SetCustomTypeArray.return_value = 0 - mock_library.niFake_StringValuedEnumInputFunctionWithDefaults.side_effect = MockFunctionCallError("niFake_StringValuedEnumInputFunctionWithDefaults") + mock_library.niFake_StringValuedEnumInputFunctionWithDefaults.side_effect = ( + MockFunctionCallError("niFake_StringValuedEnumInputFunctionWithDefaults") + ) mock_library.niFake_StringValuedEnumInputFunctionWithDefaults.return_value = 0 - mock_library.niFake_TwoInputFunction.side_effect = MockFunctionCallError("niFake_TwoInputFunction") + mock_library.niFake_TwoInputFunction.side_effect = MockFunctionCallError( + "niFake_TwoInputFunction" + ) mock_library.niFake_TwoInputFunction.return_value = 0 - mock_library.niFake_UnlockSession.side_effect = MockFunctionCallError("niFake_UnlockSession") + mock_library.niFake_UnlockSession.side_effect = MockFunctionCallError( + "niFake_UnlockSession" + ) mock_library.niFake_UnlockSession.return_value = 0 - mock_library.niFake_Use64BitNumber.side_effect = MockFunctionCallError("niFake_Use64BitNumber") + mock_library.niFake_Use64BitNumber.side_effect = MockFunctionCallError( + "niFake_Use64BitNumber" + ) mock_library.niFake_Use64BitNumber.return_value = 0 - mock_library.niFake_WriteWaveform.side_effect = MockFunctionCallError("niFake_WriteWaveform") + mock_library.niFake_WriteWaveform.side_effect = MockFunctionCallError( + "niFake_WriteWaveform" + ) mock_library.niFake_WriteWaveform.return_value = 0 mock_library.niFake_close.side_effect = MockFunctionCallError("niFake_close") mock_library.niFake_close.return_value = 0 - mock_library.niFake_error_message.side_effect = MockFunctionCallError("niFake_error_message") + mock_library.niFake_error_message.side_effect = MockFunctionCallError( + "niFake_error_message" + ) mock_library.niFake_error_message.return_value = 0 - mock_library.niFake_self_test.side_effect = MockFunctionCallError("niFake_self_test") + mock_library.niFake_self_test.side_effect = MockFunctionCallError( + "niFake_self_test" + ) mock_library.niFake_self_test.return_value = 0 diff --git a/generated/nifake/nifake/unit_tests/test_converters.py b/generated/nifake/nifake/unit_tests/test_converters.py index f828fce72..98506e9d0 100644 --- a/generated/nifake/nifake/unit_tests/test_converters.py +++ b/generated/nifake/nifake/unit_tests/test_converters.py @@ -7,24 +7,80 @@ def test_convert_init_with_options_dictionary(): - assert _converters.convert_init_with_options_dictionary('') == '' - assert _converters.convert_init_with_options_dictionary('Simulate=1') == 'Simulate=1' - assert _converters.convert_init_with_options_dictionary({'Simulate': True, }) == 'Simulate=1' - assert _converters.convert_init_with_options_dictionary({'Simulate': False, }) == 'Simulate=0' - assert _converters.convert_init_with_options_dictionary({'Simulate': True, 'Cache': False}) == 'Cache=0,Simulate=1' - assert _converters.convert_init_with_options_dictionary({'DriverSetup': {'Model': '5162 (4CH)', 'Bitfile': 'CustomProcessing'}}) == 'DriverSetup=Bitfile:CustomProcessing;Model:5162 (4CH)' - assert _converters.convert_init_with_options_dictionary({'Simulate': True, 'DriverSetup': {'Model': '5162 (4CH)', 'Bitfile': 'CustomProcessing'}}) == 'DriverSetup=Bitfile:CustomProcessing;Model:5162 (4CH),Simulate=1' - assert _converters.convert_init_with_options_dictionary({'simulate': True, 'cache': False}) == 'Cache=0,Simulate=1' - assert _converters.convert_init_with_options_dictionary({'driver_setup': {'Model': '5162 (4CH)', 'Bitfile': 'CustomProcessing'}}) == 'DriverSetup=Bitfile:CustomProcessing;Model:5162 (4CH)' - assert _converters.convert_init_with_options_dictionary({'simulate': True, 'driver_setup': {'Model': '5162 (4CH)', 'Bitfile': 'CustomProcessing'}}) == 'DriverSetup=Bitfile:CustomProcessing;Model:5162 (4CH),Simulate=1' + assert _converters.convert_init_with_options_dictionary("") == "" + assert ( + _converters.convert_init_with_options_dictionary("Simulate=1") == "Simulate=1" + ) + assert ( + _converters.convert_init_with_options_dictionary( + { + "Simulate": True, + } + ) + == "Simulate=1" + ) + assert ( + _converters.convert_init_with_options_dictionary( + { + "Simulate": False, + } + ) + == "Simulate=0" + ) + assert ( + _converters.convert_init_with_options_dictionary( + {"Simulate": True, "Cache": False} + ) + == "Cache=0,Simulate=1" + ) + assert ( + _converters.convert_init_with_options_dictionary( + {"DriverSetup": {"Model": "5162 (4CH)", "Bitfile": "CustomProcessing"}} + ) + == "DriverSetup=Bitfile:CustomProcessing;Model:5162 (4CH)" + ) + assert ( + _converters.convert_init_with_options_dictionary( + { + "Simulate": True, + "DriverSetup": {"Model": "5162 (4CH)", "Bitfile": "CustomProcessing"}, + } + ) + == "DriverSetup=Bitfile:CustomProcessing;Model:5162 (4CH),Simulate=1" + ) + assert ( + _converters.convert_init_with_options_dictionary( + {"simulate": True, "cache": False} + ) + == "Cache=0,Simulate=1" + ) + assert ( + _converters.convert_init_with_options_dictionary( + {"driver_setup": {"Model": "5162 (4CH)", "Bitfile": "CustomProcessing"}} + ) + == "DriverSetup=Bitfile:CustomProcessing;Model:5162 (4CH)" + ) + assert ( + _converters.convert_init_with_options_dictionary( + { + "simulate": True, + "driver_setup": {"Model": "5162 (4CH)", "Bitfile": "CustomProcessing"}, + } + ) + == "DriverSetup=Bitfile:CustomProcessing;Model:5162 (4CH),Simulate=1" + ) # Tests - time def test_convert_timedelta_to_seconds_double(): - test_result = _converters.convert_timedelta_to_seconds_real64(hightime.timedelta(seconds=10)) + test_result = _converters.convert_timedelta_to_seconds_real64( + hightime.timedelta(seconds=10) + ) assert test_result.value == 10.0 assert isinstance(test_result, _visatype.ViReal64) - test_result = _converters.convert_timedelta_to_seconds_real64(hightime.timedelta(nanoseconds=-0.5)) + test_result = _converters.convert_timedelta_to_seconds_real64( + hightime.timedelta(nanoseconds=-0.5) + ) assert test_result.value == pytest.approx(-5e-10) assert isinstance(test_result, _visatype.ViReal64) test_result = _converters.convert_timedelta_to_seconds_real64(10.5) @@ -36,10 +92,14 @@ def test_convert_timedelta_to_seconds_double(): def test_convert_timedelta_to_milliseconds_int32(): - test_result = _converters.convert_timedelta_to_milliseconds_int32(hightime.timedelta(seconds=10)) + test_result = _converters.convert_timedelta_to_milliseconds_int32( + hightime.timedelta(seconds=10) + ) assert test_result.value == 10000 assert isinstance(test_result, _visatype.ViInt32) - test_result = _converters.convert_timedelta_to_milliseconds_int32(hightime.timedelta(seconds=-5)) + test_result = _converters.convert_timedelta_to_milliseconds_int32( + hightime.timedelta(seconds=-5) + ) assert test_result.value == -5000 assert isinstance(test_result, _visatype.ViInt32) test_result = _converters.convert_timedelta_to_milliseconds_int32(10.5) @@ -53,11 +113,24 @@ def test_convert_timedelta_to_milliseconds_int32(): def test_convert_timedeltas_to_seconds_real64(): time_values = [10.5, -5e-10] test_result = _converters.convert_timedeltas_to_seconds_real64(time_values) - assert all([actual.value == pytest.approx(expected) for actual, expected in zip(test_result, time_values)]) + assert all( + [ + actual.value == pytest.approx(expected) + for actual, expected in zip(test_result, time_values) + ] + ) assert all([isinstance(i, _visatype.ViReal64) for i in test_result]) - test_input = [hightime.timedelta(seconds=10.5), hightime.timedelta(nanoseconds=-0.5)] + test_input = [ + hightime.timedelta(seconds=10.5), + hightime.timedelta(nanoseconds=-0.5), + ] test_result = _converters.convert_timedeltas_to_seconds_real64(test_input) - assert all([actual.value == pytest.approx(expected) for actual, expected in zip(test_result, time_values)]) + assert all( + [ + actual.value == pytest.approx(expected) + for actual, expected in zip(test_result, time_values) + ] + ) assert all([isinstance(i, _visatype.ViReal64) for i in test_result]) @@ -71,138 +144,247 @@ def test_convert_seconds_real64_to_timedelta(): def test_convert_seconds_real64_to_timedeltas(): time_values = [10.5, -5e-10] test_result = _converters.convert_seconds_real64_to_timedeltas(time_values) - assert all([actual.total_seconds() == pytest.approx(expected) for actual, expected in zip(test_result, time_values)]) + assert all( + [ + actual.total_seconds() == pytest.approx(expected) + for actual, expected in zip(test_result, time_values) + ] + ) assert all([isinstance(x, hightime.timedelta) for x in test_result]) # Tests - repeated capabilities def test_repeated_capabilities_string_channel(): - test_result_list = _converters.convert_repeated_capabilities('0') - assert test_result_list == ['0'] - test_result_list = _converters.convert_repeated_capabilities('r0') - assert test_result_list == ['r0'] - test_result_list = _converters.convert_repeated_capabilities('0,1') - assert test_result_list == ['0', '1'] + test_result_list = _converters.convert_repeated_capabilities("0") + assert test_result_list == ["0"] + test_result_list = _converters.convert_repeated_capabilities("r0") + assert test_result_list == ["r0"] + test_result_list = _converters.convert_repeated_capabilities("0,1") + assert test_result_list == ["0", "1"] def test_repeated_capabilities_string_prefix(): - test_result_list = _converters.convert_repeated_capabilities('0', prefix='ScriptTrigger') - assert test_result_list == ['ScriptTrigger0'] + test_result_list = _converters.convert_repeated_capabilities( + "0", prefix="ScriptTrigger" + ) + assert test_result_list == ["ScriptTrigger0"] def test_repeated_capabilities_list_channel(): - test_result_list = _converters.convert_repeated_capabilities(['0']) - assert test_result_list == ['0'] - test_result_list = _converters.convert_repeated_capabilities(['r0']) - assert test_result_list == ['r0'] - test_result_list = _converters.convert_repeated_capabilities(['0', '1']) - assert test_result_list == ['0', '1'] + test_result_list = _converters.convert_repeated_capabilities(["0"]) + assert test_result_list == ["0"] + test_result_list = _converters.convert_repeated_capabilities(["r0"]) + assert test_result_list == ["r0"] + test_result_list = _converters.convert_repeated_capabilities(["0", "1"]) + assert test_result_list == ["0", "1"] test_result_list = _converters.convert_repeated_capabilities([0, 1]) - assert test_result_list == ['0', '1'] - test_result_list = _converters.convert_repeated_capabilities([0, 1, '3']) - assert test_result_list == ['0', '1', '3'] + assert test_result_list == ["0", "1"] + test_result_list = _converters.convert_repeated_capabilities([0, 1, "3"]) + assert test_result_list == ["0", "1", "3"] def test_repeated_capabilities_list_prefix(): - test_result_list = _converters.convert_repeated_capabilities(['ScriptTrigger0', 'ScriptTrigger1'], prefix='ScriptTrigger') - assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] - test_result_list = _converters.convert_repeated_capabilities(['0'], prefix='ScriptTrigger') - assert test_result_list == ['ScriptTrigger0'] - test_result_list = _converters.convert_repeated_capabilities(['0', '1'], prefix='ScriptTrigger') - assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] - test_result_list = _converters.convert_repeated_capabilities([0, 1], prefix='ScriptTrigger') - assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = _converters.convert_repeated_capabilities( + ["ScriptTrigger0", "ScriptTrigger1"], prefix="ScriptTrigger" + ) + assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] + test_result_list = _converters.convert_repeated_capabilities( + ["0"], prefix="ScriptTrigger" + ) + assert test_result_list == ["ScriptTrigger0"] + test_result_list = _converters.convert_repeated_capabilities( + ["0", "1"], prefix="ScriptTrigger" + ) + assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] + test_result_list = _converters.convert_repeated_capabilities( + [0, 1], prefix="ScriptTrigger" + ) + assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] def test_repeated_capabilities_tuple_channel(): - test_result_list = _converters.convert_repeated_capabilities(('0')) - assert test_result_list == ['0'] - test_result_list = _converters.convert_repeated_capabilities(('0,1')) - assert test_result_list == ['0', '1'] - test_result_list = _converters.convert_repeated_capabilities(('0', '1')) - assert test_result_list == ['0', '1'] + test_result_list = _converters.convert_repeated_capabilities(("0")) + assert test_result_list == ["0"] + test_result_list = _converters.convert_repeated_capabilities(("0,1")) + assert test_result_list == ["0", "1"] + test_result_list = _converters.convert_repeated_capabilities(("0", "1")) + assert test_result_list == ["0", "1"] test_result_list = _converters.convert_repeated_capabilities((0, 1)) - assert test_result_list == ['0', '1'] - test_result_list = _converters.convert_repeated_capabilities((0, 1, '3')) - assert test_result_list == ['0', '1', '3'] + assert test_result_list == ["0", "1"] + test_result_list = _converters.convert_repeated_capabilities((0, 1, "3")) + assert test_result_list == ["0", "1", "3"] def test_repeated_capabilities_tuple_prefix(): - test_result_list = _converters.convert_repeated_capabilities(('ScriptTrigger0,ScriptTrigger1'), prefix='ScriptTrigger') - assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] - test_result_list = _converters.convert_repeated_capabilities(('0'), prefix='ScriptTrigger') - assert test_result_list == ['ScriptTrigger0'] - test_result_list = _converters.convert_repeated_capabilities(('0', '1'), prefix='ScriptTrigger') - assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] - test_result_list = _converters.convert_repeated_capabilities((0, 1), prefix='ScriptTrigger') - assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = _converters.convert_repeated_capabilities( + ("ScriptTrigger0,ScriptTrigger1"), prefix="ScriptTrigger" + ) + assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] + test_result_list = _converters.convert_repeated_capabilities( + ("0"), prefix="ScriptTrigger" + ) + assert test_result_list == ["ScriptTrigger0"] + test_result_list = _converters.convert_repeated_capabilities( + ("0", "1"), prefix="ScriptTrigger" + ) + assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] + test_result_list = _converters.convert_repeated_capabilities( + (0, 1), prefix="ScriptTrigger" + ) + assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] def test_repeated_capabilities_unicode(): - test_result_list = _converters.convert_repeated_capabilities(u'ScriptTrigger0,ScriptTrigger1', prefix='ScriptTrigger') - assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] - test_result_list = _converters.convert_repeated_capabilities(u'ScriptTrigger0,ScriptTrigger1', prefix=u'ScriptTrigger') - assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] - test_result_list = _converters.convert_repeated_capabilities('ScriptTrigger0,ScriptTrigger1', prefix=u'ScriptTrigger') - assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = _converters.convert_repeated_capabilities( + "ScriptTrigger0,ScriptTrigger1", prefix="ScriptTrigger" + ) + assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] + test_result_list = _converters.convert_repeated_capabilities( + "ScriptTrigger0,ScriptTrigger1", prefix="ScriptTrigger" + ) + assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] + test_result_list = _converters.convert_repeated_capabilities( + "ScriptTrigger0,ScriptTrigger1", prefix="ScriptTrigger" + ) + assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] def test_repeated_capabilities_raw(): - test_result_list = _converters.convert_repeated_capabilities(r'ScriptTrigger0,ScriptTrigger1', prefix='ScriptTrigger') - assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] - test_result_list = _converters.convert_repeated_capabilities(r'ScriptTrigger0,ScriptTrigger1', prefix=r'ScriptTrigger') - assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] - test_result_list = _converters.convert_repeated_capabilities('ScriptTrigger0,ScriptTrigger1', prefix=r'ScriptTrigger') - assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] - test_result_list = _converters.convert_repeated_capabilities(r'ScriptTrigger0,ScriptTrigger1', prefix=u'ScriptTrigger') - assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] - test_result_list = _converters.convert_repeated_capabilities(r'ScriptTrigger0,ScriptTrigger1', prefix=r'ScriptTrigger') - assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] - test_result_list = _converters.convert_repeated_capabilities(u'ScriptTrigger0,ScriptTrigger1', prefix=r'ScriptTrigger') - assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = _converters.convert_repeated_capabilities( + r"ScriptTrigger0,ScriptTrigger1", prefix="ScriptTrigger" + ) + assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] + test_result_list = _converters.convert_repeated_capabilities( + r"ScriptTrigger0,ScriptTrigger1", prefix=r"ScriptTrigger" + ) + assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] + test_result_list = _converters.convert_repeated_capabilities( + "ScriptTrigger0,ScriptTrigger1", prefix=r"ScriptTrigger" + ) + assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] + test_result_list = _converters.convert_repeated_capabilities( + r"ScriptTrigger0,ScriptTrigger1", prefix="ScriptTrigger" + ) + assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] + test_result_list = _converters.convert_repeated_capabilities( + r"ScriptTrigger0,ScriptTrigger1", prefix=r"ScriptTrigger" + ) + assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] + test_result_list = _converters.convert_repeated_capabilities( + "ScriptTrigger0,ScriptTrigger1", prefix=r"ScriptTrigger" + ) + assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] def test_repeated_capabilities_slice_channel(): test_result_list = _converters.convert_repeated_capabilities(slice(0, 1)) - assert test_result_list == ['0'] + assert test_result_list == ["0"] test_result_list = _converters.convert_repeated_capabilities(slice(0, 2)) - assert test_result_list == ['0', '1'] + assert test_result_list == ["0", "1"] test_result_list = _converters.convert_repeated_capabilities(slice(None, 2)) - assert test_result_list == ['0', '1'] + assert test_result_list == ["0", "1"] def test_repeated_capabilities_mixed_channel(): - test_result_list = _converters.convert_repeated_capabilities((slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17')) - assert test_result_list == ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - test_result_list = _converters.convert_repeated_capabilities([slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17']) - assert test_result_list == ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] + test_result_list = _converters.convert_repeated_capabilities( + (slice(0, 1), "2", [4, "5-6"], "7-9", "11:14", "16, 17") + ) + assert test_result_list == [ + "0", + "2", + "4", + "5", + "6", + "7", + "8", + "9", + "11", + "12", + "13", + "14", + "16", + "17", + ] + test_result_list = _converters.convert_repeated_capabilities( + [slice(0, 1), "2", [4, "5-6"], "7-9", "11:14", "16, 17"] + ) + assert test_result_list == [ + "0", + "2", + "4", + "5", + "6", + "7", + "8", + "9", + "11", + "12", + "13", + "14", + "16", + "17", + ] def test_repeated_capabilities_mixed_prefix(): - test_result_list = _converters.convert_repeated_capabilities((slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17'), prefix='ScriptTrigger') - assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger2', 'ScriptTrigger4', 'ScriptTrigger5', 'ScriptTrigger6', 'ScriptTrigger7', 'ScriptTrigger8', 'ScriptTrigger9', 'ScriptTrigger11', 'ScriptTrigger12', 'ScriptTrigger13', 'ScriptTrigger14', 'ScriptTrigger16', 'ScriptTrigger17'] - test_result_list = _converters.convert_repeated_capabilities([slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17'], prefix='ScriptTrigger') - assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger2', 'ScriptTrigger4', 'ScriptTrigger5', 'ScriptTrigger6', 'ScriptTrigger7', 'ScriptTrigger8', 'ScriptTrigger9', 'ScriptTrigger11', 'ScriptTrigger12', 'ScriptTrigger13', 'ScriptTrigger14', 'ScriptTrigger16', 'ScriptTrigger17'] + test_result_list = _converters.convert_repeated_capabilities( + (slice(0, 1), "2", [4, "5-6"], "7-9", "11:14", "16, 17"), prefix="ScriptTrigger" + ) + assert test_result_list == [ + "ScriptTrigger0", + "ScriptTrigger2", + "ScriptTrigger4", + "ScriptTrigger5", + "ScriptTrigger6", + "ScriptTrigger7", + "ScriptTrigger8", + "ScriptTrigger9", + "ScriptTrigger11", + "ScriptTrigger12", + "ScriptTrigger13", + "ScriptTrigger14", + "ScriptTrigger16", + "ScriptTrigger17", + ] + test_result_list = _converters.convert_repeated_capabilities( + [slice(0, 1), "2", [4, "5-6"], "7-9", "11:14", "16, 17"], prefix="ScriptTrigger" + ) + assert test_result_list == [ + "ScriptTrigger0", + "ScriptTrigger2", + "ScriptTrigger4", + "ScriptTrigger5", + "ScriptTrigger6", + "ScriptTrigger7", + "ScriptTrigger8", + "ScriptTrigger9", + "ScriptTrigger11", + "ScriptTrigger12", + "ScriptTrigger13", + "ScriptTrigger14", + "ScriptTrigger16", + "ScriptTrigger17", + ] def test_invalid_repeated_capabilities(): try: - _converters.convert_repeated_capabilities('6-8-10') + _converters.convert_repeated_capabilities("6-8-10") assert False except errors.InvalidRepeatedCapabilityError: pass try: - _converters.convert_repeated_capabilities(['5', '6-8-10']) + _converters.convert_repeated_capabilities(["5", "6-8-10"]) assert False except errors.InvalidRepeatedCapabilityError: pass try: - _converters.convert_repeated_capabilities(('5', '6-8-10')) + _converters.convert_repeated_capabilities(("5", "6-8-10")) assert False except errors.InvalidRepeatedCapabilityError: pass try: - _converters.convert_repeated_capabilities('5,6-8-10') + _converters.convert_repeated_capabilities("5,6-8-10") assert False except errors.InvalidRepeatedCapabilityError: pass @@ -212,129 +394,187 @@ def test_invalid_repeated_capabilities(): except errors.InvalidRepeatedCapabilityError: pass try: - _converters.convert_repeated_capabilities([5.0, '0']) + _converters.convert_repeated_capabilities([5.0, "0"]) assert False except errors.InvalidRepeatedCapabilityError: pass try: - _converters.convert_repeated_capabilities((5.0, '0')) + _converters.convert_repeated_capabilities((5.0, "0")) assert False except errors.InvalidRepeatedCapabilityError: pass def test_repeated_capabilities_slice_prefix(): - test_result_list = _converters.convert_repeated_capabilities(slice(0, 1), prefix='ScriptTrigger') - assert test_result_list == ['ScriptTrigger0'] - test_result_list = _converters.convert_repeated_capabilities(slice(0, 2), prefix='ScriptTrigger') - assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] - test_result_list = _converters.convert_repeated_capabilities(slice(None, 2), prefix='ScriptTrigger') - assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = _converters.convert_repeated_capabilities( + slice(0, 1), prefix="ScriptTrigger" + ) + assert test_result_list == ["ScriptTrigger0"] + test_result_list = _converters.convert_repeated_capabilities( + slice(0, 2), prefix="ScriptTrigger" + ) + assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] + test_result_list = _converters.convert_repeated_capabilities( + slice(None, 2), prefix="ScriptTrigger" + ) + assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] def test_repeated_capabilities_without_prefix(): - test_result = _converters.convert_repeated_capabilities_without_prefix((slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17')) - assert test_result == '0,2,4,5,6,7,8,9,11,12,13,14,16,17' + test_result = _converters.convert_repeated_capabilities_without_prefix( + (slice(0, 1), "2", [4, "5-6"], "7-9", "11:14", "16, 17") + ) + assert test_result == "0,2,4,5,6,7,8,9,11,12,13,14,16,17" def test_repeated_capabilities_string_resource_name(): - test_result_list = _converters.convert_repeated_capabilities_without_prefix('Dev1') - assert test_result_list == 'Dev1' - test_result_list = _converters.convert_repeated_capabilities_without_prefix('Dev1,Dev2') - assert test_result_list == 'Dev1,Dev2' - test_result_list = _converters.convert_repeated_capabilities_without_prefix('Dev1/0') - assert test_result_list == 'Dev1/0' - test_result_list = _converters.convert_repeated_capabilities_without_prefix('Dev1/0:1, Dev2/0-1') - assert test_result_list == 'Dev1/0:1,Dev2/0-1' - test_result_list = _converters.convert_repeated_capabilities_without_prefix('Dev1, Dev2/0-2') - assert test_result_list == 'Dev1,Dev2/0-2' + test_result_list = _converters.convert_repeated_capabilities_without_prefix("Dev1") + assert test_result_list == "Dev1" + test_result_list = _converters.convert_repeated_capabilities_without_prefix( + "Dev1,Dev2" + ) + assert test_result_list == "Dev1,Dev2" + test_result_list = _converters.convert_repeated_capabilities_without_prefix( + "Dev1/0" + ) + assert test_result_list == "Dev1/0" + test_result_list = _converters.convert_repeated_capabilities_without_prefix( + "Dev1/0:1, Dev2/0-1" + ) + assert test_result_list == "Dev1/0:1,Dev2/0-1" + test_result_list = _converters.convert_repeated_capabilities_without_prefix( + "Dev1, Dev2/0-2" + ) + assert test_result_list == "Dev1,Dev2/0-2" def test_repeated_capabilities_list_resource_name(): - test_result_list = _converters.convert_repeated_capabilities_without_prefix(['Dev1']) - assert test_result_list == 'Dev1' - test_result_list = _converters.convert_repeated_capabilities_without_prefix(['Dev1', 'Dev2']) - assert test_result_list == 'Dev1,Dev2' - test_result_list = _converters.convert_repeated_capabilities_without_prefix(['Dev1/0']) - assert test_result_list == 'Dev1/0' - test_result_list = _converters.convert_repeated_capabilities_without_prefix(['Dev1/0:1', 'Dev2/0-1']) - assert test_result_list == 'Dev1/0:1,Dev2/0-1' - test_result_list = _converters.convert_repeated_capabilities_without_prefix(['Dev1', 'Dev2/0-2']) - assert test_result_list == 'Dev1,Dev2/0-2' + test_result_list = _converters.convert_repeated_capabilities_without_prefix( + ["Dev1"] + ) + assert test_result_list == "Dev1" + test_result_list = _converters.convert_repeated_capabilities_without_prefix( + ["Dev1", "Dev2"] + ) + assert test_result_list == "Dev1,Dev2" + test_result_list = _converters.convert_repeated_capabilities_without_prefix( + ["Dev1/0"] + ) + assert test_result_list == "Dev1/0" + test_result_list = _converters.convert_repeated_capabilities_without_prefix( + ["Dev1/0:1", "Dev2/0-1"] + ) + assert test_result_list == "Dev1/0:1,Dev2/0-1" + test_result_list = _converters.convert_repeated_capabilities_without_prefix( + ["Dev1", "Dev2/0-2"] + ) + assert test_result_list == "Dev1,Dev2/0-2" def test_repeated_capabilities_tuple_resource_name(): - test_result_list = _converters.convert_repeated_capabilities_without_prefix(('Dev1')) - assert test_result_list == 'Dev1' - test_result_list = _converters.convert_repeated_capabilities_without_prefix(('Dev1', 'Dev2')) - assert test_result_list == 'Dev1,Dev2' - test_result_list = _converters.convert_repeated_capabilities_without_prefix(('Dev1/0')) - assert test_result_list == 'Dev1/0' - test_result_list = _converters.convert_repeated_capabilities_without_prefix(('Dev1/0:1', 'Dev2/0-1')) - assert test_result_list == 'Dev1/0:1,Dev2/0-1' - test_result_list = _converters.convert_repeated_capabilities_without_prefix(('Dev1', 'Dev2/0-2')) - assert test_result_list == 'Dev1,Dev2/0-2' + test_result_list = _converters.convert_repeated_capabilities_without_prefix( + ("Dev1") + ) + assert test_result_list == "Dev1" + test_result_list = _converters.convert_repeated_capabilities_without_prefix( + ("Dev1", "Dev2") + ) + assert test_result_list == "Dev1,Dev2" + test_result_list = _converters.convert_repeated_capabilities_without_prefix( + ("Dev1/0") + ) + assert test_result_list == "Dev1/0" + test_result_list = _converters.convert_repeated_capabilities_without_prefix( + ("Dev1/0:1", "Dev2/0-1") + ) + assert test_result_list == "Dev1/0:1,Dev2/0-1" + test_result_list = _converters.convert_repeated_capabilities_without_prefix( + ("Dev1", "Dev2/0-2") + ) + assert test_result_list == "Dev1,Dev2/0-2" def test_repeated_capabilities_mixed_resource_name(): - test_result_list = _converters.convert_repeated_capabilities_without_prefix(['Dev1', ('Dev2/0', 'Dev2/1'), ['Dev3/0:1', 'Dev4/1:2'], 'Dev5/1']) - assert test_result_list == 'Dev1,Dev2/0,Dev2/1,Dev3/0:1,Dev4/1:2,Dev5/1' + test_result_list = _converters.convert_repeated_capabilities_without_prefix( + ["Dev1", ("Dev2/0", "Dev2/1"), ["Dev3/0:1", "Dev4/1:2"], "Dev5/1"] + ) + assert test_result_list == "Dev1,Dev2/0,Dev2/1,Dev3/0:1,Dev4/1:2,Dev5/1" def test_repeated_capabilities_invalid_resource_names(): - test_result_list = _converters.convert_repeated_capabilities_without_prefix('/') - assert test_result_list == '/' - test_result_list = _converters.convert_repeated_capabilities_without_prefix('Dev/') - assert test_result_list == 'Dev/' - test_result_list = _converters.convert_repeated_capabilities_without_prefix('Dev,') - assert test_result_list == 'Dev,' - test_result_list = _converters.convert_repeated_capabilities_without_prefix('Dev/1/1,') - assert test_result_list == 'Dev/1/1,' - test_result_list = _converters.convert_repeated_capabilities_without_prefix('0/1:2,') - assert test_result_list == '0/1:2,' + test_result_list = _converters.convert_repeated_capabilities_without_prefix("/") + assert test_result_list == "/" + test_result_list = _converters.convert_repeated_capabilities_without_prefix("Dev/") + assert test_result_list == "Dev/" + test_result_list = _converters.convert_repeated_capabilities_without_prefix("Dev,") + assert test_result_list == "Dev," + test_result_list = _converters.convert_repeated_capabilities_without_prefix( + "Dev/1/1," + ) + assert test_result_list == "Dev/1/1," + test_result_list = _converters.convert_repeated_capabilities_without_prefix( + "0/1:2," + ) + assert test_result_list == "0/1:2," def test_convert_chained_repeated_capability_to_parts_three_parts(): - chained_rep_cap = ('site0/test/PinA,site0/test/PinB,site0/test/PinC,' - 'site1/test/PinA,site1/test/PinB,site1/test/PinC') - rep_cap_list = _converters.convert_chained_repeated_capability_to_parts(chained_rep_cap) - assert rep_cap_list == ['site0,site1', 'test', 'PinA,PinB,PinC'] + chained_rep_cap = ( + "site0/test/PinA,site0/test/PinB,site0/test/PinC," + "site1/test/PinA,site1/test/PinB,site1/test/PinC" + ) + rep_cap_list = _converters.convert_chained_repeated_capability_to_parts( + chained_rep_cap + ) + assert rep_cap_list == ["site0,site1", "test", "PinA,PinB,PinC"] def test_convert_chained_repeated_capability_to_parts_single_part(): - rep_cap_list = _converters.convert_chained_repeated_capability_to_parts('site0, site1') - assert rep_cap_list == ['site0,site1'] + rep_cap_list = _converters.convert_chained_repeated_capability_to_parts( + "site0, site1" + ) + assert rep_cap_list == ["site0,site1"] def test_convert_chained_repeated_capability_to_parts_empty_string(): - rep_cap_list = _converters.convert_chained_repeated_capability_to_parts('') - assert rep_cap_list == [''] + rep_cap_list = _converters.convert_chained_repeated_capability_to_parts("") + assert rep_cap_list == [""] def test_string_to_list_channel(): - test_result = _converters._convert_repeated_capabilities('r0', '') - assert test_result == ['r0'] - test_result = _converters._convert_repeated_capabilities(['0-2'], '') - assert test_result == ['0', '1', '2'] - test_result = _converters._convert_repeated_capabilities(['3:7'], '') - assert test_result == ['3', '4', '5', '6', '7'] - test_result = _converters._convert_repeated_capabilities(['2-0'], '') - assert test_result == ['2', '1', '0'] - test_result = _converters._convert_repeated_capabilities(['2:0'], '') - assert test_result == ['2', '1', '0'] + test_result = _converters._convert_repeated_capabilities("r0", "") + assert test_result == ["r0"] + test_result = _converters._convert_repeated_capabilities(["0-2"], "") + assert test_result == ["0", "1", "2"] + test_result = _converters._convert_repeated_capabilities(["3:7"], "") + assert test_result == ["3", "4", "5", "6", "7"] + test_result = _converters._convert_repeated_capabilities(["2-0"], "") + assert test_result == ["2", "1", "0"] + test_result = _converters._convert_repeated_capabilities(["2:0"], "") + assert test_result == ["2", "1", "0"] def test_string_to_list_prefix(): - test_result = _converters._convert_repeated_capabilities(['ScriptTrigger3-ScriptTrigger7'], 'ScriptTrigger') - assert test_result == ['3', '4', '5', '6', '7'] - test_result = _converters._convert_repeated_capabilities(['ScriptTrigger3:ScriptTrigger7'], 'ScriptTrigger') - assert test_result == ['3', '4', '5', '6', '7'] - test_result = _converters._convert_repeated_capabilities(['ScriptTrigger2-ScriptTrigger0'], 'ScriptTrigger') - assert test_result == ['2', '1', '0'] - test_result = _converters._convert_repeated_capabilities(['ScriptTrigger2:ScriptTrigger0'], 'ScriptTrigger') - assert test_result == ['2', '1', '0'] + test_result = _converters._convert_repeated_capabilities( + ["ScriptTrigger3-ScriptTrigger7"], "ScriptTrigger" + ) + assert test_result == ["3", "4", "5", "6", "7"] + test_result = _converters._convert_repeated_capabilities( + ["ScriptTrigger3:ScriptTrigger7"], "ScriptTrigger" + ) + assert test_result == ["3", "4", "5", "6", "7"] + test_result = _converters._convert_repeated_capabilities( + ["ScriptTrigger2-ScriptTrigger0"], "ScriptTrigger" + ) + assert test_result == ["2", "1", "0"] + test_result = _converters._convert_repeated_capabilities( + ["ScriptTrigger2:ScriptTrigger0"], "ScriptTrigger" + ) + assert test_result == ["2", "1", "0"] def test_convert_comma_separated_string_to_list(): - out_list = _converters.convert_comma_separated_string_to_list(' PinA , PinB , PinC ') - assert out_list == ['PinA', 'PinB', 'PinC'] + out_list = _converters.convert_comma_separated_string_to_list( + " PinA , PinB , PinC " + ) + assert out_list == ["PinA", "PinB", "PinC"] diff --git a/generated/nifake/nifake/unit_tests/test_session.py b/generated/nifake/nifake/unit_tests/test_session.py index 1edc33d80..fd9688d38 100644 --- a/generated/nifake/nifake/unit_tests/test_session.py +++ b/generated/nifake/nifake/unit_tests/test_session.py @@ -22,35 +22,52 @@ class TestSession(object): - def setup_method(self, method): - self.patched_library_patcher = patch('nifake._library.Library', autospec=True) + self.patched_library_patcher = patch("nifake._library.Library", autospec=True) self.patched_library = self.patched_library_patcher.start() - self.patched_library_singleton_get = patch('nifake.session._library_singleton.get', return_value=self.patched_library) + self.patched_library_singleton_get = patch( + "nifake.session._library_singleton.get", return_value=self.patched_library + ) self.patched_library_singleton_get.start() # We don't actually call into the nitclk DLL, but we do need to mock the function since it is called - self.tclk_patched_library_singleton_get = patch('nitclk.session._library_singleton.get', return_value=None) + self.tclk_patched_library_singleton_get = patch( + "nitclk.session._library_singleton.get", return_value=None + ) self.tclk_patched_library_singleton_get.start() self.side_effects_helper = _mock_helper.SideEffectsHelper() - self.side_effects_helper.set_side_effects_and_return_values(self.patched_library) - self.patched_library.niFake_InitWithOptions.side_effect = self.side_effects_helper.niFake_InitWithOptions + self.side_effects_helper.set_side_effects_and_return_values( + self.patched_library + ) + self.patched_library.niFake_InitWithOptions.side_effect = ( + self.side_effects_helper.niFake_InitWithOptions + ) self.disallow_close = self.patched_library.niFake_close.side_effect - self.patched_library.niFake_close.side_effect = self.side_effects_helper.niFake_close + self.patched_library.niFake_close.side_effect = ( + self.side_effects_helper.niFake_close + ) - self.side_effects_helper['InitWithOptions']['vi'] = SESSION_NUM_FOR_TEST + self.side_effects_helper["InitWithOptions"]["vi"] = SESSION_NUM_FOR_TEST self.get_ctypes_pointer_for_buffer_side_effect_count = 0 self.get_ctypes_pointer_for_buffer_side_effect_items = [] # Mock lock/unlock - self.LockSession_side_effect_cache = self.patched_library.niFake_LockSession.side_effect - self.patched_library.niFake_LockSession.side_effect = self.side_effects_helper.niFake_LockSession - self.side_effects_helper['LockSession']['callerHasLock'] = True - self.UnlockSession_side_effect_cache = self.patched_library.niFake_UnlockSession.side_effect - self.patched_library.niFake_UnlockSession.side_effect = self.side_effects_helper.niFake_UnlockSession - self.side_effects_helper['UnlockSession']['callerHasLock'] = False + self.LockSession_side_effect_cache = ( + self.patched_library.niFake_LockSession.side_effect + ) + self.patched_library.niFake_LockSession.side_effect = ( + self.side_effects_helper.niFake_LockSession + ) + self.side_effects_helper["LockSession"]["callerHasLock"] = True + self.UnlockSession_side_effect_cache = ( + self.patched_library.niFake_UnlockSession.side_effect + ) + self.patched_library.niFake_UnlockSession.side_effect = ( + self.side_effects_helper.niFake_UnlockSession + ) + self.side_effects_helper["UnlockSession"]["callerHasLock"] = False def teardown_method(self, method): self.patched_library_singleton_get.stop() @@ -62,53 +79,92 @@ def niFake_read_warning(self, vi, maximum_time, reading): # noqa: N802 return self.error_code_return def get_ctypes_pointer_for_buffer_side_effect(self, value, library_type=None): - ret_val = self.get_ctypes_pointer_for_buffer_side_effect_items[self.get_ctypes_pointer_for_buffer_side_effect_count] + ret_val = self.get_ctypes_pointer_for_buffer_side_effect_items[ + self.get_ctypes_pointer_for_buffer_side_effect_count + ] self.get_ctypes_pointer_for_buffer_side_effect_count += 1 return ret_val # Session management def test_init_with_options_and_close(self): - errors_patcher = patch('nifake.session.errors', spec_set=['handle_error', '_is_error']) + errors_patcher = patch( + "nifake.session.errors", spec_set=["handle_error", "_is_error"] + ) patched_errors = errors_patcher.start() patched_errors._is_error.return_value = 0 - session = nifake.Session('dev1') - self.patched_library.niFake_InitWithOptions.assert_called_once_with(_matchers.ViStringMatcher('dev1'), _matchers.ViBooleanMatcher(False), _matchers.ViBooleanMatcher(False), _matchers.ViStringMatcher(''), _matchers.ViSessionPointerMatcher()) - patched_errors.handle_error.assert_called_once_with(session, self.patched_library.niFake_InitWithOptions.return_value, ignore_warnings=False, is_error_handling=False) + session = nifake.Session("dev1") + self.patched_library.niFake_InitWithOptions.assert_called_once_with( + _matchers.ViStringMatcher("dev1"), + _matchers.ViBooleanMatcher(False), + _matchers.ViBooleanMatcher(False), + _matchers.ViStringMatcher(""), + _matchers.ViSessionPointerMatcher(), + ) + patched_errors.handle_error.assert_called_once_with( + session, + self.patched_library.niFake_InitWithOptions.return_value, + ignore_warnings=False, + is_error_handling=False, + ) session.close() - self.patched_library.niFake_close.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) + self.patched_library.niFake_close.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) + ) errors_patcher.stop() def test_init_with_options_nondefault_and_close(self): - session = nifake.Session('FakeDevice', 'Some string', True, True) - self.patched_library.niFake_InitWithOptions.assert_called_once_with(_matchers.ViStringMatcher('FakeDevice'), _matchers.ViBooleanMatcher(True), _matchers.ViBooleanMatcher(True), _matchers.ViStringMatcher('Some string'), _matchers.ViSessionPointerMatcher()) + session = nifake.Session("FakeDevice", "Some string", True, True) + self.patched_library.niFake_InitWithOptions.assert_called_once_with( + _matchers.ViStringMatcher("FakeDevice"), + _matchers.ViBooleanMatcher(True), + _matchers.ViBooleanMatcher(True), + _matchers.ViStringMatcher("Some string"), + _matchers.ViSessionPointerMatcher(), + ) session.close() - self.patched_library.niFake_close.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) + self.patched_library.niFake_close.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) + ) def test_close(self): - session = nifake.Session('dev1') + session = nifake.Session("dev1") session.close() - self.patched_library.niFake_close.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) + self.patched_library.niFake_close.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) + ) def test_session_context_manager(self): - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: assert type(session) == nifake.Session - self.patched_library.niFake_InitWithOptions.assert_called_once_with(_matchers.ViStringMatcher('dev1'), _matchers.ViBooleanMatcher(False), _matchers.ViBooleanMatcher(False), _matchers.ViStringMatcher(''), _matchers.ViSessionPointerMatcher()) - self.patched_library.niFake_close.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) + self.patched_library.niFake_InitWithOptions.assert_called_once_with( + _matchers.ViStringMatcher("dev1"), + _matchers.ViBooleanMatcher(False), + _matchers.ViBooleanMatcher(False), + _matchers.ViStringMatcher(""), + _matchers.ViSessionPointerMatcher(), + ) + self.patched_library.niFake_close.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) + ) def test_init_with_error(self): test_error_code = -1 - test_error_desc = 'Test' - self.patched_library.niFake_InitWithOptions.side_effect = self.side_effects_helper.niFake_InitWithOptions - self.side_effects_helper['InitWithOptions']['return'] = test_error_code - self.side_effects_helper['InitWithOptions']['vi'] = SESSION_NUM_FOR_TEST - self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError - self.side_effects_helper['GetError']['errorCode'] = test_error_code - self.side_effects_helper['GetError']['description'] = test_error_desc + test_error_desc = "Test" + self.patched_library.niFake_InitWithOptions.side_effect = ( + self.side_effects_helper.niFake_InitWithOptions + ) + self.side_effects_helper["InitWithOptions"]["return"] = test_error_code + self.side_effects_helper["InitWithOptions"]["vi"] = SESSION_NUM_FOR_TEST + self.patched_library.niFake_GetError.side_effect = ( + self.side_effects_helper.niFake_GetError + ) + self.side_effects_helper["GetError"]["errorCode"] = test_error_code + self.side_effects_helper["GetError"]["description"] = test_error_desc try: - nifake.Session('dev1') + nifake.Session("dev1") assert False except nifake.Error as e: assert e.code == test_error_code @@ -116,13 +172,17 @@ def test_init_with_error(self): def test_close_with_error(self): test_error_code = -1 - test_error_desc = 'Test' - self.patched_library.niFake_close.side_effect = self.side_effects_helper.niFake_close - session = nifake.Session('dev1') - self.side_effects_helper['close']['return'] = test_error_code - self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError - self.side_effects_helper['GetError']['errorCode'] = test_error_code - self.side_effects_helper['GetError']['description'] = test_error_desc + test_error_desc = "Test" + self.patched_library.niFake_close.side_effect = ( + self.side_effects_helper.niFake_close + ) + session = nifake.Session("dev1") + self.side_effects_helper["close"]["return"] = test_error_code + self.patched_library.niFake_GetError.side_effect = ( + self.side_effects_helper.niFake_GetError + ) + self.side_effects_helper["GetError"]["errorCode"] = test_error_code + self.side_effects_helper["GetError"]["description"] = test_error_desc try: session.close() assert False @@ -130,19 +190,25 @@ def test_close_with_error(self): assert e.code == test_error_code assert e.description == test_error_desc assert session._vi == 0 - self.patched_library.niFake_close.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) + self.patched_library.niFake_close.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) + ) def test_session_context_manager_init_with_error(self): test_error_code = -1 - test_error_desc = 'Test' - self.patched_library.niFake_InitWithOptions.side_effect = self.side_effects_helper.niFake_InitWithOptions - self.side_effects_helper['InitWithOptions']['return'] = test_error_code - self.side_effects_helper['InitWithOptions']['vi'] = SESSION_NUM_FOR_TEST - self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError - self.side_effects_helper['GetError']['errorCode'] = test_error_code - self.side_effects_helper['GetError']['description'] = test_error_desc + test_error_desc = "Test" + self.patched_library.niFake_InitWithOptions.side_effect = ( + self.side_effects_helper.niFake_InitWithOptions + ) + self.side_effects_helper["InitWithOptions"]["return"] = test_error_code + self.side_effects_helper["InitWithOptions"]["vi"] = SESSION_NUM_FOR_TEST + self.patched_library.niFake_GetError.side_effect = ( + self.side_effects_helper.niFake_GetError + ) + self.side_effects_helper["GetError"]["errorCode"] = test_error_code + self.side_effects_helper["GetError"]["description"] = test_error_desc try: - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: assert type(session) == nifake.Session assert False except nifake.Error as e: @@ -151,14 +217,18 @@ def test_session_context_manager_init_with_error(self): def test_session_context_manager_close_with_error(self): test_error_code = -1 - test_error_desc = 'Test' - self.patched_library.niFake_close.side_effect = self.side_effects_helper.niFake_close - self.side_effects_helper['close']['return'] = test_error_code - self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError - self.side_effects_helper['GetError']['errorCode'] = test_error_code - self.side_effects_helper['GetError']['description'] = test_error_desc + test_error_desc = "Test" + self.patched_library.niFake_close.side_effect = ( + self.side_effects_helper.niFake_close + ) + self.side_effects_helper["close"]["return"] = test_error_code + self.patched_library.niFake_GetError.side_effect = ( + self.side_effects_helper.niFake_GetError + ) + self.side_effects_helper["GetError"]["errorCode"] = test_error_code + self.side_effects_helper["GetError"]["description"] = test_error_desc try: - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: assert type(session) == nifake.Session assert False except nifake.Error as e: @@ -167,54 +237,74 @@ def test_session_context_manager_close_with_error(self): # Session locking def test_lock_session_none(self): - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: session.lock() - self.patched_library.niFake_LockSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None) + self.patched_library.niFake_LockSession.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None + ) def test_unlock_session_none(self): - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: session.unlock() - self.patched_library.niFake_UnlockSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None) + self.patched_library.niFake_UnlockSession.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None + ) def test_lock_context_manager(self): - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: with session.lock(): pass - self.patched_library.niFake_LockSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None) - self.patched_library.niFake_UnlockSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None) + self.patched_library.niFake_LockSession.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None + ) + self.patched_library.niFake_UnlockSession.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None + ) def test_lock_context_manager_abnormal_exit(self): - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: try: with session.lock(): - raise nifake.Error('Fake exception') + raise nifake.Error("Fake exception") except nifake.Error: pass - self.patched_library.niFake_LockSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None) - self.patched_library.niFake_UnlockSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None) + self.patched_library.niFake_LockSession.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None + ) + self.patched_library.niFake_UnlockSession.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None + ) # Methods def test_simple_function(self): - self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = self.side_effects_helper.niFake_PoorlyNamedSimpleFunction - with nifake.Session('dev1') as session: + self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = ( + self.side_effects_helper.niFake_PoorlyNamedSimpleFunction + ) + with nifake.Session("dev1") as session: session.simple_function() - self.patched_library.niFake_PoorlyNamedSimpleFunction.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) + self.patched_library.niFake_PoorlyNamedSimpleFunction.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) + ) def test_self_test(self): - self.patched_library.niFake_self_test.side_effect = self.side_effects_helper.niFake_self_test + self.patched_library.niFake_self_test.side_effect = ( + self.side_effects_helper.niFake_self_test + ) test_error_code = 0 - self.side_effects_helper['self_test']['selfTestResult'] = test_error_code - self.side_effects_helper['self_test']['selfTestMessage'] = '' - with nifake.Session('dev1') as session: + self.side_effects_helper["self_test"]["selfTestResult"] = test_error_code + self.side_effects_helper["self_test"]["selfTestMessage"] = "" + with nifake.Session("dev1") as session: session.self_test() def test_self_test_fail(self): - self.patched_library.niFake_self_test.side_effect = self.side_effects_helper.niFake_self_test + self.patched_library.niFake_self_test.side_effect = ( + self.side_effects_helper.niFake_self_test + ) test_error_code = 1 - test_error_message = 'error message' - self.side_effects_helper['self_test']['selfTestResult'] = test_error_code - self.side_effects_helper['self_test']['selfTestMessage'] = test_error_message - with nifake.Session('dev1') as session: + test_error_message = "error message" + self.side_effects_helper["self_test"]["selfTestResult"] = test_error_code + self.side_effects_helper["self_test"]["selfTestMessage"] = test_error_message + with nifake.Session("dev1") as session: try: session.self_test() assert False @@ -224,160 +314,279 @@ def test_self_test_fail(self): def test_get_a_number(self): test_number = 16 - self.patched_library.niFake_GetANumber.side_effect = self.side_effects_helper.niFake_GetANumber - self.side_effects_helper['GetANumber']['aNumber'] = test_number - with nifake.Session('dev1') as session: + self.patched_library.niFake_GetANumber.side_effect = ( + self.side_effects_helper.niFake_GetANumber + ) + self.side_effects_helper["GetANumber"]["aNumber"] = test_number + with nifake.Session("dev1") as session: test_result = session.get_a_number() assert isinstance(test_result, int) assert test_result == test_number - self.patched_library.niFake_GetANumber.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt16PointerMatcher()) + self.patched_library.niFake_GetANumber.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt16PointerMatcher(), + ) def test_one_input_function(self): test_number = 1 - self.patched_library.niFake_OneInputFunction.side_effect = self.side_effects_helper.niFake_OneInputFunction - with nifake.Session('dev1') as session: + self.patched_library.niFake_OneInputFunction.side_effect = ( + self.side_effects_helper.niFake_OneInputFunction + ) + with nifake.Session("dev1") as session: session.one_input_function(test_number) - self.patched_library.niFake_OneInputFunction.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(test_number)) + self.patched_library.niFake_OneInputFunction.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt32Matcher(test_number), + ) def test_vi_int_64_function(self): input_value = 1099511627776 # 2^40 output_value = 2199023255552 # 2^41 - self.patched_library.niFake_Use64BitNumber.side_effect = self.side_effects_helper.niFake_Use64BitNumber - self.side_effects_helper['Use64BitNumber']['output'] = output_value - with nifake.Session('dev1') as session: + self.patched_library.niFake_Use64BitNumber.side_effect = ( + self.side_effects_helper.niFake_Use64BitNumber + ) + self.side_effects_helper["Use64BitNumber"]["output"] = output_value + with nifake.Session("dev1") as session: assert session.use64_bit_number(input_value) == output_value - self.patched_library.niFake_Use64BitNumber.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt64Matcher(input_value), _matchers.ViInt64PointerMatcher()) + self.patched_library.niFake_Use64BitNumber.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt64Matcher(input_value), + _matchers.ViInt64PointerMatcher(), + ) def test_two_input_function(self): test_number = 1.5 - test_string = 'test' - self.patched_library.niFake_TwoInputFunction.side_effect = self.side_effects_helper.niFake_TwoInputFunction - with nifake.Session('dev1') as session: + test_string = "test" + self.patched_library.niFake_TwoInputFunction.side_effect = ( + self.side_effects_helper.niFake_TwoInputFunction + ) + with nifake.Session("dev1") as session: session.two_input_function(test_number, test_string) - self.patched_library.niFake_TwoInputFunction.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViReal64Matcher(test_number), _matchers.ViStringMatcher(test_string)) + self.patched_library.niFake_TwoInputFunction.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViReal64Matcher(test_number), + _matchers.ViStringMatcher(test_string), + ) def test_get_enum_value(self): test_number = 1 test_turtle = nifake.Turtle.LEONARDO - self.patched_library.niFake_GetEnumValue.side_effect = self.side_effects_helper.niFake_GetEnumValue - self.side_effects_helper['GetEnumValue']['aQuantity'] = test_number - self.side_effects_helper['GetEnumValue']['aTurtle'] = 0 - with nifake.Session('dev1') as session: + self.patched_library.niFake_GetEnumValue.side_effect = ( + self.side_effects_helper.niFake_GetEnumValue + ) + self.side_effects_helper["GetEnumValue"]["aQuantity"] = test_number + self.side_effects_helper["GetEnumValue"]["aTurtle"] = 0 + with nifake.Session("dev1") as session: test_result_number, test_result_enum = session.get_enum_value() assert isinstance(test_result_number, int) assert test_result_number == test_number assert isinstance(test_result_enum, nifake.Turtle) assert test_result_enum == test_turtle - self.patched_library.niFake_GetEnumValue.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32PointerMatcher(), _matchers.ViInt16PointerMatcher()) + self.patched_library.niFake_GetEnumValue.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt32PointerMatcher(), + _matchers.ViInt16PointerMatcher(), + ) def test_get_a_list_enums(self): - self.patched_library.niFake_EnumArrayOutputFunction.side_effect = self.side_effects_helper.niFake_EnumArrayOutputFunction + self.patched_library.niFake_EnumArrayOutputFunction.side_effect = ( + self.side_effects_helper.niFake_EnumArrayOutputFunction + ) test_list = [1, 1, 0] - self.side_effects_helper['EnumArrayOutputFunction']['anArray'] = test_list - with nifake.Session('dev1') as session: + self.side_effects_helper["EnumArrayOutputFunction"]["anArray"] = test_list + with nifake.Session("dev1") as session: test_result = session.enum_array_output_function(len(test_list)) assert len(test_list) == len(test_result) for expected_value, actual_value in zip(test_list, test_result): assert isinstance(actual_value, nifake.Turtle) assert actual_value.value == expected_value - self.patched_library.niFake_EnumArrayOutputFunction.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(test_list)), _matchers.ViInt16BufferMatcher(len(test_list))) + self.patched_library.niFake_EnumArrayOutputFunction.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt32Matcher(len(test_list)), + _matchers.ViInt16BufferMatcher(len(test_list)), + ) def test_get_a_boolean(self): - self.patched_library.niFake_GetABoolean.side_effect = self.side_effects_helper.niFake_GetABoolean - self.side_effects_helper['GetABoolean']['aBoolean'] = 1 - with nifake.Session('dev1') as session: + self.patched_library.niFake_GetABoolean.side_effect = ( + self.side_effects_helper.niFake_GetABoolean + ) + self.side_effects_helper["GetABoolean"]["aBoolean"] = 1 + with nifake.Session("dev1") as session: test_result = session.get_a_boolean() assert isinstance(test_result, bool) assert test_result - self.patched_library.niFake_GetABoolean.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViBooleanPointerMatcher()) + self.patched_library.niFake_GetABoolean.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViBooleanPointerMatcher(), + ) def test_get_a_list_booleans(self): - self.patched_library.niFake_BoolArrayOutputFunction.side_effect = self.side_effects_helper.niFake_BoolArrayOutputFunction + self.patched_library.niFake_BoolArrayOutputFunction.side_effect = ( + self.side_effects_helper.niFake_BoolArrayOutputFunction + ) test_list = [1, 1, 0] - self.side_effects_helper['BoolArrayOutputFunction']['anArray'] = test_list - with nifake.Session('dev1') as session: + self.side_effects_helper["BoolArrayOutputFunction"]["anArray"] = test_list + with nifake.Session("dev1") as session: test_result = session.bool_array_output_function(len(test_list)) assert len(test_list) == len(test_result) for expected_value, actual_value in zip(test_list, test_result): assert isinstance(actual_value, bool) assert actual_value == bool(expected_value) - self.patched_library.niFake_BoolArrayOutputFunction.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(test_list)), _matchers.ViBooleanBufferMatcher(len(test_list))) + self.patched_library.niFake_BoolArrayOutputFunction.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt32Matcher(len(test_list)), + _matchers.ViBooleanBufferMatcher(len(test_list)), + ) def test_acquisition_context_manager(self): - self.patched_library.niFake_Initiate.side_effect = self.side_effects_helper.niFake_Initiate - self.patched_library.niFake_Abort.side_effect = self.side_effects_helper.niFake_Abort - with nifake.Session('dev1') as session: + self.patched_library.niFake_Initiate.side_effect = ( + self.side_effects_helper.niFake_Initiate + ) + self.patched_library.niFake_Abort.side_effect = ( + self.side_effects_helper.niFake_Abort + ) + with nifake.Session("dev1") as session: with session.initiate(): - self.patched_library.niFake_Initiate.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) - self.patched_library.niFake_Abort.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) - self.patched_library.niFake_close.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) + self.patched_library.niFake_Initiate.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) + ) + self.patched_library.niFake_Abort.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) + ) + self.patched_library.niFake_close.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) + ) def test_acquisition_no_context_manager(self): - self.patched_library.niFake_Initiate.side_effect = self.side_effects_helper.niFake_Initiate - self.patched_library.niFake_Abort.side_effect = self.side_effects_helper.niFake_Abort - with nifake.Session('dev1') as session: + self.patched_library.niFake_Initiate.side_effect = ( + self.side_effects_helper.niFake_Initiate + ) + self.patched_library.niFake_Abort.side_effect = ( + self.side_effects_helper.niFake_Abort + ) + with nifake.Session("dev1") as session: session.initiate() - self.patched_library.niFake_Initiate.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) + self.patched_library.niFake_Initiate.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) + ) session.abort() - self.patched_library.niFake_Abort.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) - self.patched_library.niFake_close.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) + self.patched_library.niFake_Abort.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) + ) + self.patched_library.niFake_close.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) + ) def test_single_point_read_timedelta(self): - test_maximum_time_ns = 1 # nanoseconds + test_maximum_time_ns = 1 # nanoseconds test_maximum_time_s = 1e-9 # seconds - test_maximum_time_timedelta = hightime.timedelta(nanoseconds=test_maximum_time_ns) + test_maximum_time_timedelta = hightime.timedelta( + nanoseconds=test_maximum_time_ns + ) test_reading = 5 - self.patched_library.niFake_Read.side_effect = self.side_effects_helper.niFake_Read - self.side_effects_helper['Read']['reading'] = test_reading - with nifake.Session('dev1') as session: + self.patched_library.niFake_Read.side_effect = ( + self.side_effects_helper.niFake_Read + ) + self.side_effects_helper["Read"]["reading"] = test_reading + with nifake.Session("dev1") as session: assert test_reading == session.read(test_maximum_time_timedelta) - self.patched_library.niFake_Read.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViReal64Matcher(test_maximum_time_s), _matchers.ViReal64PointerMatcher()) + self.patched_library.niFake_Read.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViReal64Matcher(test_maximum_time_s), + _matchers.ViReal64PointerMatcher(), + ) def test_single_point_read_nan(self): test_maximum_time_s = 10.0 test_maximum_time = hightime.timedelta(seconds=test_maximum_time_s) - test_reading = float('NaN') - self.patched_library.niFake_Read.side_effect = self.side_effects_helper.niFake_Read - self.side_effects_helper['Read']['reading'] = test_reading - with nifake.Session('dev1') as session: + test_reading = float("NaN") + self.patched_library.niFake_Read.side_effect = ( + self.side_effects_helper.niFake_Read + ) + self.side_effects_helper["Read"]["reading"] = test_reading + with nifake.Session("dev1") as session: assert math.isnan(session.read(test_maximum_time)) def test_enum_input_function_with_defaults(self): test_turtle = nifake.Turtle.DONATELLO - self.patched_library.niFake_EnumInputFunctionWithDefaults.side_effect = self.side_effects_helper.niFake_EnumInputFunctionWithDefaults - with nifake.Session('dev1') as session: + self.patched_library.niFake_EnumInputFunctionWithDefaults.side_effect = ( + self.side_effects_helper.niFake_EnumInputFunctionWithDefaults + ) + with nifake.Session("dev1") as session: session.enum_input_function_with_defaults() session.enum_input_function_with_defaults(test_turtle) from unittest.mock import call - calls = [call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt16Matcher(0)), call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt16Matcher(1))] # 0 is the value of the default of nifake.Turtle.LEONARDO, 1 is the value of nifake.Turtle.DONATELLO - self.patched_library.niFake_EnumInputFunctionWithDefaults.assert_has_calls(calls) + + calls = [ + call( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt16Matcher(0), + ), + call( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt16Matcher(1), + ), + ] # 0 is the value of the default of nifake.Turtle.LEONARDO, 1 is the value of nifake.Turtle.DONATELLO + self.patched_library.niFake_EnumInputFunctionWithDefaults.assert_has_calls( + calls + ) def test_string_valued_enum_input_function_with_defaults(self): test_mobile_os_name = nifake.MobileOSNames.IOS - self.patched_library.niFake_StringValuedEnumInputFunctionWithDefaults.side_effect = self.side_effects_helper.niFake_StringValuedEnumInputFunctionWithDefaults - with nifake.Session('dev1') as session: + self.patched_library.niFake_StringValuedEnumInputFunctionWithDefaults.side_effect = ( + self.side_effects_helper.niFake_StringValuedEnumInputFunctionWithDefaults + ) + with nifake.Session("dev1") as session: session.string_valued_enum_input_function_with_defaults() session.string_valued_enum_input_function_with_defaults(test_mobile_os_name) from unittest.mock import call - calls = [call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher('Android')), call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher('iOS'))] # 'ANDROID' is the value of the default of nifake.MobileOSNames.Android, 'iOS' is the value of nifake.MobileOSNames.IOS - self.patched_library.niFake_StringValuedEnumInputFunctionWithDefaults.assert_has_calls(calls) + + calls = [ + call( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher("Android"), + ), + call( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher("iOS"), + ), + ] # 'ANDROID' is the value of the default of nifake.MobileOSNames.Android, 'iOS' is the value of nifake.MobileOSNames.IOS + self.patched_library.niFake_StringValuedEnumInputFunctionWithDefaults.assert_has_calls( + calls + ) def test_fetch_waveform(self): - expected_waveform_list = [1.0, 0.1, 42, .42] - self.patched_library.niFake_FetchWaveform.side_effect = self.side_effects_helper.niFake_FetchWaveform - self.side_effects_helper['FetchWaveform']['waveformData'] = expected_waveform_list - self.side_effects_helper['FetchWaveform']['actualNumberOfSamples'] = len(expected_waveform_list) + expected_waveform_list = [1.0, 0.1, 42, 0.42] + self.patched_library.niFake_FetchWaveform.side_effect = ( + self.side_effects_helper.niFake_FetchWaveform + ) + self.side_effects_helper["FetchWaveform"][ + "waveformData" + ] = expected_waveform_list + self.side_effects_helper["FetchWaveform"]["actualNumberOfSamples"] = len( + expected_waveform_list + ) # Because we are mocking get_ctypes_pointer_for_buffer() we don't end up using the array allocated in the function call. Instead, we will allocate the arrays here # and have the mock return them. These are the ones that are actually filled in by the function. - expected_waveform = array.array('d', [0] * len(expected_waveform_list)) - expected_waveform_ctypes = ctypes.cast(expected_waveform.buffer_info()[0], ctypes.POINTER(nifake._visatype.ViReal64 * len(expected_waveform_list))) - - with nifake.Session('dev1') as session: - self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_waveform_ctypes] + expected_waveform = array.array("d", [0] * len(expected_waveform_list)) + expected_waveform_ctypes = ctypes.cast( + expected_waveform.buffer_info()[0], + ctypes.POINTER(nifake._visatype.ViReal64 * len(expected_waveform_list)), + ) + + with nifake.Session("dev1") as session: + self.get_ctypes_pointer_for_buffer_side_effect_items = [ + expected_waveform_ctypes + ] self.get_ctypes_pointer_for_buffer_side_effect_count = 0 - self.patched_library.niFake_WriteWaveform.side_effect = self.side_effects_helper.niFake_WriteWaveform - with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect): + self.patched_library.niFake_WriteWaveform.side_effect = ( + self.side_effects_helper.niFake_WriteWaveform + ) + with patch( + "nifake.session.get_ctypes_pointer_for_buffer", + side_effect=self.get_ctypes_pointer_for_buffer_side_effect, + ): # Because we have mocked away get_ctypes_pointer_for_buffer(), we ignore the return values here and look at our already allocated arrays to make # sure they are filled in correctly session.fetch_waveform(len(expected_waveform_list)) @@ -385,22 +594,36 @@ def test_fetch_waveform(self): assert len(expected_waveform) == len(expected_waveform_list) for i in range(len(expected_waveform)): assert expected_waveform[i] == expected_waveform_list[i] - self.patched_library.niFake_FetchWaveform.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(expected_waveform)), _matchers.ViReal64BufferMatcher(expected_waveform), _matchers.ViInt32PointerMatcher()) + self.patched_library.niFake_FetchWaveform.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt32Matcher(len(expected_waveform)), + _matchers.ViReal64BufferMatcher(expected_waveform), + _matchers.ViInt32PointerMatcher(), + ) def test_fetch_waveform_into(self): - expected_waveform = [1.0, 0.1, 42, .42] - self.patched_library.niFake_FetchWaveform.side_effect = self.side_effects_helper.niFake_FetchWaveform - self.side_effects_helper['FetchWaveform']['waveformData'] = expected_waveform - self.side_effects_helper['FetchWaveform']['actualNumberOfSamples'] = len(expected_waveform) - with nifake.Session('dev1') as session: + expected_waveform = [1.0, 0.1, 42, 0.42] + self.patched_library.niFake_FetchWaveform.side_effect = ( + self.side_effects_helper.niFake_FetchWaveform + ) + self.side_effects_helper["FetchWaveform"]["waveformData"] = expected_waveform + self.side_effects_helper["FetchWaveform"]["actualNumberOfSamples"] = len( + expected_waveform + ) + with nifake.Session("dev1") as session: waveform = numpy.empty(len(expected_waveform), numpy.float64) session.fetch_waveform_into(waveform) assert numpy.array_equal(waveform, expected_waveform) - self.patched_library.niFake_FetchWaveform.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(expected_waveform)), _matchers.ViReal64BufferMatcher(expected_waveform), _matchers.ViInt32PointerMatcher()) + self.patched_library.niFake_FetchWaveform.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt32Matcher(len(expected_waveform)), + _matchers.ViReal64BufferMatcher(expected_waveform), + _matchers.ViInt32PointerMatcher(), + ) def test_fetch_waveform_into_wrong_type(self): length = 10 - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: waveforms = [ 10, 10.5, @@ -408,7 +631,7 @@ def test_fetch_waveform_into_wrong_type(self): range(length), [i + 0.0 for i in range(length)], numpy.empty(length, numpy.int32), - numpy.empty(length, numpy.uint8) + numpy.empty(length, numpy.uint8), ] for w in waveforms: try: @@ -419,24 +642,41 @@ def test_fetch_waveform_into_wrong_type(self): def test_write_waveform(self): expected_waveform = [1.1, 2.2, 3.3, 4.4] - expected_array = array.array('d', expected_waveform) - with nifake.Session('dev1') as session: + expected_array = array.array("d", expected_waveform) + with nifake.Session("dev1") as session: self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_waveform] self.get_ctypes_pointer_for_buffer_side_effect_count = 0 - self.patched_library.niFake_WriteWaveform.side_effect = self.side_effects_helper.niFake_WriteWaveform - with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect): + self.patched_library.niFake_WriteWaveform.side_effect = ( + self.side_effects_helper.niFake_WriteWaveform + ) + with patch( + "nifake.session.get_ctypes_pointer_for_buffer", + side_effect=self.get_ctypes_pointer_for_buffer_side_effect, + ): session.write_waveform(expected_array) - self.patched_library.niFake_WriteWaveform.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(expected_waveform)), _matchers.ViReal64BufferMatcher(expected_array)) + self.patched_library.niFake_WriteWaveform.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt32Matcher(len(expected_waveform)), + _matchers.ViReal64BufferMatcher(expected_array), + ) def test_write_waveform_numpy(self): - expected_waveform = numpy.array([1.1, 2.2, 3.3, 4.4], order='C') - self.patched_library.niFake_WriteWaveform.side_effect = self.side_effects_helper.niFake_WriteWaveform - with nifake.Session('dev1') as session: + expected_waveform = numpy.array([1.1, 2.2, 3.3, 4.4], order="C") + self.patched_library.niFake_WriteWaveform.side_effect = ( + self.side_effects_helper.niFake_WriteWaveform + ) + with nifake.Session("dev1") as session: session.write_waveform_numpy(expected_waveform) - self.patched_library.niFake_WriteWaveform.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(expected_waveform)), _matchers.ViReal64BufferMatcher(expected_waveform)) + self.patched_library.niFake_WriteWaveform.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt32Matcher(len(expected_waveform)), + _matchers.ViReal64BufferMatcher(expected_waveform), + ) def test_return_multiple_types(self): - self.patched_library.niFake_ReturnMultipleTypes.side_effect = self.side_effects_helper.niFake_ReturnMultipleTypes + self.patched_library.niFake_ReturnMultipleTypes.side_effect = ( + self.side_effects_helper.niFake_ReturnMultipleTypes + ) boolean_val = True int32_val = 32 int64_val = 6000000000 @@ -445,19 +685,30 @@ def test_return_multiple_types(self): float_enum_val = nifake.FloatEnum.SIX_POINT_FIVE array_val = [0, 1, 2] array_size = len(array_val) - string_val = 'Testing is fun?' - self.side_effects_helper['ReturnMultipleTypes']['return'] = len(string_val) - self.side_effects_helper['ReturnMultipleTypes']['aBoolean'] = boolean_val - self.side_effects_helper['ReturnMultipleTypes']['anInt32'] = int32_val - self.side_effects_helper['ReturnMultipleTypes']['anInt64'] = int64_val - self.side_effects_helper['ReturnMultipleTypes']['anIntEnum'] = enum_val.value - self.side_effects_helper['ReturnMultipleTypes']['aFloat'] = float_val - self.side_effects_helper['ReturnMultipleTypes']['aFloatEnum'] = float_enum_val.value - self.side_effects_helper['ReturnMultipleTypes']['anArray'] = array_val - self.side_effects_helper['ReturnMultipleTypes']['aString'] = string_val - self.side_effects_helper['ReturnMultipleTypes']['return'] = 0 - with nifake.Session('dev1') as session: - result_boolean, result_int32, result_int64, result_enum, result_float, result_float_enum, result_array, result_string = session.return_multiple_types(array_size) + string_val = "Testing is fun?" + self.side_effects_helper["ReturnMultipleTypes"]["return"] = len(string_val) + self.side_effects_helper["ReturnMultipleTypes"]["aBoolean"] = boolean_val + self.side_effects_helper["ReturnMultipleTypes"]["anInt32"] = int32_val + self.side_effects_helper["ReturnMultipleTypes"]["anInt64"] = int64_val + self.side_effects_helper["ReturnMultipleTypes"]["anIntEnum"] = enum_val.value + self.side_effects_helper["ReturnMultipleTypes"]["aFloat"] = float_val + self.side_effects_helper["ReturnMultipleTypes"][ + "aFloatEnum" + ] = float_enum_val.value + self.side_effects_helper["ReturnMultipleTypes"]["anArray"] = array_val + self.side_effects_helper["ReturnMultipleTypes"]["aString"] = string_val + self.side_effects_helper["ReturnMultipleTypes"]["return"] = 0 + with nifake.Session("dev1") as session: + ( + result_boolean, + result_int32, + result_int64, + result_enum, + result_float, + result_float_enum, + result_array, + result_string, + ) = session.return_multiple_types(array_size) assert result_boolean == boolean_val assert isinstance(result_boolean, bool) assert result_int32 == int32_val @@ -478,58 +729,85 @@ def test_return_multiple_types(self): assert self.patched_library.niFake_ReturnMultipleTypes.call_count == 2 def test_multiple_array_types(self): - self.patched_library.niFake_MultipleArrayTypes.side_effect = self.side_effects_helper.niFake_MultipleArrayTypes + self.patched_library.niFake_MultipleArrayTypes.side_effect = ( + self.side_effects_helper.niFake_MultipleArrayTypes + ) expected_output_array = [0.2, 0.4] expected_output_array_of_fixed_length = [-6, -7, -8] output_array_size = len(expected_output_array) input_array_of_integers = [1, 2] input_array_of_floats = [-1.0, -2.0] - self.side_effects_helper['MultipleArrayTypes']['outputArray'] = expected_output_array - self.side_effects_helper['MultipleArrayTypes']['outputArrayOfFixedLength'] = expected_output_array_of_fixed_length - with nifake.Session('dev1') as session: - output_array, output_array_of_fixed_length = session.multiple_array_types(output_array_size, input_array_of_floats, input_array_of_integers) + self.side_effects_helper["MultipleArrayTypes"][ + "outputArray" + ] = expected_output_array + self.side_effects_helper["MultipleArrayTypes"][ + "outputArrayOfFixedLength" + ] = expected_output_array_of_fixed_length + with nifake.Session("dev1") as session: + output_array, output_array_of_fixed_length = session.multiple_array_types( + output_array_size, input_array_of_floats, input_array_of_integers + ) assert output_array == output_array assert expected_output_array_of_fixed_length == output_array_of_fixed_length self.patched_library.niFake_MultipleArrayTypes.assert_called_once_with( _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(output_array_size), _matchers.ViReal64BufferMatcher(output_array_size), - _matchers.ViReal64BufferMatcher(len(expected_output_array_of_fixed_length)), + _matchers.ViReal64BufferMatcher( + len(expected_output_array_of_fixed_length) + ), _matchers.ViInt32Matcher(len(input_array_of_integers)), _matchers.ViReal64BufferMatcher(input_array_of_floats), _matchers.ViInt16BufferMatcher(input_array_of_integers), ) def test_multiple_array_types_none_input(self): - self.patched_library.niFake_MultipleArrayTypes.side_effect = self.side_effects_helper.niFake_MultipleArrayTypes + self.patched_library.niFake_MultipleArrayTypes.side_effect = ( + self.side_effects_helper.niFake_MultipleArrayTypes + ) expected_output_array = [0.2, 0.4] expected_output_array_of_fixed_length = [-6, -7, -8] output_array_size = len(expected_output_array) input_array_of_floats = [0.1, 0.2] - self.side_effects_helper['MultipleArrayTypes']['outputArray'] = expected_output_array - self.side_effects_helper['MultipleArrayTypes']['outputArrayOfFixedLength'] = expected_output_array_of_fixed_length - with nifake.Session('dev1') as session: - output_array, output_array_of_fixed_length = session.multiple_array_types(output_array_size, input_array_of_floats) + self.side_effects_helper["MultipleArrayTypes"][ + "outputArray" + ] = expected_output_array + self.side_effects_helper["MultipleArrayTypes"][ + "outputArrayOfFixedLength" + ] = expected_output_array_of_fixed_length + with nifake.Session("dev1") as session: + output_array, output_array_of_fixed_length = session.multiple_array_types( + output_array_size, input_array_of_floats + ) assert output_array == output_array assert expected_output_array_of_fixed_length == output_array_of_fixed_length self.patched_library.niFake_MultipleArrayTypes.assert_called_once_with( _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(output_array_size), _matchers.ViReal64BufferMatcher(output_array_size), - _matchers.ViReal64BufferMatcher(len(expected_output_array_of_fixed_length)), + _matchers.ViReal64BufferMatcher( + len(expected_output_array_of_fixed_length) + ), _matchers.ViInt32Matcher(len(input_array_of_floats)), _matchers.ViReal64BufferMatcher(input_array_of_floats), - None + None, ) def test_multiple_arrays_same_size(self): - self.patched_library.niFake_MultipleArraysSameSize.side_effect = self.side_effects_helper.niFake_MultipleArraysSameSize + self.patched_library.niFake_MultipleArraysSameSize.side_effect = ( + self.side_effects_helper.niFake_MultipleArraysSameSize + ) input_array_of_floats1 = [0.041, 0.042, 0.043, 0.044] input_array_of_floats2 = [0.410, 0.420, 0.430, 0.440] input_array_of_floats3 = [4.100, 4.200, 4.300, 4.400] input_array_of_floats4 = [41.00, 42.00, 43.00, 44.00] - with nifake.Session('dev1') as session: - session.multiple_arrays_same_size(input_array_of_floats1, input_array_of_floats2, input_array_of_floats3, input_array_of_floats4) + with nifake.Session("dev1") as session: + session.multiple_arrays_same_size( + input_array_of_floats1, + input_array_of_floats2, + input_array_of_floats3, + input_array_of_floats4, + ) self.patched_library.niFake_MultipleArraysSameSize.assert_called_once_with( _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViReal64BufferMatcher(input_array_of_floats1), @@ -540,9 +818,11 @@ def test_multiple_arrays_same_size(self): ) def test_multiple_arrays_same_size_none_input(self): - self.patched_library.niFake_MultipleArraysSameSize.side_effect = self.side_effects_helper.niFake_MultipleArraysSameSize + self.patched_library.niFake_MultipleArraysSameSize.side_effect = ( + self.side_effects_helper.niFake_MultipleArraysSameSize + ) input_array_of_floats1 = [0.041, 0.042, 0.043, 0.044] - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: session.multiple_arrays_same_size(input_array_of_floats1, None, None, None) self.patched_library.niFake_MultipleArraysSameSize.assert_called_once_with( _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), @@ -554,85 +834,154 @@ def test_multiple_arrays_same_size_none_input(self): ) def test_multiple_arrays_same_size_wrong_size_2(self): - self.patched_library.niFake_MultipleArraysSameSize.side_effect = self.side_effects_helper.niFake_MultipleArraysSameSize + self.patched_library.niFake_MultipleArraysSameSize.side_effect = ( + self.side_effects_helper.niFake_MultipleArraysSameSize + ) input_array_of_floats1 = [0.041, 0.042, 0.043, 0.044] input_array_of_floats2 = [0.410, 0.420, 0.430] input_array_of_floats3 = [4.100, 4.200, 4.300, 4.400] input_array_of_floats4 = [41.00, 42.00, 43.00, 44.00] - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: try: - session.multiple_arrays_same_size(input_array_of_floats1, input_array_of_floats2, input_array_of_floats3, input_array_of_floats4) + session.multiple_arrays_same_size( + input_array_of_floats1, + input_array_of_floats2, + input_array_of_floats3, + input_array_of_floats4, + ) assert False except ValueError: pass def test_multiple_arrays_same_size_wrong_size_3(self): - self.patched_library.niFake_MultipleArraysSameSize.side_effect = self.side_effects_helper.niFake_MultipleArraysSameSize + self.patched_library.niFake_MultipleArraysSameSize.side_effect = ( + self.side_effects_helper.niFake_MultipleArraysSameSize + ) input_array_of_floats1 = [0.041, 0.042, 0.043, 0.044] input_array_of_floats2 = [0.410, 0.420, 0.430, 0.440] input_array_of_floats3 = [4.100, 4.200, 4.400] input_array_of_floats4 = [41.00, 42.00, 43.00, 44.00] - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: try: - session.multiple_arrays_same_size(input_array_of_floats1, input_array_of_floats2, input_array_of_floats3, input_array_of_floats4) + session.multiple_arrays_same_size( + input_array_of_floats1, + input_array_of_floats2, + input_array_of_floats3, + input_array_of_floats4, + ) assert False except ValueError: pass def test_multiple_arrays_same_size_wrong_size_4(self): - self.patched_library.niFake_MultipleArraysSameSize.side_effect = self.side_effects_helper.niFake_MultipleArraysSameSize + self.patched_library.niFake_MultipleArraysSameSize.side_effect = ( + self.side_effects_helper.niFake_MultipleArraysSameSize + ) input_array_of_floats1 = [0.041, 0.042, 0.043, 0.044] input_array_of_floats2 = [0.410, 0.420, 0.430, 0.440] input_array_of_floats3 = [4.100, 4.200, 4.300, 4.400] input_array_of_floats4 = [41.00, 42.00, 43.00, 44.00, 45.00] - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: try: - session.multiple_arrays_same_size(input_array_of_floats1, input_array_of_floats2, input_array_of_floats3, input_array_of_floats4) + session.multiple_arrays_same_size( + input_array_of_floats1, + input_array_of_floats2, + input_array_of_floats3, + input_array_of_floats4, + ) assert False except ValueError: pass def test_parameters_are_multiple_types(self): - self.patched_library.niFake_ParametersAreMultipleTypes.side_effect = self.side_effects_helper.niFake_ParametersAreMultipleTypes + self.patched_library.niFake_ParametersAreMultipleTypes.side_effect = ( + self.side_effects_helper.niFake_ParametersAreMultipleTypes + ) boolean_val = True int32_val = 32 int64_val = 6000000000 enum_val = nifake.Turtle.LEONARDO float_val = 1.23 float_enum_val = nifake.FloatEnum.SIX_POINT_FIVE - string_val = 'Testing is fun?' - with nifake.Session('dev1') as session: - session.parameters_are_multiple_types(boolean_val, int32_val, int64_val, enum_val, float_val, float_enum_val, string_val) - self.patched_library.niFake_ParametersAreMultipleTypes.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViBooleanMatcher(boolean_val), _matchers.ViInt32Matcher(int32_val), _matchers.ViInt64Matcher(int64_val), _matchers.ViInt16Matcher(enum_val.value), _matchers.ViReal64Matcher(float_val), _matchers.ViReal64Matcher(float_enum_val.value), _matchers.ViInt32Matcher(len(string_val)), _matchers.ViStringMatcher(string_val)) + string_val = "Testing is fun?" + with nifake.Session("dev1") as session: + session.parameters_are_multiple_types( + boolean_val, + int32_val, + int64_val, + enum_val, + float_val, + float_enum_val, + string_val, + ) + self.patched_library.niFake_ParametersAreMultipleTypes.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViBooleanMatcher(boolean_val), + _matchers.ViInt32Matcher(int32_val), + _matchers.ViInt64Matcher(int64_val), + _matchers.ViInt16Matcher(enum_val.value), + _matchers.ViReal64Matcher(float_val), + _matchers.ViReal64Matcher(float_enum_val.value), + _matchers.ViInt32Matcher(len(string_val)), + _matchers.ViStringMatcher(string_val), + ) def test_parameters_are_multiple_types_error(self): test_error_code = -42 test_error_desc = "The answer to the ultimate question" - self.patched_library.niFake_ParametersAreMultipleTypes.side_effect = self.side_effects_helper.niFake_ParametersAreMultipleTypes - self.side_effects_helper['ParametersAreMultipleTypes']['return'] = test_error_code - self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError - self.side_effects_helper['GetError']['errorCode'] = test_error_code - self.side_effects_helper['GetError']['description'] = test_error_desc - self.patched_library.niFake_ParametersAreMultipleTypes.side_effect = self.side_effects_helper.niFake_ParametersAreMultipleTypes - self.side_effects_helper['ParametersAreMultipleTypes']['return'] = test_error_code - self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError - self.side_effects_helper['GetError']['errorCode'] = test_error_code - self.side_effects_helper['GetError']['description'] = test_error_desc + self.patched_library.niFake_ParametersAreMultipleTypes.side_effect = ( + self.side_effects_helper.niFake_ParametersAreMultipleTypes + ) + self.side_effects_helper["ParametersAreMultipleTypes"][ + "return" + ] = test_error_code + self.patched_library.niFake_GetError.side_effect = ( + self.side_effects_helper.niFake_GetError + ) + self.side_effects_helper["GetError"]["errorCode"] = test_error_code + self.side_effects_helper["GetError"]["description"] = test_error_desc + self.patched_library.niFake_ParametersAreMultipleTypes.side_effect = ( + self.side_effects_helper.niFake_ParametersAreMultipleTypes + ) + self.side_effects_helper["ParametersAreMultipleTypes"][ + "return" + ] = test_error_code + self.patched_library.niFake_GetError.side_effect = ( + self.side_effects_helper.niFake_GetError + ) + self.side_effects_helper["GetError"]["errorCode"] = test_error_code + self.side_effects_helper["GetError"]["description"] = test_error_desc boolean_val = True int32_val = 32 int64_val = 6000000000 enum_val = nifake.Turtle.LEONARDO float_val = 1.23 float_enum_val = nifake.FloatEnum.SIX_POINT_FIVE - string_val = 'Testing is fun?' - with nifake.Session('dev1') as session: + string_val = "Testing is fun?" + with nifake.Session("dev1") as session: try: - session.parameters_are_multiple_types(boolean_val, int32_val, int64_val, 123, float_val, float_enum_val, string_val) + session.parameters_are_multiple_types( + boolean_val, + int32_val, + int64_val, + 123, + float_val, + float_enum_val, + string_val, + ) assert False except TypeError: pass try: - session.parameters_are_multiple_types(boolean_val, int32_val, int64_val, enum_val, float_val, 0.123, string_val) + session.parameters_are_multiple_types( + boolean_val, + int32_val, + int64_val, + enum_val, + float_val, + 0.123, + string_val, + ) assert False except TypeError: pass @@ -640,12 +989,18 @@ def test_parameters_are_multiple_types_error(self): def test_method_with_error(self): test_error_code = -42 test_error_desc = "The answer to the ultimate question" - self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = self.side_effects_helper.niFake_PoorlyNamedSimpleFunction - self.side_effects_helper['PoorlyNamedSimpleFunction']['return'] = test_error_code - self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError - self.side_effects_helper['GetError']['errorCode'] = test_error_code - self.side_effects_helper['GetError']['description'] = test_error_desc - with nifake.Session('dev1') as session: + self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = ( + self.side_effects_helper.niFake_PoorlyNamedSimpleFunction + ) + self.side_effects_helper["PoorlyNamedSimpleFunction"][ + "return" + ] = test_error_code + self.patched_library.niFake_GetError.side_effect = ( + self.side_effects_helper.niFake_GetError + ) + self.side_effects_helper["GetError"]["errorCode"] = test_error_code + self.side_effects_helper["GetError"]["description"] = test_error_desc + with nifake.Session("dev1") as session: try: session.simple_function() assert False @@ -656,21 +1011,25 @@ def test_method_with_error(self): def test_error_with_rep_cap(self): test_error_code = -42 test_error_desc = "The answer to the ultimate question" - self.patched_library.niFake_SetAttributeViReal64.side_effect = self.side_effects_helper.niFake_SetAttributeViReal64 - self.side_effects_helper['SetAttributeViReal64']['return'] = test_error_code - self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError - self.side_effects_helper['GetError']['errorCode'] = test_error_code - self.side_effects_helper['GetError']['description'] = test_error_desc - with nifake.Session('dev1') as session: + self.patched_library.niFake_SetAttributeViReal64.side_effect = ( + self.side_effects_helper.niFake_SetAttributeViReal64 + ) + self.side_effects_helper["SetAttributeViReal64"]["return"] = test_error_code + self.patched_library.niFake_GetError.side_effect = ( + self.side_effects_helper.niFake_GetError + ) + self.side_effects_helper["GetError"]["errorCode"] = test_error_code + self.side_effects_helper["GetError"]["description"] = test_error_desc + with nifake.Session("dev1") as session: try: - session.channels['100'].read_write_double = 5.0 + session.channels["100"].read_write_double = 5.0 assert False except nifake.Error as e: assert e.code == test_error_code assert e.description == test_error_desc def test_call_not_enough_parameters_error(self): - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: try: session.multiple_array_types(10) assert False @@ -678,17 +1037,19 @@ def test_call_not_enough_parameters_error(self): pass def test_invalid_method_call_wrong_type_error(self): - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: try: - session.multiple_array_types('potato', [0.0, 0.1, 0.2]) + session.multiple_array_types("potato", [0.0, 0.1, 0.2]) assert False except TypeError: pass def test_enum_input_function_with_defaults_bad_type_error(self): test_turtle = 123 - self.patched_library.niFake_EnumInputFunctionWithDefaults.side_effect = self.side_effects_helper.niFake_EnumInputFunctionWithDefaults - with nifake.Session('dev1') as session: + self.patched_library.niFake_EnumInputFunctionWithDefaults.side_effect = ( + self.side_effects_helper.niFake_EnumInputFunctionWithDefaults + ) + with nifake.Session("dev1") as session: try: session.enum_input_function_with_defaults(test_turtle) assert False @@ -701,12 +1062,18 @@ def test_method_with_warning(self): test_error_code = 42 test_error_desc = "The answer to the ultimate question, only positive" - self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = self.side_effects_helper.niFake_PoorlyNamedSimpleFunction - self.side_effects_helper['PoorlyNamedSimpleFunction']['return'] = test_error_code - self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError - self.side_effects_helper['GetError']['errorCode'] = test_error_code - self.side_effects_helper['GetError']['description'] = test_error_desc - with nifake.Session('dev1') as session: + self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = ( + self.side_effects_helper.niFake_PoorlyNamedSimpleFunction + ) + self.side_effects_helper["PoorlyNamedSimpleFunction"][ + "return" + ] = test_error_code + self.patched_library.niFake_GetError.side_effect = ( + self.side_effects_helper.niFake_GetError + ) + self.side_effects_helper["GetError"]["errorCode"] = test_error_code + self.side_effects_helper["GetError"]["description"] = test_error_desc + with nifake.Session("dev1") as session: with warnings.catch_warnings(record=True) as w: session.simple_function() assert len(w) == 1 @@ -719,16 +1086,18 @@ def test_read_with_warning(self): test_maximum_time_s = 10.0 test_maximum_time = hightime.timedelta(seconds=test_maximum_time_s) - test_reading = float('nan') + test_reading = float("nan") test_error_code = 42 test_error_desc = "The answer to the ultimate question, only positive" self.patched_library.niFake_Read.side_effect = self.niFake_read_warning self.error_code_return = test_error_code self.reading = test_reading - self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError - self.side_effects_helper['GetError']['errorCode'] = test_error_code - self.side_effects_helper['GetError']['description'] = test_error_desc - with nifake.Session('dev1') as session: + self.patched_library.niFake_GetError.side_effect = ( + self.side_effects_helper.niFake_GetError + ) + self.side_effects_helper["GetError"]["errorCode"] = test_error_code + self.side_effects_helper["GetError"]["description"] = test_error_desc + with nifake.Session("dev1") as session: with warnings.catch_warnings(record=True) as w: assert math.isnan(session.read(test_maximum_time)) assert len(w) == 1 @@ -738,60 +1107,103 @@ def test_read_with_warning(self): # Retrieving buffers and strings def test_get_a_string_of_fixed_maximum_size(self): - test_string = "A string no larger than the max size of 256 allowed by the function." - self.patched_library.niFake_GetAStringOfFixedMaximumSize.side_effect = self.side_effects_helper.niFake_GetAStringOfFixedMaximumSize - self.side_effects_helper['GetAStringOfFixedMaximumSize']['aString'] = test_string - with nifake.Session('dev1') as session: + test_string = ( + "A string no larger than the max size of 256 allowed by the function." + ) + self.patched_library.niFake_GetAStringOfFixedMaximumSize.side_effect = ( + self.side_effects_helper.niFake_GetAStringOfFixedMaximumSize + ) + self.side_effects_helper["GetAStringOfFixedMaximumSize"][ + "aString" + ] = test_string + with nifake.Session("dev1") as session: returned_string = session.get_a_string_of_fixed_maximum_size() assert returned_string == test_string - self.patched_library.niFake_GetAStringOfFixedMaximumSize.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViCharBufferMatcher(256)) + self.patched_library.niFake_GetAStringOfFixedMaximumSize.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViCharBufferMatcher(256), + ) def test_get_a_string_of_size_python_code(self): test_size = 4 expected_string_size = test_size - 1 test_string = "A string that is larger than test_size." expected_string = test_string[:expected_string_size] - self.patched_library.niFake_GetAStringUsingPythonCode.side_effect = self.side_effects_helper.niFake_GetAStringUsingPythonCode - self.side_effects_helper['GetAStringUsingPythonCode']['aString'] = expected_string - with nifake.Session('dev1') as session: + self.patched_library.niFake_GetAStringUsingPythonCode.side_effect = ( + self.side_effects_helper.niFake_GetAStringUsingPythonCode + ) + self.side_effects_helper["GetAStringUsingPythonCode"][ + "aString" + ] = expected_string + with nifake.Session("dev1") as session: returned_string = session.get_a_string_using_python_code(test_size) assert returned_string == expected_string - self.patched_library.niFake_GetAStringUsingPythonCode.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt16Matcher(test_size), _matchers.ViCharBufferMatcher(test_size)) + self.patched_library.niFake_GetAStringUsingPythonCode.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt16Matcher(test_size), + _matchers.ViCharBufferMatcher(test_size), + ) def test_return_a_number_and_a_string(self): test_string = "this string" test_number = 13 - self.patched_library.niFake_ReturnANumberAndAString.side_effect = self.side_effects_helper.niFake_ReturnANumberAndAString - self.side_effects_helper['ReturnANumberAndAString']['aString'] = test_string - self.side_effects_helper['ReturnANumberAndAString']['aNumber'] = test_number - with nifake.Session('dev1') as session: + self.patched_library.niFake_ReturnANumberAndAString.side_effect = ( + self.side_effects_helper.niFake_ReturnANumberAndAString + ) + self.side_effects_helper["ReturnANumberAndAString"]["aString"] = test_string + self.side_effects_helper["ReturnANumberAndAString"]["aNumber"] = test_number + with nifake.Session("dev1") as session: returned_number, returned_string = session.return_a_number_and_a_string() - assert (returned_string == test_string) - assert (returned_number == test_number) - self.patched_library.niFake_ReturnANumberAndAString.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt16PointerMatcher(), _matchers.ViCharBufferMatcher(256)) + assert returned_string == test_string + assert returned_number == test_number + self.patched_library.niFake_ReturnANumberAndAString.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt16PointerMatcher(), + _matchers.ViCharBufferMatcher(256), + ) def test_get_an_ivi_dance_string(self): - self.patched_library.niFake_GetAnIviDanceString.side_effect = self.side_effects_helper.niFake_GetAnIviDanceString - string_val = 'Testing is fun?' - self.side_effects_helper['GetAnIviDanceString']['aString'] = string_val - with nifake.Session('dev1') as session: + self.patched_library.niFake_GetAnIviDanceString.side_effect = ( + self.side_effects_helper.niFake_GetAnIviDanceString + ) + string_val = "Testing is fun?" + self.side_effects_helper["GetAnIviDanceString"]["aString"] = string_val + with nifake.Session("dev1") as session: result_string = session.get_an_ivi_dance_string() assert result_string == string_val from unittest.mock import call - calls = [call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(0), None), call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(string_val)), _matchers.ViCharBufferMatcher(len(string_val)))] + + calls = [ + call( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt32Matcher(0), + None, + ), + call( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt32Matcher(len(string_val)), + _matchers.ViCharBufferMatcher(len(string_val)), + ), + ] self.patched_library.niFake_GetAnIviDanceString.assert_has_calls(calls) assert self.patched_library.niFake_GetAnIviDanceString.call_count == 2 def test_get_string_ivi_dance_error(self): test_error_code = -1234 test_error_desc = "ascending order" - self.patched_library.niFake_GetAttributeViString.side_effect = self.side_effects_helper.niFake_GetAttributeViString - self.side_effects_helper['GetAttributeViString']['attributeValue'] = 'Testing is fun?' - self.side_effects_helper['GetAttributeViString']['return'] = test_error_code - self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError - self.side_effects_helper['GetError']['errorCode'] = test_error_code - self.side_effects_helper['GetError']['description'] = test_error_desc - with nifake.Session('dev1') as session: + self.patched_library.niFake_GetAttributeViString.side_effect = ( + self.side_effects_helper.niFake_GetAttributeViString + ) + self.side_effects_helper["GetAttributeViString"][ + "attributeValue" + ] = "Testing is fun?" + self.side_effects_helper["GetAttributeViString"]["return"] = test_error_code + self.patched_library.niFake_GetError.side_effect = ( + self.side_effects_helper.niFake_GetError + ) + self.side_effects_helper["GetError"]["errorCode"] = test_error_code + self.side_effects_helper["GetError"]["description"] = test_error_desc + with nifake.Session("dev1") as session: try: session.read_write_string assert False @@ -800,284 +1212,532 @@ def test_get_string_ivi_dance_error(self): assert e.description == test_error_desc def test_get_an_ivi_dance_with_a_twist_string(self): - self.patched_library.niFake_GetAnIviDanceWithATwistString.side_effect = self.side_effects_helper.niFake_GetAnIviDanceWithATwistString - string_val = 'Testing is fun?' - self.side_effects_helper['GetAnIviDanceWithATwistString']['aString'] = string_val - self.side_effects_helper['GetAnIviDanceWithATwistString']['actualSize'] = len(string_val) - with nifake.Session('dev1') as session: + self.patched_library.niFake_GetAnIviDanceWithATwistString.side_effect = ( + self.side_effects_helper.niFake_GetAnIviDanceWithATwistString + ) + string_val = "Testing is fun?" + self.side_effects_helper["GetAnIviDanceWithATwistString"][ + "aString" + ] = string_val + self.side_effects_helper["GetAnIviDanceWithATwistString"]["actualSize"] = len( + string_val + ) + with nifake.Session("dev1") as session: result_string = session.get_an_ivi_dance_with_a_twist_string() assert result_string == string_val from unittest.mock import call + calls = [ - call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(0), None, _matchers.ViInt32PointerMatcher()), - call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(string_val)), _matchers.ViCharBufferMatcher(len(string_val)), _matchers.ViInt32PointerMatcher()) + call( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt32Matcher(0), + None, + _matchers.ViInt32PointerMatcher(), + ), + call( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt32Matcher(len(string_val)), + _matchers.ViCharBufferMatcher(len(string_val)), + _matchers.ViInt32PointerMatcher(), + ), ] - self.patched_library.niFake_GetAnIviDanceWithATwistString.assert_has_calls(calls) - assert self.patched_library.niFake_GetAnIviDanceWithATwistString.call_count == 2 + self.patched_library.niFake_GetAnIviDanceWithATwistString.assert_has_calls( + calls + ) + assert ( + self.patched_library.niFake_GetAnIviDanceWithATwistString.call_count + == 2 + ) def test_get_array_using_ivi_dance(self): - self.patched_library.niFake_GetArrayUsingIviDance.side_effect = self.side_effects_helper.niFake_GetArrayUsingIviDance - self.side_effects_helper['GetArrayUsingIviDance']['arrayOut'] = [1.1, 2.2] - with nifake.Session('dev1') as session: + self.patched_library.niFake_GetArrayUsingIviDance.side_effect = ( + self.side_effects_helper.niFake_GetArrayUsingIviDance + ) + self.side_effects_helper["GetArrayUsingIviDance"]["arrayOut"] = [1.1, 2.2] + with nifake.Session("dev1") as session: result_array = session.get_array_using_ivi_dance() assert result_array == [1.1, 2.2] # Repeated Capabilities def test_repeated_capability_method_on_session_timedelta(self): - test_maximum_time_ms = 10 # milliseconds - test_maximum_time_timedelta = hightime.timedelta(milliseconds=test_maximum_time_ms) + test_maximum_time_ms = 10 # milliseconds + test_maximum_time_timedelta = hightime.timedelta( + milliseconds=test_maximum_time_ms + ) test_reading = 5 - self.patched_library.niFake_ReadFromChannel.side_effect = self.side_effects_helper.niFake_ReadFromChannel - self.side_effects_helper['ReadFromChannel']['reading'] = test_reading - with nifake.Session('dev1') as session: + self.patched_library.niFake_ReadFromChannel.side_effect = ( + self.side_effects_helper.niFake_ReadFromChannel + ) + self.side_effects_helper["ReadFromChannel"]["reading"] = test_reading + with nifake.Session("dev1") as session: value = session.read_from_channel(test_maximum_time_timedelta) - self.patched_library.niFake_ReadFromChannel.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViInt32Matcher(test_maximum_time_ms), _matchers.ViReal64PointerMatcher()) + self.patched_library.niFake_ReadFromChannel.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViInt32Matcher(test_maximum_time_ms), + _matchers.ViReal64PointerMatcher(), + ) assert value == test_reading def test_repeated_capability_method_on_specific_channel(self): - test_maximum_time_ms = 10 # milliseconds + test_maximum_time_ms = 10 # milliseconds test_maximum_time = hightime.timedelta(milliseconds=test_maximum_time_ms) test_reading = 5 - self.patched_library.niFake_ReadFromChannel.side_effect = self.side_effects_helper.niFake_ReadFromChannel - self.side_effects_helper['ReadFromChannel']['reading'] = test_reading - with nifake.Session('dev1') as session: - value = session.channels['3'].read_from_channel(test_maximum_time) - self.patched_library.niFake_ReadFromChannel.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher('3'), _matchers.ViInt32Matcher(test_maximum_time_ms), _matchers.ViReal64PointerMatcher()) + self.patched_library.niFake_ReadFromChannel.side_effect = ( + self.side_effects_helper.niFake_ReadFromChannel + ) + self.side_effects_helper["ReadFromChannel"]["reading"] = test_reading + with nifake.Session("dev1") as session: + value = session.channels["3"].read_from_channel(test_maximum_time) + self.patched_library.niFake_ReadFromChannel.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher("3"), + _matchers.ViInt32Matcher(test_maximum_time_ms), + _matchers.ViReal64PointerMatcher(), + ) assert value == test_reading def test_device_method_not_exist_on_repeated_capability_error(self): - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: try: - session.channels['3'].simple_function() - assert False, 'Method has no repeated capability so it shouldn\'t exist on _RepeatedCapability' + session.channels["3"].simple_function() + assert ( + False + ), "Method has no repeated capability so it shouldn't exist on _RepeatedCapability" except AttributeError: pass def test_repeated_capabilities_list(self): - with nifake.Session('dev1') as session: - assert session.channels['r0']._repeated_capability_list == ['r0'] + with nifake.Session("dev1") as session: + assert session.channels["r0"]._repeated_capability_list == ["r0"] def test_chained_repeated_capabilities_list(self): - with nifake.Session('dev1') as session: - assert session.sites[0, 1].channels[2, 3]._repeated_capability_list == ['site0/2', 'site0/3', 'site1/2', 'site1/3'] + with nifake.Session("dev1") as session: + assert session.sites[0, 1].channels[2, 3]._repeated_capability_list == [ + "site0/2", + "site0/3", + "site1/2", + "site1/3", + ] def test_chained_repeated_capability_method_on_specific_channel(self): - test_maximum_time_ms = 10 # milliseconds + test_maximum_time_ms = 10 # milliseconds test_maximum_time = hightime.timedelta(milliseconds=test_maximum_time_ms) test_reading = 5 - self.patched_library.niFake_ReadFromChannel.side_effect = self.side_effects_helper.niFake_ReadFromChannel - self.side_effects_helper['ReadFromChannel']['reading'] = test_reading - with nifake.Session('dev1') as session: - value = session.sites[0, 1].channels[2, 3].read_from_channel(test_maximum_time) - self.patched_library.niFake_ReadFromChannel.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher('site0/2,site0/3,site1/2,site1/3'), _matchers.ViInt32Matcher(test_maximum_time_ms), _matchers.ViReal64PointerMatcher()) + self.patched_library.niFake_ReadFromChannel.side_effect = ( + self.side_effects_helper.niFake_ReadFromChannel + ) + self.side_effects_helper["ReadFromChannel"]["reading"] = test_reading + with nifake.Session("dev1") as session: + value = ( + session.sites[0, 1].channels[2, 3].read_from_channel(test_maximum_time) + ) + self.patched_library.niFake_ReadFromChannel.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher("site0/2,site0/3,site1/2,site1/3"), + _matchers.ViInt32Matcher(test_maximum_time_ms), + _matchers.ViReal64PointerMatcher(), + ) assert value == test_reading # Attributes def test_get_attribute_int32(self): - self.patched_library.niFake_GetAttributeViInt32.side_effect = self.side_effects_helper.niFake_GetAttributeViInt32 + self.patched_library.niFake_GetAttributeViInt32.side_effect = ( + self.side_effects_helper.niFake_GetAttributeViInt32 + ) test_number = 3 - self.side_effects_helper['GetAttributeViInt32']['attributeValue'] = test_number - with nifake.Session('dev1') as session: + self.side_effects_helper["GetAttributeViInt32"]["attributeValue"] = test_number + with nifake.Session("dev1") as session: attr_int = session.read_write_integer - assert(attr_int == test_number) - self.patched_library.niFake_GetAttributeViInt32.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000004), _matchers.ViInt32PointerMatcher()) + assert attr_int == test_number + self.patched_library.niFake_GetAttributeViInt32.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(1000004), + _matchers.ViInt32PointerMatcher(), + ) def test_set_attribute_int32(self): - self.patched_library.niFake_SetAttributeViInt32.side_effect = self.side_effects_helper.niFake_SetAttributeViInt32 + self.patched_library.niFake_SetAttributeViInt32.side_effect = ( + self.side_effects_helper.niFake_SetAttributeViInt32 + ) attribute_id = 1000004 test_number = -10 - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: session.read_write_integer = test_number - self.patched_library.niFake_SetAttributeViInt32.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt32Matcher(test_number)) + self.patched_library.niFake_SetAttributeViInt32.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViInt32Matcher(test_number), + ) def test_get_attribute_int32_with_converter(self): - self.patched_library.niFake_GetAttributeViInt32.side_effect = self.side_effects_helper.niFake_GetAttributeViInt32 + self.patched_library.niFake_GetAttributeViInt32.side_effect = ( + self.side_effects_helper.niFake_GetAttributeViInt32 + ) attribute_id = 1000008 test_number_ms = 3 test_number_s = 0.003 - self.side_effects_helper['GetAttributeViInt32']['attributeValue'] = test_number_ms - with nifake.Session('dev1') as session: + self.side_effects_helper["GetAttributeViInt32"][ + "attributeValue" + ] = test_number_ms + with nifake.Session("dev1") as session: attr_timedelta = session.read_write_integer_with_converter - assert(attr_timedelta.total_seconds() == test_number_s) - self.patched_library.niFake_GetAttributeViInt32.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt32PointerMatcher()) + assert attr_timedelta.total_seconds() == test_number_s + self.patched_library.niFake_GetAttributeViInt32.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViInt32PointerMatcher(), + ) def test_set_attribute_int32_with_converter(self): - self.patched_library.niFake_SetAttributeViInt32.side_effect = self.side_effects_helper.niFake_SetAttributeViInt32 + self.patched_library.niFake_SetAttributeViInt32.side_effect = ( + self.side_effects_helper.niFake_SetAttributeViInt32 + ) attribute_id = 1000008 test_number_ms = -10000 - with nifake.Session('dev1') as session: - session.read_write_integer_with_converter = hightime.timedelta(milliseconds=test_number_ms) - self.patched_library.niFake_SetAttributeViInt32.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt32Matcher(test_number_ms)) + with nifake.Session("dev1") as session: + session.read_write_integer_with_converter = hightime.timedelta( + milliseconds=test_number_ms + ) + self.patched_library.niFake_SetAttributeViInt32.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViInt32Matcher(test_number_ms), + ) def test_get_attribute_real64(self): - self.patched_library.niFake_GetAttributeViReal64.side_effect = self.side_effects_helper.niFake_GetAttributeViReal64 + self.patched_library.niFake_GetAttributeViReal64.side_effect = ( + self.side_effects_helper.niFake_GetAttributeViReal64 + ) test_number = 1.5 - self.side_effects_helper['GetAttributeViReal64']['attributeValue'] = test_number - with nifake.Session('dev1') as session: + self.side_effects_helper["GetAttributeViReal64"]["attributeValue"] = test_number + with nifake.Session("dev1") as session: attr_double = session.read_write_double assert attr_double == test_number - self.patched_library.niFake_GetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000001), _matchers.ViReal64PointerMatcher()) + self.patched_library.niFake_GetAttributeViReal64.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(1000001), + _matchers.ViReal64PointerMatcher(), + ) def test_set_attribute_real64(self): - self.patched_library.niFake_SetAttributeViReal64.side_effect = self.side_effects_helper.niFake_SetAttributeViReal64 + self.patched_library.niFake_SetAttributeViReal64.side_effect = ( + self.side_effects_helper.niFake_SetAttributeViReal64 + ) attribute_id = 1000001 test_number = 10.1 - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: session.read_write_double = test_number - self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64Matcher(test_number)) + self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViReal64Matcher(test_number), + ) def test_get_attribute_real64_with_converter(self): - self.patched_library.niFake_GetAttributeViReal64.side_effect = self.side_effects_helper.niFake_GetAttributeViReal64 + self.patched_library.niFake_GetAttributeViReal64.side_effect = ( + self.side_effects_helper.niFake_GetAttributeViReal64 + ) attribute_id = 1000007 test_number = 1e-9 - self.side_effects_helper['GetAttributeViReal64']['attributeValue'] = test_number - with nifake.Session('dev1') as session: + self.side_effects_helper["GetAttributeViReal64"]["attributeValue"] = test_number + with nifake.Session("dev1") as session: attr_timedelta = session.read_write_double_with_converter assert attr_timedelta.total_seconds() == test_number - self.patched_library.niFake_GetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64PointerMatcher()) + self.patched_library.niFake_GetAttributeViReal64.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViReal64PointerMatcher(), + ) def test_set_attribute_real64_with_converter(self): - self.patched_library.niFake_SetAttributeViReal64.side_effect = self.side_effects_helper.niFake_SetAttributeViReal64 + self.patched_library.niFake_SetAttributeViReal64.side_effect = ( + self.side_effects_helper.niFake_SetAttributeViReal64 + ) attribute_id = 1000007 test_number = 1e-9 - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: session.read_write_double_with_converter = hightime.timedelta(nanoseconds=1) - self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64Matcher(test_number)) + self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViReal64Matcher(test_number), + ) def test_get_attribute_string(self): - self.patched_library.niFake_GetAttributeViString.side_effect = self.side_effects_helper.niFake_GetAttributeViString - string = 'Testing is fun?' - self.side_effects_helper['GetAttributeViString']['attributeValue'] = string - with nifake.Session('dev1') as session: + self.patched_library.niFake_GetAttributeViString.side_effect = ( + self.side_effects_helper.niFake_GetAttributeViString + ) + string = "Testing is fun?" + self.side_effects_helper["GetAttributeViString"]["attributeValue"] = string + with nifake.Session("dev1") as session: attr_string = session.read_write_string assert attr_string == string from unittest.mock import call - calls = [call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000002), _matchers.ViInt32Matcher(0), None), call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000002), _matchers.ViInt32Matcher(15), _matchers.ViCharBufferMatcher(len(string)))] + + calls = [ + call( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(1000002), + _matchers.ViInt32Matcher(0), + None, + ), + call( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(1000002), + _matchers.ViInt32Matcher(15), + _matchers.ViCharBufferMatcher(len(string)), + ), + ] self.patched_library.niFake_GetAttributeViString.assert_has_calls(calls) assert self.patched_library.niFake_GetAttributeViString.call_count == 2 def test_set_attribute_string(self): - self.patched_library.niFake_SetAttributeViString.side_effect = self.side_effects_helper.niFake_SetAttributeViString + self.patched_library.niFake_SetAttributeViString.side_effect = ( + self.side_effects_helper.niFake_SetAttributeViString + ) attribute_id = 1000002 - attrib_string = 'This is test string' - with nifake.Session('dev1') as session: + attrib_string = "This is test string" + with nifake.Session("dev1") as session: session.read_write_string = attrib_string - self.patched_library.niFake_SetAttributeViString.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViStringMatcher('This is test string')) + self.patched_library.niFake_SetAttributeViString.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViStringMatcher("This is test string"), + ) def test_get_attribute_string_with_converter(self): - self.patched_library.niFake_GetAttributeViString.side_effect = self.side_effects_helper.niFake_GetAttributeViString - string = 'not that interesting' - self.side_effects_helper['GetAttributeViString']['attributeValue'] = string - with nifake.Session('dev1') as session: + self.patched_library.niFake_GetAttributeViString.side_effect = ( + self.side_effects_helper.niFake_GetAttributeViString + ) + string = "not that interesting" + self.side_effects_helper["GetAttributeViString"]["attributeValue"] = string + with nifake.Session("dev1") as session: attr_string = session.read_write_string_repeated_capability assert attr_string == string from unittest.mock import call - calls = [call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000010), _matchers.ViInt32Matcher(0), None), call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000010), _matchers.ViInt32Matcher(20), _matchers.ViCharBufferMatcher(len(string)))] + + calls = [ + call( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(1000010), + _matchers.ViInt32Matcher(0), + None, + ), + call( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(1000010), + _matchers.ViInt32Matcher(20), + _matchers.ViCharBufferMatcher(len(string)), + ), + ] self.patched_library.niFake_GetAttributeViString.assert_has_calls(calls) assert self.patched_library.niFake_GetAttributeViString.call_count == 2 def test_set_attribute_string_with_converter(self): - self.patched_library.niFake_SetAttributeViString.side_effect = self.side_effects_helper.niFake_SetAttributeViString + self.patched_library.niFake_SetAttributeViString.side_effect = ( + self.side_effects_helper.niFake_SetAttributeViString + ) attribute_id = 1000010 - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: session.read_write_string_repeated_capability = 42 - self.patched_library.niFake_SetAttributeViString.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViStringMatcher('42')) + self.patched_library.niFake_SetAttributeViString.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViStringMatcher("42"), + ) def test_get_attribute_boolean(self): - self.patched_library.niFake_GetAttributeViBoolean.side_effect = self.side_effects_helper.niFake_GetAttributeViBoolean - self.side_effects_helper['GetAttributeViBoolean']['attributeValue'] = 1 - with nifake.Session('dev1') as session: + self.patched_library.niFake_GetAttributeViBoolean.side_effect = ( + self.side_effects_helper.niFake_GetAttributeViBoolean + ) + self.side_effects_helper["GetAttributeViBoolean"]["attributeValue"] = 1 + with nifake.Session("dev1") as session: assert session.read_write_bool - self.patched_library.niFake_GetAttributeViBoolean.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000000), _matchers.ViBooleanPointerMatcher()) + self.patched_library.niFake_GetAttributeViBoolean.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(1000000), + _matchers.ViBooleanPointerMatcher(), + ) def test_set_attribute_boolean(self): - self.patched_library.niFake_SetAttributeViBoolean.side_effect = self.side_effects_helper.niFake_SetAttributeViBoolean + self.patched_library.niFake_SetAttributeViBoolean.side_effect = ( + self.side_effects_helper.niFake_SetAttributeViBoolean + ) attribute_id = 1000000 attrib_bool = True - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: session.read_write_bool = attrib_bool - self.patched_library.niFake_SetAttributeViBoolean.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViBooleanMatcher(True)) + self.patched_library.niFake_SetAttributeViBoolean.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViBooleanMatcher(True), + ) def test_get_attribute_enum_int32(self): - self.patched_library.niFake_GetAttributeViInt32.side_effect = self.side_effects_helper.niFake_GetAttributeViInt32 - self.side_effects_helper['GetAttributeViInt32']['attributeValue'] = nifake.Color.BLUE.value - with nifake.Session('dev1') as session: + self.patched_library.niFake_GetAttributeViInt32.side_effect = ( + self.side_effects_helper.niFake_GetAttributeViInt32 + ) + self.side_effects_helper["GetAttributeViInt32"][ + "attributeValue" + ] = nifake.Color.BLUE.value + with nifake.Session("dev1") as session: assert session.read_write_color == nifake.Color.BLUE attribute_id = 1000003 - self.patched_library.niFake_GetAttributeViInt32.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt32PointerMatcher()) + self.patched_library.niFake_GetAttributeViInt32.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViInt32PointerMatcher(), + ) def test_set_attribute_enum_int32(self): - self.patched_library.niFake_SetAttributeViInt32.side_effect = self.side_effects_helper.niFake_SetAttributeViInt32 + self.patched_library.niFake_SetAttributeViInt32.side_effect = ( + self.side_effects_helper.niFake_SetAttributeViInt32 + ) enum_value = nifake.Color.RED - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: session.read_write_color = enum_value attribute_id = 1000003 - self.patched_library.niFake_SetAttributeViInt32.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt32Matcher(enum_value.value)) + self.patched_library.niFake_SetAttributeViInt32.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViInt32Matcher(enum_value.value), + ) def test_get_attribute_enum_real64(self): - self.patched_library.niFake_GetAttributeViReal64.side_effect = self.side_effects_helper.niFake_GetAttributeViReal64 + self.patched_library.niFake_GetAttributeViReal64.side_effect = ( + self.side_effects_helper.niFake_GetAttributeViReal64 + ) enum_value = nifake.FloatEnum.SIX_POINT_FIVE - self.side_effects_helper['GetAttributeViReal64']['attributeValue'] = enum_value.value - with nifake.Session('dev1') as session: + self.side_effects_helper["GetAttributeViReal64"][ + "attributeValue" + ] = enum_value.value + with nifake.Session("dev1") as session: assert session.float_enum == enum_value attribute_id = 1000005 - self.patched_library.niFake_GetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64PointerMatcher()) + self.patched_library.niFake_GetAttributeViReal64.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViReal64PointerMatcher(), + ) def test_set_attribute_enum_real64(self): - self.patched_library.niFake_SetAttributeViReal64.side_effect = self.side_effects_helper.niFake_SetAttributeViReal64 + self.patched_library.niFake_SetAttributeViReal64.side_effect = ( + self.side_effects_helper.niFake_SetAttributeViReal64 + ) enum_value = nifake.FloatEnum.FIVE_POINT_FIVE - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: session.float_enum = enum_value attribute_id = 1000005 - self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64Matcher(enum_value.value)) + self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViReal64Matcher(enum_value.value), + ) def test_get_attribute_channel(self): - self.patched_library.niFake_GetAttributeViInt32.side_effect = self.side_effects_helper.niFake_GetAttributeViInt32 + self.patched_library.niFake_GetAttributeViInt32.side_effect = ( + self.side_effects_helper.niFake_GetAttributeViInt32 + ) test_number = 100 - self.side_effects_helper['GetAttributeViInt32']['attributeValue'] = test_number - with nifake.Session('dev1') as session: - attr_int = session.channels[['0', '1']].read_write_integer - assert(attr_int == test_number) - self.patched_library.niFake_GetAttributeViInt32.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher('0,1'), _matchers.ViAttrMatcher(1000004), _matchers.ViInt32PointerMatcher()) + self.side_effects_helper["GetAttributeViInt32"]["attributeValue"] = test_number + with nifake.Session("dev1") as session: + attr_int = session.channels[["0", "1"]].read_write_integer + assert attr_int == test_number + self.patched_library.niFake_GetAttributeViInt32.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher("0,1"), + _matchers.ViAttrMatcher(1000004), + _matchers.ViInt32PointerMatcher(), + ) def test_set_attribute_channel(self): - self.patched_library.niFake_SetAttributeViReal64.side_effect = self.side_effects_helper.niFake_SetAttributeViReal64 + self.patched_library.niFake_SetAttributeViReal64.side_effect = ( + self.side_effects_helper.niFake_SetAttributeViReal64 + ) attribute_id = 1000001 test_number = 0.001 - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: session.channels[range(24)].read_write_double = test_number - self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher('0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23'), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64Matcher(test_number)) + self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher( + "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23" + ), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViReal64Matcher(test_number), + ) def test_get_attribute_int64(self): - self.patched_library.niFake_GetAttributeViInt64.side_effect = self.side_effects_helper.niFake_GetAttributeViInt64 + self.patched_library.niFake_GetAttributeViInt64.side_effect = ( + self.side_effects_helper.niFake_GetAttributeViInt64 + ) attribute_id = 1000006 test_number = 6000000000 - self.side_effects_helper['GetAttributeViInt64']['attributeValue'] = test_number - with nifake.Session('dev1') as session: + self.side_effects_helper["GetAttributeViInt64"]["attributeValue"] = test_number + with nifake.Session("dev1") as session: attr_int = session.read_write_int64 - assert(attr_int == test_number) - self.patched_library.niFake_GetAttributeViInt64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt64PointerMatcher()) + assert attr_int == test_number + self.patched_library.niFake_GetAttributeViInt64.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViInt64PointerMatcher(), + ) def test_set_attribute_int64(self): - self.patched_library.niFake_SetAttributeViInt64.side_effect = self.side_effects_helper.niFake_SetAttributeViInt64 + self.patched_library.niFake_SetAttributeViInt64.side_effect = ( + self.side_effects_helper.niFake_SetAttributeViInt64 + ) attribute_id = 1000006 test_number = -6000000000 - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: session.read_write_int64 = test_number - self.patched_library.niFake_SetAttributeViInt64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt64Matcher(test_number)) + self.patched_library.niFake_SetAttributeViInt64.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViInt64Matcher(test_number), + ) def test_get_attribute_error(self): test_error_code = -123 test_error_desc = "ascending order" - self.patched_library.niFake_GetAttributeViReal64.side_effect = self.side_effects_helper.niFake_GetAttributeViReal64 - self.side_effects_helper['GetAttributeViReal64']['attributeValue'] = 'Testing is fun?' - self.side_effects_helper['GetAttributeViReal64']['return'] = test_error_code - self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError - self.side_effects_helper['GetError']['errorCode'] = test_error_code - self.side_effects_helper['GetError']['description'] = test_error_desc - with nifake.Session('dev1') as session: + self.patched_library.niFake_GetAttributeViReal64.side_effect = ( + self.side_effects_helper.niFake_GetAttributeViReal64 + ) + self.side_effects_helper["GetAttributeViReal64"][ + "attributeValue" + ] = "Testing is fun?" + self.side_effects_helper["GetAttributeViReal64"]["return"] = test_error_code + self.patched_library.niFake_GetError.side_effect = ( + self.side_effects_helper.niFake_GetError + ) + self.side_effects_helper["GetError"]["errorCode"] = test_error_code + self.side_effects_helper["GetError"]["description"] = test_error_desc + with nifake.Session("dev1") as session: try: session.read_write_double assert False @@ -1087,138 +1747,210 @@ def test_get_attribute_error(self): def test_set_attribute_error(self): test_error_code = -1 - test_error_desc = 'Test' - self.patched_library.niFake_SetAttributeViReal64.side_effect = self.side_effects_helper.niFake_SetAttributeViReal64 - self.side_effects_helper['SetAttributeViReal64']['return'] = test_error_code - self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError - self.side_effects_helper['GetError']['errorCode'] = test_error_code - self.side_effects_helper['GetError']['description'] = test_error_desc - with nifake.Session('dev1') as session: + test_error_desc = "Test" + self.patched_library.niFake_SetAttributeViReal64.side_effect = ( + self.side_effects_helper.niFake_SetAttributeViReal64 + ) + self.side_effects_helper["SetAttributeViReal64"]["return"] = test_error_code + self.patched_library.niFake_GetError.side_effect = ( + self.side_effects_helper.niFake_GetError + ) + self.side_effects_helper["GetError"]["errorCode"] = test_error_code + self.side_effects_helper["GetError"]["description"] = test_error_desc + with nifake.Session("dev1") as session: try: session.read_write_double = -42.0 assert False except nifake.Error as e: assert e.code == test_error_code assert e.description == test_error_desc - self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000001), _matchers.ViReal64Matcher(-42.0)) + self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(1000001), + _matchers.ViReal64Matcher(-42.0), + ) def test_add_properties_to_session_error_set(self): - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: try: session.non_existent_property = 5 assert False except AttributeError as e: - assert str(e) == "'Session' object has no attribute 'non_existent_property'" + assert ( + str(e) + == "'Session' object has no attribute 'non_existent_property'" + ) def test_add_properties_to_session_error_get(self): - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: try: value = session.non_existent_property # noqa: F841 assert False except AttributeError as e: - assert str(e) == "'Session' object has no attribute 'non_existent_property'" + assert ( + str(e) + == "'Session' object has no attribute 'non_existent_property'" + ) def test_add_properties_to_repeated_capability_error_set(self): - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: try: - session.channels['0'].non_existent_property = 5 + session.channels["0"].non_existent_property = 5 assert False except AttributeError as e: - assert str(e) == "'_SessionBase' object has no attribute 'non_existent_property'" + assert ( + str(e) + == "'_SessionBase' object has no attribute 'non_existent_property'" + ) def test_add_properties_to_repeated_capability_error_get(self): - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: try: - value = session.channels['0'].non_existent_property # noqa: F841 + value = session.channels["0"].non_existent_property # noqa: F841 assert False except AttributeError as e: - assert str(e) == "'_SessionBase' object has no attribute 'non_existent_property'" + assert ( + str(e) + == "'_SessionBase' object has no attribute 'non_existent_property'" + ) def test_set_enum_attribute_int32_error(self): - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: try: session.read_write_color = 5 except TypeError as e: - assert str(e) == 'must be Color not int' + assert str(e) == "must be Color not int" def test_set_wrong_enum_attribute_int32_error(self): - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: try: session.read_write_color = nifake.FloatEnum.SIX_POINT_FIVE except TypeError as e: - assert str(e) == 'must be Color not FloatEnum' + assert str(e) == "must be Color not FloatEnum" # Error descriptions def test_get_error_and_error_message_returns_error(self): test_error_code = -42 - self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = self.side_effects_helper.niFake_PoorlyNamedSimpleFunction - self.side_effects_helper['PoorlyNamedSimpleFunction']['return'] = test_error_code - self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError - self.side_effects_helper['GetError']['errorCode'] = -1 - self.side_effects_helper['GetError']['description'] = "Shouldn't get this" - self.side_effects_helper['GetError']['return'] = -2 - self.patched_library.niFake_error_message.side_effect = self.side_effects_helper.niFake_error_message - self.side_effects_helper['error_message']['errorMessage'] = "Also shouldn't get this" - self.side_effects_helper['error_message']['return'] = -3 - with nifake.Session('dev1') as session: + self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = ( + self.side_effects_helper.niFake_PoorlyNamedSimpleFunction + ) + self.side_effects_helper["PoorlyNamedSimpleFunction"][ + "return" + ] = test_error_code + self.patched_library.niFake_GetError.side_effect = ( + self.side_effects_helper.niFake_GetError + ) + self.side_effects_helper["GetError"]["errorCode"] = -1 + self.side_effects_helper["GetError"]["description"] = "Shouldn't get this" + self.side_effects_helper["GetError"]["return"] = -2 + self.patched_library.niFake_error_message.side_effect = ( + self.side_effects_helper.niFake_error_message + ) + self.side_effects_helper["error_message"][ + "errorMessage" + ] = "Also shouldn't get this" + self.side_effects_helper["error_message"]["return"] = -3 + with nifake.Session("dev1") as session: try: session.simple_function() except nifake.Error as e: assert e.code == test_error_code - assert e.description == 'Failed to retrieve error description.' + assert e.description == "Failed to retrieve error description." def test_get_error_description_error_message_error(self): test_error_code = -42 test_error_desc = "The answer to the ultimate question" - self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = self.side_effects_helper.niFake_PoorlyNamedSimpleFunction - self.side_effects_helper['PoorlyNamedSimpleFunction']['return'] = test_error_code - self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError - self.side_effects_helper['GetError']['errorCode'] = -1 - self.side_effects_helper['GetError']['description'] = "Shouldn't get this" - self.side_effects_helper['GetError']['return'] = -2 - self.patched_library.niFake_error_message.side_effect = self.side_effects_helper.niFake_error_message - self.side_effects_helper['error_message']['errorMessage'] = test_error_desc - with nifake.Session('dev1') as session: + self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = ( + self.side_effects_helper.niFake_PoorlyNamedSimpleFunction + ) + self.side_effects_helper["PoorlyNamedSimpleFunction"][ + "return" + ] = test_error_code + self.patched_library.niFake_GetError.side_effect = ( + self.side_effects_helper.niFake_GetError + ) + self.side_effects_helper["GetError"]["errorCode"] = -1 + self.side_effects_helper["GetError"]["description"] = "Shouldn't get this" + self.side_effects_helper["GetError"]["return"] = -2 + self.patched_library.niFake_error_message.side_effect = ( + self.side_effects_helper.niFake_error_message + ) + self.side_effects_helper["error_message"]["errorMessage"] = test_error_desc + with nifake.Session("dev1") as session: try: session.simple_function() except nifake.Error as e: assert e.code == test_error_code assert e.description == test_error_desc - self.patched_library.niFake_error_message.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(test_error_code), _matchers.ViCharBufferMatcher(256)) + self.patched_library.niFake_error_message.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt32Matcher(test_error_code), + _matchers.ViCharBufferMatcher(256), + ) # Custom types def test_set_custom_type(self): - self.patched_library.niFake_SetCustomType.side_effect = self.side_effects_helper.niFake_SetCustomType + self.patched_library.niFake_SetCustomType.side_effect = ( + self.side_effects_helper.niFake_SetCustomType + ) cs = nifake.CustomStruct(struct_int=42, struct_double=4.2) - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: session.set_custom_type(cs) - self.patched_library.niFake_SetCustomType.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.CustomTypeMatcher(nifake.struct_CustomStruct, nifake.struct_CustomStruct(cs))) + self.patched_library.niFake_SetCustomType.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.CustomTypeMatcher( + nifake.struct_CustomStruct, nifake.struct_CustomStruct(cs) + ), + ) def test_get_custom_type(self): - self.patched_library.niFake_GetCustomType.side_effect = self.side_effects_helper.niFake_GetCustomType + self.patched_library.niFake_GetCustomType.side_effect = ( + self.side_effects_helper.niFake_GetCustomType + ) cs_ctype = nifake.struct_CustomStruct(struct_int=42, struct_double=4.2) - self.side_effects_helper['GetCustomType']['cs'] = cs_ctype - with nifake.Session('dev1') as session: + self.side_effects_helper["GetCustomType"]["cs"] = cs_ctype + with nifake.Session("dev1") as session: cs = session.get_custom_type() assert cs.struct_int == cs_ctype.struct_int assert cs.struct_double == cs_ctype.struct_double def test_set_custom_type_array(self): - self.patched_library.niFake_SetCustomTypeArray.side_effect = self.side_effects_helper.niFake_SetCustomTypeArray - cs = [nifake.CustomStruct(struct_int=42, struct_double=4.2), nifake.CustomStruct(struct_int=43, struct_double=4.3), nifake.CustomStruct(struct_int=42, struct_double=4.3)] - cs_ctype = (nifake.struct_CustomStruct * len(cs))(*[nifake.struct_CustomStruct(c) for c in cs]) - with nifake.Session('dev1') as session: + self.patched_library.niFake_SetCustomTypeArray.side_effect = ( + self.side_effects_helper.niFake_SetCustomTypeArray + ) + cs = [ + nifake.CustomStruct(struct_int=42, struct_double=4.2), + nifake.CustomStruct(struct_int=43, struct_double=4.3), + nifake.CustomStruct(struct_int=42, struct_double=4.3), + ] + cs_ctype = (nifake.struct_CustomStruct * len(cs))( + *[nifake.struct_CustomStruct(c) for c in cs] + ) + with nifake.Session("dev1") as session: session.set_custom_type_array(cs) - self.patched_library.niFake_SetCustomTypeArray.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(cs)), _matchers.CustomTypeBufferMatcher(nifake.struct_CustomStruct, cs_ctype)) + self.patched_library.niFake_SetCustomTypeArray.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt32Matcher(len(cs)), + _matchers.CustomTypeBufferMatcher(nifake.struct_CustomStruct, cs_ctype), + ) def test_get_custom_type_array(self): - self.patched_library.niFake_GetCustomTypeArray.side_effect = self.side_effects_helper.niFake_GetCustomTypeArray - cs = [nifake.CustomStruct(struct_int=42, struct_double=4.2), nifake.CustomStruct(struct_int=43, struct_double=4.3), nifake.CustomStruct(struct_int=42, struct_double=4.3)] - cs_ctype = (nifake.struct_CustomStruct * len(cs))(*[nifake.struct_CustomStruct(c) for c in cs]) - self.side_effects_helper['GetCustomTypeArray']['cs'] = cs_ctype - with nifake.Session('dev1') as session: + self.patched_library.niFake_GetCustomTypeArray.side_effect = ( + self.side_effects_helper.niFake_GetCustomTypeArray + ) + cs = [ + nifake.CustomStruct(struct_int=42, struct_double=4.2), + nifake.CustomStruct(struct_int=43, struct_double=4.3), + nifake.CustomStruct(struct_int=42, struct_double=4.3), + ] + cs_ctype = (nifake.struct_CustomStruct * len(cs))( + *[nifake.struct_CustomStruct(c) for c in cs] + ) + self.side_effects_helper["GetCustomTypeArray"]["cs"] = cs_ctype + with nifake.Session("dev1") as session: cs_test = session.get_custom_type_array(len(cs_ctype)) assert len(cs_test) == len(cs_ctype) for actual, expected in zip(cs_test, cs): @@ -1229,13 +1961,22 @@ def test_get_custom_type_array(self): def test_get_array_using_python_code_double(self): import nifake._visatype - self.patched_library.niFake_GetArraySizeForPythonCode.side_effect = self.side_effects_helper.niFake_GetArraySizeForPythonCode - self.patched_library.niFake_GetArrayForPythonCodeDouble.side_effect = self.side_effects_helper.niFake_GetArrayForPythonCodeDouble + + self.patched_library.niFake_GetArraySizeForPythonCode.side_effect = ( + self.side_effects_helper.niFake_GetArraySizeForPythonCode + ) + self.patched_library.niFake_GetArrayForPythonCodeDouble.side_effect = ( + self.side_effects_helper.niFake_GetArrayForPythonCodeDouble + ) array_out = [42.0, 43.0, 44.0] array_out_ctype = (nifake._visatype.ViReal64 * len(array_out))(*array_out) - self.side_effects_helper['GetArraySizeForPythonCode']['sizeOut'] = len(array_out) - self.side_effects_helper['GetArrayForPythonCodeDouble']['arrayOut'] = array_out_ctype - with nifake.Session('dev1') as session: + self.side_effects_helper["GetArraySizeForPythonCode"]["sizeOut"] = len( + array_out + ) + self.side_effects_helper["GetArrayForPythonCodeDouble"][ + "arrayOut" + ] = array_out_ctype + with nifake.Session("dev1") as session: array_out_test = session.get_array_for_python_code_double() assert len(array_out_test) == len(array_out) for actual, expected in zip(array_out_test, array_out): @@ -1243,13 +1984,26 @@ def test_get_array_using_python_code_double(self): def test_get_array_using_python_code_custom_type(self): import nifake._visatype - self.patched_library.niFake_GetArraySizeForPythonCode.side_effect = self.side_effects_helper.niFake_GetArraySizeForPythonCode - self.patched_library.niFake_GetArrayForPythonCodeCustomType.side_effect = self.side_effects_helper.niFake_GetArrayForPythonCodeCustomType - cs = [nifake.CustomStruct(struct_int=42, struct_double=4.2), nifake.CustomStruct(struct_int=43, struct_double=4.3), nifake.CustomStruct(struct_int=42, struct_double=4.3)] - cs_ctype = (nifake.struct_CustomStruct * len(cs))(*[nifake.struct_CustomStruct(c) for c in cs]) - self.side_effects_helper['GetArraySizeForPythonCode']['sizeOut'] = len(cs) - self.side_effects_helper['GetArrayForPythonCodeCustomType']['arrayOut'] = cs_ctype - with nifake.Session('dev1') as session: + + self.patched_library.niFake_GetArraySizeForPythonCode.side_effect = ( + self.side_effects_helper.niFake_GetArraySizeForPythonCode + ) + self.patched_library.niFake_GetArrayForPythonCodeCustomType.side_effect = ( + self.side_effects_helper.niFake_GetArrayForPythonCodeCustomType + ) + cs = [ + nifake.CustomStruct(struct_int=42, struct_double=4.2), + nifake.CustomStruct(struct_int=43, struct_double=4.3), + nifake.CustomStruct(struct_int=42, struct_double=4.3), + ] + cs_ctype = (nifake.struct_CustomStruct * len(cs))( + *[nifake.struct_CustomStruct(c) for c in cs] + ) + self.side_effects_helper["GetArraySizeForPythonCode"]["sizeOut"] = len(cs) + self.side_effects_helper["GetArrayForPythonCodeCustomType"][ + "arrayOut" + ] = cs_ctype + with nifake.Session("dev1") as session: cs_test = session.get_array_for_python_code_custom_type() assert len(cs_test) == len(cs) for actual, expected in zip(cs_test, cs): @@ -1257,27 +2011,31 @@ def test_get_array_using_python_code_custom_type(self): assert actual.struct_double == expected.struct_double def test_get_cal_date_time(self): - self.patched_library.niFake_GetCalDateAndTime.side_effect = self.side_effects_helper.niFake_GetCalDateAndTime + self.patched_library.niFake_GetCalDateAndTime.side_effect = ( + self.side_effects_helper.niFake_GetCalDateAndTime + ) month = 12 day = 30 year = 1988 hour = 10 minute = 15 - self.side_effects_helper['GetCalDateAndTime']['return'] = 0 - self.side_effects_helper['GetCalDateAndTime']['month'] = month - self.side_effects_helper['GetCalDateAndTime']['day'] = day - self.side_effects_helper['GetCalDateAndTime']['year'] = year - self.side_effects_helper['GetCalDateAndTime']['hour'] = hour - self.side_effects_helper['GetCalDateAndTime']['minute'] = minute - with nifake.Session('dev1') as session: + self.side_effects_helper["GetCalDateAndTime"]["return"] = 0 + self.side_effects_helper["GetCalDateAndTime"]["month"] = month + self.side_effects_helper["GetCalDateAndTime"]["day"] = day + self.side_effects_helper["GetCalDateAndTime"]["year"] = year + self.side_effects_helper["GetCalDateAndTime"]["hour"] = hour + self.side_effects_helper["GetCalDateAndTime"]["minute"] = minute + with nifake.Session("dev1") as session: last_cal = session.get_cal_date_and_time(0) assert isinstance(last_cal, hightime.datetime) assert hightime.datetime(year, month, day, hour, minute) == last_cal def test_get_cal_interval(self): - self.patched_library.niFake_GetCalInterval = self.side_effects_helper.niFake_GetCalInterval - self.side_effects_helper['GetCalInterval']['months'] = 24 - with nifake.Session('dev1') as session: + self.patched_library.niFake_GetCalInterval = ( + self.side_effects_helper.niFake_GetCalInterval + ) + self.side_effects_helper["GetCalInterval"]["months"] = 24 + with nifake.Session("dev1") as session: last_cal = session.get_cal_interval() assert isinstance(last_cal, hightime.timedelta) assert 730 == last_cal.days @@ -1285,69 +2043,119 @@ def test_get_cal_interval(self): # Import/Export functions def test_import_attribute_configuration_buffer_list_i8(self): - self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer - expected_list = [ord('a'), ord('b'), ord('c'), ord('d')] + self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = ( + self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer + ) + expected_list = [ord("a"), ord("b"), ord("c"), ord("d")] configuration = expected_list - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list] self.get_ctypes_pointer_for_buffer_side_effect_count = 0 - with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect): + with patch( + "nifake.session.get_ctypes_pointer_for_buffer", + side_effect=self.get_ctypes_pointer_for_buffer_side_effect, + ): session.import_attribute_configuration_buffer(configuration) - self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(configuration)), _matchers.ViInt8BufferMatcher(expected_list)) + self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt32Matcher(len(configuration)), + _matchers.ViInt8BufferMatcher(expected_list), + ) def test_import_attribute_configuration_buffer_bytes(self): - self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer - expected_list = [ord('a'), ord('b'), ord('c'), ord('d')] - configuration = b'abcd' - with nifake.Session('dev1') as session: + self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = ( + self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer + ) + expected_list = [ord("a"), ord("b"), ord("c"), ord("d")] + configuration = b"abcd" + with nifake.Session("dev1") as session: self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list] self.get_ctypes_pointer_for_buffer_side_effect_count = 0 - with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect): + with patch( + "nifake.session.get_ctypes_pointer_for_buffer", + side_effect=self.get_ctypes_pointer_for_buffer_side_effect, + ): session.import_attribute_configuration_buffer(configuration) - self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(configuration)), _matchers.ViInt8BufferMatcher(expected_list)) + self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt32Matcher(len(configuration)), + _matchers.ViInt8BufferMatcher(expected_list), + ) def test_import_attribute_configuration_buffer_bytearray(self): - self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer - expected_list = [ord('a'), ord('b'), ord('c'), ord('d')] - configuration = bytearray(b'abcd') - with nifake.Session('dev1') as session: + self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = ( + self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer + ) + expected_list = [ord("a"), ord("b"), ord("c"), ord("d")] + configuration = bytearray(b"abcd") + with nifake.Session("dev1") as session: self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list] self.get_ctypes_pointer_for_buffer_side_effect_count = 0 - with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect): + with patch( + "nifake.session.get_ctypes_pointer_for_buffer", + side_effect=self.get_ctypes_pointer_for_buffer_side_effect, + ): session.import_attribute_configuration_buffer(configuration) - self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(configuration)), _matchers.ViInt8BufferMatcher(expected_list)) + self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt32Matcher(len(configuration)), + _matchers.ViInt8BufferMatcher(expected_list), + ) def test_import_attribute_configuration_buffer_array_bytes(self): - self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer - expected_list = [ord('a'), ord('b'), ord('c'), ord('d')] - configuration = array.array('b', b'abcd') - with nifake.Session('dev1') as session: + self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = ( + self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer + ) + expected_list = [ord("a"), ord("b"), ord("c"), ord("d")] + configuration = array.array("b", b"abcd") + with nifake.Session("dev1") as session: self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list] self.get_ctypes_pointer_for_buffer_side_effect_count = 0 - with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect): + with patch( + "nifake.session.get_ctypes_pointer_for_buffer", + side_effect=self.get_ctypes_pointer_for_buffer_side_effect, + ): session.import_attribute_configuration_buffer(configuration) - self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(configuration)), _matchers.ViInt8BufferMatcher(expected_list)) + self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt32Matcher(len(configuration)), + _matchers.ViInt8BufferMatcher(expected_list), + ) def test_import_attribute_configuration_buffer_str(self): - self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer - expected_list = [ord('a'), ord('b'), ord('c'), ord('d')] - configuration = 'abcd' - with nifake.Session('dev1') as session: + self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = ( + self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer + ) + expected_list = [ord("a"), ord("b"), ord("c"), ord("d")] + configuration = "abcd" + with nifake.Session("dev1") as session: self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list] self.get_ctypes_pointer_for_buffer_side_effect_count = 0 - with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect): + with patch( + "nifake.session.get_ctypes_pointer_for_buffer", + side_effect=self.get_ctypes_pointer_for_buffer_side_effect, + ): session.import_attribute_configuration_buffer(configuration) - self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(configuration)), _matchers.ViInt8BufferMatcher(expected_list)) + self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt32Matcher(len(configuration)), + _matchers.ViInt8BufferMatcher(expected_list), + ) # Invalid types def test_import_attribute_configuration_buffer_list_i8_big(self): - self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer - expected_list = [ord('a') * 100, ord('b') * 100, ord('c') * 100, ord('d') * 100] + self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = ( + self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer + ) + expected_list = [ord("a") * 100, ord("b") * 100, ord("c") * 100, ord("d") * 100] configuration = expected_list - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list] self.get_ctypes_pointer_for_buffer_side_effect_count = 0 - with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect): + with patch( + "nifake.session.get_ctypes_pointer_for_buffer", + side_effect=self.get_ctypes_pointer_for_buffer_side_effect, + ): try: session.import_attribute_configuration_buffer(configuration) assert False @@ -1355,13 +2163,18 @@ def test_import_attribute_configuration_buffer_list_i8_big(self): pass def test_import_attribute_configuration_buffer_list_i8_float(self): - self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer - expected_list = [ord('a') * 1.0, ord('b') * 1.0, ord('c') * 1.0, ord('d') * 1.0] + self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = ( + self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer + ) + expected_list = [ord("a") * 1.0, ord("b") * 1.0, ord("c") * 1.0, ord("d") * 1.0] configuration = expected_list - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list] self.get_ctypes_pointer_for_buffer_side_effect_count = 0 - with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect): + with patch( + "nifake.session.get_ctypes_pointer_for_buffer", + side_effect=self.get_ctypes_pointer_for_buffer_side_effect, + ): try: session.import_attribute_configuration_buffer(configuration) assert False @@ -1369,13 +2182,23 @@ def test_import_attribute_configuration_buffer_list_i8_float(self): pass def test_import_attribute_configuration_buffer_list_i8_big_float(self): - self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer - expected_list = [ord('a') * 100.0, ord('b') * 100.0, ord('c') * 100.0, ord('d') * 100.0] + self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = ( + self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer + ) + expected_list = [ + ord("a") * 100.0, + ord("b") * 100.0, + ord("c") * 100.0, + ord("d") * 100.0, + ] configuration = expected_list - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list] self.get_ctypes_pointer_for_buffer_side_effect_count = 0 - with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect): + with patch( + "nifake.session.get_ctypes_pointer_for_buffer", + side_effect=self.get_ctypes_pointer_for_buffer_side_effect, + ): try: session.import_attribute_configuration_buffer(configuration) assert False @@ -1383,19 +2206,36 @@ def test_import_attribute_configuration_buffer_list_i8_big_float(self): pass def test_export_attribute_configuration_buffer(self): - self.patched_library.niFake_ExportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ExportAttributeConfigurationBuffer - expected_buffer_list = [ord('a'), ord('b'), ord('c'), ord('d'), ] + self.patched_library.niFake_ExportAttributeConfigurationBuffer.side_effect = ( + self.side_effects_helper.niFake_ExportAttributeConfigurationBuffer + ) + expected_buffer_list = [ + ord("a"), + ord("b"), + ord("c"), + ord("d"), + ] # Because we are mocking get_ctypes_pointer_for_buffer() we don't end up using the array allocated in the function call. Instead, we will allocate the arrays here # and have the mock return them. These are the ones that are actually filled in by the function. - expected_buffer = array.array('b', [0] * len(expected_buffer_list)) - expected_buffer_ctypes = ctypes.cast(expected_buffer.buffer_info()[0], ctypes.POINTER(nifake._visatype.ViInt8 * len(expected_buffer_list))) - - self.side_effects_helper['ExportAttributeConfigurationBuffer']['configuration'] = expected_buffer_list - with nifake.Session('dev1') as session: - self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_buffer_ctypes] + expected_buffer = array.array("b", [0] * len(expected_buffer_list)) + expected_buffer_ctypes = ctypes.cast( + expected_buffer.buffer_info()[0], + ctypes.POINTER(nifake._visatype.ViInt8 * len(expected_buffer_list)), + ) + + self.side_effects_helper["ExportAttributeConfigurationBuffer"][ + "configuration" + ] = expected_buffer_list + with nifake.Session("dev1") as session: + self.get_ctypes_pointer_for_buffer_side_effect_items = [ + expected_buffer_ctypes + ] self.get_ctypes_pointer_for_buffer_side_effect_count = 0 - with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect): + with patch( + "nifake.session.get_ctypes_pointer_for_buffer", + side_effect=self.get_ctypes_pointer_for_buffer_side_effect, + ): actual_configuration = session.export_attribute_configuration_buffer() assert type(actual_configuration) is bytes assert len(actual_configuration) == len(expected_buffer_list) @@ -1405,111 +2245,170 @@ def test_export_attribute_configuration_buffer(self): assert expected_buffer[i] == expected_buffer_list[i] def test_matcher_prints(self): - assert _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST).__repr__() == "ViSessionMatcher(" + str(nifake._visatype.ViSession) + ", 42)" - assert _matchers.ViAttrMatcher(SESSION_NUM_FOR_TEST).__repr__() == "ViAttrMatcher(" + str(nifake._visatype.ViAttr) + ", 42)" - assert _matchers.ViInt32Matcher(4).__repr__() == "ViInt32Matcher(" + str(nifake._visatype.ViInt32) + ", 4)" - assert _matchers.ViStringMatcher('0-24').__repr__() == "ViStringMatcher('0-24')" - assert _matchers.ViReal64Matcher(-42.0).__repr__() == "ViReal64Matcher(" + str(nifake._visatype.ViReal64) + ", -42.0)" - assert _matchers.ViReal64PointerMatcher().__repr__() == "ViReal64PointerMatcher(" + str(nifake._visatype.ViReal64) + ")" - assert _matchers.ViInt32PointerMatcher().__repr__() == "ViInt32PointerMatcher(" + str(nifake._visatype.ViInt32) + ")" - cs = [nifake.CustomStruct(struct_int=42, struct_double=4.2), nifake.CustomStruct(struct_int=43, struct_double=4.3), nifake.CustomStruct(struct_int=42, struct_double=4.3)] - cs_ctype = (nifake.struct_CustomStruct * len(cs))(*[nifake.struct_CustomStruct(c) for c in cs]) - assert _matchers.CustomTypeMatcher(nifake.struct_CustomStruct, nifake.struct_CustomStruct(cs[0])).__repr__() == "CustomTypeMatcher(, struct_CustomStruct(data=None, struct_int=42, struct_double=4.2))" - assert _matchers.CustomTypeBufferMatcher(nifake.struct_CustomStruct, cs_ctype).__repr__() == "CustomTypeBufferMatcher(, [struct_CustomStruct(data=None, struct_int=42, struct_double=4.2), struct_CustomStruct(data=None, struct_int=43, struct_double=4.3), struct_CustomStruct(data=None, struct_int=42, struct_double=4.3)])" + assert ( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST).__repr__() + == "ViSessionMatcher(" + str(nifake._visatype.ViSession) + ", 42)" + ) + assert ( + _matchers.ViAttrMatcher(SESSION_NUM_FOR_TEST).__repr__() + == "ViAttrMatcher(" + str(nifake._visatype.ViAttr) + ", 42)" + ) + assert ( + _matchers.ViInt32Matcher(4).__repr__() + == "ViInt32Matcher(" + str(nifake._visatype.ViInt32) + ", 4)" + ) + assert _matchers.ViStringMatcher("0-24").__repr__() == "ViStringMatcher('0-24')" + assert ( + _matchers.ViReal64Matcher(-42.0).__repr__() + == "ViReal64Matcher(" + str(nifake._visatype.ViReal64) + ", -42.0)" + ) + assert ( + _matchers.ViReal64PointerMatcher().__repr__() + == "ViReal64PointerMatcher(" + str(nifake._visatype.ViReal64) + ")" + ) + assert ( + _matchers.ViInt32PointerMatcher().__repr__() + == "ViInt32PointerMatcher(" + str(nifake._visatype.ViInt32) + ")" + ) + cs = [ + nifake.CustomStruct(struct_int=42, struct_double=4.2), + nifake.CustomStruct(struct_int=43, struct_double=4.3), + nifake.CustomStruct(struct_int=42, struct_double=4.3), + ] + cs_ctype = (nifake.struct_CustomStruct * len(cs))( + *[nifake.struct_CustomStruct(c) for c in cs] + ) + assert ( + _matchers.CustomTypeMatcher( + nifake.struct_CustomStruct, nifake.struct_CustomStruct(cs[0]) + ).__repr__() + == "CustomTypeMatcher(, struct_CustomStruct(data=None, struct_int=42, struct_double=4.2))" + ) + assert ( + _matchers.CustomTypeBufferMatcher( + nifake.struct_CustomStruct, cs_ctype + ).__repr__() + == "CustomTypeBufferMatcher(, [struct_CustomStruct(data=None, struct_int=42, struct_double=4.2), struct_CustomStruct(data=None, struct_int=43, struct_double=4.3), struct_CustomStruct(data=None, struct_int=42, struct_double=4.3)])" + ) def test_channel_on_session(self): - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: try: - session['100'].read_write_double = 5.0 + session["100"].read_write_double = 5.0 assert False except TypeError: pass def test_function_name(self): - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: # Pick a function that uses @ivi_synchronized - assert session.bool_array_output_function.__name__ == 'bool_array_output_function' + assert ( + session.bool_array_output_function.__name__ + == "bool_array_output_function" + ) # Pick several functions that do not use @ivi_synchronized to make sure they don't break in the future - assert session.lock.__name__ == 'lock' - assert session._error_message.__name__ == '_error_message' - assert session.initiate.__name__ == 'initiate' + assert session.lock.__name__ == "lock" + assert session._error_message.__name__ == "_error_message" + assert session.initiate.__name__ == "initiate" # Cannot use session..__name__ since that invokes the get attribute value and the returned value # (string, int, float) don't have __name__ properties def test_buffer_converter(self): - self.patched_library.niFake_DoubleAllTheNums.side_effect = self.side_effects_helper.niFake_DoubleAllTheNums + self.patched_library.niFake_DoubleAllTheNums.side_effect = ( + self.side_effects_helper.niFake_DoubleAllTheNums + ) nums = [1, 2, 3, 4.2] nums_x2 = [x * 2 for x in nums] - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: session.double_all_the_nums(nums) - self.patched_library.niFake_DoubleAllTheNums.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(nums)), _matchers.ViReal64BufferMatcher(nums_x2)) + self.patched_library.niFake_DoubleAllTheNums.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViInt32Matcher(len(nums)), + _matchers.ViReal64BufferMatcher(nums_x2), + ) def test_nitclk_integration(self): - with nifake.Session('dev1') as session: - assert str(type(session.tclk)) == "" + with nifake.Session("dev1") as session: + assert ( + str(type(session.tclk)) == "" + ) def test_accept_list_of_time_values_as_floats(self): - self.patched_library.niFake_AcceptListOfDurationsInSeconds.side_effect = self.side_effects_helper.niFake_AcceptListOfDurationsInSeconds + self.patched_library.niFake_AcceptListOfDurationsInSeconds.side_effect = ( + self.side_effects_helper.niFake_AcceptListOfDurationsInSeconds + ) delays = [-1.5, 2.0] - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: session.accept_list_of_durations_in_seconds(delays) self.patched_library.niFake_AcceptListOfDurationsInSeconds.assert_called_once_with( _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(delays)), - _matchers.ViReal64BufferMatcher(delays) + _matchers.ViReal64BufferMatcher(delays), ) def test_accept_array_of_time_values_as_floats(self): - self.patched_library.niFake_AcceptListOfDurationsInSeconds.side_effect = self.side_effects_helper.niFake_AcceptListOfDurationsInSeconds + self.patched_library.niFake_AcceptListOfDurationsInSeconds.side_effect = ( + self.side_effects_helper.niFake_AcceptListOfDurationsInSeconds + ) time_values = [-1.5, 2.0] - delays = array.array('d', time_values) - with nifake.Session('dev1') as session: + delays = array.array("d", time_values) + with nifake.Session("dev1") as session: session.accept_list_of_durations_in_seconds(delays) self.patched_library.niFake_AcceptListOfDurationsInSeconds.assert_called_once_with( _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(delays)), - _matchers.ViReal64BufferMatcher(time_values) + _matchers.ViReal64BufferMatcher(time_values), ) def test_accept_list_of_time_values_as_timedelta_instances(self): - self.patched_library.niFake_AcceptListOfDurationsInSeconds.side_effect = self.side_effects_helper.niFake_AcceptListOfDurationsInSeconds + self.patched_library.niFake_AcceptListOfDurationsInSeconds.side_effect = ( + self.side_effects_helper.niFake_AcceptListOfDurationsInSeconds + ) time_values = [-1.5, 2e-9] delays = [datetime.timedelta(seconds=-1.5), hightime.timedelta(nanoseconds=2)] - with nifake.Session('dev1') as session: + with nifake.Session("dev1") as session: session.accept_list_of_durations_in_seconds(delays) self.patched_library.niFake_AcceptListOfDurationsInSeconds.assert_called_once_with( _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(delays)), - _matchers.ViReal64BufferMatcher(time_values) + _matchers.ViReal64BufferMatcher(time_values), ) def test_return_timedelta(self): - self.patched_library.niFake_ReturnDurationInSeconds.side_effect = self.side_effects_helper.niFake_ReturnDurationInSeconds + self.patched_library.niFake_ReturnDurationInSeconds.side_effect = ( + self.side_effects_helper.niFake_ReturnDurationInSeconds + ) time_value = -1.5 expected_timedelta = hightime.timedelta(seconds=time_value) - self.side_effects_helper['ReturnDurationInSeconds']['timedelta'] = time_value - with nifake.Session('dev1') as session: + self.side_effects_helper["ReturnDurationInSeconds"]["timedelta"] = time_value + with nifake.Session("dev1") as session: returned_timedelta = session.return_duration_in_seconds() assert returned_timedelta == expected_timedelta self.patched_library.niFake_ReturnDurationInSeconds.assert_called_once_with( _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViReal64PointerMatcher() + _matchers.ViReal64PointerMatcher(), ) def test_return_timedeltas(self): - self.patched_library.niFake_ReturnListOfDurationsInSeconds.side_effect = self.side_effects_helper.niFake_ReturnListOfDurationsInSeconds + self.patched_library.niFake_ReturnListOfDurationsInSeconds.side_effect = ( + self.side_effects_helper.niFake_ReturnListOfDurationsInSeconds + ) time_values = [-1.5, 2.0] time_values_ctype = (nifake._visatype.ViReal64 * len(time_values))(*time_values) expected_timedeltas = [hightime.timedelta(seconds=i) for i in time_values] - self.side_effects_helper['ReturnListOfDurationsInSeconds']['timedeltas'] = time_values_ctype - with nifake.Session('dev1') as session: - returned_timedeltas = session.return_list_of_durations_in_seconds(len(expected_timedeltas)) + self.side_effects_helper["ReturnListOfDurationsInSeconds"][ + "timedeltas" + ] = time_values_ctype + with nifake.Session("dev1") as session: + returned_timedeltas = session.return_list_of_durations_in_seconds( + len(expected_timedeltas) + ) assert len(returned_timedeltas) == len(expected_timedeltas) assert returned_timedeltas == expected_timedeltas self.patched_library.niFake_ReturnListOfDurationsInSeconds.assert_called_once_with( _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(time_values)), - _matchers.ViReal64BufferMatcher(len(time_values)) + _matchers.ViReal64BufferMatcher(len(time_values)), ) @@ -1520,15 +2419,15 @@ def test_diagnostic_information(): def test_dunder_version(): - print('Version = {}'.format(nifake.__version__)) + print("Version = {}".format(nifake.__version__)) assert type(nifake.__version__) is str def test_library_error(): - if platform.architecture()[0] == '64bit': - ctypes_class_name = 'ctypes.CDLL' + if platform.architecture()[0] == "64bit": + ctypes_class_name = "ctypes.CDLL" else: - ctypes_class_name = 'ctypes.WinDLL' + ctypes_class_name = "ctypes.WinDLL" mock_ctypes = patch(ctypes_class_name).start() mock_ctypes_instance = mock_ctypes.return_value # Ensure these methods return 0 because they are called in session creation @@ -1536,13 +2435,16 @@ def test_library_error(): mock_ctypes_instance.niFake_LockSession.return_value = 0 mock_ctypes_instance.niFake_UnlockSession.return_value = 0 # Delete function to simulate missing function from driver runtime - delattr(mock_ctypes_instance, 'niFake_Abort') + delattr(mock_ctypes_instance, "niFake_Abort") - session = nifake.Session('dev1') + session = nifake.Session("dev1") try: session.abort() assert False except nifake.errors.DriverTooOldError as e: message = e.args[0] - assert message == 'A function was not found in the NI-FAKE runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it.' + assert ( + message + == "A function was not found in the NI-FAKE runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it." + ) diff --git a/generated/nifake/setup.py b/generated/nifake/setup.py index 65ff38cd5..859266663 100644 --- a/generated/nifake/setup.py +++ b/generated/nifake/setup.py @@ -15,42 +15,45 @@ def finalize_options(self): def run_tests(self): import pytest + pytest.main(self.test_args) -pypi_name = 'nifake' +pypi_name = "nifake" def read_contents(file_to_read): - with open(file_to_read, 'r') as f: + with open(file_to_read, "r") as f: return f.read() setup( name=pypi_name, zip_safe=True, - version='1.4.2.dev0', - description='NI-FAKE Python API', - long_description=read_contents('README.rst'), - long_description_content_type='text/x-rst', - author='NI', + version="1.4.2.dev0", + description="NI-FAKE Python API", + long_description=read_contents("README.rst"), + long_description_content_type="text/x-rst", + author="NI", author_email="opensource@ni.com", url="https://github.com/ni/nimi-python", maintainer="NI", maintainer_email="opensource@ni.com", - keywords=['nifake'], - license='MIT', + keywords=["nifake"], + license="MIT", include_package_data=True, - packages=['nifake'], + packages=["nifake"], install_requires=[ 'enum34;python_version<"3.4"', 'singledispatch;python_version<"3.4"', - 'hightime>=0.2.0', - 'nitclk', + "hightime>=0.2.0", + "nitclk", + ], + setup_requires=[ + "pytest-runner", ], - setup_requires=['pytest-runner', ], - tests_require=['pytest'], - test_suite='tests', + tests_require=["pytest"], + test_suite="tests", classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -65,8 +68,8 @@ def read_contents(file_to_read): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", - "Topic :: System :: Hardware :: Hardware Drivers" + "Topic :: System :: Hardware :: Hardware Drivers", ], - cmdclass={'test': PyTest}, - package_data={pypi_name: ['VERSION']}, + cmdclass={"test": PyTest}, + package_data={pypi_name: ["VERSION"]}, ) diff --git a/generated/nifgen/nifgen/__init__.py b/generated/nifgen/nifgen/__init__.py index 072fbdf5b..061ff0f45 100644 --- a/generated/nifgen/nifgen/__init__.py +++ b/generated/nifgen/nifgen/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = '1.4.2.dev0' +__version__ = "1.4.2.dev0" from nifgen.enums import * # noqa: F403,F401,H303 from nifgen.errors import DriverWarning # noqa: F401 @@ -11,12 +11,12 @@ def get_diagnostic_information(): - '''Get diagnostic information about the system state that is suitable for printing or logging + """Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - ''' + """ import os import pkg_resources import platform @@ -24,73 +24,80 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return (struct.calcsize("P") == 8) + return struct.calcsize("P") == 8 def is_os_64bit(): - return platform.machine().endswith('64') + return platform.machine().endswith("64") def is_venv(): - return 'VIRTUAL_ENV' in os.environ + return "VIRTUAL_ENV" in os.environ info = {} - info['os'] = {} - info['python'] = {} - info['driver'] = {} - info['module'] = {} - if platform.system() == 'Windows': + info["os"] = {} + info["python"] = {} + info["driver"] = {} + info["module"] = {} + if platform.system() == "Windows": try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = 'Windows' + os_name = "Windows" try: - driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-FGEN\CurrentVersion") + driver_version_key = winreg.OpenKey( + winreg.HKEY_LOCAL_MACHINE, + r"SOFTWARE\National Instruments\NI-FGEN\CurrentVersion", + ) driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = 'Unknown' - elif platform.system() == 'Linux': - os_name = 'Linux' - driver_version = 'Unknown' + driver_version = "Unknown" + elif platform.system() == "Linux": + os_name = "Linux" + driver_version = "Unknown" else: - raise SystemError('Unsupported platform: {}'.format(platform.system())) + raise SystemError("Unsupported platform: {}".format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] - - info['os']['name'] = os_name - info['os']['version'] = platform.version() - info['os']['bits'] = '64' if is_os_64bit() else '32' - info['driver']['name'] = "NI-FGEN" - info['driver']['version'] = driver_version - info['module']['name'] = 'nifgen' - info['module']['version'] = "1.4.2.dev0" - info['python']['version'] = sys.version - info['python']['bits'] = '64' if is_python_64bit() else '32' - info['python']['is_venv'] = is_venv() - info['python']['packages'] = installed_packages_list + installed_packages_list = [ + { + "name": i.key, + "version": i.version, + } + for i in installed_packages + ] + + info["os"]["name"] = os_name + info["os"]["version"] = platform.version() + info["os"]["bits"] = "64" if is_os_64bit() else "32" + info["driver"]["name"] = "NI-FGEN" + info["driver"]["version"] = driver_version + info["module"]["name"] = "nifgen" + info["module"]["version"] = "1.4.2.dev0" + info["python"]["version"] = sys.version + info["python"]["bits"] = "64" if is_python_64bit() else "32" + info["python"]["is_venv"] = is_venv() + info["python"]["packages"] = installed_packages_list return info def print_diagnostic_information(): - '''Print diagnostic information in a format suitable for issue report + """Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - ''' + """ info = get_diagnostic_information() - row_format = ' {:<10} {}' - for type in ['OS', 'Driver', 'Module', 'Python']: + row_format = " {:<10} {}" + for type in ["OS", "Driver", "Module", "Python"]: typename = type.lower() - print(type + ':') + print(type + ":") for item in info[typename]: - if item != 'packages': - print(row_format.format(item.title() + ':', info[typename][item])) - print(' Installed Packages:') - for p in info['python']['packages']: - print((' ' * 8) + p['name'] + '==' + p['version']) + if item != "packages": + print(row_format.format(item.title() + ":", info[typename][item])) + print(" Installed Packages:") + for p in info["python"]["packages"]: + print((" " * 8) + p["name"] + "==" + p["version"]) return info - - diff --git a/generated/nifgen/nifgen/_attributes.py b/generated/nifgen/nifgen/_attributes.py index 13fb143f1..acb2517c0 100644 --- a/generated/nifgen/nifgen/_attributes.py +++ b/generated/nifgen/nifgen/_attributes.py @@ -6,14 +6,13 @@ class Attribute(object): - '''Base class for all typed attributes.''' + """Base class for all typed attributes.""" def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -22,16 +21,19 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) + return hightime.timedelta( + milliseconds=session._get_attribute_vi_int32(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) + session._set_attribute_vi_int32( + self._attribute_id, + _converters.convert_timedelta_to_milliseconds_int32(value).value, + ) class AttributeViInt64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -40,7 +42,6 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -49,16 +50,19 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) + return hightime.timedelta( + seconds=session._get_attribute_vi_real64(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) + session._set_attribute_vi_real64( + self._attribute_id, + _converters.convert_timedelta_to_seconds_real64(value).value, + ) class AttributeViString(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -67,16 +71,17 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) + session._set_attribute_vi_string( + self._attribute_id, + _converters.convert_repeated_capabilities_without_prefix(value), + ) class AttributeViBoolean(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -85,31 +90,36 @@ def __set__(self, session, value): class AttributeEnum(object): - def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) + return self._attribute_type( + self._underlying_attribute.__get__(session, session_type) + ) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) + raise TypeError( + "must be " + + str(self._attribute_type.__name__) + + " not " + + str(type(value).__name__) + ) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): - def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from nifgen.session import SessionReference + return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) - - - + session._set_attribute_vi_session( + self._attribute_id, _converters.convert_to_nitclk_session_number(value) + ) diff --git a/generated/nifgen/nifgen/_converters.py b/generated/nifgen/nifgen/_converters.py index a20b22b28..77a87d2cd 100644 --- a/generated/nifgen/nifgen/_converters.py +++ b/generated/nifgen/nifgen/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - '''Base version that should not be called + """Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,36 +40,38 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - ''' - raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + """ + raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - '''Integer version''' + """Integer version""" return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - '''String version (this is the most complex) + """String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - ''' + """ # First we deal with a list - rep_cap_list = repeated_capability.split(',') + rep_cap_list = repeated_capability.split(",") if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, '').replace(':', '-') - rc = r.split('-') + r = repeated_capability.strip().replace(prefix, "").replace(":", "-") + rc = r.split("-") if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + raise errors.InvalidRepeatedCapabilityError( + "Multiple '-' or ':'", repeated_capability + ) try: start = int(rc[0]) end = int(rc[1]) @@ -85,7 +87,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, '').strip()] + return [repeated_capability.replace(prefix, "").strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -94,7 +96,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - '''Iterable version - can handle lists, ranges, and tuples''' + """Iterable version - can handle lists, ranges, and tuples""" rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -103,16 +105,22 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - '''slice version''' + """slice version""" + def ifnone(a, b): return b if a is None else a + # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) + rng = range( + ifnone(repeated_capability.start, 0), + repeated_capability.stop, + ifnone(repeated_capability.step, 1), + ) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=''): - '''Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=""): + """Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -120,15 +128,17 @@ def convert_repeated_capabilities(repeated_capability, prefix=''): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - ''' + """ # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] + return [ + prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) + ] def convert_repeated_capabilities_without_prefix(repeated_capability): - '''Convert a repeated capabilities object, without any prefix, to a comma delimited list + """Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -144,8 +154,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - ''' - return ','.join(convert_repeated_capabilities(repeated_capability, '')) + """ + return ",".join(convert_repeated_capabilities(repeated_capability, "")) def _convert_timedelta(value, library_type, scaling): @@ -158,7 +168,14 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: + if library_type in [ + _visatype.ViInt64, + _visatype.ViInt32, + _visatype.ViUInt32, + _visatype.ViInt16, + _visatype.ViUInt16, + _visatype.ViInt8, + ]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -195,34 +212,36 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - 'rangecheck': 'RangeCheck', - 'queryinstrstatus': 'QueryInstrStatus', - 'cache': 'Cache', - 'simulate': 'Simulate', - 'recordcoercions': 'RecordCoercions', - 'interchangecheck': 'InterchangeCheck', - 'driversetup': 'DriverSetup', - 'range_check': 'RangeCheck', - 'query_instr_status': 'QueryInstrStatus', - 'record_coercions': 'RecordCoercions', - 'interchange_check': 'InterchangeCheck', - 'driver_setup': 'DriverSetup', + "rangecheck": "RangeCheck", + "queryinstrstatus": "QueryInstrStatus", + "cache": "Cache", + "simulate": "Simulate", + "recordcoercions": "RecordCoercions", + "interchangecheck": "InterchangeCheck", + "driversetup": "DriverSetup", + "range_check": "RangeCheck", + "query_instr_status": "QueryInstrStatus", + "record_coercions": "RecordCoercions", + "interchange_check": "InterchangeCheck", + "driver_setup": "DriverSetup", } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': - value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') - elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': + if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": + value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") + elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": if not isinstance(values[k], dict): - raise TypeError('DriverSetup must be a dictionary') - value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) + raise TypeError("DriverSetup must be a dictionary") + value = "DriverSetup=" + ( + ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) + ) else: - value = k + ('=1' if values[k] is True else '=0') + value = k + ("=1" if values[k] is True else "=0") init_with_options.append(value) - init_with_options_string = ','.join(init_with_options) + init_with_options_string = ",".join(init_with_options) return init_with_options_string @@ -251,11 +270,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(',')] + return [x.strip() for x in comma_separated_string.split(",")] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -267,11 +286,17 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - ''' - chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) - repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] + """ + chained_repeated_capability_items = convert_comma_separated_string_to_list( + chained_repeated_capability + ) + repeated_capability_lists = [ + [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) + ] for item in chained_repeated_capability_items: - repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] - return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] - - + repeated_capability_lists = [ + x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) + ] + return [ + ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists + ] diff --git a/generated/nifgen/nifgen/_library.py b/generated/nifgen/nifgen/_library.py index e92309a92..30b233ef8 100644 --- a/generated/nifgen/nifgen/_library.py +++ b/generated/nifgen/nifgen/_library.py @@ -9,11 +9,11 @@ class Library(object): - '''Library + """Library Wrapper around driver library. Class will setup the correct ctypes information for every function on first call. - ''' + """ def __init__(self, ctypes_library): self._func_lock = threading.Lock() @@ -102,31 +102,57 @@ def _get_library_function(self, name): def niFgen_AbortGeneration(self, vi): # noqa: N802 with self._func_lock: if self.niFgen_AbortGeneration_cfunc is None: - self.niFgen_AbortGeneration_cfunc = self._get_library_function('niFgen_AbortGeneration') + self.niFgen_AbortGeneration_cfunc = self._get_library_function( + "niFgen_AbortGeneration" + ) self.niFgen_AbortGeneration_cfunc.argtypes = [ViSession] # noqa: F405 self.niFgen_AbortGeneration_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_AbortGeneration_cfunc(vi) - def niFgen_AllocateNamedWaveform(self, vi, channel_name, waveform_name, waveform_size): # noqa: N802 + def niFgen_AllocateNamedWaveform( + self, vi, channel_name, waveform_name, waveform_size + ): # noqa: N802 with self._func_lock: if self.niFgen_AllocateNamedWaveform_cfunc is None: - self.niFgen_AllocateNamedWaveform_cfunc = self._get_library_function('niFgen_AllocateNamedWaveform') - self.niFgen_AllocateNamedWaveform_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32] # noqa: F405 + self.niFgen_AllocateNamedWaveform_cfunc = self._get_library_function( + "niFgen_AllocateNamedWaveform" + ) + self.niFgen_AllocateNamedWaveform_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViInt32, + ] # noqa: F405 self.niFgen_AllocateNamedWaveform_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_AllocateNamedWaveform_cfunc(vi, channel_name, waveform_name, waveform_size) + return self.niFgen_AllocateNamedWaveform_cfunc( + vi, channel_name, waveform_name, waveform_size + ) - def niFgen_AllocateWaveform(self, vi, channel_name, waveform_size, waveform_handle): # noqa: N802 + def niFgen_AllocateWaveform( + self, vi, channel_name, waveform_size, waveform_handle + ): # noqa: N802 with self._func_lock: if self.niFgen_AllocateWaveform_cfunc is None: - self.niFgen_AllocateWaveform_cfunc = self._get_library_function('niFgen_AllocateWaveform') - self.niFgen_AllocateWaveform_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViInt32)] # noqa: F405 + self.niFgen_AllocateWaveform_cfunc = self._get_library_function( + "niFgen_AllocateWaveform" + ) + self.niFgen_AllocateWaveform_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niFgen_AllocateWaveform_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_AllocateWaveform_cfunc(vi, channel_name, waveform_size, waveform_handle) + return self.niFgen_AllocateWaveform_cfunc( + vi, channel_name, waveform_size, waveform_handle + ) def niFgen_ClearArbMemory(self, vi): # noqa: N802 with self._func_lock: if self.niFgen_ClearArbMemory_cfunc is None: - self.niFgen_ClearArbMemory_cfunc = self._get_library_function('niFgen_ClearArbMemory') + self.niFgen_ClearArbMemory_cfunc = self._get_library_function( + "niFgen_ClearArbMemory" + ) self.niFgen_ClearArbMemory_cfunc.argtypes = [ViSession] # noqa: F405 self.niFgen_ClearArbMemory_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_ClearArbMemory_cfunc(vi) @@ -134,383 +160,904 @@ def niFgen_ClearArbMemory(self, vi): # noqa: N802 def niFgen_ClearArbSequence(self, vi, sequence_handle): # noqa: N802 with self._func_lock: if self.niFgen_ClearArbSequence_cfunc is None: - self.niFgen_ClearArbSequence_cfunc = self._get_library_function('niFgen_ClearArbSequence') - self.niFgen_ClearArbSequence_cfunc.argtypes = [ViSession, ViInt32] # noqa: F405 + self.niFgen_ClearArbSequence_cfunc = self._get_library_function( + "niFgen_ClearArbSequence" + ) + self.niFgen_ClearArbSequence_cfunc.argtypes = [ + ViSession, + ViInt32, + ] # noqa: F405 self.niFgen_ClearArbSequence_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_ClearArbSequence_cfunc(vi, sequence_handle) def niFgen_ClearArbWaveform(self, vi, waveform_handle): # noqa: N802 with self._func_lock: if self.niFgen_ClearArbWaveform_cfunc is None: - self.niFgen_ClearArbWaveform_cfunc = self._get_library_function('niFgen_ClearArbWaveform') - self.niFgen_ClearArbWaveform_cfunc.argtypes = [ViSession, ViInt32] # noqa: F405 + self.niFgen_ClearArbWaveform_cfunc = self._get_library_function( + "niFgen_ClearArbWaveform" + ) + self.niFgen_ClearArbWaveform_cfunc.argtypes = [ + ViSession, + ViInt32, + ] # noqa: F405 self.niFgen_ClearArbWaveform_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_ClearArbWaveform_cfunc(vi, waveform_handle) def niFgen_ClearFreqList(self, vi, frequency_list_handle): # noqa: N802 with self._func_lock: if self.niFgen_ClearFreqList_cfunc is None: - self.niFgen_ClearFreqList_cfunc = self._get_library_function('niFgen_ClearFreqList') - self.niFgen_ClearFreqList_cfunc.argtypes = [ViSession, ViInt32] # noqa: F405 + self.niFgen_ClearFreqList_cfunc = self._get_library_function( + "niFgen_ClearFreqList" + ) + self.niFgen_ClearFreqList_cfunc.argtypes = [ + ViSession, + ViInt32, + ] # noqa: F405 self.niFgen_ClearFreqList_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_ClearFreqList_cfunc(vi, frequency_list_handle) def niFgen_ClearUserStandardWaveform(self, vi, channel_name): # noqa: N802 with self._func_lock: if self.niFgen_ClearUserStandardWaveform_cfunc is None: - self.niFgen_ClearUserStandardWaveform_cfunc = self._get_library_function('niFgen_ClearUserStandardWaveform') - self.niFgen_ClearUserStandardWaveform_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 - self.niFgen_ClearUserStandardWaveform_cfunc.restype = ViStatus # noqa: F405 + self.niFgen_ClearUserStandardWaveform_cfunc = ( + self._get_library_function("niFgen_ClearUserStandardWaveform") + ) + self.niFgen_ClearUserStandardWaveform_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niFgen_ClearUserStandardWaveform_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niFgen_ClearUserStandardWaveform_cfunc(vi, channel_name) def niFgen_Commit(self, vi): # noqa: N802 with self._func_lock: if self.niFgen_Commit_cfunc is None: - self.niFgen_Commit_cfunc = self._get_library_function('niFgen_Commit') + self.niFgen_Commit_cfunc = self._get_library_function("niFgen_Commit") self.niFgen_Commit_cfunc.argtypes = [ViSession] # noqa: F405 self.niFgen_Commit_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_Commit_cfunc(vi) - def niFgen_ConfigureArbSequence(self, vi, channel_name, sequence_handle, gain, offset): # noqa: N802 + def niFgen_ConfigureArbSequence( + self, vi, channel_name, sequence_handle, gain, offset + ): # noqa: N802 with self._func_lock: if self.niFgen_ConfigureArbSequence_cfunc is None: - self.niFgen_ConfigureArbSequence_cfunc = self._get_library_function('niFgen_ConfigureArbSequence') - self.niFgen_ConfigureArbSequence_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViReal64, ViReal64] # noqa: F405 + self.niFgen_ConfigureArbSequence_cfunc = self._get_library_function( + "niFgen_ConfigureArbSequence" + ) + self.niFgen_ConfigureArbSequence_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ViReal64, + ViReal64, + ] # noqa: F405 self.niFgen_ConfigureArbSequence_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_ConfigureArbSequence_cfunc(vi, channel_name, sequence_handle, gain, offset) + return self.niFgen_ConfigureArbSequence_cfunc( + vi, channel_name, sequence_handle, gain, offset + ) - def niFgen_ConfigureArbWaveform(self, vi, channel_name, waveform_handle, gain, offset): # noqa: N802 + def niFgen_ConfigureArbWaveform( + self, vi, channel_name, waveform_handle, gain, offset + ): # noqa: N802 with self._func_lock: if self.niFgen_ConfigureArbWaveform_cfunc is None: - self.niFgen_ConfigureArbWaveform_cfunc = self._get_library_function('niFgen_ConfigureArbWaveform') - self.niFgen_ConfigureArbWaveform_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViReal64, ViReal64] # noqa: F405 + self.niFgen_ConfigureArbWaveform_cfunc = self._get_library_function( + "niFgen_ConfigureArbWaveform" + ) + self.niFgen_ConfigureArbWaveform_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ViReal64, + ViReal64, + ] # noqa: F405 self.niFgen_ConfigureArbWaveform_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_ConfigureArbWaveform_cfunc(vi, channel_name, waveform_handle, gain, offset) + return self.niFgen_ConfigureArbWaveform_cfunc( + vi, channel_name, waveform_handle, gain, offset + ) - def niFgen_ConfigureFreqList(self, vi, channel_name, frequency_list_handle, amplitude, dc_offset, start_phase): # noqa: N802 + def niFgen_ConfigureFreqList( + self, vi, channel_name, frequency_list_handle, amplitude, dc_offset, start_phase + ): # noqa: N802 with self._func_lock: if self.niFgen_ConfigureFreqList_cfunc is None: - self.niFgen_ConfigureFreqList_cfunc = self._get_library_function('niFgen_ConfigureFreqList') - self.niFgen_ConfigureFreqList_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViReal64, ViReal64, ViReal64] # noqa: F405 + self.niFgen_ConfigureFreqList_cfunc = self._get_library_function( + "niFgen_ConfigureFreqList" + ) + self.niFgen_ConfigureFreqList_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ViReal64, + ViReal64, + ViReal64, + ] # noqa: F405 self.niFgen_ConfigureFreqList_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_ConfigureFreqList_cfunc(vi, channel_name, frequency_list_handle, amplitude, dc_offset, start_phase) + return self.niFgen_ConfigureFreqList_cfunc( + vi, channel_name, frequency_list_handle, amplitude, dc_offset, start_phase + ) - def niFgen_ConfigureStandardWaveform(self, vi, channel_name, waveform, amplitude, dc_offset, frequency, start_phase): # noqa: N802 + def niFgen_ConfigureStandardWaveform( + self, vi, channel_name, waveform, amplitude, dc_offset, frequency, start_phase + ): # noqa: N802 with self._func_lock: if self.niFgen_ConfigureStandardWaveform_cfunc is None: - self.niFgen_ConfigureStandardWaveform_cfunc = self._get_library_function('niFgen_ConfigureStandardWaveform') - self.niFgen_ConfigureStandardWaveform_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViReal64, ViReal64, ViReal64, ViReal64] # noqa: F405 - self.niFgen_ConfigureStandardWaveform_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_ConfigureStandardWaveform_cfunc(vi, channel_name, waveform, amplitude, dc_offset, frequency, start_phase) - - def niFgen_CreateAdvancedArbSequence(self, vi, sequence_length, waveform_handles_array, loop_counts_array, sample_counts_array, marker_location_array, coerced_markers_array, sequence_handle): # noqa: N802 + self.niFgen_ConfigureStandardWaveform_cfunc = ( + self._get_library_function("niFgen_ConfigureStandardWaveform") + ) + self.niFgen_ConfigureStandardWaveform_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ViReal64, + ViReal64, + ViReal64, + ViReal64, + ] # noqa: F405 + self.niFgen_ConfigureStandardWaveform_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFgen_ConfigureStandardWaveform_cfunc( + vi, channel_name, waveform, amplitude, dc_offset, frequency, start_phase + ) + + def niFgen_CreateAdvancedArbSequence( + self, + vi, + sequence_length, + waveform_handles_array, + loop_counts_array, + sample_counts_array, + marker_location_array, + coerced_markers_array, + sequence_handle, + ): # noqa: N802 with self._func_lock: if self.niFgen_CreateAdvancedArbSequence_cfunc is None: - self.niFgen_CreateAdvancedArbSequence_cfunc = self._get_library_function('niFgen_CreateAdvancedArbSequence') - self.niFgen_CreateAdvancedArbSequence_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 - self.niFgen_CreateAdvancedArbSequence_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_CreateAdvancedArbSequence_cfunc(vi, sequence_length, waveform_handles_array, loop_counts_array, sample_counts_array, marker_location_array, coerced_markers_array, sequence_handle) - - def niFgen_CreateArbSequence(self, vi, sequence_length, waveform_handles_array, loop_counts_array, sequence_handle): # noqa: N802 + self.niFgen_CreateAdvancedArbSequence_cfunc = ( + self._get_library_function("niFgen_CreateAdvancedArbSequence") + ) + self.niFgen_CreateAdvancedArbSequence_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niFgen_CreateAdvancedArbSequence_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFgen_CreateAdvancedArbSequence_cfunc( + vi, + sequence_length, + waveform_handles_array, + loop_counts_array, + sample_counts_array, + marker_location_array, + coerced_markers_array, + sequence_handle, + ) + + def niFgen_CreateArbSequence( + self, + vi, + sequence_length, + waveform_handles_array, + loop_counts_array, + sequence_handle, + ): # noqa: N802 with self._func_lock: if self.niFgen_CreateArbSequence_cfunc is None: - self.niFgen_CreateArbSequence_cfunc = self._get_library_function('niFgen_CreateArbSequence') - self.niFgen_CreateArbSequence_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niFgen_CreateArbSequence_cfunc = self._get_library_function( + "niFgen_CreateArbSequence" + ) + self.niFgen_CreateArbSequence_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niFgen_CreateArbSequence_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_CreateArbSequence_cfunc(vi, sequence_length, waveform_handles_array, loop_counts_array, sequence_handle) - - def niFgen_CreateFreqList(self, vi, waveform, frequency_list_length, frequency_array, duration_array, frequency_list_handle): # noqa: N802 + return self.niFgen_CreateArbSequence_cfunc( + vi, + sequence_length, + waveform_handles_array, + loop_counts_array, + sequence_handle, + ) + + def niFgen_CreateFreqList( + self, + vi, + waveform, + frequency_list_length, + frequency_array, + duration_array, + frequency_list_handle, + ): # noqa: N802 with self._func_lock: if self.niFgen_CreateFreqList_cfunc is None: - self.niFgen_CreateFreqList_cfunc = self._get_library_function('niFgen_CreateFreqList') - self.niFgen_CreateFreqList_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niFgen_CreateFreqList_cfunc = self._get_library_function( + "niFgen_CreateFreqList" + ) + self.niFgen_CreateFreqList_cfunc.argtypes = [ + ViSession, + ViInt32, + ViInt32, + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niFgen_CreateFreqList_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_CreateFreqList_cfunc(vi, waveform, frequency_list_length, frequency_array, duration_array, frequency_list_handle) - - def niFgen_CreateWaveformF64(self, vi, channel_name, waveform_size, waveform_data_array, waveform_handle): # noqa: N802 + return self.niFgen_CreateFreqList_cfunc( + vi, + waveform, + frequency_list_length, + frequency_array, + duration_array, + frequency_list_handle, + ) + + def niFgen_CreateWaveformF64( + self, vi, channel_name, waveform_size, waveform_data_array, waveform_handle + ): # noqa: N802 with self._func_lock: if self.niFgen_CreateWaveformF64_cfunc is None: - self.niFgen_CreateWaveformF64_cfunc = self._get_library_function('niFgen_CreateWaveformF64') - self.niFgen_CreateWaveformF64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niFgen_CreateWaveformF64_cfunc = self._get_library_function( + "niFgen_CreateWaveformF64" + ) + self.niFgen_CreateWaveformF64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niFgen_CreateWaveformF64_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_CreateWaveformF64_cfunc(vi, channel_name, waveform_size, waveform_data_array, waveform_handle) + return self.niFgen_CreateWaveformF64_cfunc( + vi, channel_name, waveform_size, waveform_data_array, waveform_handle + ) - def niFgen_CreateWaveformFromFileF64(self, vi, channel_name, file_name, byte_order, waveform_handle): # noqa: N802 + def niFgen_CreateWaveformFromFileF64( + self, vi, channel_name, file_name, byte_order, waveform_handle + ): # noqa: N802 with self._func_lock: if self.niFgen_CreateWaveformFromFileF64_cfunc is None: - self.niFgen_CreateWaveformFromFileF64_cfunc = self._get_library_function('niFgen_CreateWaveformFromFileF64') - self.niFgen_CreateWaveformFromFileF64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViInt32)] # noqa: F405 - self.niFgen_CreateWaveformFromFileF64_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_CreateWaveformFromFileF64_cfunc(vi, channel_name, file_name, byte_order, waveform_handle) - - def niFgen_CreateWaveformFromFileI16(self, vi, channel_name, file_name, byte_order, waveform_handle): # noqa: N802 + self.niFgen_CreateWaveformFromFileF64_cfunc = ( + self._get_library_function("niFgen_CreateWaveformFromFileF64") + ) + self.niFgen_CreateWaveformFromFileF64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niFgen_CreateWaveformFromFileF64_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFgen_CreateWaveformFromFileF64_cfunc( + vi, channel_name, file_name, byte_order, waveform_handle + ) + + def niFgen_CreateWaveformFromFileI16( + self, vi, channel_name, file_name, byte_order, waveform_handle + ): # noqa: N802 with self._func_lock: if self.niFgen_CreateWaveformFromFileI16_cfunc is None: - self.niFgen_CreateWaveformFromFileI16_cfunc = self._get_library_function('niFgen_CreateWaveformFromFileI16') - self.niFgen_CreateWaveformFromFileI16_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViInt32)] # noqa: F405 - self.niFgen_CreateWaveformFromFileI16_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_CreateWaveformFromFileI16_cfunc(vi, channel_name, file_name, byte_order, waveform_handle) - - def niFgen_CreateWaveformI16(self, vi, channel_name, waveform_size, waveform_data_array, waveform_handle): # noqa: N802 + self.niFgen_CreateWaveformFromFileI16_cfunc = ( + self._get_library_function("niFgen_CreateWaveformFromFileI16") + ) + self.niFgen_CreateWaveformFromFileI16_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niFgen_CreateWaveformFromFileI16_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFgen_CreateWaveformFromFileI16_cfunc( + vi, channel_name, file_name, byte_order, waveform_handle + ) + + def niFgen_CreateWaveformI16( + self, vi, channel_name, waveform_size, waveform_data_array, waveform_handle + ): # noqa: N802 with self._func_lock: if self.niFgen_CreateWaveformI16_cfunc is None: - self.niFgen_CreateWaveformI16_cfunc = self._get_library_function('niFgen_CreateWaveformI16') - self.niFgen_CreateWaveformI16_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViInt16), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niFgen_CreateWaveformI16_cfunc = self._get_library_function( + "niFgen_CreateWaveformI16" + ) + self.niFgen_CreateWaveformI16_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViInt16), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niFgen_CreateWaveformI16_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_CreateWaveformI16_cfunc(vi, channel_name, waveform_size, waveform_data_array, waveform_handle) + return self.niFgen_CreateWaveformI16_cfunc( + vi, channel_name, waveform_size, waveform_data_array, waveform_handle + ) - def niFgen_DefineUserStandardWaveform(self, vi, channel_name, waveform_size, waveform_data_array): # noqa: N802 + def niFgen_DefineUserStandardWaveform( + self, vi, channel_name, waveform_size, waveform_data_array + ): # noqa: N802 with self._func_lock: if self.niFgen_DefineUserStandardWaveform_cfunc is None: - self.niFgen_DefineUserStandardWaveform_cfunc = self._get_library_function('niFgen_DefineUserStandardWaveform') - self.niFgen_DefineUserStandardWaveform_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 - self.niFgen_DefineUserStandardWaveform_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_DefineUserStandardWaveform_cfunc(vi, channel_name, waveform_size, waveform_data_array) + self.niFgen_DefineUserStandardWaveform_cfunc = ( + self._get_library_function("niFgen_DefineUserStandardWaveform") + ) + self.niFgen_DefineUserStandardWaveform_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViReal64), + ] # noqa: F405 + self.niFgen_DefineUserStandardWaveform_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFgen_DefineUserStandardWaveform_cfunc( + vi, channel_name, waveform_size, waveform_data_array + ) def niFgen_DeleteNamedWaveform(self, vi, channel_name, waveform_name): # noqa: N802 with self._func_lock: if self.niFgen_DeleteNamedWaveform_cfunc is None: - self.niFgen_DeleteNamedWaveform_cfunc = self._get_library_function('niFgen_DeleteNamedWaveform') - self.niFgen_DeleteNamedWaveform_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar)] # noqa: F405 + self.niFgen_DeleteNamedWaveform_cfunc = self._get_library_function( + "niFgen_DeleteNamedWaveform" + ) + self.niFgen_DeleteNamedWaveform_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niFgen_DeleteNamedWaveform_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_DeleteNamedWaveform_cfunc(vi, channel_name, waveform_name) def niFgen_DeleteScript(self, vi, channel_name, script_name): # noqa: N802 with self._func_lock: if self.niFgen_DeleteScript_cfunc is None: - self.niFgen_DeleteScript_cfunc = self._get_library_function('niFgen_DeleteScript') - self.niFgen_DeleteScript_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar)] # noqa: F405 + self.niFgen_DeleteScript_cfunc = self._get_library_function( + "niFgen_DeleteScript" + ) + self.niFgen_DeleteScript_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niFgen_DeleteScript_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_DeleteScript_cfunc(vi, channel_name, script_name) def niFgen_Disable(self, vi): # noqa: N802 with self._func_lock: if self.niFgen_Disable_cfunc is None: - self.niFgen_Disable_cfunc = self._get_library_function('niFgen_Disable') + self.niFgen_Disable_cfunc = self._get_library_function("niFgen_Disable") self.niFgen_Disable_cfunc.argtypes = [ViSession] # noqa: F405 self.niFgen_Disable_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_Disable_cfunc(vi) - def niFgen_ExportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 + def niFgen_ExportAttributeConfigurationBuffer( + self, vi, size_in_bytes, configuration + ): # noqa: N802 with self._func_lock: if self.niFgen_ExportAttributeConfigurationBuffer_cfunc is None: - self.niFgen_ExportAttributeConfigurationBuffer_cfunc = self._get_library_function('niFgen_ExportAttributeConfigurationBuffer') - self.niFgen_ExportAttributeConfigurationBuffer_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt8)] # noqa: F405 - self.niFgen_ExportAttributeConfigurationBuffer_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_ExportAttributeConfigurationBuffer_cfunc(vi, size_in_bytes, configuration) + self.niFgen_ExportAttributeConfigurationBuffer_cfunc = ( + self._get_library_function( + "niFgen_ExportAttributeConfigurationBuffer" + ) + ) + self.niFgen_ExportAttributeConfigurationBuffer_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViInt8), + ] # noqa: F405 + self.niFgen_ExportAttributeConfigurationBuffer_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFgen_ExportAttributeConfigurationBuffer_cfunc( + vi, size_in_bytes, configuration + ) def niFgen_ExportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niFgen_ExportAttributeConfigurationFile_cfunc is None: - self.niFgen_ExportAttributeConfigurationFile_cfunc = self._get_library_function('niFgen_ExportAttributeConfigurationFile') - self.niFgen_ExportAttributeConfigurationFile_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 - self.niFgen_ExportAttributeConfigurationFile_cfunc.restype = ViStatus # noqa: F405 + self.niFgen_ExportAttributeConfigurationFile_cfunc = ( + self._get_library_function( + "niFgen_ExportAttributeConfigurationFile" + ) + ) + self.niFgen_ExportAttributeConfigurationFile_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niFgen_ExportAttributeConfigurationFile_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niFgen_ExportAttributeConfigurationFile_cfunc(vi, file_path) - def niFgen_GetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niFgen_GetAttributeViBoolean( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niFgen_GetAttributeViBoolean_cfunc is None: - self.niFgen_GetAttributeViBoolean_cfunc = self._get_library_function('niFgen_GetAttributeViBoolean') - self.niFgen_GetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niFgen_GetAttributeViBoolean_cfunc = self._get_library_function( + "niFgen_GetAttributeViBoolean" + ) + self.niFgen_GetAttributeViBoolean_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niFgen_GetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_GetAttributeViBoolean_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niFgen_GetAttributeViBoolean_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niFgen_GetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niFgen_GetAttributeViInt32( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niFgen_GetAttributeViInt32_cfunc is None: - self.niFgen_GetAttributeViInt32_cfunc = self._get_library_function('niFgen_GetAttributeViInt32') - self.niFgen_GetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViInt32)] # noqa: F405 + self.niFgen_GetAttributeViInt32_cfunc = self._get_library_function( + "niFgen_GetAttributeViInt32" + ) + self.niFgen_GetAttributeViInt32_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niFgen_GetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_GetAttributeViInt32_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niFgen_GetAttributeViInt32_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niFgen_GetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niFgen_GetAttributeViReal64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niFgen_GetAttributeViReal64_cfunc is None: - self.niFgen_GetAttributeViReal64_cfunc = self._get_library_function('niFgen_GetAttributeViReal64') - self.niFgen_GetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niFgen_GetAttributeViReal64_cfunc = self._get_library_function( + "niFgen_GetAttributeViReal64" + ) + self.niFgen_GetAttributeViReal64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niFgen_GetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_GetAttributeViReal64_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niFgen_GetAttributeViReal64_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niFgen_GetAttributeViString(self, vi, channel_name, attribute_id, array_size, attribute_value): # noqa: N802 + def niFgen_GetAttributeViString( + self, vi, channel_name, attribute_id, array_size, attribute_value + ): # noqa: N802 with self._func_lock: if self.niFgen_GetAttributeViString_cfunc is None: - self.niFgen_GetAttributeViString_cfunc = self._get_library_function('niFgen_GetAttributeViString') - self.niFgen_GetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niFgen_GetAttributeViString_cfunc = self._get_library_function( + "niFgen_GetAttributeViString" + ) + self.niFgen_GetAttributeViString_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niFgen_GetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_GetAttributeViString_cfunc(vi, channel_name, attribute_id, array_size, attribute_value) + return self.niFgen_GetAttributeViString_cfunc( + vi, channel_name, attribute_id, array_size, attribute_value + ) - def niFgen_GetChannelName(self, vi, index, buffer_size, channel_string): # noqa: N802 + def niFgen_GetChannelName( + self, vi, index, buffer_size, channel_string + ): # noqa: N802 with self._func_lock: if self.niFgen_GetChannelName_cfunc is None: - self.niFgen_GetChannelName_cfunc = self._get_library_function('niFgen_GetChannelName') - self.niFgen_GetChannelName_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niFgen_GetChannelName_cfunc = self._get_library_function( + "niFgen_GetChannelName" + ) + self.niFgen_GetChannelName_cfunc.argtypes = [ + ViSession, + ViInt32, + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niFgen_GetChannelName_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_GetChannelName_cfunc(vi, index, buffer_size, channel_string) - def niFgen_GetError(self, vi, error_code, error_description_buffer_size, error_description): # noqa: N802 + def niFgen_GetError( + self, vi, error_code, error_description_buffer_size, error_description + ): # noqa: N802 with self._func_lock: if self.niFgen_GetError_cfunc is None: - self.niFgen_GetError_cfunc = self._get_library_function('niFgen_GetError') - self.niFgen_GetError_cfunc.argtypes = [ViSession, ctypes.POINTER(ViStatus), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niFgen_GetError_cfunc = self._get_library_function( + "niFgen_GetError" + ) + self.niFgen_GetError_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViStatus), + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niFgen_GetError_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_GetError_cfunc(vi, error_code, error_description_buffer_size, error_description) + return self.niFgen_GetError_cfunc( + vi, error_code, error_description_buffer_size, error_description + ) - def niFgen_GetExtCalLastDateAndTime(self, vi, year, month, day, hour, minute): # noqa: N802 + def niFgen_GetExtCalLastDateAndTime( + self, vi, year, month, day, hour, minute + ): # noqa: N802 with self._func_lock: if self.niFgen_GetExtCalLastDateAndTime_cfunc is None: - self.niFgen_GetExtCalLastDateAndTime_cfunc = self._get_library_function('niFgen_GetExtCalLastDateAndTime') - self.niFgen_GetExtCalLastDateAndTime_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 - self.niFgen_GetExtCalLastDateAndTime_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_GetExtCalLastDateAndTime_cfunc(vi, year, month, day, hour, minute) + self.niFgen_GetExtCalLastDateAndTime_cfunc = self._get_library_function( + "niFgen_GetExtCalLastDateAndTime" + ) + self.niFgen_GetExtCalLastDateAndTime_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niFgen_GetExtCalLastDateAndTime_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFgen_GetExtCalLastDateAndTime_cfunc( + vi, year, month, day, hour, minute + ) def niFgen_GetExtCalLastTemp(self, vi, temperature): # noqa: N802 with self._func_lock: if self.niFgen_GetExtCalLastTemp_cfunc is None: - self.niFgen_GetExtCalLastTemp_cfunc = self._get_library_function('niFgen_GetExtCalLastTemp') - self.niFgen_GetExtCalLastTemp_cfunc.argtypes = [ViSession, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niFgen_GetExtCalLastTemp_cfunc = self._get_library_function( + "niFgen_GetExtCalLastTemp" + ) + self.niFgen_GetExtCalLastTemp_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niFgen_GetExtCalLastTemp_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_GetExtCalLastTemp_cfunc(vi, temperature) def niFgen_GetExtCalRecommendedInterval(self, vi, months): # noqa: N802 with self._func_lock: if self.niFgen_GetExtCalRecommendedInterval_cfunc is None: - self.niFgen_GetExtCalRecommendedInterval_cfunc = self._get_library_function('niFgen_GetExtCalRecommendedInterval') - self.niFgen_GetExtCalRecommendedInterval_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32)] # noqa: F405 - self.niFgen_GetExtCalRecommendedInterval_cfunc.restype = ViStatus # noqa: F405 + self.niFgen_GetExtCalRecommendedInterval_cfunc = ( + self._get_library_function("niFgen_GetExtCalRecommendedInterval") + ) + self.niFgen_GetExtCalRecommendedInterval_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niFgen_GetExtCalRecommendedInterval_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niFgen_GetExtCalRecommendedInterval_cfunc(vi, months) def niFgen_GetHardwareState(self, vi, state): # noqa: N802 with self._func_lock: if self.niFgen_GetHardwareState_cfunc is None: - self.niFgen_GetHardwareState_cfunc = self._get_library_function('niFgen_GetHardwareState') - self.niFgen_GetHardwareState_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32)] # noqa: F405 + self.niFgen_GetHardwareState_cfunc = self._get_library_function( + "niFgen_GetHardwareState" + ) + self.niFgen_GetHardwareState_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niFgen_GetHardwareState_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_GetHardwareState_cfunc(vi, state) def niFgen_GetLastExtCalLastDateAndTime(self, vi, month): # noqa: N802 with self._func_lock: if self.niFgen_GetLastExtCalLastDateAndTime_cfunc is None: - self.niFgen_GetLastExtCalLastDateAndTime_cfunc = self._get_library_function('niFgen_GetLastExtCalLastDateAndTime') - self.niFgen_GetLastExtCalLastDateAndTime_cfunc.argtypes = [ViSession, ctypes.POINTER(hightime.datetime)] # noqa: F405 - self.niFgen_GetLastExtCalLastDateAndTime_cfunc.restype = ViStatus # noqa: F405 + self.niFgen_GetLastExtCalLastDateAndTime_cfunc = ( + self._get_library_function("niFgen_GetLastExtCalLastDateAndTime") + ) + self.niFgen_GetLastExtCalLastDateAndTime_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(hightime.datetime), + ] # noqa: F405 + self.niFgen_GetLastExtCalLastDateAndTime_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niFgen_GetLastExtCalLastDateAndTime_cfunc(vi, month) def niFgen_GetLastSelfCalLastDateAndTime(self, vi, month): # noqa: N802 with self._func_lock: if self.niFgen_GetLastSelfCalLastDateAndTime_cfunc is None: - self.niFgen_GetLastSelfCalLastDateAndTime_cfunc = self._get_library_function('niFgen_GetLastSelfCalLastDateAndTime') - self.niFgen_GetLastSelfCalLastDateAndTime_cfunc.argtypes = [ViSession, ctypes.POINTER(hightime.datetime)] # noqa: F405 - self.niFgen_GetLastSelfCalLastDateAndTime_cfunc.restype = ViStatus # noqa: F405 + self.niFgen_GetLastSelfCalLastDateAndTime_cfunc = ( + self._get_library_function("niFgen_GetLastSelfCalLastDateAndTime") + ) + self.niFgen_GetLastSelfCalLastDateAndTime_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(hightime.datetime), + ] # noqa: F405 + self.niFgen_GetLastSelfCalLastDateAndTime_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niFgen_GetLastSelfCalLastDateAndTime_cfunc(vi, month) - def niFgen_GetSelfCalLastDateAndTime(self, vi, year, month, day, hour, minute): # noqa: N802 + def niFgen_GetSelfCalLastDateAndTime( + self, vi, year, month, day, hour, minute + ): # noqa: N802 with self._func_lock: if self.niFgen_GetSelfCalLastDateAndTime_cfunc is None: - self.niFgen_GetSelfCalLastDateAndTime_cfunc = self._get_library_function('niFgen_GetSelfCalLastDateAndTime') - self.niFgen_GetSelfCalLastDateAndTime_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 - self.niFgen_GetSelfCalLastDateAndTime_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_GetSelfCalLastDateAndTime_cfunc(vi, year, month, day, hour, minute) + self.niFgen_GetSelfCalLastDateAndTime_cfunc = ( + self._get_library_function("niFgen_GetSelfCalLastDateAndTime") + ) + self.niFgen_GetSelfCalLastDateAndTime_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niFgen_GetSelfCalLastDateAndTime_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFgen_GetSelfCalLastDateAndTime_cfunc( + vi, year, month, day, hour, minute + ) def niFgen_GetSelfCalLastTemp(self, vi, temperature): # noqa: N802 with self._func_lock: if self.niFgen_GetSelfCalLastTemp_cfunc is None: - self.niFgen_GetSelfCalLastTemp_cfunc = self._get_library_function('niFgen_GetSelfCalLastTemp') - self.niFgen_GetSelfCalLastTemp_cfunc.argtypes = [ViSession, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niFgen_GetSelfCalLastTemp_cfunc = self._get_library_function( + "niFgen_GetSelfCalLastTemp" + ) + self.niFgen_GetSelfCalLastTemp_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niFgen_GetSelfCalLastTemp_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_GetSelfCalLastTemp_cfunc(vi, temperature) def niFgen_GetSelfCalSupported(self, vi, self_cal_supported): # noqa: N802 with self._func_lock: if self.niFgen_GetSelfCalSupported_cfunc is None: - self.niFgen_GetSelfCalSupported_cfunc = self._get_library_function('niFgen_GetSelfCalSupported') - self.niFgen_GetSelfCalSupported_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niFgen_GetSelfCalSupported_cfunc = self._get_library_function( + "niFgen_GetSelfCalSupported" + ) + self.niFgen_GetSelfCalSupported_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niFgen_GetSelfCalSupported_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_GetSelfCalSupported_cfunc(vi, self_cal_supported) - def niFgen_ImportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 + def niFgen_ImportAttributeConfigurationBuffer( + self, vi, size_in_bytes, configuration + ): # noqa: N802 with self._func_lock: if self.niFgen_ImportAttributeConfigurationBuffer_cfunc is None: - self.niFgen_ImportAttributeConfigurationBuffer_cfunc = self._get_library_function('niFgen_ImportAttributeConfigurationBuffer') - self.niFgen_ImportAttributeConfigurationBuffer_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt8)] # noqa: F405 - self.niFgen_ImportAttributeConfigurationBuffer_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_ImportAttributeConfigurationBuffer_cfunc(vi, size_in_bytes, configuration) + self.niFgen_ImportAttributeConfigurationBuffer_cfunc = ( + self._get_library_function( + "niFgen_ImportAttributeConfigurationBuffer" + ) + ) + self.niFgen_ImportAttributeConfigurationBuffer_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViInt8), + ] # noqa: F405 + self.niFgen_ImportAttributeConfigurationBuffer_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFgen_ImportAttributeConfigurationBuffer_cfunc( + vi, size_in_bytes, configuration + ) def niFgen_ImportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niFgen_ImportAttributeConfigurationFile_cfunc is None: - self.niFgen_ImportAttributeConfigurationFile_cfunc = self._get_library_function('niFgen_ImportAttributeConfigurationFile') - self.niFgen_ImportAttributeConfigurationFile_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 - self.niFgen_ImportAttributeConfigurationFile_cfunc.restype = ViStatus # noqa: F405 + self.niFgen_ImportAttributeConfigurationFile_cfunc = ( + self._get_library_function( + "niFgen_ImportAttributeConfigurationFile" + ) + ) + self.niFgen_ImportAttributeConfigurationFile_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niFgen_ImportAttributeConfigurationFile_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niFgen_ImportAttributeConfigurationFile_cfunc(vi, file_path) - def niFgen_InitializeWithChannels(self, resource_name, channel_name, reset_device, option_string, vi): # noqa: N802 + def niFgen_InitializeWithChannels( + self, resource_name, channel_name, reset_device, option_string, vi + ): # noqa: N802 with self._func_lock: if self.niFgen_InitializeWithChannels_cfunc is None: - self.niFgen_InitializeWithChannels_cfunc = self._get_library_function('niFgen_InitializeWithChannels') - self.niFgen_InitializeWithChannels_cfunc.argtypes = [ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViBoolean, ctypes.POINTER(ViChar), ctypes.POINTER(ViSession)] # noqa: F405 - self.niFgen_InitializeWithChannels_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_InitializeWithChannels_cfunc(resource_name, channel_name, reset_device, option_string, vi) + self.niFgen_InitializeWithChannels_cfunc = self._get_library_function( + "niFgen_InitializeWithChannels" + ) + self.niFgen_InitializeWithChannels_cfunc.argtypes = [ + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViBoolean, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViSession), + ] # noqa: F405 + self.niFgen_InitializeWithChannels_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFgen_InitializeWithChannels_cfunc( + resource_name, channel_name, reset_device, option_string, vi + ) def niFgen_InitiateGeneration(self, vi): # noqa: N802 with self._func_lock: if self.niFgen_InitiateGeneration_cfunc is None: - self.niFgen_InitiateGeneration_cfunc = self._get_library_function('niFgen_InitiateGeneration') - self.niFgen_InitiateGeneration_cfunc.argtypes = [ViSession] # noqa: F405 + self.niFgen_InitiateGeneration_cfunc = self._get_library_function( + "niFgen_InitiateGeneration" + ) + self.niFgen_InitiateGeneration_cfunc.argtypes = [ + ViSession + ] # noqa: F405 self.niFgen_InitiateGeneration_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_InitiateGeneration_cfunc(vi) def niFgen_IsDone(self, vi, done): # noqa: N802 with self._func_lock: if self.niFgen_IsDone_cfunc is None: - self.niFgen_IsDone_cfunc = self._get_library_function('niFgen_IsDone') - self.niFgen_IsDone_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niFgen_IsDone_cfunc = self._get_library_function("niFgen_IsDone") + self.niFgen_IsDone_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niFgen_IsDone_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_IsDone_cfunc(vi, done) def niFgen_LockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niFgen_LockSession_cfunc is None: - self.niFgen_LockSession_cfunc = self._get_library_function('niFgen_LockSession') - self.niFgen_LockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niFgen_LockSession_cfunc = self._get_library_function( + "niFgen_LockSession" + ) + self.niFgen_LockSession_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niFgen_LockSession_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_LockSession_cfunc(vi, caller_has_lock) - def niFgen_QueryArbSeqCapabilities(self, vi, maximum_number_of_sequences, minimum_sequence_length, maximum_sequence_length, maximum_loop_count): # noqa: N802 + def niFgen_QueryArbSeqCapabilities( + self, + vi, + maximum_number_of_sequences, + minimum_sequence_length, + maximum_sequence_length, + maximum_loop_count, + ): # noqa: N802 with self._func_lock: if self.niFgen_QueryArbSeqCapabilities_cfunc is None: - self.niFgen_QueryArbSeqCapabilities_cfunc = self._get_library_function('niFgen_QueryArbSeqCapabilities') - self.niFgen_QueryArbSeqCapabilities_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 - self.niFgen_QueryArbSeqCapabilities_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_QueryArbSeqCapabilities_cfunc(vi, maximum_number_of_sequences, minimum_sequence_length, maximum_sequence_length, maximum_loop_count) - - def niFgen_QueryArbWfmCapabilities(self, vi, maximum_number_of_waveforms, waveform_quantum, minimum_waveform_size, maximum_waveform_size): # noqa: N802 + self.niFgen_QueryArbSeqCapabilities_cfunc = self._get_library_function( + "niFgen_QueryArbSeqCapabilities" + ) + self.niFgen_QueryArbSeqCapabilities_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niFgen_QueryArbSeqCapabilities_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFgen_QueryArbSeqCapabilities_cfunc( + vi, + maximum_number_of_sequences, + minimum_sequence_length, + maximum_sequence_length, + maximum_loop_count, + ) + + def niFgen_QueryArbWfmCapabilities( + self, + vi, + maximum_number_of_waveforms, + waveform_quantum, + minimum_waveform_size, + maximum_waveform_size, + ): # noqa: N802 with self._func_lock: if self.niFgen_QueryArbWfmCapabilities_cfunc is None: - self.niFgen_QueryArbWfmCapabilities_cfunc = self._get_library_function('niFgen_QueryArbWfmCapabilities') - self.niFgen_QueryArbWfmCapabilities_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 - self.niFgen_QueryArbWfmCapabilities_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_QueryArbWfmCapabilities_cfunc(vi, maximum_number_of_waveforms, waveform_quantum, minimum_waveform_size, maximum_waveform_size) - - def niFgen_QueryFreqListCapabilities(self, vi, maximum_number_of_freq_lists, minimum_frequency_list_length, maximum_frequency_list_length, minimum_frequency_list_duration, maximum_frequency_list_duration, frequency_list_duration_quantum): # noqa: N802 + self.niFgen_QueryArbWfmCapabilities_cfunc = self._get_library_function( + "niFgen_QueryArbWfmCapabilities" + ) + self.niFgen_QueryArbWfmCapabilities_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niFgen_QueryArbWfmCapabilities_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFgen_QueryArbWfmCapabilities_cfunc( + vi, + maximum_number_of_waveforms, + waveform_quantum, + minimum_waveform_size, + maximum_waveform_size, + ) + + def niFgen_QueryFreqListCapabilities( + self, + vi, + maximum_number_of_freq_lists, + minimum_frequency_list_length, + maximum_frequency_list_length, + minimum_frequency_list_duration, + maximum_frequency_list_duration, + frequency_list_duration_quantum, + ): # noqa: N802 with self._func_lock: if self.niFgen_QueryFreqListCapabilities_cfunc is None: - self.niFgen_QueryFreqListCapabilities_cfunc = self._get_library_function('niFgen_QueryFreqListCapabilities') - self.niFgen_QueryFreqListCapabilities_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64)] # noqa: F405 - self.niFgen_QueryFreqListCapabilities_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_QueryFreqListCapabilities_cfunc(vi, maximum_number_of_freq_lists, minimum_frequency_list_length, maximum_frequency_list_length, minimum_frequency_list_duration, maximum_frequency_list_duration, frequency_list_duration_quantum) + self.niFgen_QueryFreqListCapabilities_cfunc = ( + self._get_library_function("niFgen_QueryFreqListCapabilities") + ) + self.niFgen_QueryFreqListCapabilities_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViReal64), + ] # noqa: F405 + self.niFgen_QueryFreqListCapabilities_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFgen_QueryFreqListCapabilities_cfunc( + vi, + maximum_number_of_freq_lists, + minimum_frequency_list_length, + maximum_frequency_list_length, + minimum_frequency_list_duration, + maximum_frequency_list_duration, + frequency_list_duration_quantum, + ) def niFgen_ReadCurrentTemperature(self, vi, temperature): # noqa: N802 with self._func_lock: if self.niFgen_ReadCurrentTemperature_cfunc is None: - self.niFgen_ReadCurrentTemperature_cfunc = self._get_library_function('niFgen_ReadCurrentTemperature') - self.niFgen_ReadCurrentTemperature_cfunc.argtypes = [ViSession, ctypes.POINTER(ViReal64)] # noqa: F405 - self.niFgen_ReadCurrentTemperature_cfunc.restype = ViStatus # noqa: F405 + self.niFgen_ReadCurrentTemperature_cfunc = self._get_library_function( + "niFgen_ReadCurrentTemperature" + ) + self.niFgen_ReadCurrentTemperature_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViReal64), + ] # noqa: F405 + self.niFgen_ReadCurrentTemperature_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niFgen_ReadCurrentTemperature_cfunc(vi, temperature) def niFgen_ResetDevice(self, vi): # noqa: N802 with self._func_lock: if self.niFgen_ResetDevice_cfunc is None: - self.niFgen_ResetDevice_cfunc = self._get_library_function('niFgen_ResetDevice') + self.niFgen_ResetDevice_cfunc = self._get_library_function( + "niFgen_ResetDevice" + ) self.niFgen_ResetDevice_cfunc.argtypes = [ViSession] # noqa: F405 self.niFgen_ResetDevice_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_ResetDevice_cfunc(vi) @@ -518,7 +1065,9 @@ def niFgen_ResetDevice(self, vi): # noqa: N802 def niFgen_ResetWithDefaults(self, vi): # noqa: N802 with self._func_lock: if self.niFgen_ResetWithDefaults_cfunc is None: - self.niFgen_ResetWithDefaults_cfunc = self._get_library_function('niFgen_ResetWithDefaults') + self.niFgen_ResetWithDefaults_cfunc = self._get_library_function( + "niFgen_ResetWithDefaults" + ) self.niFgen_ResetWithDefaults_cfunc.argtypes = [ViSession] # noqa: F405 self.niFgen_ResetWithDefaults_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_ResetWithDefaults_cfunc(vi) @@ -526,7 +1075,7 @@ def niFgen_ResetWithDefaults(self, vi): # noqa: N802 def niFgen_SelfCal(self, vi): # noqa: N802 with self._func_lock: if self.niFgen_SelfCal_cfunc is None: - self.niFgen_SelfCal_cfunc = self._get_library_function('niFgen_SelfCal') + self.niFgen_SelfCal_cfunc = self._get_library_function("niFgen_SelfCal") self.niFgen_SelfCal_cfunc.argtypes = [ViSession] # noqa: F405 self.niFgen_SelfCal_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_SelfCal_cfunc(vi) @@ -534,119 +1083,265 @@ def niFgen_SelfCal(self, vi): # noqa: N802 def niFgen_SendSoftwareEdgeTrigger(self, vi, trigger, trigger_id): # noqa: N802 with self._func_lock: if self.niFgen_SendSoftwareEdgeTrigger_cfunc is None: - self.niFgen_SendSoftwareEdgeTrigger_cfunc = self._get_library_function('niFgen_SendSoftwareEdgeTrigger') - self.niFgen_SendSoftwareEdgeTrigger_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 - self.niFgen_SendSoftwareEdgeTrigger_cfunc.restype = ViStatus # noqa: F405 + self.niFgen_SendSoftwareEdgeTrigger_cfunc = self._get_library_function( + "niFgen_SendSoftwareEdgeTrigger" + ) + self.niFgen_SendSoftwareEdgeTrigger_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niFgen_SendSoftwareEdgeTrigger_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niFgen_SendSoftwareEdgeTrigger_cfunc(vi, trigger, trigger_id) - def niFgen_SetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niFgen_SetAttributeViBoolean( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niFgen_SetAttributeViBoolean_cfunc is None: - self.niFgen_SetAttributeViBoolean_cfunc = self._get_library_function('niFgen_SetAttributeViBoolean') - self.niFgen_SetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViBoolean] # noqa: F405 + self.niFgen_SetAttributeViBoolean_cfunc = self._get_library_function( + "niFgen_SetAttributeViBoolean" + ) + self.niFgen_SetAttributeViBoolean_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViBoolean, + ] # noqa: F405 self.niFgen_SetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_SetAttributeViBoolean_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niFgen_SetAttributeViBoolean_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niFgen_SetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niFgen_SetAttributeViInt32( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niFgen_SetAttributeViInt32_cfunc is None: - self.niFgen_SetAttributeViInt32_cfunc = self._get_library_function('niFgen_SetAttributeViInt32') - self.niFgen_SetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32] # noqa: F405 + self.niFgen_SetAttributeViInt32_cfunc = self._get_library_function( + "niFgen_SetAttributeViInt32" + ) + self.niFgen_SetAttributeViInt32_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViInt32, + ] # noqa: F405 self.niFgen_SetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_SetAttributeViInt32_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niFgen_SetAttributeViInt32_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niFgen_SetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niFgen_SetAttributeViReal64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niFgen_SetAttributeViReal64_cfunc is None: - self.niFgen_SetAttributeViReal64_cfunc = self._get_library_function('niFgen_SetAttributeViReal64') - self.niFgen_SetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViReal64] # noqa: F405 + self.niFgen_SetAttributeViReal64_cfunc = self._get_library_function( + "niFgen_SetAttributeViReal64" + ) + self.niFgen_SetAttributeViReal64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViReal64, + ] # noqa: F405 self.niFgen_SetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_SetAttributeViReal64_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niFgen_SetAttributeViReal64_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niFgen_SetAttributeViString(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niFgen_SetAttributeViString( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niFgen_SetAttributeViString_cfunc is None: - self.niFgen_SetAttributeViString_cfunc = self._get_library_function('niFgen_SetAttributeViString') - self.niFgen_SetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViChar)] # noqa: F405 + self.niFgen_SetAttributeViString_cfunc = self._get_library_function( + "niFgen_SetAttributeViString" + ) + self.niFgen_SetAttributeViString_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niFgen_SetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_SetAttributeViString_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niFgen_SetAttributeViString_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niFgen_SetNamedWaveformNextWritePosition(self, vi, channel_name, waveform_name, relative_to, offset): # noqa: N802 + def niFgen_SetNamedWaveformNextWritePosition( + self, vi, channel_name, waveform_name, relative_to, offset + ): # noqa: N802 with self._func_lock: if self.niFgen_SetNamedWaveformNextWritePosition_cfunc is None: - self.niFgen_SetNamedWaveformNextWritePosition_cfunc = self._get_library_function('niFgen_SetNamedWaveformNextWritePosition') - self.niFgen_SetNamedWaveformNextWritePosition_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ViInt32] # noqa: F405 - self.niFgen_SetNamedWaveformNextWritePosition_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_SetNamedWaveformNextWritePosition_cfunc(vi, channel_name, waveform_name, relative_to, offset) - - def niFgen_SetWaveformNextWritePosition(self, vi, channel_name, waveform_handle, relative_to, offset): # noqa: N802 + self.niFgen_SetNamedWaveformNextWritePosition_cfunc = ( + self._get_library_function( + "niFgen_SetNamedWaveformNextWritePosition" + ) + ) + self.niFgen_SetNamedWaveformNextWritePosition_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViInt32, + ViInt32, + ] # noqa: F405 + self.niFgen_SetNamedWaveformNextWritePosition_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFgen_SetNamedWaveformNextWritePosition_cfunc( + vi, channel_name, waveform_name, relative_to, offset + ) + + def niFgen_SetWaveformNextWritePosition( + self, vi, channel_name, waveform_handle, relative_to, offset + ): # noqa: N802 with self._func_lock: if self.niFgen_SetWaveformNextWritePosition_cfunc is None: - self.niFgen_SetWaveformNextWritePosition_cfunc = self._get_library_function('niFgen_SetWaveformNextWritePosition') - self.niFgen_SetWaveformNextWritePosition_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViInt32, ViInt32] # noqa: F405 - self.niFgen_SetWaveformNextWritePosition_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_SetWaveformNextWritePosition_cfunc(vi, channel_name, waveform_handle, relative_to, offset) + self.niFgen_SetWaveformNextWritePosition_cfunc = ( + self._get_library_function("niFgen_SetWaveformNextWritePosition") + ) + self.niFgen_SetWaveformNextWritePosition_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ViInt32, + ViInt32, + ] # noqa: F405 + self.niFgen_SetWaveformNextWritePosition_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niFgen_SetWaveformNextWritePosition_cfunc( + vi, channel_name, waveform_handle, relative_to, offset + ) def niFgen_UnlockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niFgen_UnlockSession_cfunc is None: - self.niFgen_UnlockSession_cfunc = self._get_library_function('niFgen_UnlockSession') - self.niFgen_UnlockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niFgen_UnlockSession_cfunc = self._get_library_function( + "niFgen_UnlockSession" + ) + self.niFgen_UnlockSession_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niFgen_UnlockSession_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_UnlockSession_cfunc(vi, caller_has_lock) def niFgen_WaitUntilDone(self, vi, max_time): # noqa: N802 with self._func_lock: if self.niFgen_WaitUntilDone_cfunc is None: - self.niFgen_WaitUntilDone_cfunc = self._get_library_function('niFgen_WaitUntilDone') - self.niFgen_WaitUntilDone_cfunc.argtypes = [ViSession, ViInt32] # noqa: F405 + self.niFgen_WaitUntilDone_cfunc = self._get_library_function( + "niFgen_WaitUntilDone" + ) + self.niFgen_WaitUntilDone_cfunc.argtypes = [ + ViSession, + ViInt32, + ] # noqa: F405 self.niFgen_WaitUntilDone_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_WaitUntilDone_cfunc(vi, max_time) - def niFgen_WriteBinary16Waveform(self, vi, channel_name, waveform_handle, size, data): # noqa: N802 + def niFgen_WriteBinary16Waveform( + self, vi, channel_name, waveform_handle, size, data + ): # noqa: N802 with self._func_lock: if self.niFgen_WriteBinary16Waveform_cfunc is None: - self.niFgen_WriteBinary16Waveform_cfunc = self._get_library_function('niFgen_WriteBinary16Waveform') - self.niFgen_WriteBinary16Waveform_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViInt32, ctypes.POINTER(ViInt16)] # noqa: F405 + self.niFgen_WriteBinary16Waveform_cfunc = self._get_library_function( + "niFgen_WriteBinary16Waveform" + ) + self.niFgen_WriteBinary16Waveform_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ViInt32, + ctypes.POINTER(ViInt16), + ] # noqa: F405 self.niFgen_WriteBinary16Waveform_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_WriteBinary16Waveform_cfunc(vi, channel_name, waveform_handle, size, data) + return self.niFgen_WriteBinary16Waveform_cfunc( + vi, channel_name, waveform_handle, size, data + ) - def niFgen_WriteNamedWaveformF64(self, vi, channel_name, waveform_name, size, data): # noqa: N802 + def niFgen_WriteNamedWaveformF64( + self, vi, channel_name, waveform_name, size, data + ): # noqa: N802 with self._func_lock: if self.niFgen_WriteNamedWaveformF64_cfunc is None: - self.niFgen_WriteNamedWaveformF64_cfunc = self._get_library_function('niFgen_WriteNamedWaveformF64') - self.niFgen_WriteNamedWaveformF64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niFgen_WriteNamedWaveformF64_cfunc = self._get_library_function( + "niFgen_WriteNamedWaveformF64" + ) + self.niFgen_WriteNamedWaveformF64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niFgen_WriteNamedWaveformF64_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_WriteNamedWaveformF64_cfunc(vi, channel_name, waveform_name, size, data) + return self.niFgen_WriteNamedWaveformF64_cfunc( + vi, channel_name, waveform_name, size, data + ) - def niFgen_WriteNamedWaveformI16(self, vi, channel_name, waveform_name, size, data): # noqa: N802 + def niFgen_WriteNamedWaveformI16( + self, vi, channel_name, waveform_name, size, data + ): # noqa: N802 with self._func_lock: if self.niFgen_WriteNamedWaveformI16_cfunc is None: - self.niFgen_WriteNamedWaveformI16_cfunc = self._get_library_function('niFgen_WriteNamedWaveformI16') - self.niFgen_WriteNamedWaveformI16_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViInt16)] # noqa: F405 + self.niFgen_WriteNamedWaveformI16_cfunc = self._get_library_function( + "niFgen_WriteNamedWaveformI16" + ) + self.niFgen_WriteNamedWaveformI16_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViInt16), + ] # noqa: F405 self.niFgen_WriteNamedWaveformI16_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_WriteNamedWaveformI16_cfunc(vi, channel_name, waveform_name, size, data) + return self.niFgen_WriteNamedWaveformI16_cfunc( + vi, channel_name, waveform_name, size, data + ) def niFgen_WriteScript(self, vi, channel_name, script): # noqa: N802 with self._func_lock: if self.niFgen_WriteScript_cfunc is None: - self.niFgen_WriteScript_cfunc = self._get_library_function('niFgen_WriteScript') - self.niFgen_WriteScript_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar)] # noqa: F405 + self.niFgen_WriteScript_cfunc = self._get_library_function( + "niFgen_WriteScript" + ) + self.niFgen_WriteScript_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niFgen_WriteScript_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_WriteScript_cfunc(vi, channel_name, script) - def niFgen_WriteWaveform(self, vi, channel_name, waveform_handle, size, data): # noqa: N802 + def niFgen_WriteWaveform( + self, vi, channel_name, waveform_handle, size, data + ): # noqa: N802 with self._func_lock: if self.niFgen_WriteWaveform_cfunc is None: - self.niFgen_WriteWaveform_cfunc = self._get_library_function('niFgen_WriteWaveform') - self.niFgen_WriteWaveform_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niFgen_WriteWaveform_cfunc = self._get_library_function( + "niFgen_WriteWaveform" + ) + self.niFgen_WriteWaveform_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ViInt32, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niFgen_WriteWaveform_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_WriteWaveform_cfunc(vi, channel_name, waveform_handle, size, data) + return self.niFgen_WriteWaveform_cfunc( + vi, channel_name, waveform_handle, size, data + ) def niFgen_close(self, vi): # noqa: N802 with self._func_lock: if self.niFgen_close_cfunc is None: - self.niFgen_close_cfunc = self._get_library_function('niFgen_close') + self.niFgen_close_cfunc = self._get_library_function("niFgen_close") self.niFgen_close_cfunc.argtypes = [ViSession] # noqa: F405 self.niFgen_close_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_close_cfunc(vi) @@ -654,15 +1349,21 @@ def niFgen_close(self, vi): # noqa: N802 def niFgen_error_message(self, vi, error_code, error_message): # noqa: N802 with self._func_lock: if self.niFgen_error_message_cfunc is None: - self.niFgen_error_message_cfunc = self._get_library_function('niFgen_error_message') - self.niFgen_error_message_cfunc.argtypes = [ViSession, ViStatus, ctypes.POINTER(ViChar)] # noqa: F405 + self.niFgen_error_message_cfunc = self._get_library_function( + "niFgen_error_message" + ) + self.niFgen_error_message_cfunc.argtypes = [ + ViSession, + ViStatus, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niFgen_error_message_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_error_message_cfunc(vi, error_code, error_message) def niFgen_reset(self, vi): # noqa: N802 with self._func_lock: if self.niFgen_reset_cfunc is None: - self.niFgen_reset_cfunc = self._get_library_function('niFgen_reset') + self.niFgen_reset_cfunc = self._get_library_function("niFgen_reset") self.niFgen_reset_cfunc.argtypes = [ViSession] # noqa: F405 self.niFgen_reset_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_reset_cfunc(vi) @@ -670,7 +1371,13 @@ def niFgen_reset(self, vi): # noqa: N802 def niFgen_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 with self._func_lock: if self.niFgen_self_test_cfunc is None: - self.niFgen_self_test_cfunc = self._get_library_function('niFgen_self_test') - self.niFgen_self_test_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt16), ctypes.POINTER(ViChar)] # noqa: F405 + self.niFgen_self_test_cfunc = self._get_library_function( + "niFgen_self_test" + ) + self.niFgen_self_test_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt16), + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niFgen_self_test_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_self_test_cfunc(vi, self_test_result, self_test_message) diff --git a/generated/nifgen/nifgen/_library_singleton.py b/generated/nifgen/nifgen/_library_singleton.py index cf3648624..8072e04d3 100644 --- a/generated/nifgen/nifgen/_library_singleton.py +++ b/generated/nifgen/nifgen/_library_singleton.py @@ -12,30 +12,36 @@ _instance = None _instance_lock = threading.Lock() -_library_info = {'Linux': {'64bit': {'name': 'nifgen', 'type': 'cdll'}}, - 'Windows': {'32bit': {'name': 'niFgen_32.dll', 'type': 'windll'}, - '64bit': {'name': 'niFgen_64.dll', 'type': 'cdll'}}} +_library_info = { + "Linux": {"64bit": {"name": "nifgen", "type": "cdll"}}, + "Windows": { + "32bit": {"name": "niFgen_32.dll", "type": "windll"}, + "64bit": {"name": "niFgen_64.dll", "type": "cdll"}, + }, +} def _get_library_name(): try: - return ctypes.util.find_library(_library_info[platform.system()][platform.architecture()[0]]['name']) # We find and return full path to the DLL + return ctypes.util.find_library( + _library_info[platform.system()][platform.architecture()[0]]["name"] + ) # We find and return full path to the DLL except KeyError: raise errors.UnsupportedConfigurationError def _get_library_type(): try: - return _library_info[platform.system()][platform.architecture()[0]]['type'] + return _library_info[platform.system()][platform.architecture()[0]]["type"] except KeyError: raise errors.UnsupportedConfigurationError def get(): - '''get + """get Returns the library.Library singleton for nifgen. - ''' + """ global _instance global _instance_lock @@ -43,13 +49,12 @@ def get(): if _instance is None: try: library_type = _get_library_type() - if library_type == 'windll': + if library_type == "windll": ctypes_library = ctypes.WinDLL(_get_library_name()) else: - assert library_type == 'cdll' + assert library_type == "cdll" ctypes_library = ctypes.CDLL(_get_library_name()) except OSError: raise errors.DriverNotInstalledError() _instance = _library.Library(ctypes_library) return _instance - diff --git a/generated/nifgen/nifgen/_visatype.py b/generated/nifgen/nifgen/_visatype.py index 02cc41d1b..bf96c3cfb 100644 --- a/generated/nifgen/nifgen/_visatype.py +++ b/generated/nifgen/nifgen/_visatype.py @@ -2,9 +2,9 @@ import ctypes -'''Definitions of the VISA types used by the C API of the driver runtime. +"""Definitions of the VISA types used by the C API of the driver runtime. These are aliased directly to ctypes types so can be used directly to call into the library. -''' +""" ViChar = ctypes.c_char @@ -26,4 +26,3 @@ ViAttr = ViUInt32 ViConstString = ViString ViRsrc = ViString - diff --git a/generated/nifgen/nifgen/enums.py b/generated/nifgen/nifgen/enums.py index f9a4c7678..c3cc01484 100644 --- a/generated/nifgen/nifgen/enums.py +++ b/generated/nifgen/nifgen/enums.py @@ -6,52 +6,52 @@ class AnalogPath(Enum): MAIN = 0 - r''' + r""" Specifies use of the main path. NI-FGEN chooses the amplifier based on the user-specified gain. - ''' + """ DIRECT = 1 - r''' + r""" Specifies use of the direct path. - ''' + """ FIXED_LOW_GAIN = 2 - r''' + r""" Specifies use of the low-gain amplifier in the main path, no matter what value the user specifies for gain. This setting limits the output range. - ''' + """ FIXED_HIGH_GAIN = 3 - r''' + r""" Specifies use of the high-gain amplifier in the main path. - ''' + """ class BusType(Enum): INVALID = 0 - r''' + r""" Indicates an invalid bus type. - ''' + """ AT = 1 - r''' + r""" Indicates the signal generator is the AT bus type. - ''' + """ PCI = 2 - r''' + r""" Indicates the signal generator is the PCI bus type. - ''' + """ PXI = 3 - r''' + r""" Indicates the signal generator is the PXI bus type. - ''' + """ VXI = 4 - r''' + r""" Indicates the signal generator is the VXI bus type. - ''' + """ PCMCIA = 5 - r''' + r""" Indicates the signal generator is the PCI-CMA bus type. - ''' + """ PXIE = 6 - r''' + r""" Indicates the signal generator is the PXI Express bus type. - ''' + """ class ByteOrder(Enum): @@ -61,28 +61,28 @@ class ByteOrder(Enum): class ClockMode(Enum): HIGH_RESOLUTION = 0 - r''' + r""" High resolution sampling—Sample rate is generated by a high–resolution clock source. - ''' + """ DIVIDE_DOWN = 1 - r''' + r""" Divide down sampling—Sample rates are generated by dividing the source frequency. - ''' + """ AUTOMATIC = 2 - r''' + r""" Automatic Selection—NI-FGEN selects between the divide–down and high–resolution clocking modes. - ''' + """ class DataMarkerEventLevelPolarity(Enum): HIGH = 101 - r''' + r""" When the operation is ready to start, the Ready for Start event level is high. - ''' + """ LOW = 102 - r''' + r""" When the operation is ready to start, the Ready for Start event level is low. - ''' + """ class HardwareState(Enum): @@ -95,62 +95,62 @@ class HardwareState(Enum): class IdleBehavior(Enum): HOLD_LAST = 400 - r''' + r""" While in an Idle or Wait state, the output signal remains at the last voltage generated prior to entering the state. - ''' + """ JUMP_TO = 401 - r''' + r""" While in an Idle or Wait state, the output signal remains at the value configured in the Idle or Wait value property. - ''' + """ class OutputMode(Enum): FUNC = 0 - r''' + r""" Standard Method mode— Generates standard method waveforms such as sine, square, triangle, and so on. - ''' + """ ARB = 1 - r''' + r""" Arbitrary waveform mode—Generates waveforms from user-created/provided waveform arrays of numeric data. - ''' + """ SEQ = 2 - r''' + r""" Arbitrary sequence mode — Generates downloaded waveforms in an order your specify. - ''' + """ FREQ_LIST = 101 - r''' + r""" Frequency List mode—Generates a standard method using a list of frequencies you define. - ''' + """ SCRIPT = 102 - r''' + r""" **Script mode—**\ Allows you to use scripting to link and loop multiple waveforms in complex combinations. - ''' + """ class ReferenceClockSource(Enum): - CLOCK_IN = 'ClkIn' - r''' + CLOCK_IN = "ClkIn" + r""" Specifies that the CLK IN input signal from the front panel connector is used as the Reference Clock source. - ''' - NONE = 'None' - r''' + """ + NONE = "None" + r""" Specifies that a Reference Clock is not used. - ''' - ONBOARD_REFERENCE_CLOCK = 'OnboardRefClk' - r''' + """ + ONBOARD_REFERENCE_CLOCK = "OnboardRefClk" + r""" Specifies that the onboard Reference Clock is used as the Reference Clock source. - ''' - PXI_CLOCK = 'PXI_Clk' - r''' + """ + PXI_CLOCK = "PXI_Clk" + r""" Specifies the PXI Clock is used as the Reference Clock source. - ''' - RTSI_7 = 'RTSI7' - r''' + """ + RTSI_7 = "RTSI7" + r""" Specifies that the RTSI line 7 is used as the Reference Clock source. - ''' + """ class RelativeTo(Enum): @@ -159,148 +159,148 @@ class RelativeTo(Enum): class SampleClockSource(Enum): - CLOCK_IN = 'ClkIn' - r''' + CLOCK_IN = "ClkIn" + r""" Specifies that the signal at the CLK IN front panel connector is used as the Sample Clock source. - ''' - DDC_CLOCK_IN = 'DDC_ClkIn' - r''' + """ + DDC_CLOCK_IN = "DDC_ClkIn" + r""" Specifies that the Sample Clock from DDC connector is used as the Sample Clock source. - ''' - ONBOARD_CLOCK = 'OnboardClock' - r''' + """ + ONBOARD_CLOCK = "OnboardClock" + r""" Specifies that the onboard clock is used as the Sample Clock source. - ''' - PXI_STAR_LINE = 'PXI_Star' - r''' + """ + PXI_STAR_LINE = "PXI_Star" + r""" Specifies that the PXI\_STAR trigger line is used as the Sample Clock source. - ''' - PXI_TRIGGER_LINE_0_RTSI_0 = 'PXI_Trig0' - r''' + """ + PXI_TRIGGER_LINE_0_RTSI_0 = "PXI_Trig0" + r""" Specifies that the PXI or RTSI line 0 is used as the Sample Clock source. - ''' - PXI_TRIGGER_LINE_1_RTSI_1 = 'PXI_Trig1' - r''' + """ + PXI_TRIGGER_LINE_1_RTSI_1 = "PXI_Trig1" + r""" Specifies that the PXI or RTSI line 1 is used as the Sample Clock source. - ''' - PXI_TRIGGER_LINE_2_RTSI_2 = 'PXI_Trig2' - r''' + """ + PXI_TRIGGER_LINE_2_RTSI_2 = "PXI_Trig2" + r""" Specifies that the PXI or RTSI line 2 is used as the Sample Clock source. - ''' - PXI_TRIGGER_LINE_3_RTSI_3 = 'PXI_Trig3' - r''' + """ + PXI_TRIGGER_LINE_3_RTSI_3 = "PXI_Trig3" + r""" Specifies that the PXI or RTSI line 3 is used as the Sample Clock source. - ''' - PXI_TRIGGER_LINE_4_RTSI_4 = 'PXI_Trig4' - r''' + """ + PXI_TRIGGER_LINE_4_RTSI_4 = "PXI_Trig4" + r""" Specifies that the PXI or RTSI line 4 is used as the Sample Clock source. - ''' - PXI_TRIGGER_LINE_5_RTSI_5 = 'PXI_Trig5' - r''' + """ + PXI_TRIGGER_LINE_5_RTSI_5 = "PXI_Trig5" + r""" Specifies that the PXI or RTSI line 5 is used as the Sample Clock source. - ''' - PXI_TRIGGER_LINE_6_RTSI_6 = 'PXI_Trig6' - r''' + """ + PXI_TRIGGER_LINE_6_RTSI_6 = "PXI_Trig6" + r""" Specifies that the PXI or RTSI line 6 is used as the Sample Clock source. - ''' - PXI_TRIGGER_LINE_7_RTSI_7 = 'PXI_Trig7' - r''' + """ + PXI_TRIGGER_LINE_7_RTSI_7 = "PXI_Trig7" + r""" Specifies that the PXI or RTSI line 7 is used as the Sample Clock source. - ''' + """ class SampleClockTimebaseSource(Enum): - CLOCK_IN = 'ClkIn' - r''' + CLOCK_IN = "ClkIn" + r""" Specifies that the external signal on the CLK IN front panel connector is used as the source. - ''' - ONBOARD_CLOCK = 'OnboardClock' - r''' + """ + ONBOARD_CLOCK = "OnboardClock" + r""" Specifies that the onboard Sample Clock timebase is used as the source. - ''' + """ class ScriptTriggerDigitalEdgeEdge(Enum): RISING = 101 - r''' + r""" Rising Edge - ''' + """ FALLING = 102 - r''' + r""" Falling Edge - ''' + """ class ScriptTriggerType(Enum): TRIG_NONE = 101 - r''' + r""" No trigger is configured. Signal generation starts immediately. - ''' + """ DIGITAL_EDGE = 102 - r''' + r""" Trigger is asserted when a digital edge is detected. - ''' + """ DIGITAL_LEVEL = 103 - r''' + r""" Trigger is asserted when a digital level is detected. - ''' + """ SOFTWARE_EDGE = 104 - r''' + r""" Trigger is asserted when a software edge is detected. - ''' + """ class StartTriggerDigitalEdgeEdge(Enum): RISING = 101 - r''' + r""" Rising Edge - ''' + """ FALLING = 102 - r''' + r""" Falling Edge - ''' + """ class StartTriggerType(Enum): TRIG_NONE = 101 - r''' + r""" None - ''' + """ DIGITAL_EDGE = 102 - r''' + r""" Digital Edge - ''' + """ SOFTWARE_EDGE = 104 - r''' + r""" Software Edge - ''' + """ P2P_ENDPOINT_FULLNESS = 106 - r''' + r""" P2P Endpoint Fullness - ''' + """ class TerminalConfiguration(Enum): SINGLE_ENDED = 300 - r''' + r""" Single-ended operation - ''' + """ DIFFERENTIAL = 301 - r''' + r""" Differential operation - ''' + """ class Trigger(Enum): @@ -310,70 +310,70 @@ class Trigger(Enum): class TriggerMode(Enum): SINGLE = 1 - r''' + r""" Single Trigger Mode - The waveform you describe in the sequence list is generated only once by going through the entire staging list. Only one trigger is required to start the waveform generation. You can use Single trigger mode with the output mode in any mode. After a trigger is received, the waveform generation starts from the first stage and continues through to the last stage. Then, the last stage generates repeatedly until you stop the waveform generation. - ''' + """ CONTINUOUS = 2 - r''' + r""" Continuous Trigger Mode - The waveform you describe in the staging list generates infinitely by repeatedly cycling through the staging list. After a trigger is received, the waveform generation starts from the first stage and continues through to the last stage. After the last stage completes, the waveform generation loops back to the start of the first stage and continues until it is stopped. Only one trigger is required to start the waveform generation. - ''' + """ STEPPED = 3 - r''' + r""" Stepped Trigger Mode - After a start trigger is received, the waveform described by the first stage generates. Then, the device waits for the next trigger signal. On the next trigger, the waveform described by the second stage generates, and so on. After the staging list completes, the waveform generation returns to the first stage and continues in a cyclic fashion. After any stage has generated completely, the first eight samples of the next stage are repeated continuously until the next trigger is received. trigger mode. Note: In Frequency List mode, Stepped trigger mode is the same as Burst - ''' + """ BURST = 4 - r''' + r""" Burst Trigger Mode - After a start trigger is received, the waveform described by the first stage generates until another trigger is received. At the next trigger, the buffer of the previous stage completes, and then the waveform described by the second stage generates. After the staging list completes, the waveform generation returns to the first stage and continues in a cyclic fashion. In Frequency List mode, the duration instruction is ignored, and the trigger switches the frequency to the next frequency in the list. trigger mode. Note: In Frequency List mode, Stepped trigger mode is the same as Burst - ''' + """ class WaitBehavior(Enum): HOLD_LAST = 400 - r''' + r""" While in an Idle or Wait state, the output signal remains at the last voltage generated prior to entering the state. - ''' + """ JUMP_TO = 401 - r''' + r""" While in an Idle or Wait state, the output signal remains at the value configured in the Idle or Wait value property. - ''' + """ class Waveform(Enum): SINE = 1 - r''' + r""" Sinusoid waveform - ''' + """ SQUARE = 2 - r''' + r""" Square waveform - ''' + """ TRIANGLE = 3 - r''' + r""" Triange waveform - ''' + """ RAMP_UP = 4 - r''' + r""" Positive ramp waveform - ''' + """ RAMP_DOWN = 5 - r''' + r""" Negative ramp waveform - ''' + """ DC = 6 - r''' + r""" Constant voltage - ''' + """ NOISE = 101 - r''' + r""" White noise - ''' + """ USER = 102 - r''' + r""" User-defined waveform as defined by the define_user_standard_waveform method. - ''' + """ diff --git a/generated/nifgen/nifgen/errors.py b/generated/nifgen/nifgen/errors.py index 8399964da..cdc09eeb0 100644 --- a/generated/nifgen/nifgen/errors.py +++ b/generated/nifgen/nifgen/errors.py @@ -7,86 +7,103 @@ def _is_success(code): - return (code == 0) + return code == 0 def _is_error(code): - return (code < 0) + return code < 0 def _is_warning(code): - return (code > 0) + return code > 0 class Error(Exception): - '''Base error class for NI-FGEN''' + """Base error class for NI-FGEN""" def __init__(self, message): super(Error, self).__init__(message) class DriverError(Error): - '''An error originating from the NI-FGEN driver''' + """An error originating from the NI-FGEN driver""" def __init__(self, code, description): - assert (_is_error(code)), "Should not raise Error if code is not fatal." + assert _is_error(code), "Should not raise Error if code is not fatal." self.code = code self.description = description super(DriverError, self).__init__(str(self.code) + ": " + self.description) class DriverWarning(Warning): - '''A warning originating from the NI-FGEN driver''' + """A warning originating from the NI-FGEN driver""" def __init__(self, code, description): - assert (_is_warning(code)), "Should not create Warning if code is not positive." - super(DriverWarning, self).__init__('Warning {0} occurred.\n\n{1}'.format(code, description)) + assert _is_warning(code), "Should not create Warning if code is not positive." + super(DriverWarning, self).__init__( + "Warning {0} occurred.\n\n{1}".format(code, description) + ) class UnsupportedConfigurationError(Error): - '''An error due to using this module in an usupported platform.''' + """An error due to using this module in an usupported platform.""" def __init__(self): - super(UnsupportedConfigurationError, self).__init__('System configuration is unsupported: ' + platform.architecture()[0] + ' ' + platform.system()) + super(UnsupportedConfigurationError, self).__init__( + "System configuration is unsupported: " + + platform.architecture()[0] + + " " + + platform.system() + ) class DriverNotInstalledError(Error): - '''An error due to using this module without the driver runtime installed.''' + """An error due to using this module without the driver runtime installed.""" def __init__(self): - super(DriverNotInstalledError, self).__init__('The NI-FGEN runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it.') + super(DriverNotInstalledError, self).__init__( + "The NI-FGEN runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it." + ) class DriverTooOldError(Error): - '''An error due to using this module with an older version of the driver runtime.''' + """An error due to using this module with an older version of the driver runtime.""" def __init__(self): - super(DriverTooOldError, self).__init__('A function was not found in the NI-FGEN runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it.') + super(DriverTooOldError, self).__init__( + "A function was not found in the NI-FGEN runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it." + ) class InvalidRepeatedCapabilityError(Error): - '''An error due to an invalid character in a repeated capability''' + """An error due to an invalid character in a repeated capability""" def __init__(self, invalid_character, invalid_string): - super(InvalidRepeatedCapabilityError, self).__init__('An invalid character ({0}) was found in repeated capability string ({1})'.format(invalid_character, invalid_string)) + super(InvalidRepeatedCapabilityError, self).__init__( + "An invalid character ({0}) was found in repeated capability string ({1})".format( + invalid_character, invalid_string + ) + ) class SelfTestError(Error): - '''An error due to a failed self-test''' + """An error due to a failed self-test""" def __init__(self, code, msg): self.code = code self.message = msg - super(SelfTestError, self).__init__('Self-test failed with code {0}: {1}'.format(code, msg)) + super(SelfTestError, self).__init__( + "Self-test failed with code {0}: {1}".format(code, msg) + ) def handle_error(session, code, ignore_warnings, is_error_handling): - '''handle_error + """handle_error Helper function for handling errors returned by nifgen.Library. It calls back into the session to get the corresponding error description and raises if necessary. - ''' + """ if _is_success(code) or (_is_warning(code) and ignore_warnings): return @@ -94,7 +111,7 @@ def handle_error(session, code, ignore_warnings, is_error_handling): if is_error_handling: # The caller is in the midst of error handling and an error occurred. # Don't try to get the description or we'll start recursing until the stack overflows. - description = '' + description = "" else: description = session._get_error_description(code) @@ -103,5 +120,3 @@ def handle_error(session, code, ignore_warnings, is_error_handling): assert _is_warning(code) warnings.warn(DriverWarning(code, description)) - - diff --git a/generated/nifgen/nifgen/session.py b/generated/nifgen/nifgen/session.py index 4e4a79116..5e15cb230 100644 --- a/generated/nifgen/nifgen/session.py +++ b/generated/nifgen/nifgen/session.py @@ -2,6 +2,7 @@ # This file was generated import array # noqa: F401 import ctypes + # Used by @ivi_synchronized from functools import wraps @@ -17,22 +18,24 @@ # Used for __repr__ import pprint + pp = pprint.PrettyPrinter(indent=4) # Helper functions for creating ctypes needed for calling into the driver DLL def get_ctypes_pointer_for_buffer(value=None, library_type=None, size=None): if isinstance(value, array.array): - assert library_type is not None, 'library_type is required for array.array' + assert library_type is not None, "library_type is required for array.array" addr, _ = value.buffer_info() return ctypes.cast(addr, ctypes.POINTER(library_type)) elif str(type(value)).find("'numpy.ndarray'") != -1: import numpy + return numpy.ctypeslib.as_ctypes(value) elif isinstance(value, bytes): return ctypes.cast(value, ctypes.POINTER(library_type)) elif isinstance(value, list): - assert library_type is not None, 'library_type is required for list' + assert library_type is not None, "library_type is required for list" return (library_type * len(value))(*value) else: if library_type is not None and size is not None: @@ -72,6 +75,7 @@ def aux(*xs, **kws): session = xs[0] # parameter 0 is 'self' which is the session object with session.lock(): return f(*xs, **kws) + return aux @@ -92,16 +96,34 @@ def __init__(self, session, prefix, current_repeated_capability_list): self._session = session self._prefix = prefix # We need at least one element. If we get an empty list, make the one element an empty string - self._current_repeated_capability_list = current_repeated_capability_list if len(current_repeated_capability_list) > 0 else [''] + self._current_repeated_capability_list = ( + current_repeated_capability_list + if len(current_repeated_capability_list) > 0 + else [""] + ) # Now we know there is at lease one entry, so we look if it is an empty string or not - self._separator = '/' if len(self._current_repeated_capability_list[0]) > 0 else '' + self._separator = ( + "/" if len(self._current_repeated_capability_list[0]) > 0 else "" + ) def __getitem__(self, repeated_capability): - '''Set/get properties or call methods with a repeated capability (i.e. channels)''' - rep_caps_list = _converters.convert_repeated_capabilities(repeated_capability, self._prefix) - complete_rep_cap_list = [current_rep_cap + self._separator + rep_cap for current_rep_cap in self._current_repeated_capability_list for rep_cap in rep_caps_list] - - return _SessionBase(vi=self._session._vi, repeated_capability_list=complete_rep_cap_list, library=self._session._library, encoding=self._session._encoding, freeze_it=True) + """Set/get properties or call methods with a repeated capability (i.e. channels)""" + rep_caps_list = _converters.convert_repeated_capabilities( + repeated_capability, self._prefix + ) + complete_rep_cap_list = [ + current_rep_cap + self._separator + rep_cap + for current_rep_cap in self._current_repeated_capability_list + for rep_cap in rep_caps_list + ] + + return _SessionBase( + vi=self._session._vi, + repeated_capability_list=complete_rep_cap_list, + library=self._session._library, + encoding=self._session._encoding, + freeze_it=True, + ) # This is a very simple context manager we can use when we need to set/get attributes @@ -113,20 +135,20 @@ def __init__(self, session): def __enter__(self): self._repeated_capability_cache = self._session._repeated_capability - self._session._repeated_capability = '' + self._session._repeated_capability = "" def __exit__(self, exc_type, exc_value, traceback): self._session._repeated_capability = self._repeated_capability_cache class _SessionBase(object): - '''Base class for all NI-FGEN sessions.''' + """Base class for all NI-FGEN sessions.""" # This is needed during __init__. Without it, __setattr__ raises an exception _is_frozen = False absolute_delay = _attributes.AttributeViReal64(1150413) - '''Type: float + """Type: float Specifies the sub-Sample Clock delay, in seconds, to apply to the waveform. Use this property to reduce the trigger jitter when @@ -143,40 +165,42 @@ class _SessionBase(object): Note: If this property is set, NI-TClk cannot perform any sub-Sample Clock adjustment. - ''' + """ all_marker_events_latched_status = _attributes.AttributeViInt32(1150349) - '''Type: int + """Type: int Returns a bit field of the latched status of all Marker Events. Write 0 to this property to clear the latched status of all Marker Events. - ''' + """ all_marker_events_live_status = _attributes.AttributeViInt32(1150344) - '''Type: int + """Type: int Returns a bit field of the live status of all Marker Events. - ''' + """ analog_data_mask = _attributes.AttributeViInt32(1150234) - '''Type: int + """Type: int Specifies the mask to apply to the analog output. The masked data is replaced with the data in analog_static_value. - ''' + """ analog_filter_enabled = _attributes.AttributeViBoolean(1150103) - '''Type: bool + """Type: bool Controls whether the signal generator applies to an analog filter to the output signal. This property is valid in arbitrary waveform, arbitrary sequence, and script modes. This property can also be used in standard method and frequency list modes for user-defined waveforms. - ''' - analog_path = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.AnalogPath, 1150222) - '''Type: enums.AnalogPath + """ + analog_path = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.AnalogPath, 1150222 + ) + """Type: enums.AnalogPath Specifies the analog signal path that should be used. The main path allows you to configure gain, offset, analog filter status, output impedance, and output enable. The main path has two amplifier options, high- and low-gain. The direct path presents a much smaller gain range, and you cannot adjust offset or the filter status. The direct path also provides a smaller output range but also lower distortion. NI-FGEN normally chooses the amplifier based on the user-specified gain. - ''' + """ analog_static_value = _attributes.AttributeViInt32(1150235) - '''Type: int + """Type: int Specifies the static value that replaces data masked by analog_data_mask. - ''' + """ arb_gain = _attributes.AttributeViReal64(1250202) - '''Type: float + """Type: float Specifies the factor by which the signal generator scales the arbitrary waveform data. When you create arbitrary waveforms, you must first normalize the data points to the range -1.0 to +1.0. Use this property to scale the arbitrary waveform to other ranges. For example, when you set this property to 2.0, the output signal ranges from -2.0 V to +2.0 V. @@ -191,18 +215,18 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.arb_gain` - ''' + """ arb_marker_position = _attributes.AttributeViInt32(1150327) - '''Type: int + """Type: int Specifies the position for a marker to be asserted in the arbitrary waveform. This property defaults to -1 when no marker position is specified. Use this property when output_mode is set to OutputMode.ARB. Use ExportSignal to export the marker signal. Note: One or more of the referenced methods are not in the Python API for this driver. - ''' + """ arb_offset = _attributes.AttributeViReal64(1250203) - '''Type: float + """Type: float Specifies the value that the signal generator adds to the arbitrary waveform data. When you create arbitrary waveforms, you must first normalize the data points to the range -1.0 to +1.0. Use this property to shift the arbitrary waveform range. For example, when you set this property to 1.0, the output signal ranges from 2.0 V to 0.0 V. @@ -218,21 +242,21 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.arb_offset` - ''' + """ arb_repeat_count = _attributes.AttributeViInt32(1150328) - '''Type: int + """Type: int Specifies number of times to repeat the arbitrary waveform when the triggerMode parameter of ConfigureTriggerMode is set to TriggerMode.SINGLE or TriggerMode.STEPPED. This property is ignored if the triggerMode parameter is set to TriggerMode.CONTINUOUS or TriggerMode.BURST. Use this property when output_mode is set to OutputMode.ARB. When used during streaming, this property specifies the number of times to repeat the streaming waveform (the onboard memory allocated for streaming). For more information about streaming, refer to the Streaming topic. - ''' + """ arb_sample_rate = _attributes.AttributeViReal64(1250204) - '''Type: float + """Type: float Specifies the rate at which the signal generator outputs the points in arbitrary waveforms. Use this property when output_mode is set to OutputMode.ARB or OutputMode.SEQ. Units: Samples/s - ''' + """ arb_sequence_handle = _attributes.AttributeViInt32(1250211) - '''Type: int + """Type: int This channel-based property identifies which sequence the signal generator produces. You can create multiple sequences using create_arb_sequence. create_arb_sequence returns a handle that you can use to identify the particular sequence. To configure the signal generator to produce a particular sequence, set this property to the sequence handle. Use this property only when output_mode is set to OutputMode.SEQ. @@ -246,9 +270,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.arb_sequence_handle` - ''' + """ arb_waveform_handle = _attributes.AttributeViInt32(1250201) - '''Type: int + """Type: int Selects which arbitrary waveform the signal generator produces. You can create multiple arbitrary waveforms using one of the following niFgen Create Waveform methods: create_waveform @@ -267,19 +291,21 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.arb_waveform_handle` - ''' + """ aux_power_enabled = _attributes.AttributeViBoolean(1150411) - '''Type: bool + """Type: bool Controls the specified auxiliary power pin. Setting this property to TRUE energizes the auxiliary power when the session is committed. When this property is FALSE, the power pin of the connector outputs no power. - ''' - bus_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.BusType, 1150215) - '''Type: enums.BusType + """ + bus_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.BusType, 1150215 + ) + """Type: enums.BusType The bus type of the signal generator. - ''' + """ channel_delay = _attributes.AttributeViReal64(1150369) - '''Type: float + """Type: float Specifies, in seconds, the delay to apply to the analog output of the channel specified by the channel string. You can use the channel delay to configure the timing relationship between channels on a multichannel device. Values for this property can be zero or positive. A value of zero indicates that the channels are aligned. A positive value delays the analog output by the specified number of seconds. @@ -292,15 +318,17 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.channel_delay` - ''' - clock_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ClockMode, 1150110) - '''Type: enums.ClockMode + """ + clock_mode = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.ClockMode, 1150110 + ) + """Type: enums.ClockMode Controls which clock mode is used for the signal generator. For signal generators that support it, this property allows switching the sample clock to High-Resolution mode. When in Divide-Down mode, the sample rate can only be set to certain frequences, based on dividing down the update clock. However, in High-Resolution mode, the sample rate may be set to any value. - ''' + """ common_mode_offset = _attributes.AttributeViReal64(1150366) - '''Type: float + """Type: float Specifies, in volts, the value the signal generator adds to or subtracts from the arbitrary waveform data. This property applies only when you set the terminal_configuration property to TerminalConfiguration.DIFFERENTIAL. Common mode offset is applied to the signals generated at each differential output terminal. @@ -313,14 +341,14 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.common_mode_offset` - ''' + """ data_marker_events_count = _attributes.AttributeViInt32(1150273) - '''Type: int + """Type: int Returns the number of Data Marker Events supported by the device. - ''' + """ data_marker_event_data_bit_number = _attributes.AttributeViInt32(1150337) - '''Type: int + """Type: int Specifies the bit number to assign to the Data Marker Event. @@ -333,9 +361,11 @@ class _SessionBase(object): To set/get on all data_markers, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.data_marker_event_data_bit_number` - ''' - data_marker_event_level_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.DataMarkerEventLevelPolarity, 1150338) - '''Type: enums.DataMarkerEventLevelPolarity + """ + data_marker_event_level_polarity = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.DataMarkerEventLevelPolarity, 1150338 + ) + """Type: enums.DataMarkerEventLevelPolarity Specifies the output polarity of the Data marker event. @@ -348,9 +378,9 @@ class _SessionBase(object): To set/get on all data_markers, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.data_marker_event_level_polarity` - ''' + """ data_marker_event_output_terminal = _attributes.AttributeViString(1150339) - '''Type: str + """Type: str Specifies the destination terminal for the Data Marker Event. @@ -363,26 +393,26 @@ class _SessionBase(object): To set/get on all data_markers, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.data_marker_event_output_terminal` - ''' + """ data_transfer_block_size = _attributes.AttributeViInt32(1150241) - '''Type: int + """Type: int The number of samples at a time to download to onboard memory. Useful when the total data to be transferred to onboard memory is large. - ''' + """ data_transfer_maximum_bandwidth = _attributes.AttributeViReal64(1150373) - '''Type: float + """Type: float Specifies the maximum amount of bus bandwidth (in bytes per second) to use for data transfers. The signal generator limits data transfer speeds on the PCIe bus to the value you specify for this property. Set this property to optimize bus bandwidth usage for multi-device streaming applications by preventing the signal generator from consuming all of the available bandwidth on a PCI express link when waveforms are being written to the onboard memory of the device. - ''' + """ data_transfer_maximum_in_flight_reads = _attributes.AttributeViInt32(1150375) - '''Type: int + """Type: int Specifies the maximum number of concurrent PCI Express read requests the signal generator can issue. When transferring data from computer memory to device onboard memory across the PCI Express bus, the signal generator can issue multiple memory reads at the same time. In general, the larger the number of read requests, the more efficiently the device uses the bus because the multiple read requests keep the data flowing, even in a PCI Express topology that has high latency due to PCI Express switches in the data path. Most NI devices can issue a large number of read requests (typically 8 or 16). By default, this property is set to the highest value the signal generator supports. If other devices in your system cannot tolerate long data latencies, it may be helpful to decrease the number of in-flight read requests the NI signal generator issues. This helps to reduce the amount of data the signal generator reads at one time. - ''' + """ data_transfer_preferred_packet_size = _attributes.AttributeViInt32(1150374) - '''Type: int + """Type: int Specifies the preferred size of the data field in a PCI Express read request packet. In general, the larger the packet size, the more efficiently the device uses the bus. By default, NI signal generators use the largest packet size allowed by the system. However, due to different system implementations, some systems may perform better with smaller packet sizes. Recommended values for this property are powers of two between 64 and 512. @@ -391,14 +421,16 @@ class _SessionBase(object): Note: : - ''' + """ digital_data_mask = _attributes.AttributeViInt32(1150236) - '''Type: int + """Type: int Specifies the mask to apply to the output on the digital connector. The masked data is replaced with the data in digital_static_value. - ''' - digital_edge_script_trigger_edge = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ScriptTriggerDigitalEdgeEdge, 1150292) - '''Type: enums.ScriptTriggerDigitalEdgeEdge + """ + digital_edge_script_trigger_edge = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.ScriptTriggerDigitalEdgeEdge, 1150292 + ) + """Type: enums.ScriptTriggerDigitalEdgeEdge Specifies the active edge for the Script trigger. This property is used when script_trigger_type is set to Digital Edge. @@ -411,9 +443,9 @@ class _SessionBase(object): To set/get on all script_triggers, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.digital_edge_script_trigger_edge` - ''' + """ digital_edge_script_trigger_source = _attributes.AttributeViString(1150291) - '''Type: str + """Type: str Specifies the source terminal for the Script trigger. This property is used when script_trigger_type is set to Digital Edge. @@ -426,97 +458,103 @@ class _SessionBase(object): To set/get on all script_triggers, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.digital_edge_script_trigger_source` - ''' - digital_edge_start_trigger_edge = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.StartTriggerDigitalEdgeEdge, 1150282) - '''Type: enums.StartTriggerDigitalEdgeEdge + """ + digital_edge_start_trigger_edge = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.StartTriggerDigitalEdgeEdge, 1150282 + ) + """Type: enums.StartTriggerDigitalEdgeEdge Specifies the active edge for the Start trigger. This property is used only when start_trigger_type is set to Digital Edge. - ''' + """ digital_edge_start_trigger_source = _attributes.AttributeViString(1150281) - '''Type: str + """Type: str Specifies the source terminal for the Start trigger. This property is used only when start_trigger_type is set to Digital Edge. - ''' + """ digital_filter_enabled = _attributes.AttributeViBoolean(1150102) - '''Type: bool + """Type: bool Controls whether the signal generator applies a digital filter to the output signal. This property is valid in arbitrary waveform, arbitrary sequence, and script modes. This property can also be used in standard method and frequency list modes for user-defined waveforms. - ''' + """ digital_filter_interpolation_factor = _attributes.AttributeViReal64(1150218) - '''Type: float + """Type: float This property only affects the device when digital_filter_enabled is set to True. If you do not set this property directly, NI-FGEN automatically selects the maximum interpolation factor allowed for the current sample rate. Valid values are 2, 4, and 8. - ''' + """ digital_gain = _attributes.AttributeViReal64(1150254) - '''Type: float + """Type: float Specifies a factor by which the signal generator digitally multiplies generated data before converting it to an analog signal in the DAC. For a digital gain greater than 1.0, the product of digital gain times the generated data must be inside the range plus or minus 1.0 (assuming floating point data). If the product exceeds these limits, the signal generator clips the output signal, and an error results. Some signal generators support both digital gain and an analog gain (analog gain is specified with the func_amplitude property or the arb_gain property). Digital gain can be changed during generation without the glitches that may occur when changing analog gains, due to relay switching. However, the DAC output resolution is a method of analog gain, so only analog gain makes full use of the resolution of the DAC. - ''' + """ digital_pattern_enabled = _attributes.AttributeViBoolean(1150101) - '''Type: bool + """Type: bool Controls whether the signal generator generates a digital pattern of the output signal. - ''' + """ digital_static_value = _attributes.AttributeViInt32(1150237) - '''Type: int + """Type: int Specifies the static value that replaces data masked by digital_data_mask. - ''' + """ done_event_output_terminal = _attributes.AttributeViString(1150315) - '''Type: str + """Type: str Specifies the destination terminal for the Done Event. - ''' + """ driver_setup = _attributes.AttributeViString(1050007) - '''Type: str + """Type: str Specifies the driver setup portion of the option string that was passed into the InitWithOptions method. Note: One or more of the referenced methods are not in the Python API for this driver. - ''' - exported_onboard_reference_clock_output_terminal = _attributes.AttributeViString(1150322) - '''Type: str + """ + exported_onboard_reference_clock_output_terminal = _attributes.AttributeViString( + 1150322 + ) + """Type: str Specifies the terminal to which to export the Onboard Reference Clock. - ''' + """ exported_reference_clock_output_terminal = _attributes.AttributeViString(1150321) - '''Type: str + """Type: str Specifies the terminal to which to export the Reference Clock. - ''' + """ exported_sample_clock_divisor = _attributes.AttributeViInt32(1150219) - '''Type: int + """Type: int Specifies the factor by which to divide the Sample clock, also known as the Update clock, before it is exported. To export the Sample clock, use the ExportSignal method or the exported_sample_clock_output_terminal property. Note: One or more of the referenced methods are not in the Python API for this driver. - ''' + """ exported_sample_clock_output_terminal = _attributes.AttributeViString(1150320) - '''Type: str + """Type: str Specifies the terminal to which to export the Sample Clock. - ''' + """ exported_sample_clock_timebase_divisor = _attributes.AttributeViInt32(1150230) - '''Type: int + """Type: int Specifies the factor by which to divide the sample clock timebase (board clock) before it is exported. To export the Sample clock timebase, use the ExportSignal method or the exported_sample_clock_timebase_output_terminal property. Note: One or more of the referenced methods are not in the Python API for this driver. - ''' - exported_sample_clock_timebase_output_terminal = _attributes.AttributeViString(1150329) - '''Type: str + """ + exported_sample_clock_timebase_output_terminal = _attributes.AttributeViString( + 1150329 + ) + """Type: str Specifies the terminal to which to export the Sample clock timebase. If you specify a divisor with the exported_sample_clock_timebase_divisor property, the Sample clock exported with the exported_sample_clock_timebase_output_terminal property is the value of the Sample clock timebase after it is divided-down. For a list of the terminals available on your device, refer to the Device Routes tab in MAX. To change the device configuration, call abort or wait for the generation to complete. Note: The signal generator must not be in the Generating state when you change this property. - ''' + """ exported_script_trigger_output_terminal = _attributes.AttributeViString(1150295) - '''Type: str + """Type: str Specifies the output terminal for the exported Script trigger. Setting this property to an empty string means that when you commit the session, the signal is removed from that terminal and, if possible, the terminal is tristated. @@ -530,55 +568,55 @@ class _SessionBase(object): To set/get on all script_triggers, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.exported_script_trigger_output_terminal` - ''' + """ exported_start_trigger_output_terminal = _attributes.AttributeViString(1150283) - '''Type: str + """Type: str Specifies the destination terminal for exporting the Start trigger. - ''' + """ external_clock_delay_binary_value = _attributes.AttributeViInt32(1150233) - '''Type: int + """Type: int Binary value of the external clock delay. - ''' + """ external_sample_clock_multiplier = _attributes.AttributeViReal64(1150376) - '''Type: float + """Type: float Specifies a multiplication factor to use to obtain a desired sample rate from an external Sample clock. The resulting sample rate is equal to this factor multiplied by the external Sample clock rate. You can use this property to generate samples at a rate higher than your external clock rate. When using this property, you do not need to explicitly set the external clock rate. - ''' + """ file_transfer_block_size = _attributes.AttributeViInt32(1150240) - '''Type: int + """Type: int The number of samples at a time to read from the file and download to onboard memory. Used in conjunction with the Create From File and Write From File methods. - ''' + """ filter_correction_frequency = _attributes.AttributeViReal64(1150104) - '''Type: float + """Type: float Controls the filter correction frequency of the analog filter. This property corrects for the ripples in the analog filter frequency response at the frequency specified. For standard waveform output, the filter correction frequency should be set to be the same as the frequency of the standard waveform. To have no filter correction, set this property to 0 Hz. - ''' + """ flatness_correction_enabled = _attributes.AttributeViBoolean(1150323) - '''Type: bool + """Type: bool When True, the signal generator applies a flatness correction factor to the generated sine wave in order to ensure the same output power level at all frequencies. This property should be set to False when performing Flatness Calibration. - ''' + """ fpga_bitfile_path = _attributes.AttributeViString(1150412) - '''Type: str + """Type: str Gets the absolute file path to the bitfile loaded on the FPGA. - ''' + """ freq_list_duration_quantum = _attributes.AttributeViReal64(1150214) - '''Type: float + """Type: float Returns the quantum of which all durations must be a multiple in a frequency list. - ''' + """ freq_list_handle = _attributes.AttributeViInt32(1150208) - '''Type: int + """Type: int Sets which frequency list the signal generator produces. Create a frequency list using create_freq_list. create_freq_list returns a handle that you can use to identify the list. - ''' + """ func_amplitude = _attributes.AttributeViReal64(1250102) - '''Type: float + """Type: float Controls the amplitude of the standard waveform that the signal generator produces. This value is the amplitude at the output terminal. For example, to produce a waveform ranging from -5.00 V to +5.00 V, set the amplitude to 10.00 V. @@ -596,17 +634,17 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.func_amplitude` - ''' + """ func_buffer_size = _attributes.AttributeViInt32(1150238) - '''Type: int + """Type: int This property contains the number of samples used in the standard method waveform buffer. This property is only valid on devices that implement standard method mode in software, and is read-only for all other devices. implementation of Standard Method Mode on your device. Note: Refer to the Standard Method Mode topic for more information on the - ''' + """ func_dc_offset = _attributes.AttributeViReal64(1250103) - '''Type: float + """Type: float Controls the DC offset of the standard waveform that the signal generator produces. This value is the offset at the output terminal. The value is the offset from ground to the center of the waveform that you specify with the Waveform parameter. For example, to configure a waveform with an amplitude of 10.00 V to range from 0.00 V to +10.00 V, set DC Offset to 5.00 V. @@ -621,9 +659,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.func_dc_offset` - ''' + """ func_duty_cycle_high = _attributes.AttributeViReal64(1250106) - '''Type: float + """Type: float Controls the duty cycle of the square wave the signal generator produces. Specify this property as a percentage of the time the square wave is high in a cycle. set the Waveform parameter to Waveform.SQUARE. @@ -640,9 +678,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.func_duty_cycle_high` - ''' + """ func_frequency = _attributes.AttributeViReal64(1250104) - '''Type: float + """Type: float Controls the frequency of the standard waveform that the signal generator produces. Units: hertz @@ -661,17 +699,17 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.func_frequency` - ''' + """ func_max_buffer_size = _attributes.AttributeViInt32(1150239) - '''Type: int + """Type: int This property sets the maximum number of samples that can be used in the standard method waveform buffer. Increasing this value may increase the quality of the waveform. This property is only valid on devices that implement standard method mode in software, and is read-only for all other devices. implementation of Standard Method Mode on your device. Note: Refer to the Standard Method Mode topic for more information on the - ''' + """ func_start_phase = _attributes.AttributeViReal64(1250105) - '''Type: float + """Type: float Controls horizontal offset of the standard waveform the signal generator produces. Specify this property in degrees of one waveform cycle. A start phase of 180 degrees means output generation begins halfway through the waveform. A start phase of 360 degrees offsets the output by an entire waveform cycle, which is identical to a start phase of 0 degrees. @@ -689,9 +727,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.func_start_phase` - ''' - func_waveform = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.Waveform, 1250101) - '''Type: enums.Waveform + """ + func_waveform = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.Waveform, 1250101 + ) + """Type: enums.Waveform This channel-based property specifies which standard waveform the signal generator produces. Use this property only when output_mode is set to OutputMode.FUNC. @@ -714,63 +754,65 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.func_waveform` - ''' - idle_behavior = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.IdleBehavior, 1150377) - '''Type: enums.IdleBehavior + """ + idle_behavior = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.IdleBehavior, 1150377 + ) + """Type: enums.IdleBehavior Specifies the behavior of the output during the Idle state. The output can be configured to hold the last generated voltage before entering the Idle state or jump to the Idle Value. - ''' + """ idle_value = _attributes.AttributeViInt32(1150378) - '''Type: int + """Type: int Specifies the value to generate in the Idle state. The Idle Behavior must be configured to jump to this value. - ''' + """ instrument_firmware_revision = _attributes.AttributeViString(1050510) - '''Type: str + """Type: str A string that contains the firmware revision information for the device that you are currently using. - ''' + """ instrument_manufacturer = _attributes.AttributeViString(1050511) - '''Type: str + """Type: str A string that contains the name of the device manufacturer you are currently using. - ''' + """ instrument_model = _attributes.AttributeViString(1050512) - '''Type: str + """Type: str A string that contains the model number or name of the device that you are currently using. - ''' + """ io_resource_descriptor = _attributes.AttributeViString(1050304) - '''Type: str + """Type: str Indicates the resource descriptor that NI-FGEN uses to identify the physical device. If you initialize NI-FGEN with a logical name, this property contains the resource descriptor that corresponds to the entry in the IVI Configuration Utility. If you initialize NI-FGEN with the resource descriptor, this property contains that value. - ''' + """ load_impedance = _attributes.AttributeViReal64(1150220) - '''Type: float + """Type: float This channel-based property specifies the load impedance connected to the analog output of the channel. If you set this property to NIFGEN_VAL_MATCHED_LOAD_IMPEDANCE (-1.0), NI-FGEN assumes that the load impedance matches the output impedance. NI-FGEN compensates to give the desired peak-to-peak voltage amplitude or arbitrary gain (relative to 1 V). Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - ''' + """ logical_name = _attributes.AttributeViString(1050305) - '''Type: str + """Type: str A string containing the logical name that you specified when opening the current IVI session. You may pass a logical name to init or InitWithOptions. The IVI Configuration Utility must contain an entry for the logical name. The logical name entry refers to a virtual instrument section in the IVI Configuration file. The virtual instrument section specifies a physical device and initial user options. Note: One or more of the referenced methods are not in the Python API for this driver. - ''' + """ marker_events_count = _attributes.AttributeViInt32(1150271) - '''Type: int + """Type: int Returns the number of markers supported by the device. Use this property when output_mode is set to OutputMode.SCRIPT. - ''' + """ marker_event_output_terminal = _attributes.AttributeViString(1150312) - '''Type: str + """Type: str Specifies the destination terminal for the Marker Event. @@ -783,85 +825,85 @@ class _SessionBase(object): To set/get on all markers, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.marker_event_output_terminal` - ''' + """ max_freq_list_duration = _attributes.AttributeViReal64(1150213) - '''Type: float + """Type: float Returns the maximum duration of any one step in the frequency list. - ''' + """ max_freq_list_length = _attributes.AttributeViInt32(1150211) - '''Type: int + """Type: int Returns the maximum number of steps that can be in a frequency list. - ''' + """ max_loop_count = _attributes.AttributeViInt32(1250215) - '''Type: int + """Type: int Returns the maximum number of times that the signal generator can repeat a waveform in a sequence. Typically, this value is constant for the signal generator. - ''' + """ max_num_freq_lists = _attributes.AttributeViInt32(1150209) - '''Type: int + """Type: int Returns the maximum number of frequency lists the signal generator allows. - ''' + """ max_num_sequences = _attributes.AttributeViInt32(1250212) - '''Type: int + """Type: int Returns the maximum number of arbitrary sequences that the signal generator allows. Typically, this value is constant for the signal generator. - ''' + """ max_num_waveforms = _attributes.AttributeViInt32(1250205) - '''Type: int + """Type: int Returns the maximum number of arbitrary waveforms that the signal generator allows. Typically, this value is constant for the signal generator. - ''' + """ max_sequence_length = _attributes.AttributeViInt32(1250214) - '''Type: int + """Type: int Returns the maximum number of arbitrary waveforms that the signal generator allows in a sequence. Typically, this value is constant for the signal generator. - ''' + """ max_waveform_size = _attributes.AttributeViInt32(1250208) - '''Type: int + """Type: int Returns the size, in samples, of the largest waveform that can be created. This property reflects the space currently available, taking into account previously allocated waveforms and instructions. - ''' + """ memory_size = _attributes.AttributeViInt32(1150242) - '''Type: int + """Type: int The total amount of memory, in bytes, on the signal generator. - ''' + """ min_freq_list_duration = _attributes.AttributeViReal64(1150212) - '''Type: float + """Type: float Returns the minimum number of steps that can be in a frequency list. - ''' + """ min_freq_list_length = _attributes.AttributeViInt32(1150210) - '''Type: int + """Type: int Returns the minimum number of frequency lists that the signal generator allows. - ''' + """ min_sequence_length = _attributes.AttributeViInt32(1250213) - '''Type: int + """Type: int Returns the minimum number of arbitrary waveforms that the signal generator allows in a sequence. Typically, this value is constant for the signal generator. - ''' + """ min_waveform_size = _attributes.AttributeViInt32(1250207) - '''Type: int + """Type: int Returns the minimum number of points that the signal generator allows in an arbitrary waveform. Typically, this value is constant for the signal generator. - ''' + """ module_revision = _attributes.AttributeViString(1150390) - '''Type: str + """Type: str A string that contains the module revision for the device that you are currently using. - ''' + """ channel_count = _attributes.AttributeViInt32(1050203) - '''Type: int + """Type: int Indicates the number of channels that the specific instrument driver supports. For each property for which IVI_VAL_MULTI_CHANNEL is set, the IVI Engine maintains a separate cache value for each channel. - ''' + """ output_enabled = _attributes.AttributeViBoolean(1250003) - '''Type: bool + """Type: bool This channel-based property specifies whether the signal that the signal generator produces appears at the output connector. @@ -874,9 +916,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.output_enabled` - ''' + """ output_impedance = _attributes.AttributeViReal64(1250004) - '''Type: float + """Type: float This channel-based property specifies the signal generator output impedance at the output connector. NI signal sources modules have an output impedance of 50 ohms and an optional 75 ohms on select modules. If the load impedance matches the output impedance, then the voltage at the signal output connector is at the needed level. The voltage at the signal output connector varies with load output impedance, up to doubling the voltage for a high-impedance load. @@ -889,71 +931,81 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.output_impedance` - ''' - output_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.OutputMode, 1250001) - '''Type: enums.OutputMode + """ + output_mode = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.OutputMode, 1250001 + ) + """Type: enums.OutputMode Sets which output mode the signal generator will use. The value you specify determines which methods and properties you use to configure the waveform the signal generator produces. Note: The signal generator must not be in the Generating state when you change this property. To change the device configuration, call abort or wait for the generation to complete. - ''' + """ ready_for_start_event_output_terminal = _attributes.AttributeViString(1150310) - '''Type: str + """Type: str Specifies the destination terminal for the Ready for Start Event. - ''' - reference_clock_source = _attributes.AttributeEnum(_attributes.AttributeViString, enums.ReferenceClockSource, 1150113) - '''Type: enums.ReferenceClockSource + """ + reference_clock_source = _attributes.AttributeEnum( + _attributes.AttributeViString, enums.ReferenceClockSource, 1150113 + ) + """Type: enums.ReferenceClockSource Specifies the reference clock source used by the signal generator. The signal generator derives the frequencies and sample rates that it uses to generate waveforms from the source you specify. For example, when you set this property to ClkIn, the signal generator uses the signal it receives at the CLK IN front panel connector as the Reference clock. To change the device configuration, call abort or wait for the generation to complete. Note: The signal generator must not be in the Generating state when you change this property. - ''' + """ ref_clock_frequency = _attributes.AttributeViReal64(1150107) - '''Type: float + """Type: float Sets the frequency of the signal generator reference clock. The signal generator uses the reference clock to derive frequencies and sample rates when generating output. - ''' - sample_clock_source = _attributes.AttributeEnum(_attributes.AttributeViString, enums.SampleClockSource, 1150112) - '''Type: enums.SampleClockSource + """ + sample_clock_source = _attributes.AttributeEnum( + _attributes.AttributeViString, enums.SampleClockSource, 1150112 + ) + """Type: enums.SampleClockSource Specifies the Sample clock source. If you specify a divisor with the exported_sample_clock_divisor property, the Sample clock exported with the exported_sample_clock_output_terminal property is the value of the Sample clock after it is divided-down. For a list of the terminals available on your device, refer to the Device Routes tab in MAX. To change the device configuration, call abort or wait for the generation to complete. Note: The signal generator must not be in the Generating state when you change this property. - ''' + """ sample_clock_timebase_rate = _attributes.AttributeViReal64(1150368) - '''Type: float + """Type: float Specifies the Sample clock timebase rate. This property applies only to external Sample clock timebases. To change the device configuration, call abort or wait for the generation to complete. Note: The signal generator must not be in the Generating state when you change this property. - ''' - sample_clock_timebase_source = _attributes.AttributeEnum(_attributes.AttributeViString, enums.SampleClockTimebaseSource, 1150367) - '''Type: enums.SampleClockTimebaseSource + """ + sample_clock_timebase_source = _attributes.AttributeEnum( + _attributes.AttributeViString, enums.SampleClockTimebaseSource, 1150367 + ) + """Type: enums.SampleClockTimebaseSource Specifies the Sample Clock Timebase source. To change the device configuration, call the abort method or wait for the generation to complete. Note: The signal generator must not be in the Generating state when you change this property. - ''' + """ script_to_generate = _attributes.AttributeViString(1150270) - '''Type: str + """Type: str Specifies which script the generator produces. To configure the generator to run a particular script, set this property to the name of the script. Use write_script to create multiple scripts. Use this property when output_mode is set to OutputMode.SCRIPT. Note: The signal generator must not be in the Generating state when you change this property. To change the device configuration, call abort or wait for the generation to complete. - ''' + """ script_triggers_count = _attributes.AttributeViInt32(1150272) - '''Type: int + """Type: int Specifies the number of Script triggers supported by the device. Use this property when output_mode is set to OutputMode.SCRIPT. - ''' - script_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ScriptTriggerType, 1150290) - '''Type: enums.ScriptTriggerType + """ + script_trigger_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.ScriptTriggerType, 1150290 + ) + """Type: enums.ScriptTriggerType Specifies the Script trigger type. Depending upon the value of this property, additional properties may need to be configured to fully configure the trigger. @@ -966,14 +1018,14 @@ class _SessionBase(object): To set/get on all script_triggers, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.script_trigger_type` - ''' + """ serial_number = _attributes.AttributeViString(1150243) - '''Type: str + """Type: str The signal generator's serial number. - ''' + """ simulate = _attributes.AttributeViBoolean(1050005) - '''Type: bool + """Type: bool Specifies whether to simulate NI-FGEN I/O operations. If simulation is enabled, NI-FGEN methods perform range checking and call Ivi_GetAttribute and Ivi_SetAttribute, but they do not perform device I/O. For output parameters that represent device data, NI-FGEN methods return calculated values. Default Value: False @@ -981,73 +1033,77 @@ class _SessionBase(object): Note: One or more of the referenced methods are not in the Python API for this driver. - ''' + """ specific_driver_description = _attributes.AttributeViString(1050514) - '''Type: str + """Type: str Returns a brief description of NI-FGEN. - ''' + """ major_version = _attributes.AttributeViInt32(1050503) - '''Type: int + """Type: int Returns the major version number of NI-FGEN. - ''' + """ minor_version = _attributes.AttributeViInt32(1050504) - '''Type: int + """Type: int Returns the minor version number of NI-FGEN. - ''' + """ specific_driver_revision = _attributes.AttributeViString(1050551) - '''Type: str + """Type: str A string that contains additional version information about NI-FGEN. - ''' + """ specific_driver_vendor = _attributes.AttributeViString(1050513) - '''Type: str + """Type: str A string that contains the name of the vendor that supplies NI-FGEN. - ''' + """ started_event_output_terminal = _attributes.AttributeViString(1150314) - '''Type: str + """Type: str Specifies the destination terminal for the Started Event. - ''' - start_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.StartTriggerType, 1150280) - '''Type: enums.StartTriggerType + """ + start_trigger_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.StartTriggerType, 1150280 + ) + """Type: enums.StartTriggerType Specifies whether you want the Start trigger to be a Digital Edge, or Software trigger. You can also choose None as the value for this property. - ''' + """ streaming_space_available_in_waveform = _attributes.AttributeViInt32(1150325) - '''Type: int + """Type: int Indicates the space available (in samples) in the streaming waveform for writing new data. During generation, this available space may be in multiple locations with, for example, part of the available space at the end of the streaming waveform and the rest at the beginning. In this situation, writing a block of waveform data the size of the total space available in the streaming waveform causes NI-FGEN to return an error, as NI-FGEN will not wrap the data from the end of the waveform to the beginning and cannot write data past the end of the waveform buffer. To avoid writing data past the end of the waveform, write new data to the waveform in a fixed size that is an integer divisor of the total size of the streaming waveform. Used in conjunction with the streaming_waveform_handle or streaming_waveform_name properties. - ''' + """ streaming_waveform_handle = _attributes.AttributeViInt32(1150324) - '''Type: int + """Type: int Specifies the waveform handle of the waveform used to continuously stream data during generation. This property defaults to -1 when no streaming waveform is specified. Used in conjunction with streaming_space_available_in_waveform. - ''' + """ streaming_waveform_name = _attributes.AttributeViString(1150326) - '''Type: str + """Type: str Specifies the name of the waveform used to continuously stream data during generation. This property defaults to // when no streaming waveform is specified. Use in conjunction with streaming_space_available_in_waveform. - ''' + """ streaming_write_timeout = _attributes.AttributeViReal64TimeDeltaSeconds(1150409) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the maximum amount of time allowed to complete a streaming write operation. - ''' + """ supported_instrument_models = _attributes.AttributeViString(1050327) - '''Type: str + """Type: str Returns a model code of the device. For NI-FGEN versions that support more than one device, this property contains a comma-separated list of supported device models. - ''' - terminal_configuration = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TerminalConfiguration, 1150365) - '''Type: enums.TerminalConfiguration + """ + terminal_configuration = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TerminalConfiguration, 1150365 + ) + """Type: enums.TerminalConfiguration Specifies whether gain and offset values will be analyzed based on single-ended or differential operation. @@ -1060,9 +1116,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.terminal_configuration` - ''' - trigger_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerMode, 1150108) - '''Type: enums.TriggerMode + """ + trigger_mode = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TriggerMode, 1150108 + ) + """Type: enums.TriggerMode Controls the trigger mode. @@ -1075,60 +1133,74 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.trigger_mode` - ''' - wait_behavior = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.WaitBehavior, 1150379) - '''Type: enums.WaitBehavior + """ + wait_behavior = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.WaitBehavior, 1150379 + ) + """Type: enums.WaitBehavior Specifies the behavior of the output while waiting for a script trigger or during a wait instruction. The output can be configured to hold the last generated voltage before waiting or jump to the Wait Value. - ''' + """ wait_value = _attributes.AttributeViInt32(1150380) - '''Type: int + """Type: int Specifies the value to generate while waiting. The Wait Behavior must be configured to jump to this value. - ''' + """ waveform_quantum = _attributes.AttributeViInt32(1250206) - '''Type: int + """Type: int The size of each arbitrary waveform must be a multiple of a quantum value. This property returns the quantum value that the signal generator allows. For example, when this property returns a value of 8, all waveform sizes must be a multiple of 8. Typically, this value is constant for the signal generator. - ''' + """ - def __init__(self, repeated_capability_list, vi, library, encoding, freeze_it=False): + def __init__( + self, repeated_capability_list, vi, library, encoding, freeze_it=False + ): self._repeated_capability_list = repeated_capability_list - self._repeated_capability = ','.join(repeated_capability_list) + self._repeated_capability = ",".join(repeated_capability_list) self._vi = vi self._library = library self._encoding = encoding # Store the parameter list for later printing in __repr__ param_list = [] - param_list.append("repeated_capability_list=" + pp.pformat(repeated_capability_list)) + param_list.append( + "repeated_capability_list=" + pp.pformat(repeated_capability_list) + ) param_list.append("vi=" + pp.pformat(vi)) param_list.append("library=" + pp.pformat(library)) param_list.append("encoding=" + pp.pformat(encoding)) - self._param_list = ', '.join(param_list) + self._param_list = ", ".join(param_list) # Instantiate any repeated capability objects - self.channels = _RepeatedCapabilities(self, '', repeated_capability_list) - self.script_triggers = _RepeatedCapabilities(self, 'ScriptTrigger', repeated_capability_list) - self.markers = _RepeatedCapabilities(self, 'Marker', repeated_capability_list) - self.data_markers = _RepeatedCapabilities(self, 'DataMarker', repeated_capability_list) + self.channels = _RepeatedCapabilities(self, "", repeated_capability_list) + self.script_triggers = _RepeatedCapabilities( + self, "ScriptTrigger", repeated_capability_list + ) + self.markers = _RepeatedCapabilities(self, "Marker", repeated_capability_list) + self.data_markers = _RepeatedCapabilities( + self, "DataMarker", repeated_capability_list + ) self._is_frozen = freeze_it def __repr__(self): - return '{0}.{1}({2})'.format('nifgen', self.__class__.__name__, self._param_list) + return "{0}.{1}({2})".format( + "nifgen", self.__class__.__name__, self._param_list + ) def __setattr__(self, key, value): if self._is_frozen and key not in dir(self): - raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) + raise AttributeError( + "'{0}' object has no attribute '{1}'".format(type(self).__name__, key) + ) object.__setattr__(self, key, value) def _get_error_description(self, error_code): - '''_get_error_description + """_get_error_description Returns the error description. - ''' + """ try: _, error_string = self._get_error() return error_string @@ -1136,21 +1208,21 @@ def _get_error_description(self, error_code): pass try: - ''' + """ It is expected for _get_error to raise when the session is invalid (IVI spec requires GetError to fail). Use _error_message instead. It doesn't require a session. - ''' + """ error_string = self._error_message(error_code) return error_string except errors.Error: return "Failed to retrieve error description." - ''' These are code-generated ''' + """ These are code-generated """ @ivi_synchronized def allocate_named_waveform(self, waveform_name, waveform_size): - r'''allocate_named_waveform + r"""allocate_named_waveform Specifies the size of a named waveform up front so that it can be allocated in onboard memory before loading the associated data. Data can @@ -1175,18 +1247,26 @@ def allocate_named_waveform(self, waveform_name, waveform_size): **Default Value**: "4096" - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + waveform_name_ctype = ctypes.create_string_buffer( + waveform_name.encode(self._encoding) + ) # case C020 waveform_size_ctype = _visatype.ViInt32(waveform_size) # case S150 - error_code = self._library.niFgen_AllocateNamedWaveform(vi_ctype, channel_name_ctype, waveform_name_ctype, waveform_size_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_AllocateNamedWaveform( + vi_ctype, channel_name_ctype, waveform_name_ctype, waveform_size_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def allocate_waveform(self, waveform_size): - r'''allocate_waveform + r"""allocate_waveform Specifies the size of a waveform so that it can be allocated in onboard memory before loading the associated data. Data can then be loaded in @@ -1215,18 +1295,29 @@ def allocate_waveform(self, waveform_size): waveform_handle (int): The handle that identifies the new waveform. This handle is used later when referring to this waveform. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 waveform_size_ctype = _visatype.ViInt32(waveform_size) # case S150 waveform_handle_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_AllocateWaveform(vi_ctype, channel_name_ctype, waveform_size_ctype, None if waveform_handle_ctype is None else (ctypes.pointer(waveform_handle_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_AllocateWaveform( + vi_ctype, + channel_name_ctype, + waveform_size_ctype, + None + if waveform_handle_ctype is None + else (ctypes.pointer(waveform_handle_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(waveform_handle_ctype.value) @ivi_synchronized def clear_user_standard_waveform(self): - r'''clear_user_standard_waveform + r"""clear_user_standard_waveform Clears the user-defined waveform created by the define_user_standard_waveform method. @@ -1241,16 +1332,22 @@ def clear_user_standard_waveform(self): To call the method on all channels, you can call it directly on the :py:class:`nifgen.Session`. Example: :py:meth:`my_session.clear_user_standard_waveform` - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - error_code = self._library.niFgen_ClearUserStandardWaveform(vi_ctype, channel_name_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + error_code = self._library.niFgen_ClearUserStandardWaveform( + vi_ctype, channel_name_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def configure_arb_sequence(self, sequence_handle, gain, offset): - r'''configure_arb_sequence + r"""configure_arb_sequence Configures the signal generator properties that affect arbitrary sequence generation. Sets the arb_sequence_handle, @@ -1307,19 +1404,29 @@ def configure_arb_sequence(self, sequence_handle, gain, offset): **Default Value**: None - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 sequence_handle_ctype = _visatype.ViInt32(sequence_handle) # case S150 gain_ctype = _visatype.ViReal64(gain) # case S150 offset_ctype = _visatype.ViReal64(offset) # case S150 - error_code = self._library.niFgen_ConfigureArbSequence(vi_ctype, channel_name_ctype, sequence_handle_ctype, gain_ctype, offset_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_ConfigureArbSequence( + vi_ctype, + channel_name_ctype, + sequence_handle_ctype, + gain_ctype, + offset_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def configure_arb_waveform(self, waveform_handle, gain, offset): - r'''configure_arb_waveform + r"""configure_arb_waveform Configures the properties of the signal generator that affect arbitrary waveform generation. Sets the arb_waveform_handle, @@ -1382,19 +1489,31 @@ def configure_arb_waveform(self, waveform_handle, gain, offset): **Default Value**: None - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 waveform_handle_ctype = _visatype.ViInt32(waveform_handle) # case S150 gain_ctype = _visatype.ViReal64(gain) # case S150 offset_ctype = _visatype.ViReal64(offset) # case S150 - error_code = self._library.niFgen_ConfigureArbWaveform(vi_ctype, channel_name_ctype, waveform_handle_ctype, gain_ctype, offset_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_ConfigureArbWaveform( + vi_ctype, + channel_name_ctype, + waveform_handle_ctype, + gain_ctype, + offset_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def configure_freq_list(self, frequency_list_handle, amplitude, dc_offset=0.0, start_phase=0.0): - r'''configure_freq_list + def configure_freq_list( + self, frequency_list_handle, amplitude, dc_offset=0.0, start_phase=0.0 + ): + r"""configure_freq_list Configures the properties of the signal generator that affect frequency list generation (the freq_list_handle, @@ -1469,20 +1588,35 @@ def configure_freq_list(self, frequency_list_handle, amplitude, dc_offset=0.0, s This parameter does not affect signal generator behavior when you set the **waveform** parameter to Waveform.DC. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - frequency_list_handle_ctype = _visatype.ViInt32(frequency_list_handle) # case S150 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + frequency_list_handle_ctype = _visatype.ViInt32( + frequency_list_handle + ) # case S150 amplitude_ctype = _visatype.ViReal64(amplitude) # case S150 dc_offset_ctype = _visatype.ViReal64(dc_offset) # case S150 start_phase_ctype = _visatype.ViReal64(start_phase) # case S150 - error_code = self._library.niFgen_ConfigureFreqList(vi_ctype, channel_name_ctype, frequency_list_handle_ctype, amplitude_ctype, dc_offset_ctype, start_phase_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_ConfigureFreqList( + vi_ctype, + channel_name_ctype, + frequency_list_handle_ctype, + amplitude_ctype, + dc_offset_ctype, + start_phase_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def configure_standard_waveform(self, waveform, amplitude, frequency, dc_offset=0.0, start_phase=0.0): - r'''configure_standard_waveform + def configure_standard_waveform( + self, waveform, amplitude, frequency, dc_offset=0.0, start_phase=0.0 + ): + r"""configure_standard_waveform Configures the following properties of the signal generator that affect standard waveform generation: @@ -1597,23 +1731,35 @@ def configure_standard_waveform(self, waveform, amplitude, frequency, dc_offset= This parameter does not affect signal generator behavior when you set the **waveform** parameter to Waveform.DC. - ''' + """ if type(waveform) is not enums.Waveform: - raise TypeError('Parameter waveform must be of type ' + str(enums.Waveform)) + raise TypeError("Parameter waveform must be of type " + str(enums.Waveform)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 waveform_ctype = _visatype.ViInt32(waveform.value) # case S130 amplitude_ctype = _visatype.ViReal64(amplitude) # case S150 dc_offset_ctype = _visatype.ViReal64(dc_offset) # case S150 frequency_ctype = _visatype.ViReal64(frequency) # case S150 start_phase_ctype = _visatype.ViReal64(start_phase) # case S150 - error_code = self._library.niFgen_ConfigureStandardWaveform(vi_ctype, channel_name_ctype, waveform_ctype, amplitude_ctype, dc_offset_ctype, frequency_ctype, start_phase_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_ConfigureStandardWaveform( + vi_ctype, + channel_name_ctype, + waveform_ctype, + amplitude_ctype, + dc_offset_ctype, + frequency_ctype, + start_phase_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def create_waveform(self, waveform_data_array): - '''create_waveform + """create_waveform Creates an onboard waveform for use in Arbitrary Waveform output mode or Arbitrary Sequence output mode. @@ -1637,29 +1783,38 @@ def create_waveform(self, waveform_data_array): Returns: waveform_handle (int): The handle that identifies the new waveform. This handle is used in other methods when referring to this waveform. - ''' + """ # Check the type by using string comparison so that we don't import numpy unnecessarily. if str(type(waveform_data_array)).find("'numpy.ndarray'") != -1: import numpy + if waveform_data_array.dtype == numpy.float64: return self._create_waveform_f64_numpy(waveform_data_array) elif waveform_data_array.dtype == numpy.int16: return self._create_waveform_i16_numpy(waveform_data_array) else: - raise TypeError("Unsupported dtype. Is {0}, expected {1} or {2}".format(waveform_data_array.dtype, numpy.float64, numpy.int16)) + raise TypeError( + "Unsupported dtype. Is {0}, expected {1} or {2}".format( + waveform_data_array.dtype, numpy.float64, numpy.int16 + ) + ) elif isinstance(waveform_data_array, array.array): - if waveform_data_array.typecode == 'd': + if waveform_data_array.typecode == "d": return self._create_waveform_f64(waveform_data_array) - elif waveform_data_array.typecode == 'h': + elif waveform_data_array.typecode == "h": return self._create_waveform_i16(waveform_data_array) else: - raise TypeError("Unsupported dtype. Is {0}, expected {1} or {2}".format(waveform_data_array.typecode, 'd (double)', 'h (16 bit int)')) + raise TypeError( + "Unsupported dtype. Is {0}, expected {1} or {2}".format( + waveform_data_array.typecode, "d (double)", "h (16 bit int)" + ) + ) return self._create_waveform_f64(waveform_data_array) @ivi_synchronized def _create_waveform_f64(self, waveform_data_array): - r'''_create_waveform_f64 + r"""_create_waveform_f64 Creates an onboard waveform from binary F64 (floating point double) data for use in Arbitrary Waveform output mode or Arbitrary Sequence output @@ -1698,20 +1853,38 @@ def _create_waveform_f64(self, waveform_data_array): waveform_handle (int): The handle that identifies the new waveform. This handle is used later when referring to this waveform. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - waveform_size_ctype = _visatype.ViInt32(0 if waveform_data_array is None else len(waveform_data_array)) # case S160 - waveform_data_array_array = get_ctypes_and_array(value=waveform_data_array, array_type="d") # case B550 - waveform_data_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_data_array_array, library_type=_visatype.ViReal64) # case B550 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + waveform_size_ctype = _visatype.ViInt32( + 0 if waveform_data_array is None else len(waveform_data_array) + ) # case S160 + waveform_data_array_array = get_ctypes_and_array( + value=waveform_data_array, array_type="d" + ) # case B550 + waveform_data_array_ctype = get_ctypes_pointer_for_buffer( + value=waveform_data_array_array, library_type=_visatype.ViReal64 + ) # case B550 waveform_handle_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_CreateWaveformF64(vi_ctype, channel_name_ctype, waveform_size_ctype, waveform_data_array_ctype, None if waveform_handle_ctype is None else (ctypes.pointer(waveform_handle_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_CreateWaveformF64( + vi_ctype, + channel_name_ctype, + waveform_size_ctype, + waveform_data_array_ctype, + None + if waveform_handle_ctype is None + else (ctypes.pointer(waveform_handle_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(waveform_handle_ctype.value) @ivi_synchronized def _create_waveform_f64_numpy(self, waveform_data_array): - r'''_create_waveform_f64 + r"""_create_waveform_f64 Creates an onboard waveform from binary F64 (floating point double) data for use in Arbitrary Waveform output mode or Arbitrary Sequence output @@ -1750,27 +1923,50 @@ def _create_waveform_f64_numpy(self, waveform_data_array): waveform_handle (int): The handle that identifies the new waveform. This handle is used later when referring to this waveform. - ''' + """ import numpy if type(waveform_data_array) is not numpy.ndarray: - raise TypeError('waveform_data_array must be {0}, is {1}'.format(numpy.ndarray, type(waveform_data_array))) + raise TypeError( + "waveform_data_array must be {0}, is {1}".format( + numpy.ndarray, type(waveform_data_array) + ) + ) if numpy.isfortran(waveform_data_array) is True: - raise TypeError('waveform_data_array must be in C-order') - if waveform_data_array.dtype is not numpy.dtype('float64'): - raise TypeError('waveform_data_array must be numpy.ndarray of dtype=float64, is ' + str(waveform_data_array.dtype)) + raise TypeError("waveform_data_array must be in C-order") + if waveform_data_array.dtype is not numpy.dtype("float64"): + raise TypeError( + "waveform_data_array must be numpy.ndarray of dtype=float64, is " + + str(waveform_data_array.dtype) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - waveform_size_ctype = _visatype.ViInt32(0 if waveform_data_array is None else len(waveform_data_array)) # case S160 - waveform_data_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_data_array) # case B510 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + waveform_size_ctype = _visatype.ViInt32( + 0 if waveform_data_array is None else len(waveform_data_array) + ) # case S160 + waveform_data_array_ctype = get_ctypes_pointer_for_buffer( + value=waveform_data_array + ) # case B510 waveform_handle_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_CreateWaveformF64(vi_ctype, channel_name_ctype, waveform_size_ctype, waveform_data_array_ctype, None if waveform_handle_ctype is None else (ctypes.pointer(waveform_handle_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_CreateWaveformF64( + vi_ctype, + channel_name_ctype, + waveform_size_ctype, + waveform_data_array_ctype, + None + if waveform_handle_ctype is None + else (ctypes.pointer(waveform_handle_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(waveform_handle_ctype.value) @ivi_synchronized def create_waveform_from_file_f64(self, file_name, byte_order): - r'''create_waveform_from_file_f64 + r"""create_waveform_from_file_f64 This method takes the floating point double (F64) data from the specified file and creates an onboard waveform for use in Arbitrary @@ -1823,21 +2019,37 @@ def create_waveform_from_file_f64(self, file_name, byte_order): waveform_handle (int): The handle that identifies the new waveform. This handle is used later when referring to this waveform. - ''' + """ if type(byte_order) is not enums.ByteOrder: - raise TypeError('Parameter byte_order must be of type ' + str(enums.ByteOrder)) + raise TypeError( + "Parameter byte_order must be of type " + str(enums.ByteOrder) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - file_name_ctype = ctypes.create_string_buffer(file_name.encode(self._encoding)) # case C020 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + file_name_ctype = ctypes.create_string_buffer( + file_name.encode(self._encoding) + ) # case C020 byte_order_ctype = _visatype.ViInt32(byte_order.value) # case S130 waveform_handle_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_CreateWaveformFromFileF64(vi_ctype, channel_name_ctype, file_name_ctype, byte_order_ctype, None if waveform_handle_ctype is None else (ctypes.pointer(waveform_handle_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_CreateWaveformFromFileF64( + vi_ctype, + channel_name_ctype, + file_name_ctype, + byte_order_ctype, + None + if waveform_handle_ctype is None + else (ctypes.pointer(waveform_handle_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(waveform_handle_ctype.value) @ivi_synchronized def create_waveform_from_file_i16(self, file_name, byte_order): - r'''create_waveform_from_file_i16 + r"""create_waveform_from_file_i16 Takes the binary 16-bit signed integer (I16) data from the specified file and creates an onboard waveform for use in Arbitrary Waveform or @@ -1890,21 +2102,37 @@ def create_waveform_from_file_i16(self, file_name, byte_order): waveform_handle (int): The handle that identifies the new waveform. This handle is used later when referring to this waveform. - ''' + """ if type(byte_order) is not enums.ByteOrder: - raise TypeError('Parameter byte_order must be of type ' + str(enums.ByteOrder)) + raise TypeError( + "Parameter byte_order must be of type " + str(enums.ByteOrder) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - file_name_ctype = ctypes.create_string_buffer(file_name.encode(self._encoding)) # case C020 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + file_name_ctype = ctypes.create_string_buffer( + file_name.encode(self._encoding) + ) # case C020 byte_order_ctype = _visatype.ViInt32(byte_order.value) # case S130 waveform_handle_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_CreateWaveformFromFileI16(vi_ctype, channel_name_ctype, file_name_ctype, byte_order_ctype, None if waveform_handle_ctype is None else (ctypes.pointer(waveform_handle_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_CreateWaveformFromFileI16( + vi_ctype, + channel_name_ctype, + file_name_ctype, + byte_order_ctype, + None + if waveform_handle_ctype is None + else (ctypes.pointer(waveform_handle_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(waveform_handle_ctype.value) @ivi_synchronized def _create_waveform_i16_numpy(self, waveform_data_array): - r'''_create_waveform_i16 + r"""_create_waveform_i16 Creates an onboard waveform from binary 16-bit signed integer (I16) data for use in Arbitrary Waveform or Arbitrary Sequence output mode. The @@ -1941,27 +2169,50 @@ def _create_waveform_i16_numpy(self, waveform_data_array): waveform_handle (int): The handle that identifies the new waveform. This handle is used later when referring to this waveform. - ''' + """ import numpy if type(waveform_data_array) is not numpy.ndarray: - raise TypeError('waveform_data_array must be {0}, is {1}'.format(numpy.ndarray, type(waveform_data_array))) + raise TypeError( + "waveform_data_array must be {0}, is {1}".format( + numpy.ndarray, type(waveform_data_array) + ) + ) if numpy.isfortran(waveform_data_array) is True: - raise TypeError('waveform_data_array must be in C-order') - if waveform_data_array.dtype is not numpy.dtype('int16'): - raise TypeError('waveform_data_array must be numpy.ndarray of dtype=int16, is ' + str(waveform_data_array.dtype)) + raise TypeError("waveform_data_array must be in C-order") + if waveform_data_array.dtype is not numpy.dtype("int16"): + raise TypeError( + "waveform_data_array must be numpy.ndarray of dtype=int16, is " + + str(waveform_data_array.dtype) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - waveform_size_ctype = _visatype.ViInt32(0 if waveform_data_array is None else len(waveform_data_array)) # case S160 - waveform_data_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_data_array) # case B510 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + waveform_size_ctype = _visatype.ViInt32( + 0 if waveform_data_array is None else len(waveform_data_array) + ) # case S160 + waveform_data_array_ctype = get_ctypes_pointer_for_buffer( + value=waveform_data_array + ) # case B510 waveform_handle_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_CreateWaveformI16(vi_ctype, channel_name_ctype, waveform_size_ctype, waveform_data_array_ctype, None if waveform_handle_ctype is None else (ctypes.pointer(waveform_handle_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_CreateWaveformI16( + vi_ctype, + channel_name_ctype, + waveform_size_ctype, + waveform_data_array_ctype, + None + if waveform_handle_ctype is None + else (ctypes.pointer(waveform_handle_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(waveform_handle_ctype.value) @ivi_synchronized def define_user_standard_waveform(self, waveform_data_array): - r'''define_user_standard_waveform + r"""define_user_standard_waveform Defines a user waveform for use in either Standard Method or Frequency List output mode. @@ -2000,18 +2251,28 @@ def define_user_standard_waveform(self, waveform_data_array): **Default Value**: None - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - waveform_size_ctype = _visatype.ViInt32(0 if waveform_data_array is None else len(waveform_data_array)) # case S160 - waveform_data_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_data_array, library_type=_visatype.ViReal64) # case B550 - error_code = self._library.niFgen_DefineUserStandardWaveform(vi_ctype, channel_name_ctype, waveform_size_ctype, waveform_data_array_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + waveform_size_ctype = _visatype.ViInt32( + 0 if waveform_data_array is None else len(waveform_data_array) + ) # case S160 + waveform_data_array_ctype = get_ctypes_pointer_for_buffer( + value=waveform_data_array, library_type=_visatype.ViReal64 + ) # case B550 + error_code = self._library.niFgen_DefineUserStandardWaveform( + vi_ctype, channel_name_ctype, waveform_size_ctype, waveform_data_array_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _delete_named_waveform(self, waveform_name): - r'''_delete_named_waveform + r"""_delete_named_waveform Removes a previously created arbitrary waveform from the signal generator memory and invalidates the waveform handle. @@ -2034,17 +2295,25 @@ def _delete_named_waveform(self, waveform_name): Args: waveform_name (str): Specifies the name to associate with the allocated waveform. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 - error_code = self._library.niFgen_DeleteNamedWaveform(vi_ctype, channel_name_ctype, waveform_name_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + waveform_name_ctype = ctypes.create_string_buffer( + waveform_name.encode(self._encoding) + ) # case C020 + error_code = self._library.niFgen_DeleteNamedWaveform( + vi_ctype, channel_name_ctype, waveform_name_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def delete_script(self, script_name): - r'''delete_script + r"""delete_script Deletes the specified script from onboard memory. @@ -2063,17 +2332,25 @@ def delete_script(self, script_name): script_name (str): Specifies the name of the script you want to delete. The script name appears in the text of the script following the script keyword. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - script_name_ctype = ctypes.create_string_buffer(script_name.encode(self._encoding)) # case C020 - error_code = self._library.niFgen_DeleteScript(vi_ctype, channel_name_ctype, script_name_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + script_name_ctype = ctypes.create_string_buffer( + script_name.encode(self._encoding) + ) # case C020 + error_code = self._library.niFgen_DeleteScript( + vi_ctype, channel_name_ctype, script_name_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def delete_waveform(self, waveform_name_or_handle): - '''delete_waveform + """delete_waveform Removes a previously created arbitrary waveform from the signal generator memory. @@ -2093,7 +2370,7 @@ def delete_waveform(self, waveform_name_or_handle): Args: waveform_name_or_handle (str or int): The name (str) or handle (int) of an arbitrary waveform previously allocated with allocate_named_waveform, allocate_waveform or create_waveform. - ''' + """ if isinstance(waveform_name_or_handle, str): return self._delete_named_waveform(waveform_name_or_handle) else: @@ -2101,7 +2378,7 @@ def delete_waveform(self, waveform_name_or_handle): @ivi_synchronized def _get_attribute_vi_boolean(self, attribute_id): - r'''_get_attribute_vi_boolean + r"""_get_attribute_vi_boolean Queries the value of a ViBoolean property. @@ -2133,18 +2410,29 @@ def _get_attribute_vi_boolean(self, attribute_id): attribute_value (bool): Returns the current value of the property. Pass the address of a ViBoolean variable. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niFgen_GetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_GetAttributeViBoolean( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + None + if attribute_value_ctype is None + else (ctypes.pointer(attribute_value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return bool(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_int32(self, attribute_id): - r'''_get_attribute_vi_int32 + r"""_get_attribute_vi_int32 Queries the value of a ViInt32 property. You can use this method to get the values of instrument-specific properties and inherent IVI @@ -2174,18 +2462,29 @@ def _get_attribute_vi_int32(self, attribute_id): attribute_value (int): Returns the current value of the property. Pass the address of a ViInt32 variable. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_GetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_GetAttributeViInt32( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + None + if attribute_value_ctype is None + else (ctypes.pointer(attribute_value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_real64(self, attribute_id): - r'''_get_attribute_vi_real64 + r"""_get_attribute_vi_real64 Queries the value of a ViReal64 property. @@ -2217,18 +2516,29 @@ def _get_attribute_vi_real64(self, attribute_id): attribute_value (float): Returns the current value of the property. Pass the address of a ViReal64 variable. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niFgen_GetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_GetAttributeViReal64( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + None + if attribute_value_ctype is None + else (ctypes.pointer(attribute_value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_string(self, attribute_id): - r'''_get_attribute_vi_string + r"""_get_attribute_vi_string Queries the value of a ViString property. @@ -2290,22 +2600,42 @@ def _get_attribute_vi_string(self, attribute_id): If you specify 0 for the **arraySize** parameter, you can pass VI_NULL for this parameter. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 array_size_ctype = _visatype.ViInt32() # case S170 attribute_value_ctype = None # case C050 - error_code = self._library.niFgen_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, array_size_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niFgen_GetAttributeViString( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + array_size_ctype, + attribute_value_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) array_size_ctype = _visatype.ViInt32(error_code) # case S180 - attribute_value_ctype = (_visatype.ViChar * array_size_ctype.value)() # case C060 - error_code = self._library.niFgen_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, array_size_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + attribute_value_ctype = ( + _visatype.ViChar * array_size_ctype.value + )() # case C060 + error_code = self._library.niFgen_GetAttributeViString( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + array_size_ctype, + attribute_value_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return attribute_value_ctype.value.decode(self._encoding) def _get_error(self): - r'''_get_error + r"""_get_error Returns the error information associated with an IVI session or with the current execution thread. If you specify a valid IVI session for the @@ -2339,21 +2669,39 @@ def _get_error(self): Otherwise, you must pass a ViChar array of a size specified with the **errorDescriptionBufferSize** parameter. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus() # case S220 error_description_buffer_size_ctype = _visatype.ViInt32() # case S170 error_description_ctype = None # case C050 - error_code = self._library.niFgen_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), error_description_buffer_size_ctype, error_description_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True) + error_code = self._library.niFgen_GetError( + vi_ctype, + None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), + error_description_buffer_size_ctype, + error_description_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=True + ) error_description_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - error_description_ctype = (_visatype.ViChar * error_description_buffer_size_ctype.value)() # case C060 - error_code = self._library.niFgen_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), error_description_buffer_size_ctype, error_description_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) - return int(error_code_ctype.value), error_description_ctype.value.decode(self._encoding) + error_description_ctype = ( + _visatype.ViChar * error_description_buffer_size_ctype.value + )() # case C060 + error_code = self._library.niFgen_GetError( + vi_ctype, + None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), + error_description_buffer_size_ctype, + error_description_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) + return int(error_code_ctype.value), error_description_ctype.value.decode( + self._encoding + ) def lock(self): - '''lock + """lock Obtains a multithread lock on the device session. Before doing so, the software waits until all other execution threads release their locks @@ -2381,25 +2729,27 @@ def lock(self): Returns: lock (context manager): When used in a with statement, nifgen.Session.lock acts as a context manager and unlock will be called when the with block is exited - ''' + """ self._lock_session() # We do not call _lock_session() in the context manager so that this function can # act standalone as well and let the client call unlock() explicitly. If they do use the context manager, # that will handle the unlock for them return _Lock(self) def _lock_session(self): - '''_lock_session + """_lock_session Actual call to driver - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_LockSession(vi_ctype, None) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return @ivi_synchronized def send_software_edge_trigger(self, trigger=None, trigger_id=None): - '''send_software_edge_trigger + """send_software_edge_trigger Sends a command to trigger the signal generator. This VI can act as an override for an external edge trigger. @@ -2424,10 +2774,14 @@ def send_software_edge_trigger(self, trigger=None, trigger_id=None): trigger_id (str): Trigger ID specifies the Script Trigger to use for triggering. - ''' + """ if trigger is None or trigger_id is None: import warnings - warnings.warn('trigger and trigger_id should now always be passed in to the method', category=DeprecationWarning) + + warnings.warn( + "trigger and trigger_id should now always be passed in to the method", + category=DeprecationWarning, + ) # We look at whether we are called directly on the session or a repeated capability container to determine how to behave if len(self._repeated_capability) > 0: @@ -2441,20 +2795,30 @@ def send_software_edge_trigger(self, trigger=None, trigger_id=None): pass # This is how the function should be called else: - raise ValueError('Both trigger ({0}) and trigger_id ({1}) should be passed in to the method'.format(str(trigger), str(trigger_id))) + raise ValueError( + "Both trigger ({0}) and trigger_id ({1}) should be passed in to the method".format( + str(trigger), str(trigger_id) + ) + ) if type(trigger) is not enums.Trigger: - raise TypeError('Parameter trigger must be of type ' + str(enums.Trigger)) + raise TypeError("Parameter trigger must be of type " + str(enums.Trigger)) vi_ctype = _visatype.ViSession(self._vi) # case S110 trigger_ctype = _visatype.ViInt32(trigger.value) # case S130 - trigger_id_ctype = ctypes.create_string_buffer(trigger_id.encode(self._encoding)) # case C020 - error_code = self._library.niFgen_SendSoftwareEdgeTrigger(vi_ctype, trigger_ctype, trigger_id_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + trigger_id_ctype = ctypes.create_string_buffer( + trigger_id.encode(self._encoding) + ) # case C020 + error_code = self._library.niFgen_SendSoftwareEdgeTrigger( + vi_ctype, trigger_ctype, trigger_id_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_boolean(self, attribute_id, attribute_value): - r'''_set_attribute_vi_boolean + r"""_set_attribute_vi_boolean Sets the value of a ViBoolean property. @@ -2502,18 +2866,24 @@ def _set_attribute_vi_boolean(self, attribute_id, attribute_value): Some of the values might not be valid depending on the current settings of the instrument session. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViBoolean(attribute_value) # case S150 - error_code = self._library.niFgen_SetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_SetAttributeViBoolean( + vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_int32(self, attribute_id, attribute_value): - r'''_set_attribute_vi_int32 + r"""_set_attribute_vi_int32 Sets the value of a ViInt32 property. @@ -2561,18 +2931,24 @@ def _set_attribute_vi_int32(self, attribute_id, attribute_value): Some of the values might not be valid depending on the current settings of the instrument session. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt32(attribute_value) # case S150 - error_code = self._library.niFgen_SetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_SetAttributeViInt32( + vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_real64(self, attribute_id, attribute_value): - r'''_set_attribute_vi_real64 + r"""_set_attribute_vi_real64 Sets the value of a ViReal64 property. @@ -2620,18 +2996,24 @@ def _set_attribute_vi_real64(self, attribute_id, attribute_value): Some of the values might not be valid depending on the current settings of the instrument session. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViReal64(attribute_value) # case S150 - error_code = self._library.niFgen_SetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_SetAttributeViReal64( + vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_string(self, attribute_id, attribute_value): - r'''_set_attribute_vi_string + r"""_set_attribute_vi_string Sets the value of a ViString property. @@ -2679,18 +3061,28 @@ def _set_attribute_vi_string(self, attribute_id, attribute_value): Some of the values might not be valid depending on the current settings of the instrument session. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 - attribute_value_ctype = ctypes.create_string_buffer(attribute_value.encode(self._encoding)) # case C020 - error_code = self._library.niFgen_SetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + attribute_value_ctype = ctypes.create_string_buffer( + attribute_value.encode(self._encoding) + ) # case C020 + error_code = self._library.niFgen_SetAttributeViString( + vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def _set_named_waveform_next_write_position(self, waveform_name, relative_to, offset): - r'''_set_named_waveform_next_write_position + def _set_named_waveform_next_write_position( + self, waveform_name, relative_to, offset + ): + r"""_set_named_waveform_next_write_position Sets the position in the waveform to which data is written at the next write. This method allows you to write to arbitrary locations within @@ -2735,21 +3127,35 @@ def _set_named_waveform_next_write_position(self, waveform_name, relative_to, of offset (int): Specifies the offset from the **relativeTo** parameter at which to start loading the data into the waveform. - ''' + """ if type(relative_to) is not enums.RelativeTo: - raise TypeError('Parameter relative_to must be of type ' + str(enums.RelativeTo)) + raise TypeError( + "Parameter relative_to must be of type " + str(enums.RelativeTo) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + waveform_name_ctype = ctypes.create_string_buffer( + waveform_name.encode(self._encoding) + ) # case C020 relative_to_ctype = _visatype.ViInt32(relative_to.value) # case S130 offset_ctype = _visatype.ViInt32(offset) # case S150 - error_code = self._library.niFgen_SetNamedWaveformNextWritePosition(vi_ctype, channel_name_ctype, waveform_name_ctype, relative_to_ctype, offset_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_SetNamedWaveformNextWritePosition( + vi_ctype, + channel_name_ctype, + waveform_name_ctype, + relative_to_ctype, + offset_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def set_next_write_position(self, waveform_name_or_handle, relative_to, offset): - '''set_next_write_position + """set_next_write_position Sets the position in the waveform at which the next waveform data is written. This method allows you to write to arbitrary locations within @@ -2789,15 +3195,19 @@ def set_next_write_position(self, waveform_name_or_handle, relative_to, offset): offset (int): Specifies the offset from **relativeTo** at which to start loading the data into the waveform. - ''' + """ if isinstance(waveform_name_or_handle, str): - return self._set_named_waveform_next_write_position(waveform_name_or_handle, relative_to, offset) + return self._set_named_waveform_next_write_position( + waveform_name_or_handle, relative_to, offset + ) else: - return self._set_waveform_next_write_position(waveform_name_or_handle, relative_to, offset) + return self._set_waveform_next_write_position( + waveform_name_or_handle, relative_to, offset + ) @ivi_synchronized def _set_waveform_next_write_position(self, waveform_handle, relative_to, offset): - r'''_set_waveform_next_write_position + r"""_set_waveform_next_write_position Sets the position in the waveform at which the next waveform data is written. This method allows you to write to arbitrary locations within @@ -2843,33 +3253,47 @@ def _set_waveform_next_write_position(self, waveform_handle, relative_to, offset offset (int): Specifies the offset from **relativeTo** at which to start loading the data into the waveform. - ''' + """ if type(relative_to) is not enums.RelativeTo: - raise TypeError('Parameter relative_to must be of type ' + str(enums.RelativeTo)) + raise TypeError( + "Parameter relative_to must be of type " + str(enums.RelativeTo) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 waveform_handle_ctype = _visatype.ViInt32(waveform_handle) # case S150 relative_to_ctype = _visatype.ViInt32(relative_to.value) # case S130 offset_ctype = _visatype.ViInt32(offset) # case S150 - error_code = self._library.niFgen_SetWaveformNextWritePosition(vi_ctype, channel_name_ctype, waveform_handle_ctype, relative_to_ctype, offset_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_SetWaveformNextWritePosition( + vi_ctype, + channel_name_ctype, + waveform_handle_ctype, + relative_to_ctype, + offset_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def unlock(self): - '''unlock + """unlock Releases a lock that you acquired on an device session using lock. Refer to lock for additional information on session locks. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_UnlockSession(vi_ctype, None) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return @ivi_synchronized def _write_binary16_waveform_numpy(self, waveform_handle, data): - r'''_write_binary16_waveform + r"""_write_binary16_waveform Writes binary data to the waveform in onboard memory. The waveform handle passed must have been created by a call to the @@ -2903,27 +3327,37 @@ def _write_binary16_waveform_numpy(self, waveform_handle, data): have at least as many elements as the value in **size**. The binary data is left-justified. - ''' + """ import numpy if type(data) is not numpy.ndarray: - raise TypeError('data must be {0}, is {1}'.format(numpy.ndarray, type(data))) + raise TypeError( + "data must be {0}, is {1}".format(numpy.ndarray, type(data)) + ) if numpy.isfortran(data) is True: - raise TypeError('data must be in C-order') - if data.dtype is not numpy.dtype('int16'): - raise TypeError('data must be numpy.ndarray of dtype=int16, is ' + str(data.dtype)) + raise TypeError("data must be in C-order") + if data.dtype is not numpy.dtype("int16"): + raise TypeError( + "data must be numpy.ndarray of dtype=int16, is " + str(data.dtype) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 waveform_handle_ctype = _visatype.ViInt32(waveform_handle) # case S150 size_ctype = _visatype.ViInt32(0 if data is None else len(data)) # case S160 data_ctype = get_ctypes_pointer_for_buffer(value=data) # case B510 - error_code = self._library.niFgen_WriteBinary16Waveform(vi_ctype, channel_name_ctype, waveform_handle_ctype, size_ctype, data_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_WriteBinary16Waveform( + vi_ctype, channel_name_ctype, waveform_handle_ctype, size_ctype, data_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _write_named_waveform_f64(self, waveform_name, data): - r'''_write_named_waveform_f64 + r"""_write_named_waveform_f64 Writes floating-point data to the waveform in onboard memory. The waveform handle passed in must have been created by a call to the @@ -2961,20 +3395,30 @@ def _write_named_waveform_f64(self, waveform_name, data): data (array.array("d")): Specifies the array of data to load into the waveform. The array must have at least as many elements as the value in **size**. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + waveform_name_ctype = ctypes.create_string_buffer( + waveform_name.encode(self._encoding) + ) # case C020 size_ctype = _visatype.ViInt32(0 if data is None else len(data)) # case S160 data_array = get_ctypes_and_array(value=data, array_type="d") # case B550 - data_ctype = get_ctypes_pointer_for_buffer(value=data_array, library_type=_visatype.ViReal64) # case B550 - error_code = self._library.niFgen_WriteNamedWaveformF64(vi_ctype, channel_name_ctype, waveform_name_ctype, size_ctype, data_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + data_ctype = get_ctypes_pointer_for_buffer( + value=data_array, library_type=_visatype.ViReal64 + ) # case B550 + error_code = self._library.niFgen_WriteNamedWaveformF64( + vi_ctype, channel_name_ctype, waveform_name_ctype, size_ctype, data_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _write_named_waveform_f64_numpy(self, waveform_name, data): - r'''_write_named_waveform_f64 + r"""_write_named_waveform_f64 Writes floating-point data to the waveform in onboard memory. The waveform handle passed in must have been created by a call to the @@ -3012,27 +3456,39 @@ def _write_named_waveform_f64_numpy(self, waveform_name, data): data (numpy.array(dtype=numpy.float64)): Specifies the array of data to load into the waveform. The array must have at least as many elements as the value in **size**. - ''' + """ import numpy if type(data) is not numpy.ndarray: - raise TypeError('data must be {0}, is {1}'.format(numpy.ndarray, type(data))) + raise TypeError( + "data must be {0}, is {1}".format(numpy.ndarray, type(data)) + ) if numpy.isfortran(data) is True: - raise TypeError('data must be in C-order') - if data.dtype is not numpy.dtype('float64'): - raise TypeError('data must be numpy.ndarray of dtype=float64, is ' + str(data.dtype)) + raise TypeError("data must be in C-order") + if data.dtype is not numpy.dtype("float64"): + raise TypeError( + "data must be numpy.ndarray of dtype=float64, is " + str(data.dtype) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + waveform_name_ctype = ctypes.create_string_buffer( + waveform_name.encode(self._encoding) + ) # case C020 size_ctype = _visatype.ViInt32(0 if data is None else len(data)) # case S160 data_ctype = get_ctypes_pointer_for_buffer(value=data) # case B510 - error_code = self._library.niFgen_WriteNamedWaveformF64(vi_ctype, channel_name_ctype, waveform_name_ctype, size_ctype, data_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_WriteNamedWaveformF64( + vi_ctype, channel_name_ctype, waveform_name_ctype, size_ctype, data_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _write_named_waveform_i16_numpy(self, waveform_name, data): - r'''_write_named_waveform_i16 + r"""_write_named_waveform_i16 Writes binary data to the named waveform in onboard memory. @@ -3062,27 +3518,39 @@ def _write_named_waveform_i16_numpy(self, waveform_name, data): data (numpy.array(dtype=numpy.int16)): Specifies the array of data to load into the waveform. The array must have at least as many elements as the value in **size**. - ''' + """ import numpy if type(data) is not numpy.ndarray: - raise TypeError('data must be {0}, is {1}'.format(numpy.ndarray, type(data))) + raise TypeError( + "data must be {0}, is {1}".format(numpy.ndarray, type(data)) + ) if numpy.isfortran(data) is True: - raise TypeError('data must be in C-order') - if data.dtype is not numpy.dtype('int16'): - raise TypeError('data must be numpy.ndarray of dtype=int16, is ' + str(data.dtype)) + raise TypeError("data must be in C-order") + if data.dtype is not numpy.dtype("int16"): + raise TypeError( + "data must be numpy.ndarray of dtype=int16, is " + str(data.dtype) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + waveform_name_ctype = ctypes.create_string_buffer( + waveform_name.encode(self._encoding) + ) # case C020 size_ctype = _visatype.ViInt32(0 if data is None else len(data)) # case S160 data_ctype = get_ctypes_pointer_for_buffer(value=data) # case B510 - error_code = self._library.niFgen_WriteNamedWaveformI16(vi_ctype, channel_name_ctype, waveform_name_ctype, size_ctype, data_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_WriteNamedWaveformI16( + vi_ctype, channel_name_ctype, waveform_name_ctype, size_ctype, data_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def write_script(self, script): - r'''write_script + r"""write_script Writes a string containing one or more scripts that govern the generation of waveforms. @@ -3104,17 +3572,25 @@ def write_script(self, script): Instructions `__ for more information about writing scripts. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - script_ctype = ctypes.create_string_buffer(script.encode(self._encoding)) # case C020 - error_code = self._library.niFgen_WriteScript(vi_ctype, channel_name_ctype, script_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + script_ctype = ctypes.create_string_buffer( + script.encode(self._encoding) + ) # case C020 + error_code = self._library.niFgen_WriteScript( + vi_ctype, channel_name_ctype, script_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _write_waveform(self, waveform_handle, data): - r'''_write_waveform + r"""_write_waveform Writes floating-point data to the waveform in onboard memory. The waveform handle passed in must have been created by a call to the @@ -3153,20 +3629,28 @@ def _write_waveform(self, waveform_handle, data): data (array.array("d")): Specifies the array of data to load into the waveform. The array must have at least as many elements as the value in **size**. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 waveform_handle_ctype = _visatype.ViInt32(waveform_handle) # case S150 size_ctype = _visatype.ViInt32(0 if data is None else len(data)) # case S160 data_array = get_ctypes_and_array(value=data, array_type="d") # case B550 - data_ctype = get_ctypes_pointer_for_buffer(value=data_array, library_type=_visatype.ViReal64) # case B550 - error_code = self._library.niFgen_WriteWaveform(vi_ctype, channel_name_ctype, waveform_handle_ctype, size_ctype, data_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + data_ctype = get_ctypes_pointer_for_buffer( + value=data_array, library_type=_visatype.ViReal64 + ) # case B550 + error_code = self._library.niFgen_WriteWaveform( + vi_ctype, channel_name_ctype, waveform_handle_ctype, size_ctype, data_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _write_waveform_numpy(self, waveform_handle, data): - r'''_write_waveform + r"""_write_waveform Writes floating-point data to the waveform in onboard memory. The waveform handle passed in must have been created by a call to the @@ -3205,27 +3689,37 @@ def _write_waveform_numpy(self, waveform_handle, data): data (numpy.array(dtype=numpy.float64)): Specifies the array of data to load into the waveform. The array must have at least as many elements as the value in **size**. - ''' + """ import numpy if type(data) is not numpy.ndarray: - raise TypeError('data must be {0}, is {1}'.format(numpy.ndarray, type(data))) + raise TypeError( + "data must be {0}, is {1}".format(numpy.ndarray, type(data)) + ) if numpy.isfortran(data) is True: - raise TypeError('data must be in C-order') - if data.dtype is not numpy.dtype('float64'): - raise TypeError('data must be numpy.ndarray of dtype=float64, is ' + str(data.dtype)) + raise TypeError("data must be in C-order") + if data.dtype is not numpy.dtype("float64"): + raise TypeError( + "data must be numpy.ndarray of dtype=float64, is " + str(data.dtype) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 waveform_handle_ctype = _visatype.ViInt32(waveform_handle) # case S150 size_ctype = _visatype.ViInt32(0 if data is None else len(data)) # case S160 data_ctype = get_ctypes_pointer_for_buffer(value=data) # case B510 - error_code = self._library.niFgen_WriteWaveform(vi_ctype, channel_name_ctype, waveform_handle_ctype, size_ctype, data_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_WriteWaveform( + vi_ctype, channel_name_ctype, waveform_handle_ctype, size_ctype, data_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def write_waveform(self, waveform_name_or_handle, data): - '''write_waveform + """write_waveform Writes data to the waveform in onboard memory. @@ -3250,29 +3744,60 @@ def write_waveform(self, waveform_name_or_handle, data): data (list of float): Array of data to load into the waveform. This may be an iterable of float, or for best performance a numpy.ndarray of dtype int16 or float64. - ''' + """ use_named = isinstance(waveform_name_or_handle, str) # Check the type by using string comparison so that we don't import numpy unnecessarily. if str(type(data)).find("'numpy.ndarray'") != -1: import numpy + if data.dtype == numpy.float64: - return self._write_named_waveform_f64_numpy(waveform_name_or_handle, data) if use_named else self._write_waveform_numpy(waveform_name_or_handle, data) + return ( + self._write_named_waveform_f64_numpy(waveform_name_or_handle, data) + if use_named + else self._write_waveform_numpy(waveform_name_or_handle, data) + ) elif data.dtype == numpy.int16: - return self._write_named_waveform_i16_numpy(waveform_name_or_handle, data) if use_named else self._write_binary16_waveform_numpy(waveform_name_or_handle, data) + return ( + self._write_named_waveform_i16_numpy(waveform_name_or_handle, data) + if use_named + else self._write_binary16_waveform_numpy( + waveform_name_or_handle, data + ) + ) else: - raise TypeError("Unsupported dtype. Is {0}, expected {1} or {2}".format(data.dtype, numpy.float64, numpy.int16)) + raise TypeError( + "Unsupported dtype. Is {0}, expected {1} or {2}".format( + data.dtype, numpy.float64, numpy.int16 + ) + ) elif isinstance(data, array.array): - if data.typecode == 'd': - return self._write_named_waveform_f64(waveform_name_or_handle, data) if use_named else self._write_waveform(waveform_name_or_handle, data) - elif data.typecode == 'h': - return self._write_named_waveform_i16(waveform_name_or_handle, data) if use_named else self._write_binary16_waveform(waveform_name_or_handle, data) + if data.typecode == "d": + return ( + self._write_named_waveform_f64(waveform_name_or_handle, data) + if use_named + else self._write_waveform(waveform_name_or_handle, data) + ) + elif data.typecode == "h": + return ( + self._write_named_waveform_i16(waveform_name_or_handle, data) + if use_named + else self._write_binary16_waveform(waveform_name_or_handle, data) + ) else: - raise TypeError("Unsupported dtype. Is {0}, expected {1} or {2}".format(data.typecode, 'd (double)', 'h (16 bit int)')) - - return self._write_named_waveform_f64(waveform_name_or_handle, data) if use_named else self._write_waveform(waveform_name_or_handle, data) + raise TypeError( + "Unsupported dtype. Is {0}, expected {1} or {2}".format( + data.typecode, "d (double)", "h (16 bit int)" + ) + ) + + return ( + self._write_named_waveform_f64(waveform_name_or_handle, data) + if use_named + else self._write_waveform(waveform_name_or_handle, data) + ) def _error_message(self, error_code): - r'''_error_message + r"""_error_message Converts a status code returned by an NI-FGEN method into a user-readable string. @@ -3290,20 +3815,26 @@ def _error_message(self, error_code): You must pass a ViChar array with at least 256 bytes. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus(error_code) # case S150 error_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niFgen_error_message(vi_ctype, error_code_ctype, error_message_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + error_code = self._library.niFgen_error_message( + vi_ctype, error_code_ctype, error_message_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return error_message_ctype.value.decode(self._encoding) class Session(_SessionBase): - '''An NI-FGEN session to a National Instruments Signal Generator.''' + """An NI-FGEN session to a National Instruments Signal Generator.""" - def __init__(self, resource_name, channel_name=None, reset_device=False, options={}): - r'''An NI-FGEN session to a National Instruments Signal Generator. + def __init__( + self, resource_name, channel_name=None, reset_device=False, options={} + ): + r"""An NI-FGEN session to a National Instruments Signal Generator. Creates and returns a new NI-FGEN session to the specified channel of a waveform generator that is used in all subsequent NI-FGEN method @@ -3408,16 +3939,26 @@ def __init__(self, resource_name, channel_name=None, reset_device=False, options Returns: session (nifgen.Session): A session object representing the device. - ''' - super(Session, self).__init__(repeated_capability_list=[], vi=None, library=None, encoding=None, freeze_it=False) - channel_name = _converters.convert_repeated_capabilities_without_prefix(channel_name) + """ + super(Session, self).__init__( + repeated_capability_list=[], + vi=None, + library=None, + encoding=None, + freeze_it=False, + ) + channel_name = _converters.convert_repeated_capabilities_without_prefix( + channel_name + ) options = _converters.convert_init_with_options_dictionary(options) self._library = _library_singleton.get() - self._encoding = 'windows-1251' + self._encoding = "windows-1251" # Call specified init function self._vi = 0 # This must be set before calling _initialize_with_channels(). - self._vi = self._initialize_with_channels(resource_name, channel_name, reset_device, options) + self._vi = self._initialize_with_channels( + resource_name, channel_name, reset_device, options + ) self.tclk = nitclk.SessionReference(self._vi) @@ -3427,7 +3968,7 @@ def __init__(self, resource_name, channel_name=None, reset_device=False, options param_list.append("channel_name=" + pp.pformat(channel_name)) param_list.append("reset_device=" + pp.pformat(reset_device)) param_list.append("options=" + pp.pformat(options)) - self._param_list = ', '.join(param_list) + self._param_list = ", ".join(param_list) self._is_frozen = True @@ -3438,7 +3979,7 @@ def __exit__(self, exc_type, exc_value, traceback): self.close() def initiate(self): - '''initiate + """initiate Initiates signal generation. If you want to abort signal generation, call the abort method. After the signal generation @@ -3447,11 +3988,11 @@ def initiate(self): Note: This method will return a Python context manager that will initiate on entering and abort on exit. - ''' + """ return _Generation(self) def close(self): - '''close + """close Performs the following operations: @@ -3478,7 +4019,7 @@ def close(self): Note: This method is not needed when using the session context manager - ''' + """ try: self._close() except errors.DriverError: @@ -3486,24 +4027,26 @@ def close(self): raise self._vi = 0 - ''' These are code-generated ''' + """ These are code-generated """ @ivi_synchronized def abort(self): - r'''abort + r"""abort Aborts any previously initiated signal generation. Call the initiate method to cause the signal generator to produce a signal again. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_AbortGeneration(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def clear_arb_memory(self): - r'''clear_arb_memory + r"""clear_arb_memory Removes all previously created arbitrary waveforms, sequences, and scripts from the signal generator memory and invalidates all waveform @@ -3512,15 +4055,17 @@ def clear_arb_memory(self): Note: The signal generator must not be in the Generating state when you call this method. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_ClearArbMemory(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def clear_arb_sequence(self, sequence_handle): - r'''clear_arb_sequence + r"""clear_arb_sequence Removes a previously created arbitrary sequence from the signal generator memory and invalidates the sequence handle. @@ -3544,16 +4089,20 @@ def clear_arb_sequence(self, sequence_handle): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 sequence_handle_ctype = _visatype.ViInt32(sequence_handle) # case S150 - error_code = self._library.niFgen_ClearArbSequence(vi_ctype, sequence_handle_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_ClearArbSequence( + vi_ctype, sequence_handle_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _clear_arb_waveform(self, waveform_handle): - r'''_clear_arb_waveform + r"""_clear_arb_waveform Removes a previously created arbitrary waveform from the signal generator memory and invalidates the waveform handle. @@ -3584,16 +4133,20 @@ def _clear_arb_waveform(self, waveform_handle): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 waveform_handle_ctype = _visatype.ViInt32(waveform_handle) # case S150 - error_code = self._library.niFgen_ClearArbWaveform(vi_ctype, waveform_handle_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_ClearArbWaveform( + vi_ctype, waveform_handle_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def clear_freq_list(self, frequency_list_handle): - r'''clear_freq_list + r"""clear_freq_list Removes a previously created frequency list from the signal generator memory and invalidates the frequency list handle. @@ -3619,16 +4172,22 @@ def clear_freq_list(self, frequency_list_handle): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - frequency_list_handle_ctype = _visatype.ViInt32(frequency_list_handle) # case S150 - error_code = self._library.niFgen_ClearFreqList(vi_ctype, frequency_list_handle_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + frequency_list_handle_ctype = _visatype.ViInt32( + frequency_list_handle + ) # case S150 + error_code = self._library.niFgen_ClearFreqList( + vi_ctype, frequency_list_handle_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def commit(self): - r'''commit + r"""commit Causes a transition to the Committed state. This method verifies property values, reserves the device, and commits the property values @@ -3650,15 +4209,23 @@ def commit(self): - Any Reference Clock and external clock circuits are phase-locked. - A subsequent initiate method can run faster because the device is already configured. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_Commit(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def create_advanced_arb_sequence(self, waveform_handles_array, loop_counts_array, sample_counts_array=None, marker_location_array=None): - r'''create_advanced_arb_sequence + def create_advanced_arb_sequence( + self, + waveform_handles_array, + loop_counts_array, + sample_counts_array=None, + marker_location_array=None, + ): + r"""create_advanced_arb_sequence Creates an arbitrary sequence from an array of waveform handles and an array of corresponding loop counts. This method returns a handle that @@ -3755,29 +4322,73 @@ def create_advanced_arb_sequence(self, waveform_handles_array, loop_counts_array pass this handle to configure_arb_sequence to generate the arbitrary sequence. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - sequence_length_ctype = _visatype.ViInt32(0 if waveform_handles_array is None else len(waveform_handles_array)) # case S160 - if loop_counts_array is not None and len(loop_counts_array) != len(waveform_handles_array): # case S160 - raise ValueError("Length of loop_counts_array and waveform_handles_array parameters do not match.") # case S160 - if sample_counts_array is not None and len(sample_counts_array) != len(waveform_handles_array): # case S160 - raise ValueError("Length of sample_counts_array and waveform_handles_array parameters do not match.") # case S160 - if marker_location_array is not None and len(marker_location_array) != len(waveform_handles_array): # case S160 - raise ValueError("Length of marker_location_array and waveform_handles_array parameters do not match.") # case S160 - waveform_handles_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_handles_array, library_type=_visatype.ViInt32) # case B550 - loop_counts_array_ctype = get_ctypes_pointer_for_buffer(value=loop_counts_array, library_type=_visatype.ViInt32) # case B550 - sample_counts_array_ctype = get_ctypes_pointer_for_buffer(value=sample_counts_array, library_type=_visatype.ViInt32) # case B550 - marker_location_array_ctype = get_ctypes_pointer_for_buffer(value=marker_location_array, library_type=_visatype.ViInt32) # case B550 - coerced_markers_array_size = (0 if marker_location_array is None else len(marker_location_array)) # case B560 - coerced_markers_array_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViInt32, size=coerced_markers_array_size) # case B560 + sequence_length_ctype = _visatype.ViInt32( + 0 if waveform_handles_array is None else len(waveform_handles_array) + ) # case S160 + if loop_counts_array is not None and len(loop_counts_array) != len( + waveform_handles_array + ): # case S160 + raise ValueError( + "Length of loop_counts_array and waveform_handles_array parameters do not match." + ) # case S160 + if sample_counts_array is not None and len(sample_counts_array) != len( + waveform_handles_array + ): # case S160 + raise ValueError( + "Length of sample_counts_array and waveform_handles_array parameters do not match." + ) # case S160 + if marker_location_array is not None and len(marker_location_array) != len( + waveform_handles_array + ): # case S160 + raise ValueError( + "Length of marker_location_array and waveform_handles_array parameters do not match." + ) # case S160 + waveform_handles_array_ctype = get_ctypes_pointer_for_buffer( + value=waveform_handles_array, library_type=_visatype.ViInt32 + ) # case B550 + loop_counts_array_ctype = get_ctypes_pointer_for_buffer( + value=loop_counts_array, library_type=_visatype.ViInt32 + ) # case B550 + sample_counts_array_ctype = get_ctypes_pointer_for_buffer( + value=sample_counts_array, library_type=_visatype.ViInt32 + ) # case B550 + marker_location_array_ctype = get_ctypes_pointer_for_buffer( + value=marker_location_array, library_type=_visatype.ViInt32 + ) # case B550 + coerced_markers_array_size = ( + 0 if marker_location_array is None else len(marker_location_array) + ) # case B560 + coerced_markers_array_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViInt32, size=coerced_markers_array_size + ) # case B560 sequence_handle_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_CreateAdvancedArbSequence(vi_ctype, sequence_length_ctype, waveform_handles_array_ctype, loop_counts_array_ctype, sample_counts_array_ctype, marker_location_array_ctype, coerced_markers_array_ctype, None if sequence_handle_ctype is None else (ctypes.pointer(sequence_handle_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return [int(coerced_markers_array_ctype[i]) for i in range((0 if marker_location_array is None else len(marker_location_array)))], int(sequence_handle_ctype.value) + error_code = self._library.niFgen_CreateAdvancedArbSequence( + vi_ctype, + sequence_length_ctype, + waveform_handles_array_ctype, + loop_counts_array_ctype, + sample_counts_array_ctype, + marker_location_array_ctype, + coerced_markers_array_ctype, + None + if sequence_handle_ctype is None + else (ctypes.pointer(sequence_handle_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return [ + int(coerced_markers_array_ctype[i]) + for i in range( + (0 if marker_location_array is None else len(marker_location_array)) + ) + ], int(sequence_handle_ctype.value) @ivi_synchronized def create_arb_sequence(self, waveform_handles_array, loop_counts_array): - r'''create_arb_sequence + r"""create_arb_sequence Creates an arbitrary sequence from an array of waveform handles and an array of corresponding loop counts. This method returns a handle that @@ -3830,21 +4441,41 @@ def create_arb_sequence(self, waveform_handles_array, loop_counts_array): pass this handle to configure_arb_sequence to generate the arbitrary sequence. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - sequence_length_ctype = _visatype.ViInt32(0 if waveform_handles_array is None else len(waveform_handles_array)) # case S160 - if loop_counts_array is not None and len(loop_counts_array) != len(waveform_handles_array): # case S160 - raise ValueError("Length of loop_counts_array and waveform_handles_array parameters do not match.") # case S160 - waveform_handles_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_handles_array, library_type=_visatype.ViInt32) # case B550 - loop_counts_array_ctype = get_ctypes_pointer_for_buffer(value=loop_counts_array, library_type=_visatype.ViInt32) # case B550 + sequence_length_ctype = _visatype.ViInt32( + 0 if waveform_handles_array is None else len(waveform_handles_array) + ) # case S160 + if loop_counts_array is not None and len(loop_counts_array) != len( + waveform_handles_array + ): # case S160 + raise ValueError( + "Length of loop_counts_array and waveform_handles_array parameters do not match." + ) # case S160 + waveform_handles_array_ctype = get_ctypes_pointer_for_buffer( + value=waveform_handles_array, library_type=_visatype.ViInt32 + ) # case B550 + loop_counts_array_ctype = get_ctypes_pointer_for_buffer( + value=loop_counts_array, library_type=_visatype.ViInt32 + ) # case B550 sequence_handle_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_CreateArbSequence(vi_ctype, sequence_length_ctype, waveform_handles_array_ctype, loop_counts_array_ctype, None if sequence_handle_ctype is None else (ctypes.pointer(sequence_handle_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_CreateArbSequence( + vi_ctype, + sequence_length_ctype, + waveform_handles_array_ctype, + loop_counts_array_ctype, + None + if sequence_handle_ctype is None + else (ctypes.pointer(sequence_handle_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(sequence_handle_ctype.value) @ivi_synchronized def create_freq_list(self, waveform, frequency_array, duration_array): - r'''create_freq_list + r"""create_freq_list Creates a frequency list from an array of frequencies (**frequencyArray**) and an array of durations (**durationArray**). The @@ -3916,37 +4547,60 @@ def create_freq_list(self, waveform, frequency_array, duration_array): this handle to configure_freq_list to generate the arbitrary sequence. - ''' + """ if type(waveform) is not enums.Waveform: - raise TypeError('Parameter waveform must be of type ' + str(enums.Waveform)) + raise TypeError("Parameter waveform must be of type " + str(enums.Waveform)) vi_ctype = _visatype.ViSession(self._vi) # case S110 waveform_ctype = _visatype.ViInt32(waveform.value) # case S130 - frequency_list_length_ctype = _visatype.ViInt32(0 if frequency_array is None else len(frequency_array)) # case S160 - if duration_array is not None and len(duration_array) != len(frequency_array): # case S160 - raise ValueError("Length of duration_array and frequency_array parameters do not match.") # case S160 - frequency_array_ctype = get_ctypes_pointer_for_buffer(value=frequency_array, library_type=_visatype.ViReal64) # case B550 - duration_array_ctype = get_ctypes_pointer_for_buffer(value=duration_array, library_type=_visatype.ViReal64) # case B550 + frequency_list_length_ctype = _visatype.ViInt32( + 0 if frequency_array is None else len(frequency_array) + ) # case S160 + if duration_array is not None and len(duration_array) != len( + frequency_array + ): # case S160 + raise ValueError( + "Length of duration_array and frequency_array parameters do not match." + ) # case S160 + frequency_array_ctype = get_ctypes_pointer_for_buffer( + value=frequency_array, library_type=_visatype.ViReal64 + ) # case B550 + duration_array_ctype = get_ctypes_pointer_for_buffer( + value=duration_array, library_type=_visatype.ViReal64 + ) # case B550 frequency_list_handle_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_CreateFreqList(vi_ctype, waveform_ctype, frequency_list_length_ctype, frequency_array_ctype, duration_array_ctype, None if frequency_list_handle_ctype is None else (ctypes.pointer(frequency_list_handle_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_CreateFreqList( + vi_ctype, + waveform_ctype, + frequency_list_length_ctype, + frequency_array_ctype, + duration_array_ctype, + None + if frequency_list_handle_ctype is None + else (ctypes.pointer(frequency_list_handle_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(frequency_list_handle_ctype.value) @ivi_synchronized def disable(self): - r'''disable + r"""disable Places the instrument in a quiescent state where it has minimal or no impact on the system to which it is connected. The analog output and all exported signals are disabled. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_Disable(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def export_attribute_configuration_buffer(self): - r'''export_attribute_configuration_buffer + r"""export_attribute_configuration_buffer Exports the property configuration of the session to a configuration buffer. @@ -3963,23 +4617,33 @@ def export_attribute_configuration_buffer(self): configuration (bytes): Specifies the byte array buffer to be populated with the exported property configuration. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 size_in_bytes_ctype = _visatype.ViInt32() # case S170 configuration_ctype = None # case B580 - error_code = self._library.niFgen_ExportAttributeConfigurationBuffer(vi_ctype, size_in_bytes_ctype, configuration_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niFgen_ExportAttributeConfigurationBuffer( + vi_ctype, size_in_bytes_ctype, configuration_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) size_in_bytes_ctype = _visatype.ViInt32(error_code) # case S180 configuration_size = size_in_bytes_ctype.value # case B590 configuration_array = array.array("b", [0] * configuration_size) # case B590 - configuration_ctype = get_ctypes_pointer_for_buffer(value=configuration_array, library_type=_visatype.ViInt8) # case B590 - error_code = self._library.niFgen_ExportAttributeConfigurationBuffer(vi_ctype, size_in_bytes_ctype, configuration_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + configuration_ctype = get_ctypes_pointer_for_buffer( + value=configuration_array, library_type=_visatype.ViInt8 + ) # case B590 + error_code = self._library.niFgen_ExportAttributeConfigurationBuffer( + vi_ctype, size_in_bytes_ctype, configuration_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return _converters.convert_to_bytes(configuration_array) @ivi_synchronized def export_attribute_configuration_file(self, file_path): - r'''export_attribute_configuration_file + r"""export_attribute_configuration_file Exports the property configuration of the session to the specified file. @@ -3998,16 +4662,22 @@ def export_attribute_configuration_file(self, file_path): method returns an error. **Default file extension:** .nifgenconfig - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 - error_code = self._library.niFgen_ExportAttributeConfigurationFile(vi_ctype, file_path_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + file_path_ctype = ctypes.create_string_buffer( + file_path.encode(self._encoding) + ) # case C020 + error_code = self._library.niFgen_ExportAttributeConfigurationFile( + vi_ctype, file_path_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def get_channel_name(self, index): - r'''get_channel_name + r"""get_channel_name Returns the channel string that is in the channel table at an index you specify. @@ -4024,22 +4694,32 @@ def get_channel_name(self, index): channel_string (str): Returns the channel string that is in the channel table at the index you specify. Do not modify the contents of the channel string. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 index_ctype = _visatype.ViInt32(index) # case S150 buffer_size_ctype = _visatype.ViInt32() # case S170 channel_string_ctype = None # case C050 - error_code = self._library.niFgen_GetChannelName(vi_ctype, index_ctype, buffer_size_ctype, channel_string_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niFgen_GetChannelName( + vi_ctype, index_ctype, buffer_size_ctype, channel_string_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - channel_string_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niFgen_GetChannelName(vi_ctype, index_ctype, buffer_size_ctype, channel_string_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + channel_string_ctype = ( + _visatype.ViChar * buffer_size_ctype.value + )() # case C060 + error_code = self._library.niFgen_GetChannelName( + vi_ctype, index_ctype, buffer_size_ctype, channel_string_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return channel_string_ctype.value.decode(self._encoding) @ivi_synchronized def _get_ext_cal_last_date_and_time(self): - r'''_get_ext_cal_last_date_and_time + r"""_get_ext_cal_last_date_and_time Returns the date and time of the last successful external calibration. The time returned is 24-hour (military) local time; for example, if the @@ -4057,20 +4737,35 @@ def _get_ext_cal_last_date_and_time(self): minute (int): Specifies the minute of the last successful calibration. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 year_ctype = _visatype.ViInt32() # case S220 month_ctype = _visatype.ViInt32() # case S220 day_ctype = _visatype.ViInt32() # case S220 hour_ctype = _visatype.ViInt32() # case S220 minute_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_GetExtCalLastDateAndTime(vi_ctype, None if year_ctype is None else (ctypes.pointer(year_ctype)), None if month_ctype is None else (ctypes.pointer(month_ctype)), None if day_ctype is None else (ctypes.pointer(day_ctype)), None if hour_ctype is None else (ctypes.pointer(hour_ctype)), None if minute_ctype is None else (ctypes.pointer(minute_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return int(year_ctype.value), int(month_ctype.value), int(day_ctype.value), int(hour_ctype.value), int(minute_ctype.value) + error_code = self._library.niFgen_GetExtCalLastDateAndTime( + vi_ctype, + None if year_ctype is None else (ctypes.pointer(year_ctype)), + None if month_ctype is None else (ctypes.pointer(month_ctype)), + None if day_ctype is None else (ctypes.pointer(day_ctype)), + None if hour_ctype is None else (ctypes.pointer(hour_ctype)), + None if minute_ctype is None else (ctypes.pointer(minute_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return ( + int(year_ctype.value), + int(month_ctype.value), + int(day_ctype.value), + int(hour_ctype.value), + int(minute_ctype.value), + ) @ivi_synchronized def get_ext_cal_last_temp(self): - r'''get_ext_cal_last_temp + r"""get_ext_cal_last_temp Returns the temperature at the last successful external calibration. The temperature is returned in degrees Celsius. @@ -4079,16 +4774,21 @@ def get_ext_cal_last_temp(self): temperature (float): Specifies the temperature at the last successful calibration in degrees Celsius. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 temperature_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niFgen_GetExtCalLastTemp(vi_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_GetExtCalLastTemp( + vi_ctype, + None if temperature_ctype is None else (ctypes.pointer(temperature_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(temperature_ctype.value) @ivi_synchronized def get_ext_cal_recommended_interval(self): - r'''get_ext_cal_recommended_interval + r"""get_ext_cal_recommended_interval Returns the recommended interval between external calibrations in months. @@ -4097,16 +4797,20 @@ def get_ext_cal_recommended_interval(self): months (hightime.timedelta): Specifies the recommended interval between external calibrations in months. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 months_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_GetExtCalRecommendedInterval(vi_ctype, None if months_ctype is None else (ctypes.pointer(months_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_GetExtCalRecommendedInterval( + vi_ctype, None if months_ctype is None else (ctypes.pointer(months_ctype)) + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return _converters.convert_month_to_timedelta(int(months_ctype.value)) @ivi_synchronized def get_hardware_state(self): - r'''get_hardware_state + r"""get_hardware_state Returns the current hardware state of the device and, if the device is in the hardware error state, the current hardware error. @@ -4130,42 +4834,46 @@ def get_hardware_state(self): | HardwareState.HARDWARE_ERROR | There is a hardware error. | +-----------------------------------------+--------------------------------------------+ - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 state_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_GetHardwareState(vi_ctype, None if state_ctype is None else (ctypes.pointer(state_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_GetHardwareState( + vi_ctype, None if state_ctype is None else (ctypes.pointer(state_ctype)) + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return enums.HardwareState(state_ctype.value) @ivi_synchronized def get_ext_cal_last_date_and_time(self): - '''get_ext_cal_last_date_and_time + """get_ext_cal_last_date_and_time Returns the date and time of the last successful external calibration. The time returned is 24-hour (military) local time; for example, if the device was calibrated at 2:30 PM, this method returns 14 for the **hour** parameter and 30 for the **minute** parameter. Returns: month (hightime.datetime): Indicates date and time of the last calibration. - ''' + """ year, month, day, hour, minute = self._get_ext_cal_last_date_and_time() return hightime.datetime(year, month, day, hour, minute) @ivi_synchronized def get_self_cal_last_date_and_time(self): - '''get_self_cal_last_date_and_time + """get_self_cal_last_date_and_time Returns the date and time of the last successful self-calibration. Returns: month (hightime.datetime): Returns the date and time the device was last calibrated. - ''' + """ year, month, day, hour, minute = self._get_self_cal_last_date_and_time() return hightime.datetime(year, month, day, hour, minute) @ivi_synchronized def _get_self_cal_last_date_and_time(self): - r'''_get_self_cal_last_date_and_time + r"""_get_self_cal_last_date_and_time Returns the date and time of the last successful self-calibration. @@ -4190,20 +4898,35 @@ def _get_self_cal_last_date_and_time(self): minute (int): Specifies the minute of the last successful calibration. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 year_ctype = _visatype.ViInt32() # case S220 month_ctype = _visatype.ViInt32() # case S220 day_ctype = _visatype.ViInt32() # case S220 hour_ctype = _visatype.ViInt32() # case S220 minute_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_GetSelfCalLastDateAndTime(vi_ctype, None if year_ctype is None else (ctypes.pointer(year_ctype)), None if month_ctype is None else (ctypes.pointer(month_ctype)), None if day_ctype is None else (ctypes.pointer(day_ctype)), None if hour_ctype is None else (ctypes.pointer(hour_ctype)), None if minute_ctype is None else (ctypes.pointer(minute_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return int(year_ctype.value), int(month_ctype.value), int(day_ctype.value), int(hour_ctype.value), int(minute_ctype.value) + error_code = self._library.niFgen_GetSelfCalLastDateAndTime( + vi_ctype, + None if year_ctype is None else (ctypes.pointer(year_ctype)), + None if month_ctype is None else (ctypes.pointer(month_ctype)), + None if day_ctype is None else (ctypes.pointer(day_ctype)), + None if hour_ctype is None else (ctypes.pointer(hour_ctype)), + None if minute_ctype is None else (ctypes.pointer(minute_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return ( + int(year_ctype.value), + int(month_ctype.value), + int(day_ctype.value), + int(hour_ctype.value), + int(minute_ctype.value), + ) @ivi_synchronized def get_self_cal_last_temp(self): - r'''get_self_cal_last_temp + r"""get_self_cal_last_temp Returns the temperature at the last successful self-calibration. The temperature is returned in degrees Celsius. @@ -4212,16 +4935,21 @@ def get_self_cal_last_temp(self): temperature (float): Specifies the temperature at the last successful calibration in degrees Celsius. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 temperature_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niFgen_GetSelfCalLastTemp(vi_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_GetSelfCalLastTemp( + vi_ctype, + None if temperature_ctype is None else (ctypes.pointer(temperature_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(temperature_ctype.value) @ivi_synchronized def get_self_cal_supported(self): - r'''get_self_cal_supported + r"""get_self_cal_supported Returns whether the device supports self–calibration. @@ -4236,16 +4964,23 @@ def get_self_cal_supported(self): | False | Self–calibration is not supported. | +-------+------------------------------------+ - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 self_cal_supported_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niFgen_GetSelfCalSupported(vi_ctype, None if self_cal_supported_ctype is None else (ctypes.pointer(self_cal_supported_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_GetSelfCalSupported( + vi_ctype, + None + if self_cal_supported_ctype is None + else (ctypes.pointer(self_cal_supported_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return bool(self_cal_supported_ctype.value) @ivi_synchronized def import_attribute_configuration_buffer(self, configuration): - r'''import_attribute_configuration_buffer + r"""import_attribute_configuration_buffer Imports a property configuration to the session from the specified configuration buffer. @@ -4262,18 +4997,28 @@ def import_attribute_configuration_buffer(self, configuration): configuration (bytes): Specifies the byte array buffer that contains the property configuration to import. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - size_in_bytes_ctype = _visatype.ViInt32(0 if configuration is None else len(configuration)) # case S160 - configuration_converted = _converters.convert_to_bytes(configuration) # case B520 - configuration_ctype = get_ctypes_pointer_for_buffer(value=configuration_converted, library_type=_visatype.ViInt8) # case B520 - error_code = self._library.niFgen_ImportAttributeConfigurationBuffer(vi_ctype, size_in_bytes_ctype, configuration_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + size_in_bytes_ctype = _visatype.ViInt32( + 0 if configuration is None else len(configuration) + ) # case S160 + configuration_converted = _converters.convert_to_bytes( + configuration + ) # case B520 + configuration_ctype = get_ctypes_pointer_for_buffer( + value=configuration_converted, library_type=_visatype.ViInt8 + ) # case B520 + error_code = self._library.niFgen_ImportAttributeConfigurationBuffer( + vi_ctype, size_in_bytes_ctype, configuration_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def import_attribute_configuration_file(self, file_path): - r'''import_attribute_configuration_file + r"""import_attribute_configuration_file Imports a property configuration to the session from the specified file. @@ -4292,15 +5037,23 @@ def import_attribute_configuration_file(self, file_path): method returns an error. **Default File Extension:** .nifgenconfig - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 - error_code = self._library.niFgen_ImportAttributeConfigurationFile(vi_ctype, file_path_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + file_path_ctype = ctypes.create_string_buffer( + file_path.encode(self._encoding) + ) # case C020 + error_code = self._library.niFgen_ImportAttributeConfigurationFile( + vi_ctype, file_path_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return - def _initialize_with_channels(self, resource_name, channel_name=None, reset_device=False, option_string=""): - r'''_initialize_with_channels + def _initialize_with_channels( + self, resource_name, channel_name=None, reset_device=False, option_string="" + ): + r"""_initialize_with_channels Creates and returns a new NI-FGEN session to the specified channel of a waveform generator that is used in all subsequent NI-FGEN method @@ -4429,33 +5182,53 @@ def _initialize_with_channels(self, resource_name, channel_name=None, reset_devi vi (int): Returns a session handle that you can use to identify the device in all subsequent NI-FGEN method calls. - ''' - resource_name_ctype = ctypes.create_string_buffer(resource_name.encode(self._encoding)) # case C020 - channel_name_ctype = ctypes.create_string_buffer(_converters.convert_repeated_capabilities_without_prefix(channel_name).encode(self._encoding)) # case C040 + """ + resource_name_ctype = ctypes.create_string_buffer( + resource_name.encode(self._encoding) + ) # case C020 + channel_name_ctype = ctypes.create_string_buffer( + _converters.convert_repeated_capabilities_without_prefix( + channel_name + ).encode(self._encoding) + ) # case C040 reset_device_ctype = _visatype.ViBoolean(reset_device) # case S150 - option_string_ctype = ctypes.create_string_buffer(_converters.convert_init_with_options_dictionary(option_string).encode(self._encoding)) # case C040 + option_string_ctype = ctypes.create_string_buffer( + _converters.convert_init_with_options_dictionary(option_string).encode( + self._encoding + ) + ) # case C040 vi_ctype = _visatype.ViSession() # case S220 - error_code = self._library.niFgen_InitializeWithChannels(resource_name_ctype, channel_name_ctype, reset_device_ctype, option_string_ctype, None if vi_ctype is None else (ctypes.pointer(vi_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_InitializeWithChannels( + resource_name_ctype, + channel_name_ctype, + reset_device_ctype, + option_string_ctype, + None if vi_ctype is None else (ctypes.pointer(vi_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(vi_ctype.value) @ivi_synchronized def _initiate_generation(self): - r'''_initiate_generation + r"""_initiate_generation Initiates signal generation. If you want to abort signal generation, call the abort method. After the signal generation is aborted, you can call the initiate method to cause the signal generator to produce a signal again. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_InitiateGeneration(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def is_done(self): - r'''is_done + r"""is_done Determines whether the current generation is complete. This method sets the **done** parameter to True if the session is in the Idle or @@ -4476,16 +5249,20 @@ def is_done(self): | False | Generation is not complete. | +-------+-----------------------------+ - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 done_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niFgen_IsDone(vi_ctype, None if done_ctype is None else (ctypes.pointer(done_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_IsDone( + vi_ctype, None if done_ctype is None else (ctypes.pointer(done_ctype)) + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return bool(done_ctype.value) @ivi_synchronized def query_arb_seq_capabilities(self): - r'''query_arb_seq_capabilities + r"""query_arb_seq_capabilities Returns the properties of the signal generator that are related to creating arbitrary sequences (the max_num_sequences, @@ -4510,19 +5287,40 @@ def query_arb_seq_capabilities(self): arbitrary waveform in a sequence. NI-FGEN obtains this value from the max_loop_count property. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 maximum_number_of_sequences_ctype = _visatype.ViInt32() # case S220 minimum_sequence_length_ctype = _visatype.ViInt32() # case S220 maximum_sequence_length_ctype = _visatype.ViInt32() # case S220 maximum_loop_count_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_QueryArbSeqCapabilities(vi_ctype, None if maximum_number_of_sequences_ctype is None else (ctypes.pointer(maximum_number_of_sequences_ctype)), None if minimum_sequence_length_ctype is None else (ctypes.pointer(minimum_sequence_length_ctype)), None if maximum_sequence_length_ctype is None else (ctypes.pointer(maximum_sequence_length_ctype)), None if maximum_loop_count_ctype is None else (ctypes.pointer(maximum_loop_count_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return int(maximum_number_of_sequences_ctype.value), int(minimum_sequence_length_ctype.value), int(maximum_sequence_length_ctype.value), int(maximum_loop_count_ctype.value) + error_code = self._library.niFgen_QueryArbSeqCapabilities( + vi_ctype, + None + if maximum_number_of_sequences_ctype is None + else (ctypes.pointer(maximum_number_of_sequences_ctype)), + None + if minimum_sequence_length_ctype is None + else (ctypes.pointer(minimum_sequence_length_ctype)), + None + if maximum_sequence_length_ctype is None + else (ctypes.pointer(maximum_sequence_length_ctype)), + None + if maximum_loop_count_ctype is None + else (ctypes.pointer(maximum_loop_count_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return ( + int(maximum_number_of_sequences_ctype.value), + int(minimum_sequence_length_ctype.value), + int(maximum_sequence_length_ctype.value), + int(maximum_loop_count_ctype.value), + ) @ivi_synchronized def query_arb_wfm_capabilities(self): - r'''query_arb_wfm_capabilities + r"""query_arb_wfm_capabilities Returns the properties of the signal generator that are related to creating arbitrary waveforms. These properties are the maximum number of @@ -4554,19 +5352,40 @@ def query_arb_wfm_capabilities(self): a waveform. NI-FGEN obtains this value from the max_waveform_size property. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 maximum_number_of_waveforms_ctype = _visatype.ViInt32() # case S220 waveform_quantum_ctype = _visatype.ViInt32() # case S220 minimum_waveform_size_ctype = _visatype.ViInt32() # case S220 maximum_waveform_size_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_QueryArbWfmCapabilities(vi_ctype, None if maximum_number_of_waveforms_ctype is None else (ctypes.pointer(maximum_number_of_waveforms_ctype)), None if waveform_quantum_ctype is None else (ctypes.pointer(waveform_quantum_ctype)), None if minimum_waveform_size_ctype is None else (ctypes.pointer(minimum_waveform_size_ctype)), None if maximum_waveform_size_ctype is None else (ctypes.pointer(maximum_waveform_size_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return int(maximum_number_of_waveforms_ctype.value), int(waveform_quantum_ctype.value), int(minimum_waveform_size_ctype.value), int(maximum_waveform_size_ctype.value) + error_code = self._library.niFgen_QueryArbWfmCapabilities( + vi_ctype, + None + if maximum_number_of_waveforms_ctype is None + else (ctypes.pointer(maximum_number_of_waveforms_ctype)), + None + if waveform_quantum_ctype is None + else (ctypes.pointer(waveform_quantum_ctype)), + None + if minimum_waveform_size_ctype is None + else (ctypes.pointer(minimum_waveform_size_ctype)), + None + if maximum_waveform_size_ctype is None + else (ctypes.pointer(maximum_waveform_size_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return ( + int(maximum_number_of_waveforms_ctype.value), + int(waveform_quantum_ctype.value), + int(minimum_waveform_size_ctype.value), + int(maximum_waveform_size_ctype.value), + ) @ivi_synchronized def query_freq_list_capabilities(self): - r'''query_freq_list_capabilities + r"""query_freq_list_capabilities Returns the properties of the signal generator that are related to creating frequency lists. These properties are @@ -4602,7 +5421,7 @@ def query_freq_list_capabilities(self): frequency list. NI-FGEN obtains this value from the freq_list_duration_quantum property. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 maximum_number_of_freq_lists_ctype = _visatype.ViInt32() # case S220 minimum_frequency_list_length_ctype = _visatype.ViInt32() # case S220 @@ -4610,13 +5429,42 @@ def query_freq_list_capabilities(self): minimum_frequency_list_duration_ctype = _visatype.ViReal64() # case S220 maximum_frequency_list_duration_ctype = _visatype.ViReal64() # case S220 frequency_list_duration_quantum_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niFgen_QueryFreqListCapabilities(vi_ctype, None if maximum_number_of_freq_lists_ctype is None else (ctypes.pointer(maximum_number_of_freq_lists_ctype)), None if minimum_frequency_list_length_ctype is None else (ctypes.pointer(minimum_frequency_list_length_ctype)), None if maximum_frequency_list_length_ctype is None else (ctypes.pointer(maximum_frequency_list_length_ctype)), None if minimum_frequency_list_duration_ctype is None else (ctypes.pointer(minimum_frequency_list_duration_ctype)), None if maximum_frequency_list_duration_ctype is None else (ctypes.pointer(maximum_frequency_list_duration_ctype)), None if frequency_list_duration_quantum_ctype is None else (ctypes.pointer(frequency_list_duration_quantum_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return int(maximum_number_of_freq_lists_ctype.value), int(minimum_frequency_list_length_ctype.value), int(maximum_frequency_list_length_ctype.value), float(minimum_frequency_list_duration_ctype.value), float(maximum_frequency_list_duration_ctype.value), float(frequency_list_duration_quantum_ctype.value) + error_code = self._library.niFgen_QueryFreqListCapabilities( + vi_ctype, + None + if maximum_number_of_freq_lists_ctype is None + else (ctypes.pointer(maximum_number_of_freq_lists_ctype)), + None + if minimum_frequency_list_length_ctype is None + else (ctypes.pointer(minimum_frequency_list_length_ctype)), + None + if maximum_frequency_list_length_ctype is None + else (ctypes.pointer(maximum_frequency_list_length_ctype)), + None + if minimum_frequency_list_duration_ctype is None + else (ctypes.pointer(minimum_frequency_list_duration_ctype)), + None + if maximum_frequency_list_duration_ctype is None + else (ctypes.pointer(maximum_frequency_list_duration_ctype)), + None + if frequency_list_duration_quantum_ctype is None + else (ctypes.pointer(frequency_list_duration_quantum_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return ( + int(maximum_number_of_freq_lists_ctype.value), + int(minimum_frequency_list_length_ctype.value), + int(maximum_frequency_list_length_ctype.value), + float(minimum_frequency_list_duration_ctype.value), + float(maximum_frequency_list_duration_ctype.value), + float(frequency_list_duration_quantum_ctype.value), + ) @ivi_synchronized def read_current_temperature(self): - r'''read_current_temperature + r"""read_current_temperature Reads the current onboard temperature of the device. The temperature is returned in degrees Celsius. @@ -4625,57 +5473,68 @@ def read_current_temperature(self): temperature (float): Returns the current temperature read from onboard temperature sensors, in degrees Celsius. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 temperature_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niFgen_ReadCurrentTemperature(vi_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niFgen_ReadCurrentTemperature( + vi_ctype, + None if temperature_ctype is None else (ctypes.pointer(temperature_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(temperature_ctype.value) @ivi_synchronized def reset_device(self): - r'''reset_device + r"""reset_device Performs a hard reset on the device. Generation is stopped, all routes are released, external bidirectional terminals are tristated, FPGAs are reset, hardware is configured to its default state, and all session properties are reset to their default states. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_ResetDevice(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def reset_with_defaults(self): - r'''reset_with_defaults + r"""reset_with_defaults Resets the instrument and reapplies initial user–specified settings from the logical name that was used to initialize the session. If the session was created without a logical name, this method is equivalent to the reset method. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_ResetWithDefaults(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def self_cal(self): - r'''self_cal + r"""self_cal Performs a full internal self-calibration on the device. If the calibration is successful, new calibration data and constants are stored in the onboard EEPROM. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_SelfCal(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def wait_until_done(self, max_time=hightime.timedelta(seconds=10.0)): - r'''wait_until_done + r"""wait_until_done Waits until the device is done generating or until the maximum time has expired. @@ -4683,15 +5542,19 @@ def wait_until_done(self, max_time=hightime.timedelta(seconds=10.0)): Args: max_time (hightime.timedelta, datetime.timedelta, or int in milliseconds): Specifies the timeout value in milliseconds. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - max_time_ctype = _converters.convert_timedelta_to_milliseconds_int32(max_time) # case S140 + max_time_ctype = _converters.convert_timedelta_to_milliseconds_int32( + max_time + ) # case S140 error_code = self._library.niFgen_WaitUntilDone(vi_ctype, max_time_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def _close(self): - r'''_close + r"""_close Performs the following operations: @@ -4715,15 +5578,17 @@ def _close(self): Note: After calling _close, you cannot use NI-FGEN again until you call the init or InitWithOptions methods. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_close(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def self_test(self): - '''self_test + """self_test Runs the instrument self-test routine and returns the test result(s). @@ -4745,7 +5610,7 @@ def self_test(self): self_test method runs. If you use the self_test method, your device may not be in its previously configured state after the method runs. - ''' + """ code, msg = self._self_test() if code: raise errors.SelfTestError(code, msg) @@ -4753,7 +5618,7 @@ def self_test(self): @ivi_synchronized def reset(self): - r'''reset + r"""reset Resets the instrument to a known state. This method aborts the generation, clears all routes, and resets session properties to the @@ -4763,15 +5628,17 @@ def reset(self): Note: For the NI 5401/5404/5411/5431, this method exhibits the same behavior as the reset_device method. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_reset(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _self_test(self): - r'''_self_test + r"""_self_test Runs the instrument self-test routine and returns the test result(s). @@ -4797,13 +5664,20 @@ def _self_test(self): You must pass a ViChar array with at least 256 bytes. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 self_test_result_ctype = _visatype.ViInt16() # case S220 self_test_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niFgen_self_test(vi_ctype, None if self_test_result_ctype is None else (ctypes.pointer(self_test_result_ctype)), self_test_message_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return int(self_test_result_ctype.value), self_test_message_ctype.value.decode(self._encoding) - - - + error_code = self._library.niFgen_self_test( + vi_ctype, + None + if self_test_result_ctype is None + else (ctypes.pointer(self_test_result_ctype)), + self_test_message_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return int(self_test_result_ctype.value), self_test_message_ctype.value.decode( + self._encoding + ) diff --git a/generated/nifgen/nifgen/unit_tests/_matchers.py b/generated/nifgen/nifgen/unit_tests/_matchers.py index 75961fcbb..ab40701a8 100644 --- a/generated/nifgen/nifgen/unit_tests/_matchers.py +++ b/generated/nifgen/nifgen/unit_tests/_matchers.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # This file was generated -'''Matcher classes used by unit tests in order to set mock expectations. +"""Matcher classes used by unit tests in order to set mock expectations. These work well with our visatype definitions. -''' +""" import ctypes import nifgen._visatype as _visatype @@ -21,15 +21,27 @@ def __init__(self, expected_type, expected_value): def __eq__(self, other): if not isinstance(other, self.expected_type): - print("{0}: Unexpected type. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_type, type(other))) + print( + "{0}: Unexpected type. Expected: {1}. Received: {2}".format( + self.__class__.__name__, self.expected_type, type(other) + ) + ) return False if other.value != self.expected_value: - print("{0}: Unexpected value. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_value, other.value)) + print( + "{0}: Unexpected value. Expected: {1}. Received: {2}".format( + self.__class__.__name__, self.expected_value, other.value + ) + ) return False return True def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_type), + pp.pformat(self.expected_value), + ) class _PointerMatcher(object): @@ -38,12 +50,18 @@ def __init__(self, expected_type): def __eq__(self, other): if not isinstance(other, ctypes.POINTER(self.expected_type)): - print("Unexpected type. Expected: {0}. Received: {1}".format(ctypes.POINTER(self.expected_type), type(other))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + ctypes.POINTER(self.expected_type), type(other) + ) + ) return False return True def __repr__(self): - return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_type)) + return "{0}({1})".format( + self.__class__.__name__, pp.pformat(self.expected_type) + ) class _BufferMatcher(object): @@ -70,29 +88,47 @@ def __eq__(self, other): pass # Because of object lifetimes, we may need to mock the other instance and provide lists instead of the actual array - if not isinstance(other, self.expected_type) and not isinstance(other, list): - print("Unexpected type. Expected: {0} or {1}. Received: {2}".format(self.expected_type, list, type(other))) + if not isinstance(other, self.expected_type) and not isinstance( + other, list + ): + print( + "Unexpected type. Expected: {0} or {1}. Received: {2}".format( + self.expected_type, list, type(other) + ) + ) return False if self.expected_size != len(other): - print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(other))) + print( + "Unexpected length. Expected: {0}. Received: {1}".format( + self.expected_size, len(other) + ) + ) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for i in range(0, len(self.expected_value)): if self.expected_value[i] != other[i]: - print("Unexpected value at index {0}. Expected: {1}. Received: {2}".format(i, self.expected_value[i], other[i])) + print( + "Unexpected value at index {0}. Expected: {1}. Received: {2}".format( + i, self.expected_value[i], other[i] + ) + ) return False return True def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self._expected_element_type), pp.pformat(self._expected_size_or_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self._expected_element_type), + pp.pformat(self._expected_size_or_value), + ) def __str__(self): - ret_str = self.__repr__() + '\n' - ret_str += ' expected_type = ' + str(self.expected_type) + '\n' - ret_str += ' expected_value = ' + str(self.expected_value) + '\n' - ret_str += ' expected_size = ' + str(self.expected_size) + '\n' + ret_str = self.__repr__() + "\n" + ret_str += " expected_type = " + str(self.expected_type) + "\n" + ret_str += " expected_value = " + str(self.expected_value) + "\n" + ret_str += " expected_size = " + str(self.expected_size) + "\n" return ret_str @@ -112,21 +148,37 @@ def __eq__(self, other): pass if not isinstance(other, ctypes.Array): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(other))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_type, type(other) + ) + ) return False - if len(other) < len(self.expected_string_value) + 1: # +1 for NULL terminating character - print("Unexpected length in C string. Expected at least: {0}. Received {1}".format(len(other), len(self.expected_string_value) + 1)) + if ( + len(other) < len(self.expected_string_value) + 1 + ): # +1 for NULL terminating character + print( + "Unexpected length in C string. Expected at least: {0}. Received {1}".format( + len(other), len(self.expected_string_value) + 1 + ) + ) return False if not isinstance(other[0], bytes): print("Unexpected type. Not a string. Received: {0}".format(type(other[0]))) return False if other.value.decode("ascii") != self.expected_string_value: - print("Unexpected value. Expected {0}. Received: {1}".format(self.expected_string_value, other.value.decode)) + print( + "Unexpected value. Expected {0}. Received: {1}".format( + self.expected_string_value, other.value.decode + ) + ) return False return True def __repr__(self): - return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_string_value)) + return "{0}({1})".format( + self.__class__.__name__, pp.pformat(self.expected_string_value) + ) # Custom Type @@ -139,7 +191,11 @@ def _compare_ctype_structs(expected, actual): expected_val = getattr(expected, field_name) actual_val = getattr(actual, field_name) if expected_val != actual_val: - print("Unexpected value field {0}. Expected: {1}. Received: {2}".format(field_name, expected_val, actual_val)) + print( + "Unexpected value field {0}. Expected: {1}. Received: {2}".format( + field_name, expected_val, actual_val + ) + ) return False return True @@ -151,12 +207,20 @@ def __init__(self, expected_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_type, type(actual) + ) + ) return False return _compare_ctype_structs(self.expected_value, actual) def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_type), + pp.pformat(self.expected_value), + ) class CustomTypeBufferMatcher(object): @@ -168,30 +232,48 @@ def __init__(self, expected_element_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print("Unexpected array type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) + print( + "Unexpected array type. Expected: {0}. Received: {1}".format( + self.expected_type, type(actual) + ) + ) return False if self.expected_size != len(actual): - print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(actual))) + print( + "Unexpected length. Expected: {0}. Received: {1}".format( + self.expected_size, len(actual) + ) + ) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for a, e in zip(actual, self.expected_value): if not isinstance(a, self.expected_element_type): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_element_type, type(a))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_element_type, type(a) + ) + ) return False if not _compare_ctype_structs(e, a): return False return True def __repr__(self): - expected_val_repr = '[' + ', '.join([x.__repr__() for x in self.expected_value]) + ']' - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_element_type), expected_val_repr) + expected_val_repr = ( + "[" + ", ".join([x.__repr__() for x in self.expected_value]) + "]" + ) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_element_type), + expected_val_repr, + ) def __str__(self): - ret_str = self.__repr__() + '\n' - ret_str += ' expected_type = ' + str(self.expected_type) + '\n' - ret_str += ' expected_size = ' + str(self.expected_size) + '\n' + ret_str = self.__repr__() + "\n" + ret_str += " expected_type = " + str(self.expected_type) + "\n" + ret_str += " expected_size = " + str(self.expected_size) + "\n" return ret_str @@ -200,7 +282,9 @@ def __str__(self): class ViBooleanMatcher(_ScalarMatcher): def __init__(self, expected_value): - _ScalarMatcher.__init__(self, _visatype.ViBoolean, 1 if expected_value is True else 0) + _ScalarMatcher.__init__( + self, _visatype.ViBoolean, 1 if expected_value is True else 0 + ) class ViSessionMatcher(_ScalarMatcher): @@ -312,6 +396,3 @@ def __init__(self, expected_size_or_value): class ViSessionBufferMatcher(_BufferMatcher): def __init__(self, expected_size_or_value): _BufferMatcher.__init__(self, _visatype.ViSession, expected_size_or_value) - - - diff --git a/generated/nifgen/nifgen/unit_tests/_mock_helper.py b/generated/nifgen/nifgen/unit_tests/_mock_helper.py index a0ba88469..7e573c88b 100644 --- a/generated/nifgen/nifgen/unit_tests/_mock_helper.py +++ b/generated/nifgen/nifgen/unit_tests/_mock_helper.py @@ -16,206 +16,212 @@ def __init__(self, function, param=None): class SideEffectsHelper(object): def __init__(self): self._defaults = {} - self._defaults['AbortGeneration'] = {} - self._defaults['AbortGeneration']['return'] = 0 - self._defaults['AllocateNamedWaveform'] = {} - self._defaults['AllocateNamedWaveform']['return'] = 0 - self._defaults['AllocateWaveform'] = {} - self._defaults['AllocateWaveform']['return'] = 0 - self._defaults['AllocateWaveform']['waveformHandle'] = None - self._defaults['ClearArbMemory'] = {} - self._defaults['ClearArbMemory']['return'] = 0 - self._defaults['ClearArbSequence'] = {} - self._defaults['ClearArbSequence']['return'] = 0 - self._defaults['ClearArbWaveform'] = {} - self._defaults['ClearArbWaveform']['return'] = 0 - self._defaults['ClearFreqList'] = {} - self._defaults['ClearFreqList']['return'] = 0 - self._defaults['ClearUserStandardWaveform'] = {} - self._defaults['ClearUserStandardWaveform']['return'] = 0 - self._defaults['Commit'] = {} - self._defaults['Commit']['return'] = 0 - self._defaults['ConfigureArbSequence'] = {} - self._defaults['ConfigureArbSequence']['return'] = 0 - self._defaults['ConfigureArbWaveform'] = {} - self._defaults['ConfigureArbWaveform']['return'] = 0 - self._defaults['ConfigureFreqList'] = {} - self._defaults['ConfigureFreqList']['return'] = 0 - self._defaults['ConfigureStandardWaveform'] = {} - self._defaults['ConfigureStandardWaveform']['return'] = 0 - self._defaults['CreateAdvancedArbSequence'] = {} - self._defaults['CreateAdvancedArbSequence']['return'] = 0 - self._defaults['CreateAdvancedArbSequence']['coercedMarkersArray'] = None - self._defaults['CreateAdvancedArbSequence']['sequenceHandle'] = None - self._defaults['CreateArbSequence'] = {} - self._defaults['CreateArbSequence']['return'] = 0 - self._defaults['CreateArbSequence']['sequenceHandle'] = None - self._defaults['CreateFreqList'] = {} - self._defaults['CreateFreqList']['return'] = 0 - self._defaults['CreateFreqList']['frequencyListHandle'] = None - self._defaults['CreateWaveformF64'] = {} - self._defaults['CreateWaveformF64']['return'] = 0 - self._defaults['CreateWaveformF64']['waveformHandle'] = None - self._defaults['CreateWaveformFromFileF64'] = {} - self._defaults['CreateWaveformFromFileF64']['return'] = 0 - self._defaults['CreateWaveformFromFileF64']['waveformHandle'] = None - self._defaults['CreateWaveformFromFileI16'] = {} - self._defaults['CreateWaveformFromFileI16']['return'] = 0 - self._defaults['CreateWaveformFromFileI16']['waveformHandle'] = None - self._defaults['CreateWaveformI16'] = {} - self._defaults['CreateWaveformI16']['return'] = 0 - self._defaults['CreateWaveformI16']['waveformHandle'] = None - self._defaults['DefineUserStandardWaveform'] = {} - self._defaults['DefineUserStandardWaveform']['return'] = 0 - self._defaults['DeleteNamedWaveform'] = {} - self._defaults['DeleteNamedWaveform']['return'] = 0 - self._defaults['DeleteScript'] = {} - self._defaults['DeleteScript']['return'] = 0 - self._defaults['Disable'] = {} - self._defaults['Disable']['return'] = 0 - self._defaults['ExportAttributeConfigurationBuffer'] = {} - self._defaults['ExportAttributeConfigurationBuffer']['return'] = 0 - self._defaults['ExportAttributeConfigurationBuffer']['configuration'] = None - self._defaults['ExportAttributeConfigurationFile'] = {} - self._defaults['ExportAttributeConfigurationFile']['return'] = 0 - self._defaults['GetAttributeViBoolean'] = {} - self._defaults['GetAttributeViBoolean']['return'] = 0 - self._defaults['GetAttributeViBoolean']['attributeValue'] = None - self._defaults['GetAttributeViInt32'] = {} - self._defaults['GetAttributeViInt32']['return'] = 0 - self._defaults['GetAttributeViInt32']['attributeValue'] = None - self._defaults['GetAttributeViReal64'] = {} - self._defaults['GetAttributeViReal64']['return'] = 0 - self._defaults['GetAttributeViReal64']['attributeValue'] = None - self._defaults['GetAttributeViString'] = {} - self._defaults['GetAttributeViString']['return'] = 0 - self._defaults['GetAttributeViString']['attributeValue'] = None - self._defaults['GetChannelName'] = {} - self._defaults['GetChannelName']['return'] = 0 - self._defaults['GetChannelName']['channelString'] = None - self._defaults['GetError'] = {} - self._defaults['GetError']['return'] = 0 - self._defaults['GetError']['errorCode'] = None - self._defaults['GetError']['errorDescription'] = None - self._defaults['GetExtCalLastDateAndTime'] = {} - self._defaults['GetExtCalLastDateAndTime']['return'] = 0 - self._defaults['GetExtCalLastDateAndTime']['year'] = None - self._defaults['GetExtCalLastDateAndTime']['month'] = None - self._defaults['GetExtCalLastDateAndTime']['day'] = None - self._defaults['GetExtCalLastDateAndTime']['hour'] = None - self._defaults['GetExtCalLastDateAndTime']['minute'] = None - self._defaults['GetExtCalLastTemp'] = {} - self._defaults['GetExtCalLastTemp']['return'] = 0 - self._defaults['GetExtCalLastTemp']['temperature'] = None - self._defaults['GetExtCalRecommendedInterval'] = {} - self._defaults['GetExtCalRecommendedInterval']['return'] = 0 - self._defaults['GetExtCalRecommendedInterval']['months'] = None - self._defaults['GetHardwareState'] = {} - self._defaults['GetHardwareState']['return'] = 0 - self._defaults['GetHardwareState']['state'] = None - self._defaults['GetLastExtCalLastDateAndTime'] = {} - self._defaults['GetLastExtCalLastDateAndTime']['return'] = 0 - self._defaults['GetLastExtCalLastDateAndTime']['month'] = None - self._defaults['GetLastSelfCalLastDateAndTime'] = {} - self._defaults['GetLastSelfCalLastDateAndTime']['return'] = 0 - self._defaults['GetLastSelfCalLastDateAndTime']['month'] = None - self._defaults['GetSelfCalLastDateAndTime'] = {} - self._defaults['GetSelfCalLastDateAndTime']['return'] = 0 - self._defaults['GetSelfCalLastDateAndTime']['year'] = None - self._defaults['GetSelfCalLastDateAndTime']['month'] = None - self._defaults['GetSelfCalLastDateAndTime']['day'] = None - self._defaults['GetSelfCalLastDateAndTime']['hour'] = None - self._defaults['GetSelfCalLastDateAndTime']['minute'] = None - self._defaults['GetSelfCalLastTemp'] = {} - self._defaults['GetSelfCalLastTemp']['return'] = 0 - self._defaults['GetSelfCalLastTemp']['temperature'] = None - self._defaults['GetSelfCalSupported'] = {} - self._defaults['GetSelfCalSupported']['return'] = 0 - self._defaults['GetSelfCalSupported']['selfCalSupported'] = None - self._defaults['ImportAttributeConfigurationBuffer'] = {} - self._defaults['ImportAttributeConfigurationBuffer']['return'] = 0 - self._defaults['ImportAttributeConfigurationFile'] = {} - self._defaults['ImportAttributeConfigurationFile']['return'] = 0 - self._defaults['InitializeWithChannels'] = {} - self._defaults['InitializeWithChannels']['return'] = 0 - self._defaults['InitializeWithChannels']['vi'] = None - self._defaults['InitiateGeneration'] = {} - self._defaults['InitiateGeneration']['return'] = 0 - self._defaults['IsDone'] = {} - self._defaults['IsDone']['return'] = 0 - self._defaults['IsDone']['done'] = None - self._defaults['LockSession'] = {} - self._defaults['LockSession']['return'] = 0 - self._defaults['LockSession']['callerHasLock'] = None - self._defaults['QueryArbSeqCapabilities'] = {} - self._defaults['QueryArbSeqCapabilities']['return'] = 0 - self._defaults['QueryArbSeqCapabilities']['maximumNumberOfSequences'] = None - self._defaults['QueryArbSeqCapabilities']['minimumSequenceLength'] = None - self._defaults['QueryArbSeqCapabilities']['maximumSequenceLength'] = None - self._defaults['QueryArbSeqCapabilities']['maximumLoopCount'] = None - self._defaults['QueryArbWfmCapabilities'] = {} - self._defaults['QueryArbWfmCapabilities']['return'] = 0 - self._defaults['QueryArbWfmCapabilities']['maximumNumberOfWaveforms'] = None - self._defaults['QueryArbWfmCapabilities']['waveformQuantum'] = None - self._defaults['QueryArbWfmCapabilities']['minimumWaveformSize'] = None - self._defaults['QueryArbWfmCapabilities']['maximumWaveformSize'] = None - self._defaults['QueryFreqListCapabilities'] = {} - self._defaults['QueryFreqListCapabilities']['return'] = 0 - self._defaults['QueryFreqListCapabilities']['maximumNumberOfFreqLists'] = None - self._defaults['QueryFreqListCapabilities']['minimumFrequencyListLength'] = None - self._defaults['QueryFreqListCapabilities']['maximumFrequencyListLength'] = None - self._defaults['QueryFreqListCapabilities']['minimumFrequencyListDuration'] = None - self._defaults['QueryFreqListCapabilities']['maximumFrequencyListDuration'] = None - self._defaults['QueryFreqListCapabilities']['frequencyListDurationQuantum'] = None - self._defaults['ReadCurrentTemperature'] = {} - self._defaults['ReadCurrentTemperature']['return'] = 0 - self._defaults['ReadCurrentTemperature']['temperature'] = None - self._defaults['ResetDevice'] = {} - self._defaults['ResetDevice']['return'] = 0 - self._defaults['ResetWithDefaults'] = {} - self._defaults['ResetWithDefaults']['return'] = 0 - self._defaults['SelfCal'] = {} - self._defaults['SelfCal']['return'] = 0 - self._defaults['SendSoftwareEdgeTrigger'] = {} - self._defaults['SendSoftwareEdgeTrigger']['return'] = 0 - self._defaults['SetAttributeViBoolean'] = {} - self._defaults['SetAttributeViBoolean']['return'] = 0 - self._defaults['SetAttributeViInt32'] = {} - self._defaults['SetAttributeViInt32']['return'] = 0 - self._defaults['SetAttributeViReal64'] = {} - self._defaults['SetAttributeViReal64']['return'] = 0 - self._defaults['SetAttributeViString'] = {} - self._defaults['SetAttributeViString']['return'] = 0 - self._defaults['SetNamedWaveformNextWritePosition'] = {} - self._defaults['SetNamedWaveformNextWritePosition']['return'] = 0 - self._defaults['SetWaveformNextWritePosition'] = {} - self._defaults['SetWaveformNextWritePosition']['return'] = 0 - self._defaults['UnlockSession'] = {} - self._defaults['UnlockSession']['return'] = 0 - self._defaults['UnlockSession']['callerHasLock'] = None - self._defaults['WaitUntilDone'] = {} - self._defaults['WaitUntilDone']['return'] = 0 - self._defaults['WriteBinary16Waveform'] = {} - self._defaults['WriteBinary16Waveform']['return'] = 0 - self._defaults['WriteNamedWaveformF64'] = {} - self._defaults['WriteNamedWaveformF64']['return'] = 0 - self._defaults['WriteNamedWaveformI16'] = {} - self._defaults['WriteNamedWaveformI16']['return'] = 0 - self._defaults['WriteScript'] = {} - self._defaults['WriteScript']['return'] = 0 - self._defaults['WriteWaveform'] = {} - self._defaults['WriteWaveform']['return'] = 0 - self._defaults['close'] = {} - self._defaults['close']['return'] = 0 - self._defaults['error_message'] = {} - self._defaults['error_message']['return'] = 0 - self._defaults['error_message']['errorMessage'] = None - self._defaults['reset'] = {} - self._defaults['reset']['return'] = 0 - self._defaults['self_test'] = {} - self._defaults['self_test']['return'] = 0 - self._defaults['self_test']['selfTestResult'] = None - self._defaults['self_test']['selfTestMessage'] = None + self._defaults["AbortGeneration"] = {} + self._defaults["AbortGeneration"]["return"] = 0 + self._defaults["AllocateNamedWaveform"] = {} + self._defaults["AllocateNamedWaveform"]["return"] = 0 + self._defaults["AllocateWaveform"] = {} + self._defaults["AllocateWaveform"]["return"] = 0 + self._defaults["AllocateWaveform"]["waveformHandle"] = None + self._defaults["ClearArbMemory"] = {} + self._defaults["ClearArbMemory"]["return"] = 0 + self._defaults["ClearArbSequence"] = {} + self._defaults["ClearArbSequence"]["return"] = 0 + self._defaults["ClearArbWaveform"] = {} + self._defaults["ClearArbWaveform"]["return"] = 0 + self._defaults["ClearFreqList"] = {} + self._defaults["ClearFreqList"]["return"] = 0 + self._defaults["ClearUserStandardWaveform"] = {} + self._defaults["ClearUserStandardWaveform"]["return"] = 0 + self._defaults["Commit"] = {} + self._defaults["Commit"]["return"] = 0 + self._defaults["ConfigureArbSequence"] = {} + self._defaults["ConfigureArbSequence"]["return"] = 0 + self._defaults["ConfigureArbWaveform"] = {} + self._defaults["ConfigureArbWaveform"]["return"] = 0 + self._defaults["ConfigureFreqList"] = {} + self._defaults["ConfigureFreqList"]["return"] = 0 + self._defaults["ConfigureStandardWaveform"] = {} + self._defaults["ConfigureStandardWaveform"]["return"] = 0 + self._defaults["CreateAdvancedArbSequence"] = {} + self._defaults["CreateAdvancedArbSequence"]["return"] = 0 + self._defaults["CreateAdvancedArbSequence"]["coercedMarkersArray"] = None + self._defaults["CreateAdvancedArbSequence"]["sequenceHandle"] = None + self._defaults["CreateArbSequence"] = {} + self._defaults["CreateArbSequence"]["return"] = 0 + self._defaults["CreateArbSequence"]["sequenceHandle"] = None + self._defaults["CreateFreqList"] = {} + self._defaults["CreateFreqList"]["return"] = 0 + self._defaults["CreateFreqList"]["frequencyListHandle"] = None + self._defaults["CreateWaveformF64"] = {} + self._defaults["CreateWaveformF64"]["return"] = 0 + self._defaults["CreateWaveformF64"]["waveformHandle"] = None + self._defaults["CreateWaveformFromFileF64"] = {} + self._defaults["CreateWaveformFromFileF64"]["return"] = 0 + self._defaults["CreateWaveformFromFileF64"]["waveformHandle"] = None + self._defaults["CreateWaveformFromFileI16"] = {} + self._defaults["CreateWaveformFromFileI16"]["return"] = 0 + self._defaults["CreateWaveformFromFileI16"]["waveformHandle"] = None + self._defaults["CreateWaveformI16"] = {} + self._defaults["CreateWaveformI16"]["return"] = 0 + self._defaults["CreateWaveformI16"]["waveformHandle"] = None + self._defaults["DefineUserStandardWaveform"] = {} + self._defaults["DefineUserStandardWaveform"]["return"] = 0 + self._defaults["DeleteNamedWaveform"] = {} + self._defaults["DeleteNamedWaveform"]["return"] = 0 + self._defaults["DeleteScript"] = {} + self._defaults["DeleteScript"]["return"] = 0 + self._defaults["Disable"] = {} + self._defaults["Disable"]["return"] = 0 + self._defaults["ExportAttributeConfigurationBuffer"] = {} + self._defaults["ExportAttributeConfigurationBuffer"]["return"] = 0 + self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] = None + self._defaults["ExportAttributeConfigurationFile"] = {} + self._defaults["ExportAttributeConfigurationFile"]["return"] = 0 + self._defaults["GetAttributeViBoolean"] = {} + self._defaults["GetAttributeViBoolean"]["return"] = 0 + self._defaults["GetAttributeViBoolean"]["attributeValue"] = None + self._defaults["GetAttributeViInt32"] = {} + self._defaults["GetAttributeViInt32"]["return"] = 0 + self._defaults["GetAttributeViInt32"]["attributeValue"] = None + self._defaults["GetAttributeViReal64"] = {} + self._defaults["GetAttributeViReal64"]["return"] = 0 + self._defaults["GetAttributeViReal64"]["attributeValue"] = None + self._defaults["GetAttributeViString"] = {} + self._defaults["GetAttributeViString"]["return"] = 0 + self._defaults["GetAttributeViString"]["attributeValue"] = None + self._defaults["GetChannelName"] = {} + self._defaults["GetChannelName"]["return"] = 0 + self._defaults["GetChannelName"]["channelString"] = None + self._defaults["GetError"] = {} + self._defaults["GetError"]["return"] = 0 + self._defaults["GetError"]["errorCode"] = None + self._defaults["GetError"]["errorDescription"] = None + self._defaults["GetExtCalLastDateAndTime"] = {} + self._defaults["GetExtCalLastDateAndTime"]["return"] = 0 + self._defaults["GetExtCalLastDateAndTime"]["year"] = None + self._defaults["GetExtCalLastDateAndTime"]["month"] = None + self._defaults["GetExtCalLastDateAndTime"]["day"] = None + self._defaults["GetExtCalLastDateAndTime"]["hour"] = None + self._defaults["GetExtCalLastDateAndTime"]["minute"] = None + self._defaults["GetExtCalLastTemp"] = {} + self._defaults["GetExtCalLastTemp"]["return"] = 0 + self._defaults["GetExtCalLastTemp"]["temperature"] = None + self._defaults["GetExtCalRecommendedInterval"] = {} + self._defaults["GetExtCalRecommendedInterval"]["return"] = 0 + self._defaults["GetExtCalRecommendedInterval"]["months"] = None + self._defaults["GetHardwareState"] = {} + self._defaults["GetHardwareState"]["return"] = 0 + self._defaults["GetHardwareState"]["state"] = None + self._defaults["GetLastExtCalLastDateAndTime"] = {} + self._defaults["GetLastExtCalLastDateAndTime"]["return"] = 0 + self._defaults["GetLastExtCalLastDateAndTime"]["month"] = None + self._defaults["GetLastSelfCalLastDateAndTime"] = {} + self._defaults["GetLastSelfCalLastDateAndTime"]["return"] = 0 + self._defaults["GetLastSelfCalLastDateAndTime"]["month"] = None + self._defaults["GetSelfCalLastDateAndTime"] = {} + self._defaults["GetSelfCalLastDateAndTime"]["return"] = 0 + self._defaults["GetSelfCalLastDateAndTime"]["year"] = None + self._defaults["GetSelfCalLastDateAndTime"]["month"] = None + self._defaults["GetSelfCalLastDateAndTime"]["day"] = None + self._defaults["GetSelfCalLastDateAndTime"]["hour"] = None + self._defaults["GetSelfCalLastDateAndTime"]["minute"] = None + self._defaults["GetSelfCalLastTemp"] = {} + self._defaults["GetSelfCalLastTemp"]["return"] = 0 + self._defaults["GetSelfCalLastTemp"]["temperature"] = None + self._defaults["GetSelfCalSupported"] = {} + self._defaults["GetSelfCalSupported"]["return"] = 0 + self._defaults["GetSelfCalSupported"]["selfCalSupported"] = None + self._defaults["ImportAttributeConfigurationBuffer"] = {} + self._defaults["ImportAttributeConfigurationBuffer"]["return"] = 0 + self._defaults["ImportAttributeConfigurationFile"] = {} + self._defaults["ImportAttributeConfigurationFile"]["return"] = 0 + self._defaults["InitializeWithChannels"] = {} + self._defaults["InitializeWithChannels"]["return"] = 0 + self._defaults["InitializeWithChannels"]["vi"] = None + self._defaults["InitiateGeneration"] = {} + self._defaults["InitiateGeneration"]["return"] = 0 + self._defaults["IsDone"] = {} + self._defaults["IsDone"]["return"] = 0 + self._defaults["IsDone"]["done"] = None + self._defaults["LockSession"] = {} + self._defaults["LockSession"]["return"] = 0 + self._defaults["LockSession"]["callerHasLock"] = None + self._defaults["QueryArbSeqCapabilities"] = {} + self._defaults["QueryArbSeqCapabilities"]["return"] = 0 + self._defaults["QueryArbSeqCapabilities"]["maximumNumberOfSequences"] = None + self._defaults["QueryArbSeqCapabilities"]["minimumSequenceLength"] = None + self._defaults["QueryArbSeqCapabilities"]["maximumSequenceLength"] = None + self._defaults["QueryArbSeqCapabilities"]["maximumLoopCount"] = None + self._defaults["QueryArbWfmCapabilities"] = {} + self._defaults["QueryArbWfmCapabilities"]["return"] = 0 + self._defaults["QueryArbWfmCapabilities"]["maximumNumberOfWaveforms"] = None + self._defaults["QueryArbWfmCapabilities"]["waveformQuantum"] = None + self._defaults["QueryArbWfmCapabilities"]["minimumWaveformSize"] = None + self._defaults["QueryArbWfmCapabilities"]["maximumWaveformSize"] = None + self._defaults["QueryFreqListCapabilities"] = {} + self._defaults["QueryFreqListCapabilities"]["return"] = 0 + self._defaults["QueryFreqListCapabilities"]["maximumNumberOfFreqLists"] = None + self._defaults["QueryFreqListCapabilities"]["minimumFrequencyListLength"] = None + self._defaults["QueryFreqListCapabilities"]["maximumFrequencyListLength"] = None + self._defaults["QueryFreqListCapabilities"][ + "minimumFrequencyListDuration" + ] = None + self._defaults["QueryFreqListCapabilities"][ + "maximumFrequencyListDuration" + ] = None + self._defaults["QueryFreqListCapabilities"][ + "frequencyListDurationQuantum" + ] = None + self._defaults["ReadCurrentTemperature"] = {} + self._defaults["ReadCurrentTemperature"]["return"] = 0 + self._defaults["ReadCurrentTemperature"]["temperature"] = None + self._defaults["ResetDevice"] = {} + self._defaults["ResetDevice"]["return"] = 0 + self._defaults["ResetWithDefaults"] = {} + self._defaults["ResetWithDefaults"]["return"] = 0 + self._defaults["SelfCal"] = {} + self._defaults["SelfCal"]["return"] = 0 + self._defaults["SendSoftwareEdgeTrigger"] = {} + self._defaults["SendSoftwareEdgeTrigger"]["return"] = 0 + self._defaults["SetAttributeViBoolean"] = {} + self._defaults["SetAttributeViBoolean"]["return"] = 0 + self._defaults["SetAttributeViInt32"] = {} + self._defaults["SetAttributeViInt32"]["return"] = 0 + self._defaults["SetAttributeViReal64"] = {} + self._defaults["SetAttributeViReal64"]["return"] = 0 + self._defaults["SetAttributeViString"] = {} + self._defaults["SetAttributeViString"]["return"] = 0 + self._defaults["SetNamedWaveformNextWritePosition"] = {} + self._defaults["SetNamedWaveformNextWritePosition"]["return"] = 0 + self._defaults["SetWaveformNextWritePosition"] = {} + self._defaults["SetWaveformNextWritePosition"]["return"] = 0 + self._defaults["UnlockSession"] = {} + self._defaults["UnlockSession"]["return"] = 0 + self._defaults["UnlockSession"]["callerHasLock"] = None + self._defaults["WaitUntilDone"] = {} + self._defaults["WaitUntilDone"]["return"] = 0 + self._defaults["WriteBinary16Waveform"] = {} + self._defaults["WriteBinary16Waveform"]["return"] = 0 + self._defaults["WriteNamedWaveformF64"] = {} + self._defaults["WriteNamedWaveformF64"]["return"] = 0 + self._defaults["WriteNamedWaveformI16"] = {} + self._defaults["WriteNamedWaveformI16"]["return"] = 0 + self._defaults["WriteScript"] = {} + self._defaults["WriteScript"]["return"] = 0 + self._defaults["WriteWaveform"] = {} + self._defaults["WriteWaveform"]["return"] = 0 + self._defaults["close"] = {} + self._defaults["close"]["return"] = 0 + self._defaults["error_message"] = {} + self._defaults["error_message"]["return"] = 0 + self._defaults["error_message"]["errorMessage"] = None + self._defaults["reset"] = {} + self._defaults["reset"]["return"] = 0 + self._defaults["self_test"] = {} + self._defaults["self_test"]["return"] = 0 + self._defaults["self_test"]["selfTestResult"] = None + self._defaults["self_test"]["selfTestMessage"] = None def __getitem__(self, func): return self._defaults[func] @@ -224,82 +230,110 @@ def __setitem__(self, func, val): self._defaults[func] = val def niFgen_AbortGeneration(self, vi): # noqa: N802 - if self._defaults['AbortGeneration']['return'] != 0: - return self._defaults['AbortGeneration']['return'] - return self._defaults['AbortGeneration']['return'] - - def niFgen_AllocateNamedWaveform(self, vi, channel_name, waveform_name, waveform_size): # noqa: N802 - if self._defaults['AllocateNamedWaveform']['return'] != 0: - return self._defaults['AllocateNamedWaveform']['return'] - return self._defaults['AllocateNamedWaveform']['return'] - - def niFgen_AllocateWaveform(self, vi, channel_name, waveform_size, waveform_handle): # noqa: N802 - if self._defaults['AllocateWaveform']['return'] != 0: - return self._defaults['AllocateWaveform']['return'] + if self._defaults["AbortGeneration"]["return"] != 0: + return self._defaults["AbortGeneration"]["return"] + return self._defaults["AbortGeneration"]["return"] + + def niFgen_AllocateNamedWaveform( + self, vi, channel_name, waveform_name, waveform_size + ): # noqa: N802 + if self._defaults["AllocateNamedWaveform"]["return"] != 0: + return self._defaults["AllocateNamedWaveform"]["return"] + return self._defaults["AllocateNamedWaveform"]["return"] + + def niFgen_AllocateWaveform( + self, vi, channel_name, waveform_size, waveform_handle + ): # noqa: N802 + if self._defaults["AllocateWaveform"]["return"] != 0: + return self._defaults["AllocateWaveform"]["return"] # waveform_handle - if self._defaults['AllocateWaveform']['waveformHandle'] is None: - raise MockFunctionCallError("niFgen_AllocateWaveform", param='waveformHandle') + if self._defaults["AllocateWaveform"]["waveformHandle"] is None: + raise MockFunctionCallError( + "niFgen_AllocateWaveform", param="waveformHandle" + ) if waveform_handle is not None: - waveform_handle.contents.value = self._defaults['AllocateWaveform']['waveformHandle'] - return self._defaults['AllocateWaveform']['return'] + waveform_handle.contents.value = self._defaults["AllocateWaveform"][ + "waveformHandle" + ] + return self._defaults["AllocateWaveform"]["return"] def niFgen_ClearArbMemory(self, vi): # noqa: N802 - if self._defaults['ClearArbMemory']['return'] != 0: - return self._defaults['ClearArbMemory']['return'] - return self._defaults['ClearArbMemory']['return'] + if self._defaults["ClearArbMemory"]["return"] != 0: + return self._defaults["ClearArbMemory"]["return"] + return self._defaults["ClearArbMemory"]["return"] def niFgen_ClearArbSequence(self, vi, sequence_handle): # noqa: N802 - if self._defaults['ClearArbSequence']['return'] != 0: - return self._defaults['ClearArbSequence']['return'] - return self._defaults['ClearArbSequence']['return'] + if self._defaults["ClearArbSequence"]["return"] != 0: + return self._defaults["ClearArbSequence"]["return"] + return self._defaults["ClearArbSequence"]["return"] def niFgen_ClearArbWaveform(self, vi, waveform_handle): # noqa: N802 - if self._defaults['ClearArbWaveform']['return'] != 0: - return self._defaults['ClearArbWaveform']['return'] - return self._defaults['ClearArbWaveform']['return'] + if self._defaults["ClearArbWaveform"]["return"] != 0: + return self._defaults["ClearArbWaveform"]["return"] + return self._defaults["ClearArbWaveform"]["return"] def niFgen_ClearFreqList(self, vi, frequency_list_handle): # noqa: N802 - if self._defaults['ClearFreqList']['return'] != 0: - return self._defaults['ClearFreqList']['return'] - return self._defaults['ClearFreqList']['return'] + if self._defaults["ClearFreqList"]["return"] != 0: + return self._defaults["ClearFreqList"]["return"] + return self._defaults["ClearFreqList"]["return"] def niFgen_ClearUserStandardWaveform(self, vi, channel_name): # noqa: N802 - if self._defaults['ClearUserStandardWaveform']['return'] != 0: - return self._defaults['ClearUserStandardWaveform']['return'] - return self._defaults['ClearUserStandardWaveform']['return'] + if self._defaults["ClearUserStandardWaveform"]["return"] != 0: + return self._defaults["ClearUserStandardWaveform"]["return"] + return self._defaults["ClearUserStandardWaveform"]["return"] def niFgen_Commit(self, vi): # noqa: N802 - if self._defaults['Commit']['return'] != 0: - return self._defaults['Commit']['return'] - return self._defaults['Commit']['return'] - - def niFgen_ConfigureArbSequence(self, vi, channel_name, sequence_handle, gain, offset): # noqa: N802 - if self._defaults['ConfigureArbSequence']['return'] != 0: - return self._defaults['ConfigureArbSequence']['return'] - return self._defaults['ConfigureArbSequence']['return'] - - def niFgen_ConfigureArbWaveform(self, vi, channel_name, waveform_handle, gain, offset): # noqa: N802 - if self._defaults['ConfigureArbWaveform']['return'] != 0: - return self._defaults['ConfigureArbWaveform']['return'] - return self._defaults['ConfigureArbWaveform']['return'] - - def niFgen_ConfigureFreqList(self, vi, channel_name, frequency_list_handle, amplitude, dc_offset, start_phase): # noqa: N802 - if self._defaults['ConfigureFreqList']['return'] != 0: - return self._defaults['ConfigureFreqList']['return'] - return self._defaults['ConfigureFreqList']['return'] - - def niFgen_ConfigureStandardWaveform(self, vi, channel_name, waveform, amplitude, dc_offset, frequency, start_phase): # noqa: N802 - if self._defaults['ConfigureStandardWaveform']['return'] != 0: - return self._defaults['ConfigureStandardWaveform']['return'] - return self._defaults['ConfigureStandardWaveform']['return'] - - def niFgen_CreateAdvancedArbSequence(self, vi, sequence_length, waveform_handles_array, loop_counts_array, sample_counts_array, marker_location_array, coerced_markers_array, sequence_handle): # noqa: N802 - if self._defaults['CreateAdvancedArbSequence']['return'] != 0: - return self._defaults['CreateAdvancedArbSequence']['return'] + if self._defaults["Commit"]["return"] != 0: + return self._defaults["Commit"]["return"] + return self._defaults["Commit"]["return"] + + def niFgen_ConfigureArbSequence( + self, vi, channel_name, sequence_handle, gain, offset + ): # noqa: N802 + if self._defaults["ConfigureArbSequence"]["return"] != 0: + return self._defaults["ConfigureArbSequence"]["return"] + return self._defaults["ConfigureArbSequence"]["return"] + + def niFgen_ConfigureArbWaveform( + self, vi, channel_name, waveform_handle, gain, offset + ): # noqa: N802 + if self._defaults["ConfigureArbWaveform"]["return"] != 0: + return self._defaults["ConfigureArbWaveform"]["return"] + return self._defaults["ConfigureArbWaveform"]["return"] + + def niFgen_ConfigureFreqList( + self, vi, channel_name, frequency_list_handle, amplitude, dc_offset, start_phase + ): # noqa: N802 + if self._defaults["ConfigureFreqList"]["return"] != 0: + return self._defaults["ConfigureFreqList"]["return"] + return self._defaults["ConfigureFreqList"]["return"] + + def niFgen_ConfigureStandardWaveform( + self, vi, channel_name, waveform, amplitude, dc_offset, frequency, start_phase + ): # noqa: N802 + if self._defaults["ConfigureStandardWaveform"]["return"] != 0: + return self._defaults["ConfigureStandardWaveform"]["return"] + return self._defaults["ConfigureStandardWaveform"]["return"] + + def niFgen_CreateAdvancedArbSequence( + self, + vi, + sequence_length, + waveform_handles_array, + loop_counts_array, + sample_counts_array, + marker_location_array, + coerced_markers_array, + sequence_handle, + ): # noqa: N802 + if self._defaults["CreateAdvancedArbSequence"]["return"] != 0: + return self._defaults["CreateAdvancedArbSequence"]["return"] # coerced_markers_array - if self._defaults['CreateAdvancedArbSequence']['coercedMarkersArray'] is None: - raise MockFunctionCallError("niFgen_CreateAdvancedArbSequence", param='coercedMarkersArray') - test_value = self._defaults['CreateAdvancedArbSequence']['coercedMarkersArray'] + if self._defaults["CreateAdvancedArbSequence"]["coercedMarkersArray"] is None: + raise MockFunctionCallError( + "niFgen_CreateAdvancedArbSequence", param="coercedMarkersArray" + ) + test_value = self._defaults["CreateAdvancedArbSequence"]["coercedMarkersArray"] try: coerced_markers_array_ref = coerced_markers_array.contents except AttributeError: @@ -308,723 +342,1134 @@ def niFgen_CreateAdvancedArbSequence(self, vi, sequence_length, waveform_handles for i in range(len(test_value)): coerced_markers_array_ref[i] = test_value[i] # sequence_handle - if self._defaults['CreateAdvancedArbSequence']['sequenceHandle'] is None: - raise MockFunctionCallError("niFgen_CreateAdvancedArbSequence", param='sequenceHandle') + if self._defaults["CreateAdvancedArbSequence"]["sequenceHandle"] is None: + raise MockFunctionCallError( + "niFgen_CreateAdvancedArbSequence", param="sequenceHandle" + ) if sequence_handle is not None: - sequence_handle.contents.value = self._defaults['CreateAdvancedArbSequence']['sequenceHandle'] - return self._defaults['CreateAdvancedArbSequence']['return'] - - def niFgen_CreateArbSequence(self, vi, sequence_length, waveform_handles_array, loop_counts_array, sequence_handle): # noqa: N802 - if self._defaults['CreateArbSequence']['return'] != 0: - return self._defaults['CreateArbSequence']['return'] + sequence_handle.contents.value = self._defaults[ + "CreateAdvancedArbSequence" + ]["sequenceHandle"] + return self._defaults["CreateAdvancedArbSequence"]["return"] + + def niFgen_CreateArbSequence( + self, + vi, + sequence_length, + waveform_handles_array, + loop_counts_array, + sequence_handle, + ): # noqa: N802 + if self._defaults["CreateArbSequence"]["return"] != 0: + return self._defaults["CreateArbSequence"]["return"] # sequence_handle - if self._defaults['CreateArbSequence']['sequenceHandle'] is None: - raise MockFunctionCallError("niFgen_CreateArbSequence", param='sequenceHandle') + if self._defaults["CreateArbSequence"]["sequenceHandle"] is None: + raise MockFunctionCallError( + "niFgen_CreateArbSequence", param="sequenceHandle" + ) if sequence_handle is not None: - sequence_handle.contents.value = self._defaults['CreateArbSequence']['sequenceHandle'] - return self._defaults['CreateArbSequence']['return'] - - def niFgen_CreateFreqList(self, vi, waveform, frequency_list_length, frequency_array, duration_array, frequency_list_handle): # noqa: N802 - if self._defaults['CreateFreqList']['return'] != 0: - return self._defaults['CreateFreqList']['return'] + sequence_handle.contents.value = self._defaults["CreateArbSequence"][ + "sequenceHandle" + ] + return self._defaults["CreateArbSequence"]["return"] + + def niFgen_CreateFreqList( + self, + vi, + waveform, + frequency_list_length, + frequency_array, + duration_array, + frequency_list_handle, + ): # noqa: N802 + if self._defaults["CreateFreqList"]["return"] != 0: + return self._defaults["CreateFreqList"]["return"] # frequency_list_handle - if self._defaults['CreateFreqList']['frequencyListHandle'] is None: - raise MockFunctionCallError("niFgen_CreateFreqList", param='frequencyListHandle') + if self._defaults["CreateFreqList"]["frequencyListHandle"] is None: + raise MockFunctionCallError( + "niFgen_CreateFreqList", param="frequencyListHandle" + ) if frequency_list_handle is not None: - frequency_list_handle.contents.value = self._defaults['CreateFreqList']['frequencyListHandle'] - return self._defaults['CreateFreqList']['return'] - - def niFgen_CreateWaveformF64(self, vi, channel_name, waveform_size, waveform_data_array, waveform_handle): # noqa: N802 - if self._defaults['CreateWaveformF64']['return'] != 0: - return self._defaults['CreateWaveformF64']['return'] + frequency_list_handle.contents.value = self._defaults["CreateFreqList"][ + "frequencyListHandle" + ] + return self._defaults["CreateFreqList"]["return"] + + def niFgen_CreateWaveformF64( + self, vi, channel_name, waveform_size, waveform_data_array, waveform_handle + ): # noqa: N802 + if self._defaults["CreateWaveformF64"]["return"] != 0: + return self._defaults["CreateWaveformF64"]["return"] # waveform_handle - if self._defaults['CreateWaveformF64']['waveformHandle'] is None: - raise MockFunctionCallError("niFgen_CreateWaveformF64", param='waveformHandle') + if self._defaults["CreateWaveformF64"]["waveformHandle"] is None: + raise MockFunctionCallError( + "niFgen_CreateWaveformF64", param="waveformHandle" + ) if waveform_handle is not None: - waveform_handle.contents.value = self._defaults['CreateWaveformF64']['waveformHandle'] - return self._defaults['CreateWaveformF64']['return'] - - def niFgen_CreateWaveformFromFileF64(self, vi, channel_name, file_name, byte_order, waveform_handle): # noqa: N802 - if self._defaults['CreateWaveformFromFileF64']['return'] != 0: - return self._defaults['CreateWaveformFromFileF64']['return'] + waveform_handle.contents.value = self._defaults["CreateWaveformF64"][ + "waveformHandle" + ] + return self._defaults["CreateWaveformF64"]["return"] + + def niFgen_CreateWaveformFromFileF64( + self, vi, channel_name, file_name, byte_order, waveform_handle + ): # noqa: N802 + if self._defaults["CreateWaveformFromFileF64"]["return"] != 0: + return self._defaults["CreateWaveformFromFileF64"]["return"] # waveform_handle - if self._defaults['CreateWaveformFromFileF64']['waveformHandle'] is None: - raise MockFunctionCallError("niFgen_CreateWaveformFromFileF64", param='waveformHandle') + if self._defaults["CreateWaveformFromFileF64"]["waveformHandle"] is None: + raise MockFunctionCallError( + "niFgen_CreateWaveformFromFileF64", param="waveformHandle" + ) if waveform_handle is not None: - waveform_handle.contents.value = self._defaults['CreateWaveformFromFileF64']['waveformHandle'] - return self._defaults['CreateWaveformFromFileF64']['return'] - - def niFgen_CreateWaveformFromFileI16(self, vi, channel_name, file_name, byte_order, waveform_handle): # noqa: N802 - if self._defaults['CreateWaveformFromFileI16']['return'] != 0: - return self._defaults['CreateWaveformFromFileI16']['return'] + waveform_handle.contents.value = self._defaults[ + "CreateWaveformFromFileF64" + ]["waveformHandle"] + return self._defaults["CreateWaveformFromFileF64"]["return"] + + def niFgen_CreateWaveformFromFileI16( + self, vi, channel_name, file_name, byte_order, waveform_handle + ): # noqa: N802 + if self._defaults["CreateWaveformFromFileI16"]["return"] != 0: + return self._defaults["CreateWaveformFromFileI16"]["return"] # waveform_handle - if self._defaults['CreateWaveformFromFileI16']['waveformHandle'] is None: - raise MockFunctionCallError("niFgen_CreateWaveformFromFileI16", param='waveformHandle') + if self._defaults["CreateWaveformFromFileI16"]["waveformHandle"] is None: + raise MockFunctionCallError( + "niFgen_CreateWaveformFromFileI16", param="waveformHandle" + ) if waveform_handle is not None: - waveform_handle.contents.value = self._defaults['CreateWaveformFromFileI16']['waveformHandle'] - return self._defaults['CreateWaveformFromFileI16']['return'] - - def niFgen_CreateWaveformI16(self, vi, channel_name, waveform_size, waveform_data_array, waveform_handle): # noqa: N802 - if self._defaults['CreateWaveformI16']['return'] != 0: - return self._defaults['CreateWaveformI16']['return'] + waveform_handle.contents.value = self._defaults[ + "CreateWaveformFromFileI16" + ]["waveformHandle"] + return self._defaults["CreateWaveformFromFileI16"]["return"] + + def niFgen_CreateWaveformI16( + self, vi, channel_name, waveform_size, waveform_data_array, waveform_handle + ): # noqa: N802 + if self._defaults["CreateWaveformI16"]["return"] != 0: + return self._defaults["CreateWaveformI16"]["return"] # waveform_handle - if self._defaults['CreateWaveformI16']['waveformHandle'] is None: - raise MockFunctionCallError("niFgen_CreateWaveformI16", param='waveformHandle') + if self._defaults["CreateWaveformI16"]["waveformHandle"] is None: + raise MockFunctionCallError( + "niFgen_CreateWaveformI16", param="waveformHandle" + ) if waveform_handle is not None: - waveform_handle.contents.value = self._defaults['CreateWaveformI16']['waveformHandle'] - return self._defaults['CreateWaveformI16']['return'] - - def niFgen_DefineUserStandardWaveform(self, vi, channel_name, waveform_size, waveform_data_array): # noqa: N802 - if self._defaults['DefineUserStandardWaveform']['return'] != 0: - return self._defaults['DefineUserStandardWaveform']['return'] - return self._defaults['DefineUserStandardWaveform']['return'] + waveform_handle.contents.value = self._defaults["CreateWaveformI16"][ + "waveformHandle" + ] + return self._defaults["CreateWaveformI16"]["return"] + + def niFgen_DefineUserStandardWaveform( + self, vi, channel_name, waveform_size, waveform_data_array + ): # noqa: N802 + if self._defaults["DefineUserStandardWaveform"]["return"] != 0: + return self._defaults["DefineUserStandardWaveform"]["return"] + return self._defaults["DefineUserStandardWaveform"]["return"] def niFgen_DeleteNamedWaveform(self, vi, channel_name, waveform_name): # noqa: N802 - if self._defaults['DeleteNamedWaveform']['return'] != 0: - return self._defaults['DeleteNamedWaveform']['return'] - return self._defaults['DeleteNamedWaveform']['return'] + if self._defaults["DeleteNamedWaveform"]["return"] != 0: + return self._defaults["DeleteNamedWaveform"]["return"] + return self._defaults["DeleteNamedWaveform"]["return"] def niFgen_DeleteScript(self, vi, channel_name, script_name): # noqa: N802 - if self._defaults['DeleteScript']['return'] != 0: - return self._defaults['DeleteScript']['return'] - return self._defaults['DeleteScript']['return'] + if self._defaults["DeleteScript"]["return"] != 0: + return self._defaults["DeleteScript"]["return"] + return self._defaults["DeleteScript"]["return"] def niFgen_Disable(self, vi): # noqa: N802 - if self._defaults['Disable']['return'] != 0: - return self._defaults['Disable']['return'] - return self._defaults['Disable']['return'] - - def niFgen_ExportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 - if self._defaults['ExportAttributeConfigurationBuffer']['return'] != 0: - return self._defaults['ExportAttributeConfigurationBuffer']['return'] - if self._defaults['ExportAttributeConfigurationBuffer']['configuration'] is None: - raise MockFunctionCallError("niFgen_ExportAttributeConfigurationBuffer", param='configuration') + if self._defaults["Disable"]["return"] != 0: + return self._defaults["Disable"]["return"] + return self._defaults["Disable"]["return"] + + def niFgen_ExportAttributeConfigurationBuffer( + self, vi, size_in_bytes, configuration + ): # noqa: N802 + if self._defaults["ExportAttributeConfigurationBuffer"]["return"] != 0: + return self._defaults["ExportAttributeConfigurationBuffer"]["return"] + if ( + self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] + is None + ): + raise MockFunctionCallError( + "niFgen_ExportAttributeConfigurationBuffer", param="configuration" + ) if size_in_bytes.value == 0: - return len(self._defaults['ExportAttributeConfigurationBuffer']['configuration']) + return len( + self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] + ) try: configuration_ref = configuration.contents except AttributeError: configuration_ref = configuration - for i in range(len(self._defaults['ExportAttributeConfigurationBuffer']['configuration'])): - configuration_ref[i] = self._defaults['ExportAttributeConfigurationBuffer']['configuration'][i] - return self._defaults['ExportAttributeConfigurationBuffer']['return'] + for i in range( + len(self._defaults["ExportAttributeConfigurationBuffer"]["configuration"]) + ): + configuration_ref[i] = self._defaults["ExportAttributeConfigurationBuffer"][ + "configuration" + ][i] + return self._defaults["ExportAttributeConfigurationBuffer"]["return"] def niFgen_ExportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 - if self._defaults['ExportAttributeConfigurationFile']['return'] != 0: - return self._defaults['ExportAttributeConfigurationFile']['return'] - return self._defaults['ExportAttributeConfigurationFile']['return'] - - def niFgen_GetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['GetAttributeViBoolean']['return'] != 0: - return self._defaults['GetAttributeViBoolean']['return'] + if self._defaults["ExportAttributeConfigurationFile"]["return"] != 0: + return self._defaults["ExportAttributeConfigurationFile"]["return"] + return self._defaults["ExportAttributeConfigurationFile"]["return"] + + def niFgen_GetAttributeViBoolean( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["GetAttributeViBoolean"]["return"] != 0: + return self._defaults["GetAttributeViBoolean"]["return"] # attribute_value - if self._defaults['GetAttributeViBoolean']['attributeValue'] is None: - raise MockFunctionCallError("niFgen_GetAttributeViBoolean", param='attributeValue') + if self._defaults["GetAttributeViBoolean"]["attributeValue"] is None: + raise MockFunctionCallError( + "niFgen_GetAttributeViBoolean", param="attributeValue" + ) if attribute_value is not None: - attribute_value.contents.value = self._defaults['GetAttributeViBoolean']['attributeValue'] - return self._defaults['GetAttributeViBoolean']['return'] - - def niFgen_GetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['GetAttributeViInt32']['return'] != 0: - return self._defaults['GetAttributeViInt32']['return'] + attribute_value.contents.value = self._defaults["GetAttributeViBoolean"][ + "attributeValue" + ] + return self._defaults["GetAttributeViBoolean"]["return"] + + def niFgen_GetAttributeViInt32( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["GetAttributeViInt32"]["return"] != 0: + return self._defaults["GetAttributeViInt32"]["return"] # attribute_value - if self._defaults['GetAttributeViInt32']['attributeValue'] is None: - raise MockFunctionCallError("niFgen_GetAttributeViInt32", param='attributeValue') + if self._defaults["GetAttributeViInt32"]["attributeValue"] is None: + raise MockFunctionCallError( + "niFgen_GetAttributeViInt32", param="attributeValue" + ) if attribute_value is not None: - attribute_value.contents.value = self._defaults['GetAttributeViInt32']['attributeValue'] - return self._defaults['GetAttributeViInt32']['return'] - - def niFgen_GetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['GetAttributeViReal64']['return'] != 0: - return self._defaults['GetAttributeViReal64']['return'] + attribute_value.contents.value = self._defaults["GetAttributeViInt32"][ + "attributeValue" + ] + return self._defaults["GetAttributeViInt32"]["return"] + + def niFgen_GetAttributeViReal64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["GetAttributeViReal64"]["return"] != 0: + return self._defaults["GetAttributeViReal64"]["return"] # attribute_value - if self._defaults['GetAttributeViReal64']['attributeValue'] is None: - raise MockFunctionCallError("niFgen_GetAttributeViReal64", param='attributeValue') + if self._defaults["GetAttributeViReal64"]["attributeValue"] is None: + raise MockFunctionCallError( + "niFgen_GetAttributeViReal64", param="attributeValue" + ) if attribute_value is not None: - attribute_value.contents.value = self._defaults['GetAttributeViReal64']['attributeValue'] - return self._defaults['GetAttributeViReal64']['return'] - - def niFgen_GetAttributeViString(self, vi, channel_name, attribute_id, array_size, attribute_value): # noqa: N802 - if self._defaults['GetAttributeViString']['return'] != 0: - return self._defaults['GetAttributeViString']['return'] - if self._defaults['GetAttributeViString']['attributeValue'] is None: - raise MockFunctionCallError("niFgen_GetAttributeViString", param='attributeValue') + attribute_value.contents.value = self._defaults["GetAttributeViReal64"][ + "attributeValue" + ] + return self._defaults["GetAttributeViReal64"]["return"] + + def niFgen_GetAttributeViString( + self, vi, channel_name, attribute_id, array_size, attribute_value + ): # noqa: N802 + if self._defaults["GetAttributeViString"]["return"] != 0: + return self._defaults["GetAttributeViString"]["return"] + if self._defaults["GetAttributeViString"]["attributeValue"] is None: + raise MockFunctionCallError( + "niFgen_GetAttributeViString", param="attributeValue" + ) if array_size.value == 0: - return len(self._defaults['GetAttributeViString']['attributeValue']) - attribute_value.value = self._defaults['GetAttributeViString']['attributeValue'].encode('ascii') - return self._defaults['GetAttributeViString']['return'] - - def niFgen_GetChannelName(self, vi, index, buffer_size, channel_string): # noqa: N802 - if self._defaults['GetChannelName']['return'] != 0: - return self._defaults['GetChannelName']['return'] - if self._defaults['GetChannelName']['channelString'] is None: - raise MockFunctionCallError("niFgen_GetChannelName", param='channelString') + return len(self._defaults["GetAttributeViString"]["attributeValue"]) + attribute_value.value = self._defaults["GetAttributeViString"][ + "attributeValue" + ].encode("ascii") + return self._defaults["GetAttributeViString"]["return"] + + def niFgen_GetChannelName( + self, vi, index, buffer_size, channel_string + ): # noqa: N802 + if self._defaults["GetChannelName"]["return"] != 0: + return self._defaults["GetChannelName"]["return"] + if self._defaults["GetChannelName"]["channelString"] is None: + raise MockFunctionCallError("niFgen_GetChannelName", param="channelString") if buffer_size.value == 0: - return len(self._defaults['GetChannelName']['channelString']) - channel_string.value = self._defaults['GetChannelName']['channelString'].encode('ascii') - return self._defaults['GetChannelName']['return'] - - def niFgen_GetError(self, vi, error_code, error_description_buffer_size, error_description): # noqa: N802 - if self._defaults['GetError']['return'] != 0: - return self._defaults['GetError']['return'] + return len(self._defaults["GetChannelName"]["channelString"]) + channel_string.value = self._defaults["GetChannelName"]["channelString"].encode( + "ascii" + ) + return self._defaults["GetChannelName"]["return"] + + def niFgen_GetError( + self, vi, error_code, error_description_buffer_size, error_description + ): # noqa: N802 + if self._defaults["GetError"]["return"] != 0: + return self._defaults["GetError"]["return"] # error_code - if self._defaults['GetError']['errorCode'] is None: - raise MockFunctionCallError("niFgen_GetError", param='errorCode') + if self._defaults["GetError"]["errorCode"] is None: + raise MockFunctionCallError("niFgen_GetError", param="errorCode") if error_code is not None: - error_code.contents.value = self._defaults['GetError']['errorCode'] - if self._defaults['GetError']['errorDescription'] is None: - raise MockFunctionCallError("niFgen_GetError", param='errorDescription') + error_code.contents.value = self._defaults["GetError"]["errorCode"] + if self._defaults["GetError"]["errorDescription"] is None: + raise MockFunctionCallError("niFgen_GetError", param="errorDescription") if error_description_buffer_size.value == 0: - return len(self._defaults['GetError']['errorDescription']) - error_description.value = self._defaults['GetError']['errorDescription'].encode('ascii') - return self._defaults['GetError']['return'] - - def niFgen_GetExtCalLastDateAndTime(self, vi, year, month, day, hour, minute): # noqa: N802 - if self._defaults['GetExtCalLastDateAndTime']['return'] != 0: - return self._defaults['GetExtCalLastDateAndTime']['return'] + return len(self._defaults["GetError"]["errorDescription"]) + error_description.value = self._defaults["GetError"]["errorDescription"].encode( + "ascii" + ) + return self._defaults["GetError"]["return"] + + def niFgen_GetExtCalLastDateAndTime( + self, vi, year, month, day, hour, minute + ): # noqa: N802 + if self._defaults["GetExtCalLastDateAndTime"]["return"] != 0: + return self._defaults["GetExtCalLastDateAndTime"]["return"] # year - if self._defaults['GetExtCalLastDateAndTime']['year'] is None: - raise MockFunctionCallError("niFgen_GetExtCalLastDateAndTime", param='year') + if self._defaults["GetExtCalLastDateAndTime"]["year"] is None: + raise MockFunctionCallError("niFgen_GetExtCalLastDateAndTime", param="year") if year is not None: - year.contents.value = self._defaults['GetExtCalLastDateAndTime']['year'] + year.contents.value = self._defaults["GetExtCalLastDateAndTime"]["year"] # month - if self._defaults['GetExtCalLastDateAndTime']['month'] is None: - raise MockFunctionCallError("niFgen_GetExtCalLastDateAndTime", param='month') + if self._defaults["GetExtCalLastDateAndTime"]["month"] is None: + raise MockFunctionCallError( + "niFgen_GetExtCalLastDateAndTime", param="month" + ) if month is not None: - month.contents.value = self._defaults['GetExtCalLastDateAndTime']['month'] + month.contents.value = self._defaults["GetExtCalLastDateAndTime"]["month"] # day - if self._defaults['GetExtCalLastDateAndTime']['day'] is None: - raise MockFunctionCallError("niFgen_GetExtCalLastDateAndTime", param='day') + if self._defaults["GetExtCalLastDateAndTime"]["day"] is None: + raise MockFunctionCallError("niFgen_GetExtCalLastDateAndTime", param="day") if day is not None: - day.contents.value = self._defaults['GetExtCalLastDateAndTime']['day'] + day.contents.value = self._defaults["GetExtCalLastDateAndTime"]["day"] # hour - if self._defaults['GetExtCalLastDateAndTime']['hour'] is None: - raise MockFunctionCallError("niFgen_GetExtCalLastDateAndTime", param='hour') + if self._defaults["GetExtCalLastDateAndTime"]["hour"] is None: + raise MockFunctionCallError("niFgen_GetExtCalLastDateAndTime", param="hour") if hour is not None: - hour.contents.value = self._defaults['GetExtCalLastDateAndTime']['hour'] + hour.contents.value = self._defaults["GetExtCalLastDateAndTime"]["hour"] # minute - if self._defaults['GetExtCalLastDateAndTime']['minute'] is None: - raise MockFunctionCallError("niFgen_GetExtCalLastDateAndTime", param='minute') + if self._defaults["GetExtCalLastDateAndTime"]["minute"] is None: + raise MockFunctionCallError( + "niFgen_GetExtCalLastDateAndTime", param="minute" + ) if minute is not None: - minute.contents.value = self._defaults['GetExtCalLastDateAndTime']['minute'] - return self._defaults['GetExtCalLastDateAndTime']['return'] + minute.contents.value = self._defaults["GetExtCalLastDateAndTime"]["minute"] + return self._defaults["GetExtCalLastDateAndTime"]["return"] def niFgen_GetExtCalLastTemp(self, vi, temperature): # noqa: N802 - if self._defaults['GetExtCalLastTemp']['return'] != 0: - return self._defaults['GetExtCalLastTemp']['return'] + if self._defaults["GetExtCalLastTemp"]["return"] != 0: + return self._defaults["GetExtCalLastTemp"]["return"] # temperature - if self._defaults['GetExtCalLastTemp']['temperature'] is None: - raise MockFunctionCallError("niFgen_GetExtCalLastTemp", param='temperature') + if self._defaults["GetExtCalLastTemp"]["temperature"] is None: + raise MockFunctionCallError("niFgen_GetExtCalLastTemp", param="temperature") if temperature is not None: - temperature.contents.value = self._defaults['GetExtCalLastTemp']['temperature'] - return self._defaults['GetExtCalLastTemp']['return'] + temperature.contents.value = self._defaults["GetExtCalLastTemp"][ + "temperature" + ] + return self._defaults["GetExtCalLastTemp"]["return"] def niFgen_GetExtCalRecommendedInterval(self, vi, months): # noqa: N802 - if self._defaults['GetExtCalRecommendedInterval']['return'] != 0: - return self._defaults['GetExtCalRecommendedInterval']['return'] + if self._defaults["GetExtCalRecommendedInterval"]["return"] != 0: + return self._defaults["GetExtCalRecommendedInterval"]["return"] # months - if self._defaults['GetExtCalRecommendedInterval']['months'] is None: - raise MockFunctionCallError("niFgen_GetExtCalRecommendedInterval", param='months') + if self._defaults["GetExtCalRecommendedInterval"]["months"] is None: + raise MockFunctionCallError( + "niFgen_GetExtCalRecommendedInterval", param="months" + ) if months is not None: - months.contents.value = self._defaults['GetExtCalRecommendedInterval']['months'] - return self._defaults['GetExtCalRecommendedInterval']['return'] + months.contents.value = self._defaults["GetExtCalRecommendedInterval"][ + "months" + ] + return self._defaults["GetExtCalRecommendedInterval"]["return"] def niFgen_GetHardwareState(self, vi, state): # noqa: N802 - if self._defaults['GetHardwareState']['return'] != 0: - return self._defaults['GetHardwareState']['return'] + if self._defaults["GetHardwareState"]["return"] != 0: + return self._defaults["GetHardwareState"]["return"] # state - if self._defaults['GetHardwareState']['state'] is None: - raise MockFunctionCallError("niFgen_GetHardwareState", param='state') + if self._defaults["GetHardwareState"]["state"] is None: + raise MockFunctionCallError("niFgen_GetHardwareState", param="state") if state is not None: - state.contents.value = self._defaults['GetHardwareState']['state'] - return self._defaults['GetHardwareState']['return'] + state.contents.value = self._defaults["GetHardwareState"]["state"] + return self._defaults["GetHardwareState"]["return"] def niFgen_GetLastExtCalLastDateAndTime(self, vi, month): # noqa: N802 - if self._defaults['GetLastExtCalLastDateAndTime']['return'] != 0: - return self._defaults['GetLastExtCalLastDateAndTime']['return'] + if self._defaults["GetLastExtCalLastDateAndTime"]["return"] != 0: + return self._defaults["GetLastExtCalLastDateAndTime"]["return"] # month - if self._defaults['GetLastExtCalLastDateAndTime']['month'] is None: - raise MockFunctionCallError("niFgen_GetLastExtCalLastDateAndTime", param='month') + if self._defaults["GetLastExtCalLastDateAndTime"]["month"] is None: + raise MockFunctionCallError( + "niFgen_GetLastExtCalLastDateAndTime", param="month" + ) if month is not None: - month.contents.value = self._defaults['GetLastExtCalLastDateAndTime']['month'] - return self._defaults['GetLastExtCalLastDateAndTime']['return'] + month.contents.value = self._defaults["GetLastExtCalLastDateAndTime"][ + "month" + ] + return self._defaults["GetLastExtCalLastDateAndTime"]["return"] def niFgen_GetLastSelfCalLastDateAndTime(self, vi, month): # noqa: N802 - if self._defaults['GetLastSelfCalLastDateAndTime']['return'] != 0: - return self._defaults['GetLastSelfCalLastDateAndTime']['return'] + if self._defaults["GetLastSelfCalLastDateAndTime"]["return"] != 0: + return self._defaults["GetLastSelfCalLastDateAndTime"]["return"] # month - if self._defaults['GetLastSelfCalLastDateAndTime']['month'] is None: - raise MockFunctionCallError("niFgen_GetLastSelfCalLastDateAndTime", param='month') + if self._defaults["GetLastSelfCalLastDateAndTime"]["month"] is None: + raise MockFunctionCallError( + "niFgen_GetLastSelfCalLastDateAndTime", param="month" + ) if month is not None: - month.contents.value = self._defaults['GetLastSelfCalLastDateAndTime']['month'] - return self._defaults['GetLastSelfCalLastDateAndTime']['return'] - - def niFgen_GetSelfCalLastDateAndTime(self, vi, year, month, day, hour, minute): # noqa: N802 - if self._defaults['GetSelfCalLastDateAndTime']['return'] != 0: - return self._defaults['GetSelfCalLastDateAndTime']['return'] + month.contents.value = self._defaults["GetLastSelfCalLastDateAndTime"][ + "month" + ] + return self._defaults["GetLastSelfCalLastDateAndTime"]["return"] + + def niFgen_GetSelfCalLastDateAndTime( + self, vi, year, month, day, hour, minute + ): # noqa: N802 + if self._defaults["GetSelfCalLastDateAndTime"]["return"] != 0: + return self._defaults["GetSelfCalLastDateAndTime"]["return"] # year - if self._defaults['GetSelfCalLastDateAndTime']['year'] is None: - raise MockFunctionCallError("niFgen_GetSelfCalLastDateAndTime", param='year') + if self._defaults["GetSelfCalLastDateAndTime"]["year"] is None: + raise MockFunctionCallError( + "niFgen_GetSelfCalLastDateAndTime", param="year" + ) if year is not None: - year.contents.value = self._defaults['GetSelfCalLastDateAndTime']['year'] + year.contents.value = self._defaults["GetSelfCalLastDateAndTime"]["year"] # month - if self._defaults['GetSelfCalLastDateAndTime']['month'] is None: - raise MockFunctionCallError("niFgen_GetSelfCalLastDateAndTime", param='month') + if self._defaults["GetSelfCalLastDateAndTime"]["month"] is None: + raise MockFunctionCallError( + "niFgen_GetSelfCalLastDateAndTime", param="month" + ) if month is not None: - month.contents.value = self._defaults['GetSelfCalLastDateAndTime']['month'] + month.contents.value = self._defaults["GetSelfCalLastDateAndTime"]["month"] # day - if self._defaults['GetSelfCalLastDateAndTime']['day'] is None: - raise MockFunctionCallError("niFgen_GetSelfCalLastDateAndTime", param='day') + if self._defaults["GetSelfCalLastDateAndTime"]["day"] is None: + raise MockFunctionCallError("niFgen_GetSelfCalLastDateAndTime", param="day") if day is not None: - day.contents.value = self._defaults['GetSelfCalLastDateAndTime']['day'] + day.contents.value = self._defaults["GetSelfCalLastDateAndTime"]["day"] # hour - if self._defaults['GetSelfCalLastDateAndTime']['hour'] is None: - raise MockFunctionCallError("niFgen_GetSelfCalLastDateAndTime", param='hour') + if self._defaults["GetSelfCalLastDateAndTime"]["hour"] is None: + raise MockFunctionCallError( + "niFgen_GetSelfCalLastDateAndTime", param="hour" + ) if hour is not None: - hour.contents.value = self._defaults['GetSelfCalLastDateAndTime']['hour'] + hour.contents.value = self._defaults["GetSelfCalLastDateAndTime"]["hour"] # minute - if self._defaults['GetSelfCalLastDateAndTime']['minute'] is None: - raise MockFunctionCallError("niFgen_GetSelfCalLastDateAndTime", param='minute') + if self._defaults["GetSelfCalLastDateAndTime"]["minute"] is None: + raise MockFunctionCallError( + "niFgen_GetSelfCalLastDateAndTime", param="minute" + ) if minute is not None: - minute.contents.value = self._defaults['GetSelfCalLastDateAndTime']['minute'] - return self._defaults['GetSelfCalLastDateAndTime']['return'] + minute.contents.value = self._defaults["GetSelfCalLastDateAndTime"][ + "minute" + ] + return self._defaults["GetSelfCalLastDateAndTime"]["return"] def niFgen_GetSelfCalLastTemp(self, vi, temperature): # noqa: N802 - if self._defaults['GetSelfCalLastTemp']['return'] != 0: - return self._defaults['GetSelfCalLastTemp']['return'] + if self._defaults["GetSelfCalLastTemp"]["return"] != 0: + return self._defaults["GetSelfCalLastTemp"]["return"] # temperature - if self._defaults['GetSelfCalLastTemp']['temperature'] is None: - raise MockFunctionCallError("niFgen_GetSelfCalLastTemp", param='temperature') + if self._defaults["GetSelfCalLastTemp"]["temperature"] is None: + raise MockFunctionCallError( + "niFgen_GetSelfCalLastTemp", param="temperature" + ) if temperature is not None: - temperature.contents.value = self._defaults['GetSelfCalLastTemp']['temperature'] - return self._defaults['GetSelfCalLastTemp']['return'] + temperature.contents.value = self._defaults["GetSelfCalLastTemp"][ + "temperature" + ] + return self._defaults["GetSelfCalLastTemp"]["return"] def niFgen_GetSelfCalSupported(self, vi, self_cal_supported): # noqa: N802 - if self._defaults['GetSelfCalSupported']['return'] != 0: - return self._defaults['GetSelfCalSupported']['return'] + if self._defaults["GetSelfCalSupported"]["return"] != 0: + return self._defaults["GetSelfCalSupported"]["return"] # self_cal_supported - if self._defaults['GetSelfCalSupported']['selfCalSupported'] is None: - raise MockFunctionCallError("niFgen_GetSelfCalSupported", param='selfCalSupported') + if self._defaults["GetSelfCalSupported"]["selfCalSupported"] is None: + raise MockFunctionCallError( + "niFgen_GetSelfCalSupported", param="selfCalSupported" + ) if self_cal_supported is not None: - self_cal_supported.contents.value = self._defaults['GetSelfCalSupported']['selfCalSupported'] - return self._defaults['GetSelfCalSupported']['return'] - - def niFgen_ImportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 - if self._defaults['ImportAttributeConfigurationBuffer']['return'] != 0: - return self._defaults['ImportAttributeConfigurationBuffer']['return'] - return self._defaults['ImportAttributeConfigurationBuffer']['return'] + self_cal_supported.contents.value = self._defaults["GetSelfCalSupported"][ + "selfCalSupported" + ] + return self._defaults["GetSelfCalSupported"]["return"] + + def niFgen_ImportAttributeConfigurationBuffer( + self, vi, size_in_bytes, configuration + ): # noqa: N802 + if self._defaults["ImportAttributeConfigurationBuffer"]["return"] != 0: + return self._defaults["ImportAttributeConfigurationBuffer"]["return"] + return self._defaults["ImportAttributeConfigurationBuffer"]["return"] def niFgen_ImportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 - if self._defaults['ImportAttributeConfigurationFile']['return'] != 0: - return self._defaults['ImportAttributeConfigurationFile']['return'] - return self._defaults['ImportAttributeConfigurationFile']['return'] - - def niFgen_InitializeWithChannels(self, resource_name, channel_name, reset_device, option_string, vi): # noqa: N802 - if self._defaults['InitializeWithChannels']['return'] != 0: - return self._defaults['InitializeWithChannels']['return'] + if self._defaults["ImportAttributeConfigurationFile"]["return"] != 0: + return self._defaults["ImportAttributeConfigurationFile"]["return"] + return self._defaults["ImportAttributeConfigurationFile"]["return"] + + def niFgen_InitializeWithChannels( + self, resource_name, channel_name, reset_device, option_string, vi + ): # noqa: N802 + if self._defaults["InitializeWithChannels"]["return"] != 0: + return self._defaults["InitializeWithChannels"]["return"] # vi - if self._defaults['InitializeWithChannels']['vi'] is None: - raise MockFunctionCallError("niFgen_InitializeWithChannels", param='vi') + if self._defaults["InitializeWithChannels"]["vi"] is None: + raise MockFunctionCallError("niFgen_InitializeWithChannels", param="vi") if vi is not None: - vi.contents.value = self._defaults['InitializeWithChannels']['vi'] - return self._defaults['InitializeWithChannels']['return'] + vi.contents.value = self._defaults["InitializeWithChannels"]["vi"] + return self._defaults["InitializeWithChannels"]["return"] def niFgen_InitiateGeneration(self, vi): # noqa: N802 - if self._defaults['InitiateGeneration']['return'] != 0: - return self._defaults['InitiateGeneration']['return'] - return self._defaults['InitiateGeneration']['return'] + if self._defaults["InitiateGeneration"]["return"] != 0: + return self._defaults["InitiateGeneration"]["return"] + return self._defaults["InitiateGeneration"]["return"] def niFgen_IsDone(self, vi, done): # noqa: N802 - if self._defaults['IsDone']['return'] != 0: - return self._defaults['IsDone']['return'] + if self._defaults["IsDone"]["return"] != 0: + return self._defaults["IsDone"]["return"] # done - if self._defaults['IsDone']['done'] is None: - raise MockFunctionCallError("niFgen_IsDone", param='done') + if self._defaults["IsDone"]["done"] is None: + raise MockFunctionCallError("niFgen_IsDone", param="done") if done is not None: - done.contents.value = self._defaults['IsDone']['done'] - return self._defaults['IsDone']['return'] + done.contents.value = self._defaults["IsDone"]["done"] + return self._defaults["IsDone"]["return"] def niFgen_LockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults['LockSession']['return'] != 0: - return self._defaults['LockSession']['return'] + if self._defaults["LockSession"]["return"] != 0: + return self._defaults["LockSession"]["return"] # caller_has_lock - if self._defaults['LockSession']['callerHasLock'] is None: - raise MockFunctionCallError("niFgen_LockSession", param='callerHasLock') + if self._defaults["LockSession"]["callerHasLock"] is None: + raise MockFunctionCallError("niFgen_LockSession", param="callerHasLock") if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults['LockSession']['callerHasLock'] - return self._defaults['LockSession']['return'] - - def niFgen_QueryArbSeqCapabilities(self, vi, maximum_number_of_sequences, minimum_sequence_length, maximum_sequence_length, maximum_loop_count): # noqa: N802 - if self._defaults['QueryArbSeqCapabilities']['return'] != 0: - return self._defaults['QueryArbSeqCapabilities']['return'] + caller_has_lock.contents.value = self._defaults["LockSession"][ + "callerHasLock" + ] + return self._defaults["LockSession"]["return"] + + def niFgen_QueryArbSeqCapabilities( + self, + vi, + maximum_number_of_sequences, + minimum_sequence_length, + maximum_sequence_length, + maximum_loop_count, + ): # noqa: N802 + if self._defaults["QueryArbSeqCapabilities"]["return"] != 0: + return self._defaults["QueryArbSeqCapabilities"]["return"] # maximum_number_of_sequences - if self._defaults['QueryArbSeqCapabilities']['maximumNumberOfSequences'] is None: - raise MockFunctionCallError("niFgen_QueryArbSeqCapabilities", param='maximumNumberOfSequences') + if ( + self._defaults["QueryArbSeqCapabilities"]["maximumNumberOfSequences"] + is None + ): + raise MockFunctionCallError( + "niFgen_QueryArbSeqCapabilities", param="maximumNumberOfSequences" + ) if maximum_number_of_sequences is not None: - maximum_number_of_sequences.contents.value = self._defaults['QueryArbSeqCapabilities']['maximumNumberOfSequences'] + maximum_number_of_sequences.contents.value = self._defaults[ + "QueryArbSeqCapabilities" + ]["maximumNumberOfSequences"] # minimum_sequence_length - if self._defaults['QueryArbSeqCapabilities']['minimumSequenceLength'] is None: - raise MockFunctionCallError("niFgen_QueryArbSeqCapabilities", param='minimumSequenceLength') + if self._defaults["QueryArbSeqCapabilities"]["minimumSequenceLength"] is None: + raise MockFunctionCallError( + "niFgen_QueryArbSeqCapabilities", param="minimumSequenceLength" + ) if minimum_sequence_length is not None: - minimum_sequence_length.contents.value = self._defaults['QueryArbSeqCapabilities']['minimumSequenceLength'] + minimum_sequence_length.contents.value = self._defaults[ + "QueryArbSeqCapabilities" + ]["minimumSequenceLength"] # maximum_sequence_length - if self._defaults['QueryArbSeqCapabilities']['maximumSequenceLength'] is None: - raise MockFunctionCallError("niFgen_QueryArbSeqCapabilities", param='maximumSequenceLength') + if self._defaults["QueryArbSeqCapabilities"]["maximumSequenceLength"] is None: + raise MockFunctionCallError( + "niFgen_QueryArbSeqCapabilities", param="maximumSequenceLength" + ) if maximum_sequence_length is not None: - maximum_sequence_length.contents.value = self._defaults['QueryArbSeqCapabilities']['maximumSequenceLength'] + maximum_sequence_length.contents.value = self._defaults[ + "QueryArbSeqCapabilities" + ]["maximumSequenceLength"] # maximum_loop_count - if self._defaults['QueryArbSeqCapabilities']['maximumLoopCount'] is None: - raise MockFunctionCallError("niFgen_QueryArbSeqCapabilities", param='maximumLoopCount') + if self._defaults["QueryArbSeqCapabilities"]["maximumLoopCount"] is None: + raise MockFunctionCallError( + "niFgen_QueryArbSeqCapabilities", param="maximumLoopCount" + ) if maximum_loop_count is not None: - maximum_loop_count.contents.value = self._defaults['QueryArbSeqCapabilities']['maximumLoopCount'] - return self._defaults['QueryArbSeqCapabilities']['return'] - - def niFgen_QueryArbWfmCapabilities(self, vi, maximum_number_of_waveforms, waveform_quantum, minimum_waveform_size, maximum_waveform_size): # noqa: N802 - if self._defaults['QueryArbWfmCapabilities']['return'] != 0: - return self._defaults['QueryArbWfmCapabilities']['return'] + maximum_loop_count.contents.value = self._defaults[ + "QueryArbSeqCapabilities" + ]["maximumLoopCount"] + return self._defaults["QueryArbSeqCapabilities"]["return"] + + def niFgen_QueryArbWfmCapabilities( + self, + vi, + maximum_number_of_waveforms, + waveform_quantum, + minimum_waveform_size, + maximum_waveform_size, + ): # noqa: N802 + if self._defaults["QueryArbWfmCapabilities"]["return"] != 0: + return self._defaults["QueryArbWfmCapabilities"]["return"] # maximum_number_of_waveforms - if self._defaults['QueryArbWfmCapabilities']['maximumNumberOfWaveforms'] is None: - raise MockFunctionCallError("niFgen_QueryArbWfmCapabilities", param='maximumNumberOfWaveforms') + if ( + self._defaults["QueryArbWfmCapabilities"]["maximumNumberOfWaveforms"] + is None + ): + raise MockFunctionCallError( + "niFgen_QueryArbWfmCapabilities", param="maximumNumberOfWaveforms" + ) if maximum_number_of_waveforms is not None: - maximum_number_of_waveforms.contents.value = self._defaults['QueryArbWfmCapabilities']['maximumNumberOfWaveforms'] + maximum_number_of_waveforms.contents.value = self._defaults[ + "QueryArbWfmCapabilities" + ]["maximumNumberOfWaveforms"] # waveform_quantum - if self._defaults['QueryArbWfmCapabilities']['waveformQuantum'] is None: - raise MockFunctionCallError("niFgen_QueryArbWfmCapabilities", param='waveformQuantum') + if self._defaults["QueryArbWfmCapabilities"]["waveformQuantum"] is None: + raise MockFunctionCallError( + "niFgen_QueryArbWfmCapabilities", param="waveformQuantum" + ) if waveform_quantum is not None: - waveform_quantum.contents.value = self._defaults['QueryArbWfmCapabilities']['waveformQuantum'] + waveform_quantum.contents.value = self._defaults["QueryArbWfmCapabilities"][ + "waveformQuantum" + ] # minimum_waveform_size - if self._defaults['QueryArbWfmCapabilities']['minimumWaveformSize'] is None: - raise MockFunctionCallError("niFgen_QueryArbWfmCapabilities", param='minimumWaveformSize') + if self._defaults["QueryArbWfmCapabilities"]["minimumWaveformSize"] is None: + raise MockFunctionCallError( + "niFgen_QueryArbWfmCapabilities", param="minimumWaveformSize" + ) if minimum_waveform_size is not None: - minimum_waveform_size.contents.value = self._defaults['QueryArbWfmCapabilities']['minimumWaveformSize'] + minimum_waveform_size.contents.value = self._defaults[ + "QueryArbWfmCapabilities" + ]["minimumWaveformSize"] # maximum_waveform_size - if self._defaults['QueryArbWfmCapabilities']['maximumWaveformSize'] is None: - raise MockFunctionCallError("niFgen_QueryArbWfmCapabilities", param='maximumWaveformSize') + if self._defaults["QueryArbWfmCapabilities"]["maximumWaveformSize"] is None: + raise MockFunctionCallError( + "niFgen_QueryArbWfmCapabilities", param="maximumWaveformSize" + ) if maximum_waveform_size is not None: - maximum_waveform_size.contents.value = self._defaults['QueryArbWfmCapabilities']['maximumWaveformSize'] - return self._defaults['QueryArbWfmCapabilities']['return'] - - def niFgen_QueryFreqListCapabilities(self, vi, maximum_number_of_freq_lists, minimum_frequency_list_length, maximum_frequency_list_length, minimum_frequency_list_duration, maximum_frequency_list_duration, frequency_list_duration_quantum): # noqa: N802 - if self._defaults['QueryFreqListCapabilities']['return'] != 0: - return self._defaults['QueryFreqListCapabilities']['return'] + maximum_waveform_size.contents.value = self._defaults[ + "QueryArbWfmCapabilities" + ]["maximumWaveformSize"] + return self._defaults["QueryArbWfmCapabilities"]["return"] + + def niFgen_QueryFreqListCapabilities( + self, + vi, + maximum_number_of_freq_lists, + minimum_frequency_list_length, + maximum_frequency_list_length, + minimum_frequency_list_duration, + maximum_frequency_list_duration, + frequency_list_duration_quantum, + ): # noqa: N802 + if self._defaults["QueryFreqListCapabilities"]["return"] != 0: + return self._defaults["QueryFreqListCapabilities"]["return"] # maximum_number_of_freq_lists - if self._defaults['QueryFreqListCapabilities']['maximumNumberOfFreqLists'] is None: - raise MockFunctionCallError("niFgen_QueryFreqListCapabilities", param='maximumNumberOfFreqLists') + if ( + self._defaults["QueryFreqListCapabilities"]["maximumNumberOfFreqLists"] + is None + ): + raise MockFunctionCallError( + "niFgen_QueryFreqListCapabilities", param="maximumNumberOfFreqLists" + ) if maximum_number_of_freq_lists is not None: - maximum_number_of_freq_lists.contents.value = self._defaults['QueryFreqListCapabilities']['maximumNumberOfFreqLists'] + maximum_number_of_freq_lists.contents.value = self._defaults[ + "QueryFreqListCapabilities" + ]["maximumNumberOfFreqLists"] # minimum_frequency_list_length - if self._defaults['QueryFreqListCapabilities']['minimumFrequencyListLength'] is None: - raise MockFunctionCallError("niFgen_QueryFreqListCapabilities", param='minimumFrequencyListLength') + if ( + self._defaults["QueryFreqListCapabilities"]["minimumFrequencyListLength"] + is None + ): + raise MockFunctionCallError( + "niFgen_QueryFreqListCapabilities", param="minimumFrequencyListLength" + ) if minimum_frequency_list_length is not None: - minimum_frequency_list_length.contents.value = self._defaults['QueryFreqListCapabilities']['minimumFrequencyListLength'] + minimum_frequency_list_length.contents.value = self._defaults[ + "QueryFreqListCapabilities" + ]["minimumFrequencyListLength"] # maximum_frequency_list_length - if self._defaults['QueryFreqListCapabilities']['maximumFrequencyListLength'] is None: - raise MockFunctionCallError("niFgen_QueryFreqListCapabilities", param='maximumFrequencyListLength') + if ( + self._defaults["QueryFreqListCapabilities"]["maximumFrequencyListLength"] + is None + ): + raise MockFunctionCallError( + "niFgen_QueryFreqListCapabilities", param="maximumFrequencyListLength" + ) if maximum_frequency_list_length is not None: - maximum_frequency_list_length.contents.value = self._defaults['QueryFreqListCapabilities']['maximumFrequencyListLength'] + maximum_frequency_list_length.contents.value = self._defaults[ + "QueryFreqListCapabilities" + ]["maximumFrequencyListLength"] # minimum_frequency_list_duration - if self._defaults['QueryFreqListCapabilities']['minimumFrequencyListDuration'] is None: - raise MockFunctionCallError("niFgen_QueryFreqListCapabilities", param='minimumFrequencyListDuration') + if ( + self._defaults["QueryFreqListCapabilities"]["minimumFrequencyListDuration"] + is None + ): + raise MockFunctionCallError( + "niFgen_QueryFreqListCapabilities", param="minimumFrequencyListDuration" + ) if minimum_frequency_list_duration is not None: - minimum_frequency_list_duration.contents.value = self._defaults['QueryFreqListCapabilities']['minimumFrequencyListDuration'] + minimum_frequency_list_duration.contents.value = self._defaults[ + "QueryFreqListCapabilities" + ]["minimumFrequencyListDuration"] # maximum_frequency_list_duration - if self._defaults['QueryFreqListCapabilities']['maximumFrequencyListDuration'] is None: - raise MockFunctionCallError("niFgen_QueryFreqListCapabilities", param='maximumFrequencyListDuration') + if ( + self._defaults["QueryFreqListCapabilities"]["maximumFrequencyListDuration"] + is None + ): + raise MockFunctionCallError( + "niFgen_QueryFreqListCapabilities", param="maximumFrequencyListDuration" + ) if maximum_frequency_list_duration is not None: - maximum_frequency_list_duration.contents.value = self._defaults['QueryFreqListCapabilities']['maximumFrequencyListDuration'] + maximum_frequency_list_duration.contents.value = self._defaults[ + "QueryFreqListCapabilities" + ]["maximumFrequencyListDuration"] # frequency_list_duration_quantum - if self._defaults['QueryFreqListCapabilities']['frequencyListDurationQuantum'] is None: - raise MockFunctionCallError("niFgen_QueryFreqListCapabilities", param='frequencyListDurationQuantum') + if ( + self._defaults["QueryFreqListCapabilities"]["frequencyListDurationQuantum"] + is None + ): + raise MockFunctionCallError( + "niFgen_QueryFreqListCapabilities", param="frequencyListDurationQuantum" + ) if frequency_list_duration_quantum is not None: - frequency_list_duration_quantum.contents.value = self._defaults['QueryFreqListCapabilities']['frequencyListDurationQuantum'] - return self._defaults['QueryFreqListCapabilities']['return'] + frequency_list_duration_quantum.contents.value = self._defaults[ + "QueryFreqListCapabilities" + ]["frequencyListDurationQuantum"] + return self._defaults["QueryFreqListCapabilities"]["return"] def niFgen_ReadCurrentTemperature(self, vi, temperature): # noqa: N802 - if self._defaults['ReadCurrentTemperature']['return'] != 0: - return self._defaults['ReadCurrentTemperature']['return'] + if self._defaults["ReadCurrentTemperature"]["return"] != 0: + return self._defaults["ReadCurrentTemperature"]["return"] # temperature - if self._defaults['ReadCurrentTemperature']['temperature'] is None: - raise MockFunctionCallError("niFgen_ReadCurrentTemperature", param='temperature') + if self._defaults["ReadCurrentTemperature"]["temperature"] is None: + raise MockFunctionCallError( + "niFgen_ReadCurrentTemperature", param="temperature" + ) if temperature is not None: - temperature.contents.value = self._defaults['ReadCurrentTemperature']['temperature'] - return self._defaults['ReadCurrentTemperature']['return'] + temperature.contents.value = self._defaults["ReadCurrentTemperature"][ + "temperature" + ] + return self._defaults["ReadCurrentTemperature"]["return"] def niFgen_ResetDevice(self, vi): # noqa: N802 - if self._defaults['ResetDevice']['return'] != 0: - return self._defaults['ResetDevice']['return'] - return self._defaults['ResetDevice']['return'] + if self._defaults["ResetDevice"]["return"] != 0: + return self._defaults["ResetDevice"]["return"] + return self._defaults["ResetDevice"]["return"] def niFgen_ResetWithDefaults(self, vi): # noqa: N802 - if self._defaults['ResetWithDefaults']['return'] != 0: - return self._defaults['ResetWithDefaults']['return'] - return self._defaults['ResetWithDefaults']['return'] + if self._defaults["ResetWithDefaults"]["return"] != 0: + return self._defaults["ResetWithDefaults"]["return"] + return self._defaults["ResetWithDefaults"]["return"] def niFgen_SelfCal(self, vi): # noqa: N802 - if self._defaults['SelfCal']['return'] != 0: - return self._defaults['SelfCal']['return'] - return self._defaults['SelfCal']['return'] + if self._defaults["SelfCal"]["return"] != 0: + return self._defaults["SelfCal"]["return"] + return self._defaults["SelfCal"]["return"] def niFgen_SendSoftwareEdgeTrigger(self, vi, trigger, trigger_id): # noqa: N802 - if self._defaults['SendSoftwareEdgeTrigger']['return'] != 0: - return self._defaults['SendSoftwareEdgeTrigger']['return'] - return self._defaults['SendSoftwareEdgeTrigger']['return'] - - def niFgen_SetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['SetAttributeViBoolean']['return'] != 0: - return self._defaults['SetAttributeViBoolean']['return'] - return self._defaults['SetAttributeViBoolean']['return'] - - def niFgen_SetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['SetAttributeViInt32']['return'] != 0: - return self._defaults['SetAttributeViInt32']['return'] - return self._defaults['SetAttributeViInt32']['return'] - - def niFgen_SetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['SetAttributeViReal64']['return'] != 0: - return self._defaults['SetAttributeViReal64']['return'] - return self._defaults['SetAttributeViReal64']['return'] - - def niFgen_SetAttributeViString(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['SetAttributeViString']['return'] != 0: - return self._defaults['SetAttributeViString']['return'] - return self._defaults['SetAttributeViString']['return'] - - def niFgen_SetNamedWaveformNextWritePosition(self, vi, channel_name, waveform_name, relative_to, offset): # noqa: N802 - if self._defaults['SetNamedWaveformNextWritePosition']['return'] != 0: - return self._defaults['SetNamedWaveformNextWritePosition']['return'] - return self._defaults['SetNamedWaveformNextWritePosition']['return'] - - def niFgen_SetWaveformNextWritePosition(self, vi, channel_name, waveform_handle, relative_to, offset): # noqa: N802 - if self._defaults['SetWaveformNextWritePosition']['return'] != 0: - return self._defaults['SetWaveformNextWritePosition']['return'] - return self._defaults['SetWaveformNextWritePosition']['return'] + if self._defaults["SendSoftwareEdgeTrigger"]["return"] != 0: + return self._defaults["SendSoftwareEdgeTrigger"]["return"] + return self._defaults["SendSoftwareEdgeTrigger"]["return"] + + def niFgen_SetAttributeViBoolean( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["SetAttributeViBoolean"]["return"] != 0: + return self._defaults["SetAttributeViBoolean"]["return"] + return self._defaults["SetAttributeViBoolean"]["return"] + + def niFgen_SetAttributeViInt32( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["SetAttributeViInt32"]["return"] != 0: + return self._defaults["SetAttributeViInt32"]["return"] + return self._defaults["SetAttributeViInt32"]["return"] + + def niFgen_SetAttributeViReal64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["SetAttributeViReal64"]["return"] != 0: + return self._defaults["SetAttributeViReal64"]["return"] + return self._defaults["SetAttributeViReal64"]["return"] + + def niFgen_SetAttributeViString( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["SetAttributeViString"]["return"] != 0: + return self._defaults["SetAttributeViString"]["return"] + return self._defaults["SetAttributeViString"]["return"] + + def niFgen_SetNamedWaveformNextWritePosition( + self, vi, channel_name, waveform_name, relative_to, offset + ): # noqa: N802 + if self._defaults["SetNamedWaveformNextWritePosition"]["return"] != 0: + return self._defaults["SetNamedWaveformNextWritePosition"]["return"] + return self._defaults["SetNamedWaveformNextWritePosition"]["return"] + + def niFgen_SetWaveformNextWritePosition( + self, vi, channel_name, waveform_handle, relative_to, offset + ): # noqa: N802 + if self._defaults["SetWaveformNextWritePosition"]["return"] != 0: + return self._defaults["SetWaveformNextWritePosition"]["return"] + return self._defaults["SetWaveformNextWritePosition"]["return"] def niFgen_UnlockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults['UnlockSession']['return'] != 0: - return self._defaults['UnlockSession']['return'] + if self._defaults["UnlockSession"]["return"] != 0: + return self._defaults["UnlockSession"]["return"] # caller_has_lock - if self._defaults['UnlockSession']['callerHasLock'] is None: - raise MockFunctionCallError("niFgen_UnlockSession", param='callerHasLock') + if self._defaults["UnlockSession"]["callerHasLock"] is None: + raise MockFunctionCallError("niFgen_UnlockSession", param="callerHasLock") if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults['UnlockSession']['callerHasLock'] - return self._defaults['UnlockSession']['return'] + caller_has_lock.contents.value = self._defaults["UnlockSession"][ + "callerHasLock" + ] + return self._defaults["UnlockSession"]["return"] def niFgen_WaitUntilDone(self, vi, max_time): # noqa: N802 - if self._defaults['WaitUntilDone']['return'] != 0: - return self._defaults['WaitUntilDone']['return'] - return self._defaults['WaitUntilDone']['return'] - - def niFgen_WriteBinary16Waveform(self, vi, channel_name, waveform_handle, size, data): # noqa: N802 - if self._defaults['WriteBinary16Waveform']['return'] != 0: - return self._defaults['WriteBinary16Waveform']['return'] - return self._defaults['WriteBinary16Waveform']['return'] - - def niFgen_WriteNamedWaveformF64(self, vi, channel_name, waveform_name, size, data): # noqa: N802 - if self._defaults['WriteNamedWaveformF64']['return'] != 0: - return self._defaults['WriteNamedWaveformF64']['return'] - return self._defaults['WriteNamedWaveformF64']['return'] - - def niFgen_WriteNamedWaveformI16(self, vi, channel_name, waveform_name, size, data): # noqa: N802 - if self._defaults['WriteNamedWaveformI16']['return'] != 0: - return self._defaults['WriteNamedWaveformI16']['return'] - return self._defaults['WriteNamedWaveformI16']['return'] + if self._defaults["WaitUntilDone"]["return"] != 0: + return self._defaults["WaitUntilDone"]["return"] + return self._defaults["WaitUntilDone"]["return"] + + def niFgen_WriteBinary16Waveform( + self, vi, channel_name, waveform_handle, size, data + ): # noqa: N802 + if self._defaults["WriteBinary16Waveform"]["return"] != 0: + return self._defaults["WriteBinary16Waveform"]["return"] + return self._defaults["WriteBinary16Waveform"]["return"] + + def niFgen_WriteNamedWaveformF64( + self, vi, channel_name, waveform_name, size, data + ): # noqa: N802 + if self._defaults["WriteNamedWaveformF64"]["return"] != 0: + return self._defaults["WriteNamedWaveformF64"]["return"] + return self._defaults["WriteNamedWaveformF64"]["return"] + + def niFgen_WriteNamedWaveformI16( + self, vi, channel_name, waveform_name, size, data + ): # noqa: N802 + if self._defaults["WriteNamedWaveformI16"]["return"] != 0: + return self._defaults["WriteNamedWaveformI16"]["return"] + return self._defaults["WriteNamedWaveformI16"]["return"] def niFgen_WriteScript(self, vi, channel_name, script): # noqa: N802 - if self._defaults['WriteScript']['return'] != 0: - return self._defaults['WriteScript']['return'] - return self._defaults['WriteScript']['return'] + if self._defaults["WriteScript"]["return"] != 0: + return self._defaults["WriteScript"]["return"] + return self._defaults["WriteScript"]["return"] - def niFgen_WriteWaveform(self, vi, channel_name, waveform_handle, size, data): # noqa: N802 - if self._defaults['WriteWaveform']['return'] != 0: - return self._defaults['WriteWaveform']['return'] - return self._defaults['WriteWaveform']['return'] + def niFgen_WriteWaveform( + self, vi, channel_name, waveform_handle, size, data + ): # noqa: N802 + if self._defaults["WriteWaveform"]["return"] != 0: + return self._defaults["WriteWaveform"]["return"] + return self._defaults["WriteWaveform"]["return"] def niFgen_close(self, vi): # noqa: N802 - if self._defaults['close']['return'] != 0: - return self._defaults['close']['return'] - return self._defaults['close']['return'] + if self._defaults["close"]["return"] != 0: + return self._defaults["close"]["return"] + return self._defaults["close"]["return"] def niFgen_error_message(self, vi, error_code, error_message): # noqa: N802 - if self._defaults['error_message']['return'] != 0: - return self._defaults['error_message']['return'] + if self._defaults["error_message"]["return"] != 0: + return self._defaults["error_message"]["return"] # error_message - if self._defaults['error_message']['errorMessage'] is None: - raise MockFunctionCallError("niFgen_error_message", param='errorMessage') - test_value = self._defaults['error_message']['errorMessage'] + if self._defaults["error_message"]["errorMessage"] is None: + raise MockFunctionCallError("niFgen_error_message", param="errorMessage") + test_value = self._defaults["error_message"]["errorMessage"] if type(test_value) is str: - test_value = test_value.encode('ascii') + test_value = test_value.encode("ascii") assert len(error_message) >= len(test_value) for i in range(len(test_value)): error_message[i] = test_value[i] - return self._defaults['error_message']['return'] + return self._defaults["error_message"]["return"] def niFgen_reset(self, vi): # noqa: N802 - if self._defaults['reset']['return'] != 0: - return self._defaults['reset']['return'] - return self._defaults['reset']['return'] + if self._defaults["reset"]["return"] != 0: + return self._defaults["reset"]["return"] + return self._defaults["reset"]["return"] def niFgen_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 - if self._defaults['self_test']['return'] != 0: - return self._defaults['self_test']['return'] + if self._defaults["self_test"]["return"] != 0: + return self._defaults["self_test"]["return"] # self_test_result - if self._defaults['self_test']['selfTestResult'] is None: - raise MockFunctionCallError("niFgen_self_test", param='selfTestResult') + if self._defaults["self_test"]["selfTestResult"] is None: + raise MockFunctionCallError("niFgen_self_test", param="selfTestResult") if self_test_result is not None: - self_test_result.contents.value = self._defaults['self_test']['selfTestResult'] + self_test_result.contents.value = self._defaults["self_test"][ + "selfTestResult" + ] # self_test_message - if self._defaults['self_test']['selfTestMessage'] is None: - raise MockFunctionCallError("niFgen_self_test", param='selfTestMessage') - test_value = self._defaults['self_test']['selfTestMessage'] + if self._defaults["self_test"]["selfTestMessage"] is None: + raise MockFunctionCallError("niFgen_self_test", param="selfTestMessage") + test_value = self._defaults["self_test"]["selfTestMessage"] if type(test_value) is str: - test_value = test_value.encode('ascii') + test_value = test_value.encode("ascii") assert len(self_test_message) >= len(test_value) for i in range(len(test_value)): self_test_message[i] = test_value[i] - return self._defaults['self_test']['return'] + return self._defaults["self_test"]["return"] # Helper function to setup Mock object with default side effects and return values def set_side_effects_and_return_values(self, mock_library): - mock_library.niFgen_AbortGeneration.side_effect = MockFunctionCallError("niFgen_AbortGeneration") + mock_library.niFgen_AbortGeneration.side_effect = MockFunctionCallError( + "niFgen_AbortGeneration" + ) mock_library.niFgen_AbortGeneration.return_value = 0 - mock_library.niFgen_AllocateNamedWaveform.side_effect = MockFunctionCallError("niFgen_AllocateNamedWaveform") + mock_library.niFgen_AllocateNamedWaveform.side_effect = MockFunctionCallError( + "niFgen_AllocateNamedWaveform" + ) mock_library.niFgen_AllocateNamedWaveform.return_value = 0 - mock_library.niFgen_AllocateWaveform.side_effect = MockFunctionCallError("niFgen_AllocateWaveform") + mock_library.niFgen_AllocateWaveform.side_effect = MockFunctionCallError( + "niFgen_AllocateWaveform" + ) mock_library.niFgen_AllocateWaveform.return_value = 0 - mock_library.niFgen_ClearArbMemory.side_effect = MockFunctionCallError("niFgen_ClearArbMemory") + mock_library.niFgen_ClearArbMemory.side_effect = MockFunctionCallError( + "niFgen_ClearArbMemory" + ) mock_library.niFgen_ClearArbMemory.return_value = 0 - mock_library.niFgen_ClearArbSequence.side_effect = MockFunctionCallError("niFgen_ClearArbSequence") + mock_library.niFgen_ClearArbSequence.side_effect = MockFunctionCallError( + "niFgen_ClearArbSequence" + ) mock_library.niFgen_ClearArbSequence.return_value = 0 - mock_library.niFgen_ClearArbWaveform.side_effect = MockFunctionCallError("niFgen_ClearArbWaveform") + mock_library.niFgen_ClearArbWaveform.side_effect = MockFunctionCallError( + "niFgen_ClearArbWaveform" + ) mock_library.niFgen_ClearArbWaveform.return_value = 0 - mock_library.niFgen_ClearFreqList.side_effect = MockFunctionCallError("niFgen_ClearFreqList") + mock_library.niFgen_ClearFreqList.side_effect = MockFunctionCallError( + "niFgen_ClearFreqList" + ) mock_library.niFgen_ClearFreqList.return_value = 0 - mock_library.niFgen_ClearUserStandardWaveform.side_effect = MockFunctionCallError("niFgen_ClearUserStandardWaveform") + mock_library.niFgen_ClearUserStandardWaveform.side_effect = ( + MockFunctionCallError("niFgen_ClearUserStandardWaveform") + ) mock_library.niFgen_ClearUserStandardWaveform.return_value = 0 mock_library.niFgen_Commit.side_effect = MockFunctionCallError("niFgen_Commit") mock_library.niFgen_Commit.return_value = 0 - mock_library.niFgen_ConfigureArbSequence.side_effect = MockFunctionCallError("niFgen_ConfigureArbSequence") + mock_library.niFgen_ConfigureArbSequence.side_effect = MockFunctionCallError( + "niFgen_ConfigureArbSequence" + ) mock_library.niFgen_ConfigureArbSequence.return_value = 0 - mock_library.niFgen_ConfigureArbWaveform.side_effect = MockFunctionCallError("niFgen_ConfigureArbWaveform") + mock_library.niFgen_ConfigureArbWaveform.side_effect = MockFunctionCallError( + "niFgen_ConfigureArbWaveform" + ) mock_library.niFgen_ConfigureArbWaveform.return_value = 0 - mock_library.niFgen_ConfigureFreqList.side_effect = MockFunctionCallError("niFgen_ConfigureFreqList") + mock_library.niFgen_ConfigureFreqList.side_effect = MockFunctionCallError( + "niFgen_ConfigureFreqList" + ) mock_library.niFgen_ConfigureFreqList.return_value = 0 - mock_library.niFgen_ConfigureStandardWaveform.side_effect = MockFunctionCallError("niFgen_ConfigureStandardWaveform") + mock_library.niFgen_ConfigureStandardWaveform.side_effect = ( + MockFunctionCallError("niFgen_ConfigureStandardWaveform") + ) mock_library.niFgen_ConfigureStandardWaveform.return_value = 0 - mock_library.niFgen_CreateAdvancedArbSequence.side_effect = MockFunctionCallError("niFgen_CreateAdvancedArbSequence") + mock_library.niFgen_CreateAdvancedArbSequence.side_effect = ( + MockFunctionCallError("niFgen_CreateAdvancedArbSequence") + ) mock_library.niFgen_CreateAdvancedArbSequence.return_value = 0 - mock_library.niFgen_CreateArbSequence.side_effect = MockFunctionCallError("niFgen_CreateArbSequence") + mock_library.niFgen_CreateArbSequence.side_effect = MockFunctionCallError( + "niFgen_CreateArbSequence" + ) mock_library.niFgen_CreateArbSequence.return_value = 0 - mock_library.niFgen_CreateFreqList.side_effect = MockFunctionCallError("niFgen_CreateFreqList") + mock_library.niFgen_CreateFreqList.side_effect = MockFunctionCallError( + "niFgen_CreateFreqList" + ) mock_library.niFgen_CreateFreqList.return_value = 0 - mock_library.niFgen_CreateWaveformF64.side_effect = MockFunctionCallError("niFgen_CreateWaveformF64") + mock_library.niFgen_CreateWaveformF64.side_effect = MockFunctionCallError( + "niFgen_CreateWaveformF64" + ) mock_library.niFgen_CreateWaveformF64.return_value = 0 - mock_library.niFgen_CreateWaveformFromFileF64.side_effect = MockFunctionCallError("niFgen_CreateWaveformFromFileF64") + mock_library.niFgen_CreateWaveformFromFileF64.side_effect = ( + MockFunctionCallError("niFgen_CreateWaveformFromFileF64") + ) mock_library.niFgen_CreateWaveformFromFileF64.return_value = 0 - mock_library.niFgen_CreateWaveformFromFileI16.side_effect = MockFunctionCallError("niFgen_CreateWaveformFromFileI16") + mock_library.niFgen_CreateWaveformFromFileI16.side_effect = ( + MockFunctionCallError("niFgen_CreateWaveformFromFileI16") + ) mock_library.niFgen_CreateWaveformFromFileI16.return_value = 0 - mock_library.niFgen_CreateWaveformI16.side_effect = MockFunctionCallError("niFgen_CreateWaveformI16") + mock_library.niFgen_CreateWaveformI16.side_effect = MockFunctionCallError( + "niFgen_CreateWaveformI16" + ) mock_library.niFgen_CreateWaveformI16.return_value = 0 - mock_library.niFgen_DefineUserStandardWaveform.side_effect = MockFunctionCallError("niFgen_DefineUserStandardWaveform") + mock_library.niFgen_DefineUserStandardWaveform.side_effect = ( + MockFunctionCallError("niFgen_DefineUserStandardWaveform") + ) mock_library.niFgen_DefineUserStandardWaveform.return_value = 0 - mock_library.niFgen_DeleteNamedWaveform.side_effect = MockFunctionCallError("niFgen_DeleteNamedWaveform") + mock_library.niFgen_DeleteNamedWaveform.side_effect = MockFunctionCallError( + "niFgen_DeleteNamedWaveform" + ) mock_library.niFgen_DeleteNamedWaveform.return_value = 0 - mock_library.niFgen_DeleteScript.side_effect = MockFunctionCallError("niFgen_DeleteScript") + mock_library.niFgen_DeleteScript.side_effect = MockFunctionCallError( + "niFgen_DeleteScript" + ) mock_library.niFgen_DeleteScript.return_value = 0 - mock_library.niFgen_Disable.side_effect = MockFunctionCallError("niFgen_Disable") + mock_library.niFgen_Disable.side_effect = MockFunctionCallError( + "niFgen_Disable" + ) mock_library.niFgen_Disable.return_value = 0 - mock_library.niFgen_ExportAttributeConfigurationBuffer.side_effect = MockFunctionCallError("niFgen_ExportAttributeConfigurationBuffer") + mock_library.niFgen_ExportAttributeConfigurationBuffer.side_effect = ( + MockFunctionCallError("niFgen_ExportAttributeConfigurationBuffer") + ) mock_library.niFgen_ExportAttributeConfigurationBuffer.return_value = 0 - mock_library.niFgen_ExportAttributeConfigurationFile.side_effect = MockFunctionCallError("niFgen_ExportAttributeConfigurationFile") + mock_library.niFgen_ExportAttributeConfigurationFile.side_effect = ( + MockFunctionCallError("niFgen_ExportAttributeConfigurationFile") + ) mock_library.niFgen_ExportAttributeConfigurationFile.return_value = 0 - mock_library.niFgen_GetAttributeViBoolean.side_effect = MockFunctionCallError("niFgen_GetAttributeViBoolean") + mock_library.niFgen_GetAttributeViBoolean.side_effect = MockFunctionCallError( + "niFgen_GetAttributeViBoolean" + ) mock_library.niFgen_GetAttributeViBoolean.return_value = 0 - mock_library.niFgen_GetAttributeViInt32.side_effect = MockFunctionCallError("niFgen_GetAttributeViInt32") + mock_library.niFgen_GetAttributeViInt32.side_effect = MockFunctionCallError( + "niFgen_GetAttributeViInt32" + ) mock_library.niFgen_GetAttributeViInt32.return_value = 0 - mock_library.niFgen_GetAttributeViReal64.side_effect = MockFunctionCallError("niFgen_GetAttributeViReal64") + mock_library.niFgen_GetAttributeViReal64.side_effect = MockFunctionCallError( + "niFgen_GetAttributeViReal64" + ) mock_library.niFgen_GetAttributeViReal64.return_value = 0 - mock_library.niFgen_GetAttributeViString.side_effect = MockFunctionCallError("niFgen_GetAttributeViString") + mock_library.niFgen_GetAttributeViString.side_effect = MockFunctionCallError( + "niFgen_GetAttributeViString" + ) mock_library.niFgen_GetAttributeViString.return_value = 0 - mock_library.niFgen_GetChannelName.side_effect = MockFunctionCallError("niFgen_GetChannelName") + mock_library.niFgen_GetChannelName.side_effect = MockFunctionCallError( + "niFgen_GetChannelName" + ) mock_library.niFgen_GetChannelName.return_value = 0 - mock_library.niFgen_GetError.side_effect = MockFunctionCallError("niFgen_GetError") + mock_library.niFgen_GetError.side_effect = MockFunctionCallError( + "niFgen_GetError" + ) mock_library.niFgen_GetError.return_value = 0 - mock_library.niFgen_GetExtCalLastDateAndTime.side_effect = MockFunctionCallError("niFgen_GetExtCalLastDateAndTime") + mock_library.niFgen_GetExtCalLastDateAndTime.side_effect = ( + MockFunctionCallError("niFgen_GetExtCalLastDateAndTime") + ) mock_library.niFgen_GetExtCalLastDateAndTime.return_value = 0 - mock_library.niFgen_GetExtCalLastTemp.side_effect = MockFunctionCallError("niFgen_GetExtCalLastTemp") + mock_library.niFgen_GetExtCalLastTemp.side_effect = MockFunctionCallError( + "niFgen_GetExtCalLastTemp" + ) mock_library.niFgen_GetExtCalLastTemp.return_value = 0 - mock_library.niFgen_GetExtCalRecommendedInterval.side_effect = MockFunctionCallError("niFgen_GetExtCalRecommendedInterval") + mock_library.niFgen_GetExtCalRecommendedInterval.side_effect = ( + MockFunctionCallError("niFgen_GetExtCalRecommendedInterval") + ) mock_library.niFgen_GetExtCalRecommendedInterval.return_value = 0 - mock_library.niFgen_GetHardwareState.side_effect = MockFunctionCallError("niFgen_GetHardwareState") + mock_library.niFgen_GetHardwareState.side_effect = MockFunctionCallError( + "niFgen_GetHardwareState" + ) mock_library.niFgen_GetHardwareState.return_value = 0 - mock_library.niFgen_GetLastExtCalLastDateAndTime.side_effect = MockFunctionCallError("niFgen_GetLastExtCalLastDateAndTime") + mock_library.niFgen_GetLastExtCalLastDateAndTime.side_effect = ( + MockFunctionCallError("niFgen_GetLastExtCalLastDateAndTime") + ) mock_library.niFgen_GetLastExtCalLastDateAndTime.return_value = 0 - mock_library.niFgen_GetLastSelfCalLastDateAndTime.side_effect = MockFunctionCallError("niFgen_GetLastSelfCalLastDateAndTime") + mock_library.niFgen_GetLastSelfCalLastDateAndTime.side_effect = ( + MockFunctionCallError("niFgen_GetLastSelfCalLastDateAndTime") + ) mock_library.niFgen_GetLastSelfCalLastDateAndTime.return_value = 0 - mock_library.niFgen_GetSelfCalLastDateAndTime.side_effect = MockFunctionCallError("niFgen_GetSelfCalLastDateAndTime") + mock_library.niFgen_GetSelfCalLastDateAndTime.side_effect = ( + MockFunctionCallError("niFgen_GetSelfCalLastDateAndTime") + ) mock_library.niFgen_GetSelfCalLastDateAndTime.return_value = 0 - mock_library.niFgen_GetSelfCalLastTemp.side_effect = MockFunctionCallError("niFgen_GetSelfCalLastTemp") + mock_library.niFgen_GetSelfCalLastTemp.side_effect = MockFunctionCallError( + "niFgen_GetSelfCalLastTemp" + ) mock_library.niFgen_GetSelfCalLastTemp.return_value = 0 - mock_library.niFgen_GetSelfCalSupported.side_effect = MockFunctionCallError("niFgen_GetSelfCalSupported") + mock_library.niFgen_GetSelfCalSupported.side_effect = MockFunctionCallError( + "niFgen_GetSelfCalSupported" + ) mock_library.niFgen_GetSelfCalSupported.return_value = 0 - mock_library.niFgen_ImportAttributeConfigurationBuffer.side_effect = MockFunctionCallError("niFgen_ImportAttributeConfigurationBuffer") + mock_library.niFgen_ImportAttributeConfigurationBuffer.side_effect = ( + MockFunctionCallError("niFgen_ImportAttributeConfigurationBuffer") + ) mock_library.niFgen_ImportAttributeConfigurationBuffer.return_value = 0 - mock_library.niFgen_ImportAttributeConfigurationFile.side_effect = MockFunctionCallError("niFgen_ImportAttributeConfigurationFile") + mock_library.niFgen_ImportAttributeConfigurationFile.side_effect = ( + MockFunctionCallError("niFgen_ImportAttributeConfigurationFile") + ) mock_library.niFgen_ImportAttributeConfigurationFile.return_value = 0 - mock_library.niFgen_InitializeWithChannels.side_effect = MockFunctionCallError("niFgen_InitializeWithChannels") + mock_library.niFgen_InitializeWithChannels.side_effect = MockFunctionCallError( + "niFgen_InitializeWithChannels" + ) mock_library.niFgen_InitializeWithChannels.return_value = 0 - mock_library.niFgen_InitiateGeneration.side_effect = MockFunctionCallError("niFgen_InitiateGeneration") + mock_library.niFgen_InitiateGeneration.side_effect = MockFunctionCallError( + "niFgen_InitiateGeneration" + ) mock_library.niFgen_InitiateGeneration.return_value = 0 mock_library.niFgen_IsDone.side_effect = MockFunctionCallError("niFgen_IsDone") mock_library.niFgen_IsDone.return_value = 0 - mock_library.niFgen_LockSession.side_effect = MockFunctionCallError("niFgen_LockSession") + mock_library.niFgen_LockSession.side_effect = MockFunctionCallError( + "niFgen_LockSession" + ) mock_library.niFgen_LockSession.return_value = 0 - mock_library.niFgen_QueryArbSeqCapabilities.side_effect = MockFunctionCallError("niFgen_QueryArbSeqCapabilities") + mock_library.niFgen_QueryArbSeqCapabilities.side_effect = MockFunctionCallError( + "niFgen_QueryArbSeqCapabilities" + ) mock_library.niFgen_QueryArbSeqCapabilities.return_value = 0 - mock_library.niFgen_QueryArbWfmCapabilities.side_effect = MockFunctionCallError("niFgen_QueryArbWfmCapabilities") + mock_library.niFgen_QueryArbWfmCapabilities.side_effect = MockFunctionCallError( + "niFgen_QueryArbWfmCapabilities" + ) mock_library.niFgen_QueryArbWfmCapabilities.return_value = 0 - mock_library.niFgen_QueryFreqListCapabilities.side_effect = MockFunctionCallError("niFgen_QueryFreqListCapabilities") + mock_library.niFgen_QueryFreqListCapabilities.side_effect = ( + MockFunctionCallError("niFgen_QueryFreqListCapabilities") + ) mock_library.niFgen_QueryFreqListCapabilities.return_value = 0 - mock_library.niFgen_ReadCurrentTemperature.side_effect = MockFunctionCallError("niFgen_ReadCurrentTemperature") + mock_library.niFgen_ReadCurrentTemperature.side_effect = MockFunctionCallError( + "niFgen_ReadCurrentTemperature" + ) mock_library.niFgen_ReadCurrentTemperature.return_value = 0 - mock_library.niFgen_ResetDevice.side_effect = MockFunctionCallError("niFgen_ResetDevice") + mock_library.niFgen_ResetDevice.side_effect = MockFunctionCallError( + "niFgen_ResetDevice" + ) mock_library.niFgen_ResetDevice.return_value = 0 - mock_library.niFgen_ResetWithDefaults.side_effect = MockFunctionCallError("niFgen_ResetWithDefaults") + mock_library.niFgen_ResetWithDefaults.side_effect = MockFunctionCallError( + "niFgen_ResetWithDefaults" + ) mock_library.niFgen_ResetWithDefaults.return_value = 0 - mock_library.niFgen_SelfCal.side_effect = MockFunctionCallError("niFgen_SelfCal") + mock_library.niFgen_SelfCal.side_effect = MockFunctionCallError( + "niFgen_SelfCal" + ) mock_library.niFgen_SelfCal.return_value = 0 - mock_library.niFgen_SendSoftwareEdgeTrigger.side_effect = MockFunctionCallError("niFgen_SendSoftwareEdgeTrigger") + mock_library.niFgen_SendSoftwareEdgeTrigger.side_effect = MockFunctionCallError( + "niFgen_SendSoftwareEdgeTrigger" + ) mock_library.niFgen_SendSoftwareEdgeTrigger.return_value = 0 - mock_library.niFgen_SetAttributeViBoolean.side_effect = MockFunctionCallError("niFgen_SetAttributeViBoolean") + mock_library.niFgen_SetAttributeViBoolean.side_effect = MockFunctionCallError( + "niFgen_SetAttributeViBoolean" + ) mock_library.niFgen_SetAttributeViBoolean.return_value = 0 - mock_library.niFgen_SetAttributeViInt32.side_effect = MockFunctionCallError("niFgen_SetAttributeViInt32") + mock_library.niFgen_SetAttributeViInt32.side_effect = MockFunctionCallError( + "niFgen_SetAttributeViInt32" + ) mock_library.niFgen_SetAttributeViInt32.return_value = 0 - mock_library.niFgen_SetAttributeViReal64.side_effect = MockFunctionCallError("niFgen_SetAttributeViReal64") + mock_library.niFgen_SetAttributeViReal64.side_effect = MockFunctionCallError( + "niFgen_SetAttributeViReal64" + ) mock_library.niFgen_SetAttributeViReal64.return_value = 0 - mock_library.niFgen_SetAttributeViString.side_effect = MockFunctionCallError("niFgen_SetAttributeViString") + mock_library.niFgen_SetAttributeViString.side_effect = MockFunctionCallError( + "niFgen_SetAttributeViString" + ) mock_library.niFgen_SetAttributeViString.return_value = 0 - mock_library.niFgen_SetNamedWaveformNextWritePosition.side_effect = MockFunctionCallError("niFgen_SetNamedWaveformNextWritePosition") + mock_library.niFgen_SetNamedWaveformNextWritePosition.side_effect = ( + MockFunctionCallError("niFgen_SetNamedWaveformNextWritePosition") + ) mock_library.niFgen_SetNamedWaveformNextWritePosition.return_value = 0 - mock_library.niFgen_SetWaveformNextWritePosition.side_effect = MockFunctionCallError("niFgen_SetWaveformNextWritePosition") + mock_library.niFgen_SetWaveformNextWritePosition.side_effect = ( + MockFunctionCallError("niFgen_SetWaveformNextWritePosition") + ) mock_library.niFgen_SetWaveformNextWritePosition.return_value = 0 - mock_library.niFgen_UnlockSession.side_effect = MockFunctionCallError("niFgen_UnlockSession") + mock_library.niFgen_UnlockSession.side_effect = MockFunctionCallError( + "niFgen_UnlockSession" + ) mock_library.niFgen_UnlockSession.return_value = 0 - mock_library.niFgen_WaitUntilDone.side_effect = MockFunctionCallError("niFgen_WaitUntilDone") + mock_library.niFgen_WaitUntilDone.side_effect = MockFunctionCallError( + "niFgen_WaitUntilDone" + ) mock_library.niFgen_WaitUntilDone.return_value = 0 - mock_library.niFgen_WriteBinary16Waveform.side_effect = MockFunctionCallError("niFgen_WriteBinary16Waveform") + mock_library.niFgen_WriteBinary16Waveform.side_effect = MockFunctionCallError( + "niFgen_WriteBinary16Waveform" + ) mock_library.niFgen_WriteBinary16Waveform.return_value = 0 - mock_library.niFgen_WriteNamedWaveformF64.side_effect = MockFunctionCallError("niFgen_WriteNamedWaveformF64") + mock_library.niFgen_WriteNamedWaveformF64.side_effect = MockFunctionCallError( + "niFgen_WriteNamedWaveformF64" + ) mock_library.niFgen_WriteNamedWaveformF64.return_value = 0 - mock_library.niFgen_WriteNamedWaveformI16.side_effect = MockFunctionCallError("niFgen_WriteNamedWaveformI16") + mock_library.niFgen_WriteNamedWaveformI16.side_effect = MockFunctionCallError( + "niFgen_WriteNamedWaveformI16" + ) mock_library.niFgen_WriteNamedWaveformI16.return_value = 0 - mock_library.niFgen_WriteScript.side_effect = MockFunctionCallError("niFgen_WriteScript") + mock_library.niFgen_WriteScript.side_effect = MockFunctionCallError( + "niFgen_WriteScript" + ) mock_library.niFgen_WriteScript.return_value = 0 - mock_library.niFgen_WriteWaveform.side_effect = MockFunctionCallError("niFgen_WriteWaveform") + mock_library.niFgen_WriteWaveform.side_effect = MockFunctionCallError( + "niFgen_WriteWaveform" + ) mock_library.niFgen_WriteWaveform.return_value = 0 mock_library.niFgen_close.side_effect = MockFunctionCallError("niFgen_close") mock_library.niFgen_close.return_value = 0 - mock_library.niFgen_error_message.side_effect = MockFunctionCallError("niFgen_error_message") + mock_library.niFgen_error_message.side_effect = MockFunctionCallError( + "niFgen_error_message" + ) mock_library.niFgen_error_message.return_value = 0 mock_library.niFgen_reset.side_effect = MockFunctionCallError("niFgen_reset") mock_library.niFgen_reset.return_value = 0 - mock_library.niFgen_self_test.side_effect = MockFunctionCallError("niFgen_self_test") + mock_library.niFgen_self_test.side_effect = MockFunctionCallError( + "niFgen_self_test" + ) mock_library.niFgen_self_test.return_value = 0 diff --git a/generated/nifgen/setup.py b/generated/nifgen/setup.py index 04f91f5a2..53bb9762d 100644 --- a/generated/nifgen/setup.py +++ b/generated/nifgen/setup.py @@ -15,42 +15,45 @@ def finalize_options(self): def run_tests(self): import pytest + pytest.main(self.test_args) -pypi_name = 'nifgen' +pypi_name = "nifgen" def read_contents(file_to_read): - with open(file_to_read, 'r') as f: + with open(file_to_read, "r") as f: return f.read() setup( name=pypi_name, zip_safe=True, - version='1.4.2.dev0', - description='NI-FGEN Python API', - long_description=read_contents('README.rst'), - long_description_content_type='text/x-rst', - author='NI', + version="1.4.2.dev0", + description="NI-FGEN Python API", + long_description=read_contents("README.rst"), + long_description_content_type="text/x-rst", + author="NI", author_email="opensource@ni.com", url="https://github.com/ni/nimi-python", maintainer="NI", maintainer_email="opensource@ni.com", - keywords=['nifgen'], - license='MIT', + keywords=["nifgen"], + license="MIT", include_package_data=True, - packages=['nifgen'], + packages=["nifgen"], install_requires=[ 'enum34;python_version<"3.4"', 'singledispatch;python_version<"3.4"', - 'hightime>=0.2.0', - 'nitclk', + "hightime>=0.2.0", + "nitclk", + ], + setup_requires=[ + "pytest-runner", ], - setup_requires=['pytest-runner', ], - tests_require=['pytest'], - test_suite='tests', + tests_require=["pytest"], + test_suite="tests", classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -65,8 +68,8 @@ def read_contents(file_to_read): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", - "Topic :: System :: Hardware :: Hardware Drivers" + "Topic :: System :: Hardware :: Hardware Drivers", ], - cmdclass={'test': PyTest}, - package_data={pypi_name: ['VERSION']}, + cmdclass={"test": PyTest}, + package_data={pypi_name: ["VERSION"]}, ) diff --git a/generated/nimodinst/nimodinst/__init__.py b/generated/nimodinst/nimodinst/__init__.py index 2419dd9ac..649a9858b 100644 --- a/generated/nimodinst/nimodinst/__init__.py +++ b/generated/nimodinst/nimodinst/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = '1.4.2.dev0' +__version__ = "1.4.2.dev0" from nimodinst.errors import DriverWarning # noqa: F401 from nimodinst.errors import Error # noqa: F401 @@ -10,12 +10,12 @@ def get_diagnostic_information(): - '''Get diagnostic information about the system state that is suitable for printing or logging + """Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - ''' + """ import os import pkg_resources import platform @@ -23,73 +23,80 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return (struct.calcsize("P") == 8) + return struct.calcsize("P") == 8 def is_os_64bit(): - return platform.machine().endswith('64') + return platform.machine().endswith("64") def is_venv(): - return 'VIRTUAL_ENV' in os.environ + return "VIRTUAL_ENV" in os.environ info = {} - info['os'] = {} - info['python'] = {} - info['driver'] = {} - info['module'] = {} - if platform.system() == 'Windows': + info["os"] = {} + info["python"] = {} + info["driver"] = {} + info["module"] = {} + if platform.system() == "Windows": try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = 'Windows' + os_name = "Windows" try: - driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-ModInst\CurrentVersion") + driver_version_key = winreg.OpenKey( + winreg.HKEY_LOCAL_MACHINE, + r"SOFTWARE\National Instruments\NI-ModInst\CurrentVersion", + ) driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = 'Unknown' - elif platform.system() == 'Linux': - os_name = 'Linux' - driver_version = 'Unknown' + driver_version = "Unknown" + elif platform.system() == "Linux": + os_name = "Linux" + driver_version = "Unknown" else: - raise SystemError('Unsupported platform: {}'.format(platform.system())) + raise SystemError("Unsupported platform: {}".format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] - - info['os']['name'] = os_name - info['os']['version'] = platform.version() - info['os']['bits'] = '64' if is_os_64bit() else '32' - info['driver']['name'] = "NI-ModInst" - info['driver']['version'] = driver_version - info['module']['name'] = 'nimodinst' - info['module']['version'] = "1.4.2.dev0" - info['python']['version'] = sys.version - info['python']['bits'] = '64' if is_python_64bit() else '32' - info['python']['is_venv'] = is_venv() - info['python']['packages'] = installed_packages_list + installed_packages_list = [ + { + "name": i.key, + "version": i.version, + } + for i in installed_packages + ] + + info["os"]["name"] = os_name + info["os"]["version"] = platform.version() + info["os"]["bits"] = "64" if is_os_64bit() else "32" + info["driver"]["name"] = "NI-ModInst" + info["driver"]["version"] = driver_version + info["module"]["name"] = "nimodinst" + info["module"]["version"] = "1.4.2.dev0" + info["python"]["version"] = sys.version + info["python"]["bits"] = "64" if is_python_64bit() else "32" + info["python"]["is_venv"] = is_venv() + info["python"]["packages"] = installed_packages_list return info def print_diagnostic_information(): - '''Print diagnostic information in a format suitable for issue report + """Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - ''' + """ info = get_diagnostic_information() - row_format = ' {:<10} {}' - for type in ['OS', 'Driver', 'Module', 'Python']: + row_format = " {:<10} {}" + for type in ["OS", "Driver", "Module", "Python"]: typename = type.lower() - print(type + ':') + print(type + ":") for item in info[typename]: - if item != 'packages': - print(row_format.format(item.title() + ':', info[typename][item])) - print(' Installed Packages:') - for p in info['python']['packages']: - print((' ' * 8) + p['name'] + '==' + p['version']) + if item != "packages": + print(row_format.format(item.title() + ":", info[typename][item])) + print(" Installed Packages:") + for p in info["python"]["packages"]: + print((" " * 8) + p["name"] + "==" + p["version"]) return info - - diff --git a/generated/nimodinst/nimodinst/_converters.py b/generated/nimodinst/nimodinst/_converters.py index 8851ba799..f58b2d776 100644 --- a/generated/nimodinst/nimodinst/_converters.py +++ b/generated/nimodinst/nimodinst/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - '''Base version that should not be called + """Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,36 +40,38 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - ''' - raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + """ + raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - '''Integer version''' + """Integer version""" return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - '''String version (this is the most complex) + """String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - ''' + """ # First we deal with a list - rep_cap_list = repeated_capability.split(',') + rep_cap_list = repeated_capability.split(",") if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, '').replace(':', '-') - rc = r.split('-') + r = repeated_capability.strip().replace(prefix, "").replace(":", "-") + rc = r.split("-") if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + raise errors.InvalidRepeatedCapabilityError( + "Multiple '-' or ':'", repeated_capability + ) try: start = int(rc[0]) end = int(rc[1]) @@ -85,7 +87,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, '').strip()] + return [repeated_capability.replace(prefix, "").strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -94,7 +96,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - '''Iterable version - can handle lists, ranges, and tuples''' + """Iterable version - can handle lists, ranges, and tuples""" rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -103,16 +105,22 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - '''slice version''' + """slice version""" + def ifnone(a, b): return b if a is None else a + # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) + rng = range( + ifnone(repeated_capability.start, 0), + repeated_capability.stop, + ifnone(repeated_capability.step, 1), + ) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=''): - '''Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=""): + """Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -120,15 +128,17 @@ def convert_repeated_capabilities(repeated_capability, prefix=''): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - ''' + """ # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] + return [ + prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) + ] def convert_repeated_capabilities_without_prefix(repeated_capability): - '''Convert a repeated capabilities object, without any prefix, to a comma delimited list + """Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -144,8 +154,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - ''' - return ','.join(convert_repeated_capabilities(repeated_capability, '')) + """ + return ",".join(convert_repeated_capabilities(repeated_capability, "")) def _convert_timedelta(value, library_type, scaling): @@ -158,7 +168,14 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: + if library_type in [ + _visatype.ViInt64, + _visatype.ViInt32, + _visatype.ViUInt32, + _visatype.ViInt16, + _visatype.ViUInt16, + _visatype.ViInt8, + ]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -195,34 +212,36 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - 'rangecheck': 'RangeCheck', - 'queryinstrstatus': 'QueryInstrStatus', - 'cache': 'Cache', - 'simulate': 'Simulate', - 'recordcoercions': 'RecordCoercions', - 'interchangecheck': 'InterchangeCheck', - 'driversetup': 'DriverSetup', - 'range_check': 'RangeCheck', - 'query_instr_status': 'QueryInstrStatus', - 'record_coercions': 'RecordCoercions', - 'interchange_check': 'InterchangeCheck', - 'driver_setup': 'DriverSetup', + "rangecheck": "RangeCheck", + "queryinstrstatus": "QueryInstrStatus", + "cache": "Cache", + "simulate": "Simulate", + "recordcoercions": "RecordCoercions", + "interchangecheck": "InterchangeCheck", + "driversetup": "DriverSetup", + "range_check": "RangeCheck", + "query_instr_status": "QueryInstrStatus", + "record_coercions": "RecordCoercions", + "interchange_check": "InterchangeCheck", + "driver_setup": "DriverSetup", } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': - value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') - elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': + if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": + value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") + elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": if not isinstance(values[k], dict): - raise TypeError('DriverSetup must be a dictionary') - value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) + raise TypeError("DriverSetup must be a dictionary") + value = "DriverSetup=" + ( + ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) + ) else: - value = k + ('=1' if values[k] is True else '=0') + value = k + ("=1" if values[k] is True else "=0") init_with_options.append(value) - init_with_options_string = ','.join(init_with_options) + init_with_options_string = ",".join(init_with_options) return init_with_options_string @@ -251,11 +270,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(',')] + return [x.strip() for x in comma_separated_string.split(",")] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -267,11 +286,17 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - ''' - chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) - repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] + """ + chained_repeated_capability_items = convert_comma_separated_string_to_list( + chained_repeated_capability + ) + repeated_capability_lists = [ + [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) + ] for item in chained_repeated_capability_items: - repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] - return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] - - + repeated_capability_lists = [ + x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) + ] + return [ + ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists + ] diff --git a/generated/nimodinst/nimodinst/_library.py b/generated/nimodinst/nimodinst/_library.py index 7f1f8f140..c6bcc66d2 100644 --- a/generated/nimodinst/nimodinst/_library.py +++ b/generated/nimodinst/nimodinst/_library.py @@ -9,11 +9,11 @@ class Library(object): - '''Library + """Library Wrapper around driver library. Class will setup the correct ctypes information for every function on first call. - ''' + """ def __init__(self, ctypes_library): self._func_lock = threading.Lock() @@ -35,39 +35,99 @@ def _get_library_function(self, name): def niModInst_CloseInstalledDevicesSession(self, handle): # noqa: N802 with self._func_lock: if self.niModInst_CloseInstalledDevicesSession_cfunc is None: - self.niModInst_CloseInstalledDevicesSession_cfunc = self._get_library_function('niModInst_CloseInstalledDevicesSession') - self.niModInst_CloseInstalledDevicesSession_cfunc.argtypes = [ViSession] # noqa: F405 - self.niModInst_CloseInstalledDevicesSession_cfunc.restype = ViStatus # noqa: F405 + self.niModInst_CloseInstalledDevicesSession_cfunc = ( + self._get_library_function("niModInst_CloseInstalledDevicesSession") + ) + self.niModInst_CloseInstalledDevicesSession_cfunc.argtypes = [ + ViSession + ] # noqa: F405 + self.niModInst_CloseInstalledDevicesSession_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niModInst_CloseInstalledDevicesSession_cfunc(handle) - def niModInst_GetExtendedErrorInfo(self, error_info_buffer_size, error_info): # noqa: N802 + def niModInst_GetExtendedErrorInfo( + self, error_info_buffer_size, error_info + ): # noqa: N802 with self._func_lock: if self.niModInst_GetExtendedErrorInfo_cfunc is None: - self.niModInst_GetExtendedErrorInfo_cfunc = self._get_library_function('niModInst_GetExtendedErrorInfo') - self.niModInst_GetExtendedErrorInfo_cfunc.argtypes = [ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 - self.niModInst_GetExtendedErrorInfo_cfunc.restype = ViStatus # noqa: F405 - return self.niModInst_GetExtendedErrorInfo_cfunc(error_info_buffer_size, error_info) + self.niModInst_GetExtendedErrorInfo_cfunc = self._get_library_function( + "niModInst_GetExtendedErrorInfo" + ) + self.niModInst_GetExtendedErrorInfo_cfunc.argtypes = [ + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niModInst_GetExtendedErrorInfo_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niModInst_GetExtendedErrorInfo_cfunc( + error_info_buffer_size, error_info + ) - def niModInst_GetInstalledDeviceAttributeViInt32(self, handle, index, attribute_id, attribute_value): # noqa: N802 + def niModInst_GetInstalledDeviceAttributeViInt32( + self, handle, index, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niModInst_GetInstalledDeviceAttributeViInt32_cfunc is None: - self.niModInst_GetInstalledDeviceAttributeViInt32_cfunc = self._get_library_function('niModInst_GetInstalledDeviceAttributeViInt32') - self.niModInst_GetInstalledDeviceAttributeViInt32_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViInt32)] # noqa: F405 - self.niModInst_GetInstalledDeviceAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niModInst_GetInstalledDeviceAttributeViInt32_cfunc(handle, index, attribute_id, attribute_value) + self.niModInst_GetInstalledDeviceAttributeViInt32_cfunc = ( + self._get_library_function( + "niModInst_GetInstalledDeviceAttributeViInt32" + ) + ) + self.niModInst_GetInstalledDeviceAttributeViInt32_cfunc.argtypes = [ + ViSession, + ViInt32, + ViInt32, + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niModInst_GetInstalledDeviceAttributeViInt32_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niModInst_GetInstalledDeviceAttributeViInt32_cfunc( + handle, index, attribute_id, attribute_value + ) - def niModInst_GetInstalledDeviceAttributeViString(self, handle, index, attribute_id, attribute_value_buffer_size, attribute_value): # noqa: N802 + def niModInst_GetInstalledDeviceAttributeViString( + self, handle, index, attribute_id, attribute_value_buffer_size, attribute_value + ): # noqa: N802 with self._func_lock: if self.niModInst_GetInstalledDeviceAttributeViString_cfunc is None: - self.niModInst_GetInstalledDeviceAttributeViString_cfunc = self._get_library_function('niModInst_GetInstalledDeviceAttributeViString') - self.niModInst_GetInstalledDeviceAttributeViString_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 - self.niModInst_GetInstalledDeviceAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niModInst_GetInstalledDeviceAttributeViString_cfunc(handle, index, attribute_id, attribute_value_buffer_size, attribute_value) + self.niModInst_GetInstalledDeviceAttributeViString_cfunc = ( + self._get_library_function( + "niModInst_GetInstalledDeviceAttributeViString" + ) + ) + self.niModInst_GetInstalledDeviceAttributeViString_cfunc.argtypes = [ + ViSession, + ViInt32, + ViInt32, + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niModInst_GetInstalledDeviceAttributeViString_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niModInst_GetInstalledDeviceAttributeViString_cfunc( + handle, index, attribute_id, attribute_value_buffer_size, attribute_value + ) - def niModInst_OpenInstalledDevicesSession(self, driver, handle, device_count): # noqa: N802 + def niModInst_OpenInstalledDevicesSession( + self, driver, handle, device_count + ): # noqa: N802 with self._func_lock: if self.niModInst_OpenInstalledDevicesSession_cfunc is None: - self.niModInst_OpenInstalledDevicesSession_cfunc = self._get_library_function('niModInst_OpenInstalledDevicesSession') - self.niModInst_OpenInstalledDevicesSession_cfunc.argtypes = [ctypes.POINTER(ViChar), ctypes.POINTER(ViSession), ctypes.POINTER(ViInt32)] # noqa: F405 - self.niModInst_OpenInstalledDevicesSession_cfunc.restype = ViStatus # noqa: F405 - return self.niModInst_OpenInstalledDevicesSession_cfunc(driver, handle, device_count) + self.niModInst_OpenInstalledDevicesSession_cfunc = ( + self._get_library_function("niModInst_OpenInstalledDevicesSession") + ) + self.niModInst_OpenInstalledDevicesSession_cfunc.argtypes = [ + ctypes.POINTER(ViChar), + ctypes.POINTER(ViSession), + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niModInst_OpenInstalledDevicesSession_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niModInst_OpenInstalledDevicesSession_cfunc( + driver, handle, device_count + ) diff --git a/generated/nimodinst/nimodinst/_library_singleton.py b/generated/nimodinst/nimodinst/_library_singleton.py index 283ecb6c1..c2cdc3fa1 100644 --- a/generated/nimodinst/nimodinst/_library_singleton.py +++ b/generated/nimodinst/nimodinst/_library_singleton.py @@ -12,30 +12,36 @@ _instance = None _instance_lock = threading.Lock() -_library_info = {'Linux': {'64bit': {'name': 'nimodinst', 'type': 'cdll'}}, - 'Windows': {'32bit': {'name': 'niModInst.dll', 'type': 'windll'}, - '64bit': {'name': 'niModInst_64.dll', 'type': 'cdll'}}} +_library_info = { + "Linux": {"64bit": {"name": "nimodinst", "type": "cdll"}}, + "Windows": { + "32bit": {"name": "niModInst.dll", "type": "windll"}, + "64bit": {"name": "niModInst_64.dll", "type": "cdll"}, + }, +} def _get_library_name(): try: - return ctypes.util.find_library(_library_info[platform.system()][platform.architecture()[0]]['name']) # We find and return full path to the DLL + return ctypes.util.find_library( + _library_info[platform.system()][platform.architecture()[0]]["name"] + ) # We find and return full path to the DLL except KeyError: raise errors.UnsupportedConfigurationError def _get_library_type(): try: - return _library_info[platform.system()][platform.architecture()[0]]['type'] + return _library_info[platform.system()][platform.architecture()[0]]["type"] except KeyError: raise errors.UnsupportedConfigurationError def get(): - '''get + """get Returns the library.Library singleton for nimodinst. - ''' + """ global _instance global _instance_lock @@ -43,13 +49,12 @@ def get(): if _instance is None: try: library_type = _get_library_type() - if library_type == 'windll': + if library_type == "windll": ctypes_library = ctypes.WinDLL(_get_library_name()) else: - assert library_type == 'cdll' + assert library_type == "cdll" ctypes_library = ctypes.CDLL(_get_library_name()) except OSError: raise errors.DriverNotInstalledError() _instance = _library.Library(ctypes_library) return _instance - diff --git a/generated/nimodinst/nimodinst/_visatype.py b/generated/nimodinst/nimodinst/_visatype.py index 02cc41d1b..bf96c3cfb 100644 --- a/generated/nimodinst/nimodinst/_visatype.py +++ b/generated/nimodinst/nimodinst/_visatype.py @@ -2,9 +2,9 @@ import ctypes -'''Definitions of the VISA types used by the C API of the driver runtime. +"""Definitions of the VISA types used by the C API of the driver runtime. These are aliased directly to ctypes types so can be used directly to call into the library. -''' +""" ViChar = ctypes.c_char @@ -26,4 +26,3 @@ ViAttr = ViUInt32 ViConstString = ViString ViRsrc = ViString - diff --git a/generated/nimodinst/nimodinst/errors.py b/generated/nimodinst/nimodinst/errors.py index 08f307aac..d7451e47a 100644 --- a/generated/nimodinst/nimodinst/errors.py +++ b/generated/nimodinst/nimodinst/errors.py @@ -7,70 +7,81 @@ def _is_success(code): - return (code == 0) + return code == 0 def _is_error(code): - return (code < 0) + return code < 0 def _is_warning(code): - return (code > 0) + return code > 0 class Error(Exception): - '''Base error class for NI-ModInst''' + """Base error class for NI-ModInst""" def __init__(self, message): super(Error, self).__init__(message) class DriverError(Error): - '''An error originating from the NI-ModInst driver''' + """An error originating from the NI-ModInst driver""" def __init__(self, code, description): - assert (_is_error(code)), "Should not raise Error if code is not fatal." + assert _is_error(code), "Should not raise Error if code is not fatal." self.code = code self.description = description super(DriverError, self).__init__(str(self.code) + ": " + self.description) class DriverWarning(Warning): - '''A warning originating from the NI-ModInst driver''' + """A warning originating from the NI-ModInst driver""" def __init__(self, code, description): - assert (_is_warning(code)), "Should not create Warning if code is not positive." - super(DriverWarning, self).__init__('Warning {0} occurred.\n\n{1}'.format(code, description)) + assert _is_warning(code), "Should not create Warning if code is not positive." + super(DriverWarning, self).__init__( + "Warning {0} occurred.\n\n{1}".format(code, description) + ) class UnsupportedConfigurationError(Error): - '''An error due to using this module in an usupported platform.''' + """An error due to using this module in an usupported platform.""" def __init__(self): - super(UnsupportedConfigurationError, self).__init__('System configuration is unsupported: ' + platform.architecture()[0] + ' ' + platform.system()) + super(UnsupportedConfigurationError, self).__init__( + "System configuration is unsupported: " + + platform.architecture()[0] + + " " + + platform.system() + ) class DriverNotInstalledError(Error): - '''An error due to using this module without the driver runtime installed.''' + """An error due to using this module without the driver runtime installed.""" def __init__(self): - super(DriverNotInstalledError, self).__init__('The NI-ModInst runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it.') + super(DriverNotInstalledError, self).__init__( + "The NI-ModInst runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it." + ) class DriverTooOldError(Error): - '''An error due to using this module with an older version of the driver runtime.''' + """An error due to using this module with an older version of the driver runtime.""" def __init__(self): - super(DriverTooOldError, self).__init__('A function was not found in the NI-ModInst runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it.') + super(DriverTooOldError, self).__init__( + "A function was not found in the NI-ModInst runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it." + ) def handle_error(session, code, ignore_warnings, is_error_handling): - '''handle_error + """handle_error Helper function for handling errors returned by nimodinst.Library. It calls back into the session to get the corresponding error description and raises if necessary. - ''' + """ if _is_success(code) or (_is_warning(code) and ignore_warnings): return @@ -78,7 +89,7 @@ def handle_error(session, code, ignore_warnings, is_error_handling): if is_error_handling: # The caller is in the midst of error handling and an error occurred. # Don't try to get the description or we'll start recursing until the stack overflows. - description = '' + description = "" else: description = session._get_error_description(code) @@ -87,5 +98,3 @@ def handle_error(session, code, ignore_warnings, is_error_handling): assert _is_warning(code) warnings.warn(DriverWarning(code, description)) - - diff --git a/generated/nimodinst/nimodinst/session.py b/generated/nimodinst/nimodinst/session.py index 423587a81..42630f897 100644 --- a/generated/nimodinst/nimodinst/session.py +++ b/generated/nimodinst/nimodinst/session.py @@ -13,25 +13,27 @@ class AttributeViInt32(object): - def __init__(self, owner, attribute_id, index): self._owner = owner self._index = index self._attribute_id = attribute_id def __getitem__(self, index): - return self._owner._get_installed_device_attribute_vi_int32(self._index, self._attribute_id) + return self._owner._get_installed_device_attribute_vi_int32( + self._index, self._attribute_id + ) class AttributeViString(object): - def __init__(self, owner, attribute_id, index): self._owner = owner self._index = index self._attribute_id = attribute_id def __getitem__(self, index): - return self._owner._get_installed_device_attribute_vi_string(self._index, self._attribute_id) + return self._owner._get_installed_device_attribute_vi_string( + self._index, self._attribute_id + ) class _Device(object): @@ -42,62 +44,81 @@ class _Device(object): def __init__(self, owner, index): self._index = index self.bus_number = AttributeViInt32(owner, 12, index=index) - ''' + """ The bus on which the device has been enumerated. - ''' + """ self.chassis_number = AttributeViInt32(owner, 11, index=index) - ''' + """ The number of the chassis in which the device is installed. This property can only be queried for PXI devices installed in a chassis that has been properly identified in MAX. - ''' + """ self.device_model = AttributeViString(owner, 1, index=index) - ''' + """ The model of the device (for example, NI PXI-5122) - ''' + """ self.device_name = AttributeViString(owner, 0, index=index) - ''' + """ The name of the device, which can be used to open an instrument driver session for that device - ''' + """ self.max_pciexpress_link_width = AttributeViInt32(owner, 18, index=index) - ''' + """ **MAX_PCIEXPRESS_LINK_WIDTH** - ''' + """ self.pciexpress_link_width = AttributeViInt32(owner, 17, index=index) - ''' + """ **PCIEXPRESS_LINK_WIDTH** - ''' + """ self.serial_number = AttributeViString(owner, 2, index=index) - ''' + """ The serial number of the device - ''' + """ self.slot_number = AttributeViInt32(owner, 10, index=index) - ''' + """ The slot (for example, in a PXI chassis) in which the device is installed. This property can only be queried for PXI devices installed in a chassis that has been properly identified in MAX. - ''' + """ self.socket_number = AttributeViInt32(owner, 13, index=index) - ''' + """ The socket number on which the device has been enumerated - ''' - self._param_list = 'owner=' + pp.pformat(owner) + ', index=' + pp.pformat(index) + """ + self._param_list = "owner=" + pp.pformat(owner) + ", index=" + pp.pformat(index) self._is_frozen = True def __repr__(self): - return '{0}.{1}({2})'.format('nimodinst', self.__class__.__name__, self._param_list) + return "{0}.{1}({2})".format( + "nimodinst", self.__class__.__name__, self._param_list + ) def __str__(self): - ret_str = self.__repr__() + ':\n' - ret_str += ' bus_number = ' + pp.pformat(self.bus_number) + '\n' - ret_str += ' chassis_number = ' + pp.pformat(self.chassis_number) + '\n' - ret_str += ' device_model = ' + pp.pformat(self.device_model) + '\n' - ret_str += ' device_name = ' + pp.pformat(self.device_name) + '\n' - ret_str += ' max_pciexpress_link_width = ' + pp.pformat(self.max_pciexpress_link_width) + '\n' - ret_str += ' pciexpress_link_width = ' + pp.pformat(self.pciexpress_link_width) + '\n' - ret_str += ' serial_number = ' + pp.pformat(self.serial_number) + '\n' - ret_str += ' slot_number = ' + pp.pformat(self.slot_number) + '\n' - ret_str += ' socket_number = ' + pp.pformat(self.socket_number) + '\n' + ret_str = self.__repr__() + ":\n" + ret_str += " bus_number = " + pp.pformat(self.bus_number) + "\n" + ret_str += " chassis_number = " + pp.pformat(self.chassis_number) + "\n" + ret_str += " device_model = " + pp.pformat(self.device_model) + "\n" + ret_str += " device_name = " + pp.pformat(self.device_name) + "\n" + ret_str += ( + " max_pciexpress_link_width = " + + pp.pformat(self.max_pciexpress_link_width) + + "\n" + ) + ret_str += ( + " pciexpress_link_width = " + + pp.pformat(self.pciexpress_link_width) + + "\n" + ) + ret_str += " serial_number = " + pp.pformat(self.serial_number) + "\n" + ret_str += " slot_number = " + pp.pformat(self.slot_number) + "\n" + ret_str += " socket_number = " + pp.pformat(self.socket_number) + "\n" return ret_str def __getattribute__(self, name): - if name in ['_is_frozen', 'index', '_param_list', '__class__', '__name__', '__repr__', '__str__', '__setattr__', ]: + if name in [ + "_is_frozen", + "index", + "_param_list", + "__class__", + "__name__", + "__repr__", + "__str__", + "__setattr__", + ]: return object.__getattribute__(self, name) else: return object.__getattribute__(self, name).__getitem__(None) @@ -113,7 +134,7 @@ def __init__(self, owner, count): self._current_index = 0 self._owner = owner self._count = count - self._param_list = 'owner=' + pp.pformat(owner) + ', count=' + pp.pformat(count) + self._param_list = "owner=" + pp.pformat(owner) + ", count=" + pp.pformat(count) self._is_frozen = True def _get_next(self): @@ -131,16 +152,18 @@ def __next__(self): return self._get_next() def __repr__(self): - return '{0}.{1}({2})'.format('nimodinst', self.__class__.__name__, self._param_list) + return "{0}.{1}({2})".format( + "nimodinst", self.__class__.__name__, self._param_list + ) def __str__(self): - ret_str = self.__repr__() + ':\n' - ret_str += ' current index = {0}'.format(self._current_index) + ret_str = self.__repr__() + ":\n" + ret_str += " current index = {0}".format(self._current_index) return ret_str class Session(object): - '''A NI-ModInst session to get device information''' + """A NI-ModInst session to get device information""" # This is needed during __init__. Without it, __setattr__ raises an exception _is_frozen = False @@ -149,7 +172,7 @@ def __init__(self, driver): self._handle = 0 self._item_count = 0 self._current_item = 0 - self._encoding = 'windows-1251' + self._encoding = "windows-1251" self._library = _library_singleton.get() self._handle, self._item_count = self._open_installed_devices_session(driver) self._param_list = "driver=" + pp.pformat(driver) @@ -161,12 +184,14 @@ def __init__(self, driver): self._is_frozen = True def __repr__(self): - return '{0}.{1}({2})'.format('nimodinst', self.__class__.__name__, self._param_list) + return "{0}.{1}({2})".format( + "nimodinst", self.__class__.__name__, self._param_list + ) def __str__(self): - ret_str = self.__repr__() + ':\n' + ret_str = self.__repr__() + ":\n" for i in range(self._item_count): - ret_str += str(_Device(self, i)) + '\n' + ret_str += str(_Device(self, i)) + "\n" return ret_str def __setattr__(self, key, value): @@ -181,23 +206,29 @@ def __exit__(self, exc_type, exc_value, traceback): self.close() def _get_error_description(self, error_code): - '''_get_error_description + """_get_error_description Returns the error description. - ''' + """ # We hand-maintain the code that calls into self._library rather than leverage code-generation # because niModInst_GetExtendedErrorInfo() does not properly do the IVI-dance. # See https://github.com/ni/nimi-python/issues/166 error_info_buffer_size_ctype = _visatype.ViInt32() # case S170 error_info_ctype = None # case C050 - error_code = self._library.niModInst_GetExtendedErrorInfo(error_info_buffer_size_ctype, error_info_ctype) + error_code = self._library.niModInst_GetExtendedErrorInfo( + error_info_buffer_size_ctype, error_info_ctype + ) if error_code <= 0: return "Failed to retrieve error description." error_info_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - error_info_ctype = (_visatype.ViChar * error_info_buffer_size_ctype.value)() # case C060 + error_info_ctype = ( + _visatype.ViChar * error_info_buffer_size_ctype.value + )() # case C060 # Note we don't look at the return value. This is intentional as niModInst returns the # original error code rather than 0 (VI_SUCCESS). - self._library.niModInst_GetExtendedErrorInfo(error_info_buffer_size_ctype, error_info_ctype) + self._library.niModInst_GetExtendedErrorInfo( + error_info_buffer_size_ctype, error_info_ctype + ) return error_info_ctype.value.decode("ascii") # Iterator functions @@ -215,21 +246,24 @@ def close(self): raise self._handle = 0 - ''' These are code-generated ''' + """ These are code-generated """ + def _close_installed_devices_session(self): - r'''_close_installed_devices_session + r"""_close_installed_devices_session Cleans up the NI-ModInst session created by a call to _open_installed_devices_session. Call this method when you are finished using the session handle and do not use this handle again. - ''' + """ handle_ctype = _visatype.ViSession(self._handle) # case S110 error_code = self._library.niModInst_CloseInstalledDevicesSession(handle_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def _get_extended_error_info(self): - r'''_get_extended_error_info + r"""_get_extended_error_info Returns detailed information about the last error that occurred in the current thread during a call to one of the NI-ModInst methods. When @@ -249,19 +283,29 @@ def _get_extended_error_info(self): Returns: error_info (str): The character buffer into which the error information string is copied. - ''' + """ error_info_buffer_size_ctype = _visatype.ViInt32() # case S170 error_info_ctype = None # case C050 - error_code = self._library.niModInst_GetExtendedErrorInfo(error_info_buffer_size_ctype, error_info_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True) + error_code = self._library.niModInst_GetExtendedErrorInfo( + error_info_buffer_size_ctype, error_info_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=True + ) error_info_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - error_info_ctype = (_visatype.ViChar * error_info_buffer_size_ctype.value)() # case C060 - error_code = self._library.niModInst_GetExtendedErrorInfo(error_info_buffer_size_ctype, error_info_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + error_info_ctype = ( + _visatype.ViChar * error_info_buffer_size_ctype.value + )() # case C060 + error_code = self._library.niModInst_GetExtendedErrorInfo( + error_info_buffer_size_ctype, error_info_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return error_info_ctype.value.decode(self._encoding) def _get_installed_device_attribute_vi_int32(self, index, attribute_id): - r'''_get_installed_device_attribute_vi_int32 + r"""_get_installed_device_attribute_vi_int32 Returns an integer property specified by the attributeID parameter for a device specified by the handle and index parameters. The handle @@ -294,17 +338,26 @@ def _get_installed_device_attribute_vi_int32(self, index, attribute_id): attribute_value (int): A pointer to a signed 32-bit integer variable that receives the value of the requested property. - ''' + """ handle_ctype = _visatype.ViSession(self._handle) # case S110 index_ctype = _visatype.ViInt32(index) # case S150 attribute_id_ctype = _visatype.ViInt32(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niModInst_GetInstalledDeviceAttributeViInt32(handle_ctype, index_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niModInst_GetInstalledDeviceAttributeViInt32( + handle_ctype, + index_ctype, + attribute_id_ctype, + None + if attribute_value_ctype is None + else (ctypes.pointer(attribute_value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(attribute_value_ctype.value) def _get_installed_device_attribute_vi_string(self, index, attribute_id): - r'''_get_installed_device_attribute_vi_string + r"""_get_installed_device_attribute_vi_string Returns a string property specified by the attributeID parameter for a device specified by the handle and index parameters. The handle @@ -336,22 +389,40 @@ def _get_installed_device_attribute_vi_string(self, index, attribute_id): Returns: attribute_value (str): The character buffer into which the property value string is copied. - ''' + """ handle_ctype = _visatype.ViSession(self._handle) # case S110 index_ctype = _visatype.ViInt32(index) # case S150 attribute_id_ctype = _visatype.ViInt32(attribute_id) # case S150 attribute_value_buffer_size_ctype = _visatype.ViInt32() # case S170 attribute_value_ctype = None # case C050 - error_code = self._library.niModInst_GetInstalledDeviceAttributeViString(handle_ctype, index_ctype, attribute_id_ctype, attribute_value_buffer_size_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niModInst_GetInstalledDeviceAttributeViString( + handle_ctype, + index_ctype, + attribute_id_ctype, + attribute_value_buffer_size_ctype, + attribute_value_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) attribute_value_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - attribute_value_ctype = (_visatype.ViChar * attribute_value_buffer_size_ctype.value)() # case C060 - error_code = self._library.niModInst_GetInstalledDeviceAttributeViString(handle_ctype, index_ctype, attribute_id_ctype, attribute_value_buffer_size_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + attribute_value_ctype = ( + _visatype.ViChar * attribute_value_buffer_size_ctype.value + )() # case C060 + error_code = self._library.niModInst_GetInstalledDeviceAttributeViString( + handle_ctype, + index_ctype, + attribute_id_ctype, + attribute_value_buffer_size_ctype, + attribute_value_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return attribute_value_ctype.value.decode(self._encoding) def _open_installed_devices_session(self, driver): - r'''_open_installed_devices_session + r"""_open_installed_devices_session Creates a handle to a list of installed devices supported by the specified driver. Call this method and pass in the name of a National @@ -385,12 +456,20 @@ def _open_installed_devices_session(self, driver): found in the system that are supported by the driver specified in the driver parameter. - ''' - driver_ctype = ctypes.create_string_buffer(driver.encode(self._encoding)) # case C020 + """ + driver_ctype = ctypes.create_string_buffer( + driver.encode(self._encoding) + ) # case C020 handle_ctype = _visatype.ViSession() # case S220 device_count_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niModInst_OpenInstalledDevicesSession(driver_ctype, None if handle_ctype is None else (ctypes.pointer(handle_ctype)), None if device_count_ctype is None else (ctypes.pointer(device_count_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niModInst_OpenInstalledDevicesSession( + driver_ctype, + None if handle_ctype is None else (ctypes.pointer(handle_ctype)), + None + if device_count_ctype is None + else (ctypes.pointer(device_count_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(handle_ctype.value), int(device_count_ctype.value) - - diff --git a/generated/nimodinst/nimodinst/unit_tests/_matchers.py b/generated/nimodinst/nimodinst/unit_tests/_matchers.py index 879e2b3ff..4749a584e 100644 --- a/generated/nimodinst/nimodinst/unit_tests/_matchers.py +++ b/generated/nimodinst/nimodinst/unit_tests/_matchers.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # This file was generated -'''Matcher classes used by unit tests in order to set mock expectations. +"""Matcher classes used by unit tests in order to set mock expectations. These work well with our visatype definitions. -''' +""" import ctypes import nimodinst._visatype as _visatype @@ -21,15 +21,27 @@ def __init__(self, expected_type, expected_value): def __eq__(self, other): if not isinstance(other, self.expected_type): - print("{0}: Unexpected type. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_type, type(other))) + print( + "{0}: Unexpected type. Expected: {1}. Received: {2}".format( + self.__class__.__name__, self.expected_type, type(other) + ) + ) return False if other.value != self.expected_value: - print("{0}: Unexpected value. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_value, other.value)) + print( + "{0}: Unexpected value. Expected: {1}. Received: {2}".format( + self.__class__.__name__, self.expected_value, other.value + ) + ) return False return True def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_type), + pp.pformat(self.expected_value), + ) class _PointerMatcher(object): @@ -38,12 +50,18 @@ def __init__(self, expected_type): def __eq__(self, other): if not isinstance(other, ctypes.POINTER(self.expected_type)): - print("Unexpected type. Expected: {0}. Received: {1}".format(ctypes.POINTER(self.expected_type), type(other))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + ctypes.POINTER(self.expected_type), type(other) + ) + ) return False return True def __repr__(self): - return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_type)) + return "{0}({1})".format( + self.__class__.__name__, pp.pformat(self.expected_type) + ) class _BufferMatcher(object): @@ -70,29 +88,47 @@ def __eq__(self, other): pass # Because of object lifetimes, we may need to mock the other instance and provide lists instead of the actual array - if not isinstance(other, self.expected_type) and not isinstance(other, list): - print("Unexpected type. Expected: {0} or {1}. Received: {2}".format(self.expected_type, list, type(other))) + if not isinstance(other, self.expected_type) and not isinstance( + other, list + ): + print( + "Unexpected type. Expected: {0} or {1}. Received: {2}".format( + self.expected_type, list, type(other) + ) + ) return False if self.expected_size != len(other): - print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(other))) + print( + "Unexpected length. Expected: {0}. Received: {1}".format( + self.expected_size, len(other) + ) + ) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for i in range(0, len(self.expected_value)): if self.expected_value[i] != other[i]: - print("Unexpected value at index {0}. Expected: {1}. Received: {2}".format(i, self.expected_value[i], other[i])) + print( + "Unexpected value at index {0}. Expected: {1}. Received: {2}".format( + i, self.expected_value[i], other[i] + ) + ) return False return True def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self._expected_element_type), pp.pformat(self._expected_size_or_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self._expected_element_type), + pp.pformat(self._expected_size_or_value), + ) def __str__(self): - ret_str = self.__repr__() + '\n' - ret_str += ' expected_type = ' + str(self.expected_type) + '\n' - ret_str += ' expected_value = ' + str(self.expected_value) + '\n' - ret_str += ' expected_size = ' + str(self.expected_size) + '\n' + ret_str = self.__repr__() + "\n" + ret_str += " expected_type = " + str(self.expected_type) + "\n" + ret_str += " expected_value = " + str(self.expected_value) + "\n" + ret_str += " expected_size = " + str(self.expected_size) + "\n" return ret_str @@ -112,21 +148,37 @@ def __eq__(self, other): pass if not isinstance(other, ctypes.Array): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(other))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_type, type(other) + ) + ) return False - if len(other) < len(self.expected_string_value) + 1: # +1 for NULL terminating character - print("Unexpected length in C string. Expected at least: {0}. Received {1}".format(len(other), len(self.expected_string_value) + 1)) + if ( + len(other) < len(self.expected_string_value) + 1 + ): # +1 for NULL terminating character + print( + "Unexpected length in C string. Expected at least: {0}. Received {1}".format( + len(other), len(self.expected_string_value) + 1 + ) + ) return False if not isinstance(other[0], bytes): print("Unexpected type. Not a string. Received: {0}".format(type(other[0]))) return False if other.value.decode("ascii") != self.expected_string_value: - print("Unexpected value. Expected {0}. Received: {1}".format(self.expected_string_value, other.value.decode)) + print( + "Unexpected value. Expected {0}. Received: {1}".format( + self.expected_string_value, other.value.decode + ) + ) return False return True def __repr__(self): - return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_string_value)) + return "{0}({1})".format( + self.__class__.__name__, pp.pformat(self.expected_string_value) + ) # Custom Type @@ -139,7 +191,11 @@ def _compare_ctype_structs(expected, actual): expected_val = getattr(expected, field_name) actual_val = getattr(actual, field_name) if expected_val != actual_val: - print("Unexpected value field {0}. Expected: {1}. Received: {2}".format(field_name, expected_val, actual_val)) + print( + "Unexpected value field {0}. Expected: {1}. Received: {2}".format( + field_name, expected_val, actual_val + ) + ) return False return True @@ -151,12 +207,20 @@ def __init__(self, expected_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_type, type(actual) + ) + ) return False return _compare_ctype_structs(self.expected_value, actual) def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_type), + pp.pformat(self.expected_value), + ) class CustomTypeBufferMatcher(object): @@ -168,30 +232,48 @@ def __init__(self, expected_element_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print("Unexpected array type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) + print( + "Unexpected array type. Expected: {0}. Received: {1}".format( + self.expected_type, type(actual) + ) + ) return False if self.expected_size != len(actual): - print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(actual))) + print( + "Unexpected length. Expected: {0}. Received: {1}".format( + self.expected_size, len(actual) + ) + ) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for a, e in zip(actual, self.expected_value): if not isinstance(a, self.expected_element_type): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_element_type, type(a))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_element_type, type(a) + ) + ) return False if not _compare_ctype_structs(e, a): return False return True def __repr__(self): - expected_val_repr = '[' + ', '.join([x.__repr__() for x in self.expected_value]) + ']' - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_element_type), expected_val_repr) + expected_val_repr = ( + "[" + ", ".join([x.__repr__() for x in self.expected_value]) + "]" + ) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_element_type), + expected_val_repr, + ) def __str__(self): - ret_str = self.__repr__() + '\n' - ret_str += ' expected_type = ' + str(self.expected_type) + '\n' - ret_str += ' expected_size = ' + str(self.expected_size) + '\n' + ret_str = self.__repr__() + "\n" + ret_str += " expected_type = " + str(self.expected_type) + "\n" + ret_str += " expected_size = " + str(self.expected_size) + "\n" return ret_str @@ -200,7 +282,9 @@ def __str__(self): class ViBooleanMatcher(_ScalarMatcher): def __init__(self, expected_value): - _ScalarMatcher.__init__(self, _visatype.ViBoolean, 1 if expected_value is True else 0) + _ScalarMatcher.__init__( + self, _visatype.ViBoolean, 1 if expected_value is True else 0 + ) class ViSessionMatcher(_ScalarMatcher): @@ -312,6 +396,3 @@ def __init__(self, expected_size_or_value): class ViSessionBufferMatcher(_BufferMatcher): def __init__(self, expected_size_or_value): _BufferMatcher.__init__(self, _visatype.ViSession, expected_size_or_value) - - - diff --git a/generated/nimodinst/nimodinst/unit_tests/_mock_helper.py b/generated/nimodinst/nimodinst/unit_tests/_mock_helper.py index 8493cf03a..03ab8d5b6 100644 --- a/generated/nimodinst/nimodinst/unit_tests/_mock_helper.py +++ b/generated/nimodinst/nimodinst/unit_tests/_mock_helper.py @@ -16,21 +16,21 @@ def __init__(self, function, param=None): class SideEffectsHelper(object): def __init__(self): self._defaults = {} - self._defaults['CloseInstalledDevicesSession'] = {} - self._defaults['CloseInstalledDevicesSession']['return'] = 0 - self._defaults['GetExtendedErrorInfo'] = {} - self._defaults['GetExtendedErrorInfo']['return'] = 0 - self._defaults['GetExtendedErrorInfo']['errorInfo'] = None - self._defaults['GetInstalledDeviceAttributeViInt32'] = {} - self._defaults['GetInstalledDeviceAttributeViInt32']['return'] = 0 - self._defaults['GetInstalledDeviceAttributeViInt32']['attributeValue'] = None - self._defaults['GetInstalledDeviceAttributeViString'] = {} - self._defaults['GetInstalledDeviceAttributeViString']['return'] = 0 - self._defaults['GetInstalledDeviceAttributeViString']['attributeValue'] = None - self._defaults['OpenInstalledDevicesSession'] = {} - self._defaults['OpenInstalledDevicesSession']['return'] = 0 - self._defaults['OpenInstalledDevicesSession']['handle'] = None - self._defaults['OpenInstalledDevicesSession']['deviceCount'] = None + self._defaults["CloseInstalledDevicesSession"] = {} + self._defaults["CloseInstalledDevicesSession"]["return"] = 0 + self._defaults["GetExtendedErrorInfo"] = {} + self._defaults["GetExtendedErrorInfo"]["return"] = 0 + self._defaults["GetExtendedErrorInfo"]["errorInfo"] = None + self._defaults["GetInstalledDeviceAttributeViInt32"] = {} + self._defaults["GetInstalledDeviceAttributeViInt32"]["return"] = 0 + self._defaults["GetInstalledDeviceAttributeViInt32"]["attributeValue"] = None + self._defaults["GetInstalledDeviceAttributeViString"] = {} + self._defaults["GetInstalledDeviceAttributeViString"]["return"] = 0 + self._defaults["GetInstalledDeviceAttributeViString"]["attributeValue"] = None + self._defaults["OpenInstalledDevicesSession"] = {} + self._defaults["OpenInstalledDevicesSession"]["return"] = 0 + self._defaults["OpenInstalledDevicesSession"]["handle"] = None + self._defaults["OpenInstalledDevicesSession"]["deviceCount"] = None def __getitem__(self, func): return self._defaults[func] @@ -39,64 +39,110 @@ def __setitem__(self, func, val): self._defaults[func] = val def niModInst_CloseInstalledDevicesSession(self, handle): # noqa: N802 - if self._defaults['CloseInstalledDevicesSession']['return'] != 0: - return self._defaults['CloseInstalledDevicesSession']['return'] - return self._defaults['CloseInstalledDevicesSession']['return'] + if self._defaults["CloseInstalledDevicesSession"]["return"] != 0: + return self._defaults["CloseInstalledDevicesSession"]["return"] + return self._defaults["CloseInstalledDevicesSession"]["return"] - def niModInst_GetExtendedErrorInfo(self, error_info_buffer_size, error_info): # noqa: N802 - if self._defaults['GetExtendedErrorInfo']['return'] != 0: - return self._defaults['GetExtendedErrorInfo']['return'] - if self._defaults['GetExtendedErrorInfo']['errorInfo'] is None: - raise MockFunctionCallError("niModInst_GetExtendedErrorInfo", param='errorInfo') + def niModInst_GetExtendedErrorInfo( + self, error_info_buffer_size, error_info + ): # noqa: N802 + if self._defaults["GetExtendedErrorInfo"]["return"] != 0: + return self._defaults["GetExtendedErrorInfo"]["return"] + if self._defaults["GetExtendedErrorInfo"]["errorInfo"] is None: + raise MockFunctionCallError( + "niModInst_GetExtendedErrorInfo", param="errorInfo" + ) if error_info_buffer_size.value == 0: - return len(self._defaults['GetExtendedErrorInfo']['errorInfo']) - error_info.value = self._defaults['GetExtendedErrorInfo']['errorInfo'].encode('ascii') - return self._defaults['GetExtendedErrorInfo']['return'] + return len(self._defaults["GetExtendedErrorInfo"]["errorInfo"]) + error_info.value = self._defaults["GetExtendedErrorInfo"]["errorInfo"].encode( + "ascii" + ) + return self._defaults["GetExtendedErrorInfo"]["return"] - def niModInst_GetInstalledDeviceAttributeViInt32(self, handle, index, attribute_id, attribute_value): # noqa: N802 - if self._defaults['GetInstalledDeviceAttributeViInt32']['return'] != 0: - return self._defaults['GetInstalledDeviceAttributeViInt32']['return'] + def niModInst_GetInstalledDeviceAttributeViInt32( + self, handle, index, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["GetInstalledDeviceAttributeViInt32"]["return"] != 0: + return self._defaults["GetInstalledDeviceAttributeViInt32"]["return"] # attribute_value - if self._defaults['GetInstalledDeviceAttributeViInt32']['attributeValue'] is None: - raise MockFunctionCallError("niModInst_GetInstalledDeviceAttributeViInt32", param='attributeValue') + if ( + self._defaults["GetInstalledDeviceAttributeViInt32"]["attributeValue"] + is None + ): + raise MockFunctionCallError( + "niModInst_GetInstalledDeviceAttributeViInt32", param="attributeValue" + ) if attribute_value is not None: - attribute_value.contents.value = self._defaults['GetInstalledDeviceAttributeViInt32']['attributeValue'] - return self._defaults['GetInstalledDeviceAttributeViInt32']['return'] + attribute_value.contents.value = self._defaults[ + "GetInstalledDeviceAttributeViInt32" + ]["attributeValue"] + return self._defaults["GetInstalledDeviceAttributeViInt32"]["return"] - def niModInst_GetInstalledDeviceAttributeViString(self, handle, index, attribute_id, attribute_value_buffer_size, attribute_value): # noqa: N802 - if self._defaults['GetInstalledDeviceAttributeViString']['return'] != 0: - return self._defaults['GetInstalledDeviceAttributeViString']['return'] - if self._defaults['GetInstalledDeviceAttributeViString']['attributeValue'] is None: - raise MockFunctionCallError("niModInst_GetInstalledDeviceAttributeViString", param='attributeValue') + def niModInst_GetInstalledDeviceAttributeViString( + self, handle, index, attribute_id, attribute_value_buffer_size, attribute_value + ): # noqa: N802 + if self._defaults["GetInstalledDeviceAttributeViString"]["return"] != 0: + return self._defaults["GetInstalledDeviceAttributeViString"]["return"] + if ( + self._defaults["GetInstalledDeviceAttributeViString"]["attributeValue"] + is None + ): + raise MockFunctionCallError( + "niModInst_GetInstalledDeviceAttributeViString", param="attributeValue" + ) if attribute_value_buffer_size.value == 0: - return len(self._defaults['GetInstalledDeviceAttributeViString']['attributeValue']) - attribute_value.value = self._defaults['GetInstalledDeviceAttributeViString']['attributeValue'].encode('ascii') - return self._defaults['GetInstalledDeviceAttributeViString']['return'] + return len( + self._defaults["GetInstalledDeviceAttributeViString"]["attributeValue"] + ) + attribute_value.value = self._defaults["GetInstalledDeviceAttributeViString"][ + "attributeValue" + ].encode("ascii") + return self._defaults["GetInstalledDeviceAttributeViString"]["return"] - def niModInst_OpenInstalledDevicesSession(self, driver, handle, device_count): # noqa: N802 - if self._defaults['OpenInstalledDevicesSession']['return'] != 0: - return self._defaults['OpenInstalledDevicesSession']['return'] + def niModInst_OpenInstalledDevicesSession( + self, driver, handle, device_count + ): # noqa: N802 + if self._defaults["OpenInstalledDevicesSession"]["return"] != 0: + return self._defaults["OpenInstalledDevicesSession"]["return"] # handle - if self._defaults['OpenInstalledDevicesSession']['handle'] is None: - raise MockFunctionCallError("niModInst_OpenInstalledDevicesSession", param='handle') + if self._defaults["OpenInstalledDevicesSession"]["handle"] is None: + raise MockFunctionCallError( + "niModInst_OpenInstalledDevicesSession", param="handle" + ) if handle is not None: - handle.contents.value = self._defaults['OpenInstalledDevicesSession']['handle'] + handle.contents.value = self._defaults["OpenInstalledDevicesSession"][ + "handle" + ] # device_count - if self._defaults['OpenInstalledDevicesSession']['deviceCount'] is None: - raise MockFunctionCallError("niModInst_OpenInstalledDevicesSession", param='deviceCount') + if self._defaults["OpenInstalledDevicesSession"]["deviceCount"] is None: + raise MockFunctionCallError( + "niModInst_OpenInstalledDevicesSession", param="deviceCount" + ) if device_count is not None: - device_count.contents.value = self._defaults['OpenInstalledDevicesSession']['deviceCount'] - return self._defaults['OpenInstalledDevicesSession']['return'] + device_count.contents.value = self._defaults["OpenInstalledDevicesSession"][ + "deviceCount" + ] + return self._defaults["OpenInstalledDevicesSession"]["return"] # Helper function to setup Mock object with default side effects and return values def set_side_effects_and_return_values(self, mock_library): - mock_library.niModInst_CloseInstalledDevicesSession.side_effect = MockFunctionCallError("niModInst_CloseInstalledDevicesSession") + mock_library.niModInst_CloseInstalledDevicesSession.side_effect = ( + MockFunctionCallError("niModInst_CloseInstalledDevicesSession") + ) mock_library.niModInst_CloseInstalledDevicesSession.return_value = 0 - mock_library.niModInst_GetExtendedErrorInfo.side_effect = MockFunctionCallError("niModInst_GetExtendedErrorInfo") + mock_library.niModInst_GetExtendedErrorInfo.side_effect = MockFunctionCallError( + "niModInst_GetExtendedErrorInfo" + ) mock_library.niModInst_GetExtendedErrorInfo.return_value = 0 - mock_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = MockFunctionCallError("niModInst_GetInstalledDeviceAttributeViInt32") + mock_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = ( + MockFunctionCallError("niModInst_GetInstalledDeviceAttributeViInt32") + ) mock_library.niModInst_GetInstalledDeviceAttributeViInt32.return_value = 0 - mock_library.niModInst_GetInstalledDeviceAttributeViString.side_effect = MockFunctionCallError("niModInst_GetInstalledDeviceAttributeViString") + mock_library.niModInst_GetInstalledDeviceAttributeViString.side_effect = ( + MockFunctionCallError("niModInst_GetInstalledDeviceAttributeViString") + ) mock_library.niModInst_GetInstalledDeviceAttributeViString.return_value = 0 - mock_library.niModInst_OpenInstalledDevicesSession.side_effect = MockFunctionCallError("niModInst_OpenInstalledDevicesSession") + mock_library.niModInst_OpenInstalledDevicesSession.side_effect = ( + MockFunctionCallError("niModInst_OpenInstalledDevicesSession") + ) mock_library.niModInst_OpenInstalledDevicesSession.return_value = 0 diff --git a/generated/nimodinst/nimodinst/unit_tests/test_modinst.py b/generated/nimodinst/nimodinst/unit_tests/test_modinst.py index 92f3bea51..60424d545 100644 --- a/generated/nimodinst/nimodinst/unit_tests/test_modinst.py +++ b/generated/nimodinst/nimodinst/unit_tests/test_modinst.py @@ -11,19 +11,34 @@ class TestSession(object): def setup_method(self, method): - self.patched_library_patcher = patch('nimodinst._library.Library', autospec=True) + self.patched_library_patcher = patch( + "nimodinst._library.Library", autospec=True + ) self.patched_library = self.patched_library_patcher.start() - self.patched_library_singleton_get = patch('nimodinst.session._library_singleton.get', return_value=self.patched_library) + self.patched_library_singleton_get = patch( + "nimodinst.session._library_singleton.get", + return_value=self.patched_library, + ) self.patched_library_singleton_get.start() self.side_effects_helper = _mock_helper.SideEffectsHelper() - self.side_effects_helper.set_side_effects_and_return_values(self.patched_library) - self.patched_library.niModInst_OpenInstalledDevicesSession.side_effect = self.side_effects_helper.niModInst_OpenInstalledDevicesSession - self.disallow_close = self.patched_library.niModInst_CloseInstalledDevicesSession.side_effect - self.patched_library.niModInst_CloseInstalledDevicesSession.side_effect = self.side_effects_helper.niModInst_CloseInstalledDevicesSession - - self.side_effects_helper['OpenInstalledDevicesSession']['handle'] = SESSION_NUM_FOR_TEST - self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = 1 + self.side_effects_helper.set_side_effects_and_return_values( + self.patched_library + ) + self.patched_library.niModInst_OpenInstalledDevicesSession.side_effect = ( + self.side_effects_helper.niModInst_OpenInstalledDevicesSession + ) + self.disallow_close = ( + self.patched_library.niModInst_CloseInstalledDevicesSession.side_effect + ) + self.patched_library.niModInst_CloseInstalledDevicesSession.side_effect = ( + self.side_effects_helper.niModInst_CloseInstalledDevicesSession + ) + + self.side_effects_helper["OpenInstalledDevicesSession"][ + "handle" + ] = SESSION_NUM_FOR_TEST + self.side_effects_helper["OpenInstalledDevicesSession"]["deviceCount"] = 1 self.iteration_device_looping = 0 self.num_int_devices_looping = 3 @@ -36,44 +51,66 @@ def teardown_method(self, method): self.patched_library_patcher.stop() # Helper function for mocking multiple devices - def niModInst_GetInstalledDeviceAttributeViString_looping(self, handle, index, attribute_id, attribute_value_buffer_size, attribute_value): # noqa: N802 + def niModInst_GetInstalledDeviceAttributeViString_looping( + self, handle, index, attribute_id, attribute_value_buffer_size, attribute_value + ): # noqa: N802 if attribute_value_buffer_size.value == 0: # TODO(marcoskirsch): What about the byte for the NULL character? Issue #526 - return (len(self.string_vals_device_looping[self.iteration_device_looping])) - bytes_to_copy = self.string_vals_device_looping[self.iteration_device_looping].encode('ascii') + return len(self.string_vals_device_looping[self.iteration_device_looping]) + bytes_to_copy = self.string_vals_device_looping[ + self.iteration_device_looping + ].encode("ascii") for i in range(0, len(bytes_to_copy)): attribute_value[i] = bytes_to_copy[i] self.iteration_device_looping += 1 return 0 # Helper function for mocking multiple devices - def niModInst_GetInstalledDeviceAttributeViInt32_looping(self, handle, index, attribute_id, attribute_value): # noqa: N802 - attribute_value.contents.value = self.int_vals_device_looping[self.iteration_device_looping] + def niModInst_GetInstalledDeviceAttributeViInt32_looping( + self, handle, index, attribute_id, attribute_value + ): # noqa: N802 + attribute_value.contents.value = self.int_vals_device_looping[ + self.iteration_device_looping + ] self.iteration_device_looping += 1 return 0 # API Tests def test_open_and_close(self): - session = nimodinst.Session('') - self.patched_library.niModInst_OpenInstalledDevicesSession.assert_called_once_with(_matchers.ViStringMatcher(''), _matchers.ViSessionPointerMatcher(), _matchers.ViInt32PointerMatcher()) + session = nimodinst.Session("") + self.patched_library.niModInst_OpenInstalledDevicesSession.assert_called_once_with( + _matchers.ViStringMatcher(""), + _matchers.ViSessionPointerMatcher(), + _matchers.ViInt32PointerMatcher(), + ) session.close() - self.patched_library.niModInst_CloseInstalledDevicesSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) + self.patched_library.niModInst_CloseInstalledDevicesSession.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) + ) def test_close(self): - session = nimodinst.Session('') + session = nimodinst.Session("") session.close() - self.patched_library.niModInst_CloseInstalledDevicesSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) + self.patched_library.niModInst_CloseInstalledDevicesSession.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) + ) def test_context_manager(self): - with nimodinst.Session('') as session: + with nimodinst.Session("") as session: assert type(session) == nimodinst.Session - self.patched_library.niModInst_OpenInstalledDevicesSession.assert_called_once_with(_matchers.ViStringMatcher(''), _matchers.ViSessionPointerMatcher(), _matchers.ViInt32PointerMatcher()) - self.patched_library.niModInst_CloseInstalledDevicesSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) + self.patched_library.niModInst_OpenInstalledDevicesSession.assert_called_once_with( + _matchers.ViStringMatcher(""), + _matchers.ViSessionPointerMatcher(), + _matchers.ViInt32PointerMatcher(), + ) + self.patched_library.niModInst_CloseInstalledDevicesSession.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) + ) def test_iterating_for(self): - self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = 2 - with nimodinst.Session('') as session: + self.side_effects_helper["OpenInstalledDevicesSession"]["deviceCount"] = 2 + with nimodinst.Session("") as session: assert len(session) == 2 count = 0 for d in session: @@ -81,8 +118,8 @@ def test_iterating_for(self): assert count == len(session) def test_iterating_for_empty(self): - self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = 0 - with nimodinst.Session('') as session: + self.side_effects_helper["OpenInstalledDevicesSession"]["deviceCount"] = 0 + with nimodinst.Session("") as session: assert len(session) == 0 count = 0 for d in session: @@ -90,60 +127,90 @@ def test_iterating_for_empty(self): assert count == len(session) def test_get_extended_error_info(self): - error_string = 'Error' - self.patched_library.niModInst_GetExtendedErrorInfo.side_effect = self.side_effects_helper.niModInst_GetExtendedErrorInfo - self.side_effects_helper['GetExtendedErrorInfo']['errorInfo'] = error_string - with nimodinst.Session('') as session: + error_string = "Error" + self.patched_library.niModInst_GetExtendedErrorInfo.side_effect = ( + self.side_effects_helper.niModInst_GetExtendedErrorInfo + ) + self.side_effects_helper["GetExtendedErrorInfo"]["errorInfo"] = error_string + with nimodinst.Session("") as session: # Calling the private function directly, as _get_extended_error_info() functions differently than other IVI Dance functions. # As a result, it cannot be used directly during error handling. result = session._get_extended_error_info() assert result == error_string def test_get_error_description_fails(self): - self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 - self.side_effects_helper['GetInstalledDeviceAttributeViInt32']['return'] = -1 - self.patched_library.niModInst_GetExtendedErrorInfo.side_effect = self.side_effects_helper.niModInst_GetExtendedErrorInfo - self.side_effects_helper['GetExtendedErrorInfo']['return'] = -2 - with nimodinst.Session('') as session: + self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = ( + self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 + ) + self.side_effects_helper["GetInstalledDeviceAttributeViInt32"]["return"] = -1 + self.patched_library.niModInst_GetExtendedErrorInfo.side_effect = ( + self.side_effects_helper.niModInst_GetExtendedErrorInfo + ) + self.side_effects_helper["GetExtendedErrorInfo"]["return"] = -2 + with nimodinst.Session("") as session: try: session.devices[0].chassis_number except nimodinst.Error as e: - assert e.code == -1 # we want the original error code from getting the attribute. + assert ( + e.code == -1 + ) # we want the original error code from getting the attribute. assert e.description == "Failed to retrieve error description." def test_get_attribute_session(self): val = 123 - self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = 1 - self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 - self.side_effects_helper['GetInstalledDeviceAttributeViInt32']['attributeValue'] = val - with nimodinst.Session('') as session: + self.side_effects_helper["OpenInstalledDevicesSession"]["deviceCount"] = 1 + self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = ( + self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 + ) + self.side_effects_helper["GetInstalledDeviceAttributeViInt32"][ + "attributeValue" + ] = val + with nimodinst.Session("") as session: attr_int = session.devices[0].chassis_number - assert(attr_int == val) + assert attr_int == val def test_get_attribute_vi_int32_for_loop_index(self): - self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = self.niModInst_GetInstalledDeviceAttributeViInt32_looping - self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = self.num_int_devices_looping + self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = ( + self.niModInst_GetInstalledDeviceAttributeViInt32_looping + ) + self.side_effects_helper["OpenInstalledDevicesSession"][ + "deviceCount" + ] = self.num_int_devices_looping index = 0 - with nimodinst.Session('') as session: + with nimodinst.Session("") as session: attr_int = session.devices[index].chassis_number index += 1 - assert(attr_int == self.int_vals_device_looping[self.iteration_device_looping - 1]) # Have to subtract once since it was already incremented in the callback function + assert ( + attr_int + == self.int_vals_device_looping[self.iteration_device_looping - 1] + ) # Have to subtract once since it was already incremented in the callback function def test_get_attribute_vi_string_for_loop_index(self): - self.patched_library.niModInst_GetInstalledDeviceAttributeViString.side_effect = self.niModInst_GetInstalledDeviceAttributeViString_looping - self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = self.num_string_devices_looping + self.patched_library.niModInst_GetInstalledDeviceAttributeViString.side_effect = ( + self.niModInst_GetInstalledDeviceAttributeViString_looping + ) + self.side_effects_helper["OpenInstalledDevicesSession"][ + "deviceCount" + ] = self.num_string_devices_looping index = 0 - with nimodinst.Session('') as session: + with nimodinst.Session("") as session: attr_int = session.devices[index].device_name index += 1 - assert(attr_int == self.string_vals_device_looping[self.iteration_device_looping - 1]) # Have to subtract once since it was already incremented in the callback function + assert ( + attr_int + == self.string_vals_device_looping[self.iteration_device_looping - 1] + ) # Have to subtract once since it was already incremented in the callback function def test_get_attribute_session_no_index(self): val = 123 - self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = 1 - self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 - self.side_effects_helper['GetInstalledDeviceAttributeViInt32']['attributeValue'] = val - with nimodinst.Session('') as session: + self.side_effects_helper["OpenInstalledDevicesSession"]["deviceCount"] = 1 + self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = ( + self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 + ) + self.side_effects_helper["GetInstalledDeviceAttributeViInt32"][ + "attributeValue" + ] = val + with nimodinst.Session("") as session: try: session.chassis_number assert False @@ -151,24 +218,40 @@ def test_get_attribute_session_no_index(self): assert str(e) == "'Session' object has no attribute 'chassis_number'" def test_get_attribute_vi_int32_for_loop_multiple_devices(self): - self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = self.niModInst_GetInstalledDeviceAttributeViInt32_looping - self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = self.num_int_devices_looping - with nimodinst.Session('') as session: + self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = ( + self.niModInst_GetInstalledDeviceAttributeViInt32_looping + ) + self.side_effects_helper["OpenInstalledDevicesSession"][ + "deviceCount" + ] = self.num_int_devices_looping + with nimodinst.Session("") as session: for d in session: attr_int = d.chassis_number - assert(attr_int == self.int_vals_device_looping[self.iteration_device_looping - 1]) # Have to subtract once since it was already incremented in the callback function + assert ( + attr_int + == self.int_vals_device_looping[self.iteration_device_looping - 1] + ) # Have to subtract once since it was already incremented in the callback function def test_get_attribute_vi_string_for_loop_multiple_devices(self): - self.patched_library.niModInst_GetInstalledDeviceAttributeViString.side_effect = self.niModInst_GetInstalledDeviceAttributeViString_looping - self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = self.num_string_devices_looping - with nimodinst.Session('') as session: + self.patched_library.niModInst_GetInstalledDeviceAttributeViString.side_effect = ( + self.niModInst_GetInstalledDeviceAttributeViString_looping + ) + self.side_effects_helper["OpenInstalledDevicesSession"][ + "deviceCount" + ] = self.num_string_devices_looping + with nimodinst.Session("") as session: for d in session: attr_int = d.device_name - assert(attr_int == self.string_vals_device_looping[self.iteration_device_looping - 1]) # Have to subtract once since it was already incremented in the callback function + assert ( + attr_int + == self.string_vals_device_looping[ + self.iteration_device_looping - 1 + ] + ) # Have to subtract once since it was already incremented in the callback function # Error Tests def test_cannot_add_properties_to_session_set(self): - with nimodinst.Session('') as session: + with nimodinst.Session("") as session: try: session.non_existent_property = 5 assert False @@ -176,15 +259,18 @@ def test_cannot_add_properties_to_session_set(self): assert str(e) == "__setattr__ not supported." def test_cannot_add_properties_to_session_get(self): - with nimodinst.Session('') as session: + with nimodinst.Session("") as session: try: session.non_existent_property assert False except AttributeError as e: - assert str(e) == "'Session' object has no attribute 'non_existent_property'" + assert ( + str(e) + == "'Session' object has no attribute 'non_existent_property'" + ) def test_cannot_add_properties_to_device_set(self): - with nimodinst.Session('') as session: + with nimodinst.Session("") as session: try: session.devices[0].non_existent_property = 5 assert False @@ -192,16 +278,19 @@ def test_cannot_add_properties_to_device_set(self): assert str(e) == "__setattr__ not supported." def test_cannot_add_properties_to_device_get(self): - with nimodinst.Session('') as session: + with nimodinst.Session("") as session: try: session.devices[0].non_existent_property assert False except AttributeError as e: - assert str(e) == "'_Device' object has no attribute 'non_existent_property'" + assert ( + str(e) + == "'_Device' object has no attribute 'non_existent_property'" + ) def test_vi_int32_attribute_read_only(self): - self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = 1 - with nimodinst.Session('') as session: + self.side_effects_helper["OpenInstalledDevicesSession"]["deviceCount"] = 1 + with nimodinst.Session("") as session: try: session.devices[0].chassis_number = 5 assert False @@ -209,8 +298,8 @@ def test_vi_int32_attribute_read_only(self): assert str(e) == "__setattr__ not supported." def test_vi_string_attribute_read_only(self): - self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = 1 - with nimodinst.Session('') as session: + self.side_effects_helper["OpenInstalledDevicesSession"]["deviceCount"] = 1 + with nimodinst.Session("") as session: try: session.devices[0].device_name = "Not Possible" assert False @@ -219,13 +308,21 @@ def test_vi_string_attribute_read_only(self): def test_int_attribute_error(self): error_code = -1234 - error_string = 'Error' - self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 - self.side_effects_helper['GetInstalledDeviceAttributeViInt32']['attributeValue'] = -1 - self.side_effects_helper['GetInstalledDeviceAttributeViInt32']['return'] = error_code - self.patched_library.niModInst_GetExtendedErrorInfo.side_effect = self.side_effects_helper.niModInst_GetExtendedErrorInfo - self.side_effects_helper['GetExtendedErrorInfo']['errorInfo'] = error_string - with nimodinst.Session('') as session: + error_string = "Error" + self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = ( + self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 + ) + self.side_effects_helper["GetInstalledDeviceAttributeViInt32"][ + "attributeValue" + ] = -1 + self.side_effects_helper["GetInstalledDeviceAttributeViInt32"][ + "return" + ] = error_code + self.patched_library.niModInst_GetExtendedErrorInfo.side_effect = ( + self.side_effects_helper.niModInst_GetExtendedErrorInfo + ) + self.side_effects_helper["GetExtendedErrorInfo"]["errorInfo"] = error_string + with nimodinst.Session("") as session: try: session.devices[0].chassis_number assert False @@ -235,13 +332,21 @@ def test_int_attribute_error(self): def test_int_attribute_warning(self): warning_code = 1234 - error_string = 'Error' - self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 - self.side_effects_helper['GetInstalledDeviceAttributeViInt32']['attributeValue'] = -1 - self.side_effects_helper['GetInstalledDeviceAttributeViInt32']['return'] = warning_code - self.patched_library.niModInst_GetExtendedErrorInfo.side_effect = self.side_effects_helper.niModInst_GetExtendedErrorInfo - self.side_effects_helper['GetExtendedErrorInfo']['errorInfo'] = error_string - with nimodinst.Session('') as session: + error_string = "Error" + self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = ( + self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 + ) + self.side_effects_helper["GetInstalledDeviceAttributeViInt32"][ + "attributeValue" + ] = -1 + self.side_effects_helper["GetInstalledDeviceAttributeViInt32"][ + "return" + ] = warning_code + self.patched_library.niModInst_GetExtendedErrorInfo.side_effect = ( + self.side_effects_helper.niModInst_GetExtendedErrorInfo + ) + self.side_effects_helper["GetExtendedErrorInfo"]["errorInfo"] = error_string + with nimodinst.Session("") as session: with warnings.catch_warnings(record=True) as w: session.devices[0].chassis_number assert len(w) == 1 @@ -249,12 +354,20 @@ def test_int_attribute_warning(self): assert error_string in str(w[0].message) def test_repr_and_str(self): - self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 - self.patched_library.niModInst_GetInstalledDeviceAttributeViString.side_effect = self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViString - self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = 2 - self.side_effects_helper['GetInstalledDeviceAttributeViInt32']['attributeValue'] = 42 - self.side_effects_helper['GetInstalledDeviceAttributeViString']['attributeValue'] = 'fourty two' - with nimodinst.Session('') as session: + self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = ( + self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 + ) + self.patched_library.niModInst_GetInstalledDeviceAttributeViString.side_effect = ( + self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViString + ) + self.side_effects_helper["OpenInstalledDevicesSession"]["deviceCount"] = 2 + self.side_effects_helper["GetInstalledDeviceAttributeViInt32"][ + "attributeValue" + ] = 42 + self.side_effects_helper["GetInstalledDeviceAttributeViString"][ + "attributeValue" + ] = "fourty two" + with nimodinst.Session("") as session: session print(session) for d in session: diff --git a/generated/nimodinst/setup.py b/generated/nimodinst/setup.py index 36e8d21f7..7e1c2d8d7 100644 --- a/generated/nimodinst/setup.py +++ b/generated/nimodinst/setup.py @@ -15,41 +15,44 @@ def finalize_options(self): def run_tests(self): import pytest + pytest.main(self.test_args) -pypi_name = 'nimodinst' +pypi_name = "nimodinst" def read_contents(file_to_read): - with open(file_to_read, 'r') as f: + with open(file_to_read, "r") as f: return f.read() setup( name=pypi_name, zip_safe=True, - version='1.4.2.dev0', - description='NI-ModInst Python API', - long_description=read_contents('README.rst'), - long_description_content_type='text/x-rst', - author='NI', + version="1.4.2.dev0", + description="NI-ModInst Python API", + long_description=read_contents("README.rst"), + long_description_content_type="text/x-rst", + author="NI", author_email="opensource@ni.com", url="https://github.com/ni/nimi-python", maintainer="NI", maintainer_email="opensource@ni.com", - keywords=['nimodinst'], - license='MIT', + keywords=["nimodinst"], + license="MIT", include_package_data=True, - packages=['nimodinst'], + packages=["nimodinst"], install_requires=[ 'enum34;python_version<"3.4"', 'singledispatch;python_version<"3.4"', - 'hightime>=0.2.0', + "hightime>=0.2.0", + ], + setup_requires=[ + "pytest-runner", ], - setup_requires=['pytest-runner', ], - tests_require=['pytest'], - test_suite='tests', + tests_require=["pytest"], + test_suite="tests", classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -64,8 +67,8 @@ def read_contents(file_to_read): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", - "Topic :: System :: Hardware :: Hardware Drivers" + "Topic :: System :: Hardware :: Hardware Drivers", ], - cmdclass={'test': PyTest}, - package_data={pypi_name: ['VERSION']}, + cmdclass={"test": PyTest}, + package_data={pypi_name: ["VERSION"]}, ) diff --git a/generated/niscope/niscope/__init__.py b/generated/niscope/niscope/__init__.py index cb3b1a12e..bcc8677f0 100644 --- a/generated/niscope/niscope/__init__.py +++ b/generated/niscope/niscope/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = '1.4.2.dev0' +__version__ = "1.4.2.dev0" from niscope.enums import * # noqa: F403,F401,H303 from niscope.errors import DriverWarning # noqa: F401 @@ -17,12 +17,12 @@ def get_diagnostic_information(): - '''Get diagnostic information about the system state that is suitable for printing or logging + """Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - ''' + """ import os import pkg_resources import platform @@ -30,73 +30,80 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return (struct.calcsize("P") == 8) + return struct.calcsize("P") == 8 def is_os_64bit(): - return platform.machine().endswith('64') + return platform.machine().endswith("64") def is_venv(): - return 'VIRTUAL_ENV' in os.environ + return "VIRTUAL_ENV" in os.environ info = {} - info['os'] = {} - info['python'] = {} - info['driver'] = {} - info['module'] = {} - if platform.system() == 'Windows': + info["os"] = {} + info["python"] = {} + info["driver"] = {} + info["module"] = {} + if platform.system() == "Windows": try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = 'Windows' + os_name = "Windows" try: - driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-SCOPE\CurrentVersion") + driver_version_key = winreg.OpenKey( + winreg.HKEY_LOCAL_MACHINE, + r"SOFTWARE\National Instruments\NI-SCOPE\CurrentVersion", + ) driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = 'Unknown' - elif platform.system() == 'Linux': - os_name = 'Linux' - driver_version = 'Unknown' + driver_version = "Unknown" + elif platform.system() == "Linux": + os_name = "Linux" + driver_version = "Unknown" else: - raise SystemError('Unsupported platform: {}'.format(platform.system())) + raise SystemError("Unsupported platform: {}".format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] - - info['os']['name'] = os_name - info['os']['version'] = platform.version() - info['os']['bits'] = '64' if is_os_64bit() else '32' - info['driver']['name'] = "NI-SCOPE" - info['driver']['version'] = driver_version - info['module']['name'] = 'niscope' - info['module']['version'] = "1.4.2.dev0" - info['python']['version'] = sys.version - info['python']['bits'] = '64' if is_python_64bit() else '32' - info['python']['is_venv'] = is_venv() - info['python']['packages'] = installed_packages_list + installed_packages_list = [ + { + "name": i.key, + "version": i.version, + } + for i in installed_packages + ] + + info["os"]["name"] = os_name + info["os"]["version"] = platform.version() + info["os"]["bits"] = "64" if is_os_64bit() else "32" + info["driver"]["name"] = "NI-SCOPE" + info["driver"]["version"] = driver_version + info["module"]["name"] = "niscope" + info["module"]["version"] = "1.4.2.dev0" + info["python"]["version"] = sys.version + info["python"]["bits"] = "64" if is_python_64bit() else "32" + info["python"]["is_venv"] = is_venv() + info["python"]["packages"] = installed_packages_list return info def print_diagnostic_information(): - '''Print diagnostic information in a format suitable for issue report + """Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - ''' + """ info = get_diagnostic_information() - row_format = ' {:<10} {}' - for type in ['OS', 'Driver', 'Module', 'Python']: + row_format = " {:<10} {}" + for type in ["OS", "Driver", "Module", "Python"]: typename = type.lower() - print(type + ':') + print(type + ":") for item in info[typename]: - if item != 'packages': - print(row_format.format(item.title() + ':', info[typename][item])) - print(' Installed Packages:') - for p in info['python']['packages']: - print((' ' * 8) + p['name'] + '==' + p['version']) + if item != "packages": + print(row_format.format(item.title() + ":", info[typename][item])) + print(" Installed Packages:") + for p in info["python"]["packages"]: + print((" " * 8) + p["name"] + "==" + p["version"]) return info - - diff --git a/generated/niscope/niscope/_attributes.py b/generated/niscope/niscope/_attributes.py index 4647d930d..d1522c6ef 100644 --- a/generated/niscope/niscope/_attributes.py +++ b/generated/niscope/niscope/_attributes.py @@ -6,14 +6,13 @@ class Attribute(object): - '''Base class for all typed attributes.''' + """Base class for all typed attributes.""" def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -22,16 +21,19 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) + return hightime.timedelta( + milliseconds=session._get_attribute_vi_int32(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) + session._set_attribute_vi_int32( + self._attribute_id, + _converters.convert_timedelta_to_milliseconds_int32(value).value, + ) class AttributeViInt64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -40,7 +42,6 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -49,16 +50,19 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) + return hightime.timedelta( + seconds=session._get_attribute_vi_real64(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) + session._set_attribute_vi_real64( + self._attribute_id, + _converters.convert_timedelta_to_seconds_real64(value).value, + ) class AttributeViString(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -67,16 +71,17 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) + session._set_attribute_vi_string( + self._attribute_id, + _converters.convert_repeated_capabilities_without_prefix(value), + ) class AttributeViBoolean(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -85,31 +90,36 @@ def __set__(self, session, value): class AttributeEnum(object): - def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) + return self._attribute_type( + self._underlying_attribute.__get__(session, session_type) + ) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) + raise TypeError( + "must be " + + str(self._attribute_type.__name__) + + " not " + + str(type(value).__name__) + ) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): - def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from niscope.session import SessionReference + return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) - - - + session._set_attribute_vi_session( + self._attribute_id, _converters.convert_to_nitclk_session_number(value) + ) diff --git a/generated/niscope/niscope/_converters.py b/generated/niscope/niscope/_converters.py index 223d8e26b..8839d84e2 100644 --- a/generated/niscope/niscope/_converters.py +++ b/generated/niscope/niscope/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - '''Base version that should not be called + """Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,36 +40,38 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - ''' - raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + """ + raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - '''Integer version''' + """Integer version""" return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - '''String version (this is the most complex) + """String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - ''' + """ # First we deal with a list - rep_cap_list = repeated_capability.split(',') + rep_cap_list = repeated_capability.split(",") if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, '').replace(':', '-') - rc = r.split('-') + r = repeated_capability.strip().replace(prefix, "").replace(":", "-") + rc = r.split("-") if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + raise errors.InvalidRepeatedCapabilityError( + "Multiple '-' or ':'", repeated_capability + ) try: start = int(rc[0]) end = int(rc[1]) @@ -85,7 +87,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, '').strip()] + return [repeated_capability.replace(prefix, "").strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -94,7 +96,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - '''Iterable version - can handle lists, ranges, and tuples''' + """Iterable version - can handle lists, ranges, and tuples""" rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -103,16 +105,22 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - '''slice version''' + """slice version""" + def ifnone(a, b): return b if a is None else a + # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) + rng = range( + ifnone(repeated_capability.start, 0), + repeated_capability.stop, + ifnone(repeated_capability.step, 1), + ) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=''): - '''Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=""): + """Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -120,15 +128,17 @@ def convert_repeated_capabilities(repeated_capability, prefix=''): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - ''' + """ # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] + return [ + prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) + ] def convert_repeated_capabilities_without_prefix(repeated_capability): - '''Convert a repeated capabilities object, without any prefix, to a comma delimited list + """Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -144,8 +154,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - ''' - return ','.join(convert_repeated_capabilities(repeated_capability, '')) + """ + return ",".join(convert_repeated_capabilities(repeated_capability, "")) def _convert_timedelta(value, library_type, scaling): @@ -158,7 +168,14 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: + if library_type in [ + _visatype.ViInt64, + _visatype.ViInt32, + _visatype.ViUInt32, + _visatype.ViInt16, + _visatype.ViUInt16, + _visatype.ViInt8, + ]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -195,34 +212,36 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - 'rangecheck': 'RangeCheck', - 'queryinstrstatus': 'QueryInstrStatus', - 'cache': 'Cache', - 'simulate': 'Simulate', - 'recordcoercions': 'RecordCoercions', - 'interchangecheck': 'InterchangeCheck', - 'driversetup': 'DriverSetup', - 'range_check': 'RangeCheck', - 'query_instr_status': 'QueryInstrStatus', - 'record_coercions': 'RecordCoercions', - 'interchange_check': 'InterchangeCheck', - 'driver_setup': 'DriverSetup', + "rangecheck": "RangeCheck", + "queryinstrstatus": "QueryInstrStatus", + "cache": "Cache", + "simulate": "Simulate", + "recordcoercions": "RecordCoercions", + "interchangecheck": "InterchangeCheck", + "driversetup": "DriverSetup", + "range_check": "RangeCheck", + "query_instr_status": "QueryInstrStatus", + "record_coercions": "RecordCoercions", + "interchange_check": "InterchangeCheck", + "driver_setup": "DriverSetup", } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': - value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') - elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': + if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": + value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") + elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": if not isinstance(values[k], dict): - raise TypeError('DriverSetup must be a dictionary') - value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) + raise TypeError("DriverSetup must be a dictionary") + value = "DriverSetup=" + ( + ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) + ) else: - value = k + ('=1' if values[k] is True else '=0') + value = k + ("=1" if values[k] is True else "=0") init_with_options.append(value) - init_with_options_string = ','.join(init_with_options) + init_with_options_string = ",".join(init_with_options) return init_with_options_string @@ -251,11 +270,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(',')] + return [x.strip() for x in comma_separated_string.split(",")] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -267,11 +286,17 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - ''' - chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) - repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] + """ + chained_repeated_capability_items = convert_comma_separated_string_to_list( + chained_repeated_capability + ) + repeated_capability_lists = [ + [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) + ] for item in chained_repeated_capability_items: - repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] - return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] - - + repeated_capability_lists = [ + x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) + ] + return [ + ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists + ] diff --git a/generated/niscope/niscope/_library.py b/generated/niscope/niscope/_library.py index 54b93fcdb..2a6dd4a82 100644 --- a/generated/niscope/niscope/_library.py +++ b/generated/niscope/niscope/_library.py @@ -13,11 +13,11 @@ class Library(object): - '''Library + """Library Wrapper around driver library. Class will setup the correct ctypes information for every function on first call. - ''' + """ def __init__(self, ctypes_library): self._func_lock = threading.Lock() @@ -95,7 +95,7 @@ def _get_library_function(self, name): def niScope_Abort(self, vi): # noqa: N802 with self._func_lock: if self.niScope_Abort_cfunc is None: - self.niScope_Abort_cfunc = self._get_library_function('niScope_Abort') + self.niScope_Abort_cfunc = self._get_library_function("niScope_Abort") self.niScope_Abort_cfunc.argtypes = [ViSession] # noqa: F405 self.niScope_Abort_cfunc.restype = ViStatus # noqa: F405 return self.niScope_Abort_cfunc(vi) @@ -103,39 +103,72 @@ def niScope_Abort(self, vi): # noqa: N802 def niScope_AcquisitionStatus(self, vi, acquisition_status): # noqa: N802 with self._func_lock: if self.niScope_AcquisitionStatus_cfunc is None: - self.niScope_AcquisitionStatus_cfunc = self._get_library_function('niScope_AcquisitionStatus') - self.niScope_AcquisitionStatus_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32)] # noqa: F405 + self.niScope_AcquisitionStatus_cfunc = self._get_library_function( + "niScope_AcquisitionStatus" + ) + self.niScope_AcquisitionStatus_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niScope_AcquisitionStatus_cfunc.restype = ViStatus # noqa: F405 return self.niScope_AcquisitionStatus_cfunc(vi, acquisition_status) - def niScope_ActualMeasWfmSize(self, vi, array_meas_function, meas_waveform_size): # noqa: N802 + def niScope_ActualMeasWfmSize( + self, vi, array_meas_function, meas_waveform_size + ): # noqa: N802 with self._func_lock: if self.niScope_ActualMeasWfmSize_cfunc is None: - self.niScope_ActualMeasWfmSize_cfunc = self._get_library_function('niScope_ActualMeasWfmSize') - self.niScope_ActualMeasWfmSize_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt32)] # noqa: F405 + self.niScope_ActualMeasWfmSize_cfunc = self._get_library_function( + "niScope_ActualMeasWfmSize" + ) + self.niScope_ActualMeasWfmSize_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niScope_ActualMeasWfmSize_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_ActualMeasWfmSize_cfunc(vi, array_meas_function, meas_waveform_size) + return self.niScope_ActualMeasWfmSize_cfunc( + vi, array_meas_function, meas_waveform_size + ) def niScope_ActualNumWfms(self, vi, channel_list, num_wfms): # noqa: N802 with self._func_lock: if self.niScope_ActualNumWfms_cfunc is None: - self.niScope_ActualNumWfms_cfunc = self._get_library_function('niScope_ActualNumWfms') - self.niScope_ActualNumWfms_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niScope_ActualNumWfms_cfunc = self._get_library_function( + "niScope_ActualNumWfms" + ) + self.niScope_ActualNumWfms_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niScope_ActualNumWfms_cfunc.restype = ViStatus # noqa: F405 return self.niScope_ActualNumWfms_cfunc(vi, channel_list, num_wfms) - def niScope_AddWaveformProcessing(self, vi, channel_list, meas_function): # noqa: N802 + def niScope_AddWaveformProcessing( + self, vi, channel_list, meas_function + ): # noqa: N802 with self._func_lock: if self.niScope_AddWaveformProcessing_cfunc is None: - self.niScope_AddWaveformProcessing_cfunc = self._get_library_function('niScope_AddWaveformProcessing') - self.niScope_AddWaveformProcessing_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32] # noqa: F405 - self.niScope_AddWaveformProcessing_cfunc.restype = ViStatus # noqa: F405 + self.niScope_AddWaveformProcessing_cfunc = self._get_library_function( + "niScope_AddWaveformProcessing" + ) + self.niScope_AddWaveformProcessing_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ] # noqa: F405 + self.niScope_AddWaveformProcessing_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niScope_AddWaveformProcessing_cfunc(vi, channel_list, meas_function) def niScope_AutoSetup(self, vi): # noqa: N802 with self._func_lock: if self.niScope_AutoSetup_cfunc is None: - self.niScope_AutoSetup_cfunc = self._get_library_function('niScope_AutoSetup') + self.niScope_AutoSetup_cfunc = self._get_library_function( + "niScope_AutoSetup" + ) self.niScope_AutoSetup_cfunc.argtypes = [ViSession] # noqa: F405 self.niScope_AutoSetup_cfunc.restype = ViStatus # noqa: F405 return self.niScope_AutoSetup_cfunc(vi) @@ -143,343 +176,892 @@ def niScope_AutoSetup(self, vi): # noqa: N802 def niScope_CalFetchDate(self, vi, which_one, year, month, day): # noqa: N802 with self._func_lock: if self.niScope_CalFetchDate_cfunc is None: - self.niScope_CalFetchDate_cfunc = self._get_library_function('niScope_CalFetchDate') - self.niScope_CalFetchDate_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niScope_CalFetchDate_cfunc = self._get_library_function( + "niScope_CalFetchDate" + ) + self.niScope_CalFetchDate_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niScope_CalFetchDate_cfunc.restype = ViStatus # noqa: F405 return self.niScope_CalFetchDate_cfunc(vi, which_one, year, month, day) def niScope_CalFetchTemperature(self, vi, which_one, temperature): # noqa: N802 with self._func_lock: if self.niScope_CalFetchTemperature_cfunc is None: - self.niScope_CalFetchTemperature_cfunc = self._get_library_function('niScope_CalFetchTemperature') - self.niScope_CalFetchTemperature_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niScope_CalFetchTemperature_cfunc = self._get_library_function( + "niScope_CalFetchTemperature" + ) + self.niScope_CalFetchTemperature_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niScope_CalFetchTemperature_cfunc.restype = ViStatus # noqa: F405 return self.niScope_CalFetchTemperature_cfunc(vi, which_one, temperature) def niScope_CalSelfCalibrate(self, vi, channel_list, option): # noqa: N802 with self._func_lock: if self.niScope_CalSelfCalibrate_cfunc is None: - self.niScope_CalSelfCalibrate_cfunc = self._get_library_function('niScope_CalSelfCalibrate') - self.niScope_CalSelfCalibrate_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32] # noqa: F405 + self.niScope_CalSelfCalibrate_cfunc = self._get_library_function( + "niScope_CalSelfCalibrate" + ) + self.niScope_CalSelfCalibrate_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ] # noqa: F405 self.niScope_CalSelfCalibrate_cfunc.restype = ViStatus # noqa: F405 return self.niScope_CalSelfCalibrate_cfunc(vi, channel_list, option) - def niScope_ClearWaveformMeasurementStats(self, vi, channel_list, clearable_measurement_function): # noqa: N802 + def niScope_ClearWaveformMeasurementStats( + self, vi, channel_list, clearable_measurement_function + ): # noqa: N802 with self._func_lock: if self.niScope_ClearWaveformMeasurementStats_cfunc is None: - self.niScope_ClearWaveformMeasurementStats_cfunc = self._get_library_function('niScope_ClearWaveformMeasurementStats') - self.niScope_ClearWaveformMeasurementStats_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32] # noqa: F405 - self.niScope_ClearWaveformMeasurementStats_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_ClearWaveformMeasurementStats_cfunc(vi, channel_list, clearable_measurement_function) + self.niScope_ClearWaveformMeasurementStats_cfunc = ( + self._get_library_function("niScope_ClearWaveformMeasurementStats") + ) + self.niScope_ClearWaveformMeasurementStats_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ] # noqa: F405 + self.niScope_ClearWaveformMeasurementStats_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niScope_ClearWaveformMeasurementStats_cfunc( + vi, channel_list, clearable_measurement_function + ) def niScope_ClearWaveformProcessing(self, vi, channel_list): # noqa: N802 with self._func_lock: if self.niScope_ClearWaveformProcessing_cfunc is None: - self.niScope_ClearWaveformProcessing_cfunc = self._get_library_function('niScope_ClearWaveformProcessing') - self.niScope_ClearWaveformProcessing_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 - self.niScope_ClearWaveformProcessing_cfunc.restype = ViStatus # noqa: F405 + self.niScope_ClearWaveformProcessing_cfunc = self._get_library_function( + "niScope_ClearWaveformProcessing" + ) + self.niScope_ClearWaveformProcessing_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niScope_ClearWaveformProcessing_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niScope_ClearWaveformProcessing_cfunc(vi, channel_list) def niScope_Commit(self, vi): # noqa: N802 with self._func_lock: if self.niScope_Commit_cfunc is None: - self.niScope_Commit_cfunc = self._get_library_function('niScope_Commit') + self.niScope_Commit_cfunc = self._get_library_function("niScope_Commit") self.niScope_Commit_cfunc.argtypes = [ViSession] # noqa: F405 self.niScope_Commit_cfunc.restype = ViStatus # noqa: F405 return self.niScope_Commit_cfunc(vi) - def niScope_ConfigureChanCharacteristics(self, vi, channel_list, input_impedance, max_input_frequency): # noqa: N802 + def niScope_ConfigureChanCharacteristics( + self, vi, channel_list, input_impedance, max_input_frequency + ): # noqa: N802 with self._func_lock: if self.niScope_ConfigureChanCharacteristics_cfunc is None: - self.niScope_ConfigureChanCharacteristics_cfunc = self._get_library_function('niScope_ConfigureChanCharacteristics') - self.niScope_ConfigureChanCharacteristics_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViReal64] # noqa: F405 - self.niScope_ConfigureChanCharacteristics_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_ConfigureChanCharacteristics_cfunc(vi, channel_list, input_impedance, max_input_frequency) - - def niScope_ConfigureEqualizationFilterCoefficients(self, vi, channel_list, number_of_coefficients, coefficients): # noqa: N802 + self.niScope_ConfigureChanCharacteristics_cfunc = ( + self._get_library_function("niScope_ConfigureChanCharacteristics") + ) + self.niScope_ConfigureChanCharacteristics_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViReal64, + ViReal64, + ] # noqa: F405 + self.niScope_ConfigureChanCharacteristics_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niScope_ConfigureChanCharacteristics_cfunc( + vi, channel_list, input_impedance, max_input_frequency + ) + + def niScope_ConfigureEqualizationFilterCoefficients( + self, vi, channel_list, number_of_coefficients, coefficients + ): # noqa: N802 with self._func_lock: if self.niScope_ConfigureEqualizationFilterCoefficients_cfunc is None: - self.niScope_ConfigureEqualizationFilterCoefficients_cfunc = self._get_library_function('niScope_ConfigureEqualizationFilterCoefficients') - self.niScope_ConfigureEqualizationFilterCoefficients_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 - self.niScope_ConfigureEqualizationFilterCoefficients_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_ConfigureEqualizationFilterCoefficients_cfunc(vi, channel_list, number_of_coefficients, coefficients) - - def niScope_ConfigureHorizontalTiming(self, vi, min_sample_rate, min_num_pts, ref_position, num_records, enforce_realtime): # noqa: N802 + self.niScope_ConfigureEqualizationFilterCoefficients_cfunc = ( + self._get_library_function( + "niScope_ConfigureEqualizationFilterCoefficients" + ) + ) + self.niScope_ConfigureEqualizationFilterCoefficients_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViReal64), + ] # noqa: F405 + self.niScope_ConfigureEqualizationFilterCoefficients_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niScope_ConfigureEqualizationFilterCoefficients_cfunc( + vi, channel_list, number_of_coefficients, coefficients + ) + + def niScope_ConfigureHorizontalTiming( + self, + vi, + min_sample_rate, + min_num_pts, + ref_position, + num_records, + enforce_realtime, + ): # noqa: N802 with self._func_lock: if self.niScope_ConfigureHorizontalTiming_cfunc is None: - self.niScope_ConfigureHorizontalTiming_cfunc = self._get_library_function('niScope_ConfigureHorizontalTiming') - self.niScope_ConfigureHorizontalTiming_cfunc.argtypes = [ViSession, ViReal64, ViInt32, ViReal64, ViInt32, ViBoolean] # noqa: F405 - self.niScope_ConfigureHorizontalTiming_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_ConfigureHorizontalTiming_cfunc(vi, min_sample_rate, min_num_pts, ref_position, num_records, enforce_realtime) + self.niScope_ConfigureHorizontalTiming_cfunc = ( + self._get_library_function("niScope_ConfigureHorizontalTiming") + ) + self.niScope_ConfigureHorizontalTiming_cfunc.argtypes = [ + ViSession, + ViReal64, + ViInt32, + ViReal64, + ViInt32, + ViBoolean, + ] # noqa: F405 + self.niScope_ConfigureHorizontalTiming_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niScope_ConfigureHorizontalTiming_cfunc( + vi, + min_sample_rate, + min_num_pts, + ref_position, + num_records, + enforce_realtime, + ) def niScope_ConfigureRefLevels(self, vi, low, mid, high): # noqa: N802 with self._func_lock: if self.niScope_ConfigureRefLevels_cfunc is None: - self.niScope_ConfigureRefLevels_cfunc = self._get_library_function('niScope_ConfigureRefLevels') - self.niScope_ConfigureRefLevels_cfunc.argtypes = [ViSession, ViReal64, ViReal64, ViReal64] # noqa: F405 + self.niScope_ConfigureRefLevels_cfunc = self._get_library_function( + "niScope_ConfigureRefLevels" + ) + self.niScope_ConfigureRefLevels_cfunc.argtypes = [ + ViSession, + ViReal64, + ViReal64, + ViReal64, + ] # noqa: F405 self.niScope_ConfigureRefLevels_cfunc.restype = ViStatus # noqa: F405 return self.niScope_ConfigureRefLevels_cfunc(vi, low, mid, high) - def niScope_ConfigureTriggerDigital(self, vi, trigger_source, slope, holdoff, delay): # noqa: N802 + def niScope_ConfigureTriggerDigital( + self, vi, trigger_source, slope, holdoff, delay + ): # noqa: N802 with self._func_lock: if self.niScope_ConfigureTriggerDigital_cfunc is None: - self.niScope_ConfigureTriggerDigital_cfunc = self._get_library_function('niScope_ConfigureTriggerDigital') - self.niScope_ConfigureTriggerDigital_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViReal64, ViReal64] # noqa: F405 - self.niScope_ConfigureTriggerDigital_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_ConfigureTriggerDigital_cfunc(vi, trigger_source, slope, holdoff, delay) - - def niScope_ConfigureTriggerEdge(self, vi, trigger_source, level, slope, trigger_coupling, holdoff, delay): # noqa: N802 + self.niScope_ConfigureTriggerDigital_cfunc = self._get_library_function( + "niScope_ConfigureTriggerDigital" + ) + self.niScope_ConfigureTriggerDigital_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ViReal64, + ViReal64, + ] # noqa: F405 + self.niScope_ConfigureTriggerDigital_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niScope_ConfigureTriggerDigital_cfunc( + vi, trigger_source, slope, holdoff, delay + ) + + def niScope_ConfigureTriggerEdge( + self, vi, trigger_source, level, slope, trigger_coupling, holdoff, delay + ): # noqa: N802 with self._func_lock: if self.niScope_ConfigureTriggerEdge_cfunc is None: - self.niScope_ConfigureTriggerEdge_cfunc = self._get_library_function('niScope_ConfigureTriggerEdge') - self.niScope_ConfigureTriggerEdge_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViInt32, ViInt32, ViReal64, ViReal64] # noqa: F405 + self.niScope_ConfigureTriggerEdge_cfunc = self._get_library_function( + "niScope_ConfigureTriggerEdge" + ) + self.niScope_ConfigureTriggerEdge_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViReal64, + ViInt32, + ViInt32, + ViReal64, + ViReal64, + ] # noqa: F405 self.niScope_ConfigureTriggerEdge_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_ConfigureTriggerEdge_cfunc(vi, trigger_source, level, slope, trigger_coupling, holdoff, delay) - - def niScope_ConfigureTriggerHysteresis(self, vi, trigger_source, level, hysteresis, slope, trigger_coupling, holdoff, delay): # noqa: N802 + return self.niScope_ConfigureTriggerEdge_cfunc( + vi, trigger_source, level, slope, trigger_coupling, holdoff, delay + ) + + def niScope_ConfigureTriggerHysteresis( + self, + vi, + trigger_source, + level, + hysteresis, + slope, + trigger_coupling, + holdoff, + delay, + ): # noqa: N802 with self._func_lock: if self.niScope_ConfigureTriggerHysteresis_cfunc is None: - self.niScope_ConfigureTriggerHysteresis_cfunc = self._get_library_function('niScope_ConfigureTriggerHysteresis') - self.niScope_ConfigureTriggerHysteresis_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViReal64, ViInt32, ViInt32, ViReal64, ViReal64] # noqa: F405 - self.niScope_ConfigureTriggerHysteresis_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_ConfigureTriggerHysteresis_cfunc(vi, trigger_source, level, hysteresis, slope, trigger_coupling, holdoff, delay) + self.niScope_ConfigureTriggerHysteresis_cfunc = ( + self._get_library_function("niScope_ConfigureTriggerHysteresis") + ) + self.niScope_ConfigureTriggerHysteresis_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViReal64, + ViReal64, + ViInt32, + ViInt32, + ViReal64, + ViReal64, + ] # noqa: F405 + self.niScope_ConfigureTriggerHysteresis_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niScope_ConfigureTriggerHysteresis_cfunc( + vi, + trigger_source, + level, + hysteresis, + slope, + trigger_coupling, + holdoff, + delay, + ) def niScope_ConfigureTriggerImmediate(self, vi): # noqa: N802 with self._func_lock: if self.niScope_ConfigureTriggerImmediate_cfunc is None: - self.niScope_ConfigureTriggerImmediate_cfunc = self._get_library_function('niScope_ConfigureTriggerImmediate') - self.niScope_ConfigureTriggerImmediate_cfunc.argtypes = [ViSession] # noqa: F405 - self.niScope_ConfigureTriggerImmediate_cfunc.restype = ViStatus # noqa: F405 + self.niScope_ConfigureTriggerImmediate_cfunc = ( + self._get_library_function("niScope_ConfigureTriggerImmediate") + ) + self.niScope_ConfigureTriggerImmediate_cfunc.argtypes = [ + ViSession + ] # noqa: F405 + self.niScope_ConfigureTriggerImmediate_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niScope_ConfigureTriggerImmediate_cfunc(vi) def niScope_ConfigureTriggerSoftware(self, vi, holdoff, delay): # noqa: N802 with self._func_lock: if self.niScope_ConfigureTriggerSoftware_cfunc is None: - self.niScope_ConfigureTriggerSoftware_cfunc = self._get_library_function('niScope_ConfigureTriggerSoftware') - self.niScope_ConfigureTriggerSoftware_cfunc.argtypes = [ViSession, ViReal64, ViReal64] # noqa: F405 - self.niScope_ConfigureTriggerSoftware_cfunc.restype = ViStatus # noqa: F405 + self.niScope_ConfigureTriggerSoftware_cfunc = ( + self._get_library_function("niScope_ConfigureTriggerSoftware") + ) + self.niScope_ConfigureTriggerSoftware_cfunc.argtypes = [ + ViSession, + ViReal64, + ViReal64, + ] # noqa: F405 + self.niScope_ConfigureTriggerSoftware_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niScope_ConfigureTriggerSoftware_cfunc(vi, holdoff, delay) - def niScope_ConfigureTriggerVideo(self, vi, trigger_source, enable_dc_restore, signal_format, event, line_number, polarity, trigger_coupling, holdoff, delay): # noqa: N802 + def niScope_ConfigureTriggerVideo( + self, + vi, + trigger_source, + enable_dc_restore, + signal_format, + event, + line_number, + polarity, + trigger_coupling, + holdoff, + delay, + ): # noqa: N802 with self._func_lock: if self.niScope_ConfigureTriggerVideo_cfunc is None: - self.niScope_ConfigureTriggerVideo_cfunc = self._get_library_function('niScope_ConfigureTriggerVideo') - self.niScope_ConfigureTriggerVideo_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViBoolean, ViInt32, ViInt32, ViInt32, ViInt32, ViInt32, ViReal64, ViReal64] # noqa: F405 - self.niScope_ConfigureTriggerVideo_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_ConfigureTriggerVideo_cfunc(vi, trigger_source, enable_dc_restore, signal_format, event, line_number, polarity, trigger_coupling, holdoff, delay) - - def niScope_ConfigureTriggerWindow(self, vi, trigger_source, low_level, high_level, window_mode, trigger_coupling, holdoff, delay): # noqa: N802 + self.niScope_ConfigureTriggerVideo_cfunc = self._get_library_function( + "niScope_ConfigureTriggerVideo" + ) + self.niScope_ConfigureTriggerVideo_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViBoolean, + ViInt32, + ViInt32, + ViInt32, + ViInt32, + ViInt32, + ViReal64, + ViReal64, + ] # noqa: F405 + self.niScope_ConfigureTriggerVideo_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niScope_ConfigureTriggerVideo_cfunc( + vi, + trigger_source, + enable_dc_restore, + signal_format, + event, + line_number, + polarity, + trigger_coupling, + holdoff, + delay, + ) + + def niScope_ConfigureTriggerWindow( + self, + vi, + trigger_source, + low_level, + high_level, + window_mode, + trigger_coupling, + holdoff, + delay, + ): # noqa: N802 with self._func_lock: if self.niScope_ConfigureTriggerWindow_cfunc is None: - self.niScope_ConfigureTriggerWindow_cfunc = self._get_library_function('niScope_ConfigureTriggerWindow') - self.niScope_ConfigureTriggerWindow_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViReal64, ViInt32, ViInt32, ViReal64, ViReal64] # noqa: F405 - self.niScope_ConfigureTriggerWindow_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_ConfigureTriggerWindow_cfunc(vi, trigger_source, low_level, high_level, window_mode, trigger_coupling, holdoff, delay) - - def niScope_ConfigureVertical(self, vi, channel_list, range, offset, coupling, probe_attenuation, enabled): # noqa: N802 + self.niScope_ConfigureTriggerWindow_cfunc = self._get_library_function( + "niScope_ConfigureTriggerWindow" + ) + self.niScope_ConfigureTriggerWindow_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViReal64, + ViReal64, + ViInt32, + ViInt32, + ViReal64, + ViReal64, + ] # noqa: F405 + self.niScope_ConfigureTriggerWindow_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niScope_ConfigureTriggerWindow_cfunc( + vi, + trigger_source, + low_level, + high_level, + window_mode, + trigger_coupling, + holdoff, + delay, + ) + + def niScope_ConfigureVertical( + self, vi, channel_list, range, offset, coupling, probe_attenuation, enabled + ): # noqa: N802 with self._func_lock: if self.niScope_ConfigureVertical_cfunc is None: - self.niScope_ConfigureVertical_cfunc = self._get_library_function('niScope_ConfigureVertical') - self.niScope_ConfigureVertical_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViReal64, ViInt32, ViReal64, ViBoolean] # noqa: F405 + self.niScope_ConfigureVertical_cfunc = self._get_library_function( + "niScope_ConfigureVertical" + ) + self.niScope_ConfigureVertical_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViReal64, + ViReal64, + ViInt32, + ViReal64, + ViBoolean, + ] # noqa: F405 self.niScope_ConfigureVertical_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_ConfigureVertical_cfunc(vi, channel_list, range, offset, coupling, probe_attenuation, enabled) + return self.niScope_ConfigureVertical_cfunc( + vi, channel_list, range, offset, coupling, probe_attenuation, enabled + ) def niScope_Disable(self, vi): # noqa: N802 with self._func_lock: if self.niScope_Disable_cfunc is None: - self.niScope_Disable_cfunc = self._get_library_function('niScope_Disable') + self.niScope_Disable_cfunc = self._get_library_function( + "niScope_Disable" + ) self.niScope_Disable_cfunc.argtypes = [ViSession] # noqa: F405 self.niScope_Disable_cfunc.restype = ViStatus # noqa: F405 return self.niScope_Disable_cfunc(vi) - def niScope_ExportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 + def niScope_ExportAttributeConfigurationBuffer( + self, vi, size_in_bytes, configuration + ): # noqa: N802 with self._func_lock: if self.niScope_ExportAttributeConfigurationBuffer_cfunc is None: - self.niScope_ExportAttributeConfigurationBuffer_cfunc = self._get_library_function('niScope_ExportAttributeConfigurationBuffer') - self.niScope_ExportAttributeConfigurationBuffer_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt8)] # noqa: F405 - self.niScope_ExportAttributeConfigurationBuffer_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_ExportAttributeConfigurationBuffer_cfunc(vi, size_in_bytes, configuration) + self.niScope_ExportAttributeConfigurationBuffer_cfunc = ( + self._get_library_function( + "niScope_ExportAttributeConfigurationBuffer" + ) + ) + self.niScope_ExportAttributeConfigurationBuffer_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViInt8), + ] # noqa: F405 + self.niScope_ExportAttributeConfigurationBuffer_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niScope_ExportAttributeConfigurationBuffer_cfunc( + vi, size_in_bytes, configuration + ) def niScope_ExportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niScope_ExportAttributeConfigurationFile_cfunc is None: - self.niScope_ExportAttributeConfigurationFile_cfunc = self._get_library_function('niScope_ExportAttributeConfigurationFile') - self.niScope_ExportAttributeConfigurationFile_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 - self.niScope_ExportAttributeConfigurationFile_cfunc.restype = ViStatus # noqa: F405 + self.niScope_ExportAttributeConfigurationFile_cfunc = ( + self._get_library_function( + "niScope_ExportAttributeConfigurationFile" + ) + ) + self.niScope_ExportAttributeConfigurationFile_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niScope_ExportAttributeConfigurationFile_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niScope_ExportAttributeConfigurationFile_cfunc(vi, file_path) - def niScope_Fetch(self, vi, channel_list, timeout, num_samples, waveform, wfm_info): # noqa: N802 + def niScope_Fetch( + self, vi, channel_list, timeout, num_samples, waveform, wfm_info + ): # noqa: N802 with self._func_lock: if self.niScope_Fetch_cfunc is None: - self.niScope_Fetch_cfunc = self._get_library_function('niScope_Fetch') - self.niScope_Fetch_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(waveform_info.struct_niScope_wfmInfo)] # noqa: F405 + self.niScope_Fetch_cfunc = self._get_library_function("niScope_Fetch") + self.niScope_Fetch_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViReal64, + ViInt32, + ctypes.POINTER(ViReal64), + ctypes.POINTER(waveform_info.struct_niScope_wfmInfo), + ] # noqa: F405 self.niScope_Fetch_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_Fetch_cfunc(vi, channel_list, timeout, num_samples, waveform, wfm_info) - - def niScope_FetchArrayMeasurement(self, vi, channel_list, timeout, array_meas_function, measurement_waveform_size, meas_wfm, wfm_info): # noqa: N802 + return self.niScope_Fetch_cfunc( + vi, channel_list, timeout, num_samples, waveform, wfm_info + ) + + def niScope_FetchArrayMeasurement( + self, + vi, + channel_list, + timeout, + array_meas_function, + measurement_waveform_size, + meas_wfm, + wfm_info, + ): # noqa: N802 with self._func_lock: if self.niScope_FetchArrayMeasurement_cfunc is None: - self.niScope_FetchArrayMeasurement_cfunc = self._get_library_function('niScope_FetchArrayMeasurement') - self.niScope_FetchArrayMeasurement_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViInt32, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(waveform_info.struct_niScope_wfmInfo)] # noqa: F405 - self.niScope_FetchArrayMeasurement_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_FetchArrayMeasurement_cfunc(vi, channel_list, timeout, array_meas_function, measurement_waveform_size, meas_wfm, wfm_info) - - def niScope_FetchBinary16(self, vi, channel_list, timeout, num_samples, waveform, wfm_info): # noqa: N802 + self.niScope_FetchArrayMeasurement_cfunc = self._get_library_function( + "niScope_FetchArrayMeasurement" + ) + self.niScope_FetchArrayMeasurement_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViReal64, + ViInt32, + ViInt32, + ctypes.POINTER(ViReal64), + ctypes.POINTER(waveform_info.struct_niScope_wfmInfo), + ] # noqa: F405 + self.niScope_FetchArrayMeasurement_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niScope_FetchArrayMeasurement_cfunc( + vi, + channel_list, + timeout, + array_meas_function, + measurement_waveform_size, + meas_wfm, + wfm_info, + ) + + def niScope_FetchBinary16( + self, vi, channel_list, timeout, num_samples, waveform, wfm_info + ): # noqa: N802 with self._func_lock: if self.niScope_FetchBinary16_cfunc is None: - self.niScope_FetchBinary16_cfunc = self._get_library_function('niScope_FetchBinary16') - self.niScope_FetchBinary16_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViInt32, ctypes.POINTER(ViInt16), ctypes.POINTER(waveform_info.struct_niScope_wfmInfo)] # noqa: F405 + self.niScope_FetchBinary16_cfunc = self._get_library_function( + "niScope_FetchBinary16" + ) + self.niScope_FetchBinary16_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViReal64, + ViInt32, + ctypes.POINTER(ViInt16), + ctypes.POINTER(waveform_info.struct_niScope_wfmInfo), + ] # noqa: F405 self.niScope_FetchBinary16_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_FetchBinary16_cfunc(vi, channel_list, timeout, num_samples, waveform, wfm_info) + return self.niScope_FetchBinary16_cfunc( + vi, channel_list, timeout, num_samples, waveform, wfm_info + ) - def niScope_FetchBinary32(self, vi, channel_list, timeout, num_samples, waveform, wfm_info): # noqa: N802 + def niScope_FetchBinary32( + self, vi, channel_list, timeout, num_samples, waveform, wfm_info + ): # noqa: N802 with self._func_lock: if self.niScope_FetchBinary32_cfunc is None: - self.niScope_FetchBinary32_cfunc = self._get_library_function('niScope_FetchBinary32') - self.niScope_FetchBinary32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViInt32, ctypes.POINTER(ViInt32), ctypes.POINTER(waveform_info.struct_niScope_wfmInfo)] # noqa: F405 + self.niScope_FetchBinary32_cfunc = self._get_library_function( + "niScope_FetchBinary32" + ) + self.niScope_FetchBinary32_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViReal64, + ViInt32, + ctypes.POINTER(ViInt32), + ctypes.POINTER(waveform_info.struct_niScope_wfmInfo), + ] # noqa: F405 self.niScope_FetchBinary32_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_FetchBinary32_cfunc(vi, channel_list, timeout, num_samples, waveform, wfm_info) + return self.niScope_FetchBinary32_cfunc( + vi, channel_list, timeout, num_samples, waveform, wfm_info + ) - def niScope_FetchBinary8(self, vi, channel_list, timeout, num_samples, waveform, wfm_info): # noqa: N802 + def niScope_FetchBinary8( + self, vi, channel_list, timeout, num_samples, waveform, wfm_info + ): # noqa: N802 with self._func_lock: if self.niScope_FetchBinary8_cfunc is None: - self.niScope_FetchBinary8_cfunc = self._get_library_function('niScope_FetchBinary8') - self.niScope_FetchBinary8_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViInt32, ctypes.POINTER(ViInt8), ctypes.POINTER(waveform_info.struct_niScope_wfmInfo)] # noqa: F405 + self.niScope_FetchBinary8_cfunc = self._get_library_function( + "niScope_FetchBinary8" + ) + self.niScope_FetchBinary8_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViReal64, + ViInt32, + ctypes.POINTER(ViInt8), + ctypes.POINTER(waveform_info.struct_niScope_wfmInfo), + ] # noqa: F405 self.niScope_FetchBinary8_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_FetchBinary8_cfunc(vi, channel_list, timeout, num_samples, waveform, wfm_info) - - def niScope_FetchMeasurementStats(self, vi, channel_list, timeout, scalar_meas_function, result, mean, stdev, min, max, num_in_stats): # noqa: N802 + return self.niScope_FetchBinary8_cfunc( + vi, channel_list, timeout, num_samples, waveform, wfm_info + ) + + def niScope_FetchMeasurementStats( + self, + vi, + channel_list, + timeout, + scalar_meas_function, + result, + mean, + stdev, + min, + max, + num_in_stats, + ): # noqa: N802 with self._func_lock: if self.niScope_FetchMeasurementStats_cfunc is None: - self.niScope_FetchMeasurementStats_cfunc = self._get_library_function('niScope_FetchMeasurementStats') - self.niScope_FetchMeasurementStats_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt32)] # noqa: F405 - self.niScope_FetchMeasurementStats_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_FetchMeasurementStats_cfunc(vi, channel_list, timeout, scalar_meas_function, result, mean, stdev, min, max, num_in_stats) - - def niScope_GetAttributeViBoolean(self, vi, channel_list, attribute_id, value): # noqa: N802 + self.niScope_FetchMeasurementStats_cfunc = self._get_library_function( + "niScope_FetchMeasurementStats" + ) + self.niScope_FetchMeasurementStats_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViReal64, + ViInt32, + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViReal64), + ctypes.POINTER(ViInt32), + ] # noqa: F405 + self.niScope_FetchMeasurementStats_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niScope_FetchMeasurementStats_cfunc( + vi, + channel_list, + timeout, + scalar_meas_function, + result, + mean, + stdev, + min, + max, + num_in_stats, + ) + + def niScope_GetAttributeViBoolean( + self, vi, channel_list, attribute_id, value + ): # noqa: N802 with self._func_lock: if self.niScope_GetAttributeViBoolean_cfunc is None: - self.niScope_GetAttributeViBoolean_cfunc = self._get_library_function('niScope_GetAttributeViBoolean') - self.niScope_GetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViBoolean)] # noqa: F405 - self.niScope_GetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_GetAttributeViBoolean_cfunc(vi, channel_list, attribute_id, value) - - def niScope_GetAttributeViInt32(self, vi, channel_list, attribute_id, value): # noqa: N802 + self.niScope_GetAttributeViBoolean_cfunc = self._get_library_function( + "niScope_GetAttributeViBoolean" + ) + self.niScope_GetAttributeViBoolean_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 + self.niScope_GetAttributeViBoolean_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niScope_GetAttributeViBoolean_cfunc( + vi, channel_list, attribute_id, value + ) + + def niScope_GetAttributeViInt32( + self, vi, channel_list, attribute_id, value + ): # noqa: N802 with self._func_lock: if self.niScope_GetAttributeViInt32_cfunc is None: - self.niScope_GetAttributeViInt32_cfunc = self._get_library_function('niScope_GetAttributeViInt32') - self.niScope_GetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViInt32)] # noqa: F405 + self.niScope_GetAttributeViInt32_cfunc = self._get_library_function( + "niScope_GetAttributeViInt32" + ) + self.niScope_GetAttributeViInt32_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niScope_GetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_GetAttributeViInt32_cfunc(vi, channel_list, attribute_id, value) + return self.niScope_GetAttributeViInt32_cfunc( + vi, channel_list, attribute_id, value + ) - def niScope_GetAttributeViInt64(self, vi, channel_list, attribute_id, value): # noqa: N802 + def niScope_GetAttributeViInt64( + self, vi, channel_list, attribute_id, value + ): # noqa: N802 with self._func_lock: if self.niScope_GetAttributeViInt64_cfunc is None: - self.niScope_GetAttributeViInt64_cfunc = self._get_library_function('niScope_GetAttributeViInt64') - self.niScope_GetAttributeViInt64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViInt64)] # noqa: F405 + self.niScope_GetAttributeViInt64_cfunc = self._get_library_function( + "niScope_GetAttributeViInt64" + ) + self.niScope_GetAttributeViInt64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViInt64), + ] # noqa: F405 self.niScope_GetAttributeViInt64_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_GetAttributeViInt64_cfunc(vi, channel_list, attribute_id, value) + return self.niScope_GetAttributeViInt64_cfunc( + vi, channel_list, attribute_id, value + ) - def niScope_GetAttributeViReal64(self, vi, channel_list, attribute_id, value): # noqa: N802 + def niScope_GetAttributeViReal64( + self, vi, channel_list, attribute_id, value + ): # noqa: N802 with self._func_lock: if self.niScope_GetAttributeViReal64_cfunc is None: - self.niScope_GetAttributeViReal64_cfunc = self._get_library_function('niScope_GetAttributeViReal64') - self.niScope_GetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niScope_GetAttributeViReal64_cfunc = self._get_library_function( + "niScope_GetAttributeViReal64" + ) + self.niScope_GetAttributeViReal64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niScope_GetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_GetAttributeViReal64_cfunc(vi, channel_list, attribute_id, value) + return self.niScope_GetAttributeViReal64_cfunc( + vi, channel_list, attribute_id, value + ) - def niScope_GetAttributeViString(self, vi, channel_list, attribute_id, buf_size, value): # noqa: N802 + def niScope_GetAttributeViString( + self, vi, channel_list, attribute_id, buf_size, value + ): # noqa: N802 with self._func_lock: if self.niScope_GetAttributeViString_cfunc is None: - self.niScope_GetAttributeViString_cfunc = self._get_library_function('niScope_GetAttributeViString') - self.niScope_GetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niScope_GetAttributeViString_cfunc = self._get_library_function( + "niScope_GetAttributeViString" + ) + self.niScope_GetAttributeViString_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niScope_GetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_GetAttributeViString_cfunc(vi, channel_list, attribute_id, buf_size, value) + return self.niScope_GetAttributeViString_cfunc( + vi, channel_list, attribute_id, buf_size, value + ) - def niScope_GetEqualizationFilterCoefficients(self, vi, channel, number_of_coefficients, coefficients): # noqa: N802 + def niScope_GetEqualizationFilterCoefficients( + self, vi, channel, number_of_coefficients, coefficients + ): # noqa: N802 with self._func_lock: if self.niScope_GetEqualizationFilterCoefficients_cfunc is None: - self.niScope_GetEqualizationFilterCoefficients_cfunc = self._get_library_function('niScope_GetEqualizationFilterCoefficients') - self.niScope_GetEqualizationFilterCoefficients_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 - self.niScope_GetEqualizationFilterCoefficients_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_GetEqualizationFilterCoefficients_cfunc(vi, channel, number_of_coefficients, coefficients) + self.niScope_GetEqualizationFilterCoefficients_cfunc = ( + self._get_library_function( + "niScope_GetEqualizationFilterCoefficients" + ) + ) + self.niScope_GetEqualizationFilterCoefficients_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViReal64), + ] # noqa: F405 + self.niScope_GetEqualizationFilterCoefficients_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niScope_GetEqualizationFilterCoefficients_cfunc( + vi, channel, number_of_coefficients, coefficients + ) def niScope_GetError(self, vi, error_code, buffer_size, description): # noqa: N802 with self._func_lock: if self.niScope_GetError_cfunc is None: - self.niScope_GetError_cfunc = self._get_library_function('niScope_GetError') - self.niScope_GetError_cfunc.argtypes = [ViSession, ctypes.POINTER(ViStatus), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niScope_GetError_cfunc = self._get_library_function( + "niScope_GetError" + ) + self.niScope_GetError_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViStatus), + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niScope_GetError_cfunc.restype = ViStatus # noqa: F405 return self.niScope_GetError_cfunc(vi, error_code, buffer_size, description) - def niScope_ImportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 + def niScope_ImportAttributeConfigurationBuffer( + self, vi, size_in_bytes, configuration + ): # noqa: N802 with self._func_lock: if self.niScope_ImportAttributeConfigurationBuffer_cfunc is None: - self.niScope_ImportAttributeConfigurationBuffer_cfunc = self._get_library_function('niScope_ImportAttributeConfigurationBuffer') - self.niScope_ImportAttributeConfigurationBuffer_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt8)] # noqa: F405 - self.niScope_ImportAttributeConfigurationBuffer_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_ImportAttributeConfigurationBuffer_cfunc(vi, size_in_bytes, configuration) + self.niScope_ImportAttributeConfigurationBuffer_cfunc = ( + self._get_library_function( + "niScope_ImportAttributeConfigurationBuffer" + ) + ) + self.niScope_ImportAttributeConfigurationBuffer_cfunc.argtypes = [ + ViSession, + ViInt32, + ctypes.POINTER(ViInt8), + ] # noqa: F405 + self.niScope_ImportAttributeConfigurationBuffer_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niScope_ImportAttributeConfigurationBuffer_cfunc( + vi, size_in_bytes, configuration + ) def niScope_ImportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niScope_ImportAttributeConfigurationFile_cfunc is None: - self.niScope_ImportAttributeConfigurationFile_cfunc = self._get_library_function('niScope_ImportAttributeConfigurationFile') - self.niScope_ImportAttributeConfigurationFile_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 - self.niScope_ImportAttributeConfigurationFile_cfunc.restype = ViStatus # noqa: F405 + self.niScope_ImportAttributeConfigurationFile_cfunc = ( + self._get_library_function( + "niScope_ImportAttributeConfigurationFile" + ) + ) + self.niScope_ImportAttributeConfigurationFile_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niScope_ImportAttributeConfigurationFile_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niScope_ImportAttributeConfigurationFile_cfunc(vi, file_path) - def niScope_InitWithOptions(self, resource_name, id_query, reset_device, option_string, vi): # noqa: N802 + def niScope_InitWithOptions( + self, resource_name, id_query, reset_device, option_string, vi + ): # noqa: N802 with self._func_lock: if self.niScope_InitWithOptions_cfunc is None: - self.niScope_InitWithOptions_cfunc = self._get_library_function('niScope_InitWithOptions') - self.niScope_InitWithOptions_cfunc.argtypes = [ctypes.POINTER(ViChar), ViBoolean, ViBoolean, ctypes.POINTER(ViChar), ctypes.POINTER(ViSession)] # noqa: F405 + self.niScope_InitWithOptions_cfunc = self._get_library_function( + "niScope_InitWithOptions" + ) + self.niScope_InitWithOptions_cfunc.argtypes = [ + ctypes.POINTER(ViChar), + ViBoolean, + ViBoolean, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViSession), + ] # noqa: F405 self.niScope_InitWithOptions_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_InitWithOptions_cfunc(resource_name, id_query, reset_device, option_string, vi) + return self.niScope_InitWithOptions_cfunc( + resource_name, id_query, reset_device, option_string, vi + ) def niScope_InitiateAcquisition(self, vi): # noqa: N802 with self._func_lock: if self.niScope_InitiateAcquisition_cfunc is None: - self.niScope_InitiateAcquisition_cfunc = self._get_library_function('niScope_InitiateAcquisition') - self.niScope_InitiateAcquisition_cfunc.argtypes = [ViSession] # noqa: F405 + self.niScope_InitiateAcquisition_cfunc = self._get_library_function( + "niScope_InitiateAcquisition" + ) + self.niScope_InitiateAcquisition_cfunc.argtypes = [ + ViSession + ] # noqa: F405 self.niScope_InitiateAcquisition_cfunc.restype = ViStatus # noqa: F405 return self.niScope_InitiateAcquisition_cfunc(vi) def niScope_LockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niScope_LockSession_cfunc is None: - self.niScope_LockSession_cfunc = self._get_library_function('niScope_LockSession') - self.niScope_LockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niScope_LockSession_cfunc = self._get_library_function( + "niScope_LockSession" + ) + self.niScope_LockSession_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niScope_LockSession_cfunc.restype = ViStatus # noqa: F405 return self.niScope_LockSession_cfunc(vi, caller_has_lock) def niScope_ProbeCompensationSignalStart(self, vi): # noqa: N802 with self._func_lock: if self.niScope_ProbeCompensationSignalStart_cfunc is None: - self.niScope_ProbeCompensationSignalStart_cfunc = self._get_library_function('niScope_ProbeCompensationSignalStart') - self.niScope_ProbeCompensationSignalStart_cfunc.argtypes = [ViSession] # noqa: F405 - self.niScope_ProbeCompensationSignalStart_cfunc.restype = ViStatus # noqa: F405 + self.niScope_ProbeCompensationSignalStart_cfunc = ( + self._get_library_function("niScope_ProbeCompensationSignalStart") + ) + self.niScope_ProbeCompensationSignalStart_cfunc.argtypes = [ + ViSession + ] # noqa: F405 + self.niScope_ProbeCompensationSignalStart_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niScope_ProbeCompensationSignalStart_cfunc(vi) def niScope_ProbeCompensationSignalStop(self, vi): # noqa: N802 with self._func_lock: if self.niScope_ProbeCompensationSignalStop_cfunc is None: - self.niScope_ProbeCompensationSignalStop_cfunc = self._get_library_function('niScope_ProbeCompensationSignalStop') - self.niScope_ProbeCompensationSignalStop_cfunc.argtypes = [ViSession] # noqa: F405 - self.niScope_ProbeCompensationSignalStop_cfunc.restype = ViStatus # noqa: F405 + self.niScope_ProbeCompensationSignalStop_cfunc = ( + self._get_library_function("niScope_ProbeCompensationSignalStop") + ) + self.niScope_ProbeCompensationSignalStop_cfunc.argtypes = [ + ViSession + ] # noqa: F405 + self.niScope_ProbeCompensationSignalStop_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niScope_ProbeCompensationSignalStop_cfunc(vi) - def niScope_Read(self, vi, channel_list, timeout, num_samples, waveform, wfm_info): # noqa: N802 + def niScope_Read( + self, vi, channel_list, timeout, num_samples, waveform, wfm_info + ): # noqa: N802 with self._func_lock: if self.niScope_Read_cfunc is None: - self.niScope_Read_cfunc = self._get_library_function('niScope_Read') - self.niScope_Read_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(waveform_info.struct_niScope_wfmInfo)] # noqa: F405 + self.niScope_Read_cfunc = self._get_library_function("niScope_Read") + self.niScope_Read_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViReal64, + ViInt32, + ctypes.POINTER(ViReal64), + ctypes.POINTER(waveform_info.struct_niScope_wfmInfo), + ] # noqa: F405 self.niScope_Read_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_Read_cfunc(vi, channel_list, timeout, num_samples, waveform, wfm_info) + return self.niScope_Read_cfunc( + vi, channel_list, timeout, num_samples, waveform, wfm_info + ) def niScope_ResetDevice(self, vi): # noqa: N802 with self._func_lock: if self.niScope_ResetDevice_cfunc is None: - self.niScope_ResetDevice_cfunc = self._get_library_function('niScope_ResetDevice') + self.niScope_ResetDevice_cfunc = self._get_library_function( + "niScope_ResetDevice" + ) self.niScope_ResetDevice_cfunc.argtypes = [ViSession] # noqa: F405 self.niScope_ResetDevice_cfunc.restype = ViStatus # noqa: F405 return self.niScope_ResetDevice_cfunc(vi) @@ -487,71 +1069,144 @@ def niScope_ResetDevice(self, vi): # noqa: N802 def niScope_ResetWithDefaults(self, vi): # noqa: N802 with self._func_lock: if self.niScope_ResetWithDefaults_cfunc is None: - self.niScope_ResetWithDefaults_cfunc = self._get_library_function('niScope_ResetWithDefaults') - self.niScope_ResetWithDefaults_cfunc.argtypes = [ViSession] # noqa: F405 + self.niScope_ResetWithDefaults_cfunc = self._get_library_function( + "niScope_ResetWithDefaults" + ) + self.niScope_ResetWithDefaults_cfunc.argtypes = [ + ViSession + ] # noqa: F405 self.niScope_ResetWithDefaults_cfunc.restype = ViStatus # noqa: F405 return self.niScope_ResetWithDefaults_cfunc(vi) def niScope_SendSoftwareTriggerEdge(self, vi, which_trigger): # noqa: N802 with self._func_lock: if self.niScope_SendSoftwareTriggerEdge_cfunc is None: - self.niScope_SendSoftwareTriggerEdge_cfunc = self._get_library_function('niScope_SendSoftwareTriggerEdge') - self.niScope_SendSoftwareTriggerEdge_cfunc.argtypes = [ViSession, ViInt32] # noqa: F405 - self.niScope_SendSoftwareTriggerEdge_cfunc.restype = ViStatus # noqa: F405 + self.niScope_SendSoftwareTriggerEdge_cfunc = self._get_library_function( + "niScope_SendSoftwareTriggerEdge" + ) + self.niScope_SendSoftwareTriggerEdge_cfunc.argtypes = [ + ViSession, + ViInt32, + ] # noqa: F405 + self.niScope_SendSoftwareTriggerEdge_cfunc.restype = ( + ViStatus # noqa: F405 + ) return self.niScope_SendSoftwareTriggerEdge_cfunc(vi, which_trigger) - def niScope_SetAttributeViBoolean(self, vi, channel_list, attribute_id, value): # noqa: N802 + def niScope_SetAttributeViBoolean( + self, vi, channel_list, attribute_id, value + ): # noqa: N802 with self._func_lock: if self.niScope_SetAttributeViBoolean_cfunc is None: - self.niScope_SetAttributeViBoolean_cfunc = self._get_library_function('niScope_SetAttributeViBoolean') - self.niScope_SetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViBoolean] # noqa: F405 - self.niScope_SetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_SetAttributeViBoolean_cfunc(vi, channel_list, attribute_id, value) - - def niScope_SetAttributeViInt32(self, vi, channel_list, attribute_id, value): # noqa: N802 + self.niScope_SetAttributeViBoolean_cfunc = self._get_library_function( + "niScope_SetAttributeViBoolean" + ) + self.niScope_SetAttributeViBoolean_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViBoolean, + ] # noqa: F405 + self.niScope_SetAttributeViBoolean_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niScope_SetAttributeViBoolean_cfunc( + vi, channel_list, attribute_id, value + ) + + def niScope_SetAttributeViInt32( + self, vi, channel_list, attribute_id, value + ): # noqa: N802 with self._func_lock: if self.niScope_SetAttributeViInt32_cfunc is None: - self.niScope_SetAttributeViInt32_cfunc = self._get_library_function('niScope_SetAttributeViInt32') - self.niScope_SetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32] # noqa: F405 + self.niScope_SetAttributeViInt32_cfunc = self._get_library_function( + "niScope_SetAttributeViInt32" + ) + self.niScope_SetAttributeViInt32_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViInt32, + ] # noqa: F405 self.niScope_SetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_SetAttributeViInt32_cfunc(vi, channel_list, attribute_id, value) + return self.niScope_SetAttributeViInt32_cfunc( + vi, channel_list, attribute_id, value + ) - def niScope_SetAttributeViInt64(self, vi, channel_list, attribute_id, value): # noqa: N802 + def niScope_SetAttributeViInt64( + self, vi, channel_list, attribute_id, value + ): # noqa: N802 with self._func_lock: if self.niScope_SetAttributeViInt64_cfunc is None: - self.niScope_SetAttributeViInt64_cfunc = self._get_library_function('niScope_SetAttributeViInt64') - self.niScope_SetAttributeViInt64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt64] # noqa: F405 + self.niScope_SetAttributeViInt64_cfunc = self._get_library_function( + "niScope_SetAttributeViInt64" + ) + self.niScope_SetAttributeViInt64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViInt64, + ] # noqa: F405 self.niScope_SetAttributeViInt64_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_SetAttributeViInt64_cfunc(vi, channel_list, attribute_id, value) + return self.niScope_SetAttributeViInt64_cfunc( + vi, channel_list, attribute_id, value + ) - def niScope_SetAttributeViReal64(self, vi, channel_list, attribute_id, value): # noqa: N802 + def niScope_SetAttributeViReal64( + self, vi, channel_list, attribute_id, value + ): # noqa: N802 with self._func_lock: if self.niScope_SetAttributeViReal64_cfunc is None: - self.niScope_SetAttributeViReal64_cfunc = self._get_library_function('niScope_SetAttributeViReal64') - self.niScope_SetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViReal64] # noqa: F405 + self.niScope_SetAttributeViReal64_cfunc = self._get_library_function( + "niScope_SetAttributeViReal64" + ) + self.niScope_SetAttributeViReal64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViReal64, + ] # noqa: F405 self.niScope_SetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_SetAttributeViReal64_cfunc(vi, channel_list, attribute_id, value) + return self.niScope_SetAttributeViReal64_cfunc( + vi, channel_list, attribute_id, value + ) - def niScope_SetAttributeViString(self, vi, channel_list, attribute_id, value): # noqa: N802 + def niScope_SetAttributeViString( + self, vi, channel_list, attribute_id, value + ): # noqa: N802 with self._func_lock: if self.niScope_SetAttributeViString_cfunc is None: - self.niScope_SetAttributeViString_cfunc = self._get_library_function('niScope_SetAttributeViString') - self.niScope_SetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViChar)] # noqa: F405 + self.niScope_SetAttributeViString_cfunc = self._get_library_function( + "niScope_SetAttributeViString" + ) + self.niScope_SetAttributeViString_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niScope_SetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_SetAttributeViString_cfunc(vi, channel_list, attribute_id, value) + return self.niScope_SetAttributeViString_cfunc( + vi, channel_list, attribute_id, value + ) def niScope_UnlockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niScope_UnlockSession_cfunc is None: - self.niScope_UnlockSession_cfunc = self._get_library_function('niScope_UnlockSession') - self.niScope_UnlockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niScope_UnlockSession_cfunc = self._get_library_function( + "niScope_UnlockSession" + ) + self.niScope_UnlockSession_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niScope_UnlockSession_cfunc.restype = ViStatus # noqa: F405 return self.niScope_UnlockSession_cfunc(vi, caller_has_lock) def niScope_close(self, vi): # noqa: N802 with self._func_lock: if self.niScope_close_cfunc is None: - self.niScope_close_cfunc = self._get_library_function('niScope_close') + self.niScope_close_cfunc = self._get_library_function("niScope_close") self.niScope_close_cfunc.argtypes = [ViSession] # noqa: F405 self.niScope_close_cfunc.restype = ViStatus # noqa: F405 return self.niScope_close_cfunc(vi) @@ -559,15 +1214,21 @@ def niScope_close(self, vi): # noqa: N802 def niScope_error_message(self, vi, error_code, error_message): # noqa: N802 with self._func_lock: if self.niScope_error_message_cfunc is None: - self.niScope_error_message_cfunc = self._get_library_function('niScope_error_message') - self.niScope_error_message_cfunc.argtypes = [ViSession, ViStatus, ctypes.POINTER(ViChar)] # noqa: F405 + self.niScope_error_message_cfunc = self._get_library_function( + "niScope_error_message" + ) + self.niScope_error_message_cfunc.argtypes = [ + ViSession, + ViStatus, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niScope_error_message_cfunc.restype = ViStatus # noqa: F405 return self.niScope_error_message_cfunc(vi, error_code, error_message) def niScope_reset(self, vi): # noqa: N802 with self._func_lock: if self.niScope_reset_cfunc is None: - self.niScope_reset_cfunc = self._get_library_function('niScope_reset') + self.niScope_reset_cfunc = self._get_library_function("niScope_reset") self.niScope_reset_cfunc.argtypes = [ViSession] # noqa: F405 self.niScope_reset_cfunc.restype = ViStatus # noqa: F405 return self.niScope_reset_cfunc(vi) @@ -575,7 +1236,13 @@ def niScope_reset(self, vi): # noqa: N802 def niScope_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 with self._func_lock: if self.niScope_self_test_cfunc is None: - self.niScope_self_test_cfunc = self._get_library_function('niScope_self_test') - self.niScope_self_test_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt16), ctypes.POINTER(ViChar)] # noqa: F405 + self.niScope_self_test_cfunc = self._get_library_function( + "niScope_self_test" + ) + self.niScope_self_test_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt16), + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niScope_self_test_cfunc.restype = ViStatus # noqa: F405 return self.niScope_self_test_cfunc(vi, self_test_result, self_test_message) diff --git a/generated/niscope/niscope/_library_singleton.py b/generated/niscope/niscope/_library_singleton.py index bd32f4d36..fac599547 100644 --- a/generated/niscope/niscope/_library_singleton.py +++ b/generated/niscope/niscope/_library_singleton.py @@ -12,30 +12,36 @@ _instance = None _instance_lock = threading.Lock() -_library_info = {'Linux': {'64bit': {'name': 'niscope', 'type': 'cdll'}}, - 'Windows': {'32bit': {'name': 'niScope_32.dll', 'type': 'windll'}, - '64bit': {'name': 'niScope_64.dll', 'type': 'cdll'}}} +_library_info = { + "Linux": {"64bit": {"name": "niscope", "type": "cdll"}}, + "Windows": { + "32bit": {"name": "niScope_32.dll", "type": "windll"}, + "64bit": {"name": "niScope_64.dll", "type": "cdll"}, + }, +} def _get_library_name(): try: - return ctypes.util.find_library(_library_info[platform.system()][platform.architecture()[0]]['name']) # We find and return full path to the DLL + return ctypes.util.find_library( + _library_info[platform.system()][platform.architecture()[0]]["name"] + ) # We find and return full path to the DLL except KeyError: raise errors.UnsupportedConfigurationError def _get_library_type(): try: - return _library_info[platform.system()][platform.architecture()[0]]['type'] + return _library_info[platform.system()][platform.architecture()[0]]["type"] except KeyError: raise errors.UnsupportedConfigurationError def get(): - '''get + """get Returns the library.Library singleton for niscope. - ''' + """ global _instance global _instance_lock @@ -43,13 +49,12 @@ def get(): if _instance is None: try: library_type = _get_library_type() - if library_type == 'windll': + if library_type == "windll": ctypes_library = ctypes.WinDLL(_get_library_name()) else: - assert library_type == 'cdll' + assert library_type == "cdll" ctypes_library = ctypes.CDLL(_get_library_name()) except OSError: raise errors.DriverNotInstalledError() _instance = _library.Library(ctypes_library) return _instance - diff --git a/generated/niscope/niscope/_visatype.py b/generated/niscope/niscope/_visatype.py index 02cc41d1b..bf96c3cfb 100644 --- a/generated/niscope/niscope/_visatype.py +++ b/generated/niscope/niscope/_visatype.py @@ -2,9 +2,9 @@ import ctypes -'''Definitions of the VISA types used by the C API of the driver runtime. +"""Definitions of the VISA types used by the C API of the driver runtime. These are aliased directly to ctypes types so can be used directly to call into the library. -''' +""" ViChar = ctypes.c_char @@ -26,4 +26,3 @@ ViAttr = ViUInt32 ViConstString = ViString ViRsrc = ViString - diff --git a/generated/niscope/niscope/enums.py b/generated/niscope/niscope/enums.py index 5b4391e73..af0a2ff24 100644 --- a/generated/niscope/niscope/enums.py +++ b/generated/niscope/niscope/enums.py @@ -12,139 +12,139 @@ class AcquisitionStatus(Enum): class AcquisitionType(Enum): NORMAL = 0 - r''' + r""" Sets the digitizer to normal resolution mode. The digitizer can use real-time sampling or equivalent-time sampling. - ''' + """ FLEXRES = 1001 - r''' + r""" Sets the digitizer to flexible resolution mode if supported. The digitizer uses different hardware configurations to change the resolution depending on the sampling rate used. - ''' + """ DDC = 1002 - r''' + r""" Sets the digitizer to DDC mode on the NI 5620/5621. - ''' + """ class ArrayMeasurement(Enum): NO_MEASUREMENT = 4000 - r''' + r""" None - ''' + """ LAST_ACQ_HISTOGRAM = 4001 - r''' + r""" Last Acquisition Histogram - ''' + """ FFT_PHASE_SPECTRUM = 4002 - r''' + r""" FFT Phase Spectrum - ''' + """ FFT_AMP_SPECTRUM_VOLTS_RMS = 4003 - r''' + r""" FFT Amp. Spectrum (Volts RMS) - ''' + """ MULTI_ACQ_VOLTAGE_HISTOGRAM = 4004 - r''' + r""" Multi Acquisition Voltage Histogram - ''' + """ MULTI_ACQ_TIME_HISTOGRAM = 4005 - r''' + r""" Multi Acquisition Time Histogram - ''' + """ ARRAY_INTEGRAL = 4006 - r''' + r""" Array Integral - ''' + """ DERIVATIVE = 4007 - r''' + r""" Derivative - ''' + """ INVERSE = 4008 - r''' + r""" Inverse - ''' + """ HANNING_WINDOW = 4009 - r''' + r""" Hanning Window - ''' + """ FLAT_TOP_WINDOW = 4010 - r''' + r""" Flat Top Window - ''' + """ POLYNOMIAL_INTERPOLATION = 4011 - r''' + r""" Polynomial Interpolation - ''' + """ MULTIPLY_CHANNELS = 4012 - r''' + r""" Multiply Channels - ''' + """ ADD_CHANNELS = 4013 - r''' + r""" Add Channels - ''' + """ SUBTRACT_CHANNELS = 4014 - r''' + r""" Subtract Channels - ''' + """ DIVIDE_CHANNELS = 4015 - r''' + r""" Divide Channels - ''' + """ MULTI_ACQ_AVERAGE = 4016 - r''' + r""" Multi Acquisition Average - ''' + """ BUTTERWORTH_FILTER = 4017 - r''' + r""" Butterworth IIR Filter - ''' + """ CHEBYSHEV_FILTER = 4018 - r''' + r""" Chebyshev IIR Filter - ''' + """ FFT_AMP_SPECTRUM_DB = 4019 - r''' + r""" FFT Amp. Spectrum (dB) - ''' + """ HAMMING_WINDOW = 4020 - r''' + r""" Hamming Window - ''' + """ WINDOWED_FIR_FILTER = 4021 - r''' + r""" FIR Windowed Filter - ''' + """ BESSEL_FILTER = 4022 - r''' + r""" Bessel IIR Filter - ''' + """ TRIANGLE_WINDOW = 4023 - r''' + r""" Triangle Window - ''' + """ BLACKMAN_WINDOW = 4024 - r''' + r""" Blackman Window - ''' + """ ARRAY_OFFSET = 4025 - r''' + r""" Array Offset - ''' + """ ARRAY_GAIN = 4026 - r''' + r""" Array Gain - ''' + """ class CableSenseMode(Enum): DISABLED = 0 - r''' + r""" The oscilloscope is not configured to emit a CableSense signal. - ''' + """ ON_DEMAND = 1 - r''' + r""" The oscilloscope is configured to emit a single CableSense pulse. - ''' + """ class _CalibrationTypes(Enum): @@ -225,223 +225,223 @@ class ClearableMeasurement(Enum): class FIRFilterWindow(Enum): NONE = 0 - r''' + r""" No window. - ''' + """ HANNING = 409 - r''' + r""" Specifies a Hanning window. - ''' + """ FLAT_TOP = 410 - r''' + r""" Specifies a Flat Top window. - ''' + """ HAMMING = 420 - r''' + r""" Specifies a Hamming window. - ''' + """ TRIANGLE = 423 - r''' + r""" Specifies a Triangle window. - ''' + """ BLACKMAN = 424 - r''' + r""" Specifies a Blackman window. - ''' + """ class FetchRelativeTo(Enum): READ_POINTER = 388 - r''' + r""" The read pointer is set to zero when a new acquisition is initiated. After every fetch the read pointer is incremeted to be the sample after the last sample retrieved. Therefore, you can repeatedly fetch relative to the read pointer for a continuous acquisition program. - ''' + """ PRETRIGGER = 477 - r''' + r""" Fetches relative to the first pretrigger point requested with configure_horizontal_timing. - ''' + """ NOW = 481 - r''' + r""" Fetch data at the last sample acquired. - ''' + """ START = 482 - r''' + r""" Fetch data starting at the first point sampled by the digitizer. - ''' + """ TRIGGER = 483 - r''' + r""" Fetch at the first posttrigger sample. - ''' + """ class FilterType(Enum): LOWPASS = 0 - r''' + r""" Specifies lowpass as the filter type. - ''' + """ HIGHPASS = 1 - r''' + r""" Specifies highpass as the filter type. - ''' + """ BANDPASS = 2 - r''' + r""" Specifies bandpass as the filter type. - ''' + """ BANDSTOP = 3 - r''' + r""" Specifies bandstop as the filter type. - ''' + """ class FlexFIRAntialiasFilterType(Enum): FOURTYEIGHT_TAP_STANDARD = 0 - r''' + r""" This filter is optimized for alias protection and frequency-domain flatness - ''' + """ FOURTYEIGHT_TAP_HANNING = 1 - r''' + r""" This filter is optimized for the lowest possible bandwidth for a 48 tap filter and maximizes the SNR - ''' + """ SIXTEEN_TAP_HANNING = 2 - r''' + r""" This filter is optimized for the lowest possible bandwidth for a 16 tap filter and maximizes the SNR - ''' + """ EIGHT_TAP_HANNING = 3 - r''' + r""" This filter is optimized for the lowest possible bandwidth for a 8 tap filter and maximizes the SNR - ''' + """ class GlitchCondition(Enum): GREATER = 2 - r''' + r""" Trigger on pulses with a duration greater than the specified glitch width. - ''' + """ LESS = 1 - r''' + r""" Trigger on pulses with a duration shorter than the specified glitch width. - ''' + """ class GlitchPolarity(Enum): POSITIVE = 1 - r''' + r""" Trigger on pulses of positive polarity relative to the trigger threshold. - ''' + """ NEGATIVE = 2 - r''' + r""" Trigger on pulses of negative polarity relative to the trigger threshold. - ''' + """ EITHER = 3 - r''' + r""" Trigger on pulses of either positive or negative polarity. - ''' + """ class Option(Enum): SELF_CALIBRATE_ALL_CHANNELS = 0 - r''' + r""" Self Calibrating all Channels - ''' + """ RESTORE_EXTERNAL_CALIBRATION = 1 - r''' + r""" Restore External Calibration. - ''' + """ class PercentageMethod(Enum): LOWHIGH = 0 - r''' + r""" Specifies that the reference level percentages should be computed using the low/high method, - ''' + """ MINMAX = 1 - r''' + r""" Reference level percentages are computed using the min/max method. - ''' + """ BASETOP = 2 - r''' + r""" Reference level percentages are computed using the base/top method. - ''' + """ class RISMethod(Enum): EXACT_NUM_AVERAGES = 1 - r''' + r""" Acquires exactly the specified number of records for each bin in the RIS acquisition. An error is returned from the fetch method if the RIS acquisition does not successfully acquire the specified number of waveforms within the timeout period. You may call the fetch method again to allow more time for the acquisition to finish. - ''' + """ MIN_NUM_AVERAGES = 2 - r''' + r""" Each RIS sample is the average of a least a minimum number of randomly distributed points. - ''' + """ INCOMPLETE = 3 - r''' + r""" Returns the RIS waveform after the specified timeout even if it is incomplete. If no waveforms have been acquired in certain bins, these bins will have a NaN (when fetching scaled data) or a zero (when fetching binary data). A warning (positive error code) is returned from the fetch method if the RIS acquisition did not finish. The acquisition aborts when data is returned. - ''' + """ LIMITED_BIN_WIDTH = 5 - r''' + r""" Limits the waveforms in the various bins to be within 200 ps of the center of the bin. - ''' + """ class RefLevelUnits(Enum): VOLTS = 0 - r''' + r""" Specifies that the reference levels are given in units of volts. - ''' + """ PERCENTAGE = 1 - r''' + r""" (Default) Specifies that the reference levels are given in percentage units. - ''' + """ class RefTriggerDetectorLocation(Enum): ANALOG_DETECTION_CIRCUIT = 0 - r''' + r""" use the hardware analog circuitry to implement the reference trigger. This option will trigger before any onboard signal processing. - ''' + """ DDC_OUTPUT = 1 - r''' + r""" use the onboard signal processing logic to implement the reference trigger. This option will trigger based on the onboard signal processed data. - ''' + """ class RuntPolarity(Enum): POSITIVE = 1 - r''' + r""" Trigger on pulses of positive polarity relative to runt_low_threshold that do not cross runt_high_threshold. - ''' + """ NEGATIVE = 2 - r''' + r""" Trigger on pulses of negative polarity relative to runt_high_threshold that do not cross runt_low_threshold. - ''' + """ EITHER = 3 - r''' + r""" Trigger on pulses of either positive or negative polarity. - ''' + """ class RuntTimeCondition(Enum): NONE = 0 - r''' + r""" Time qualification is disabled. Trigger on runt pulses based solely on the voltage level of the pulses. - ''' + """ WITHIN = 1 - r''' + r""" Trigger on pulses that, in addition to meeting runt voltage criteria, have a duration within the range bounded by runt_time_low_limit and runt_time_high_limit. - ''' + """ OUTSIDE = 2 - r''' + r""" Trigger on pulses that, in addition to meeting runt voltage criteria, have a duration not within the range bounded by runt_time_low_limit and runt_time_high_limit. - ''' + """ class ScalarMeasurement(Enum): NO_MEASUREMENT = 4000 - r''' + r""" None - ''' + """ RISE_TIME = 0 FALL_TIME = 1 FREQUENCY = 2 @@ -485,234 +485,234 @@ class ScalarMeasurement(Enum): class TerminalConfiguration(Enum): SINGLE_ENDED = 0 - r''' + r""" Channel is single ended - ''' + """ UNBALANCED_DIFFERENTIAL = 1 - r''' + r""" Channel is unbalanced differential - ''' + """ DIFFERENTIAL = 2 - r''' + r""" Channel is differential - ''' + """ class TriggerCoupling(Enum): AC = 0 - r''' + r""" AC coupling - ''' + """ DC = 1 - r''' + r""" DC coupling - ''' + """ HF_REJECT = 3 - r''' + r""" Highpass filter coupling - ''' + """ LF_REJECT = 4 - r''' + r""" Lowpass filter coupling - ''' + """ AC_PLUS_HF_REJECT = 1001 - r''' + r""" Highpass and lowpass filter coupling - ''' + """ class TriggerModifier(Enum): NO_TRIGGER_MOD = 1 - r''' + r""" Normal triggering. - ''' + """ AUTO = 2 - r''' + r""" Software will trigger an acquisition automatically if no trigger arrives after a certain amount of time. - ''' + """ AUTO_LEVEL = 3 class TriggerSlope(Enum): NEGATIVE = 0 - r''' + r""" Falling edge - ''' + """ POSITIVE = 1 - r''' + r""" Rising edge - ''' + """ SLOPE_EITHER = 3 - r''' + r""" Either edge - ''' + """ class TriggerType(Enum): EDGE = 1 - r''' + r""" Configures the digitizer for edge triggering. An edge trigger occurs when the trigger signal crosses the trigger level specified with the set trigger slope. You configure the trigger level and slope with configure_trigger_edge. - ''' + """ HYSTERESIS = 1001 - r''' + r""" Configures the digitizer for hysteresis triggering. A hysteresis trigger occurs when the trigger signal crosses the trigger level with the specified slope and passes through the hysteresis window you specify. You configure the trigger level, slope, and hysteresis with configure_trigger_hysteresis. - ''' + """ DIGITAL = 1002 - r''' + r""" Configures the digitizer for digital triggering. A digital trigger occurs when the trigger signal has the specified slope. You configure the trigger slope with configure_trigger_digital. - ''' + """ WINDOW = 1003 - r''' + r""" Configures the digitizer for window triggering. A window trigger occurs when the trigger signal enters or leaves the window defined by the values you specify with the Low Window Level, High Window Level, and Window Mode Parameters. You configure the low window level high window level, and window mode with configure_trigger_window. - ''' + """ SOFTWARE = 1004 - r''' + r""" Configures the digitizer for software triggering. A software trigger occurs when SendSoftwareTrigger is called. - ''' + """ TV = 5 - r''' + r""" Configures the digitizer for video/TV triggering. You configure the video trigger parameters like signal Format, Line to trigger off of, Polarity, and Enable DC Restore with configure_trigger_video. - ''' + """ GLITCH = 4 WIDTH = 2 RUNT = 3 IMMEDIATE = 6 - r''' + r""" Configures the digitizer for immediate triggering. An immediate trigger occurs as soon as the pretrigger samples are acquired. - ''' + """ class TriggerWindowMode(Enum): ENTERING = 0 - r''' + r""" Trigger upon entering the window - ''' + """ LEAVING = 1 - r''' + r""" Trigger upon leaving the window - ''' + """ ENTERING_OR_LEAVING = 2 class VerticalCoupling(Enum): AC = 0 - r''' + r""" AC coupling - ''' + """ DC = 1 - r''' + r""" DC coupling - ''' + """ GND = 2 - r''' + r""" GND coupling - ''' + """ class VideoPolarity(Enum): POSITIVE = 1 - r''' + r""" Specifies that the video signal has positive polarity. - ''' + """ NEGATIVE = 2 - r''' + r""" Specifies that the video signal has negative polarity. - ''' + """ class VideoSignalFormat(Enum): NTSC = 1 - r''' + r""" NTSC signal format supports line numbers from 1 to 525 - ''' + """ PAL = 2 - r''' + r""" PAL signal format supports line numbers from 1 to 625 - ''' + """ SECAM = 3 - r''' + r""" SECAM signal format supports line numbers from 1 to 625 - ''' + """ M_PAL = 1001 - r''' + r""" M-PAL signal format supports line numbers from 1 to 525 - ''' + """ VIDEO_480I_59_94_FIELDS_PER_SECOND = 1010 - r''' + r""" 480 lines, interlaced, 59.94 fields per second - ''' + """ VIDEO_480I_60_FIELDS_PER_SECOND = 1011 - r''' + r""" 480 lines, interlaced, 60 fields per second - ''' + """ VIDEO_480P_59_94_FRAMES_PER_SECOND = 1015 - r''' + r""" 480 lines, progressive, 59.94 frames per second - ''' + """ VIDEO_480P_60_FRAMES_PER_SECOND = 1016 - r''' + r""" 480 lines, progressive,60 frames per second - ''' + """ VIDEO_576I_50_FIELDS_PER_SECOND = 1020 - r''' + r""" 576 lines, interlaced, 50 fields per second - ''' + """ VIDEO_576P_50_FRAMES_PER_SECOND = 1025 - r''' + r""" 576 lines, progressive, 50 frames per second - ''' + """ VIDEO_720P_50_FRAMES_PER_SECOND = 1031 - r''' + r""" 720 lines, progressive, 50 frames per second - ''' + """ VIDEO_720P_59_94_FRAMES_PER_SECOND = 1032 - r''' + r""" 720 lines, progressive, 59.94 frames per second - ''' + """ VIDEO_720P_60_FRAMES_PER_SECOND = 1033 - r''' + r""" 720 lines, progressive, 60 frames per second - ''' + """ VIDEO_1080I_50_FIELDS_PER_SECOND = 1040 - r''' + r""" 1,080 lines, interlaced, 50 fields per second - ''' + """ VIDEO_1080I_59_94_FIELDS_PER_SECOND = 1041 - r''' + r""" 1,080 lines, interlaced, 59.94 fields per second - ''' + """ VIDEO_1080I_60_FIELDS_PER_SECOND = 1042 - r''' + r""" 1,080 lines, interlaced, 60 fields per second - ''' + """ VIDEO_1080P_24_FRAMES_PER_SECOND = 1045 - r''' + r""" 1,080 lines, progressive, 24 frames per second - ''' + """ class VideoTriggerEvent(Enum): FIELD1 = 1 - r''' + r""" Trigger on field 1 of the signal - ''' + """ FIELD2 = 2 - r''' + r""" Trigger on field 2 of the signal - ''' + """ ANY_FIELD = 3 - r''' + r""" Trigger on the first field acquired - ''' + """ ANY_LINE = 4 - r''' + r""" Trigger on the first line acquired - ''' + """ LINE_NUMBER = 5 - r''' + r""" Trigger on a specific line of a video signal. Valid values vary depending on the signal format configured. - ''' + """ class WhichTrigger(Enum): @@ -724,25 +724,25 @@ class WhichTrigger(Enum): class WidthCondition(Enum): WITHIN = 1 - r''' + r""" Trigger on pulses with a duration within the range bounded by width_low_threshold and width_high_threshold. - ''' + """ OUTSIDE = 2 - r''' + r""" Trigger on pulses with a duration not within the range bounded by width_low_threshold and width_high_threshold. - ''' + """ class WidthPolarity(Enum): POSITIVE = 1 - r''' + r""" Trigger on pulses of positive polarity relative to the trigger threshold. - ''' + """ NEGATIVE = 2 - r''' + r""" Trigger on pulses of negative polarity relative to the trigger threshold. - ''' + """ EITHER = 3 - r''' + r""" Trigger on pulses of either positive or negative polarity. - ''' + """ diff --git a/generated/niscope/niscope/errors.py b/generated/niscope/niscope/errors.py index fea4821a9..f4f3abc5c 100644 --- a/generated/niscope/niscope/errors.py +++ b/generated/niscope/niscope/errors.py @@ -7,86 +7,103 @@ def _is_success(code): - return (code == 0) + return code == 0 def _is_error(code): - return (code < 0) + return code < 0 def _is_warning(code): - return (code > 0) + return code > 0 class Error(Exception): - '''Base error class for NI-SCOPE''' + """Base error class for NI-SCOPE""" def __init__(self, message): super(Error, self).__init__(message) class DriverError(Error): - '''An error originating from the NI-SCOPE driver''' + """An error originating from the NI-SCOPE driver""" def __init__(self, code, description): - assert (_is_error(code)), "Should not raise Error if code is not fatal." + assert _is_error(code), "Should not raise Error if code is not fatal." self.code = code self.description = description super(DriverError, self).__init__(str(self.code) + ": " + self.description) class DriverWarning(Warning): - '''A warning originating from the NI-SCOPE driver''' + """A warning originating from the NI-SCOPE driver""" def __init__(self, code, description): - assert (_is_warning(code)), "Should not create Warning if code is not positive." - super(DriverWarning, self).__init__('Warning {0} occurred.\n\n{1}'.format(code, description)) + assert _is_warning(code), "Should not create Warning if code is not positive." + super(DriverWarning, self).__init__( + "Warning {0} occurred.\n\n{1}".format(code, description) + ) class UnsupportedConfigurationError(Error): - '''An error due to using this module in an usupported platform.''' + """An error due to using this module in an usupported platform.""" def __init__(self): - super(UnsupportedConfigurationError, self).__init__('System configuration is unsupported: ' + platform.architecture()[0] + ' ' + platform.system()) + super(UnsupportedConfigurationError, self).__init__( + "System configuration is unsupported: " + + platform.architecture()[0] + + " " + + platform.system() + ) class DriverNotInstalledError(Error): - '''An error due to using this module without the driver runtime installed.''' + """An error due to using this module without the driver runtime installed.""" def __init__(self): - super(DriverNotInstalledError, self).__init__('The NI-SCOPE runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it.') + super(DriverNotInstalledError, self).__init__( + "The NI-SCOPE runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it." + ) class DriverTooOldError(Error): - '''An error due to using this module with an older version of the driver runtime.''' + """An error due to using this module with an older version of the driver runtime.""" def __init__(self): - super(DriverTooOldError, self).__init__('A function was not found in the NI-SCOPE runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it.') + super(DriverTooOldError, self).__init__( + "A function was not found in the NI-SCOPE runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it." + ) class InvalidRepeatedCapabilityError(Error): - '''An error due to an invalid character in a repeated capability''' + """An error due to an invalid character in a repeated capability""" def __init__(self, invalid_character, invalid_string): - super(InvalidRepeatedCapabilityError, self).__init__('An invalid character ({0}) was found in repeated capability string ({1})'.format(invalid_character, invalid_string)) + super(InvalidRepeatedCapabilityError, self).__init__( + "An invalid character ({0}) was found in repeated capability string ({1})".format( + invalid_character, invalid_string + ) + ) class SelfTestError(Error): - '''An error due to a failed self-test''' + """An error due to a failed self-test""" def __init__(self, code, msg): self.code = code self.message = msg - super(SelfTestError, self).__init__('Self-test failed with code {0}: {1}'.format(code, msg)) + super(SelfTestError, self).__init__( + "Self-test failed with code {0}: {1}".format(code, msg) + ) def handle_error(session, code, ignore_warnings, is_error_handling): - '''handle_error + """handle_error Helper function for handling errors returned by niscope.Library. It calls back into the session to get the corresponding error description and raises if necessary. - ''' + """ if _is_success(code) or (_is_warning(code) and ignore_warnings): return @@ -94,7 +111,7 @@ def handle_error(session, code, ignore_warnings, is_error_handling): if is_error_handling: # The caller is in the midst of error handling and an error occurred. # Don't try to get the description or we'll start recursing until the stack overflows. - description = '' + description = "" else: description = session._get_error_description(code) @@ -103,5 +120,3 @@ def handle_error(session, code, ignore_warnings, is_error_handling): assert _is_warning(code) warnings.warn(DriverWarning(code, description)) - - diff --git a/generated/niscope/niscope/measurement_stats.py b/generated/niscope/niscope/measurement_stats.py index 178f0f6f1..f4ba79914 100644 --- a/generated/niscope/niscope/measurement_stats.py +++ b/generated/niscope/niscope/measurement_stats.py @@ -1,5 +1,7 @@ class MeasurementStats(object): - def __init__(self, result=0.0, mean=0.0, stdev=0.0, min_val=0.0, max_val=0.0, num_in_stats=0): + def __init__( + self, result=0.0, mean=0.0, stdev=0.0, min_val=0.0, max_val=0.0, num_in_stats=0 + ): self.result = result self.mean = mean self.stdev = stdev @@ -12,32 +14,34 @@ def __init__(self, result=0.0, mean=0.0, stdev=0.0, min_val=0.0, max_val=0.0, nu def __repr__(self): parameter_list = [ - 'result={}'.format(self.result), - 'mean={}'.format(self.mean), - 'stdev={}'.format(self.stdev), - 'min_val={}'.format(self.min_val), - 'max_val={}'.format(self.max_val), - 'num_in_stats={}'.format(self.num_in_stats) + "result={}".format(self.result), + "mean={}".format(self.mean), + "stdev={}".format(self.stdev), + "min_val={}".format(self.min_val), + "max_val={}".format(self.max_val), + "num_in_stats={}".format(self.num_in_stats), ] - return '{0}({1})'.format(self.__class__.__name__, ', '.join(parameter_list)) + return "{0}({1})".format(self.__class__.__name__, ", ".join(parameter_list)) def __str__(self): - row_format_g = '{:<20}: {:,.6g}\n' - row_format_d = '{:<20}: {:,}\n' - row_format_s = '{:<20}: {:}\n' + row_format_g = "{:<20}: {:,.6g}\n" + row_format_d = "{:<20}: {:,}\n" + row_format_s = "{:<20}: {:}\n" - string_representation = '' + string_representation = "" if self.channel is not None: - string_representation += row_format_s.format('Channel', self.channel) + string_representation += row_format_s.format("Channel", self.channel) if self.record is not None: - string_representation += row_format_d.format('Record', self.record) + string_representation += row_format_d.format("Record", self.record) - string_representation += row_format_g.format('Result', self.result) - string_representation += row_format_g.format('Mean', self.mean) - string_representation += row_format_g.format('Standard Deviation', self.stdev) - string_representation += row_format_g.format('Minimum Value', self.min_val) - string_representation += row_format_g.format('Maximum Value', self.max_val) - string_representation += row_format_d.format('Number in Stats', self.num_in_stats) + string_representation += row_format_g.format("Result", self.result) + string_representation += row_format_g.format("Mean", self.mean) + string_representation += row_format_g.format("Standard Deviation", self.stdev) + string_representation += row_format_g.format("Minimum Value", self.min_val) + string_representation += row_format_g.format("Maximum Value", self.max_val) + string_representation += row_format_d.format( + "Number in Stats", self.num_in_stats + ) return string_representation diff --git a/generated/niscope/niscope/session.py b/generated/niscope/niscope/session.py index 2bbffb2d1..bddc9f8a9 100644 --- a/generated/niscope/niscope/session.py +++ b/generated/niscope/niscope/session.py @@ -2,6 +2,7 @@ # This file was generated import array # noqa: F401 import ctypes + # Used by @ivi_synchronized from functools import wraps @@ -21,22 +22,24 @@ # Used for __repr__ import pprint + pp = pprint.PrettyPrinter(indent=4) # Helper functions for creating ctypes needed for calling into the driver DLL def get_ctypes_pointer_for_buffer(value=None, library_type=None, size=None): if isinstance(value, array.array): - assert library_type is not None, 'library_type is required for array.array' + assert library_type is not None, "library_type is required for array.array" addr, _ = value.buffer_info() return ctypes.cast(addr, ctypes.POINTER(library_type)) elif str(type(value)).find("'numpy.ndarray'") != -1: import numpy + return numpy.ctypeslib.as_ctypes(value) elif isinstance(value, bytes): return ctypes.cast(value, ctypes.POINTER(library_type)) elif isinstance(value, list): - assert library_type is not None, 'library_type is required for list' + assert library_type is not None, "library_type is required for list" return (library_type * len(value))(*value) else: if library_type is not None and size is not None: @@ -76,6 +79,7 @@ def aux(*xs, **kws): session = xs[0] # parameter 0 is 'self' which is the session object with session.lock(): return f(*xs, **kws) + return aux @@ -96,16 +100,34 @@ def __init__(self, session, prefix, current_repeated_capability_list): self._session = session self._prefix = prefix # We need at least one element. If we get an empty list, make the one element an empty string - self._current_repeated_capability_list = current_repeated_capability_list if len(current_repeated_capability_list) > 0 else [''] + self._current_repeated_capability_list = ( + current_repeated_capability_list + if len(current_repeated_capability_list) > 0 + else [""] + ) # Now we know there is at lease one entry, so we look if it is an empty string or not - self._separator = '/' if len(self._current_repeated_capability_list[0]) > 0 else '' + self._separator = ( + "/" if len(self._current_repeated_capability_list[0]) > 0 else "" + ) def __getitem__(self, repeated_capability): - '''Set/get properties or call methods with a repeated capability (i.e. channels)''' - rep_caps_list = _converters.convert_repeated_capabilities(repeated_capability, self._prefix) - complete_rep_cap_list = [current_rep_cap + self._separator + rep_cap for current_rep_cap in self._current_repeated_capability_list for rep_cap in rep_caps_list] - - return _SessionBase(vi=self._session._vi, repeated_capability_list=complete_rep_cap_list, library=self._session._library, encoding=self._session._encoding, freeze_it=True) + """Set/get properties or call methods with a repeated capability (i.e. channels)""" + rep_caps_list = _converters.convert_repeated_capabilities( + repeated_capability, self._prefix + ) + complete_rep_cap_list = [ + current_rep_cap + self._separator + rep_cap + for current_rep_cap in self._current_repeated_capability_list + for rep_cap in rep_caps_list + ] + + return _SessionBase( + vi=self._session._vi, + repeated_capability_list=complete_rep_cap_list, + library=self._session._library, + encoding=self._session._encoding, + freeze_it=True, + ) # This is a very simple context manager we can use when we need to set/get attributes @@ -117,20 +139,22 @@ def __init__(self, session): def __enter__(self): self._repeated_capability_cache = self._session._repeated_capability - self._session._repeated_capability = '' + self._session._repeated_capability = "" def __exit__(self, exc_type, exc_value, traceback): self._session._repeated_capability = self._repeated_capability_cache class _SessionBase(object): - '''Base class for all NI-SCOPE sessions.''' + """Base class for all NI-SCOPE sessions.""" # This is needed during __init__. Without it, __setattr__ raises an exception _is_frozen = False - absolute_sample_clock_offset = _attributes.AttributeViReal64TimeDeltaSeconds(1150374) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + absolute_sample_clock_offset = _attributes.AttributeViReal64TimeDeltaSeconds( + 1150374 + ) + """Type: hightime.timedelta, datetime.timedelta, or float in seconds Gets or sets the absolute time offset of the sample clock relative to the reference clock in terms of seconds. @@ -143,19 +167,21 @@ class _SessionBase(object): The range of the absolute sample clock offset is [-.5 sample clock periods, .5 sample clock periods]. The default absolute sample clock offset is 0s. - ''' + """ acquisition_start_time = _attributes.AttributeViReal64TimeDeltaSeconds(1250109) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the length of time from the trigger event to the first point in the waveform record in seconds. If the value is positive, the first point in the waveform record occurs after the trigger event (same as specifying trigger_delay_time). If the value is negative, the first point in the waveform record occurs before the trigger event (same as specifying horz_record_ref_position). - ''' - acquisition_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.AcquisitionType, 1250101) - '''Type: enums.AcquisitionType + """ + acquisition_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.AcquisitionType, 1250101 + ) + """Type: enums.AcquisitionType Specifies how the digitizer acquires data and fills the waveform record. - ''' + """ acq_arm_source = _attributes.AttributeViString(1150053) - '''Type: str + """Type: str Specifies the source the digitizer monitors for a start (acquisition arm) trigger. When the start trigger is received, the digitizer begins acquiring pretrigger samples. Valid Values: @@ -174,34 +200,34 @@ class _SessionBase(object): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - ''' + """ advance_trigger_terminal_name = _attributes.AttributeViString(1150143) - '''Type: str + """Type: str Returns the fully qualified name for the Advance Trigger terminal. You can use this terminal as the source for another trigger. - ''' + """ adv_trig_src = _attributes.AttributeViString(1150094) - '''Type: str + """Type: str Specifies the source the digitizer monitors for an advance trigger. When the advance trigger is received, the digitizer begins acquiring pretrigger samples. - ''' + """ allow_more_records_than_memory = _attributes.AttributeViBoolean(1150068) - '''Type: bool + """Type: bool Indicates whether more records can be configured with configure_horizontal_timing than fit in the onboard memory. If this property is set to True, it is necessary to fetch records while the acquisition is in progress. Eventually, some of the records will be overwritten. An error is returned from the fetch method if you attempt to fetch a record that has been overwritten. - ''' + """ arm_ref_trig_src = _attributes.AttributeViString(1150095) - '''Type: str + """Type: str Specifies the source the digitizer monitors for an arm reference trigger. When the arm reference trigger is received, the digitizer begins looking for a reference (stop) trigger from the user-configured trigger source. - ''' + """ backlog = _attributes.AttributeViReal64(1150084) - '''Type: float + """Type: float Returns the number of samples (points_done) that have been acquired but not fetched for the record specified by fetch_record_number. - ''' + """ bandpass_filter_enabled = _attributes.AttributeViBoolean(1150318) - '''Type: bool + """Type: bool Enables the bandpass filter on the specificed channel. The default value is FALSE. @@ -214,17 +240,19 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.bandpass_filter_enabled` - ''' + """ binary_sample_width = _attributes.AttributeViInt32(1150005) - '''Type: int + """Type: int Indicates the bit width of the binary data in the acquired waveform. Useful for determining which Binary Fetch method to use. Compare to resolution. To configure the device to store samples with a lower resolution that the native, set this property to the desired binary width. This can be useful for streaming at faster speeds at the cost of resolution. The least significant bits will be lost with this configuration. Valid Values: 8, 16, 32 - ''' - cable_sense_mode = _attributes.AttributeEnum(_attributes.AttributeViReal64, enums.CableSenseMode, 1150138) - '''Type: enums.CableSenseMode + """ + cable_sense_mode = _attributes.AttributeEnum( + _attributes.AttributeViReal64, enums.CableSenseMode, 1150138 + ) + """Type: enums.CableSenseMode Specifies whether and how the oscilloscope is configured to generate a CableSense signal on the specified channels when the CableSenseSignalStart method is called. @@ -251,14 +279,14 @@ class _SessionBase(object): Note: One or more of the referenced methods are not in the Python API for this driver. - ''' + """ cable_sense_signal_enable = _attributes.AttributeViBoolean(1150139) - '''Type: bool + """Type: bool TBD - ''' + """ cable_sense_voltage = _attributes.AttributeViReal64(1150137) - '''Type: float + """Type: float Returns the voltage of the CableSense signal that is written to the EEPROM of the oscilloscope during factory calibration. @@ -275,15 +303,15 @@ class _SessionBase(object): +-----------------------+ | PXIe-5162 | +-----------------------+ - ''' + """ channel_count = _attributes.AttributeViInt32(1050203) - '''Type: int + """Type: int Indicates the number of channels that the specific instrument driver supports. For channel-based properties, the IVI engine maintains a separate cache value for each channel. - ''' + """ channel_enabled = _attributes.AttributeViBoolean(1250005) - '''Type: bool + """Type: bool Specifies whether the digitizer acquires a waveform for the channel. Valid Values: @@ -299,9 +327,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.channel_enabled` - ''' - channel_terminal_configuration = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TerminalConfiguration, 1150107) - '''Type: enums.TerminalConfiguration + """ + channel_terminal_configuration = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TerminalConfiguration, 1150107 + ) + """Type: enums.TerminalConfiguration Specifies the terminal configuration for the channel. @@ -314,24 +344,24 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.channel_terminal_configuration` - ''' + """ data_transfer_block_size = _attributes.AttributeViInt32(1150316) - '''Type: int + """Type: int Specifies the maximum number of samples to transfer at one time from the device to host memory. Increasing this number should result in better fetching performance because the driver does not need to restart the transfers as often. However, increasing this number may also increase the amount of page-locked memory required from the system. - ''' + """ data_transfer_maximum_bandwidth = _attributes.AttributeViReal64(1150321) - '''Type: float + """Type: float This property specifies the maximum bandwidth that the device is allowed to consume. - ''' + """ data_transfer_preferred_packet_size = _attributes.AttributeViInt32(1150322) - '''Type: int + """Type: int This property specifies the size of (read request|memory write) data payload. Due to alignment of the data buffers, the hardware may not always generate a packet of this size. - ''' + """ device_temperature = _attributes.AttributeViReal64(1150086) - '''Type: float + """Type: float Returns the temperature of the device in degrees Celsius from the onboard sensor. @@ -344,9 +374,9 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.device_temperature` - ''' + """ enabled_channels = _attributes.AttributeViString(1150140) - '''Type: str + """Type: str Returns a comma-separated list of the channels enabled for the session in ascending order. @@ -356,17 +386,17 @@ class _SessionBase(object): Because this property returns channels in ascending order, but the order in which you specify channels for the input is important, the value of this property may not necessarily reflect the order in which NI-SCOPE performs certain actions. Refer to Channel String Syntax in the NI High-Speed Digitizers Help for more information on the effects of channel order in NI-SCOPE. - ''' + """ enable_dc_restore = _attributes.AttributeViBoolean(1150093) - '''Type: bool + """Type: bool Restores the video-triggered data retrieved by the digitizer to the video signal's zero reference point. Valid Values: True - Enable DC restore False - Disable DC restore - ''' + """ enable_time_interleaved_sampling = _attributes.AttributeViBoolean(1150128) - '''Type: bool + """Type: bool Specifies whether the digitizer acquires the waveform using multiple ADCs for the channel enabling a higher maximum real-time sampling rate. Valid Values: @@ -382,31 +412,33 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.enable_time_interleaved_sampling` - ''' + """ end_of_acquisition_event_output_terminal = _attributes.AttributeViString(1150101) - '''Type: str + """Type: str Specifies the destination for the End of Acquisition Event. When this event is asserted, the digitizer has completed sampling for all records. Consult your device documentation for a specific list of valid destinations. - ''' + """ end_of_acquisition_event_terminal_name = _attributes.AttributeViString(1150141) - '''Type: str + """Type: str Returns the fully qualified name for the End of Acquisition Event terminal. You can use this terminal as the source for a trigger. - ''' + """ end_of_record_event_output_terminal = _attributes.AttributeViString(1150099) - '''Type: str + """Type: str Specifies the destination for the End of Record Event. When this event is asserted, the digitizer has completed sampling for the current record. Consult your device documentation for a specific list of valid destinations. - ''' + """ end_of_record_event_terminal_name = _attributes.AttributeViString(1150142) - '''Type: str + """Type: str Returns the fully qualified name for the End of Record Event terminal. You can use this terminal as the source for a trigger. - ''' - end_of_record_to_advance_trigger_holdoff = _attributes.AttributeViReal64TimeDeltaSeconds(1150366) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """ + end_of_record_to_advance_trigger_holdoff = ( + _attributes.AttributeViReal64TimeDeltaSeconds(1150366) + ) + """Type: hightime.timedelta, datetime.timedelta, or float in seconds End of Record to Advance Trigger Holdoff is the length of time (in seconds) that a device waits between the completion of one record and @@ -415,9 +447,9 @@ class _SessionBase(object): Advance Trigger state, and will not store samples in onboard memory, accept an Advance Trigger, or trigger on the input signal.. **Supported Devices**: NI 5185/5186 - ''' + """ equalization_filter_enabled = _attributes.AttributeViBoolean(1150313) - '''Type: bool + """Type: bool Enables the onboard signal processing FIR block. This block is connected directly to the input signal. This filter is designed to compensate the input signal for artifacts introduced to the signal outside of the digitizer. However, since this is a generic FIR filter any coefficients are valid. Coefficients should be between +1 and -1 in value. @@ -430,9 +462,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.equalization_filter_enabled` - ''' + """ equalization_num_coefficients = _attributes.AttributeViInt32(1150312) - '''Type: int + """Type: int Returns the number of coefficients that the FIR filter can accept. This filter is designed to compensate the input signal for artifacts introduced to the signal outside of the digitizer. However, since this is a generic FIR filter any coefficients are valid. Coefficients should be between +1 and -1 in value. @@ -445,57 +477,61 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.equalization_num_coefficients` - ''' + """ exported_advance_trigger_output_terminal = _attributes.AttributeViString(1150109) - '''Type: str + """Type: str Specifies the destination to export the advance trigger. When the advance trigger is received, the digitizer begins acquiring samples for the Nth record. Consult your device documentation for a specific list of valid destinations. - ''' + """ exported_ref_trigger_output_terminal = _attributes.AttributeViString(1150098) - '''Type: str + """Type: str Specifies the destination export for the reference (stop) trigger. Consult your device documentation for a specific list of valid destinations. - ''' + """ exported_start_trigger_output_terminal = _attributes.AttributeViString(1150097) - '''Type: str + """Type: str Specifies the destination to export the Start trigger. When the start trigger is received, the digitizer begins acquiring samples. Consult your device documentation for a specific list of valid destinations. - ''' + """ _fetch_meas_num_samples = _attributes.AttributeViInt32(1150081) - '''Type: int + """Type: int Number of samples to fetch when performing a measurement. Use -1 to fetch the actual record length. Default Value: -1 - ''' + """ _fetch_num_records = _attributes.AttributeViInt32(1150080) - '''Type: int + """Type: int Number of records to fetch. Use -1 to fetch all configured records. Default Value: -1 - ''' + """ _fetch_offset = _attributes.AttributeViInt32(1150078) - '''Type: int + """Type: int Offset in samples to start fetching data within each record. The offset is applied relative to fetch_relative_to.The offset can be positive or negative. Default Value: 0 - ''' + """ _fetch_record_number = _attributes.AttributeViInt32(1150079) - '''Type: int + """Type: int Zero-based index of the first record to fetch. Use NISCOPE_FETCH_NUM_RECORDS to set the number of records to fetch. Default Value: 0. - ''' - _fetch_relative_to = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.FetchRelativeTo, 1150077) - '''Type: enums.FetchRelativeTo + """ + _fetch_relative_to = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.FetchRelativeTo, 1150077 + ) + """Type: enums.FetchRelativeTo Position to start fetching within one record. Default Value: FetchRelativeTo.PRETRIGGER - ''' - flex_fir_antialias_filter_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.FlexFIRAntialiasFilterType, 1150271) - '''Type: enums.FlexFIRAntialiasFilterType + """ + flex_fir_antialias_filter_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.FlexFIRAntialiasFilterType, 1150271 + ) + """Type: enums.FlexFIRAntialiasFilterType The NI 5922 flexible-resolution digitizer uses an onboard FIR lowpass antialias filter. Use this property to select from several types of filters to achieve desired filtering characteristics. @@ -509,33 +545,37 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.flex_fir_antialias_filter_type` - ''' + """ fpga_bitfile_path = _attributes.AttributeViString(1150375) - '''Type: str + """Type: str Gets the absolute file path to the bitfile loaded on the FPGA. Note: Gets the absolute file path to the bitfile loaded on the FPGA. - ''' - glitch_condition = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.GlitchCondition, 1250403) - '''Type: enums.GlitchCondition + """ + glitch_condition = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.GlitchCondition, 1250403 + ) + """Type: enums.GlitchCondition Specifies whether the oscilloscope triggers on pulses of duration less than or greater than the value specified by the glitch_width property. - ''' - glitch_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.GlitchPolarity, 1250402) - '''Type: enums.GlitchPolarity + """ + glitch_polarity = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.GlitchPolarity, 1250402 + ) + """Type: enums.GlitchPolarity Specifies the polarity of pulses that trigger the oscilloscope for glitch triggering. - ''' + """ glitch_width = _attributes.AttributeViReal64(1250401) - '''Type: float + """Type: float Specifies the glitch duration, in seconds. The oscilloscope triggers when it detects of pulse of duration either less than or greater than this value depending on the value of the glitch_condition property. - ''' + """ high_pass_filter_frequency = _attributes.AttributeViReal64(1150377) - '''Type: float + """Type: float Specifies the frequency for the highpass filter in Hz. The device uses one of the valid values listed below. If an invalid value is specified, @@ -554,54 +594,54 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.high_pass_filter_frequency` - ''' + """ horz_enforce_realtime = _attributes.AttributeViBoolean(1150004) - '''Type: bool + """Type: bool Indicates whether the digitizer enforces real-time measurements or allows equivalent-time measurements. - ''' + """ horz_min_num_pts = _attributes.AttributeViInt32(1250009) - '''Type: int + """Type: int Specifies the minimum number of points you require in the waveform record for each channel. NI-SCOPE uses the value you specify to configure the record length that the digitizer uses for waveform acquisition. horz_record_length returns the actual record length. Valid Values: 1 - available onboard memory - ''' + """ horz_num_records = _attributes.AttributeViInt32(1150001) - '''Type: int + """Type: int Specifies the number of records to acquire. Can be used for multi-record acquisition and single-record acquisitions. Setting this to 1 indicates a single-record acquisition. - ''' + """ horz_record_length = _attributes.AttributeViInt32(1250008) - '''Type: int + """Type: int Returns the actual number of points the digitizer acquires for each channel. The value is equal to or greater than the minimum number of points you specify with horz_min_num_pts. Allocate a ViReal64 array of this size or greater to pass as the WaveformArray parameter of the Read and Fetch methods. This property is only valid after a call to the one of the Configure Horizontal methods. - ''' + """ horz_record_ref_position = _attributes.AttributeViReal64(1250011) - '''Type: float + """Type: float Specifies the position of the Reference Event in the waveform record. When the digitizer detects a trigger, it waits the length of time the trigger_delay_time property specifies. The event that occurs when the delay time elapses is the Reference Event. The Reference Event is relative to the start of the record and is a percentage of the record length. For example, the value 50.0 corresponds to the center of the waveform record and 0.0 corresponds to the first element in the waveform record. Valid Values: 0.0 - 100.0 - ''' + """ horz_sample_rate = _attributes.AttributeViReal64(1250010) - '''Type: float + """Type: float Returns the effective sample rate using the current configuration. The units are samples per second. This property is only valid after a call to the one of the Configure Horizontal methods. Units: Hertz (Samples / Second) - ''' + """ horz_time_per_record = _attributes.AttributeViReal64TimeDeltaSeconds(1250007) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the length of time that corresponds to the record length. Units: Seconds - ''' + """ input_clock_source = _attributes.AttributeViString(1150002) - '''Type: str + """Type: str Specifies the input source for the PLL reference clock (the 1 MHz to 20 MHz clock on the NI 5122, the 10 MHz clock for the NI 5112/5620/5621/5911) to which the digitizer will be phase-locked; for the NI 5102, this is the source of the board clock. - ''' + """ input_impedance = _attributes.AttributeViReal64(1250103) - '''Type: float + """Type: float Specifies the input impedance for the channel in Ohms. @@ -614,9 +654,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.input_impedance` - ''' + """ instrument_firmware_revision = _attributes.AttributeViString(1050510) - '''Type: str + """Type: str A string that contains the firmware revision information for the instrument you are currently using. @@ -629,19 +669,19 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.instrument_firmware_revision` - ''' + """ instrument_manufacturer = _attributes.AttributeViString(1050511) - '''Type: str + """Type: str A string that contains the name of the instrument manufacturer. - ''' + """ instrument_model = _attributes.AttributeViString(1050512) - '''Type: str + """Type: str A string that contains the model number of the current instrument. - ''' + """ interleaving_offset_correction_enabled = _attributes.AttributeViBoolean(1150376) - '''Type: bool + """Type: bool Enables the interleaving offset correction on the specified channel. The default value is TRUE. @@ -660,18 +700,18 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.interleaving_offset_correction_enabled` - ''' + """ io_resource_descriptor = _attributes.AttributeViString(1050304) - '''Type: str + """Type: str Indicates the resource descriptor the driver uses to identify the physical device. If you initialize the driver with a logical name, this property contains the resource descriptor that corresponds to the entry in the IVI Configuration utility. If you initialize the instrument driver with the resource descriptor, this property contains that value.You can pass a logical name to Init or __init__. The IVI Configuration utility must contain an entry for the logical name. The logical name entry refers to a virtual instrument section in the IVI Configuration file. The virtual instrument section specifies a physical device and initial user options. Note: One or more of the referenced methods are not in the Python API for this driver. - ''' + """ is_probe_comp_on = _attributes.AttributeViBoolean(1150066) - '''Type: bool + """Type: bool Tip: This property can be set/get on specific instruments within your :py:class:`niscope.Session` instance. @@ -682,22 +722,22 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.is_probe_comp_on` - ''' + """ logical_name = _attributes.AttributeViString(1050305) - '''Type: str + """Type: str A string containing the logical name you specified when opening the current IVI session. You can pass a logical name to Init or __init__. The IVI Configuration utility must contain an entry for the logical name. The logical name entry refers to a virtual instrument section in the IVI Configuration file. The virtual instrument section specifies a physical device and initial user options. Note: One or more of the referenced methods are not in the Python API for this driver. - ''' + """ master_enable = _attributes.AttributeViBoolean(1150008) - '''Type: bool + """Type: bool Specifies whether you want the device to be a master or a slave. The master typically originates the trigger signal and clock sync pulse. For a standalone device, set this property to False. - ''' + """ max_input_frequency = _attributes.AttributeViReal64(1250006) - '''Type: float + """Type: float Specifies the bandwidth of the channel. Express this value as the frequency at which the input circuitry attenuates the input signal by 3 dB. The units are hertz. Defined Values: @@ -720,19 +760,19 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.max_input_frequency` - ''' + """ max_real_time_sampling_rate = _attributes.AttributeViReal64(1150073) - '''Type: float + """Type: float Returns the maximum real time sample rate in Hz. - ''' + """ max_ris_rate = _attributes.AttributeViReal64(1150074) - '''Type: float + """Type: float Returns the maximum sample rate in RIS mode in Hz. - ''' + """ meas_array_gain = _attributes.AttributeViReal64(1150043) - '''Type: float + """Type: float Every element of an array is multiplied by this scalar value during the Array Gain measurement. Refer to ArrayMeasurement.ARRAY_GAIN for more information. Default: 1.0 @@ -746,9 +786,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_array_gain` - ''' + """ meas_array_offset = _attributes.AttributeViReal64(1150044) - '''Type: float + """Type: float Every element of an array is added to this scalar value during the Array Offset measurement. Refer to ArrayMeasurement.ARRAY_OFFSET for more information. Default: 0.0 @@ -762,9 +802,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_array_offset` - ''' + """ meas_chan_high_ref_level = _attributes.AttributeViReal64(1150040) - '''Type: float + """Type: float Stores the high reference level used in many scalar measurements. Different channels may have different reference levels. Do not use the IVI-defined, nonchannel-based properties such as meas_high_ref if you use this property to set various channels to different values. Default: 90% @@ -778,9 +818,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_chan_high_ref_level` - ''' + """ meas_chan_low_ref_level = _attributes.AttributeViReal64(1150038) - '''Type: float + """Type: float Stores the low reference level used in many scalar measurements. Different channels may have different reference levels. Do not use the IVI-defined, nonchannel-based properties such as meas_low_ref if you use this property to set various channels to different values. Default: 10% @@ -794,9 +834,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_chan_low_ref_level` - ''' + """ meas_chan_mid_ref_level = _attributes.AttributeViReal64(1150039) - '''Type: float + """Type: float Stores the mid reference level used in many scalar measurements. Different channels may have different reference levels. Do not use the IVI-defined, nonchannel-based properties such as meas_mid_ref if you use this property to set various channels to different values. Default: 50% @@ -810,9 +850,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_chan_mid_ref_level` - ''' + """ meas_filter_center_freq = _attributes.AttributeViReal64(1150032) - '''Type: float + """Type: float The center frequency in hertz for filters of type bandpass and bandstop. The width of the filter is specified by meas_filter_width, where the cutoff frequencies are the center ± width. Default: 1.0e6 Hz @@ -826,9 +866,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_filter_center_freq` - ''' + """ meas_filter_cutoff_freq = _attributes.AttributeViReal64(1150031) - '''Type: float + """Type: float Specifies the cutoff frequency in hertz for filters of type lowpass and highpass. The cutoff frequency definition varies depending on the filter. Default: 1.0e6 Hz @@ -842,9 +882,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_filter_cutoff_freq` - ''' + """ meas_filter_order = _attributes.AttributeViInt32(1150036) - '''Type: int + """Type: int Specifies the order of an IIR filter. All positive integers are valid. Default: 2 @@ -858,9 +898,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_filter_order` - ''' + """ meas_filter_ripple = _attributes.AttributeViReal64(1150033) - '''Type: float + """Type: float Specifies the amount of ripple in the passband in units of decibels (positive values). Used only for Chebyshev filters. The more ripple allowed gives a sharper cutoff for a given filter order. Default: 0.1 dB @@ -874,9 +914,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_filter_ripple` - ''' + """ meas_filter_taps = _attributes.AttributeViInt32(1150037) - '''Type: int + """Type: int Defines the number of taps (coefficients) for an FIR filter. Default: 25 @@ -890,9 +930,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_filter_taps` - ''' + """ meas_filter_transient_waveform_percent = _attributes.AttributeViReal64(1150034) - '''Type: float + """Type: float The percentage (0 - 100%) of the IIR filtered waveform to eliminate from the beginning of the waveform. This allows eliminating the transient portion of the waveform that is undefined due to the assumptions necessary at the boundary condition. Default: 20.0% @@ -906,9 +946,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_filter_transient_waveform_percent` - ''' - meas_filter_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.FilterType, 1150035) - '''Type: enums.FilterType + """ + meas_filter_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.FilterType, 1150035 + ) + """Type: enums.FilterType Specifies the type of filter, for both IIR and FIR filters. The allowed values are the following: · NISCOPE_VAL_MEAS_LOWPASS @@ -929,9 +971,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_filter_type` - ''' + """ meas_filter_width = _attributes.AttributeViReal64(1150041) - '''Type: float + """Type: float Specifies the width of bandpass and bandstop type filters in hertz. The cutoff frequencies occur at meas_filter_center_freq ± one-half width. Default: 1.0e3 Hz @@ -945,9 +987,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_filter_width` - ''' - meas_fir_filter_window = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.FIRFilterWindow, 1150042) - '''Type: enums.FIRFilterWindow + """ + meas_fir_filter_window = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.FIRFilterWindow, 1150042 + ) + """Type: enums.FIRFilterWindow Specifies the FIR window type. The possible choices are: FIRFilterWindow.NONE @@ -968,10 +1012,10 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_fir_filter_window` - ''' + """ meas_high_ref = _attributes.AttributeViReal64(1250607) meas_hysteresis_percent = _attributes.AttributeViReal64(1150019) - '''Type: float + """Type: float Digital hysteresis that is used in several of the scalar waveform measurements. This property specifies the percentage of the full-scale vertical range for the hysteresis window size. Default: 2% @@ -985,9 +1029,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_hysteresis_percent` - ''' + """ meas_interpolation_sampling_factor = _attributes.AttributeViReal64(1150030) - '''Type: float + """Type: float The new number of points for polynomial interpolation is the sampling factor times the input number of points. For example, if you acquire 1,000 points with the digitizer and set this property to 2.5, calling FetchWaveformMeasurementArray with the ArrayMeasurement.POLYNOMIAL_INTERPOLATION measurement resamples the waveform to 2,500 points. Default: 2.0 @@ -1004,9 +1048,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_interpolation_sampling_factor` - ''' + """ meas_last_acq_histogram_size = _attributes.AttributeViInt32(1150020) - '''Type: int + """Type: int Specifies the size (that is, the number of bins) in the last acquisition histogram. This histogram is used to determine several scalar measurements, most importantly voltage low and voltage high. Default: 256 @@ -1020,11 +1064,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_last_acq_histogram_size` - ''' + """ meas_low_ref = _attributes.AttributeViReal64(1250608) meas_mid_ref = _attributes.AttributeViReal64(1250609) meas_other_channel = _attributes.AttributeViStringRepeatedCapability(1150018) - '''Type: str or int + """Type: str or int Specifies the second channel for two-channel measurements, such as ArrayMeasurement.ADD_CHANNELS. If processing steps are registered with this channel, the processing is done before the waveform is used in a two-channel measurement. Default: '0' @@ -1038,9 +1082,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_other_channel` - ''' - meas_percentage_method = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.PercentageMethod, 1150045) - '''Type: enums.PercentageMethod + """ + meas_percentage_method = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.PercentageMethod, 1150045 + ) + """Type: enums.PercentageMethod Specifies the method used to map percentage reference units to voltages for the reference. Possible values are: NISCOPE_VAL_MEAS_LOW_HIGH @@ -1060,9 +1106,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_percentage_method` - ''' + """ meas_polynomial_interpolation_order = _attributes.AttributeViInt32(1150029) - '''Type: int + """Type: int Specifies the polynomial order used for the polynomial interpolation measurement. For example, an order of 1 is linear interpolation whereas an order of 2 specifies parabolic interpolation. Any positive integer is valid. Default: 1 @@ -1076,9 +1122,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_polynomial_interpolation_order` - ''' - meas_ref_level_units = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.RefLevelUnits, 1150016) - '''Type: enums.RefLevelUnits + """ + meas_ref_level_units = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.RefLevelUnits, 1150016 + ) + """Type: enums.RefLevelUnits Specifies the units of the reference levels. NISCOPE_VAL_MEAS_VOLTAGE--Specifies that the reference levels are given in units of volts @@ -1097,9 +1145,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_ref_level_units` - ''' - meas_time_histogram_high_time = _attributes.AttributeViReal64TimeDeltaSeconds(1150028) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """ + meas_time_histogram_high_time = _attributes.AttributeViReal64TimeDeltaSeconds( + 1150028 + ) + """Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the highest time value included in the multiple acquisition time histogram. The units are always seconds. Default: 5.0e-4 seconds @@ -1113,9 +1163,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_time_histogram_high_time` - ''' + """ meas_time_histogram_high_volts = _attributes.AttributeViReal64(1150026) - '''Type: float + """Type: float Specifies the highest voltage value included in the multiple-acquisition time histogram. The units are always volts. Default: 10.0 V @@ -1129,9 +1179,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_time_histogram_high_volts` - ''' - meas_time_histogram_low_time = _attributes.AttributeViReal64TimeDeltaSeconds(1150027) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """ + meas_time_histogram_low_time = _attributes.AttributeViReal64TimeDeltaSeconds( + 1150027 + ) + """Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the lowest time value included in the multiple-acquisition time histogram. The units are always seconds. Default: -5.0e-4 seconds @@ -1145,9 +1197,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_time_histogram_low_time` - ''' + """ meas_time_histogram_low_volts = _attributes.AttributeViReal64(1150025) - '''Type: float + """Type: float Specifies the lowest voltage value included in the multiple acquisition time histogram. The units are always volts. Default: -10.0 V @@ -1161,9 +1213,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_time_histogram_low_volts` - ''' + """ meas_time_histogram_size = _attributes.AttributeViInt32(1150024) - '''Type: int + """Type: int Determines the multiple acquisition voltage histogram size. The size is set during the first call to a time histogram measurement after clearing the measurement history with clear_waveform_measurement_stats. Default: 256 @@ -1177,9 +1229,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_time_histogram_size` - ''' + """ meas_voltage_histogram_high_volts = _attributes.AttributeViReal64(1150023) - '''Type: float + """Type: float Specifies the highest voltage value included in the multiple acquisition voltage histogram. The units are always volts. Default: 10.0 V @@ -1193,9 +1245,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_voltage_histogram_high_volts` - ''' + """ meas_voltage_histogram_low_volts = _attributes.AttributeViReal64(1150022) - '''Type: float + """Type: float Specifies the lowest voltage value included in the multiple-acquisition voltage histogram. The units are always volts. Default: -10.0 V @@ -1209,9 +1261,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_voltage_histogram_low_volts` - ''' + """ meas_voltage_histogram_size = _attributes.AttributeViInt32(1150021) - '''Type: int + """Type: int Determines the multiple acquisition voltage histogram size. The size is set the first time a voltage histogram measurement is called after clearing the measurement history with the method clear_waveform_measurement_stats. Default: 256 @@ -1225,9 +1277,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_voltage_histogram_size` - ''' + """ min_sample_rate = _attributes.AttributeViReal64(1150009) - '''Type: float + """Type: float Specify the sampling rate for the acquisition in Samples per second. Valid Values: @@ -1235,9 +1287,9 @@ class _SessionBase(object): Note: One or more of the referenced methods are not in the Python API for this driver. - ''' + """ onboard_memory_size = _attributes.AttributeViInt32(1150069) - '''Type: int + """Type: int Returns the total combined amount of onboard memory for all channels in bytes. @@ -1250,14 +1302,14 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.onboard_memory_size` - ''' + """ output_clock_source = _attributes.AttributeViString(1150003) - '''Type: str + """Type: str Specifies the output source for the 10 MHz clock to which another digitizer's sample clock can be phased-locked. - ''' + """ pll_lock_status = _attributes.AttributeViBoolean(1151303) - '''Type: bool + """Type: bool If TRUE, the PLL has remained locked to the external reference clock since it was last checked. If FALSE, the PLL has become unlocked from the external reference clock since it was last checked. @@ -1270,19 +1322,19 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.pll_lock_status` - ''' + """ points_done = _attributes.AttributeViReal64(1150082) - '''Type: float + """Type: float Actual number of samples acquired in the record specified by fetch_record_number from the fetch_relative_to and fetch_offset properties. - ''' + """ poll_interval = _attributes.AttributeViInt32(1150100) - '''Type: int + """Type: int Specifies the poll interval in milliseconds to use during RIS acquisitions to check whether the acquisition is complete. - ''' + """ probe_attenuation = _attributes.AttributeViReal64(1250004) - '''Type: float + """Type: float Specifies the probe attenuation for the input channel. For example, for a 10:1 probe, set this property to 10.0. Valid Values: @@ -1297,114 +1349,122 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.probe_attenuation` - ''' + """ ready_for_advance_event_output_terminal = _attributes.AttributeViString(1150112) - '''Type: str + """Type: str Specifies the destination for the Ready for Advance Event. When this event is asserted, the digitizer is ready to receive an advance trigger. Consult your device documentation for a specific list of valid destinations. - ''' + """ ready_for_advance_event_terminal_name = _attributes.AttributeViString(1150146) - '''Type: str + """Type: str Returns the fully qualified name for the Ready for Advance Event terminal. You can use this terminal as the source for a trigger. - ''' + """ ready_for_ref_event_output_terminal = _attributes.AttributeViString(1150111) - '''Type: str + """Type: str Specifies the destination for the Ready for Reference Event. When this event is asserted, the digitizer is ready to receive a reference trigger. Consult your device documentation for a specific list of valid destinations. - ''' + """ ready_for_ref_event_terminal_name = _attributes.AttributeViString(1150147) - '''Type: str + """Type: str Returns the fully qualified name for the Ready for Reference Event terminal. You can use this terminal as the source for a trigger. - ''' + """ ready_for_start_event_output_terminal = _attributes.AttributeViString(1150110) - '''Type: str + """Type: str Specifies the destination for the Ready for Start Event. When this event is asserted, the digitizer is ready to receive a start trigger. Consult your device documentation for a specific list of valid destinations. - ''' + """ ready_for_start_event_terminal_name = _attributes.AttributeViString(1150148) - '''Type: str + """Type: str Returns the fully qualified name for the Ready for Start Event terminal. You can use this terminal as the source for a trigger. - ''' + """ records_done = _attributes.AttributeViInt32(1150083) - '''Type: int + """Type: int Specifies the number of records that have been completely acquired. - ''' + """ record_arm_source = _attributes.AttributeViString(1150065) - '''Type: str + """Type: str Specifies the record arm source. - ''' + """ ref_clk_rate = _attributes.AttributeViReal64(1150090) - '''Type: float + """Type: float If input_clock_source is an external source, this property specifies the frequency of the input, or reference clock, to which the internal sample clock timebase is synchronized. The frequency is in hertz. - ''' - ref_trigger_detector_location = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.RefTriggerDetectorLocation, 1150314) - '''Type: enums.RefTriggerDetectorLocation + """ + ref_trigger_detector_location = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.RefTriggerDetectorLocation, 1150314 + ) + """Type: enums.RefTriggerDetectorLocation Indicates which analog compare circuitry to use on the device. - ''' - ref_trigger_minimum_quiet_time = _attributes.AttributeViReal64TimeDeltaSeconds(1150315) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """ + ref_trigger_minimum_quiet_time = _attributes.AttributeViReal64TimeDeltaSeconds( + 1150315 + ) + """Type: hightime.timedelta, datetime.timedelta, or float in seconds The amount of time the trigger circuit must not detect a signal above the trigger level before the trigger is armed. This property is useful for triggering at the beginning and not in the middle of signal bursts. - ''' + """ ref_trigger_terminal_name = _attributes.AttributeViString(1150144) - '''Type: str + """Type: str Returns the fully qualified name for the Reference Trigger terminal. You can use this terminal as the source for another trigger. - ''' + """ ref_trig_tdc_enable = _attributes.AttributeViBoolean(1150096) - '''Type: bool + """Type: bool This property controls whether the TDC is used to compute an accurate trigger. - ''' + """ resolution = _attributes.AttributeViInt32(1150102) - '''Type: int + """Type: int Indicates the bit width of valid data (as opposed to padding bits) in the acquired waveform. Compare to binary_sample_width. - ''' + """ ris_in_auto_setup_enable = _attributes.AttributeViBoolean(1150106) - '''Type: bool + """Type: bool Indicates whether the digitizer should use RIS sample rates when searching for a frequency in autosetup. Valid Values: True (1) - Use RIS sample rates in autosetup False (0) - Do not use RIS sample rates in autosetup - ''' - ris_method = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.RISMethod, 1150071) - '''Type: enums.RISMethod + """ + ris_method = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.RISMethod, 1150071 + ) + """Type: enums.RISMethod Specifies the algorithm for random-interleaved sampling, which is used if the sample rate exceeds the value of max_real_time_sampling_rate. - ''' + """ ris_num_averages = _attributes.AttributeViInt32(1150070) - '''Type: int + """Type: int The number of averages for each bin in an RIS acquisition. The number of averages times the oversampling factor is the minimum number of real-time acquisitions necessary to reconstruct the RIS waveform. Averaging is useful in RIS because the trigger times are not evenly spaced, so adjacent points in the reconstructed waveform not be accurately spaced. By averaging, the errors in both time and voltage are smoothed. - ''' + """ runt_high_threshold = _attributes.AttributeViReal64(1250301) - '''Type: float + """Type: float Specifies the higher of two thresholds, in volts, that bound the vertical range to examine for runt pulses. The runt threshold that causes the oscilloscope to trigger depends on the runt polarity you select. Refer to the runt_polarity property for more information. - ''' + """ runt_low_threshold = _attributes.AttributeViReal64(1250302) - '''Type: float + """Type: float Specifies the lower of two thresholds, in volts, that bound the vertical range to examine for runt pulses. The runt threshold that causes the oscilloscope to trigger depends on the runt polarity you select. Refer to the runt_polarity property for more information. - ''' - runt_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.RuntPolarity, 1250303) - '''Type: enums.RuntPolarity + """ + runt_polarity = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.RuntPolarity, 1250303 + ) + """Type: enums.RuntPolarity Specifies the polarity of pulses that trigger the oscilloscope for runt triggering. @@ -1419,57 +1479,59 @@ class _SessionBase(object): * No portion of the pulse crosses the runt_low_threshold. When set to RuntPolarity.EITHER, the oscilloscope triggers in either case. - ''' - runt_time_condition = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.RuntTimeCondition, 1150132) - '''Type: enums.RuntTimeCondition + """ + runt_time_condition = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.RuntTimeCondition, 1150132 + ) + """Type: enums.RuntTimeCondition Specifies whether runt triggers are time qualified, and if so, how the oscilloscope triggers in relation to the duration range bounded by the runt_time_low_limit and runt_time_high_limit properties. - ''' + """ runt_time_high_limit = _attributes.AttributeViReal64(1150134) - '''Type: float + """Type: float Specifies, in seconds, the high runt threshold time. This property sets the upper bound on the duration of runt pulses that may trigger the oscilloscope. The runt_time_condition property determines how the oscilloscope triggers in relation to the runt time limits. - ''' + """ runt_time_low_limit = _attributes.AttributeViReal64(1150133) - '''Type: float + """Type: float Specifies, in seconds, the low runt threshold time. This property sets the lower bound on the duration of runt pulses that may trigger the oscilloscope. The runt_time_condition property determines how the oscilloscope triggers in relation to the runt time limits. - ''' + """ sample_mode = _attributes.AttributeViInt32(1250106) - '''Type: int + """Type: int Indicates the sample mode the digitizer is currently using. - ''' + """ samp_clk_timebase_div = _attributes.AttributeViInt32(1150089) - '''Type: int + """Type: int If samp_clk_timebase_src is an external source, specifies the ratio between the sample clock timebase rate and the actual sample rate, which can be slower. - ''' + """ sample_clock_timebase_multiplier = _attributes.AttributeViInt32(1150367) - '''Type: int + """Type: int If samp_clk_timebase_src is an external source, this property specifies the ratio between the samp_clk_timebase_rate and the actual sample rate, which can be higher. This property can be used in conjunction with samp_clk_timebase_div. Some devices use multiple ADCs to sample the same channel at an effective sample rate that is greater than the specified clock rate. When providing an external sample clock use this property to indicate when you want a higher sample rate. Valid values for this property vary by device and current configuration. **Related topics:** `Sample Clock `__ - ''' + """ samp_clk_timebase_rate = _attributes.AttributeViReal64(1150088) - '''Type: float + """Type: float If samp_clk_timebase_src is an external source, specifies the frequency in hertz of the external clock used as the timebase source. - ''' + """ samp_clk_timebase_src = _attributes.AttributeViString(1150087) - '''Type: str + """Type: str Specifies the source of the sample clock timebase, which is the timebase used to control waveform sampling. The actual sample rate may be the timebase itself or a divided version of the timebase, depending on the min_sample_rate (for internal sources) or the samp_clk_timebase_div (for external sources). - ''' + """ serial_number = _attributes.AttributeViString(1150104) - '''Type: str + """Type: str Returns the serial number of the device. @@ -1482,9 +1544,9 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.serial_number` - ''' + """ accessory_gain = _attributes.AttributeViReal64(1150279) - '''Type: float + """Type: float Returns the calibration gain for the current device configuration. @@ -1503,9 +1565,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.accessory_gain` - ''' + """ accessory_offset = _attributes.AttributeViReal64(1150280) - '''Type: float + """Type: float Returns the calibration offset for the current device configuration. @@ -1524,112 +1586,122 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.accessory_offset` - ''' + """ simulate = _attributes.AttributeViBoolean(1050005) - '''Type: bool + """Type: bool Specifies whether or not to simulate instrument driver I/O operations. If simulation is enabled, instrument driver methods perform range checking and call Ivi_GetAttribute and Ivi_SetAttribute methods, but they do not perform instrument I/O. For output parameters that represent instrument data, the instrument driver methods return calculated values. The default value is False. Use the __init__ method to override this value. - ''' + """ specific_driver_description = _attributes.AttributeViString(1050514) - '''Type: str + """Type: str A string that contains a brief description of the specific driver - ''' + """ specific_driver_revision = _attributes.AttributeViString(1050551) - '''Type: str + """Type: str A string that contains additional version information about this instrument driver. - ''' + """ specific_driver_vendor = _attributes.AttributeViString(1050513) - '''Type: str + """Type: str A string that contains the name of the vendor that supplies this driver. - ''' - start_to_ref_trigger_holdoff = _attributes.AttributeViReal64TimeDeltaSeconds(1150103) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """ + start_to_ref_trigger_holdoff = _attributes.AttributeViReal64TimeDeltaSeconds( + 1150103 + ) + """Type: hightime.timedelta, datetime.timedelta, or float in seconds Pass the length of time you want the digitizer to wait after it starts acquiring data until the digitizer enables the trigger system to detect a reference (stop) trigger. Units: Seconds Valid Values: 0.0 - 171.8 - ''' + """ start_trigger_terminal_name = _attributes.AttributeViString(1150145) - '''Type: str + """Type: str Returns the fully qualified name for the Start Trigger terminal. You can use this terminal as the source for another trigger. - ''' + """ supported_instrument_models = _attributes.AttributeViString(1050327) - '''Type: str + """Type: str A string that contains a comma-separated list of the instrument model numbers supported by this driver. - ''' + """ trigger_auto_triggered = _attributes.AttributeViBoolean(1150278) - '''Type: bool + """Type: bool Specifies if the last acquisition was auto triggered. You can use the Auto Triggered property to find out if the last acquisition was triggered. - ''' - trigger_coupling = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerCoupling, 1250014) - '''Type: enums.TriggerCoupling + """ + trigger_coupling = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TriggerCoupling, 1250014 + ) + """Type: enums.TriggerCoupling Specifies how the digitizer couples the trigger source. This property affects instrument operation only when trigger_type is set to TriggerType.EDGE, TriggerType.HYSTERESIS, or TriggerType.WINDOW. - ''' + """ trigger_delay_time = _attributes.AttributeViReal64TimeDeltaSeconds(1250015) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the trigger delay time in seconds. The trigger delay time is the length of time the digitizer waits after it receives the trigger. The event that occurs when the trigger delay elapses is the Reference Event. Valid Values: 0.0 - 171.8 - ''' + """ trigger_holdoff = _attributes.AttributeViReal64TimeDeltaSeconds(1250016) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the length of time (in seconds) the digitizer waits after detecting a trigger before enabling the trigger subsystem to detect another trigger. This property affects instrument operation only when the digitizer requires multiple acquisitions to build a complete waveform. The digitizer requires multiple waveform acquisitions when it uses equivalent-time sampling or when the digitizer is configured for a multi-record acquisition through a call to configure_horizontal_timing. Valid Values: 0.0 - 171.8 - ''' + """ trigger_hysteresis = _attributes.AttributeViReal64(1150006) - '''Type: float + """Type: float Specifies the size of the hysteresis window on either side of the trigger level. The digitizer triggers when the trigger signal passes through the threshold you specify with the Trigger Level parameter, has the slope you specify with the Trigger Slope parameter, and passes through the hysteresis window that you specify with this parameter. - ''' + """ trigger_impedance = _attributes.AttributeViReal64(1150075) - '''Type: float + """Type: float Specifies the input impedance for the external analog trigger channel in Ohms. Valid Values: 50 - 50 ohms 1000000 - 1 mega ohm - ''' + """ trigger_level = _attributes.AttributeViReal64(1250017) - '''Type: float + """Type: float Specifies the voltage threshold for the trigger subsystem. The units are volts. This property affects instrument behavior only when the trigger_type is set to TriggerType.EDGE, TriggerType.HYSTERESIS, or TriggerType.WINDOW. Valid Values: The values of the range and offset parameters in configure_vertical determine the valid range for the trigger level on the channel you use as the Trigger Source. The value you pass for this parameter must meet the following conditions: - ''' - trigger_modifier = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerModifier, 1250102) - '''Type: enums.TriggerModifier + """ + trigger_modifier = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TriggerModifier, 1250102 + ) + """Type: enums.TriggerModifier Configures the device to automatically complete an acquisition if a trigger has not been received. Valid Values: None (1) - Normal triggering Auto Trigger (2) - Auto trigger acquisition if no trigger arrives - ''' - trigger_slope = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerSlope, 1250018) - '''Type: enums.TriggerSlope + """ + trigger_slope = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TriggerSlope, 1250018 + ) + """Type: enums.TriggerSlope Specifies if a rising or a falling edge triggers the digitizer. This property affects instrument operation only when trigger_type is set to TriggerType.EDGE, TriggerType.HYSTERESIS, or TriggerType.WINDOW. - ''' + """ trigger_source = _attributes.AttributeViString(1250013) - '''Type: str + """Type: str Specifies the source the digitizer monitors for the trigger event. - ''' - trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerType, 1250012) - '''Type: enums.TriggerType + """ + trigger_type = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TriggerType, 1250012 + ) + """Type: enums.TriggerType Specifies the type of trigger to use. - ''' + """ trigger_window_high_level = _attributes.AttributeViReal64(1150014) - '''Type: float + """Type: float Pass the upper voltage threshold you want the digitizer to use for window triggering. The digitizer triggers when the trigger signal enters or leaves the window you specify with trigger_window_low_level and trigger_window_high_level @@ -1641,9 +1713,9 @@ class _SessionBase(object): Note: One or more of the referenced methods are not in the Python API for this driver. - ''' + """ trigger_window_low_level = _attributes.AttributeViReal64(1150013) - '''Type: float + """Type: float Pass the lower voltage threshold you want the digitizer to use for window triggering. The digitizer triggers when the trigger signal enters or leaves the window you specify with trigger_window_low_level and trigger_window_high_level. @@ -1656,35 +1728,45 @@ class _SessionBase(object): Note: One or more of the referenced methods are not in the Python API for this driver. - ''' - trigger_window_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerWindowMode, 1150012) - '''Type: enums.TriggerWindowMode + """ + trigger_window_mode = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TriggerWindowMode, 1150012 + ) + """Type: enums.TriggerWindowMode Specifies whether you want a trigger to occur when the signal enters or leaves the window specified by trigger_window_low_level, or trigger_window_high_level. - ''' - tv_trigger_event = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.VideoTriggerEvent, 1250205) - '''Type: enums.VideoTriggerEvent + """ + tv_trigger_event = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.VideoTriggerEvent, 1250205 + ) + """Type: enums.VideoTriggerEvent Specifies the condition in the video signal that causes the digitizer to trigger. - ''' + """ tv_trigger_line_number = _attributes.AttributeViInt32(1250206) - '''Type: int + """Type: int Specifies the line on which to trigger, if tv_trigger_event is set to line number. The valid ranges of the property depend on the signal format selected. M-NTSC has a valid range of 1 to 525. B/G-PAL, SECAM, 576i, and 576p have a valid range of 1 to 625. 720p has a valid range of 1 to 750. 1080i and 1080p have a valid range of 1125. - ''' - tv_trigger_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.VideoPolarity, 1250204) - '''Type: enums.VideoPolarity + """ + tv_trigger_polarity = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.VideoPolarity, 1250204 + ) + """Type: enums.VideoPolarity Specifies whether the video signal sync is positive or negative. - ''' - tv_trigger_signal_format = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.VideoSignalFormat, 1250201) - '''Type: enums.VideoSignalFormat + """ + tv_trigger_signal_format = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.VideoSignalFormat, 1250201 + ) + """Type: enums.VideoSignalFormat Specifies the type of video signal, such as NTSC, PAL, or SECAM. - ''' + """ use_spec_initial_x = _attributes.AttributeViBoolean(1150067) - vertical_coupling = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.VerticalCoupling, 1250003) - '''Type: enums.VerticalCoupling + vertical_coupling = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.VerticalCoupling, 1250003 + ) + """Type: enums.VerticalCoupling Specifies how the digitizer couples the input signal for the channel. When input coupling changes, the input stage takes a finite amount of time to settle. @@ -1697,9 +1779,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.vertical_coupling` - ''' + """ vertical_offset = _attributes.AttributeViReal64(1250002) - '''Type: float + """Type: float Specifies the location of the center of the range. The value is with respect to ground and is in volts. For example, to acquire a sine wave that spans between 0.0 and 10.0 V, set this property to 5.0 V. @@ -1714,9 +1796,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.vertical_offset` - ''' + """ vertical_range = _attributes.AttributeViReal64(1250001) - '''Type: float + """Type: float Specifies the absolute value of the input range for a channel in volts. For example, to acquire a sine wave that spans between -5 and +5 V, set this property to 10.0 V. Refer to the NI High-Speed Digitizers Help for a list of supported vertical ranges for each device. If the specified range is not supported by a device, the value is coerced up to the next valid range. @@ -1730,66 +1812,78 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.vertical_range` - ''' - width_condition = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.WidthCondition, 1250504) - '''Type: enums.WidthCondition + """ + width_condition = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.WidthCondition, 1250504 + ) + """Type: enums.WidthCondition Specifies whether the oscilloscope triggers on pulses within or outside the duration range bounded by the width_low_threshold and width_high_threshold properties. - ''' + """ width_high_threshold = _attributes.AttributeViReal64(1250502) - '''Type: float + """Type: float Specifies the high width threshold, in seconds. This properties sets the upper bound on the duration range that triggers the oscilloscope. The width_condition property determines how the oscilloscope triggers in relation to the width thresholds. - ''' + """ width_low_threshold = _attributes.AttributeViReal64(1250501) - '''Type: float + """Type: float Specifies the low width threshold, in seconds. This property sets the lower bound on the duration range that triggers the oscilloscope. The width_condition property determines how the oscilloscope triggers in relation to the width thresholds. - ''' - width_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.WidthPolarity, 1250503) - '''Type: enums.WidthPolarity + """ + width_polarity = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.WidthPolarity, 1250503 + ) + """Type: enums.WidthPolarity Specifies the polarity of pulses that trigger the oscilloscope for width triggering. - ''' + """ - def __init__(self, repeated_capability_list, vi, library, encoding, freeze_it=False): + def __init__( + self, repeated_capability_list, vi, library, encoding, freeze_it=False + ): self._repeated_capability_list = repeated_capability_list - self._repeated_capability = ','.join(repeated_capability_list) + self._repeated_capability = ",".join(repeated_capability_list) self._vi = vi self._library = library self._encoding = encoding # Store the parameter list for later printing in __repr__ param_list = [] - param_list.append("repeated_capability_list=" + pp.pformat(repeated_capability_list)) + param_list.append( + "repeated_capability_list=" + pp.pformat(repeated_capability_list) + ) param_list.append("vi=" + pp.pformat(vi)) param_list.append("library=" + pp.pformat(library)) param_list.append("encoding=" + pp.pformat(encoding)) - self._param_list = ', '.join(param_list) + self._param_list = ", ".join(param_list) # Instantiate any repeated capability objects - self.channels = _RepeatedCapabilities(self, '', repeated_capability_list) - self.instruments = _RepeatedCapabilities(self, '', repeated_capability_list) + self.channels = _RepeatedCapabilities(self, "", repeated_capability_list) + self.instruments = _RepeatedCapabilities(self, "", repeated_capability_list) self._is_frozen = freeze_it def __repr__(self): - return '{0}.{1}({2})'.format('niscope', self.__class__.__name__, self._param_list) + return "{0}.{1}({2})".format( + "niscope", self.__class__.__name__, self._param_list + ) def __setattr__(self, key, value): if self._is_frozen and key not in dir(self): - raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) + raise AttributeError( + "'{0}' object has no attribute '{1}'".format(type(self).__name__, key) + ) object.__setattr__(self, key, value) def _get_error_description(self, error_code): - '''_get_error_description + """_get_error_description Returns the error description. - ''' + """ try: _, error_string = self._get_error() return error_string @@ -1797,21 +1891,21 @@ def _get_error_description(self, error_code): pass try: - ''' + """ It is expected for _get_error to raise when the session is invalid (IVI spec requires GetError to fail). Use _error_message instead. It doesn't require a session. - ''' + """ error_string = self._error_message(error_code) return error_string except errors.Error: return "Failed to retrieve error description." - ''' These are code-generated ''' + """ These are code-generated """ @ivi_synchronized def _actual_meas_wfm_size(self, array_meas_function): - r'''_actual_meas_wfm_size + r"""_actual_meas_wfm_size Returns the total available size of an array measurement acquisition. @@ -1825,19 +1919,32 @@ def _actual_meas_wfm_size(self, array_meas_function): meas_waveform_size (int): Returns the size (in number of samples) of the resulting analysis waveform. - ''' + """ if type(array_meas_function) is not enums.ArrayMeasurement: - raise TypeError('Parameter array_meas_function must be of type ' + str(enums.ArrayMeasurement)) + raise TypeError( + "Parameter array_meas_function must be of type " + + str(enums.ArrayMeasurement) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - array_meas_function_ctype = _visatype.ViInt32(array_meas_function.value) # case S130 + array_meas_function_ctype = _visatype.ViInt32( + array_meas_function.value + ) # case S130 meas_waveform_size_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niScope_ActualMeasWfmSize(vi_ctype, array_meas_function_ctype, None if meas_waveform_size_ctype is None else (ctypes.pointer(meas_waveform_size_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niScope_ActualMeasWfmSize( + vi_ctype, + array_meas_function_ctype, + None + if meas_waveform_size_ctype is None + else (ctypes.pointer(meas_waveform_size_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(meas_waveform_size_ctype.value) @ivi_synchronized def _actual_num_wfms(self): - r'''_actual_num_wfms + r"""_actual_num_wfms Helps you to declare appropriately sized waveforms. NI-SCOPE handles the channel list parsing for you. @@ -1858,17 +1965,25 @@ def _actual_num_wfms(self): operating in DDC mode (NI 5620/5621 only), this value is multiplied by two. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 num_wfms_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niScope_ActualNumWfms(vi_ctype, channel_list_ctype, None if num_wfms_ctype is None else (ctypes.pointer(num_wfms_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niScope_ActualNumWfms( + vi_ctype, + channel_list_ctype, + None if num_wfms_ctype is None else (ctypes.pointer(num_wfms_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(num_wfms_ctype.value) @ivi_synchronized def add_waveform_processing(self, meas_function): - r'''add_waveform_processing + r"""add_waveform_processing Adds one measurement to the list of processing steps that are completed before the measurement. The processing is added on a per channel basis, @@ -1896,19 +2011,27 @@ def add_waveform_processing(self, meas_function): measurement `__ to add. - ''' + """ if type(meas_function) is not enums.ArrayMeasurement: - raise TypeError('Parameter meas_function must be of type ' + str(enums.ArrayMeasurement)) + raise TypeError( + "Parameter meas_function must be of type " + str(enums.ArrayMeasurement) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 meas_function_ctype = _visatype.ViInt32(meas_function.value) # case S130 - error_code = self._library.niScope_AddWaveformProcessing(vi_ctype, channel_list_ctype, meas_function_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niScope_AddWaveformProcessing( + vi_ctype, channel_list_ctype, meas_function_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def self_cal(self, option=enums.Option.SELF_CALIBRATE_ALL_CHANNELS): - r'''self_cal + r"""self_cal Self-calibrates most NI digitizers, including all SMC-based devices and most Traditional NI-DAQ (Legacy) devices. To verify that your digitizer @@ -1949,19 +2072,27 @@ def self_cal(self, option=enums.Option.SELF_CALIBRATE_ALL_CHANNELS): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - ''' + """ if type(option) is not enums.Option: - raise TypeError('Parameter option must be of type ' + str(enums.Option)) + raise TypeError("Parameter option must be of type " + str(enums.Option)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 option_ctype = _visatype.ViInt32(option.value) # case S130 - error_code = self._library.niScope_CalSelfCalibrate(vi_ctype, channel_list_ctype, option_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niScope_CalSelfCalibrate( + vi_ctype, channel_list_ctype, option_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def clear_waveform_measurement_stats(self, clearable_measurement_function=enums.ClearableMeasurement.ALL_MEASUREMENTS): - r'''clear_waveform_measurement_stats + def clear_waveform_measurement_stats( + self, clearable_measurement_function=enums.ClearableMeasurement.ALL_MEASUREMENTS + ): + r"""clear_waveform_measurement_stats Clears the waveform stats on the channel and measurement you specify. If you want to clear all of the measurements, use @@ -1992,19 +2123,30 @@ def clear_waveform_measurement_stats(self, clearable_measurement_function=enums. measurement `__ to clear the stats for. - ''' + """ if type(clearable_measurement_function) is not enums.ClearableMeasurement: - raise TypeError('Parameter clearable_measurement_function must be of type ' + str(enums.ClearableMeasurement)) + raise TypeError( + "Parameter clearable_measurement_function must be of type " + + str(enums.ClearableMeasurement) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - clearable_measurement_function_ctype = _visatype.ViInt32(clearable_measurement_function.value) # case S130 - error_code = self._library.niScope_ClearWaveformMeasurementStats(vi_ctype, channel_list_ctype, clearable_measurement_function_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + clearable_measurement_function_ctype = _visatype.ViInt32( + clearable_measurement_function.value + ) # case S130 + error_code = self._library.niScope_ClearWaveformMeasurementStats( + vi_ctype, channel_list_ctype, clearable_measurement_function_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def clear_waveform_processing(self): - r'''clear_waveform_processing + r"""clear_waveform_processing Clears the list of processing steps assigned to the given channel. The processing is added using the add_waveform_processing method, @@ -2023,16 +2165,22 @@ def clear_waveform_processing(self): To call the method on all channels, you can call it directly on the :py:class:`niscope.Session`. Example: :py:meth:`my_session.clear_waveform_processing` - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - error_code = self._library.niScope_ClearWaveformProcessing(vi_ctype, channel_list_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + error_code = self._library.niScope_ClearWaveformProcessing( + vi_ctype, channel_list_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def configure_chan_characteristics(self, input_impedance, max_input_frequency): - r'''configure_chan_characteristics + r"""configure_chan_characteristics Configures the properties that control the electrical characteristics of the channel—the input impedance and the bandwidth. @@ -2057,18 +2205,27 @@ def configure_chan_characteristics(self, input_impedance, max_input_frequency): value to use the hardware default bandwidth. Pass –1 for this value to achieve full bandwidth. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 input_impedance_ctype = _visatype.ViReal64(input_impedance) # case S150 max_input_frequency_ctype = _visatype.ViReal64(max_input_frequency) # case S150 - error_code = self._library.niScope_ConfigureChanCharacteristics(vi_ctype, channel_list_ctype, input_impedance_ctype, max_input_frequency_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niScope_ConfigureChanCharacteristics( + vi_ctype, + channel_list_ctype, + input_impedance_ctype, + max_input_frequency_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def configure_equalization_filter_coefficients(self, coefficients): - r'''configure_equalization_filter_coefficients + r"""configure_equalization_filter_coefficients Configures the custom coefficients for the equalization FIR filter on the device. This filter is designed to compensate the input signal for @@ -2096,18 +2253,33 @@ def configure_equalization_filter_coefficients(self, coefficients): `equalization_filter_enabled `__ property must be set to TRUE to enable the filter. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - number_of_coefficients_ctype = _visatype.ViInt32(0 if coefficients is None else len(coefficients)) # case S160 - coefficients_ctype = get_ctypes_pointer_for_buffer(value=coefficients, library_type=_visatype.ViReal64) # case B550 - error_code = self._library.niScope_ConfigureEqualizationFilterCoefficients(vi_ctype, channel_list_ctype, number_of_coefficients_ctype, coefficients_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + number_of_coefficients_ctype = _visatype.ViInt32( + 0 if coefficients is None else len(coefficients) + ) # case S160 + coefficients_ctype = get_ctypes_pointer_for_buffer( + value=coefficients, library_type=_visatype.ViReal64 + ) # case B550 + error_code = self._library.niScope_ConfigureEqualizationFilterCoefficients( + vi_ctype, + channel_list_ctype, + number_of_coefficients_ctype, + coefficients_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def configure_vertical(self, range, coupling, offset=0.0, probe_attenuation=1.0, enabled=True): - r'''configure_vertical + def configure_vertical( + self, range, coupling, offset=0.0, probe_attenuation=1.0, enabled=True + ): + r"""configure_vertical Configures the most commonly configured properties of the digitizer vertical subsystem, such as the range, offset, coupling, probe @@ -2140,23 +2312,45 @@ def configure_vertical(self, range, coupling, offset=0.0, probe_attenuation=1.0, enabled (bool): Specifies whether the channel is enabled for acquisition. Refer to channel_enabled for more information. - ''' + """ if type(coupling) is not enums.VerticalCoupling: - raise TypeError('Parameter coupling must be of type ' + str(enums.VerticalCoupling)) + raise TypeError( + "Parameter coupling must be of type " + str(enums.VerticalCoupling) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 range_ctype = _visatype.ViReal64(range) # case S150 offset_ctype = _visatype.ViReal64(offset) # case S150 coupling_ctype = _visatype.ViInt32(coupling.value) # case S130 probe_attenuation_ctype = _visatype.ViReal64(probe_attenuation) # case S150 enabled_ctype = _visatype.ViBoolean(enabled) # case S150 - error_code = self._library.niScope_ConfigureVertical(vi_ctype, channel_list_ctype, range_ctype, offset_ctype, coupling_ctype, probe_attenuation_ctype, enabled_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niScope_ConfigureVertical( + vi_ctype, + channel_list_ctype, + range_ctype, + offset_ctype, + coupling_ctype, + probe_attenuation_ctype, + enabled_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def fetch(self, num_samples=None, relative_to=enums.FetchRelativeTo.PRETRIGGER, offset=0, record_number=0, num_records=None, timeout=hightime.timedelta(seconds=5.0)): - '''fetch + def fetch( + self, + num_samples=None, + relative_to=enums.FetchRelativeTo.PRETRIGGER, + offset=0, + record_number=0, + num_records=None, + timeout=hightime.timedelta(seconds=5.0), + ): + """fetch Returns the waveform from a previously initiated acquisition that the digitizer acquires for the specified channel. This method returns @@ -2214,7 +2408,7 @@ def fetch(self, num_samples=None, relative_to=enums.FetchRelativeTo.PRETRIGGER, - **samples** (array of float) floating point array of samples. Length will be of the actual samples acquired - ''' + """ # Set the fetch attributes with _NoChannel(session=self): self._fetch_relative_to = relative_to @@ -2233,15 +2427,33 @@ def fetch(self, num_samples=None, relative_to=enums.FetchRelativeTo.PRETRIGGER, lwfm_i = len(wfm_info) lrcl = len(self._repeated_capability_list) # Should this raise instead? If this asserts, is it the users fault? - assert lwfm_i % lrcl == 0, 'Number of waveforms should be evenly divisible by the number of channels: len(wfm_info) == {0}, len(self._repeated_capability_list) == {1}'.format(lwfm_i, lrcl) + assert ( + lwfm_i % lrcl == 0 + ), "Number of waveforms should be evenly divisible by the number of channels: len(wfm_info) == {0}, len(self._repeated_capability_list) == {1}".format( + lwfm_i, lrcl + ) actual_num_records = int(lwfm_i / lrcl) - waveform_info._populate_channel_and_record_info(wfm_info, self._repeated_capability_list, range(record_number, record_number + actual_num_records)) + waveform_info._populate_channel_and_record_info( + wfm_info, + self._repeated_capability_list, + range(record_number, record_number + actual_num_records), + ) return wfm_info @ivi_synchronized - def fetch_array_measurement(self, array_meas_function, meas_wfm_size=None, relative_to=enums.FetchRelativeTo.PRETRIGGER, offset=0, record_number=0, num_records=None, meas_num_samples=None, timeout=hightime.timedelta(seconds=5.0)): - r'''fetch_array_measurement + def fetch_array_measurement( + self, + array_meas_function, + meas_wfm_size=None, + relative_to=enums.FetchRelativeTo.PRETRIGGER, + offset=0, + record_number=0, + num_records=None, + meas_num_samples=None, + timeout=hightime.timedelta(seconds=5.0), + ): + r"""fetch_array_measurement Obtains a waveform from the digitizer and returns the specified measurement array. This method may return multiple waveforms depending @@ -2310,34 +2522,54 @@ def fetch_array_measurement(self, array_meas_function, meas_wfm_size=None, relat - **samples**-floating point array of samples. Length will be of actual samples acquired. - ''' + """ # Set the fetch attributes with _NoChannel(session=self): self._fetch_relative_to = relative_to self._fetch_offset = offset self._fetch_record_number = record_number self._fetch_num_records = -1 if num_records is None else num_records - self._fetch_meas_num_samples = -1 if meas_num_samples is None else meas_num_samples + self._fetch_meas_num_samples = ( + -1 if meas_num_samples is None else meas_num_samples + ) if meas_wfm_size is None: meas_wfm_size = self._actual_meas_wfm_size(array_meas_function) - meas_wfm, wfm_info = self._fetch_array_measurement(array_meas_function, meas_wfm_size, timeout) + meas_wfm, wfm_info = self._fetch_array_measurement( + array_meas_function, meas_wfm_size, timeout + ) record_length = int(len(meas_wfm) / len(wfm_info)) waveform_info._populate_samples_info(wfm_info, meas_wfm, record_length) wfm_info_count = len(wfm_info) channel_count = len(self._repeated_capability_list) - assert wfm_info_count % channel_count == 0, 'Number of waveforms should be evenly divisible by the number of channels: len(wfm_info) == {0}, len(self._repeated_capability_list) == {1}'.format(wfm_info_count, channel_count) + assert ( + wfm_info_count % channel_count == 0 + ), "Number of waveforms should be evenly divisible by the number of channels: len(wfm_info) == {0}, len(self._repeated_capability_list) == {1}".format( + wfm_info_count, channel_count + ) actual_num_records = int(wfm_info_count / channel_count) - waveform_info._populate_channel_and_record_info(wfm_info, self._repeated_capability_list, range(record_number, record_number + actual_num_records)) + waveform_info._populate_channel_and_record_info( + wfm_info, + self._repeated_capability_list, + range(record_number, record_number + actual_num_records), + ) return wfm_info @ivi_synchronized - def fetch_measurement_stats(self, scalar_meas_function, relative_to=enums.FetchRelativeTo.PRETRIGGER, offset=0, record_number=0, num_records=None, timeout=hightime.timedelta(seconds=5.0)): - r'''fetch_measurement_stats + def fetch_measurement_stats( + self, + scalar_meas_function, + relative_to=enums.FetchRelativeTo.PRETRIGGER, + offset=0, + record_number=0, + num_records=None, + timeout=hightime.timedelta(seconds=5.0), + ): + r"""fetch_measurement_stats Obtains a waveform measurement and returns the measurement value. This method may return multiple statistical results depending on the number @@ -2406,7 +2638,7 @@ def fetch_measurement_stats(self, scalar_meas_function, relative_to=enums.FetchR - **channel** (str): channel name this result was acquired from - **record** (int): record number of this result - ''' + """ # Set the fetch attributes with _NoChannel(session=self): self._fetch_relative_to = relative_to @@ -2414,24 +2646,43 @@ def fetch_measurement_stats(self, scalar_meas_function, relative_to=enums.FetchR self._fetch_record_number = record_number self._fetch_num_records = -1 if num_records is None else num_records - results, means, stdevs, min_vals, max_vals, nums_in_stats = self._fetch_measurement_stats(scalar_meas_function, timeout) + ( + results, + means, + stdevs, + min_vals, + max_vals, + nums_in_stats, + ) = self._fetch_measurement_stats(scalar_meas_function, timeout) output = [] - for result, mean, stdev, min_val, max_val, num_in_stats in zip(results, means, stdevs, min_vals, max_vals, nums_in_stats): - measurement_stat = measurement_stats.MeasurementStats(result, mean, stdev, min_val, max_val, num_in_stats) + for result, mean, stdev, min_val, max_val, num_in_stats in zip( + results, means, stdevs, min_vals, max_vals, nums_in_stats + ): + measurement_stat = measurement_stats.MeasurementStats( + result, mean, stdev, min_val, max_val, num_in_stats + ) output.append(measurement_stat) results_count = len(results) channel_count = len(self._repeated_capability_list) - assert results_count % channel_count == 0, 'Number of results should be evenly divisible by the number of channels: len(results) == {0}, len(self._repeated_capability_list) == {1}'.format(results_count, channel_count) + assert ( + results_count % channel_count == 0 + ), "Number of results should be evenly divisible by the number of channels: len(results) == {0}, len(self._repeated_capability_list) == {1}".format( + results_count, channel_count + ) actual_num_records = int(results_count / channel_count) - waveform_info._populate_channel_and_record_info(output, self._repeated_capability_list, range(record_number, record_number + actual_num_records)) + waveform_info._populate_channel_and_record_info( + output, + self._repeated_capability_list, + range(record_number, record_number + actual_num_records), + ) return output @ivi_synchronized def get_equalization_filter_coefficients(self): - '''get_equalization_filter_coefficients + """get_equalization_filter_coefficients Retrieves the custom coefficients for the equalization FIR filter on the device. This filter is designed to compensate the input signal for artifacts introduced to the signal outside of the digitizer. Because this filter is a generic FIR filter, any coefficients are valid. Coefficient values should be between +1 and –1. @@ -2445,12 +2696,22 @@ def get_equalization_filter_coefficients(self): To call the method on all channels, you can call it directly on the :py:class:`niscope.Session`. Example: :py:meth:`my_session.get_equalization_filter_coefficients` - ''' - return self._get_equalization_filter_coefficients(self.equalization_num_coefficients) + """ + return self._get_equalization_filter_coefficients( + self.equalization_num_coefficients + ) @ivi_synchronized - def read(self, num_samples=None, relative_to=enums.FetchRelativeTo.PRETRIGGER, offset=0, record_number=0, num_records=None, timeout=hightime.timedelta(seconds=5.0)): - '''read + def read( + self, + num_samples=None, + relative_to=enums.FetchRelativeTo.PRETRIGGER, + offset=0, + record_number=0, + num_records=None, + timeout=hightime.timedelta(seconds=5.0), + ): + """read Initiates an acquisition, waits for it to complete, and retrieves the data. The process is similar to calling _initiate_acquisition, @@ -2511,7 +2772,7 @@ def read(self, num_samples=None, relative_to=enums.FetchRelativeTo.PRETRIGGER, o - **samples** (array of float) floating point array of samples. Length will be of the actual samples acquired - ''' + """ # Set the fetch attributes with _NoChannel(session=self): self._fetch_relative_to = relative_to @@ -2530,15 +2791,23 @@ def read(self, num_samples=None, relative_to=enums.FetchRelativeTo.PRETRIGGER, o lwfm_i = len(wfm_info) lrcl = len(self._repeated_capability_list) # Should this raise instead? If this asserts, is it the users fault? - assert lwfm_i % lrcl == 0, 'Number of waveforms should be evenly divisible by the number of channels: len(wfm_info) == {0}, len(self._repeated_capability_list) == {1}'.format(lwfm_i, lrcl) + assert ( + lwfm_i % lrcl == 0 + ), "Number of waveforms should be evenly divisible by the number of channels: len(wfm_info) == {0}, len(self._repeated_capability_list) == {1}".format( + lwfm_i, lrcl + ) actual_num_records = int(lwfm_i / lrcl) - waveform_info._populate_channel_and_record_info(wfm_info, self._repeated_capability_list, range(record_number, record_number + actual_num_records)) + waveform_info._populate_channel_and_record_info( + wfm_info, + self._repeated_capability_list, + range(record_number, record_number + actual_num_records), + ) return wfm_info @ivi_synchronized def _fetch(self, num_samples, timeout=hightime.timedelta(seconds=5.0)): - r'''_fetch + r"""_fetch Returns the waveform from a previously initiated acquisition that the digitizer acquires for the specified channel. This method returns @@ -2627,23 +2896,45 @@ def _fetch(self, num_samples, timeout=hightime.timedelta(seconds=5.0)): Call _actual_num_wfms to determine the size of this array. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64( + timeout + ) # case S140 num_samples_ctype = _visatype.ViInt32(num_samples) # case S150 - waveform_size = (num_samples * self._actual_num_wfms()) # case B560 + waveform_size = num_samples * self._actual_num_wfms() # case B560 waveform_array = array.array("d", [0] * waveform_size) # case B560 - waveform_ctype = get_ctypes_pointer_for_buffer(value=waveform_array, library_type=_visatype.ViReal64) # case B560 + waveform_ctype = get_ctypes_pointer_for_buffer( + value=waveform_array, library_type=_visatype.ViReal64 + ) # case B560 wfm_info_size = self._actual_num_wfms() # case B560 - wfm_info_ctype = get_ctypes_pointer_for_buffer(library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size) # case B560 - error_code = self._library.niScope_Fetch(vi_ctype, channel_list_ctype, timeout_ctype, num_samples_ctype, waveform_ctype, wfm_info_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return waveform_array, [waveform_info.WaveformInfo(wfm_info_ctype[i]) for i in range(self._actual_num_wfms())] + wfm_info_ctype = get_ctypes_pointer_for_buffer( + library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size + ) # case B560 + error_code = self._library.niScope_Fetch( + vi_ctype, + channel_list_ctype, + timeout_ctype, + num_samples_ctype, + waveform_ctype, + wfm_info_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return waveform_array, [ + waveform_info.WaveformInfo(wfm_info_ctype[i]) + for i in range(self._actual_num_wfms()) + ] @ivi_synchronized - def _fetch_into_numpy(self, num_samples, waveform, timeout=hightime.timedelta(seconds=5.0)): - r'''_fetch + def _fetch_into_numpy( + self, num_samples, waveform, timeout=hightime.timedelta(seconds=5.0) + ): + r"""_fetch Returns the waveform from a previously initiated acquisition that the digitizer acquires for the specified channel. This method returns @@ -2753,29 +3044,57 @@ def _fetch_into_numpy(self, num_samples, waveform, timeout=hightime.timedelta(se Call _actual_num_wfms to determine the size of this array. - ''' + """ import numpy if type(waveform) is not numpy.ndarray: - raise TypeError('waveform must be {0}, is {1}'.format(numpy.ndarray, type(waveform))) + raise TypeError( + "waveform must be {0}, is {1}".format(numpy.ndarray, type(waveform)) + ) if numpy.isfortran(waveform) is True: - raise TypeError('waveform must be in C-order') - if waveform.dtype is not numpy.dtype('float64'): - raise TypeError('waveform must be numpy.ndarray of dtype=float64, is ' + str(waveform.dtype)) + raise TypeError("waveform must be in C-order") + if waveform.dtype is not numpy.dtype("float64"): + raise TypeError( + "waveform must be numpy.ndarray of dtype=float64, is " + + str(waveform.dtype) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64( + timeout + ) # case S140 num_samples_ctype = _visatype.ViInt32(num_samples) # case S150 waveform_ctype = get_ctypes_pointer_for_buffer(value=waveform) # case B510 wfm_info_size = self._actual_num_wfms() # case B560 - wfm_info_ctype = get_ctypes_pointer_for_buffer(library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size) # case B560 - error_code = self._library.niScope_Fetch(vi_ctype, channel_list_ctype, timeout_ctype, num_samples_ctype, waveform_ctype, wfm_info_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return [waveform_info.WaveformInfo(wfm_info_ctype[i]) for i in range(self._actual_num_wfms())] + wfm_info_ctype = get_ctypes_pointer_for_buffer( + library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size + ) # case B560 + error_code = self._library.niScope_Fetch( + vi_ctype, + channel_list_ctype, + timeout_ctype, + num_samples_ctype, + waveform_ctype, + wfm_info_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return [ + waveform_info.WaveformInfo(wfm_info_ctype[i]) + for i in range(self._actual_num_wfms()) + ] @ivi_synchronized - def _fetch_array_measurement(self, array_meas_function, measurement_waveform_size, timeout=hightime.timedelta(seconds=5.0)): - r'''_fetch_array_measurement + def _fetch_array_measurement( + self, + array_meas_function, + measurement_waveform_size, + timeout=hightime.timedelta(seconds=5.0), + ): + r"""_fetch_array_measurement Obtains a waveform from the digitizer and returns the specified measurement array. This method may return multiple waveforms depending @@ -2863,25 +3182,58 @@ def _fetch_array_measurement(self, array_meas_function, measurement_waveform_siz Call _actual_num_wfms to determine the size of this array. - ''' + """ if type(array_meas_function) is not enums.ArrayMeasurement: - raise TypeError('Parameter array_meas_function must be of type ' + str(enums.ArrayMeasurement)) + raise TypeError( + "Parameter array_meas_function must be of type " + + str(enums.ArrayMeasurement) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 - array_meas_function_ctype = _visatype.ViInt32(array_meas_function.value) # case S130 - measurement_waveform_size_ctype = _visatype.ViInt32(measurement_waveform_size) # case S150 - meas_wfm_size = (measurement_waveform_size * self._actual_num_wfms()) # case B560 - meas_wfm_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=meas_wfm_size) # case B560 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64( + timeout + ) # case S140 + array_meas_function_ctype = _visatype.ViInt32( + array_meas_function.value + ) # case S130 + measurement_waveform_size_ctype = _visatype.ViInt32( + measurement_waveform_size + ) # case S150 + meas_wfm_size = measurement_waveform_size * self._actual_num_wfms() # case B560 + meas_wfm_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViReal64, size=meas_wfm_size + ) # case B560 wfm_info_size = self._actual_num_wfms() # case B560 - wfm_info_ctype = get_ctypes_pointer_for_buffer(library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size) # case B560 - error_code = self._library.niScope_FetchArrayMeasurement(vi_ctype, channel_list_ctype, timeout_ctype, array_meas_function_ctype, measurement_waveform_size_ctype, meas_wfm_ctype, wfm_info_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return [float(meas_wfm_ctype[i]) for i in range((measurement_waveform_size * self._actual_num_wfms()))], [waveform_info.WaveformInfo(wfm_info_ctype[i]) for i in range(self._actual_num_wfms())] + wfm_info_ctype = get_ctypes_pointer_for_buffer( + library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size + ) # case B560 + error_code = self._library.niScope_FetchArrayMeasurement( + vi_ctype, + channel_list_ctype, + timeout_ctype, + array_meas_function_ctype, + measurement_waveform_size_ctype, + meas_wfm_ctype, + wfm_info_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return [ + float(meas_wfm_ctype[i]) + for i in range((measurement_waveform_size * self._actual_num_wfms())) + ], [ + waveform_info.WaveformInfo(wfm_info_ctype[i]) + for i in range(self._actual_num_wfms()) + ] @ivi_synchronized - def _fetch_binary16_into_numpy(self, num_samples, waveform, timeout=hightime.timedelta(seconds=5.0)): - r'''_fetch_binary16 + def _fetch_binary16_into_numpy( + self, num_samples, waveform, timeout=hightime.timedelta(seconds=5.0) + ): + r"""_fetch_binary16 Retrieves data from a previously initiated acquisition and returns binary 16-bit waveforms. This method may return multiple waveforms @@ -2989,29 +3341,54 @@ def _fetch_binary16_into_numpy(self, num_samples, waveform, timeout=hightime.tim Call _actual_num_wfms to determine the size of this array. - ''' + """ import numpy if type(waveform) is not numpy.ndarray: - raise TypeError('waveform must be {0}, is {1}'.format(numpy.ndarray, type(waveform))) + raise TypeError( + "waveform must be {0}, is {1}".format(numpy.ndarray, type(waveform)) + ) if numpy.isfortran(waveform) is True: - raise TypeError('waveform must be in C-order') - if waveform.dtype is not numpy.dtype('int16'): - raise TypeError('waveform must be numpy.ndarray of dtype=int16, is ' + str(waveform.dtype)) + raise TypeError("waveform must be in C-order") + if waveform.dtype is not numpy.dtype("int16"): + raise TypeError( + "waveform must be numpy.ndarray of dtype=int16, is " + + str(waveform.dtype) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64( + timeout + ) # case S140 num_samples_ctype = _visatype.ViInt32(num_samples) # case S150 waveform_ctype = get_ctypes_pointer_for_buffer(value=waveform) # case B510 wfm_info_size = self._actual_num_wfms() # case B560 - wfm_info_ctype = get_ctypes_pointer_for_buffer(library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size) # case B560 - error_code = self._library.niScope_FetchBinary16(vi_ctype, channel_list_ctype, timeout_ctype, num_samples_ctype, waveform_ctype, wfm_info_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return [waveform_info.WaveformInfo(wfm_info_ctype[i]) for i in range(self._actual_num_wfms())] + wfm_info_ctype = get_ctypes_pointer_for_buffer( + library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size + ) # case B560 + error_code = self._library.niScope_FetchBinary16( + vi_ctype, + channel_list_ctype, + timeout_ctype, + num_samples_ctype, + waveform_ctype, + wfm_info_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return [ + waveform_info.WaveformInfo(wfm_info_ctype[i]) + for i in range(self._actual_num_wfms()) + ] @ivi_synchronized - def _fetch_binary32_into_numpy(self, num_samples, waveform, timeout=hightime.timedelta(seconds=5.0)): - r'''_fetch_binary32 + def _fetch_binary32_into_numpy( + self, num_samples, waveform, timeout=hightime.timedelta(seconds=5.0) + ): + r"""_fetch_binary32 Retrieves data from a previously initiated acquisition and returns binary 32-bit waveforms. This method may return multiple waveforms @@ -3119,29 +3496,54 @@ def _fetch_binary32_into_numpy(self, num_samples, waveform, timeout=hightime.tim Call _actual_num_wfms to determine the size of this array. - ''' + """ import numpy if type(waveform) is not numpy.ndarray: - raise TypeError('waveform must be {0}, is {1}'.format(numpy.ndarray, type(waveform))) + raise TypeError( + "waveform must be {0}, is {1}".format(numpy.ndarray, type(waveform)) + ) if numpy.isfortran(waveform) is True: - raise TypeError('waveform must be in C-order') - if waveform.dtype is not numpy.dtype('int32'): - raise TypeError('waveform must be numpy.ndarray of dtype=int32, is ' + str(waveform.dtype)) + raise TypeError("waveform must be in C-order") + if waveform.dtype is not numpy.dtype("int32"): + raise TypeError( + "waveform must be numpy.ndarray of dtype=int32, is " + + str(waveform.dtype) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64( + timeout + ) # case S140 num_samples_ctype = _visatype.ViInt32(num_samples) # case S150 waveform_ctype = get_ctypes_pointer_for_buffer(value=waveform) # case B510 wfm_info_size = self._actual_num_wfms() # case B560 - wfm_info_ctype = get_ctypes_pointer_for_buffer(library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size) # case B560 - error_code = self._library.niScope_FetchBinary32(vi_ctype, channel_list_ctype, timeout_ctype, num_samples_ctype, waveform_ctype, wfm_info_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return [waveform_info.WaveformInfo(wfm_info_ctype[i]) for i in range(self._actual_num_wfms())] + wfm_info_ctype = get_ctypes_pointer_for_buffer( + library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size + ) # case B560 + error_code = self._library.niScope_FetchBinary32( + vi_ctype, + channel_list_ctype, + timeout_ctype, + num_samples_ctype, + waveform_ctype, + wfm_info_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return [ + waveform_info.WaveformInfo(wfm_info_ctype[i]) + for i in range(self._actual_num_wfms()) + ] @ivi_synchronized - def _fetch_binary8_into_numpy(self, num_samples, waveform, timeout=hightime.timedelta(seconds=5.0)): - r'''_fetch_binary8 + def _fetch_binary8_into_numpy( + self, num_samples, waveform, timeout=hightime.timedelta(seconds=5.0) + ): + r"""_fetch_binary8 Retrieves data from a previously initiated acquisition and returns binary 8-bit waveforms. This method may return multiple waveforms @@ -3249,29 +3651,60 @@ def _fetch_binary8_into_numpy(self, num_samples, waveform, timeout=hightime.time Call _actual_num_wfms to determine the size of this array. - ''' + """ import numpy if type(waveform) is not numpy.ndarray: - raise TypeError('waveform must be {0}, is {1}'.format(numpy.ndarray, type(waveform))) + raise TypeError( + "waveform must be {0}, is {1}".format(numpy.ndarray, type(waveform)) + ) if numpy.isfortran(waveform) is True: - raise TypeError('waveform must be in C-order') - if waveform.dtype is not numpy.dtype('int8'): - raise TypeError('waveform must be numpy.ndarray of dtype=int8, is ' + str(waveform.dtype)) + raise TypeError("waveform must be in C-order") + if waveform.dtype is not numpy.dtype("int8"): + raise TypeError( + "waveform must be numpy.ndarray of dtype=int8, is " + + str(waveform.dtype) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64( + timeout + ) # case S140 num_samples_ctype = _visatype.ViInt32(num_samples) # case S150 waveform_ctype = get_ctypes_pointer_for_buffer(value=waveform) # case B510 wfm_info_size = self._actual_num_wfms() # case B560 - wfm_info_ctype = get_ctypes_pointer_for_buffer(library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size) # case B560 - error_code = self._library.niScope_FetchBinary8(vi_ctype, channel_list_ctype, timeout_ctype, num_samples_ctype, waveform_ctype, wfm_info_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return [waveform_info.WaveformInfo(wfm_info_ctype[i]) for i in range(self._actual_num_wfms())] + wfm_info_ctype = get_ctypes_pointer_for_buffer( + library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size + ) # case B560 + error_code = self._library.niScope_FetchBinary8( + vi_ctype, + channel_list_ctype, + timeout_ctype, + num_samples_ctype, + waveform_ctype, + wfm_info_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return [ + waveform_info.WaveformInfo(wfm_info_ctype[i]) + for i in range(self._actual_num_wfms()) + ] @ivi_synchronized - def fetch_into(self, waveform, relative_to=enums.FetchRelativeTo.PRETRIGGER, offset=0, record_number=0, num_records=None, timeout=hightime.timedelta(seconds=5.0)): - '''fetch + def fetch_into( + self, + waveform, + relative_to=enums.FetchRelativeTo.PRETRIGGER, + offset=0, + record_number=0, + num_records=None, + timeout=hightime.timedelta(seconds=5.0), + ): + """fetch Returns the waveform from a previously initiated acquisition that the digitizer acquires for the specified channel. This method returns @@ -3343,7 +3776,7 @@ def fetch_into(self, waveform, relative_to=enums.FetchRelativeTo.PRETRIGGER, off - **samples** (array of float) floating point array of samples. Length will be of the actual samples acquired - ''' + """ import numpy # Set the fetch attributes @@ -3356,15 +3789,27 @@ def fetch_into(self, waveform, relative_to=enums.FetchRelativeTo.PRETRIGGER, off num_samples = int(len(waveform) / self._actual_num_wfms()) if waveform.dtype == numpy.float64: - wfm_info = self._fetch_into_numpy(num_samples=num_samples, waveform=waveform, timeout=timeout) + wfm_info = self._fetch_into_numpy( + num_samples=num_samples, waveform=waveform, timeout=timeout + ) elif waveform.dtype == numpy.int8: - wfm_info = self._fetch_binary8_into_numpy(num_samples=num_samples, waveform=waveform, timeout=timeout) + wfm_info = self._fetch_binary8_into_numpy( + num_samples=num_samples, waveform=waveform, timeout=timeout + ) elif waveform.dtype == numpy.int16: - wfm_info = self._fetch_binary16_into_numpy(num_samples=num_samples, waveform=waveform, timeout=timeout) + wfm_info = self._fetch_binary16_into_numpy( + num_samples=num_samples, waveform=waveform, timeout=timeout + ) elif waveform.dtype == numpy.int32: - wfm_info = self._fetch_binary32_into_numpy(num_samples=num_samples, waveform=waveform, timeout=timeout) + wfm_info = self._fetch_binary32_into_numpy( + num_samples=num_samples, waveform=waveform, timeout=timeout + ) else: - raise TypeError("Unsupported dtype. Is {0}, expected {1}, {2}, {3}, or {4}".format(waveform.dtype, numpy.float64, numpy.int8, numpy.int16, numpy.int32)) + raise TypeError( + "Unsupported dtype. Is {0}, expected {1}, {2}, {3}, or {4}".format( + waveform.dtype, numpy.float64, numpy.int8, numpy.int16, numpy.int32 + ) + ) mv = memoryview(waveform) @@ -3372,15 +3817,25 @@ def fetch_into(self, waveform, relative_to=enums.FetchRelativeTo.PRETRIGGER, off lwfm_i = len(wfm_info) lrcl = len(self._repeated_capability_list) - assert lwfm_i % lrcl == 0, 'Number of waveforms should be evenly divisible by the number of channels: len(wfm_info) == {0}, len(self._repeated_capability_list) == {1}'.format(lwfm_i, lrcl) + assert ( + lwfm_i % lrcl == 0 + ), "Number of waveforms should be evenly divisible by the number of channels: len(wfm_info) == {0}, len(self._repeated_capability_list) == {1}".format( + lwfm_i, lrcl + ) actual_num_records = int(lwfm_i / lrcl) - waveform_info._populate_channel_and_record_info(wfm_info, self._repeated_capability_list, range(record_number, record_number + actual_num_records)) + waveform_info._populate_channel_and_record_info( + wfm_info, + self._repeated_capability_list, + range(record_number, record_number + actual_num_records), + ) return wfm_info @ivi_synchronized - def _fetch_measurement_stats(self, scalar_meas_function, timeout=hightime.timedelta(seconds=5.0)): - r'''_fetch_measurement_stats + def _fetch_measurement_stats( + self, scalar_meas_function, timeout=hightime.timedelta(seconds=5.0) + ): + r"""_fetch_measurement_stats Obtains a waveform measurement and returns the measurement value. This method may return multiple statistical results depending on the number @@ -3446,32 +3901,73 @@ def _fetch_measurement_stats(self, scalar_meas_function, timeout=hightime.timede num_in_stats (list of int): Returns the number of times _fetch_measurement_stats has been called. - ''' + """ if type(scalar_meas_function) is not enums.ScalarMeasurement: - raise TypeError('Parameter scalar_meas_function must be of type ' + str(enums.ScalarMeasurement)) + raise TypeError( + "Parameter scalar_meas_function must be of type " + + str(enums.ScalarMeasurement) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 - scalar_meas_function_ctype = _visatype.ViInt32(scalar_meas_function.value) # case S130 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64( + timeout + ) # case S140 + scalar_meas_function_ctype = _visatype.ViInt32( + scalar_meas_function.value + ) # case S130 result_size = self._actual_num_wfms() # case B560 - result_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=result_size) # case B560 + result_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViReal64, size=result_size + ) # case B560 mean_size = self._actual_num_wfms() # case B560 - mean_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=mean_size) # case B560 + mean_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViReal64, size=mean_size + ) # case B560 stdev_size = self._actual_num_wfms() # case B560 - stdev_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=stdev_size) # case B560 + stdev_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViReal64, size=stdev_size + ) # case B560 min_size = self._actual_num_wfms() # case B560 - min_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=min_size) # case B560 + min_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViReal64, size=min_size + ) # case B560 max_size = self._actual_num_wfms() # case B560 - max_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=max_size) # case B560 + max_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViReal64, size=max_size + ) # case B560 num_in_stats_size = self._actual_num_wfms() # case B560 - num_in_stats_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViInt32, size=num_in_stats_size) # case B560 - error_code = self._library.niScope_FetchMeasurementStats(vi_ctype, channel_list_ctype, timeout_ctype, scalar_meas_function_ctype, result_ctype, mean_ctype, stdev_ctype, min_ctype, max_ctype, num_in_stats_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return [float(result_ctype[i]) for i in range(self._actual_num_wfms())], [float(mean_ctype[i]) for i in range(self._actual_num_wfms())], [float(stdev_ctype[i]) for i in range(self._actual_num_wfms())], [float(min_ctype[i]) for i in range(self._actual_num_wfms())], [float(max_ctype[i]) for i in range(self._actual_num_wfms())], [int(num_in_stats_ctype[i]) for i in range(self._actual_num_wfms())] + num_in_stats_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViInt32, size=num_in_stats_size + ) # case B560 + error_code = self._library.niScope_FetchMeasurementStats( + vi_ctype, + channel_list_ctype, + timeout_ctype, + scalar_meas_function_ctype, + result_ctype, + mean_ctype, + stdev_ctype, + min_ctype, + max_ctype, + num_in_stats_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return ( + [float(result_ctype[i]) for i in range(self._actual_num_wfms())], + [float(mean_ctype[i]) for i in range(self._actual_num_wfms())], + [float(stdev_ctype[i]) for i in range(self._actual_num_wfms())], + [float(min_ctype[i]) for i in range(self._actual_num_wfms())], + [float(max_ctype[i]) for i in range(self._actual_num_wfms())], + [int(num_in_stats_ctype[i]) for i in range(self._actual_num_wfms())], + ) @ivi_synchronized def _get_attribute_vi_boolean(self, attribute_id): - r'''_get_attribute_vi_boolean + r"""_get_attribute_vi_boolean Queries the value of a ViBoolean property. You can use this method to get the values of instrument-specific properties and inherent IVI @@ -3501,18 +3997,27 @@ def _get_attribute_vi_boolean(self, attribute_id): value (bool): Returns the current value of the property; pass the address of a ViBoolean variable. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niScope_GetAttributeViBoolean(vi_ctype, channel_list_ctype, attribute_id_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niScope_GetAttributeViBoolean( + vi_ctype, + channel_list_ctype, + attribute_id_ctype, + None if value_ctype is None else (ctypes.pointer(value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return bool(value_ctype.value) @ivi_synchronized def _get_attribute_vi_int32(self, attribute_id): - r'''_get_attribute_vi_int32 + r"""_get_attribute_vi_int32 Queries the value of a ViInt32 property. You can use this method to get the values of instrument-specific properties and inherent IVI @@ -3541,18 +4046,27 @@ def _get_attribute_vi_int32(self, attribute_id): Returns: value (int): Returns the current value of the property. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niScope_GetAttributeViInt32(vi_ctype, channel_list_ctype, attribute_id_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niScope_GetAttributeViInt32( + vi_ctype, + channel_list_ctype, + attribute_id_ctype, + None if value_ctype is None else (ctypes.pointer(value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(value_ctype.value) @ivi_synchronized def _get_attribute_vi_int64(self, attribute_id): - r'''_get_attribute_vi_int64 + r"""_get_attribute_vi_int64 Queries the value of a ViInt64 property. You can use this method to get the values of instrument-specific properties and inherent IVI @@ -3581,18 +4095,27 @@ def _get_attribute_vi_int64(self, attribute_id): Returns: value (int): Returns the current value of the property. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViInt64() # case S220 - error_code = self._library.niScope_GetAttributeViInt64(vi_ctype, channel_list_ctype, attribute_id_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niScope_GetAttributeViInt64( + vi_ctype, + channel_list_ctype, + attribute_id_ctype, + None if value_ctype is None else (ctypes.pointer(value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(value_ctype.value) @ivi_synchronized def _get_attribute_vi_real64(self, attribute_id): - r'''_get_attribute_vi_real64 + r"""_get_attribute_vi_real64 Queries the value of a ViReal64 property. You can use this method to get the values of instrument-specific properties and inherent IVI @@ -3622,18 +4145,27 @@ def _get_attribute_vi_real64(self, attribute_id): value (float): Returns the current value of the property; pass the address of a ViReal64 variable. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niScope_GetAttributeViReal64(vi_ctype, channel_list_ctype, attribute_id_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niScope_GetAttributeViReal64( + vi_ctype, + channel_list_ctype, + attribute_id_ctype, + None if value_ctype is None else (ctypes.pointer(value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(value_ctype.value) @ivi_synchronized def _get_attribute_vi_string(self, attribute_id): - r'''_get_attribute_vi_string + r"""_get_attribute_vi_string Queries the value of a ViString property. You can use this method to get the values of instrument-specific properties and inherent IVI @@ -3675,23 +4207,41 @@ def _get_attribute_vi_string(self, attribute_id): property; the buffer must be of type ViChar and have at least as many bytes as indicated in the **bufSize**. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 buf_size_ctype = _visatype.ViInt32() # case S170 value_ctype = None # case C050 - error_code = self._library.niScope_GetAttributeViString(vi_ctype, channel_list_ctype, attribute_id_ctype, buf_size_ctype, value_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niScope_GetAttributeViString( + vi_ctype, + channel_list_ctype, + attribute_id_ctype, + buf_size_ctype, + value_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) buf_size_ctype = _visatype.ViInt32(error_code) # case S180 value_ctype = (_visatype.ViChar * buf_size_ctype.value)() # case C060 - error_code = self._library.niScope_GetAttributeViString(vi_ctype, channel_list_ctype, attribute_id_ctype, buf_size_ctype, value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niScope_GetAttributeViString( + vi_ctype, + channel_list_ctype, + attribute_id_ctype, + buf_size_ctype, + value_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return value_ctype.value.decode(self._encoding) @ivi_synchronized def _get_equalization_filter_coefficients(self, number_of_coefficients): - r'''_get_equalization_filter_coefficients + r"""_get_equalization_filter_coefficients Retrieves the custom coefficients for the equalization FIR filter on the device. This filter is designed to compensate the input signal for @@ -3721,18 +4271,31 @@ def _get_equalization_filter_coefficients(self, number_of_coefficients): `equalization_num_coefficients `__ property. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - number_of_coefficients_ctype = _visatype.ViInt32(number_of_coefficients) # case S210 + channel_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + number_of_coefficients_ctype = _visatype.ViInt32( + number_of_coefficients + ) # case S210 coefficients_size = number_of_coefficients # case B600 - coefficients_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=coefficients_size) # case B600 - error_code = self._library.niScope_GetEqualizationFilterCoefficients(vi_ctype, channel_ctype, number_of_coefficients_ctype, coefficients_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return [float(coefficients_ctype[i]) for i in range(number_of_coefficients_ctype.value)] + coefficients_ctype = get_ctypes_pointer_for_buffer( + library_type=_visatype.ViReal64, size=coefficients_size + ) # case B600 + error_code = self._library.niScope_GetEqualizationFilterCoefficients( + vi_ctype, channel_ctype, number_of_coefficients_ctype, coefficients_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return [ + float(coefficients_ctype[i]) + for i in range(number_of_coefficients_ctype.value) + ] def _get_error(self): - r'''_get_error + r"""_get_error Reads an error code and message from the error queue. National Instruments digitizers do not contain an error queue. Errors are @@ -3767,21 +4330,37 @@ def _get_error(self): If you pass 0 for the **bufferSize**, you can pass VI_NULL for this parameter. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus() # case S220 buffer_size_ctype = _visatype.ViInt32() # case S170 description_ctype = None # case C050 - error_code = self._library.niScope_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), buffer_size_ctype, description_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True) + error_code = self._library.niScope_GetError( + vi_ctype, + None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), + buffer_size_ctype, + description_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=True + ) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 description_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niScope_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), buffer_size_ctype, description_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) - return int(error_code_ctype.value), description_ctype.value.decode(self._encoding) + error_code = self._library.niScope_GetError( + vi_ctype, + None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), + buffer_size_ctype, + description_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) + return int(error_code_ctype.value), description_ctype.value.decode( + self._encoding + ) def lock(self): - '''lock + """lock Obtains a multithread lock on the device session. Before doing so, the software waits until all other execution threads release their locks @@ -3809,25 +4388,27 @@ def lock(self): Returns: lock (context manager): When used in a with statement, niscope.Session.lock acts as a context manager and unlock will be called when the with block is exited - ''' + """ self._lock_session() # We do not call _lock_session() in the context manager so that this function can # act standalone as well and let the client call unlock() explicitly. If they do use the context manager, # that will handle the unlock for them return _Lock(self) def _lock_session(self): - '''_lock_session + """_lock_session Actual call to driver - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_LockSession(vi_ctype, None) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return @ivi_synchronized def _read(self, num_samples, timeout=hightime.timedelta(seconds=5.0)): - r'''_read + r"""_read Initiates an acquisition, waits for it to complete, and retrieves the data. The process is similar to calling _initiate_acquisition, @@ -3915,23 +4496,43 @@ def _read(self, num_samples, timeout=hightime.timedelta(seconds=5.0)): Call _actual_num_wfms to determine the size of this array. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64( + timeout + ) # case S140 num_samples_ctype = _visatype.ViInt32(num_samples) # case S150 - waveform_size = (num_samples * self._actual_num_wfms()) # case B560 + waveform_size = num_samples * self._actual_num_wfms() # case B560 waveform_array = array.array("d", [0] * waveform_size) # case B560 - waveform_ctype = get_ctypes_pointer_for_buffer(value=waveform_array, library_type=_visatype.ViReal64) # case B560 + waveform_ctype = get_ctypes_pointer_for_buffer( + value=waveform_array, library_type=_visatype.ViReal64 + ) # case B560 wfm_info_size = self._actual_num_wfms() # case B560 - wfm_info_ctype = get_ctypes_pointer_for_buffer(library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size) # case B560 - error_code = self._library.niScope_Read(vi_ctype, channel_list_ctype, timeout_ctype, num_samples_ctype, waveform_ctype, wfm_info_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return waveform_array, [waveform_info.WaveformInfo(wfm_info_ctype[i]) for i in range(self._actual_num_wfms())] + wfm_info_ctype = get_ctypes_pointer_for_buffer( + library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size + ) # case B560 + error_code = self._library.niScope_Read( + vi_ctype, + channel_list_ctype, + timeout_ctype, + num_samples_ctype, + waveform_ctype, + wfm_info_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return waveform_array, [ + waveform_info.WaveformInfo(wfm_info_ctype[i]) + for i in range(self._actual_num_wfms()) + ] @ivi_synchronized def _set_attribute_vi_boolean(self, attribute_id, value): - r'''_set_attribute_vi_boolean + r"""_set_attribute_vi_boolean Sets the value of a ViBoolean property. This is a low-level method that you can use to set the values of instrument-specific properties and @@ -3973,18 +4574,24 @@ def _set_attribute_vi_boolean(self, attribute_id, value): value (bool): The value that you want to set the property to. Some values might not be valid depending on the current settings of the instrument session. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViBoolean(value) # case S150 - error_code = self._library.niScope_SetAttributeViBoolean(vi_ctype, channel_list_ctype, attribute_id_ctype, value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niScope_SetAttributeViBoolean( + vi_ctype, channel_list_ctype, attribute_id_ctype, value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_int32(self, attribute_id, value): - r'''_set_attribute_vi_int32 + r"""_set_attribute_vi_int32 Sets the value of a ViInt32 property. This is a low-level method that you can use to set the values of instrument-specific properties and @@ -4026,18 +4633,24 @@ def _set_attribute_vi_int32(self, attribute_id, value): value (int): The value that you want to set the property. Some values might not be valid depending on the current settings of the instrument session. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViInt32(value) # case S150 - error_code = self._library.niScope_SetAttributeViInt32(vi_ctype, channel_list_ctype, attribute_id_ctype, value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niScope_SetAttributeViInt32( + vi_ctype, channel_list_ctype, attribute_id_ctype, value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_int64(self, attribute_id, value): - r'''_set_attribute_vi_int64 + r"""_set_attribute_vi_int64 Sets the value of a ViInt64 property. This is a low-level method that you can use to set the values of instrument-specific properties and @@ -4079,18 +4692,24 @@ def _set_attribute_vi_int64(self, attribute_id, value): value (int): The value that you want to set the property. Some values might not be valid depending on the current settings of the instrument session. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViInt64(value) # case S150 - error_code = self._library.niScope_SetAttributeViInt64(vi_ctype, channel_list_ctype, attribute_id_ctype, value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niScope_SetAttributeViInt64( + vi_ctype, channel_list_ctype, attribute_id_ctype, value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_real64(self, attribute_id, value): - r'''_set_attribute_vi_real64 + r"""_set_attribute_vi_real64 Sets the value of a ViReal64 property. This is a low-level method that you can use to set the values of instrument-specific properties and @@ -4132,18 +4751,24 @@ def _set_attribute_vi_real64(self, attribute_id, value): value (float): The value that you want to set the property to. Some values might not be valid depending on the current settings of the instrument session. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViReal64(value) # case S150 - error_code = self._library.niScope_SetAttributeViReal64(vi_ctype, channel_list_ctype, attribute_id_ctype, value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niScope_SetAttributeViReal64( + vi_ctype, channel_list_ctype, attribute_id_ctype, value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_string(self, attribute_id, value): - r'''_set_attribute_vi_string + r"""_set_attribute_vi_string Sets the value of a ViString property. @@ -4187,29 +4812,39 @@ def _set_attribute_vi_string(self, attribute_id, value): value (str): The value that you want to set the property to. Some values might not be valid depending on the current settings of the instrument session. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_list_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 - value_ctype = ctypes.create_string_buffer(value.encode(self._encoding)) # case C020 - error_code = self._library.niScope_SetAttributeViString(vi_ctype, channel_list_ctype, attribute_id_ctype, value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + value_ctype = ctypes.create_string_buffer( + value.encode(self._encoding) + ) # case C020 + error_code = self._library.niScope_SetAttributeViString( + vi_ctype, channel_list_ctype, attribute_id_ctype, value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def unlock(self): - '''unlock + """unlock Releases a lock that you acquired on an device session using lock. Refer to lock for additional information on session locks. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_UnlockSession(vi_ctype, None) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return def _error_message(self, error_code): - r'''_error_message + r"""_error_message Takes the **Error_Code** returned by the instrument driver methods, interprets it, and returns it as a user-readable string. @@ -4220,20 +4855,24 @@ def _error_message(self, error_code): Returns: error_message (str): The error information formatted into a string. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus(error_code) # case S150 error_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niScope_error_message(vi_ctype, error_code_ctype, error_message_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + error_code = self._library.niScope_error_message( + vi_ctype, error_code_ctype, error_message_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return error_message_ctype.value.decode(self._encoding) class Session(_SessionBase): - '''An NI-SCOPE session to a National Instruments Digitizer.''' + """An NI-SCOPE session to a National Instruments Digitizer.""" def __init__(self, resource_name, id_query=False, reset_device=False, options={}): - r'''An NI-SCOPE session to a National Instruments Digitizer. + r"""An NI-SCOPE session to a National Instruments Digitizer. Performs the following initialization actions: @@ -4361,15 +5000,23 @@ def __init__(self, resource_name, id_query=False, reset_device=False, options={} Returns: session (niscope.Session): A session object representing the device. - ''' - super(Session, self).__init__(repeated_capability_list=[], vi=None, library=None, encoding=None, freeze_it=False) + """ + super(Session, self).__init__( + repeated_capability_list=[], + vi=None, + library=None, + encoding=None, + freeze_it=False, + ) options = _converters.convert_init_with_options_dictionary(options) self._library = _library_singleton.get() - self._encoding = 'windows-1251' + self._encoding = "windows-1251" # Call specified init function self._vi = 0 # This must be set before calling _init_with_options(). - self._vi = self._init_with_options(resource_name, id_query, reset_device, options) + self._vi = self._init_with_options( + resource_name, id_query, reset_device, options + ) self.tclk = nitclk.SessionReference(self._vi) @@ -4379,7 +5026,7 @@ def __init__(self, resource_name, id_query=False, reset_device=False, options={} param_list.append("id_query=" + pp.pformat(id_query)) param_list.append("reset_device=" + pp.pformat(reset_device)) param_list.append("options=" + pp.pformat(options)) - self._param_list = ', '.join(param_list) + self._param_list = ", ".join(param_list) self._is_frozen = True @@ -4390,7 +5037,7 @@ def __exit__(self, exc_type, exc_value, traceback): self.close() def initiate(self): - '''initiate + """initiate Initiates a waveform acquisition. @@ -4400,11 +5047,11 @@ def initiate(self): Note: This method will return a Python context manager that will initiate on entering and abort on exit. - ''' + """ return _Acquisition(self) def close(self): - '''close + """close When you are finished using an instrument driver session, you must call this method to perform the following actions: @@ -4415,7 +5062,7 @@ def close(self): Note: This method is not needed when using the session context manager - ''' + """ try: self._close() except errors.DriverError: @@ -4423,23 +5070,25 @@ def close(self): raise self._vi = 0 - ''' These are code-generated ''' + """ These are code-generated """ @ivi_synchronized def abort(self): - r'''abort + r"""abort Aborts an acquisition and returns the digitizer to the Idle state. Call this method if the digitizer times out waiting for a trigger. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_Abort(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def acquisition_status(self): - r'''acquisition_status + r"""acquisition_status Returns status information about the acquisition to the **status** output parameter. @@ -4455,16 +5104,23 @@ def acquisition_status(self): AcquisitionStatus.STATUS_UNKNOWN - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 acquisition_status_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niScope_AcquisitionStatus(vi_ctype, None if acquisition_status_ctype is None else (ctypes.pointer(acquisition_status_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niScope_AcquisitionStatus( + vi_ctype, + None + if acquisition_status_ctype is None + else (ctypes.pointer(acquisition_status_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return enums.AcquisitionStatus(acquisition_status_ctype.value) @ivi_synchronized def auto_setup(self): - r'''auto_setup + r"""auto_setup Automatically configures the instrument. When you call this method, the digitizer senses the input signal and automatically configures many @@ -4532,15 +5188,17 @@ def auto_setup(self): +--------------------+-----------------------------------------------+ | Trigger output | None | +--------------------+-----------------------------------------------+ - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_AutoSetup(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _cal_fetch_date(self, which_one): - r'''_cal_fetch_date + r"""_cal_fetch_date TBD @@ -4555,21 +5213,31 @@ def _cal_fetch_date(self, which_one): day (int): - ''' + """ if type(which_one) is not enums._CalibrationTypes: - raise TypeError('Parameter which_one must be of type ' + str(enums._CalibrationTypes)) + raise TypeError( + "Parameter which_one must be of type " + str(enums._CalibrationTypes) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 which_one_ctype = _visatype.ViInt32(which_one.value) # case S130 year_ctype = _visatype.ViInt32() # case S220 month_ctype = _visatype.ViInt32() # case S220 day_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niScope_CalFetchDate(vi_ctype, which_one_ctype, None if year_ctype is None else (ctypes.pointer(year_ctype)), None if month_ctype is None else (ctypes.pointer(month_ctype)), None if day_ctype is None else (ctypes.pointer(day_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niScope_CalFetchDate( + vi_ctype, + which_one_ctype, + None if year_ctype is None else (ctypes.pointer(year_ctype)), + None if month_ctype is None else (ctypes.pointer(month_ctype)), + None if day_ctype is None else (ctypes.pointer(day_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(year_ctype.value), int(month_ctype.value), int(day_ctype.value) @ivi_synchronized def _cal_fetch_temperature(self, which_one): - r'''_cal_fetch_temperature + r"""_cal_fetch_temperature TBD @@ -4580,31 +5248,41 @@ def _cal_fetch_temperature(self, which_one): Returns: temperature (float): - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 which_one_ctype = _visatype.ViInt32(which_one) # case S150 temperature_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niScope_CalFetchTemperature(vi_ctype, which_one_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niScope_CalFetchTemperature( + vi_ctype, + which_one_ctype, + None if temperature_ctype is None else (ctypes.pointer(temperature_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(temperature_ctype.value) @ivi_synchronized def commit(self): - r'''commit + r"""commit Commits to hardware all the parameter settings associated with the task. Use this method if you want a parameter change to be immediately reflected in the hardware. This method is not supported for Traditional NI-DAQ (Legacy) devices. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_Commit(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def configure_horizontal_timing(self, min_sample_rate, min_num_pts, ref_position, num_records, enforce_realtime): - r'''configure_horizontal_timing + def configure_horizontal_timing( + self, min_sample_rate, min_num_pts, ref_position, num_records, enforce_realtime + ): + r"""configure_horizontal_timing Configures the common properties of the horizontal subsystem for a multirecord acquisition in terms of minimum sample rate. @@ -4641,20 +5319,29 @@ def configure_horizontal_timing(self, min_sample_rate, min_num_pts, ref_position False—Allow real-time and equivalent-time acquisitions - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 min_sample_rate_ctype = _visatype.ViReal64(min_sample_rate) # case S150 min_num_pts_ctype = _visatype.ViInt32(min_num_pts) # case S150 ref_position_ctype = _visatype.ViReal64(ref_position) # case S150 num_records_ctype = _visatype.ViInt32(num_records) # case S150 enforce_realtime_ctype = _visatype.ViBoolean(enforce_realtime) # case S150 - error_code = self._library.niScope_ConfigureHorizontalTiming(vi_ctype, min_sample_rate_ctype, min_num_pts_ctype, ref_position_ctype, num_records_ctype, enforce_realtime_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niScope_ConfigureHorizontalTiming( + vi_ctype, + min_sample_rate_ctype, + min_num_pts_ctype, + ref_position_ctype, + num_records_ctype, + enforce_realtime_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _configure_ref_levels(self, low=10.0, mid=50.0, high=90.0): - r'''_configure_ref_levels + r"""_configure_ref_levels This method is included for compliance with the IviScope Class Specification. @@ -4704,18 +5391,28 @@ def _configure_ref_levels(self, low=10.0, mid=50.0, high=90.0): Default Value: 90.0 - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 low_ctype = _visatype.ViReal64(low) # case S150 mid_ctype = _visatype.ViReal64(mid) # case S150 high_ctype = _visatype.ViReal64(high) # case S150 - error_code = self._library.niScope_ConfigureRefLevels(vi_ctype, low_ctype, mid_ctype, high_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niScope_ConfigureRefLevels( + vi_ctype, low_ctype, mid_ctype, high_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def configure_trigger_digital(self, trigger_source, slope=enums.TriggerSlope.POSITIVE, holdoff=hightime.timedelta(seconds=0.0), delay=hightime.timedelta(seconds=0.0)): - r'''configure_trigger_digital + def configure_trigger_digital( + self, + trigger_source, + slope=enums.TriggerSlope.POSITIVE, + holdoff=hightime.timedelta(seconds=0.0), + delay=hightime.timedelta(seconds=0.0), + ): + r"""configure_trigger_digital Configures the common properties of a digital trigger. @@ -4763,21 +5460,41 @@ def configure_trigger_digital(self, trigger_source, slope=enums.TriggerSlope.POS acquiring data. Refer to trigger_delay_time for more information. - ''' + """ if type(slope) is not enums.TriggerSlope: - raise TypeError('Parameter slope must be of type ' + str(enums.TriggerSlope)) + raise TypeError( + "Parameter slope must be of type " + str(enums.TriggerSlope) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - trigger_source_ctype = ctypes.create_string_buffer(trigger_source.encode(self._encoding)) # case C020 + trigger_source_ctype = ctypes.create_string_buffer( + trigger_source.encode(self._encoding) + ) # case C020 slope_ctype = _visatype.ViInt32(slope.value) # case S130 - holdoff_ctype = _converters.convert_timedelta_to_seconds_real64(holdoff) # case S140 - delay_ctype = _converters.convert_timedelta_to_seconds_real64(delay) # case S140 - error_code = self._library.niScope_ConfigureTriggerDigital(vi_ctype, trigger_source_ctype, slope_ctype, holdoff_ctype, delay_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + holdoff_ctype = _converters.convert_timedelta_to_seconds_real64( + holdoff + ) # case S140 + delay_ctype = _converters.convert_timedelta_to_seconds_real64( + delay + ) # case S140 + error_code = self._library.niScope_ConfigureTriggerDigital( + vi_ctype, trigger_source_ctype, slope_ctype, holdoff_ctype, delay_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def configure_trigger_edge(self, trigger_source, level, trigger_coupling, slope=enums.TriggerSlope.POSITIVE, holdoff=hightime.timedelta(seconds=0.0), delay=hightime.timedelta(seconds=0.0)): - r'''configure_trigger_edge + def configure_trigger_edge( + self, + trigger_source, + level, + trigger_coupling, + slope=enums.TriggerSlope.POSITIVE, + holdoff=hightime.timedelta(seconds=0.0), + delay=hightime.timedelta(seconds=0.0), + ): + r"""configure_trigger_edge Configures common properties for analog edge triggering. @@ -4821,25 +5538,55 @@ def configure_trigger_edge(self, trigger_source, level, trigger_coupling, slope= acquiring data. Refer to trigger_delay_time for more information. - ''' + """ if type(slope) is not enums.TriggerSlope: - raise TypeError('Parameter slope must be of type ' + str(enums.TriggerSlope)) + raise TypeError( + "Parameter slope must be of type " + str(enums.TriggerSlope) + ) if type(trigger_coupling) is not enums.TriggerCoupling: - raise TypeError('Parameter trigger_coupling must be of type ' + str(enums.TriggerCoupling)) + raise TypeError( + "Parameter trigger_coupling must be of type " + + str(enums.TriggerCoupling) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - trigger_source_ctype = ctypes.create_string_buffer(trigger_source.encode(self._encoding)) # case C020 + trigger_source_ctype = ctypes.create_string_buffer( + trigger_source.encode(self._encoding) + ) # case C020 level_ctype = _visatype.ViReal64(level) # case S150 slope_ctype = _visatype.ViInt32(slope.value) # case S130 trigger_coupling_ctype = _visatype.ViInt32(trigger_coupling.value) # case S130 - holdoff_ctype = _converters.convert_timedelta_to_seconds_real64(holdoff) # case S140 - delay_ctype = _converters.convert_timedelta_to_seconds_real64(delay) # case S140 - error_code = self._library.niScope_ConfigureTriggerEdge(vi_ctype, trigger_source_ctype, level_ctype, slope_ctype, trigger_coupling_ctype, holdoff_ctype, delay_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + holdoff_ctype = _converters.convert_timedelta_to_seconds_real64( + holdoff + ) # case S140 + delay_ctype = _converters.convert_timedelta_to_seconds_real64( + delay + ) # case S140 + error_code = self._library.niScope_ConfigureTriggerEdge( + vi_ctype, + trigger_source_ctype, + level_ctype, + slope_ctype, + trigger_coupling_ctype, + holdoff_ctype, + delay_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def configure_trigger_hysteresis(self, trigger_source, level, hysteresis, trigger_coupling, slope=enums.TriggerSlope.POSITIVE, holdoff=hightime.timedelta(seconds=0.0), delay=hightime.timedelta(seconds=0.0)): - r'''configure_trigger_hysteresis + def configure_trigger_hysteresis( + self, + trigger_source, + level, + hysteresis, + trigger_coupling, + slope=enums.TriggerSlope.POSITIVE, + holdoff=hightime.timedelta(seconds=0.0), + delay=hightime.timedelta(seconds=0.0), + ): + r"""configure_trigger_hysteresis Configures common properties for analog hysteresis triggering. This kind of trigger specifies an additional value, specified in the @@ -4893,26 +5640,48 @@ def configure_trigger_hysteresis(self, trigger_source, level, hysteresis, trigge acquiring data. Refer to trigger_delay_time for more information. - ''' + """ if type(slope) is not enums.TriggerSlope: - raise TypeError('Parameter slope must be of type ' + str(enums.TriggerSlope)) + raise TypeError( + "Parameter slope must be of type " + str(enums.TriggerSlope) + ) if type(trigger_coupling) is not enums.TriggerCoupling: - raise TypeError('Parameter trigger_coupling must be of type ' + str(enums.TriggerCoupling)) + raise TypeError( + "Parameter trigger_coupling must be of type " + + str(enums.TriggerCoupling) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - trigger_source_ctype = ctypes.create_string_buffer(trigger_source.encode(self._encoding)) # case C020 + trigger_source_ctype = ctypes.create_string_buffer( + trigger_source.encode(self._encoding) + ) # case C020 level_ctype = _visatype.ViReal64(level) # case S150 hysteresis_ctype = _visatype.ViReal64(hysteresis) # case S150 slope_ctype = _visatype.ViInt32(slope.value) # case S130 trigger_coupling_ctype = _visatype.ViInt32(trigger_coupling.value) # case S130 - holdoff_ctype = _converters.convert_timedelta_to_seconds_real64(holdoff) # case S140 - delay_ctype = _converters.convert_timedelta_to_seconds_real64(delay) # case S140 - error_code = self._library.niScope_ConfigureTriggerHysteresis(vi_ctype, trigger_source_ctype, level_ctype, hysteresis_ctype, slope_ctype, trigger_coupling_ctype, holdoff_ctype, delay_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + holdoff_ctype = _converters.convert_timedelta_to_seconds_real64( + holdoff + ) # case S140 + delay_ctype = _converters.convert_timedelta_to_seconds_real64( + delay + ) # case S140 + error_code = self._library.niScope_ConfigureTriggerHysteresis( + vi_ctype, + trigger_source_ctype, + level_ctype, + hysteresis_ctype, + slope_ctype, + trigger_coupling_ctype, + holdoff_ctype, + delay_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def configure_trigger_immediate(self): - r'''configure_trigger_immediate + r"""configure_trigger_immediate Configures common properties for immediate triggering. Immediate triggering means the digitizer triggers itself. @@ -4920,15 +5689,21 @@ def configure_trigger_immediate(self): When you initiate an acquisition, the digitizer waits for a trigger. You specify the type of trigger that the digitizer waits for with a Configure Trigger method, such as configure_trigger_immediate. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_ConfigureTriggerImmediate(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def configure_trigger_software(self, holdoff=hightime.timedelta(seconds=0.0), delay=hightime.timedelta(seconds=0.0)): - r'''configure_trigger_software + def configure_trigger_software( + self, + holdoff=hightime.timedelta(seconds=0.0), + delay=hightime.timedelta(seconds=0.0), + ): + r"""configure_trigger_software Configures common properties for software triggering. @@ -4961,17 +5736,36 @@ def configure_trigger_software(self, holdoff=hightime.timedelta(seconds=0.0), de acquiring data. Refer to trigger_delay_time for more information. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - holdoff_ctype = _converters.convert_timedelta_to_seconds_real64(holdoff) # case S140 - delay_ctype = _converters.convert_timedelta_to_seconds_real64(delay) # case S140 - error_code = self._library.niScope_ConfigureTriggerSoftware(vi_ctype, holdoff_ctype, delay_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + holdoff_ctype = _converters.convert_timedelta_to_seconds_real64( + holdoff + ) # case S140 + delay_ctype = _converters.convert_timedelta_to_seconds_real64( + delay + ) # case S140 + error_code = self._library.niScope_ConfigureTriggerSoftware( + vi_ctype, holdoff_ctype, delay_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def configure_trigger_video(self, trigger_source, signal_format, event, polarity, trigger_coupling, enable_dc_restore=False, line_number=1, holdoff=hightime.timedelta(seconds=0.0), delay=hightime.timedelta(seconds=0.0)): - r'''configure_trigger_video + def configure_trigger_video( + self, + trigger_source, + signal_format, + event, + polarity, + trigger_coupling, + enable_dc_restore=False, + line_number=1, + holdoff=hightime.timedelta(seconds=0.0), + delay=hightime.timedelta(seconds=0.0), + ): + r"""configure_trigger_video Configures the common properties for video triggering, including the signal format, TV event, line number, polarity, and enable DC restore. A @@ -5032,32 +5826,70 @@ def configure_trigger_video(self, trigger_source, signal_format, event, polarity acquiring data. Refer to trigger_delay_time for more information. - ''' + """ if type(signal_format) is not enums.VideoSignalFormat: - raise TypeError('Parameter signal_format must be of type ' + str(enums.VideoSignalFormat)) + raise TypeError( + "Parameter signal_format must be of type " + + str(enums.VideoSignalFormat) + ) if type(event) is not enums.VideoTriggerEvent: - raise TypeError('Parameter event must be of type ' + str(enums.VideoTriggerEvent)) + raise TypeError( + "Parameter event must be of type " + str(enums.VideoTriggerEvent) + ) if type(polarity) is not enums.VideoPolarity: - raise TypeError('Parameter polarity must be of type ' + str(enums.VideoPolarity)) + raise TypeError( + "Parameter polarity must be of type " + str(enums.VideoPolarity) + ) if type(trigger_coupling) is not enums.TriggerCoupling: - raise TypeError('Parameter trigger_coupling must be of type ' + str(enums.TriggerCoupling)) + raise TypeError( + "Parameter trigger_coupling must be of type " + + str(enums.TriggerCoupling) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - trigger_source_ctype = ctypes.create_string_buffer(trigger_source.encode(self._encoding)) # case C020 + trigger_source_ctype = ctypes.create_string_buffer( + trigger_source.encode(self._encoding) + ) # case C020 enable_dc_restore_ctype = _visatype.ViBoolean(enable_dc_restore) # case S150 signal_format_ctype = _visatype.ViInt32(signal_format.value) # case S130 event_ctype = _visatype.ViInt32(event.value) # case S130 line_number_ctype = _visatype.ViInt32(line_number) # case S150 polarity_ctype = _visatype.ViInt32(polarity.value) # case S130 trigger_coupling_ctype = _visatype.ViInt32(trigger_coupling.value) # case S130 - holdoff_ctype = _converters.convert_timedelta_to_seconds_real64(holdoff) # case S140 - delay_ctype = _converters.convert_timedelta_to_seconds_real64(delay) # case S140 - error_code = self._library.niScope_ConfigureTriggerVideo(vi_ctype, trigger_source_ctype, enable_dc_restore_ctype, signal_format_ctype, event_ctype, line_number_ctype, polarity_ctype, trigger_coupling_ctype, holdoff_ctype, delay_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + holdoff_ctype = _converters.convert_timedelta_to_seconds_real64( + holdoff + ) # case S140 + delay_ctype = _converters.convert_timedelta_to_seconds_real64( + delay + ) # case S140 + error_code = self._library.niScope_ConfigureTriggerVideo( + vi_ctype, + trigger_source_ctype, + enable_dc_restore_ctype, + signal_format_ctype, + event_ctype, + line_number_ctype, + polarity_ctype, + trigger_coupling_ctype, + holdoff_ctype, + delay_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def configure_trigger_window(self, trigger_source, low_level, high_level, window_mode, trigger_coupling, holdoff=hightime.timedelta(seconds=0.0), delay=hightime.timedelta(seconds=0.0)): - r'''configure_trigger_window + def configure_trigger_window( + self, + trigger_source, + low_level, + high_level, + window_mode, + trigger_coupling, + holdoff=hightime.timedelta(seconds=0.0), + delay=hightime.timedelta(seconds=0.0), + ): + r"""configure_trigger_window Configures common properties for analog window triggering. A window trigger occurs when a signal enters or leaves a window you specify with @@ -5103,38 +5935,62 @@ def configure_trigger_window(self, trigger_source, low_level, high_level, window acquiring data. Refer to trigger_delay_time for more information. - ''' + """ if type(window_mode) is not enums.TriggerWindowMode: - raise TypeError('Parameter window_mode must be of type ' + str(enums.TriggerWindowMode)) + raise TypeError( + "Parameter window_mode must be of type " + str(enums.TriggerWindowMode) + ) if type(trigger_coupling) is not enums.TriggerCoupling: - raise TypeError('Parameter trigger_coupling must be of type ' + str(enums.TriggerCoupling)) + raise TypeError( + "Parameter trigger_coupling must be of type " + + str(enums.TriggerCoupling) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - trigger_source_ctype = ctypes.create_string_buffer(trigger_source.encode(self._encoding)) # case C020 + trigger_source_ctype = ctypes.create_string_buffer( + trigger_source.encode(self._encoding) + ) # case C020 low_level_ctype = _visatype.ViReal64(low_level) # case S150 high_level_ctype = _visatype.ViReal64(high_level) # case S150 window_mode_ctype = _visatype.ViInt32(window_mode.value) # case S130 trigger_coupling_ctype = _visatype.ViInt32(trigger_coupling.value) # case S130 - holdoff_ctype = _converters.convert_timedelta_to_seconds_real64(holdoff) # case S140 - delay_ctype = _converters.convert_timedelta_to_seconds_real64(delay) # case S140 - error_code = self._library.niScope_ConfigureTriggerWindow(vi_ctype, trigger_source_ctype, low_level_ctype, high_level_ctype, window_mode_ctype, trigger_coupling_ctype, holdoff_ctype, delay_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + holdoff_ctype = _converters.convert_timedelta_to_seconds_real64( + holdoff + ) # case S140 + delay_ctype = _converters.convert_timedelta_to_seconds_real64( + delay + ) # case S140 + error_code = self._library.niScope_ConfigureTriggerWindow( + vi_ctype, + trigger_source_ctype, + low_level_ctype, + high_level_ctype, + window_mode_ctype, + trigger_coupling_ctype, + holdoff_ctype, + delay_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def disable(self): - r'''disable + r"""disable Aborts any current operation, opens data channel relays, and releases RTSI and PFI lines. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_Disable(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def export_attribute_configuration_buffer(self): - r'''export_attribute_configuration_buffer + r"""export_attribute_configuration_buffer Exports the property configuration of the session to a configuration buffer. @@ -5159,23 +6015,33 @@ def export_attribute_configuration_buffer(self): configuration (bytes): Specifies the byte array buffer to be populated with the exported property configuration. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 size_in_bytes_ctype = _visatype.ViInt32() # case S170 configuration_ctype = None # case B580 - error_code = self._library.niScope_ExportAttributeConfigurationBuffer(vi_ctype, size_in_bytes_ctype, configuration_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niScope_ExportAttributeConfigurationBuffer( + vi_ctype, size_in_bytes_ctype, configuration_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) size_in_bytes_ctype = _visatype.ViInt32(error_code) # case S180 configuration_size = size_in_bytes_ctype.value # case B590 configuration_array = array.array("b", [0] * configuration_size) # case B590 - configuration_ctype = get_ctypes_pointer_for_buffer(value=configuration_array, library_type=_visatype.ViInt8) # case B590 - error_code = self._library.niScope_ExportAttributeConfigurationBuffer(vi_ctype, size_in_bytes_ctype, configuration_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + configuration_ctype = get_ctypes_pointer_for_buffer( + value=configuration_array, library_type=_visatype.ViInt8 + ) # case B590 + error_code = self._library.niScope_ExportAttributeConfigurationBuffer( + vi_ctype, size_in_bytes_ctype, configuration_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return _converters.convert_to_bytes(configuration_array) @ivi_synchronized def export_attribute_configuration_file(self, file_path): - r'''export_attribute_configuration_file + r"""export_attribute_configuration_file Exports the property configuration of the session to the specified file. @@ -5202,30 +6068,36 @@ def export_attribute_configuration_file(self, file_path): method returns an error. **Default file extension:** .niscopeconfig - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 - error_code = self._library.niScope_ExportAttributeConfigurationFile(vi_ctype, file_path_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + file_path_ctype = ctypes.create_string_buffer( + file_path.encode(self._encoding) + ) # case C020 + error_code = self._library.niScope_ExportAttributeConfigurationFile( + vi_ctype, file_path_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def get_ext_cal_last_date_and_time(self): - '''get_ext_cal_last_date_and_time + """get_ext_cal_last_date_and_time Returns the date and time of the last external calibration performed. Returns: last_cal_datetime (hightime.timedelta, datetime.timedelta, or float in seconds): Indicates the **date** of the last calibration. A hightime.datetime object is returned, but only contains resolution to the day. - ''' + """ year, month, day = self._cal_fetch_date(enums._CalibrationTypes.EXTERNAL) return hightime.datetime(year, month, day) @ivi_synchronized def get_ext_cal_last_temp(self): - '''get_ext_cal_last_temp + """get_ext_cal_last_temp Returns the onboard temperature, in degrees Celsius, of an oscilloscope at the time of the last successful external calibration. The temperature returned by this node is an onboard temperature read from a sensor on the surface of the oscilloscope. This temperature should not be confused with the environmental temperature of the oscilloscope surroundings. During operation, the onboard temperature is normally higher than the environmental temperature. @@ -5234,27 +6106,27 @@ def get_ext_cal_last_temp(self): Returns: temperature (float): Returns the **temperature** in degrees Celsius during the last calibration. - ''' + """ return self._cal_fetch_temperature(enums._CalibrationTypes.EXTERNAL.value) @ivi_synchronized def get_self_cal_last_date_and_time(self): - '''get_self_cal_last_date_and_time + """get_self_cal_last_date_and_time Returns the date and time of the last self calibration performed. Returns: last_cal_datetime (hightime.timedelta, datetime.timedelta, or float in seconds): Indicates the **date** of the last calibration. A hightime.datetime object is returned, but only contains resolution to the day. - ''' + """ year, month, day = self._cal_fetch_date(enums._CalibrationTypes.SELF) return hightime.datetime(year, month, day) @ivi_synchronized def get_self_cal_last_temp(self): - '''get_self_cal_last_temp + """get_self_cal_last_temp Returns the onboard temperature, in degrees Celsius, of an oscilloscope at the time of the last successful self calibration. The temperature returned by this node is an onboard temperature read from a sensor on the surface of the oscilloscope. This temperature should not be confused with the environmental temperature of the oscilloscope surroundings. During operation, the onboard temperature is normally higher than the environmental temperature. @@ -5263,13 +6135,13 @@ def get_self_cal_last_temp(self): Returns: temperature (float): Returns the **temperature** in degrees Celsius during the last calibration. - ''' + """ return self._cal_fetch_temperature(enums._CalibrationTypes.SELF.value) @ivi_synchronized def import_attribute_configuration_buffer(self, configuration): - r'''import_attribute_configuration_buffer + r"""import_attribute_configuration_buffer Imports a property configuration to the session from the specified configuration buffer. @@ -5294,18 +6166,28 @@ def import_attribute_configuration_buffer(self, configuration): configuration (bytes): Specifies the byte array buffer that contains the property configuration to import. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - size_in_bytes_ctype = _visatype.ViInt32(0 if configuration is None else len(configuration)) # case S160 - configuration_converted = _converters.convert_to_bytes(configuration) # case B520 - configuration_ctype = get_ctypes_pointer_for_buffer(value=configuration_converted, library_type=_visatype.ViInt8) # case B520 - error_code = self._library.niScope_ImportAttributeConfigurationBuffer(vi_ctype, size_in_bytes_ctype, configuration_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + size_in_bytes_ctype = _visatype.ViInt32( + 0 if configuration is None else len(configuration) + ) # case S160 + configuration_converted = _converters.convert_to_bytes( + configuration + ) # case B520 + configuration_ctype = get_ctypes_pointer_for_buffer( + value=configuration_converted, library_type=_visatype.ViInt8 + ) # case B520 + error_code = self._library.niScope_ImportAttributeConfigurationBuffer( + vi_ctype, size_in_bytes_ctype, configuration_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def import_attribute_configuration_file(self, file_path): - r'''import_attribute_configuration_file + r"""import_attribute_configuration_file Imports a property configuration to the session from the specified file. @@ -5332,15 +6214,23 @@ def import_attribute_configuration_file(self, file_path): method returns an error. **Default File Extension:** .niscopeconfig - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 - error_code = self._library.niScope_ImportAttributeConfigurationFile(vi_ctype, file_path_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + file_path_ctype = ctypes.create_string_buffer( + file_path.encode(self._encoding) + ) # case C020 + error_code = self._library.niScope_ImportAttributeConfigurationFile( + vi_ctype, file_path_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return - def _init_with_options(self, resource_name, id_query=False, reset_device=False, option_string=""): - r'''_init_with_options + def _init_with_options( + self, resource_name, id_query=False, reset_device=False, option_string="" + ): + r"""_init_with_options Performs the following initialization actions: @@ -5464,56 +6354,76 @@ def _init_with_options(self, resource_name, id_query=False, reset_device=False, vi (int): Returns a session handle that you can use to identify the device in all subsequent NI-SCOPE method calls. - ''' - resource_name_ctype = ctypes.create_string_buffer(resource_name.encode(self._encoding)) # case C020 + """ + resource_name_ctype = ctypes.create_string_buffer( + resource_name.encode(self._encoding) + ) # case C020 id_query_ctype = _visatype.ViBoolean(id_query) # case S150 reset_device_ctype = _visatype.ViBoolean(reset_device) # case S150 - option_string_ctype = ctypes.create_string_buffer(_converters.convert_init_with_options_dictionary(option_string).encode(self._encoding)) # case C040 + option_string_ctype = ctypes.create_string_buffer( + _converters.convert_init_with_options_dictionary(option_string).encode( + self._encoding + ) + ) # case C040 vi_ctype = _visatype.ViSession() # case S220 - error_code = self._library.niScope_InitWithOptions(resource_name_ctype, id_query_ctype, reset_device_ctype, option_string_ctype, None if vi_ctype is None else (ctypes.pointer(vi_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niScope_InitWithOptions( + resource_name_ctype, + id_query_ctype, + reset_device_ctype, + option_string_ctype, + None if vi_ctype is None else (ctypes.pointer(vi_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(vi_ctype.value) @ivi_synchronized def _initiate_acquisition(self): - r'''_initiate_acquisition + r"""_initiate_acquisition Initiates a waveform acquisition. After calling this method, the digitizer leaves the Idle state and waits for a trigger. The digitizer acquires a waveform for each channel you enable with configure_vertical. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_InitiateAcquisition(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def probe_compensation_signal_start(self): - r'''probe_compensation_signal_start + r"""probe_compensation_signal_start Starts the 1 kHz square wave output on PFI 1 for probe compensation. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_ProbeCompensationSignalStart(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def probe_compensation_signal_stop(self): - r'''probe_compensation_signal_stop + r"""probe_compensation_signal_stop Stops the 1 kHz square wave output on PFI 1 for probe compensation. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_ProbeCompensationSignalStop(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def reset_device(self): - r'''reset_device + r"""reset_device Performs a hard reset of the device. Acquisition stops, all routes are released, RTSI and PFI lines are tristated, hardware is configured to @@ -5521,28 +6431,32 @@ def reset_device(self): state. - `Thermal Shutdown `__ - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_ResetDevice(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def reset_with_defaults(self): - r'''reset_with_defaults + r"""reset_with_defaults Performs a software reset of the device, returning it to the default state and applying any initial default settings from the IVI Configuration Store. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_ResetWithDefaults(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def send_software_trigger_edge(self, which_trigger): - r'''send_software_trigger_edge + r"""send_software_trigger_edge Sends the selected trigger to the digitizer. Call this method if you called configure_trigger_software when you want the Reference @@ -5562,17 +6476,23 @@ def send_software_trigger_edge(self, which_trigger): | WhichTrigger.REFERENCE (2L) | WhichTrigger.ADVANCE (3L) - ''' + """ if type(which_trigger) is not enums.WhichTrigger: - raise TypeError('Parameter which_trigger must be of type ' + str(enums.WhichTrigger)) + raise TypeError( + "Parameter which_trigger must be of type " + str(enums.WhichTrigger) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 which_trigger_ctype = _visatype.ViInt32(which_trigger.value) # case S130 - error_code = self._library.niScope_SendSoftwareTriggerEdge(vi_ctype, which_trigger_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niScope_SendSoftwareTriggerEdge( + vi_ctype, which_trigger_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def _close(self): - r'''_close + r"""_close When you are finished using an instrument driver session, you must call this method to perform the following actions: @@ -5580,15 +6500,17 @@ def _close(self): - Closes the instrument I/O session. - Destroys the IVI session and all of its properties. - Deallocates any memory resources used by the IVI session. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_close(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def self_test(self): - '''self_test + """self_test Runs the instrument self-test routine and returns the test result(s). Refer to the device-specific help topics for an explanation of the message contents. @@ -5605,7 +6527,7 @@ def self_test(self): +----------------+------------------+ | 1 | Self-test failed | +----------------+------------------+ - ''' + """ code, msg = self._self_test() if code: raise errors.SelfTestError(code, msg) @@ -5613,20 +6535,22 @@ def self_test(self): @ivi_synchronized def reset(self): - r'''reset + r"""reset Stops the acquisition, releases routes, and all session properties are reset to their `default states `__. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_reset(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _self_test(self): - r'''_self_test + r"""_self_test Runs the instrument self-test routine and returns the test result(s). @@ -5644,13 +6568,20 @@ def _self_test(self): you must pass a ViChar array at least IVI_MAX_MESSAGE_BUF_SIZE bytes in length. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 self_test_result_ctype = _visatype.ViInt16() # case S220 self_test_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niScope_self_test(vi_ctype, None if self_test_result_ctype is None else (ctypes.pointer(self_test_result_ctype)), self_test_message_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return int(self_test_result_ctype.value), self_test_message_ctype.value.decode(self._encoding) - - - + error_code = self._library.niScope_self_test( + vi_ctype, + None + if self_test_result_ctype is None + else (ctypes.pointer(self_test_result_ctype)), + self_test_message_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return int(self_test_result_ctype.value), self_test_message_ctype.value.decode( + self._encoding + ) diff --git a/generated/niscope/niscope/unit_tests/_matchers.py b/generated/niscope/niscope/unit_tests/_matchers.py index e86b7201f..b8169652b 100644 --- a/generated/niscope/niscope/unit_tests/_matchers.py +++ b/generated/niscope/niscope/unit_tests/_matchers.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # This file was generated -'''Matcher classes used by unit tests in order to set mock expectations. +"""Matcher classes used by unit tests in order to set mock expectations. These work well with our visatype definitions. -''' +""" import ctypes import niscope._visatype as _visatype @@ -21,15 +21,27 @@ def __init__(self, expected_type, expected_value): def __eq__(self, other): if not isinstance(other, self.expected_type): - print("{0}: Unexpected type. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_type, type(other))) + print( + "{0}: Unexpected type. Expected: {1}. Received: {2}".format( + self.__class__.__name__, self.expected_type, type(other) + ) + ) return False if other.value != self.expected_value: - print("{0}: Unexpected value. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_value, other.value)) + print( + "{0}: Unexpected value. Expected: {1}. Received: {2}".format( + self.__class__.__name__, self.expected_value, other.value + ) + ) return False return True def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_type), + pp.pformat(self.expected_value), + ) class _PointerMatcher(object): @@ -38,12 +50,18 @@ def __init__(self, expected_type): def __eq__(self, other): if not isinstance(other, ctypes.POINTER(self.expected_type)): - print("Unexpected type. Expected: {0}. Received: {1}".format(ctypes.POINTER(self.expected_type), type(other))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + ctypes.POINTER(self.expected_type), type(other) + ) + ) return False return True def __repr__(self): - return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_type)) + return "{0}({1})".format( + self.__class__.__name__, pp.pformat(self.expected_type) + ) class _BufferMatcher(object): @@ -70,29 +88,47 @@ def __eq__(self, other): pass # Because of object lifetimes, we may need to mock the other instance and provide lists instead of the actual array - if not isinstance(other, self.expected_type) and not isinstance(other, list): - print("Unexpected type. Expected: {0} or {1}. Received: {2}".format(self.expected_type, list, type(other))) + if not isinstance(other, self.expected_type) and not isinstance( + other, list + ): + print( + "Unexpected type. Expected: {0} or {1}. Received: {2}".format( + self.expected_type, list, type(other) + ) + ) return False if self.expected_size != len(other): - print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(other))) + print( + "Unexpected length. Expected: {0}. Received: {1}".format( + self.expected_size, len(other) + ) + ) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for i in range(0, len(self.expected_value)): if self.expected_value[i] != other[i]: - print("Unexpected value at index {0}. Expected: {1}. Received: {2}".format(i, self.expected_value[i], other[i])) + print( + "Unexpected value at index {0}. Expected: {1}. Received: {2}".format( + i, self.expected_value[i], other[i] + ) + ) return False return True def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self._expected_element_type), pp.pformat(self._expected_size_or_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self._expected_element_type), + pp.pformat(self._expected_size_or_value), + ) def __str__(self): - ret_str = self.__repr__() + '\n' - ret_str += ' expected_type = ' + str(self.expected_type) + '\n' - ret_str += ' expected_value = ' + str(self.expected_value) + '\n' - ret_str += ' expected_size = ' + str(self.expected_size) + '\n' + ret_str = self.__repr__() + "\n" + ret_str += " expected_type = " + str(self.expected_type) + "\n" + ret_str += " expected_value = " + str(self.expected_value) + "\n" + ret_str += " expected_size = " + str(self.expected_size) + "\n" return ret_str @@ -112,21 +148,37 @@ def __eq__(self, other): pass if not isinstance(other, ctypes.Array): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(other))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_type, type(other) + ) + ) return False - if len(other) < len(self.expected_string_value) + 1: # +1 for NULL terminating character - print("Unexpected length in C string. Expected at least: {0}. Received {1}".format(len(other), len(self.expected_string_value) + 1)) + if ( + len(other) < len(self.expected_string_value) + 1 + ): # +1 for NULL terminating character + print( + "Unexpected length in C string. Expected at least: {0}. Received {1}".format( + len(other), len(self.expected_string_value) + 1 + ) + ) return False if not isinstance(other[0], bytes): print("Unexpected type. Not a string. Received: {0}".format(type(other[0]))) return False if other.value.decode("ascii") != self.expected_string_value: - print("Unexpected value. Expected {0}. Received: {1}".format(self.expected_string_value, other.value.decode)) + print( + "Unexpected value. Expected {0}. Received: {1}".format( + self.expected_string_value, other.value.decode + ) + ) return False return True def __repr__(self): - return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_string_value)) + return "{0}({1})".format( + self.__class__.__name__, pp.pformat(self.expected_string_value) + ) # Custom Type @@ -139,7 +191,11 @@ def _compare_ctype_structs(expected, actual): expected_val = getattr(expected, field_name) actual_val = getattr(actual, field_name) if expected_val != actual_val: - print("Unexpected value field {0}. Expected: {1}. Received: {2}".format(field_name, expected_val, actual_val)) + print( + "Unexpected value field {0}. Expected: {1}. Received: {2}".format( + field_name, expected_val, actual_val + ) + ) return False return True @@ -151,12 +207,20 @@ def __init__(self, expected_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_type, type(actual) + ) + ) return False return _compare_ctype_structs(self.expected_value, actual) def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_type), + pp.pformat(self.expected_value), + ) class CustomTypeBufferMatcher(object): @@ -168,30 +232,48 @@ def __init__(self, expected_element_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print("Unexpected array type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) + print( + "Unexpected array type. Expected: {0}. Received: {1}".format( + self.expected_type, type(actual) + ) + ) return False if self.expected_size != len(actual): - print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(actual))) + print( + "Unexpected length. Expected: {0}. Received: {1}".format( + self.expected_size, len(actual) + ) + ) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for a, e in zip(actual, self.expected_value): if not isinstance(a, self.expected_element_type): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_element_type, type(a))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_element_type, type(a) + ) + ) return False if not _compare_ctype_structs(e, a): return False return True def __repr__(self): - expected_val_repr = '[' + ', '.join([x.__repr__() for x in self.expected_value]) + ']' - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_element_type), expected_val_repr) + expected_val_repr = ( + "[" + ", ".join([x.__repr__() for x in self.expected_value]) + "]" + ) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_element_type), + expected_val_repr, + ) def __str__(self): - ret_str = self.__repr__() + '\n' - ret_str += ' expected_type = ' + str(self.expected_type) + '\n' - ret_str += ' expected_size = ' + str(self.expected_size) + '\n' + ret_str = self.__repr__() + "\n" + ret_str += " expected_type = " + str(self.expected_type) + "\n" + ret_str += " expected_size = " + str(self.expected_size) + "\n" return ret_str @@ -200,7 +282,9 @@ def __str__(self): class ViBooleanMatcher(_ScalarMatcher): def __init__(self, expected_value): - _ScalarMatcher.__init__(self, _visatype.ViBoolean, 1 if expected_value is True else 0) + _ScalarMatcher.__init__( + self, _visatype.ViBoolean, 1 if expected_value is True else 0 + ) class ViSessionMatcher(_ScalarMatcher): @@ -312,6 +396,3 @@ def __init__(self, expected_size_or_value): class ViSessionBufferMatcher(_BufferMatcher): def __init__(self, expected_size_or_value): _BufferMatcher.__init__(self, _visatype.ViSession, expected_size_or_value) - - - diff --git a/generated/niscope/niscope/unit_tests/_mock_helper.py b/generated/niscope/niscope/unit_tests/_mock_helper.py index e6aa6eced..88608ffe4 100644 --- a/generated/niscope/niscope/unit_tests/_mock_helper.py +++ b/generated/niscope/niscope/unit_tests/_mock_helper.py @@ -16,168 +16,168 @@ def __init__(self, function, param=None): class SideEffectsHelper(object): def __init__(self): self._defaults = {} - self._defaults['Abort'] = {} - self._defaults['Abort']['return'] = 0 - self._defaults['AcquisitionStatus'] = {} - self._defaults['AcquisitionStatus']['return'] = 0 - self._defaults['AcquisitionStatus']['acquisitionStatus'] = None - self._defaults['ActualMeasWfmSize'] = {} - self._defaults['ActualMeasWfmSize']['return'] = 0 - self._defaults['ActualMeasWfmSize']['measWaveformSize'] = None - self._defaults['ActualNumWfms'] = {} - self._defaults['ActualNumWfms']['return'] = 0 - self._defaults['ActualNumWfms']['numWfms'] = None - self._defaults['AddWaveformProcessing'] = {} - self._defaults['AddWaveformProcessing']['return'] = 0 - self._defaults['AutoSetup'] = {} - self._defaults['AutoSetup']['return'] = 0 - self._defaults['CalFetchDate'] = {} - self._defaults['CalFetchDate']['return'] = 0 - self._defaults['CalFetchDate']['year'] = None - self._defaults['CalFetchDate']['month'] = None - self._defaults['CalFetchDate']['day'] = None - self._defaults['CalFetchTemperature'] = {} - self._defaults['CalFetchTemperature']['return'] = 0 - self._defaults['CalFetchTemperature']['temperature'] = None - self._defaults['CalSelfCalibrate'] = {} - self._defaults['CalSelfCalibrate']['return'] = 0 - self._defaults['ClearWaveformMeasurementStats'] = {} - self._defaults['ClearWaveformMeasurementStats']['return'] = 0 - self._defaults['ClearWaveformProcessing'] = {} - self._defaults['ClearWaveformProcessing']['return'] = 0 - self._defaults['Commit'] = {} - self._defaults['Commit']['return'] = 0 - self._defaults['ConfigureChanCharacteristics'] = {} - self._defaults['ConfigureChanCharacteristics']['return'] = 0 - self._defaults['ConfigureEqualizationFilterCoefficients'] = {} - self._defaults['ConfigureEqualizationFilterCoefficients']['return'] = 0 - self._defaults['ConfigureHorizontalTiming'] = {} - self._defaults['ConfigureHorizontalTiming']['return'] = 0 - self._defaults['ConfigureRefLevels'] = {} - self._defaults['ConfigureRefLevels']['return'] = 0 - self._defaults['ConfigureTriggerDigital'] = {} - self._defaults['ConfigureTriggerDigital']['return'] = 0 - self._defaults['ConfigureTriggerEdge'] = {} - self._defaults['ConfigureTriggerEdge']['return'] = 0 - self._defaults['ConfigureTriggerHysteresis'] = {} - self._defaults['ConfigureTriggerHysteresis']['return'] = 0 - self._defaults['ConfigureTriggerImmediate'] = {} - self._defaults['ConfigureTriggerImmediate']['return'] = 0 - self._defaults['ConfigureTriggerSoftware'] = {} - self._defaults['ConfigureTriggerSoftware']['return'] = 0 - self._defaults['ConfigureTriggerVideo'] = {} - self._defaults['ConfigureTriggerVideo']['return'] = 0 - self._defaults['ConfigureTriggerWindow'] = {} - self._defaults['ConfigureTriggerWindow']['return'] = 0 - self._defaults['ConfigureVertical'] = {} - self._defaults['ConfigureVertical']['return'] = 0 - self._defaults['Disable'] = {} - self._defaults['Disable']['return'] = 0 - self._defaults['ExportAttributeConfigurationBuffer'] = {} - self._defaults['ExportAttributeConfigurationBuffer']['return'] = 0 - self._defaults['ExportAttributeConfigurationBuffer']['configuration'] = None - self._defaults['ExportAttributeConfigurationFile'] = {} - self._defaults['ExportAttributeConfigurationFile']['return'] = 0 - self._defaults['Fetch'] = {} - self._defaults['Fetch']['return'] = 0 - self._defaults['Fetch']['waveform'] = None - self._defaults['Fetch']['wfmInfo'] = None - self._defaults['FetchArrayMeasurement'] = {} - self._defaults['FetchArrayMeasurement']['return'] = 0 - self._defaults['FetchArrayMeasurement']['measWfm'] = None - self._defaults['FetchArrayMeasurement']['wfmInfo'] = None - self._defaults['FetchBinary16'] = {} - self._defaults['FetchBinary16']['return'] = 0 - self._defaults['FetchBinary16']['waveform'] = None - self._defaults['FetchBinary16']['wfmInfo'] = None - self._defaults['FetchBinary32'] = {} - self._defaults['FetchBinary32']['return'] = 0 - self._defaults['FetchBinary32']['waveform'] = None - self._defaults['FetchBinary32']['wfmInfo'] = None - self._defaults['FetchBinary8'] = {} - self._defaults['FetchBinary8']['return'] = 0 - self._defaults['FetchBinary8']['waveform'] = None - self._defaults['FetchBinary8']['wfmInfo'] = None - self._defaults['FetchMeasurementStats'] = {} - self._defaults['FetchMeasurementStats']['return'] = 0 - self._defaults['FetchMeasurementStats']['result'] = None - self._defaults['FetchMeasurementStats']['mean'] = None - self._defaults['FetchMeasurementStats']['stdev'] = None - self._defaults['FetchMeasurementStats']['min'] = None - self._defaults['FetchMeasurementStats']['max'] = None - self._defaults['FetchMeasurementStats']['numInStats'] = None - self._defaults['GetAttributeViBoolean'] = {} - self._defaults['GetAttributeViBoolean']['return'] = 0 - self._defaults['GetAttributeViBoolean']['value'] = None - self._defaults['GetAttributeViInt32'] = {} - self._defaults['GetAttributeViInt32']['return'] = 0 - self._defaults['GetAttributeViInt32']['value'] = None - self._defaults['GetAttributeViInt64'] = {} - self._defaults['GetAttributeViInt64']['return'] = 0 - self._defaults['GetAttributeViInt64']['value'] = None - self._defaults['GetAttributeViReal64'] = {} - self._defaults['GetAttributeViReal64']['return'] = 0 - self._defaults['GetAttributeViReal64']['value'] = None - self._defaults['GetAttributeViString'] = {} - self._defaults['GetAttributeViString']['return'] = 0 - self._defaults['GetAttributeViString']['value'] = None - self._defaults['GetEqualizationFilterCoefficients'] = {} - self._defaults['GetEqualizationFilterCoefficients']['return'] = 0 - self._defaults['GetEqualizationFilterCoefficients']['coefficients'] = None - self._defaults['GetError'] = {} - self._defaults['GetError']['return'] = 0 - self._defaults['GetError']['errorCode'] = None - self._defaults['GetError']['description'] = None - self._defaults['ImportAttributeConfigurationBuffer'] = {} - self._defaults['ImportAttributeConfigurationBuffer']['return'] = 0 - self._defaults['ImportAttributeConfigurationFile'] = {} - self._defaults['ImportAttributeConfigurationFile']['return'] = 0 - self._defaults['InitWithOptions'] = {} - self._defaults['InitWithOptions']['return'] = 0 - self._defaults['InitWithOptions']['vi'] = None - self._defaults['InitiateAcquisition'] = {} - self._defaults['InitiateAcquisition']['return'] = 0 - self._defaults['LockSession'] = {} - self._defaults['LockSession']['return'] = 0 - self._defaults['LockSession']['callerHasLock'] = None - self._defaults['ProbeCompensationSignalStart'] = {} - self._defaults['ProbeCompensationSignalStart']['return'] = 0 - self._defaults['ProbeCompensationSignalStop'] = {} - self._defaults['ProbeCompensationSignalStop']['return'] = 0 - self._defaults['Read'] = {} - self._defaults['Read']['return'] = 0 - self._defaults['Read']['waveform'] = None - self._defaults['Read']['wfmInfo'] = None - self._defaults['ResetDevice'] = {} - self._defaults['ResetDevice']['return'] = 0 - self._defaults['ResetWithDefaults'] = {} - self._defaults['ResetWithDefaults']['return'] = 0 - self._defaults['SendSoftwareTriggerEdge'] = {} - self._defaults['SendSoftwareTriggerEdge']['return'] = 0 - self._defaults['SetAttributeViBoolean'] = {} - self._defaults['SetAttributeViBoolean']['return'] = 0 - self._defaults['SetAttributeViInt32'] = {} - self._defaults['SetAttributeViInt32']['return'] = 0 - self._defaults['SetAttributeViInt64'] = {} - self._defaults['SetAttributeViInt64']['return'] = 0 - self._defaults['SetAttributeViReal64'] = {} - self._defaults['SetAttributeViReal64']['return'] = 0 - self._defaults['SetAttributeViString'] = {} - self._defaults['SetAttributeViString']['return'] = 0 - self._defaults['UnlockSession'] = {} - self._defaults['UnlockSession']['return'] = 0 - self._defaults['UnlockSession']['callerHasLock'] = None - self._defaults['close'] = {} - self._defaults['close']['return'] = 0 - self._defaults['error_message'] = {} - self._defaults['error_message']['return'] = 0 - self._defaults['error_message']['errorMessage'] = None - self._defaults['reset'] = {} - self._defaults['reset']['return'] = 0 - self._defaults['self_test'] = {} - self._defaults['self_test']['return'] = 0 - self._defaults['self_test']['selfTestResult'] = None - self._defaults['self_test']['selfTestMessage'] = None + self._defaults["Abort"] = {} + self._defaults["Abort"]["return"] = 0 + self._defaults["AcquisitionStatus"] = {} + self._defaults["AcquisitionStatus"]["return"] = 0 + self._defaults["AcquisitionStatus"]["acquisitionStatus"] = None + self._defaults["ActualMeasWfmSize"] = {} + self._defaults["ActualMeasWfmSize"]["return"] = 0 + self._defaults["ActualMeasWfmSize"]["measWaveformSize"] = None + self._defaults["ActualNumWfms"] = {} + self._defaults["ActualNumWfms"]["return"] = 0 + self._defaults["ActualNumWfms"]["numWfms"] = None + self._defaults["AddWaveformProcessing"] = {} + self._defaults["AddWaveformProcessing"]["return"] = 0 + self._defaults["AutoSetup"] = {} + self._defaults["AutoSetup"]["return"] = 0 + self._defaults["CalFetchDate"] = {} + self._defaults["CalFetchDate"]["return"] = 0 + self._defaults["CalFetchDate"]["year"] = None + self._defaults["CalFetchDate"]["month"] = None + self._defaults["CalFetchDate"]["day"] = None + self._defaults["CalFetchTemperature"] = {} + self._defaults["CalFetchTemperature"]["return"] = 0 + self._defaults["CalFetchTemperature"]["temperature"] = None + self._defaults["CalSelfCalibrate"] = {} + self._defaults["CalSelfCalibrate"]["return"] = 0 + self._defaults["ClearWaveformMeasurementStats"] = {} + self._defaults["ClearWaveformMeasurementStats"]["return"] = 0 + self._defaults["ClearWaveformProcessing"] = {} + self._defaults["ClearWaveformProcessing"]["return"] = 0 + self._defaults["Commit"] = {} + self._defaults["Commit"]["return"] = 0 + self._defaults["ConfigureChanCharacteristics"] = {} + self._defaults["ConfigureChanCharacteristics"]["return"] = 0 + self._defaults["ConfigureEqualizationFilterCoefficients"] = {} + self._defaults["ConfigureEqualizationFilterCoefficients"]["return"] = 0 + self._defaults["ConfigureHorizontalTiming"] = {} + self._defaults["ConfigureHorizontalTiming"]["return"] = 0 + self._defaults["ConfigureRefLevels"] = {} + self._defaults["ConfigureRefLevels"]["return"] = 0 + self._defaults["ConfigureTriggerDigital"] = {} + self._defaults["ConfigureTriggerDigital"]["return"] = 0 + self._defaults["ConfigureTriggerEdge"] = {} + self._defaults["ConfigureTriggerEdge"]["return"] = 0 + self._defaults["ConfigureTriggerHysteresis"] = {} + self._defaults["ConfigureTriggerHysteresis"]["return"] = 0 + self._defaults["ConfigureTriggerImmediate"] = {} + self._defaults["ConfigureTriggerImmediate"]["return"] = 0 + self._defaults["ConfigureTriggerSoftware"] = {} + self._defaults["ConfigureTriggerSoftware"]["return"] = 0 + self._defaults["ConfigureTriggerVideo"] = {} + self._defaults["ConfigureTriggerVideo"]["return"] = 0 + self._defaults["ConfigureTriggerWindow"] = {} + self._defaults["ConfigureTriggerWindow"]["return"] = 0 + self._defaults["ConfigureVertical"] = {} + self._defaults["ConfigureVertical"]["return"] = 0 + self._defaults["Disable"] = {} + self._defaults["Disable"]["return"] = 0 + self._defaults["ExportAttributeConfigurationBuffer"] = {} + self._defaults["ExportAttributeConfigurationBuffer"]["return"] = 0 + self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] = None + self._defaults["ExportAttributeConfigurationFile"] = {} + self._defaults["ExportAttributeConfigurationFile"]["return"] = 0 + self._defaults["Fetch"] = {} + self._defaults["Fetch"]["return"] = 0 + self._defaults["Fetch"]["waveform"] = None + self._defaults["Fetch"]["wfmInfo"] = None + self._defaults["FetchArrayMeasurement"] = {} + self._defaults["FetchArrayMeasurement"]["return"] = 0 + self._defaults["FetchArrayMeasurement"]["measWfm"] = None + self._defaults["FetchArrayMeasurement"]["wfmInfo"] = None + self._defaults["FetchBinary16"] = {} + self._defaults["FetchBinary16"]["return"] = 0 + self._defaults["FetchBinary16"]["waveform"] = None + self._defaults["FetchBinary16"]["wfmInfo"] = None + self._defaults["FetchBinary32"] = {} + self._defaults["FetchBinary32"]["return"] = 0 + self._defaults["FetchBinary32"]["waveform"] = None + self._defaults["FetchBinary32"]["wfmInfo"] = None + self._defaults["FetchBinary8"] = {} + self._defaults["FetchBinary8"]["return"] = 0 + self._defaults["FetchBinary8"]["waveform"] = None + self._defaults["FetchBinary8"]["wfmInfo"] = None + self._defaults["FetchMeasurementStats"] = {} + self._defaults["FetchMeasurementStats"]["return"] = 0 + self._defaults["FetchMeasurementStats"]["result"] = None + self._defaults["FetchMeasurementStats"]["mean"] = None + self._defaults["FetchMeasurementStats"]["stdev"] = None + self._defaults["FetchMeasurementStats"]["min"] = None + self._defaults["FetchMeasurementStats"]["max"] = None + self._defaults["FetchMeasurementStats"]["numInStats"] = None + self._defaults["GetAttributeViBoolean"] = {} + self._defaults["GetAttributeViBoolean"]["return"] = 0 + self._defaults["GetAttributeViBoolean"]["value"] = None + self._defaults["GetAttributeViInt32"] = {} + self._defaults["GetAttributeViInt32"]["return"] = 0 + self._defaults["GetAttributeViInt32"]["value"] = None + self._defaults["GetAttributeViInt64"] = {} + self._defaults["GetAttributeViInt64"]["return"] = 0 + self._defaults["GetAttributeViInt64"]["value"] = None + self._defaults["GetAttributeViReal64"] = {} + self._defaults["GetAttributeViReal64"]["return"] = 0 + self._defaults["GetAttributeViReal64"]["value"] = None + self._defaults["GetAttributeViString"] = {} + self._defaults["GetAttributeViString"]["return"] = 0 + self._defaults["GetAttributeViString"]["value"] = None + self._defaults["GetEqualizationFilterCoefficients"] = {} + self._defaults["GetEqualizationFilterCoefficients"]["return"] = 0 + self._defaults["GetEqualizationFilterCoefficients"]["coefficients"] = None + self._defaults["GetError"] = {} + self._defaults["GetError"]["return"] = 0 + self._defaults["GetError"]["errorCode"] = None + self._defaults["GetError"]["description"] = None + self._defaults["ImportAttributeConfigurationBuffer"] = {} + self._defaults["ImportAttributeConfigurationBuffer"]["return"] = 0 + self._defaults["ImportAttributeConfigurationFile"] = {} + self._defaults["ImportAttributeConfigurationFile"]["return"] = 0 + self._defaults["InitWithOptions"] = {} + self._defaults["InitWithOptions"]["return"] = 0 + self._defaults["InitWithOptions"]["vi"] = None + self._defaults["InitiateAcquisition"] = {} + self._defaults["InitiateAcquisition"]["return"] = 0 + self._defaults["LockSession"] = {} + self._defaults["LockSession"]["return"] = 0 + self._defaults["LockSession"]["callerHasLock"] = None + self._defaults["ProbeCompensationSignalStart"] = {} + self._defaults["ProbeCompensationSignalStart"]["return"] = 0 + self._defaults["ProbeCompensationSignalStop"] = {} + self._defaults["ProbeCompensationSignalStop"]["return"] = 0 + self._defaults["Read"] = {} + self._defaults["Read"]["return"] = 0 + self._defaults["Read"]["waveform"] = None + self._defaults["Read"]["wfmInfo"] = None + self._defaults["ResetDevice"] = {} + self._defaults["ResetDevice"]["return"] = 0 + self._defaults["ResetWithDefaults"] = {} + self._defaults["ResetWithDefaults"]["return"] = 0 + self._defaults["SendSoftwareTriggerEdge"] = {} + self._defaults["SendSoftwareTriggerEdge"]["return"] = 0 + self._defaults["SetAttributeViBoolean"] = {} + self._defaults["SetAttributeViBoolean"]["return"] = 0 + self._defaults["SetAttributeViInt32"] = {} + self._defaults["SetAttributeViInt32"]["return"] = 0 + self._defaults["SetAttributeViInt64"] = {} + self._defaults["SetAttributeViInt64"]["return"] = 0 + self._defaults["SetAttributeViReal64"] = {} + self._defaults["SetAttributeViReal64"]["return"] = 0 + self._defaults["SetAttributeViString"] = {} + self._defaults["SetAttributeViString"]["return"] = 0 + self._defaults["UnlockSession"] = {} + self._defaults["UnlockSession"]["return"] = 0 + self._defaults["UnlockSession"]["callerHasLock"] = None + self._defaults["close"] = {} + self._defaults["close"]["return"] = 0 + self._defaults["error_message"] = {} + self._defaults["error_message"]["return"] = 0 + self._defaults["error_message"]["errorMessage"] = None + self._defaults["reset"] = {} + self._defaults["reset"]["return"] = 0 + self._defaults["self_test"] = {} + self._defaults["self_test"]["return"] = 0 + self._defaults["self_test"]["selfTestResult"] = None + self._defaults["self_test"]["selfTestMessage"] = None def __getitem__(self, func): return self._defaults[func] @@ -186,192 +186,275 @@ def __setitem__(self, func, val): self._defaults[func] = val def niScope_Abort(self, vi): # noqa: N802 - if self._defaults['Abort']['return'] != 0: - return self._defaults['Abort']['return'] - return self._defaults['Abort']['return'] + if self._defaults["Abort"]["return"] != 0: + return self._defaults["Abort"]["return"] + return self._defaults["Abort"]["return"] def niScope_AcquisitionStatus(self, vi, acquisition_status): # noqa: N802 - if self._defaults['AcquisitionStatus']['return'] != 0: - return self._defaults['AcquisitionStatus']['return'] + if self._defaults["AcquisitionStatus"]["return"] != 0: + return self._defaults["AcquisitionStatus"]["return"] # acquisition_status - if self._defaults['AcquisitionStatus']['acquisitionStatus'] is None: - raise MockFunctionCallError("niScope_AcquisitionStatus", param='acquisitionStatus') + if self._defaults["AcquisitionStatus"]["acquisitionStatus"] is None: + raise MockFunctionCallError( + "niScope_AcquisitionStatus", param="acquisitionStatus" + ) if acquisition_status is not None: - acquisition_status.contents.value = self._defaults['AcquisitionStatus']['acquisitionStatus'] - return self._defaults['AcquisitionStatus']['return'] - - def niScope_ActualMeasWfmSize(self, vi, array_meas_function, meas_waveform_size): # noqa: N802 - if self._defaults['ActualMeasWfmSize']['return'] != 0: - return self._defaults['ActualMeasWfmSize']['return'] + acquisition_status.contents.value = self._defaults["AcquisitionStatus"][ + "acquisitionStatus" + ] + return self._defaults["AcquisitionStatus"]["return"] + + def niScope_ActualMeasWfmSize( + self, vi, array_meas_function, meas_waveform_size + ): # noqa: N802 + if self._defaults["ActualMeasWfmSize"]["return"] != 0: + return self._defaults["ActualMeasWfmSize"]["return"] # meas_waveform_size - if self._defaults['ActualMeasWfmSize']['measWaveformSize'] is None: - raise MockFunctionCallError("niScope_ActualMeasWfmSize", param='measWaveformSize') + if self._defaults["ActualMeasWfmSize"]["measWaveformSize"] is None: + raise MockFunctionCallError( + "niScope_ActualMeasWfmSize", param="measWaveformSize" + ) if meas_waveform_size is not None: - meas_waveform_size.contents.value = self._defaults['ActualMeasWfmSize']['measWaveformSize'] - return self._defaults['ActualMeasWfmSize']['return'] + meas_waveform_size.contents.value = self._defaults["ActualMeasWfmSize"][ + "measWaveformSize" + ] + return self._defaults["ActualMeasWfmSize"]["return"] def niScope_ActualNumWfms(self, vi, channel_list, num_wfms): # noqa: N802 - if self._defaults['ActualNumWfms']['return'] != 0: - return self._defaults['ActualNumWfms']['return'] + if self._defaults["ActualNumWfms"]["return"] != 0: + return self._defaults["ActualNumWfms"]["return"] # num_wfms - if self._defaults['ActualNumWfms']['numWfms'] is None: - raise MockFunctionCallError("niScope_ActualNumWfms", param='numWfms') + if self._defaults["ActualNumWfms"]["numWfms"] is None: + raise MockFunctionCallError("niScope_ActualNumWfms", param="numWfms") if num_wfms is not None: - num_wfms.contents.value = self._defaults['ActualNumWfms']['numWfms'] - return self._defaults['ActualNumWfms']['return'] + num_wfms.contents.value = self._defaults["ActualNumWfms"]["numWfms"] + return self._defaults["ActualNumWfms"]["return"] - def niScope_AddWaveformProcessing(self, vi, channel_list, meas_function): # noqa: N802 - if self._defaults['AddWaveformProcessing']['return'] != 0: - return self._defaults['AddWaveformProcessing']['return'] - return self._defaults['AddWaveformProcessing']['return'] + def niScope_AddWaveformProcessing( + self, vi, channel_list, meas_function + ): # noqa: N802 + if self._defaults["AddWaveformProcessing"]["return"] != 0: + return self._defaults["AddWaveformProcessing"]["return"] + return self._defaults["AddWaveformProcessing"]["return"] def niScope_AutoSetup(self, vi): # noqa: N802 - if self._defaults['AutoSetup']['return'] != 0: - return self._defaults['AutoSetup']['return'] - return self._defaults['AutoSetup']['return'] + if self._defaults["AutoSetup"]["return"] != 0: + return self._defaults["AutoSetup"]["return"] + return self._defaults["AutoSetup"]["return"] def niScope_CalFetchDate(self, vi, which_one, year, month, day): # noqa: N802 - if self._defaults['CalFetchDate']['return'] != 0: - return self._defaults['CalFetchDate']['return'] + if self._defaults["CalFetchDate"]["return"] != 0: + return self._defaults["CalFetchDate"]["return"] # year - if self._defaults['CalFetchDate']['year'] is None: - raise MockFunctionCallError("niScope_CalFetchDate", param='year') + if self._defaults["CalFetchDate"]["year"] is None: + raise MockFunctionCallError("niScope_CalFetchDate", param="year") if year is not None: - year.contents.value = self._defaults['CalFetchDate']['year'] + year.contents.value = self._defaults["CalFetchDate"]["year"] # month - if self._defaults['CalFetchDate']['month'] is None: - raise MockFunctionCallError("niScope_CalFetchDate", param='month') + if self._defaults["CalFetchDate"]["month"] is None: + raise MockFunctionCallError("niScope_CalFetchDate", param="month") if month is not None: - month.contents.value = self._defaults['CalFetchDate']['month'] + month.contents.value = self._defaults["CalFetchDate"]["month"] # day - if self._defaults['CalFetchDate']['day'] is None: - raise MockFunctionCallError("niScope_CalFetchDate", param='day') + if self._defaults["CalFetchDate"]["day"] is None: + raise MockFunctionCallError("niScope_CalFetchDate", param="day") if day is not None: - day.contents.value = self._defaults['CalFetchDate']['day'] - return self._defaults['CalFetchDate']['return'] + day.contents.value = self._defaults["CalFetchDate"]["day"] + return self._defaults["CalFetchDate"]["return"] def niScope_CalFetchTemperature(self, vi, which_one, temperature): # noqa: N802 - if self._defaults['CalFetchTemperature']['return'] != 0: - return self._defaults['CalFetchTemperature']['return'] + if self._defaults["CalFetchTemperature"]["return"] != 0: + return self._defaults["CalFetchTemperature"]["return"] # temperature - if self._defaults['CalFetchTemperature']['temperature'] is None: - raise MockFunctionCallError("niScope_CalFetchTemperature", param='temperature') + if self._defaults["CalFetchTemperature"]["temperature"] is None: + raise MockFunctionCallError( + "niScope_CalFetchTemperature", param="temperature" + ) if temperature is not None: - temperature.contents.value = self._defaults['CalFetchTemperature']['temperature'] - return self._defaults['CalFetchTemperature']['return'] + temperature.contents.value = self._defaults["CalFetchTemperature"][ + "temperature" + ] + return self._defaults["CalFetchTemperature"]["return"] def niScope_CalSelfCalibrate(self, vi, channel_list, option): # noqa: N802 - if self._defaults['CalSelfCalibrate']['return'] != 0: - return self._defaults['CalSelfCalibrate']['return'] - return self._defaults['CalSelfCalibrate']['return'] + if self._defaults["CalSelfCalibrate"]["return"] != 0: + return self._defaults["CalSelfCalibrate"]["return"] + return self._defaults["CalSelfCalibrate"]["return"] - def niScope_ClearWaveformMeasurementStats(self, vi, channel_list, clearable_measurement_function): # noqa: N802 - if self._defaults['ClearWaveformMeasurementStats']['return'] != 0: - return self._defaults['ClearWaveformMeasurementStats']['return'] - return self._defaults['ClearWaveformMeasurementStats']['return'] + def niScope_ClearWaveformMeasurementStats( + self, vi, channel_list, clearable_measurement_function + ): # noqa: N802 + if self._defaults["ClearWaveformMeasurementStats"]["return"] != 0: + return self._defaults["ClearWaveformMeasurementStats"]["return"] + return self._defaults["ClearWaveformMeasurementStats"]["return"] def niScope_ClearWaveformProcessing(self, vi, channel_list): # noqa: N802 - if self._defaults['ClearWaveformProcessing']['return'] != 0: - return self._defaults['ClearWaveformProcessing']['return'] - return self._defaults['ClearWaveformProcessing']['return'] + if self._defaults["ClearWaveformProcessing"]["return"] != 0: + return self._defaults["ClearWaveformProcessing"]["return"] + return self._defaults["ClearWaveformProcessing"]["return"] def niScope_Commit(self, vi): # noqa: N802 - if self._defaults['Commit']['return'] != 0: - return self._defaults['Commit']['return'] - return self._defaults['Commit']['return'] - - def niScope_ConfigureChanCharacteristics(self, vi, channel_list, input_impedance, max_input_frequency): # noqa: N802 - if self._defaults['ConfigureChanCharacteristics']['return'] != 0: - return self._defaults['ConfigureChanCharacteristics']['return'] - return self._defaults['ConfigureChanCharacteristics']['return'] - - def niScope_ConfigureEqualizationFilterCoefficients(self, vi, channel_list, number_of_coefficients, coefficients): # noqa: N802 - if self._defaults['ConfigureEqualizationFilterCoefficients']['return'] != 0: - return self._defaults['ConfigureEqualizationFilterCoefficients']['return'] - return self._defaults['ConfigureEqualizationFilterCoefficients']['return'] - - def niScope_ConfigureHorizontalTiming(self, vi, min_sample_rate, min_num_pts, ref_position, num_records, enforce_realtime): # noqa: N802 - if self._defaults['ConfigureHorizontalTiming']['return'] != 0: - return self._defaults['ConfigureHorizontalTiming']['return'] - return self._defaults['ConfigureHorizontalTiming']['return'] + if self._defaults["Commit"]["return"] != 0: + return self._defaults["Commit"]["return"] + return self._defaults["Commit"]["return"] + + def niScope_ConfigureChanCharacteristics( + self, vi, channel_list, input_impedance, max_input_frequency + ): # noqa: N802 + if self._defaults["ConfigureChanCharacteristics"]["return"] != 0: + return self._defaults["ConfigureChanCharacteristics"]["return"] + return self._defaults["ConfigureChanCharacteristics"]["return"] + + def niScope_ConfigureEqualizationFilterCoefficients( + self, vi, channel_list, number_of_coefficients, coefficients + ): # noqa: N802 + if self._defaults["ConfigureEqualizationFilterCoefficients"]["return"] != 0: + return self._defaults["ConfigureEqualizationFilterCoefficients"]["return"] + return self._defaults["ConfigureEqualizationFilterCoefficients"]["return"] + + def niScope_ConfigureHorizontalTiming( + self, + vi, + min_sample_rate, + min_num_pts, + ref_position, + num_records, + enforce_realtime, + ): # noqa: N802 + if self._defaults["ConfigureHorizontalTiming"]["return"] != 0: + return self._defaults["ConfigureHorizontalTiming"]["return"] + return self._defaults["ConfigureHorizontalTiming"]["return"] def niScope_ConfigureRefLevels(self, vi, low, mid, high): # noqa: N802 - if self._defaults['ConfigureRefLevels']['return'] != 0: - return self._defaults['ConfigureRefLevels']['return'] - return self._defaults['ConfigureRefLevels']['return'] - - def niScope_ConfigureTriggerDigital(self, vi, trigger_source, slope, holdoff, delay): # noqa: N802 - if self._defaults['ConfigureTriggerDigital']['return'] != 0: - return self._defaults['ConfigureTriggerDigital']['return'] - return self._defaults['ConfigureTriggerDigital']['return'] - - def niScope_ConfigureTriggerEdge(self, vi, trigger_source, level, slope, trigger_coupling, holdoff, delay): # noqa: N802 - if self._defaults['ConfigureTriggerEdge']['return'] != 0: - return self._defaults['ConfigureTriggerEdge']['return'] - return self._defaults['ConfigureTriggerEdge']['return'] - - def niScope_ConfigureTriggerHysteresis(self, vi, trigger_source, level, hysteresis, slope, trigger_coupling, holdoff, delay): # noqa: N802 - if self._defaults['ConfigureTriggerHysteresis']['return'] != 0: - return self._defaults['ConfigureTriggerHysteresis']['return'] - return self._defaults['ConfigureTriggerHysteresis']['return'] + if self._defaults["ConfigureRefLevels"]["return"] != 0: + return self._defaults["ConfigureRefLevels"]["return"] + return self._defaults["ConfigureRefLevels"]["return"] + + def niScope_ConfigureTriggerDigital( + self, vi, trigger_source, slope, holdoff, delay + ): # noqa: N802 + if self._defaults["ConfigureTriggerDigital"]["return"] != 0: + return self._defaults["ConfigureTriggerDigital"]["return"] + return self._defaults["ConfigureTriggerDigital"]["return"] + + def niScope_ConfigureTriggerEdge( + self, vi, trigger_source, level, slope, trigger_coupling, holdoff, delay + ): # noqa: N802 + if self._defaults["ConfigureTriggerEdge"]["return"] != 0: + return self._defaults["ConfigureTriggerEdge"]["return"] + return self._defaults["ConfigureTriggerEdge"]["return"] + + def niScope_ConfigureTriggerHysteresis( + self, + vi, + trigger_source, + level, + hysteresis, + slope, + trigger_coupling, + holdoff, + delay, + ): # noqa: N802 + if self._defaults["ConfigureTriggerHysteresis"]["return"] != 0: + return self._defaults["ConfigureTriggerHysteresis"]["return"] + return self._defaults["ConfigureTriggerHysteresis"]["return"] def niScope_ConfigureTriggerImmediate(self, vi): # noqa: N802 - if self._defaults['ConfigureTriggerImmediate']['return'] != 0: - return self._defaults['ConfigureTriggerImmediate']['return'] - return self._defaults['ConfigureTriggerImmediate']['return'] + if self._defaults["ConfigureTriggerImmediate"]["return"] != 0: + return self._defaults["ConfigureTriggerImmediate"]["return"] + return self._defaults["ConfigureTriggerImmediate"]["return"] def niScope_ConfigureTriggerSoftware(self, vi, holdoff, delay): # noqa: N802 - if self._defaults['ConfigureTriggerSoftware']['return'] != 0: - return self._defaults['ConfigureTriggerSoftware']['return'] - return self._defaults['ConfigureTriggerSoftware']['return'] - - def niScope_ConfigureTriggerVideo(self, vi, trigger_source, enable_dc_restore, signal_format, event, line_number, polarity, trigger_coupling, holdoff, delay): # noqa: N802 - if self._defaults['ConfigureTriggerVideo']['return'] != 0: - return self._defaults['ConfigureTriggerVideo']['return'] - return self._defaults['ConfigureTriggerVideo']['return'] - - def niScope_ConfigureTriggerWindow(self, vi, trigger_source, low_level, high_level, window_mode, trigger_coupling, holdoff, delay): # noqa: N802 - if self._defaults['ConfigureTriggerWindow']['return'] != 0: - return self._defaults['ConfigureTriggerWindow']['return'] - return self._defaults['ConfigureTriggerWindow']['return'] - - def niScope_ConfigureVertical(self, vi, channel_list, range, offset, coupling, probe_attenuation, enabled): # noqa: N802 - if self._defaults['ConfigureVertical']['return'] != 0: - return self._defaults['ConfigureVertical']['return'] - return self._defaults['ConfigureVertical']['return'] + if self._defaults["ConfigureTriggerSoftware"]["return"] != 0: + return self._defaults["ConfigureTriggerSoftware"]["return"] + return self._defaults["ConfigureTriggerSoftware"]["return"] + + def niScope_ConfigureTriggerVideo( + self, + vi, + trigger_source, + enable_dc_restore, + signal_format, + event, + line_number, + polarity, + trigger_coupling, + holdoff, + delay, + ): # noqa: N802 + if self._defaults["ConfigureTriggerVideo"]["return"] != 0: + return self._defaults["ConfigureTriggerVideo"]["return"] + return self._defaults["ConfigureTriggerVideo"]["return"] + + def niScope_ConfigureTriggerWindow( + self, + vi, + trigger_source, + low_level, + high_level, + window_mode, + trigger_coupling, + holdoff, + delay, + ): # noqa: N802 + if self._defaults["ConfigureTriggerWindow"]["return"] != 0: + return self._defaults["ConfigureTriggerWindow"]["return"] + return self._defaults["ConfigureTriggerWindow"]["return"] + + def niScope_ConfigureVertical( + self, vi, channel_list, range, offset, coupling, probe_attenuation, enabled + ): # noqa: N802 + if self._defaults["ConfigureVertical"]["return"] != 0: + return self._defaults["ConfigureVertical"]["return"] + return self._defaults["ConfigureVertical"]["return"] def niScope_Disable(self, vi): # noqa: N802 - if self._defaults['Disable']['return'] != 0: - return self._defaults['Disable']['return'] - return self._defaults['Disable']['return'] - - def niScope_ExportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 - if self._defaults['ExportAttributeConfigurationBuffer']['return'] != 0: - return self._defaults['ExportAttributeConfigurationBuffer']['return'] - if self._defaults['ExportAttributeConfigurationBuffer']['configuration'] is None: - raise MockFunctionCallError("niScope_ExportAttributeConfigurationBuffer", param='configuration') + if self._defaults["Disable"]["return"] != 0: + return self._defaults["Disable"]["return"] + return self._defaults["Disable"]["return"] + + def niScope_ExportAttributeConfigurationBuffer( + self, vi, size_in_bytes, configuration + ): # noqa: N802 + if self._defaults["ExportAttributeConfigurationBuffer"]["return"] != 0: + return self._defaults["ExportAttributeConfigurationBuffer"]["return"] + if ( + self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] + is None + ): + raise MockFunctionCallError( + "niScope_ExportAttributeConfigurationBuffer", param="configuration" + ) if size_in_bytes.value == 0: - return len(self._defaults['ExportAttributeConfigurationBuffer']['configuration']) + return len( + self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] + ) try: configuration_ref = configuration.contents except AttributeError: configuration_ref = configuration - for i in range(len(self._defaults['ExportAttributeConfigurationBuffer']['configuration'])): - configuration_ref[i] = self._defaults['ExportAttributeConfigurationBuffer']['configuration'][i] - return self._defaults['ExportAttributeConfigurationBuffer']['return'] + for i in range( + len(self._defaults["ExportAttributeConfigurationBuffer"]["configuration"]) + ): + configuration_ref[i] = self._defaults["ExportAttributeConfigurationBuffer"][ + "configuration" + ][i] + return self._defaults["ExportAttributeConfigurationBuffer"]["return"] def niScope_ExportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 - if self._defaults['ExportAttributeConfigurationFile']['return'] != 0: - return self._defaults['ExportAttributeConfigurationFile']['return'] - return self._defaults['ExportAttributeConfigurationFile']['return'] - - def niScope_Fetch(self, vi, channel_list, timeout, num_samples, waveform, wfm_info): # noqa: N802 - if self._defaults['Fetch']['return'] != 0: - return self._defaults['Fetch']['return'] + if self._defaults["ExportAttributeConfigurationFile"]["return"] != 0: + return self._defaults["ExportAttributeConfigurationFile"]["return"] + return self._defaults["ExportAttributeConfigurationFile"]["return"] + + def niScope_Fetch( + self, vi, channel_list, timeout, num_samples, waveform, wfm_info + ): # noqa: N802 + if self._defaults["Fetch"]["return"] != 0: + return self._defaults["Fetch"]["return"] # waveform - if self._defaults['Fetch']['waveform'] is None: - raise MockFunctionCallError("niScope_Fetch", param='waveform') - test_value = self._defaults['Fetch']['waveform'] + if self._defaults["Fetch"]["waveform"] is None: + raise MockFunctionCallError("niScope_Fetch", param="waveform") + test_value = self._defaults["Fetch"]["waveform"] try: waveform_ref = waveform.contents except AttributeError: @@ -380,9 +463,9 @@ def niScope_Fetch(self, vi, channel_list, timeout, num_samples, waveform, wfm_in for i in range(len(test_value)): waveform_ref[i] = test_value[i] # wfm_info - if self._defaults['Fetch']['wfmInfo'] is None: - raise MockFunctionCallError("niScope_Fetch", param='wfmInfo') - test_value = self._defaults['Fetch']['wfmInfo'] + if self._defaults["Fetch"]["wfmInfo"] is None: + raise MockFunctionCallError("niScope_Fetch", param="wfmInfo") + test_value = self._defaults["Fetch"]["wfmInfo"] try: wfm_info_ref = wfm_info.contents except AttributeError: @@ -390,15 +473,26 @@ def niScope_Fetch(self, vi, channel_list, timeout, num_samples, waveform, wfm_in assert len(wfm_info_ref) >= len(test_value) for i in range(len(test_value)): wfm_info_ref[i] = test_value[i] - return self._defaults['Fetch']['return'] - - def niScope_FetchArrayMeasurement(self, vi, channel_list, timeout, array_meas_function, measurement_waveform_size, meas_wfm, wfm_info): # noqa: N802 - if self._defaults['FetchArrayMeasurement']['return'] != 0: - return self._defaults['FetchArrayMeasurement']['return'] + return self._defaults["Fetch"]["return"] + + def niScope_FetchArrayMeasurement( + self, + vi, + channel_list, + timeout, + array_meas_function, + measurement_waveform_size, + meas_wfm, + wfm_info, + ): # noqa: N802 + if self._defaults["FetchArrayMeasurement"]["return"] != 0: + return self._defaults["FetchArrayMeasurement"]["return"] # meas_wfm - if self._defaults['FetchArrayMeasurement']['measWfm'] is None: - raise MockFunctionCallError("niScope_FetchArrayMeasurement", param='measWfm') - test_value = self._defaults['FetchArrayMeasurement']['measWfm'] + if self._defaults["FetchArrayMeasurement"]["measWfm"] is None: + raise MockFunctionCallError( + "niScope_FetchArrayMeasurement", param="measWfm" + ) + test_value = self._defaults["FetchArrayMeasurement"]["measWfm"] try: meas_wfm_ref = meas_wfm.contents except AttributeError: @@ -407,9 +501,11 @@ def niScope_FetchArrayMeasurement(self, vi, channel_list, timeout, array_meas_fu for i in range(len(test_value)): meas_wfm_ref[i] = test_value[i] # wfm_info - if self._defaults['FetchArrayMeasurement']['wfmInfo'] is None: - raise MockFunctionCallError("niScope_FetchArrayMeasurement", param='wfmInfo') - test_value = self._defaults['FetchArrayMeasurement']['wfmInfo'] + if self._defaults["FetchArrayMeasurement"]["wfmInfo"] is None: + raise MockFunctionCallError( + "niScope_FetchArrayMeasurement", param="wfmInfo" + ) + test_value = self._defaults["FetchArrayMeasurement"]["wfmInfo"] try: wfm_info_ref = wfm_info.contents except AttributeError: @@ -417,15 +513,17 @@ def niScope_FetchArrayMeasurement(self, vi, channel_list, timeout, array_meas_fu assert len(wfm_info_ref) >= len(test_value) for i in range(len(test_value)): wfm_info_ref[i] = test_value[i] - return self._defaults['FetchArrayMeasurement']['return'] + return self._defaults["FetchArrayMeasurement"]["return"] - def niScope_FetchBinary16(self, vi, channel_list, timeout, num_samples, waveform, wfm_info): # noqa: N802 - if self._defaults['FetchBinary16']['return'] != 0: - return self._defaults['FetchBinary16']['return'] + def niScope_FetchBinary16( + self, vi, channel_list, timeout, num_samples, waveform, wfm_info + ): # noqa: N802 + if self._defaults["FetchBinary16"]["return"] != 0: + return self._defaults["FetchBinary16"]["return"] # waveform - if self._defaults['FetchBinary16']['waveform'] is None: - raise MockFunctionCallError("niScope_FetchBinary16", param='waveform') - test_value = self._defaults['FetchBinary16']['waveform'] + if self._defaults["FetchBinary16"]["waveform"] is None: + raise MockFunctionCallError("niScope_FetchBinary16", param="waveform") + test_value = self._defaults["FetchBinary16"]["waveform"] try: waveform_ref = waveform.contents except AttributeError: @@ -434,9 +532,9 @@ def niScope_FetchBinary16(self, vi, channel_list, timeout, num_samples, waveform for i in range(len(test_value)): waveform_ref[i] = test_value[i] # wfm_info - if self._defaults['FetchBinary16']['wfmInfo'] is None: - raise MockFunctionCallError("niScope_FetchBinary16", param='wfmInfo') - test_value = self._defaults['FetchBinary16']['wfmInfo'] + if self._defaults["FetchBinary16"]["wfmInfo"] is None: + raise MockFunctionCallError("niScope_FetchBinary16", param="wfmInfo") + test_value = self._defaults["FetchBinary16"]["wfmInfo"] try: wfm_info_ref = wfm_info.contents except AttributeError: @@ -444,15 +542,17 @@ def niScope_FetchBinary16(self, vi, channel_list, timeout, num_samples, waveform assert len(wfm_info_ref) >= len(test_value) for i in range(len(test_value)): wfm_info_ref[i] = test_value[i] - return self._defaults['FetchBinary16']['return'] + return self._defaults["FetchBinary16"]["return"] - def niScope_FetchBinary32(self, vi, channel_list, timeout, num_samples, waveform, wfm_info): # noqa: N802 - if self._defaults['FetchBinary32']['return'] != 0: - return self._defaults['FetchBinary32']['return'] + def niScope_FetchBinary32( + self, vi, channel_list, timeout, num_samples, waveform, wfm_info + ): # noqa: N802 + if self._defaults["FetchBinary32"]["return"] != 0: + return self._defaults["FetchBinary32"]["return"] # waveform - if self._defaults['FetchBinary32']['waveform'] is None: - raise MockFunctionCallError("niScope_FetchBinary32", param='waveform') - test_value = self._defaults['FetchBinary32']['waveform'] + if self._defaults["FetchBinary32"]["waveform"] is None: + raise MockFunctionCallError("niScope_FetchBinary32", param="waveform") + test_value = self._defaults["FetchBinary32"]["waveform"] try: waveform_ref = waveform.contents except AttributeError: @@ -461,9 +561,9 @@ def niScope_FetchBinary32(self, vi, channel_list, timeout, num_samples, waveform for i in range(len(test_value)): waveform_ref[i] = test_value[i] # wfm_info - if self._defaults['FetchBinary32']['wfmInfo'] is None: - raise MockFunctionCallError("niScope_FetchBinary32", param='wfmInfo') - test_value = self._defaults['FetchBinary32']['wfmInfo'] + if self._defaults["FetchBinary32"]["wfmInfo"] is None: + raise MockFunctionCallError("niScope_FetchBinary32", param="wfmInfo") + test_value = self._defaults["FetchBinary32"]["wfmInfo"] try: wfm_info_ref = wfm_info.contents except AttributeError: @@ -471,15 +571,17 @@ def niScope_FetchBinary32(self, vi, channel_list, timeout, num_samples, waveform assert len(wfm_info_ref) >= len(test_value) for i in range(len(test_value)): wfm_info_ref[i] = test_value[i] - return self._defaults['FetchBinary32']['return'] + return self._defaults["FetchBinary32"]["return"] - def niScope_FetchBinary8(self, vi, channel_list, timeout, num_samples, waveform, wfm_info): # noqa: N802 - if self._defaults['FetchBinary8']['return'] != 0: - return self._defaults['FetchBinary8']['return'] + def niScope_FetchBinary8( + self, vi, channel_list, timeout, num_samples, waveform, wfm_info + ): # noqa: N802 + if self._defaults["FetchBinary8"]["return"] != 0: + return self._defaults["FetchBinary8"]["return"] # waveform - if self._defaults['FetchBinary8']['waveform'] is None: - raise MockFunctionCallError("niScope_FetchBinary8", param='waveform') - test_value = self._defaults['FetchBinary8']['waveform'] + if self._defaults["FetchBinary8"]["waveform"] is None: + raise MockFunctionCallError("niScope_FetchBinary8", param="waveform") + test_value = self._defaults["FetchBinary8"]["waveform"] try: waveform_ref = waveform.contents except AttributeError: @@ -488,9 +590,9 @@ def niScope_FetchBinary8(self, vi, channel_list, timeout, num_samples, waveform, for i in range(len(test_value)): waveform_ref[i] = test_value[i] # wfm_info - if self._defaults['FetchBinary8']['wfmInfo'] is None: - raise MockFunctionCallError("niScope_FetchBinary8", param='wfmInfo') - test_value = self._defaults['FetchBinary8']['wfmInfo'] + if self._defaults["FetchBinary8"]["wfmInfo"] is None: + raise MockFunctionCallError("niScope_FetchBinary8", param="wfmInfo") + test_value = self._defaults["FetchBinary8"]["wfmInfo"] try: wfm_info_ref = wfm_info.contents except AttributeError: @@ -498,15 +600,27 @@ def niScope_FetchBinary8(self, vi, channel_list, timeout, num_samples, waveform, assert len(wfm_info_ref) >= len(test_value) for i in range(len(test_value)): wfm_info_ref[i] = test_value[i] - return self._defaults['FetchBinary8']['return'] - - def niScope_FetchMeasurementStats(self, vi, channel_list, timeout, scalar_meas_function, result, mean, stdev, min, max, num_in_stats): # noqa: N802 - if self._defaults['FetchMeasurementStats']['return'] != 0: - return self._defaults['FetchMeasurementStats']['return'] + return self._defaults["FetchBinary8"]["return"] + + def niScope_FetchMeasurementStats( + self, + vi, + channel_list, + timeout, + scalar_meas_function, + result, + mean, + stdev, + min, + max, + num_in_stats, + ): # noqa: N802 + if self._defaults["FetchMeasurementStats"]["return"] != 0: + return self._defaults["FetchMeasurementStats"]["return"] # result - if self._defaults['FetchMeasurementStats']['result'] is None: - raise MockFunctionCallError("niScope_FetchMeasurementStats", param='result') - test_value = self._defaults['FetchMeasurementStats']['result'] + if self._defaults["FetchMeasurementStats"]["result"] is None: + raise MockFunctionCallError("niScope_FetchMeasurementStats", param="result") + test_value = self._defaults["FetchMeasurementStats"]["result"] try: result_ref = result.contents except AttributeError: @@ -515,9 +629,9 @@ def niScope_FetchMeasurementStats(self, vi, channel_list, timeout, scalar_meas_f for i in range(len(test_value)): result_ref[i] = test_value[i] # mean - if self._defaults['FetchMeasurementStats']['mean'] is None: - raise MockFunctionCallError("niScope_FetchMeasurementStats", param='mean') - test_value = self._defaults['FetchMeasurementStats']['mean'] + if self._defaults["FetchMeasurementStats"]["mean"] is None: + raise MockFunctionCallError("niScope_FetchMeasurementStats", param="mean") + test_value = self._defaults["FetchMeasurementStats"]["mean"] try: mean_ref = mean.contents except AttributeError: @@ -526,9 +640,9 @@ def niScope_FetchMeasurementStats(self, vi, channel_list, timeout, scalar_meas_f for i in range(len(test_value)): mean_ref[i] = test_value[i] # stdev - if self._defaults['FetchMeasurementStats']['stdev'] is None: - raise MockFunctionCallError("niScope_FetchMeasurementStats", param='stdev') - test_value = self._defaults['FetchMeasurementStats']['stdev'] + if self._defaults["FetchMeasurementStats"]["stdev"] is None: + raise MockFunctionCallError("niScope_FetchMeasurementStats", param="stdev") + test_value = self._defaults["FetchMeasurementStats"]["stdev"] try: stdev_ref = stdev.contents except AttributeError: @@ -537,9 +651,9 @@ def niScope_FetchMeasurementStats(self, vi, channel_list, timeout, scalar_meas_f for i in range(len(test_value)): stdev_ref[i] = test_value[i] # min - if self._defaults['FetchMeasurementStats']['min'] is None: - raise MockFunctionCallError("niScope_FetchMeasurementStats", param='min') - test_value = self._defaults['FetchMeasurementStats']['min'] + if self._defaults["FetchMeasurementStats"]["min"] is None: + raise MockFunctionCallError("niScope_FetchMeasurementStats", param="min") + test_value = self._defaults["FetchMeasurementStats"]["min"] try: min_ref = min.contents except AttributeError: @@ -548,9 +662,9 @@ def niScope_FetchMeasurementStats(self, vi, channel_list, timeout, scalar_meas_f for i in range(len(test_value)): min_ref[i] = test_value[i] # max - if self._defaults['FetchMeasurementStats']['max'] is None: - raise MockFunctionCallError("niScope_FetchMeasurementStats", param='max') - test_value = self._defaults['FetchMeasurementStats']['max'] + if self._defaults["FetchMeasurementStats"]["max"] is None: + raise MockFunctionCallError("niScope_FetchMeasurementStats", param="max") + test_value = self._defaults["FetchMeasurementStats"]["max"] try: max_ref = max.contents except AttributeError: @@ -559,9 +673,11 @@ def niScope_FetchMeasurementStats(self, vi, channel_list, timeout, scalar_meas_f for i in range(len(test_value)): max_ref[i] = test_value[i] # num_in_stats - if self._defaults['FetchMeasurementStats']['numInStats'] is None: - raise MockFunctionCallError("niScope_FetchMeasurementStats", param='numInStats') - test_value = self._defaults['FetchMeasurementStats']['numInStats'] + if self._defaults["FetchMeasurementStats"]["numInStats"] is None: + raise MockFunctionCallError( + "niScope_FetchMeasurementStats", param="numInStats" + ) + test_value = self._defaults["FetchMeasurementStats"]["numInStats"] try: num_in_stats_ref = num_in_stats.contents except AttributeError: @@ -569,65 +685,79 @@ def niScope_FetchMeasurementStats(self, vi, channel_list, timeout, scalar_meas_f assert len(num_in_stats_ref) >= len(test_value) for i in range(len(test_value)): num_in_stats_ref[i] = test_value[i] - return self._defaults['FetchMeasurementStats']['return'] + return self._defaults["FetchMeasurementStats"]["return"] - def niScope_GetAttributeViBoolean(self, vi, channel_list, attribute_id, value): # noqa: N802 - if self._defaults['GetAttributeViBoolean']['return'] != 0: - return self._defaults['GetAttributeViBoolean']['return'] + def niScope_GetAttributeViBoolean( + self, vi, channel_list, attribute_id, value + ): # noqa: N802 + if self._defaults["GetAttributeViBoolean"]["return"] != 0: + return self._defaults["GetAttributeViBoolean"]["return"] # value - if self._defaults['GetAttributeViBoolean']['value'] is None: - raise MockFunctionCallError("niScope_GetAttributeViBoolean", param='value') + if self._defaults["GetAttributeViBoolean"]["value"] is None: + raise MockFunctionCallError("niScope_GetAttributeViBoolean", param="value") if value is not None: - value.contents.value = self._defaults['GetAttributeViBoolean']['value'] - return self._defaults['GetAttributeViBoolean']['return'] - - def niScope_GetAttributeViInt32(self, vi, channel_list, attribute_id, value): # noqa: N802 - if self._defaults['GetAttributeViInt32']['return'] != 0: - return self._defaults['GetAttributeViInt32']['return'] + value.contents.value = self._defaults["GetAttributeViBoolean"]["value"] + return self._defaults["GetAttributeViBoolean"]["return"] + + def niScope_GetAttributeViInt32( + self, vi, channel_list, attribute_id, value + ): # noqa: N802 + if self._defaults["GetAttributeViInt32"]["return"] != 0: + return self._defaults["GetAttributeViInt32"]["return"] # value - if self._defaults['GetAttributeViInt32']['value'] is None: - raise MockFunctionCallError("niScope_GetAttributeViInt32", param='value') + if self._defaults["GetAttributeViInt32"]["value"] is None: + raise MockFunctionCallError("niScope_GetAttributeViInt32", param="value") if value is not None: - value.contents.value = self._defaults['GetAttributeViInt32']['value'] - return self._defaults['GetAttributeViInt32']['return'] - - def niScope_GetAttributeViInt64(self, vi, channel_list, attribute_id, value): # noqa: N802 - if self._defaults['GetAttributeViInt64']['return'] != 0: - return self._defaults['GetAttributeViInt64']['return'] + value.contents.value = self._defaults["GetAttributeViInt32"]["value"] + return self._defaults["GetAttributeViInt32"]["return"] + + def niScope_GetAttributeViInt64( + self, vi, channel_list, attribute_id, value + ): # noqa: N802 + if self._defaults["GetAttributeViInt64"]["return"] != 0: + return self._defaults["GetAttributeViInt64"]["return"] # value - if self._defaults['GetAttributeViInt64']['value'] is None: - raise MockFunctionCallError("niScope_GetAttributeViInt64", param='value') + if self._defaults["GetAttributeViInt64"]["value"] is None: + raise MockFunctionCallError("niScope_GetAttributeViInt64", param="value") if value is not None: - value.contents.value = self._defaults['GetAttributeViInt64']['value'] - return self._defaults['GetAttributeViInt64']['return'] - - def niScope_GetAttributeViReal64(self, vi, channel_list, attribute_id, value): # noqa: N802 - if self._defaults['GetAttributeViReal64']['return'] != 0: - return self._defaults['GetAttributeViReal64']['return'] + value.contents.value = self._defaults["GetAttributeViInt64"]["value"] + return self._defaults["GetAttributeViInt64"]["return"] + + def niScope_GetAttributeViReal64( + self, vi, channel_list, attribute_id, value + ): # noqa: N802 + if self._defaults["GetAttributeViReal64"]["return"] != 0: + return self._defaults["GetAttributeViReal64"]["return"] # value - if self._defaults['GetAttributeViReal64']['value'] is None: - raise MockFunctionCallError("niScope_GetAttributeViReal64", param='value') + if self._defaults["GetAttributeViReal64"]["value"] is None: + raise MockFunctionCallError("niScope_GetAttributeViReal64", param="value") if value is not None: - value.contents.value = self._defaults['GetAttributeViReal64']['value'] - return self._defaults['GetAttributeViReal64']['return'] - - def niScope_GetAttributeViString(self, vi, channel_list, attribute_id, buf_size, value): # noqa: N802 - if self._defaults['GetAttributeViString']['return'] != 0: - return self._defaults['GetAttributeViString']['return'] - if self._defaults['GetAttributeViString']['value'] is None: - raise MockFunctionCallError("niScope_GetAttributeViString", param='value') + value.contents.value = self._defaults["GetAttributeViReal64"]["value"] + return self._defaults["GetAttributeViReal64"]["return"] + + def niScope_GetAttributeViString( + self, vi, channel_list, attribute_id, buf_size, value + ): # noqa: N802 + if self._defaults["GetAttributeViString"]["return"] != 0: + return self._defaults["GetAttributeViString"]["return"] + if self._defaults["GetAttributeViString"]["value"] is None: + raise MockFunctionCallError("niScope_GetAttributeViString", param="value") if buf_size.value == 0: - return len(self._defaults['GetAttributeViString']['value']) - value.value = self._defaults['GetAttributeViString']['value'].encode('ascii') - return self._defaults['GetAttributeViString']['return'] - - def niScope_GetEqualizationFilterCoefficients(self, vi, channel, number_of_coefficients, coefficients): # noqa: N802 - if self._defaults['GetEqualizationFilterCoefficients']['return'] != 0: - return self._defaults['GetEqualizationFilterCoefficients']['return'] + return len(self._defaults["GetAttributeViString"]["value"]) + value.value = self._defaults["GetAttributeViString"]["value"].encode("ascii") + return self._defaults["GetAttributeViString"]["return"] + + def niScope_GetEqualizationFilterCoefficients( + self, vi, channel, number_of_coefficients, coefficients + ): # noqa: N802 + if self._defaults["GetEqualizationFilterCoefficients"]["return"] != 0: + return self._defaults["GetEqualizationFilterCoefficients"]["return"] # coefficients - if self._defaults['GetEqualizationFilterCoefficients']['coefficients'] is None: - raise MockFunctionCallError("niScope_GetEqualizationFilterCoefficients", param='coefficients') - test_value = self._defaults['GetEqualizationFilterCoefficients']['coefficients'] + if self._defaults["GetEqualizationFilterCoefficients"]["coefficients"] is None: + raise MockFunctionCallError( + "niScope_GetEqualizationFilterCoefficients", param="coefficients" + ) + test_value = self._defaults["GetEqualizationFilterCoefficients"]["coefficients"] try: coefficients_ref = coefficients.contents except AttributeError: @@ -635,75 +765,83 @@ def niScope_GetEqualizationFilterCoefficients(self, vi, channel, number_of_coeff assert len(coefficients_ref) >= len(test_value) for i in range(len(test_value)): coefficients_ref[i] = test_value[i] - return self._defaults['GetEqualizationFilterCoefficients']['return'] + return self._defaults["GetEqualizationFilterCoefficients"]["return"] def niScope_GetError(self, vi, error_code, buffer_size, description): # noqa: N802 - if self._defaults['GetError']['return'] != 0: - return self._defaults['GetError']['return'] + if self._defaults["GetError"]["return"] != 0: + return self._defaults["GetError"]["return"] # error_code - if self._defaults['GetError']['errorCode'] is None: - raise MockFunctionCallError("niScope_GetError", param='errorCode') + if self._defaults["GetError"]["errorCode"] is None: + raise MockFunctionCallError("niScope_GetError", param="errorCode") if error_code is not None: - error_code.contents.value = self._defaults['GetError']['errorCode'] - if self._defaults['GetError']['description'] is None: - raise MockFunctionCallError("niScope_GetError", param='description') + error_code.contents.value = self._defaults["GetError"]["errorCode"] + if self._defaults["GetError"]["description"] is None: + raise MockFunctionCallError("niScope_GetError", param="description") if buffer_size.value == 0: - return len(self._defaults['GetError']['description']) - description.value = self._defaults['GetError']['description'].encode('ascii') - return self._defaults['GetError']['return'] + return len(self._defaults["GetError"]["description"]) + description.value = self._defaults["GetError"]["description"].encode("ascii") + return self._defaults["GetError"]["return"] - def niScope_ImportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 - if self._defaults['ImportAttributeConfigurationBuffer']['return'] != 0: - return self._defaults['ImportAttributeConfigurationBuffer']['return'] - return self._defaults['ImportAttributeConfigurationBuffer']['return'] + def niScope_ImportAttributeConfigurationBuffer( + self, vi, size_in_bytes, configuration + ): # noqa: N802 + if self._defaults["ImportAttributeConfigurationBuffer"]["return"] != 0: + return self._defaults["ImportAttributeConfigurationBuffer"]["return"] + return self._defaults["ImportAttributeConfigurationBuffer"]["return"] def niScope_ImportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 - if self._defaults['ImportAttributeConfigurationFile']['return'] != 0: - return self._defaults['ImportAttributeConfigurationFile']['return'] - return self._defaults['ImportAttributeConfigurationFile']['return'] - - def niScope_InitWithOptions(self, resource_name, id_query, reset_device, option_string, vi): # noqa: N802 - if self._defaults['InitWithOptions']['return'] != 0: - return self._defaults['InitWithOptions']['return'] + if self._defaults["ImportAttributeConfigurationFile"]["return"] != 0: + return self._defaults["ImportAttributeConfigurationFile"]["return"] + return self._defaults["ImportAttributeConfigurationFile"]["return"] + + def niScope_InitWithOptions( + self, resource_name, id_query, reset_device, option_string, vi + ): # noqa: N802 + if self._defaults["InitWithOptions"]["return"] != 0: + return self._defaults["InitWithOptions"]["return"] # vi - if self._defaults['InitWithOptions']['vi'] is None: - raise MockFunctionCallError("niScope_InitWithOptions", param='vi') + if self._defaults["InitWithOptions"]["vi"] is None: + raise MockFunctionCallError("niScope_InitWithOptions", param="vi") if vi is not None: - vi.contents.value = self._defaults['InitWithOptions']['vi'] - return self._defaults['InitWithOptions']['return'] + vi.contents.value = self._defaults["InitWithOptions"]["vi"] + return self._defaults["InitWithOptions"]["return"] def niScope_InitiateAcquisition(self, vi): # noqa: N802 - if self._defaults['InitiateAcquisition']['return'] != 0: - return self._defaults['InitiateAcquisition']['return'] - return self._defaults['InitiateAcquisition']['return'] + if self._defaults["InitiateAcquisition"]["return"] != 0: + return self._defaults["InitiateAcquisition"]["return"] + return self._defaults["InitiateAcquisition"]["return"] def niScope_LockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults['LockSession']['return'] != 0: - return self._defaults['LockSession']['return'] + if self._defaults["LockSession"]["return"] != 0: + return self._defaults["LockSession"]["return"] # caller_has_lock - if self._defaults['LockSession']['callerHasLock'] is None: - raise MockFunctionCallError("niScope_LockSession", param='callerHasLock') + if self._defaults["LockSession"]["callerHasLock"] is None: + raise MockFunctionCallError("niScope_LockSession", param="callerHasLock") if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults['LockSession']['callerHasLock'] - return self._defaults['LockSession']['return'] + caller_has_lock.contents.value = self._defaults["LockSession"][ + "callerHasLock" + ] + return self._defaults["LockSession"]["return"] def niScope_ProbeCompensationSignalStart(self, vi): # noqa: N802 - if self._defaults['ProbeCompensationSignalStart']['return'] != 0: - return self._defaults['ProbeCompensationSignalStart']['return'] - return self._defaults['ProbeCompensationSignalStart']['return'] + if self._defaults["ProbeCompensationSignalStart"]["return"] != 0: + return self._defaults["ProbeCompensationSignalStart"]["return"] + return self._defaults["ProbeCompensationSignalStart"]["return"] def niScope_ProbeCompensationSignalStop(self, vi): # noqa: N802 - if self._defaults['ProbeCompensationSignalStop']['return'] != 0: - return self._defaults['ProbeCompensationSignalStop']['return'] - return self._defaults['ProbeCompensationSignalStop']['return'] - - def niScope_Read(self, vi, channel_list, timeout, num_samples, waveform, wfm_info): # noqa: N802 - if self._defaults['Read']['return'] != 0: - return self._defaults['Read']['return'] + if self._defaults["ProbeCompensationSignalStop"]["return"] != 0: + return self._defaults["ProbeCompensationSignalStop"]["return"] + return self._defaults["ProbeCompensationSignalStop"]["return"] + + def niScope_Read( + self, vi, channel_list, timeout, num_samples, waveform, wfm_info + ): # noqa: N802 + if self._defaults["Read"]["return"] != 0: + return self._defaults["Read"]["return"] # waveform - if self._defaults['Read']['waveform'] is None: - raise MockFunctionCallError("niScope_Read", param='waveform') - test_value = self._defaults['Read']['waveform'] + if self._defaults["Read"]["waveform"] is None: + raise MockFunctionCallError("niScope_Read", param="waveform") + test_value = self._defaults["Read"]["waveform"] try: waveform_ref = waveform.contents except AttributeError: @@ -712,9 +850,9 @@ def niScope_Read(self, vi, channel_list, timeout, num_samples, waveform, wfm_inf for i in range(len(test_value)): waveform_ref[i] = test_value[i] # wfm_info - if self._defaults['Read']['wfmInfo'] is None: - raise MockFunctionCallError("niScope_Read", param='wfmInfo') - test_value = self._defaults['Read']['wfmInfo'] + if self._defaults["Read"]["wfmInfo"] is None: + raise MockFunctionCallError("niScope_Read", param="wfmInfo") + test_value = self._defaults["Read"]["wfmInfo"] try: wfm_info_ref = wfm_info.contents except AttributeError: @@ -722,222 +860,348 @@ def niScope_Read(self, vi, channel_list, timeout, num_samples, waveform, wfm_inf assert len(wfm_info_ref) >= len(test_value) for i in range(len(test_value)): wfm_info_ref[i] = test_value[i] - return self._defaults['Read']['return'] + return self._defaults["Read"]["return"] def niScope_ResetDevice(self, vi): # noqa: N802 - if self._defaults['ResetDevice']['return'] != 0: - return self._defaults['ResetDevice']['return'] - return self._defaults['ResetDevice']['return'] + if self._defaults["ResetDevice"]["return"] != 0: + return self._defaults["ResetDevice"]["return"] + return self._defaults["ResetDevice"]["return"] def niScope_ResetWithDefaults(self, vi): # noqa: N802 - if self._defaults['ResetWithDefaults']['return'] != 0: - return self._defaults['ResetWithDefaults']['return'] - return self._defaults['ResetWithDefaults']['return'] + if self._defaults["ResetWithDefaults"]["return"] != 0: + return self._defaults["ResetWithDefaults"]["return"] + return self._defaults["ResetWithDefaults"]["return"] def niScope_SendSoftwareTriggerEdge(self, vi, which_trigger): # noqa: N802 - if self._defaults['SendSoftwareTriggerEdge']['return'] != 0: - return self._defaults['SendSoftwareTriggerEdge']['return'] - return self._defaults['SendSoftwareTriggerEdge']['return'] - - def niScope_SetAttributeViBoolean(self, vi, channel_list, attribute_id, value): # noqa: N802 - if self._defaults['SetAttributeViBoolean']['return'] != 0: - return self._defaults['SetAttributeViBoolean']['return'] - return self._defaults['SetAttributeViBoolean']['return'] - - def niScope_SetAttributeViInt32(self, vi, channel_list, attribute_id, value): # noqa: N802 - if self._defaults['SetAttributeViInt32']['return'] != 0: - return self._defaults['SetAttributeViInt32']['return'] - return self._defaults['SetAttributeViInt32']['return'] - - def niScope_SetAttributeViInt64(self, vi, channel_list, attribute_id, value): # noqa: N802 - if self._defaults['SetAttributeViInt64']['return'] != 0: - return self._defaults['SetAttributeViInt64']['return'] - return self._defaults['SetAttributeViInt64']['return'] - - def niScope_SetAttributeViReal64(self, vi, channel_list, attribute_id, value): # noqa: N802 - if self._defaults['SetAttributeViReal64']['return'] != 0: - return self._defaults['SetAttributeViReal64']['return'] - return self._defaults['SetAttributeViReal64']['return'] - - def niScope_SetAttributeViString(self, vi, channel_list, attribute_id, value): # noqa: N802 - if self._defaults['SetAttributeViString']['return'] != 0: - return self._defaults['SetAttributeViString']['return'] - return self._defaults['SetAttributeViString']['return'] + if self._defaults["SendSoftwareTriggerEdge"]["return"] != 0: + return self._defaults["SendSoftwareTriggerEdge"]["return"] + return self._defaults["SendSoftwareTriggerEdge"]["return"] + + def niScope_SetAttributeViBoolean( + self, vi, channel_list, attribute_id, value + ): # noqa: N802 + if self._defaults["SetAttributeViBoolean"]["return"] != 0: + return self._defaults["SetAttributeViBoolean"]["return"] + return self._defaults["SetAttributeViBoolean"]["return"] + + def niScope_SetAttributeViInt32( + self, vi, channel_list, attribute_id, value + ): # noqa: N802 + if self._defaults["SetAttributeViInt32"]["return"] != 0: + return self._defaults["SetAttributeViInt32"]["return"] + return self._defaults["SetAttributeViInt32"]["return"] + + def niScope_SetAttributeViInt64( + self, vi, channel_list, attribute_id, value + ): # noqa: N802 + if self._defaults["SetAttributeViInt64"]["return"] != 0: + return self._defaults["SetAttributeViInt64"]["return"] + return self._defaults["SetAttributeViInt64"]["return"] + + def niScope_SetAttributeViReal64( + self, vi, channel_list, attribute_id, value + ): # noqa: N802 + if self._defaults["SetAttributeViReal64"]["return"] != 0: + return self._defaults["SetAttributeViReal64"]["return"] + return self._defaults["SetAttributeViReal64"]["return"] + + def niScope_SetAttributeViString( + self, vi, channel_list, attribute_id, value + ): # noqa: N802 + if self._defaults["SetAttributeViString"]["return"] != 0: + return self._defaults["SetAttributeViString"]["return"] + return self._defaults["SetAttributeViString"]["return"] def niScope_UnlockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults['UnlockSession']['return'] != 0: - return self._defaults['UnlockSession']['return'] + if self._defaults["UnlockSession"]["return"] != 0: + return self._defaults["UnlockSession"]["return"] # caller_has_lock - if self._defaults['UnlockSession']['callerHasLock'] is None: - raise MockFunctionCallError("niScope_UnlockSession", param='callerHasLock') + if self._defaults["UnlockSession"]["callerHasLock"] is None: + raise MockFunctionCallError("niScope_UnlockSession", param="callerHasLock") if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults['UnlockSession']['callerHasLock'] - return self._defaults['UnlockSession']['return'] + caller_has_lock.contents.value = self._defaults["UnlockSession"][ + "callerHasLock" + ] + return self._defaults["UnlockSession"]["return"] def niScope_close(self, vi): # noqa: N802 - if self._defaults['close']['return'] != 0: - return self._defaults['close']['return'] - return self._defaults['close']['return'] + if self._defaults["close"]["return"] != 0: + return self._defaults["close"]["return"] + return self._defaults["close"]["return"] def niScope_error_message(self, vi, error_code, error_message): # noqa: N802 - if self._defaults['error_message']['return'] != 0: - return self._defaults['error_message']['return'] + if self._defaults["error_message"]["return"] != 0: + return self._defaults["error_message"]["return"] # error_message - if self._defaults['error_message']['errorMessage'] is None: - raise MockFunctionCallError("niScope_error_message", param='errorMessage') - test_value = self._defaults['error_message']['errorMessage'] + if self._defaults["error_message"]["errorMessage"] is None: + raise MockFunctionCallError("niScope_error_message", param="errorMessage") + test_value = self._defaults["error_message"]["errorMessage"] if type(test_value) is str: - test_value = test_value.encode('ascii') + test_value = test_value.encode("ascii") assert len(error_message) >= len(test_value) for i in range(len(test_value)): error_message[i] = test_value[i] - return self._defaults['error_message']['return'] + return self._defaults["error_message"]["return"] def niScope_reset(self, vi): # noqa: N802 - if self._defaults['reset']['return'] != 0: - return self._defaults['reset']['return'] - return self._defaults['reset']['return'] + if self._defaults["reset"]["return"] != 0: + return self._defaults["reset"]["return"] + return self._defaults["reset"]["return"] def niScope_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 - if self._defaults['self_test']['return'] != 0: - return self._defaults['self_test']['return'] + if self._defaults["self_test"]["return"] != 0: + return self._defaults["self_test"]["return"] # self_test_result - if self._defaults['self_test']['selfTestResult'] is None: - raise MockFunctionCallError("niScope_self_test", param='selfTestResult') + if self._defaults["self_test"]["selfTestResult"] is None: + raise MockFunctionCallError("niScope_self_test", param="selfTestResult") if self_test_result is not None: - self_test_result.contents.value = self._defaults['self_test']['selfTestResult'] + self_test_result.contents.value = self._defaults["self_test"][ + "selfTestResult" + ] # self_test_message - if self._defaults['self_test']['selfTestMessage'] is None: - raise MockFunctionCallError("niScope_self_test", param='selfTestMessage') - test_value = self._defaults['self_test']['selfTestMessage'] + if self._defaults["self_test"]["selfTestMessage"] is None: + raise MockFunctionCallError("niScope_self_test", param="selfTestMessage") + test_value = self._defaults["self_test"]["selfTestMessage"] if type(test_value) is str: - test_value = test_value.encode('ascii') + test_value = test_value.encode("ascii") assert len(self_test_message) >= len(test_value) for i in range(len(test_value)): self_test_message[i] = test_value[i] - return self._defaults['self_test']['return'] + return self._defaults["self_test"]["return"] # Helper function to setup Mock object with default side effects and return values def set_side_effects_and_return_values(self, mock_library): mock_library.niScope_Abort.side_effect = MockFunctionCallError("niScope_Abort") mock_library.niScope_Abort.return_value = 0 - mock_library.niScope_AcquisitionStatus.side_effect = MockFunctionCallError("niScope_AcquisitionStatus") + mock_library.niScope_AcquisitionStatus.side_effect = MockFunctionCallError( + "niScope_AcquisitionStatus" + ) mock_library.niScope_AcquisitionStatus.return_value = 0 - mock_library.niScope_ActualMeasWfmSize.side_effect = MockFunctionCallError("niScope_ActualMeasWfmSize") + mock_library.niScope_ActualMeasWfmSize.side_effect = MockFunctionCallError( + "niScope_ActualMeasWfmSize" + ) mock_library.niScope_ActualMeasWfmSize.return_value = 0 - mock_library.niScope_ActualNumWfms.side_effect = MockFunctionCallError("niScope_ActualNumWfms") + mock_library.niScope_ActualNumWfms.side_effect = MockFunctionCallError( + "niScope_ActualNumWfms" + ) mock_library.niScope_ActualNumWfms.return_value = 0 - mock_library.niScope_AddWaveformProcessing.side_effect = MockFunctionCallError("niScope_AddWaveformProcessing") + mock_library.niScope_AddWaveformProcessing.side_effect = MockFunctionCallError( + "niScope_AddWaveformProcessing" + ) mock_library.niScope_AddWaveformProcessing.return_value = 0 - mock_library.niScope_AutoSetup.side_effect = MockFunctionCallError("niScope_AutoSetup") + mock_library.niScope_AutoSetup.side_effect = MockFunctionCallError( + "niScope_AutoSetup" + ) mock_library.niScope_AutoSetup.return_value = 0 - mock_library.niScope_CalFetchDate.side_effect = MockFunctionCallError("niScope_CalFetchDate") + mock_library.niScope_CalFetchDate.side_effect = MockFunctionCallError( + "niScope_CalFetchDate" + ) mock_library.niScope_CalFetchDate.return_value = 0 - mock_library.niScope_CalFetchTemperature.side_effect = MockFunctionCallError("niScope_CalFetchTemperature") + mock_library.niScope_CalFetchTemperature.side_effect = MockFunctionCallError( + "niScope_CalFetchTemperature" + ) mock_library.niScope_CalFetchTemperature.return_value = 0 - mock_library.niScope_CalSelfCalibrate.side_effect = MockFunctionCallError("niScope_CalSelfCalibrate") + mock_library.niScope_CalSelfCalibrate.side_effect = MockFunctionCallError( + "niScope_CalSelfCalibrate" + ) mock_library.niScope_CalSelfCalibrate.return_value = 0 - mock_library.niScope_ClearWaveformMeasurementStats.side_effect = MockFunctionCallError("niScope_ClearWaveformMeasurementStats") + mock_library.niScope_ClearWaveformMeasurementStats.side_effect = ( + MockFunctionCallError("niScope_ClearWaveformMeasurementStats") + ) mock_library.niScope_ClearWaveformMeasurementStats.return_value = 0 - mock_library.niScope_ClearWaveformProcessing.side_effect = MockFunctionCallError("niScope_ClearWaveformProcessing") + mock_library.niScope_ClearWaveformProcessing.side_effect = ( + MockFunctionCallError("niScope_ClearWaveformProcessing") + ) mock_library.niScope_ClearWaveformProcessing.return_value = 0 - mock_library.niScope_Commit.side_effect = MockFunctionCallError("niScope_Commit") + mock_library.niScope_Commit.side_effect = MockFunctionCallError( + "niScope_Commit" + ) mock_library.niScope_Commit.return_value = 0 - mock_library.niScope_ConfigureChanCharacteristics.side_effect = MockFunctionCallError("niScope_ConfigureChanCharacteristics") + mock_library.niScope_ConfigureChanCharacteristics.side_effect = ( + MockFunctionCallError("niScope_ConfigureChanCharacteristics") + ) mock_library.niScope_ConfigureChanCharacteristics.return_value = 0 - mock_library.niScope_ConfigureEqualizationFilterCoefficients.side_effect = MockFunctionCallError("niScope_ConfigureEqualizationFilterCoefficients") + mock_library.niScope_ConfigureEqualizationFilterCoefficients.side_effect = ( + MockFunctionCallError("niScope_ConfigureEqualizationFilterCoefficients") + ) mock_library.niScope_ConfigureEqualizationFilterCoefficients.return_value = 0 - mock_library.niScope_ConfigureHorizontalTiming.side_effect = MockFunctionCallError("niScope_ConfigureHorizontalTiming") + mock_library.niScope_ConfigureHorizontalTiming.side_effect = ( + MockFunctionCallError("niScope_ConfigureHorizontalTiming") + ) mock_library.niScope_ConfigureHorizontalTiming.return_value = 0 - mock_library.niScope_ConfigureRefLevels.side_effect = MockFunctionCallError("niScope_ConfigureRefLevels") + mock_library.niScope_ConfigureRefLevels.side_effect = MockFunctionCallError( + "niScope_ConfigureRefLevels" + ) mock_library.niScope_ConfigureRefLevels.return_value = 0 - mock_library.niScope_ConfigureTriggerDigital.side_effect = MockFunctionCallError("niScope_ConfigureTriggerDigital") + mock_library.niScope_ConfigureTriggerDigital.side_effect = ( + MockFunctionCallError("niScope_ConfigureTriggerDigital") + ) mock_library.niScope_ConfigureTriggerDigital.return_value = 0 - mock_library.niScope_ConfigureTriggerEdge.side_effect = MockFunctionCallError("niScope_ConfigureTriggerEdge") + mock_library.niScope_ConfigureTriggerEdge.side_effect = MockFunctionCallError( + "niScope_ConfigureTriggerEdge" + ) mock_library.niScope_ConfigureTriggerEdge.return_value = 0 - mock_library.niScope_ConfigureTriggerHysteresis.side_effect = MockFunctionCallError("niScope_ConfigureTriggerHysteresis") + mock_library.niScope_ConfigureTriggerHysteresis.side_effect = ( + MockFunctionCallError("niScope_ConfigureTriggerHysteresis") + ) mock_library.niScope_ConfigureTriggerHysteresis.return_value = 0 - mock_library.niScope_ConfigureTriggerImmediate.side_effect = MockFunctionCallError("niScope_ConfigureTriggerImmediate") + mock_library.niScope_ConfigureTriggerImmediate.side_effect = ( + MockFunctionCallError("niScope_ConfigureTriggerImmediate") + ) mock_library.niScope_ConfigureTriggerImmediate.return_value = 0 - mock_library.niScope_ConfigureTriggerSoftware.side_effect = MockFunctionCallError("niScope_ConfigureTriggerSoftware") + mock_library.niScope_ConfigureTriggerSoftware.side_effect = ( + MockFunctionCallError("niScope_ConfigureTriggerSoftware") + ) mock_library.niScope_ConfigureTriggerSoftware.return_value = 0 - mock_library.niScope_ConfigureTriggerVideo.side_effect = MockFunctionCallError("niScope_ConfigureTriggerVideo") + mock_library.niScope_ConfigureTriggerVideo.side_effect = MockFunctionCallError( + "niScope_ConfigureTriggerVideo" + ) mock_library.niScope_ConfigureTriggerVideo.return_value = 0 - mock_library.niScope_ConfigureTriggerWindow.side_effect = MockFunctionCallError("niScope_ConfigureTriggerWindow") + mock_library.niScope_ConfigureTriggerWindow.side_effect = MockFunctionCallError( + "niScope_ConfigureTriggerWindow" + ) mock_library.niScope_ConfigureTriggerWindow.return_value = 0 - mock_library.niScope_ConfigureVertical.side_effect = MockFunctionCallError("niScope_ConfigureVertical") + mock_library.niScope_ConfigureVertical.side_effect = MockFunctionCallError( + "niScope_ConfigureVertical" + ) mock_library.niScope_ConfigureVertical.return_value = 0 - mock_library.niScope_Disable.side_effect = MockFunctionCallError("niScope_Disable") + mock_library.niScope_Disable.side_effect = MockFunctionCallError( + "niScope_Disable" + ) mock_library.niScope_Disable.return_value = 0 - mock_library.niScope_ExportAttributeConfigurationBuffer.side_effect = MockFunctionCallError("niScope_ExportAttributeConfigurationBuffer") + mock_library.niScope_ExportAttributeConfigurationBuffer.side_effect = ( + MockFunctionCallError("niScope_ExportAttributeConfigurationBuffer") + ) mock_library.niScope_ExportAttributeConfigurationBuffer.return_value = 0 - mock_library.niScope_ExportAttributeConfigurationFile.side_effect = MockFunctionCallError("niScope_ExportAttributeConfigurationFile") + mock_library.niScope_ExportAttributeConfigurationFile.side_effect = ( + MockFunctionCallError("niScope_ExportAttributeConfigurationFile") + ) mock_library.niScope_ExportAttributeConfigurationFile.return_value = 0 mock_library.niScope_Fetch.side_effect = MockFunctionCallError("niScope_Fetch") mock_library.niScope_Fetch.return_value = 0 - mock_library.niScope_FetchArrayMeasurement.side_effect = MockFunctionCallError("niScope_FetchArrayMeasurement") + mock_library.niScope_FetchArrayMeasurement.side_effect = MockFunctionCallError( + "niScope_FetchArrayMeasurement" + ) mock_library.niScope_FetchArrayMeasurement.return_value = 0 - mock_library.niScope_FetchBinary16.side_effect = MockFunctionCallError("niScope_FetchBinary16") + mock_library.niScope_FetchBinary16.side_effect = MockFunctionCallError( + "niScope_FetchBinary16" + ) mock_library.niScope_FetchBinary16.return_value = 0 - mock_library.niScope_FetchBinary32.side_effect = MockFunctionCallError("niScope_FetchBinary32") + mock_library.niScope_FetchBinary32.side_effect = MockFunctionCallError( + "niScope_FetchBinary32" + ) mock_library.niScope_FetchBinary32.return_value = 0 - mock_library.niScope_FetchBinary8.side_effect = MockFunctionCallError("niScope_FetchBinary8") + mock_library.niScope_FetchBinary8.side_effect = MockFunctionCallError( + "niScope_FetchBinary8" + ) mock_library.niScope_FetchBinary8.return_value = 0 - mock_library.niScope_FetchMeasurementStats.side_effect = MockFunctionCallError("niScope_FetchMeasurementStats") + mock_library.niScope_FetchMeasurementStats.side_effect = MockFunctionCallError( + "niScope_FetchMeasurementStats" + ) mock_library.niScope_FetchMeasurementStats.return_value = 0 - mock_library.niScope_GetAttributeViBoolean.side_effect = MockFunctionCallError("niScope_GetAttributeViBoolean") + mock_library.niScope_GetAttributeViBoolean.side_effect = MockFunctionCallError( + "niScope_GetAttributeViBoolean" + ) mock_library.niScope_GetAttributeViBoolean.return_value = 0 - mock_library.niScope_GetAttributeViInt32.side_effect = MockFunctionCallError("niScope_GetAttributeViInt32") + mock_library.niScope_GetAttributeViInt32.side_effect = MockFunctionCallError( + "niScope_GetAttributeViInt32" + ) mock_library.niScope_GetAttributeViInt32.return_value = 0 - mock_library.niScope_GetAttributeViInt64.side_effect = MockFunctionCallError("niScope_GetAttributeViInt64") + mock_library.niScope_GetAttributeViInt64.side_effect = MockFunctionCallError( + "niScope_GetAttributeViInt64" + ) mock_library.niScope_GetAttributeViInt64.return_value = 0 - mock_library.niScope_GetAttributeViReal64.side_effect = MockFunctionCallError("niScope_GetAttributeViReal64") + mock_library.niScope_GetAttributeViReal64.side_effect = MockFunctionCallError( + "niScope_GetAttributeViReal64" + ) mock_library.niScope_GetAttributeViReal64.return_value = 0 - mock_library.niScope_GetAttributeViString.side_effect = MockFunctionCallError("niScope_GetAttributeViString") + mock_library.niScope_GetAttributeViString.side_effect = MockFunctionCallError( + "niScope_GetAttributeViString" + ) mock_library.niScope_GetAttributeViString.return_value = 0 - mock_library.niScope_GetEqualizationFilterCoefficients.side_effect = MockFunctionCallError("niScope_GetEqualizationFilterCoefficients") + mock_library.niScope_GetEqualizationFilterCoefficients.side_effect = ( + MockFunctionCallError("niScope_GetEqualizationFilterCoefficients") + ) mock_library.niScope_GetEqualizationFilterCoefficients.return_value = 0 - mock_library.niScope_GetError.side_effect = MockFunctionCallError("niScope_GetError") + mock_library.niScope_GetError.side_effect = MockFunctionCallError( + "niScope_GetError" + ) mock_library.niScope_GetError.return_value = 0 - mock_library.niScope_ImportAttributeConfigurationBuffer.side_effect = MockFunctionCallError("niScope_ImportAttributeConfigurationBuffer") + mock_library.niScope_ImportAttributeConfigurationBuffer.side_effect = ( + MockFunctionCallError("niScope_ImportAttributeConfigurationBuffer") + ) mock_library.niScope_ImportAttributeConfigurationBuffer.return_value = 0 - mock_library.niScope_ImportAttributeConfigurationFile.side_effect = MockFunctionCallError("niScope_ImportAttributeConfigurationFile") + mock_library.niScope_ImportAttributeConfigurationFile.side_effect = ( + MockFunctionCallError("niScope_ImportAttributeConfigurationFile") + ) mock_library.niScope_ImportAttributeConfigurationFile.return_value = 0 - mock_library.niScope_InitWithOptions.side_effect = MockFunctionCallError("niScope_InitWithOptions") + mock_library.niScope_InitWithOptions.side_effect = MockFunctionCallError( + "niScope_InitWithOptions" + ) mock_library.niScope_InitWithOptions.return_value = 0 - mock_library.niScope_InitiateAcquisition.side_effect = MockFunctionCallError("niScope_InitiateAcquisition") + mock_library.niScope_InitiateAcquisition.side_effect = MockFunctionCallError( + "niScope_InitiateAcquisition" + ) mock_library.niScope_InitiateAcquisition.return_value = 0 - mock_library.niScope_LockSession.side_effect = MockFunctionCallError("niScope_LockSession") + mock_library.niScope_LockSession.side_effect = MockFunctionCallError( + "niScope_LockSession" + ) mock_library.niScope_LockSession.return_value = 0 - mock_library.niScope_ProbeCompensationSignalStart.side_effect = MockFunctionCallError("niScope_ProbeCompensationSignalStart") + mock_library.niScope_ProbeCompensationSignalStart.side_effect = ( + MockFunctionCallError("niScope_ProbeCompensationSignalStart") + ) mock_library.niScope_ProbeCompensationSignalStart.return_value = 0 - mock_library.niScope_ProbeCompensationSignalStop.side_effect = MockFunctionCallError("niScope_ProbeCompensationSignalStop") + mock_library.niScope_ProbeCompensationSignalStop.side_effect = ( + MockFunctionCallError("niScope_ProbeCompensationSignalStop") + ) mock_library.niScope_ProbeCompensationSignalStop.return_value = 0 mock_library.niScope_Read.side_effect = MockFunctionCallError("niScope_Read") mock_library.niScope_Read.return_value = 0 - mock_library.niScope_ResetDevice.side_effect = MockFunctionCallError("niScope_ResetDevice") + mock_library.niScope_ResetDevice.side_effect = MockFunctionCallError( + "niScope_ResetDevice" + ) mock_library.niScope_ResetDevice.return_value = 0 - mock_library.niScope_ResetWithDefaults.side_effect = MockFunctionCallError("niScope_ResetWithDefaults") + mock_library.niScope_ResetWithDefaults.side_effect = MockFunctionCallError( + "niScope_ResetWithDefaults" + ) mock_library.niScope_ResetWithDefaults.return_value = 0 - mock_library.niScope_SendSoftwareTriggerEdge.side_effect = MockFunctionCallError("niScope_SendSoftwareTriggerEdge") + mock_library.niScope_SendSoftwareTriggerEdge.side_effect = ( + MockFunctionCallError("niScope_SendSoftwareTriggerEdge") + ) mock_library.niScope_SendSoftwareTriggerEdge.return_value = 0 - mock_library.niScope_SetAttributeViBoolean.side_effect = MockFunctionCallError("niScope_SetAttributeViBoolean") + mock_library.niScope_SetAttributeViBoolean.side_effect = MockFunctionCallError( + "niScope_SetAttributeViBoolean" + ) mock_library.niScope_SetAttributeViBoolean.return_value = 0 - mock_library.niScope_SetAttributeViInt32.side_effect = MockFunctionCallError("niScope_SetAttributeViInt32") + mock_library.niScope_SetAttributeViInt32.side_effect = MockFunctionCallError( + "niScope_SetAttributeViInt32" + ) mock_library.niScope_SetAttributeViInt32.return_value = 0 - mock_library.niScope_SetAttributeViInt64.side_effect = MockFunctionCallError("niScope_SetAttributeViInt64") + mock_library.niScope_SetAttributeViInt64.side_effect = MockFunctionCallError( + "niScope_SetAttributeViInt64" + ) mock_library.niScope_SetAttributeViInt64.return_value = 0 - mock_library.niScope_SetAttributeViReal64.side_effect = MockFunctionCallError("niScope_SetAttributeViReal64") + mock_library.niScope_SetAttributeViReal64.side_effect = MockFunctionCallError( + "niScope_SetAttributeViReal64" + ) mock_library.niScope_SetAttributeViReal64.return_value = 0 - mock_library.niScope_SetAttributeViString.side_effect = MockFunctionCallError("niScope_SetAttributeViString") + mock_library.niScope_SetAttributeViString.side_effect = MockFunctionCallError( + "niScope_SetAttributeViString" + ) mock_library.niScope_SetAttributeViString.return_value = 0 - mock_library.niScope_UnlockSession.side_effect = MockFunctionCallError("niScope_UnlockSession") + mock_library.niScope_UnlockSession.side_effect = MockFunctionCallError( + "niScope_UnlockSession" + ) mock_library.niScope_UnlockSession.return_value = 0 mock_library.niScope_close.side_effect = MockFunctionCallError("niScope_close") mock_library.niScope_close.return_value = 0 - mock_library.niScope_error_message.side_effect = MockFunctionCallError("niScope_error_message") + mock_library.niScope_error_message.side_effect = MockFunctionCallError( + "niScope_error_message" + ) mock_library.niScope_error_message.return_value = 0 mock_library.niScope_reset.side_effect = MockFunctionCallError("niScope_reset") mock_library.niScope_reset.return_value = 0 - mock_library.niScope_self_test.side_effect = MockFunctionCallError("niScope_self_test") + mock_library.niScope_self_test.side_effect = MockFunctionCallError( + "niScope_self_test" + ) mock_library.niScope_self_test.return_value = 0 diff --git a/generated/niscope/niscope/unit_tests/test_niscope.py b/generated/niscope/niscope/unit_tests/test_niscope.py index a9c5902b8..5b6f2dbd1 100644 --- a/generated/niscope/niscope/unit_tests/test_niscope.py +++ b/generated/niscope/niscope/unit_tests/test_niscope.py @@ -8,13 +8,13 @@ def test_populate_samples_info(): waveform_infos.append(niscope.waveform_info.WaveformInfo()) waveform_infos[-1]._actual_samples = i - sample_data = array.array('d', [0, 1, 2, 3, 4, 5, 6, 7, 8]) + sample_data = array.array("d", [0, 1, 2, 3, 4, 5, 6, 7, 8]) niscope.waveform_info._populate_samples_info(waveform_infos, sample_data, 3) expected = [ - array.array('d', [0]), - array.array('d', [3, 4]), - array.array('d', [6, 7, 8]) + array.array("d", [0]), + array.array("d", [3, 4]), + array.array("d", [6, 7, 8]), ] for i in range(len(waveform_infos)): assert waveform_infos[i]._actual_samples is None @@ -28,7 +28,9 @@ def test_populate_channel_and_record_info(): channels = ["Dev1/4", "Dev2/2"] records = [0, 1, 2] - niscope.waveform_info._populate_channel_and_record_info(waveform_infos, channels, records) + niscope.waveform_info._populate_channel_and_record_info( + waveform_infos, channels, records + ) expected_channels = ["Dev1/4", "Dev2/2"] * len(records) expected_records = [0, 0, 1, 1, 2, 2] diff --git a/generated/niscope/niscope/waveform_info.py b/generated/niscope/niscope/waveform_info.py index 00cd610da..71d1be7b9 100644 --- a/generated/niscope/niscope/waveform_info.py +++ b/generated/niscope/niscope/waveform_info.py @@ -9,19 +9,28 @@ class struct_niScope_wfmInfo(ctypes.Structure): # noqa N801 _pack_ = 8 _fields_ = [ - ('absolute_initial_x', niscope._visatype.ViReal64), - ('relative_initial_x', niscope._visatype.ViReal64), - ('x_increment', niscope._visatype.ViReal64), - ('actual_samples', niscope._visatype.ViInt32), - ('offset', niscope._visatype.ViReal64), - ('gain', niscope._visatype.ViReal64), - ('reserved1', niscope._visatype.ViReal64), - ('reserved2', niscope._visatype.ViReal64), + ("absolute_initial_x", niscope._visatype.ViReal64), + ("relative_initial_x", niscope._visatype.ViReal64), + ("x_increment", niscope._visatype.ViReal64), + ("actual_samples", niscope._visatype.ViInt32), + ("offset", niscope._visatype.ViReal64), + ("gain", niscope._visatype.ViReal64), + ("reserved1", niscope._visatype.ViReal64), + ("reserved2", niscope._visatype.ViReal64), ] - def __init__(self, data=None, absolute_initial_x=0.0, relative_initial_x=0.0, - x_increment=0.0, actual_samples=0, offset=0.0, gain=0.0, - reserved1=0.0, reserved2=0.0): + def __init__( + self, + data=None, + absolute_initial_x=0.0, + relative_initial_x=0.0, + x_increment=0.0, + actual_samples=0, + offset=0.0, + gain=0.0, + reserved1=0.0, + reserved2=0.0, + ): super(ctypes.Structure, self).__init__() if data is not None: self.absolute_initial_x = data.absolute_initial_x @@ -44,9 +53,17 @@ def __init__(self, data=None, absolute_initial_x=0.0, relative_initial_x=0.0, class WaveformInfo(object): - def __init__(self, data=None, absolute_initial_x=0.0, relative_initial_x=0.0, - x_increment=0.0, offset=0.0, gain=0.0, - reserved1=0.0, reserved2=0.0): + def __init__( + self, + data=None, + absolute_initial_x=0.0, + relative_initial_x=0.0, + x_increment=0.0, + offset=0.0, + gain=0.0, + reserved1=0.0, + reserved2=0.0, + ): if data is not None: self.absolute_initial_x = data.absolute_initial_x self.relative_initial_x = data.relative_initial_x @@ -75,44 +92,60 @@ def __init__(self, data=None, absolute_initial_x=0.0, relative_initial_x=0.0, def __repr__(self): parameter_list = [ - 'absolute_initial_x={}'.format(self.absolute_initial_x), - 'relative_initial_x={}'.format(self.relative_initial_x), - 'x_increment={}'.format(self.x_increment), - 'offset={}'.format(self.offset), - 'gain={}'.format(self.gain) + "absolute_initial_x={}".format(self.absolute_initial_x), + "relative_initial_x={}".format(self.relative_initial_x), + "x_increment={}".format(self.x_increment), + "offset={}".format(self.offset), + "gain={}".format(self.gain), ] - return '{0}({1})'.format(self.__class__.__name__, ', '.join(parameter_list)) + return "{0}({1})".format(self.__class__.__name__, ", ".join(parameter_list)) def __str__(self): # different format lines - row_format_g = '{:<20}: {:,.6g}\n' - row_format_d = '{:<20}: {:,}\n' - row_format_s = '{:<20}: {:}\n' - - string_representation = '' - if self.channel is not None: # We explicitly look for not None to differentiate from empty string - string_representation += row_format_s.format('Channel', self.channel) - if self.record is not None: # We explicitly look for not None to differentiate from 0 - string_representation += row_format_d.format('Record', self.record) - - string_representation += row_format_g.format('Absolute X0', self.absolute_initial_x) - string_representation += row_format_g.format('Relative X0', self.relative_initial_x) - string_representation += row_format_g.format('dt', self.x_increment) - string_representation += row_format_g.format('Offset', self.offset) - string_representation += row_format_g.format('Gain', self.gain) - if self.samples is not None: # We explicitly look for not None to differentiate from empty array - string_representation += row_format_g.format('Waveform Length', len(self.samples)) + row_format_g = "{:<20}: {:,.6g}\n" + row_format_d = "{:<20}: {:,}\n" + row_format_s = "{:<20}: {:}\n" + + string_representation = "" + if ( + self.channel is not None + ): # We explicitly look for not None to differentiate from empty string + string_representation += row_format_s.format("Channel", self.channel) + if ( + self.record is not None + ): # We explicitly look for not None to differentiate from 0 + string_representation += row_format_d.format("Record", self.record) + + string_representation += row_format_g.format( + "Absolute X0", self.absolute_initial_x + ) + string_representation += row_format_g.format( + "Relative X0", self.relative_initial_x + ) + string_representation += row_format_g.format("dt", self.x_increment) + string_representation += row_format_g.format("Offset", self.offset) + string_representation += row_format_g.format("Gain", self.gain) + if ( + self.samples is not None + ): # We explicitly look for not None to differentiate from empty array + string_representation += row_format_g.format( + "Waveform Length", len(self.samples) + ) # Put possible private variable last - if self._actual_samples is not None: # We explicitly look for not None to differentiate from 0 - string_representation += row_format_d.format('_actual samples', self._actual_samples) + if ( + self._actual_samples is not None + ): # We explicitly look for not None to differentiate from 0 + string_representation += row_format_d.format( + "_actual samples", self._actual_samples + ) return string_representation def _populate_samples_info(waveform_infos, sample_data, num_samples_per_waveform): - '''Chunk up flat array of sample_data and copy each chunk into individual WaveformInfo instance + """Chunk up flat array of sample_data and copy each chunk into individual WaveformInfo instance Args: waveform_infos (Iterable of WaveformInfo): WaveformInfo class instances @@ -120,7 +153,7 @@ def _populate_samples_info(waveform_infos, sample_data, num_samples_per_waveform sample_data (Iterable of float): Waveform sample data num_samples_per_waveform (int): Number of samples belonging to each waveform - ''' + """ for i in range(len(waveform_infos)): start = i * num_samples_per_waveform end = start + waveform_infos[i]._actual_samples @@ -131,7 +164,7 @@ def _populate_samples_info(waveform_infos, sample_data, num_samples_per_waveform def _populate_channel_and_record_info(waveform_infos, channels, records): - '''Populate the channel and record attributes of WaveformInfo instances + """Populate the channel and record attributes of WaveformInfo instances Args: waveform_infos (Iterable of WaveformInfo): WaveformInfo class instances @@ -139,7 +172,7 @@ def _populate_channel_and_record_info(waveform_infos, channels, records): channels (Iterable of str): Channel names records (Iterable of int): Record numbers - ''' + """ i = 0 for record in records: for channel in channels: diff --git a/generated/niscope/setup.py b/generated/niscope/setup.py index 4af2e3aa7..8a5f96209 100644 --- a/generated/niscope/setup.py +++ b/generated/niscope/setup.py @@ -15,42 +15,45 @@ def finalize_options(self): def run_tests(self): import pytest + pytest.main(self.test_args) -pypi_name = 'niscope' +pypi_name = "niscope" def read_contents(file_to_read): - with open(file_to_read, 'r') as f: + with open(file_to_read, "r") as f: return f.read() setup( name=pypi_name, zip_safe=True, - version='1.4.2.dev0', - description='NI-SCOPE Python API', - long_description=read_contents('README.rst'), - long_description_content_type='text/x-rst', - author='NI', + version="1.4.2.dev0", + description="NI-SCOPE Python API", + long_description=read_contents("README.rst"), + long_description_content_type="text/x-rst", + author="NI", author_email="opensource@ni.com", url="https://github.com/ni/nimi-python", maintainer="NI", maintainer_email="opensource@ni.com", - keywords=['niscope'], - license='MIT', + keywords=["niscope"], + license="MIT", include_package_data=True, - packages=['niscope'], + packages=["niscope"], install_requires=[ 'enum34;python_version<"3.4"', 'singledispatch;python_version<"3.4"', - 'hightime>=0.2.0', - 'nitclk', + "hightime>=0.2.0", + "nitclk", + ], + setup_requires=[ + "pytest-runner", ], - setup_requires=['pytest-runner', ], - tests_require=['pytest'], - test_suite='tests', + tests_require=["pytest"], + test_suite="tests", classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -65,8 +68,8 @@ def read_contents(file_to_read): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", - "Topic :: System :: Hardware :: Hardware Drivers" + "Topic :: System :: Hardware :: Hardware Drivers", ], - cmdclass={'test': PyTest}, - package_data={pypi_name: ['VERSION']}, + cmdclass={"test": PyTest}, + package_data={pypi_name: ["VERSION"]}, ) diff --git a/generated/nise/nise/__init__.py b/generated/nise/nise/__init__.py index 982f424d6..02110c498 100644 --- a/generated/nise/nise/__init__.py +++ b/generated/nise/nise/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = '1.4.2.dev0' +__version__ = "1.4.2.dev0" from nise.enums import * # noqa: F403,F401,H303 from nise.errors import DriverWarning # noqa: F401 @@ -11,12 +11,12 @@ def get_diagnostic_information(): - '''Get diagnostic information about the system state that is suitable for printing or logging + """Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - ''' + """ import os import pkg_resources import platform @@ -24,73 +24,80 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return (struct.calcsize("P") == 8) + return struct.calcsize("P") == 8 def is_os_64bit(): - return platform.machine().endswith('64') + return platform.machine().endswith("64") def is_venv(): - return 'VIRTUAL_ENV' in os.environ + return "VIRTUAL_ENV" in os.environ info = {} - info['os'] = {} - info['python'] = {} - info['driver'] = {} - info['module'] = {} - if platform.system() == 'Windows': + info["os"] = {} + info["python"] = {} + info["driver"] = {} + info["module"] = {} + if platform.system() == "Windows": try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = 'Windows' + os_name = "Windows" try: - driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\Switch Executive\CurrentVersion") + driver_version_key = winreg.OpenKey( + winreg.HKEY_LOCAL_MACHINE, + r"SOFTWARE\National Instruments\Switch Executive\CurrentVersion", + ) driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = 'Unknown' - elif platform.system() == 'Linux': - os_name = 'Linux' - driver_version = 'Unknown' + driver_version = "Unknown" + elif platform.system() == "Linux": + os_name = "Linux" + driver_version = "Unknown" else: - raise SystemError('Unsupported platform: {}'.format(platform.system())) + raise SystemError("Unsupported platform: {}".format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] - - info['os']['name'] = os_name - info['os']['version'] = platform.version() - info['os']['bits'] = '64' if is_os_64bit() else '32' - info['driver']['name'] = "NI Switch Executive" - info['driver']['version'] = driver_version - info['module']['name'] = 'nise' - info['module']['version'] = "1.4.2.dev0" - info['python']['version'] = sys.version - info['python']['bits'] = '64' if is_python_64bit() else '32' - info['python']['is_venv'] = is_venv() - info['python']['packages'] = installed_packages_list + installed_packages_list = [ + { + "name": i.key, + "version": i.version, + } + for i in installed_packages + ] + + info["os"]["name"] = os_name + info["os"]["version"] = platform.version() + info["os"]["bits"] = "64" if is_os_64bit() else "32" + info["driver"]["name"] = "NI Switch Executive" + info["driver"]["version"] = driver_version + info["module"]["name"] = "nise" + info["module"]["version"] = "1.4.2.dev0" + info["python"]["version"] = sys.version + info["python"]["bits"] = "64" if is_python_64bit() else "32" + info["python"]["is_venv"] = is_venv() + info["python"]["packages"] = installed_packages_list return info def print_diagnostic_information(): - '''Print diagnostic information in a format suitable for issue report + """Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - ''' + """ info = get_diagnostic_information() - row_format = ' {:<10} {}' - for type in ['OS', 'Driver', 'Module', 'Python']: + row_format = " {:<10} {}" + for type in ["OS", "Driver", "Module", "Python"]: typename = type.lower() - print(type + ':') + print(type + ":") for item in info[typename]: - if item != 'packages': - print(row_format.format(item.title() + ':', info[typename][item])) - print(' Installed Packages:') - for p in info['python']['packages']: - print((' ' * 8) + p['name'] + '==' + p['version']) + if item != "packages": + print(row_format.format(item.title() + ":", info[typename][item])) + print(" Installed Packages:") + for p in info["python"]["packages"]: + print((" " * 8) + p["name"] + "==" + p["version"]) return info - - diff --git a/generated/nise/nise/_converters.py b/generated/nise/nise/_converters.py index 63de67487..577411557 100644 --- a/generated/nise/nise/_converters.py +++ b/generated/nise/nise/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - '''Base version that should not be called + """Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,36 +40,38 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - ''' - raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + """ + raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - '''Integer version''' + """Integer version""" return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - '''String version (this is the most complex) + """String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - ''' + """ # First we deal with a list - rep_cap_list = repeated_capability.split(',') + rep_cap_list = repeated_capability.split(",") if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, '').replace(':', '-') - rc = r.split('-') + r = repeated_capability.strip().replace(prefix, "").replace(":", "-") + rc = r.split("-") if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + raise errors.InvalidRepeatedCapabilityError( + "Multiple '-' or ':'", repeated_capability + ) try: start = int(rc[0]) end = int(rc[1]) @@ -85,7 +87,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, '').strip()] + return [repeated_capability.replace(prefix, "").strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -94,7 +96,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - '''Iterable version - can handle lists, ranges, and tuples''' + """Iterable version - can handle lists, ranges, and tuples""" rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -103,16 +105,22 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - '''slice version''' + """slice version""" + def ifnone(a, b): return b if a is None else a + # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) + rng = range( + ifnone(repeated_capability.start, 0), + repeated_capability.stop, + ifnone(repeated_capability.step, 1), + ) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=''): - '''Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=""): + """Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -120,15 +128,17 @@ def convert_repeated_capabilities(repeated_capability, prefix=''): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - ''' + """ # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] + return [ + prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) + ] def convert_repeated_capabilities_without_prefix(repeated_capability): - '''Convert a repeated capabilities object, without any prefix, to a comma delimited list + """Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -144,8 +154,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - ''' - return ','.join(convert_repeated_capabilities(repeated_capability, '')) + """ + return ",".join(convert_repeated_capabilities(repeated_capability, "")) def _convert_timedelta(value, library_type, scaling): @@ -158,7 +168,14 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: + if library_type in [ + _visatype.ViInt64, + _visatype.ViInt32, + _visatype.ViUInt32, + _visatype.ViInt16, + _visatype.ViUInt16, + _visatype.ViInt8, + ]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -195,34 +212,36 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - 'rangecheck': 'RangeCheck', - 'queryinstrstatus': 'QueryInstrStatus', - 'cache': 'Cache', - 'simulate': 'Simulate', - 'recordcoercions': 'RecordCoercions', - 'interchangecheck': 'InterchangeCheck', - 'driversetup': 'DriverSetup', - 'range_check': 'RangeCheck', - 'query_instr_status': 'QueryInstrStatus', - 'record_coercions': 'RecordCoercions', - 'interchange_check': 'InterchangeCheck', - 'driver_setup': 'DriverSetup', + "rangecheck": "RangeCheck", + "queryinstrstatus": "QueryInstrStatus", + "cache": "Cache", + "simulate": "Simulate", + "recordcoercions": "RecordCoercions", + "interchangecheck": "InterchangeCheck", + "driversetup": "DriverSetup", + "range_check": "RangeCheck", + "query_instr_status": "QueryInstrStatus", + "record_coercions": "RecordCoercions", + "interchange_check": "InterchangeCheck", + "driver_setup": "DriverSetup", } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': - value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') - elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': + if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": + value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") + elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": if not isinstance(values[k], dict): - raise TypeError('DriverSetup must be a dictionary') - value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) + raise TypeError("DriverSetup must be a dictionary") + value = "DriverSetup=" + ( + ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) + ) else: - value = k + ('=1' if values[k] is True else '=0') + value = k + ("=1" if values[k] is True else "=0") init_with_options.append(value) - init_with_options_string = ','.join(init_with_options) + init_with_options_string = ",".join(init_with_options) return init_with_options_string @@ -251,11 +270,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(',')] + return [x.strip() for x in comma_separated_string.split(",")] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -267,11 +286,17 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - ''' - chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) - repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] + """ + chained_repeated_capability_items = convert_comma_separated_string_to_list( + chained_repeated_capability + ) + repeated_capability_lists = [ + [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) + ] for item in chained_repeated_capability_items: - repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] - return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] - - + repeated_capability_lists = [ + x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) + ] + return [ + ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists + ] diff --git a/generated/nise/nise/_library.py b/generated/nise/nise/_library.py index 05af687c9..b02023386 100644 --- a/generated/nise/nise/_library.py +++ b/generated/nise/nise/_library.py @@ -9,11 +9,11 @@ class Library(object): - '''Library + """Library Wrapper around driver library. Class will setup the correct ctypes information for every function on first call. - ''' + """ def __init__(self, ctypes_library): self._func_lock = threading.Lock() @@ -43,103 +43,210 @@ def _get_library_function(self, name): def niSE_CloseSession(self, vi): # noqa: N802 with self._func_lock: if self.niSE_CloseSession_cfunc is None: - self.niSE_CloseSession_cfunc = self._get_library_function('niSE_CloseSession') + self.niSE_CloseSession_cfunc = self._get_library_function( + "niSE_CloseSession" + ) self.niSE_CloseSession_cfunc.argtypes = [ViSession] # noqa: F405 self.niSE_CloseSession_cfunc.restype = ViStatus # noqa: F405 return self.niSE_CloseSession_cfunc(vi) - def niSE_Connect(self, vi, connect_spec, multiconnect_mode, wait_for_debounce): # noqa: N802 + def niSE_Connect( + self, vi, connect_spec, multiconnect_mode, wait_for_debounce + ): # noqa: N802 with self._func_lock: if self.niSE_Connect_cfunc is None: - self.niSE_Connect_cfunc = self._get_library_function('niSE_Connect') - self.niSE_Connect_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViBoolean] # noqa: F405 + self.niSE_Connect_cfunc = self._get_library_function("niSE_Connect") + self.niSE_Connect_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ViBoolean, + ] # noqa: F405 self.niSE_Connect_cfunc.restype = ViStatus # noqa: F405 - return self.niSE_Connect_cfunc(vi, connect_spec, multiconnect_mode, wait_for_debounce) - - def niSE_ConnectAndDisconnect(self, vi, connect_spec, disconnect_spec, multiconnect_mode, operation_order, wait_for_debounce): # noqa: N802 + return self.niSE_Connect_cfunc( + vi, connect_spec, multiconnect_mode, wait_for_debounce + ) + + def niSE_ConnectAndDisconnect( + self, + vi, + connect_spec, + disconnect_spec, + multiconnect_mode, + operation_order, + wait_for_debounce, + ): # noqa: N802 with self._func_lock: if self.niSE_ConnectAndDisconnect_cfunc is None: - self.niSE_ConnectAndDisconnect_cfunc = self._get_library_function('niSE_ConnectAndDisconnect') - self.niSE_ConnectAndDisconnect_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ViInt32, ViBoolean] # noqa: F405 + self.niSE_ConnectAndDisconnect_cfunc = self._get_library_function( + "niSE_ConnectAndDisconnect" + ) + self.niSE_ConnectAndDisconnect_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViInt32, + ViInt32, + ViBoolean, + ] # noqa: F405 self.niSE_ConnectAndDisconnect_cfunc.restype = ViStatus # noqa: F405 - return self.niSE_ConnectAndDisconnect_cfunc(vi, connect_spec, disconnect_spec, multiconnect_mode, operation_order, wait_for_debounce) + return self.niSE_ConnectAndDisconnect_cfunc( + vi, + connect_spec, + disconnect_spec, + multiconnect_mode, + operation_order, + wait_for_debounce, + ) def niSE_Disconnect(self, vi, disconnect_spec): # noqa: N802 with self._func_lock: if self.niSE_Disconnect_cfunc is None: - self.niSE_Disconnect_cfunc = self._get_library_function('niSE_Disconnect') - self.niSE_Disconnect_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niSE_Disconnect_cfunc = self._get_library_function( + "niSE_Disconnect" + ) + self.niSE_Disconnect_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niSE_Disconnect_cfunc.restype = ViStatus # noqa: F405 return self.niSE_Disconnect_cfunc(vi, disconnect_spec) def niSE_DisconnectAll(self, vi): # noqa: N802 with self._func_lock: if self.niSE_DisconnectAll_cfunc is None: - self.niSE_DisconnectAll_cfunc = self._get_library_function('niSE_DisconnectAll') + self.niSE_DisconnectAll_cfunc = self._get_library_function( + "niSE_DisconnectAll" + ) self.niSE_DisconnectAll_cfunc.argtypes = [ViSession] # noqa: F405 self.niSE_DisconnectAll_cfunc.restype = ViStatus # noqa: F405 return self.niSE_DisconnectAll_cfunc(vi) - def niSE_ExpandRouteSpec(self, vi, route_spec, expand_action, expanded_route_spec, expanded_route_spec_size): # noqa: N802 + def niSE_ExpandRouteSpec( + self, + vi, + route_spec, + expand_action, + expanded_route_spec, + expanded_route_spec_size, + ): # noqa: N802 with self._func_lock: if self.niSE_ExpandRouteSpec_cfunc is None: - self.niSE_ExpandRouteSpec_cfunc = self._get_library_function('niSE_ExpandRouteSpec') - self.niSE_ExpandRouteSpec_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niSE_ExpandRouteSpec_cfunc = self._get_library_function( + "niSE_ExpandRouteSpec" + ) + self.niSE_ExpandRouteSpec_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niSE_ExpandRouteSpec_cfunc.restype = ViStatus # noqa: F405 - return self.niSE_ExpandRouteSpec_cfunc(vi, route_spec, expand_action, expanded_route_spec, expanded_route_spec_size) + return self.niSE_ExpandRouteSpec_cfunc( + vi, route_spec, expand_action, expanded_route_spec, expanded_route_spec_size + ) - def niSE_FindRoute(self, vi, channel1, channel2, route_spec, route_spec_size, path_capability): # noqa: N802 + def niSE_FindRoute( + self, vi, channel1, channel2, route_spec, route_spec_size, path_capability + ): # noqa: N802 with self._func_lock: if self.niSE_FindRoute_cfunc is None: - self.niSE_FindRoute_cfunc = self._get_library_function('niSE_FindRoute') - self.niSE_FindRoute_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niSE_FindRoute_cfunc = self._get_library_function("niSE_FindRoute") + self.niSE_FindRoute_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niSE_FindRoute_cfunc.restype = ViStatus # noqa: F405 - return self.niSE_FindRoute_cfunc(vi, channel1, channel2, route_spec, route_spec_size, path_capability) + return self.niSE_FindRoute_cfunc( + vi, channel1, channel2, route_spec, route_spec_size, path_capability + ) def niSE_GetAllConnections(self, vi, route_spec, route_spec_size): # noqa: N802 with self._func_lock: if self.niSE_GetAllConnections_cfunc is None: - self.niSE_GetAllConnections_cfunc = self._get_library_function('niSE_GetAllConnections') - self.niSE_GetAllConnections_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niSE_GetAllConnections_cfunc = self._get_library_function( + "niSE_GetAllConnections" + ) + self.niSE_GetAllConnections_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niSE_GetAllConnections_cfunc.restype = ViStatus # noqa: F405 return self.niSE_GetAllConnections_cfunc(vi, route_spec, route_spec_size) - def niSE_GetError(self, vi, error_number, error_description, error_description_size): # noqa: N802 + def niSE_GetError( + self, vi, error_number, error_description, error_description_size + ): # noqa: N802 with self._func_lock: if self.niSE_GetError_cfunc is None: - self.niSE_GetError_cfunc = self._get_library_function('niSE_GetError') - self.niSE_GetError_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32), ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niSE_GetError_cfunc = self._get_library_function("niSE_GetError") + self.niSE_GetError_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt32), + ctypes.POINTER(ViChar), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niSE_GetError_cfunc.restype = ViStatus # noqa: F405 - return self.niSE_GetError_cfunc(vi, error_number, error_description, error_description_size) + return self.niSE_GetError_cfunc( + vi, error_number, error_description, error_description_size + ) def niSE_IsConnected(self, vi, route_spec, is_connected): # noqa: N802 with self._func_lock: if self.niSE_IsConnected_cfunc is None: - self.niSE_IsConnected_cfunc = self._get_library_function('niSE_IsConnected') - self.niSE_IsConnected_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niSE_IsConnected_cfunc = self._get_library_function( + "niSE_IsConnected" + ) + self.niSE_IsConnected_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niSE_IsConnected_cfunc.restype = ViStatus # noqa: F405 return self.niSE_IsConnected_cfunc(vi, route_spec, is_connected) def niSE_IsDebounced(self, vi, is_debounced): # noqa: N802 with self._func_lock: if self.niSE_IsDebounced_cfunc is None: - self.niSE_IsDebounced_cfunc = self._get_library_function('niSE_IsDebounced') - self.niSE_IsDebounced_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niSE_IsDebounced_cfunc = self._get_library_function( + "niSE_IsDebounced" + ) + self.niSE_IsDebounced_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niSE_IsDebounced_cfunc.restype = ViStatus # noqa: F405 return self.niSE_IsDebounced_cfunc(vi, is_debounced) def niSE_OpenSession(self, virtual_device_name, option_string, vi): # noqa: N802 with self._func_lock: if self.niSE_OpenSession_cfunc is None: - self.niSE_OpenSession_cfunc = self._get_library_function('niSE_OpenSession') - self.niSE_OpenSession_cfunc.argtypes = [ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ctypes.POINTER(ViSession)] # noqa: F405 + self.niSE_OpenSession_cfunc = self._get_library_function( + "niSE_OpenSession" + ) + self.niSE_OpenSession_cfunc.argtypes = [ + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ctypes.POINTER(ViSession), + ] # noqa: F405 self.niSE_OpenSession_cfunc.restype = ViStatus # noqa: F405 return self.niSE_OpenSession_cfunc(virtual_device_name, option_string, vi) def niSE_WaitForDebounce(self, vi, maximum_time_ms): # noqa: N802 with self._func_lock: if self.niSE_WaitForDebounce_cfunc is None: - self.niSE_WaitForDebounce_cfunc = self._get_library_function('niSE_WaitForDebounce') - self.niSE_WaitForDebounce_cfunc.argtypes = [ViSession, ViInt32] # noqa: F405 + self.niSE_WaitForDebounce_cfunc = self._get_library_function( + "niSE_WaitForDebounce" + ) + self.niSE_WaitForDebounce_cfunc.argtypes = [ + ViSession, + ViInt32, + ] # noqa: F405 self.niSE_WaitForDebounce_cfunc.restype = ViStatus # noqa: F405 return self.niSE_WaitForDebounce_cfunc(vi, maximum_time_ms) diff --git a/generated/nise/nise/_library_singleton.py b/generated/nise/nise/_library_singleton.py index d96bcb73a..84c82342a 100644 --- a/generated/nise/nise/_library_singleton.py +++ b/generated/nise/nise/_library_singleton.py @@ -12,30 +12,36 @@ _instance = None _instance_lock = threading.Lock() -_library_info = {'Linux': {'64bit': {'name': 'nise', 'type': 'cdll'}}, - 'Windows': {'32bit': {'name': 'nise.dll', 'type': 'windll'}, - '64bit': {'name': 'nise.dll', 'type': 'cdll'}}} +_library_info = { + "Linux": {"64bit": {"name": "nise", "type": "cdll"}}, + "Windows": { + "32bit": {"name": "nise.dll", "type": "windll"}, + "64bit": {"name": "nise.dll", "type": "cdll"}, + }, +} def _get_library_name(): try: - return ctypes.util.find_library(_library_info[platform.system()][platform.architecture()[0]]['name']) # We find and return full path to the DLL + return ctypes.util.find_library( + _library_info[platform.system()][platform.architecture()[0]]["name"] + ) # We find and return full path to the DLL except KeyError: raise errors.UnsupportedConfigurationError def _get_library_type(): try: - return _library_info[platform.system()][platform.architecture()[0]]['type'] + return _library_info[platform.system()][platform.architecture()[0]]["type"] except KeyError: raise errors.UnsupportedConfigurationError def get(): - '''get + """get Returns the library.Library singleton for nise. - ''' + """ global _instance global _instance_lock @@ -43,13 +49,12 @@ def get(): if _instance is None: try: library_type = _get_library_type() - if library_type == 'windll': + if library_type == "windll": ctypes_library = ctypes.WinDLL(_get_library_name()) else: - assert library_type == 'cdll' + assert library_type == "cdll" ctypes_library = ctypes.CDLL(_get_library_name()) except OSError: raise errors.DriverNotInstalledError() _instance = _library.Library(ctypes_library) return _instance - diff --git a/generated/nise/nise/_visatype.py b/generated/nise/nise/_visatype.py index 02cc41d1b..bf96c3cfb 100644 --- a/generated/nise/nise/_visatype.py +++ b/generated/nise/nise/_visatype.py @@ -2,9 +2,9 @@ import ctypes -'''Definitions of the VISA types used by the C API of the driver runtime. +"""Definitions of the VISA types used by the C API of the driver runtime. These are aliased directly to ctypes types so can be used directly to call into the library. -''' +""" ViChar = ctypes.c_char @@ -26,4 +26,3 @@ ViAttr = ViUInt32 ViConstString = ViString ViRsrc = ViString - diff --git a/generated/nise/nise/enums.py b/generated/nise/nise/enums.py index 7a377b806..a0fc8d4a5 100644 --- a/generated/nise/nise/enums.py +++ b/generated/nise/nise/enums.py @@ -6,75 +6,75 @@ class ExpandAction(Enum): ROUTES = 0 - r''' + r""" Expand to routes - ''' + """ PATHS = 1 - r''' + r""" Expand to paths - ''' + """ class MulticonnectMode(Enum): DEFAULT = -1 - r''' + r""" Default - ''' + """ NO_MULTICONNECT = 0 - r''' + r""" No multiconnect - ''' + """ MULTICONNECT = 1 - r''' + r""" Multiconnect - ''' + """ class OperationOrder(Enum): BEFORE = 1 - r''' + r""" Break before make - ''' + """ AFTER = 2 - r''' + r""" Break after make - ''' + """ class PathCapability(Enum): PATH_NEEDS_HARDWIRE = -2 - r''' + r""" Path needs hardwire - ''' + """ PATH_NEEDS_CONFIG_CHANNEL = -1 - r''' + r""" Path needs config channel - ''' + """ PATH_AVAILABLE = 1 - r''' + r""" Path available - ''' + """ PATH_EXISTS = 2 - r''' + r""" Path exists - ''' + """ PATH_UNSUPPORTED = 3 - r''' + r""" Path Unsupported - ''' + """ RESOURCE_IN_USE = 4 - r''' + r""" Resource in use - ''' + """ EXCLUSION_CONFLICT = 5 - r''' + r""" Exclusion conflict - ''' + """ CHANNEL_NOT_AVAILABLE = 6 - r''' + r""" Channel not available - ''' + """ CHANNELS_HARDWIRED = 7 - r''' + r""" Channels hardwired - ''' + """ diff --git a/generated/nise/nise/errors.py b/generated/nise/nise/errors.py index 47d194146..f7b97bfb1 100644 --- a/generated/nise/nise/errors.py +++ b/generated/nise/nise/errors.py @@ -7,77 +7,92 @@ def _is_success(code): - return (code == 0) + return code == 0 def _is_error(code): - return (code < 0) + return code < 0 def _is_warning(code): - return (code > 0) + return code > 0 class Error(Exception): - '''Base error class for NI Switch Executive''' + """Base error class for NI Switch Executive""" def __init__(self, message): super(Error, self).__init__(message) class DriverError(Error): - '''An error originating from the NI Switch Executive driver''' + """An error originating from the NI Switch Executive driver""" def __init__(self, code, description): - assert (_is_error(code)), "Should not raise Error if code is not fatal." + assert _is_error(code), "Should not raise Error if code is not fatal." self.code = code self.description = description super(DriverError, self).__init__(str(self.code) + ": " + self.description) class DriverWarning(Warning): - '''A warning originating from the NI Switch Executive driver''' + """A warning originating from the NI Switch Executive driver""" def __init__(self, code, description): - assert (_is_warning(code)), "Should not create Warning if code is not positive." - super(DriverWarning, self).__init__('Warning {0} occurred.\n\n{1}'.format(code, description)) + assert _is_warning(code), "Should not create Warning if code is not positive." + super(DriverWarning, self).__init__( + "Warning {0} occurred.\n\n{1}".format(code, description) + ) class UnsupportedConfigurationError(Error): - '''An error due to using this module in an usupported platform.''' + """An error due to using this module in an usupported platform.""" def __init__(self): - super(UnsupportedConfigurationError, self).__init__('System configuration is unsupported: ' + platform.architecture()[0] + ' ' + platform.system()) + super(UnsupportedConfigurationError, self).__init__( + "System configuration is unsupported: " + + platform.architecture()[0] + + " " + + platform.system() + ) class DriverNotInstalledError(Error): - '''An error due to using this module without the driver runtime installed.''' + """An error due to using this module without the driver runtime installed.""" def __init__(self): - super(DriverNotInstalledError, self).__init__('The NI Switch Executive runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it.') + super(DriverNotInstalledError, self).__init__( + "The NI Switch Executive runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it." + ) class DriverTooOldError(Error): - '''An error due to using this module with an older version of the driver runtime.''' + """An error due to using this module with an older version of the driver runtime.""" def __init__(self): - super(DriverTooOldError, self).__init__('A function was not found in the NI Switch Executive runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it.') + super(DriverTooOldError, self).__init__( + "A function was not found in the NI Switch Executive runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it." + ) class InvalidRepeatedCapabilityError(Error): - '''An error due to an invalid character in a repeated capability''' + """An error due to an invalid character in a repeated capability""" def __init__(self, invalid_character, invalid_string): - super(InvalidRepeatedCapabilityError, self).__init__('An invalid character ({0}) was found in repeated capability string ({1})'.format(invalid_character, invalid_string)) + super(InvalidRepeatedCapabilityError, self).__init__( + "An invalid character ({0}) was found in repeated capability string ({1})".format( + invalid_character, invalid_string + ) + ) def handle_error(session, code, ignore_warnings, is_error_handling): - '''handle_error + """handle_error Helper function for handling errors returned by nise.Library. It calls back into the session to get the corresponding error description and raises if necessary. - ''' + """ if _is_success(code) or (_is_warning(code) and ignore_warnings): return @@ -85,7 +100,7 @@ def handle_error(session, code, ignore_warnings, is_error_handling): if is_error_handling: # The caller is in the midst of error handling and an error occurred. # Don't try to get the description or we'll start recursing until the stack overflows. - description = '' + description = "" else: description = session._get_error_description(code) @@ -94,5 +109,3 @@ def handle_error(session, code, ignore_warnings, is_error_handling): assert _is_warning(code) warnings.warn(DriverWarning(code, description)) - - diff --git a/generated/nise/nise/session.py b/generated/nise/nise/session.py index 90c1d5828..b03d186b1 100644 --- a/generated/nise/nise/session.py +++ b/generated/nise/nise/session.py @@ -13,22 +13,24 @@ # Used for __repr__ import pprint + pp = pprint.PrettyPrinter(indent=4) # Helper functions for creating ctypes needed for calling into the driver DLL def get_ctypes_pointer_for_buffer(value=None, library_type=None, size=None): if isinstance(value, array.array): - assert library_type is not None, 'library_type is required for array.array' + assert library_type is not None, "library_type is required for array.array" addr, _ = value.buffer_info() return ctypes.cast(addr, ctypes.POINTER(library_type)) elif str(type(value)).find("'numpy.ndarray'") != -1: import numpy + return numpy.ctypeslib.as_ctypes(value) elif isinstance(value, bytes): return ctypes.cast(value, ctypes.POINTER(library_type)) elif isinstance(value, list): - assert library_type is not None, 'library_type is required for list' + assert library_type is not None, "library_type is required for list" return (library_type * len(value))(*value) else: if library_type is not None and size is not None: @@ -50,41 +52,47 @@ def get_ctypes_and_array(value, array_type): class _SessionBase(object): - '''Base class for all NI Switch Executive sessions.''' + """Base class for all NI Switch Executive sessions.""" # This is needed during __init__. Without it, __setattr__ raises an exception _is_frozen = False - def __init__(self, repeated_capability_list, vi, library, encoding, freeze_it=False): + def __init__( + self, repeated_capability_list, vi, library, encoding, freeze_it=False + ): self._repeated_capability_list = repeated_capability_list - self._repeated_capability = ','.join(repeated_capability_list) + self._repeated_capability = ",".join(repeated_capability_list) self._vi = vi self._library = library self._encoding = encoding # Store the parameter list for later printing in __repr__ param_list = [] - param_list.append("repeated_capability_list=" + pp.pformat(repeated_capability_list)) + param_list.append( + "repeated_capability_list=" + pp.pformat(repeated_capability_list) + ) param_list.append("vi=" + pp.pformat(vi)) param_list.append("library=" + pp.pformat(library)) param_list.append("encoding=" + pp.pformat(encoding)) - self._param_list = ', '.join(param_list) + self._param_list = ", ".join(param_list) self._is_frozen = freeze_it def __repr__(self): - return '{0}.{1}({2})'.format('nise', self.__class__.__name__, self._param_list) + return "{0}.{1}({2})".format("nise", self.__class__.__name__, self._param_list) def __setattr__(self, key, value): if self._is_frozen and key not in dir(self): - raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) + raise AttributeError( + "'{0}' object has no attribute '{1}'".format(type(self).__name__, key) + ) object.__setattr__(self, key, value) def _get_error_description(self, error_code): - '''_get_error_description + """_get_error_description Returns the error description. - ''' + """ try: _, error_string = self._get_error() return error_string @@ -92,20 +100,20 @@ def _get_error_description(self, error_code): pass try: - ''' + """ It is expected for _get_error to raise when the session is invalid (IVI spec requires GetError to fail). Use _error_message instead. It doesn't require a session. - ''' + """ error_string = self._error_message(error_code) return error_string except errors.Error: return "Failed to retrieve error description." - ''' These are code-generated ''' + """ These are code-generated """ def _get_error(self, error_description_size=[1024]): - r'''_get_error + r"""_get_error Get error information of the first error that occurred. If a valid pointer is passed to errorDescription or errorNumber, GetError will @@ -161,21 +169,36 @@ def _get_error(self, error_description_size=[1024]): specification string. Allocate a buffer of the appropriate size and then re-call the method to obtain the entire buffer. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_number_ctype = _visatype.ViInt32() # case S220 - error_description_ctype = (_visatype.ViChar * error_description_size[0])() # case C080 - error_description_size_ctype = get_ctypes_pointer_for_buffer(value=error_description_size, library_type=_visatype.ViInt32) # case B550 - error_code = self._library.niSE_GetError(vi_ctype, None if error_number_ctype is None else (ctypes.pointer(error_number_ctype)), error_description_ctype, error_description_size_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) - return int(error_number_ctype.value), error_description_ctype.value.decode(self._encoding) + error_description_ctype = ( + _visatype.ViChar * error_description_size[0] + )() # case C080 + error_description_size_ctype = get_ctypes_pointer_for_buffer( + value=error_description_size, library_type=_visatype.ViInt32 + ) # case B550 + error_code = self._library.niSE_GetError( + vi_ctype, + None + if error_number_ctype is None + else (ctypes.pointer(error_number_ctype)), + error_description_ctype, + error_description_size_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) + return int(error_number_ctype.value), error_description_ctype.value.decode( + self._encoding + ) class Session(_SessionBase): - '''An NI Switch Executive session''' + """An NI Switch Executive session""" def __init__(self, virtual_device_name, options={}): - r'''An NI Switch Executive session + r"""An NI Switch Executive session Opens a session to a specified NI Switch Executive virtual device. Opens communications with all of the IVI switches associated with the @@ -227,11 +250,17 @@ def __init__(self, virtual_device_name, options={}): Returns: session (nise.Session): A session object representing the device. - ''' - super(Session, self).__init__(repeated_capability_list=[], vi=None, library=None, encoding=None, freeze_it=False) + """ + super(Session, self).__init__( + repeated_capability_list=[], + vi=None, + library=None, + encoding=None, + freeze_it=False, + ) options = _converters.convert_init_with_options_dictionary(options) self._library = _library_singleton.get() - self._encoding = 'windows-1251' + self._encoding = "windows-1251" # Call specified init function self._vi = 0 # This must be set before calling _open_session(). @@ -241,7 +270,7 @@ def __init__(self, virtual_device_name, options={}): param_list = [] param_list.append("virtual_device_name=" + pp.pformat(virtual_device_name)) param_list.append("options=" + pp.pformat(options)) - self._param_list = ', '.join(param_list) + self._param_list = ", ".join(param_list) self._is_frozen = True @@ -252,7 +281,7 @@ def __exit__(self, exc_type, exc_value, traceback): self.close() def close(self): - '''close + """close Reduces the reference count of open sessions by one. If the reference count goes to 0, the method deallocates any memory resources the @@ -262,7 +291,7 @@ def close(self): Note: This method is not needed when using the session context manager - ''' + """ try: self._close_session() except errors.DriverError: @@ -270,24 +299,31 @@ def close(self): raise self._vi = 0 - ''' These are code-generated ''' + """ These are code-generated """ def _close_session(self): - r'''_close_session + r"""_close_session Reduces the reference count of open sessions by one. If the reference count goes to 0, the method deallocates any memory resources the driver uses and closes any open IVI switch sessions. After calling the close method, you should not use the NI Switch Executive virtual device again until you call __init__. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSE_CloseSession(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return - def connect(self, connect_spec, multiconnect_mode=enums.MulticonnectMode.DEFAULT, wait_for_debounce=True): - r'''connect + def connect( + self, + connect_spec, + multiconnect_mode=enums.MulticonnectMode.DEFAULT, + wait_for_debounce=True, + ): + r"""connect Connects the routes specified by the connection specification. When connecting, it may allow for multiconnection based on the @@ -335,19 +371,40 @@ def connect(self, connect_spec, multiconnect_mode=enums.MulticonnectMode.DEFAULT operation after completing the first. The order of connect and disconnect operation is set by the Operation Order input. - ''' + """ if type(multiconnect_mode) is not enums.MulticonnectMode: - raise TypeError('Parameter multiconnect_mode must be of type ' + str(enums.MulticonnectMode)) + raise TypeError( + "Parameter multiconnect_mode must be of type " + + str(enums.MulticonnectMode) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - connect_spec_ctype = ctypes.create_string_buffer(connect_spec.encode(self._encoding)) # case C020 - multiconnect_mode_ctype = _visatype.ViInt32(multiconnect_mode.value) # case S130 + connect_spec_ctype = ctypes.create_string_buffer( + connect_spec.encode(self._encoding) + ) # case C020 + multiconnect_mode_ctype = _visatype.ViInt32( + multiconnect_mode.value + ) # case S130 wait_for_debounce_ctype = _visatype.ViBoolean(wait_for_debounce) # case S150 - error_code = self._library.niSE_Connect(vi_ctype, connect_spec_ctype, multiconnect_mode_ctype, wait_for_debounce_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niSE_Connect( + vi_ctype, + connect_spec_ctype, + multiconnect_mode_ctype, + wait_for_debounce_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return - def connect_and_disconnect(self, connect_spec, disconnect_spec, multiconnect_mode=enums.MulticonnectMode.DEFAULT, operation_order=enums.OperationOrder.AFTER, wait_for_debounce=True): - r'''connect_and_disconnect + def connect_and_disconnect( + self, + connect_spec, + disconnect_spec, + multiconnect_mode=enums.MulticonnectMode.DEFAULT, + operation_order=enums.OperationOrder.AFTER, + wait_for_debounce=True, + ): + r"""connect_and_disconnect Connects routes and disconnects routes in a similar fashion to connect and disconnect except that the operations happen in @@ -426,23 +483,43 @@ def connect_and_disconnect(self, connect_spec, disconnect_spec, multiconnect_mod operation after completing the first. The order of connect and disconnect operation is set by the Operation Order input. - ''' + """ if type(multiconnect_mode) is not enums.MulticonnectMode: - raise TypeError('Parameter multiconnect_mode must be of type ' + str(enums.MulticonnectMode)) + raise TypeError( + "Parameter multiconnect_mode must be of type " + + str(enums.MulticonnectMode) + ) if type(operation_order) is not enums.OperationOrder: - raise TypeError('Parameter operation_order must be of type ' + str(enums.OperationOrder)) + raise TypeError( + "Parameter operation_order must be of type " + str(enums.OperationOrder) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - connect_spec_ctype = ctypes.create_string_buffer(connect_spec.encode(self._encoding)) # case C020 - disconnect_spec_ctype = ctypes.create_string_buffer(disconnect_spec.encode(self._encoding)) # case C020 - multiconnect_mode_ctype = _visatype.ViInt32(multiconnect_mode.value) # case S130 + connect_spec_ctype = ctypes.create_string_buffer( + connect_spec.encode(self._encoding) + ) # case C020 + disconnect_spec_ctype = ctypes.create_string_buffer( + disconnect_spec.encode(self._encoding) + ) # case C020 + multiconnect_mode_ctype = _visatype.ViInt32( + multiconnect_mode.value + ) # case S130 operation_order_ctype = _visatype.ViInt32(operation_order.value) # case S130 wait_for_debounce_ctype = _visatype.ViBoolean(wait_for_debounce) # case S150 - error_code = self._library.niSE_ConnectAndDisconnect(vi_ctype, connect_spec_ctype, disconnect_spec_ctype, multiconnect_mode_ctype, operation_order_ctype, wait_for_debounce_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niSE_ConnectAndDisconnect( + vi_ctype, + connect_spec_ctype, + disconnect_spec_ctype, + multiconnect_mode_ctype, + operation_order_ctype, + wait_for_debounce_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def disconnect(self, disconnect_spec): - r'''disconnect + r"""disconnect Disconnects the routes specified in the Disconnection Specification. If any of the specified routes were originally connected in a @@ -463,28 +540,39 @@ def disconnect(self, disconnect_spec): [A->Switch1/r0->B] Refer to Route Specification Strings in the NI Switch Executive Help for more information. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - disconnect_spec_ctype = ctypes.create_string_buffer(disconnect_spec.encode(self._encoding)) # case C020 + disconnect_spec_ctype = ctypes.create_string_buffer( + disconnect_spec.encode(self._encoding) + ) # case C020 error_code = self._library.niSE_Disconnect(vi_ctype, disconnect_spec_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def disconnect_all(self): - r'''disconnect_all + r"""disconnect_all Disconnects all connections on every IVI switch device managed by the NISE session reference passed to this method. disconnect_all ignores all multiconnect modes. Calling disconnect_all resets all of the switch states for the system. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSE_DisconnectAll(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return - def expand_route_spec(self, route_spec, expand_action=enums.ExpandAction.ROUTES, expanded_route_spec_size=[1024]): - r'''expand_route_spec + def expand_route_spec( + self, + route_spec, + expand_action=enums.ExpandAction.ROUTES, + expanded_route_spec_size=[1024], + ): + r"""expand_route_spec Expands a route spec string to yield more information about the routes and route groups within the spec. The route specification string @@ -537,20 +625,36 @@ def expand_route_spec(self, route_spec, expand_action=enums.ExpandAction.ROUTES, Allocate a buffer of the appropriate size and then re-call the method to obtain the entire buffer. - ''' + """ if type(expand_action) is not enums.ExpandAction: - raise TypeError('Parameter expand_action must be of type ' + str(enums.ExpandAction)) + raise TypeError( + "Parameter expand_action must be of type " + str(enums.ExpandAction) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - route_spec_ctype = ctypes.create_string_buffer(route_spec.encode(self._encoding)) # case C020 + route_spec_ctype = ctypes.create_string_buffer( + route_spec.encode(self._encoding) + ) # case C020 expand_action_ctype = _visatype.ViInt32(expand_action.value) # case S130 - expanded_route_spec_ctype = (_visatype.ViChar * expanded_route_spec_size[0])() # case C080 - expanded_route_spec_size_ctype = get_ctypes_pointer_for_buffer(value=expanded_route_spec_size, library_type=_visatype.ViInt32) # case B550 - error_code = self._library.niSE_ExpandRouteSpec(vi_ctype, route_spec_ctype, expand_action_ctype, expanded_route_spec_ctype, expanded_route_spec_size_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + expanded_route_spec_ctype = ( + _visatype.ViChar * expanded_route_spec_size[0] + )() # case C080 + expanded_route_spec_size_ctype = get_ctypes_pointer_for_buffer( + value=expanded_route_spec_size, library_type=_visatype.ViInt32 + ) # case B550 + error_code = self._library.niSE_ExpandRouteSpec( + vi_ctype, + route_spec_ctype, + expand_action_ctype, + expanded_route_spec_ctype, + expanded_route_spec_size_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return expanded_route_spec_ctype.value.decode(self._encoding) def find_route(self, channel1, channel2, route_spec_size=[1024]): - r'''find_route + r"""find_route Finds an existing or potential route between channel 1 and channel 2. The returned route specification contains the route specification and @@ -619,19 +723,38 @@ def find_route(self, channel1, channel2, route_spec_size=[1024]): Channels Hardwired (7) The two channels reside on the same hardwire. An implicit path already exists. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel1_ctype = ctypes.create_string_buffer(channel1.encode(self._encoding)) # case C020 - channel2_ctype = ctypes.create_string_buffer(channel2.encode(self._encoding)) # case C020 + channel1_ctype = ctypes.create_string_buffer( + channel1.encode(self._encoding) + ) # case C020 + channel2_ctype = ctypes.create_string_buffer( + channel2.encode(self._encoding) + ) # case C020 route_spec_ctype = (_visatype.ViChar * route_spec_size[0])() # case C080 - route_spec_size_ctype = get_ctypes_pointer_for_buffer(value=route_spec_size, library_type=_visatype.ViInt32) # case B550 + route_spec_size_ctype = get_ctypes_pointer_for_buffer( + value=route_spec_size, library_type=_visatype.ViInt32 + ) # case B550 path_capability_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niSE_FindRoute(vi_ctype, channel1_ctype, channel2_ctype, route_spec_ctype, route_spec_size_ctype, None if path_capability_ctype is None else (ctypes.pointer(path_capability_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return route_spec_ctype.value.decode(self._encoding), enums.PathCapability(path_capability_ctype.value) + error_code = self._library.niSE_FindRoute( + vi_ctype, + channel1_ctype, + channel2_ctype, + route_spec_ctype, + route_spec_size_ctype, + None + if path_capability_ctype is None + else (ctypes.pointer(path_capability_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return route_spec_ctype.value.decode(self._encoding), enums.PathCapability( + path_capability_ctype.value + ) def get_all_connections(self, route_spec_size=[1024]): - r'''get_all_connections + r"""get_all_connections Returns the top-level connected routes and route groups. The route specification string returned from get_all_connections can be passed @@ -669,16 +792,22 @@ def get_all_connections(self, route_spec_size=[1024]): Allocate a buffer of the appropriate size and then re-call the method to obtain the entire buffer. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 route_spec_ctype = (_visatype.ViChar * route_spec_size[0])() # case C080 - route_spec_size_ctype = get_ctypes_pointer_for_buffer(value=route_spec_size, library_type=_visatype.ViInt32) # case B550 - error_code = self._library.niSE_GetAllConnections(vi_ctype, route_spec_ctype, route_spec_size_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + route_spec_size_ctype = get_ctypes_pointer_for_buffer( + value=route_spec_size, library_type=_visatype.ViInt32 + ) # case B550 + error_code = self._library.niSE_GetAllConnections( + vi_ctype, route_spec_ctype, route_spec_size_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return route_spec_ctype.value.decode(self._encoding) def is_connected(self, route_spec): - r'''is_connected + r"""is_connected Checks whether the specified routes and routes groups are connected. It returns true if connected. @@ -698,16 +827,26 @@ def is_connected(self, route_spec): is_connected (bool): Returns TRUE if the routes and routes groups are connected or FALSE if they are not. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - route_spec_ctype = ctypes.create_string_buffer(route_spec.encode(self._encoding)) # case C020 + route_spec_ctype = ctypes.create_string_buffer( + route_spec.encode(self._encoding) + ) # case C020 is_connected_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niSE_IsConnected(vi_ctype, route_spec_ctype, None if is_connected_ctype is None else (ctypes.pointer(is_connected_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niSE_IsConnected( + vi_ctype, + route_spec_ctype, + None + if is_connected_ctype is None + else (ctypes.pointer(is_connected_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return bool(is_connected_ctype.value) def is_debounced(self): - r'''is_debounced + r"""is_debounced Checks to see if the switching system is debounced or not. This method does not wait for debouncing to occur. It returns true if the system is @@ -718,15 +857,22 @@ def is_debounced(self): is_debounced (bool): Returns TRUE if the system is fully debounced or FALSE if it is still settling. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 is_debounced_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niSE_IsDebounced(vi_ctype, None if is_debounced_ctype is None else (ctypes.pointer(is_debounced_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niSE_IsDebounced( + vi_ctype, + None + if is_debounced_ctype is None + else (ctypes.pointer(is_debounced_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return bool(is_debounced_ctype.value) def _open_session(self, virtual_device_name, option_string=""): - r'''_open_session + r"""_open_session Opens a session to a specified NI Switch Executive virtual device. Opens communications with all of the IVI switches associated with the @@ -755,16 +901,28 @@ def _open_session(self, virtual_device_name, option_string=""): Returns: vi (int): The session referencing this NI Switch Executive virtual device session. - ''' - virtual_device_name_ctype = ctypes.create_string_buffer(virtual_device_name.encode(self._encoding)) # case C020 - option_string_ctype = ctypes.create_string_buffer(_converters.convert_init_with_options_dictionary(option_string).encode(self._encoding)) # case C040 + """ + virtual_device_name_ctype = ctypes.create_string_buffer( + virtual_device_name.encode(self._encoding) + ) # case C020 + option_string_ctype = ctypes.create_string_buffer( + _converters.convert_init_with_options_dictionary(option_string).encode( + self._encoding + ) + ) # case C040 vi_ctype = _visatype.ViSession() # case S220 - error_code = self._library.niSE_OpenSession(virtual_device_name_ctype, option_string_ctype, None if vi_ctype is None else (ctypes.pointer(vi_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niSE_OpenSession( + virtual_device_name_ctype, + option_string_ctype, + None if vi_ctype is None else (ctypes.pointer(vi_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(vi_ctype.value) def wait_for_debounce(self, maximum_time_ms=hightime.timedelta(milliseconds=-1)): - r'''wait_for_debounce + r"""wait_for_debounce Waits for all of the switches in the NI Switch Executive virtual device to debounce. This method does not return until either the switching @@ -782,12 +940,13 @@ def wait_for_debounce(self, maximum_time_ms=hightime.timedelta(milliseconds=-1)) if the system is not debounced at that time. A value of -1 means to block for an infinite period of time until the system is debounced. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_time_ms_ctype = _converters.convert_timedelta_to_milliseconds_int32(maximum_time_ms) # case S140 + maximum_time_ms_ctype = _converters.convert_timedelta_to_milliseconds_int32( + maximum_time_ms + ) # case S140 error_code = self._library.niSE_WaitForDebounce(vi_ctype, maximum_time_ms_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return - - - diff --git a/generated/nise/nise/unit_tests/_matchers.py b/generated/nise/nise/unit_tests/_matchers.py index 80750d519..e1eb551e9 100644 --- a/generated/nise/nise/unit_tests/_matchers.py +++ b/generated/nise/nise/unit_tests/_matchers.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # This file was generated -'''Matcher classes used by unit tests in order to set mock expectations. +"""Matcher classes used by unit tests in order to set mock expectations. These work well with our visatype definitions. -''' +""" import ctypes import nise._visatype as _visatype @@ -21,15 +21,27 @@ def __init__(self, expected_type, expected_value): def __eq__(self, other): if not isinstance(other, self.expected_type): - print("{0}: Unexpected type. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_type, type(other))) + print( + "{0}: Unexpected type. Expected: {1}. Received: {2}".format( + self.__class__.__name__, self.expected_type, type(other) + ) + ) return False if other.value != self.expected_value: - print("{0}: Unexpected value. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_value, other.value)) + print( + "{0}: Unexpected value. Expected: {1}. Received: {2}".format( + self.__class__.__name__, self.expected_value, other.value + ) + ) return False return True def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_type), + pp.pformat(self.expected_value), + ) class _PointerMatcher(object): @@ -38,12 +50,18 @@ def __init__(self, expected_type): def __eq__(self, other): if not isinstance(other, ctypes.POINTER(self.expected_type)): - print("Unexpected type. Expected: {0}. Received: {1}".format(ctypes.POINTER(self.expected_type), type(other))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + ctypes.POINTER(self.expected_type), type(other) + ) + ) return False return True def __repr__(self): - return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_type)) + return "{0}({1})".format( + self.__class__.__name__, pp.pformat(self.expected_type) + ) class _BufferMatcher(object): @@ -70,29 +88,47 @@ def __eq__(self, other): pass # Because of object lifetimes, we may need to mock the other instance and provide lists instead of the actual array - if not isinstance(other, self.expected_type) and not isinstance(other, list): - print("Unexpected type. Expected: {0} or {1}. Received: {2}".format(self.expected_type, list, type(other))) + if not isinstance(other, self.expected_type) and not isinstance( + other, list + ): + print( + "Unexpected type. Expected: {0} or {1}. Received: {2}".format( + self.expected_type, list, type(other) + ) + ) return False if self.expected_size != len(other): - print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(other))) + print( + "Unexpected length. Expected: {0}. Received: {1}".format( + self.expected_size, len(other) + ) + ) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for i in range(0, len(self.expected_value)): if self.expected_value[i] != other[i]: - print("Unexpected value at index {0}. Expected: {1}. Received: {2}".format(i, self.expected_value[i], other[i])) + print( + "Unexpected value at index {0}. Expected: {1}. Received: {2}".format( + i, self.expected_value[i], other[i] + ) + ) return False return True def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self._expected_element_type), pp.pformat(self._expected_size_or_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self._expected_element_type), + pp.pformat(self._expected_size_or_value), + ) def __str__(self): - ret_str = self.__repr__() + '\n' - ret_str += ' expected_type = ' + str(self.expected_type) + '\n' - ret_str += ' expected_value = ' + str(self.expected_value) + '\n' - ret_str += ' expected_size = ' + str(self.expected_size) + '\n' + ret_str = self.__repr__() + "\n" + ret_str += " expected_type = " + str(self.expected_type) + "\n" + ret_str += " expected_value = " + str(self.expected_value) + "\n" + ret_str += " expected_size = " + str(self.expected_size) + "\n" return ret_str @@ -112,21 +148,37 @@ def __eq__(self, other): pass if not isinstance(other, ctypes.Array): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(other))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_type, type(other) + ) + ) return False - if len(other) < len(self.expected_string_value) + 1: # +1 for NULL terminating character - print("Unexpected length in C string. Expected at least: {0}. Received {1}".format(len(other), len(self.expected_string_value) + 1)) + if ( + len(other) < len(self.expected_string_value) + 1 + ): # +1 for NULL terminating character + print( + "Unexpected length in C string. Expected at least: {0}. Received {1}".format( + len(other), len(self.expected_string_value) + 1 + ) + ) return False if not isinstance(other[0], bytes): print("Unexpected type. Not a string. Received: {0}".format(type(other[0]))) return False if other.value.decode("ascii") != self.expected_string_value: - print("Unexpected value. Expected {0}. Received: {1}".format(self.expected_string_value, other.value.decode)) + print( + "Unexpected value. Expected {0}. Received: {1}".format( + self.expected_string_value, other.value.decode + ) + ) return False return True def __repr__(self): - return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_string_value)) + return "{0}({1})".format( + self.__class__.__name__, pp.pformat(self.expected_string_value) + ) # Custom Type @@ -139,7 +191,11 @@ def _compare_ctype_structs(expected, actual): expected_val = getattr(expected, field_name) actual_val = getattr(actual, field_name) if expected_val != actual_val: - print("Unexpected value field {0}. Expected: {1}. Received: {2}".format(field_name, expected_val, actual_val)) + print( + "Unexpected value field {0}. Expected: {1}. Received: {2}".format( + field_name, expected_val, actual_val + ) + ) return False return True @@ -151,12 +207,20 @@ def __init__(self, expected_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_type, type(actual) + ) + ) return False return _compare_ctype_structs(self.expected_value, actual) def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_type), + pp.pformat(self.expected_value), + ) class CustomTypeBufferMatcher(object): @@ -168,30 +232,48 @@ def __init__(self, expected_element_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print("Unexpected array type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) + print( + "Unexpected array type. Expected: {0}. Received: {1}".format( + self.expected_type, type(actual) + ) + ) return False if self.expected_size != len(actual): - print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(actual))) + print( + "Unexpected length. Expected: {0}. Received: {1}".format( + self.expected_size, len(actual) + ) + ) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for a, e in zip(actual, self.expected_value): if not isinstance(a, self.expected_element_type): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_element_type, type(a))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_element_type, type(a) + ) + ) return False if not _compare_ctype_structs(e, a): return False return True def __repr__(self): - expected_val_repr = '[' + ', '.join([x.__repr__() for x in self.expected_value]) + ']' - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_element_type), expected_val_repr) + expected_val_repr = ( + "[" + ", ".join([x.__repr__() for x in self.expected_value]) + "]" + ) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_element_type), + expected_val_repr, + ) def __str__(self): - ret_str = self.__repr__() + '\n' - ret_str += ' expected_type = ' + str(self.expected_type) + '\n' - ret_str += ' expected_size = ' + str(self.expected_size) + '\n' + ret_str = self.__repr__() + "\n" + ret_str += " expected_type = " + str(self.expected_type) + "\n" + ret_str += " expected_size = " + str(self.expected_size) + "\n" return ret_str @@ -200,7 +282,9 @@ def __str__(self): class ViBooleanMatcher(_ScalarMatcher): def __init__(self, expected_value): - _ScalarMatcher.__init__(self, _visatype.ViBoolean, 1 if expected_value is True else 0) + _ScalarMatcher.__init__( + self, _visatype.ViBoolean, 1 if expected_value is True else 0 + ) class ViSessionMatcher(_ScalarMatcher): @@ -312,6 +396,3 @@ def __init__(self, expected_size_or_value): class ViSessionBufferMatcher(_BufferMatcher): def __init__(self, expected_size_or_value): _BufferMatcher.__init__(self, _visatype.ViSession, expected_size_or_value) - - - diff --git a/generated/nise/nise/unit_tests/_mock_helper.py b/generated/nise/nise/unit_tests/_mock_helper.py index 79e48528e..619596438 100644 --- a/generated/nise/nise/unit_tests/_mock_helper.py +++ b/generated/nise/nise/unit_tests/_mock_helper.py @@ -16,41 +16,41 @@ def __init__(self, function, param=None): class SideEffectsHelper(object): def __init__(self): self._defaults = {} - self._defaults['CloseSession'] = {} - self._defaults['CloseSession']['return'] = 0 - self._defaults['Connect'] = {} - self._defaults['Connect']['return'] = 0 - self._defaults['ConnectAndDisconnect'] = {} - self._defaults['ConnectAndDisconnect']['return'] = 0 - self._defaults['Disconnect'] = {} - self._defaults['Disconnect']['return'] = 0 - self._defaults['DisconnectAll'] = {} - self._defaults['DisconnectAll']['return'] = 0 - self._defaults['ExpandRouteSpec'] = {} - self._defaults['ExpandRouteSpec']['return'] = 0 - self._defaults['ExpandRouteSpec']['expandedRouteSpec'] = None - self._defaults['FindRoute'] = {} - self._defaults['FindRoute']['return'] = 0 - self._defaults['FindRoute']['routeSpec'] = None - self._defaults['FindRoute']['pathCapability'] = None - self._defaults['GetAllConnections'] = {} - self._defaults['GetAllConnections']['return'] = 0 - self._defaults['GetAllConnections']['routeSpec'] = None - self._defaults['GetError'] = {} - self._defaults['GetError']['return'] = 0 - self._defaults['GetError']['errorNumber'] = None - self._defaults['GetError']['errorDescription'] = None - self._defaults['IsConnected'] = {} - self._defaults['IsConnected']['return'] = 0 - self._defaults['IsConnected']['isConnected'] = None - self._defaults['IsDebounced'] = {} - self._defaults['IsDebounced']['return'] = 0 - self._defaults['IsDebounced']['isDebounced'] = None - self._defaults['OpenSession'] = {} - self._defaults['OpenSession']['return'] = 0 - self._defaults['OpenSession']['vi'] = None - self._defaults['WaitForDebounce'] = {} - self._defaults['WaitForDebounce']['return'] = 0 + self._defaults["CloseSession"] = {} + self._defaults["CloseSession"]["return"] = 0 + self._defaults["Connect"] = {} + self._defaults["Connect"]["return"] = 0 + self._defaults["ConnectAndDisconnect"] = {} + self._defaults["ConnectAndDisconnect"]["return"] = 0 + self._defaults["Disconnect"] = {} + self._defaults["Disconnect"]["return"] = 0 + self._defaults["DisconnectAll"] = {} + self._defaults["DisconnectAll"]["return"] = 0 + self._defaults["ExpandRouteSpec"] = {} + self._defaults["ExpandRouteSpec"]["return"] = 0 + self._defaults["ExpandRouteSpec"]["expandedRouteSpec"] = None + self._defaults["FindRoute"] = {} + self._defaults["FindRoute"]["return"] = 0 + self._defaults["FindRoute"]["routeSpec"] = None + self._defaults["FindRoute"]["pathCapability"] = None + self._defaults["GetAllConnections"] = {} + self._defaults["GetAllConnections"]["return"] = 0 + self._defaults["GetAllConnections"]["routeSpec"] = None + self._defaults["GetError"] = {} + self._defaults["GetError"]["return"] = 0 + self._defaults["GetError"]["errorNumber"] = None + self._defaults["GetError"]["errorDescription"] = None + self._defaults["IsConnected"] = {} + self._defaults["IsConnected"]["return"] = 0 + self._defaults["IsConnected"]["isConnected"] = None + self._defaults["IsDebounced"] = {} + self._defaults["IsDebounced"]["return"] = 0 + self._defaults["IsDebounced"]["isDebounced"] = None + self._defaults["OpenSession"] = {} + self._defaults["OpenSession"]["return"] = 0 + self._defaults["OpenSession"]["vi"] = None + self._defaults["WaitForDebounce"] = {} + self._defaults["WaitForDebounce"]["return"] = 0 def __getitem__(self, func): return self._defaults[func] @@ -59,156 +59,203 @@ def __setitem__(self, func, val): self._defaults[func] = val def niSE_CloseSession(self, vi): # noqa: N802 - if self._defaults['CloseSession']['return'] != 0: - return self._defaults['CloseSession']['return'] - return self._defaults['CloseSession']['return'] + if self._defaults["CloseSession"]["return"] != 0: + return self._defaults["CloseSession"]["return"] + return self._defaults["CloseSession"]["return"] - def niSE_Connect(self, vi, connect_spec, multiconnect_mode, wait_for_debounce): # noqa: N802 - if self._defaults['Connect']['return'] != 0: - return self._defaults['Connect']['return'] - return self._defaults['Connect']['return'] + def niSE_Connect( + self, vi, connect_spec, multiconnect_mode, wait_for_debounce + ): # noqa: N802 + if self._defaults["Connect"]["return"] != 0: + return self._defaults["Connect"]["return"] + return self._defaults["Connect"]["return"] - def niSE_ConnectAndDisconnect(self, vi, connect_spec, disconnect_spec, multiconnect_mode, operation_order, wait_for_debounce): # noqa: N802 - if self._defaults['ConnectAndDisconnect']['return'] != 0: - return self._defaults['ConnectAndDisconnect']['return'] - return self._defaults['ConnectAndDisconnect']['return'] + def niSE_ConnectAndDisconnect( + self, + vi, + connect_spec, + disconnect_spec, + multiconnect_mode, + operation_order, + wait_for_debounce, + ): # noqa: N802 + if self._defaults["ConnectAndDisconnect"]["return"] != 0: + return self._defaults["ConnectAndDisconnect"]["return"] + return self._defaults["ConnectAndDisconnect"]["return"] def niSE_Disconnect(self, vi, disconnect_spec): # noqa: N802 - if self._defaults['Disconnect']['return'] != 0: - return self._defaults['Disconnect']['return'] - return self._defaults['Disconnect']['return'] + if self._defaults["Disconnect"]["return"] != 0: + return self._defaults["Disconnect"]["return"] + return self._defaults["Disconnect"]["return"] def niSE_DisconnectAll(self, vi): # noqa: N802 - if self._defaults['DisconnectAll']['return'] != 0: - return self._defaults['DisconnectAll']['return'] - return self._defaults['DisconnectAll']['return'] + if self._defaults["DisconnectAll"]["return"] != 0: + return self._defaults["DisconnectAll"]["return"] + return self._defaults["DisconnectAll"]["return"] - def niSE_ExpandRouteSpec(self, vi, route_spec, expand_action, expanded_route_spec, expanded_route_spec_size): # noqa: N802 - if self._defaults['ExpandRouteSpec']['return'] != 0: - return self._defaults['ExpandRouteSpec']['return'] + def niSE_ExpandRouteSpec( + self, + vi, + route_spec, + expand_action, + expanded_route_spec, + expanded_route_spec_size, + ): # noqa: N802 + if self._defaults["ExpandRouteSpec"]["return"] != 0: + return self._defaults["ExpandRouteSpec"]["return"] # expanded_route_spec - if self._defaults['ExpandRouteSpec']['expandedRouteSpec'] is None: - raise MockFunctionCallError("niSE_ExpandRouteSpec", param='expandedRouteSpec') - test_value = self._defaults['ExpandRouteSpec']['expandedRouteSpec'] + if self._defaults["ExpandRouteSpec"]["expandedRouteSpec"] is None: + raise MockFunctionCallError( + "niSE_ExpandRouteSpec", param="expandedRouteSpec" + ) + test_value = self._defaults["ExpandRouteSpec"]["expandedRouteSpec"] if type(test_value) is str: - test_value = test_value.encode('ascii') + test_value = test_value.encode("ascii") assert len(expanded_route_spec) >= len(test_value) for i in range(len(test_value)): expanded_route_spec[i] = test_value[i] - return self._defaults['ExpandRouteSpec']['return'] + return self._defaults["ExpandRouteSpec"]["return"] - def niSE_FindRoute(self, vi, channel1, channel2, route_spec, route_spec_size, path_capability): # noqa: N802 - if self._defaults['FindRoute']['return'] != 0: - return self._defaults['FindRoute']['return'] + def niSE_FindRoute( + self, vi, channel1, channel2, route_spec, route_spec_size, path_capability + ): # noqa: N802 + if self._defaults["FindRoute"]["return"] != 0: + return self._defaults["FindRoute"]["return"] # route_spec - if self._defaults['FindRoute']['routeSpec'] is None: - raise MockFunctionCallError("niSE_FindRoute", param='routeSpec') - test_value = self._defaults['FindRoute']['routeSpec'] + if self._defaults["FindRoute"]["routeSpec"] is None: + raise MockFunctionCallError("niSE_FindRoute", param="routeSpec") + test_value = self._defaults["FindRoute"]["routeSpec"] if type(test_value) is str: - test_value = test_value.encode('ascii') + test_value = test_value.encode("ascii") assert len(route_spec) >= len(test_value) for i in range(len(test_value)): route_spec[i] = test_value[i] # path_capability - if self._defaults['FindRoute']['pathCapability'] is None: - raise MockFunctionCallError("niSE_FindRoute", param='pathCapability') + if self._defaults["FindRoute"]["pathCapability"] is None: + raise MockFunctionCallError("niSE_FindRoute", param="pathCapability") if path_capability is not None: - path_capability.contents.value = self._defaults['FindRoute']['pathCapability'] - return self._defaults['FindRoute']['return'] + path_capability.contents.value = self._defaults["FindRoute"][ + "pathCapability" + ] + return self._defaults["FindRoute"]["return"] def niSE_GetAllConnections(self, vi, route_spec, route_spec_size): # noqa: N802 - if self._defaults['GetAllConnections']['return'] != 0: - return self._defaults['GetAllConnections']['return'] + if self._defaults["GetAllConnections"]["return"] != 0: + return self._defaults["GetAllConnections"]["return"] # route_spec - if self._defaults['GetAllConnections']['routeSpec'] is None: - raise MockFunctionCallError("niSE_GetAllConnections", param='routeSpec') - test_value = self._defaults['GetAllConnections']['routeSpec'] + if self._defaults["GetAllConnections"]["routeSpec"] is None: + raise MockFunctionCallError("niSE_GetAllConnections", param="routeSpec") + test_value = self._defaults["GetAllConnections"]["routeSpec"] if type(test_value) is str: - test_value = test_value.encode('ascii') + test_value = test_value.encode("ascii") assert len(route_spec) >= len(test_value) for i in range(len(test_value)): route_spec[i] = test_value[i] - return self._defaults['GetAllConnections']['return'] + return self._defaults["GetAllConnections"]["return"] - def niSE_GetError(self, vi, error_number, error_description, error_description_size): # noqa: N802 - if self._defaults['GetError']['return'] != 0: - return self._defaults['GetError']['return'] + def niSE_GetError( + self, vi, error_number, error_description, error_description_size + ): # noqa: N802 + if self._defaults["GetError"]["return"] != 0: + return self._defaults["GetError"]["return"] # error_number - if self._defaults['GetError']['errorNumber'] is None: - raise MockFunctionCallError("niSE_GetError", param='errorNumber') + if self._defaults["GetError"]["errorNumber"] is None: + raise MockFunctionCallError("niSE_GetError", param="errorNumber") if error_number is not None: - error_number.contents.value = self._defaults['GetError']['errorNumber'] + error_number.contents.value = self._defaults["GetError"]["errorNumber"] # error_description - if self._defaults['GetError']['errorDescription'] is None: - raise MockFunctionCallError("niSE_GetError", param='errorDescription') - test_value = self._defaults['GetError']['errorDescription'] + if self._defaults["GetError"]["errorDescription"] is None: + raise MockFunctionCallError("niSE_GetError", param="errorDescription") + test_value = self._defaults["GetError"]["errorDescription"] if type(test_value) is str: - test_value = test_value.encode('ascii') + test_value = test_value.encode("ascii") assert len(error_description) >= len(test_value) for i in range(len(test_value)): error_description[i] = test_value[i] - return self._defaults['GetError']['return'] + return self._defaults["GetError"]["return"] def niSE_IsConnected(self, vi, route_spec, is_connected): # noqa: N802 - if self._defaults['IsConnected']['return'] != 0: - return self._defaults['IsConnected']['return'] + if self._defaults["IsConnected"]["return"] != 0: + return self._defaults["IsConnected"]["return"] # is_connected - if self._defaults['IsConnected']['isConnected'] is None: - raise MockFunctionCallError("niSE_IsConnected", param='isConnected') + if self._defaults["IsConnected"]["isConnected"] is None: + raise MockFunctionCallError("niSE_IsConnected", param="isConnected") if is_connected is not None: - is_connected.contents.value = self._defaults['IsConnected']['isConnected'] - return self._defaults['IsConnected']['return'] + is_connected.contents.value = self._defaults["IsConnected"]["isConnected"] + return self._defaults["IsConnected"]["return"] def niSE_IsDebounced(self, vi, is_debounced): # noqa: N802 - if self._defaults['IsDebounced']['return'] != 0: - return self._defaults['IsDebounced']['return'] + if self._defaults["IsDebounced"]["return"] != 0: + return self._defaults["IsDebounced"]["return"] # is_debounced - if self._defaults['IsDebounced']['isDebounced'] is None: - raise MockFunctionCallError("niSE_IsDebounced", param='isDebounced') + if self._defaults["IsDebounced"]["isDebounced"] is None: + raise MockFunctionCallError("niSE_IsDebounced", param="isDebounced") if is_debounced is not None: - is_debounced.contents.value = self._defaults['IsDebounced']['isDebounced'] - return self._defaults['IsDebounced']['return'] + is_debounced.contents.value = self._defaults["IsDebounced"]["isDebounced"] + return self._defaults["IsDebounced"]["return"] def niSE_OpenSession(self, virtual_device_name, option_string, vi): # noqa: N802 - if self._defaults['OpenSession']['return'] != 0: - return self._defaults['OpenSession']['return'] + if self._defaults["OpenSession"]["return"] != 0: + return self._defaults["OpenSession"]["return"] # vi - if self._defaults['OpenSession']['vi'] is None: - raise MockFunctionCallError("niSE_OpenSession", param='vi') + if self._defaults["OpenSession"]["vi"] is None: + raise MockFunctionCallError("niSE_OpenSession", param="vi") if vi is not None: - vi.contents.value = self._defaults['OpenSession']['vi'] - return self._defaults['OpenSession']['return'] + vi.contents.value = self._defaults["OpenSession"]["vi"] + return self._defaults["OpenSession"]["return"] def niSE_WaitForDebounce(self, vi, maximum_time_ms): # noqa: N802 - if self._defaults['WaitForDebounce']['return'] != 0: - return self._defaults['WaitForDebounce']['return'] - return self._defaults['WaitForDebounce']['return'] + if self._defaults["WaitForDebounce"]["return"] != 0: + return self._defaults["WaitForDebounce"]["return"] + return self._defaults["WaitForDebounce"]["return"] # Helper function to setup Mock object with default side effects and return values def set_side_effects_and_return_values(self, mock_library): - mock_library.niSE_CloseSession.side_effect = MockFunctionCallError("niSE_CloseSession") + mock_library.niSE_CloseSession.side_effect = MockFunctionCallError( + "niSE_CloseSession" + ) mock_library.niSE_CloseSession.return_value = 0 mock_library.niSE_Connect.side_effect = MockFunctionCallError("niSE_Connect") mock_library.niSE_Connect.return_value = 0 - mock_library.niSE_ConnectAndDisconnect.side_effect = MockFunctionCallError("niSE_ConnectAndDisconnect") + mock_library.niSE_ConnectAndDisconnect.side_effect = MockFunctionCallError( + "niSE_ConnectAndDisconnect" + ) mock_library.niSE_ConnectAndDisconnect.return_value = 0 - mock_library.niSE_Disconnect.side_effect = MockFunctionCallError("niSE_Disconnect") + mock_library.niSE_Disconnect.side_effect = MockFunctionCallError( + "niSE_Disconnect" + ) mock_library.niSE_Disconnect.return_value = 0 - mock_library.niSE_DisconnectAll.side_effect = MockFunctionCallError("niSE_DisconnectAll") + mock_library.niSE_DisconnectAll.side_effect = MockFunctionCallError( + "niSE_DisconnectAll" + ) mock_library.niSE_DisconnectAll.return_value = 0 - mock_library.niSE_ExpandRouteSpec.side_effect = MockFunctionCallError("niSE_ExpandRouteSpec") + mock_library.niSE_ExpandRouteSpec.side_effect = MockFunctionCallError( + "niSE_ExpandRouteSpec" + ) mock_library.niSE_ExpandRouteSpec.return_value = 0 - mock_library.niSE_FindRoute.side_effect = MockFunctionCallError("niSE_FindRoute") + mock_library.niSE_FindRoute.side_effect = MockFunctionCallError( + "niSE_FindRoute" + ) mock_library.niSE_FindRoute.return_value = 0 - mock_library.niSE_GetAllConnections.side_effect = MockFunctionCallError("niSE_GetAllConnections") + mock_library.niSE_GetAllConnections.side_effect = MockFunctionCallError( + "niSE_GetAllConnections" + ) mock_library.niSE_GetAllConnections.return_value = 0 mock_library.niSE_GetError.side_effect = MockFunctionCallError("niSE_GetError") mock_library.niSE_GetError.return_value = 0 - mock_library.niSE_IsConnected.side_effect = MockFunctionCallError("niSE_IsConnected") + mock_library.niSE_IsConnected.side_effect = MockFunctionCallError( + "niSE_IsConnected" + ) mock_library.niSE_IsConnected.return_value = 0 - mock_library.niSE_IsDebounced.side_effect = MockFunctionCallError("niSE_IsDebounced") + mock_library.niSE_IsDebounced.side_effect = MockFunctionCallError( + "niSE_IsDebounced" + ) mock_library.niSE_IsDebounced.return_value = 0 - mock_library.niSE_OpenSession.side_effect = MockFunctionCallError("niSE_OpenSession") + mock_library.niSE_OpenSession.side_effect = MockFunctionCallError( + "niSE_OpenSession" + ) mock_library.niSE_OpenSession.return_value = 0 - mock_library.niSE_WaitForDebounce.side_effect = MockFunctionCallError("niSE_WaitForDebounce") + mock_library.niSE_WaitForDebounce.side_effect = MockFunctionCallError( + "niSE_WaitForDebounce" + ) mock_library.niSE_WaitForDebounce.return_value = 0 diff --git a/generated/nise/setup.py b/generated/nise/setup.py index 3a5d2e322..ded73f4ba 100644 --- a/generated/nise/setup.py +++ b/generated/nise/setup.py @@ -15,41 +15,44 @@ def finalize_options(self): def run_tests(self): import pytest + pytest.main(self.test_args) -pypi_name = 'nise' +pypi_name = "nise" def read_contents(file_to_read): - with open(file_to_read, 'r') as f: + with open(file_to_read, "r") as f: return f.read() setup( name=pypi_name, zip_safe=True, - version='1.4.2.dev0', - description='NI Switch Executive Python API', - long_description=read_contents('README.rst'), - long_description_content_type='text/x-rst', - author='NI', + version="1.4.2.dev0", + description="NI Switch Executive Python API", + long_description=read_contents("README.rst"), + long_description_content_type="text/x-rst", + author="NI", author_email="opensource@ni.com", url="https://github.com/ni/nimi-python", maintainer="NI", maintainer_email="opensource@ni.com", - keywords=['nise'], - license='MIT', + keywords=["nise"], + license="MIT", include_package_data=True, - packages=['nise'], + packages=["nise"], install_requires=[ 'enum34;python_version<"3.4"', 'singledispatch;python_version<"3.4"', - 'hightime>=0.2.0', + "hightime>=0.2.0", + ], + setup_requires=[ + "pytest-runner", ], - setup_requires=['pytest-runner', ], - tests_require=['pytest'], - test_suite='tests', + tests_require=["pytest"], + test_suite="tests", classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -64,8 +67,8 @@ def read_contents(file_to_read): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", - "Topic :: System :: Hardware :: Hardware Drivers" + "Topic :: System :: Hardware :: Hardware Drivers", ], - cmdclass={'test': PyTest}, - package_data={pypi_name: ['VERSION']}, + cmdclass={"test": PyTest}, + package_data={pypi_name: ["VERSION"]}, ) diff --git a/generated/niswitch/niswitch/__init__.py b/generated/niswitch/niswitch/__init__.py index a3318b471..200a683a6 100644 --- a/generated/niswitch/niswitch/__init__.py +++ b/generated/niswitch/niswitch/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = '1.4.2.dev0' +__version__ = "1.4.2.dev0" from niswitch.enums import * # noqa: F403,F401,H303 from niswitch.errors import DriverWarning # noqa: F401 @@ -11,12 +11,12 @@ def get_diagnostic_information(): - '''Get diagnostic information about the system state that is suitable for printing or logging + """Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - ''' + """ import os import pkg_resources import platform @@ -24,73 +24,80 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return (struct.calcsize("P") == 8) + return struct.calcsize("P") == 8 def is_os_64bit(): - return platform.machine().endswith('64') + return platform.machine().endswith("64") def is_venv(): - return 'VIRTUAL_ENV' in os.environ + return "VIRTUAL_ENV" in os.environ info = {} - info['os'] = {} - info['python'] = {} - info['driver'] = {} - info['module'] = {} - if platform.system() == 'Windows': + info["os"] = {} + info["python"] = {} + info["driver"] = {} + info["module"] = {} + if platform.system() == "Windows": try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = 'Windows' + os_name = "Windows" try: - driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-SWITCH\CurrentVersion") + driver_version_key = winreg.OpenKey( + winreg.HKEY_LOCAL_MACHINE, + r"SOFTWARE\National Instruments\NI-SWITCH\CurrentVersion", + ) driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = 'Unknown' - elif platform.system() == 'Linux': - os_name = 'Linux' - driver_version = 'Unknown' + driver_version = "Unknown" + elif platform.system() == "Linux": + os_name = "Linux" + driver_version = "Unknown" else: - raise SystemError('Unsupported platform: {}'.format(platform.system())) + raise SystemError("Unsupported platform: {}".format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] - - info['os']['name'] = os_name - info['os']['version'] = platform.version() - info['os']['bits'] = '64' if is_os_64bit() else '32' - info['driver']['name'] = "NI-SWITCH" - info['driver']['version'] = driver_version - info['module']['name'] = 'niswitch' - info['module']['version'] = "1.4.2.dev0" - info['python']['version'] = sys.version - info['python']['bits'] = '64' if is_python_64bit() else '32' - info['python']['is_venv'] = is_venv() - info['python']['packages'] = installed_packages_list + installed_packages_list = [ + { + "name": i.key, + "version": i.version, + } + for i in installed_packages + ] + + info["os"]["name"] = os_name + info["os"]["version"] = platform.version() + info["os"]["bits"] = "64" if is_os_64bit() else "32" + info["driver"]["name"] = "NI-SWITCH" + info["driver"]["version"] = driver_version + info["module"]["name"] = "niswitch" + info["module"]["version"] = "1.4.2.dev0" + info["python"]["version"] = sys.version + info["python"]["bits"] = "64" if is_python_64bit() else "32" + info["python"]["is_venv"] = is_venv() + info["python"]["packages"] = installed_packages_list return info def print_diagnostic_information(): - '''Print diagnostic information in a format suitable for issue report + """Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - ''' + """ info = get_diagnostic_information() - row_format = ' {:<10} {}' - for type in ['OS', 'Driver', 'Module', 'Python']: + row_format = " {:<10} {}" + for type in ["OS", "Driver", "Module", "Python"]: typename = type.lower() - print(type + ':') + print(type + ":") for item in info[typename]: - if item != 'packages': - print(row_format.format(item.title() + ':', info[typename][item])) - print(' Installed Packages:') - for p in info['python']['packages']: - print((' ' * 8) + p['name'] + '==' + p['version']) + if item != "packages": + print(row_format.format(item.title() + ":", info[typename][item])) + print(" Installed Packages:") + for p in info["python"]["packages"]: + print((" " * 8) + p["name"] + "==" + p["version"]) return info - - diff --git a/generated/niswitch/niswitch/_attributes.py b/generated/niswitch/niswitch/_attributes.py index ea564a33e..c003081d8 100644 --- a/generated/niswitch/niswitch/_attributes.py +++ b/generated/niswitch/niswitch/_attributes.py @@ -6,14 +6,13 @@ class Attribute(object): - '''Base class for all typed attributes.''' + """Base class for all typed attributes.""" def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -22,16 +21,19 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) + return hightime.timedelta( + milliseconds=session._get_attribute_vi_int32(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) + session._set_attribute_vi_int32( + self._attribute_id, + _converters.convert_timedelta_to_milliseconds_int32(value).value, + ) class AttributeViInt64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -40,7 +42,6 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -49,16 +50,19 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) + return hightime.timedelta( + seconds=session._get_attribute_vi_real64(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) + session._set_attribute_vi_real64( + self._attribute_id, + _converters.convert_timedelta_to_seconds_real64(value).value, + ) class AttributeViString(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -67,16 +71,17 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) + session._set_attribute_vi_string( + self._attribute_id, + _converters.convert_repeated_capabilities_without_prefix(value), + ) class AttributeViBoolean(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -85,31 +90,36 @@ def __set__(self, session, value): class AttributeEnum(object): - def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) + return self._attribute_type( + self._underlying_attribute.__get__(session, session_type) + ) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) + raise TypeError( + "must be " + + str(self._attribute_type.__name__) + + " not " + + str(type(value).__name__) + ) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): - def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from niswitch.session import SessionReference + return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) - - - + session._set_attribute_vi_session( + self._attribute_id, _converters.convert_to_nitclk_session_number(value) + ) diff --git a/generated/niswitch/niswitch/_converters.py b/generated/niswitch/niswitch/_converters.py index 02af41b77..a336125ed 100644 --- a/generated/niswitch/niswitch/_converters.py +++ b/generated/niswitch/niswitch/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - '''Base version that should not be called + """Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,36 +40,38 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - ''' - raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + """ + raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - '''Integer version''' + """Integer version""" return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - '''String version (this is the most complex) + """String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - ''' + """ # First we deal with a list - rep_cap_list = repeated_capability.split(',') + rep_cap_list = repeated_capability.split(",") if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, '').replace(':', '-') - rc = r.split('-') + r = repeated_capability.strip().replace(prefix, "").replace(":", "-") + rc = r.split("-") if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + raise errors.InvalidRepeatedCapabilityError( + "Multiple '-' or ':'", repeated_capability + ) try: start = int(rc[0]) end = int(rc[1]) @@ -85,7 +87,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, '').strip()] + return [repeated_capability.replace(prefix, "").strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -94,7 +96,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - '''Iterable version - can handle lists, ranges, and tuples''' + """Iterable version - can handle lists, ranges, and tuples""" rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -103,16 +105,22 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - '''slice version''' + """slice version""" + def ifnone(a, b): return b if a is None else a + # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) + rng = range( + ifnone(repeated_capability.start, 0), + repeated_capability.stop, + ifnone(repeated_capability.step, 1), + ) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=''): - '''Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=""): + """Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -120,15 +128,17 @@ def convert_repeated_capabilities(repeated_capability, prefix=''): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - ''' + """ # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] + return [ + prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) + ] def convert_repeated_capabilities_without_prefix(repeated_capability): - '''Convert a repeated capabilities object, without any prefix, to a comma delimited list + """Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -144,8 +154,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - ''' - return ','.join(convert_repeated_capabilities(repeated_capability, '')) + """ + return ",".join(convert_repeated_capabilities(repeated_capability, "")) def _convert_timedelta(value, library_type, scaling): @@ -158,7 +168,14 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: + if library_type in [ + _visatype.ViInt64, + _visatype.ViInt32, + _visatype.ViUInt32, + _visatype.ViInt16, + _visatype.ViUInt16, + _visatype.ViInt8, + ]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -195,34 +212,36 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - 'rangecheck': 'RangeCheck', - 'queryinstrstatus': 'QueryInstrStatus', - 'cache': 'Cache', - 'simulate': 'Simulate', - 'recordcoercions': 'RecordCoercions', - 'interchangecheck': 'InterchangeCheck', - 'driversetup': 'DriverSetup', - 'range_check': 'RangeCheck', - 'query_instr_status': 'QueryInstrStatus', - 'record_coercions': 'RecordCoercions', - 'interchange_check': 'InterchangeCheck', - 'driver_setup': 'DriverSetup', + "rangecheck": "RangeCheck", + "queryinstrstatus": "QueryInstrStatus", + "cache": "Cache", + "simulate": "Simulate", + "recordcoercions": "RecordCoercions", + "interchangecheck": "InterchangeCheck", + "driversetup": "DriverSetup", + "range_check": "RangeCheck", + "query_instr_status": "QueryInstrStatus", + "record_coercions": "RecordCoercions", + "interchange_check": "InterchangeCheck", + "driver_setup": "DriverSetup", } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': - value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') - elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': + if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": + value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") + elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": if not isinstance(values[k], dict): - raise TypeError('DriverSetup must be a dictionary') - value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) + raise TypeError("DriverSetup must be a dictionary") + value = "DriverSetup=" + ( + ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) + ) else: - value = k + ('=1' if values[k] is True else '=0') + value = k + ("=1" if values[k] is True else "=0") init_with_options.append(value) - init_with_options_string = ','.join(init_with_options) + init_with_options_string = ",".join(init_with_options) return init_with_options_string @@ -251,11 +270,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(',')] + return [x.strip() for x in comma_separated_string.split(",")] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -267,11 +286,17 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - ''' - chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) - repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] + """ + chained_repeated_capability_items = convert_comma_separated_string_to_list( + chained_repeated_capability + ) + repeated_capability_lists = [ + [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) + ] for item in chained_repeated_capability_items: - repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] - return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] - - + repeated_capability_lists = [ + x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) + ] + return [ + ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists + ] diff --git a/generated/niswitch/niswitch/_library.py b/generated/niswitch/niswitch/_library.py index 3af994c65..0e796b1c2 100644 --- a/generated/niswitch/niswitch/_library.py +++ b/generated/niswitch/niswitch/_library.py @@ -9,11 +9,11 @@ class Library(object): - '''Library + """Library Wrapper around driver library. Class will setup the correct ctypes information for every function on first call. - ''' + """ def __init__(self, ctypes_library): self._func_lock = threading.Lock() @@ -69,23 +69,36 @@ def _get_library_function(self, name): def niSwitch_AbortScan(self, vi): # noqa: N802 with self._func_lock: if self.niSwitch_AbortScan_cfunc is None: - self.niSwitch_AbortScan_cfunc = self._get_library_function('niSwitch_AbortScan') + self.niSwitch_AbortScan_cfunc = self._get_library_function( + "niSwitch_AbortScan" + ) self.niSwitch_AbortScan_cfunc.argtypes = [ViSession] # noqa: F405 self.niSwitch_AbortScan_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_AbortScan_cfunc(vi) - def niSwitch_CanConnect(self, vi, channel1, channel2, path_capability): # noqa: N802 + def niSwitch_CanConnect( + self, vi, channel1, channel2, path_capability + ): # noqa: N802 with self._func_lock: if self.niSwitch_CanConnect_cfunc is None: - self.niSwitch_CanConnect_cfunc = self._get_library_function('niSwitch_CanConnect') - self.niSwitch_CanConnect_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niSwitch_CanConnect_cfunc = self._get_library_function( + "niSwitch_CanConnect" + ) + self.niSwitch_CanConnect_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niSwitch_CanConnect_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_CanConnect_cfunc(vi, channel1, channel2, path_capability) def niSwitch_Commit(self, vi): # noqa: N802 with self._func_lock: if self.niSwitch_Commit_cfunc is None: - self.niSwitch_Commit_cfunc = self._get_library_function('niSwitch_Commit') + self.niSwitch_Commit_cfunc = self._get_library_function( + "niSwitch_Commit" + ) self.niSwitch_Commit_cfunc.argtypes = [ViSession] # noqa: F405 self.niSwitch_Commit_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_Commit_cfunc(vi) @@ -93,23 +106,36 @@ def niSwitch_Commit(self, vi): # noqa: N802 def niSwitch_Connect(self, vi, channel1, channel2): # noqa: N802 with self._func_lock: if self.niSwitch_Connect_cfunc is None: - self.niSwitch_Connect_cfunc = self._get_library_function('niSwitch_Connect') - self.niSwitch_Connect_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar)] # noqa: F405 + self.niSwitch_Connect_cfunc = self._get_library_function( + "niSwitch_Connect" + ) + self.niSwitch_Connect_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niSwitch_Connect_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_Connect_cfunc(vi, channel1, channel2) def niSwitch_ConnectMultiple(self, vi, connection_list): # noqa: N802 with self._func_lock: if self.niSwitch_ConnectMultiple_cfunc is None: - self.niSwitch_ConnectMultiple_cfunc = self._get_library_function('niSwitch_ConnectMultiple') - self.niSwitch_ConnectMultiple_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niSwitch_ConnectMultiple_cfunc = self._get_library_function( + "niSwitch_ConnectMultiple" + ) + self.niSwitch_ConnectMultiple_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niSwitch_ConnectMultiple_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_ConnectMultiple_cfunc(vi, connection_list) def niSwitch_Disable(self, vi): # noqa: N802 with self._func_lock: if self.niSwitch_Disable_cfunc is None: - self.niSwitch_Disable_cfunc = self._get_library_function('niSwitch_Disable') + self.niSwitch_Disable_cfunc = self._get_library_function( + "niSwitch_Disable" + ) self.niSwitch_Disable_cfunc.argtypes = [ViSession] # noqa: F405 self.niSwitch_Disable_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_Disable_cfunc(vi) @@ -117,15 +143,23 @@ def niSwitch_Disable(self, vi): # noqa: N802 def niSwitch_Disconnect(self, vi, channel1, channel2): # noqa: N802 with self._func_lock: if self.niSwitch_Disconnect_cfunc is None: - self.niSwitch_Disconnect_cfunc = self._get_library_function('niSwitch_Disconnect') - self.niSwitch_Disconnect_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar)] # noqa: F405 + self.niSwitch_Disconnect_cfunc = self._get_library_function( + "niSwitch_Disconnect" + ) + self.niSwitch_Disconnect_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niSwitch_Disconnect_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_Disconnect_cfunc(vi, channel1, channel2) def niSwitch_DisconnectAll(self, vi): # noqa: N802 with self._func_lock: if self.niSwitch_DisconnectAll_cfunc is None: - self.niSwitch_DisconnectAll_cfunc = self._get_library_function('niSwitch_DisconnectAll') + self.niSwitch_DisconnectAll_cfunc = self._get_library_function( + "niSwitch_DisconnectAll" + ) self.niSwitch_DisconnectAll_cfunc.argtypes = [ViSession] # noqa: F405 self.niSwitch_DisconnectAll_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_DisconnectAll_cfunc(vi) @@ -133,103 +167,222 @@ def niSwitch_DisconnectAll(self, vi): # noqa: N802 def niSwitch_DisconnectMultiple(self, vi, disconnection_list): # noqa: N802 with self._func_lock: if self.niSwitch_DisconnectMultiple_cfunc is None: - self.niSwitch_DisconnectMultiple_cfunc = self._get_library_function('niSwitch_DisconnectMultiple') - self.niSwitch_DisconnectMultiple_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niSwitch_DisconnectMultiple_cfunc = self._get_library_function( + "niSwitch_DisconnectMultiple" + ) + self.niSwitch_DisconnectMultiple_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niSwitch_DisconnectMultiple_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_DisconnectMultiple_cfunc(vi, disconnection_list) - def niSwitch_GetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niSwitch_GetAttributeViBoolean( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niSwitch_GetAttributeViBoolean_cfunc is None: - self.niSwitch_GetAttributeViBoolean_cfunc = self._get_library_function('niSwitch_GetAttributeViBoolean') - self.niSwitch_GetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViBoolean)] # noqa: F405 - self.niSwitch_GetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 - return self.niSwitch_GetAttributeViBoolean_cfunc(vi, channel_name, attribute_id, attribute_value) - - def niSwitch_GetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + self.niSwitch_GetAttributeViBoolean_cfunc = self._get_library_function( + "niSwitch_GetAttributeViBoolean" + ) + self.niSwitch_GetAttributeViBoolean_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 + self.niSwitch_GetAttributeViBoolean_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niSwitch_GetAttributeViBoolean_cfunc( + vi, channel_name, attribute_id, attribute_value + ) + + def niSwitch_GetAttributeViInt32( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niSwitch_GetAttributeViInt32_cfunc is None: - self.niSwitch_GetAttributeViInt32_cfunc = self._get_library_function('niSwitch_GetAttributeViInt32') - self.niSwitch_GetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViInt32)] # noqa: F405 + self.niSwitch_GetAttributeViInt32_cfunc = self._get_library_function( + "niSwitch_GetAttributeViInt32" + ) + self.niSwitch_GetAttributeViInt32_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niSwitch_GetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niSwitch_GetAttributeViInt32_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niSwitch_GetAttributeViInt32_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niSwitch_GetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niSwitch_GetAttributeViReal64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niSwitch_GetAttributeViReal64_cfunc is None: - self.niSwitch_GetAttributeViReal64_cfunc = self._get_library_function('niSwitch_GetAttributeViReal64') - self.niSwitch_GetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViReal64)] # noqa: F405 - self.niSwitch_GetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niSwitch_GetAttributeViReal64_cfunc(vi, channel_name, attribute_id, attribute_value) - - def niSwitch_GetAttributeViString(self, vi, channel_name, attribute_id, array_size, attribute_value): # noqa: N802 + self.niSwitch_GetAttributeViReal64_cfunc = self._get_library_function( + "niSwitch_GetAttributeViReal64" + ) + self.niSwitch_GetAttributeViReal64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViReal64), + ] # noqa: F405 + self.niSwitch_GetAttributeViReal64_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niSwitch_GetAttributeViReal64_cfunc( + vi, channel_name, attribute_id, attribute_value + ) + + def niSwitch_GetAttributeViString( + self, vi, channel_name, attribute_id, array_size, attribute_value + ): # noqa: N802 with self._func_lock: if self.niSwitch_GetAttributeViString_cfunc is None: - self.niSwitch_GetAttributeViString_cfunc = self._get_library_function('niSwitch_GetAttributeViString') - self.niSwitch_GetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 - self.niSwitch_GetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niSwitch_GetAttributeViString_cfunc(vi, channel_name, attribute_id, array_size, attribute_value) - - def niSwitch_GetChannelName(self, vi, index, buffer_size, channel_name_buffer): # noqa: N802 + self.niSwitch_GetAttributeViString_cfunc = self._get_library_function( + "niSwitch_GetAttributeViString" + ) + self.niSwitch_GetAttributeViString_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niSwitch_GetAttributeViString_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niSwitch_GetAttributeViString_cfunc( + vi, channel_name, attribute_id, array_size, attribute_value + ) + + def niSwitch_GetChannelName( + self, vi, index, buffer_size, channel_name_buffer + ): # noqa: N802 with self._func_lock: if self.niSwitch_GetChannelName_cfunc is None: - self.niSwitch_GetChannelName_cfunc = self._get_library_function('niSwitch_GetChannelName') - self.niSwitch_GetChannelName_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niSwitch_GetChannelName_cfunc = self._get_library_function( + "niSwitch_GetChannelName" + ) + self.niSwitch_GetChannelName_cfunc.argtypes = [ + ViSession, + ViInt32, + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niSwitch_GetChannelName_cfunc.restype = ViStatus # noqa: F405 - return self.niSwitch_GetChannelName_cfunc(vi, index, buffer_size, channel_name_buffer) + return self.niSwitch_GetChannelName_cfunc( + vi, index, buffer_size, channel_name_buffer + ) def niSwitch_GetError(self, vi, code, buffer_size, description): # noqa: N802 with self._func_lock: if self.niSwitch_GetError_cfunc is None: - self.niSwitch_GetError_cfunc = self._get_library_function('niSwitch_GetError') - self.niSwitch_GetError_cfunc.argtypes = [ViSession, ctypes.POINTER(ViStatus), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niSwitch_GetError_cfunc = self._get_library_function( + "niSwitch_GetError" + ) + self.niSwitch_GetError_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViStatus), + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niSwitch_GetError_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_GetError_cfunc(vi, code, buffer_size, description) def niSwitch_GetPath(self, vi, channel1, channel2, buffer_size, path): # noqa: N802 with self._func_lock: if self.niSwitch_GetPath_cfunc is None: - self.niSwitch_GetPath_cfunc = self._get_library_function('niSwitch_GetPath') - self.niSwitch_GetPath_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niSwitch_GetPath_cfunc = self._get_library_function( + "niSwitch_GetPath" + ) + self.niSwitch_GetPath_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niSwitch_GetPath_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_GetPath_cfunc(vi, channel1, channel2, buffer_size, path) def niSwitch_GetRelayCount(self, vi, relay_name, relay_count): # noqa: N802 with self._func_lock: if self.niSwitch_GetRelayCount_cfunc is None: - self.niSwitch_GetRelayCount_cfunc = self._get_library_function('niSwitch_GetRelayCount') - self.niSwitch_GetRelayCount_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niSwitch_GetRelayCount_cfunc = self._get_library_function( + "niSwitch_GetRelayCount" + ) + self.niSwitch_GetRelayCount_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niSwitch_GetRelayCount_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_GetRelayCount_cfunc(vi, relay_name, relay_count) - def niSwitch_GetRelayName(self, vi, index, relay_name_buffer_size, relay_name_buffer): # noqa: N802 + def niSwitch_GetRelayName( + self, vi, index, relay_name_buffer_size, relay_name_buffer + ): # noqa: N802 with self._func_lock: if self.niSwitch_GetRelayName_cfunc is None: - self.niSwitch_GetRelayName_cfunc = self._get_library_function('niSwitch_GetRelayName') - self.niSwitch_GetRelayName_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niSwitch_GetRelayName_cfunc = self._get_library_function( + "niSwitch_GetRelayName" + ) + self.niSwitch_GetRelayName_cfunc.argtypes = [ + ViSession, + ViInt32, + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niSwitch_GetRelayName_cfunc.restype = ViStatus # noqa: F405 - return self.niSwitch_GetRelayName_cfunc(vi, index, relay_name_buffer_size, relay_name_buffer) + return self.niSwitch_GetRelayName_cfunc( + vi, index, relay_name_buffer_size, relay_name_buffer + ) def niSwitch_GetRelayPosition(self, vi, relay_name, relay_position): # noqa: N802 with self._func_lock: if self.niSwitch_GetRelayPosition_cfunc is None: - self.niSwitch_GetRelayPosition_cfunc = self._get_library_function('niSwitch_GetRelayPosition') - self.niSwitch_GetRelayPosition_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niSwitch_GetRelayPosition_cfunc = self._get_library_function( + "niSwitch_GetRelayPosition" + ) + self.niSwitch_GetRelayPosition_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ctypes.POINTER(ViInt32), + ] # noqa: F405 self.niSwitch_GetRelayPosition_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_GetRelayPosition_cfunc(vi, relay_name, relay_position) - def niSwitch_InitWithTopology(self, resource_name, topology, simulate, reset_device, vi): # noqa: N802 + def niSwitch_InitWithTopology( + self, resource_name, topology, simulate, reset_device, vi + ): # noqa: N802 with self._func_lock: if self.niSwitch_InitWithTopology_cfunc is None: - self.niSwitch_InitWithTopology_cfunc = self._get_library_function('niSwitch_InitWithTopology') - self.niSwitch_InitWithTopology_cfunc.argtypes = [ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViBoolean, ViBoolean, ctypes.POINTER(ViSession)] # noqa: F405 + self.niSwitch_InitWithTopology_cfunc = self._get_library_function( + "niSwitch_InitWithTopology" + ) + self.niSwitch_InitWithTopology_cfunc.argtypes = [ + ctypes.POINTER(ViChar), + ctypes.POINTER(ViChar), + ViBoolean, + ViBoolean, + ctypes.POINTER(ViSession), + ] # noqa: F405 self.niSwitch_InitWithTopology_cfunc.restype = ViStatus # noqa: F405 - return self.niSwitch_InitWithTopology_cfunc(resource_name, topology, simulate, reset_device, vi) + return self.niSwitch_InitWithTopology_cfunc( + resource_name, topology, simulate, reset_device, vi + ) def niSwitch_InitiateScan(self, vi): # noqa: N802 with self._func_lock: if self.niSwitch_InitiateScan_cfunc is None: - self.niSwitch_InitiateScan_cfunc = self._get_library_function('niSwitch_InitiateScan') + self.niSwitch_InitiateScan_cfunc = self._get_library_function( + "niSwitch_InitiateScan" + ) self.niSwitch_InitiateScan_cfunc.argtypes = [ViSession] # noqa: F405 self.niSwitch_InitiateScan_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_InitiateScan_cfunc(vi) @@ -237,119 +390,232 @@ def niSwitch_InitiateScan(self, vi): # noqa: N802 def niSwitch_LockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niSwitch_LockSession_cfunc is None: - self.niSwitch_LockSession_cfunc = self._get_library_function('niSwitch_LockSession') - self.niSwitch_LockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niSwitch_LockSession_cfunc = self._get_library_function( + "niSwitch_LockSession" + ) + self.niSwitch_LockSession_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niSwitch_LockSession_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_LockSession_cfunc(vi, caller_has_lock) def niSwitch_RelayControl(self, vi, relay_name, relay_action): # noqa: N802 with self._func_lock: if self.niSwitch_RelayControl_cfunc is None: - self.niSwitch_RelayControl_cfunc = self._get_library_function('niSwitch_RelayControl') - self.niSwitch_RelayControl_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32] # noqa: F405 + self.niSwitch_RelayControl_cfunc = self._get_library_function( + "niSwitch_RelayControl" + ) + self.niSwitch_RelayControl_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViInt32, + ] # noqa: F405 self.niSwitch_RelayControl_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_RelayControl_cfunc(vi, relay_name, relay_action) def niSwitch_ResetWithDefaults(self, vi): # noqa: N802 with self._func_lock: if self.niSwitch_ResetWithDefaults_cfunc is None: - self.niSwitch_ResetWithDefaults_cfunc = self._get_library_function('niSwitch_ResetWithDefaults') - self.niSwitch_ResetWithDefaults_cfunc.argtypes = [ViSession] # noqa: F405 + self.niSwitch_ResetWithDefaults_cfunc = self._get_library_function( + "niSwitch_ResetWithDefaults" + ) + self.niSwitch_ResetWithDefaults_cfunc.argtypes = [ + ViSession + ] # noqa: F405 self.niSwitch_ResetWithDefaults_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_ResetWithDefaults_cfunc(vi) - def niSwitch_RouteScanAdvancedOutput(self, vi, scan_advanced_output_connector, scan_advanced_output_bus_line, invert): # noqa: N802 + def niSwitch_RouteScanAdvancedOutput( + self, vi, scan_advanced_output_connector, scan_advanced_output_bus_line, invert + ): # noqa: N802 with self._func_lock: if self.niSwitch_RouteScanAdvancedOutput_cfunc is None: - self.niSwitch_RouteScanAdvancedOutput_cfunc = self._get_library_function('niSwitch_RouteScanAdvancedOutput') - self.niSwitch_RouteScanAdvancedOutput_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ViBoolean] # noqa: F405 - self.niSwitch_RouteScanAdvancedOutput_cfunc.restype = ViStatus # noqa: F405 - return self.niSwitch_RouteScanAdvancedOutput_cfunc(vi, scan_advanced_output_connector, scan_advanced_output_bus_line, invert) - - def niSwitch_RouteTriggerInput(self, vi, trigger_input_connector, trigger_input_bus_line, invert): # noqa: N802 + self.niSwitch_RouteScanAdvancedOutput_cfunc = ( + self._get_library_function("niSwitch_RouteScanAdvancedOutput") + ) + self.niSwitch_RouteScanAdvancedOutput_cfunc.argtypes = [ + ViSession, + ViInt32, + ViInt32, + ViBoolean, + ] # noqa: F405 + self.niSwitch_RouteScanAdvancedOutput_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niSwitch_RouteScanAdvancedOutput_cfunc( + vi, scan_advanced_output_connector, scan_advanced_output_bus_line, invert + ) + + def niSwitch_RouteTriggerInput( + self, vi, trigger_input_connector, trigger_input_bus_line, invert + ): # noqa: N802 with self._func_lock: if self.niSwitch_RouteTriggerInput_cfunc is None: - self.niSwitch_RouteTriggerInput_cfunc = self._get_library_function('niSwitch_RouteTriggerInput') - self.niSwitch_RouteTriggerInput_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ViBoolean] # noqa: F405 + self.niSwitch_RouteTriggerInput_cfunc = self._get_library_function( + "niSwitch_RouteTriggerInput" + ) + self.niSwitch_RouteTriggerInput_cfunc.argtypes = [ + ViSession, + ViInt32, + ViInt32, + ViBoolean, + ] # noqa: F405 self.niSwitch_RouteTriggerInput_cfunc.restype = ViStatus # noqa: F405 - return self.niSwitch_RouteTriggerInput_cfunc(vi, trigger_input_connector, trigger_input_bus_line, invert) + return self.niSwitch_RouteTriggerInput_cfunc( + vi, trigger_input_connector, trigger_input_bus_line, invert + ) def niSwitch_SendSoftwareTrigger(self, vi): # noqa: N802 with self._func_lock: if self.niSwitch_SendSoftwareTrigger_cfunc is None: - self.niSwitch_SendSoftwareTrigger_cfunc = self._get_library_function('niSwitch_SendSoftwareTrigger') - self.niSwitch_SendSoftwareTrigger_cfunc.argtypes = [ViSession] # noqa: F405 + self.niSwitch_SendSoftwareTrigger_cfunc = self._get_library_function( + "niSwitch_SendSoftwareTrigger" + ) + self.niSwitch_SendSoftwareTrigger_cfunc.argtypes = [ + ViSession + ] # noqa: F405 self.niSwitch_SendSoftwareTrigger_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_SendSoftwareTrigger_cfunc(vi) - def niSwitch_SetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niSwitch_SetAttributeViBoolean( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niSwitch_SetAttributeViBoolean_cfunc is None: - self.niSwitch_SetAttributeViBoolean_cfunc = self._get_library_function('niSwitch_SetAttributeViBoolean') - self.niSwitch_SetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViBoolean] # noqa: F405 - self.niSwitch_SetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 - return self.niSwitch_SetAttributeViBoolean_cfunc(vi, channel_name, attribute_id, attribute_value) - - def niSwitch_SetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + self.niSwitch_SetAttributeViBoolean_cfunc = self._get_library_function( + "niSwitch_SetAttributeViBoolean" + ) + self.niSwitch_SetAttributeViBoolean_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViBoolean, + ] # noqa: F405 + self.niSwitch_SetAttributeViBoolean_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niSwitch_SetAttributeViBoolean_cfunc( + vi, channel_name, attribute_id, attribute_value + ) + + def niSwitch_SetAttributeViInt32( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niSwitch_SetAttributeViInt32_cfunc is None: - self.niSwitch_SetAttributeViInt32_cfunc = self._get_library_function('niSwitch_SetAttributeViInt32') - self.niSwitch_SetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32] # noqa: F405 + self.niSwitch_SetAttributeViInt32_cfunc = self._get_library_function( + "niSwitch_SetAttributeViInt32" + ) + self.niSwitch_SetAttributeViInt32_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViInt32, + ] # noqa: F405 self.niSwitch_SetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niSwitch_SetAttributeViInt32_cfunc(vi, channel_name, attribute_id, attribute_value) + return self.niSwitch_SetAttributeViInt32_cfunc( + vi, channel_name, attribute_id, attribute_value + ) - def niSwitch_SetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + def niSwitch_SetAttributeViReal64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niSwitch_SetAttributeViReal64_cfunc is None: - self.niSwitch_SetAttributeViReal64_cfunc = self._get_library_function('niSwitch_SetAttributeViReal64') - self.niSwitch_SetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViReal64] # noqa: F405 - self.niSwitch_SetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niSwitch_SetAttributeViReal64_cfunc(vi, channel_name, attribute_id, attribute_value) - - def niSwitch_SetAttributeViString(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + self.niSwitch_SetAttributeViReal64_cfunc = self._get_library_function( + "niSwitch_SetAttributeViReal64" + ) + self.niSwitch_SetAttributeViReal64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViReal64, + ] # noqa: F405 + self.niSwitch_SetAttributeViReal64_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niSwitch_SetAttributeViReal64_cfunc( + vi, channel_name, attribute_id, attribute_value + ) + + def niSwitch_SetAttributeViString( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 with self._func_lock: if self.niSwitch_SetAttributeViString_cfunc is None: - self.niSwitch_SetAttributeViString_cfunc = self._get_library_function('niSwitch_SetAttributeViString') - self.niSwitch_SetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViChar)] # noqa: F405 - self.niSwitch_SetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niSwitch_SetAttributeViString_cfunc(vi, channel_name, attribute_id, attribute_value) + self.niSwitch_SetAttributeViString_cfunc = self._get_library_function( + "niSwitch_SetAttributeViString" + ) + self.niSwitch_SetAttributeViString_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViChar), + ] # noqa: F405 + self.niSwitch_SetAttributeViString_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niSwitch_SetAttributeViString_cfunc( + vi, channel_name, attribute_id, attribute_value + ) def niSwitch_SetPath(self, vi, path_list): # noqa: N802 with self._func_lock: if self.niSwitch_SetPath_cfunc is None: - self.niSwitch_SetPath_cfunc = self._get_library_function('niSwitch_SetPath') - self.niSwitch_SetPath_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niSwitch_SetPath_cfunc = self._get_library_function( + "niSwitch_SetPath" + ) + self.niSwitch_SetPath_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niSwitch_SetPath_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_SetPath_cfunc(vi, path_list) def niSwitch_UnlockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niSwitch_UnlockSession_cfunc is None: - self.niSwitch_UnlockSession_cfunc = self._get_library_function('niSwitch_UnlockSession') - self.niSwitch_UnlockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niSwitch_UnlockSession_cfunc = self._get_library_function( + "niSwitch_UnlockSession" + ) + self.niSwitch_UnlockSession_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niSwitch_UnlockSession_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_UnlockSession_cfunc(vi, caller_has_lock) def niSwitch_WaitForDebounce(self, vi, maximum_time_ms): # noqa: N802 with self._func_lock: if self.niSwitch_WaitForDebounce_cfunc is None: - self.niSwitch_WaitForDebounce_cfunc = self._get_library_function('niSwitch_WaitForDebounce') - self.niSwitch_WaitForDebounce_cfunc.argtypes = [ViSession, ViInt32] # noqa: F405 + self.niSwitch_WaitForDebounce_cfunc = self._get_library_function( + "niSwitch_WaitForDebounce" + ) + self.niSwitch_WaitForDebounce_cfunc.argtypes = [ + ViSession, + ViInt32, + ] # noqa: F405 self.niSwitch_WaitForDebounce_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_WaitForDebounce_cfunc(vi, maximum_time_ms) def niSwitch_WaitForScanComplete(self, vi, maximum_time_ms): # noqa: N802 with self._func_lock: if self.niSwitch_WaitForScanComplete_cfunc is None: - self.niSwitch_WaitForScanComplete_cfunc = self._get_library_function('niSwitch_WaitForScanComplete') - self.niSwitch_WaitForScanComplete_cfunc.argtypes = [ViSession, ViInt32] # noqa: F405 + self.niSwitch_WaitForScanComplete_cfunc = self._get_library_function( + "niSwitch_WaitForScanComplete" + ) + self.niSwitch_WaitForScanComplete_cfunc.argtypes = [ + ViSession, + ViInt32, + ] # noqa: F405 self.niSwitch_WaitForScanComplete_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_WaitForScanComplete_cfunc(vi, maximum_time_ms) def niSwitch_close(self, vi): # noqa: N802 with self._func_lock: if self.niSwitch_close_cfunc is None: - self.niSwitch_close_cfunc = self._get_library_function('niSwitch_close') + self.niSwitch_close_cfunc = self._get_library_function("niSwitch_close") self.niSwitch_close_cfunc.argtypes = [ViSession] # noqa: F405 self.niSwitch_close_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_close_cfunc(vi) @@ -357,15 +623,21 @@ def niSwitch_close(self, vi): # noqa: N802 def niSwitch_error_message(self, vi, error_code, error_message): # noqa: N802 with self._func_lock: if self.niSwitch_error_message_cfunc is None: - self.niSwitch_error_message_cfunc = self._get_library_function('niSwitch_error_message') - self.niSwitch_error_message_cfunc.argtypes = [ViSession, ViStatus, ctypes.POINTER(ViChar)] # noqa: F405 + self.niSwitch_error_message_cfunc = self._get_library_function( + "niSwitch_error_message" + ) + self.niSwitch_error_message_cfunc.argtypes = [ + ViSession, + ViStatus, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niSwitch_error_message_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_error_message_cfunc(vi, error_code, error_message) def niSwitch_reset(self, vi): # noqa: N802 with self._func_lock: if self.niSwitch_reset_cfunc is None: - self.niSwitch_reset_cfunc = self._get_library_function('niSwitch_reset') + self.niSwitch_reset_cfunc = self._get_library_function("niSwitch_reset") self.niSwitch_reset_cfunc.argtypes = [ViSession] # noqa: F405 self.niSwitch_reset_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_reset_cfunc(vi) @@ -373,7 +645,13 @@ def niSwitch_reset(self, vi): # noqa: N802 def niSwitch_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 with self._func_lock: if self.niSwitch_self_test_cfunc is None: - self.niSwitch_self_test_cfunc = self._get_library_function('niSwitch_self_test') - self.niSwitch_self_test_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt16), ctypes.POINTER(ViChar)] # noqa: F405 + self.niSwitch_self_test_cfunc = self._get_library_function( + "niSwitch_self_test" + ) + self.niSwitch_self_test_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViInt16), + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niSwitch_self_test_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_self_test_cfunc(vi, self_test_result, self_test_message) diff --git a/generated/niswitch/niswitch/_library_singleton.py b/generated/niswitch/niswitch/_library_singleton.py index 5ddab9ad9..8ed94dea1 100644 --- a/generated/niswitch/niswitch/_library_singleton.py +++ b/generated/niswitch/niswitch/_library_singleton.py @@ -12,30 +12,36 @@ _instance = None _instance_lock = threading.Lock() -_library_info = {'Linux': {'64bit': {'name': 'niswitch', 'type': 'cdll'}}, - 'Windows': {'32bit': {'name': 'niswitch_32.dll', 'type': 'windll'}, - '64bit': {'name': 'niswitch_64.dll', 'type': 'cdll'}}} +_library_info = { + "Linux": {"64bit": {"name": "niswitch", "type": "cdll"}}, + "Windows": { + "32bit": {"name": "niswitch_32.dll", "type": "windll"}, + "64bit": {"name": "niswitch_64.dll", "type": "cdll"}, + }, +} def _get_library_name(): try: - return ctypes.util.find_library(_library_info[platform.system()][platform.architecture()[0]]['name']) # We find and return full path to the DLL + return ctypes.util.find_library( + _library_info[platform.system()][platform.architecture()[0]]["name"] + ) # We find and return full path to the DLL except KeyError: raise errors.UnsupportedConfigurationError def _get_library_type(): try: - return _library_info[platform.system()][platform.architecture()[0]]['type'] + return _library_info[platform.system()][platform.architecture()[0]]["type"] except KeyError: raise errors.UnsupportedConfigurationError def get(): - '''get + """get Returns the library.Library singleton for niswitch. - ''' + """ global _instance global _instance_lock @@ -43,13 +49,12 @@ def get(): if _instance is None: try: library_type = _get_library_type() - if library_type == 'windll': + if library_type == "windll": ctypes_library = ctypes.WinDLL(_get_library_name()) else: - assert library_type == 'cdll' + assert library_type == "cdll" ctypes_library = ctypes.CDLL(_get_library_name()) except OSError: raise errors.DriverNotInstalledError() _instance = _library.Library(ctypes_library) return _instance - diff --git a/generated/niswitch/niswitch/_visatype.py b/generated/niswitch/niswitch/_visatype.py index 02cc41d1b..bf96c3cfb 100644 --- a/generated/niswitch/niswitch/_visatype.py +++ b/generated/niswitch/niswitch/_visatype.py @@ -2,9 +2,9 @@ import ctypes -'''Definitions of the VISA types used by the C API of the driver runtime. +"""Definitions of the VISA types used by the C API of the driver runtime. These are aliased directly to ctypes types so can be used directly to call into the library. -''' +""" ViChar = ctypes.c_char @@ -26,4 +26,3 @@ ViAttr = ViUInt32 ViConstString = ViString ViRsrc = ViString - diff --git a/generated/niswitch/niswitch/enums.py b/generated/niswitch/niswitch/enums.py index a5ade1e6d..0390f3e67 100644 --- a/generated/niswitch/niswitch/enums.py +++ b/generated/niswitch/niswitch/enums.py @@ -6,7 +6,7 @@ class HandshakingInitiation(Enum): MEASUREMENT_DEVICE = 0 - r''' + r""" The `niSwitch Initiate Scan `__ VI does not return until the switch hardware is waiting for a trigger input. This @@ -18,9 +18,9 @@ class HandshakingInitiation(Enum): first take a measurement, send MC, then wait for scanner advanced output signal. Thus, the first MC of the measurement device initiates handshaking. - ''' + """ SWITCH = 1 - r''' + r""" The `niSwitch Initiate Scan `__ VI returns immediately after beginning scan list execution. It is assumed that the @@ -28,445 +28,445 @@ class HandshakingInitiation(Enum): scanner advanced signal. The measurement should be configured to first wait for a trigger, then take a measurement. Thus, the first scanner advanced output signal of the switch module initiates handshaking. - ''' + """ class PathCapability(Enum): PATH_AVAILABLE = 1 - r''' + r""" Path Available - ''' + """ PATH_EXISTS = 2 - r''' + r""" Path Exists - ''' + """ PATH_UNSUPPORTED = 3 - r''' + r""" Path Unsupported - ''' + """ RESOURCE_IN_USE = 4 - r''' + r""" Resource in use - ''' + """ SOURCE_CONFLICT = 5 - r''' + r""" Source conflict - ''' + """ CHANNEL_NOT_AVAILABLE = 6 - r''' + r""" Channel not available - ''' + """ class RelayAction(Enum): OPEN = 20 - r''' + r""" Open Relay - ''' + """ CLOSE = 21 - r''' + r""" Close Relay - ''' + """ class RelayPosition(Enum): OPEN = 10 - r''' + r""" Open - ''' + """ CLOSED = 11 - r''' + r""" Closed - ''' + """ class ScanAdvancedOutput(Enum): NONE = 0 - r''' + r""" The switch device does not produce a Scan Advanced Output trigger. - ''' + """ EXTERNAL = 2 - r''' + r""" External Trigger. The switch device produces the Scan Advanced Output trigger on the external trigger output. - ''' + """ TTL0 = 111 - r''' + r""" The switch device produces the Scan Advanced Output on the PXI TRIG0 line. - ''' + """ TTL1 = 112 - r''' + r""" The switch device produces the Scan Advanced Output on the PXI TRIG1 line. - ''' + """ TTL2 = 113 - r''' + r""" The switch device produces the Scan Advanced Output on the PXI TRIG2 line. - ''' + """ TTL3 = 114 - r''' + r""" The switch device produces the Scan Advanced Output on the PXI TRIG3 line. - ''' + """ TTL4 = 115 - r''' + r""" The switch device produces the Scan Advanced Output on the PXI TRIG4 line. - ''' + """ TTL5 = 116 - r''' + r""" The switch device produces the Scan Advanced Output on the PXI TRIG5 line. - ''' + """ TTL6 = 117 - r''' + r""" The switch device produces the Scan Advanced Output on the PXI TRIG6 line. - ''' + """ TTL7 = 118 - r''' + r""" The switch device produces the Scan Advanced Output on the PXI TRIG7 line. - ''' + """ PXI_STAR = 125 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the PXI Star trigger bus before processing the next entry in the scan list. - ''' + """ REARCONNECTOR = 1000 - r''' + r""" The switch device produces the Scan Advanced Output trigger on the rear connector. - ''' + """ FRONTCONNECTOR = 1001 - r''' + r""" The switch device produces the Scan Advanced Output trigger on the front connector. - ''' + """ REARCONNECTOR_MODULE1 = 1021 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the rear connector module 1. - ''' + """ REARCONNECTOR_MODULE2 = 1022 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the rear connector module 2. - ''' + """ REARCONNECTOR_MODULE3 = 1023 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the rear connector module 3. - ''' + """ REARCONNECTOR_MODULE4 = 1024 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the rear connector module 4. - ''' + """ REARCONNECTOR_MODULE5 = 1025 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the rear connector module 5. - ''' + """ REARCONNECTOR_MODULE6 = 1026 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the rear connector module 6. - ''' + """ REARCONNECTOR_MODULE7 = 1027 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the rear connector module 7. - ''' + """ REARCONNECTOR_MODULE8 = 1028 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the rear connector module 8. - ''' + """ REARCONNECTOR_MODULE9 = 1029 - r''' + r""" The switch module produces the Scan Advanced Ouptut Trigger on the rear connector module 9. - ''' + """ REARCONNECTOR_MODULE10 = 1030 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the rear connector module 10. - ''' + """ REARCONNECTOR_MODULE11 = 1031 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the rear connector module 11. - ''' + """ REARCONNECTOR_MODULE12 = 1032 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the rear connector module 12. - ''' + """ FRONTCONNECTOR_MODULE1 = 1041 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the front connector module 1. - ''' + """ FRONTCONNECTOR_MODULE2 = 1042 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the front connector module 2. - ''' + """ FRONTCONNECTOR_MODULE3 = 1043 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the front connector module 3. - ''' + """ FRONTCONNECTOR_MODULE4 = 1044 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the front connector module 4. - ''' + """ FRONTCONNECTOR_MODULE5 = 1045 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the front connector module 5. - ''' + """ FRONTCONNECTOR_MODULE6 = 1046 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the front connector module 6. - ''' + """ FRONTCONNECTOR_MODULE7 = 1047 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the front connector module 7. - ''' + """ FRONTCONNECTOR_MODULE8 = 1048 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the front connector module 8. - ''' + """ FRONTCONNECTOR_MODULE9 = 1049 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the front connector module 9. - ''' + """ FRONTCONNECTOR_MODULE10 = 1050 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the front connector module 10. - ''' + """ FRONTCONNECTOR_MODULE11 = 1051 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the front connector module 11. - ''' + """ FRONTCONNECTOR_MODULE12 = 1052 - r''' + r""" The switch module produces the Scan Advanced Output Trigger on the front connector module 12. - ''' + """ class ScanAdvancedPolarity(Enum): RISING = 0 - r''' + r""" The trigger occurs on the rising edge of the signal. - ''' + """ FALLING = 1 - r''' + r""" The trigger occurs on the falling edge of the signal. - ''' + """ class ScanMode(Enum): NONE = 0 - r''' + r""" No implicit action on connections when scanning. - ''' + """ BREAK_BEFORE_MAKE = 1 - r''' + r""" When scanning, the switch device breaks existing connections before making new connections. - ''' + """ BREAK_AFTER_MAKE = 2 - r''' + r""" When scanning, the switch device breaks existing connections after making new connections. - ''' + """ class TriggerInput(Enum): IMMEDIATE = 1 - r''' + r""" Immediate Trigger. The switch device does not wait for a trigger before processing the next entry in the scan list. - ''' + """ EXTERNAL = 2 - r''' + r""" External Trigger. The switch device waits until it receives a trigger from an external source through the external trigger input before processing the next entry in the scan list. - ''' + """ SOFTWARE_TRIG = 3 - r''' + r""" The switch device waits until you call the send_software_trigger method before processing the next entry in the scan list. - ''' + """ TTL0 = 111 - r''' + r""" The switch device waits until it receives a trigger on the PXI TRIG0 line before processing the next entry in the scan list. - ''' + """ TTL1 = 112 - r''' + r""" The switch device waits until it receives a trigger on the PXI TRIG1 line before processing the next entry in the scan list. - ''' + """ TTL2 = 113 - r''' + r""" The switch device waits until it receives a trigger on the PXI TRIG2 line before processing the next entry in the scan list. - ''' + """ TTL3 = 114 - r''' + r""" The switch device waits until it receives a trigger on the PXI TRIG3 line before processing the next entry in the scan list. - ''' + """ TTL4 = 115 - r''' + r""" The switch device waits until it receives a trigger on the PXI TRIG4 line before processing the next entry in the scan list. - ''' + """ TTL5 = 116 - r''' + r""" The switch device waits until it receives a trigger on the PXI TRIG5 line before processing the next entry in the scan list. - ''' + """ TTL6 = 117 - r''' + r""" The switch device waits until it receives a trigger on the PXI TRIG6 line before processing the next entry in the scan list. - ''' + """ TTL7 = 118 - r''' + r""" The switch device waits until it receives a trigger on the PXI TRIG7 line before processing the next entry in the scan list. - ''' + """ PXI_STAR = 125 - r''' + r""" The switch device waits until it receives a trigger on the PXI STAR trigger bus before processing the next entry in the scan list. - ''' + """ REARCONNECTOR = 1000 - r''' + r""" The switch device waits until it receives a trigger on the rear connector. - ''' + """ FRONTCONNECTOR = 1001 - r''' + r""" The switch device waits until it receives a trigger on the front connector. - ''' + """ REARCONNECTOR_MODULE1 = 1021 - r''' + r""" The switch module waits until it receives a trigger on the rear connector module 1. - ''' + """ REARCONNECTOR_MODULE2 = 1022 - r''' + r""" The switch module waits until it receives a trigger on the rear connector module 2. - ''' + """ REARCONNECTOR_MODULE3 = 1023 - r''' + r""" The switch module waits until it receives a trigger on the rear connector module 3. - ''' + """ REARCONNECTOR_MODULE4 = 1024 - r''' + r""" The switch module waits until it receives a trigger on the rear connector module 4. - ''' + """ REARCONNECTOR_MODULE5 = 1025 - r''' + r""" The switch module waits until it receives a trigger on the rear connector module 5. - ''' + """ REARCONNECTOR_MODULE6 = 1026 - r''' + r""" The switch module waits until it receives a trigger on the rear connector module 6. - ''' + """ REARCONNECTOR_MODULE7 = 1027 - r''' + r""" The switch module waits until it receives a trigger on the rear connector module 7. - ''' + """ REARCONNECTOR_MODULE8 = 1028 - r''' + r""" The switch module waits until it receives a trigger on the rear connector module 8. - ''' + """ REARCONNECTOR_MODULE9 = 1029 - r''' + r""" The switch module waits until it receives a trigger on the rear connector module 9. - ''' + """ REARCONNECTOR_MODULE10 = 1030 - r''' + r""" The switch module waits until it receives a trigger on the rear connector module 10. - ''' + """ REARCONNECTOR_MODULE11 = 1031 - r''' + r""" The switch module waits until it receives a trigger on the rear connector module 11. - ''' + """ REARCONNECTOR_MODULE12 = 1032 - r''' + r""" The switch module waits until it receives a trigger on the rear connector module 12. - ''' + """ FRONTCONNECTOR_MODULE1 = 1041 - r''' + r""" The switch module waits until it receives a trigger on the front connector module 1. - ''' + """ FRONTCONNECTOR_MODULE2 = 1042 - r''' + r""" The switch module waits until it receives a trigger on the front connector module 2. - ''' + """ FRONTCONNECTOR_MODULE3 = 1043 - r''' + r""" The switch module waits until it receives a trigger on the front connector module 3. - ''' + """ FRONTCONNECTOR_MODULE4 = 1044 - r''' + r""" The switch module waits until it receives a trigger on the front connector module 4. - ''' + """ FRONTCONNECTOR_MODULE5 = 1045 - r''' + r""" The switch module waits until it receives a trigger on the front connector module 5. - ''' + """ FRONTCONNECTOR_MODULE6 = 1046 - r''' + r""" The switch module waits until it receives a trigger on the front connector module 6. - ''' + """ FRONTCONNECTOR_MODULE7 = 1047 - r''' + r""" The switch module waits until it receives a trigger on the front connector module 7. - ''' + """ FRONTCONNECTOR_MODULE8 = 1048 - r''' + r""" The switch module waits until it receives a trigger on the front connector module 8. - ''' + """ FRONTCONNECTOR_MODULE9 = 1049 - r''' + r""" The switch module waits until it receives a trigger on the front connector module 9. - ''' + """ FRONTCONNECTOR_MODULE10 = 1050 - r''' + r""" The switch module waits until it receives a trigger on the front connector module 10. - ''' + """ FRONTCONNECTOR_MODULE11 = 1051 - r''' + r""" The switch module waits until it receives a trigger on the front connector module 11. - ''' + """ FRONTCONNECTOR_MODULE12 = 1052 - r''' + r""" The switch module waits until it receives a trigger on the front connector module 12. - ''' + """ class TriggerInputPolarity(Enum): RISING = 0 - r''' + r""" The trigger occurs on the rising edge of the signal. - ''' + """ FALLING = 1 - r''' + r""" The trigger occurs on the falling edge of the signal. - ''' + """ diff --git a/generated/niswitch/niswitch/errors.py b/generated/niswitch/niswitch/errors.py index 4e7c4b0b3..8ea126b9f 100644 --- a/generated/niswitch/niswitch/errors.py +++ b/generated/niswitch/niswitch/errors.py @@ -7,86 +7,103 @@ def _is_success(code): - return (code == 0) + return code == 0 def _is_error(code): - return (code < 0) + return code < 0 def _is_warning(code): - return (code > 0) + return code > 0 class Error(Exception): - '''Base error class for NI-SWITCH''' + """Base error class for NI-SWITCH""" def __init__(self, message): super(Error, self).__init__(message) class DriverError(Error): - '''An error originating from the NI-SWITCH driver''' + """An error originating from the NI-SWITCH driver""" def __init__(self, code, description): - assert (_is_error(code)), "Should not raise Error if code is not fatal." + assert _is_error(code), "Should not raise Error if code is not fatal." self.code = code self.description = description super(DriverError, self).__init__(str(self.code) + ": " + self.description) class DriverWarning(Warning): - '''A warning originating from the NI-SWITCH driver''' + """A warning originating from the NI-SWITCH driver""" def __init__(self, code, description): - assert (_is_warning(code)), "Should not create Warning if code is not positive." - super(DriverWarning, self).__init__('Warning {0} occurred.\n\n{1}'.format(code, description)) + assert _is_warning(code), "Should not create Warning if code is not positive." + super(DriverWarning, self).__init__( + "Warning {0} occurred.\n\n{1}".format(code, description) + ) class UnsupportedConfigurationError(Error): - '''An error due to using this module in an usupported platform.''' + """An error due to using this module in an usupported platform.""" def __init__(self): - super(UnsupportedConfigurationError, self).__init__('System configuration is unsupported: ' + platform.architecture()[0] + ' ' + platform.system()) + super(UnsupportedConfigurationError, self).__init__( + "System configuration is unsupported: " + + platform.architecture()[0] + + " " + + platform.system() + ) class DriverNotInstalledError(Error): - '''An error due to using this module without the driver runtime installed.''' + """An error due to using this module without the driver runtime installed.""" def __init__(self): - super(DriverNotInstalledError, self).__init__('The NI-SWITCH runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it.') + super(DriverNotInstalledError, self).__init__( + "The NI-SWITCH runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it." + ) class DriverTooOldError(Error): - '''An error due to using this module with an older version of the driver runtime.''' + """An error due to using this module with an older version of the driver runtime.""" def __init__(self): - super(DriverTooOldError, self).__init__('A function was not found in the NI-SWITCH runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it.') + super(DriverTooOldError, self).__init__( + "A function was not found in the NI-SWITCH runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it." + ) class InvalidRepeatedCapabilityError(Error): - '''An error due to an invalid character in a repeated capability''' + """An error due to an invalid character in a repeated capability""" def __init__(self, invalid_character, invalid_string): - super(InvalidRepeatedCapabilityError, self).__init__('An invalid character ({0}) was found in repeated capability string ({1})'.format(invalid_character, invalid_string)) + super(InvalidRepeatedCapabilityError, self).__init__( + "An invalid character ({0}) was found in repeated capability string ({1})".format( + invalid_character, invalid_string + ) + ) class SelfTestError(Error): - '''An error due to a failed self-test''' + """An error due to a failed self-test""" def __init__(self, code, msg): self.code = code self.message = msg - super(SelfTestError, self).__init__('Self-test failed with code {0}: {1}'.format(code, msg)) + super(SelfTestError, self).__init__( + "Self-test failed with code {0}: {1}".format(code, msg) + ) def handle_error(session, code, ignore_warnings, is_error_handling): - '''handle_error + """handle_error Helper function for handling errors returned by niswitch.Library. It calls back into the session to get the corresponding error description and raises if necessary. - ''' + """ if _is_success(code) or (_is_warning(code) and ignore_warnings): return @@ -94,7 +111,7 @@ def handle_error(session, code, ignore_warnings, is_error_handling): if is_error_handling: # The caller is in the midst of error handling and an error occurred. # Don't try to get the description or we'll start recursing until the stack overflows. - description = '' + description = "" else: description = session._get_error_description(code) @@ -103,5 +120,3 @@ def handle_error(session, code, ignore_warnings, is_error_handling): assert _is_warning(code) warnings.warn(DriverWarning(code, description)) - - diff --git a/generated/niswitch/niswitch/session.py b/generated/niswitch/niswitch/session.py index 099ead958..d07e08f51 100644 --- a/generated/niswitch/niswitch/session.py +++ b/generated/niswitch/niswitch/session.py @@ -2,6 +2,7 @@ # This file was generated import array # noqa: F401 import ctypes + # Used by @ivi_synchronized from functools import wraps @@ -16,22 +17,24 @@ # Used for __repr__ import pprint + pp = pprint.PrettyPrinter(indent=4) # Helper functions for creating ctypes needed for calling into the driver DLL def get_ctypes_pointer_for_buffer(value=None, library_type=None, size=None): if isinstance(value, array.array): - assert library_type is not None, 'library_type is required for array.array' + assert library_type is not None, "library_type is required for array.array" addr, _ = value.buffer_info() return ctypes.cast(addr, ctypes.POINTER(library_type)) elif str(type(value)).find("'numpy.ndarray'") != -1: import numpy + return numpy.ctypeslib.as_ctypes(value) elif isinstance(value, bytes): return ctypes.cast(value, ctypes.POINTER(library_type)) elif isinstance(value, list): - assert library_type is not None, 'library_type is required for list' + assert library_type is not None, "library_type is required for list" return (library_type * len(value))(*value) else: if library_type is not None and size is not None: @@ -71,6 +74,7 @@ def aux(*xs, **kws): session = xs[0] # parameter 0 is 'self' which is the session object with session.lock(): return f(*xs, **kws) + return aux @@ -91,16 +95,34 @@ def __init__(self, session, prefix, current_repeated_capability_list): self._session = session self._prefix = prefix # We need at least one element. If we get an empty list, make the one element an empty string - self._current_repeated_capability_list = current_repeated_capability_list if len(current_repeated_capability_list) > 0 else [''] + self._current_repeated_capability_list = ( + current_repeated_capability_list + if len(current_repeated_capability_list) > 0 + else [""] + ) # Now we know there is at lease one entry, so we look if it is an empty string or not - self._separator = '/' if len(self._current_repeated_capability_list[0]) > 0 else '' + self._separator = ( + "/" if len(self._current_repeated_capability_list[0]) > 0 else "" + ) def __getitem__(self, repeated_capability): - '''Set/get properties or call methods with a repeated capability (i.e. channels)''' - rep_caps_list = _converters.convert_repeated_capabilities(repeated_capability, self._prefix) - complete_rep_cap_list = [current_rep_cap + self._separator + rep_cap for current_rep_cap in self._current_repeated_capability_list for rep_cap in rep_caps_list] - - return _SessionBase(vi=self._session._vi, repeated_capability_list=complete_rep_cap_list, library=self._session._library, encoding=self._session._encoding, freeze_it=True) + """Set/get properties or call methods with a repeated capability (i.e. channels)""" + rep_caps_list = _converters.convert_repeated_capabilities( + repeated_capability, self._prefix + ) + complete_rep_cap_list = [ + current_rep_cap + self._separator + rep_cap + for current_rep_cap in self._current_repeated_capability_list + for rep_cap in rep_caps_list + ] + + return _SessionBase( + vi=self._session._vi, + repeated_capability_list=complete_rep_cap_list, + library=self._session._library, + encoding=self._session._encoding, + freeze_it=True, + ) # This is a very simple context manager we can use when we need to set/get attributes @@ -112,20 +134,20 @@ def __init__(self, session): def __enter__(self): self._repeated_capability_cache = self._session._repeated_capability - self._session._repeated_capability = '' + self._session._repeated_capability = "" def __exit__(self, exc_type, exc_value, traceback): self._session._repeated_capability = self._repeated_capability_cache class _SessionBase(object): - '''Base class for all NI-SWITCH sessions.''' + """Base class for all NI-SWITCH sessions.""" # This is needed during __init__. Without it, __setattr__ raises an exception _is_frozen = False analog_bus_sharing_enable = _attributes.AttributeViBoolean(1150018) - '''Type: bool + """Type: bool Enables or disables sharing of an analog bus line so that multiple NI SwitchBlock devices may connect to it simultaneously. To enable multiple NI SwitchBlock devices to share an analog bus line, set this property to True for each device on the channel that corresponds with the shared analog bus line. The default value for all devices is False, which disables sharing of the analog bus. Refer to the Using the Analog Bus on an NI SwitchBlock Carrier topic in the NI Switches Help for more information about sharing the analog bus. @@ -139,9 +161,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.analog_bus_sharing_enable` - ''' + """ bandwidth = _attributes.AttributeViReal64(1250005) - '''Type: float + """Type: float This channel-based property returns the bandwidth for the channel. The units are hertz. @@ -155,14 +177,14 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.bandwidth` - ''' + """ channel_count = _attributes.AttributeViInt32(1050203) - '''Type: int + """Type: int Indicates the number of channels that the specific instrument driver supports. - ''' + """ characteristic_impedance = _attributes.AttributeViReal64(1250016) - '''Type: float + """Type: float This channel-based property returns the characteristic impedance for the channel. The units are ohms. @@ -176,21 +198,21 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.characteristic_impedance` - ''' + """ continuous_scan = _attributes.AttributeViBoolean(1250026) - '''Type: bool + """Type: bool When a switch device is scanning, the swich can either stop scanning when the end of the scan (False) or continue scanning from the top of the scan list again (True). Notice that if you set the scan to continuous (True), the Wait For Scan Complete operation will always time out and you must call Abort to stop the scan. - ''' + """ digital_filter_enable = _attributes.AttributeViBoolean(1150016) - '''Type: bool + """Type: bool This property specifies whether to apply the pulse width filter to the Trigger Input. Enabling the Digital Filter (True) prevents the switch module from being triggered by pulses that are less than 150 ns on PXI trigger lines 0–7. When Digital Filter is disabled (False), it is possible for the switch module to be triggered by noise on the PXI trigger lines. If the device triggering the switch is capable of sending pulses greater than 150 ns, you should not disable the Digital Filter. - ''' + """ driver_setup = _attributes.AttributeViString(1050007) - '''Type: str + """Type: str This property indicates the Driver Setup string that the user specified when initializing the driver. Some cases exist where the end-user must specify instrument driver options at initialization time. An example of this is specifying a particular instrument model from among a family of instruments that the driver supports. This is useful when using simulation. The end-user can specify driver-specific options through the DriverSetup keyword in the optionsString parameter to the InitWithOptions method, or through the IVI Configuration Utility. @@ -198,32 +220,34 @@ class _SessionBase(object): Note: One or more of the referenced methods are not in the Python API for this driver. - ''' - handshaking_initiation = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.HandshakingInitiation, 1150013) + """ + handshaking_initiation = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.HandshakingInitiation, 1150013 + ) instrument_firmware_revision = _attributes.AttributeViString(1050510) - '''Type: str + """Type: str A string that contains the firmware revision information for the instrument you are currently using. - ''' + """ instrument_manufacturer = _attributes.AttributeViString(1050511) - '''Type: str + """Type: str A string that contains the name of the instrument manufacturer you are currently using. - ''' + """ instrument_model = _attributes.AttributeViString(1050512) - '''Type: str + """Type: str A string that contains the model number or name of the instrument that you are currently using. - ''' + """ io_resource_descriptor = _attributes.AttributeViString(1050304) - '''Type: str + """Type: str Indicates the resource descriptor the driver uses to identify the physical device. If you initialize the driver with a logical name, this property contains the resource descriptor that corresponds to the entry in the IVI Configuration utility. If you initialize the instrument driver with the resource descriptor, this property contains that value. - ''' + """ is_configuration_channel = _attributes.AttributeViBoolean(1250003) - '''Type: bool + """Type: bool This channel-based property specifies whether to reserve the channel for internal path creation. A channel that is available for internal path creation is called a configuration channel. The driver may use configuration channels to create paths between two channels you specify in the connect method. Configuration channels are not available for external connections. Set this property to True to mark the channel as a configuration channel. Set this property to False to mark the channel as available for external connections. @@ -238,19 +262,19 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.is_configuration_channel` - ''' + """ is_debounced = _attributes.AttributeViBoolean(1250002) - '''Type: bool + """Type: bool This property indicates whether the entire switch device has settled since the last switching command. A value of True indicates that all signals going through the switch device are valid. - ''' + """ is_scanning = _attributes.AttributeViBoolean(1250024) - '''Type: bool + """Type: bool If True, the switch module is currently scanning through the scan list (i.e. it is not in the Idle state). If False, the switch module is not currently scanning through the scan list (i.e. it is in the Idle state). - ''' + """ is_source_channel = _attributes.AttributeViBoolean(1250001) - '''Type: bool + """Type: bool This channel-based property specifies whether you want to identify the channel as a source channel. Typically, you set this property to True when you attach the channel to a power supply, a method generator, or an active measurement point on the unit under test, and you do not want to connect the channel to another source. The driver prevents source channels from connecting to each other. The connect method returns the NISWITCH_ERROR_ATTEMPT_TO_CONNECT_SOURCES when you attempt to connect two channels that you identify as source channels. @@ -263,23 +287,23 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.is_source_channel` - ''' + """ is_waiting_for_trig = _attributes.AttributeViBoolean(1150004) - '''Type: bool + """Type: bool In a scan list, a semi-colon (;) is used to indicate that at that point in the scan list, the scan engine should pause until a trigger is received from the trigger input. If that trigger is user generated through either a hardware pulse or the Send SW Trigger operation, it is necessary for the user to know when the scan engine has reached such a state. - ''' + """ logical_name = _attributes.AttributeViString(1050305) - '''Type: str + """Type: str A string containing the logical name you specified when opening the current IVI session. You may pass a logical name to the init or InitWithOptions methods. The IVI Configuration utility must contain an entry for the logical name. The logical name entry refers to a virtual instrument section in the IVI Configuration file. The virtual instrument section specifies a physical device and initial user options. Note: One or more of the referenced methods are not in the Python API for this driver. - ''' + """ max_ac_voltage = _attributes.AttributeViReal64(1250007) - '''Type: float + """Type: float This channel-based property returns the maximum AC voltage the channel can switch. The units are volts RMS. @@ -293,9 +317,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.max_ac_voltage` - ''' + """ max_carry_ac_current = _attributes.AttributeViReal64(1250011) - '''Type: float + """Type: float This channel-based property returns the maximum AC current the channel can carry. The units are amperes RMS. @@ -309,9 +333,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.max_carry_ac_current` - ''' + """ max_carry_ac_power = _attributes.AttributeViReal64(1250015) - '''Type: float + """Type: float This channel-based property returns the maximum AC power the channel can carry. The units are volt-amperes. @@ -325,9 +349,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.max_carry_ac_power` - ''' + """ max_carry_dc_current = _attributes.AttributeViReal64(1250010) - '''Type: float + """Type: float This channel-based property returns the maximum DC current the channel can carry. The units are amperes. @@ -341,9 +365,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.max_carry_dc_current` - ''' + """ max_carry_dc_power = _attributes.AttributeViReal64(1250014) - '''Type: float + """Type: float This channel-based property returns the maximum DC power the channel can carry. The units are watts. @@ -357,9 +381,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.max_carry_dc_power` - ''' + """ max_dc_voltage = _attributes.AttributeViReal64(1250006) - '''Type: float + """Type: float This channel-based property returns the maximum DC voltage the channel can switch. The units are volts. @@ -373,9 +397,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.max_dc_voltage` - ''' + """ max_switching_ac_current = _attributes.AttributeViReal64(1250009) - '''Type: float + """Type: float This channel-based property returns the maximum AC current the channel can switch. The units are amperes RMS. @@ -389,9 +413,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.max_switching_ac_current` - ''' + """ max_switching_ac_power = _attributes.AttributeViReal64(1250013) - '''Type: float + """Type: float This channel-based property returns the maximum AC power the channel can switch. The units are volt-amperes. @@ -405,9 +429,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.max_switching_ac_power` - ''' + """ max_switching_dc_current = _attributes.AttributeViReal64(1250008) - '''Type: float + """Type: float This channel-based property returns the maximum DC current the channel can switch. The units are amperes. @@ -421,9 +445,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.max_switching_dc_current` - ''' + """ max_switching_dc_power = _attributes.AttributeViReal64(1250012) - '''Type: float + """Type: float This channel-based property returns the maximum DC power the channel can switch. The units are watts. @@ -437,46 +461,50 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.max_switching_dc_power` - ''' + """ number_of_relays = _attributes.AttributeViInt32(1150014) - '''Type: int + """Type: int This property returns the number of relays. - ''' + """ num_of_columns = _attributes.AttributeViInt32(1250019) - '''Type: int + """Type: int This property returns the number of channels on the column of a matrix or scanner. If the switch device is a scanner, this value is the number of input channels. The wire_mode property affects the number of available columns. For example, if your device has 8 input lines and you use the four-wire mode, then the number of columns you have available is 2. - ''' + """ num_of_rows = _attributes.AttributeViInt32(1250018) - '''Type: int + """Type: int This property returns the number of channels on the row of a matrix or scanner. If the switch device is a scanner, this value is the number of output channels. The wire_mode property affects the number of available rows. For example, if your device has 8 input lines and you use the two-wire mode, then the number of columns you have available is 4. - ''' + """ power_down_latching_relays_after_debounce = _attributes.AttributeViBoolean(1150017) - '''Type: bool + """Type: bool This property specifies whether to power down latching relays after calling Wait For Debounce. When Power Down Latching Relays After Debounce is enabled (True), a call to Wait For Debounce ensures that the relays are settled and the latching relays are powered down. - ''' - scan_advanced_output = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ScanAdvancedOutput, 1250023) - '''Type: enums.ScanAdvancedOutput + """ + scan_advanced_output = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.ScanAdvancedOutput, 1250023 + ) + """Type: enums.ScanAdvancedOutput This property specifies the method you want to use to notify another instrument that all signals going through the switch device have settled following the processing of one entry in the scan list. - ''' - scan_advanced_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ScanAdvancedPolarity, 1150011) + """ + scan_advanced_polarity = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.ScanAdvancedPolarity, 1150011 + ) scan_delay = _attributes.AttributeViReal64TimeDeltaSeconds(1250025) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """Type: hightime.timedelta, datetime.timedelta, or float in seconds This property specifies the minimum amount of time the switch device waits before it asserts the scan advanced output trigger after opening or closing the switch. The switch device always waits for debounce before asserting the trigger. The units are seconds. the greater value of the settling time and the value you specify as the scan delay. Note: NI PXI-2501/2503/2565/2590/2591 Users--the actual delay will always be - ''' + """ scan_list = _attributes.AttributeViString(1250020) - '''Type: str + """Type: str This property contains a scan list, which is a string that specifies channel connections and trigger conditions. The initiate method makes or breaks connections and waits for triggers according to the instructions in the scan list. The scan list is comprised of channel names that you separate with special characters. These special characters determine the operations the scanner performs on the channels when it executes this scan list. @@ -489,9 +517,11 @@ class _SessionBase(object): To tell the switch device to wait for a trigger event, use the following character as a separator between paths: ; (semi-colon) Example: 'CH1->CH2;CH3->CH4' tells the switch to make the path from channel CH1 to channel CH2, wait for a trigger, and then make the path from CH3 to CH4. - ''' - scan_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ScanMode, 1250021) - '''Type: enums.ScanMode + """ + scan_mode = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.ScanMode, 1250021 + ) + """Type: enums.ScanMode This property specifies what happens to existing connections that conflict with the connections you make in a scan list. For example, if CH1 is already connected to CH2 and the scan list instructs the switch device to connect CH1 to CH3, this property specifies what happens to the connection between CH1 and CH2. If the value of this property is ScanMode.NONE, the switch device takes no action on existing paths. If the value is ScanMode.BREAK_BEFORE_MAKE, the switch device breaks conflicting paths before making new ones. If the value is ScanMode.BREAK_AFTER_MAKE, the switch device breaks conflicting paths after making new ones. @@ -499,14 +529,14 @@ class _SessionBase(object): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - ''' + """ serial_number = _attributes.AttributeViString(1150015) - '''Type: str + """Type: str This read-only property returns the serial number for the switch device controlled by this instrument driver. If the device does not return a serial number, the driver returns the IVI_ERROR_ATTRIBUTE_NOT_SUPPORTED error. - ''' + """ settling_time = _attributes.AttributeViReal64TimeDeltaSeconds(1250004) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """Type: hightime.timedelta, datetime.timedelta, or float in seconds This channel-based property returns the maximum length of time from after you make a connection until the signal flowing through the channel settles. The units are seconds. the greater value of the settling time and the value you specify as the scan delay. @@ -522,53 +552,57 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.settling_time` - ''' + """ simulate = _attributes.AttributeViBoolean(1050005) - '''Type: bool + """Type: bool Specifies whether or not to simulate instrument driver I/O operations. If simulation is enabled, instrument driver methods perform range checking and call Ivi_GetAttribute and Ivi_SetAttribute methods, but they do not perform instrument I/O. For output parameters that represent instrument data, the instrument driver methods return calculated values. The default value is False. Use the InitWithOptions method to override this value. Note: One or more of the referenced methods are not in the Python API for this driver. - ''' + """ specific_driver_description = _attributes.AttributeViString(1050514) - '''Type: str + """Type: str A string that contains a brief description of the specific driver. - ''' + """ specific_driver_revision = _attributes.AttributeViString(1050551) - '''Type: str + """Type: str A string that contains additional version information about this instrument driver. - ''' + """ specific_driver_vendor = _attributes.AttributeViString(1050513) - '''Type: str + """Type: str A string that contains the name of the vendor that supplies this driver. - ''' + """ supported_instrument_models = _attributes.AttributeViString(1050327) - '''Type: str + """Type: str Contains a comma-separated list of supported instrument models. - ''' + """ temperature = _attributes.AttributeViReal64(1150019) - '''Type: float + """Type: float This property returns the temperature as read by the Switch module. The units are degrees Celsius. - ''' - trigger_input = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerInput, 1250022) - '''Type: enums.TriggerInput + """ + trigger_input = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TriggerInput, 1250022 + ) + """Type: enums.TriggerInput This property specifies the source of the trigger for which the switch device can wait when processing a scan list. The switch device waits for a trigger when it encounters a semi-colon in a scan list. When the trigger occurs, the switch device advances to the next entry in the scan list. - ''' - trigger_input_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerInputPolarity, 1150010) - '''Type: enums.TriggerInputPolarity + """ + trigger_input_polarity = _attributes.AttributeEnum( + _attributes.AttributeViInt32, enums.TriggerInputPolarity, 1150010 + ) + """Type: enums.TriggerInputPolarity Determines the behavior of the trigger Input. - ''' + """ wire_mode = _attributes.AttributeViInt32(1250017) - '''Type: int + """Type: int This property returns the wire mode of the switch device. This property affects the values of the num_of_rows and num_of_columns properties. The actual number of input and output lines on the switch device is fixed, but the number of channels depends on how many lines constitute each channel. @@ -582,41 +616,49 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.wire_mode` - ''' + """ - def __init__(self, repeated_capability_list, vi, library, encoding, freeze_it=False): + def __init__( + self, repeated_capability_list, vi, library, encoding, freeze_it=False + ): self._repeated_capability_list = repeated_capability_list - self._repeated_capability = ','.join(repeated_capability_list) + self._repeated_capability = ",".join(repeated_capability_list) self._vi = vi self._library = library self._encoding = encoding # Store the parameter list for later printing in __repr__ param_list = [] - param_list.append("repeated_capability_list=" + pp.pformat(repeated_capability_list)) + param_list.append( + "repeated_capability_list=" + pp.pformat(repeated_capability_list) + ) param_list.append("vi=" + pp.pformat(vi)) param_list.append("library=" + pp.pformat(library)) param_list.append("encoding=" + pp.pformat(encoding)) - self._param_list = ', '.join(param_list) + self._param_list = ", ".join(param_list) # Instantiate any repeated capability objects - self.channels = _RepeatedCapabilities(self, '', repeated_capability_list) + self.channels = _RepeatedCapabilities(self, "", repeated_capability_list) self._is_frozen = freeze_it def __repr__(self): - return '{0}.{1}({2})'.format('niswitch', self.__class__.__name__, self._param_list) + return "{0}.{1}({2})".format( + "niswitch", self.__class__.__name__, self._param_list + ) def __setattr__(self, key, value): if self._is_frozen and key not in dir(self): - raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) + raise AttributeError( + "'{0}' object has no attribute '{1}'".format(type(self).__name__, key) + ) object.__setattr__(self, key, value) def _get_error_description(self, error_code): - '''_get_error_description + """_get_error_description Returns the error description. - ''' + """ try: _, error_string = self._get_error() return error_string @@ -624,21 +666,21 @@ def _get_error_description(self, error_code): pass try: - ''' + """ It is expected for _get_error to raise when the session is invalid (IVI spec requires GetError to fail). Use _error_message instead. It doesn't require a session. - ''' + """ error_string = self._error_message(error_code) return error_string except errors.Error: return "Failed to retrieve error description." - ''' These are code-generated ''' + """ These are code-generated """ @ivi_synchronized def _get_attribute_vi_boolean(self, attribute_id): - r'''_get_attribute_vi_boolean + r"""_get_attribute_vi_boolean This method queries the value of a ViBoolean property. You can use this method to get the values of instrument specific properties and @@ -686,18 +728,29 @@ def _get_attribute_vi_boolean(self, attribute_id): list of the constants by pressing on this control. Select a value by double-clicking on it or by selecting it and then pressing . - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niSwitch_GetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niSwitch_GetAttributeViBoolean( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + None + if attribute_value_ctype is None + else (ctypes.pointer(attribute_value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return bool(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_int32(self, attribute_id): - r'''_get_attribute_vi_int32 + r"""_get_attribute_vi_int32 This method queries the value of a ViInt32 property. You can use this method to get the values of instrument specific properties and @@ -745,18 +798,29 @@ def _get_attribute_vi_int32(self, attribute_id): list of the constants by pressing on this control. Select a value by double-clicking on it or by selecting it and then pressing . - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niSwitch_GetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niSwitch_GetAttributeViInt32( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + None + if attribute_value_ctype is None + else (ctypes.pointer(attribute_value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_real64(self, attribute_id): - r'''_get_attribute_vi_real64 + r"""_get_attribute_vi_real64 This method queries the value of a ViReal64 property. You can use this method to get the values of instrument specific properties and @@ -804,18 +868,29 @@ def _get_attribute_vi_real64(self, attribute_id): list of the constants by pressing on this control. Select a value by double-clicking on it or by selecting it and then pressing . - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niSwitch_GetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niSwitch_GetAttributeViReal64( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + None + if attribute_value_ctype is None + else (ctypes.pointer(attribute_value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_string(self, attribute_id): - r'''_get_attribute_vi_string + r"""_get_attribute_vi_string This method queries the value of a ViString property. You can use this method to get the values of instrument specific properties and @@ -884,22 +959,42 @@ def _get_attribute_vi_string(self, attribute_id): constants by pressing on this control. Select a value by double-clicking on it or by selecting it and then pressing . - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 array_size_ctype = _visatype.ViInt32() # case S170 attribute_value_ctype = None # case C050 - error_code = self._library.niSwitch_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, array_size_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niSwitch_GetAttributeViString( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + array_size_ctype, + attribute_value_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) array_size_ctype = _visatype.ViInt32(error_code) # case S180 - attribute_value_ctype = (_visatype.ViChar * array_size_ctype.value)() # case C060 - error_code = self._library.niSwitch_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, array_size_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + attribute_value_ctype = ( + _visatype.ViChar * array_size_ctype.value + )() # case C060 + error_code = self._library.niSwitch_GetAttributeViString( + vi_ctype, + channel_name_ctype, + attribute_id_ctype, + array_size_ctype, + attribute_value_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return attribute_value_ctype.value.decode(self._encoding) def _get_error(self): - r'''_get_error + r"""_get_error This method retrieves and then clears the IVI error information for the session or the current execution thread. One exception exists: If @@ -935,21 +1030,35 @@ def _get_error(self): places "123" into the buffer and returns 7. If you pass 0 for the Buffer Size, you can pass VI_NULL for this parameter. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 code_ctype = _visatype.ViStatus() # case S220 buffer_size_ctype = _visatype.ViInt32() # case S170 description_ctype = None # case C050 - error_code = self._library.niSwitch_GetError(vi_ctype, None if code_ctype is None else (ctypes.pointer(code_ctype)), buffer_size_ctype, description_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True) + error_code = self._library.niSwitch_GetError( + vi_ctype, + None if code_ctype is None else (ctypes.pointer(code_ctype)), + buffer_size_ctype, + description_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=True + ) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 description_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niSwitch_GetError(vi_ctype, None if code_ctype is None else (ctypes.pointer(code_ctype)), buffer_size_ctype, description_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + error_code = self._library.niSwitch_GetError( + vi_ctype, + None if code_ctype is None else (ctypes.pointer(code_ctype)), + buffer_size_ctype, + description_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return int(code_ctype.value), description_ctype.value.decode(self._encoding) def lock(self): - '''lock + """lock Obtains a multithread lock on the device session. Before doing so, the software waits until all other execution threads release their locks @@ -977,25 +1086,27 @@ def lock(self): Returns: lock (context manager): When used in a with statement, niswitch.Session.lock acts as a context manager and unlock will be called when the with block is exited - ''' + """ self._lock_session() # We do not call _lock_session() in the context manager so that this function can # act standalone as well and let the client call unlock() explicitly. If they do use the context manager, # that will handle the unlock for them return _Lock(self) def _lock_session(self): - '''_lock_session + """_lock_session Actual call to driver - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSwitch_LockSession(vi_ctype, None) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return @ivi_synchronized def _set_attribute_vi_boolean(self, attribute_id, attribute_value): - r'''_set_attribute_vi_boolean + r"""_set_attribute_vi_boolean This method sets the value of a ViBoolean property. This is a low-level method that you can use to set the values of @@ -1055,18 +1166,24 @@ def _set_attribute_vi_boolean(self, attribute_id, attribute_value): then pressing . Note: Some of the values might not be valid depending on the current settings of the instrument session. Default Value: none - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViBoolean(attribute_value) # case S150 - error_code = self._library.niSwitch_SetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niSwitch_SetAttributeViBoolean( + vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_int32(self, attribute_id, attribute_value): - r'''_set_attribute_vi_int32 + r"""_set_attribute_vi_int32 This method sets the value of a ViInt32 property. This is a low-level method that you can use to set the values of instrument-specific @@ -1126,18 +1243,24 @@ def _set_attribute_vi_int32(self, attribute_id, attribute_value): then pressing . Note: Some of the values might not be valid depending on the current settings of the instrument session. Default Value: none - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt32(attribute_value) # case S150 - error_code = self._library.niSwitch_SetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niSwitch_SetAttributeViInt32( + vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_real64(self, attribute_id, attribute_value): - r'''_set_attribute_vi_real64 + r"""_set_attribute_vi_real64 This method sets the value of a ViReal64 property. This is a low-level method that you can use to set the values of @@ -1197,18 +1320,24 @@ def _set_attribute_vi_real64(self, attribute_id, attribute_value): then pressing . Note: Some of the values might not be valid depending on the current settings of the instrument session. Default Value: none - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViReal64(attribute_value) # case S150 - error_code = self._library.niSwitch_SetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niSwitch_SetAttributeViReal64( + vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _set_attribute_vi_string(self, attribute_id, attribute_value): - r'''_set_attribute_vi_string + r"""_set_attribute_vi_string This method sets the value of a ViString property. This is a low-level method that you can use to set the values of @@ -1268,29 +1397,39 @@ def _set_attribute_vi_string(self, attribute_id, attribute_value): then pressing . Note: Some of the values might not be valid depending on the current settings of the instrument session. Default Value: none - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 - attribute_value_ctype = ctypes.create_string_buffer(attribute_value.encode(self._encoding)) # case C020 - error_code = self._library.niSwitch_SetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + attribute_value_ctype = ctypes.create_string_buffer( + attribute_value.encode(self._encoding) + ) # case C020 + error_code = self._library.niSwitch_SetAttributeViString( + vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def unlock(self): - '''unlock + """unlock Releases a lock that you acquired on an device session using lock. Refer to lock for additional information on session locks. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSwitch_UnlockSession(vi_ctype, None) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return def _error_message(self, error_code): - r'''_error_message + r"""_error_message Converts an error code returned by NI-SWITCH into a user-readable string. Generally this information is supplied in error out of any @@ -1306,20 +1445,30 @@ def _error_message(self, error_code): error_message (str): The error information formatted into a string. You must pass a ViChar array with at least 256 bytes. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus(error_code) # case S150 error_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niSwitch_error_message(vi_ctype, error_code_ctype, error_message_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + error_code = self._library.niSwitch_error_message( + vi_ctype, error_code_ctype, error_message_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return error_message_ctype.value.decode(self._encoding) class Session(_SessionBase): - '''An NI-SWITCH session to a National Instruments Switch Module''' + """An NI-SWITCH session to a National Instruments Switch Module""" - def __init__(self, resource_name, topology="Configured Topology", simulate=False, reset_device=False): - r'''An NI-SWITCH session to a National Instruments Switch Module + def __init__( + self, + resource_name, + topology="Configured Topology", + simulate=False, + reset_device=False, + ): + r"""An NI-SWITCH session to a National Instruments Switch Module Returns a session handle used to identify the switch in all subsequent instrument driver calls and sets the topology of the switch. @@ -1552,14 +1701,22 @@ def __init__(self, resource_name, topology="Configured Topology", simulate=False Returns: session (niswitch.Session): A session object representing the device. - ''' - super(Session, self).__init__(repeated_capability_list=[], vi=None, library=None, encoding=None, freeze_it=False) + """ + super(Session, self).__init__( + repeated_capability_list=[], + vi=None, + library=None, + encoding=None, + freeze_it=False, + ) self._library = _library_singleton.get() - self._encoding = 'windows-1251' + self._encoding = "windows-1251" # Call specified init function self._vi = 0 # This must be set before calling _init_with_topology(). - self._vi = self._init_with_topology(resource_name, topology, simulate, reset_device) + self._vi = self._init_with_topology( + resource_name, topology, simulate, reset_device + ) # Store the parameter list for later printing in __repr__ param_list = [] @@ -1567,7 +1724,7 @@ def __init__(self, resource_name, topology="Configured Topology", simulate=False param_list.append("topology=" + pp.pformat(topology)) param_list.append("simulate=" + pp.pformat(simulate)) param_list.append("reset_device=" + pp.pformat(reset_device)) - self._param_list = ', '.join(param_list) + self._param_list = ", ".join(param_list) self._is_frozen = True @@ -1578,7 +1735,7 @@ def __exit__(self, exc_type, exc_value, traceback): self.close() def initiate(self): - '''initiate + """initiate Commits the configured scan list and trigger settings to hardware and initiates the scan. If niSwitch Commit was called earlier, niSwitch @@ -1591,11 +1748,11 @@ def initiate(self): Note: This method will return a Python context manager that will initiate on entering and abort on exit. - ''' + """ return _Scan(self) def close(self): - '''close + """close Terminates the NI-SWITCH session and all of its properties and deallocates any memory resources the driver uses. Notes: (1) You must @@ -1608,7 +1765,7 @@ def close(self): Note: This method is not needed when using the session context manager - ''' + """ try: self._close() except errors.DriverError: @@ -1616,24 +1773,26 @@ def close(self): raise self._vi = 0 - ''' These are code-generated ''' + """ These are code-generated """ @ivi_synchronized def abort(self): - r'''abort + r"""abort Aborts the scan in progress. Initiate a scan with initiate. If the switch module is not scanning, NISWITCH_ERROR_NO_SCAN_IN_PROGRESS error is returned. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSwitch_AbortScan(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def can_connect(self, channel1, channel2): - r'''can_connect + r"""can_connect Verifies that a path between channel 1 and channel 2 can be created. If a path is possible in the switch module, the availability of that path @@ -1679,32 +1838,47 @@ def can_connect(self, channel1, channel2): create a path between the two channels because one of the channels is a configuration channel and thus unavailable for external connections. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel1_ctype = ctypes.create_string_buffer(channel1.encode(self._encoding)) # case C020 - channel2_ctype = ctypes.create_string_buffer(channel2.encode(self._encoding)) # case C020 + channel1_ctype = ctypes.create_string_buffer( + channel1.encode(self._encoding) + ) # case C020 + channel2_ctype = ctypes.create_string_buffer( + channel2.encode(self._encoding) + ) # case C020 path_capability_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niSwitch_CanConnect(vi_ctype, channel1_ctype, channel2_ctype, None if path_capability_ctype is None else (ctypes.pointer(path_capability_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niSwitch_CanConnect( + vi_ctype, + channel1_ctype, + channel2_ctype, + None + if path_capability_ctype is None + else (ctypes.pointer(path_capability_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return enums.PathCapability(path_capability_ctype.value) @ivi_synchronized def commit(self): - r'''commit + r"""commit Downloads the configured scan list and trigger settings to hardware. Calling commit optional as it is implicitly called during initiate. Use commit to arm triggers in a given order or to control when expensive hardware operations are performed. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSwitch_Commit(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def connect(self, channel1, channel2): - r'''connect + r"""connect Creates a path between channel 1 and channel 2. The driver calculates and uses the shortest path between the two channels. Refer to Immediate @@ -1736,17 +1910,25 @@ def connect(self, channel1, channel2): valid channel names for the switch module. Examples of valid channel names: ch0, com0, ab0, r1, c2, cjtemp Default value: None - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel1_ctype = ctypes.create_string_buffer(channel1.encode(self._encoding)) # case C020 - channel2_ctype = ctypes.create_string_buffer(channel2.encode(self._encoding)) # case C020 - error_code = self._library.niSwitch_Connect(vi_ctype, channel1_ctype, channel2_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + channel1_ctype = ctypes.create_string_buffer( + channel1.encode(self._encoding) + ) # case C020 + channel2_ctype = ctypes.create_string_buffer( + channel2.encode(self._encoding) + ) # case C020 + error_code = self._library.niSwitch_Connect( + vi_ctype, channel1_ctype, channel2_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def connect_multiple(self, connection_list): - r'''connect_multiple + r"""connect_multiple Creates the connections between channels specified in Connection List. Specify connections with two endpoints only or the explicit path between @@ -1778,29 +1960,37 @@ def connect_multiple(self, connection_list): of a valid connection list: c0 -> r1, [c2 -> r2 -> c3] In this example, r2 is a configuration channel. Default value: None - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - connection_list_ctype = ctypes.create_string_buffer(connection_list.encode(self._encoding)) # case C020 - error_code = self._library.niSwitch_ConnectMultiple(vi_ctype, connection_list_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + connection_list_ctype = ctypes.create_string_buffer( + connection_list.encode(self._encoding) + ) # case C020 + error_code = self._library.niSwitch_ConnectMultiple( + vi_ctype, connection_list_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def disable(self): - r'''disable + r"""disable Places the switch module in a quiescent state where it has minimal or no impact on the system to which it is connected. All channels are disconnected and any scan in progress is aborted. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSwitch_Disable(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def disconnect(self, channel1, channel2): - r'''disconnect + r"""disconnect This method destroys the path between two channels that you create with the connect or set_path method. If a path is @@ -1818,29 +2008,39 @@ def disconnect(self, channel1, channel2): valid channel names for the switch module. Examples of valid channel names: ch0, com0, ab0, r1, c2, cjtemp Default value: None - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel1_ctype = ctypes.create_string_buffer(channel1.encode(self._encoding)) # case C020 - channel2_ctype = ctypes.create_string_buffer(channel2.encode(self._encoding)) # case C020 - error_code = self._library.niSwitch_Disconnect(vi_ctype, channel1_ctype, channel2_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + channel1_ctype = ctypes.create_string_buffer( + channel1.encode(self._encoding) + ) # case C020 + channel2_ctype = ctypes.create_string_buffer( + channel2.encode(self._encoding) + ) # case C020 + error_code = self._library.niSwitch_Disconnect( + vi_ctype, channel1_ctype, channel2_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def disconnect_all(self): - r'''disconnect_all + r"""disconnect_all Breaks all existing paths. If the switch module cannot break all paths, NISWITCH_WARN_PATH_REMAINS warning is returned. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSwitch_DisconnectAll(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def disconnect_multiple(self, disconnection_list): - r'''disconnect_multiple + r"""disconnect_multiple Breaks the connections between channels specified in Disconnection List. If no connections exist between channels, NI-SWITCH returns an error. In @@ -1857,16 +2057,22 @@ def disconnect_multiple(self, disconnection_list): r2 -> c3] In this example, r2 is a configuration channel. Default value: None - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - disconnection_list_ctype = ctypes.create_string_buffer(disconnection_list.encode(self._encoding)) # case C020 - error_code = self._library.niSwitch_DisconnectMultiple(vi_ctype, disconnection_list_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + disconnection_list_ctype = ctypes.create_string_buffer( + disconnection_list.encode(self._encoding) + ) # case C020 + error_code = self._library.niSwitch_DisconnectMultiple( + vi_ctype, disconnection_list_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def get_channel_name(self, index): - r'''get_channel_name + r"""get_channel_name Returns the channel string that is in the channel table at the specified index. Use get_channel_name in a For Loop to get a complete list @@ -1882,22 +2088,32 @@ def get_channel_name(self, index): channel_name_buffer (str): Returns the channel name that is in the channel table at the index you specify. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 index_ctype = _visatype.ViInt32(index) # case S150 buffer_size_ctype = _visatype.ViInt32() # case S170 channel_name_buffer_ctype = None # case C050 - error_code = self._library.niSwitch_GetChannelName(vi_ctype, index_ctype, buffer_size_ctype, channel_name_buffer_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niSwitch_GetChannelName( + vi_ctype, index_ctype, buffer_size_ctype, channel_name_buffer_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - channel_name_buffer_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niSwitch_GetChannelName(vi_ctype, index_ctype, buffer_size_ctype, channel_name_buffer_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + channel_name_buffer_ctype = ( + _visatype.ViChar * buffer_size_ctype.value + )() # case C060 + error_code = self._library.niSwitch_GetChannelName( + vi_ctype, index_ctype, buffer_size_ctype, channel_name_buffer_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return channel_name_buffer_ctype.value.decode(self._encoding) @ivi_synchronized def get_path(self, channel1, channel2): - r'''get_path + r"""get_path Returns a string that identifies the explicit path created with connect. Pass this string to set_path to establish @@ -1929,23 +2145,35 @@ def get_path(self, channel1, channel2): All other channels in the path are configuration channels. Examples of returned paths: ch0->com0, com0->ab0 - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel1_ctype = ctypes.create_string_buffer(channel1.encode(self._encoding)) # case C020 - channel2_ctype = ctypes.create_string_buffer(channel2.encode(self._encoding)) # case C020 + channel1_ctype = ctypes.create_string_buffer( + channel1.encode(self._encoding) + ) # case C020 + channel2_ctype = ctypes.create_string_buffer( + channel2.encode(self._encoding) + ) # case C020 buffer_size_ctype = _visatype.ViInt32() # case S170 path_ctype = None # case C050 - error_code = self._library.niSwitch_GetPath(vi_ctype, channel1_ctype, channel2_ctype, buffer_size_ctype, path_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niSwitch_GetPath( + vi_ctype, channel1_ctype, channel2_ctype, buffer_size_ctype, path_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 path_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niSwitch_GetPath(vi_ctype, channel1_ctype, channel2_ctype, buffer_size_ctype, path_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niSwitch_GetPath( + vi_ctype, channel1_ctype, channel2_ctype, buffer_size_ctype, path_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return path_ctype.value.decode(self._encoding) @ivi_synchronized def get_relay_count(self, relay_name): - r'''get_relay_count + r"""get_relay_count Returns the number of times the relay has changed from Closed to Open. Relay count is useful for tracking relay lifetime and usage. Call @@ -1962,17 +2190,25 @@ def get_relay_count(self, relay_name): Returns: relay_count (int): The number of relay cycles. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - relay_name_ctype = ctypes.create_string_buffer(relay_name.encode(self._encoding)) # case C020 + relay_name_ctype = ctypes.create_string_buffer( + relay_name.encode(self._encoding) + ) # case C020 relay_count_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niSwitch_GetRelayCount(vi_ctype, relay_name_ctype, None if relay_count_ctype is None else (ctypes.pointer(relay_count_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niSwitch_GetRelayCount( + vi_ctype, + relay_name_ctype, + None if relay_count_ctype is None else (ctypes.pointer(relay_count_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(relay_count_ctype.value) @ivi_synchronized def get_relay_name(self, index): - r'''get_relay_name + r"""get_relay_name Returns the relay name string that is in the relay list at the specified index. Use get_relay_name in a For Loop to get a complete list @@ -1987,22 +2223,32 @@ def get_relay_name(self, index): Returns: relay_name_buffer (str): Returns the relay name for the index you specify. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 index_ctype = _visatype.ViInt32(index) # case S150 relay_name_buffer_size_ctype = _visatype.ViInt32() # case S170 relay_name_buffer_ctype = None # case C050 - error_code = self._library.niSwitch_GetRelayName(vi_ctype, index_ctype, relay_name_buffer_size_ctype, relay_name_buffer_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niSwitch_GetRelayName( + vi_ctype, index_ctype, relay_name_buffer_size_ctype, relay_name_buffer_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) relay_name_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - relay_name_buffer_ctype = (_visatype.ViChar * relay_name_buffer_size_ctype.value)() # case C060 - error_code = self._library.niSwitch_GetRelayName(vi_ctype, index_ctype, relay_name_buffer_size_ctype, relay_name_buffer_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + relay_name_buffer_ctype = ( + _visatype.ViChar * relay_name_buffer_size_ctype.value + )() # case C060 + error_code = self._library.niSwitch_GetRelayName( + vi_ctype, index_ctype, relay_name_buffer_size_ctype, relay_name_buffer_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return relay_name_buffer_ctype.value.decode(self._encoding) @ivi_synchronized def get_relay_position(self, relay_name): - r'''get_relay_position + r"""get_relay_position Returns the relay position for the relay specified in the Relay Name parameter. @@ -2017,16 +2263,32 @@ def get_relay_position(self, relay_name): relay_position (enums.RelayPosition): Indicates whether the relay is open or closed. RelayPosition.OPEN 10 RelayPosition.CLOSED 11 - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - relay_name_ctype = ctypes.create_string_buffer(relay_name.encode(self._encoding)) # case C020 + relay_name_ctype = ctypes.create_string_buffer( + relay_name.encode(self._encoding) + ) # case C020 relay_position_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niSwitch_GetRelayPosition(vi_ctype, relay_name_ctype, None if relay_position_ctype is None else (ctypes.pointer(relay_position_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niSwitch_GetRelayPosition( + vi_ctype, + relay_name_ctype, + None + if relay_position_ctype is None + else (ctypes.pointer(relay_position_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return enums.RelayPosition(relay_position_ctype.value) - def _init_with_topology(self, resource_name, topology="Configured Topology", simulate=False, reset_device=False): - r'''_init_with_topology + def _init_with_topology( + self, + resource_name, + topology="Configured Topology", + simulate=False, + reset_device=False, + ): + r"""_init_with_topology Returns a session handle used to identify the switch in all subsequent instrument driver calls and sets the topology of the switch. @@ -2264,19 +2526,31 @@ def _init_with_topology(self, resource_name, topology="Configured Topology", sim Note: One or more of the referenced methods are not in the Python API for this driver. - ''' - resource_name_ctype = ctypes.create_string_buffer(resource_name.encode(self._encoding)) # case C020 - topology_ctype = ctypes.create_string_buffer(topology.encode(self._encoding)) # case C020 + """ + resource_name_ctype = ctypes.create_string_buffer( + resource_name.encode(self._encoding) + ) # case C020 + topology_ctype = ctypes.create_string_buffer( + topology.encode(self._encoding) + ) # case C020 simulate_ctype = _visatype.ViBoolean(simulate) # case S150 reset_device_ctype = _visatype.ViBoolean(reset_device) # case S150 vi_ctype = _visatype.ViSession() # case S220 - error_code = self._library.niSwitch_InitWithTopology(resource_name_ctype, topology_ctype, simulate_ctype, reset_device_ctype, None if vi_ctype is None else (ctypes.pointer(vi_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niSwitch_InitWithTopology( + resource_name_ctype, + topology_ctype, + simulate_ctype, + reset_device_ctype, + None if vi_ctype is None else (ctypes.pointer(vi_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(vi_ctype.value) @ivi_synchronized def _initiate_scan(self): - r'''_initiate_scan + r"""_initiate_scan Commits the configured scan list and trigger settings to hardware and initiates the scan. If niSwitch Commit was called earlier, niSwitch @@ -2286,15 +2560,17 @@ def _initiate_scan(self): methods return NISWITCH_ERROR_SCAN_IN_PROGRESS. To stop the scanning operation, To stop the scanning operation, call abort. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSwitch_InitiateScan(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def relay_control(self, relay_name, relay_action): - r'''relay_control + r"""relay_control Controls individual relays of the switch. When controlling individual relays, the protection offered by setting the usage of source channels @@ -2312,33 +2588,48 @@ def relay_control(self, relay_name, relay_action): Close Defined values: RelayAction.OPEN RelayAction.CLOSE (Default Value) - ''' + """ if type(relay_action) is not enums.RelayAction: - raise TypeError('Parameter relay_action must be of type ' + str(enums.RelayAction)) + raise TypeError( + "Parameter relay_action must be of type " + str(enums.RelayAction) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - relay_name_ctype = ctypes.create_string_buffer(relay_name.encode(self._encoding)) # case C020 + relay_name_ctype = ctypes.create_string_buffer( + relay_name.encode(self._encoding) + ) # case C020 relay_action_ctype = _visatype.ViInt32(relay_action.value) # case S130 - error_code = self._library.niSwitch_RelayControl(vi_ctype, relay_name_ctype, relay_action_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niSwitch_RelayControl( + vi_ctype, relay_name_ctype, relay_action_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def reset_with_defaults(self): - r'''reset_with_defaults + r"""reset_with_defaults Resets the switch module and applies initial user specified settings from the logical name used to initialize the session. If the session was created without a logical name, this method is equivalent to reset. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSwitch_ResetWithDefaults(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def route_scan_advanced_output(self, scan_advanced_output_connector, scan_advanced_output_bus_line, invert=False): - r'''route_scan_advanced_output + def route_scan_advanced_output( + self, + scan_advanced_output_connector, + scan_advanced_output_bus_line, + invert=False, + ): + r"""route_scan_advanced_output Routes the scan advanced output trigger from a trigger bus line (TTLx) to the front or rear connector. @@ -2364,22 +2655,41 @@ def route_scan_advanced_output(self, scan_advanced_output_connector, scan_advanc invert (bool): If True, inverts the input trigger signal from falling to rising or vice versa. Default value: False - ''' + """ if type(scan_advanced_output_connector) is not enums.ScanAdvancedOutput: - raise TypeError('Parameter scan_advanced_output_connector must be of type ' + str(enums.ScanAdvancedOutput)) + raise TypeError( + "Parameter scan_advanced_output_connector must be of type " + + str(enums.ScanAdvancedOutput) + ) if type(scan_advanced_output_bus_line) is not enums.ScanAdvancedOutput: - raise TypeError('Parameter scan_advanced_output_bus_line must be of type ' + str(enums.ScanAdvancedOutput)) + raise TypeError( + "Parameter scan_advanced_output_bus_line must be of type " + + str(enums.ScanAdvancedOutput) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - scan_advanced_output_connector_ctype = _visatype.ViInt32(scan_advanced_output_connector.value) # case S130 - scan_advanced_output_bus_line_ctype = _visatype.ViInt32(scan_advanced_output_bus_line.value) # case S130 + scan_advanced_output_connector_ctype = _visatype.ViInt32( + scan_advanced_output_connector.value + ) # case S130 + scan_advanced_output_bus_line_ctype = _visatype.ViInt32( + scan_advanced_output_bus_line.value + ) # case S130 invert_ctype = _visatype.ViBoolean(invert) # case S150 - error_code = self._library.niSwitch_RouteScanAdvancedOutput(vi_ctype, scan_advanced_output_connector_ctype, scan_advanced_output_bus_line_ctype, invert_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niSwitch_RouteScanAdvancedOutput( + vi_ctype, + scan_advanced_output_connector_ctype, + scan_advanced_output_bus_line_ctype, + invert_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def route_trigger_input(self, trigger_input_connector, trigger_input_bus_line, invert=False): - r'''route_trigger_input + def route_trigger_input( + self, trigger_input_connector, trigger_input_bus_line, invert=False + ): + r"""route_trigger_input Routes the input trigger from the front or rear connector to a trigger bus line (TTLx). To disconnect the route, call this method again and @@ -2406,22 +2716,39 @@ def route_trigger_input(self, trigger_input_connector, trigger_input_bus_line, i invert (bool): If True, inverts the input trigger signal from falling to rising or vice versa. Default value: False - ''' + """ if type(trigger_input_connector) is not enums.TriggerInput: - raise TypeError('Parameter trigger_input_connector must be of type ' + str(enums.TriggerInput)) + raise TypeError( + "Parameter trigger_input_connector must be of type " + + str(enums.TriggerInput) + ) if type(trigger_input_bus_line) is not enums.TriggerInput: - raise TypeError('Parameter trigger_input_bus_line must be of type ' + str(enums.TriggerInput)) + raise TypeError( + "Parameter trigger_input_bus_line must be of type " + + str(enums.TriggerInput) + ) vi_ctype = _visatype.ViSession(self._vi) # case S110 - trigger_input_connector_ctype = _visatype.ViInt32(trigger_input_connector.value) # case S130 - trigger_input_bus_line_ctype = _visatype.ViInt32(trigger_input_bus_line.value) # case S130 + trigger_input_connector_ctype = _visatype.ViInt32( + trigger_input_connector.value + ) # case S130 + trigger_input_bus_line_ctype = _visatype.ViInt32( + trigger_input_bus_line.value + ) # case S130 invert_ctype = _visatype.ViBoolean(invert) # case S150 - error_code = self._library.niSwitch_RouteTriggerInput(vi_ctype, trigger_input_connector_ctype, trigger_input_bus_line_ctype, invert_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niSwitch_RouteTriggerInput( + vi_ctype, + trigger_input_connector_ctype, + trigger_input_bus_line_ctype, + invert_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def send_software_trigger(self): - r'''send_software_trigger + r"""send_software_trigger Sends a software trigger to the switch module specified in the NI-SWITCH session. When the trigger input is set to TriggerInput.SOFTWARE_TRIG @@ -2432,15 +2759,17 @@ def send_software_trigger(self): Note: One or more of the referenced methods are not in the Python API for this driver. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSwitch_SendSoftwareTrigger(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def set_path(self, path_list): - r'''set_path + r"""set_path Connects two channels by specifying an explicit path in the path list parameter. set_path is particularly useful where path @@ -2455,16 +2784,20 @@ def set_path(self, path_list): configuration channel. Default value: None Obtain the path list for a previously created path with get_path. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - path_list_ctype = ctypes.create_string_buffer(path_list.encode(self._encoding)) # case C020 + path_list_ctype = ctypes.create_string_buffer( + path_list.encode(self._encoding) + ) # case C020 error_code = self._library.niSwitch_SetPath(vi_ctype, path_list_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def wait_for_debounce(self, maximum_time_ms=hightime.timedelta(milliseconds=5000)): - r'''wait_for_debounce + r"""wait_for_debounce Pauses until all created paths have settled. If the time you specify with the Maximum Time (ms) parameter elapsed before the switch paths @@ -2477,16 +2810,24 @@ def wait_for_debounce(self, maximum_time_ms=hightime.timedelta(milliseconds=5000 before all relays active or deactivate, a timeout error is returned. Default Value:5000 ms - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_time_ms_ctype = _converters.convert_timedelta_to_milliseconds_int32(maximum_time_ms) # case S140 - error_code = self._library.niSwitch_WaitForDebounce(vi_ctype, maximum_time_ms_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + maximum_time_ms_ctype = _converters.convert_timedelta_to_milliseconds_int32( + maximum_time_ms + ) # case S140 + error_code = self._library.niSwitch_WaitForDebounce( + vi_ctype, maximum_time_ms_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized - def wait_for_scan_complete(self, maximum_time_ms=hightime.timedelta(milliseconds=5000)): - r'''wait_for_scan_complete + def wait_for_scan_complete( + self, maximum_time_ms=hightime.timedelta(milliseconds=5000) + ): + r"""wait_for_scan_complete Pauses until the switch module stops scanning or the maximum time has elapsed and returns a timeout error. If the time you specify with the @@ -2500,15 +2841,21 @@ def wait_for_scan_complete(self, maximum_time_ms=hightime.timedelta(milliseconds NISWITCH_ERROR_MAX_TIME_EXCEEDED error is returned. Default Value:5000 ms - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_time_ms_ctype = _converters.convert_timedelta_to_milliseconds_int32(maximum_time_ms) # case S140 - error_code = self._library.niSwitch_WaitForScanComplete(vi_ctype, maximum_time_ms_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + maximum_time_ms_ctype = _converters.convert_timedelta_to_milliseconds_int32( + maximum_time_ms + ) # case S140 + error_code = self._library.niSwitch_WaitForScanComplete( + vi_ctype, maximum_time_ms_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def _close(self): - r'''_close + r"""_close Terminates the NI-SWITCH session and all of its properties and deallocates any memory resources the driver uses. Notes: (1) You must @@ -2518,15 +2865,17 @@ def _close(self): Note: One or more of the referenced methods are not in the Python API for this driver. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSwitch_close(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def self_test(self): - '''self_test + """self_test Verifies that the driver can communicate with the switch module. @@ -2542,7 +2891,7 @@ def self_test(self): +----------------+------------------+ | 1 | Self-test failed | +----------------+------------------+ - ''' + """ code, msg = self._self_test() if code: raise errors.SelfTestError(code, msg) @@ -2550,20 +2899,22 @@ def self_test(self): @ivi_synchronized def reset(self): - r'''reset + r"""reset Disconnects all created paths and returns the switch module to the state at initialization. Configuration channel and source channel settings remain unchanged. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSwitch_reset(vi_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return @ivi_synchronized def _self_test(self): - r'''_self_test + r"""_self_test Verifies that the driver can communicate with the switch module. @@ -2573,13 +2924,20 @@ def _self_test(self): self_test_message (str): Self-test response string from the switch device. You must pass a ViChar array with at least 256 bytes. - ''' + """ vi_ctype = _visatype.ViSession(self._vi) # case S110 self_test_result_ctype = _visatype.ViInt16() # case S220 self_test_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niSwitch_self_test(vi_ctype, None if self_test_result_ctype is None else (ctypes.pointer(self_test_result_ctype)), self_test_message_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) - return int(self_test_result_ctype.value), self_test_message_ctype.value.decode(self._encoding) - - - + error_code = self._library.niSwitch_self_test( + vi_ctype, + None + if self_test_result_ctype is None + else (ctypes.pointer(self_test_result_ctype)), + self_test_message_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) + return int(self_test_result_ctype.value), self_test_message_ctype.value.decode( + self._encoding + ) diff --git a/generated/niswitch/niswitch/unit_tests/_matchers.py b/generated/niswitch/niswitch/unit_tests/_matchers.py index b06336fe7..2c3d190ca 100644 --- a/generated/niswitch/niswitch/unit_tests/_matchers.py +++ b/generated/niswitch/niswitch/unit_tests/_matchers.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # This file was generated -'''Matcher classes used by unit tests in order to set mock expectations. +"""Matcher classes used by unit tests in order to set mock expectations. These work well with our visatype definitions. -''' +""" import ctypes import niswitch._visatype as _visatype @@ -21,15 +21,27 @@ def __init__(self, expected_type, expected_value): def __eq__(self, other): if not isinstance(other, self.expected_type): - print("{0}: Unexpected type. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_type, type(other))) + print( + "{0}: Unexpected type. Expected: {1}. Received: {2}".format( + self.__class__.__name__, self.expected_type, type(other) + ) + ) return False if other.value != self.expected_value: - print("{0}: Unexpected value. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_value, other.value)) + print( + "{0}: Unexpected value. Expected: {1}. Received: {2}".format( + self.__class__.__name__, self.expected_value, other.value + ) + ) return False return True def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_type), + pp.pformat(self.expected_value), + ) class _PointerMatcher(object): @@ -38,12 +50,18 @@ def __init__(self, expected_type): def __eq__(self, other): if not isinstance(other, ctypes.POINTER(self.expected_type)): - print("Unexpected type. Expected: {0}. Received: {1}".format(ctypes.POINTER(self.expected_type), type(other))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + ctypes.POINTER(self.expected_type), type(other) + ) + ) return False return True def __repr__(self): - return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_type)) + return "{0}({1})".format( + self.__class__.__name__, pp.pformat(self.expected_type) + ) class _BufferMatcher(object): @@ -70,29 +88,47 @@ def __eq__(self, other): pass # Because of object lifetimes, we may need to mock the other instance and provide lists instead of the actual array - if not isinstance(other, self.expected_type) and not isinstance(other, list): - print("Unexpected type. Expected: {0} or {1}. Received: {2}".format(self.expected_type, list, type(other))) + if not isinstance(other, self.expected_type) and not isinstance( + other, list + ): + print( + "Unexpected type. Expected: {0} or {1}. Received: {2}".format( + self.expected_type, list, type(other) + ) + ) return False if self.expected_size != len(other): - print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(other))) + print( + "Unexpected length. Expected: {0}. Received: {1}".format( + self.expected_size, len(other) + ) + ) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for i in range(0, len(self.expected_value)): if self.expected_value[i] != other[i]: - print("Unexpected value at index {0}. Expected: {1}. Received: {2}".format(i, self.expected_value[i], other[i])) + print( + "Unexpected value at index {0}. Expected: {1}. Received: {2}".format( + i, self.expected_value[i], other[i] + ) + ) return False return True def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self._expected_element_type), pp.pformat(self._expected_size_or_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self._expected_element_type), + pp.pformat(self._expected_size_or_value), + ) def __str__(self): - ret_str = self.__repr__() + '\n' - ret_str += ' expected_type = ' + str(self.expected_type) + '\n' - ret_str += ' expected_value = ' + str(self.expected_value) + '\n' - ret_str += ' expected_size = ' + str(self.expected_size) + '\n' + ret_str = self.__repr__() + "\n" + ret_str += " expected_type = " + str(self.expected_type) + "\n" + ret_str += " expected_value = " + str(self.expected_value) + "\n" + ret_str += " expected_size = " + str(self.expected_size) + "\n" return ret_str @@ -112,21 +148,37 @@ def __eq__(self, other): pass if not isinstance(other, ctypes.Array): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(other))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_type, type(other) + ) + ) return False - if len(other) < len(self.expected_string_value) + 1: # +1 for NULL terminating character - print("Unexpected length in C string. Expected at least: {0}. Received {1}".format(len(other), len(self.expected_string_value) + 1)) + if ( + len(other) < len(self.expected_string_value) + 1 + ): # +1 for NULL terminating character + print( + "Unexpected length in C string. Expected at least: {0}. Received {1}".format( + len(other), len(self.expected_string_value) + 1 + ) + ) return False if not isinstance(other[0], bytes): print("Unexpected type. Not a string. Received: {0}".format(type(other[0]))) return False if other.value.decode("ascii") != self.expected_string_value: - print("Unexpected value. Expected {0}. Received: {1}".format(self.expected_string_value, other.value.decode)) + print( + "Unexpected value. Expected {0}. Received: {1}".format( + self.expected_string_value, other.value.decode + ) + ) return False return True def __repr__(self): - return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_string_value)) + return "{0}({1})".format( + self.__class__.__name__, pp.pformat(self.expected_string_value) + ) # Custom Type @@ -139,7 +191,11 @@ def _compare_ctype_structs(expected, actual): expected_val = getattr(expected, field_name) actual_val = getattr(actual, field_name) if expected_val != actual_val: - print("Unexpected value field {0}. Expected: {1}. Received: {2}".format(field_name, expected_val, actual_val)) + print( + "Unexpected value field {0}. Expected: {1}. Received: {2}".format( + field_name, expected_val, actual_val + ) + ) return False return True @@ -151,12 +207,20 @@ def __init__(self, expected_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_type, type(actual) + ) + ) return False return _compare_ctype_structs(self.expected_value, actual) def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_type), + pp.pformat(self.expected_value), + ) class CustomTypeBufferMatcher(object): @@ -168,30 +232,48 @@ def __init__(self, expected_element_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print("Unexpected array type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) + print( + "Unexpected array type. Expected: {0}. Received: {1}".format( + self.expected_type, type(actual) + ) + ) return False if self.expected_size != len(actual): - print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(actual))) + print( + "Unexpected length. Expected: {0}. Received: {1}".format( + self.expected_size, len(actual) + ) + ) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for a, e in zip(actual, self.expected_value): if not isinstance(a, self.expected_element_type): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_element_type, type(a))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_element_type, type(a) + ) + ) return False if not _compare_ctype_structs(e, a): return False return True def __repr__(self): - expected_val_repr = '[' + ', '.join([x.__repr__() for x in self.expected_value]) + ']' - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_element_type), expected_val_repr) + expected_val_repr = ( + "[" + ", ".join([x.__repr__() for x in self.expected_value]) + "]" + ) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_element_type), + expected_val_repr, + ) def __str__(self): - ret_str = self.__repr__() + '\n' - ret_str += ' expected_type = ' + str(self.expected_type) + '\n' - ret_str += ' expected_size = ' + str(self.expected_size) + '\n' + ret_str = self.__repr__() + "\n" + ret_str += " expected_type = " + str(self.expected_type) + "\n" + ret_str += " expected_size = " + str(self.expected_size) + "\n" return ret_str @@ -200,7 +282,9 @@ def __str__(self): class ViBooleanMatcher(_ScalarMatcher): def __init__(self, expected_value): - _ScalarMatcher.__init__(self, _visatype.ViBoolean, 1 if expected_value is True else 0) + _ScalarMatcher.__init__( + self, _visatype.ViBoolean, 1 if expected_value is True else 0 + ) class ViSessionMatcher(_ScalarMatcher): @@ -312,6 +396,3 @@ def __init__(self, expected_size_or_value): class ViSessionBufferMatcher(_BufferMatcher): def __init__(self, expected_size_or_value): _BufferMatcher.__init__(self, _visatype.ViSession, expected_size_or_value) - - - diff --git a/generated/niswitch/niswitch/unit_tests/_mock_helper.py b/generated/niswitch/niswitch/unit_tests/_mock_helper.py index c7b4221b5..d509168f0 100644 --- a/generated/niswitch/niswitch/unit_tests/_mock_helper.py +++ b/generated/niswitch/niswitch/unit_tests/_mock_helper.py @@ -16,102 +16,102 @@ def __init__(self, function, param=None): class SideEffectsHelper(object): def __init__(self): self._defaults = {} - self._defaults['AbortScan'] = {} - self._defaults['AbortScan']['return'] = 0 - self._defaults['CanConnect'] = {} - self._defaults['CanConnect']['return'] = 0 - self._defaults['CanConnect']['pathCapability'] = None - self._defaults['Commit'] = {} - self._defaults['Commit']['return'] = 0 - self._defaults['Connect'] = {} - self._defaults['Connect']['return'] = 0 - self._defaults['ConnectMultiple'] = {} - self._defaults['ConnectMultiple']['return'] = 0 - self._defaults['Disable'] = {} - self._defaults['Disable']['return'] = 0 - self._defaults['Disconnect'] = {} - self._defaults['Disconnect']['return'] = 0 - self._defaults['DisconnectAll'] = {} - self._defaults['DisconnectAll']['return'] = 0 - self._defaults['DisconnectMultiple'] = {} - self._defaults['DisconnectMultiple']['return'] = 0 - self._defaults['GetAttributeViBoolean'] = {} - self._defaults['GetAttributeViBoolean']['return'] = 0 - self._defaults['GetAttributeViBoolean']['attributeValue'] = None - self._defaults['GetAttributeViInt32'] = {} - self._defaults['GetAttributeViInt32']['return'] = 0 - self._defaults['GetAttributeViInt32']['attributeValue'] = None - self._defaults['GetAttributeViReal64'] = {} - self._defaults['GetAttributeViReal64']['return'] = 0 - self._defaults['GetAttributeViReal64']['attributeValue'] = None - self._defaults['GetAttributeViString'] = {} - self._defaults['GetAttributeViString']['return'] = 0 - self._defaults['GetAttributeViString']['attributeValue'] = None - self._defaults['GetChannelName'] = {} - self._defaults['GetChannelName']['return'] = 0 - self._defaults['GetChannelName']['channelNameBuffer'] = None - self._defaults['GetError'] = {} - self._defaults['GetError']['return'] = 0 - self._defaults['GetError']['code'] = None - self._defaults['GetError']['description'] = None - self._defaults['GetPath'] = {} - self._defaults['GetPath']['return'] = 0 - self._defaults['GetPath']['path'] = None - self._defaults['GetRelayCount'] = {} - self._defaults['GetRelayCount']['return'] = 0 - self._defaults['GetRelayCount']['relayCount'] = None - self._defaults['GetRelayName'] = {} - self._defaults['GetRelayName']['return'] = 0 - self._defaults['GetRelayName']['relayNameBuffer'] = None - self._defaults['GetRelayPosition'] = {} - self._defaults['GetRelayPosition']['return'] = 0 - self._defaults['GetRelayPosition']['relayPosition'] = None - self._defaults['InitWithTopology'] = {} - self._defaults['InitWithTopology']['return'] = 0 - self._defaults['InitWithTopology']['vi'] = None - self._defaults['InitiateScan'] = {} - self._defaults['InitiateScan']['return'] = 0 - self._defaults['LockSession'] = {} - self._defaults['LockSession']['return'] = 0 - self._defaults['LockSession']['callerHasLock'] = None - self._defaults['RelayControl'] = {} - self._defaults['RelayControl']['return'] = 0 - self._defaults['ResetWithDefaults'] = {} - self._defaults['ResetWithDefaults']['return'] = 0 - self._defaults['RouteScanAdvancedOutput'] = {} - self._defaults['RouteScanAdvancedOutput']['return'] = 0 - self._defaults['RouteTriggerInput'] = {} - self._defaults['RouteTriggerInput']['return'] = 0 - self._defaults['SendSoftwareTrigger'] = {} - self._defaults['SendSoftwareTrigger']['return'] = 0 - self._defaults['SetAttributeViBoolean'] = {} - self._defaults['SetAttributeViBoolean']['return'] = 0 - self._defaults['SetAttributeViInt32'] = {} - self._defaults['SetAttributeViInt32']['return'] = 0 - self._defaults['SetAttributeViReal64'] = {} - self._defaults['SetAttributeViReal64']['return'] = 0 - self._defaults['SetAttributeViString'] = {} - self._defaults['SetAttributeViString']['return'] = 0 - self._defaults['SetPath'] = {} - self._defaults['SetPath']['return'] = 0 - self._defaults['UnlockSession'] = {} - self._defaults['UnlockSession']['return'] = 0 - self._defaults['UnlockSession']['callerHasLock'] = None - self._defaults['WaitForDebounce'] = {} - self._defaults['WaitForDebounce']['return'] = 0 - self._defaults['WaitForScanComplete'] = {} - self._defaults['WaitForScanComplete']['return'] = 0 - self._defaults['close'] = {} - self._defaults['close']['return'] = 0 - self._defaults['error_message'] = {} - self._defaults['error_message']['return'] = 0 - self._defaults['error_message']['errorMessage'] = None - self._defaults['reset'] = {} - self._defaults['reset']['return'] = 0 - self._defaults['self_test'] = {} - self._defaults['self_test']['return'] = 0 - self._defaults['self_test']['selfTestResult'] = None - self._defaults['self_test']['selfTestMessage'] = None + self._defaults["AbortScan"] = {} + self._defaults["AbortScan"]["return"] = 0 + self._defaults["CanConnect"] = {} + self._defaults["CanConnect"]["return"] = 0 + self._defaults["CanConnect"]["pathCapability"] = None + self._defaults["Commit"] = {} + self._defaults["Commit"]["return"] = 0 + self._defaults["Connect"] = {} + self._defaults["Connect"]["return"] = 0 + self._defaults["ConnectMultiple"] = {} + self._defaults["ConnectMultiple"]["return"] = 0 + self._defaults["Disable"] = {} + self._defaults["Disable"]["return"] = 0 + self._defaults["Disconnect"] = {} + self._defaults["Disconnect"]["return"] = 0 + self._defaults["DisconnectAll"] = {} + self._defaults["DisconnectAll"]["return"] = 0 + self._defaults["DisconnectMultiple"] = {} + self._defaults["DisconnectMultiple"]["return"] = 0 + self._defaults["GetAttributeViBoolean"] = {} + self._defaults["GetAttributeViBoolean"]["return"] = 0 + self._defaults["GetAttributeViBoolean"]["attributeValue"] = None + self._defaults["GetAttributeViInt32"] = {} + self._defaults["GetAttributeViInt32"]["return"] = 0 + self._defaults["GetAttributeViInt32"]["attributeValue"] = None + self._defaults["GetAttributeViReal64"] = {} + self._defaults["GetAttributeViReal64"]["return"] = 0 + self._defaults["GetAttributeViReal64"]["attributeValue"] = None + self._defaults["GetAttributeViString"] = {} + self._defaults["GetAttributeViString"]["return"] = 0 + self._defaults["GetAttributeViString"]["attributeValue"] = None + self._defaults["GetChannelName"] = {} + self._defaults["GetChannelName"]["return"] = 0 + self._defaults["GetChannelName"]["channelNameBuffer"] = None + self._defaults["GetError"] = {} + self._defaults["GetError"]["return"] = 0 + self._defaults["GetError"]["code"] = None + self._defaults["GetError"]["description"] = None + self._defaults["GetPath"] = {} + self._defaults["GetPath"]["return"] = 0 + self._defaults["GetPath"]["path"] = None + self._defaults["GetRelayCount"] = {} + self._defaults["GetRelayCount"]["return"] = 0 + self._defaults["GetRelayCount"]["relayCount"] = None + self._defaults["GetRelayName"] = {} + self._defaults["GetRelayName"]["return"] = 0 + self._defaults["GetRelayName"]["relayNameBuffer"] = None + self._defaults["GetRelayPosition"] = {} + self._defaults["GetRelayPosition"]["return"] = 0 + self._defaults["GetRelayPosition"]["relayPosition"] = None + self._defaults["InitWithTopology"] = {} + self._defaults["InitWithTopology"]["return"] = 0 + self._defaults["InitWithTopology"]["vi"] = None + self._defaults["InitiateScan"] = {} + self._defaults["InitiateScan"]["return"] = 0 + self._defaults["LockSession"] = {} + self._defaults["LockSession"]["return"] = 0 + self._defaults["LockSession"]["callerHasLock"] = None + self._defaults["RelayControl"] = {} + self._defaults["RelayControl"]["return"] = 0 + self._defaults["ResetWithDefaults"] = {} + self._defaults["ResetWithDefaults"]["return"] = 0 + self._defaults["RouteScanAdvancedOutput"] = {} + self._defaults["RouteScanAdvancedOutput"]["return"] = 0 + self._defaults["RouteTriggerInput"] = {} + self._defaults["RouteTriggerInput"]["return"] = 0 + self._defaults["SendSoftwareTrigger"] = {} + self._defaults["SendSoftwareTrigger"]["return"] = 0 + self._defaults["SetAttributeViBoolean"] = {} + self._defaults["SetAttributeViBoolean"]["return"] = 0 + self._defaults["SetAttributeViInt32"] = {} + self._defaults["SetAttributeViInt32"]["return"] = 0 + self._defaults["SetAttributeViReal64"] = {} + self._defaults["SetAttributeViReal64"]["return"] = 0 + self._defaults["SetAttributeViString"] = {} + self._defaults["SetAttributeViString"]["return"] = 0 + self._defaults["SetPath"] = {} + self._defaults["SetPath"]["return"] = 0 + self._defaults["UnlockSession"] = {} + self._defaults["UnlockSession"]["return"] = 0 + self._defaults["UnlockSession"]["callerHasLock"] = None + self._defaults["WaitForDebounce"] = {} + self._defaults["WaitForDebounce"]["return"] = 0 + self._defaults["WaitForScanComplete"] = {} + self._defaults["WaitForScanComplete"]["return"] = 0 + self._defaults["close"] = {} + self._defaults["close"]["return"] = 0 + self._defaults["error_message"] = {} + self._defaults["error_message"]["return"] = 0 + self._defaults["error_message"]["errorMessage"] = None + self._defaults["reset"] = {} + self._defaults["reset"]["return"] = 0 + self._defaults["self_test"] = {} + self._defaults["self_test"]["return"] = 0 + self._defaults["self_test"]["selfTestResult"] = None + self._defaults["self_test"]["selfTestMessage"] = None def __getitem__(self, func): return self._defaults[func] @@ -120,375 +120,517 @@ def __setitem__(self, func, val): self._defaults[func] = val def niSwitch_AbortScan(self, vi): # noqa: N802 - if self._defaults['AbortScan']['return'] != 0: - return self._defaults['AbortScan']['return'] - return self._defaults['AbortScan']['return'] - - def niSwitch_CanConnect(self, vi, channel1, channel2, path_capability): # noqa: N802 - if self._defaults['CanConnect']['return'] != 0: - return self._defaults['CanConnect']['return'] + if self._defaults["AbortScan"]["return"] != 0: + return self._defaults["AbortScan"]["return"] + return self._defaults["AbortScan"]["return"] + + def niSwitch_CanConnect( + self, vi, channel1, channel2, path_capability + ): # noqa: N802 + if self._defaults["CanConnect"]["return"] != 0: + return self._defaults["CanConnect"]["return"] # path_capability - if self._defaults['CanConnect']['pathCapability'] is None: - raise MockFunctionCallError("niSwitch_CanConnect", param='pathCapability') + if self._defaults["CanConnect"]["pathCapability"] is None: + raise MockFunctionCallError("niSwitch_CanConnect", param="pathCapability") if path_capability is not None: - path_capability.contents.value = self._defaults['CanConnect']['pathCapability'] - return self._defaults['CanConnect']['return'] + path_capability.contents.value = self._defaults["CanConnect"][ + "pathCapability" + ] + return self._defaults["CanConnect"]["return"] def niSwitch_Commit(self, vi): # noqa: N802 - if self._defaults['Commit']['return'] != 0: - return self._defaults['Commit']['return'] - return self._defaults['Commit']['return'] + if self._defaults["Commit"]["return"] != 0: + return self._defaults["Commit"]["return"] + return self._defaults["Commit"]["return"] def niSwitch_Connect(self, vi, channel1, channel2): # noqa: N802 - if self._defaults['Connect']['return'] != 0: - return self._defaults['Connect']['return'] - return self._defaults['Connect']['return'] + if self._defaults["Connect"]["return"] != 0: + return self._defaults["Connect"]["return"] + return self._defaults["Connect"]["return"] def niSwitch_ConnectMultiple(self, vi, connection_list): # noqa: N802 - if self._defaults['ConnectMultiple']['return'] != 0: - return self._defaults['ConnectMultiple']['return'] - return self._defaults['ConnectMultiple']['return'] + if self._defaults["ConnectMultiple"]["return"] != 0: + return self._defaults["ConnectMultiple"]["return"] + return self._defaults["ConnectMultiple"]["return"] def niSwitch_Disable(self, vi): # noqa: N802 - if self._defaults['Disable']['return'] != 0: - return self._defaults['Disable']['return'] - return self._defaults['Disable']['return'] + if self._defaults["Disable"]["return"] != 0: + return self._defaults["Disable"]["return"] + return self._defaults["Disable"]["return"] def niSwitch_Disconnect(self, vi, channel1, channel2): # noqa: N802 - if self._defaults['Disconnect']['return'] != 0: - return self._defaults['Disconnect']['return'] - return self._defaults['Disconnect']['return'] + if self._defaults["Disconnect"]["return"] != 0: + return self._defaults["Disconnect"]["return"] + return self._defaults["Disconnect"]["return"] def niSwitch_DisconnectAll(self, vi): # noqa: N802 - if self._defaults['DisconnectAll']['return'] != 0: - return self._defaults['DisconnectAll']['return'] - return self._defaults['DisconnectAll']['return'] + if self._defaults["DisconnectAll"]["return"] != 0: + return self._defaults["DisconnectAll"]["return"] + return self._defaults["DisconnectAll"]["return"] def niSwitch_DisconnectMultiple(self, vi, disconnection_list): # noqa: N802 - if self._defaults['DisconnectMultiple']['return'] != 0: - return self._defaults['DisconnectMultiple']['return'] - return self._defaults['DisconnectMultiple']['return'] - - def niSwitch_GetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['GetAttributeViBoolean']['return'] != 0: - return self._defaults['GetAttributeViBoolean']['return'] + if self._defaults["DisconnectMultiple"]["return"] != 0: + return self._defaults["DisconnectMultiple"]["return"] + return self._defaults["DisconnectMultiple"]["return"] + + def niSwitch_GetAttributeViBoolean( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["GetAttributeViBoolean"]["return"] != 0: + return self._defaults["GetAttributeViBoolean"]["return"] # attribute_value - if self._defaults['GetAttributeViBoolean']['attributeValue'] is None: - raise MockFunctionCallError("niSwitch_GetAttributeViBoolean", param='attributeValue') + if self._defaults["GetAttributeViBoolean"]["attributeValue"] is None: + raise MockFunctionCallError( + "niSwitch_GetAttributeViBoolean", param="attributeValue" + ) if attribute_value is not None: - attribute_value.contents.value = self._defaults['GetAttributeViBoolean']['attributeValue'] - return self._defaults['GetAttributeViBoolean']['return'] - - def niSwitch_GetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['GetAttributeViInt32']['return'] != 0: - return self._defaults['GetAttributeViInt32']['return'] + attribute_value.contents.value = self._defaults["GetAttributeViBoolean"][ + "attributeValue" + ] + return self._defaults["GetAttributeViBoolean"]["return"] + + def niSwitch_GetAttributeViInt32( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["GetAttributeViInt32"]["return"] != 0: + return self._defaults["GetAttributeViInt32"]["return"] # attribute_value - if self._defaults['GetAttributeViInt32']['attributeValue'] is None: - raise MockFunctionCallError("niSwitch_GetAttributeViInt32", param='attributeValue') + if self._defaults["GetAttributeViInt32"]["attributeValue"] is None: + raise MockFunctionCallError( + "niSwitch_GetAttributeViInt32", param="attributeValue" + ) if attribute_value is not None: - attribute_value.contents.value = self._defaults['GetAttributeViInt32']['attributeValue'] - return self._defaults['GetAttributeViInt32']['return'] - - def niSwitch_GetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['GetAttributeViReal64']['return'] != 0: - return self._defaults['GetAttributeViReal64']['return'] + attribute_value.contents.value = self._defaults["GetAttributeViInt32"][ + "attributeValue" + ] + return self._defaults["GetAttributeViInt32"]["return"] + + def niSwitch_GetAttributeViReal64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["GetAttributeViReal64"]["return"] != 0: + return self._defaults["GetAttributeViReal64"]["return"] # attribute_value - if self._defaults['GetAttributeViReal64']['attributeValue'] is None: - raise MockFunctionCallError("niSwitch_GetAttributeViReal64", param='attributeValue') + if self._defaults["GetAttributeViReal64"]["attributeValue"] is None: + raise MockFunctionCallError( + "niSwitch_GetAttributeViReal64", param="attributeValue" + ) if attribute_value is not None: - attribute_value.contents.value = self._defaults['GetAttributeViReal64']['attributeValue'] - return self._defaults['GetAttributeViReal64']['return'] - - def niSwitch_GetAttributeViString(self, vi, channel_name, attribute_id, array_size, attribute_value): # noqa: N802 - if self._defaults['GetAttributeViString']['return'] != 0: - return self._defaults['GetAttributeViString']['return'] - if self._defaults['GetAttributeViString']['attributeValue'] is None: - raise MockFunctionCallError("niSwitch_GetAttributeViString", param='attributeValue') + attribute_value.contents.value = self._defaults["GetAttributeViReal64"][ + "attributeValue" + ] + return self._defaults["GetAttributeViReal64"]["return"] + + def niSwitch_GetAttributeViString( + self, vi, channel_name, attribute_id, array_size, attribute_value + ): # noqa: N802 + if self._defaults["GetAttributeViString"]["return"] != 0: + return self._defaults["GetAttributeViString"]["return"] + if self._defaults["GetAttributeViString"]["attributeValue"] is None: + raise MockFunctionCallError( + "niSwitch_GetAttributeViString", param="attributeValue" + ) if array_size.value == 0: - return len(self._defaults['GetAttributeViString']['attributeValue']) - attribute_value.value = self._defaults['GetAttributeViString']['attributeValue'].encode('ascii') - return self._defaults['GetAttributeViString']['return'] - - def niSwitch_GetChannelName(self, vi, index, buffer_size, channel_name_buffer): # noqa: N802 - if self._defaults['GetChannelName']['return'] != 0: - return self._defaults['GetChannelName']['return'] - if self._defaults['GetChannelName']['channelNameBuffer'] is None: - raise MockFunctionCallError("niSwitch_GetChannelName", param='channelNameBuffer') + return len(self._defaults["GetAttributeViString"]["attributeValue"]) + attribute_value.value = self._defaults["GetAttributeViString"][ + "attributeValue" + ].encode("ascii") + return self._defaults["GetAttributeViString"]["return"] + + def niSwitch_GetChannelName( + self, vi, index, buffer_size, channel_name_buffer + ): # noqa: N802 + if self._defaults["GetChannelName"]["return"] != 0: + return self._defaults["GetChannelName"]["return"] + if self._defaults["GetChannelName"]["channelNameBuffer"] is None: + raise MockFunctionCallError( + "niSwitch_GetChannelName", param="channelNameBuffer" + ) if buffer_size.value == 0: - return len(self._defaults['GetChannelName']['channelNameBuffer']) - channel_name_buffer.value = self._defaults['GetChannelName']['channelNameBuffer'].encode('ascii') - return self._defaults['GetChannelName']['return'] + return len(self._defaults["GetChannelName"]["channelNameBuffer"]) + channel_name_buffer.value = self._defaults["GetChannelName"][ + "channelNameBuffer" + ].encode("ascii") + return self._defaults["GetChannelName"]["return"] def niSwitch_GetError(self, vi, code, buffer_size, description): # noqa: N802 - if self._defaults['GetError']['return'] != 0: - return self._defaults['GetError']['return'] + if self._defaults["GetError"]["return"] != 0: + return self._defaults["GetError"]["return"] # code - if self._defaults['GetError']['code'] is None: - raise MockFunctionCallError("niSwitch_GetError", param='code') + if self._defaults["GetError"]["code"] is None: + raise MockFunctionCallError("niSwitch_GetError", param="code") if code is not None: - code.contents.value = self._defaults['GetError']['code'] - if self._defaults['GetError']['description'] is None: - raise MockFunctionCallError("niSwitch_GetError", param='description') + code.contents.value = self._defaults["GetError"]["code"] + if self._defaults["GetError"]["description"] is None: + raise MockFunctionCallError("niSwitch_GetError", param="description") if buffer_size.value == 0: - return len(self._defaults['GetError']['description']) - description.value = self._defaults['GetError']['description'].encode('ascii') - return self._defaults['GetError']['return'] + return len(self._defaults["GetError"]["description"]) + description.value = self._defaults["GetError"]["description"].encode("ascii") + return self._defaults["GetError"]["return"] def niSwitch_GetPath(self, vi, channel1, channel2, buffer_size, path): # noqa: N802 - if self._defaults['GetPath']['return'] != 0: - return self._defaults['GetPath']['return'] - if self._defaults['GetPath']['path'] is None: - raise MockFunctionCallError("niSwitch_GetPath", param='path') + if self._defaults["GetPath"]["return"] != 0: + return self._defaults["GetPath"]["return"] + if self._defaults["GetPath"]["path"] is None: + raise MockFunctionCallError("niSwitch_GetPath", param="path") if buffer_size.value == 0: - return len(self._defaults['GetPath']['path']) - path.value = self._defaults['GetPath']['path'].encode('ascii') - return self._defaults['GetPath']['return'] + return len(self._defaults["GetPath"]["path"]) + path.value = self._defaults["GetPath"]["path"].encode("ascii") + return self._defaults["GetPath"]["return"] def niSwitch_GetRelayCount(self, vi, relay_name, relay_count): # noqa: N802 - if self._defaults['GetRelayCount']['return'] != 0: - return self._defaults['GetRelayCount']['return'] + if self._defaults["GetRelayCount"]["return"] != 0: + return self._defaults["GetRelayCount"]["return"] # relay_count - if self._defaults['GetRelayCount']['relayCount'] is None: - raise MockFunctionCallError("niSwitch_GetRelayCount", param='relayCount') + if self._defaults["GetRelayCount"]["relayCount"] is None: + raise MockFunctionCallError("niSwitch_GetRelayCount", param="relayCount") if relay_count is not None: - relay_count.contents.value = self._defaults['GetRelayCount']['relayCount'] - return self._defaults['GetRelayCount']['return'] - - def niSwitch_GetRelayName(self, vi, index, relay_name_buffer_size, relay_name_buffer): # noqa: N802 - if self._defaults['GetRelayName']['return'] != 0: - return self._defaults['GetRelayName']['return'] - if self._defaults['GetRelayName']['relayNameBuffer'] is None: - raise MockFunctionCallError("niSwitch_GetRelayName", param='relayNameBuffer') + relay_count.contents.value = self._defaults["GetRelayCount"]["relayCount"] + return self._defaults["GetRelayCount"]["return"] + + def niSwitch_GetRelayName( + self, vi, index, relay_name_buffer_size, relay_name_buffer + ): # noqa: N802 + if self._defaults["GetRelayName"]["return"] != 0: + return self._defaults["GetRelayName"]["return"] + if self._defaults["GetRelayName"]["relayNameBuffer"] is None: + raise MockFunctionCallError( + "niSwitch_GetRelayName", param="relayNameBuffer" + ) if relay_name_buffer_size.value == 0: - return len(self._defaults['GetRelayName']['relayNameBuffer']) - relay_name_buffer.value = self._defaults['GetRelayName']['relayNameBuffer'].encode('ascii') - return self._defaults['GetRelayName']['return'] + return len(self._defaults["GetRelayName"]["relayNameBuffer"]) + relay_name_buffer.value = self._defaults["GetRelayName"][ + "relayNameBuffer" + ].encode("ascii") + return self._defaults["GetRelayName"]["return"] def niSwitch_GetRelayPosition(self, vi, relay_name, relay_position): # noqa: N802 - if self._defaults['GetRelayPosition']['return'] != 0: - return self._defaults['GetRelayPosition']['return'] + if self._defaults["GetRelayPosition"]["return"] != 0: + return self._defaults["GetRelayPosition"]["return"] # relay_position - if self._defaults['GetRelayPosition']['relayPosition'] is None: - raise MockFunctionCallError("niSwitch_GetRelayPosition", param='relayPosition') + if self._defaults["GetRelayPosition"]["relayPosition"] is None: + raise MockFunctionCallError( + "niSwitch_GetRelayPosition", param="relayPosition" + ) if relay_position is not None: - relay_position.contents.value = self._defaults['GetRelayPosition']['relayPosition'] - return self._defaults['GetRelayPosition']['return'] - - def niSwitch_InitWithTopology(self, resource_name, topology, simulate, reset_device, vi): # noqa: N802 - if self._defaults['InitWithTopology']['return'] != 0: - return self._defaults['InitWithTopology']['return'] + relay_position.contents.value = self._defaults["GetRelayPosition"][ + "relayPosition" + ] + return self._defaults["GetRelayPosition"]["return"] + + def niSwitch_InitWithTopology( + self, resource_name, topology, simulate, reset_device, vi + ): # noqa: N802 + if self._defaults["InitWithTopology"]["return"] != 0: + return self._defaults["InitWithTopology"]["return"] # vi - if self._defaults['InitWithTopology']['vi'] is None: - raise MockFunctionCallError("niSwitch_InitWithTopology", param='vi') + if self._defaults["InitWithTopology"]["vi"] is None: + raise MockFunctionCallError("niSwitch_InitWithTopology", param="vi") if vi is not None: - vi.contents.value = self._defaults['InitWithTopology']['vi'] - return self._defaults['InitWithTopology']['return'] + vi.contents.value = self._defaults["InitWithTopology"]["vi"] + return self._defaults["InitWithTopology"]["return"] def niSwitch_InitiateScan(self, vi): # noqa: N802 - if self._defaults['InitiateScan']['return'] != 0: - return self._defaults['InitiateScan']['return'] - return self._defaults['InitiateScan']['return'] + if self._defaults["InitiateScan"]["return"] != 0: + return self._defaults["InitiateScan"]["return"] + return self._defaults["InitiateScan"]["return"] def niSwitch_LockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults['LockSession']['return'] != 0: - return self._defaults['LockSession']['return'] + if self._defaults["LockSession"]["return"] != 0: + return self._defaults["LockSession"]["return"] # caller_has_lock - if self._defaults['LockSession']['callerHasLock'] is None: - raise MockFunctionCallError("niSwitch_LockSession", param='callerHasLock') + if self._defaults["LockSession"]["callerHasLock"] is None: + raise MockFunctionCallError("niSwitch_LockSession", param="callerHasLock") if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults['LockSession']['callerHasLock'] - return self._defaults['LockSession']['return'] + caller_has_lock.contents.value = self._defaults["LockSession"][ + "callerHasLock" + ] + return self._defaults["LockSession"]["return"] def niSwitch_RelayControl(self, vi, relay_name, relay_action): # noqa: N802 - if self._defaults['RelayControl']['return'] != 0: - return self._defaults['RelayControl']['return'] - return self._defaults['RelayControl']['return'] + if self._defaults["RelayControl"]["return"] != 0: + return self._defaults["RelayControl"]["return"] + return self._defaults["RelayControl"]["return"] def niSwitch_ResetWithDefaults(self, vi): # noqa: N802 - if self._defaults['ResetWithDefaults']['return'] != 0: - return self._defaults['ResetWithDefaults']['return'] - return self._defaults['ResetWithDefaults']['return'] - - def niSwitch_RouteScanAdvancedOutput(self, vi, scan_advanced_output_connector, scan_advanced_output_bus_line, invert): # noqa: N802 - if self._defaults['RouteScanAdvancedOutput']['return'] != 0: - return self._defaults['RouteScanAdvancedOutput']['return'] - return self._defaults['RouteScanAdvancedOutput']['return'] - - def niSwitch_RouteTriggerInput(self, vi, trigger_input_connector, trigger_input_bus_line, invert): # noqa: N802 - if self._defaults['RouteTriggerInput']['return'] != 0: - return self._defaults['RouteTriggerInput']['return'] - return self._defaults['RouteTriggerInput']['return'] + if self._defaults["ResetWithDefaults"]["return"] != 0: + return self._defaults["ResetWithDefaults"]["return"] + return self._defaults["ResetWithDefaults"]["return"] + + def niSwitch_RouteScanAdvancedOutput( + self, vi, scan_advanced_output_connector, scan_advanced_output_bus_line, invert + ): # noqa: N802 + if self._defaults["RouteScanAdvancedOutput"]["return"] != 0: + return self._defaults["RouteScanAdvancedOutput"]["return"] + return self._defaults["RouteScanAdvancedOutput"]["return"] + + def niSwitch_RouteTriggerInput( + self, vi, trigger_input_connector, trigger_input_bus_line, invert + ): # noqa: N802 + if self._defaults["RouteTriggerInput"]["return"] != 0: + return self._defaults["RouteTriggerInput"]["return"] + return self._defaults["RouteTriggerInput"]["return"] def niSwitch_SendSoftwareTrigger(self, vi): # noqa: N802 - if self._defaults['SendSoftwareTrigger']['return'] != 0: - return self._defaults['SendSoftwareTrigger']['return'] - return self._defaults['SendSoftwareTrigger']['return'] - - def niSwitch_SetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['SetAttributeViBoolean']['return'] != 0: - return self._defaults['SetAttributeViBoolean']['return'] - return self._defaults['SetAttributeViBoolean']['return'] - - def niSwitch_SetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['SetAttributeViInt32']['return'] != 0: - return self._defaults['SetAttributeViInt32']['return'] - return self._defaults['SetAttributeViInt32']['return'] - - def niSwitch_SetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['SetAttributeViReal64']['return'] != 0: - return self._defaults['SetAttributeViReal64']['return'] - return self._defaults['SetAttributeViReal64']['return'] - - def niSwitch_SetAttributeViString(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 - if self._defaults['SetAttributeViString']['return'] != 0: - return self._defaults['SetAttributeViString']['return'] - return self._defaults['SetAttributeViString']['return'] + if self._defaults["SendSoftwareTrigger"]["return"] != 0: + return self._defaults["SendSoftwareTrigger"]["return"] + return self._defaults["SendSoftwareTrigger"]["return"] + + def niSwitch_SetAttributeViBoolean( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["SetAttributeViBoolean"]["return"] != 0: + return self._defaults["SetAttributeViBoolean"]["return"] + return self._defaults["SetAttributeViBoolean"]["return"] + + def niSwitch_SetAttributeViInt32( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["SetAttributeViInt32"]["return"] != 0: + return self._defaults["SetAttributeViInt32"]["return"] + return self._defaults["SetAttributeViInt32"]["return"] + + def niSwitch_SetAttributeViReal64( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["SetAttributeViReal64"]["return"] != 0: + return self._defaults["SetAttributeViReal64"]["return"] + return self._defaults["SetAttributeViReal64"]["return"] + + def niSwitch_SetAttributeViString( + self, vi, channel_name, attribute_id, attribute_value + ): # noqa: N802 + if self._defaults["SetAttributeViString"]["return"] != 0: + return self._defaults["SetAttributeViString"]["return"] + return self._defaults["SetAttributeViString"]["return"] def niSwitch_SetPath(self, vi, path_list): # noqa: N802 - if self._defaults['SetPath']['return'] != 0: - return self._defaults['SetPath']['return'] - return self._defaults['SetPath']['return'] + if self._defaults["SetPath"]["return"] != 0: + return self._defaults["SetPath"]["return"] + return self._defaults["SetPath"]["return"] def niSwitch_UnlockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults['UnlockSession']['return'] != 0: - return self._defaults['UnlockSession']['return'] + if self._defaults["UnlockSession"]["return"] != 0: + return self._defaults["UnlockSession"]["return"] # caller_has_lock - if self._defaults['UnlockSession']['callerHasLock'] is None: - raise MockFunctionCallError("niSwitch_UnlockSession", param='callerHasLock') + if self._defaults["UnlockSession"]["callerHasLock"] is None: + raise MockFunctionCallError("niSwitch_UnlockSession", param="callerHasLock") if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults['UnlockSession']['callerHasLock'] - return self._defaults['UnlockSession']['return'] + caller_has_lock.contents.value = self._defaults["UnlockSession"][ + "callerHasLock" + ] + return self._defaults["UnlockSession"]["return"] def niSwitch_WaitForDebounce(self, vi, maximum_time_ms): # noqa: N802 - if self._defaults['WaitForDebounce']['return'] != 0: - return self._defaults['WaitForDebounce']['return'] - return self._defaults['WaitForDebounce']['return'] + if self._defaults["WaitForDebounce"]["return"] != 0: + return self._defaults["WaitForDebounce"]["return"] + return self._defaults["WaitForDebounce"]["return"] def niSwitch_WaitForScanComplete(self, vi, maximum_time_ms): # noqa: N802 - if self._defaults['WaitForScanComplete']['return'] != 0: - return self._defaults['WaitForScanComplete']['return'] - return self._defaults['WaitForScanComplete']['return'] + if self._defaults["WaitForScanComplete"]["return"] != 0: + return self._defaults["WaitForScanComplete"]["return"] + return self._defaults["WaitForScanComplete"]["return"] def niSwitch_close(self, vi): # noqa: N802 - if self._defaults['close']['return'] != 0: - return self._defaults['close']['return'] - return self._defaults['close']['return'] + if self._defaults["close"]["return"] != 0: + return self._defaults["close"]["return"] + return self._defaults["close"]["return"] def niSwitch_error_message(self, vi, error_code, error_message): # noqa: N802 - if self._defaults['error_message']['return'] != 0: - return self._defaults['error_message']['return'] + if self._defaults["error_message"]["return"] != 0: + return self._defaults["error_message"]["return"] # error_message - if self._defaults['error_message']['errorMessage'] is None: - raise MockFunctionCallError("niSwitch_error_message", param='errorMessage') - test_value = self._defaults['error_message']['errorMessage'] + if self._defaults["error_message"]["errorMessage"] is None: + raise MockFunctionCallError("niSwitch_error_message", param="errorMessage") + test_value = self._defaults["error_message"]["errorMessage"] if type(test_value) is str: - test_value = test_value.encode('ascii') + test_value = test_value.encode("ascii") assert len(error_message) >= len(test_value) for i in range(len(test_value)): error_message[i] = test_value[i] - return self._defaults['error_message']['return'] + return self._defaults["error_message"]["return"] def niSwitch_reset(self, vi): # noqa: N802 - if self._defaults['reset']['return'] != 0: - return self._defaults['reset']['return'] - return self._defaults['reset']['return'] + if self._defaults["reset"]["return"] != 0: + return self._defaults["reset"]["return"] + return self._defaults["reset"]["return"] def niSwitch_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 - if self._defaults['self_test']['return'] != 0: - return self._defaults['self_test']['return'] + if self._defaults["self_test"]["return"] != 0: + return self._defaults["self_test"]["return"] # self_test_result - if self._defaults['self_test']['selfTestResult'] is None: - raise MockFunctionCallError("niSwitch_self_test", param='selfTestResult') + if self._defaults["self_test"]["selfTestResult"] is None: + raise MockFunctionCallError("niSwitch_self_test", param="selfTestResult") if self_test_result is not None: - self_test_result.contents.value = self._defaults['self_test']['selfTestResult'] + self_test_result.contents.value = self._defaults["self_test"][ + "selfTestResult" + ] # self_test_message - if self._defaults['self_test']['selfTestMessage'] is None: - raise MockFunctionCallError("niSwitch_self_test", param='selfTestMessage') - test_value = self._defaults['self_test']['selfTestMessage'] + if self._defaults["self_test"]["selfTestMessage"] is None: + raise MockFunctionCallError("niSwitch_self_test", param="selfTestMessage") + test_value = self._defaults["self_test"]["selfTestMessage"] if type(test_value) is str: - test_value = test_value.encode('ascii') + test_value = test_value.encode("ascii") assert len(self_test_message) >= len(test_value) for i in range(len(test_value)): self_test_message[i] = test_value[i] - return self._defaults['self_test']['return'] + return self._defaults["self_test"]["return"] # Helper function to setup Mock object with default side effects and return values def set_side_effects_and_return_values(self, mock_library): - mock_library.niSwitch_AbortScan.side_effect = MockFunctionCallError("niSwitch_AbortScan") + mock_library.niSwitch_AbortScan.side_effect = MockFunctionCallError( + "niSwitch_AbortScan" + ) mock_library.niSwitch_AbortScan.return_value = 0 - mock_library.niSwitch_CanConnect.side_effect = MockFunctionCallError("niSwitch_CanConnect") + mock_library.niSwitch_CanConnect.side_effect = MockFunctionCallError( + "niSwitch_CanConnect" + ) mock_library.niSwitch_CanConnect.return_value = 0 - mock_library.niSwitch_Commit.side_effect = MockFunctionCallError("niSwitch_Commit") + mock_library.niSwitch_Commit.side_effect = MockFunctionCallError( + "niSwitch_Commit" + ) mock_library.niSwitch_Commit.return_value = 0 - mock_library.niSwitch_Connect.side_effect = MockFunctionCallError("niSwitch_Connect") + mock_library.niSwitch_Connect.side_effect = MockFunctionCallError( + "niSwitch_Connect" + ) mock_library.niSwitch_Connect.return_value = 0 - mock_library.niSwitch_ConnectMultiple.side_effect = MockFunctionCallError("niSwitch_ConnectMultiple") + mock_library.niSwitch_ConnectMultiple.side_effect = MockFunctionCallError( + "niSwitch_ConnectMultiple" + ) mock_library.niSwitch_ConnectMultiple.return_value = 0 - mock_library.niSwitch_Disable.side_effect = MockFunctionCallError("niSwitch_Disable") + mock_library.niSwitch_Disable.side_effect = MockFunctionCallError( + "niSwitch_Disable" + ) mock_library.niSwitch_Disable.return_value = 0 - mock_library.niSwitch_Disconnect.side_effect = MockFunctionCallError("niSwitch_Disconnect") + mock_library.niSwitch_Disconnect.side_effect = MockFunctionCallError( + "niSwitch_Disconnect" + ) mock_library.niSwitch_Disconnect.return_value = 0 - mock_library.niSwitch_DisconnectAll.side_effect = MockFunctionCallError("niSwitch_DisconnectAll") + mock_library.niSwitch_DisconnectAll.side_effect = MockFunctionCallError( + "niSwitch_DisconnectAll" + ) mock_library.niSwitch_DisconnectAll.return_value = 0 - mock_library.niSwitch_DisconnectMultiple.side_effect = MockFunctionCallError("niSwitch_DisconnectMultiple") + mock_library.niSwitch_DisconnectMultiple.side_effect = MockFunctionCallError( + "niSwitch_DisconnectMultiple" + ) mock_library.niSwitch_DisconnectMultiple.return_value = 0 - mock_library.niSwitch_GetAttributeViBoolean.side_effect = MockFunctionCallError("niSwitch_GetAttributeViBoolean") + mock_library.niSwitch_GetAttributeViBoolean.side_effect = MockFunctionCallError( + "niSwitch_GetAttributeViBoolean" + ) mock_library.niSwitch_GetAttributeViBoolean.return_value = 0 - mock_library.niSwitch_GetAttributeViInt32.side_effect = MockFunctionCallError("niSwitch_GetAttributeViInt32") + mock_library.niSwitch_GetAttributeViInt32.side_effect = MockFunctionCallError( + "niSwitch_GetAttributeViInt32" + ) mock_library.niSwitch_GetAttributeViInt32.return_value = 0 - mock_library.niSwitch_GetAttributeViReal64.side_effect = MockFunctionCallError("niSwitch_GetAttributeViReal64") + mock_library.niSwitch_GetAttributeViReal64.side_effect = MockFunctionCallError( + "niSwitch_GetAttributeViReal64" + ) mock_library.niSwitch_GetAttributeViReal64.return_value = 0 - mock_library.niSwitch_GetAttributeViString.side_effect = MockFunctionCallError("niSwitch_GetAttributeViString") + mock_library.niSwitch_GetAttributeViString.side_effect = MockFunctionCallError( + "niSwitch_GetAttributeViString" + ) mock_library.niSwitch_GetAttributeViString.return_value = 0 - mock_library.niSwitch_GetChannelName.side_effect = MockFunctionCallError("niSwitch_GetChannelName") + mock_library.niSwitch_GetChannelName.side_effect = MockFunctionCallError( + "niSwitch_GetChannelName" + ) mock_library.niSwitch_GetChannelName.return_value = 0 - mock_library.niSwitch_GetError.side_effect = MockFunctionCallError("niSwitch_GetError") + mock_library.niSwitch_GetError.side_effect = MockFunctionCallError( + "niSwitch_GetError" + ) mock_library.niSwitch_GetError.return_value = 0 - mock_library.niSwitch_GetPath.side_effect = MockFunctionCallError("niSwitch_GetPath") + mock_library.niSwitch_GetPath.side_effect = MockFunctionCallError( + "niSwitch_GetPath" + ) mock_library.niSwitch_GetPath.return_value = 0 - mock_library.niSwitch_GetRelayCount.side_effect = MockFunctionCallError("niSwitch_GetRelayCount") + mock_library.niSwitch_GetRelayCount.side_effect = MockFunctionCallError( + "niSwitch_GetRelayCount" + ) mock_library.niSwitch_GetRelayCount.return_value = 0 - mock_library.niSwitch_GetRelayName.side_effect = MockFunctionCallError("niSwitch_GetRelayName") + mock_library.niSwitch_GetRelayName.side_effect = MockFunctionCallError( + "niSwitch_GetRelayName" + ) mock_library.niSwitch_GetRelayName.return_value = 0 - mock_library.niSwitch_GetRelayPosition.side_effect = MockFunctionCallError("niSwitch_GetRelayPosition") + mock_library.niSwitch_GetRelayPosition.side_effect = MockFunctionCallError( + "niSwitch_GetRelayPosition" + ) mock_library.niSwitch_GetRelayPosition.return_value = 0 - mock_library.niSwitch_InitWithTopology.side_effect = MockFunctionCallError("niSwitch_InitWithTopology") + mock_library.niSwitch_InitWithTopology.side_effect = MockFunctionCallError( + "niSwitch_InitWithTopology" + ) mock_library.niSwitch_InitWithTopology.return_value = 0 - mock_library.niSwitch_InitiateScan.side_effect = MockFunctionCallError("niSwitch_InitiateScan") + mock_library.niSwitch_InitiateScan.side_effect = MockFunctionCallError( + "niSwitch_InitiateScan" + ) mock_library.niSwitch_InitiateScan.return_value = 0 - mock_library.niSwitch_LockSession.side_effect = MockFunctionCallError("niSwitch_LockSession") + mock_library.niSwitch_LockSession.side_effect = MockFunctionCallError( + "niSwitch_LockSession" + ) mock_library.niSwitch_LockSession.return_value = 0 - mock_library.niSwitch_RelayControl.side_effect = MockFunctionCallError("niSwitch_RelayControl") + mock_library.niSwitch_RelayControl.side_effect = MockFunctionCallError( + "niSwitch_RelayControl" + ) mock_library.niSwitch_RelayControl.return_value = 0 - mock_library.niSwitch_ResetWithDefaults.side_effect = MockFunctionCallError("niSwitch_ResetWithDefaults") + mock_library.niSwitch_ResetWithDefaults.side_effect = MockFunctionCallError( + "niSwitch_ResetWithDefaults" + ) mock_library.niSwitch_ResetWithDefaults.return_value = 0 - mock_library.niSwitch_RouteScanAdvancedOutput.side_effect = MockFunctionCallError("niSwitch_RouteScanAdvancedOutput") + mock_library.niSwitch_RouteScanAdvancedOutput.side_effect = ( + MockFunctionCallError("niSwitch_RouteScanAdvancedOutput") + ) mock_library.niSwitch_RouteScanAdvancedOutput.return_value = 0 - mock_library.niSwitch_RouteTriggerInput.side_effect = MockFunctionCallError("niSwitch_RouteTriggerInput") + mock_library.niSwitch_RouteTriggerInput.side_effect = MockFunctionCallError( + "niSwitch_RouteTriggerInput" + ) mock_library.niSwitch_RouteTriggerInput.return_value = 0 - mock_library.niSwitch_SendSoftwareTrigger.side_effect = MockFunctionCallError("niSwitch_SendSoftwareTrigger") + mock_library.niSwitch_SendSoftwareTrigger.side_effect = MockFunctionCallError( + "niSwitch_SendSoftwareTrigger" + ) mock_library.niSwitch_SendSoftwareTrigger.return_value = 0 - mock_library.niSwitch_SetAttributeViBoolean.side_effect = MockFunctionCallError("niSwitch_SetAttributeViBoolean") + mock_library.niSwitch_SetAttributeViBoolean.side_effect = MockFunctionCallError( + "niSwitch_SetAttributeViBoolean" + ) mock_library.niSwitch_SetAttributeViBoolean.return_value = 0 - mock_library.niSwitch_SetAttributeViInt32.side_effect = MockFunctionCallError("niSwitch_SetAttributeViInt32") + mock_library.niSwitch_SetAttributeViInt32.side_effect = MockFunctionCallError( + "niSwitch_SetAttributeViInt32" + ) mock_library.niSwitch_SetAttributeViInt32.return_value = 0 - mock_library.niSwitch_SetAttributeViReal64.side_effect = MockFunctionCallError("niSwitch_SetAttributeViReal64") + mock_library.niSwitch_SetAttributeViReal64.side_effect = MockFunctionCallError( + "niSwitch_SetAttributeViReal64" + ) mock_library.niSwitch_SetAttributeViReal64.return_value = 0 - mock_library.niSwitch_SetAttributeViString.side_effect = MockFunctionCallError("niSwitch_SetAttributeViString") + mock_library.niSwitch_SetAttributeViString.side_effect = MockFunctionCallError( + "niSwitch_SetAttributeViString" + ) mock_library.niSwitch_SetAttributeViString.return_value = 0 - mock_library.niSwitch_SetPath.side_effect = MockFunctionCallError("niSwitch_SetPath") + mock_library.niSwitch_SetPath.side_effect = MockFunctionCallError( + "niSwitch_SetPath" + ) mock_library.niSwitch_SetPath.return_value = 0 - mock_library.niSwitch_UnlockSession.side_effect = MockFunctionCallError("niSwitch_UnlockSession") + mock_library.niSwitch_UnlockSession.side_effect = MockFunctionCallError( + "niSwitch_UnlockSession" + ) mock_library.niSwitch_UnlockSession.return_value = 0 - mock_library.niSwitch_WaitForDebounce.side_effect = MockFunctionCallError("niSwitch_WaitForDebounce") + mock_library.niSwitch_WaitForDebounce.side_effect = MockFunctionCallError( + "niSwitch_WaitForDebounce" + ) mock_library.niSwitch_WaitForDebounce.return_value = 0 - mock_library.niSwitch_WaitForScanComplete.side_effect = MockFunctionCallError("niSwitch_WaitForScanComplete") + mock_library.niSwitch_WaitForScanComplete.side_effect = MockFunctionCallError( + "niSwitch_WaitForScanComplete" + ) mock_library.niSwitch_WaitForScanComplete.return_value = 0 - mock_library.niSwitch_close.side_effect = MockFunctionCallError("niSwitch_close") + mock_library.niSwitch_close.side_effect = MockFunctionCallError( + "niSwitch_close" + ) mock_library.niSwitch_close.return_value = 0 - mock_library.niSwitch_error_message.side_effect = MockFunctionCallError("niSwitch_error_message") + mock_library.niSwitch_error_message.side_effect = MockFunctionCallError( + "niSwitch_error_message" + ) mock_library.niSwitch_error_message.return_value = 0 - mock_library.niSwitch_reset.side_effect = MockFunctionCallError("niSwitch_reset") + mock_library.niSwitch_reset.side_effect = MockFunctionCallError( + "niSwitch_reset" + ) mock_library.niSwitch_reset.return_value = 0 - mock_library.niSwitch_self_test.side_effect = MockFunctionCallError("niSwitch_self_test") + mock_library.niSwitch_self_test.side_effect = MockFunctionCallError( + "niSwitch_self_test" + ) mock_library.niSwitch_self_test.return_value = 0 diff --git a/generated/niswitch/setup.py b/generated/niswitch/setup.py index b544e8856..d715e2560 100644 --- a/generated/niswitch/setup.py +++ b/generated/niswitch/setup.py @@ -15,41 +15,44 @@ def finalize_options(self): def run_tests(self): import pytest + pytest.main(self.test_args) -pypi_name = 'niswitch' +pypi_name = "niswitch" def read_contents(file_to_read): - with open(file_to_read, 'r') as f: + with open(file_to_read, "r") as f: return f.read() setup( name=pypi_name, zip_safe=True, - version='1.4.2.dev0', - description='NI-SWITCH Python API', - long_description=read_contents('README.rst'), - long_description_content_type='text/x-rst', - author='NI', + version="1.4.2.dev0", + description="NI-SWITCH Python API", + long_description=read_contents("README.rst"), + long_description_content_type="text/x-rst", + author="NI", author_email="opensource@ni.com", url="https://github.com/ni/nimi-python", maintainer="NI", maintainer_email="opensource@ni.com", - keywords=['niswitch'], - license='MIT', + keywords=["niswitch"], + license="MIT", include_package_data=True, - packages=['niswitch'], + packages=["niswitch"], install_requires=[ 'enum34;python_version<"3.4"', 'singledispatch;python_version<"3.4"', - 'hightime>=0.2.0', + "hightime>=0.2.0", + ], + setup_requires=[ + "pytest-runner", ], - setup_requires=['pytest-runner', ], - tests_require=['pytest'], - test_suite='tests', + tests_require=["pytest"], + test_suite="tests", classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -64,8 +67,8 @@ def read_contents(file_to_read): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", - "Topic :: System :: Hardware :: Hardware Drivers" + "Topic :: System :: Hardware :: Hardware Drivers", ], - cmdclass={'test': PyTest}, - package_data={pypi_name: ['VERSION']}, + cmdclass={"test": PyTest}, + package_data={pypi_name: ["VERSION"]}, ) diff --git a/generated/nitclk/nitclk/__init__.py b/generated/nitclk/nitclk/__init__.py index f17a5e9c1..fbf2200ef 100644 --- a/generated/nitclk/nitclk/__init__.py +++ b/generated/nitclk/nitclk/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = '1.4.2.dev0' +__version__ = "1.4.2.dev0" from nitclk.errors import DriverWarning # noqa: F401 from nitclk.errors import Error # noqa: F401 @@ -20,12 +20,12 @@ def get_diagnostic_information(): - '''Get diagnostic information about the system state that is suitable for printing or logging + """Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - ''' + """ import os import pkg_resources import platform @@ -33,73 +33,80 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return (struct.calcsize("P") == 8) + return struct.calcsize("P") == 8 def is_os_64bit(): - return platform.machine().endswith('64') + return platform.machine().endswith("64") def is_venv(): - return 'VIRTUAL_ENV' in os.environ + return "VIRTUAL_ENV" in os.environ info = {} - info['os'] = {} - info['python'] = {} - info['driver'] = {} - info['module'] = {} - if platform.system() == 'Windows': + info["os"] = {} + info["python"] = {} + info["driver"] = {} + info["module"] = {} + if platform.system() == "Windows": try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = 'Windows' + os_name = "Windows" try: - driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-TClk\CurrentVersion") + driver_version_key = winreg.OpenKey( + winreg.HKEY_LOCAL_MACHINE, + r"SOFTWARE\National Instruments\NI-TClk\CurrentVersion", + ) driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = 'Unknown' - elif platform.system() == 'Linux': - os_name = 'Linux' - driver_version = 'Unknown' + driver_version = "Unknown" + elif platform.system() == "Linux": + os_name = "Linux" + driver_version = "Unknown" else: - raise SystemError('Unsupported platform: {}'.format(platform.system())) + raise SystemError("Unsupported platform: {}".format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] - - info['os']['name'] = os_name - info['os']['version'] = platform.version() - info['os']['bits'] = '64' if is_os_64bit() else '32' - info['driver']['name'] = "NI-TClk" - info['driver']['version'] = driver_version - info['module']['name'] = 'nitclk' - info['module']['version'] = "1.4.2.dev0" - info['python']['version'] = sys.version - info['python']['bits'] = '64' if is_python_64bit() else '32' - info['python']['is_venv'] = is_venv() - info['python']['packages'] = installed_packages_list + installed_packages_list = [ + { + "name": i.key, + "version": i.version, + } + for i in installed_packages + ] + + info["os"]["name"] = os_name + info["os"]["version"] = platform.version() + info["os"]["bits"] = "64" if is_os_64bit() else "32" + info["driver"]["name"] = "NI-TClk" + info["driver"]["version"] = driver_version + info["module"]["name"] = "nitclk" + info["module"]["version"] = "1.4.2.dev0" + info["python"]["version"] = sys.version + info["python"]["bits"] = "64" if is_python_64bit() else "32" + info["python"]["is_venv"] = is_venv() + info["python"]["packages"] = installed_packages_list return info def print_diagnostic_information(): - '''Print diagnostic information in a format suitable for issue report + """Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - ''' + """ info = get_diagnostic_information() - row_format = ' {:<10} {}' - for type in ['OS', 'Driver', 'Module', 'Python']: + row_format = " {:<10} {}" + for type in ["OS", "Driver", "Module", "Python"]: typename = type.lower() - print(type + ':') + print(type + ":") for item in info[typename]: - if item != 'packages': - print(row_format.format(item.title() + ':', info[typename][item])) - print(' Installed Packages:') - for p in info['python']['packages']: - print((' ' * 8) + p['name'] + '==' + p['version']) + if item != "packages": + print(row_format.format(item.title() + ":", info[typename][item])) + print(" Installed Packages:") + for p in info["python"]["packages"]: + print((" " * 8) + p["name"] + "==" + p["version"]) return info - - diff --git a/generated/nitclk/nitclk/_attributes.py b/generated/nitclk/nitclk/_attributes.py index 73c7c66fe..33ac0b907 100644 --- a/generated/nitclk/nitclk/_attributes.py +++ b/generated/nitclk/nitclk/_attributes.py @@ -6,14 +6,13 @@ class Attribute(object): - '''Base class for all typed attributes.''' + """Base class for all typed attributes.""" def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -22,16 +21,19 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) + return hightime.timedelta( + milliseconds=session._get_attribute_vi_int32(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) + session._set_attribute_vi_int32( + self._attribute_id, + _converters.convert_timedelta_to_milliseconds_int32(value).value, + ) class AttributeViInt64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -40,7 +42,6 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -49,16 +50,19 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) + return hightime.timedelta( + seconds=session._get_attribute_vi_real64(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) + session._set_attribute_vi_real64( + self._attribute_id, + _converters.convert_timedelta_to_seconds_real64(value).value, + ) class AttributeViString(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -67,16 +71,17 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) + session._set_attribute_vi_string( + self._attribute_id, + _converters.convert_repeated_capabilities_without_prefix(value), + ) class AttributeViBoolean(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -85,31 +90,36 @@ def __set__(self, session, value): class AttributeEnum(object): - def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) + return self._attribute_type( + self._underlying_attribute.__get__(session, session_type) + ) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) + raise TypeError( + "must be " + + str(self._attribute_type.__name__) + + " not " + + str(type(value).__name__) + ) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): - def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from nitclk.session import SessionReference + return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) - - - + session._set_attribute_vi_session( + self._attribute_id, _converters.convert_to_nitclk_session_number(value) + ) diff --git a/generated/nitclk/nitclk/_converters.py b/generated/nitclk/nitclk/_converters.py index 45f76e0d2..9d5ae352f 100644 --- a/generated/nitclk/nitclk/_converters.py +++ b/generated/nitclk/nitclk/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - '''Base version that should not be called + """Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,36 +40,38 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - ''' - raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + """ + raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - '''Integer version''' + """Integer version""" return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - '''String version (this is the most complex) + """String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - ''' + """ # First we deal with a list - rep_cap_list = repeated_capability.split(',') + rep_cap_list = repeated_capability.split(",") if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, '').replace(':', '-') - rc = r.split('-') + r = repeated_capability.strip().replace(prefix, "").replace(":", "-") + rc = r.split("-") if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + raise errors.InvalidRepeatedCapabilityError( + "Multiple '-' or ':'", repeated_capability + ) try: start = int(rc[0]) end = int(rc[1]) @@ -85,7 +87,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, '').strip()] + return [repeated_capability.replace(prefix, "").strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -94,7 +96,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - '''Iterable version - can handle lists, ranges, and tuples''' + """Iterable version - can handle lists, ranges, and tuples""" rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -103,16 +105,22 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - '''slice version''' + """slice version""" + def ifnone(a, b): return b if a is None else a + # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) + rng = range( + ifnone(repeated_capability.start, 0), + repeated_capability.stop, + ifnone(repeated_capability.step, 1), + ) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=''): - '''Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=""): + """Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -120,15 +128,17 @@ def convert_repeated_capabilities(repeated_capability, prefix=''): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - ''' + """ # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] + return [ + prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) + ] def convert_repeated_capabilities_without_prefix(repeated_capability): - '''Convert a repeated capabilities object, without any prefix, to a comma delimited list + """Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -144,8 +154,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - ''' - return ','.join(convert_repeated_capabilities(repeated_capability, '')) + """ + return ",".join(convert_repeated_capabilities(repeated_capability, "")) def _convert_timedelta(value, library_type, scaling): @@ -158,7 +168,14 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: + if library_type in [ + _visatype.ViInt64, + _visatype.ViInt32, + _visatype.ViUInt32, + _visatype.ViInt16, + _visatype.ViUInt16, + _visatype.ViInt8, + ]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -195,34 +212,36 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - 'rangecheck': 'RangeCheck', - 'queryinstrstatus': 'QueryInstrStatus', - 'cache': 'Cache', - 'simulate': 'Simulate', - 'recordcoercions': 'RecordCoercions', - 'interchangecheck': 'InterchangeCheck', - 'driversetup': 'DriverSetup', - 'range_check': 'RangeCheck', - 'query_instr_status': 'QueryInstrStatus', - 'record_coercions': 'RecordCoercions', - 'interchange_check': 'InterchangeCheck', - 'driver_setup': 'DriverSetup', + "rangecheck": "RangeCheck", + "queryinstrstatus": "QueryInstrStatus", + "cache": "Cache", + "simulate": "Simulate", + "recordcoercions": "RecordCoercions", + "interchangecheck": "InterchangeCheck", + "driversetup": "DriverSetup", + "range_check": "RangeCheck", + "query_instr_status": "QueryInstrStatus", + "record_coercions": "RecordCoercions", + "interchange_check": "InterchangeCheck", + "driver_setup": "DriverSetup", } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': - value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') - elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': + if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": + value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") + elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": if not isinstance(values[k], dict): - raise TypeError('DriverSetup must be a dictionary') - value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) + raise TypeError("DriverSetup must be a dictionary") + value = "DriverSetup=" + ( + ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) + ) else: - value = k + ('=1' if values[k] is True else '=0') + value = k + ("=1" if values[k] is True else "=0") init_with_options.append(value) - init_with_options_string = ','.join(init_with_options) + init_with_options_string = ",".join(init_with_options) return init_with_options_string @@ -251,11 +270,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(',')] + return [x.strip() for x in comma_separated_string.split(",")] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -267,22 +286,30 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - ''' - chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) - repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] + """ + chained_repeated_capability_items = convert_comma_separated_string_to_list( + chained_repeated_capability + ) + repeated_capability_lists = [ + [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) + ] for item in chained_repeated_capability_items: - repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] - return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] + repeated_capability_lists = [ + x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) + ] + return [ + ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists + ] # nitclk specific converters def convert_to_nitclk_session_number(item): - '''Convert from supported objects to NI-TClk Session Num + """Convert from supported objects to NI-TClk Session Num Supported objects are: - class with .tclk object of type nitclk.SessionReference - nitclk.SessionReference - ''' + """ try: return item.tclk._get_tclk_session_reference() except AttributeError: @@ -293,11 +320,9 @@ def convert_to_nitclk_session_number(item): except AttributeError: pass - raise TypeError('Unsupported type for nitclk session: {}'.format(type(item))) + raise TypeError("Unsupported type for nitclk session: {}".format(type(item))) def convert_to_nitclk_session_number_list(item_list): - '''Converts a list of items to nitclk session nums''' + """Converts a list of items to nitclk session nums""" return [convert_to_nitclk_session_number(i) for i in item_list] - - diff --git a/generated/nitclk/nitclk/_library.py b/generated/nitclk/nitclk/_library.py index f8e44eae6..0c1c69df1 100644 --- a/generated/nitclk/nitclk/_library.py +++ b/generated/nitclk/nitclk/_library.py @@ -9,11 +9,11 @@ class Library(object): - '''Library + """Library Wrapper around driver library. Class will setup the correct ctypes information for every function on first call. - ''' + """ def __init__(self, ctypes_library): self._func_lock = threading.Lock() @@ -42,122 +42,270 @@ def _get_library_function(self, name): raise errors.DriverTooOldError() from e return function - def niTClk_ConfigureForHomogeneousTriggers(self, session_count, sessions): # noqa: N802 + def niTClk_ConfigureForHomogeneousTriggers( + self, session_count, sessions + ): # noqa: N802 with self._func_lock: if self.niTClk_ConfigureForHomogeneousTriggers_cfunc is None: - self.niTClk_ConfigureForHomogeneousTriggers_cfunc = self._get_library_function('niTClk_ConfigureForHomogeneousTriggers') - self.niTClk_ConfigureForHomogeneousTriggers_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession)] # noqa: F405 - self.niTClk_ConfigureForHomogeneousTriggers_cfunc.restype = ViStatus # noqa: F405 - return self.niTClk_ConfigureForHomogeneousTriggers_cfunc(session_count, sessions) + self.niTClk_ConfigureForHomogeneousTriggers_cfunc = ( + self._get_library_function("niTClk_ConfigureForHomogeneousTriggers") + ) + self.niTClk_ConfigureForHomogeneousTriggers_cfunc.argtypes = [ + ViUInt32, + ctypes.POINTER(ViSession), + ] # noqa: F405 + self.niTClk_ConfigureForHomogeneousTriggers_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niTClk_ConfigureForHomogeneousTriggers_cfunc( + session_count, sessions + ) - def niTClk_FinishSyncPulseSenderSynchronize(self, session_count, sessions, min_time): # noqa: N802 + def niTClk_FinishSyncPulseSenderSynchronize( + self, session_count, sessions, min_time + ): # noqa: N802 with self._func_lock: if self.niTClk_FinishSyncPulseSenderSynchronize_cfunc is None: - self.niTClk_FinishSyncPulseSenderSynchronize_cfunc = self._get_library_function('niTClk_FinishSyncPulseSenderSynchronize') - self.niTClk_FinishSyncPulseSenderSynchronize_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession), ViReal64] # noqa: F405 - self.niTClk_FinishSyncPulseSenderSynchronize_cfunc.restype = ViStatus # noqa: F405 - return self.niTClk_FinishSyncPulseSenderSynchronize_cfunc(session_count, sessions, min_time) + self.niTClk_FinishSyncPulseSenderSynchronize_cfunc = ( + self._get_library_function( + "niTClk_FinishSyncPulseSenderSynchronize" + ) + ) + self.niTClk_FinishSyncPulseSenderSynchronize_cfunc.argtypes = [ + ViUInt32, + ctypes.POINTER(ViSession), + ViReal64, + ] # noqa: F405 + self.niTClk_FinishSyncPulseSenderSynchronize_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niTClk_FinishSyncPulseSenderSynchronize_cfunc( + session_count, sessions, min_time + ) - def niTClk_GetAttributeViReal64(self, session, channel_name, attribute_id, value): # noqa: N802 + def niTClk_GetAttributeViReal64( + self, session, channel_name, attribute_id, value + ): # noqa: N802 with self._func_lock: if self.niTClk_GetAttributeViReal64_cfunc is None: - self.niTClk_GetAttributeViReal64_cfunc = self._get_library_function('niTClk_GetAttributeViReal64') - self.niTClk_GetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niTClk_GetAttributeViReal64_cfunc = self._get_library_function( + "niTClk_GetAttributeViReal64" + ) + self.niTClk_GetAttributeViReal64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViReal64), + ] # noqa: F405 self.niTClk_GetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niTClk_GetAttributeViReal64_cfunc(session, channel_name, attribute_id, value) + return self.niTClk_GetAttributeViReal64_cfunc( + session, channel_name, attribute_id, value + ) - def niTClk_GetAttributeViSession(self, session, channel_name, attribute_id, value): # noqa: N802 + def niTClk_GetAttributeViSession( + self, session, channel_name, attribute_id, value + ): # noqa: N802 with self._func_lock: if self.niTClk_GetAttributeViSession_cfunc is None: - self.niTClk_GetAttributeViSession_cfunc = self._get_library_function('niTClk_GetAttributeViSession') - self.niTClk_GetAttributeViSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViSession)] # noqa: F405 + self.niTClk_GetAttributeViSession_cfunc = self._get_library_function( + "niTClk_GetAttributeViSession" + ) + self.niTClk_GetAttributeViSession_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViSession), + ] # noqa: F405 self.niTClk_GetAttributeViSession_cfunc.restype = ViStatus # noqa: F405 - return self.niTClk_GetAttributeViSession_cfunc(session, channel_name, attribute_id, value) + return self.niTClk_GetAttributeViSession_cfunc( + session, channel_name, attribute_id, value + ) - def niTClk_GetAttributeViString(self, session, channel_name, attribute_id, buf_size, value): # noqa: N802 + def niTClk_GetAttributeViString( + self, session, channel_name, attribute_id, buf_size, value + ): # noqa: N802 with self._func_lock: if self.niTClk_GetAttributeViString_cfunc is None: - self.niTClk_GetAttributeViString_cfunc = self._get_library_function('niTClk_GetAttributeViString') - self.niTClk_GetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niTClk_GetAttributeViString_cfunc = self._get_library_function( + "niTClk_GetAttributeViString" + ) + self.niTClk_GetAttributeViString_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViInt32, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niTClk_GetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niTClk_GetAttributeViString_cfunc(session, channel_name, attribute_id, buf_size, value) + return self.niTClk_GetAttributeViString_cfunc( + session, channel_name, attribute_id, buf_size, value + ) - def niTClk_GetExtendedErrorInfo(self, error_string, error_string_size): # noqa: N802 + def niTClk_GetExtendedErrorInfo( + self, error_string, error_string_size + ): # noqa: N802 with self._func_lock: if self.niTClk_GetExtendedErrorInfo_cfunc is None: - self.niTClk_GetExtendedErrorInfo_cfunc = self._get_library_function('niTClk_GetExtendedErrorInfo') - self.niTClk_GetExtendedErrorInfo_cfunc.argtypes = [ctypes.POINTER(ViChar), ViUInt32] # noqa: F405 + self.niTClk_GetExtendedErrorInfo_cfunc = self._get_library_function( + "niTClk_GetExtendedErrorInfo" + ) + self.niTClk_GetExtendedErrorInfo_cfunc.argtypes = [ + ctypes.POINTER(ViChar), + ViUInt32, + ] # noqa: F405 self.niTClk_GetExtendedErrorInfo_cfunc.restype = ViStatus # noqa: F405 return self.niTClk_GetExtendedErrorInfo_cfunc(error_string, error_string_size) def niTClk_Initiate(self, session_count, sessions): # noqa: N802 with self._func_lock: if self.niTClk_Initiate_cfunc is None: - self.niTClk_Initiate_cfunc = self._get_library_function('niTClk_Initiate') - self.niTClk_Initiate_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession)] # noqa: F405 + self.niTClk_Initiate_cfunc = self._get_library_function( + "niTClk_Initiate" + ) + self.niTClk_Initiate_cfunc.argtypes = [ + ViUInt32, + ctypes.POINTER(ViSession), + ] # noqa: F405 self.niTClk_Initiate_cfunc.restype = ViStatus # noqa: F405 return self.niTClk_Initiate_cfunc(session_count, sessions) def niTClk_IsDone(self, session_count, sessions, done): # noqa: N802 with self._func_lock: if self.niTClk_IsDone_cfunc is None: - self.niTClk_IsDone_cfunc = self._get_library_function('niTClk_IsDone') - self.niTClk_IsDone_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession), ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niTClk_IsDone_cfunc = self._get_library_function("niTClk_IsDone") + self.niTClk_IsDone_cfunc.argtypes = [ + ViUInt32, + ctypes.POINTER(ViSession), + ctypes.POINTER(ViBoolean), + ] # noqa: F405 self.niTClk_IsDone_cfunc.restype = ViStatus # noqa: F405 return self.niTClk_IsDone_cfunc(session_count, sessions, done) - def niTClk_SetAttributeViReal64(self, session, channel_name, attribute_id, value): # noqa: N802 + def niTClk_SetAttributeViReal64( + self, session, channel_name, attribute_id, value + ): # noqa: N802 with self._func_lock: if self.niTClk_SetAttributeViReal64_cfunc is None: - self.niTClk_SetAttributeViReal64_cfunc = self._get_library_function('niTClk_SetAttributeViReal64') - self.niTClk_SetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViReal64] # noqa: F405 + self.niTClk_SetAttributeViReal64_cfunc = self._get_library_function( + "niTClk_SetAttributeViReal64" + ) + self.niTClk_SetAttributeViReal64_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViReal64, + ] # noqa: F405 self.niTClk_SetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niTClk_SetAttributeViReal64_cfunc(session, channel_name, attribute_id, value) + return self.niTClk_SetAttributeViReal64_cfunc( + session, channel_name, attribute_id, value + ) - def niTClk_SetAttributeViSession(self, session, channel_name, attribute_id, value): # noqa: N802 + def niTClk_SetAttributeViSession( + self, session, channel_name, attribute_id, value + ): # noqa: N802 with self._func_lock: if self.niTClk_SetAttributeViSession_cfunc is None: - self.niTClk_SetAttributeViSession_cfunc = self._get_library_function('niTClk_SetAttributeViSession') - self.niTClk_SetAttributeViSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViSession] # noqa: F405 + self.niTClk_SetAttributeViSession_cfunc = self._get_library_function( + "niTClk_SetAttributeViSession" + ) + self.niTClk_SetAttributeViSession_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ViSession, + ] # noqa: F405 self.niTClk_SetAttributeViSession_cfunc.restype = ViStatus # noqa: F405 - return self.niTClk_SetAttributeViSession_cfunc(session, channel_name, attribute_id, value) + return self.niTClk_SetAttributeViSession_cfunc( + session, channel_name, attribute_id, value + ) - def niTClk_SetAttributeViString(self, session, channel_name, attribute_id, value): # noqa: N802 + def niTClk_SetAttributeViString( + self, session, channel_name, attribute_id, value + ): # noqa: N802 with self._func_lock: if self.niTClk_SetAttributeViString_cfunc is None: - self.niTClk_SetAttributeViString_cfunc = self._get_library_function('niTClk_SetAttributeViString') - self.niTClk_SetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViChar)] # noqa: F405 + self.niTClk_SetAttributeViString_cfunc = self._get_library_function( + "niTClk_SetAttributeViString" + ) + self.niTClk_SetAttributeViString_cfunc.argtypes = [ + ViSession, + ctypes.POINTER(ViChar), + ViAttr, + ctypes.POINTER(ViChar), + ] # noqa: F405 self.niTClk_SetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niTClk_SetAttributeViString_cfunc(session, channel_name, attribute_id, value) + return self.niTClk_SetAttributeViString_cfunc( + session, channel_name, attribute_id, value + ) - def niTClk_SetupForSyncPulseSenderSynchronize(self, session_count, sessions, min_time): # noqa: N802 + def niTClk_SetupForSyncPulseSenderSynchronize( + self, session_count, sessions, min_time + ): # noqa: N802 with self._func_lock: if self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc is None: - self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc = self._get_library_function('niTClk_SetupForSyncPulseSenderSynchronize') - self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession), ViReal64] # noqa: F405 - self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc.restype = ViStatus # noqa: F405 - return self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc(session_count, sessions, min_time) + self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc = ( + self._get_library_function( + "niTClk_SetupForSyncPulseSenderSynchronize" + ) + ) + self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc.argtypes = [ + ViUInt32, + ctypes.POINTER(ViSession), + ViReal64, + ] # noqa: F405 + self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc( + session_count, sessions, min_time + ) - def niTClk_Synchronize(self, session_count, sessions, min_tclk_period): # noqa: N802 + def niTClk_Synchronize( + self, session_count, sessions, min_tclk_period + ): # noqa: N802 with self._func_lock: if self.niTClk_Synchronize_cfunc is None: - self.niTClk_Synchronize_cfunc = self._get_library_function('niTClk_Synchronize') - self.niTClk_Synchronize_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession), ViReal64] # noqa: F405 + self.niTClk_Synchronize_cfunc = self._get_library_function( + "niTClk_Synchronize" + ) + self.niTClk_Synchronize_cfunc.argtypes = [ + ViUInt32, + ctypes.POINTER(ViSession), + ViReal64, + ] # noqa: F405 self.niTClk_Synchronize_cfunc.restype = ViStatus # noqa: F405 return self.niTClk_Synchronize_cfunc(session_count, sessions, min_tclk_period) - def niTClk_SynchronizeToSyncPulseSender(self, session_count, sessions, min_time): # noqa: N802 + def niTClk_SynchronizeToSyncPulseSender( + self, session_count, sessions, min_time + ): # noqa: N802 with self._func_lock: if self.niTClk_SynchronizeToSyncPulseSender_cfunc is None: - self.niTClk_SynchronizeToSyncPulseSender_cfunc = self._get_library_function('niTClk_SynchronizeToSyncPulseSender') - self.niTClk_SynchronizeToSyncPulseSender_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession), ViReal64] # noqa: F405 - self.niTClk_SynchronizeToSyncPulseSender_cfunc.restype = ViStatus # noqa: F405 - return self.niTClk_SynchronizeToSyncPulseSender_cfunc(session_count, sessions, min_time) + self.niTClk_SynchronizeToSyncPulseSender_cfunc = ( + self._get_library_function("niTClk_SynchronizeToSyncPulseSender") + ) + self.niTClk_SynchronizeToSyncPulseSender_cfunc.argtypes = [ + ViUInt32, + ctypes.POINTER(ViSession), + ViReal64, + ] # noqa: F405 + self.niTClk_SynchronizeToSyncPulseSender_cfunc.restype = ( + ViStatus # noqa: F405 + ) + return self.niTClk_SynchronizeToSyncPulseSender_cfunc( + session_count, sessions, min_time + ) def niTClk_WaitUntilDone(self, session_count, sessions, timeout): # noqa: N802 with self._func_lock: if self.niTClk_WaitUntilDone_cfunc is None: - self.niTClk_WaitUntilDone_cfunc = self._get_library_function('niTClk_WaitUntilDone') - self.niTClk_WaitUntilDone_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession), ViReal64] # noqa: F405 + self.niTClk_WaitUntilDone_cfunc = self._get_library_function( + "niTClk_WaitUntilDone" + ) + self.niTClk_WaitUntilDone_cfunc.argtypes = [ + ViUInt32, + ctypes.POINTER(ViSession), + ViReal64, + ] # noqa: F405 self.niTClk_WaitUntilDone_cfunc.restype = ViStatus # noqa: F405 return self.niTClk_WaitUntilDone_cfunc(session_count, sessions, timeout) diff --git a/generated/nitclk/nitclk/_library_singleton.py b/generated/nitclk/nitclk/_library_singleton.py index 124ff8afc..a866829a2 100644 --- a/generated/nitclk/nitclk/_library_singleton.py +++ b/generated/nitclk/nitclk/_library_singleton.py @@ -12,30 +12,36 @@ _instance = None _instance_lock = threading.Lock() -_library_info = {'Linux': {'64bit': {'name': 'nitclk', 'type': 'cdll'}}, - 'Windows': {'32bit': {'name': 'niTClk.dll', 'type': 'windll'}, - '64bit': {'name': 'niTClk_64.dll', 'type': 'cdll'}}} +_library_info = { + "Linux": {"64bit": {"name": "nitclk", "type": "cdll"}}, + "Windows": { + "32bit": {"name": "niTClk.dll", "type": "windll"}, + "64bit": {"name": "niTClk_64.dll", "type": "cdll"}, + }, +} def _get_library_name(): try: - return ctypes.util.find_library(_library_info[platform.system()][platform.architecture()[0]]['name']) # We find and return full path to the DLL + return ctypes.util.find_library( + _library_info[platform.system()][platform.architecture()[0]]["name"] + ) # We find and return full path to the DLL except KeyError: raise errors.UnsupportedConfigurationError def _get_library_type(): try: - return _library_info[platform.system()][platform.architecture()[0]]['type'] + return _library_info[platform.system()][platform.architecture()[0]]["type"] except KeyError: raise errors.UnsupportedConfigurationError def get(): - '''get + """get Returns the library.Library singleton for nitclk. - ''' + """ global _instance global _instance_lock @@ -43,13 +49,12 @@ def get(): if _instance is None: try: library_type = _get_library_type() - if library_type == 'windll': + if library_type == "windll": ctypes_library = ctypes.WinDLL(_get_library_name()) else: - assert library_type == 'cdll' + assert library_type == "cdll" ctypes_library = ctypes.CDLL(_get_library_name()) except OSError: raise errors.DriverNotInstalledError() _instance = _library.Library(ctypes_library) return _instance - diff --git a/generated/nitclk/nitclk/_visatype.py b/generated/nitclk/nitclk/_visatype.py index 02cc41d1b..bf96c3cfb 100644 --- a/generated/nitclk/nitclk/_visatype.py +++ b/generated/nitclk/nitclk/_visatype.py @@ -2,9 +2,9 @@ import ctypes -'''Definitions of the VISA types used by the C API of the driver runtime. +"""Definitions of the VISA types used by the C API of the driver runtime. These are aliased directly to ctypes types so can be used directly to call into the library. -''' +""" ViChar = ctypes.c_char @@ -26,4 +26,3 @@ ViAttr = ViUInt32 ViConstString = ViString ViRsrc = ViString - diff --git a/generated/nitclk/nitclk/errors.py b/generated/nitclk/nitclk/errors.py index a66db325d..6eac3f779 100644 --- a/generated/nitclk/nitclk/errors.py +++ b/generated/nitclk/nitclk/errors.py @@ -7,70 +7,81 @@ def _is_success(code): - return (code == 0) + return code == 0 def _is_error(code): - return (code < 0) + return code < 0 def _is_warning(code): - return (code > 0) + return code > 0 class Error(Exception): - '''Base error class for NI-TClk''' + """Base error class for NI-TClk""" def __init__(self, message): super(Error, self).__init__(message) class DriverError(Error): - '''An error originating from the NI-TClk driver''' + """An error originating from the NI-TClk driver""" def __init__(self, code, description): - assert (_is_error(code)), "Should not raise Error if code is not fatal." + assert _is_error(code), "Should not raise Error if code is not fatal." self.code = code self.description = description super(DriverError, self).__init__(str(self.code) + ": " + self.description) class DriverWarning(Warning): - '''A warning originating from the NI-TClk driver''' + """A warning originating from the NI-TClk driver""" def __init__(self, code, description): - assert (_is_warning(code)), "Should not create Warning if code is not positive." - super(DriverWarning, self).__init__('Warning {0} occurred.\n\n{1}'.format(code, description)) + assert _is_warning(code), "Should not create Warning if code is not positive." + super(DriverWarning, self).__init__( + "Warning {0} occurred.\n\n{1}".format(code, description) + ) class UnsupportedConfigurationError(Error): - '''An error due to using this module in an usupported platform.''' + """An error due to using this module in an usupported platform.""" def __init__(self): - super(UnsupportedConfigurationError, self).__init__('System configuration is unsupported: ' + platform.architecture()[0] + ' ' + platform.system()) + super(UnsupportedConfigurationError, self).__init__( + "System configuration is unsupported: " + + platform.architecture()[0] + + " " + + platform.system() + ) class DriverNotInstalledError(Error): - '''An error due to using this module without the driver runtime installed.''' + """An error due to using this module without the driver runtime installed.""" def __init__(self): - super(DriverNotInstalledError, self).__init__('The NI-TClk runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it.') + super(DriverNotInstalledError, self).__init__( + "The NI-TClk runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it." + ) class DriverTooOldError(Error): - '''An error due to using this module with an older version of the driver runtime.''' + """An error due to using this module with an older version of the driver runtime.""" def __init__(self): - super(DriverTooOldError, self).__init__('A function was not found in the NI-TClk runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it.') + super(DriverTooOldError, self).__init__( + "A function was not found in the NI-TClk runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it." + ) def handle_error(session, code, ignore_warnings, is_error_handling): - '''handle_error + """handle_error Helper function for handling errors returned by nitclk.Library. It calls back into the session to get the corresponding error description and raises if necessary. - ''' + """ if _is_success(code) or (_is_warning(code) and ignore_warnings): return @@ -78,7 +89,7 @@ def handle_error(session, code, ignore_warnings, is_error_handling): if is_error_handling: # The caller is in the midst of error handling and an error occurred. # Don't try to get the description or we'll start recursing until the stack overflows. - description = '' + description = "" else: description = session._get_error_description(code) @@ -87,5 +98,3 @@ def handle_error(session, code, ignore_warnings, is_error_handling): assert _is_warning(code) warnings.warn(DriverWarning(code, description)) - - diff --git a/generated/nitclk/nitclk/session.py b/generated/nitclk/nitclk/session.py index 1e868347e..a76a77a8e 100644 --- a/generated/nitclk/nitclk/session.py +++ b/generated/nitclk/nitclk/session.py @@ -13,6 +13,7 @@ # Used for __repr__ and __str__ import pprint + pp = pprint.PrettyPrinter(indent=4) _session_instance = None @@ -22,14 +23,15 @@ # Helper functions for creating ctypes needed for calling into the driver DLL def get_ctypes_pointer_for_buffer(value=None, library_type=None, size=None): if isinstance(value, array.array): - assert library_type is not None, 'library_type is required for array.array' + assert library_type is not None, "library_type is required for array.array" addr, _ = value.buffer_info() return ctypes.cast(addr, ctypes.POINTER(library_type)) elif str(type(value)).find("'numpy.ndarray'") != -1: import numpy + return numpy.ctypeslib.as_ctypes(value) elif isinstance(value, list): - assert library_type is not None, 'library_type is required for list' + assert library_type is not None, "library_type is required for list" return (library_type * len(value))(*value) else: if library_type is not None and size is not None: @@ -39,16 +41,16 @@ def get_ctypes_pointer_for_buffer(value=None, library_type=None, size=None): class SessionReference(object): - '''Properties container for NI-TClk attributes. + """Properties container for NI-TClk attributes. Note: Constructing this class is an advanced use case and should not be needed in most circumstances. - ''' + """ # This is needed during __init__. Without it, __setattr__ raises an exception _is_frozen = False exported_sync_pulse_output_terminal = _attributes.AttributeViString(2) - '''Type: str + """Type: str Specifies the destination of the Sync Pulse. This property is most often used when synchronizing a multichassis system. Values @@ -60,9 +62,9 @@ class SessionReference(object): - NI PXI-5421 supports 'PFI0', 'PFI1', 'PFI4', and 'PFI5' - NI PXI-6551/6552 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3' Default Value is empty string - ''' + """ exported_tclk_output_terminal = _attributes.AttributeViString(9) - '''Type: str + """Type: str Specifies the destination of the device's TClk signal. Values @@ -74,21 +76,21 @@ class SessionReference(object): - NI PXI-5421 supports 'PFI0', 'PFI1', 'PFI4', and 'PFI5' - NI PXI-6551/6552 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3' Default Value is empty string - ''' + """ pause_trigger_master_session = _attributes.AttributeSessionReference(6) - '''Type: instrument-specific session or an instance of nitclk.SessionReference + """Type: instrument-specific session or an instance of nitclk.SessionReference Specifies the pause trigger master session. For external triggers, the session that originally receives the trigger. For None (no trigger configured) or software triggers, the session that originally generates the trigger. - ''' + """ ref_trigger_master_session = _attributes.AttributeSessionReference(4) - '''Type: instrument-specific session or an instance of nitclk.SessionReference + """Type: instrument-specific session or an instance of nitclk.SessionReference Specifies the reference trigger master session. For external triggers, the session that originally receives the trigger. For None (no trigger configured) or software triggers, the session that originally generates the trigger. - ''' + """ sample_clock_delay = _attributes.AttributeViReal64TimeDeltaSeconds(11) - '''Type: hightime.timedelta, datetime.timedelta, or float in seconds + """Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the sample clock delay. Specifies the delay, in seconds, to apply to the session sample clock relative to the other synchronized sessions. During synchronization, NI-TClk aligns the sample clocks on the synchronized devices. If you want to delay the sample clocks, set this property before calling synchronize. @@ -98,32 +100,32 @@ class SessionReference(object): Default Value is 0 Note: Sample clock delay is supported for generation sessions only; it is - ''' + """ sequencer_flag_master_session = _attributes.AttributeSessionReference(16) - '''Type: instrument-specific session or an instance of nitclk.SessionReference + """Type: instrument-specific session or an instance of nitclk.SessionReference Specifies the sequencer flag master session. For external triggers, the session that originally receives the trigger. For None (no trigger configured) or software triggers, the session that originally generates the trigger. - ''' + """ start_trigger_master_session = _attributes.AttributeSessionReference(3) - '''Type: instrument-specific session or an instance of nitclk.SessionReference + """Type: instrument-specific session or an instance of nitclk.SessionReference Specifies the start trigger master session. For external triggers, the session that originally receives the trigger. For None (no trigger configured) or software triggers, the session that originally generates the trigger. - ''' + """ sync_pulse_clock_source = _attributes.AttributeViString(10) - '''Type: str + """Type: str Specifies the Sync Pulse Clock source. This property is typically used to synchronize PCI devices when you want to control RTSI 7 yourself. Make sure that a 10 MHz clock is driven onto RTSI 7. Values PCI Devices - 'RTSI_7' and 'None' PXI Devices - 'PXI_CLK10' and 'None' Default Value - 'None' directs synchronize to create the necessary routes. For PCI, one of the synchronized devices drives a 10 MHz clock on RTSI 7 unless that line is already being driven. - ''' + """ sync_pulse_sender_sync_pulse_source = _attributes.AttributeViString(13) - '''Type: str + """Type: str Specifies the external sync pulse source for the Sync Pulse Sender. You can use this source to synchronize the Sync Pulse Sender with an external non-TClk source. Values @@ -135,9 +137,9 @@ class SessionReference(object): - NI PXI-5421 supports 'PFI0', 'PFI1', 'PFI4', and 'PFI5' - NI PXI-6551/6552 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3' Default Value is empty string - ''' + """ sync_pulse_source = _attributes.AttributeViString(1) - '''Type: str + """Type: str Specifies the Sync Pulse source. This property is most often used when synchronizing a multichassis system. Values @@ -149,47 +151,51 @@ class SessionReference(object): - NI PXI-5421 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3' - NI PXI-6551/6552 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3' Default Value - Empty string. This default value directs synchronize to set this property when all the synchronized devices are in one PXI chassis. To synchronize a multichassis system, you must set this property before calling synchronize. - ''' + """ tclk_actual_period = _attributes.AttributeViReal64(8) - '''Type: float + """Type: float Indicates the computed TClk period that will be used during the acquisition. - ''' + """ - def __init__(self, session_number, encoding='windows-1251'): + def __init__(self, session_number, encoding="windows-1251"): self._session_number = session_number self._library = _library_singleton.get() self._encoding = encoding # We need a self._repeated_capability string for passing down to function calls on _Library class. We just need to set it to empty string. - self._repeated_capability = '' + self._repeated_capability = "" # Store the parameter list for later printing in __repr__ param_list = [] param_list.append("session_number=" + pp.pformat(session_number)) param_list.append("encoding=" + pp.pformat(encoding)) - self._param_list = ', '.join(param_list) + self._param_list = ", ".join(param_list) self._is_frozen = True def __repr__(self): - return '{0}.{1}({2})'.format('nitclk', self.__class__.__name__, self._param_list) + return "{0}.{1}({2})".format( + "nitclk", self.__class__.__name__, self._param_list + ) def __setattr__(self, key, value): if self._is_frozen and key not in dir(self): - raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) + raise AttributeError( + "'{0}' object has no attribute '{1}'".format(type(self).__name__, key) + ) object.__setattr__(self, key, value) def _get_error_description(self, error_code): - '''_get_error_description + """_get_error_description Returns the error description. - ''' + """ try: - ''' + """ It is expected for _get_error to raise when the session is invalid (IVI spec requires GetError to fail). Use _error_message instead. It doesn't require a session. - ''' + """ error_string = self._get_extended_error_info() return error_string except errors.Error: @@ -199,7 +205,7 @@ def _get_tclk_session_reference(self): return self._session_number def _get_attribute_vi_real64(self, attribute_id): - r'''_get_attribute_vi_real64 + r"""_get_attribute_vi_real64 Gets the value of an NI-TClk ViReal64 property. @@ -222,17 +228,26 @@ def _get_attribute_vi_real64(self, attribute_id): Returns: value (float): The value that you are getting - ''' + """ session_ctype = _visatype.ViSession(self._session_number) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niTClk_GetAttributeViReal64(session_ctype, channel_name_ctype, attribute_id_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niTClk_GetAttributeViReal64( + session_ctype, + channel_name_ctype, + attribute_id_ctype, + None if value_ctype is None else (ctypes.pointer(value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return float(value_ctype.value) def _get_attribute_vi_session(self, attribute_id): - r'''_get_attribute_vi_session + r"""_get_attribute_vi_session Gets the value of an NI-TClk ViSession property. @@ -257,17 +272,26 @@ def _get_attribute_vi_session(self, attribute_id): Returns: value (int): The value that you are getting - ''' + """ session_ctype = _visatype.ViSession(self._session_number) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViSession() # case S220 - error_code = self._library.niTClk_GetAttributeViSession(session_ctype, channel_name_ctype, attribute_id_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niTClk_GetAttributeViSession( + session_ctype, + channel_name_ctype, + attribute_id_ctype, + None if value_ctype is None else (ctypes.pointer(value_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return int(value_ctype.value) def _get_attribute_vi_string(self, attribute_id): - r'''_get_attribute_vi_string + r"""_get_attribute_vi_string This method queries the value of an NI-TClk ViString property. You must provide a ViChar array to serve as a buffer for the value. You pass @@ -302,22 +326,40 @@ def _get_attribute_vi_string(self, attribute_id): Returns: value (str): The value that you are getting - ''' + """ session_ctype = _visatype.ViSession(self._session_number) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 buf_size_ctype = _visatype.ViInt32() # case S170 value_ctype = None # case C050 - error_code = self._library.niTClk_GetAttributeViString(session_ctype, channel_name_ctype, attribute_id_ctype, buf_size_ctype, value_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + error_code = self._library.niTClk_GetAttributeViString( + session_ctype, + channel_name_ctype, + attribute_id_ctype, + buf_size_ctype, + value_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=False + ) buf_size_ctype = _visatype.ViInt32(error_code) # case S180 value_ctype = (_visatype.ViChar * buf_size_ctype.value)() # case C060 - error_code = self._library.niTClk_GetAttributeViString(session_ctype, channel_name_ctype, attribute_id_ctype, buf_size_ctype, value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niTClk_GetAttributeViString( + session_ctype, + channel_name_ctype, + attribute_id_ctype, + buf_size_ctype, + value_ctype, + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return value_ctype.value.decode(self._encoding) def _get_extended_error_info(self): - r'''_get_extended_error_info + r"""_get_extended_error_info Reports extended error information for the most recent NI-TClk method that returned an error. To establish the method that returned an @@ -331,19 +373,29 @@ def _get_extended_error_info(self): value of _get_extended_error_info is the size that you should use for _get_extended_error_info to return the full error string. - ''' + """ error_string_ctype = None # case C050 error_string_size_ctype = _visatype.ViUInt32() # case S170 - error_code = self._library.niTClk_GetExtendedErrorInfo(error_string_ctype, error_string_size_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True) + error_code = self._library.niTClk_GetExtendedErrorInfo( + error_string_ctype, error_string_size_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=True + ) error_string_size_ctype = _visatype.ViUInt32(error_code) # case S180 - error_string_ctype = (_visatype.ViChar * error_string_size_ctype.value)() # case C060 - error_code = self._library.niTClk_GetExtendedErrorInfo(error_string_ctype, error_string_size_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + error_string_ctype = ( + _visatype.ViChar * error_string_size_ctype.value + )() # case C060 + error_code = self._library.niTClk_GetExtendedErrorInfo( + error_string_ctype, error_string_size_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return error_string_ctype.value.decode(self._encoding) def _set_attribute_vi_real64(self, attribute_id, value): - r'''_set_attribute_vi_real64 + r"""_set_attribute_vi_real64 Sets the value of an NI-TClk VIReal64 property. _set_attribute_vi_real64 is a low-level method that you can use to @@ -368,17 +420,23 @@ def _set_attribute_vi_real64(self, attribute_id, value): value (float): The value for the property - ''' + """ session_ctype = _visatype.ViSession(self._session_number) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViReal64(value) # case S150 - error_code = self._library.niTClk_SetAttributeViReal64(session_ctype, channel_name_ctype, attribute_id_ctype, value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niTClk_SetAttributeViReal64( + session_ctype, channel_name_ctype, attribute_id_ctype, value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def _set_attribute_vi_session(self, attribute_id, value): - r'''_set_attribute_vi_session + r"""_set_attribute_vi_session Sets the value of an NI-TClk ViSession property. _set_attribute_vi_session is a low-level method that you can use @@ -405,17 +463,23 @@ def _set_attribute_vi_session(self, attribute_id, value): value (int): The value for the property - ''' + """ session_ctype = _visatype.ViSession(self._session_number) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViSession(value) # case S150 - error_code = self._library.niTClk_SetAttributeViSession(session_ctype, channel_name_ctype, attribute_id_ctype, value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niTClk_SetAttributeViSession( + session_ctype, channel_name_ctype, attribute_id_ctype, value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def _set_attribute_vi_string(self, attribute_id, value): - r'''_set_attribute_vi_string + r"""_set_attribute_vi_string Sets the value of an NI-TClk VIString property. _set_attribute_vi_string is a low-level method that you can use to @@ -442,55 +506,64 @@ def _set_attribute_vi_string(self, attribute_id, value): value (str): Pass the value for the property - ''' + """ session_ctype = _visatype.ViSession(self._session_number) # case S110 - channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + channel_name_ctype = ctypes.create_string_buffer( + self._repeated_capability.encode(self._encoding) + ) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 - value_ctype = ctypes.create_string_buffer(value.encode(self._encoding)) # case C020 - error_code = self._library.niTClk_SetAttributeViString(session_ctype, channel_name_ctype, attribute_id_ctype, value_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + value_ctype = ctypes.create_string_buffer( + value.encode(self._encoding) + ) # case C020 + error_code = self._library.niTClk_SetAttributeViString( + session_ctype, channel_name_ctype, attribute_id_ctype, value_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return class _Session(object): - '''Private class + """Private class This class allows reusing function templates that are used in all other drivers. If we don't do this, we would need new template(s) that the only difference is in the indentation. - ''' + """ def __init__(self): self._library = _library_singleton.get() - self._encoding = 'windows-1251' + self._encoding = "windows-1251" # Instantiate any repeated capability objects # Store the parameter list for later printing in __repr__ param_list = [] - self._param_list = ', '.join(param_list) + self._param_list = ", ".join(param_list) self._is_frozen = True def _get_error_description(self, error_code): - '''_get_error_description + """_get_error_description Returns the error description. - ''' + """ try: - ''' + """ It is expected for _get_error to raise when the session is invalid (IVI spec requires GetError to fail). Use _error_message instead. It doesn't require a session. - ''' + """ error_string = self._get_extended_error_info() return error_string except errors.Error: return "Failed to retrieve error description." - ''' These are code-generated ''' + """ These are code-generated """ + def configure_for_homogeneous_triggers(self, sessions): - r'''configure_for_homogeneous_triggers + r"""configure_for_homogeneous_triggers Configures the properties commonly required for the TClk synchronization of device sessions with homogeneous triggers in a single PXI chassis or @@ -598,16 +671,28 @@ def configure_for_homogeneous_triggers(self, sessions): Args: sessions (list of instrument-specific sessions or nitclk.SessionReference instances): sessions is an array of sessions that are being synchronized. - ''' - session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 - sessions_converted = _converters.convert_to_nitclk_session_number_list(sessions) # case B520 - sessions_ctype = get_ctypes_pointer_for_buffer(value=sessions_converted, library_type=_visatype.ViSession) # case B520 - error_code = self._library.niTClk_ConfigureForHomogeneousTriggers(session_count_ctype, sessions_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + """ + session_count_ctype = _visatype.ViUInt32( + 0 if sessions is None else len(sessions) + ) # case S160 + sessions_converted = _converters.convert_to_nitclk_session_number_list( + sessions + ) # case B520 + sessions_ctype = get_ctypes_pointer_for_buffer( + value=sessions_converted, library_type=_visatype.ViSession + ) # case B520 + error_code = self._library.niTClk_ConfigureForHomogeneousTriggers( + session_count_ctype, sessions_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return - def finish_sync_pulse_sender_synchronize(self, sessions, min_time=hightime.timedelta(seconds=0.0)): - r'''finish_sync_pulse_sender_synchronize + def finish_sync_pulse_sender_synchronize( + self, sessions, min_time=hightime.timedelta(seconds=0.0) + ): + r"""finish_sync_pulse_sender_synchronize Finishes synchronizing the Sync Pulse Sender. @@ -621,17 +706,29 @@ def finish_sync_pulse_sender_synchronize(self, sessions, min_time=hightime.timed synchronization, adjust this value to account for propagation delays through the various devices and cables. - ''' - session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 - sessions_converted = _converters.convert_to_nitclk_session_number_list(sessions) # case B520 - sessions_ctype = get_ctypes_pointer_for_buffer(value=sessions_converted, library_type=_visatype.ViSession) # case B520 - min_time_ctype = _converters.convert_timedelta_to_seconds_real64(min_time) # case S140 - error_code = self._library.niTClk_FinishSyncPulseSenderSynchronize(session_count_ctype, sessions_ctype, min_time_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + """ + session_count_ctype = _visatype.ViUInt32( + 0 if sessions is None else len(sessions) + ) # case S160 + sessions_converted = _converters.convert_to_nitclk_session_number_list( + sessions + ) # case B520 + sessions_ctype = get_ctypes_pointer_for_buffer( + value=sessions_converted, library_type=_visatype.ViSession + ) # case B520 + min_time_ctype = _converters.convert_timedelta_to_seconds_real64( + min_time + ) # case S140 + error_code = self._library.niTClk_FinishSyncPulseSenderSynchronize( + session_count_ctype, sessions_ctype, min_time_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def _get_extended_error_info(self): - r'''_get_extended_error_info + r"""_get_extended_error_info Reports extended error information for the most recent NI-TClk method that returned an error. To establish the method that returned an @@ -645,19 +742,29 @@ def _get_extended_error_info(self): value of _get_extended_error_info is the size that you should use for _get_extended_error_info to return the full error string. - ''' + """ error_string_ctype = None # case C050 error_string_size_ctype = _visatype.ViUInt32() # case S170 - error_code = self._library.niTClk_GetExtendedErrorInfo(error_string_ctype, error_string_size_ctype) - errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True) + error_code = self._library.niTClk_GetExtendedErrorInfo( + error_string_ctype, error_string_size_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=True, is_error_handling=True + ) error_string_size_ctype = _visatype.ViUInt32(error_code) # case S180 - error_string_ctype = (_visatype.ViChar * error_string_size_ctype.value)() # case C060 - error_code = self._library.niTClk_GetExtendedErrorInfo(error_string_ctype, error_string_size_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + error_string_ctype = ( + _visatype.ViChar * error_string_size_ctype.value + )() # case C060 + error_code = self._library.niTClk_GetExtendedErrorInfo( + error_string_ctype, error_string_size_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=True + ) return error_string_ctype.value.decode(self._encoding) def initiate(self, sessions): - r'''initiate + r"""initiate Initiates the acquisition or generation sessions specified, taking into consideration any special requirements needed for synchronization. For @@ -668,16 +775,24 @@ def initiate(self, sessions): Args: sessions (list of instrument-specific sessions or nitclk.SessionReference instances): sessions is an array of sessions that are being synchronized. - ''' - session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 - sessions_converted = _converters.convert_to_nitclk_session_number_list(sessions) # case B520 - sessions_ctype = get_ctypes_pointer_for_buffer(value=sessions_converted, library_type=_visatype.ViSession) # case B520 + """ + session_count_ctype = _visatype.ViUInt32( + 0 if sessions is None else len(sessions) + ) # case S160 + sessions_converted = _converters.convert_to_nitclk_session_number_list( + sessions + ) # case B520 + sessions_ctype = get_ctypes_pointer_for_buffer( + value=sessions_converted, library_type=_visatype.ViSession + ) # case B520 error_code = self._library.niTClk_Initiate(session_count_ctype, sessions_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def is_done(self, sessions): - r'''is_done + r"""is_done Monitors the progress of the acquisitions and/or generations corresponding to sessions. @@ -691,17 +806,31 @@ def is_done(self, sessions): session has completed without any errors or when any one of the sessions reports an error. - ''' - session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 - sessions_converted = _converters.convert_to_nitclk_session_number_list(sessions) # case B520 - sessions_ctype = get_ctypes_pointer_for_buffer(value=sessions_converted, library_type=_visatype.ViSession) # case B520 + """ + session_count_ctype = _visatype.ViUInt32( + 0 if sessions is None else len(sessions) + ) # case S160 + sessions_converted = _converters.convert_to_nitclk_session_number_list( + sessions + ) # case B520 + sessions_ctype = get_ctypes_pointer_for_buffer( + value=sessions_converted, library_type=_visatype.ViSession + ) # case B520 done_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niTClk_IsDone(session_count_ctype, sessions_ctype, None if done_ctype is None else (ctypes.pointer(done_ctype))) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + error_code = self._library.niTClk_IsDone( + session_count_ctype, + sessions_ctype, + None if done_ctype is None else (ctypes.pointer(done_ctype)), + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return bool(done_ctype.value) - def setup_for_sync_pulse_sender_synchronize(self, sessions, min_time=hightime.timedelta(seconds=0.0)): - r'''setup_for_sync_pulse_sender_synchronize + def setup_for_sync_pulse_sender_synchronize( + self, sessions, min_time=hightime.timedelta(seconds=0.0) + ): + r"""setup_for_sync_pulse_sender_synchronize Configures the TClks on all the devices and prepares the Sync Pulse Sender for synchronization @@ -715,17 +844,29 @@ def setup_for_sync_pulse_sender_synchronize(self, sessions, min_time=hightime.ti synchronization, adjust this value to account for propagation delays through the various devices and cables. - ''' - session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 - sessions_converted = _converters.convert_to_nitclk_session_number_list(sessions) # case B520 - sessions_ctype = get_ctypes_pointer_for_buffer(value=sessions_converted, library_type=_visatype.ViSession) # case B520 - min_time_ctype = _converters.convert_timedelta_to_seconds_real64(min_time) # case S140 - error_code = self._library.niTClk_SetupForSyncPulseSenderSynchronize(session_count_ctype, sessions_ctype, min_time_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + """ + session_count_ctype = _visatype.ViUInt32( + 0 if sessions is None else len(sessions) + ) # case S160 + sessions_converted = _converters.convert_to_nitclk_session_number_list( + sessions + ) # case B520 + sessions_ctype = get_ctypes_pointer_for_buffer( + value=sessions_converted, library_type=_visatype.ViSession + ) # case B520 + min_time_ctype = _converters.convert_timedelta_to_seconds_real64( + min_time + ) # case S140 + error_code = self._library.niTClk_SetupForSyncPulseSenderSynchronize( + session_count_ctype, sessions_ctype, min_time_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def synchronize(self, sessions, min_tclk_period=hightime.timedelta(seconds=0.0)): - r'''synchronize + r"""synchronize Synchronizes the TClk signals on the given sessions. After synchronize executes, TClk signals from all sessions are @@ -744,17 +885,31 @@ def synchronize(self, sessions, min_tclk_period=hightime.timedelta(seconds=0.0)) synchronization, adjust this value to account for propagation delays through the various devices and cables. - ''' - session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 - sessions_converted = _converters.convert_to_nitclk_session_number_list(sessions) # case B520 - sessions_ctype = get_ctypes_pointer_for_buffer(value=sessions_converted, library_type=_visatype.ViSession) # case B520 - min_tclk_period_ctype = _converters.convert_timedelta_to_seconds_real64(min_tclk_period) # case S140 - error_code = self._library.niTClk_Synchronize(session_count_ctype, sessions_ctype, min_tclk_period_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + """ + session_count_ctype = _visatype.ViUInt32( + 0 if sessions is None else len(sessions) + ) # case S160 + sessions_converted = _converters.convert_to_nitclk_session_number_list( + sessions + ) # case B520 + sessions_ctype = get_ctypes_pointer_for_buffer( + value=sessions_converted, library_type=_visatype.ViSession + ) # case B520 + min_tclk_period_ctype = _converters.convert_timedelta_to_seconds_real64( + min_tclk_period + ) # case S140 + error_code = self._library.niTClk_Synchronize( + session_count_ctype, sessions_ctype, min_tclk_period_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return - def synchronize_to_sync_pulse_sender(self, sessions, min_time=hightime.timedelta(seconds=0.0)): - r'''synchronize_to_sync_pulse_sender + def synchronize_to_sync_pulse_sender( + self, sessions, min_time=hightime.timedelta(seconds=0.0) + ): + r"""synchronize_to_sync_pulse_sender Synchronizes the other devices to the Sync Pulse Sender. @@ -768,17 +923,29 @@ def synchronize_to_sync_pulse_sender(self, sessions, min_time=hightime.timedelta synchronization, adjust this value to account for propagation delays through the various devices and cables. - ''' - session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 - sessions_converted = _converters.convert_to_nitclk_session_number_list(sessions) # case B520 - sessions_ctype = get_ctypes_pointer_for_buffer(value=sessions_converted, library_type=_visatype.ViSession) # case B520 - min_time_ctype = _converters.convert_timedelta_to_seconds_real64(min_time) # case S140 - error_code = self._library.niTClk_SynchronizeToSyncPulseSender(session_count_ctype, sessions_ctype, min_time_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + """ + session_count_ctype = _visatype.ViUInt32( + 0 if sessions is None else len(sessions) + ) # case S160 + sessions_converted = _converters.convert_to_nitclk_session_number_list( + sessions + ) # case B520 + sessions_ctype = get_ctypes_pointer_for_buffer( + value=sessions_converted, library_type=_visatype.ViSession + ) # case B520 + min_time_ctype = _converters.convert_timedelta_to_seconds_real64( + min_time + ) # case S140 + error_code = self._library.niTClk_SynchronizeToSyncPulseSender( + session_count_ctype, sessions_ctype, min_time_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def wait_until_done(self, sessions, timeout=hightime.timedelta(seconds=0.0)): - r'''wait_until_done + r"""wait_until_done Call this method to pause execution of your program until the acquisitions and/or generations corresponding to sessions are done or @@ -796,18 +963,30 @@ def wait_until_done(self, sessions, timeout=hightime.timedelta(seconds=0.0)): sessions to complete. If timeout is exceeded, wait_until_done returns an error. - ''' - session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 - sessions_converted = _converters.convert_to_nitclk_session_number_list(sessions) # case B520 - sessions_ctype = get_ctypes_pointer_for_buffer(value=sessions_converted, library_type=_visatype.ViSession) # case B520 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 - error_code = self._library.niTClk_WaitUntilDone(session_count_ctype, sessions_ctype, timeout_ctype) - errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + """ + session_count_ctype = _visatype.ViUInt32( + 0 if sessions is None else len(sessions) + ) # case S160 + sessions_converted = _converters.convert_to_nitclk_session_number_list( + sessions + ) # case B520 + sessions_ctype = get_ctypes_pointer_for_buffer( + value=sessions_converted, library_type=_visatype.ViSession + ) # case B520 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64( + timeout + ) # case S140 + error_code = self._library.niTClk_WaitUntilDone( + session_count_ctype, sessions_ctype, timeout_ctype + ) + errors.handle_error( + self, error_code, ignore_warnings=False, is_error_handling=False + ) return def configure_for_homogeneous_triggers(sessions): - '''configure_for_homogeneous_triggers + """configure_for_homogeneous_triggers Configures the properties commonly required for the TClk synchronization of device sessions with homogeneous triggers in a single PXI chassis or @@ -915,12 +1094,12 @@ def configure_for_homogeneous_triggers(sessions): Args: sessions (list of instrument-specific sessions or nitclk.SessionReference instances): sessions is an array of sessions that are being synchronized. - ''' + """ return _Session().configure_for_homogeneous_triggers(sessions) def finish_sync_pulse_sender_synchronize(sessions, min_time): - '''finish_sync_pulse_sender_synchronize + """finish_sync_pulse_sender_synchronize Finishes synchronizing the Sync Pulse Sender. @@ -934,12 +1113,12 @@ def finish_sync_pulse_sender_synchronize(sessions, min_time): synchronization, adjust this value to account for propagation delays through the various devices and cables. - ''' + """ return _Session().finish_sync_pulse_sender_synchronize(sessions, min_time) def initiate(sessions): - '''initiate + """initiate Initiates the acquisition or generation sessions specified, taking into consideration any special requirements needed for synchronization. For @@ -950,12 +1129,12 @@ def initiate(sessions): Args: sessions (list of instrument-specific sessions or nitclk.SessionReference instances): sessions is an array of sessions that are being synchronized. - ''' + """ return _Session().initiate(sessions) def is_done(sessions): - '''is_done + """is_done Monitors the progress of the acquisitions and/or generations corresponding to sessions. @@ -969,12 +1148,12 @@ def is_done(sessions): session has completed without any errors or when any one of the sessions reports an error. - ''' + """ return _Session().is_done(sessions) def setup_for_sync_pulse_sender_synchronize(sessions, min_time): - '''setup_for_sync_pulse_sender_synchronize + """setup_for_sync_pulse_sender_synchronize Configures the TClks on all the devices and prepares the Sync Pulse Sender for synchronization @@ -988,12 +1167,12 @@ def setup_for_sync_pulse_sender_synchronize(sessions, min_time): synchronization, adjust this value to account for propagation delays through the various devices and cables. - ''' + """ return _Session().setup_for_sync_pulse_sender_synchronize(sessions, min_time) def synchronize(sessions, min_tclk_period): - '''synchronize + """synchronize Synchronizes the TClk signals on the given sessions. After synchronize executes, TClk signals from all sessions are @@ -1012,12 +1191,12 @@ def synchronize(sessions, min_tclk_period): synchronization, adjust this value to account for propagation delays through the various devices and cables. - ''' + """ return _Session().synchronize(sessions, min_tclk_period) def synchronize_to_sync_pulse_sender(sessions, min_time): - '''synchronize_to_sync_pulse_sender + """synchronize_to_sync_pulse_sender Synchronizes the other devices to the Sync Pulse Sender. @@ -1031,12 +1210,12 @@ def synchronize_to_sync_pulse_sender(sessions, min_time): synchronization, adjust this value to account for propagation delays through the various devices and cables. - ''' + """ return _Session().synchronize_to_sync_pulse_sender(sessions, min_time) def wait_until_done(sessions, timeout): - '''wait_until_done + """wait_until_done Call this method to pause execution of your program until the acquisitions and/or generations corresponding to sessions are done or @@ -1054,8 +1233,5 @@ def wait_until_done(sessions, timeout): sessions to complete. If timeout is exceeded, wait_until_done returns an error. - ''' + """ return _Session().wait_until_done(sessions, timeout) - - - diff --git a/generated/nitclk/nitclk/unit_tests/_matchers.py b/generated/nitclk/nitclk/unit_tests/_matchers.py index 70f09f8d3..34fcb63b5 100644 --- a/generated/nitclk/nitclk/unit_tests/_matchers.py +++ b/generated/nitclk/nitclk/unit_tests/_matchers.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # This file was generated -'''Matcher classes used by unit tests in order to set mock expectations. +"""Matcher classes used by unit tests in order to set mock expectations. These work well with our visatype definitions. -''' +""" import ctypes import nitclk._visatype as _visatype @@ -21,15 +21,27 @@ def __init__(self, expected_type, expected_value): def __eq__(self, other): if not isinstance(other, self.expected_type): - print("{0}: Unexpected type. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_type, type(other))) + print( + "{0}: Unexpected type. Expected: {1}. Received: {2}".format( + self.__class__.__name__, self.expected_type, type(other) + ) + ) return False if other.value != self.expected_value: - print("{0}: Unexpected value. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_value, other.value)) + print( + "{0}: Unexpected value. Expected: {1}. Received: {2}".format( + self.__class__.__name__, self.expected_value, other.value + ) + ) return False return True def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_type), + pp.pformat(self.expected_value), + ) class _PointerMatcher(object): @@ -38,12 +50,18 @@ def __init__(self, expected_type): def __eq__(self, other): if not isinstance(other, ctypes.POINTER(self.expected_type)): - print("Unexpected type. Expected: {0}. Received: {1}".format(ctypes.POINTER(self.expected_type), type(other))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + ctypes.POINTER(self.expected_type), type(other) + ) + ) return False return True def __repr__(self): - return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_type)) + return "{0}({1})".format( + self.__class__.__name__, pp.pformat(self.expected_type) + ) class _BufferMatcher(object): @@ -70,29 +88,47 @@ def __eq__(self, other): pass # Because of object lifetimes, we may need to mock the other instance and provide lists instead of the actual array - if not isinstance(other, self.expected_type) and not isinstance(other, list): - print("Unexpected type. Expected: {0} or {1}. Received: {2}".format(self.expected_type, list, type(other))) + if not isinstance(other, self.expected_type) and not isinstance( + other, list + ): + print( + "Unexpected type. Expected: {0} or {1}. Received: {2}".format( + self.expected_type, list, type(other) + ) + ) return False if self.expected_size != len(other): - print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(other))) + print( + "Unexpected length. Expected: {0}. Received: {1}".format( + self.expected_size, len(other) + ) + ) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for i in range(0, len(self.expected_value)): if self.expected_value[i] != other[i]: - print("Unexpected value at index {0}. Expected: {1}. Received: {2}".format(i, self.expected_value[i], other[i])) + print( + "Unexpected value at index {0}. Expected: {1}. Received: {2}".format( + i, self.expected_value[i], other[i] + ) + ) return False return True def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self._expected_element_type), pp.pformat(self._expected_size_or_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self._expected_element_type), + pp.pformat(self._expected_size_or_value), + ) def __str__(self): - ret_str = self.__repr__() + '\n' - ret_str += ' expected_type = ' + str(self.expected_type) + '\n' - ret_str += ' expected_value = ' + str(self.expected_value) + '\n' - ret_str += ' expected_size = ' + str(self.expected_size) + '\n' + ret_str = self.__repr__() + "\n" + ret_str += " expected_type = " + str(self.expected_type) + "\n" + ret_str += " expected_value = " + str(self.expected_value) + "\n" + ret_str += " expected_size = " + str(self.expected_size) + "\n" return ret_str @@ -112,21 +148,37 @@ def __eq__(self, other): pass if not isinstance(other, ctypes.Array): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(other))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_type, type(other) + ) + ) return False - if len(other) < len(self.expected_string_value) + 1: # +1 for NULL terminating character - print("Unexpected length in C string. Expected at least: {0}. Received {1}".format(len(other), len(self.expected_string_value) + 1)) + if ( + len(other) < len(self.expected_string_value) + 1 + ): # +1 for NULL terminating character + print( + "Unexpected length in C string. Expected at least: {0}. Received {1}".format( + len(other), len(self.expected_string_value) + 1 + ) + ) return False if not isinstance(other[0], bytes): print("Unexpected type. Not a string. Received: {0}".format(type(other[0]))) return False if other.value.decode("ascii") != self.expected_string_value: - print("Unexpected value. Expected {0}. Received: {1}".format(self.expected_string_value, other.value.decode)) + print( + "Unexpected value. Expected {0}. Received: {1}".format( + self.expected_string_value, other.value.decode + ) + ) return False return True def __repr__(self): - return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_string_value)) + return "{0}({1})".format( + self.__class__.__name__, pp.pformat(self.expected_string_value) + ) # Custom Type @@ -139,7 +191,11 @@ def _compare_ctype_structs(expected, actual): expected_val = getattr(expected, field_name) actual_val = getattr(actual, field_name) if expected_val != actual_val: - print("Unexpected value field {0}. Expected: {1}. Received: {2}".format(field_name, expected_val, actual_val)) + print( + "Unexpected value field {0}. Expected: {1}. Received: {2}".format( + field_name, expected_val, actual_val + ) + ) return False return True @@ -151,12 +207,20 @@ def __init__(self, expected_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_type, type(actual) + ) + ) return False return _compare_ctype_structs(self.expected_value, actual) def __repr__(self): - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_type), + pp.pformat(self.expected_value), + ) class CustomTypeBufferMatcher(object): @@ -168,30 +232,48 @@ def __init__(self, expected_element_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print("Unexpected array type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) + print( + "Unexpected array type. Expected: {0}. Received: {1}".format( + self.expected_type, type(actual) + ) + ) return False if self.expected_size != len(actual): - print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(actual))) + print( + "Unexpected length. Expected: {0}. Received: {1}".format( + self.expected_size, len(actual) + ) + ) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for a, e in zip(actual, self.expected_value): if not isinstance(a, self.expected_element_type): - print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_element_type, type(a))) + print( + "Unexpected type. Expected: {0}. Received: {1}".format( + self.expected_element_type, type(a) + ) + ) return False if not _compare_ctype_structs(e, a): return False return True def __repr__(self): - expected_val_repr = '[' + ', '.join([x.__repr__() for x in self.expected_value]) + ']' - return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_element_type), expected_val_repr) + expected_val_repr = ( + "[" + ", ".join([x.__repr__() for x in self.expected_value]) + "]" + ) + return "{0}({1}, {2})".format( + self.__class__.__name__, + pp.pformat(self.expected_element_type), + expected_val_repr, + ) def __str__(self): - ret_str = self.__repr__() + '\n' - ret_str += ' expected_type = ' + str(self.expected_type) + '\n' - ret_str += ' expected_size = ' + str(self.expected_size) + '\n' + ret_str = self.__repr__() + "\n" + ret_str += " expected_type = " + str(self.expected_type) + "\n" + ret_str += " expected_size = " + str(self.expected_size) + "\n" return ret_str @@ -200,7 +282,9 @@ def __str__(self): class ViBooleanMatcher(_ScalarMatcher): def __init__(self, expected_value): - _ScalarMatcher.__init__(self, _visatype.ViBoolean, 1 if expected_value is True else 0) + _ScalarMatcher.__init__( + self, _visatype.ViBoolean, 1 if expected_value is True else 0 + ) class ViSessionMatcher(_ScalarMatcher): @@ -312,6 +396,3 @@ def __init__(self, expected_size_or_value): class ViSessionBufferMatcher(_BufferMatcher): def __init__(self, expected_size_or_value): _BufferMatcher.__init__(self, _visatype.ViSession, expected_size_or_value) - - - diff --git a/generated/nitclk/nitclk/unit_tests/_mock_helper.py b/generated/nitclk/nitclk/unit_tests/_mock_helper.py index 754c1a98e..3973b3f11 100644 --- a/generated/nitclk/nitclk/unit_tests/_mock_helper.py +++ b/generated/nitclk/nitclk/unit_tests/_mock_helper.py @@ -16,41 +16,41 @@ def __init__(self, function, param=None): class SideEffectsHelper(object): def __init__(self): self._defaults = {} - self._defaults['ConfigureForHomogeneousTriggers'] = {} - self._defaults['ConfigureForHomogeneousTriggers']['return'] = 0 - self._defaults['FinishSyncPulseSenderSynchronize'] = {} - self._defaults['FinishSyncPulseSenderSynchronize']['return'] = 0 - self._defaults['GetAttributeViReal64'] = {} - self._defaults['GetAttributeViReal64']['return'] = 0 - self._defaults['GetAttributeViReal64']['value'] = None - self._defaults['GetAttributeViSession'] = {} - self._defaults['GetAttributeViSession']['return'] = 0 - self._defaults['GetAttributeViSession']['value'] = None - self._defaults['GetAttributeViString'] = {} - self._defaults['GetAttributeViString']['return'] = 0 - self._defaults['GetAttributeViString']['value'] = None - self._defaults['GetExtendedErrorInfo'] = {} - self._defaults['GetExtendedErrorInfo']['return'] = 0 - self._defaults['GetExtendedErrorInfo']['errorString'] = None - self._defaults['Initiate'] = {} - self._defaults['Initiate']['return'] = 0 - self._defaults['IsDone'] = {} - self._defaults['IsDone']['return'] = 0 - self._defaults['IsDone']['done'] = None - self._defaults['SetAttributeViReal64'] = {} - self._defaults['SetAttributeViReal64']['return'] = 0 - self._defaults['SetAttributeViSession'] = {} - self._defaults['SetAttributeViSession']['return'] = 0 - self._defaults['SetAttributeViString'] = {} - self._defaults['SetAttributeViString']['return'] = 0 - self._defaults['SetupForSyncPulseSenderSynchronize'] = {} - self._defaults['SetupForSyncPulseSenderSynchronize']['return'] = 0 - self._defaults['Synchronize'] = {} - self._defaults['Synchronize']['return'] = 0 - self._defaults['SynchronizeToSyncPulseSender'] = {} - self._defaults['SynchronizeToSyncPulseSender']['return'] = 0 - self._defaults['WaitUntilDone'] = {} - self._defaults['WaitUntilDone']['return'] = 0 + self._defaults["ConfigureForHomogeneousTriggers"] = {} + self._defaults["ConfigureForHomogeneousTriggers"]["return"] = 0 + self._defaults["FinishSyncPulseSenderSynchronize"] = {} + self._defaults["FinishSyncPulseSenderSynchronize"]["return"] = 0 + self._defaults["GetAttributeViReal64"] = {} + self._defaults["GetAttributeViReal64"]["return"] = 0 + self._defaults["GetAttributeViReal64"]["value"] = None + self._defaults["GetAttributeViSession"] = {} + self._defaults["GetAttributeViSession"]["return"] = 0 + self._defaults["GetAttributeViSession"]["value"] = None + self._defaults["GetAttributeViString"] = {} + self._defaults["GetAttributeViString"]["return"] = 0 + self._defaults["GetAttributeViString"]["value"] = None + self._defaults["GetExtendedErrorInfo"] = {} + self._defaults["GetExtendedErrorInfo"]["return"] = 0 + self._defaults["GetExtendedErrorInfo"]["errorString"] = None + self._defaults["Initiate"] = {} + self._defaults["Initiate"]["return"] = 0 + self._defaults["IsDone"] = {} + self._defaults["IsDone"]["return"] = 0 + self._defaults["IsDone"]["done"] = None + self._defaults["SetAttributeViReal64"] = {} + self._defaults["SetAttributeViReal64"]["return"] = 0 + self._defaults["SetAttributeViSession"] = {} + self._defaults["SetAttributeViSession"]["return"] = 0 + self._defaults["SetAttributeViString"] = {} + self._defaults["SetAttributeViString"]["return"] = 0 + self._defaults["SetupForSyncPulseSenderSynchronize"] = {} + self._defaults["SetupForSyncPulseSenderSynchronize"]["return"] = 0 + self._defaults["Synchronize"] = {} + self._defaults["Synchronize"]["return"] = 0 + self._defaults["SynchronizeToSyncPulseSender"] = {} + self._defaults["SynchronizeToSyncPulseSender"]["return"] = 0 + self._defaults["WaitUntilDone"] = {} + self._defaults["WaitUntilDone"]["return"] = 0 def __getitem__(self, func): return self._defaults[func] @@ -58,135 +58,191 @@ def __getitem__(self, func): def __setitem__(self, func, val): self._defaults[func] = val - def niTClk_ConfigureForHomogeneousTriggers(self, session_count, sessions): # noqa: N802 - if self._defaults['ConfigureForHomogeneousTriggers']['return'] != 0: - return self._defaults['ConfigureForHomogeneousTriggers']['return'] - return self._defaults['ConfigureForHomogeneousTriggers']['return'] - - def niTClk_FinishSyncPulseSenderSynchronize(self, session_count, sessions, min_time): # noqa: N802 - if self._defaults['FinishSyncPulseSenderSynchronize']['return'] != 0: - return self._defaults['FinishSyncPulseSenderSynchronize']['return'] - return self._defaults['FinishSyncPulseSenderSynchronize']['return'] - - def niTClk_GetAttributeViReal64(self, session, channel_name, attribute_id, value): # noqa: N802 - if self._defaults['GetAttributeViReal64']['return'] != 0: - return self._defaults['GetAttributeViReal64']['return'] + def niTClk_ConfigureForHomogeneousTriggers( + self, session_count, sessions + ): # noqa: N802 + if self._defaults["ConfigureForHomogeneousTriggers"]["return"] != 0: + return self._defaults["ConfigureForHomogeneousTriggers"]["return"] + return self._defaults["ConfigureForHomogeneousTriggers"]["return"] + + def niTClk_FinishSyncPulseSenderSynchronize( + self, session_count, sessions, min_time + ): # noqa: N802 + if self._defaults["FinishSyncPulseSenderSynchronize"]["return"] != 0: + return self._defaults["FinishSyncPulseSenderSynchronize"]["return"] + return self._defaults["FinishSyncPulseSenderSynchronize"]["return"] + + def niTClk_GetAttributeViReal64( + self, session, channel_name, attribute_id, value + ): # noqa: N802 + if self._defaults["GetAttributeViReal64"]["return"] != 0: + return self._defaults["GetAttributeViReal64"]["return"] # value - if self._defaults['GetAttributeViReal64']['value'] is None: - raise MockFunctionCallError("niTClk_GetAttributeViReal64", param='value') + if self._defaults["GetAttributeViReal64"]["value"] is None: + raise MockFunctionCallError("niTClk_GetAttributeViReal64", param="value") if value is not None: - value.contents.value = self._defaults['GetAttributeViReal64']['value'] - return self._defaults['GetAttributeViReal64']['return'] - - def niTClk_GetAttributeViSession(self, session, channel_name, attribute_id, value): # noqa: N802 - if self._defaults['GetAttributeViSession']['return'] != 0: - return self._defaults['GetAttributeViSession']['return'] + value.contents.value = self._defaults["GetAttributeViReal64"]["value"] + return self._defaults["GetAttributeViReal64"]["return"] + + def niTClk_GetAttributeViSession( + self, session, channel_name, attribute_id, value + ): # noqa: N802 + if self._defaults["GetAttributeViSession"]["return"] != 0: + return self._defaults["GetAttributeViSession"]["return"] # value - if self._defaults['GetAttributeViSession']['value'] is None: - raise MockFunctionCallError("niTClk_GetAttributeViSession", param='value') + if self._defaults["GetAttributeViSession"]["value"] is None: + raise MockFunctionCallError("niTClk_GetAttributeViSession", param="value") if value is not None: - value.contents.value = self._defaults['GetAttributeViSession']['value'] - return self._defaults['GetAttributeViSession']['return'] - - def niTClk_GetAttributeViString(self, session, channel_name, attribute_id, buf_size, value): # noqa: N802 - if self._defaults['GetAttributeViString']['return'] != 0: - return self._defaults['GetAttributeViString']['return'] - if self._defaults['GetAttributeViString']['value'] is None: - raise MockFunctionCallError("niTClk_GetAttributeViString", param='value') + value.contents.value = self._defaults["GetAttributeViSession"]["value"] + return self._defaults["GetAttributeViSession"]["return"] + + def niTClk_GetAttributeViString( + self, session, channel_name, attribute_id, buf_size, value + ): # noqa: N802 + if self._defaults["GetAttributeViString"]["return"] != 0: + return self._defaults["GetAttributeViString"]["return"] + if self._defaults["GetAttributeViString"]["value"] is None: + raise MockFunctionCallError("niTClk_GetAttributeViString", param="value") if buf_size.value == 0: - return len(self._defaults['GetAttributeViString']['value']) - value.value = self._defaults['GetAttributeViString']['value'].encode('ascii') - return self._defaults['GetAttributeViString']['return'] - - def niTClk_GetExtendedErrorInfo(self, error_string, error_string_size): # noqa: N802 - if self._defaults['GetExtendedErrorInfo']['return'] != 0: - return self._defaults['GetExtendedErrorInfo']['return'] - if self._defaults['GetExtendedErrorInfo']['errorString'] is None: - raise MockFunctionCallError("niTClk_GetExtendedErrorInfo", param='errorString') + return len(self._defaults["GetAttributeViString"]["value"]) + value.value = self._defaults["GetAttributeViString"]["value"].encode("ascii") + return self._defaults["GetAttributeViString"]["return"] + + def niTClk_GetExtendedErrorInfo( + self, error_string, error_string_size + ): # noqa: N802 + if self._defaults["GetExtendedErrorInfo"]["return"] != 0: + return self._defaults["GetExtendedErrorInfo"]["return"] + if self._defaults["GetExtendedErrorInfo"]["errorString"] is None: + raise MockFunctionCallError( + "niTClk_GetExtendedErrorInfo", param="errorString" + ) if error_string_size.value == 0: - return len(self._defaults['GetExtendedErrorInfo']['errorString']) - error_string.value = self._defaults['GetExtendedErrorInfo']['errorString'].encode('ascii') - return self._defaults['GetExtendedErrorInfo']['return'] + return len(self._defaults["GetExtendedErrorInfo"]["errorString"]) + error_string.value = self._defaults["GetExtendedErrorInfo"][ + "errorString" + ].encode("ascii") + return self._defaults["GetExtendedErrorInfo"]["return"] def niTClk_Initiate(self, session_count, sessions): # noqa: N802 - if self._defaults['Initiate']['return'] != 0: - return self._defaults['Initiate']['return'] - return self._defaults['Initiate']['return'] + if self._defaults["Initiate"]["return"] != 0: + return self._defaults["Initiate"]["return"] + return self._defaults["Initiate"]["return"] def niTClk_IsDone(self, session_count, sessions, done): # noqa: N802 - if self._defaults['IsDone']['return'] != 0: - return self._defaults['IsDone']['return'] + if self._defaults["IsDone"]["return"] != 0: + return self._defaults["IsDone"]["return"] # done - if self._defaults['IsDone']['done'] is None: - raise MockFunctionCallError("niTClk_IsDone", param='done') + if self._defaults["IsDone"]["done"] is None: + raise MockFunctionCallError("niTClk_IsDone", param="done") if done is not None: - done.contents.value = self._defaults['IsDone']['done'] - return self._defaults['IsDone']['return'] - - def niTClk_SetAttributeViReal64(self, session, channel_name, attribute_id, value): # noqa: N802 - if self._defaults['SetAttributeViReal64']['return'] != 0: - return self._defaults['SetAttributeViReal64']['return'] - return self._defaults['SetAttributeViReal64']['return'] - - def niTClk_SetAttributeViSession(self, session, channel_name, attribute_id, value): # noqa: N802 - if self._defaults['SetAttributeViSession']['return'] != 0: - return self._defaults['SetAttributeViSession']['return'] - return self._defaults['SetAttributeViSession']['return'] - - def niTClk_SetAttributeViString(self, session, channel_name, attribute_id, value): # noqa: N802 - if self._defaults['SetAttributeViString']['return'] != 0: - return self._defaults['SetAttributeViString']['return'] - return self._defaults['SetAttributeViString']['return'] - - def niTClk_SetupForSyncPulseSenderSynchronize(self, session_count, sessions, min_time): # noqa: N802 - if self._defaults['SetupForSyncPulseSenderSynchronize']['return'] != 0: - return self._defaults['SetupForSyncPulseSenderSynchronize']['return'] - return self._defaults['SetupForSyncPulseSenderSynchronize']['return'] - - def niTClk_Synchronize(self, session_count, sessions, min_tclk_period): # noqa: N802 - if self._defaults['Synchronize']['return'] != 0: - return self._defaults['Synchronize']['return'] - return self._defaults['Synchronize']['return'] - - def niTClk_SynchronizeToSyncPulseSender(self, session_count, sessions, min_time): # noqa: N802 - if self._defaults['SynchronizeToSyncPulseSender']['return'] != 0: - return self._defaults['SynchronizeToSyncPulseSender']['return'] - return self._defaults['SynchronizeToSyncPulseSender']['return'] + done.contents.value = self._defaults["IsDone"]["done"] + return self._defaults["IsDone"]["return"] + + def niTClk_SetAttributeViReal64( + self, session, channel_name, attribute_id, value + ): # noqa: N802 + if self._defaults["SetAttributeViReal64"]["return"] != 0: + return self._defaults["SetAttributeViReal64"]["return"] + return self._defaults["SetAttributeViReal64"]["return"] + + def niTClk_SetAttributeViSession( + self, session, channel_name, attribute_id, value + ): # noqa: N802 + if self._defaults["SetAttributeViSession"]["return"] != 0: + return self._defaults["SetAttributeViSession"]["return"] + return self._defaults["SetAttributeViSession"]["return"] + + def niTClk_SetAttributeViString( + self, session, channel_name, attribute_id, value + ): # noqa: N802 + if self._defaults["SetAttributeViString"]["return"] != 0: + return self._defaults["SetAttributeViString"]["return"] + return self._defaults["SetAttributeViString"]["return"] + + def niTClk_SetupForSyncPulseSenderSynchronize( + self, session_count, sessions, min_time + ): # noqa: N802 + if self._defaults["SetupForSyncPulseSenderSynchronize"]["return"] != 0: + return self._defaults["SetupForSyncPulseSenderSynchronize"]["return"] + return self._defaults["SetupForSyncPulseSenderSynchronize"]["return"] + + def niTClk_Synchronize( + self, session_count, sessions, min_tclk_period + ): # noqa: N802 + if self._defaults["Synchronize"]["return"] != 0: + return self._defaults["Synchronize"]["return"] + return self._defaults["Synchronize"]["return"] + + def niTClk_SynchronizeToSyncPulseSender( + self, session_count, sessions, min_time + ): # noqa: N802 + if self._defaults["SynchronizeToSyncPulseSender"]["return"] != 0: + return self._defaults["SynchronizeToSyncPulseSender"]["return"] + return self._defaults["SynchronizeToSyncPulseSender"]["return"] def niTClk_WaitUntilDone(self, session_count, sessions, timeout): # noqa: N802 - if self._defaults['WaitUntilDone']['return'] != 0: - return self._defaults['WaitUntilDone']['return'] - return self._defaults['WaitUntilDone']['return'] + if self._defaults["WaitUntilDone"]["return"] != 0: + return self._defaults["WaitUntilDone"]["return"] + return self._defaults["WaitUntilDone"]["return"] # Helper function to setup Mock object with default side effects and return values def set_side_effects_and_return_values(self, mock_library): - mock_library.niTClk_ConfigureForHomogeneousTriggers.side_effect = MockFunctionCallError("niTClk_ConfigureForHomogeneousTriggers") + mock_library.niTClk_ConfigureForHomogeneousTriggers.side_effect = ( + MockFunctionCallError("niTClk_ConfigureForHomogeneousTriggers") + ) mock_library.niTClk_ConfigureForHomogeneousTriggers.return_value = 0 - mock_library.niTClk_FinishSyncPulseSenderSynchronize.side_effect = MockFunctionCallError("niTClk_FinishSyncPulseSenderSynchronize") + mock_library.niTClk_FinishSyncPulseSenderSynchronize.side_effect = ( + MockFunctionCallError("niTClk_FinishSyncPulseSenderSynchronize") + ) mock_library.niTClk_FinishSyncPulseSenderSynchronize.return_value = 0 - mock_library.niTClk_GetAttributeViReal64.side_effect = MockFunctionCallError("niTClk_GetAttributeViReal64") + mock_library.niTClk_GetAttributeViReal64.side_effect = MockFunctionCallError( + "niTClk_GetAttributeViReal64" + ) mock_library.niTClk_GetAttributeViReal64.return_value = 0 - mock_library.niTClk_GetAttributeViSession.side_effect = MockFunctionCallError("niTClk_GetAttributeViSession") + mock_library.niTClk_GetAttributeViSession.side_effect = MockFunctionCallError( + "niTClk_GetAttributeViSession" + ) mock_library.niTClk_GetAttributeViSession.return_value = 0 - mock_library.niTClk_GetAttributeViString.side_effect = MockFunctionCallError("niTClk_GetAttributeViString") + mock_library.niTClk_GetAttributeViString.side_effect = MockFunctionCallError( + "niTClk_GetAttributeViString" + ) mock_library.niTClk_GetAttributeViString.return_value = 0 - mock_library.niTClk_GetExtendedErrorInfo.side_effect = MockFunctionCallError("niTClk_GetExtendedErrorInfo") + mock_library.niTClk_GetExtendedErrorInfo.side_effect = MockFunctionCallError( + "niTClk_GetExtendedErrorInfo" + ) mock_library.niTClk_GetExtendedErrorInfo.return_value = 0 - mock_library.niTClk_Initiate.side_effect = MockFunctionCallError("niTClk_Initiate") + mock_library.niTClk_Initiate.side_effect = MockFunctionCallError( + "niTClk_Initiate" + ) mock_library.niTClk_Initiate.return_value = 0 mock_library.niTClk_IsDone.side_effect = MockFunctionCallError("niTClk_IsDone") mock_library.niTClk_IsDone.return_value = 0 - mock_library.niTClk_SetAttributeViReal64.side_effect = MockFunctionCallError("niTClk_SetAttributeViReal64") + mock_library.niTClk_SetAttributeViReal64.side_effect = MockFunctionCallError( + "niTClk_SetAttributeViReal64" + ) mock_library.niTClk_SetAttributeViReal64.return_value = 0 - mock_library.niTClk_SetAttributeViSession.side_effect = MockFunctionCallError("niTClk_SetAttributeViSession") + mock_library.niTClk_SetAttributeViSession.side_effect = MockFunctionCallError( + "niTClk_SetAttributeViSession" + ) mock_library.niTClk_SetAttributeViSession.return_value = 0 - mock_library.niTClk_SetAttributeViString.side_effect = MockFunctionCallError("niTClk_SetAttributeViString") + mock_library.niTClk_SetAttributeViString.side_effect = MockFunctionCallError( + "niTClk_SetAttributeViString" + ) mock_library.niTClk_SetAttributeViString.return_value = 0 - mock_library.niTClk_SetupForSyncPulseSenderSynchronize.side_effect = MockFunctionCallError("niTClk_SetupForSyncPulseSenderSynchronize") + mock_library.niTClk_SetupForSyncPulseSenderSynchronize.side_effect = ( + MockFunctionCallError("niTClk_SetupForSyncPulseSenderSynchronize") + ) mock_library.niTClk_SetupForSyncPulseSenderSynchronize.return_value = 0 - mock_library.niTClk_Synchronize.side_effect = MockFunctionCallError("niTClk_Synchronize") + mock_library.niTClk_Synchronize.side_effect = MockFunctionCallError( + "niTClk_Synchronize" + ) mock_library.niTClk_Synchronize.return_value = 0 - mock_library.niTClk_SynchronizeToSyncPulseSender.side_effect = MockFunctionCallError("niTClk_SynchronizeToSyncPulseSender") + mock_library.niTClk_SynchronizeToSyncPulseSender.side_effect = ( + MockFunctionCallError("niTClk_SynchronizeToSyncPulseSender") + ) mock_library.niTClk_SynchronizeToSyncPulseSender.return_value = 0 - mock_library.niTClk_WaitUntilDone.side_effect = MockFunctionCallError("niTClk_WaitUntilDone") + mock_library.niTClk_WaitUntilDone.side_effect = MockFunctionCallError( + "niTClk_WaitUntilDone" + ) mock_library.niTClk_WaitUntilDone.return_value = 0 diff --git a/generated/nitclk/nitclk/unit_tests/test_nitclk.py b/generated/nitclk/nitclk/unit_tests/test_nitclk.py index 43fd96140..6ff70e222 100644 --- a/generated/nitclk/nitclk/unit_tests/test_nitclk.py +++ b/generated/nitclk/nitclk/unit_tests/test_nitclk.py @@ -9,28 +9,38 @@ SESSION_NUM_FOR_TEST = 42 single_session = [SESSION_NUM_FOR_TEST] single_session_reference = [nitclk.SessionReference(x) for x in single_session] -multiple_sessions = [SESSION_NUM_FOR_TEST, SESSION_NUM_FOR_TEST * 10, SESSION_NUM_FOR_TEST * 100, SESSION_NUM_FOR_TEST + 1] +multiple_sessions = [ + SESSION_NUM_FOR_TEST, + SESSION_NUM_FOR_TEST * 10, + SESSION_NUM_FOR_TEST * 100, + SESSION_NUM_FOR_TEST + 1, +] multiple_session_references = [nitclk.SessionReference(x) for x in multiple_sessions] class NitclkSupportingDriverSession(object): - '''Session objects for drivers that support NI-TClk are expected to have a property of type nitclk.SessionReference called tclk + """Session objects for drivers that support NI-TClk are expected to have a property of type nitclk.SessionReference called tclk This is why we're creating this fake driver class and adding the tclk property. - ''' + """ + def __init__(self, session_number): self.tclk = nitclk.SessionReference(session_number) class TestNitclkApi(object): def setup_method(self, method): - self.patched_library_patcher = patch('nitclk._library.Library', autospec=True) + self.patched_library_patcher = patch("nitclk._library.Library", autospec=True) self.patched_library = self.patched_library_patcher.start() - self.patched_library_singleton_get = patch('nitclk.session._library_singleton.get', return_value=self.patched_library) + self.patched_library_singleton_get = patch( + "nitclk.session._library_singleton.get", return_value=self.patched_library + ) self.patched_library_singleton_get.start() self.side_effects_helper = _mock_helper.SideEffectsHelper() - self.side_effects_helper.set_side_effects_and_return_values(self.patched_library) + self.side_effects_helper.set_side_effects_and_return_values( + self.patched_library + ) def teardown_method(self, method): self.patched_library_singleton_get.stop() @@ -39,83 +49,148 @@ def teardown_method(self, method): # API Tests def test_initialize_one_session(self): - self.patched_library.niTClk_Initiate.side_effect = self.side_effects_helper.niTClk_Initiate + self.patched_library.niTClk_Initiate.side_effect = ( + self.side_effects_helper.niTClk_Initiate + ) nitclk.initiate(single_session_reference) - self.patched_library.niTClk_Initiate.assert_called_once_with(_matchers.ViUInt32Matcher(len(single_session)), _matchers.ViSessionBufferMatcher(single_session)) + self.patched_library.niTClk_Initiate.assert_called_once_with( + _matchers.ViUInt32Matcher(len(single_session)), + _matchers.ViSessionBufferMatcher(single_session), + ) return def test_initialize_multiple_sessions(self): - self.patched_library.niTClk_Initiate.side_effect = self.side_effects_helper.niTClk_Initiate + self.patched_library.niTClk_Initiate.side_effect = ( + self.side_effects_helper.niTClk_Initiate + ) nitclk.initiate(multiple_session_references) - self.patched_library.niTClk_Initiate.assert_called_once_with(_matchers.ViUInt32Matcher(len(multiple_sessions)), _matchers.ViSessionBufferMatcher(multiple_sessions)) + self.patched_library.niTClk_Initiate.assert_called_once_with( + _matchers.ViUInt32Matcher(len(multiple_sessions)), + _matchers.ViSessionBufferMatcher(multiple_sessions), + ) return def test_configure_for_homogeneous_triggers(self): - self.patched_library.niTClk_ConfigureForHomogeneousTriggers.side_effect = self.side_effects_helper.niTClk_ConfigureForHomogeneousTriggers + self.patched_library.niTClk_ConfigureForHomogeneousTriggers.side_effect = ( + self.side_effects_helper.niTClk_ConfigureForHomogeneousTriggers + ) nitclk.configure_for_homogeneous_triggers(multiple_session_references) - self.patched_library.niTClk_ConfigureForHomogeneousTriggers.assert_called_once_with(_matchers.ViUInt32Matcher(len(multiple_sessions)), _matchers.ViSessionBufferMatcher(multiple_sessions)) + self.patched_library.niTClk_ConfigureForHomogeneousTriggers.assert_called_once_with( + _matchers.ViUInt32Matcher(len(multiple_sessions)), + _matchers.ViSessionBufferMatcher(multiple_sessions), + ) return def test_finish_sync_pulse_sender_synchronize(self): min_time = 0.042 - self.patched_library.niTClk_FinishSyncPulseSenderSynchronize.side_effect = self.side_effects_helper.niTClk_FinishSyncPulseSenderSynchronize - nitclk.finish_sync_pulse_sender_synchronize(multiple_session_references, min_time) - self.patched_library.niTClk_FinishSyncPulseSenderSynchronize.assert_called_once_with(_matchers.ViUInt32Matcher(len(multiple_sessions)), _matchers.ViSessionBufferMatcher(multiple_sessions), _matchers.ViReal64Matcher(min_time)) + self.patched_library.niTClk_FinishSyncPulseSenderSynchronize.side_effect = ( + self.side_effects_helper.niTClk_FinishSyncPulseSenderSynchronize + ) + nitclk.finish_sync_pulse_sender_synchronize( + multiple_session_references, min_time + ) + self.patched_library.niTClk_FinishSyncPulseSenderSynchronize.assert_called_once_with( + _matchers.ViUInt32Matcher(len(multiple_sessions)), + _matchers.ViSessionBufferMatcher(multiple_sessions), + _matchers.ViReal64Matcher(min_time), + ) return def test_is_done(self): expected_result = True - self.side_effects_helper['IsDone']['done'] = expected_result + self.side_effects_helper["IsDone"]["done"] = expected_result - self.patched_library.niTClk_IsDone.side_effect = self.side_effects_helper.niTClk_IsDone + self.patched_library.niTClk_IsDone.side_effect = ( + self.side_effects_helper.niTClk_IsDone + ) actual_result = nitclk.is_done(multiple_session_references) assert actual_result == expected_result - self.patched_library.niTClk_IsDone.assert_called_once_with(_matchers.ViUInt32Matcher(len(multiple_sessions)), _matchers.ViSessionBufferMatcher(multiple_sessions), _matchers.ViBooleanPointerMatcher()) + self.patched_library.niTClk_IsDone.assert_called_once_with( + _matchers.ViUInt32Matcher(len(multiple_sessions)), + _matchers.ViSessionBufferMatcher(multiple_sessions), + _matchers.ViBooleanPointerMatcher(), + ) return def test_setup_for_sync_pulse_sender_synchronize(self): min_time = 0.042 - self.patched_library.niTClk_SetupForSyncPulseSenderSynchronize.side_effect = self.side_effects_helper.niTClk_SetupForSyncPulseSenderSynchronize - nitclk.setup_for_sync_pulse_sender_synchronize(multiple_session_references, min_time) - self.patched_library.niTClk_SetupForSyncPulseSenderSynchronize.assert_called_once_with(_matchers.ViUInt32Matcher(len(multiple_sessions)), _matchers.ViSessionBufferMatcher(multiple_sessions), _matchers.ViReal64Matcher(min_time)) + self.patched_library.niTClk_SetupForSyncPulseSenderSynchronize.side_effect = ( + self.side_effects_helper.niTClk_SetupForSyncPulseSenderSynchronize + ) + nitclk.setup_for_sync_pulse_sender_synchronize( + multiple_session_references, min_time + ) + self.patched_library.niTClk_SetupForSyncPulseSenderSynchronize.assert_called_once_with( + _matchers.ViUInt32Matcher(len(multiple_sessions)), + _matchers.ViSessionBufferMatcher(multiple_sessions), + _matchers.ViReal64Matcher(min_time), + ) return def test_synchronize(self): min_time = 0.042 - self.patched_library.niTClk_Synchronize.side_effect = self.side_effects_helper.niTClk_Synchronize + self.patched_library.niTClk_Synchronize.side_effect = ( + self.side_effects_helper.niTClk_Synchronize + ) nitclk.synchronize(multiple_session_references, min_time) - self.patched_library.niTClk_Synchronize.assert_called_once_with(_matchers.ViUInt32Matcher(len(multiple_sessions)), _matchers.ViSessionBufferMatcher(multiple_sessions), _matchers.ViReal64Matcher(min_time)) + self.patched_library.niTClk_Synchronize.assert_called_once_with( + _matchers.ViUInt32Matcher(len(multiple_sessions)), + _matchers.ViSessionBufferMatcher(multiple_sessions), + _matchers.ViReal64Matcher(min_time), + ) return def test_synchronize_timedelta(self): min_time = hightime.timedelta(seconds=0.042) - self.patched_library.niTClk_Synchronize.side_effect = self.side_effects_helper.niTClk_Synchronize + self.patched_library.niTClk_Synchronize.side_effect = ( + self.side_effects_helper.niTClk_Synchronize + ) nitclk.synchronize(multiple_session_references, min_time) - self.patched_library.niTClk_Synchronize.assert_called_once_with(_matchers.ViUInt32Matcher(len(multiple_sessions)), _matchers.ViSessionBufferMatcher(multiple_sessions), _matchers.ViReal64Matcher(min_time.total_seconds())) + self.patched_library.niTClk_Synchronize.assert_called_once_with( + _matchers.ViUInt32Matcher(len(multiple_sessions)), + _matchers.ViSessionBufferMatcher(multiple_sessions), + _matchers.ViReal64Matcher(min_time.total_seconds()), + ) return def test_synchronize_to_sync_pulse_sender(self): min_time = 0.042 - self.patched_library.niTClk_SynchronizeToSyncPulseSender.side_effect = self.side_effects_helper.niTClk_SynchronizeToSyncPulseSender + self.patched_library.niTClk_SynchronizeToSyncPulseSender.side_effect = ( + self.side_effects_helper.niTClk_SynchronizeToSyncPulseSender + ) nitclk.synchronize_to_sync_pulse_sender(multiple_session_references, min_time) - self.patched_library.niTClk_SynchronizeToSyncPulseSender.assert_called_once_with(_matchers.ViUInt32Matcher(len(multiple_sessions)), _matchers.ViSessionBufferMatcher(multiple_sessions), _matchers.ViReal64Matcher(min_time)) + self.patched_library.niTClk_SynchronizeToSyncPulseSender.assert_called_once_with( + _matchers.ViUInt32Matcher(len(multiple_sessions)), + _matchers.ViSessionBufferMatcher(multiple_sessions), + _matchers.ViReal64Matcher(min_time), + ) return def test_wait_until_done(self): min_time = 4.2 - self.patched_library.niTClk_WaitUntilDone.side_effect = self.side_effects_helper.niTClk_WaitUntilDone + self.patched_library.niTClk_WaitUntilDone.side_effect = ( + self.side_effects_helper.niTClk_WaitUntilDone + ) nitclk.wait_until_done(multiple_session_references, min_time) - self.patched_library.niTClk_WaitUntilDone.assert_called_once_with(_matchers.ViUInt32Matcher(len(multiple_sessions)), _matchers.ViSessionBufferMatcher(multiple_sessions), _matchers.ViReal64Matcher(min_time)) + self.patched_library.niTClk_WaitUntilDone.assert_called_once_with( + _matchers.ViUInt32Matcher(len(multiple_sessions)), + _matchers.ViSessionBufferMatcher(multiple_sessions), + _matchers.ViReal64Matcher(min_time), + ) return # API error handling def test_api_error(self): - error_string = 'Error' - self.patched_library.niTClk_Synchronize.side_effect = self.side_effects_helper.niTClk_Synchronize - self.side_effects_helper['Synchronize']['return'] = -1 - self.patched_library.niTClk_GetExtendedErrorInfo.side_effect = self.side_effects_helper.niTClk_GetExtendedErrorInfo - self.side_effects_helper['GetExtendedErrorInfo']['errorString'] = error_string + error_string = "Error" + self.patched_library.niTClk_Synchronize.side_effect = ( + self.side_effects_helper.niTClk_Synchronize + ) + self.side_effects_helper["Synchronize"]["return"] = -1 + self.patched_library.niTClk_GetExtendedErrorInfo.side_effect = ( + self.side_effects_helper.niTClk_GetExtendedErrorInfo + ) + self.side_effects_helper["GetExtendedErrorInfo"]["errorString"] = error_string try: nitclk.synchronize(multiple_session_references, 0.42) except nitclk.Error as e: @@ -123,25 +198,35 @@ def test_api_error(self): assert e.description == error_string def test_api_get_error_description_fails(self): - self.patched_library.niTClk_Synchronize.side_effect = self.side_effects_helper.niTClk_Synchronize - self.side_effects_helper['Synchronize']['return'] = -1 - self.patched_library.niTClk_GetExtendedErrorInfo.side_effect = self.side_effects_helper.niTClk_GetExtendedErrorInfo - self.side_effects_helper['GetExtendedErrorInfo']['return'] = -2 + self.patched_library.niTClk_Synchronize.side_effect = ( + self.side_effects_helper.niTClk_Synchronize + ) + self.side_effects_helper["Synchronize"]["return"] = -1 + self.patched_library.niTClk_GetExtendedErrorInfo.side_effect = ( + self.side_effects_helper.niTClk_GetExtendedErrorInfo + ) + self.side_effects_helper["GetExtendedErrorInfo"]["return"] = -2 try: nitclk.synchronize(multiple_session_references, 0.42) except nitclk.Error as e: - assert e.code == -1 # we want the original error code from getting the attribute. + assert ( + e.code == -1 + ) # we want the original error code from getting the attribute. assert e.description == "Failed to retrieve error description." # SessionReference error handling def test_session_reference_error(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - error_string = 'Error' - self.patched_library.niTClk_GetAttributeViReal64.side_effect = self.side_effects_helper.niTClk_GetAttributeViReal64 - self.side_effects_helper['GetAttributeViReal64']['return'] = -1 - self.patched_library.niTClk_GetExtendedErrorInfo.side_effect = self.side_effects_helper.niTClk_GetExtendedErrorInfo - self.side_effects_helper['GetExtendedErrorInfo']['errorString'] = error_string + error_string = "Error" + self.patched_library.niTClk_GetAttributeViReal64.side_effect = ( + self.side_effects_helper.niTClk_GetAttributeViReal64 + ) + self.side_effects_helper["GetAttributeViReal64"]["return"] = -1 + self.patched_library.niTClk_GetExtendedErrorInfo.side_effect = ( + self.side_effects_helper.niTClk_GetExtendedErrorInfo + ) + self.side_effects_helper["GetExtendedErrorInfo"]["errorString"] = error_string try: test = session.sample_clock_delay print(test) # Get rid of flake8 F841 @@ -152,90 +237,158 @@ def test_session_reference_error(self): def test_session_reference_get_error_description_fails(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_GetAttributeViReal64.side_effect = self.side_effects_helper.niTClk_GetAttributeViReal64 - self.side_effects_helper['GetAttributeViReal64']['return'] = -1 - self.patched_library.niTClk_GetExtendedErrorInfo.side_effect = self.side_effects_helper.niTClk_GetExtendedErrorInfo - self.side_effects_helper['GetExtendedErrorInfo']['return'] = -2 + self.patched_library.niTClk_GetAttributeViReal64.side_effect = ( + self.side_effects_helper.niTClk_GetAttributeViReal64 + ) + self.side_effects_helper["GetAttributeViReal64"]["return"] = -1 + self.patched_library.niTClk_GetExtendedErrorInfo.side_effect = ( + self.side_effects_helper.niTClk_GetExtendedErrorInfo + ) + self.side_effects_helper["GetExtendedErrorInfo"]["return"] = -2 try: test = session.sample_clock_delay print(test) # Get rid of flake8 F841 assert False except nitclk.Error as e: - assert e.code == -1 # we want the original error code from getting the attribute. + assert ( + e.code == -1 + ) # we want the original error code from getting the attribute. assert e.description == "Failed to retrieve error description." # Session Reference def test_set_vi_real64(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_SetAttributeViReal64.side_effect = self.side_effects_helper.niTClk_SetAttributeViReal64 + self.patched_library.niTClk_SetAttributeViReal64.side_effect = ( + self.side_effects_helper.niTClk_SetAttributeViReal64 + ) attribute_id = 8 test_number = 4.2 session.tclk_actual_period = test_number - self.patched_library.niTClk_SetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64Matcher(test_number)) + self.patched_library.niTClk_SetAttributeViReal64.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViReal64Matcher(test_number), + ) def test_get_vi_real64(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_GetAttributeViReal64.side_effect = self.side_effects_helper.niTClk_GetAttributeViReal64 + self.patched_library.niTClk_GetAttributeViReal64.side_effect = ( + self.side_effects_helper.niTClk_GetAttributeViReal64 + ) attribute_id = 8 test_number = 4.2 - self.side_effects_helper['GetAttributeViReal64']['value'] = test_number + self.side_effects_helper["GetAttributeViReal64"]["value"] = test_number attr_val = session.tclk_actual_period - assert(attr_val == test_number) - self.patched_library.niTClk_GetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64PointerMatcher()) + assert attr_val == test_number + self.patched_library.niTClk_GetAttributeViReal64.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViReal64PointerMatcher(), + ) def test_set_timedelta_as_vi_real64(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_SetAttributeViReal64.side_effect = self.side_effects_helper.niTClk_SetAttributeViReal64 + self.patched_library.niTClk_SetAttributeViReal64.side_effect = ( + self.side_effects_helper.niTClk_SetAttributeViReal64 + ) attribute_id = 11 test_number = 4.2 session.sample_clock_delay = test_number - self.patched_library.niTClk_SetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64Matcher(test_number)) + self.patched_library.niTClk_SetAttributeViReal64.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViReal64Matcher(test_number), + ) def test_set_timedelta_as_timedelta(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_SetAttributeViReal64.side_effect = self.side_effects_helper.niTClk_SetAttributeViReal64 + self.patched_library.niTClk_SetAttributeViReal64.side_effect = ( + self.side_effects_helper.niTClk_SetAttributeViReal64 + ) attribute_id = 11 test_number = 4.2 session.sample_clock_delay = hightime.timedelta(seconds=test_number) - self.patched_library.niTClk_SetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64Matcher(test_number)) + self.patched_library.niTClk_SetAttributeViReal64.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViReal64Matcher(test_number), + ) def test_get_timedelta(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_GetAttributeViReal64.side_effect = self.side_effects_helper.niTClk_GetAttributeViReal64 + self.patched_library.niTClk_GetAttributeViReal64.side_effect = ( + self.side_effects_helper.niTClk_GetAttributeViReal64 + ) attribute_id = 11 test_number = 4.2 - self.side_effects_helper['GetAttributeViReal64']['value'] = test_number + self.side_effects_helper["GetAttributeViReal64"]["value"] = test_number attr_timedelta = session.sample_clock_delay - assert(attr_timedelta.total_seconds() == test_number) - self.patched_library.niTClk_GetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64PointerMatcher()) + assert attr_timedelta.total_seconds() == test_number + self.patched_library.niTClk_GetAttributeViReal64.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViReal64PointerMatcher(), + ) def test_set_vi_string(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_SetAttributeViString.side_effect = self.side_effects_helper.niTClk_SetAttributeViString + self.patched_library.niTClk_SetAttributeViString.side_effect = ( + self.side_effects_helper.niTClk_SetAttributeViString + ) attribute_id = 13 test_string = "The answer to the ultimate question is 42" session.sync_pulse_sender_sync_pulse_source = test_string - self.patched_library.niTClk_SetAttributeViString.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViStringMatcher(test_string)) + self.patched_library.niTClk_SetAttributeViString.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViStringMatcher(test_string), + ) def test_get_vi_string(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_GetAttributeViString.side_effect = self.side_effects_helper.niTClk_GetAttributeViString + self.patched_library.niTClk_GetAttributeViString.side_effect = ( + self.side_effects_helper.niTClk_GetAttributeViString + ) attribute_id = 13 test_string = "The answer to the ultimate question is 42" - self.side_effects_helper['GetAttributeViString']['value'] = test_string + self.side_effects_helper["GetAttributeViString"]["value"] = test_string attr_string = session.sync_pulse_sender_sync_pulse_source - assert(attr_string == test_string) + assert attr_string == test_string from unittest.mock import call - calls = [call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt32Matcher(0), None), call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt32Matcher(len(test_string)), _matchers.ViCharBufferMatcher(len(test_string)))] + + calls = [ + call( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViInt32Matcher(0), + None, + ), + call( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViInt32Matcher(len(test_string)), + _matchers.ViCharBufferMatcher(len(test_string)), + ), + ] self.patched_library.niTClk_GetAttributeViString.assert_has_calls(calls) assert self.patched_library.niTClk_GetAttributeViString.call_count == 2 # All ViInt32 attributes are really sessions references def test_set_vi_session_with_int(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_SetAttributeViSession.side_effect = self.side_effects_helper.niTClk_SetAttributeViSession + self.patched_library.niTClk_SetAttributeViSession.side_effect = ( + self.side_effects_helper.niTClk_SetAttributeViSession + ) other_session_number = 43 # We do not support using just the number try: @@ -246,33 +399,54 @@ def test_set_vi_session_with_int(self): def test_set_vi_session_with_session_reference(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_SetAttributeViSession.side_effect = self.side_effects_helper.niTClk_SetAttributeViSession + self.patched_library.niTClk_SetAttributeViSession.side_effect = ( + self.side_effects_helper.niTClk_SetAttributeViSession + ) attribute_id = 3 other_session_number = 43 other_session_reference = nitclk.SessionReference(other_session_number) session.start_trigger_master_session = other_session_reference - self.patched_library.niTClk_SetAttributeViSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViSessionMatcher(other_session_number)) + self.patched_library.niTClk_SetAttributeViSession.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViSessionMatcher(other_session_number), + ) def test_set_vi_session_with_session(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_SetAttributeViSession.side_effect = self.side_effects_helper.niTClk_SetAttributeViSession + self.patched_library.niTClk_SetAttributeViSession.side_effect = ( + self.side_effects_helper.niTClk_SetAttributeViSession + ) attribute_id = 3 other_session_number = 43 other_session = NitclkSupportingDriverSession(other_session_number) session.start_trigger_master_session = other_session - self.patched_library.niTClk_SetAttributeViSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViSessionMatcher(other_session_number)) + self.patched_library.niTClk_SetAttributeViSession.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViSessionMatcher(other_session_number), + ) def test_get_tclk_session_reference(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_GetAttributeViSession.side_effect = self.side_effects_helper.niTClk_GetAttributeViSession + self.patched_library.niTClk_GetAttributeViSession.side_effect = ( + self.side_effects_helper.niTClk_GetAttributeViSession + ) attribute_id = 3 other_session_number = 43 - self.side_effects_helper['GetAttributeViSession']['value'] = other_session_number + self.side_effects_helper["GetAttributeViSession"][ + "value" + ] = other_session_number attr_session_reference = session.start_trigger_master_session assert type(attr_session_reference) is nitclk.SessionReference - assert(attr_session_reference._get_tclk_session_reference() == other_session_number) - self.patched_library.niTClk_GetAttributeViSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViSessionPointerMatcher()) - - - - + assert ( + attr_session_reference._get_tclk_session_reference() == other_session_number + ) + self.patched_library.niTClk_GetAttributeViSession.assert_called_once_with( + _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), + _matchers.ViStringMatcher(""), + _matchers.ViAttrMatcher(attribute_id), + _matchers.ViSessionPointerMatcher(), + ) diff --git a/generated/nitclk/setup.py b/generated/nitclk/setup.py index d73d4e363..b638526ed 100644 --- a/generated/nitclk/setup.py +++ b/generated/nitclk/setup.py @@ -15,41 +15,44 @@ def finalize_options(self): def run_tests(self): import pytest + pytest.main(self.test_args) -pypi_name = 'nitclk' +pypi_name = "nitclk" def read_contents(file_to_read): - with open(file_to_read, 'r') as f: + with open(file_to_read, "r") as f: return f.read() setup( name=pypi_name, zip_safe=True, - version='1.4.2.dev0', - description='NI-TClk Python API', - long_description=read_contents('README.rst'), - long_description_content_type='text/x-rst', - author='NI', + version="1.4.2.dev0", + description="NI-TClk Python API", + long_description=read_contents("README.rst"), + long_description_content_type="text/x-rst", + author="NI", author_email="opensource@ni.com", url="https://github.com/ni/nimi-python", maintainer="NI", maintainer_email="opensource@ni.com", - keywords=['nitclk'], - license='MIT', + keywords=["nitclk"], + license="MIT", include_package_data=True, - packages=['nitclk'], + packages=["nitclk"], install_requires=[ 'enum34;python_version<"3.4"', 'singledispatch;python_version<"3.4"', - 'hightime>=0.2.0', + "hightime>=0.2.0", + ], + setup_requires=[ + "pytest-runner", ], - setup_requires=['pytest-runner', ], - tests_require=['pytest'], - test_suite='tests', + tests_require=["pytest"], + test_suite="tests", classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -64,8 +67,8 @@ def read_contents(file_to_read): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", - "Topic :: System :: Hardware :: Hardware Drivers" + "Topic :: System :: Hardware :: Hardware Drivers", ], - cmdclass={'test': PyTest}, - package_data={pypi_name: ['VERSION']}, + cmdclass={"test": PyTest}, + package_data={pypi_name: ["VERSION"]}, ) From 0b02dc12bdd5ecbdbfe9935c448153d8e8f415b9 Mon Sep 17 00:00:00 2001 From: Marcos Kirsch Date: Wed, 13 Apr 2022 14:03:24 -0500 Subject: [PATCH 2/6] Modify __init__.py.mako so that running black on generated code is a no-op --- build/templates/__init__.py.mako | 93 +++++++++++++++++--------------- 1 file changed, 50 insertions(+), 43 deletions(-) diff --git a/build/templates/__init__.py.mako b/build/templates/__init__.py.mako index a376b3d30..aa14cc9fe 100644 --- a/build/templates/__init__.py.mako +++ b/build/templates/__init__.py.mako @@ -10,7 +10,7 @@ module_name = config['module_name'] registry_name = config['driver_registry'] if 'driver_registry' in config else config['driver_name'] %> -__version__ = '${config['module_version']}' +__version__ = "${config['module_version']}" % if len(enums) > 0: from ${module_name}.enums import * # noqa: F403,F401,H303 @@ -59,12 +59,12 @@ from ${module_name}.${c['file_name']} import ${c['ctypes_type']} # noqa: F401 def get_diagnostic_information(): - '''Get diagnostic information about the system state that is suitable for printing or logging + """Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - ''' + """ import os import pkg_resources import platform @@ -72,73 +72,80 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return (struct.calcsize("P") == 8) + return struct.calcsize("P") == 8 def is_os_64bit(): - return platform.machine().endswith('64') + return platform.machine().endswith("64") def is_venv(): - return 'VIRTUAL_ENV' in os.environ + return "VIRTUAL_ENV" in os.environ info = {} - info['os'] = {} - info['python'] = {} - info['driver'] = {} - info['module'] = {} - if platform.system() == 'Windows': + info["os"] = {} + info["python"] = {} + info["driver"] = {} + info["module"] = {} + if platform.system() == "Windows": try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = 'Windows' + os_name = "Windows" try: - driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\${registry_name}\CurrentVersion") + driver_version_key = winreg.OpenKey( + winreg.HKEY_LOCAL_MACHINE, + r"SOFTWARE\National Instruments\${registry_name}\CurrentVersion", + ) driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = 'Unknown' - elif platform.system() == 'Linux': - os_name = 'Linux' - driver_version = 'Unknown' + driver_version = "Unknown" + elif platform.system() == "Linux": + os_name = "Linux" + driver_version = "Unknown" else: - raise SystemError('Unsupported platform: {}'.format(platform.system())) + raise SystemError("Unsupported platform: {}".format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] - - info['os']['name'] = os_name - info['os']['version'] = platform.version() - info['os']['bits'] = '64' if is_os_64bit() else '32' - info['driver']['name'] = "${config['driver_name']}" - info['driver']['version'] = driver_version - info['module']['name'] = '${module_name}' - info['module']['version'] = "${config['module_version']}" - info['python']['version'] = sys.version - info['python']['bits'] = '64' if is_python_64bit() else '32' - info['python']['is_venv'] = is_venv() - info['python']['packages'] = installed_packages_list + installed_packages_list = [ + { + "name": i.key, + "version": i.version, + } + for i in installed_packages + ] + + info["os"]["name"] = os_name + info["os"]["version"] = platform.version() + info["os"]["bits"] = "64" if is_os_64bit() else "32" + info["driver"]["name"] = "${config['driver_name']}" + info["driver"]["version"] = driver_version + info["module"]["name"] = "${module_name}" + info["module"]["version"] = "${config['module_version']}" + info["python"]["version"] = sys.version + info["python"]["bits"] = "64" if is_python_64bit() else "32" + info["python"]["is_venv"] = is_venv() + info["python"]["packages"] = installed_packages_list return info def print_diagnostic_information(): - '''Print diagnostic information in a format suitable for issue report + """Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - ''' + """ info = get_diagnostic_information() - row_format = ' {:<10} {}' - for type in ['OS', 'Driver', 'Module', 'Python']: + row_format = " {:<10} {}" + for type in ["OS", "Driver", "Module", "Python"]: typename = type.lower() - print(type + ':') + print(type + ":") for item in info[typename]: - if item != 'packages': - print(row_format.format(item.title() + ':', info[typename][item])) - print(' Installed Packages:') - for p in info['python']['packages']: - print((' ' * 8) + p['name'] + '==' + p['version']) + if item != "packages": + print(row_format.format(item.title() + ":", info[typename][item])) + print(" Installed Packages:") + for p in info["python"]["packages"]: + print((" " * 8) + p["name"] + "==" + p["version"]) return info - - From f3a8adcd93ed5421d2d57894547ad7e54ca45d05 Mon Sep 17 00:00:00 2001 From: Marcos Kirsch Date: Wed, 13 Apr 2022 14:14:50 -0500 Subject: [PATCH 3/6] Modify _attributes.py.mako so that running black on generated code is a no-op --- build/templates/_attributes.py.mako | 54 +++++++++++++++++------------ 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/build/templates/_attributes.py.mako b/build/templates/_attributes.py.mako index b37ebbcdd..9bcbfb264 100644 --- a/build/templates/_attributes.py.mako +++ b/build/templates/_attributes.py.mako @@ -10,14 +10,13 @@ import hightime class Attribute(object): - '''Base class for all typed attributes.''' + """Base class for all typed attributes.""" def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -26,16 +25,19 @@ class AttributeViInt32(Attribute): class AttributeViInt32TimeDeltaMilliseconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) + return hightime.timedelta( + milliseconds=session._get_attribute_vi_int32(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) + session._set_attribute_vi_int32( + self._attribute_id, + _converters.convert_timedelta_to_milliseconds_int32(value).value, + ) class AttributeViInt64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -44,7 +46,6 @@ class AttributeViInt64(Attribute): class AttributeViReal64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -53,16 +54,19 @@ class AttributeViReal64(Attribute): class AttributeViReal64TimeDeltaSeconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) + return hightime.timedelta( + seconds=session._get_attribute_vi_real64(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) + session._set_attribute_vi_real64( + self._attribute_id, + _converters.convert_timedelta_to_seconds_real64(value).value, + ) class AttributeViString(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -71,16 +75,17 @@ class AttributeViString(Attribute): class AttributeViStringRepeatedCapability(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) + session._set_attribute_vi_string( + self._attribute_id, + _converters.convert_repeated_capabilities_without_prefix(value), + ) class AttributeViBoolean(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -89,31 +94,36 @@ class AttributeViBoolean(Attribute): class AttributeEnum(object): - def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) + return self._attribute_type( + self._underlying_attribute.__get__(session, session_type) + ) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) + raise TypeError( + "must be " + + str(self._attribute_type.__name__) + + " not " + + str(type(value).__name__) + ) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): - def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from ${module_name}.session import SessionReference + return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) - - - + session._set_attribute_vi_session( + self._attribute_id, _converters.convert_to_nitclk_session_number(value) + ) From e325e0e1a730513fd0677a9e1f3d8c0482610bc8 Mon Sep 17 00:00:00 2001 From: Marcos Kirsch Date: Wed, 13 Apr 2022 14:33:43 -0500 Subject: [PATCH 4/6] Modify _converters.py.mako so that running black on generated code is a no-op --- build/templates/_converters.py.mako | 141 ++++++++++++++++------------ 1 file changed, 83 insertions(+), 58 deletions(-) diff --git a/build/templates/_converters.py.mako b/build/templates/_converters.py.mako index 5c63b2e63..4b53bb968 100644 --- a/build/templates/_converters.py.mako +++ b/build/templates/_converters.py.mako @@ -18,7 +18,7 @@ from functools import singledispatch @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - '''Base version that should not be called + """Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -45,36 +45,38 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - ''' - raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + """ + raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - '''Integer version''' + """Integer version""" return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - '''String version (this is the most complex) + """String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - ''' + """ # First we deal with a list - rep_cap_list = repeated_capability.split(',') + rep_cap_list = repeated_capability.split(",") if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, '').replace(':', '-') - rc = r.split('-') + r = repeated_capability.strip().replace(prefix, "").replace(":", "-") + rc = r.split("-") if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + raise errors.InvalidRepeatedCapabilityError( + "Multiple '-' or ':'", repeated_capability + ) try: start = int(rc[0]) end = int(rc[1]) @@ -90,7 +92,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, '').strip()] + return [repeated_capability.replace(prefix, "").strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -99,7 +101,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - '''Iterable version - can handle lists, ranges, and tuples''' + """Iterable version - can handle lists, ranges, and tuples""" rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -108,16 +110,22 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - '''slice version''' + """slice version""" + def ifnone(a, b): return b if a is None else a + # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) + rng = range( + ifnone(repeated_capability.start, 0), + repeated_capability.stop, + ifnone(repeated_capability.step, 1), + ) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=''): - '''Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=""): + """Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -125,15 +133,17 @@ def convert_repeated_capabilities(repeated_capability, prefix=''): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - ''' + """ # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] + return [ + prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) + ] def convert_repeated_capabilities_without_prefix(repeated_capability): - '''Convert a repeated capabilities object, without any prefix, to a comma delimited list + """Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -149,8 +159,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - ''' - return ','.join(convert_repeated_capabilities(repeated_capability, '')) + """ + return ",".join(convert_repeated_capabilities(repeated_capability, "")) def _convert_timedelta(value, library_type, scaling): @@ -163,7 +173,14 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: + if library_type in [ + _visatype.ViInt64, + _visatype.ViInt32, + _visatype.ViUInt32, + _visatype.ViInt16, + _visatype.ViUInt16, + _visatype.ViInt8, + ]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -200,34 +217,36 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - 'rangecheck': 'RangeCheck', - 'queryinstrstatus': 'QueryInstrStatus', - 'cache': 'Cache', - 'simulate': 'Simulate', - 'recordcoercions': 'RecordCoercions', - 'interchangecheck': 'InterchangeCheck', - 'driversetup': 'DriverSetup', - 'range_check': 'RangeCheck', - 'query_instr_status': 'QueryInstrStatus', - 'record_coercions': 'RecordCoercions', - 'interchange_check': 'InterchangeCheck', - 'driver_setup': 'DriverSetup', + "rangecheck": "RangeCheck", + "queryinstrstatus": "QueryInstrStatus", + "cache": "Cache", + "simulate": "Simulate", + "recordcoercions": "RecordCoercions", + "interchangecheck": "InterchangeCheck", + "driversetup": "DriverSetup", + "range_check": "RangeCheck", + "query_instr_status": "QueryInstrStatus", + "record_coercions": "RecordCoercions", + "interchange_check": "InterchangeCheck", + "driver_setup": "DriverSetup", } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': - value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') - elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': + if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": + value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") + elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": if not isinstance(values[k], dict): - raise TypeError('DriverSetup must be a dictionary') - value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) + raise TypeError("DriverSetup must be a dictionary") + value = "DriverSetup=" + ( + ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) + ) else: - value = k + ('=1' if values[k] is True else '=0') + value = k + ("=1" if values[k] is True else "=0") init_with_options.append(value) - init_with_options_string = ','.join(init_with_options) + init_with_options_string = ",".join(init_with_options) return init_with_options_string @@ -256,11 +275,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(',')] + return [x.strip() for x in comma_separated_string.split(",")] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -272,14 +291,20 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - ''' - chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) - repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] + """ + chained_repeated_capability_items = convert_comma_separated_string_to_list( + chained_repeated_capability + ) + repeated_capability_lists = [ + [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) + ] for item in chained_repeated_capability_items: - repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] - return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] - - + repeated_capability_lists = [ + x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) + ] + return [ + ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists + ] <% # Beginning of module-specific converters %>\ @@ -287,14 +312,16 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): # nitclk is different. Only nitclk needs to be able to convert sessions like this %>\ % if config['module_name'] == 'nitclk': + + # nitclk specific converters def convert_to_nitclk_session_number(item): - '''Convert from supported objects to NI-TClk Session Num + """Convert from supported objects to NI-TClk Session Num Supported objects are: - class with .tclk object of type nitclk.SessionReference - nitclk.SessionReference - ''' + """ try: return item.tclk._get_tclk_session_reference() except AttributeError: @@ -305,22 +332,20 @@ def convert_to_nitclk_session_number(item): except AttributeError: pass - raise TypeError('Unsupported type for nitclk session: {}'.format(type(item))) + raise TypeError("Unsupported type for nitclk session: {}".format(type(item))) def convert_to_nitclk_session_number_list(item_list): - '''Converts a list of items to nitclk session nums''' + """Converts a list of items to nitclk session nums""" return [convert_to_nitclk_session_number(i) for i in item_list] - - % endif <% # This converter is only needed for nifake testing %>\ % if config['module_name'] == 'nifake': + + # nifake specific converter(s) - used only for testing def convert_double_each_element(numbers): return [x * 2 for x in numbers] - - % endif From 440a9014d921de43f0110d5a6c19c5d66d613340 Mon Sep 17 00:00:00 2001 From: Marcos Kirsch Date: Wed, 13 Apr 2022 14:44:20 -0500 Subject: [PATCH 5/6] Revert "Generated files but after running black for diffing purposes" This reverts commit cc38a9c71c1f2d6376f178a30c7bc84a3d27bf3f. --- generated/nidcpower/nidcpower/__init__.py | 93 +- generated/nidcpower/nidcpower/_attributes.py | 54 +- generated/nidcpower/nidcpower/_converters.py | 125 +- generated/nidcpower/nidcpower/_library.py | 1131 ++---- .../nidcpower/nidcpower/_library_singleton.py | 25 +- generated/nidcpower/nidcpower/_visatype.py | 5 +- generated/nidcpower/nidcpower/enums.py | 256 +- generated/nidcpower/nidcpower/errors.py | 63 +- generated/nidcpower/nidcpower/session.py | 2205 ++++-------- .../nidcpower/unit_tests/_matchers.py | 153 +- .../nidcpower/unit_tests/_mock_helper.py | 1566 ++++----- generated/nidcpower/setup.py | 37 +- generated/nidigital/nidigital/__init__.py | 97 +- generated/nidigital/nidigital/_attributes.py | 54 +- generated/nidigital/nidigital/_converters.py | 125 +- generated/nidigital/nidigital/_library.py | 1858 ++-------- .../nidigital/nidigital/_library_singleton.py | 25 +- generated/nidigital/nidigital/_visatype.py | 5 +- generated/nidigital/nidigital/enums.py | 300 +- generated/nidigital/nidigital/errors.py | 63 +- .../history_ram_cycle_information.py | 87 +- generated/nidigital/nidigital/session.py | 3075 +++++------------ .../nidigital/unit_tests/_matchers.py | 153 +- .../nidigital/unit_tests/_mock_helper.py | 2313 +++++-------- .../nidigital/unit_tests/test_nidigital.py | 747 +--- generated/nidigital/setup.py | 39 +- generated/nidmm/nidmm/__init__.py | 93 +- generated/nidmm/nidmm/_attributes.py | 54 +- generated/nidmm/nidmm/_converters.py | 125 +- generated/nidmm/nidmm/_library.py | 684 +--- generated/nidmm/nidmm/_library_singleton.py | 25 +- generated/nidmm/nidmm/_visatype.py | 5 +- generated/nidmm/nidmm/enums.py | 432 +-- generated/nidmm/nidmm/errors.py | 63 +- generated/nidmm/nidmm/session.py | 1390 +++----- generated/nidmm/nidmm/unit_tests/_matchers.py | 153 +- .../nidmm/nidmm/unit_tests/_mock_helper.py | 1187 +++---- generated/nidmm/setup.py | 37 +- generated/nifake/nifake/__init__.py | 93 +- generated/nifake/nifake/_attributes.py | 54 +- generated/nifake/nifake/_converters.py | 125 +- generated/nifake/nifake/_library.py | 960 ++--- generated/nifake/nifake/_library_singleton.py | 25 +- generated/nifake/nifake/_visatype.py | 5 +- generated/nifake/nifake/custom_struct.py | 14 +- generated/nifake/nifake/enums.py | 70 +- generated/nifake/nifake/errors.py | 63 +- generated/nifake/nifake/session.py | 1452 +++----- .../nifake/nifake/unit_tests/_matchers.py | 153 +- .../nifake/nifake/unit_tests/_mock_helper.py | 1572 ++++----- .../nifake/unit_tests/test_converters.py | 586 +--- .../nifake/nifake/unit_tests/test_session.py | 2104 ++++------- generated/nifake/setup.py | 39 +- generated/nifgen/nifgen/__init__.py | 93 +- generated/nifgen/nifgen/_attributes.py | 54 +- generated/nifgen/nifgen/_converters.py | 125 +- generated/nifgen/nifgen/_library.py | 1195 ++----- generated/nifgen/nifgen/_library_singleton.py | 25 +- generated/nifgen/nifgen/_visatype.py | 5 +- generated/nifgen/nifgen/enums.py | 318 +- generated/nifgen/nifgen/errors.py | 63 +- generated/nifgen/nifgen/session.py | 2390 ++++--------- .../nifgen/nifgen/unit_tests/_matchers.py | 153 +- .../nifgen/nifgen/unit_tests/_mock_helper.py | 1913 ++++------ generated/nifgen/setup.py | 39 +- generated/nimodinst/nimodinst/__init__.py | 93 +- generated/nimodinst/nimodinst/_converters.py | 125 +- generated/nimodinst/nimodinst/_library.py | 110 +- .../nimodinst/nimodinst/_library_singleton.py | 25 +- generated/nimodinst/nimodinst/_visatype.py | 5 +- generated/nimodinst/nimodinst/errors.py | 49 +- generated/nimodinst/nimodinst/session.py | 235 +- .../nimodinst/unit_tests/_matchers.py | 153 +- .../nimodinst/unit_tests/_mock_helper.py | 158 +- .../nimodinst/unit_tests/test_modinst.py | 295 +- generated/nimodinst/setup.py | 37 +- generated/niscope/niscope/__init__.py | 93 +- generated/niscope/niscope/_attributes.py | 54 +- generated/niscope/niscope/_converters.py | 125 +- generated/niscope/niscope/_library.py | 1103 ++---- .../niscope/niscope/_library_singleton.py | 25 +- generated/niscope/niscope/_visatype.py | 5 +- generated/niscope/niscope/enums.py | 520 +-- generated/niscope/niscope/errors.py | 63 +- .../niscope/niscope/measurement_stats.py | 44 +- generated/niscope/niscope/session.py | 2613 +++++--------- .../niscope/niscope/unit_tests/_matchers.py | 153 +- .../niscope/unit_tests/_mock_helper.py | 1436 ++++---- .../niscope/unit_tests/test_niscope.py | 12 +- generated/niscope/niscope/waveform_info.py | 119 +- generated/niscope/setup.py | 39 +- generated/nise/nise/__init__.py | 93 +- generated/nise/nise/_converters.py | 125 +- generated/nise/nise/_library.py | 181 +- generated/nise/nise/_library_singleton.py | 25 +- generated/nise/nise/_visatype.py | 5 +- generated/nise/nise/enums.py | 64 +- generated/nise/nise/errors.py | 57 +- generated/nise/nise/session.py | 363 +- generated/nise/nise/unit_tests/_matchers.py | 153 +- .../nise/nise/unit_tests/_mock_helper.py | 289 +- generated/nise/setup.py | 37 +- generated/niswitch/niswitch/__init__.py | 93 +- generated/niswitch/niswitch/_attributes.py | 54 +- generated/niswitch/niswitch/_converters.py | 125 +- generated/niswitch/niswitch/_library.py | 504 +-- .../niswitch/niswitch/_library_singleton.py | 25 +- generated/niswitch/niswitch/_visatype.py | 5 +- generated/niswitch/niswitch/enums.py | 376 +- generated/niswitch/niswitch/errors.py | 63 +- generated/niswitch/niswitch/session.py | 1036 ++---- .../niswitch/niswitch/unit_tests/_matchers.py | 153 +- .../niswitch/unit_tests/_mock_helper.py | 824 ++--- generated/niswitch/setup.py | 37 +- generated/nitclk/nitclk/__init__.py | 93 +- generated/nitclk/nitclk/_attributes.py | 54 +- generated/nitclk/nitclk/_converters.py | 133 +- generated/nitclk/nitclk/_library.py | 264 +- generated/nitclk/nitclk/_library_singleton.py | 25 +- generated/nitclk/nitclk/_visatype.py | 5 +- generated/nitclk/nitclk/errors.py | 49 +- generated/nitclk/nitclk/session.py | 522 +-- .../nitclk/nitclk/unit_tests/_matchers.py | 153 +- .../nitclk/nitclk/unit_tests/_mock_helper.py | 324 +- .../nitclk/nitclk/unit_tests/test_nitclk.py | 338 +- generated/nitclk/setup.py | 37 +- 126 files changed, 15452 insertions(+), 31511 deletions(-) diff --git a/generated/nidcpower/nidcpower/__init__.py b/generated/nidcpower/nidcpower/__init__.py index 6204442ad..b4c976047 100644 --- a/generated/nidcpower/nidcpower/__init__.py +++ b/generated/nidcpower/nidcpower/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = "1.4.2.dev0" +__version__ = '1.4.2.dev0' from nidcpower.enums import * # noqa: F403,F401,H303 from nidcpower.errors import DriverWarning # noqa: F401 @@ -11,12 +11,12 @@ def get_diagnostic_information(): - """Get diagnostic information about the system state that is suitable for printing or logging + '''Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - """ + ''' import os import pkg_resources import platform @@ -24,80 +24,73 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return struct.calcsize("P") == 8 + return (struct.calcsize("P") == 8) def is_os_64bit(): - return platform.machine().endswith("64") + return platform.machine().endswith('64') def is_venv(): - return "VIRTUAL_ENV" in os.environ + return 'VIRTUAL_ENV' in os.environ info = {} - info["os"] = {} - info["python"] = {} - info["driver"] = {} - info["module"] = {} - if platform.system() == "Windows": + info['os'] = {} + info['python'] = {} + info['driver'] = {} + info['module'] = {} + if platform.system() == 'Windows': try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = "Windows" + os_name = 'Windows' try: - driver_version_key = winreg.OpenKey( - winreg.HKEY_LOCAL_MACHINE, - r"SOFTWARE\National Instruments\NI-DCPower\CurrentVersion", - ) + driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-DCPower\CurrentVersion") driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = "Unknown" - elif platform.system() == "Linux": - os_name = "Linux" - driver_version = "Unknown" + driver_version = 'Unknown' + elif platform.system() == 'Linux': + os_name = 'Linux' + driver_version = 'Unknown' else: - raise SystemError("Unsupported platform: {}".format(platform.system())) + raise SystemError('Unsupported platform: {}'.format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [ - { - "name": i.key, - "version": i.version, - } - for i in installed_packages - ] - - info["os"]["name"] = os_name - info["os"]["version"] = platform.version() - info["os"]["bits"] = "64" if is_os_64bit() else "32" - info["driver"]["name"] = "NI-DCPower" - info["driver"]["version"] = driver_version - info["module"]["name"] = "nidcpower" - info["module"]["version"] = "1.4.2.dev0" - info["python"]["version"] = sys.version - info["python"]["bits"] = "64" if is_python_64bit() else "32" - info["python"]["is_venv"] = is_venv() - info["python"]["packages"] = installed_packages_list + installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] + + info['os']['name'] = os_name + info['os']['version'] = platform.version() + info['os']['bits'] = '64' if is_os_64bit() else '32' + info['driver']['name'] = "NI-DCPower" + info['driver']['version'] = driver_version + info['module']['name'] = 'nidcpower' + info['module']['version'] = "1.4.2.dev0" + info['python']['version'] = sys.version + info['python']['bits'] = '64' if is_python_64bit() else '32' + info['python']['is_venv'] = is_venv() + info['python']['packages'] = installed_packages_list return info def print_diagnostic_information(): - """Print diagnostic information in a format suitable for issue report + '''Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - """ + ''' info = get_diagnostic_information() - row_format = " {:<10} {}" - for type in ["OS", "Driver", "Module", "Python"]: + row_format = ' {:<10} {}' + for type in ['OS', 'Driver', 'Module', 'Python']: typename = type.lower() - print(type + ":") + print(type + ':') for item in info[typename]: - if item != "packages": - print(row_format.format(item.title() + ":", info[typename][item])) - print(" Installed Packages:") - for p in info["python"]["packages"]: - print((" " * 8) + p["name"] + "==" + p["version"]) + if item != 'packages': + print(row_format.format(item.title() + ':', info[typename][item])) + print(' Installed Packages:') + for p in info['python']['packages']: + print((' ' * 8) + p['name'] + '==' + p['version']) return info + + diff --git a/generated/nidcpower/nidcpower/_attributes.py b/generated/nidcpower/nidcpower/_attributes.py index f7cb3fcda..1ca78bd23 100644 --- a/generated/nidcpower/nidcpower/_attributes.py +++ b/generated/nidcpower/nidcpower/_attributes.py @@ -6,13 +6,14 @@ class Attribute(object): - """Base class for all typed attributes.""" + '''Base class for all typed attributes.''' def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -21,19 +22,16 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): + def __get__(self, session, session_type): - return hightime.timedelta( - milliseconds=session._get_attribute_vi_int32(self._attribute_id) - ) + return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_int32( - self._attribute_id, - _converters.convert_timedelta_to_milliseconds_int32(value).value, - ) + session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) class AttributeViInt64(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -42,6 +40,7 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -50,19 +49,16 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): + def __get__(self, session, session_type): - return hightime.timedelta( - seconds=session._get_attribute_vi_real64(self._attribute_id) - ) + return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_real64( - self._attribute_id, - _converters.convert_timedelta_to_seconds_real64(value).value, - ) + session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) class AttributeViString(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -71,17 +67,16 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string( - self._attribute_id, - _converters.convert_repeated_capabilities_without_prefix(value), - ) + session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) class AttributeViBoolean(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -90,36 +85,31 @@ def __set__(self, session, value): class AttributeEnum(object): + def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type( - self._underlying_attribute.__get__(session, session_type) - ) + return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError( - "must be " - + str(self._attribute_type.__name__) - + " not " - + str(type(value).__name__) - ) + raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): + def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from nidcpower.session import SessionReference - return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session( - self._attribute_id, _converters.convert_to_nitclk_session_number(value) - ) + session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) + + + diff --git a/generated/nidcpower/nidcpower/_converters.py b/generated/nidcpower/nidcpower/_converters.py index f4c70b5c3..3da843692 100644 --- a/generated/nidcpower/nidcpower/_converters.py +++ b/generated/nidcpower/nidcpower/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - """Base version that should not be called + '''Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,38 +40,36 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - """ - raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) + ''' + raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - """Integer version""" + '''Integer version''' return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - """String version (this is the most complex) + '''String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - """ + ''' # First we deal with a list - rep_cap_list = repeated_capability.split(",") + rep_cap_list = repeated_capability.split(',') if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, "").replace(":", "-") - rc = r.split("-") + r = repeated_capability.strip().replace(prefix, '').replace(':', '-') + rc = r.split('-') if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError( - "Multiple '-' or ':'", repeated_capability - ) + raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) try: start = int(rc[0]) end = int(rc[1]) @@ -87,7 +85,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, "").strip()] + return [repeated_capability.replace(prefix, '').strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -96,7 +94,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - """Iterable version - can handle lists, ranges, and tuples""" + '''Iterable version - can handle lists, ranges, and tuples''' rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -105,22 +103,16 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - """slice version""" - + '''slice version''' def ifnone(a, b): return b if a is None else a - # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range( - ifnone(repeated_capability.start, 0), - repeated_capability.stop, - ifnone(repeated_capability.step, 1), - ) + rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=""): - """Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=''): + '''Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -128,17 +120,15 @@ def convert_repeated_capabilities(repeated_capability, prefix=""): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - """ + ''' # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [ - prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) - ] + return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] def convert_repeated_capabilities_without_prefix(repeated_capability): - """Convert a repeated capabilities object, without any prefix, to a comma delimited list + '''Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -154,8 +144,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - """ - return ",".join(convert_repeated_capabilities(repeated_capability, "")) + ''' + return ','.join(convert_repeated_capabilities(repeated_capability, '')) def _convert_timedelta(value, library_type, scaling): @@ -168,14 +158,7 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [ - _visatype.ViInt64, - _visatype.ViInt32, - _visatype.ViUInt32, - _visatype.ViInt16, - _visatype.ViUInt16, - _visatype.ViInt8, - ]: + if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -212,36 +195,34 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - "rangecheck": "RangeCheck", - "queryinstrstatus": "QueryInstrStatus", - "cache": "Cache", - "simulate": "Simulate", - "recordcoercions": "RecordCoercions", - "interchangecheck": "InterchangeCheck", - "driversetup": "DriverSetup", - "range_check": "RangeCheck", - "query_instr_status": "QueryInstrStatus", - "record_coercions": "RecordCoercions", - "interchange_check": "InterchangeCheck", - "driver_setup": "DriverSetup", + 'rangecheck': 'RangeCheck', + 'queryinstrstatus': 'QueryInstrStatus', + 'cache': 'Cache', + 'simulate': 'Simulate', + 'recordcoercions': 'RecordCoercions', + 'interchangecheck': 'InterchangeCheck', + 'driversetup': 'DriverSetup', + 'range_check': 'RangeCheck', + 'query_instr_status': 'QueryInstrStatus', + 'record_coercions': 'RecordCoercions', + 'interchange_check': 'InterchangeCheck', + 'driver_setup': 'DriverSetup', } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": - value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") - elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": + if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': + value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') + elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': if not isinstance(values[k], dict): - raise TypeError("DriverSetup must be a dictionary") - value = "DriverSetup=" + ( - ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) - ) + raise TypeError('DriverSetup must be a dictionary') + value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) else: - value = k + ("=1" if values[k] is True else "=0") + value = k + ('=1' if values[k] is True else '=0') init_with_options.append(value) - init_with_options_string = ",".join(init_with_options) + init_with_options_string = ','.join(init_with_options) return init_with_options_string @@ -270,11 +251,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(",")] + return [x.strip() for x in comma_separated_string.split(',')] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -286,17 +267,11 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - """ - chained_repeated_capability_items = convert_comma_separated_string_to_list( - chained_repeated_capability - ) - repeated_capability_lists = [ - [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) - ] + ''' + chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) + repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] for item in chained_repeated_capability_items: - repeated_capability_lists = [ - x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) - ] - return [ - ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists - ] + repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] + return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] + + diff --git a/generated/nidcpower/nidcpower/_library.py b/generated/nidcpower/nidcpower/_library.py index 18d2572c2..3d518981d 100644 --- a/generated/nidcpower/nidcpower/_library.py +++ b/generated/nidcpower/nidcpower/_library.py @@ -9,11 +9,11 @@ class Library(object): - """Library + '''Library Wrapper around driver library. Class will setup the correct ctypes information for every function on first call. - """ + ''' def __init__(self, ctypes_library): self._func_lock = threading.Lock() @@ -88,854 +88,351 @@ def _get_library_function(self, name): def niDCPower_AbortWithChannels(self, vi, channel_name): # noqa: N802 with self._func_lock: if self.niDCPower_AbortWithChannels_cfunc is None: - self.niDCPower_AbortWithChannels_cfunc = self._get_library_function( - "niDCPower_AbortWithChannels" - ) - self.niDCPower_AbortWithChannels_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDCPower_AbortWithChannels_cfunc = self._get_library_function('niDCPower_AbortWithChannels') + self.niDCPower_AbortWithChannels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 self.niDCPower_AbortWithChannels_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_AbortWithChannels_cfunc(vi, channel_name) def niDCPower_CalSelfCalibrate(self, vi, channel_name): # noqa: N802 with self._func_lock: if self.niDCPower_CalSelfCalibrate_cfunc is None: - self.niDCPower_CalSelfCalibrate_cfunc = self._get_library_function( - "niDCPower_CalSelfCalibrate" - ) - self.niDCPower_CalSelfCalibrate_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDCPower_CalSelfCalibrate_cfunc = self._get_library_function('niDCPower_CalSelfCalibrate') + self.niDCPower_CalSelfCalibrate_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 self.niDCPower_CalSelfCalibrate_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_CalSelfCalibrate_cfunc(vi, channel_name) - def niDCPower_ClearLatchedOutputCutoffState( - self, vi, channel_name, output_cutoff_reason - ): # noqa: N802 + def niDCPower_ClearLatchedOutputCutoffState(self, vi, channel_name, output_cutoff_reason): # noqa: N802 with self._func_lock: if self.niDCPower_ClearLatchedOutputCutoffState_cfunc is None: - self.niDCPower_ClearLatchedOutputCutoffState_cfunc = ( - self._get_library_function( - "niDCPower_ClearLatchedOutputCutoffState" - ) - ) - self.niDCPower_ClearLatchedOutputCutoffState_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ] # noqa: F405 - self.niDCPower_ClearLatchedOutputCutoffState_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_ClearLatchedOutputCutoffState_cfunc( - vi, channel_name, output_cutoff_reason - ) + self.niDCPower_ClearLatchedOutputCutoffState_cfunc = self._get_library_function('niDCPower_ClearLatchedOutputCutoffState') + self.niDCPower_ClearLatchedOutputCutoffState_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32] # noqa: F405 + self.niDCPower_ClearLatchedOutputCutoffState_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_ClearLatchedOutputCutoffState_cfunc(vi, channel_name, output_cutoff_reason) def niDCPower_CommitWithChannels(self, vi, channel_name): # noqa: N802 with self._func_lock: if self.niDCPower_CommitWithChannels_cfunc is None: - self.niDCPower_CommitWithChannels_cfunc = self._get_library_function( - "niDCPower_CommitWithChannels" - ) - self.niDCPower_CommitWithChannels_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDCPower_CommitWithChannels_cfunc = self._get_library_function('niDCPower_CommitWithChannels') + self.niDCPower_CommitWithChannels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 self.niDCPower_CommitWithChannels_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_CommitWithChannels_cfunc(vi, channel_name) - def niDCPower_ConfigureApertureTime( - self, vi, channel_name, aperture_time, units - ): # noqa: N802 + def niDCPower_ConfigureApertureTime(self, vi, channel_name, aperture_time, units): # noqa: N802 with self._func_lock: if self.niDCPower_ConfigureApertureTime_cfunc is None: - self.niDCPower_ConfigureApertureTime_cfunc = self._get_library_function( - "niDCPower_ConfigureApertureTime" - ) - self.niDCPower_ConfigureApertureTime_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViReal64, - ViInt32, - ] # noqa: F405 - self.niDCPower_ConfigureApertureTime_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_ConfigureApertureTime_cfunc( - vi, channel_name, aperture_time, units - ) - - def niDCPower_CreateAdvancedSequenceCommitStepWithChannels( - self, vi, channel_name, set_as_active_step - ): # noqa: N802 + self.niDCPower_ConfigureApertureTime_cfunc = self._get_library_function('niDCPower_ConfigureApertureTime') + self.niDCPower_ConfigureApertureTime_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViInt32] # noqa: F405 + self.niDCPower_ConfigureApertureTime_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_ConfigureApertureTime_cfunc(vi, channel_name, aperture_time, units) + + def niDCPower_CreateAdvancedSequenceCommitStepWithChannels(self, vi, channel_name, set_as_active_step): # noqa: N802 with self._func_lock: - if ( - self.niDCPower_CreateAdvancedSequenceCommitStepWithChannels_cfunc - is None - ): - self.niDCPower_CreateAdvancedSequenceCommitStepWithChannels_cfunc = ( - self._get_library_function( - "niDCPower_CreateAdvancedSequenceCommitStepWithChannels" - ) - ) - self.niDCPower_CreateAdvancedSequenceCommitStepWithChannels_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViBoolean, - ] # noqa: F405 - self.niDCPower_CreateAdvancedSequenceCommitStepWithChannels_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_CreateAdvancedSequenceCommitStepWithChannels_cfunc( - vi, channel_name, set_as_active_step - ) - - def niDCPower_CreateAdvancedSequenceStepWithChannels( - self, vi, channel_name, set_as_active_step - ): # noqa: N802 + if self.niDCPower_CreateAdvancedSequenceCommitStepWithChannels_cfunc is None: + self.niDCPower_CreateAdvancedSequenceCommitStepWithChannels_cfunc = self._get_library_function('niDCPower_CreateAdvancedSequenceCommitStepWithChannels') + self.niDCPower_CreateAdvancedSequenceCommitStepWithChannels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViBoolean] # noqa: F405 + self.niDCPower_CreateAdvancedSequenceCommitStepWithChannels_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_CreateAdvancedSequenceCommitStepWithChannels_cfunc(vi, channel_name, set_as_active_step) + + def niDCPower_CreateAdvancedSequenceStepWithChannels(self, vi, channel_name, set_as_active_step): # noqa: N802 with self._func_lock: if self.niDCPower_CreateAdvancedSequenceStepWithChannels_cfunc is None: - self.niDCPower_CreateAdvancedSequenceStepWithChannels_cfunc = ( - self._get_library_function( - "niDCPower_CreateAdvancedSequenceStepWithChannels" - ) - ) - self.niDCPower_CreateAdvancedSequenceStepWithChannels_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViBoolean, - ] # noqa: F405 - self.niDCPower_CreateAdvancedSequenceStepWithChannels_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_CreateAdvancedSequenceStepWithChannels_cfunc( - vi, channel_name, set_as_active_step - ) - - def niDCPower_CreateAdvancedSequenceWithChannels( - self, - vi, - channel_name, - sequence_name, - attribute_id_count, - attribute_ids, - set_as_active_sequence, - ): # noqa: N802 + self.niDCPower_CreateAdvancedSequenceStepWithChannels_cfunc = self._get_library_function('niDCPower_CreateAdvancedSequenceStepWithChannels') + self.niDCPower_CreateAdvancedSequenceStepWithChannels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViBoolean] # noqa: F405 + self.niDCPower_CreateAdvancedSequenceStepWithChannels_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_CreateAdvancedSequenceStepWithChannels_cfunc(vi, channel_name, set_as_active_step) + + def niDCPower_CreateAdvancedSequenceWithChannels(self, vi, channel_name, sequence_name, attribute_id_count, attribute_ids, set_as_active_sequence): # noqa: N802 with self._func_lock: if self.niDCPower_CreateAdvancedSequenceWithChannels_cfunc is None: - self.niDCPower_CreateAdvancedSequenceWithChannels_cfunc = ( - self._get_library_function( - "niDCPower_CreateAdvancedSequenceWithChannels" - ) - ) - self.niDCPower_CreateAdvancedSequenceWithChannels_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViInt32), - ViBoolean, - ] # noqa: F405 - self.niDCPower_CreateAdvancedSequenceWithChannels_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_CreateAdvancedSequenceWithChannels_cfunc( - vi, - channel_name, - sequence_name, - attribute_id_count, - attribute_ids, - set_as_active_sequence, - ) - - def niDCPower_DeleteAdvancedSequenceWithChannels( - self, vi, channel_name, sequence_name - ): # noqa: N802 + self.niDCPower_CreateAdvancedSequenceWithChannels_cfunc = self._get_library_function('niDCPower_CreateAdvancedSequenceWithChannels') + self.niDCPower_CreateAdvancedSequenceWithChannels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViInt32), ViBoolean] # noqa: F405 + self.niDCPower_CreateAdvancedSequenceWithChannels_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_CreateAdvancedSequenceWithChannels_cfunc(vi, channel_name, sequence_name, attribute_id_count, attribute_ids, set_as_active_sequence) + + def niDCPower_DeleteAdvancedSequenceWithChannels(self, vi, channel_name, sequence_name): # noqa: N802 with self._func_lock: if self.niDCPower_DeleteAdvancedSequenceWithChannels_cfunc is None: - self.niDCPower_DeleteAdvancedSequenceWithChannels_cfunc = ( - self._get_library_function( - "niDCPower_DeleteAdvancedSequenceWithChannels" - ) - ) - self.niDCPower_DeleteAdvancedSequenceWithChannels_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niDCPower_DeleteAdvancedSequenceWithChannels_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_DeleteAdvancedSequenceWithChannels_cfunc( - vi, channel_name, sequence_name - ) + self.niDCPower_DeleteAdvancedSequenceWithChannels_cfunc = self._get_library_function('niDCPower_DeleteAdvancedSequenceWithChannels') + self.niDCPower_DeleteAdvancedSequenceWithChannels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar)] # noqa: F405 + self.niDCPower_DeleteAdvancedSequenceWithChannels_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_DeleteAdvancedSequenceWithChannels_cfunc(vi, channel_name, sequence_name) def niDCPower_Disable(self, vi): # noqa: N802 with self._func_lock: if self.niDCPower_Disable_cfunc is None: - self.niDCPower_Disable_cfunc = self._get_library_function( - "niDCPower_Disable" - ) + self.niDCPower_Disable_cfunc = self._get_library_function('niDCPower_Disable') self.niDCPower_Disable_cfunc.argtypes = [ViSession] # noqa: F405 self.niDCPower_Disable_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_Disable_cfunc(vi) - def niDCPower_ExportAttributeConfigurationBuffer( - self, vi, size, configuration - ): # noqa: N802 + def niDCPower_ExportAttributeConfigurationBuffer(self, vi, size, configuration): # noqa: N802 with self._func_lock: if self.niDCPower_ExportAttributeConfigurationBuffer_cfunc is None: - self.niDCPower_ExportAttributeConfigurationBuffer_cfunc = ( - self._get_library_function( - "niDCPower_ExportAttributeConfigurationBuffer" - ) - ) - self.niDCPower_ExportAttributeConfigurationBuffer_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViInt8), - ] # noqa: F405 - self.niDCPower_ExportAttributeConfigurationBuffer_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_ExportAttributeConfigurationBuffer_cfunc( - vi, size, configuration - ) + self.niDCPower_ExportAttributeConfigurationBuffer_cfunc = self._get_library_function('niDCPower_ExportAttributeConfigurationBuffer') + self.niDCPower_ExportAttributeConfigurationBuffer_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt8)] # noqa: F405 + self.niDCPower_ExportAttributeConfigurationBuffer_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_ExportAttributeConfigurationBuffer_cfunc(vi, size, configuration) def niDCPower_ExportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niDCPower_ExportAttributeConfigurationFile_cfunc is None: - self.niDCPower_ExportAttributeConfigurationFile_cfunc = ( - self._get_library_function( - "niDCPower_ExportAttributeConfigurationFile" - ) - ) - self.niDCPower_ExportAttributeConfigurationFile_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niDCPower_ExportAttributeConfigurationFile_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niDCPower_ExportAttributeConfigurationFile_cfunc = self._get_library_function('niDCPower_ExportAttributeConfigurationFile') + self.niDCPower_ExportAttributeConfigurationFile_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDCPower_ExportAttributeConfigurationFile_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_ExportAttributeConfigurationFile_cfunc(vi, file_path) - def niDCPower_FancyInitialize( - self, resource_name, channels, reset, option_string, vi, independent_channels - ): # noqa: N802 + def niDCPower_FancyInitialize(self, resource_name, channels, reset, option_string, vi, independent_channels): # noqa: N802 with self._func_lock: if self.niDCPower_FancyInitialize_cfunc is None: - self.niDCPower_FancyInitialize_cfunc = self._get_library_function( - "niDCPower_FancyInitialize" - ) - self.niDCPower_FancyInitialize_cfunc.argtypes = [ - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViBoolean, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViSession), - ViBoolean, - ] # noqa: F405 + self.niDCPower_FancyInitialize_cfunc = self._get_library_function('niDCPower_FancyInitialize') + self.niDCPower_FancyInitialize_cfunc.argtypes = [ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViBoolean, ctypes.POINTER(ViChar), ctypes.POINTER(ViSession), ViBoolean] # noqa: F405 self.niDCPower_FancyInitialize_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_FancyInitialize_cfunc( - resource_name, channels, reset, option_string, vi, independent_channels - ) - - def niDCPower_FetchMultiple( - self, - vi, - channel_name, - timeout, - count, - voltage_measurements, - current_measurements, - in_compliance, - actual_count, - ): # noqa: N802 + return self.niDCPower_FancyInitialize_cfunc(resource_name, channels, reset, option_string, vi, independent_channels) + + def niDCPower_FetchMultiple(self, vi, channel_name, timeout, count, voltage_measurements, current_measurements, in_compliance, actual_count): # noqa: N802 with self._func_lock: if self.niDCPower_FetchMultiple_cfunc is None: - self.niDCPower_FetchMultiple_cfunc = self._get_library_function( - "niDCPower_FetchMultiple" - ) - self.niDCPower_FetchMultiple_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViReal64, - ViInt32, - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViBoolean), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niDCPower_FetchMultiple_cfunc = self._get_library_function('niDCPower_FetchMultiple') + self.niDCPower_FetchMultiple_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ctypes.POINTER(ViBoolean), ctypes.POINTER(ViInt32)] # noqa: F405 self.niDCPower_FetchMultiple_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_FetchMultiple_cfunc( - vi, - channel_name, - timeout, - count, - voltage_measurements, - current_measurements, - in_compliance, - actual_count, - ) - - def niDCPower_GetAttributeViBoolean( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + return self.niDCPower_FetchMultiple_cfunc(vi, channel_name, timeout, count, voltage_measurements, current_measurements, in_compliance, actual_count) + + def niDCPower_GetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niDCPower_GetAttributeViBoolean_cfunc is None: - self.niDCPower_GetAttributeViBoolean_cfunc = self._get_library_function( - "niDCPower_GetAttributeViBoolean" - ) - self.niDCPower_GetAttributeViBoolean_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 - self.niDCPower_GetAttributeViBoolean_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_GetAttributeViBoolean_cfunc( - vi, channel_name, attribute_id, attribute_value - ) - - def niDCPower_GetAttributeViInt32( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + self.niDCPower_GetAttributeViBoolean_cfunc = self._get_library_function('niDCPower_GetAttributeViBoolean') + self.niDCPower_GetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niDCPower_GetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_GetAttributeViBoolean_cfunc(vi, channel_name, attribute_id, attribute_value) + + def niDCPower_GetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niDCPower_GetAttributeViInt32_cfunc is None: - self.niDCPower_GetAttributeViInt32_cfunc = self._get_library_function( - "niDCPower_GetAttributeViInt32" - ) - self.niDCPower_GetAttributeViInt32_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niDCPower_GetAttributeViInt32_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_GetAttributeViInt32_cfunc( - vi, channel_name, attribute_id, attribute_value - ) - - def niDCPower_GetAttributeViInt64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + self.niDCPower_GetAttributeViInt32_cfunc = self._get_library_function('niDCPower_GetAttributeViInt32') + self.niDCPower_GetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDCPower_GetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_GetAttributeViInt32_cfunc(vi, channel_name, attribute_id, attribute_value) + + def niDCPower_GetAttributeViInt64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niDCPower_GetAttributeViInt64_cfunc is None: - self.niDCPower_GetAttributeViInt64_cfunc = self._get_library_function( - "niDCPower_GetAttributeViInt64" - ) - self.niDCPower_GetAttributeViInt64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViInt64), - ] # noqa: F405 - self.niDCPower_GetAttributeViInt64_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_GetAttributeViInt64_cfunc( - vi, channel_name, attribute_id, attribute_value - ) - - def niDCPower_GetAttributeViReal64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + self.niDCPower_GetAttributeViInt64_cfunc = self._get_library_function('niDCPower_GetAttributeViInt64') + self.niDCPower_GetAttributeViInt64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViInt64)] # noqa: F405 + self.niDCPower_GetAttributeViInt64_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_GetAttributeViInt64_cfunc(vi, channel_name, attribute_id, attribute_value) + + def niDCPower_GetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niDCPower_GetAttributeViReal64_cfunc is None: - self.niDCPower_GetAttributeViReal64_cfunc = self._get_library_function( - "niDCPower_GetAttributeViReal64" - ) - self.niDCPower_GetAttributeViReal64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViReal64), - ] # noqa: F405 - self.niDCPower_GetAttributeViReal64_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_GetAttributeViReal64_cfunc( - vi, channel_name, attribute_id, attribute_value - ) - - def niDCPower_GetAttributeViString( - self, vi, channel_name, attribute_id, buffer_size, attribute_value - ): # noqa: N802 + self.niDCPower_GetAttributeViReal64_cfunc = self._get_library_function('niDCPower_GetAttributeViReal64') + self.niDCPower_GetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niDCPower_GetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_GetAttributeViReal64_cfunc(vi, channel_name, attribute_id, attribute_value) + + def niDCPower_GetAttributeViString(self, vi, channel_name, attribute_id, buffer_size, attribute_value): # noqa: N802 with self._func_lock: if self.niDCPower_GetAttributeViString_cfunc is None: - self.niDCPower_GetAttributeViString_cfunc = self._get_library_function( - "niDCPower_GetAttributeViString" - ) - self.niDCPower_GetAttributeViString_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niDCPower_GetAttributeViString_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_GetAttributeViString_cfunc( - vi, channel_name, attribute_id, buffer_size, attribute_value - ) - - def niDCPower_GetChannelName( - self, vi, index, buffer_size, channel_name - ): # noqa: N802 + self.niDCPower_GetAttributeViString_cfunc = self._get_library_function('niDCPower_GetAttributeViString') + self.niDCPower_GetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDCPower_GetAttributeViString_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_GetAttributeViString_cfunc(vi, channel_name, attribute_id, buffer_size, attribute_value) + + def niDCPower_GetChannelName(self, vi, index, buffer_size, channel_name): # noqa: N802 with self._func_lock: if self.niDCPower_GetChannelName_cfunc is None: - self.niDCPower_GetChannelName_cfunc = self._get_library_function( - "niDCPower_GetChannelName" - ) - self.niDCPower_GetChannelName_cfunc.argtypes = [ - ViSession, - ViInt32, - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDCPower_GetChannelName_cfunc = self._get_library_function('niDCPower_GetChannelName') + self.niDCPower_GetChannelName_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niDCPower_GetChannelName_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_GetChannelName_cfunc(vi, index, buffer_size, channel_name) - def niDCPower_GetChannelNameFromString( - self, vi, indices, buffer_size, names - ): # noqa: N802 + def niDCPower_GetChannelNameFromString(self, vi, indices, buffer_size, names): # noqa: N802 with self._func_lock: if self.niDCPower_GetChannelNameFromString_cfunc is None: - self.niDCPower_GetChannelNameFromString_cfunc = ( - self._get_library_function("niDCPower_GetChannelNameFromString") - ) - self.niDCPower_GetChannelNameFromString_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niDCPower_GetChannelNameFromString_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_GetChannelNameFromString_cfunc( - vi, indices, buffer_size, names - ) + self.niDCPower_GetChannelNameFromString_cfunc = self._get_library_function('niDCPower_GetChannelNameFromString') + self.niDCPower_GetChannelNameFromString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDCPower_GetChannelNameFromString_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_GetChannelNameFromString_cfunc(vi, indices, buffer_size, names) def niDCPower_GetError(self, vi, code, buffer_size, description): # noqa: N802 with self._func_lock: if self.niDCPower_GetError_cfunc is None: - self.niDCPower_GetError_cfunc = self._get_library_function( - "niDCPower_GetError" - ) - self.niDCPower_GetError_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViStatus), - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDCPower_GetError_cfunc = self._get_library_function('niDCPower_GetError') + self.niDCPower_GetError_cfunc.argtypes = [ViSession, ctypes.POINTER(ViStatus), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niDCPower_GetError_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_GetError_cfunc(vi, code, buffer_size, description) - def niDCPower_GetExtCalLastDateAndTime( - self, vi, year, month, day, hour, minute - ): # noqa: N802 + def niDCPower_GetExtCalLastDateAndTime(self, vi, year, month, day, hour, minute): # noqa: N802 with self._func_lock: if self.niDCPower_GetExtCalLastDateAndTime_cfunc is None: - self.niDCPower_GetExtCalLastDateAndTime_cfunc = ( - self._get_library_function("niDCPower_GetExtCalLastDateAndTime") - ) - self.niDCPower_GetExtCalLastDateAndTime_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niDCPower_GetExtCalLastDateAndTime_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_GetExtCalLastDateAndTime_cfunc( - vi, year, month, day, hour, minute - ) + self.niDCPower_GetExtCalLastDateAndTime_cfunc = self._get_library_function('niDCPower_GetExtCalLastDateAndTime') + self.niDCPower_GetExtCalLastDateAndTime_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDCPower_GetExtCalLastDateAndTime_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_GetExtCalLastDateAndTime_cfunc(vi, year, month, day, hour, minute) def niDCPower_GetExtCalLastTemp(self, vi, temperature): # noqa: N802 with self._func_lock: if self.niDCPower_GetExtCalLastTemp_cfunc is None: - self.niDCPower_GetExtCalLastTemp_cfunc = self._get_library_function( - "niDCPower_GetExtCalLastTemp" - ) - self.niDCPower_GetExtCalLastTemp_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niDCPower_GetExtCalLastTemp_cfunc = self._get_library_function('niDCPower_GetExtCalLastTemp') + self.niDCPower_GetExtCalLastTemp_cfunc.argtypes = [ViSession, ctypes.POINTER(ViReal64)] # noqa: F405 self.niDCPower_GetExtCalLastTemp_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_GetExtCalLastTemp_cfunc(vi, temperature) def niDCPower_GetExtCalRecommendedInterval(self, vi, months): # noqa: N802 with self._func_lock: if self.niDCPower_GetExtCalRecommendedInterval_cfunc is None: - self.niDCPower_GetExtCalRecommendedInterval_cfunc = ( - self._get_library_function("niDCPower_GetExtCalRecommendedInterval") - ) - self.niDCPower_GetExtCalRecommendedInterval_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niDCPower_GetExtCalRecommendedInterval_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niDCPower_GetExtCalRecommendedInterval_cfunc = self._get_library_function('niDCPower_GetExtCalRecommendedInterval') + self.niDCPower_GetExtCalRecommendedInterval_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDCPower_GetExtCalRecommendedInterval_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_GetExtCalRecommendedInterval_cfunc(vi, months) - def niDCPower_GetSelfCalLastDateAndTime( - self, vi, year, month, day, hour, minute - ): # noqa: N802 + def niDCPower_GetSelfCalLastDateAndTime(self, vi, year, month, day, hour, minute): # noqa: N802 with self._func_lock: if self.niDCPower_GetSelfCalLastDateAndTime_cfunc is None: - self.niDCPower_GetSelfCalLastDateAndTime_cfunc = ( - self._get_library_function("niDCPower_GetSelfCalLastDateAndTime") - ) - self.niDCPower_GetSelfCalLastDateAndTime_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niDCPower_GetSelfCalLastDateAndTime_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_GetSelfCalLastDateAndTime_cfunc( - vi, year, month, day, hour, minute - ) + self.niDCPower_GetSelfCalLastDateAndTime_cfunc = self._get_library_function('niDCPower_GetSelfCalLastDateAndTime') + self.niDCPower_GetSelfCalLastDateAndTime_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDCPower_GetSelfCalLastDateAndTime_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_GetSelfCalLastDateAndTime_cfunc(vi, year, month, day, hour, minute) def niDCPower_GetSelfCalLastTemp(self, vi, temperature): # noqa: N802 with self._func_lock: if self.niDCPower_GetSelfCalLastTemp_cfunc is None: - self.niDCPower_GetSelfCalLastTemp_cfunc = self._get_library_function( - "niDCPower_GetSelfCalLastTemp" - ) - self.niDCPower_GetSelfCalLastTemp_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niDCPower_GetSelfCalLastTemp_cfunc = self._get_library_function('niDCPower_GetSelfCalLastTemp') + self.niDCPower_GetSelfCalLastTemp_cfunc.argtypes = [ViSession, ctypes.POINTER(ViReal64)] # noqa: F405 self.niDCPower_GetSelfCalLastTemp_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_GetSelfCalLastTemp_cfunc(vi, temperature) - def niDCPower_ImportAttributeConfigurationBuffer( - self, vi, size, configuration - ): # noqa: N802 + def niDCPower_ImportAttributeConfigurationBuffer(self, vi, size, configuration): # noqa: N802 with self._func_lock: if self.niDCPower_ImportAttributeConfigurationBuffer_cfunc is None: - self.niDCPower_ImportAttributeConfigurationBuffer_cfunc = ( - self._get_library_function( - "niDCPower_ImportAttributeConfigurationBuffer" - ) - ) - self.niDCPower_ImportAttributeConfigurationBuffer_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViInt8), - ] # noqa: F405 - self.niDCPower_ImportAttributeConfigurationBuffer_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_ImportAttributeConfigurationBuffer_cfunc( - vi, size, configuration - ) + self.niDCPower_ImportAttributeConfigurationBuffer_cfunc = self._get_library_function('niDCPower_ImportAttributeConfigurationBuffer') + self.niDCPower_ImportAttributeConfigurationBuffer_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt8)] # noqa: F405 + self.niDCPower_ImportAttributeConfigurationBuffer_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_ImportAttributeConfigurationBuffer_cfunc(vi, size, configuration) def niDCPower_ImportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niDCPower_ImportAttributeConfigurationFile_cfunc is None: - self.niDCPower_ImportAttributeConfigurationFile_cfunc = ( - self._get_library_function( - "niDCPower_ImportAttributeConfigurationFile" - ) - ) - self.niDCPower_ImportAttributeConfigurationFile_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niDCPower_ImportAttributeConfigurationFile_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niDCPower_ImportAttributeConfigurationFile_cfunc = self._get_library_function('niDCPower_ImportAttributeConfigurationFile') + self.niDCPower_ImportAttributeConfigurationFile_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDCPower_ImportAttributeConfigurationFile_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_ImportAttributeConfigurationFile_cfunc(vi, file_path) - def niDCPower_InitializeWithChannels( - self, resource_name, channels, reset, option_string, vi - ): # noqa: N802 + def niDCPower_InitializeWithChannels(self, resource_name, channels, reset, option_string, vi): # noqa: N802 with self._func_lock: if self.niDCPower_InitializeWithChannels_cfunc is None: - self.niDCPower_InitializeWithChannels_cfunc = ( - self._get_library_function("niDCPower_InitializeWithChannels") - ) - self.niDCPower_InitializeWithChannels_cfunc.argtypes = [ - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViBoolean, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViSession), - ] # noqa: F405 - self.niDCPower_InitializeWithChannels_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_InitializeWithChannels_cfunc( - resource_name, channels, reset, option_string, vi - ) - - def niDCPower_InitializeWithIndependentChannels( - self, resource_name, reset, option_string, vi - ): # noqa: N802 + self.niDCPower_InitializeWithChannels_cfunc = self._get_library_function('niDCPower_InitializeWithChannels') + self.niDCPower_InitializeWithChannels_cfunc.argtypes = [ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViBoolean, ctypes.POINTER(ViChar), ctypes.POINTER(ViSession)] # noqa: F405 + self.niDCPower_InitializeWithChannels_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_InitializeWithChannels_cfunc(resource_name, channels, reset, option_string, vi) + + def niDCPower_InitializeWithIndependentChannels(self, resource_name, reset, option_string, vi): # noqa: N802 with self._func_lock: if self.niDCPower_InitializeWithIndependentChannels_cfunc is None: - self.niDCPower_InitializeWithIndependentChannels_cfunc = ( - self._get_library_function( - "niDCPower_InitializeWithIndependentChannels" - ) - ) - self.niDCPower_InitializeWithIndependentChannels_cfunc.argtypes = [ - ctypes.POINTER(ViChar), - ViBoolean, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViSession), - ] # noqa: F405 - self.niDCPower_InitializeWithIndependentChannels_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_InitializeWithIndependentChannels_cfunc( - resource_name, reset, option_string, vi - ) + self.niDCPower_InitializeWithIndependentChannels_cfunc = self._get_library_function('niDCPower_InitializeWithIndependentChannels') + self.niDCPower_InitializeWithIndependentChannels_cfunc.argtypes = [ctypes.POINTER(ViChar), ViBoolean, ctypes.POINTER(ViChar), ctypes.POINTER(ViSession)] # noqa: F405 + self.niDCPower_InitializeWithIndependentChannels_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_InitializeWithIndependentChannels_cfunc(resource_name, reset, option_string, vi) def niDCPower_InitiateWithChannels(self, vi, channel_name): # noqa: N802 with self._func_lock: if self.niDCPower_InitiateWithChannels_cfunc is None: - self.niDCPower_InitiateWithChannels_cfunc = self._get_library_function( - "niDCPower_InitiateWithChannels" - ) - self.niDCPower_InitiateWithChannels_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niDCPower_InitiateWithChannels_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niDCPower_InitiateWithChannels_cfunc = self._get_library_function('niDCPower_InitiateWithChannels') + self.niDCPower_InitiateWithChannels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDCPower_InitiateWithChannels_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_InitiateWithChannels_cfunc(vi, channel_name) def niDCPower_LockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niDCPower_LockSession_cfunc is None: - self.niDCPower_LockSession_cfunc = self._get_library_function( - "niDCPower_LockSession" - ) - self.niDCPower_LockSession_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niDCPower_LockSession_cfunc = self._get_library_function('niDCPower_LockSession') + self.niDCPower_LockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niDCPower_LockSession_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_LockSession_cfunc(vi, caller_has_lock) - def niDCPower_Measure( - self, vi, channel_name, measurement_type, measurement - ): # noqa: N802 + def niDCPower_Measure(self, vi, channel_name, measurement_type, measurement): # noqa: N802 with self._func_lock: if self.niDCPower_Measure_cfunc is None: - self.niDCPower_Measure_cfunc = self._get_library_function( - "niDCPower_Measure" - ) - self.niDCPower_Measure_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niDCPower_Measure_cfunc = self._get_library_function('niDCPower_Measure') + self.niDCPower_Measure_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 self.niDCPower_Measure_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_Measure_cfunc( - vi, channel_name, measurement_type, measurement - ) + return self.niDCPower_Measure_cfunc(vi, channel_name, measurement_type, measurement) - def niDCPower_MeasureMultiple( - self, vi, channel_name, voltage_measurements, current_measurements - ): # noqa: N802 + def niDCPower_MeasureMultiple(self, vi, channel_name, voltage_measurements, current_measurements): # noqa: N802 with self._func_lock: if self.niDCPower_MeasureMultiple_cfunc is None: - self.niDCPower_MeasureMultiple_cfunc = self._get_library_function( - "niDCPower_MeasureMultiple" - ) - self.niDCPower_MeasureMultiple_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niDCPower_MeasureMultiple_cfunc = self._get_library_function('niDCPower_MeasureMultiple') + self.niDCPower_MeasureMultiple_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64)] # noqa: F405 self.niDCPower_MeasureMultiple_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_MeasureMultiple_cfunc( - vi, channel_name, voltage_measurements, current_measurements - ) + return self.niDCPower_MeasureMultiple_cfunc(vi, channel_name, voltage_measurements, current_measurements) - def niDCPower_ParseChannelCount( - self, vi, channels_string, number_of_channels - ): # noqa: N802 + def niDCPower_ParseChannelCount(self, vi, channels_string, number_of_channels): # noqa: N802 with self._func_lock: if self.niDCPower_ParseChannelCount_cfunc is None: - self.niDCPower_ParseChannelCount_cfunc = self._get_library_function( - "niDCPower_ParseChannelCount" - ) - self.niDCPower_ParseChannelCount_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViUInt32), - ] # noqa: F405 + self.niDCPower_ParseChannelCount_cfunc = self._get_library_function('niDCPower_ParseChannelCount') + self.niDCPower_ParseChannelCount_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViUInt32)] # noqa: F405 self.niDCPower_ParseChannelCount_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_ParseChannelCount_cfunc( - vi, channels_string, number_of_channels - ) + return self.niDCPower_ParseChannelCount_cfunc(vi, channels_string, number_of_channels) - def niDCPower_QueryInCompliance( - self, vi, channel_name, in_compliance - ): # noqa: N802 + def niDCPower_QueryInCompliance(self, vi, channel_name, in_compliance): # noqa: N802 with self._func_lock: if self.niDCPower_QueryInCompliance_cfunc is None: - self.niDCPower_QueryInCompliance_cfunc = self._get_library_function( - "niDCPower_QueryInCompliance" - ) - self.niDCPower_QueryInCompliance_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niDCPower_QueryInCompliance_cfunc = self._get_library_function('niDCPower_QueryInCompliance') + self.niDCPower_QueryInCompliance_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViBoolean)] # noqa: F405 self.niDCPower_QueryInCompliance_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_QueryInCompliance_cfunc(vi, channel_name, in_compliance) - def niDCPower_QueryLatchedOutputCutoffState( - self, vi, channel_name, output_cutoff_reason, output_cutoff_state - ): # noqa: N802 + def niDCPower_QueryLatchedOutputCutoffState(self, vi, channel_name, output_cutoff_reason, output_cutoff_state): # noqa: N802 with self._func_lock: if self.niDCPower_QueryLatchedOutputCutoffState_cfunc is None: - self.niDCPower_QueryLatchedOutputCutoffState_cfunc = ( - self._get_library_function( - "niDCPower_QueryLatchedOutputCutoffState" - ) - ) - self.niDCPower_QueryLatchedOutputCutoffState_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 - self.niDCPower_QueryLatchedOutputCutoffState_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_QueryLatchedOutputCutoffState_cfunc( - vi, channel_name, output_cutoff_reason, output_cutoff_state - ) - - def niDCPower_QueryMaxCurrentLimit( - self, vi, channel_name, voltage_level, max_current_limit - ): # noqa: N802 + self.niDCPower_QueryLatchedOutputCutoffState_cfunc = self._get_library_function('niDCPower_QueryLatchedOutputCutoffState') + self.niDCPower_QueryLatchedOutputCutoffState_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niDCPower_QueryLatchedOutputCutoffState_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_QueryLatchedOutputCutoffState_cfunc(vi, channel_name, output_cutoff_reason, output_cutoff_state) + + def niDCPower_QueryMaxCurrentLimit(self, vi, channel_name, voltage_level, max_current_limit): # noqa: N802 with self._func_lock: if self.niDCPower_QueryMaxCurrentLimit_cfunc is None: - self.niDCPower_QueryMaxCurrentLimit_cfunc = self._get_library_function( - "niDCPower_QueryMaxCurrentLimit" - ) - self.niDCPower_QueryMaxCurrentLimit_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViReal64, - ctypes.POINTER(ViReal64), - ] # noqa: F405 - self.niDCPower_QueryMaxCurrentLimit_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_QueryMaxCurrentLimit_cfunc( - vi, channel_name, voltage_level, max_current_limit - ) - - def niDCPower_QueryMaxVoltageLevel( - self, vi, channel_name, current_limit, max_voltage_level - ): # noqa: N802 + self.niDCPower_QueryMaxCurrentLimit_cfunc = self._get_library_function('niDCPower_QueryMaxCurrentLimit') + self.niDCPower_QueryMaxCurrentLimit_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niDCPower_QueryMaxCurrentLimit_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_QueryMaxCurrentLimit_cfunc(vi, channel_name, voltage_level, max_current_limit) + + def niDCPower_QueryMaxVoltageLevel(self, vi, channel_name, current_limit, max_voltage_level): # noqa: N802 with self._func_lock: if self.niDCPower_QueryMaxVoltageLevel_cfunc is None: - self.niDCPower_QueryMaxVoltageLevel_cfunc = self._get_library_function( - "niDCPower_QueryMaxVoltageLevel" - ) - self.niDCPower_QueryMaxVoltageLevel_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViReal64, - ctypes.POINTER(ViReal64), - ] # noqa: F405 - self.niDCPower_QueryMaxVoltageLevel_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_QueryMaxVoltageLevel_cfunc( - vi, channel_name, current_limit, max_voltage_level - ) - - def niDCPower_QueryMinCurrentLimit( - self, vi, channel_name, voltage_level, min_current_limit - ): # noqa: N802 + self.niDCPower_QueryMaxVoltageLevel_cfunc = self._get_library_function('niDCPower_QueryMaxVoltageLevel') + self.niDCPower_QueryMaxVoltageLevel_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niDCPower_QueryMaxVoltageLevel_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_QueryMaxVoltageLevel_cfunc(vi, channel_name, current_limit, max_voltage_level) + + def niDCPower_QueryMinCurrentLimit(self, vi, channel_name, voltage_level, min_current_limit): # noqa: N802 with self._func_lock: if self.niDCPower_QueryMinCurrentLimit_cfunc is None: - self.niDCPower_QueryMinCurrentLimit_cfunc = self._get_library_function( - "niDCPower_QueryMinCurrentLimit" - ) - self.niDCPower_QueryMinCurrentLimit_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViReal64, - ctypes.POINTER(ViReal64), - ] # noqa: F405 - self.niDCPower_QueryMinCurrentLimit_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_QueryMinCurrentLimit_cfunc( - vi, channel_name, voltage_level, min_current_limit - ) - - def niDCPower_QueryOutputState( - self, vi, channel_name, output_state, in_state - ): # noqa: N802 + self.niDCPower_QueryMinCurrentLimit_cfunc = self._get_library_function('niDCPower_QueryMinCurrentLimit') + self.niDCPower_QueryMinCurrentLimit_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niDCPower_QueryMinCurrentLimit_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_QueryMinCurrentLimit_cfunc(vi, channel_name, voltage_level, min_current_limit) + + def niDCPower_QueryOutputState(self, vi, channel_name, output_state, in_state): # noqa: N802 with self._func_lock: if self.niDCPower_QueryOutputState_cfunc is None: - self.niDCPower_QueryOutputState_cfunc = self._get_library_function( - "niDCPower_QueryOutputState" - ) - self.niDCPower_QueryOutputState_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niDCPower_QueryOutputState_cfunc = self._get_library_function('niDCPower_QueryOutputState') + self.niDCPower_QueryOutputState_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niDCPower_QueryOutputState_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_QueryOutputState_cfunc( - vi, channel_name, output_state, in_state - ) + return self.niDCPower_QueryOutputState_cfunc(vi, channel_name, output_state, in_state) def niDCPower_ReadCurrentTemperature(self, vi, temperature): # noqa: N802 with self._func_lock: if self.niDCPower_ReadCurrentTemperature_cfunc is None: - self.niDCPower_ReadCurrentTemperature_cfunc = ( - self._get_library_function("niDCPower_ReadCurrentTemperature") - ) - self.niDCPower_ReadCurrentTemperature_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViReal64), - ] # noqa: F405 - self.niDCPower_ReadCurrentTemperature_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niDCPower_ReadCurrentTemperature_cfunc = self._get_library_function('niDCPower_ReadCurrentTemperature') + self.niDCPower_ReadCurrentTemperature_cfunc.argtypes = [ViSession, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niDCPower_ReadCurrentTemperature_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_ReadCurrentTemperature_cfunc(vi, temperature) def niDCPower_ResetDevice(self, vi): # noqa: N802 with self._func_lock: if self.niDCPower_ResetDevice_cfunc is None: - self.niDCPower_ResetDevice_cfunc = self._get_library_function( - "niDCPower_ResetDevice" - ) + self.niDCPower_ResetDevice_cfunc = self._get_library_function('niDCPower_ResetDevice') self.niDCPower_ResetDevice_cfunc.argtypes = [ViSession] # noqa: F405 self.niDCPower_ResetDevice_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_ResetDevice_cfunc(vi) @@ -943,215 +440,95 @@ def niDCPower_ResetDevice(self, vi): # noqa: N802 def niDCPower_ResetWithChannels(self, vi, channel_name): # noqa: N802 with self._func_lock: if self.niDCPower_ResetWithChannels_cfunc is None: - self.niDCPower_ResetWithChannels_cfunc = self._get_library_function( - "niDCPower_ResetWithChannels" - ) - self.niDCPower_ResetWithChannels_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDCPower_ResetWithChannels_cfunc = self._get_library_function('niDCPower_ResetWithChannels') + self.niDCPower_ResetWithChannels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 self.niDCPower_ResetWithChannels_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_ResetWithChannels_cfunc(vi, channel_name) def niDCPower_ResetWithDefaults(self, vi): # noqa: N802 with self._func_lock: if self.niDCPower_ResetWithDefaults_cfunc is None: - self.niDCPower_ResetWithDefaults_cfunc = self._get_library_function( - "niDCPower_ResetWithDefaults" - ) - self.niDCPower_ResetWithDefaults_cfunc.argtypes = [ - ViSession - ] # noqa: F405 + self.niDCPower_ResetWithDefaults_cfunc = self._get_library_function('niDCPower_ResetWithDefaults') + self.niDCPower_ResetWithDefaults_cfunc.argtypes = [ViSession] # noqa: F405 self.niDCPower_ResetWithDefaults_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_ResetWithDefaults_cfunc(vi) - def niDCPower_SendSoftwareEdgeTriggerWithChannels( - self, vi, channel_name, trigger - ): # noqa: N802 + def niDCPower_SendSoftwareEdgeTriggerWithChannels(self, vi, channel_name, trigger): # noqa: N802 with self._func_lock: if self.niDCPower_SendSoftwareEdgeTriggerWithChannels_cfunc is None: - self.niDCPower_SendSoftwareEdgeTriggerWithChannels_cfunc = ( - self._get_library_function( - "niDCPower_SendSoftwareEdgeTriggerWithChannels" - ) - ) - self.niDCPower_SendSoftwareEdgeTriggerWithChannels_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ] # noqa: F405 - self.niDCPower_SendSoftwareEdgeTriggerWithChannels_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_SendSoftwareEdgeTriggerWithChannels_cfunc( - vi, channel_name, trigger - ) - - def niDCPower_SetAttributeViBoolean( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + self.niDCPower_SendSoftwareEdgeTriggerWithChannels_cfunc = self._get_library_function('niDCPower_SendSoftwareEdgeTriggerWithChannels') + self.niDCPower_SendSoftwareEdgeTriggerWithChannels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32] # noqa: F405 + self.niDCPower_SendSoftwareEdgeTriggerWithChannels_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_SendSoftwareEdgeTriggerWithChannels_cfunc(vi, channel_name, trigger) + + def niDCPower_SetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niDCPower_SetAttributeViBoolean_cfunc is None: - self.niDCPower_SetAttributeViBoolean_cfunc = self._get_library_function( - "niDCPower_SetAttributeViBoolean" - ) - self.niDCPower_SetAttributeViBoolean_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViBoolean, - ] # noqa: F405 - self.niDCPower_SetAttributeViBoolean_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_SetAttributeViBoolean_cfunc( - vi, channel_name, attribute_id, attribute_value - ) - - def niDCPower_SetAttributeViInt32( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + self.niDCPower_SetAttributeViBoolean_cfunc = self._get_library_function('niDCPower_SetAttributeViBoolean') + self.niDCPower_SetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViBoolean] # noqa: F405 + self.niDCPower_SetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_SetAttributeViBoolean_cfunc(vi, channel_name, attribute_id, attribute_value) + + def niDCPower_SetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niDCPower_SetAttributeViInt32_cfunc is None: - self.niDCPower_SetAttributeViInt32_cfunc = self._get_library_function( - "niDCPower_SetAttributeViInt32" - ) - self.niDCPower_SetAttributeViInt32_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViInt32, - ] # noqa: F405 - self.niDCPower_SetAttributeViInt32_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_SetAttributeViInt32_cfunc( - vi, channel_name, attribute_id, attribute_value - ) - - def niDCPower_SetAttributeViInt64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + self.niDCPower_SetAttributeViInt32_cfunc = self._get_library_function('niDCPower_SetAttributeViInt32') + self.niDCPower_SetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32] # noqa: F405 + self.niDCPower_SetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_SetAttributeViInt32_cfunc(vi, channel_name, attribute_id, attribute_value) + + def niDCPower_SetAttributeViInt64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niDCPower_SetAttributeViInt64_cfunc is None: - self.niDCPower_SetAttributeViInt64_cfunc = self._get_library_function( - "niDCPower_SetAttributeViInt64" - ) - self.niDCPower_SetAttributeViInt64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViInt64, - ] # noqa: F405 - self.niDCPower_SetAttributeViInt64_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_SetAttributeViInt64_cfunc( - vi, channel_name, attribute_id, attribute_value - ) - - def niDCPower_SetAttributeViReal64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + self.niDCPower_SetAttributeViInt64_cfunc = self._get_library_function('niDCPower_SetAttributeViInt64') + self.niDCPower_SetAttributeViInt64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt64] # noqa: F405 + self.niDCPower_SetAttributeViInt64_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_SetAttributeViInt64_cfunc(vi, channel_name, attribute_id, attribute_value) + + def niDCPower_SetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niDCPower_SetAttributeViReal64_cfunc is None: - self.niDCPower_SetAttributeViReal64_cfunc = self._get_library_function( - "niDCPower_SetAttributeViReal64" - ) - self.niDCPower_SetAttributeViReal64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViReal64, - ] # noqa: F405 - self.niDCPower_SetAttributeViReal64_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_SetAttributeViReal64_cfunc( - vi, channel_name, attribute_id, attribute_value - ) - - def niDCPower_SetAttributeViString( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + self.niDCPower_SetAttributeViReal64_cfunc = self._get_library_function('niDCPower_SetAttributeViReal64') + self.niDCPower_SetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViReal64] # noqa: F405 + self.niDCPower_SetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_SetAttributeViReal64_cfunc(vi, channel_name, attribute_id, attribute_value) + + def niDCPower_SetAttributeViString(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niDCPower_SetAttributeViString_cfunc is None: - self.niDCPower_SetAttributeViString_cfunc = self._get_library_function( - "niDCPower_SetAttributeViString" - ) - self.niDCPower_SetAttributeViString_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niDCPower_SetAttributeViString_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_SetAttributeViString_cfunc( - vi, channel_name, attribute_id, attribute_value - ) - - def niDCPower_SetSequence( - self, vi, channel_name, values, source_delays, size - ): # noqa: N802 + self.niDCPower_SetAttributeViString_cfunc = self._get_library_function('niDCPower_SetAttributeViString') + self.niDCPower_SetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDCPower_SetAttributeViString_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_SetAttributeViString_cfunc(vi, channel_name, attribute_id, attribute_value) + + def niDCPower_SetSequence(self, vi, channel_name, values, source_delays, size): # noqa: N802 with self._func_lock: if self.niDCPower_SetSequence_cfunc is None: - self.niDCPower_SetSequence_cfunc = self._get_library_function( - "niDCPower_SetSequence" - ) - self.niDCPower_SetSequence_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViReal64), - ViUInt32, - ] # noqa: F405 + self.niDCPower_SetSequence_cfunc = self._get_library_function('niDCPower_SetSequence') + self.niDCPower_SetSequence_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ViUInt32] # noqa: F405 self.niDCPower_SetSequence_cfunc.restype = ViStatus # noqa: F405 - return self.niDCPower_SetSequence_cfunc( - vi, channel_name, values, source_delays, size - ) + return self.niDCPower_SetSequence_cfunc(vi, channel_name, values, source_delays, size) def niDCPower_UnlockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niDCPower_UnlockSession_cfunc is None: - self.niDCPower_UnlockSession_cfunc = self._get_library_function( - "niDCPower_UnlockSession" - ) - self.niDCPower_UnlockSession_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niDCPower_UnlockSession_cfunc = self._get_library_function('niDCPower_UnlockSession') + self.niDCPower_UnlockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niDCPower_UnlockSession_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_UnlockSession_cfunc(vi, caller_has_lock) - def niDCPower_WaitForEventWithChannels( - self, vi, channel_name, event_id, timeout - ): # noqa: N802 + def niDCPower_WaitForEventWithChannels(self, vi, channel_name, event_id, timeout): # noqa: N802 with self._func_lock: if self.niDCPower_WaitForEventWithChannels_cfunc is None: - self.niDCPower_WaitForEventWithChannels_cfunc = ( - self._get_library_function("niDCPower_WaitForEventWithChannels") - ) - self.niDCPower_WaitForEventWithChannels_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ViReal64, - ] # noqa: F405 - self.niDCPower_WaitForEventWithChannels_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDCPower_WaitForEventWithChannels_cfunc( - vi, channel_name, event_id, timeout - ) + self.niDCPower_WaitForEventWithChannels_cfunc = self._get_library_function('niDCPower_WaitForEventWithChannels') + self.niDCPower_WaitForEventWithChannels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViReal64] # noqa: F405 + self.niDCPower_WaitForEventWithChannels_cfunc.restype = ViStatus # noqa: F405 + return self.niDCPower_WaitForEventWithChannels_cfunc(vi, channel_name, event_id, timeout) def niDCPower_close(self, vi): # noqa: N802 with self._func_lock: if self.niDCPower_close_cfunc is None: - self.niDCPower_close_cfunc = self._get_library_function( - "niDCPower_close" - ) + self.niDCPower_close_cfunc = self._get_library_function('niDCPower_close') self.niDCPower_close_cfunc.argtypes = [ViSession] # noqa: F405 self.niDCPower_close_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_close_cfunc(vi) @@ -1159,29 +536,15 @@ def niDCPower_close(self, vi): # noqa: N802 def niDCPower_error_message(self, vi, error_code, error_message): # noqa: N802 with self._func_lock: if self.niDCPower_error_message_cfunc is None: - self.niDCPower_error_message_cfunc = self._get_library_function( - "niDCPower_error_message" - ) - self.niDCPower_error_message_cfunc.argtypes = [ - ViSession, - ViStatus, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDCPower_error_message_cfunc = self._get_library_function('niDCPower_error_message') + self.niDCPower_error_message_cfunc.argtypes = [ViSession, ViStatus, ctypes.POINTER(ViChar)] # noqa: F405 self.niDCPower_error_message_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_error_message_cfunc(vi, error_code, error_message) - def niDCPower_self_test( - self, vi, self_test_result, self_test_message - ): # noqa: N802 + def niDCPower_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 with self._func_lock: if self.niDCPower_self_test_cfunc is None: - self.niDCPower_self_test_cfunc = self._get_library_function( - "niDCPower_self_test" - ) - self.niDCPower_self_test_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt16), - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDCPower_self_test_cfunc = self._get_library_function('niDCPower_self_test') + self.niDCPower_self_test_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt16), ctypes.POINTER(ViChar)] # noqa: F405 self.niDCPower_self_test_cfunc.restype = ViStatus # noqa: F405 return self.niDCPower_self_test_cfunc(vi, self_test_result, self_test_message) diff --git a/generated/nidcpower/nidcpower/_library_singleton.py b/generated/nidcpower/nidcpower/_library_singleton.py index 48f6714c5..62fd03c29 100644 --- a/generated/nidcpower/nidcpower/_library_singleton.py +++ b/generated/nidcpower/nidcpower/_library_singleton.py @@ -12,36 +12,30 @@ _instance = None _instance_lock = threading.Lock() -_library_info = { - "Linux": {"64bit": {"name": "nidcpower", "type": "cdll"}}, - "Windows": { - "32bit": {"name": "nidcpower_32.dll", "type": "windll"}, - "64bit": {"name": "nidcpower_64.dll", "type": "cdll"}, - }, -} +_library_info = {'Linux': {'64bit': {'name': 'nidcpower', 'type': 'cdll'}}, + 'Windows': {'32bit': {'name': 'nidcpower_32.dll', 'type': 'windll'}, + '64bit': {'name': 'nidcpower_64.dll', 'type': 'cdll'}}} def _get_library_name(): try: - return ctypes.util.find_library( - _library_info[platform.system()][platform.architecture()[0]]["name"] - ) # We find and return full path to the DLL + return ctypes.util.find_library(_library_info[platform.system()][platform.architecture()[0]]['name']) # We find and return full path to the DLL except KeyError: raise errors.UnsupportedConfigurationError def _get_library_type(): try: - return _library_info[platform.system()][platform.architecture()[0]]["type"] + return _library_info[platform.system()][platform.architecture()[0]]['type'] except KeyError: raise errors.UnsupportedConfigurationError def get(): - """get + '''get Returns the library.Library singleton for nidcpower. - """ + ''' global _instance global _instance_lock @@ -49,12 +43,13 @@ def get(): if _instance is None: try: library_type = _get_library_type() - if library_type == "windll": + if library_type == 'windll': ctypes_library = ctypes.WinDLL(_get_library_name()) else: - assert library_type == "cdll" + assert library_type == 'cdll' ctypes_library = ctypes.CDLL(_get_library_name()) except OSError: raise errors.DriverNotInstalledError() _instance = _library.Library(ctypes_library) return _instance + diff --git a/generated/nidcpower/nidcpower/_visatype.py b/generated/nidcpower/nidcpower/_visatype.py index bf96c3cfb..02cc41d1b 100644 --- a/generated/nidcpower/nidcpower/_visatype.py +++ b/generated/nidcpower/nidcpower/_visatype.py @@ -2,9 +2,9 @@ import ctypes -"""Definitions of the VISA types used by the C API of the driver runtime. +'''Definitions of the VISA types used by the C API of the driver runtime. These are aliased directly to ctypes types so can be used directly to call into the library. -""" +''' ViChar = ctypes.c_char @@ -26,3 +26,4 @@ ViAttr = ViUInt32 ViConstString = ViString ViRsrc = ViString + diff --git a/generated/nidcpower/nidcpower/enums.py b/generated/nidcpower/nidcpower/enums.py index 4ad82e51d..ef5089b9e 100644 --- a/generated/nidcpower/nidcpower/enums.py +++ b/generated/nidcpower/nidcpower/enums.py @@ -6,99 +6,99 @@ class ApertureTimeUnits(Enum): SECONDS = 1028 - r""" + r''' Specifies aperture time in seconds. - """ + ''' POWER_LINE_CYCLES = 1029 - r""" + r''' Specifies aperture time in power line cycles (PLCs). - """ + ''' class AutoZero(Enum): OFF = 0 - r""" + r''' Disables auto zero. - """ + ''' ON = 1 - r""" + r''' Makes zero conversions for every measurement. - """ + ''' ONCE = 1024 - r""" + r''' Makes zero conversions following the first measurement after initiating the device. The device uses these zero conversions for the preceding measurement and future measurements until the device is reinitiated. - """ + ''' class AutorangeApertureTimeMode(Enum): AUTO = 1110 - r""" + r''' NI-DCPower optimizes the aperture time for the autorange algorithm based on the module range. - """ + ''' CUSTOM = 1111 - r""" + r''' The user specifies a minimum aperture time for the algorithm using the autorange_minimum_aperture_time property and the corresponding autorange_minimum_aperture_time_units property. - """ + ''' class AutorangeBehavior(Enum): UP_TO_LIMIT_THEN_DOWN = 1107 - r""" + r''' Go to limit range then range down as needed until measured value is within thresholds. - """ + ''' UP = 1108 - r""" + r''' go up one range when the upper threshold is reached. - """ + ''' UP_AND_DOWN = 1109 - r""" + r''' go up or down one range when the upper/lower threshold is reached. - """ + ''' class AutorangeThresholdMode(Enum): NORMAL = 1112 - r""" + r''' Thresholds are selected based on a balance between accuracy and hysteresis. - """ + ''' FAST_STEP = 1113 - r""" + r''' Optimized for faster changes in the measured signal. Thresholds are configured to be a smaller percentage of the range. - """ + ''' HIGH_HYSTERESIS = 1114 - r""" + r''' Optimized for noisy signals to minimize frequent and unpredictable range changes. Thresholds are configured to be a larger percentage of the range. - """ + ''' MEDIUM_HYSTERESIS = 1115 - r""" + r''' Optimized for noisy signals to minimize frequent and unpredictable range changes. Thresholds are configured to be a medium percentage of the range. - """ + ''' HOLD = 1116 - r""" + r''' Attempt to maintain the active range. Thresholds will favor the active range. - """ + ''' class ComplianceLimitSymmetry(Enum): SYMMETRIC = 0 - r""" + r''' Compliance limits are specified symmetrically about 0. - """ + ''' ASYMMETRIC = 1 - r""" + r''' Compliance limits can be specified asymmetrically with respect to 0. - """ + ''' class DCNoiseRejection(Enum): SECOND_ORDER = 1043 - r""" + r''' Second-order rejection of DC noise. - """ + ''' NORMAL = 1044 - r""" + r''' Normal rejection of DC noise. - """ + ''' class Event(Enum): @@ -112,171 +112,171 @@ class Event(Enum): class MeasureWhen(Enum): AUTOMATICALLY_AFTER_SOURCE_COMPLETE = 1025 - r""" + r''' Acquires a measurement after each Source Complete event completes. - """ + ''' ON_DEMAND = 1026 - r""" + r''' Acquires a measurement when the measure method or measure_multiple method is called. - """ + ''' ON_MEASURE_TRIGGER = 1027 - r""" + r''' Acquires a measurement when a Measure trigger is received. - """ + ''' class MeasurementTypes(Enum): CURRENT = 0 - r""" + r''' The device measures current. - """ + ''' VOLTAGE = 1 - r""" + r''' The device measures voltage. - """ + ''' class OutputCapacitance(Enum): LOW = 1010 - r""" + r''' Output Capacitance is low. - """ + ''' HIGH = 1011 - r""" + r''' Output Capacitance is high. - """ + ''' class OutputCutoffReason(Enum): ALL = -1 - r""" + r''' Queries any output cutoff condition; clears all output cutoff conditions. - """ + ''' VOLTAGE_OUTPUT_HIGH = 1 - r""" + r''' Queries or clears cutoff conditions when the output exceeded the high cutoff limit for voltage output. - """ + ''' VOLTAGE_OUTPUT_LOW = 2 - r""" + r''' Queries or clears cutoff conditions when the output fell below the low cutoff limit for voltage output. - """ + ''' CURRENT_MEASURE_HIGH = 4 - r""" + r''' Queries or clears cutoff conditions when the measured current exceeded the high cutoff limit for current output. - """ + ''' CURRENT_MEASURE_LOW = 8 - r""" + r''' Queries or clears cutoff conditions when the measured current fell below the low cutoff limit for current output. - """ + ''' VOLTAGE_CHANGE_HIGH = 16 - r""" + r''' Queries or clears cutoff conditions when the voltage slew rate increased beyond the positive change cutoff for voltage output. - """ + ''' VOLTAGE_CHANGE_LOW = 32 - r""" + r''' Queries or clears cutoff conditions when the voltage slew rate decreased beyond the negative change cutoff for voltage output. - """ + ''' CURRENT_CHANGE_HIGH = 64 - r""" + r''' Queries or clears cutoff conditions when the current slew rate increased beyond the positive change cutoff for current output. - """ + ''' CURRENT_CHANGE_LOW = 128 - r""" + r''' Queries or clears cutoff conditions when the current slew rate decreased beyond the negative change cutoff for current output. - """ + ''' class OutputFunction(Enum): DC_VOLTAGE = 1006 - r""" + r''' Sets the output method to DC voltage. - """ + ''' DC_CURRENT = 1007 - r""" + r''' Sets the output method to DC current. - """ + ''' PULSE_VOLTAGE = 1049 - r""" + r''' Sets the output method to pulse voltage. - """ + ''' PULSE_CURRENT = 1050 - r""" + r''' Sets the output method to pulse current. - """ + ''' class OutputStates(Enum): VOLTAGE = 0 - r""" + r''' The device maintains a constant voltage by adjusting the current - """ + ''' CURRENT = 1 - r""" + r''' The device maintains a constant current by adjusting the voltage. - """ + ''' class Polarity(Enum): HIGH = 1018 - r""" + r''' A high pulse occurs when the event is generated. The exported signal is low level both before and after the event is generated. - """ + ''' LOW = 1019 - r""" + r''' A low pulse occurs when the event is generated. The exported signal is high level both before and after the event is generated. - """ + ''' class PowerAllocationMode(Enum): DISABLED = 1058 - r""" + r''' The device attempts to source, on each active channel, the power that the present source configuration requires; NI-DCPower does not perform a sourcing power check. If the required power is greater than the maximum sourcing power, the device attempts to source the required amount and may shut down to prevent damage. - """ + ''' AUTOMATIC = 1059 - r""" + r''' The device attempts to source, on each active channel, the power that the present source configuration requires; NI-DCPower performs a sourcing power check. If the required power is greater than the maximum sourcing power, the device does not exceed the maximum power, and NI-DCPower returns an error. - """ + ''' MANUAL = 1060 - r""" + r''' The device attempts to source, on each active channel, the power you request with the requested_power_allocation property; NI-DCPower performs a sourcing power check. If the requested power is either less than the required power for the present source configuration or greater than the maximum sourcing power, the device does not exceed the requested or allowed power, respectively, and NI-DCPower returns an error. - """ + ''' class PowerSource(Enum): INTERNAL = 1003 - r""" + r''' Uses the PXI chassis power source. - """ + ''' AUXILIARY = 1004 - r""" + r''' Uses the auxiliary power source connected to the device. - """ + ''' AUTOMATIC = 1005 - r""" + r''' Uses the auxiliary power source if it is available; otherwise uses the PXI chassis power source. - """ + ''' class PowerSourceInUse(Enum): INTERNAL = 1003 - r""" + r''' Uses the PXI chassis power source. - """ + ''' AUXILIARY = 1004 - r""" + r''' Uses the auxiliary power source connected to the device. Only the NI PXI-4110, NI PXIe-4112, NI PXIe-4113, and NI PXI-4130 support this value. This is the only supported value for the NI PXIe-4112 and NI PXIe-4113. - """ + ''' class SelfCalibrationPersistence(Enum): KEEP_IN_MEMORY = 1045 - r""" + r''' Keep new self calibration values in memory only. - """ + ''' WRITE_TO_EEPROM = 1046 - r""" + r''' Write new self calibration values to hardware. - """ + ''' class SendSoftwareEdgeTriggerType(Enum): @@ -290,55 +290,55 @@ class SendSoftwareEdgeTriggerType(Enum): class Sense(Enum): LOCAL = 1008 - r""" + r''' Local sensing is selected. - """ + ''' REMOTE = 1009 - r""" + r''' Remote sensing is selected. - """ + ''' class SourceMode(Enum): SINGLE_POINT = 1020 - r""" + r''' The source unit applies a single source configuration. - """ + ''' SEQUENCE = 1021 - r""" + r''' The source unit applies a list of voltage or current configurations sequentially. - """ + ''' class TransientResponse(Enum): NORMAL = 1038 - r""" + r''' The output responds to changes in load at a normal speed. - """ + ''' FAST = 1039 - r""" + r''' The output responds to changes in load quickly. - """ + ''' SLOW = 1041 - r""" + r''' The output responds to changes in load slowly. - """ + ''' CUSTOM = 1042 - r""" + r''' The output responds to changes in load based on specified values. - """ + ''' class TriggerType(Enum): NONE = 1012 - r""" + r''' No trigger is configured. - """ + ''' DIGITAL_EDGE = 1014 - r""" + r''' The data operation starts when a digital edge is detected. - """ + ''' SOFTWARE_EDGE = 1015 - r""" + r''' The data operation starts when a software trigger occurs. - """ + ''' diff --git a/generated/nidcpower/nidcpower/errors.py b/generated/nidcpower/nidcpower/errors.py index 68216a70e..ffce9d274 100644 --- a/generated/nidcpower/nidcpower/errors.py +++ b/generated/nidcpower/nidcpower/errors.py @@ -7,103 +7,86 @@ def _is_success(code): - return code == 0 + return (code == 0) def _is_error(code): - return code < 0 + return (code < 0) def _is_warning(code): - return code > 0 + return (code > 0) class Error(Exception): - """Base error class for NI-DCPower""" + '''Base error class for NI-DCPower''' def __init__(self, message): super(Error, self).__init__(message) class DriverError(Error): - """An error originating from the NI-DCPower driver""" + '''An error originating from the NI-DCPower driver''' def __init__(self, code, description): - assert _is_error(code), "Should not raise Error if code is not fatal." + assert (_is_error(code)), "Should not raise Error if code is not fatal." self.code = code self.description = description super(DriverError, self).__init__(str(self.code) + ": " + self.description) class DriverWarning(Warning): - """A warning originating from the NI-DCPower driver""" + '''A warning originating from the NI-DCPower driver''' def __init__(self, code, description): - assert _is_warning(code), "Should not create Warning if code is not positive." - super(DriverWarning, self).__init__( - "Warning {0} occurred.\n\n{1}".format(code, description) - ) + assert (_is_warning(code)), "Should not create Warning if code is not positive." + super(DriverWarning, self).__init__('Warning {0} occurred.\n\n{1}'.format(code, description)) class UnsupportedConfigurationError(Error): - """An error due to using this module in an usupported platform.""" + '''An error due to using this module in an usupported platform.''' def __init__(self): - super(UnsupportedConfigurationError, self).__init__( - "System configuration is unsupported: " - + platform.architecture()[0] - + " " - + platform.system() - ) + super(UnsupportedConfigurationError, self).__init__('System configuration is unsupported: ' + platform.architecture()[0] + ' ' + platform.system()) class DriverNotInstalledError(Error): - """An error due to using this module without the driver runtime installed.""" + '''An error due to using this module without the driver runtime installed.''' def __init__(self): - super(DriverNotInstalledError, self).__init__( - "The NI-DCPower runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it." - ) + super(DriverNotInstalledError, self).__init__('The NI-DCPower runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it.') class DriverTooOldError(Error): - """An error due to using this module with an older version of the driver runtime.""" + '''An error due to using this module with an older version of the driver runtime.''' def __init__(self): - super(DriverTooOldError, self).__init__( - "A function was not found in the NI-DCPower runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it." - ) + super(DriverTooOldError, self).__init__('A function was not found in the NI-DCPower runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it.') class InvalidRepeatedCapabilityError(Error): - """An error due to an invalid character in a repeated capability""" + '''An error due to an invalid character in a repeated capability''' def __init__(self, invalid_character, invalid_string): - super(InvalidRepeatedCapabilityError, self).__init__( - "An invalid character ({0}) was found in repeated capability string ({1})".format( - invalid_character, invalid_string - ) - ) + super(InvalidRepeatedCapabilityError, self).__init__('An invalid character ({0}) was found in repeated capability string ({1})'.format(invalid_character, invalid_string)) class SelfTestError(Error): - """An error due to a failed self-test""" + '''An error due to a failed self-test''' def __init__(self, code, msg): self.code = code self.message = msg - super(SelfTestError, self).__init__( - "Self-test failed with code {0}: {1}".format(code, msg) - ) + super(SelfTestError, self).__init__('Self-test failed with code {0}: {1}'.format(code, msg)) def handle_error(session, code, ignore_warnings, is_error_handling): - """handle_error + '''handle_error Helper function for handling errors returned by nidcpower.Library. It calls back into the session to get the corresponding error description and raises if necessary. - """ + ''' if _is_success(code) or (_is_warning(code) and ignore_warnings): return @@ -111,7 +94,7 @@ def handle_error(session, code, ignore_warnings, is_error_handling): if is_error_handling: # The caller is in the midst of error handling and an error occurred. # Don't try to get the description or we'll start recursing until the stack overflows. - description = "" + description = '' else: description = session._get_error_description(code) @@ -120,3 +103,5 @@ def handle_error(session, code, ignore_warnings, is_error_handling): assert _is_warning(code) warnings.warn(DriverWarning(code, description)) + + diff --git a/generated/nidcpower/nidcpower/session.py b/generated/nidcpower/nidcpower/session.py index 1bf675943..8d6352138 100644 --- a/generated/nidcpower/nidcpower/session.py +++ b/generated/nidcpower/nidcpower/session.py @@ -2,7 +2,6 @@ # This file was generated import array # noqa: F401 import ctypes - # Used by @ivi_synchronized from functools import wraps @@ -17,24 +16,22 @@ # Used for __repr__ import pprint - pp = pprint.PrettyPrinter(indent=4) # Helper functions for creating ctypes needed for calling into the driver DLL def get_ctypes_pointer_for_buffer(value=None, library_type=None, size=None): if isinstance(value, array.array): - assert library_type is not None, "library_type is required for array.array" + assert library_type is not None, 'library_type is required for array.array' addr, _ = value.buffer_info() return ctypes.cast(addr, ctypes.POINTER(library_type)) elif str(type(value)).find("'numpy.ndarray'") != -1: import numpy - return numpy.ctypeslib.as_ctypes(value) elif isinstance(value, bytes): return ctypes.cast(value, ctypes.POINTER(library_type)) elif isinstance(value, list): - assert library_type is not None, "library_type is required for list" + assert library_type is not None, 'library_type is required for list' return (library_type * len(value))(*value) else: if library_type is not None and size is not None: @@ -74,7 +71,6 @@ def aux(*xs, **kws): session = xs[0] # parameter 0 is 'self' which is the session object with session.lock(): return f(*xs, **kws) - return aux @@ -95,34 +91,16 @@ def __init__(self, session, prefix, current_repeated_capability_list): self._session = session self._prefix = prefix # We need at least one element. If we get an empty list, make the one element an empty string - self._current_repeated_capability_list = ( - current_repeated_capability_list - if len(current_repeated_capability_list) > 0 - else [""] - ) + self._current_repeated_capability_list = current_repeated_capability_list if len(current_repeated_capability_list) > 0 else [''] # Now we know there is at lease one entry, so we look if it is an empty string or not - self._separator = ( - "/" if len(self._current_repeated_capability_list[0]) > 0 else "" - ) + self._separator = '/' if len(self._current_repeated_capability_list[0]) > 0 else '' def __getitem__(self, repeated_capability): - """Set/get properties or call methods with a repeated capability (i.e. channels)""" - rep_caps_list = _converters.convert_repeated_capabilities( - repeated_capability, self._prefix - ) - complete_rep_cap_list = [ - current_rep_cap + self._separator + rep_cap - for current_rep_cap in self._current_repeated_capability_list - for rep_cap in rep_caps_list - ] - - return _SessionBase( - vi=self._session._vi, - repeated_capability_list=complete_rep_cap_list, - library=self._session._library, - encoding=self._session._encoding, - freeze_it=True, - ) + '''Set/get properties or call methods with a repeated capability (i.e. channels)''' + rep_caps_list = _converters.convert_repeated_capabilities(repeated_capability, self._prefix) + complete_rep_cap_list = [current_rep_cap + self._separator + rep_cap for current_rep_cap in self._current_repeated_capability_list for rep_cap in rep_caps_list] + + return _SessionBase(vi=self._session._vi, repeated_capability_list=complete_rep_cap_list, library=self._session._library, encoding=self._session._encoding, freeze_it=True) # This is a very simple context manager we can use when we need to set/get attributes @@ -134,20 +112,20 @@ def __init__(self, session): def __enter__(self): self._repeated_capability_cache = self._session._repeated_capability - self._session._repeated_capability = "" + self._session._repeated_capability = '' def __exit__(self, exc_type, exc_value, traceback): self._session._repeated_capability = self._repeated_capability_cache class _SessionBase(object): - """Base class for all NI-DCPower sessions.""" + '''Base class for all NI-DCPower sessions.''' # This is needed during __init__. Without it, __setattr__ raises an exception _is_frozen = False active_advanced_sequence = _attributes.AttributeViString(1150074) - """Type: str + '''Type: str Specifies the advanced sequence to configure or generate. @@ -162,9 +140,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.active_advanced_sequence` - """ + ''' active_advanced_sequence_step = _attributes.AttributeViInt64(1150075) - """Type: int + '''Type: int Specifies the advanced sequence step to configure. @@ -179,9 +157,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.active_advanced_sequence_step` - """ + ''' actual_power_allocation = _attributes.AttributeViReal64(1150205) - """Type: float + '''Type: float Returns the power, in watts, the device is sourcing on each active channel if the power_allocation_mode property is set to PowerAllocationMode.AUTOMATIC or PowerAllocationMode.MANUAL. @@ -202,9 +180,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.actual_power_allocation` - """ + ''' aperture_time = _attributes.AttributeViReal64(1150058) - """Type: float + '''Type: float Specifies the measurement aperture time for the channel configuration. Aperture time is specified in the units set by the aperture_time_units property. for information about supported devices. @@ -222,11 +200,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.aperture_time` - """ - aperture_time_units = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.ApertureTimeUnits, 1150059 - ) - """Type: enums.ApertureTimeUnits + ''' + aperture_time_units = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ApertureTimeUnits, 1150059) + '''Type: enums.ApertureTimeUnits Specifies the units of the aperture_time property for the channel configuration. for information about supported devices. @@ -244,9 +220,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.aperture_time_units` - """ + ''' autorange = _attributes.AttributeViInt32(1150244) - """Type: bool + '''Type: bool Specifies whether the hardware automatically selects the best range to measure the signal. Note the highest range the algorithm uses is dependent on the corresponding limit range property. The algorithm the hardware uses can be controlled using the autorange_aperture_time_mode property. @@ -261,11 +237,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.autorange` - """ - autorange_aperture_time_mode = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.AutorangeApertureTimeMode, 1150246 - ) - """Type: enums.AutorangeApertureTimeMode + ''' + autorange_aperture_time_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.AutorangeApertureTimeMode, 1150246) + '''Type: enums.AutorangeApertureTimeMode Specifies whether the aperture time used for the measurement autorange algorithm is determined automatically or customized using the autorange_minimum_aperture_time property. @@ -280,11 +254,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.autorange_aperture_time_mode` - """ - autorange_behavior = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.AutorangeBehavior, 1150245 - ) - """Type: enums.AutorangeBehavior + ''' + autorange_behavior = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.AutorangeBehavior, 1150245) + '''Type: enums.AutorangeBehavior Specifies the algorithm the hardware uses for measurement autoranging. @@ -299,9 +271,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.autorange_behavior` - """ + ''' autorange_minimum_aperture_time = _attributes.AttributeViReal64(1150247) - """Type: float + '''Type: float Specifies the measurement autorange aperture time used for the measurement autorange algorithm. The aperture time is specified in the units set by the autorange_minimum_aperture_time_units property. This value will typically be smaller than the aperture time used for measurements. @@ -316,11 +288,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.autorange_minimum_aperture_time` - """ - autorange_minimum_aperture_time_units = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.ApertureTimeUnits, 1150248 - ) - """Type: enums.ApertureTimeUnits + ''' + autorange_minimum_aperture_time_units = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ApertureTimeUnits, 1150248) + '''Type: enums.ApertureTimeUnits Specifies the units of the autorange_minimum_aperture_time property. @@ -335,9 +305,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.autorange_minimum_aperture_time_units` - """ + ''' autorange_minimum_current_range = _attributes.AttributeViReal64(1150255) - """Type: float + '''Type: float Specifies the lowest range used during measurement autoranging. Limiting the lowest range used during autoranging can improve the speed of the autoranging algorithm and minimize frequent and unpredictable range changes for noisy signals. @@ -352,9 +322,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.autorange_minimum_current_range` - """ + ''' autorange_minimum_voltage_range = _attributes.AttributeViReal64(1150256) - """Type: float + '''Type: float Specifies the lowest range used during measurement autoranging. The maximum range used is range that includes the value specified in the compliance limit property. Limiting the lowest range used during autoranging can improve the speed of the autoranging algorithm and/or minimize thrashing between ranges for noisy signals. @@ -369,11 +339,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.autorange_minimum_voltage_range` - """ - autorange_threshold_mode = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.AutorangeThresholdMode, 1150257 - ) - """Type: enums.AutorangeThresholdMode + ''' + autorange_threshold_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.AutorangeThresholdMode, 1150257) + '''Type: enums.AutorangeThresholdMode Specifies thresholds used during autoranging to determine when range changing occurs. @@ -388,11 +356,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.autorange_threshold_mode` - """ - auto_zero = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.AutoZero, 1150055 - ) - """Type: enums.AutoZero + ''' + auto_zero = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.AutoZero, 1150055) + '''Type: enums.AutoZero Specifies the auto-zero method to use on the device. Refer to the NI PXI-4132 Measurement Configuration and Timing and Auto Zero topics for more information about how to configure your measurements. @@ -407,25 +373,23 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.auto_zero` - """ + ''' auxiliary_power_source_available = _attributes.AttributeViBoolean(1150002) - """Type: bool + '''Type: bool Indicates whether an auxiliary power source is connected to the device. A value of False may indicate that the auxiliary input fuse has blown. Refer to the Detecting Internal/Auxiliary Power topic in the NI DC Power Supplies and SMUs Help for more information about internal and auxiliary power. power source to generate power. Use the power_source_in_use property to retrieve this information. Note: This property does not necessarily indicate if the device is using the auxiliary - """ + ''' channel_count = _attributes.AttributeViInt32(1050203) - """Type: int + '''Type: int Indicates the number of channels that NI-DCPower supports for the instrument that was chosen when the current session was opened. For channel-based properties, the IVI engine maintains a separate cache value for each channel. - """ - compliance_limit_symmetry = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.ComplianceLimitSymmetry, 1150184 - ) - """Type: enums.ComplianceLimitSymmetry + ''' + compliance_limit_symmetry = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ComplianceLimitSymmetry, 1150184) + '''Type: enums.ComplianceLimitSymmetry Specifies whether compliance limits for current generation and voltage generation for the device are applied symmetrically about 0 V and 0 A or @@ -459,9 +423,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.compliance_limit_symmetry` - """ + ''' current_compensation_frequency = _attributes.AttributeViReal64(1150071) - """Type: float + '''Type: float The frequency at which a pole-zero pair is added to the system when the channel is in Constant Current mode. for information about supported devices. @@ -478,9 +442,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_compensation_frequency` - """ + ''' current_gain_bandwidth = _attributes.AttributeViReal64(1150070) - """Type: float + '''Type: float The frequency at which the unloaded loop gain extrapolates to 0 dB in the absence of additional poles and zeroes. This property takes effect when the channel is in Constant Current mode. for information about supported devices. @@ -497,9 +461,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_gain_bandwidth` - """ + ''' current_level = _attributes.AttributeViReal64(1150009) - """Type: float + '''Type: float Specifies the current level, in amps, that the device attempts to generate on the specified channel(s). This property is applicable only if the output_function property is set to OutputFunction.DC_CURRENT. @@ -517,9 +481,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_level` - """ + ''' current_level_autorange = _attributes.AttributeViInt32(1150017) - """Type: bool + '''Type: bool Specifies whether NI-DCPower automatically selects the current level range based on the desired current level for the specified channels. If you set this property to AutoZero.ON, NI-DCPower ignores any changes you make to the current_level_range property. If you change the current_level_autorange property from AutoZero.ON to AutoZero.OFF, NI-DCPower retains the last value the current_level_range property was set to (or the default value if the property was never set) and uses that value as the current level range. @@ -536,9 +500,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_level_autorange` - """ + ''' current_level_range = _attributes.AttributeViReal64(1150011) - """Type: float + '''Type: float Specifies the current level range, in amps, for the specified channel(s). The range defines the valid value to which the current level can be set. Use the current_level_autorange property to enable automatic selection of the current level range. @@ -557,9 +521,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_level_range` - """ + ''' current_limit = _attributes.AttributeViReal64(1250005) - """Type: float + '''Type: float Specifies the current limit, in amps, that the output cannot exceed when generating the desired voltage level on the specified channel(s). This property is applicable only if the output_function property is set to OutputFunction.DC_VOLTAGE and the compliance_limit_symmetry property is set to ComplianceLimitSymmetry.SYMMETRIC. @@ -577,9 +541,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_limit` - """ + ''' current_limit_autorange = _attributes.AttributeViInt32(1150016) - """Type: bool + '''Type: bool Specifies whether NI-DCPower automatically selects the current limit range based on the desired current limit for the specified channel(s). If you set this property to AutoZero.ON, NI-DCPower ignores any changes you make to the current_limit_range property. If you change this property from AutoZero.ON to AutoZero.OFF, NI-DCPower retains the last value the current_limit_range property was set to (or the default value if the property was never set) and uses that value as the current limit range. @@ -596,9 +560,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_limit_autorange` - """ + ''' current_limit_behavior = _attributes.AttributeViInt32(1250004) - """Type: int + '''Type: int Tip: This property can be set/get on specific channels within your :py:class:`nidcpower.Session` instance. @@ -609,9 +573,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_limit_behavior` - """ + ''' current_limit_high = _attributes.AttributeViReal64(1150187) - """Type: float + '''Type: float Specifies the maximum current, in amps, that the output can produce when generating the desired voltage on the specified channel(s). @@ -653,9 +617,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_limit_high` - """ + ''' current_limit_low = _attributes.AttributeViReal64(1150188) - """Type: float + '''Type: float Specifies the minimum current, in amps, that the output can produce when generating the desired voltage on the specified channel(s). @@ -697,9 +661,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_limit_low` - """ + ''' current_limit_range = _attributes.AttributeViReal64(1150004) - """Type: float + '''Type: float Specifies the current limit range, in amps, for the specified channel(s). The range defines the valid value to which the current limit can be set. Use the current_limit_autorange property to enable automatic selection of the current limit range. @@ -718,9 +682,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_limit_range` - """ + ''' current_pole_zero_ratio = _attributes.AttributeViReal64(1150072) - """Type: float + '''Type: float The ratio of the pole frequency to the zero frequency when the channel is in Constant Current mode. for information about supported devices. @@ -737,11 +701,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.current_pole_zero_ratio` - """ - dc_noise_rejection = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.DCNoiseRejection, 1150066 - ) - """Type: enums.DCNoiseRejection + ''' + dc_noise_rejection = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.DCNoiseRejection, 1150066) + '''Type: enums.DCNoiseRejection Determines the relative weighting of samples in a measurement. Refer to the NI PXIe-4140/4141 DC Noise Rejection, NI PXIe-4142/4143 DC Noise Rejection, or NI PXIe-4144/4145 DC Noise Rejection topic in the NI DC Power Supplies and SMUs Help for more information about noise rejection. for information about supported devices. @@ -758,9 +720,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.dc_noise_rejection` - """ + ''' digital_edge_measure_trigger_input_terminal = _attributes.AttributeViString(1150036) - """Type: str + '''Type: str Specifies the input terminal for the Measure trigger. This property is used only when the measure_trigger_type property is set to TriggerType.DIGITAL_EDGE. for this property. @@ -778,9 +740,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.digital_edge_measure_trigger_input_terminal` - """ + ''' digital_edge_pulse_trigger_input_terminal = _attributes.AttributeViString(1150097) - """Type: str + '''Type: str Specifies the input terminal for the Pulse trigger. This property is used only when the pulse_trigger_type property is set to digital edge. You can specify any valid input terminal for this property. Valid terminals are listed in Measurement & Automation Explorer under the Device Routes tab. @@ -797,11 +759,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.digital_edge_pulse_trigger_input_terminal` - """ - digital_edge_sequence_advance_trigger_input_terminal = ( - _attributes.AttributeViString(1150028) - ) - """Type: str + ''' + digital_edge_sequence_advance_trigger_input_terminal = _attributes.AttributeViString(1150028) + '''Type: str Specifies the input terminal for the Sequence Advance trigger. Use this property only when the sequence_advance_trigger_type property is set to TriggerType.DIGITAL_EDGE. the NI DC Power Supplies and SMUs Help for information about supported devices. @@ -819,11 +779,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.digital_edge_sequence_advance_trigger_input_terminal` - """ - digital_edge_shutdown_trigger_input_terminal = _attributes.AttributeViString( - 1150277 - ) - """Type: str + ''' + digital_edge_shutdown_trigger_input_terminal = _attributes.AttributeViString(1150277) + '''Type: str Specifies the input terminal for the Shutdown trigger. This property is used only when the shutdown_trigger_type property is set to digital edge. You can specify any valid input terminal for this property. Valid terminals are listed in Measurement & Automation Explorer under the Device Routes tab. @@ -840,9 +798,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.digital_edge_shutdown_trigger_input_terminal` - """ + ''' digital_edge_source_trigger_input_terminal = _attributes.AttributeViString(1150032) - """Type: str + '''Type: str Specifies the input terminal for the Source trigger. Use this property only when the source_trigger_type property is set to TriggerType.DIGITAL_EDGE. for information about supported devices. @@ -860,9 +818,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.digital_edge_source_trigger_input_terminal` - """ + ''' digital_edge_start_trigger_input_terminal = _attributes.AttributeViString(1150023) - """Type: str + '''Type: str Specifies the input terminal for the Start trigger. Use this property only when the start_trigger_type property is set to TriggerType.DIGITAL_EDGE. for information about supported devices. @@ -880,16 +838,16 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.digital_edge_start_trigger_input_terminal` - """ + ''' driver_setup = _attributes.AttributeViString(1050007) - """Type: str + '''Type: str Indicates the Driver Setup string that you specified when initializing the driver. Some cases exist where you must specify the instrument driver options at initialization time. An example of this case is specifying a particular device model from among a family of devices that the driver supports. This property is useful when simulating a device. You can specify the driver-specific options through the DriverSetup keyword in the optionsString parameter in the __init__ method or through the IVI Configuration Utility. You can specify driver-specific options through the DriverSetup keyword in the optionsString parameter in the __init__ method. If you do not specify a Driver Setup string, this property returns an empty string. - """ + ''' exported_measure_trigger_output_terminal = _attributes.AttributeViString(1150037) - """Type: str + '''Type: str Specifies the output terminal for exporting the Measure trigger. Refer to the Device Routes tab in Measurement & Automation Explorer for a list of the terminals available on your device. @@ -907,9 +865,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.exported_measure_trigger_output_terminal` - """ + ''' exported_pulse_trigger_output_terminal = _attributes.AttributeViString(1150098) - """Type: str + '''Type: str Specifies the output terminal for exporting the Pulse trigger. Refer to the Device Routes tab in Measurement & Automation Explorer for a list of the terminals available on your device. @@ -926,11 +884,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.exported_pulse_trigger_output_terminal` - """ - exported_sequence_advance_trigger_output_terminal = _attributes.AttributeViString( - 1150029 - ) - """Type: str + ''' + exported_sequence_advance_trigger_output_terminal = _attributes.AttributeViString(1150029) + '''Type: str Specifies the output terminal for exporting the Sequence Advance trigger. Refer to the Device Routes tab in Measurement & Automation Explorer for a list of the terminals available on your device. @@ -948,9 +904,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.exported_sequence_advance_trigger_output_terminal` - """ + ''' exported_source_trigger_output_terminal = _attributes.AttributeViString(1150033) - """Type: str + '''Type: str Specifies the output terminal for exporting the Source trigger. Refer to the Device Routes tab in MAX for a list of the terminals available on your device. @@ -968,9 +924,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.exported_source_trigger_output_terminal` - """ + ''' exported_start_trigger_output_terminal = _attributes.AttributeViString(1150024) - """Type: str + '''Type: str Specifies the output terminal for exporting the Start trigger. Refer to the Device Routes tab in Measurement & Automation Explorer (MAX) for a list of the terminals available on your device. @@ -988,9 +944,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.exported_start_trigger_output_terminal` - """ + ''' fetch_backlog = _attributes.AttributeViInt32(1150056) - """Type: int + '''Type: int Returns the number of measurements acquired that have not been fetched yet. @@ -1003,9 +959,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.fetch_backlog` - """ + ''' instrument_firmware_revision = _attributes.AttributeViString(1050510) - """Type: str + '''Type: str Contains the firmware revision information for the device you are currently using. @@ -1018,9 +974,9 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.instrument_firmware_revision` - """ + ''' instrument_manufacturer = _attributes.AttributeViString(1050511) - """Type: str + '''Type: str Contains the name of the manufacturer for the device you are currently using. @@ -1033,9 +989,9 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.instrument_manufacturer` - """ + ''' instrument_model = _attributes.AttributeViString(1050512) - """Type: str + '''Type: str Contains the model number or name of the device that you are currently using. @@ -1048,9 +1004,9 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.instrument_model` - """ + ''' interlock_input_open = _attributes.AttributeViBoolean(1150105) - """Type: bool + '''Type: bool Indicates whether the safety interlock circuit is open. Refer to the Safety Interlock topic in the NI DC Power Supplies and SMUs Help for more information about the safety interlock circuit. @@ -1067,22 +1023,22 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.interlock_input_open` - """ + ''' io_resource_descriptor = _attributes.AttributeViString(1050304) - """Type: str + '''Type: str Indicates the resource descriptor NI-DCPower uses to identify the physical device. If you initialize NI-DCPower with a logical name, this property contains the resource descriptor that corresponds to the entry in the IVI Configuration utility. If you initialize NI-DCPower with the resource descriptor, this property contains that value. - """ + ''' logical_name = _attributes.AttributeViString(1050305) - """Type: str + '''Type: str Contains the logical name you specified when opening the current IVI session. You can pass a logical name to the __init__ method. The IVI Configuration utility must contain an entry for the logical name. The logical name entry refers to a method section in the IVI Configuration file. The method section specifies a physical device and initial user options. - """ + ''' measure_buffer_size = _attributes.AttributeViInt32(1150077) - """Type: int + '''Type: int Specifies the number of samples that the active channel measurement buffer can hold. The default value is the maximum number of samples that a device is capable of recording in one second. @@ -1101,11 +1057,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.measure_buffer_size` - """ - measure_complete_event_delay = _attributes.AttributeViReal64TimeDeltaSeconds( - 1150046 - ) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + ''' + measure_complete_event_delay = _attributes.AttributeViReal64TimeDeltaSeconds(1150046) + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the amount of time to delay the generation of the Measure Complete event, in seconds. for information about supported devices. @@ -1123,9 +1077,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.measure_complete_event_delay` - """ + ''' measure_complete_event_output_terminal = _attributes.AttributeViString(1150047) - """Type: str + '''Type: str Specifies the output terminal for exporting the Measure Complete event. for information about supported devices. @@ -1142,11 +1096,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.measure_complete_event_output_terminal` - """ - measure_complete_event_pulse_polarity = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.Polarity, 1150044 - ) - """Type: enums.Polarity + ''' + measure_complete_event_pulse_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.Polarity, 1150044) + '''Type: enums.Polarity Specifies the behavior of the Measure Complete event. for information about supported devices. @@ -1163,9 +1115,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.measure_complete_event_pulse_polarity` - """ + ''' measure_complete_event_pulse_width = _attributes.AttributeViReal64(1150045) - """Type: float + '''Type: float Specifies the width of the Measure Complete event, in seconds. The minimum event pulse width value for PXI devices is 150 ns, and the minimum event pulse width value for PXI Express devices is 250 ns. @@ -1185,9 +1137,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.measure_complete_event_pulse_width` - """ + ''' measure_record_delta_time = _attributes.AttributeViReal64TimeDeltaSeconds(1150065) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds Queries the amount of time, in seconds, between between the start of two consecutive measurements in a measure record. Only query this property after the desired measurement settings are committed. for information about supported devices. @@ -1204,9 +1156,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.measure_record_delta_time` - """ + ''' measure_record_length = _attributes.AttributeViInt32(1150063) - """Type: int + '''Type: int Specifies how many measurements compose a measure record. When this property is set to a value greater than 1, the measure_when property must be set to MeasureWhen.AUTOMATICALLY_AFTER_SOURCE_COMPLETE or MeasureWhen.ON_MEASURE_TRIGGER. for information about supported devices. @@ -1225,9 +1177,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.measure_record_length` - """ + ''' measure_record_length_is_finite = _attributes.AttributeViBoolean(1150064) - """Type: bool + '''Type: bool Specifies whether to take continuous measurements. Call the abort method to stop continuous measurements. When this property is set to False and the source_mode property is set to SourceMode.SINGLE_POINT, the measure_when property must be set to MeasureWhen.AUTOMATICALLY_AFTER_SOURCE_COMPLETE or MeasureWhen.ON_MEASURE_TRIGGER. When this property is set to False and the source_mode property is set to SourceMode.SEQUENCE, the measure_when property must be set to MeasureWhen.ON_MEASURE_TRIGGER. for information about supported devices. @@ -1245,11 +1197,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.measure_record_length_is_finite` - """ - measure_trigger_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TriggerType, 1150034 - ) - """Type: enums.TriggerType + ''' + measure_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerType, 1150034) + '''Type: enums.TriggerType Specifies the behavior of the Measure trigger. for information about supported devices. @@ -1266,11 +1216,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.measure_trigger_type` - """ - measure_when = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.MeasureWhen, 1150057 - ) - """Type: enums.MeasureWhen + ''' + measure_when = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.MeasureWhen, 1150057) + '''Type: enums.MeasureWhen Specifies when the measure unit should acquire measurements. Unless this property is configured to MeasureWhen.ON_MEASURE_TRIGGER, the measure_trigger_type property is ignored. Refer to the Acquiring Measurements topic in the NI DC Power Supplies and SMUs Help for more information about how to configure your measurements. @@ -1285,9 +1233,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.measure_when` - """ + ''' merged_channels = _attributes.AttributeViStringRepeatedCapability(1150249) - """Type: str + '''Type: str Specifies the channel(s) to merge with a designated primary channel of an SMU in order to increase the maximum current you can source from the SMU. This property designates the merge channels to combine with a primary channel. To designate the primary channel, initialize the session to the primary channel only. @@ -1306,11 +1254,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.merged_channels` - """ - output_capacitance = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.OutputCapacitance, 1150014 - ) - """Type: enums.OutputCapacitance + ''' + output_capacitance = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.OutputCapacitance, 1150014) + '''Type: enums.OutputCapacitance Specifies whether to use a low or high capacitance on the output for the specified channel(s). for information about supported devices. @@ -1327,9 +1273,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_capacitance` - """ + ''' output_connected = _attributes.AttributeViBoolean(1150060) - """Type: bool + '''Type: bool Specifies whether the output relay is connected (closed) or disconnected (open). The output_enabled property does not change based on this property; they are independent of each other. about supported devices. @@ -1348,9 +1294,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_connected` - """ + ''' output_cutoff_current_change_limit_high = _attributes.AttributeViReal64(1150295) - """Type: float + '''Type: float Specifies a limit for positive current slew rate, in amps per microsecond, for output cutoff. If the current increases at a rate that exceeds this limit, the output is disconnected. @@ -1368,9 +1314,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_cutoff_current_change_limit_high` - """ + ''' output_cutoff_current_change_limit_low = _attributes.AttributeViReal64(1150239) - """Type: float + '''Type: float Specifies a limit for negative current slew rate, in amps per microsecond, for output cutoff. If the current decreases at a rate that exceeds this limit, the output is disconnected. @@ -1388,9 +1334,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_cutoff_current_change_limit_low` - """ + ''' output_cutoff_current_measure_limit_high = _attributes.AttributeViReal64(1150237) - """Type: float + '''Type: float Specifies a high limit current value, in amps, for output cutoff. If the measured current exceeds this limit, the output is disconnected. @@ -1408,9 +1354,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_cutoff_current_measure_limit_high` - """ + ''' output_cutoff_current_measure_limit_low = _attributes.AttributeViReal64(1150293) - """Type: float + '''Type: float Specifies a low limit current value, in amps, for output cutoff. If the measured current falls below this limit, the output is disconnected. @@ -1428,9 +1374,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_cutoff_current_measure_limit_low` - """ + ''' output_cutoff_current_overrange_enabled = _attributes.AttributeViBoolean(1150240) - """Type: bool + '''Type: bool Enables or disables current overrange functionality for output cutoff. If enabled, the output is disconnected when the measured current saturates the current range. @@ -1447,9 +1393,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_cutoff_current_overrange_enabled` - """ + ''' output_cutoff_delay = _attributes.AttributeViReal64TimeDeltaSeconds(1150300) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds Delays disconnecting the output by the time you specify, in seconds, when a limit is exceeded. @@ -1464,9 +1410,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_cutoff_delay` - """ + ''' output_cutoff_enabled = _attributes.AttributeViBoolean(1150235) - """Type: bool + '''Type: bool Enables or disables output cutoff functionality. If enabled, you can define output cutoffs that, if exceeded, cause the output of the specified channel(s) to be disconnected. When this property is disabled, all other output cutoff properties are ignored. @@ -1482,9 +1428,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_cutoff_enabled` - """ + ''' output_cutoff_voltage_change_limit_high = _attributes.AttributeViReal64(1150294) - """Type: float + '''Type: float Specifies a limit for positive voltage slew rate, in volts per microsecond, for output cutoff. If the voltage increases at a rate that exceeds this limit, the output is disconnected. @@ -1502,9 +1448,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_cutoff_voltage_change_limit_high` - """ + ''' output_cutoff_voltage_change_limit_low = _attributes.AttributeViReal64(1150238) - """Type: float + '''Type: float Specifies a limit for negative voltage slew rate, in volts per microsecond, for output cutoff. If the voltage decreases at a rate that exceeds this limit, the output is disconnected. @@ -1522,9 +1468,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_cutoff_voltage_change_limit_low` - """ + ''' output_cutoff_voltage_output_limit_high = _attributes.AttributeViReal64(1150236) - """Type: float + '''Type: float Specifies a high limit voltage value, in volts, for output cutoff. If the voltage output exceeds this limit, the output is disconnected. @@ -1542,9 +1488,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_cutoff_voltage_output_limit_high` - """ + ''' output_cutoff_voltage_output_limit_low = _attributes.AttributeViReal64(1150292) - """Type: float + '''Type: float Specifies a low limit voltage value, in volts, for output cutoff. If the voltage output falls below this limit, the output is disconnected. @@ -1562,9 +1508,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_cutoff_voltage_output_limit_low` - """ + ''' output_enabled = _attributes.AttributeViBoolean(1250006) - """Type: bool + '''Type: bool Specifies whether the output is enabled (True) or disabled (False). Depending on the value you specify for the output_function property, you also must set the voltage level or current level in addition to enabling the output @@ -1582,11 +1528,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_enabled` - """ - output_function = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.OutputFunction, 1150008 - ) - """Type: enums.OutputFunction + ''' + output_function = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.OutputFunction, 1150008) + '''Type: enums.OutputFunction Configures the method to generate on the specified channel(s). When OutputFunction.DC_VOLTAGE is selected, the device generates the desired voltage level on the output as long as the output current is below the current limit. You can use the following properties to configure the channel when OutputFunction.DC_VOLTAGE is selected: @@ -1615,9 +1559,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_function` - """ + ''' output_resistance = _attributes.AttributeViReal64(1150061) - """Type: float + '''Type: float Specifies the output resistance that the device attempts to generate for the specified channel(s). This property is available only when you set the output_function property on a support device. Refer to a supported device's topic about output resistance for more information about selecting an output resistance. about supported devices. @@ -1634,9 +1578,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.output_resistance` - """ + ''' overranging_enabled = _attributes.AttributeViBoolean(1150007) - """Type: bool + '''Type: bool Specifies whether NI-DCPower allows setting the voltage level, current level, voltage limit and current limit outside the device specification limits. True means that overranging is enabled. Refer to the Ranges topic in the NI DC Power Supplies and SMUs Help for more information about overranging. @@ -1651,9 +1595,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.overranging_enabled` - """ + ''' ovp_enabled = _attributes.AttributeViBoolean(1250002) - """Type: bool + '''Type: bool Enables (True) or disables (False) overvoltage protection (OVP). Refer to the Output Overvoltage Protection topic in the NI DC Power Supplies and SMUs Help for more information about overvoltage protection. @@ -1671,9 +1615,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.ovp_enabled` - """ + ''' ovp_limit = _attributes.AttributeViReal64(1250003) - """Type: float + '''Type: float Determines the voltage limit, in volts, beyond which overvoltage protection (OVP) engages. for information about supported devices. @@ -1691,11 +1635,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.ovp_limit` - """ - power_allocation_mode = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.PowerAllocationMode, 1150207 - ) - """Type: enums.PowerAllocationMode + ''' + power_allocation_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.PowerAllocationMode, 1150207) + '''Type: enums.PowerAllocationMode Determines whether the device sources the power its source configuration requires or a specific wattage you request; determines whether NI-DCPower proactively checks that this sourcing power is within the maximum per-channel and overall sourcing power of the device. @@ -1716,9 +1658,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.power_allocation_mode` - """ + ''' power_line_frequency = _attributes.AttributeViReal64(1150020) - """Type: float + '''Type: float Specifies the power line frequency for specified channel(s). NI-DCPower uses this value to select a timebase for setting the aperture_time property in power line cycles (PLCs). in the NI DC Power Supplies and SMUs Help for information about supported devices. @@ -1738,27 +1680,23 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.power_line_frequency` - """ - power_source = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.PowerSource, 1150000 - ) - """Type: enums.PowerSource + ''' + power_source = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.PowerSource, 1150000) + '''Type: enums.PowerSource Specifies the power source to use. NI-DCPower switches the power source used by the device to the specified value. Default Value: PowerSource.AUTOMATIC is set to PowerSource.AUTOMATIC. However, if the session is in the Committed or Uncommitted state when you set this property, the power source selection only occurs after you call the initiate method. Note: Automatic selection is not persistent and occurs only at the time this property - """ - power_source_in_use = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.PowerSourceInUse, 1150001 - ) - """Type: enums.PowerSourceInUse + ''' + power_source_in_use = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.PowerSourceInUse, 1150001) + '''Type: enums.PowerSourceInUse Indicates whether the device is using the internal or auxiliary power source to generate power. - """ + ''' pulse_bias_current_level = _attributes.AttributeViReal64(1150088) - """Type: float + '''Type: float Specifies the pulse bias current level, in amps, that the device attempts to generate on the specified channel(s) during the off phase of a pulse. This property is applicable only if the output_function property is set to OutputFunction.PULSE_CURRENT. @@ -1775,9 +1713,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_bias_current_level` - """ + ''' pulse_bias_current_limit = _attributes.AttributeViReal64(1150083) - """Type: float + '''Type: float Specifies the pulse bias current limit, in amps, that the output cannot exceed when generating the desired pulse bias voltage on the specified channel(s) during the off phase of a pulse. This property is applicable only if the output_function property is set to OutputFunction.PULSE_VOLTAGE. @@ -1794,9 +1732,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_bias_current_limit` - """ + ''' pulse_bias_current_limit_high = _attributes.AttributeViReal64(1150195) - """Type: float + '''Type: float Specifies the maximum current, in amps, that the output can produce when generating the desired pulse voltage on the specified channel(s) during @@ -1841,9 +1779,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_bias_current_limit_high` - """ + ''' pulse_bias_current_limit_low = _attributes.AttributeViReal64(1150196) - """Type: float + '''Type: float Specifies the minimum current, in amps, that the output can produce when generating the desired pulse voltage on the specified channel(s) during @@ -1888,9 +1826,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_bias_current_limit_low` - """ + ''' pulse_bias_delay = _attributes.AttributeViReal64(1150092) - """Type: float + '''Type: float Determines when, in seconds, the device generates the Pulse Complete event after generating the off level of a pulse. Valid Values: 0 to 167 seconds @@ -1907,9 +1845,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_bias_delay` - """ + ''' pulse_bias_voltage_level = _attributes.AttributeViReal64(1150082) - """Type: float + '''Type: float Specifies the pulse bias voltage level, in volts, that the device attempts to generate on the specified channel(s) during the off phase of a pulse. This property is applicable only if the output_function property is set to OutputFunction.PULSE_VOLTAGE. @@ -1926,9 +1864,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_bias_voltage_level` - """ + ''' pulse_bias_voltage_limit = _attributes.AttributeViReal64(1150089) - """Type: float + '''Type: float Specifies the pulse voltage limit, in volts, that the output cannot exceed when generating the desired current on the specified channel(s) during the off phase of a pulse. This property is applicable only if the output_function property is set to OutputFunction.PULSE_CURRENT. @@ -1945,9 +1883,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_bias_voltage_limit` - """ + ''' pulse_bias_voltage_limit_high = _attributes.AttributeViReal64(1150191) - """Type: float + '''Type: float Specifies the maximum voltage, in volts, that the output can produce when generating the desired pulse current on the specified channel(s) @@ -1992,9 +1930,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_bias_voltage_limit_high` - """ + ''' pulse_bias_voltage_limit_low = _attributes.AttributeViReal64(1150192) - """Type: float + '''Type: float Specifies the minimum voltage, in volts, that the output can produce when generating the desired pulse current on the specified channel(s) @@ -2039,9 +1977,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_bias_voltage_limit_low` - """ + ''' pulse_complete_event_output_terminal = _attributes.AttributeViString(1150099) - """Type: str + '''Type: str Specifies the output terminal for exporting the Pulse Complete event. Output terminals can be specified in one of two ways. If the device is named Dev1 and your terminal is PXI_Trig0, you can specify the terminal with the fully qualified terminal name, /Dev1/PXI_Trig0, or with the shortened terminal name, PXI_Trig0. @@ -2058,11 +1996,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_complete_event_output_terminal` - """ - pulse_complete_event_pulse_polarity = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.Polarity, 1150100 - ) - """Type: enums.Polarity + ''' + pulse_complete_event_pulse_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.Polarity, 1150100) + '''Type: enums.Polarity Specifies the behavior of the Pulse Complete event. Default Value: Polarity.HIGH @@ -2078,9 +2014,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_complete_event_pulse_polarity` - """ + ''' pulse_complete_event_pulse_width = _attributes.AttributeViReal64(1150101) - """Type: float + '''Type: float Specifies the width of the Pulse Complete event, in seconds. The minimum event pulse width value for PXI Express devices is 250 ns. @@ -2098,9 +2034,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_complete_event_pulse_width` - """ + ''' pulse_current_level = _attributes.AttributeViReal64(1150086) - """Type: float + '''Type: float Specifies the pulse current level, in amps, that the device attempts to generate on the specified channel(s) during the on phase of a pulse. This property is applicable only if the output_function property is set to OutputFunction.PULSE_CURRENT. @@ -2117,9 +2053,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_current_level` - """ + ''' pulse_current_level_range = _attributes.AttributeViReal64(1150090) - """Type: float + '''Type: float Specifies the pulse current level range, in amps, for the specified channel(s). The range defines the valid values to which you can set the pulse current level and pulse bias current level. @@ -2137,9 +2073,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_current_level_range` - """ + ''' pulse_current_limit = _attributes.AttributeViReal64(1150081) - """Type: float + '''Type: float Specifies the pulse current limit, in amps, that the output cannot exceed when generating the desired pulse voltage on the specified channel(s) during the on phase of a pulse. This property is applicable only if the output_function property is set to OutputFunction.PULSE_VOLTAGE and the compliance_limit_symmetry property is set to ComplianceLimitSymmetry.SYMMETRIC. @@ -2156,9 +2092,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_current_limit` - """ + ''' pulse_current_limit_high = _attributes.AttributeViReal64(1150193) - """Type: float + '''Type: float Specifies the maximum current, in amps, that the output can produce when generating the desired pulse voltage on the specified channel(s) during @@ -2203,9 +2139,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_current_limit_high` - """ + ''' pulse_current_limit_low = _attributes.AttributeViReal64(1150194) - """Type: float + '''Type: float Specifies the minimum current, in amps, that the output can produce when generating the desired pulse voltage on the specified channel(s) during @@ -2250,9 +2186,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_current_limit_low` - """ + ''' pulse_current_limit_range = _attributes.AttributeViReal64(1150085) - """Type: float + '''Type: float Specifies the pulse current limit range, in amps, for the specified channel(s). The range defines the valid values to which you can set the pulse current limit and pulse bias current limit. @@ -2270,9 +2206,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_current_limit_range` - """ + ''' pulse_off_time = _attributes.AttributeViReal64TimeDeltaSeconds(1150094) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds Determines the length, in seconds, of the off phase of a pulse. Valid Values: 10 microseconds to 167 seconds @@ -2289,9 +2225,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_off_time` - """ + ''' pulse_on_time = _attributes.AttributeViReal64TimeDeltaSeconds(1150093) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds Determines the length, in seconds, of the on phase of a pulse. Valid Values: 10 microseconds to 167 seconds @@ -2308,11 +2244,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_on_time` - """ - pulse_trigger_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TriggerType, 1150095 - ) - """Type: enums.TriggerType + ''' + pulse_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerType, 1150095) + '''Type: enums.TriggerType Specifies the behavior of the Pulse trigger. Default Value: TriggerType.NONE @@ -2328,9 +2262,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_trigger_type` - """ + ''' pulse_voltage_level = _attributes.AttributeViReal64(1150080) - """Type: float + '''Type: float Specifies the pulse current limit, in amps, that the output cannot exceed when generating the desired pulse voltage on the specified channel(s) during the on phase of a pulse. This property is applicable only if the output_function property is set to OutputFunction.PULSE_VOLTAGE. @@ -2347,9 +2281,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_voltage_level` - """ + ''' pulse_voltage_level_range = _attributes.AttributeViReal64(1150084) - """Type: float + '''Type: float Specifies the pulse voltage level range, in volts, for the specified channel(s). The range defines the valid values at which you can set the pulse voltage level and pulse bias voltage level. @@ -2367,9 +2301,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_voltage_level_range` - """ + ''' pulse_voltage_limit = _attributes.AttributeViReal64(1150087) - """Type: float + '''Type: float Specifies the pulse voltage limit, in volts, that the output cannot exceed when generating the desired pulse current on the specified channel(s) during the on phase of a pulse. This property is applicable only if the output_function property is set to OutputFunction.PULSE_CURRENT and the compliance_limit_symmetry property is set to ComplianceLimitSymmetry.SYMMETRIC. @@ -2386,9 +2320,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_voltage_limit` - """ + ''' pulse_voltage_limit_high = _attributes.AttributeViReal64(1150189) - """Type: float + '''Type: float Specifies the maximum voltage, in volts, that the output can produce when generating the desired pulse current on the specified channel(s) @@ -2433,9 +2367,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_voltage_limit_high` - """ + ''' pulse_voltage_limit_low = _attributes.AttributeViReal64(1150190) - """Type: float + '''Type: float Specifies the minimum voltage, in volts, that the output can produce when generating the desired pulse current on the specified channel(s) @@ -2480,9 +2414,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_voltage_limit_low` - """ + ''' pulse_voltage_limit_range = _attributes.AttributeViReal64(1150091) - """Type: float + '''Type: float Specifies the pulse voltage limit range, in volts, for the specified channel(s). The range defines the valid values to which you can set the pulse voltage limit and pulse bias voltage limit. @@ -2500,20 +2434,18 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.pulse_voltage_limit_range` - """ + ''' query_instrument_status = _attributes.AttributeViBoolean(1050003) - """Type: bool + '''Type: bool Specifies whether NI-DCPower queries the device status after each operation. Querying the device status is useful for debugging. After you validate your program, you can set this property to False to disable status checking and maximize performance. NI-DCPower ignores status checking for particular properties regardless of the setting of this property. Use the __init__ method to override this value. Default Value: True - """ - ready_for_pulse_trigger_event_output_terminal = _attributes.AttributeViString( - 1150102 - ) - """Type: str + ''' + ready_for_pulse_trigger_event_output_terminal = _attributes.AttributeViString(1150102) + '''Type: str Specifies the output terminal for exporting the Ready For Pulse Trigger event. Output terminals can be specified in one of two ways. If the device is named Dev1 and your terminal is PXI_Trig0, you can specify the terminal with the fully qualified terminal name, /Dev1/PXI_Trig0, or with the shortened terminal name, PXI_Trig0. @@ -2529,11 +2461,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.ready_for_pulse_trigger_event_output_terminal` - """ - ready_for_pulse_trigger_event_pulse_polarity = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.Polarity, 1150103 - ) - """Type: enums.Polarity + ''' + ready_for_pulse_trigger_event_pulse_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.Polarity, 1150103) + '''Type: enums.Polarity Specifies the behavior of the Ready For Pulse Trigger event. Default Value: Polarity.HIGH @@ -2549,9 +2479,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.ready_for_pulse_trigger_event_pulse_polarity` - """ + ''' ready_for_pulse_trigger_event_pulse_width = _attributes.AttributeViReal64(1150104) - """Type: float + '''Type: float Specifies the width of the Ready For Pulse Trigger event, in seconds. The minimum event pulse width value for PXI Express devices is 250 ns. @@ -2569,9 +2499,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.ready_for_pulse_trigger_event_pulse_width` - """ + ''' requested_power_allocation = _attributes.AttributeViReal64(1150206) - """Type: float + '''Type: float Specifies the power, in watts, to request the device to source from each active channel. This property defines the power to source from the device only if the power_allocation_mode property is set to PowerAllocationMode.MANUAL. @@ -2594,9 +2524,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.requested_power_allocation` - """ + ''' reset_average_before_measurement = _attributes.AttributeViBoolean(1150006) - """Type: bool + '''Type: bool Specifies whether the measurement returned from any measurement call starts with a new measurement call (True) or returns a measurement that has already begun or completed(False). for information about supported devices. @@ -2614,9 +2544,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.reset_average_before_measurement` - """ + ''' samples_to_average = _attributes.AttributeViInt32(1150003) - """Type: int + '''Type: int Specifies the number of samples to average when you take a measurement. Increasing the number of samples to average decreases measurement noise but increases the time required to take a measurement. Refer to the NI PXI-4110, NI PXI-4130, NI PXI-4132, or NI PXIe-4154 Averaging topic for optional property settings to improve immunity to certain noise types, or refer to the NI PXIe-4140/4141 DC Noise Rejection, NI PXIe-4142/4143 DC Noise Rejection, or NI PXIe-4144/4145 DC Noise Rejection topic for information about improving noise immunity for those devices. @@ -2639,11 +2569,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.samples_to_average` - """ - self_calibration_persistence = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.SelfCalibrationPersistence, 1150073 - ) - """Type: enums.SelfCalibrationPersistence + ''' + self_calibration_persistence = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.SelfCalibrationPersistence, 1150073) + '''Type: enums.SelfCalibrationPersistence Specifies whether the values calculated during self-calibration should be written to hardware to be used until the next self-calibration or only used until the reset_device method is called or the machine is powered down. This property affects the behavior of the self_cal method. When set to SelfCalibrationPersistence.KEEP_IN_MEMORY, the values calculated by the self_cal method are used in the existing session, as well as in all further sessions until you call the reset_device method or restart the machine. When you set this property to SelfCalibrationPersistence.WRITE_TO_EEPROM, the values calculated by the self_cal method are written to hardware and used in the existing session and in all subsequent sessions until another call to the self_cal method is made. @@ -2661,11 +2589,9 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.self_calibration_persistence` - """ - sense = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.Sense, 1150013 - ) - """Type: enums.Sense + ''' + sense = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.Sense, 1150013) + '''Type: enums.Sense Selects either local or remote sensing of the output voltage for the specified channel(s). Refer to the Local and Remote Sense topic in the NI DC Power Supplies and SMUs Help for more information about sensing voltage on supported channels and about devices that support local and/or remote sensing. @@ -2680,11 +2606,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sense` - """ - sequence_advance_trigger_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TriggerType, 1150026 - ) - """Type: enums.TriggerType + ''' + sequence_advance_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerType, 1150026) + '''Type: enums.TriggerType Specifies the behavior of the Sequence Advance trigger. for information about supported devices. @@ -2701,9 +2625,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sequence_advance_trigger_type` - """ + ''' sequence_engine_done_event_output_terminal = _attributes.AttributeViString(1150050) - """Type: str + '''Type: str Specifies the output terminal for exporting the Sequence Engine Done Complete event. for information about supported devices. @@ -2720,11 +2644,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sequence_engine_done_event_output_terminal` - """ - sequence_engine_done_event_pulse_polarity = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.Polarity, 1150048 - ) - """Type: enums.Polarity + ''' + sequence_engine_done_event_pulse_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.Polarity, 1150048) + '''Type: enums.Polarity Specifies the behavior of the Sequence Engine Done event. for information about supported devices. @@ -2741,9 +2663,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sequence_engine_done_event_pulse_polarity` - """ + ''' sequence_engine_done_event_pulse_width = _attributes.AttributeViReal64(1150049) - """Type: float + '''Type: float Specifies the width of the Sequence Engine Done event, in seconds. The minimum event pulse width value for PXI devices is 150 ns, and the minimum event pulse width value for PXI Express devices is 250 ns. @@ -2763,11 +2685,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sequence_engine_done_event_pulse_width` - """ - sequence_iteration_complete_event_output_terminal = _attributes.AttributeViString( - 1150040 - ) - """Type: str + ''' + sequence_iteration_complete_event_output_terminal = _attributes.AttributeViString(1150040) + '''Type: str Specifies the output terminal for exporting the Sequence Iteration Complete event. for information about supported devices. @@ -2784,11 +2704,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sequence_iteration_complete_event_output_terminal` - """ - sequence_iteration_complete_event_pulse_polarity = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.Polarity, 1150038 - ) - """Type: enums.Polarity + ''' + sequence_iteration_complete_event_pulse_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.Polarity, 1150038) + '''Type: enums.Polarity Specifies the behavior of the Sequence Iteration Complete event. for information about supported devices. @@ -2805,11 +2723,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sequence_iteration_complete_event_pulse_polarity` - """ - sequence_iteration_complete_event_pulse_width = _attributes.AttributeViReal64( - 1150039 - ) - """Type: float + ''' + sequence_iteration_complete_event_pulse_width = _attributes.AttributeViReal64(1150039) + '''Type: float Specifies the width of the Sequence Iteration Complete event, in seconds. The minimum event pulse width value for PXI devices is 150 ns, and the minimum event pulse width value for PXI Express devices is 250 ns. @@ -2829,9 +2745,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sequence_iteration_complete_event_pulse_width` - """ + ''' sequence_loop_count = _attributes.AttributeViInt32(1150025) - """Type: int + '''Type: int Specifies the number of times a sequence is run after initiation. Refer to the Sequence Source Mode topic in the NI DC Power Supplies and SMUs Help for more information about the sequence loop count. @@ -2850,9 +2766,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sequence_loop_count` - """ + ''' sequence_loop_count_is_finite = _attributes.AttributeViBoolean(1150078) - """Type: bool + '''Type: bool Specifies whether a sequence should repeat indefinitely. Refer to the Sequence Source Mode topic in the NI DC Power Supplies and SMUs Help for more information about infinite sequencing. @@ -2870,9 +2786,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sequence_loop_count_is_finite` - """ + ''' sequence_step_delta_time = _attributes.AttributeViReal64(1150198) - """Type: float + '''Type: float Tip: This property can be set/get on specific channels within your :py:class:`nidcpower.Session` instance. @@ -2883,9 +2799,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sequence_step_delta_time` - """ + ''' sequence_step_delta_time_enabled = _attributes.AttributeViBoolean(1150199) - """Type: bool + '''Type: bool Tip: This property can be set/get on specific channels within your :py:class:`nidcpower.Session` instance. @@ -2896,9 +2812,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.sequence_step_delta_time_enabled` - """ + ''' serial_number = _attributes.AttributeViString(1150152) - """Type: str + '''Type: str Contains the serial number for the device you are currently using. @@ -2911,11 +2827,9 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.serial_number` - """ - shutdown_trigger_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TriggerType, 1150275 - ) - """Type: enums.TriggerType + ''' + shutdown_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerType, 1150275) + '''Type: enums.TriggerType Specifies the behavior of the Shutdown trigger. Default Value: TriggerType.NONE @@ -2931,15 +2845,15 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.shutdown_trigger_type` - """ + ''' simulate = _attributes.AttributeViBoolean(1050005) - """Type: bool + '''Type: bool Specifies whether to simulate NI-DCPower I/O operations. True specifies that operation is simulated. Default Value: False - """ + ''' source_complete_event_output_terminal = _attributes.AttributeViString(1150043) - """Type: str + '''Type: str Specifies the output terminal for exporting the Source Complete event. for information about supported devices. @@ -2956,11 +2870,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.source_complete_event_output_terminal` - """ - source_complete_event_pulse_polarity = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.Polarity, 1150041 - ) - """Type: enums.Polarity + ''' + source_complete_event_pulse_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.Polarity, 1150041) + '''Type: enums.Polarity Specifies the behavior of the Source Complete event. for information about supported devices. @@ -2977,9 +2889,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.source_complete_event_pulse_polarity` - """ + ''' source_complete_event_pulse_width = _attributes.AttributeViReal64(1150042) - """Type: float + '''Type: float Specifies the width of the Source Complete event, in seconds. for information about supported devices. @@ -2999,9 +2911,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.source_complete_event_pulse_width` - """ + ''' source_delay = _attributes.AttributeViReal64TimeDeltaSeconds(1150051) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds Determines when, in seconds, the device generates the Source Complete event, potentially starting a measurement if the measure_when property is set to MeasureWhen.AUTOMATICALLY_AFTER_SOURCE_COMPLETE. Refer to the Single Point Source Mode and Sequence Source Mode topics for more information. @@ -3020,11 +2932,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.source_delay` - """ - source_mode = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.SourceMode, 1150054 - ) - """Type: enums.SourceMode + ''' + source_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.SourceMode, 1150054) + '''Type: enums.SourceMode Specifies whether to run a single output point or a sequence. Refer to the Single Point Source Mode and Sequence Source Mode topics in the NI DC Power Supplies and SMUs Help for more information about source modes. Default value: SourceMode.SINGLE_POINT @@ -3038,11 +2948,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.source_mode` - """ - source_trigger_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TriggerType, 1150030 - ) - """Type: enums.TriggerType + ''' + source_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerType, 1150030) + '''Type: enums.TriggerType Specifies the behavior of the Source trigger. for information about supported devices. @@ -3059,31 +2967,29 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.source_trigger_type` - """ + ''' specific_driver_description = _attributes.AttributeViString(1050514) - """Type: str + '''Type: str Contains a brief description of the specific driver. - """ + ''' specific_driver_prefix = _attributes.AttributeViString(1050302) - """Type: str + '''Type: str Contains the prefix for NI-DCPower. The name of each user-callable method in NI-DCPower begins with this prefix. - """ + ''' specific_driver_revision = _attributes.AttributeViString(1050551) - """Type: str + '''Type: str Contains additional version information about NI-DCPower. - """ + ''' specific_driver_vendor = _attributes.AttributeViString(1050513) - """Type: str + '''Type: str Contains the name of the vendor that supplies NI-DCPower. - """ - start_trigger_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TriggerType, 1150021 - ) - """Type: enums.TriggerType + ''' + start_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerType, 1150021) + '''Type: enums.TriggerType Specifies the behavior of the Start trigger. for information about supported devices. @@ -3100,16 +3006,14 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.start_trigger_type` - """ + ''' supported_instrument_models = _attributes.AttributeViString(1050327) - """Type: str + '''Type: str Contains a comma-separated (,) list of supported NI-DCPower device models. - """ - transient_response = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TransientResponse, 1150062 - ) - """Type: enums.TransientResponse + ''' + transient_response = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TransientResponse, 1150062) + '''Type: enums.TransientResponse Specifies the transient response. Refer to the Transient Response topic in the NI DC Power Supplies and SMUs Help for more information about transient response. for information about supported devices. @@ -3126,9 +3030,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.transient_response` - """ + ''' voltage_compensation_frequency = _attributes.AttributeViReal64(1150068) - """Type: float + '''Type: float The frequency at which a pole-zero pair is added to the system when the channel is in Constant Voltage mode. for information about supported devices. @@ -3145,9 +3049,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.voltage_compensation_frequency` - """ + ''' voltage_gain_bandwidth = _attributes.AttributeViReal64(1150067) - """Type: float + '''Type: float The frequency at which the unloaded loop gain extrapolates to 0 dB in the absence of additional poles and zeroes. This property takes effect when the channel is in Constant Voltage mode. for information about supported devices. @@ -3164,9 +3068,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.voltage_gain_bandwidth` - """ + ''' voltage_level = _attributes.AttributeViReal64(1250001) - """Type: float + '''Type: float Specifies the voltage level, in volts, that the device attempts to generate on the specified channel(s). This property is applicable only if the output_function property is set to OutputFunction.DC_VOLTAGE. @@ -3184,9 +3088,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.voltage_level` - """ + ''' voltage_level_autorange = _attributes.AttributeViInt32(1150015) - """Type: bool + '''Type: bool Specifies whether NI-DCPower automatically selects the voltage level range based on the desired voltage level for the specified channel(s). If you set this property to AutoZero.ON, NI-DCPower ignores any changes you make to the voltage_level_range property. If you change the voltage_level_autorange property from AutoZero.ON to AutoZero.OFF, NI-DCPower retains the last value the voltage_level_range property was set to (or the default value if the property was never set) and uses that value as the voltage level range. @@ -3203,9 +3107,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.voltage_level_autorange` - """ + ''' voltage_level_range = _attributes.AttributeViReal64(1150005) - """Type: float + '''Type: float Specifies the voltage level range, in volts, for the specified channel(s). The range defines the valid values to which the voltage level can be set. Use the voltage_level_autorange property to enable automatic selection of the voltage level range. @@ -3224,9 +3128,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.voltage_level_range` - """ + ''' voltage_limit = _attributes.AttributeViReal64(1150010) - """Type: float + '''Type: float Specifies the voltage limit, in volts, that the output cannot exceed when generating the desired current level on the specified channels. This property is applicable only if the output_function property is set to OutputFunction.DC_CURRENT and the compliance_limit_symmetry property is set to ComplianceLimitSymmetry.SYMMETRIC. @@ -3244,9 +3148,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.voltage_limit` - """ + ''' voltage_limit_autorange = _attributes.AttributeViInt32(1150018) - """Type: bool + '''Type: bool Specifies whether NI-DCPower automatically selects the voltage limit range based on the desired voltage limit for the specified channel(s). If this property is set to AutoZero.ON, NI-DCPower ignores any changes you make to the voltage_limit_range property. If you change the voltage_limit_autorange property from AutoZero.ON to AutoZero.OFF, NI-DCPower retains the last value the voltage_limit_range property was set to (or the default value if the property was never set) and uses that value as the voltage limit range. @@ -3263,9 +3167,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.voltage_limit_autorange` - """ + ''' voltage_limit_high = _attributes.AttributeViReal64(1150185) - """Type: float + '''Type: float Specifies the maximum voltage, in volts, that the output can produce when generating the desired current on the specified channel(s). @@ -3307,9 +3211,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.voltage_limit_high` - """ + ''' voltage_limit_low = _attributes.AttributeViReal64(1150186) - """Type: float + '''Type: float Specifies the minimum voltage, in volts, that the output can produce when generating the desired current on the specified channel(s). @@ -3351,9 +3255,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.voltage_limit_low` - """ + ''' voltage_limit_range = _attributes.AttributeViReal64(1150012) - """Type: float + '''Type: float Specifies the voltage limit range, in volts, for the specified channel(s). The range defines the valid values to which the voltage limit can be set. Use the voltage_limit_autorange property to enable automatic selection of the voltage limit range. @@ -3372,9 +3276,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.voltage_limit_range` - """ + ''' voltage_pole_zero_ratio = _attributes.AttributeViReal64(1150069) - """Type: float + '''Type: float The ratio of the pole frequency to the zero frequency when the channel is in Constant Voltage mode. for information about supported devices. @@ -3391,50 +3295,42 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nidcpower.Session`. Example: :py:attr:`my_session.voltage_pole_zero_ratio` - """ + ''' - def __init__( - self, repeated_capability_list, vi, library, encoding, freeze_it=False - ): + def __init__(self, repeated_capability_list, vi, library, encoding, freeze_it=False): self._repeated_capability_list = repeated_capability_list - self._repeated_capability = ",".join(repeated_capability_list) + self._repeated_capability = ','.join(repeated_capability_list) self._vi = vi self._library = library self._encoding = encoding # Store the parameter list for later printing in __repr__ param_list = [] - param_list.append( - "repeated_capability_list=" + pp.pformat(repeated_capability_list) - ) + param_list.append("repeated_capability_list=" + pp.pformat(repeated_capability_list)) param_list.append("vi=" + pp.pformat(vi)) param_list.append("library=" + pp.pformat(library)) param_list.append("encoding=" + pp.pformat(encoding)) - self._param_list = ", ".join(param_list) + self._param_list = ', '.join(param_list) # Instantiate any repeated capability objects - self.channels = _RepeatedCapabilities(self, "", repeated_capability_list) - self.instruments = _RepeatedCapabilities(self, "", repeated_capability_list) + self.channels = _RepeatedCapabilities(self, '', repeated_capability_list) + self.instruments = _RepeatedCapabilities(self, '', repeated_capability_list) self._is_frozen = freeze_it def __repr__(self): - return "{0}.{1}({2})".format( - "nidcpower", self.__class__.__name__, self._param_list - ) + return '{0}.{1}({2})'.format('nidcpower', self.__class__.__name__, self._param_list) def __setattr__(self, key, value): if self._is_frozen and key not in dir(self): - raise AttributeError( - "'{0}' object has no attribute '{1}'".format(type(self).__name__, key) - ) + raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) object.__setattr__(self, key, value) def _get_error_description(self, error_code): - """_get_error_description + '''_get_error_description Returns the error description. - """ + ''' try: _, error_string = self._get_error() return error_string @@ -3442,18 +3338,18 @@ def _get_error_description(self, error_code): pass try: - """ + ''' It is expected for _get_error to raise when the session is invalid (IVI spec requires GetError to fail). Use _error_message instead. It doesn't require a session. - """ + ''' error_string = self._error_message(error_code) return error_string except errors.Error: return "Failed to retrieve error description." def initiate(self): - """initiate + '''initiate Starts generation or acquisition, causing the specified channel(s) to leave the Uncommitted state or Committed state and enter the Running @@ -3481,14 +3377,14 @@ def initiate(self): To call the method on all channels, you can call it directly on the :py:class:`nidcpower.Session`. Example: :py:meth:`my_session.initiate` - """ + ''' return _Acquisition(self) - """ These are code-generated """ + ''' These are code-generated ''' @ivi_synchronized def abort(self): - r"""abort + r'''abort Transitions the specified channel(s) from the Running state to the Uncommitted state. If a sequence is running, it is stopped. Any @@ -3524,22 +3420,16 @@ def abort(self): To call the method on all channels, you can call it directly on the :py:class:`nidcpower.Session`. Example: :py:meth:`my_session.abort` - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - error_code = self._library.niDCPower_AbortWithChannels( - vi_ctype, channel_name_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + error_code = self._library.niDCPower_AbortWithChannels(vi_ctype, channel_name_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def self_cal(self): - r"""self_cal + r'''self_cal Performs a self-calibration upon the specified channel(s). @@ -3579,22 +3469,16 @@ def self_cal(self): To call the method on all channels, you can call it directly on the :py:class:`nidcpower.Session`. Example: :py:meth:`my_session.self_cal` - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - error_code = self._library.niDCPower_CalSelfCalibrate( - vi_ctype, channel_name_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + error_code = self._library.niDCPower_CalSelfCalibrate(vi_ctype, channel_name_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def clear_latched_output_cutoff_state(self, output_cutoff_reason): - r"""clear_latched_output_cutoff_state + r'''clear_latched_output_cutoff_state Clears the state of an output cutoff that was engaged. To clear the state for all output cutoff reasons, use OutputCutoffReason.ALL. @@ -3633,30 +3517,19 @@ def clear_latched_output_cutoff_state(self, output_cutoff_reason): | OutputCutoffReason.CURRENT_CHANGE_LOW | Clears cutoffs caused when the voltage slew rate decreased beyond the negative change cutoff for current output | +-----------------------------------------+-----------------------------------------------------------------------------------------------------------------+ - """ + ''' if type(output_cutoff_reason) is not enums.OutputCutoffReason: - raise TypeError( - "Parameter output_cutoff_reason must be of type " - + str(enums.OutputCutoffReason) - ) + raise TypeError('Parameter output_cutoff_reason must be of type ' + str(enums.OutputCutoffReason)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - output_cutoff_reason_ctype = _visatype.ViInt32( - output_cutoff_reason.value - ) # case S130 - error_code = self._library.niDCPower_ClearLatchedOutputCutoffState( - vi_ctype, channel_name_ctype, output_cutoff_reason_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + output_cutoff_reason_ctype = _visatype.ViInt32(output_cutoff_reason.value) # case S130 + error_code = self._library.niDCPower_ClearLatchedOutputCutoffState(vi_ctype, channel_name_ctype, output_cutoff_reason_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def commit(self): - r"""commit + r'''commit Applies previously configured settings to the specified channel(s). Calling this method moves the NI-DCPower session from the Uncommitted state into @@ -3683,24 +3556,16 @@ def commit(self): To call the method on all channels, you can call it directly on the :py:class:`nidcpower.Session`. Example: :py:meth:`my_session.commit` - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - error_code = self._library.niDCPower_CommitWithChannels( - vi_ctype, channel_name_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + error_code = self._library.niDCPower_CommitWithChannels(vi_ctype, channel_name_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def configure_aperture_time( - self, aperture_time, units=enums.ApertureTimeUnits.SECONDS - ): - r"""configure_aperture_time + def configure_aperture_time(self, aperture_time, units=enums.ApertureTimeUnits.SECONDS): + r'''configure_aperture_time Configures the aperture time on the specified channel(s). @@ -3748,28 +3613,20 @@ def configure_aperture_time( | ApertureTimeUnits.POWER_LINE_CYCLES | Specifies Power Line Cycles. | +-------------------------------------+------------------------------+ - """ + ''' if type(units) is not enums.ApertureTimeUnits: - raise TypeError( - "Parameter units must be of type " + str(enums.ApertureTimeUnits) - ) + raise TypeError('Parameter units must be of type ' + str(enums.ApertureTimeUnits)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 aperture_time_ctype = _visatype.ViReal64(aperture_time) # case S150 units_ctype = _visatype.ViInt32(units.value) # case S130 - error_code = self._library.niDCPower_ConfigureApertureTime( - vi_ctype, channel_name_ctype, aperture_time_ctype, units_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_ConfigureApertureTime(vi_ctype, channel_name_ctype, aperture_time_ctype, units_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def create_advanced_sequence_commit_step(self, set_as_active_step=True): - r"""create_advanced_sequence_commit_step + r'''create_advanced_sequence_commit_step Creates a Commit step in the Active advanced sequence. A Commit step configures channels to a user-defined known state before starting the advanced sequence. @@ -3816,25 +3673,17 @@ def create_advanced_sequence_commit_step(self, set_as_active_step=True): Args: set_as_active_step (bool): Specifies whether the step created with this method is active in the Active advanced sequence. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 set_as_active_step_ctype = _visatype.ViBoolean(set_as_active_step) # case S150 - error_code = ( - self._library.niDCPower_CreateAdvancedSequenceCommitStepWithChannels( - vi_ctype, channel_name_ctype, set_as_active_step_ctype - ) - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_CreateAdvancedSequenceCommitStepWithChannels(vi_ctype, channel_name_ctype, set_as_active_step_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def create_advanced_sequence_step(self, set_as_active_step=True): - r"""create_advanced_sequence_step + r'''create_advanced_sequence_step Creates a new advanced sequence step in the advanced sequence specified by the Active advanced sequence. When you create an advanced sequence @@ -3879,25 +3728,17 @@ def create_advanced_sequence_step(self, set_as_active_step=True): Args: set_as_active_step (bool): Specifies whether the step created with this method is active in the Active advanced sequence. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 set_as_active_step_ctype = _visatype.ViBoolean(set_as_active_step) # case S150 - error_code = self._library.niDCPower_CreateAdvancedSequenceStepWithChannels( - vi_ctype, channel_name_ctype, set_as_active_step_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_CreateAdvancedSequenceStepWithChannels(vi_ctype, channel_name_ctype, set_as_active_step_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def _create_advanced_sequence_with_channels( - self, sequence_name, attribute_ids, set_as_active_sequence - ): - r"""_create_advanced_sequence_with_channels + def _create_advanced_sequence_with_channels(self, sequence_name, attribute_ids, set_as_active_sequence): + r'''_create_advanced_sequence_with_channels Creates an empty advanced sequence. Call the create_advanced_sequence_step method to add steps to the @@ -4065,39 +3906,20 @@ def _create_advanced_sequence_with_channels( set_as_active_sequence (bool): Specifies that this current sequence is active. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - sequence_name_ctype = ctypes.create_string_buffer( - sequence_name.encode(self._encoding) - ) # case C020 - attribute_id_count_ctype = _visatype.ViInt32( - 0 if attribute_ids is None else len(attribute_ids) - ) # case S160 - attribute_ids_ctype = get_ctypes_pointer_for_buffer( - value=attribute_ids, library_type=_visatype.ViInt32 - ) # case B550 - set_as_active_sequence_ctype = _visatype.ViBoolean( - set_as_active_sequence - ) # case S150 - error_code = self._library.niDCPower_CreateAdvancedSequenceWithChannels( - vi_ctype, - channel_name_ctype, - sequence_name_ctype, - attribute_id_count_ctype, - attribute_ids_ctype, - set_as_active_sequence_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + sequence_name_ctype = ctypes.create_string_buffer(sequence_name.encode(self._encoding)) # case C020 + attribute_id_count_ctype = _visatype.ViInt32(0 if attribute_ids is None else len(attribute_ids)) # case S160 + attribute_ids_ctype = get_ctypes_pointer_for_buffer(value=attribute_ids, library_type=_visatype.ViInt32) # case B550 + set_as_active_sequence_ctype = _visatype.ViBoolean(set_as_active_sequence) # case S150 + error_code = self._library.niDCPower_CreateAdvancedSequenceWithChannels(vi_ctype, channel_name_ctype, sequence_name_ctype, attribute_id_count_ctype, attribute_ids_ctype, set_as_active_sequence_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def delete_advanced_sequence(self, sequence_name): - r"""delete_advanced_sequence + r'''delete_advanced_sequence Deletes a previously created advanced sequence and all the advanced sequence steps in the advanced sequence. @@ -4137,27 +3959,17 @@ def delete_advanced_sequence(self, sequence_name): Args: sequence_name (str): specifies the name of the sequence to delete. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - sequence_name_ctype = ctypes.create_string_buffer( - sequence_name.encode(self._encoding) - ) # case C020 - error_code = self._library.niDCPower_DeleteAdvancedSequenceWithChannels( - vi_ctype, channel_name_ctype, sequence_name_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + sequence_name_ctype = ctypes.create_string_buffer(sequence_name.encode(self._encoding)) # case C020 + error_code = self._library.niDCPower_DeleteAdvancedSequenceWithChannels(vi_ctype, channel_name_ctype, sequence_name_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def create_advanced_sequence( - self, sequence_name, property_names, set_as_active_sequence=True - ): - """create_advanced_sequence + def create_advanced_sequence(self, sequence_name, property_names, set_as_active_sequence=True): + '''create_advanced_sequence Creates an empty advanced sequence. Call the create_advanced_sequence_step method to add steps to the @@ -4320,35 +4132,23 @@ def create_advanced_sequence( set_as_active_sequence (bool): Specifies that this current sequence is active. - """ + ''' # The way the NI-DCPower C API is designed, we need to know all the attribute ID's upfront in order to call # `niDCPower_CreateAdvancedSequence`. In order to find the attribute ID of each property, we look at the # member Attribute objects of Session. We use a set since we don't have to worry about is it already there. attribute_ids_used = set() for prop in property_names: if prop not in Session.__base__.__dict__: - raise KeyError( - "{0} is not an property on the nidcpower.Session".format(prop) - ) - if not isinstance( - Session.__base__.__dict__[prop], _attributes.Attribute - ) and not isinstance( - Session.__base__.__dict__[prop], _attributes.AttributeEnum - ): - raise TypeError( - "{0} is not a valid property: {1}".format( - prop, type(Session.__base__.__dict__[prop]) - ) - ) + raise KeyError('{0} is not an property on the nidcpower.Session'.format(prop)) + if not isinstance(Session.__base__.__dict__[prop], _attributes.Attribute) and not isinstance(Session.__base__.__dict__[prop], _attributes.AttributeEnum): + raise TypeError('{0} is not a valid property: {1}'.format(prop, type(Session.__base__.__dict__[prop]))) attribute_ids_used.add(Session.__base__.__dict__[prop]._attribute_id) - self._create_advanced_sequence_with_channels( - sequence_name, list(attribute_ids_used), set_as_active_sequence - ) + self._create_advanced_sequence_with_channels(sequence_name, list(attribute_ids_used), set_as_active_sequence) @ivi_synchronized def fetch_multiple(self, count, timeout=hightime.timedelta(seconds=1.0)): - """fetch_multiple + '''fetch_multiple Returns a list of named tuples (Measurement) that were previously taken and are stored in the NI-DCPower buffer. This method @@ -4390,31 +4190,17 @@ def fetch_multiple(self, count, timeout=hightime.timedelta(seconds=1.0)): - **current** (float) - **in_compliance** (bool) - """ + ''' import collections + Measurement = collections.namedtuple('Measurement', ['voltage', 'current', 'in_compliance']) + + voltage_measurements, current_measurements, in_compliance = self._fetch_multiple(timeout, count) - Measurement = collections.namedtuple( - "Measurement", ["voltage", "current", "in_compliance"] - ) - - ( - voltage_measurements, - current_measurements, - in_compliance, - ) = self._fetch_multiple(timeout, count) - - return [ - Measurement( - voltage=voltage_measurements[i], - current=current_measurements[i], - in_compliance=in_compliance[i], - ) - for i in range(count) - ] + return [Measurement(voltage=voltage_measurements[i], current=current_measurements[i], in_compliance=in_compliance[i]) for i in range(count)] @ivi_synchronized def measure_multiple(self): - """measure_multiple + '''measure_multiple Returns a list of named tuples (Measurement) containing the measured voltage and current values on the specified output channel(s). Each call to this method @@ -4448,27 +4234,17 @@ def measure_multiple(self): - **current** (float) - **in_compliance** (bool) - Always None - """ + ''' import collections - - Measurement = collections.namedtuple( - "Measurement", ["voltage", "current", "in_compliance"] - ) + Measurement = collections.namedtuple('Measurement', ['voltage', 'current', 'in_compliance']) voltage_measurements, current_measurements = self._measure_multiple() - return [ - Measurement( - voltage=voltage_measurements[i], - current=current_measurements[i], - in_compliance=None, - ) - for i in range(self._parse_channel_count()) - ] + return [Measurement(voltage=voltage_measurements[i], current=current_measurements[i], in_compliance=None) for i in range(self._parse_channel_count())] @ivi_synchronized def _fetch_multiple(self, timeout, count): - r"""_fetch_multiple + r'''_fetch_multiple Returns an array of voltage measurements, an array of current measurements, and an array of compliance measurements that were @@ -4527,58 +4303,27 @@ def _fetch_multiple(self, timeout, count): actual_count (int): Indicates the number of measured values actually retrieved from the device. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64( - timeout - ) # case S140 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 count_ctype = _visatype.ViInt32(count) # case S210 voltage_measurements_size = count # case B600 - voltage_measurements_array = array.array( - "d", [0] * voltage_measurements_size - ) # case B600 - voltage_measurements_ctype = get_ctypes_pointer_for_buffer( - value=voltage_measurements_array, library_type=_visatype.ViReal64 - ) # case B600 + voltage_measurements_array = array.array("d", [0] * voltage_measurements_size) # case B600 + voltage_measurements_ctype = get_ctypes_pointer_for_buffer(value=voltage_measurements_array, library_type=_visatype.ViReal64) # case B600 current_measurements_size = count # case B600 - current_measurements_array = array.array( - "d", [0] * current_measurements_size - ) # case B600 - current_measurements_ctype = get_ctypes_pointer_for_buffer( - value=current_measurements_array, library_type=_visatype.ViReal64 - ) # case B600 + current_measurements_array = array.array("d", [0] * current_measurements_size) # case B600 + current_measurements_ctype = get_ctypes_pointer_for_buffer(value=current_measurements_array, library_type=_visatype.ViReal64) # case B600 in_compliance_size = count # case B600 - in_compliance_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViBoolean, size=in_compliance_size - ) # case B600 + in_compliance_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViBoolean, size=in_compliance_size) # case B600 actual_count_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDCPower_FetchMultiple( - vi_ctype, - channel_name_ctype, - timeout_ctype, - count_ctype, - voltage_measurements_ctype, - current_measurements_ctype, - in_compliance_ctype, - None - if actual_count_ctype is None - else (ctypes.pointer(actual_count_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return ( - voltage_measurements_array, - current_measurements_array, - [bool(in_compliance_ctype[i]) for i in range(count_ctype.value)], - ) + error_code = self._library.niDCPower_FetchMultiple(vi_ctype, channel_name_ctype, timeout_ctype, count_ctype, voltage_measurements_ctype, current_measurements_ctype, in_compliance_ctype, None if actual_count_ctype is None else (ctypes.pointer(actual_count_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return voltage_measurements_array, current_measurements_array, [bool(in_compliance_ctype[i]) for i in range(count_ctype.value)] @ivi_synchronized def _get_attribute_vi_boolean(self, attribute_id): - r"""_get_attribute_vi_boolean + r'''_get_attribute_vi_boolean | Queries the value of a ViBoolean property. | You can use this method to get the values of device-specific @@ -4625,29 +4370,18 @@ def _get_attribute_vi_boolean(self, attribute_id): pressing **Enter** on this control. Select a value by double-clicking on it or by selecting it and then pressing **Enter**. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niDCPower_GetAttributeViBoolean( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - None - if attribute_value_ctype is None - else (ctypes.pointer(attribute_value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_GetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_int32(self, attribute_id): - r"""_get_attribute_vi_int32 + r'''_get_attribute_vi_int32 | Queries the value of a ViInt32 property. | You can use this method to get the values of device-specific @@ -4694,29 +4428,18 @@ def _get_attribute_vi_int32(self, attribute_id): pressing **Enter** on this control. Select a value by double-clicking on it or by selecting it and then pressing **Enter**. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDCPower_GetAttributeViInt32( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - None - if attribute_value_ctype is None - else (ctypes.pointer(attribute_value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_GetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_int64(self, attribute_id): - r"""_get_attribute_vi_int64 + r'''_get_attribute_vi_int64 | Queries the value of a ViInt64 property. | You can use this method to get the values of device-specific @@ -4763,29 +4486,18 @@ def _get_attribute_vi_int64(self, attribute_id): pressing **Enter** on this control. Select a value by double-clicking on it or by selecting it and then pressing **Enter**. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt64() # case S220 - error_code = self._library.niDCPower_GetAttributeViInt64( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - None - if attribute_value_ctype is None - else (ctypes.pointer(attribute_value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_GetAttributeViInt64(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_real64(self, attribute_id): - r"""_get_attribute_vi_real64 + r'''_get_attribute_vi_real64 | Queries the value of a ViReal64 property. | You can use this method to get the values of device-specific @@ -4832,29 +4544,18 @@ def _get_attribute_vi_real64(self, attribute_id): pressing **Enter** on this control. Select a value by double-clicking on it or by selecting it and then pressing **Enter**. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDCPower_GetAttributeViReal64( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - None - if attribute_value_ctype is None - else (ctypes.pointer(attribute_value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_GetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_string(self, attribute_id): - r"""_get_attribute_vi_string + r'''_get_attribute_vi_string | Queries the value of a ViString property. | You can use this method to get the values of device-specific @@ -4911,42 +4612,22 @@ def _get_attribute_vi_string(self, attribute_id): pressing on this control. Select a value by double-clicking on it or by selecting it and then pressing . - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 buffer_size_ctype = _visatype.ViInt32() # case S170 attribute_value_ctype = None # case C050 - error_code = self._library.niDCPower_GetAttributeViString( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - buffer_size_ctype, - attribute_value_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niDCPower_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, buffer_size_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - attribute_value_ctype = ( - _visatype.ViChar * buffer_size_ctype.value - )() # case C060 - error_code = self._library.niDCPower_GetAttributeViString( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - buffer_size_ctype, - attribute_value_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + attribute_value_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 + error_code = self._library.niDCPower_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, buffer_size_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return attribute_value_ctype.value.decode(self._encoding) def _get_error(self): - r"""_get_error + r'''_get_error | Retrieves and then clears the IVI error information for the session or the current execution thread unless **bufferSize** is 0, in which case @@ -4982,36 +4663,22 @@ def _get_error(self): If you pass 0 for **bufferSize**, you can pass VI_NULL for this property. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 code_ctype = _visatype.ViStatus() # case S220 buffer_size_ctype = _visatype.ViInt32() # case S170 description_ctype = None # case C050 - error_code = self._library.niDCPower_GetError( - vi_ctype, - None if code_ctype is None else (ctypes.pointer(code_ctype)), - buffer_size_ctype, - description_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=True - ) + error_code = self._library.niDCPower_GetError(vi_ctype, None if code_ctype is None else (ctypes.pointer(code_ctype)), buffer_size_ctype, description_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 description_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niDCPower_GetError( - vi_ctype, - None if code_ctype is None else (ctypes.pointer(code_ctype)), - buffer_size_ctype, - description_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + error_code = self._library.niDCPower_GetError(vi_ctype, None if code_ctype is None else (ctypes.pointer(code_ctype)), buffer_size_ctype, description_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return int(code_ctype.value), description_ctype.value.decode(self._encoding) @ivi_synchronized def _initiate_with_channels(self): - r"""_initiate_with_channels + r'''_initiate_with_channels Starts generation or acquisition, causing the specified channel(s) to leave the Uncommitted state or Committed state and enter the Running @@ -5036,21 +4703,15 @@ def _initiate_with_channels(self): To call the method on all channels, you can call it directly on the :py:class:`nidcpower.Session`. Example: :py:meth:`my_session._initiate_with_channels` - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - error_code = self._library.niDCPower_InitiateWithChannels( - vi_ctype, channel_name_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + error_code = self._library.niDCPower_InitiateWithChannels(vi_ctype, channel_name_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def lock(self): - """lock + '''lock Obtains a multithread lock on the device session. Before doing so, the software waits until all other execution threads release their locks @@ -5078,27 +4739,25 @@ def lock(self): Returns: lock (context manager): When used in a with statement, nidcpower.Session.lock acts as a context manager and unlock will be called when the with block is exited - """ + ''' self._lock_session() # We do not call _lock_session() in the context manager so that this function can # act standalone as well and let the client call unlock() explicitly. If they do use the context manager, # that will handle the unlock for them return _Lock(self) def _lock_session(self): - """_lock_session + '''_lock_session Actual call to driver - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDCPower_LockSession(vi_ctype, None) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return @ivi_synchronized def measure(self, measurement_type): - r"""measure + r'''measure Returns the measured value of either the voltage or current on the specified output channel. Each call to this method blocks other @@ -5132,32 +4791,20 @@ def measure(self, measurement_type): measurement (float): Returns the value of the measurement, either in volts for voltage or amps for current. - """ + ''' if type(measurement_type) is not enums.MeasurementTypes: - raise TypeError( - "Parameter measurement_type must be of type " - + str(enums.MeasurementTypes) - ) + raise TypeError('Parameter measurement_type must be of type ' + str(enums.MeasurementTypes)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 measurement_type_ctype = _visatype.ViInt32(measurement_type.value) # case S130 measurement_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDCPower_Measure( - vi_ctype, - channel_name_ctype, - measurement_type_ctype, - None if measurement_ctype is None else (ctypes.pointer(measurement_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_Measure(vi_ctype, channel_name_ctype, measurement_type_ctype, None if measurement_ctype is None else (ctypes.pointer(measurement_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(measurement_ctype.value) @ivi_synchronized def _measure_multiple(self): - r"""_measure_multiple + r'''_measure_multiple Returns arrays of the measured voltage and current values on the specified output channel(s). Each call to this method blocks other @@ -5187,39 +4834,22 @@ def _measure_multiple(self): **channelName**. Ensure that sufficient space has been allocated for the returned array. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 voltage_measurements_size = self._parse_channel_count() # case B560 - voltage_measurements_array = array.array( - "d", [0] * voltage_measurements_size - ) # case B560 - voltage_measurements_ctype = get_ctypes_pointer_for_buffer( - value=voltage_measurements_array, library_type=_visatype.ViReal64 - ) # case B560 + voltage_measurements_array = array.array("d", [0] * voltage_measurements_size) # case B560 + voltage_measurements_ctype = get_ctypes_pointer_for_buffer(value=voltage_measurements_array, library_type=_visatype.ViReal64) # case B560 current_measurements_size = self._parse_channel_count() # case B560 - current_measurements_array = array.array( - "d", [0] * current_measurements_size - ) # case B560 - current_measurements_ctype = get_ctypes_pointer_for_buffer( - value=current_measurements_array, library_type=_visatype.ViReal64 - ) # case B560 - error_code = self._library.niDCPower_MeasureMultiple( - vi_ctype, - channel_name_ctype, - voltage_measurements_ctype, - current_measurements_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + current_measurements_array = array.array("d", [0] * current_measurements_size) # case B560 + current_measurements_ctype = get_ctypes_pointer_for_buffer(value=current_measurements_array, library_type=_visatype.ViReal64) # case B560 + error_code = self._library.niDCPower_MeasureMultiple(vi_ctype, channel_name_ctype, voltage_measurements_ctype, current_measurements_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return voltage_measurements_array, current_measurements_array @ivi_synchronized def _parse_channel_count(self): - r"""_parse_channel_count + r'''_parse_channel_count Returns the number of channels. @@ -5237,27 +4867,17 @@ def _parse_channel_count(self): Returns: number_of_channels (int): - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channels_string_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channels_string_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 number_of_channels_ctype = _visatype.ViUInt32() # case S220 - error_code = self._library.niDCPower_ParseChannelCount( - vi_ctype, - channels_string_ctype, - None - if number_of_channels_ctype is None - else (ctypes.pointer(number_of_channels_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_ParseChannelCount(vi_ctype, channels_string_ctype, None if number_of_channels_ctype is None else (ctypes.pointer(number_of_channels_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(number_of_channels_ctype.value) @ivi_synchronized def query_in_compliance(self): - r"""query_in_compliance + r'''query_in_compliance Queries the specified output device to determine if it is operating at the `compliance `__ limit. @@ -5297,27 +4917,17 @@ def query_in_compliance(self): Returns: in_compliance (bool): Returns whether the device output channel is in compliance. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 in_compliance_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niDCPower_QueryInCompliance( - vi_ctype, - channel_name_ctype, - None - if in_compliance_ctype is None - else (ctypes.pointer(in_compliance_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_QueryInCompliance(vi_ctype, channel_name_ctype, None if in_compliance_ctype is None else (ctypes.pointer(in_compliance_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(in_compliance_ctype.value) @ivi_synchronized def query_latched_output_cutoff_state(self, output_cutoff_reason): - r"""query_latched_output_cutoff_state + r'''query_latched_output_cutoff_state Discovers if an output cutoff limit was exceeded for the specified reason. When an output cutoff is engaged, the output of the channel(s) is disconnected. If a limit was exceeded, the state is latched until you clear it with the clear_latched_output_cutoff_state method or the reset method. @@ -5368,36 +4978,20 @@ def query_latched_output_cutoff_state(self, output_cutoff_reason): | False | No output cutoff has engaged. | +-------+------------------------------------------------------------------------------+ - """ + ''' if type(output_cutoff_reason) is not enums.OutputCutoffReason: - raise TypeError( - "Parameter output_cutoff_reason must be of type " - + str(enums.OutputCutoffReason) - ) + raise TypeError('Parameter output_cutoff_reason must be of type ' + str(enums.OutputCutoffReason)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - output_cutoff_reason_ctype = _visatype.ViInt32( - output_cutoff_reason.value - ) # case S130 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + output_cutoff_reason_ctype = _visatype.ViInt32(output_cutoff_reason.value) # case S130 output_cutoff_state_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niDCPower_QueryLatchedOutputCutoffState( - vi_ctype, - channel_name_ctype, - output_cutoff_reason_ctype, - None - if output_cutoff_state_ctype is None - else (ctypes.pointer(output_cutoff_state_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_QueryLatchedOutputCutoffState(vi_ctype, channel_name_ctype, output_cutoff_reason_ctype, None if output_cutoff_state_ctype is None else (ctypes.pointer(output_cutoff_state_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(output_cutoff_state_ctype.value) @ivi_synchronized def query_max_current_limit(self, voltage_level): - r"""query_max_current_limit + r'''query_max_current_limit Queries the maximum current limit on an output channel if the output channel is set to the specified **voltageLevel**. @@ -5422,29 +5016,18 @@ def query_max_current_limit(self, voltage_level): max_current_limit (float): Returns the maximum current limit that can be set with the specified **voltageLevel**. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 voltage_level_ctype = _visatype.ViReal64(voltage_level) # case S150 max_current_limit_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDCPower_QueryMaxCurrentLimit( - vi_ctype, - channel_name_ctype, - voltage_level_ctype, - None - if max_current_limit_ctype is None - else (ctypes.pointer(max_current_limit_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_QueryMaxCurrentLimit(vi_ctype, channel_name_ctype, voltage_level_ctype, None if max_current_limit_ctype is None else (ctypes.pointer(max_current_limit_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(max_current_limit_ctype.value) @ivi_synchronized def query_max_voltage_level(self, current_limit): - r"""query_max_voltage_level + r'''query_max_voltage_level Queries the maximum voltage level on an output channel if the output channel is set to the specified **currentLimit**. @@ -5469,29 +5052,18 @@ def query_max_voltage_level(self, current_limit): max_voltage_level (float): Returns the maximum voltage level that can be set on an output channel with the specified **currentLimit**. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 current_limit_ctype = _visatype.ViReal64(current_limit) # case S150 max_voltage_level_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDCPower_QueryMaxVoltageLevel( - vi_ctype, - channel_name_ctype, - current_limit_ctype, - None - if max_voltage_level_ctype is None - else (ctypes.pointer(max_voltage_level_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_QueryMaxVoltageLevel(vi_ctype, channel_name_ctype, current_limit_ctype, None if max_voltage_level_ctype is None else (ctypes.pointer(max_voltage_level_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(max_voltage_level_ctype.value) @ivi_synchronized def query_min_current_limit(self, voltage_level): - r"""query_min_current_limit + r'''query_min_current_limit Queries the minimum current limit on an output channel if the output channel is set to the specified **voltageLevel**. @@ -5516,29 +5088,18 @@ def query_min_current_limit(self, voltage_level): min_current_limit (float): Returns the minimum current limit that can be set on an output channel with the specified **voltageLevel**. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 voltage_level_ctype = _visatype.ViReal64(voltage_level) # case S150 min_current_limit_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDCPower_QueryMinCurrentLimit( - vi_ctype, - channel_name_ctype, - voltage_level_ctype, - None - if min_current_limit_ctype is None - else (ctypes.pointer(min_current_limit_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_QueryMinCurrentLimit(vi_ctype, channel_name_ctype, voltage_level_ctype, None if min_current_limit_ctype is None else (ctypes.pointer(min_current_limit_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(min_current_limit_ctype.value) @ivi_synchronized def query_output_state(self, output_state): - r"""query_output_state + r'''query_output_state Queries the specified output channel to determine if the output channel is currently in the state specified by **outputState**. @@ -5573,31 +5134,20 @@ def query_output_state(self, output_state): in_state (bool): Returns whether the device output channel is in the specified output state. - """ + ''' if type(output_state) is not enums.OutputStates: - raise TypeError( - "Parameter output_state must be of type " + str(enums.OutputStates) - ) + raise TypeError('Parameter output_state must be of type ' + str(enums.OutputStates)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 output_state_ctype = _visatype.ViInt32(output_state.value) # case S130 in_state_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niDCPower_QueryOutputState( - vi_ctype, - channel_name_ctype, - output_state_ctype, - None if in_state_ctype is None else (ctypes.pointer(in_state_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_QueryOutputState(vi_ctype, channel_name_ctype, output_state_ctype, None if in_state_ctype is None else (ctypes.pointer(in_state_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(in_state_ctype.value) @ivi_synchronized def reset(self): - r"""reset + r'''reset Resets the specified channel(s) to a known state. This method disables power generation, resets session properties to their default values, commits @@ -5616,22 +5166,16 @@ def reset(self): To call the method on all channels, you can call it directly on the :py:class:`nidcpower.Session`. Example: :py:meth:`my_session.reset` - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - error_code = self._library.niDCPower_ResetWithChannels( - vi_ctype, channel_name_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + error_code = self._library.niDCPower_ResetWithChannels(vi_ctype, channel_name_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def send_software_edge_trigger(self, trigger): - r"""send_software_edge_trigger + r'''send_software_edge_trigger Asserts the specified trigger. This method can override an external edge trigger. @@ -5678,28 +5222,19 @@ def send_software_edge_trigger(self, trigger): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - """ + ''' if type(trigger) is not enums.SendSoftwareEdgeTriggerType: - raise TypeError( - "Parameter trigger must be of type " - + str(enums.SendSoftwareEdgeTriggerType) - ) + raise TypeError('Parameter trigger must be of type ' + str(enums.SendSoftwareEdgeTriggerType)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 trigger_ctype = _visatype.ViInt32(trigger.value) # case S130 - error_code = self._library.niDCPower_SendSoftwareEdgeTriggerWithChannels( - vi_ctype, channel_name_ctype, trigger_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_SendSoftwareEdgeTriggerWithChannels(vi_ctype, channel_name_ctype, trigger_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_boolean(self, attribute_id, attribute_value): - r"""_set_attribute_vi_boolean + r'''_set_attribute_vi_boolean | Sets the value of a ViBoolean property. | This is a low-level method that you can use to set the values of @@ -5749,24 +5284,18 @@ def _set_attribute_vi_boolean(self, attribute_id, attribute_value): Some of the values might not be valid depending upon the current settings of the device session. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViBoolean(attribute_value) # case S150 - error_code = self._library.niDCPower_SetAttributeViBoolean( - vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_SetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_int32(self, attribute_id, attribute_value): - r"""_set_attribute_vi_int32 + r'''_set_attribute_vi_int32 | Sets the value of a ViInt32 property. | This is a low-level method that you can use to set the values of @@ -5816,24 +5345,18 @@ def _set_attribute_vi_int32(self, attribute_id, attribute_value): Some of the values might not be valid depending upon the current settings of the device session. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt32(attribute_value) # case S150 - error_code = self._library.niDCPower_SetAttributeViInt32( - vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_SetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_int64(self, attribute_id, attribute_value): - r"""_set_attribute_vi_int64 + r'''_set_attribute_vi_int64 | Sets the value of a ViInt64 property. | This is a low-level method that you can use to set the values of @@ -5883,24 +5406,18 @@ def _set_attribute_vi_int64(self, attribute_id, attribute_value): Some of the values might not be valid depending upon the current settings of the device session. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt64(attribute_value) # case S150 - error_code = self._library.niDCPower_SetAttributeViInt64( - vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_SetAttributeViInt64(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_real64(self, attribute_id, attribute_value): - r"""_set_attribute_vi_real64 + r'''_set_attribute_vi_real64 | Sets the value of a ViReal64 property. | This is a low-level method that you can use to set the values of @@ -5950,24 +5467,18 @@ def _set_attribute_vi_real64(self, attribute_id, attribute_value): Some of the values might not be valid depending upon the current settings of the device session. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViReal64(attribute_value) # case S150 - error_code = self._library.niDCPower_SetAttributeViReal64( - vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_SetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_string(self, attribute_id, attribute_value): - r"""_set_attribute_vi_string + r'''_set_attribute_vi_string | Sets the value of a ViString property. | This is a low-level method that you can use to set the values of @@ -6017,26 +5528,18 @@ def _set_attribute_vi_string(self, attribute_id, attribute_value): Some of the values might not be valid depending upon the current settings of the device session. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 - attribute_value_ctype = ctypes.create_string_buffer( - attribute_value.encode(self._encoding) - ) # case C020 - error_code = self._library.niDCPower_SetAttributeViString( - vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + attribute_value_ctype = ctypes.create_string_buffer(attribute_value.encode(self._encoding)) # case C020 + error_code = self._library.niDCPower_SetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def set_sequence(self, values, source_delays): - r"""set_sequence + r'''set_sequence Configures a series of voltage or current outputs and corresponding source delays. The source mode must be set to @@ -6084,49 +5587,33 @@ def set_sequence(self, values, source_delays): **Valid Values**: The valid values are between 0 and 167 seconds. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - values_ctype = get_ctypes_pointer_for_buffer( - value=values, library_type=_visatype.ViReal64 - ) # case B550 - source_delays_ctype = get_ctypes_pointer_for_buffer( - value=source_delays, library_type=_visatype.ViReal64 - ) # case B550 - size_ctype = _visatype.ViUInt32( - 0 if values is None else len(values) - ) # case S160 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + values_ctype = get_ctypes_pointer_for_buffer(value=values, library_type=_visatype.ViReal64) # case B550 + source_delays_ctype = get_ctypes_pointer_for_buffer(value=source_delays, library_type=_visatype.ViReal64) # case B550 + size_ctype = _visatype.ViUInt32(0 if values is None else len(values)) # case S160 if source_delays is not None and len(source_delays) != len(values): # case S160 - raise ValueError( - "Length of source_delays and values parameters do not match." - ) # case S160 - error_code = self._library.niDCPower_SetSequence( - vi_ctype, channel_name_ctype, values_ctype, source_delays_ctype, size_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + raise ValueError("Length of source_delays and values parameters do not match.") # case S160 + error_code = self._library.niDCPower_SetSequence(vi_ctype, channel_name_ctype, values_ctype, source_delays_ctype, size_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def unlock(self): - """unlock + '''unlock Releases a lock that you acquired on an device session using lock. Refer to lock for additional information on session locks. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDCPower_UnlockSession(vi_ctype, None) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return @ivi_synchronized def wait_for_event(self, event_id, timeout=hightime.timedelta(seconds=10.0)): - r"""wait_for_event + r'''wait_for_event Waits until the specified channel(s) have generated the specified event. @@ -6182,27 +5669,19 @@ def wait_for_event(self, event_id, timeout=hightime.timedelta(seconds=10.0)): triggers so that the timeout interval is long enough for your application. - """ + ''' if type(event_id) is not enums.Event: - raise TypeError("Parameter event_id must be of type " + str(enums.Event)) + raise TypeError('Parameter event_id must be of type ' + str(enums.Event)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 event_id_ctype = _visatype.ViInt32(event_id.value) # case S130 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64( - timeout - ) # case S140 - error_code = self._library.niDCPower_WaitForEventWithChannels( - vi_ctype, channel_name_ctype, event_id_ctype, timeout_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 + error_code = self._library.niDCPower_WaitForEventWithChannels(vi_ctype, channel_name_ctype, event_id_ctype, timeout_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def _error_message(self, error_code): - r"""_error_message + r'''_error_message Converts a status code returned by an instrument driver method into a user-readable string. @@ -6217,31 +5696,20 @@ def _error_message(self, error_code): code you specify. You must pass a ViChar array with at least 256 bytes. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus(error_code) # case S150 error_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niDCPower_error_message( - vi_ctype, error_code_ctype, error_message_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + error_code = self._library.niDCPower_error_message(vi_ctype, error_code_ctype, error_message_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return error_message_ctype.value.decode(self._encoding) class Session(_SessionBase): - """An NI-DCPower session to a National Instruments Programmable Power Supply or Source Measure Unit.""" - - def __init__( - self, - resource_name, - channels=None, - reset=False, - options={}, - independent_channels=True, - ): - r"""An NI-DCPower session to a National Instruments Programmable Power Supply or Source Measure Unit. + '''An NI-DCPower session to a National Instruments Programmable Power Supply or Source Measure Unit.''' + + def __init__(self, resource_name, channels=None, reset=False, options={}, independent_channels=True): + r'''An NI-DCPower session to a National Instruments Programmable Power Supply or Source Measure Unit. Creates and returns a new NI-DCPower session to the instrument(s) and channel(s) specified in **resource name** to be used in all subsequent NI-DCPower method calls. With this method, @@ -6348,27 +5816,17 @@ def __init__( Returns: session (nidcpower.Session): A session object representing the device. - """ - super(Session, self).__init__( - repeated_capability_list=[], - vi=None, - library=None, - encoding=None, - freeze_it=False, - ) - resource_name = _converters.convert_repeated_capabilities_without_prefix( - resource_name - ) + ''' + super(Session, self).__init__(repeated_capability_list=[], vi=None, library=None, encoding=None, freeze_it=False) + resource_name = _converters.convert_repeated_capabilities_without_prefix(resource_name) channels = _converters.convert_repeated_capabilities_without_prefix(channels) options = _converters.convert_init_with_options_dictionary(options) self._library = _library_singleton.get() - self._encoding = "windows-1251" + self._encoding = 'windows-1251' # Call specified init function self._vi = 0 # This must be set before calling _fancy_initialize(). - self._vi = self._fancy_initialize( - resource_name, channels, reset, options, independent_channels - ) + self._vi = self._fancy_initialize(resource_name, channels, reset, options, independent_channels) # Store the parameter list for later printing in __repr__ param_list = [] @@ -6377,7 +5835,7 @@ def __init__( param_list.append("reset=" + pp.pformat(reset)) param_list.append("options=" + pp.pformat(options)) param_list.append("independent_channels=" + pp.pformat(independent_channels)) - self._param_list = ", ".join(param_list) + self._param_list = ', '.join(param_list) self._is_frozen = True @@ -6388,7 +5846,7 @@ def __exit__(self, exc_type, exc_value, traceback): self.close() def close(self): - """close + '''close Closes the session specified in **vi** and deallocates the resources that NI-DCPower reserves. If power output is enabled when you call this @@ -6407,7 +5865,7 @@ def close(self): Note: This method is not needed when using the session context manager - """ + ''' try: self._close() except errors.DriverError: @@ -6415,11 +5873,11 @@ def close(self): raise self._vi = 0 - """ These are code-generated """ + ''' These are code-generated ''' @ivi_synchronized def disable(self): - r"""disable + r'''disable This method performs the same actions as the reset method, except that this method also immediately sets the @@ -6427,17 +5885,15 @@ def disable(self): This method opens the output relay on devices that have an output relay. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDCPower_Disable(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def export_attribute_configuration_buffer(self): - r"""export_attribute_configuration_buffer + r'''export_attribute_configuration_buffer Exports the property configuration of the session to the specified configuration buffer. @@ -6486,33 +5942,23 @@ def export_attribute_configuration_buffer(self): configuration (bytes): Specifies the byte array buffer to be populated with the exported property configuration. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 size_ctype = _visatype.ViInt32() # case S170 configuration_ctype = None # case B580 - error_code = self._library.niDCPower_ExportAttributeConfigurationBuffer( - vi_ctype, size_ctype, configuration_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niDCPower_ExportAttributeConfigurationBuffer(vi_ctype, size_ctype, configuration_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) size_ctype = _visatype.ViInt32(error_code) # case S180 configuration_size = size_ctype.value # case B590 configuration_array = array.array("b", [0] * configuration_size) # case B590 - configuration_ctype = get_ctypes_pointer_for_buffer( - value=configuration_array, library_type=_visatype.ViInt8 - ) # case B590 - error_code = self._library.niDCPower_ExportAttributeConfigurationBuffer( - vi_ctype, size_ctype, configuration_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + configuration_ctype = get_ctypes_pointer_for_buffer(value=configuration_array, library_type=_visatype.ViInt8) # case B590 + error_code = self._library.niDCPower_ExportAttributeConfigurationBuffer(vi_ctype, size_ctype, configuration_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return _converters.convert_to_bytes(configuration_array) @ivi_synchronized def export_attribute_configuration_file(self, file_path): - r"""export_attribute_configuration_file + r'''export_attribute_configuration_file Exports the property configuration of the session to the specified file. @@ -6563,28 +6009,15 @@ def export_attribute_configuration_file(self, file_path): method returns an error. **Default file extension:** .nidcpowerconfig - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer( - file_path.encode(self._encoding) - ) # case C020 - error_code = self._library.niDCPower_ExportAttributeConfigurationFile( - vi_ctype, file_path_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 + error_code = self._library.niDCPower_ExportAttributeConfigurationFile(vi_ctype, file_path_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return - def _fancy_initialize( - self, - resource_name, - channels=None, - reset=False, - option_string="", - independent_channels=True, - ): - """_fancy_initialize + def _fancy_initialize(self, resource_name, channels=None, reset=False, option_string="", independent_channels=True): + '''_fancy_initialize Creates and returns a new NI-DCPower session to the instrument(s) and channel(s) specified in **resource name** to be used in all subsequent NI-DCPower method calls. With this method, @@ -6680,62 +6113,43 @@ def _fancy_initialize( vi (int): Returns a session handle that you use to identify the device in all subsequent NI-DCPower method calls. - """ + ''' if independent_channels: resource_string = resource_name # store potential modifications to resource_name in a separate variable if channels: # if we have a channels arg, we need to try and combine it with the resource name # before calling into initialize with independent channels - channel_list = ( - resource_name + "/" + channel for channel in channels.split(",") - ) + channel_list = (resource_name + "/" + channel for channel in channels.split(",")) resource_string = ",".join(channel_list) import warnings - warnings.warn( "Attempting to initialize an independent channels session with a channels argument. The resource " - "name '" - + resource_name - + "' will be combined with the channels '" - + channels - + "' to form the " - "fully-qualified channel list '" - + resource_string - + "'. To avoid this warning, use a " + "name '" + resource_name + "' will be combined with the channels '" + channels + "' to form the " + "fully-qualified channel list '" + resource_string + "'. To avoid this warning, use a " "fully-qualified channel list as the resource name instead of providing a channels argument.", - DeprecationWarning, + DeprecationWarning ) if "," in resource_name: raise ValueError( - "Channels cannot be combined with multiple instruments in the resource name '" - + resource_name - + "'. " + "Channels cannot be combined with multiple instruments in the resource name '" + resource_name + "'. " "Specify a list of fully-qualified channels as the resource name instead of supplying a " "channels argument." ) - return self._initialize_with_independent_channels( - resource_string, reset, option_string - ) + return self._initialize_with_independent_channels(resource_string, reset, option_string) else: import warnings + warnings.warn("Initializing session without independent channels enabled.", DeprecationWarning) - warnings.warn( - "Initializing session without independent channels enabled.", - DeprecationWarning, - ) - - return self._initialize_with_channels( - resource_name, channels, reset, option_string - ) + return self._initialize_with_channels(resource_name, channels, reset, option_string) @ivi_synchronized def get_channel_name(self, index): - r"""get_channel_name + r'''get_channel_name Retrieves the output **channelName** that corresponds to the requested **index**. Use the channel_count property to @@ -6749,30 +6163,22 @@ def get_channel_name(self, index): Returns: channel_name (str): Returns the output channel name that corresponds to **index**. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 index_ctype = _visatype.ViInt32(index) # case S150 buffer_size_ctype = _visatype.ViInt32() # case S170 channel_name_ctype = None # case C050 - error_code = self._library.niDCPower_GetChannelName( - vi_ctype, index_ctype, buffer_size_ctype, channel_name_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niDCPower_GetChannelName(vi_ctype, index_ctype, buffer_size_ctype, channel_name_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 channel_name_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niDCPower_GetChannelName( - vi_ctype, index_ctype, buffer_size_ctype, channel_name_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_GetChannelName(vi_ctype, index_ctype, buffer_size_ctype, channel_name_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return channel_name_ctype.value.decode(self._encoding) @ivi_synchronized def get_channel_names(self, indices): - r"""get_channel_names + r'''get_channel_names Returns a list of channel names for the given channel indices. @@ -6789,36 +6195,22 @@ def get_channel_names(self, indices): Returns: names (list of str): The channel name(s) at the specified indices. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - indices_ctype = ctypes.create_string_buffer( - _converters.convert_repeated_capabilities_without_prefix(indices).encode( - self._encoding - ) - ) # case C040 + indices_ctype = ctypes.create_string_buffer(_converters.convert_repeated_capabilities_without_prefix(indices).encode(self._encoding)) # case C040 buffer_size_ctype = _visatype.ViInt32() # case S170 names_ctype = None # case C050 - error_code = self._library.niDCPower_GetChannelNameFromString( - vi_ctype, indices_ctype, buffer_size_ctype, names_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niDCPower_GetChannelNameFromString(vi_ctype, indices_ctype, buffer_size_ctype, names_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 names_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niDCPower_GetChannelNameFromString( - vi_ctype, indices_ctype, buffer_size_ctype, names_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return _converters.convert_comma_separated_string_to_list( - names_ctype.value.decode(self._encoding) - ) + error_code = self._library.niDCPower_GetChannelNameFromString(vi_ctype, indices_ctype, buffer_size_ctype, names_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return _converters.convert_comma_separated_string_to_list(names_ctype.value.decode(self._encoding)) @ivi_synchronized def _get_ext_cal_last_date_and_time(self): - r"""_get_ext_cal_last_date_and_time + r'''_get_ext_cal_last_date_and_time Returns the date and time of the last successful calibration. The time returned is 24-hour (military) local time; for example, if the device @@ -6837,35 +6229,20 @@ def _get_ext_cal_last_date_and_time(self): minute (int): Returns the **minute** in which the device was last calibrated. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 year_ctype = _visatype.ViInt32() # case S220 month_ctype = _visatype.ViInt32() # case S220 day_ctype = _visatype.ViInt32() # case S220 hour_ctype = _visatype.ViInt32() # case S220 minute_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDCPower_GetExtCalLastDateAndTime( - vi_ctype, - None if year_ctype is None else (ctypes.pointer(year_ctype)), - None if month_ctype is None else (ctypes.pointer(month_ctype)), - None if day_ctype is None else (ctypes.pointer(day_ctype)), - None if hour_ctype is None else (ctypes.pointer(hour_ctype)), - None if minute_ctype is None else (ctypes.pointer(minute_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return ( - int(year_ctype.value), - int(month_ctype.value), - int(day_ctype.value), - int(hour_ctype.value), - int(minute_ctype.value), - ) + error_code = self._library.niDCPower_GetExtCalLastDateAndTime(vi_ctype, None if year_ctype is None else (ctypes.pointer(year_ctype)), None if month_ctype is None else (ctypes.pointer(month_ctype)), None if day_ctype is None else (ctypes.pointer(day_ctype)), None if hour_ctype is None else (ctypes.pointer(hour_ctype)), None if minute_ctype is None else (ctypes.pointer(minute_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return int(year_ctype.value), int(month_ctype.value), int(day_ctype.value), int(hour_ctype.value), int(minute_ctype.value) @ivi_synchronized def get_ext_cal_last_temp(self): - r"""get_ext_cal_last_temp + r'''get_ext_cal_last_temp Returns the onboard **temperature** of the device, in degrees Celsius, during the last successful external calibration. @@ -6874,21 +6251,16 @@ def get_ext_cal_last_temp(self): temperature (float): Returns the onboard **temperature** of the device, in degrees Celsius, during the last successful external calibration. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 temperature_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDCPower_GetExtCalLastTemp( - vi_ctype, - None if temperature_ctype is None else (ctypes.pointer(temperature_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_GetExtCalLastTemp(vi_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(temperature_ctype.value) @ivi_synchronized def get_ext_cal_recommended_interval(self): - r"""get_ext_cal_recommended_interval + r'''get_ext_cal_recommended_interval Returns the recommended maximum interval, in **months**, between external calibrations. @@ -6897,33 +6269,29 @@ def get_ext_cal_recommended_interval(self): months (hightime.timedelta): Specifies the recommended maximum interval, in **months**, between external calibrations. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 months_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDCPower_GetExtCalRecommendedInterval( - vi_ctype, None if months_ctype is None else (ctypes.pointer(months_ctype)) - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_GetExtCalRecommendedInterval(vi_ctype, None if months_ctype is None else (ctypes.pointer(months_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return _converters.convert_month_to_timedelta(int(months_ctype.value)) @ivi_synchronized def get_ext_cal_last_date_and_time(self): - """get_ext_cal_last_date_and_time + '''get_ext_cal_last_date_and_time Returns the date and time of the last successful calibration. Returns: month (hightime.datetime): Indicates date and time of the last calibration. - """ + ''' year, month, day, hour, minute = self._get_ext_cal_last_date_and_time() return hightime.datetime(year, month, day, hour, minute) @ivi_synchronized def get_self_cal_last_date_and_time(self): - """get_self_cal_last_date_and_time + '''get_self_cal_last_date_and_time Returns the date and time of the oldest successful self-calibration from among the channels in the session. @@ -6932,13 +6300,13 @@ def get_self_cal_last_date_and_time(self): Returns: month (hightime.datetime): Returns the date and time the device was last calibrated. - """ + ''' year, month, day, hour, minute = self._get_self_cal_last_date_and_time() return hightime.datetime(year, month, day, hour, minute) @ivi_synchronized def _get_self_cal_last_date_and_time(self): - r"""_get_self_cal_last_date_and_time + r'''_get_self_cal_last_date_and_time Returns the date and time of the oldest successful self-calibration from among the channels in the session. @@ -6967,35 +6335,20 @@ def _get_self_cal_last_date_and_time(self): minute (int): Returns the **minute** in which the device was last calibrated. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 year_ctype = _visatype.ViInt32() # case S220 month_ctype = _visatype.ViInt32() # case S220 day_ctype = _visatype.ViInt32() # case S220 hour_ctype = _visatype.ViInt32() # case S220 minute_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDCPower_GetSelfCalLastDateAndTime( - vi_ctype, - None if year_ctype is None else (ctypes.pointer(year_ctype)), - None if month_ctype is None else (ctypes.pointer(month_ctype)), - None if day_ctype is None else (ctypes.pointer(day_ctype)), - None if hour_ctype is None else (ctypes.pointer(hour_ctype)), - None if minute_ctype is None else (ctypes.pointer(minute_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return ( - int(year_ctype.value), - int(month_ctype.value), - int(day_ctype.value), - int(hour_ctype.value), - int(minute_ctype.value), - ) + error_code = self._library.niDCPower_GetSelfCalLastDateAndTime(vi_ctype, None if year_ctype is None else (ctypes.pointer(year_ctype)), None if month_ctype is None else (ctypes.pointer(month_ctype)), None if day_ctype is None else (ctypes.pointer(day_ctype)), None if hour_ctype is None else (ctypes.pointer(hour_ctype)), None if minute_ctype is None else (ctypes.pointer(minute_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return int(year_ctype.value), int(month_ctype.value), int(day_ctype.value), int(hour_ctype.value), int(minute_ctype.value) @ivi_synchronized def get_self_cal_last_temp(self): - r"""get_self_cal_last_temp + r'''get_self_cal_last_temp Returns the onboard temperature of the device, in degrees Celsius, during the oldest successful self-calibration from among the channels in @@ -7017,21 +6370,16 @@ def get_self_cal_last_temp(self): temperature (float): Returns the onboard **temperature** of the device, in degrees Celsius, during the oldest successful calibration. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 temperature_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDCPower_GetSelfCalLastTemp( - vi_ctype, - None if temperature_ctype is None else (ctypes.pointer(temperature_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_GetSelfCalLastTemp(vi_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(temperature_ctype.value) @ivi_synchronized def import_attribute_configuration_buffer(self, configuration): - r"""import_attribute_configuration_buffer + r'''import_attribute_configuration_buffer Imports a property configuration to the session from the specified configuration buffer. @@ -7079,28 +6427,18 @@ def import_attribute_configuration_buffer(self, configuration): configuration (bytes): Specifies the byte array buffer that contains the property configuration to import. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - size_ctype = _visatype.ViInt32( - 0 if configuration is None else len(configuration) - ) # case S160 - configuration_converted = _converters.convert_to_bytes( - configuration - ) # case B520 - configuration_ctype = get_ctypes_pointer_for_buffer( - value=configuration_converted, library_type=_visatype.ViInt8 - ) # case B520 - error_code = self._library.niDCPower_ImportAttributeConfigurationBuffer( - vi_ctype, size_ctype, configuration_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + size_ctype = _visatype.ViInt32(0 if configuration is None else len(configuration)) # case S160 + configuration_converted = _converters.convert_to_bytes(configuration) # case B520 + configuration_ctype = get_ctypes_pointer_for_buffer(value=configuration_converted, library_type=_visatype.ViInt8) # case B520 + error_code = self._library.niDCPower_ImportAttributeConfigurationBuffer(vi_ctype, size_ctype, configuration_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def import_attribute_configuration_file(self, file_path): - r"""import_attribute_configuration_file + r'''import_attribute_configuration_file Imports a property configuration to the session from the specified file. @@ -7150,21 +6488,15 @@ def import_attribute_configuration_file(self, file_path): method returns an error. **Default File Extension:** .nidcpowerconfig - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer( - file_path.encode(self._encoding) - ) # case C020 - error_code = self._library.niDCPower_ImportAttributeConfigurationFile( - vi_ctype, file_path_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 + error_code = self._library.niDCPower_ImportAttributeConfigurationFile(vi_ctype, file_path_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def _initialize_with_channels(self, resource_name, channels, reset, option_string): - r"""_initialize_with_channels + r'''_initialize_with_channels Creates and returns a new NI-DCPower session to the power supply or SMU specified in **resource name** to be used in all subsequent NI-DCPower @@ -7231,34 +6563,18 @@ def _initialize_with_channels(self, resource_name, channels, reset, option_strin vi (int): Returns a session handle that you use to identify the device in all subsequent NI-DCPower method calls. - """ - resource_name_ctype = ctypes.create_string_buffer( - resource_name.encode(self._encoding) - ) # case C020 - channels_ctype = ctypes.create_string_buffer( - channels.encode(self._encoding) - ) # case C020 + ''' + resource_name_ctype = ctypes.create_string_buffer(resource_name.encode(self._encoding)) # case C020 + channels_ctype = ctypes.create_string_buffer(channels.encode(self._encoding)) # case C020 reset_ctype = _visatype.ViBoolean(reset) # case S150 - option_string_ctype = ctypes.create_string_buffer( - option_string.encode(self._encoding) - ) # case C020 + option_string_ctype = ctypes.create_string_buffer(option_string.encode(self._encoding)) # case C020 vi_ctype = _visatype.ViSession() # case S220 - error_code = self._library.niDCPower_InitializeWithChannels( - resource_name_ctype, - channels_ctype, - reset_ctype, - option_string_ctype, - None if vi_ctype is None else (ctypes.pointer(vi_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_InitializeWithChannels(resource_name_ctype, channels_ctype, reset_ctype, option_string_ctype, None if vi_ctype is None else (ctypes.pointer(vi_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(vi_ctype.value) - def _initialize_with_independent_channels( - self, resource_name, reset, option_string - ): - r"""_initialize_with_independent_channels + def _initialize_with_independent_channels(self, resource_name, reset, option_string): + r'''_initialize_with_independent_channels Creates a new NI-DCPower session to the specified instrument(s) and channel(s) and returns a session handle to be used in all subsequent NI-DCPower method calls. @@ -7333,29 +6649,18 @@ def _initialize_with_independent_channels( vi (int): Returns a session handle that you use to identify the session in all subsequent NI-DCPower method calls. - """ - resource_name_ctype = ctypes.create_string_buffer( - resource_name.encode(self._encoding) - ) # case C020 + ''' + resource_name_ctype = ctypes.create_string_buffer(resource_name.encode(self._encoding)) # case C020 reset_ctype = _visatype.ViBoolean(reset) # case S150 - option_string_ctype = ctypes.create_string_buffer( - option_string.encode(self._encoding) - ) # case C020 + option_string_ctype = ctypes.create_string_buffer(option_string.encode(self._encoding)) # case C020 vi_ctype = _visatype.ViSession() # case S220 - error_code = self._library.niDCPower_InitializeWithIndependentChannels( - resource_name_ctype, - reset_ctype, - option_string_ctype, - None if vi_ctype is None else (ctypes.pointer(vi_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_InitializeWithIndependentChannels(resource_name_ctype, reset_ctype, option_string_ctype, None if vi_ctype is None else (ctypes.pointer(vi_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(vi_ctype.value) @ivi_synchronized def read_current_temperature(self): - r"""read_current_temperature + r'''read_current_temperature Returns the current onboard **temperature**, in degrees Celsius, of the device. @@ -7363,21 +6668,16 @@ def read_current_temperature(self): Returns: temperature (float): Returns the onboard **temperature**, in degrees Celsius, of the device. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 temperature_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDCPower_ReadCurrentTemperature( - vi_ctype, - None if temperature_ctype is None else (ctypes.pointer(temperature_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDCPower_ReadCurrentTemperature(vi_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(temperature_ctype.value) @ivi_synchronized def reset_device(self): - r"""reset_device + r'''reset_device Resets the device to a known state. The method disables power generation, resets session properties to their default values, clears @@ -7392,17 +6692,15 @@ def reset_device(self): This will also open the output relay on devices that have an output relay. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDCPower_ResetDevice(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def reset_with_defaults(self): - r"""reset_with_defaults + r'''reset_with_defaults Resets the device to a known state. This method disables power generation, resets session properties to their default values, commits @@ -7411,16 +6709,14 @@ def reset_with_defaults(self): state. In addition to exhibiting the behavior of the reset method, this method can assign user-defined default values for configurable properties from the IVI configuration. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDCPower_ResetWithDefaults(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def _close(self): - r"""_close + r'''_close Closes the session specified in **vi** and deallocates the resources that NI-DCPower reserves. If power output is enabled when you call this @@ -7436,17 +6732,15 @@ def _close(self): Note: One or more of the referenced methods are not in the Python API for this driver. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDCPower_close(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def self_test(self): - """self_test + '''self_test Performs the device self-test routine and returns the test result(s). Calling this method implicitly calls the reset method. @@ -7468,7 +6762,7 @@ def self_test(self): +----------------+-------------------+ | 1 | Self test failed. | +----------------+-------------------+ - """ + ''' code, msg = self._self_test() if code: raise errors.SelfTestError(code, msg) @@ -7476,7 +6770,7 @@ def self_test(self): @ivi_synchronized def _self_test(self): - r"""_self_test + r'''_self_test Performs the device self-test routine and returns the test result(s). Calling this method implicitly calls the reset method. @@ -7500,20 +6794,13 @@ def _self_test(self): self_test_message (str): Returns the self-test result message. The size of this array must be at least 256 bytes. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 self_test_result_ctype = _visatype.ViInt16() # case S220 self_test_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niDCPower_self_test( - vi_ctype, - None - if self_test_result_ctype is None - else (ctypes.pointer(self_test_result_ctype)), - self_test_message_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return int(self_test_result_ctype.value), self_test_message_ctype.value.decode( - self._encoding - ) + error_code = self._library.niDCPower_self_test(vi_ctype, None if self_test_result_ctype is None else (ctypes.pointer(self_test_result_ctype)), self_test_message_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return int(self_test_result_ctype.value), self_test_message_ctype.value.decode(self._encoding) + + + diff --git a/generated/nidcpower/nidcpower/unit_tests/_matchers.py b/generated/nidcpower/nidcpower/unit_tests/_matchers.py index c4918400f..4aff4eb59 100644 --- a/generated/nidcpower/nidcpower/unit_tests/_matchers.py +++ b/generated/nidcpower/nidcpower/unit_tests/_matchers.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # This file was generated -"""Matcher classes used by unit tests in order to set mock expectations. +'''Matcher classes used by unit tests in order to set mock expectations. These work well with our visatype definitions. -""" +''' import ctypes import nidcpower._visatype as _visatype @@ -21,27 +21,15 @@ def __init__(self, expected_type, expected_value): def __eq__(self, other): if not isinstance(other, self.expected_type): - print( - "{0}: Unexpected type. Expected: {1}. Received: {2}".format( - self.__class__.__name__, self.expected_type, type(other) - ) - ) + print("{0}: Unexpected type. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_type, type(other))) return False if other.value != self.expected_value: - print( - "{0}: Unexpected value. Expected: {1}. Received: {2}".format( - self.__class__.__name__, self.expected_value, other.value - ) - ) + print("{0}: Unexpected value. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_value, other.value)) return False return True def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_type), - pp.pformat(self.expected_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) class _PointerMatcher(object): @@ -50,18 +38,12 @@ def __init__(self, expected_type): def __eq__(self, other): if not isinstance(other, ctypes.POINTER(self.expected_type)): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - ctypes.POINTER(self.expected_type), type(other) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(ctypes.POINTER(self.expected_type), type(other))) return False return True def __repr__(self): - return "{0}({1})".format( - self.__class__.__name__, pp.pformat(self.expected_type) - ) + return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_type)) class _BufferMatcher(object): @@ -88,47 +70,29 @@ def __eq__(self, other): pass # Because of object lifetimes, we may need to mock the other instance and provide lists instead of the actual array - if not isinstance(other, self.expected_type) and not isinstance( - other, list - ): - print( - "Unexpected type. Expected: {0} or {1}. Received: {2}".format( - self.expected_type, list, type(other) - ) - ) + if not isinstance(other, self.expected_type) and not isinstance(other, list): + print("Unexpected type. Expected: {0} or {1}. Received: {2}".format(self.expected_type, list, type(other))) return False if self.expected_size != len(other): - print( - "Unexpected length. Expected: {0}. Received: {1}".format( - self.expected_size, len(other) - ) - ) + print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(other))) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for i in range(0, len(self.expected_value)): if self.expected_value[i] != other[i]: - print( - "Unexpected value at index {0}. Expected: {1}. Received: {2}".format( - i, self.expected_value[i], other[i] - ) - ) + print("Unexpected value at index {0}. Expected: {1}. Received: {2}".format(i, self.expected_value[i], other[i])) return False return True def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self._expected_element_type), - pp.pformat(self._expected_size_or_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self._expected_element_type), pp.pformat(self._expected_size_or_value)) def __str__(self): - ret_str = self.__repr__() + "\n" - ret_str += " expected_type = " + str(self.expected_type) + "\n" - ret_str += " expected_value = " + str(self.expected_value) + "\n" - ret_str += " expected_size = " + str(self.expected_size) + "\n" + ret_str = self.__repr__() + '\n' + ret_str += ' expected_type = ' + str(self.expected_type) + '\n' + ret_str += ' expected_value = ' + str(self.expected_value) + '\n' + ret_str += ' expected_size = ' + str(self.expected_size) + '\n' return ret_str @@ -148,37 +112,21 @@ def __eq__(self, other): pass if not isinstance(other, ctypes.Array): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_type, type(other) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(other))) return False - if ( - len(other) < len(self.expected_string_value) + 1 - ): # +1 for NULL terminating character - print( - "Unexpected length in C string. Expected at least: {0}. Received {1}".format( - len(other), len(self.expected_string_value) + 1 - ) - ) + if len(other) < len(self.expected_string_value) + 1: # +1 for NULL terminating character + print("Unexpected length in C string. Expected at least: {0}. Received {1}".format(len(other), len(self.expected_string_value) + 1)) return False if not isinstance(other[0], bytes): print("Unexpected type. Not a string. Received: {0}".format(type(other[0]))) return False if other.value.decode("ascii") != self.expected_string_value: - print( - "Unexpected value. Expected {0}. Received: {1}".format( - self.expected_string_value, other.value.decode - ) - ) + print("Unexpected value. Expected {0}. Received: {1}".format(self.expected_string_value, other.value.decode)) return False return True def __repr__(self): - return "{0}({1})".format( - self.__class__.__name__, pp.pformat(self.expected_string_value) - ) + return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_string_value)) # Custom Type @@ -191,11 +139,7 @@ def _compare_ctype_structs(expected, actual): expected_val = getattr(expected, field_name) actual_val = getattr(actual, field_name) if expected_val != actual_val: - print( - "Unexpected value field {0}. Expected: {1}. Received: {2}".format( - field_name, expected_val, actual_val - ) - ) + print("Unexpected value field {0}. Expected: {1}. Received: {2}".format(field_name, expected_val, actual_val)) return False return True @@ -207,20 +151,12 @@ def __init__(self, expected_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_type, type(actual) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) return False return _compare_ctype_structs(self.expected_value, actual) def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_type), - pp.pformat(self.expected_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) class CustomTypeBufferMatcher(object): @@ -232,48 +168,30 @@ def __init__(self, expected_element_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print( - "Unexpected array type. Expected: {0}. Received: {1}".format( - self.expected_type, type(actual) - ) - ) + print("Unexpected array type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) return False if self.expected_size != len(actual): - print( - "Unexpected length. Expected: {0}. Received: {1}".format( - self.expected_size, len(actual) - ) - ) + print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(actual))) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for a, e in zip(actual, self.expected_value): if not isinstance(a, self.expected_element_type): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_element_type, type(a) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_element_type, type(a))) return False if not _compare_ctype_structs(e, a): return False return True def __repr__(self): - expected_val_repr = ( - "[" + ", ".join([x.__repr__() for x in self.expected_value]) + "]" - ) - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_element_type), - expected_val_repr, - ) + expected_val_repr = '[' + ', '.join([x.__repr__() for x in self.expected_value]) + ']' + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_element_type), expected_val_repr) def __str__(self): - ret_str = self.__repr__() + "\n" - ret_str += " expected_type = " + str(self.expected_type) + "\n" - ret_str += " expected_size = " + str(self.expected_size) + "\n" + ret_str = self.__repr__() + '\n' + ret_str += ' expected_type = ' + str(self.expected_type) + '\n' + ret_str += ' expected_size = ' + str(self.expected_size) + '\n' return ret_str @@ -282,9 +200,7 @@ def __str__(self): class ViBooleanMatcher(_ScalarMatcher): def __init__(self, expected_value): - _ScalarMatcher.__init__( - self, _visatype.ViBoolean, 1 if expected_value is True else 0 - ) + _ScalarMatcher.__init__(self, _visatype.ViBoolean, 1 if expected_value is True else 0) class ViSessionMatcher(_ScalarMatcher): @@ -396,3 +312,6 @@ def __init__(self, expected_size_or_value): class ViSessionBufferMatcher(_BufferMatcher): def __init__(self, expected_size_or_value): _BufferMatcher.__init__(self, _visatype.ViSession, expected_size_or_value) + + + diff --git a/generated/nidcpower/nidcpower/unit_tests/_mock_helper.py b/generated/nidcpower/nidcpower/unit_tests/_mock_helper.py index f4dfb00bc..9af5ae091 100644 --- a/generated/nidcpower/nidcpower/unit_tests/_mock_helper.py +++ b/generated/nidcpower/nidcpower/unit_tests/_mock_helper.py @@ -16,168 +16,168 @@ def __init__(self, function, param=None): class SideEffectsHelper(object): def __init__(self): self._defaults = {} - self._defaults["AbortWithChannels"] = {} - self._defaults["AbortWithChannels"]["return"] = 0 - self._defaults["CalSelfCalibrate"] = {} - self._defaults["CalSelfCalibrate"]["return"] = 0 - self._defaults["ClearLatchedOutputCutoffState"] = {} - self._defaults["ClearLatchedOutputCutoffState"]["return"] = 0 - self._defaults["CommitWithChannels"] = {} - self._defaults["CommitWithChannels"]["return"] = 0 - self._defaults["ConfigureApertureTime"] = {} - self._defaults["ConfigureApertureTime"]["return"] = 0 - self._defaults["CreateAdvancedSequenceCommitStepWithChannels"] = {} - self._defaults["CreateAdvancedSequenceCommitStepWithChannels"]["return"] = 0 - self._defaults["CreateAdvancedSequenceStepWithChannels"] = {} - self._defaults["CreateAdvancedSequenceStepWithChannels"]["return"] = 0 - self._defaults["CreateAdvancedSequenceWithChannels"] = {} - self._defaults["CreateAdvancedSequenceWithChannels"]["return"] = 0 - self._defaults["DeleteAdvancedSequenceWithChannels"] = {} - self._defaults["DeleteAdvancedSequenceWithChannels"]["return"] = 0 - self._defaults["Disable"] = {} - self._defaults["Disable"]["return"] = 0 - self._defaults["ExportAttributeConfigurationBuffer"] = {} - self._defaults["ExportAttributeConfigurationBuffer"]["return"] = 0 - self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] = None - self._defaults["ExportAttributeConfigurationFile"] = {} - self._defaults["ExportAttributeConfigurationFile"]["return"] = 0 - self._defaults["FancyInitialize"] = {} - self._defaults["FancyInitialize"]["return"] = 0 - self._defaults["FancyInitialize"]["vi"] = None - self._defaults["FetchMultiple"] = {} - self._defaults["FetchMultiple"]["return"] = 0 - self._defaults["FetchMultiple"]["voltageMeasurements"] = None - self._defaults["FetchMultiple"]["currentMeasurements"] = None - self._defaults["FetchMultiple"]["inCompliance"] = None - self._defaults["FetchMultiple"]["actualCount"] = None - self._defaults["GetAttributeViBoolean"] = {} - self._defaults["GetAttributeViBoolean"]["return"] = 0 - self._defaults["GetAttributeViBoolean"]["attributeValue"] = None - self._defaults["GetAttributeViInt32"] = {} - self._defaults["GetAttributeViInt32"]["return"] = 0 - self._defaults["GetAttributeViInt32"]["attributeValue"] = None - self._defaults["GetAttributeViInt64"] = {} - self._defaults["GetAttributeViInt64"]["return"] = 0 - self._defaults["GetAttributeViInt64"]["attributeValue"] = None - self._defaults["GetAttributeViReal64"] = {} - self._defaults["GetAttributeViReal64"]["return"] = 0 - self._defaults["GetAttributeViReal64"]["attributeValue"] = None - self._defaults["GetAttributeViString"] = {} - self._defaults["GetAttributeViString"]["return"] = 0 - self._defaults["GetAttributeViString"]["attributeValue"] = None - self._defaults["GetChannelName"] = {} - self._defaults["GetChannelName"]["return"] = 0 - self._defaults["GetChannelName"]["channelName"] = None - self._defaults["GetChannelNameFromString"] = {} - self._defaults["GetChannelNameFromString"]["return"] = 0 - self._defaults["GetChannelNameFromString"]["channelName"] = None - self._defaults["GetError"] = {} - self._defaults["GetError"]["return"] = 0 - self._defaults["GetError"]["code"] = None - self._defaults["GetError"]["description"] = None - self._defaults["GetExtCalLastDateAndTime"] = {} - self._defaults["GetExtCalLastDateAndTime"]["return"] = 0 - self._defaults["GetExtCalLastDateAndTime"]["year"] = None - self._defaults["GetExtCalLastDateAndTime"]["month"] = None - self._defaults["GetExtCalLastDateAndTime"]["day"] = None - self._defaults["GetExtCalLastDateAndTime"]["hour"] = None - self._defaults["GetExtCalLastDateAndTime"]["minute"] = None - self._defaults["GetExtCalLastTemp"] = {} - self._defaults["GetExtCalLastTemp"]["return"] = 0 - self._defaults["GetExtCalLastTemp"]["temperature"] = None - self._defaults["GetExtCalRecommendedInterval"] = {} - self._defaults["GetExtCalRecommendedInterval"]["return"] = 0 - self._defaults["GetExtCalRecommendedInterval"]["months"] = None - self._defaults["GetSelfCalLastDateAndTime"] = {} - self._defaults["GetSelfCalLastDateAndTime"]["return"] = 0 - self._defaults["GetSelfCalLastDateAndTime"]["year"] = None - self._defaults["GetSelfCalLastDateAndTime"]["month"] = None - self._defaults["GetSelfCalLastDateAndTime"]["day"] = None - self._defaults["GetSelfCalLastDateAndTime"]["hour"] = None - self._defaults["GetSelfCalLastDateAndTime"]["minute"] = None - self._defaults["GetSelfCalLastTemp"] = {} - self._defaults["GetSelfCalLastTemp"]["return"] = 0 - self._defaults["GetSelfCalLastTemp"]["temperature"] = None - self._defaults["ImportAttributeConfigurationBuffer"] = {} - self._defaults["ImportAttributeConfigurationBuffer"]["return"] = 0 - self._defaults["ImportAttributeConfigurationFile"] = {} - self._defaults["ImportAttributeConfigurationFile"]["return"] = 0 - self._defaults["InitializeWithChannels"] = {} - self._defaults["InitializeWithChannels"]["return"] = 0 - self._defaults["InitializeWithChannels"]["vi"] = None - self._defaults["InitializeWithIndependentChannels"] = {} - self._defaults["InitializeWithIndependentChannels"]["return"] = 0 - self._defaults["InitializeWithIndependentChannels"]["vi"] = None - self._defaults["InitiateWithChannels"] = {} - self._defaults["InitiateWithChannels"]["return"] = 0 - self._defaults["LockSession"] = {} - self._defaults["LockSession"]["return"] = 0 - self._defaults["LockSession"]["callerHasLock"] = None - self._defaults["Measure"] = {} - self._defaults["Measure"]["return"] = 0 - self._defaults["Measure"]["measurement"] = None - self._defaults["MeasureMultiple"] = {} - self._defaults["MeasureMultiple"]["return"] = 0 - self._defaults["MeasureMultiple"]["voltageMeasurements"] = None - self._defaults["MeasureMultiple"]["currentMeasurements"] = None - self._defaults["ParseChannelCount"] = {} - self._defaults["ParseChannelCount"]["return"] = 0 - self._defaults["ParseChannelCount"]["numberOfChannels"] = None - self._defaults["QueryInCompliance"] = {} - self._defaults["QueryInCompliance"]["return"] = 0 - self._defaults["QueryInCompliance"]["inCompliance"] = None - self._defaults["QueryLatchedOutputCutoffState"] = {} - self._defaults["QueryLatchedOutputCutoffState"]["return"] = 0 - self._defaults["QueryLatchedOutputCutoffState"]["outputCutoffState"] = None - self._defaults["QueryMaxCurrentLimit"] = {} - self._defaults["QueryMaxCurrentLimit"]["return"] = 0 - self._defaults["QueryMaxCurrentLimit"]["maxCurrentLimit"] = None - self._defaults["QueryMaxVoltageLevel"] = {} - self._defaults["QueryMaxVoltageLevel"]["return"] = 0 - self._defaults["QueryMaxVoltageLevel"]["maxVoltageLevel"] = None - self._defaults["QueryMinCurrentLimit"] = {} - self._defaults["QueryMinCurrentLimit"]["return"] = 0 - self._defaults["QueryMinCurrentLimit"]["minCurrentLimit"] = None - self._defaults["QueryOutputState"] = {} - self._defaults["QueryOutputState"]["return"] = 0 - self._defaults["QueryOutputState"]["inState"] = None - self._defaults["ReadCurrentTemperature"] = {} - self._defaults["ReadCurrentTemperature"]["return"] = 0 - self._defaults["ReadCurrentTemperature"]["temperature"] = None - self._defaults["ResetDevice"] = {} - self._defaults["ResetDevice"]["return"] = 0 - self._defaults["ResetWithChannels"] = {} - self._defaults["ResetWithChannels"]["return"] = 0 - self._defaults["ResetWithDefaults"] = {} - self._defaults["ResetWithDefaults"]["return"] = 0 - self._defaults["SendSoftwareEdgeTriggerWithChannels"] = {} - self._defaults["SendSoftwareEdgeTriggerWithChannels"]["return"] = 0 - self._defaults["SetAttributeViBoolean"] = {} - self._defaults["SetAttributeViBoolean"]["return"] = 0 - self._defaults["SetAttributeViInt32"] = {} - self._defaults["SetAttributeViInt32"]["return"] = 0 - self._defaults["SetAttributeViInt64"] = {} - self._defaults["SetAttributeViInt64"]["return"] = 0 - self._defaults["SetAttributeViReal64"] = {} - self._defaults["SetAttributeViReal64"]["return"] = 0 - self._defaults["SetAttributeViString"] = {} - self._defaults["SetAttributeViString"]["return"] = 0 - self._defaults["SetSequence"] = {} - self._defaults["SetSequence"]["return"] = 0 - self._defaults["UnlockSession"] = {} - self._defaults["UnlockSession"]["return"] = 0 - self._defaults["UnlockSession"]["callerHasLock"] = None - self._defaults["WaitForEventWithChannels"] = {} - self._defaults["WaitForEventWithChannels"]["return"] = 0 - self._defaults["close"] = {} - self._defaults["close"]["return"] = 0 - self._defaults["error_message"] = {} - self._defaults["error_message"]["return"] = 0 - self._defaults["error_message"]["errorMessage"] = None - self._defaults["self_test"] = {} - self._defaults["self_test"]["return"] = 0 - self._defaults["self_test"]["selfTestResult"] = None - self._defaults["self_test"]["selfTestMessage"] = None + self._defaults['AbortWithChannels'] = {} + self._defaults['AbortWithChannels']['return'] = 0 + self._defaults['CalSelfCalibrate'] = {} + self._defaults['CalSelfCalibrate']['return'] = 0 + self._defaults['ClearLatchedOutputCutoffState'] = {} + self._defaults['ClearLatchedOutputCutoffState']['return'] = 0 + self._defaults['CommitWithChannels'] = {} + self._defaults['CommitWithChannels']['return'] = 0 + self._defaults['ConfigureApertureTime'] = {} + self._defaults['ConfigureApertureTime']['return'] = 0 + self._defaults['CreateAdvancedSequenceCommitStepWithChannels'] = {} + self._defaults['CreateAdvancedSequenceCommitStepWithChannels']['return'] = 0 + self._defaults['CreateAdvancedSequenceStepWithChannels'] = {} + self._defaults['CreateAdvancedSequenceStepWithChannels']['return'] = 0 + self._defaults['CreateAdvancedSequenceWithChannels'] = {} + self._defaults['CreateAdvancedSequenceWithChannels']['return'] = 0 + self._defaults['DeleteAdvancedSequenceWithChannels'] = {} + self._defaults['DeleteAdvancedSequenceWithChannels']['return'] = 0 + self._defaults['Disable'] = {} + self._defaults['Disable']['return'] = 0 + self._defaults['ExportAttributeConfigurationBuffer'] = {} + self._defaults['ExportAttributeConfigurationBuffer']['return'] = 0 + self._defaults['ExportAttributeConfigurationBuffer']['configuration'] = None + self._defaults['ExportAttributeConfigurationFile'] = {} + self._defaults['ExportAttributeConfigurationFile']['return'] = 0 + self._defaults['FancyInitialize'] = {} + self._defaults['FancyInitialize']['return'] = 0 + self._defaults['FancyInitialize']['vi'] = None + self._defaults['FetchMultiple'] = {} + self._defaults['FetchMultiple']['return'] = 0 + self._defaults['FetchMultiple']['voltageMeasurements'] = None + self._defaults['FetchMultiple']['currentMeasurements'] = None + self._defaults['FetchMultiple']['inCompliance'] = None + self._defaults['FetchMultiple']['actualCount'] = None + self._defaults['GetAttributeViBoolean'] = {} + self._defaults['GetAttributeViBoolean']['return'] = 0 + self._defaults['GetAttributeViBoolean']['attributeValue'] = None + self._defaults['GetAttributeViInt32'] = {} + self._defaults['GetAttributeViInt32']['return'] = 0 + self._defaults['GetAttributeViInt32']['attributeValue'] = None + self._defaults['GetAttributeViInt64'] = {} + self._defaults['GetAttributeViInt64']['return'] = 0 + self._defaults['GetAttributeViInt64']['attributeValue'] = None + self._defaults['GetAttributeViReal64'] = {} + self._defaults['GetAttributeViReal64']['return'] = 0 + self._defaults['GetAttributeViReal64']['attributeValue'] = None + self._defaults['GetAttributeViString'] = {} + self._defaults['GetAttributeViString']['return'] = 0 + self._defaults['GetAttributeViString']['attributeValue'] = None + self._defaults['GetChannelName'] = {} + self._defaults['GetChannelName']['return'] = 0 + self._defaults['GetChannelName']['channelName'] = None + self._defaults['GetChannelNameFromString'] = {} + self._defaults['GetChannelNameFromString']['return'] = 0 + self._defaults['GetChannelNameFromString']['channelName'] = None + self._defaults['GetError'] = {} + self._defaults['GetError']['return'] = 0 + self._defaults['GetError']['code'] = None + self._defaults['GetError']['description'] = None + self._defaults['GetExtCalLastDateAndTime'] = {} + self._defaults['GetExtCalLastDateAndTime']['return'] = 0 + self._defaults['GetExtCalLastDateAndTime']['year'] = None + self._defaults['GetExtCalLastDateAndTime']['month'] = None + self._defaults['GetExtCalLastDateAndTime']['day'] = None + self._defaults['GetExtCalLastDateAndTime']['hour'] = None + self._defaults['GetExtCalLastDateAndTime']['minute'] = None + self._defaults['GetExtCalLastTemp'] = {} + self._defaults['GetExtCalLastTemp']['return'] = 0 + self._defaults['GetExtCalLastTemp']['temperature'] = None + self._defaults['GetExtCalRecommendedInterval'] = {} + self._defaults['GetExtCalRecommendedInterval']['return'] = 0 + self._defaults['GetExtCalRecommendedInterval']['months'] = None + self._defaults['GetSelfCalLastDateAndTime'] = {} + self._defaults['GetSelfCalLastDateAndTime']['return'] = 0 + self._defaults['GetSelfCalLastDateAndTime']['year'] = None + self._defaults['GetSelfCalLastDateAndTime']['month'] = None + self._defaults['GetSelfCalLastDateAndTime']['day'] = None + self._defaults['GetSelfCalLastDateAndTime']['hour'] = None + self._defaults['GetSelfCalLastDateAndTime']['minute'] = None + self._defaults['GetSelfCalLastTemp'] = {} + self._defaults['GetSelfCalLastTemp']['return'] = 0 + self._defaults['GetSelfCalLastTemp']['temperature'] = None + self._defaults['ImportAttributeConfigurationBuffer'] = {} + self._defaults['ImportAttributeConfigurationBuffer']['return'] = 0 + self._defaults['ImportAttributeConfigurationFile'] = {} + self._defaults['ImportAttributeConfigurationFile']['return'] = 0 + self._defaults['InitializeWithChannels'] = {} + self._defaults['InitializeWithChannels']['return'] = 0 + self._defaults['InitializeWithChannels']['vi'] = None + self._defaults['InitializeWithIndependentChannels'] = {} + self._defaults['InitializeWithIndependentChannels']['return'] = 0 + self._defaults['InitializeWithIndependentChannels']['vi'] = None + self._defaults['InitiateWithChannels'] = {} + self._defaults['InitiateWithChannels']['return'] = 0 + self._defaults['LockSession'] = {} + self._defaults['LockSession']['return'] = 0 + self._defaults['LockSession']['callerHasLock'] = None + self._defaults['Measure'] = {} + self._defaults['Measure']['return'] = 0 + self._defaults['Measure']['measurement'] = None + self._defaults['MeasureMultiple'] = {} + self._defaults['MeasureMultiple']['return'] = 0 + self._defaults['MeasureMultiple']['voltageMeasurements'] = None + self._defaults['MeasureMultiple']['currentMeasurements'] = None + self._defaults['ParseChannelCount'] = {} + self._defaults['ParseChannelCount']['return'] = 0 + self._defaults['ParseChannelCount']['numberOfChannels'] = None + self._defaults['QueryInCompliance'] = {} + self._defaults['QueryInCompliance']['return'] = 0 + self._defaults['QueryInCompliance']['inCompliance'] = None + self._defaults['QueryLatchedOutputCutoffState'] = {} + self._defaults['QueryLatchedOutputCutoffState']['return'] = 0 + self._defaults['QueryLatchedOutputCutoffState']['outputCutoffState'] = None + self._defaults['QueryMaxCurrentLimit'] = {} + self._defaults['QueryMaxCurrentLimit']['return'] = 0 + self._defaults['QueryMaxCurrentLimit']['maxCurrentLimit'] = None + self._defaults['QueryMaxVoltageLevel'] = {} + self._defaults['QueryMaxVoltageLevel']['return'] = 0 + self._defaults['QueryMaxVoltageLevel']['maxVoltageLevel'] = None + self._defaults['QueryMinCurrentLimit'] = {} + self._defaults['QueryMinCurrentLimit']['return'] = 0 + self._defaults['QueryMinCurrentLimit']['minCurrentLimit'] = None + self._defaults['QueryOutputState'] = {} + self._defaults['QueryOutputState']['return'] = 0 + self._defaults['QueryOutputState']['inState'] = None + self._defaults['ReadCurrentTemperature'] = {} + self._defaults['ReadCurrentTemperature']['return'] = 0 + self._defaults['ReadCurrentTemperature']['temperature'] = None + self._defaults['ResetDevice'] = {} + self._defaults['ResetDevice']['return'] = 0 + self._defaults['ResetWithChannels'] = {} + self._defaults['ResetWithChannels']['return'] = 0 + self._defaults['ResetWithDefaults'] = {} + self._defaults['ResetWithDefaults']['return'] = 0 + self._defaults['SendSoftwareEdgeTriggerWithChannels'] = {} + self._defaults['SendSoftwareEdgeTriggerWithChannels']['return'] = 0 + self._defaults['SetAttributeViBoolean'] = {} + self._defaults['SetAttributeViBoolean']['return'] = 0 + self._defaults['SetAttributeViInt32'] = {} + self._defaults['SetAttributeViInt32']['return'] = 0 + self._defaults['SetAttributeViInt64'] = {} + self._defaults['SetAttributeViInt64']['return'] = 0 + self._defaults['SetAttributeViReal64'] = {} + self._defaults['SetAttributeViReal64']['return'] = 0 + self._defaults['SetAttributeViString'] = {} + self._defaults['SetAttributeViString']['return'] = 0 + self._defaults['SetSequence'] = {} + self._defaults['SetSequence']['return'] = 0 + self._defaults['UnlockSession'] = {} + self._defaults['UnlockSession']['return'] = 0 + self._defaults['UnlockSession']['callerHasLock'] = None + self._defaults['WaitForEventWithChannels'] = {} + self._defaults['WaitForEventWithChannels']['return'] = 0 + self._defaults['close'] = {} + self._defaults['close']['return'] = 0 + self._defaults['error_message'] = {} + self._defaults['error_message']['return'] = 0 + self._defaults['error_message']['errorMessage'] = None + self._defaults['self_test'] = {} + self._defaults['self_test']['return'] = 0 + self._defaults['self_test']['selfTestResult'] = None + self._defaults['self_test']['selfTestMessage'] = None def __getitem__(self, func): return self._defaults[func] @@ -186,142 +186,92 @@ def __setitem__(self, func, val): self._defaults[func] = val def niDCPower_AbortWithChannels(self, vi, channel_name): # noqa: N802 - if self._defaults["AbortWithChannels"]["return"] != 0: - return self._defaults["AbortWithChannels"]["return"] - return self._defaults["AbortWithChannels"]["return"] + if self._defaults['AbortWithChannels']['return'] != 0: + return self._defaults['AbortWithChannels']['return'] + return self._defaults['AbortWithChannels']['return'] def niDCPower_CalSelfCalibrate(self, vi, channel_name): # noqa: N802 - if self._defaults["CalSelfCalibrate"]["return"] != 0: - return self._defaults["CalSelfCalibrate"]["return"] - return self._defaults["CalSelfCalibrate"]["return"] + if self._defaults['CalSelfCalibrate']['return'] != 0: + return self._defaults['CalSelfCalibrate']['return'] + return self._defaults['CalSelfCalibrate']['return'] - def niDCPower_ClearLatchedOutputCutoffState( - self, vi, channel_name, output_cutoff_reason - ): # noqa: N802 - if self._defaults["ClearLatchedOutputCutoffState"]["return"] != 0: - return self._defaults["ClearLatchedOutputCutoffState"]["return"] - return self._defaults["ClearLatchedOutputCutoffState"]["return"] + def niDCPower_ClearLatchedOutputCutoffState(self, vi, channel_name, output_cutoff_reason): # noqa: N802 + if self._defaults['ClearLatchedOutputCutoffState']['return'] != 0: + return self._defaults['ClearLatchedOutputCutoffState']['return'] + return self._defaults['ClearLatchedOutputCutoffState']['return'] def niDCPower_CommitWithChannels(self, vi, channel_name): # noqa: N802 - if self._defaults["CommitWithChannels"]["return"] != 0: - return self._defaults["CommitWithChannels"]["return"] - return self._defaults["CommitWithChannels"]["return"] - - def niDCPower_ConfigureApertureTime( - self, vi, channel_name, aperture_time, units - ): # noqa: N802 - if self._defaults["ConfigureApertureTime"]["return"] != 0: - return self._defaults["ConfigureApertureTime"]["return"] - return self._defaults["ConfigureApertureTime"]["return"] - - def niDCPower_CreateAdvancedSequenceCommitStepWithChannels( - self, vi, channel_name, set_as_active_step - ): # noqa: N802 - if ( - self._defaults["CreateAdvancedSequenceCommitStepWithChannels"]["return"] - != 0 - ): - return self._defaults["CreateAdvancedSequenceCommitStepWithChannels"][ - "return" - ] - return self._defaults["CreateAdvancedSequenceCommitStepWithChannels"]["return"] - - def niDCPower_CreateAdvancedSequenceStepWithChannels( - self, vi, channel_name, set_as_active_step - ): # noqa: N802 - if self._defaults["CreateAdvancedSequenceStepWithChannels"]["return"] != 0: - return self._defaults["CreateAdvancedSequenceStepWithChannels"]["return"] - return self._defaults["CreateAdvancedSequenceStepWithChannels"]["return"] - - def niDCPower_CreateAdvancedSequenceWithChannels( - self, - vi, - channel_name, - sequence_name, - attribute_id_count, - attribute_ids, - set_as_active_sequence, - ): # noqa: N802 - if self._defaults["CreateAdvancedSequenceWithChannels"]["return"] != 0: - return self._defaults["CreateAdvancedSequenceWithChannels"]["return"] - return self._defaults["CreateAdvancedSequenceWithChannels"]["return"] - - def niDCPower_DeleteAdvancedSequenceWithChannels( - self, vi, channel_name, sequence_name - ): # noqa: N802 - if self._defaults["DeleteAdvancedSequenceWithChannels"]["return"] != 0: - return self._defaults["DeleteAdvancedSequenceWithChannels"]["return"] - return self._defaults["DeleteAdvancedSequenceWithChannels"]["return"] + if self._defaults['CommitWithChannels']['return'] != 0: + return self._defaults['CommitWithChannels']['return'] + return self._defaults['CommitWithChannels']['return'] + + def niDCPower_ConfigureApertureTime(self, vi, channel_name, aperture_time, units): # noqa: N802 + if self._defaults['ConfigureApertureTime']['return'] != 0: + return self._defaults['ConfigureApertureTime']['return'] + return self._defaults['ConfigureApertureTime']['return'] + + def niDCPower_CreateAdvancedSequenceCommitStepWithChannels(self, vi, channel_name, set_as_active_step): # noqa: N802 + if self._defaults['CreateAdvancedSequenceCommitStepWithChannels']['return'] != 0: + return self._defaults['CreateAdvancedSequenceCommitStepWithChannels']['return'] + return self._defaults['CreateAdvancedSequenceCommitStepWithChannels']['return'] + + def niDCPower_CreateAdvancedSequenceStepWithChannels(self, vi, channel_name, set_as_active_step): # noqa: N802 + if self._defaults['CreateAdvancedSequenceStepWithChannels']['return'] != 0: + return self._defaults['CreateAdvancedSequenceStepWithChannels']['return'] + return self._defaults['CreateAdvancedSequenceStepWithChannels']['return'] + + def niDCPower_CreateAdvancedSequenceWithChannels(self, vi, channel_name, sequence_name, attribute_id_count, attribute_ids, set_as_active_sequence): # noqa: N802 + if self._defaults['CreateAdvancedSequenceWithChannels']['return'] != 0: + return self._defaults['CreateAdvancedSequenceWithChannels']['return'] + return self._defaults['CreateAdvancedSequenceWithChannels']['return'] + + def niDCPower_DeleteAdvancedSequenceWithChannels(self, vi, channel_name, sequence_name): # noqa: N802 + if self._defaults['DeleteAdvancedSequenceWithChannels']['return'] != 0: + return self._defaults['DeleteAdvancedSequenceWithChannels']['return'] + return self._defaults['DeleteAdvancedSequenceWithChannels']['return'] def niDCPower_Disable(self, vi): # noqa: N802 - if self._defaults["Disable"]["return"] != 0: - return self._defaults["Disable"]["return"] - return self._defaults["Disable"]["return"] - - def niDCPower_ExportAttributeConfigurationBuffer( - self, vi, size, configuration - ): # noqa: N802 - if self._defaults["ExportAttributeConfigurationBuffer"]["return"] != 0: - return self._defaults["ExportAttributeConfigurationBuffer"]["return"] - if ( - self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] - is None - ): - raise MockFunctionCallError( - "niDCPower_ExportAttributeConfigurationBuffer", param="configuration" - ) + if self._defaults['Disable']['return'] != 0: + return self._defaults['Disable']['return'] + return self._defaults['Disable']['return'] + + def niDCPower_ExportAttributeConfigurationBuffer(self, vi, size, configuration): # noqa: N802 + if self._defaults['ExportAttributeConfigurationBuffer']['return'] != 0: + return self._defaults['ExportAttributeConfigurationBuffer']['return'] + if self._defaults['ExportAttributeConfigurationBuffer']['configuration'] is None: + raise MockFunctionCallError("niDCPower_ExportAttributeConfigurationBuffer", param='configuration') if size.value == 0: - return len( - self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] - ) + return len(self._defaults['ExportAttributeConfigurationBuffer']['configuration']) try: configuration_ref = configuration.contents except AttributeError: configuration_ref = configuration - for i in range( - len(self._defaults["ExportAttributeConfigurationBuffer"]["configuration"]) - ): - configuration_ref[i] = self._defaults["ExportAttributeConfigurationBuffer"][ - "configuration" - ][i] - return self._defaults["ExportAttributeConfigurationBuffer"]["return"] + for i in range(len(self._defaults['ExportAttributeConfigurationBuffer']['configuration'])): + configuration_ref[i] = self._defaults['ExportAttributeConfigurationBuffer']['configuration'][i] + return self._defaults['ExportAttributeConfigurationBuffer']['return'] def niDCPower_ExportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 - if self._defaults["ExportAttributeConfigurationFile"]["return"] != 0: - return self._defaults["ExportAttributeConfigurationFile"]["return"] - return self._defaults["ExportAttributeConfigurationFile"]["return"] - - def niDCPower_FancyInitialize( - self, resource_name, channels, reset, option_string, vi, independent_channels - ): # noqa: N802 - if self._defaults["FancyInitialize"]["return"] != 0: - return self._defaults["FancyInitialize"]["return"] + if self._defaults['ExportAttributeConfigurationFile']['return'] != 0: + return self._defaults['ExportAttributeConfigurationFile']['return'] + return self._defaults['ExportAttributeConfigurationFile']['return'] + + def niDCPower_FancyInitialize(self, resource_name, channels, reset, option_string, vi, independent_channels): # noqa: N802 + if self._defaults['FancyInitialize']['return'] != 0: + return self._defaults['FancyInitialize']['return'] # vi - if self._defaults["FancyInitialize"]["vi"] is None: - raise MockFunctionCallError("niDCPower_FancyInitialize", param="vi") + if self._defaults['FancyInitialize']['vi'] is None: + raise MockFunctionCallError("niDCPower_FancyInitialize", param='vi') if vi is not None: - vi.contents.value = self._defaults["FancyInitialize"]["vi"] - return self._defaults["FancyInitialize"]["return"] - - def niDCPower_FetchMultiple( - self, - vi, - channel_name, - timeout, - count, - voltage_measurements, - current_measurements, - in_compliance, - actual_count, - ): # noqa: N802 - if self._defaults["FetchMultiple"]["return"] != 0: - return self._defaults["FetchMultiple"]["return"] + vi.contents.value = self._defaults['FancyInitialize']['vi'] + return self._defaults['FancyInitialize']['return'] + + def niDCPower_FetchMultiple(self, vi, channel_name, timeout, count, voltage_measurements, current_measurements, in_compliance, actual_count): # noqa: N802 + if self._defaults['FetchMultiple']['return'] != 0: + return self._defaults['FetchMultiple']['return'] # voltage_measurements - if self._defaults["FetchMultiple"]["voltageMeasurements"] is None: - raise MockFunctionCallError( - "niDCPower_FetchMultiple", param="voltageMeasurements" - ) - test_value = self._defaults["FetchMultiple"]["voltageMeasurements"] + if self._defaults['FetchMultiple']['voltageMeasurements'] is None: + raise MockFunctionCallError("niDCPower_FetchMultiple", param='voltageMeasurements') + test_value = self._defaults['FetchMultiple']['voltageMeasurements'] try: voltage_measurements_ref = voltage_measurements.contents except AttributeError: @@ -330,11 +280,9 @@ def niDCPower_FetchMultiple( for i in range(len(test_value)): voltage_measurements_ref[i] = test_value[i] # current_measurements - if self._defaults["FetchMultiple"]["currentMeasurements"] is None: - raise MockFunctionCallError( - "niDCPower_FetchMultiple", param="currentMeasurements" - ) - test_value = self._defaults["FetchMultiple"]["currentMeasurements"] + if self._defaults['FetchMultiple']['currentMeasurements'] is None: + raise MockFunctionCallError("niDCPower_FetchMultiple", param='currentMeasurements') + test_value = self._defaults['FetchMultiple']['currentMeasurements'] try: current_measurements_ref = current_measurements.contents except AttributeError: @@ -343,9 +291,9 @@ def niDCPower_FetchMultiple( for i in range(len(test_value)): current_measurements_ref[i] = test_value[i] # in_compliance - if self._defaults["FetchMultiple"]["inCompliance"] is None: - raise MockFunctionCallError("niDCPower_FetchMultiple", param="inCompliance") - test_value = self._defaults["FetchMultiple"]["inCompliance"] + if self._defaults['FetchMultiple']['inCompliance'] is None: + raise MockFunctionCallError("niDCPower_FetchMultiple", param='inCompliance') + test_value = self._defaults['FetchMultiple']['inCompliance'] try: in_compliance_ref = in_compliance.contents except AttributeError: @@ -354,345 +302,249 @@ def niDCPower_FetchMultiple( for i in range(len(test_value)): in_compliance_ref[i] = test_value[i] # actual_count - if self._defaults["FetchMultiple"]["actualCount"] is None: - raise MockFunctionCallError("niDCPower_FetchMultiple", param="actualCount") + if self._defaults['FetchMultiple']['actualCount'] is None: + raise MockFunctionCallError("niDCPower_FetchMultiple", param='actualCount') if actual_count is not None: - actual_count.contents.value = self._defaults["FetchMultiple"]["actualCount"] - return self._defaults["FetchMultiple"]["return"] - - def niDCPower_GetAttributeViBoolean( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["GetAttributeViBoolean"]["return"] != 0: - return self._defaults["GetAttributeViBoolean"]["return"] + actual_count.contents.value = self._defaults['FetchMultiple']['actualCount'] + return self._defaults['FetchMultiple']['return'] + + def niDCPower_GetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['GetAttributeViBoolean']['return'] != 0: + return self._defaults['GetAttributeViBoolean']['return'] # attribute_value - if self._defaults["GetAttributeViBoolean"]["attributeValue"] is None: - raise MockFunctionCallError( - "niDCPower_GetAttributeViBoolean", param="attributeValue" - ) + if self._defaults['GetAttributeViBoolean']['attributeValue'] is None: + raise MockFunctionCallError("niDCPower_GetAttributeViBoolean", param='attributeValue') if attribute_value is not None: - attribute_value.contents.value = self._defaults["GetAttributeViBoolean"][ - "attributeValue" - ] - return self._defaults["GetAttributeViBoolean"]["return"] - - def niDCPower_GetAttributeViInt32( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["GetAttributeViInt32"]["return"] != 0: - return self._defaults["GetAttributeViInt32"]["return"] + attribute_value.contents.value = self._defaults['GetAttributeViBoolean']['attributeValue'] + return self._defaults['GetAttributeViBoolean']['return'] + + def niDCPower_GetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['GetAttributeViInt32']['return'] != 0: + return self._defaults['GetAttributeViInt32']['return'] # attribute_value - if self._defaults["GetAttributeViInt32"]["attributeValue"] is None: - raise MockFunctionCallError( - "niDCPower_GetAttributeViInt32", param="attributeValue" - ) + if self._defaults['GetAttributeViInt32']['attributeValue'] is None: + raise MockFunctionCallError("niDCPower_GetAttributeViInt32", param='attributeValue') if attribute_value is not None: - attribute_value.contents.value = self._defaults["GetAttributeViInt32"][ - "attributeValue" - ] - return self._defaults["GetAttributeViInt32"]["return"] - - def niDCPower_GetAttributeViInt64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["GetAttributeViInt64"]["return"] != 0: - return self._defaults["GetAttributeViInt64"]["return"] + attribute_value.contents.value = self._defaults['GetAttributeViInt32']['attributeValue'] + return self._defaults['GetAttributeViInt32']['return'] + + def niDCPower_GetAttributeViInt64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['GetAttributeViInt64']['return'] != 0: + return self._defaults['GetAttributeViInt64']['return'] # attribute_value - if self._defaults["GetAttributeViInt64"]["attributeValue"] is None: - raise MockFunctionCallError( - "niDCPower_GetAttributeViInt64", param="attributeValue" - ) + if self._defaults['GetAttributeViInt64']['attributeValue'] is None: + raise MockFunctionCallError("niDCPower_GetAttributeViInt64", param='attributeValue') if attribute_value is not None: - attribute_value.contents.value = self._defaults["GetAttributeViInt64"][ - "attributeValue" - ] - return self._defaults["GetAttributeViInt64"]["return"] - - def niDCPower_GetAttributeViReal64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["GetAttributeViReal64"]["return"] != 0: - return self._defaults["GetAttributeViReal64"]["return"] + attribute_value.contents.value = self._defaults['GetAttributeViInt64']['attributeValue'] + return self._defaults['GetAttributeViInt64']['return'] + + def niDCPower_GetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['GetAttributeViReal64']['return'] != 0: + return self._defaults['GetAttributeViReal64']['return'] # attribute_value - if self._defaults["GetAttributeViReal64"]["attributeValue"] is None: - raise MockFunctionCallError( - "niDCPower_GetAttributeViReal64", param="attributeValue" - ) + if self._defaults['GetAttributeViReal64']['attributeValue'] is None: + raise MockFunctionCallError("niDCPower_GetAttributeViReal64", param='attributeValue') if attribute_value is not None: - attribute_value.contents.value = self._defaults["GetAttributeViReal64"][ - "attributeValue" - ] - return self._defaults["GetAttributeViReal64"]["return"] - - def niDCPower_GetAttributeViString( - self, vi, channel_name, attribute_id, buffer_size, attribute_value - ): # noqa: N802 - if self._defaults["GetAttributeViString"]["return"] != 0: - return self._defaults["GetAttributeViString"]["return"] - if self._defaults["GetAttributeViString"]["attributeValue"] is None: - raise MockFunctionCallError( - "niDCPower_GetAttributeViString", param="attributeValue" - ) + attribute_value.contents.value = self._defaults['GetAttributeViReal64']['attributeValue'] + return self._defaults['GetAttributeViReal64']['return'] + + def niDCPower_GetAttributeViString(self, vi, channel_name, attribute_id, buffer_size, attribute_value): # noqa: N802 + if self._defaults['GetAttributeViString']['return'] != 0: + return self._defaults['GetAttributeViString']['return'] + if self._defaults['GetAttributeViString']['attributeValue'] is None: + raise MockFunctionCallError("niDCPower_GetAttributeViString", param='attributeValue') if buffer_size.value == 0: - return len(self._defaults["GetAttributeViString"]["attributeValue"]) - attribute_value.value = self._defaults["GetAttributeViString"][ - "attributeValue" - ].encode("ascii") - return self._defaults["GetAttributeViString"]["return"] - - def niDCPower_GetChannelName( - self, vi, index, buffer_size, channel_name - ): # noqa: N802 - if self._defaults["GetChannelName"]["return"] != 0: - return self._defaults["GetChannelName"]["return"] - if self._defaults["GetChannelName"]["channelName"] is None: - raise MockFunctionCallError("niDCPower_GetChannelName", param="channelName") + return len(self._defaults['GetAttributeViString']['attributeValue']) + attribute_value.value = self._defaults['GetAttributeViString']['attributeValue'].encode('ascii') + return self._defaults['GetAttributeViString']['return'] + + def niDCPower_GetChannelName(self, vi, index, buffer_size, channel_name): # noqa: N802 + if self._defaults['GetChannelName']['return'] != 0: + return self._defaults['GetChannelName']['return'] + if self._defaults['GetChannelName']['channelName'] is None: + raise MockFunctionCallError("niDCPower_GetChannelName", param='channelName') if buffer_size.value == 0: - return len(self._defaults["GetChannelName"]["channelName"]) - channel_name.value = self._defaults["GetChannelName"]["channelName"].encode( - "ascii" - ) - return self._defaults["GetChannelName"]["return"] - - def niDCPower_GetChannelNameFromString( - self, vi, indices, buffer_size, names - ): # noqa: N802 - if self._defaults["GetChannelNameFromString"]["return"] != 0: - return self._defaults["GetChannelNameFromString"]["return"] - if self._defaults["GetChannelNameFromString"]["channelName"] is None: - raise MockFunctionCallError( - "niDCPower_GetChannelNameFromString", param="channelName" - ) + return len(self._defaults['GetChannelName']['channelName']) + channel_name.value = self._defaults['GetChannelName']['channelName'].encode('ascii') + return self._defaults['GetChannelName']['return'] + + def niDCPower_GetChannelNameFromString(self, vi, indices, buffer_size, names): # noqa: N802 + if self._defaults['GetChannelNameFromString']['return'] != 0: + return self._defaults['GetChannelNameFromString']['return'] + if self._defaults['GetChannelNameFromString']['channelName'] is None: + raise MockFunctionCallError("niDCPower_GetChannelNameFromString", param='channelName') if buffer_size.value == 0: - return len(self._defaults["GetChannelNameFromString"]["channelName"]) - names.value = self._defaults["GetChannelNameFromString"]["channelName"].encode( - "ascii" - ) - return self._defaults["GetChannelNameFromString"]["return"] + return len(self._defaults['GetChannelNameFromString']['channelName']) + names.value = self._defaults['GetChannelNameFromString']['channelName'].encode('ascii') + return self._defaults['GetChannelNameFromString']['return'] def niDCPower_GetError(self, vi, code, buffer_size, description): # noqa: N802 - if self._defaults["GetError"]["return"] != 0: - return self._defaults["GetError"]["return"] + if self._defaults['GetError']['return'] != 0: + return self._defaults['GetError']['return'] # code - if self._defaults["GetError"]["code"] is None: - raise MockFunctionCallError("niDCPower_GetError", param="code") + if self._defaults['GetError']['code'] is None: + raise MockFunctionCallError("niDCPower_GetError", param='code') if code is not None: - code.contents.value = self._defaults["GetError"]["code"] - if self._defaults["GetError"]["description"] is None: - raise MockFunctionCallError("niDCPower_GetError", param="description") + code.contents.value = self._defaults['GetError']['code'] + if self._defaults['GetError']['description'] is None: + raise MockFunctionCallError("niDCPower_GetError", param='description') if buffer_size.value == 0: - return len(self._defaults["GetError"]["description"]) - description.value = self._defaults["GetError"]["description"].encode("ascii") - return self._defaults["GetError"]["return"] - - def niDCPower_GetExtCalLastDateAndTime( - self, vi, year, month, day, hour, minute - ): # noqa: N802 - if self._defaults["GetExtCalLastDateAndTime"]["return"] != 0: - return self._defaults["GetExtCalLastDateAndTime"]["return"] + return len(self._defaults['GetError']['description']) + description.value = self._defaults['GetError']['description'].encode('ascii') + return self._defaults['GetError']['return'] + + def niDCPower_GetExtCalLastDateAndTime(self, vi, year, month, day, hour, minute): # noqa: N802 + if self._defaults['GetExtCalLastDateAndTime']['return'] != 0: + return self._defaults['GetExtCalLastDateAndTime']['return'] # year - if self._defaults["GetExtCalLastDateAndTime"]["year"] is None: - raise MockFunctionCallError( - "niDCPower_GetExtCalLastDateAndTime", param="year" - ) + if self._defaults['GetExtCalLastDateAndTime']['year'] is None: + raise MockFunctionCallError("niDCPower_GetExtCalLastDateAndTime", param='year') if year is not None: - year.contents.value = self._defaults["GetExtCalLastDateAndTime"]["year"] + year.contents.value = self._defaults['GetExtCalLastDateAndTime']['year'] # month - if self._defaults["GetExtCalLastDateAndTime"]["month"] is None: - raise MockFunctionCallError( - "niDCPower_GetExtCalLastDateAndTime", param="month" - ) + if self._defaults['GetExtCalLastDateAndTime']['month'] is None: + raise MockFunctionCallError("niDCPower_GetExtCalLastDateAndTime", param='month') if month is not None: - month.contents.value = self._defaults["GetExtCalLastDateAndTime"]["month"] + month.contents.value = self._defaults['GetExtCalLastDateAndTime']['month'] # day - if self._defaults["GetExtCalLastDateAndTime"]["day"] is None: - raise MockFunctionCallError( - "niDCPower_GetExtCalLastDateAndTime", param="day" - ) + if self._defaults['GetExtCalLastDateAndTime']['day'] is None: + raise MockFunctionCallError("niDCPower_GetExtCalLastDateAndTime", param='day') if day is not None: - day.contents.value = self._defaults["GetExtCalLastDateAndTime"]["day"] + day.contents.value = self._defaults['GetExtCalLastDateAndTime']['day'] # hour - if self._defaults["GetExtCalLastDateAndTime"]["hour"] is None: - raise MockFunctionCallError( - "niDCPower_GetExtCalLastDateAndTime", param="hour" - ) + if self._defaults['GetExtCalLastDateAndTime']['hour'] is None: + raise MockFunctionCallError("niDCPower_GetExtCalLastDateAndTime", param='hour') if hour is not None: - hour.contents.value = self._defaults["GetExtCalLastDateAndTime"]["hour"] + hour.contents.value = self._defaults['GetExtCalLastDateAndTime']['hour'] # minute - if self._defaults["GetExtCalLastDateAndTime"]["minute"] is None: - raise MockFunctionCallError( - "niDCPower_GetExtCalLastDateAndTime", param="minute" - ) + if self._defaults['GetExtCalLastDateAndTime']['minute'] is None: + raise MockFunctionCallError("niDCPower_GetExtCalLastDateAndTime", param='minute') if minute is not None: - minute.contents.value = self._defaults["GetExtCalLastDateAndTime"]["minute"] - return self._defaults["GetExtCalLastDateAndTime"]["return"] + minute.contents.value = self._defaults['GetExtCalLastDateAndTime']['minute'] + return self._defaults['GetExtCalLastDateAndTime']['return'] def niDCPower_GetExtCalLastTemp(self, vi, temperature): # noqa: N802 - if self._defaults["GetExtCalLastTemp"]["return"] != 0: - return self._defaults["GetExtCalLastTemp"]["return"] + if self._defaults['GetExtCalLastTemp']['return'] != 0: + return self._defaults['GetExtCalLastTemp']['return'] # temperature - if self._defaults["GetExtCalLastTemp"]["temperature"] is None: - raise MockFunctionCallError( - "niDCPower_GetExtCalLastTemp", param="temperature" - ) + if self._defaults['GetExtCalLastTemp']['temperature'] is None: + raise MockFunctionCallError("niDCPower_GetExtCalLastTemp", param='temperature') if temperature is not None: - temperature.contents.value = self._defaults["GetExtCalLastTemp"][ - "temperature" - ] - return self._defaults["GetExtCalLastTemp"]["return"] + temperature.contents.value = self._defaults['GetExtCalLastTemp']['temperature'] + return self._defaults['GetExtCalLastTemp']['return'] def niDCPower_GetExtCalRecommendedInterval(self, vi, months): # noqa: N802 - if self._defaults["GetExtCalRecommendedInterval"]["return"] != 0: - return self._defaults["GetExtCalRecommendedInterval"]["return"] + if self._defaults['GetExtCalRecommendedInterval']['return'] != 0: + return self._defaults['GetExtCalRecommendedInterval']['return'] # months - if self._defaults["GetExtCalRecommendedInterval"]["months"] is None: - raise MockFunctionCallError( - "niDCPower_GetExtCalRecommendedInterval", param="months" - ) + if self._defaults['GetExtCalRecommendedInterval']['months'] is None: + raise MockFunctionCallError("niDCPower_GetExtCalRecommendedInterval", param='months') if months is not None: - months.contents.value = self._defaults["GetExtCalRecommendedInterval"][ - "months" - ] - return self._defaults["GetExtCalRecommendedInterval"]["return"] - - def niDCPower_GetSelfCalLastDateAndTime( - self, vi, year, month, day, hour, minute - ): # noqa: N802 - if self._defaults["GetSelfCalLastDateAndTime"]["return"] != 0: - return self._defaults["GetSelfCalLastDateAndTime"]["return"] + months.contents.value = self._defaults['GetExtCalRecommendedInterval']['months'] + return self._defaults['GetExtCalRecommendedInterval']['return'] + + def niDCPower_GetSelfCalLastDateAndTime(self, vi, year, month, day, hour, minute): # noqa: N802 + if self._defaults['GetSelfCalLastDateAndTime']['return'] != 0: + return self._defaults['GetSelfCalLastDateAndTime']['return'] # year - if self._defaults["GetSelfCalLastDateAndTime"]["year"] is None: - raise MockFunctionCallError( - "niDCPower_GetSelfCalLastDateAndTime", param="year" - ) + if self._defaults['GetSelfCalLastDateAndTime']['year'] is None: + raise MockFunctionCallError("niDCPower_GetSelfCalLastDateAndTime", param='year') if year is not None: - year.contents.value = self._defaults["GetSelfCalLastDateAndTime"]["year"] + year.contents.value = self._defaults['GetSelfCalLastDateAndTime']['year'] # month - if self._defaults["GetSelfCalLastDateAndTime"]["month"] is None: - raise MockFunctionCallError( - "niDCPower_GetSelfCalLastDateAndTime", param="month" - ) + if self._defaults['GetSelfCalLastDateAndTime']['month'] is None: + raise MockFunctionCallError("niDCPower_GetSelfCalLastDateAndTime", param='month') if month is not None: - month.contents.value = self._defaults["GetSelfCalLastDateAndTime"]["month"] + month.contents.value = self._defaults['GetSelfCalLastDateAndTime']['month'] # day - if self._defaults["GetSelfCalLastDateAndTime"]["day"] is None: - raise MockFunctionCallError( - "niDCPower_GetSelfCalLastDateAndTime", param="day" - ) + if self._defaults['GetSelfCalLastDateAndTime']['day'] is None: + raise MockFunctionCallError("niDCPower_GetSelfCalLastDateAndTime", param='day') if day is not None: - day.contents.value = self._defaults["GetSelfCalLastDateAndTime"]["day"] + day.contents.value = self._defaults['GetSelfCalLastDateAndTime']['day'] # hour - if self._defaults["GetSelfCalLastDateAndTime"]["hour"] is None: - raise MockFunctionCallError( - "niDCPower_GetSelfCalLastDateAndTime", param="hour" - ) + if self._defaults['GetSelfCalLastDateAndTime']['hour'] is None: + raise MockFunctionCallError("niDCPower_GetSelfCalLastDateAndTime", param='hour') if hour is not None: - hour.contents.value = self._defaults["GetSelfCalLastDateAndTime"]["hour"] + hour.contents.value = self._defaults['GetSelfCalLastDateAndTime']['hour'] # minute - if self._defaults["GetSelfCalLastDateAndTime"]["minute"] is None: - raise MockFunctionCallError( - "niDCPower_GetSelfCalLastDateAndTime", param="minute" - ) + if self._defaults['GetSelfCalLastDateAndTime']['minute'] is None: + raise MockFunctionCallError("niDCPower_GetSelfCalLastDateAndTime", param='minute') if minute is not None: - minute.contents.value = self._defaults["GetSelfCalLastDateAndTime"][ - "minute" - ] - return self._defaults["GetSelfCalLastDateAndTime"]["return"] + minute.contents.value = self._defaults['GetSelfCalLastDateAndTime']['minute'] + return self._defaults['GetSelfCalLastDateAndTime']['return'] def niDCPower_GetSelfCalLastTemp(self, vi, temperature): # noqa: N802 - if self._defaults["GetSelfCalLastTemp"]["return"] != 0: - return self._defaults["GetSelfCalLastTemp"]["return"] + if self._defaults['GetSelfCalLastTemp']['return'] != 0: + return self._defaults['GetSelfCalLastTemp']['return'] # temperature - if self._defaults["GetSelfCalLastTemp"]["temperature"] is None: - raise MockFunctionCallError( - "niDCPower_GetSelfCalLastTemp", param="temperature" - ) + if self._defaults['GetSelfCalLastTemp']['temperature'] is None: + raise MockFunctionCallError("niDCPower_GetSelfCalLastTemp", param='temperature') if temperature is not None: - temperature.contents.value = self._defaults["GetSelfCalLastTemp"][ - "temperature" - ] - return self._defaults["GetSelfCalLastTemp"]["return"] - - def niDCPower_ImportAttributeConfigurationBuffer( - self, vi, size, configuration - ): # noqa: N802 - if self._defaults["ImportAttributeConfigurationBuffer"]["return"] != 0: - return self._defaults["ImportAttributeConfigurationBuffer"]["return"] - return self._defaults["ImportAttributeConfigurationBuffer"]["return"] + temperature.contents.value = self._defaults['GetSelfCalLastTemp']['temperature'] + return self._defaults['GetSelfCalLastTemp']['return'] + + def niDCPower_ImportAttributeConfigurationBuffer(self, vi, size, configuration): # noqa: N802 + if self._defaults['ImportAttributeConfigurationBuffer']['return'] != 0: + return self._defaults['ImportAttributeConfigurationBuffer']['return'] + return self._defaults['ImportAttributeConfigurationBuffer']['return'] def niDCPower_ImportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 - if self._defaults["ImportAttributeConfigurationFile"]["return"] != 0: - return self._defaults["ImportAttributeConfigurationFile"]["return"] - return self._defaults["ImportAttributeConfigurationFile"]["return"] - - def niDCPower_InitializeWithChannels( - self, resource_name, channels, reset, option_string, vi - ): # noqa: N802 - if self._defaults["InitializeWithChannels"]["return"] != 0: - return self._defaults["InitializeWithChannels"]["return"] + if self._defaults['ImportAttributeConfigurationFile']['return'] != 0: + return self._defaults['ImportAttributeConfigurationFile']['return'] + return self._defaults['ImportAttributeConfigurationFile']['return'] + + def niDCPower_InitializeWithChannels(self, resource_name, channels, reset, option_string, vi): # noqa: N802 + if self._defaults['InitializeWithChannels']['return'] != 0: + return self._defaults['InitializeWithChannels']['return'] # vi - if self._defaults["InitializeWithChannels"]["vi"] is None: - raise MockFunctionCallError("niDCPower_InitializeWithChannels", param="vi") + if self._defaults['InitializeWithChannels']['vi'] is None: + raise MockFunctionCallError("niDCPower_InitializeWithChannels", param='vi') if vi is not None: - vi.contents.value = self._defaults["InitializeWithChannels"]["vi"] - return self._defaults["InitializeWithChannels"]["return"] - - def niDCPower_InitializeWithIndependentChannels( - self, resource_name, reset, option_string, vi - ): # noqa: N802 - if self._defaults["InitializeWithIndependentChannels"]["return"] != 0: - return self._defaults["InitializeWithIndependentChannels"]["return"] + vi.contents.value = self._defaults['InitializeWithChannels']['vi'] + return self._defaults['InitializeWithChannels']['return'] + + def niDCPower_InitializeWithIndependentChannels(self, resource_name, reset, option_string, vi): # noqa: N802 + if self._defaults['InitializeWithIndependentChannels']['return'] != 0: + return self._defaults['InitializeWithIndependentChannels']['return'] # vi - if self._defaults["InitializeWithIndependentChannels"]["vi"] is None: - raise MockFunctionCallError( - "niDCPower_InitializeWithIndependentChannels", param="vi" - ) + if self._defaults['InitializeWithIndependentChannels']['vi'] is None: + raise MockFunctionCallError("niDCPower_InitializeWithIndependentChannels", param='vi') if vi is not None: - vi.contents.value = self._defaults["InitializeWithIndependentChannels"][ - "vi" - ] - return self._defaults["InitializeWithIndependentChannels"]["return"] + vi.contents.value = self._defaults['InitializeWithIndependentChannels']['vi'] + return self._defaults['InitializeWithIndependentChannels']['return'] def niDCPower_InitiateWithChannels(self, vi, channel_name): # noqa: N802 - if self._defaults["InitiateWithChannels"]["return"] != 0: - return self._defaults["InitiateWithChannels"]["return"] - return self._defaults["InitiateWithChannels"]["return"] + if self._defaults['InitiateWithChannels']['return'] != 0: + return self._defaults['InitiateWithChannels']['return'] + return self._defaults['InitiateWithChannels']['return'] def niDCPower_LockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults["LockSession"]["return"] != 0: - return self._defaults["LockSession"]["return"] + if self._defaults['LockSession']['return'] != 0: + return self._defaults['LockSession']['return'] # caller_has_lock - if self._defaults["LockSession"]["callerHasLock"] is None: - raise MockFunctionCallError("niDCPower_LockSession", param="callerHasLock") + if self._defaults['LockSession']['callerHasLock'] is None: + raise MockFunctionCallError("niDCPower_LockSession", param='callerHasLock') if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults["LockSession"][ - "callerHasLock" - ] - return self._defaults["LockSession"]["return"] - - def niDCPower_Measure( - self, vi, channel_name, measurement_type, measurement - ): # noqa: N802 - if self._defaults["Measure"]["return"] != 0: - return self._defaults["Measure"]["return"] + caller_has_lock.contents.value = self._defaults['LockSession']['callerHasLock'] + return self._defaults['LockSession']['return'] + + def niDCPower_Measure(self, vi, channel_name, measurement_type, measurement): # noqa: N802 + if self._defaults['Measure']['return'] != 0: + return self._defaults['Measure']['return'] # measurement - if self._defaults["Measure"]["measurement"] is None: - raise MockFunctionCallError("niDCPower_Measure", param="measurement") + if self._defaults['Measure']['measurement'] is None: + raise MockFunctionCallError("niDCPower_Measure", param='measurement') if measurement is not None: - measurement.contents.value = self._defaults["Measure"]["measurement"] - return self._defaults["Measure"]["return"] - - def niDCPower_MeasureMultiple( - self, vi, channel_name, voltage_measurements, current_measurements - ): # noqa: N802 - if self._defaults["MeasureMultiple"]["return"] != 0: - return self._defaults["MeasureMultiple"]["return"] + measurement.contents.value = self._defaults['Measure']['measurement'] + return self._defaults['Measure']['return'] + + def niDCPower_MeasureMultiple(self, vi, channel_name, voltage_measurements, current_measurements): # noqa: N802 + if self._defaults['MeasureMultiple']['return'] != 0: + return self._defaults['MeasureMultiple']['return'] # voltage_measurements - if self._defaults["MeasureMultiple"]["voltageMeasurements"] is None: - raise MockFunctionCallError( - "niDCPower_MeasureMultiple", param="voltageMeasurements" - ) - test_value = self._defaults["MeasureMultiple"]["voltageMeasurements"] + if self._defaults['MeasureMultiple']['voltageMeasurements'] is None: + raise MockFunctionCallError("niDCPower_MeasureMultiple", param='voltageMeasurements') + test_value = self._defaults['MeasureMultiple']['voltageMeasurements'] try: voltage_measurements_ref = voltage_measurements.contents except AttributeError: @@ -701,11 +553,9 @@ def niDCPower_MeasureMultiple( for i in range(len(test_value)): voltage_measurements_ref[i] = test_value[i] # current_measurements - if self._defaults["MeasureMultiple"]["currentMeasurements"] is None: - raise MockFunctionCallError( - "niDCPower_MeasureMultiple", param="currentMeasurements" - ) - test_value = self._defaults["MeasureMultiple"]["currentMeasurements"] + if self._defaults['MeasureMultiple']['currentMeasurements'] is None: + raise MockFunctionCallError("niDCPower_MeasureMultiple", param='currentMeasurements') + test_value = self._defaults['MeasureMultiple']['currentMeasurements'] try: current_measurements_ref = current_measurements.contents except AttributeError: @@ -713,490 +563,306 @@ def niDCPower_MeasureMultiple( assert len(current_measurements_ref) >= len(test_value) for i in range(len(test_value)): current_measurements_ref[i] = test_value[i] - return self._defaults["MeasureMultiple"]["return"] + return self._defaults['MeasureMultiple']['return'] - def niDCPower_ParseChannelCount( - self, vi, channels_string, number_of_channels - ): # noqa: N802 - if self._defaults["ParseChannelCount"]["return"] != 0: - return self._defaults["ParseChannelCount"]["return"] + def niDCPower_ParseChannelCount(self, vi, channels_string, number_of_channels): # noqa: N802 + if self._defaults['ParseChannelCount']['return'] != 0: + return self._defaults['ParseChannelCount']['return'] # number_of_channels - if self._defaults["ParseChannelCount"]["numberOfChannels"] is None: - raise MockFunctionCallError( - "niDCPower_ParseChannelCount", param="numberOfChannels" - ) + if self._defaults['ParseChannelCount']['numberOfChannels'] is None: + raise MockFunctionCallError("niDCPower_ParseChannelCount", param='numberOfChannels') if number_of_channels is not None: - number_of_channels.contents.value = self._defaults["ParseChannelCount"][ - "numberOfChannels" - ] - return self._defaults["ParseChannelCount"]["return"] - - def niDCPower_QueryInCompliance( - self, vi, channel_name, in_compliance - ): # noqa: N802 - if self._defaults["QueryInCompliance"]["return"] != 0: - return self._defaults["QueryInCompliance"]["return"] + number_of_channels.contents.value = self._defaults['ParseChannelCount']['numberOfChannels'] + return self._defaults['ParseChannelCount']['return'] + + def niDCPower_QueryInCompliance(self, vi, channel_name, in_compliance): # noqa: N802 + if self._defaults['QueryInCompliance']['return'] != 0: + return self._defaults['QueryInCompliance']['return'] # in_compliance - if self._defaults["QueryInCompliance"]["inCompliance"] is None: - raise MockFunctionCallError( - "niDCPower_QueryInCompliance", param="inCompliance" - ) + if self._defaults['QueryInCompliance']['inCompliance'] is None: + raise MockFunctionCallError("niDCPower_QueryInCompliance", param='inCompliance') if in_compliance is not None: - in_compliance.contents.value = self._defaults["QueryInCompliance"][ - "inCompliance" - ] - return self._defaults["QueryInCompliance"]["return"] - - def niDCPower_QueryLatchedOutputCutoffState( - self, vi, channel_name, output_cutoff_reason, output_cutoff_state - ): # noqa: N802 - if self._defaults["QueryLatchedOutputCutoffState"]["return"] != 0: - return self._defaults["QueryLatchedOutputCutoffState"]["return"] + in_compliance.contents.value = self._defaults['QueryInCompliance']['inCompliance'] + return self._defaults['QueryInCompliance']['return'] + + def niDCPower_QueryLatchedOutputCutoffState(self, vi, channel_name, output_cutoff_reason, output_cutoff_state): # noqa: N802 + if self._defaults['QueryLatchedOutputCutoffState']['return'] != 0: + return self._defaults['QueryLatchedOutputCutoffState']['return'] # output_cutoff_state - if self._defaults["QueryLatchedOutputCutoffState"]["outputCutoffState"] is None: - raise MockFunctionCallError( - "niDCPower_QueryLatchedOutputCutoffState", param="outputCutoffState" - ) + if self._defaults['QueryLatchedOutputCutoffState']['outputCutoffState'] is None: + raise MockFunctionCallError("niDCPower_QueryLatchedOutputCutoffState", param='outputCutoffState') if output_cutoff_state is not None: - output_cutoff_state.contents.value = self._defaults[ - "QueryLatchedOutputCutoffState" - ]["outputCutoffState"] - return self._defaults["QueryLatchedOutputCutoffState"]["return"] - - def niDCPower_QueryMaxCurrentLimit( - self, vi, channel_name, voltage_level, max_current_limit - ): # noqa: N802 - if self._defaults["QueryMaxCurrentLimit"]["return"] != 0: - return self._defaults["QueryMaxCurrentLimit"]["return"] + output_cutoff_state.contents.value = self._defaults['QueryLatchedOutputCutoffState']['outputCutoffState'] + return self._defaults['QueryLatchedOutputCutoffState']['return'] + + def niDCPower_QueryMaxCurrentLimit(self, vi, channel_name, voltage_level, max_current_limit): # noqa: N802 + if self._defaults['QueryMaxCurrentLimit']['return'] != 0: + return self._defaults['QueryMaxCurrentLimit']['return'] # max_current_limit - if self._defaults["QueryMaxCurrentLimit"]["maxCurrentLimit"] is None: - raise MockFunctionCallError( - "niDCPower_QueryMaxCurrentLimit", param="maxCurrentLimit" - ) + if self._defaults['QueryMaxCurrentLimit']['maxCurrentLimit'] is None: + raise MockFunctionCallError("niDCPower_QueryMaxCurrentLimit", param='maxCurrentLimit') if max_current_limit is not None: - max_current_limit.contents.value = self._defaults["QueryMaxCurrentLimit"][ - "maxCurrentLimit" - ] - return self._defaults["QueryMaxCurrentLimit"]["return"] - - def niDCPower_QueryMaxVoltageLevel( - self, vi, channel_name, current_limit, max_voltage_level - ): # noqa: N802 - if self._defaults["QueryMaxVoltageLevel"]["return"] != 0: - return self._defaults["QueryMaxVoltageLevel"]["return"] + max_current_limit.contents.value = self._defaults['QueryMaxCurrentLimit']['maxCurrentLimit'] + return self._defaults['QueryMaxCurrentLimit']['return'] + + def niDCPower_QueryMaxVoltageLevel(self, vi, channel_name, current_limit, max_voltage_level): # noqa: N802 + if self._defaults['QueryMaxVoltageLevel']['return'] != 0: + return self._defaults['QueryMaxVoltageLevel']['return'] # max_voltage_level - if self._defaults["QueryMaxVoltageLevel"]["maxVoltageLevel"] is None: - raise MockFunctionCallError( - "niDCPower_QueryMaxVoltageLevel", param="maxVoltageLevel" - ) + if self._defaults['QueryMaxVoltageLevel']['maxVoltageLevel'] is None: + raise MockFunctionCallError("niDCPower_QueryMaxVoltageLevel", param='maxVoltageLevel') if max_voltage_level is not None: - max_voltage_level.contents.value = self._defaults["QueryMaxVoltageLevel"][ - "maxVoltageLevel" - ] - return self._defaults["QueryMaxVoltageLevel"]["return"] - - def niDCPower_QueryMinCurrentLimit( - self, vi, channel_name, voltage_level, min_current_limit - ): # noqa: N802 - if self._defaults["QueryMinCurrentLimit"]["return"] != 0: - return self._defaults["QueryMinCurrentLimit"]["return"] + max_voltage_level.contents.value = self._defaults['QueryMaxVoltageLevel']['maxVoltageLevel'] + return self._defaults['QueryMaxVoltageLevel']['return'] + + def niDCPower_QueryMinCurrentLimit(self, vi, channel_name, voltage_level, min_current_limit): # noqa: N802 + if self._defaults['QueryMinCurrentLimit']['return'] != 0: + return self._defaults['QueryMinCurrentLimit']['return'] # min_current_limit - if self._defaults["QueryMinCurrentLimit"]["minCurrentLimit"] is None: - raise MockFunctionCallError( - "niDCPower_QueryMinCurrentLimit", param="minCurrentLimit" - ) + if self._defaults['QueryMinCurrentLimit']['minCurrentLimit'] is None: + raise MockFunctionCallError("niDCPower_QueryMinCurrentLimit", param='minCurrentLimit') if min_current_limit is not None: - min_current_limit.contents.value = self._defaults["QueryMinCurrentLimit"][ - "minCurrentLimit" - ] - return self._defaults["QueryMinCurrentLimit"]["return"] - - def niDCPower_QueryOutputState( - self, vi, channel_name, output_state, in_state - ): # noqa: N802 - if self._defaults["QueryOutputState"]["return"] != 0: - return self._defaults["QueryOutputState"]["return"] + min_current_limit.contents.value = self._defaults['QueryMinCurrentLimit']['minCurrentLimit'] + return self._defaults['QueryMinCurrentLimit']['return'] + + def niDCPower_QueryOutputState(self, vi, channel_name, output_state, in_state): # noqa: N802 + if self._defaults['QueryOutputState']['return'] != 0: + return self._defaults['QueryOutputState']['return'] # in_state - if self._defaults["QueryOutputState"]["inState"] is None: - raise MockFunctionCallError("niDCPower_QueryOutputState", param="inState") + if self._defaults['QueryOutputState']['inState'] is None: + raise MockFunctionCallError("niDCPower_QueryOutputState", param='inState') if in_state is not None: - in_state.contents.value = self._defaults["QueryOutputState"]["inState"] - return self._defaults["QueryOutputState"]["return"] + in_state.contents.value = self._defaults['QueryOutputState']['inState'] + return self._defaults['QueryOutputState']['return'] def niDCPower_ReadCurrentTemperature(self, vi, temperature): # noqa: N802 - if self._defaults["ReadCurrentTemperature"]["return"] != 0: - return self._defaults["ReadCurrentTemperature"]["return"] + if self._defaults['ReadCurrentTemperature']['return'] != 0: + return self._defaults['ReadCurrentTemperature']['return'] # temperature - if self._defaults["ReadCurrentTemperature"]["temperature"] is None: - raise MockFunctionCallError( - "niDCPower_ReadCurrentTemperature", param="temperature" - ) + if self._defaults['ReadCurrentTemperature']['temperature'] is None: + raise MockFunctionCallError("niDCPower_ReadCurrentTemperature", param='temperature') if temperature is not None: - temperature.contents.value = self._defaults["ReadCurrentTemperature"][ - "temperature" - ] - return self._defaults["ReadCurrentTemperature"]["return"] + temperature.contents.value = self._defaults['ReadCurrentTemperature']['temperature'] + return self._defaults['ReadCurrentTemperature']['return'] def niDCPower_ResetDevice(self, vi): # noqa: N802 - if self._defaults["ResetDevice"]["return"] != 0: - return self._defaults["ResetDevice"]["return"] - return self._defaults["ResetDevice"]["return"] + if self._defaults['ResetDevice']['return'] != 0: + return self._defaults['ResetDevice']['return'] + return self._defaults['ResetDevice']['return'] def niDCPower_ResetWithChannels(self, vi, channel_name): # noqa: N802 - if self._defaults["ResetWithChannels"]["return"] != 0: - return self._defaults["ResetWithChannels"]["return"] - return self._defaults["ResetWithChannels"]["return"] + if self._defaults['ResetWithChannels']['return'] != 0: + return self._defaults['ResetWithChannels']['return'] + return self._defaults['ResetWithChannels']['return'] def niDCPower_ResetWithDefaults(self, vi): # noqa: N802 - if self._defaults["ResetWithDefaults"]["return"] != 0: - return self._defaults["ResetWithDefaults"]["return"] - return self._defaults["ResetWithDefaults"]["return"] - - def niDCPower_SendSoftwareEdgeTriggerWithChannels( - self, vi, channel_name, trigger - ): # noqa: N802 - if self._defaults["SendSoftwareEdgeTriggerWithChannels"]["return"] != 0: - return self._defaults["SendSoftwareEdgeTriggerWithChannels"]["return"] - return self._defaults["SendSoftwareEdgeTriggerWithChannels"]["return"] - - def niDCPower_SetAttributeViBoolean( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["SetAttributeViBoolean"]["return"] != 0: - return self._defaults["SetAttributeViBoolean"]["return"] - return self._defaults["SetAttributeViBoolean"]["return"] - - def niDCPower_SetAttributeViInt32( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["SetAttributeViInt32"]["return"] != 0: - return self._defaults["SetAttributeViInt32"]["return"] - return self._defaults["SetAttributeViInt32"]["return"] - - def niDCPower_SetAttributeViInt64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["SetAttributeViInt64"]["return"] != 0: - return self._defaults["SetAttributeViInt64"]["return"] - return self._defaults["SetAttributeViInt64"]["return"] - - def niDCPower_SetAttributeViReal64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["SetAttributeViReal64"]["return"] != 0: - return self._defaults["SetAttributeViReal64"]["return"] - return self._defaults["SetAttributeViReal64"]["return"] - - def niDCPower_SetAttributeViString( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["SetAttributeViString"]["return"] != 0: - return self._defaults["SetAttributeViString"]["return"] - return self._defaults["SetAttributeViString"]["return"] - - def niDCPower_SetSequence( - self, vi, channel_name, values, source_delays, size - ): # noqa: N802 - if self._defaults["SetSequence"]["return"] != 0: - return self._defaults["SetSequence"]["return"] - return self._defaults["SetSequence"]["return"] + if self._defaults['ResetWithDefaults']['return'] != 0: + return self._defaults['ResetWithDefaults']['return'] + return self._defaults['ResetWithDefaults']['return'] + + def niDCPower_SendSoftwareEdgeTriggerWithChannels(self, vi, channel_name, trigger): # noqa: N802 + if self._defaults['SendSoftwareEdgeTriggerWithChannels']['return'] != 0: + return self._defaults['SendSoftwareEdgeTriggerWithChannels']['return'] + return self._defaults['SendSoftwareEdgeTriggerWithChannels']['return'] + + def niDCPower_SetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['SetAttributeViBoolean']['return'] != 0: + return self._defaults['SetAttributeViBoolean']['return'] + return self._defaults['SetAttributeViBoolean']['return'] + + def niDCPower_SetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['SetAttributeViInt32']['return'] != 0: + return self._defaults['SetAttributeViInt32']['return'] + return self._defaults['SetAttributeViInt32']['return'] + + def niDCPower_SetAttributeViInt64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['SetAttributeViInt64']['return'] != 0: + return self._defaults['SetAttributeViInt64']['return'] + return self._defaults['SetAttributeViInt64']['return'] + + def niDCPower_SetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['SetAttributeViReal64']['return'] != 0: + return self._defaults['SetAttributeViReal64']['return'] + return self._defaults['SetAttributeViReal64']['return'] + + def niDCPower_SetAttributeViString(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['SetAttributeViString']['return'] != 0: + return self._defaults['SetAttributeViString']['return'] + return self._defaults['SetAttributeViString']['return'] + + def niDCPower_SetSequence(self, vi, channel_name, values, source_delays, size): # noqa: N802 + if self._defaults['SetSequence']['return'] != 0: + return self._defaults['SetSequence']['return'] + return self._defaults['SetSequence']['return'] def niDCPower_UnlockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults["UnlockSession"]["return"] != 0: - return self._defaults["UnlockSession"]["return"] + if self._defaults['UnlockSession']['return'] != 0: + return self._defaults['UnlockSession']['return'] # caller_has_lock - if self._defaults["UnlockSession"]["callerHasLock"] is None: - raise MockFunctionCallError( - "niDCPower_UnlockSession", param="callerHasLock" - ) + if self._defaults['UnlockSession']['callerHasLock'] is None: + raise MockFunctionCallError("niDCPower_UnlockSession", param='callerHasLock') if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults["UnlockSession"][ - "callerHasLock" - ] - return self._defaults["UnlockSession"]["return"] - - def niDCPower_WaitForEventWithChannels( - self, vi, channel_name, event_id, timeout - ): # noqa: N802 - if self._defaults["WaitForEventWithChannels"]["return"] != 0: - return self._defaults["WaitForEventWithChannels"]["return"] - return self._defaults["WaitForEventWithChannels"]["return"] + caller_has_lock.contents.value = self._defaults['UnlockSession']['callerHasLock'] + return self._defaults['UnlockSession']['return'] + + def niDCPower_WaitForEventWithChannels(self, vi, channel_name, event_id, timeout): # noqa: N802 + if self._defaults['WaitForEventWithChannels']['return'] != 0: + return self._defaults['WaitForEventWithChannels']['return'] + return self._defaults['WaitForEventWithChannels']['return'] def niDCPower_close(self, vi): # noqa: N802 - if self._defaults["close"]["return"] != 0: - return self._defaults["close"]["return"] - return self._defaults["close"]["return"] + if self._defaults['close']['return'] != 0: + return self._defaults['close']['return'] + return self._defaults['close']['return'] def niDCPower_error_message(self, vi, error_code, error_message): # noqa: N802 - if self._defaults["error_message"]["return"] != 0: - return self._defaults["error_message"]["return"] + if self._defaults['error_message']['return'] != 0: + return self._defaults['error_message']['return'] # error_message - if self._defaults["error_message"]["errorMessage"] is None: - raise MockFunctionCallError("niDCPower_error_message", param="errorMessage") - test_value = self._defaults["error_message"]["errorMessage"] + if self._defaults['error_message']['errorMessage'] is None: + raise MockFunctionCallError("niDCPower_error_message", param='errorMessage') + test_value = self._defaults['error_message']['errorMessage'] if type(test_value) is str: - test_value = test_value.encode("ascii") + test_value = test_value.encode('ascii') assert len(error_message) >= len(test_value) for i in range(len(test_value)): error_message[i] = test_value[i] - return self._defaults["error_message"]["return"] + return self._defaults['error_message']['return'] - def niDCPower_self_test( - self, vi, self_test_result, self_test_message - ): # noqa: N802 - if self._defaults["self_test"]["return"] != 0: - return self._defaults["self_test"]["return"] + def niDCPower_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 + if self._defaults['self_test']['return'] != 0: + return self._defaults['self_test']['return'] # self_test_result - if self._defaults["self_test"]["selfTestResult"] is None: - raise MockFunctionCallError("niDCPower_self_test", param="selfTestResult") + if self._defaults['self_test']['selfTestResult'] is None: + raise MockFunctionCallError("niDCPower_self_test", param='selfTestResult') if self_test_result is not None: - self_test_result.contents.value = self._defaults["self_test"][ - "selfTestResult" - ] + self_test_result.contents.value = self._defaults['self_test']['selfTestResult'] # self_test_message - if self._defaults["self_test"]["selfTestMessage"] is None: - raise MockFunctionCallError("niDCPower_self_test", param="selfTestMessage") - test_value = self._defaults["self_test"]["selfTestMessage"] + if self._defaults['self_test']['selfTestMessage'] is None: + raise MockFunctionCallError("niDCPower_self_test", param='selfTestMessage') + test_value = self._defaults['self_test']['selfTestMessage'] if type(test_value) is str: - test_value = test_value.encode("ascii") + test_value = test_value.encode('ascii') assert len(self_test_message) >= len(test_value) for i in range(len(test_value)): self_test_message[i] = test_value[i] - return self._defaults["self_test"]["return"] + return self._defaults['self_test']['return'] # Helper function to setup Mock object with default side effects and return values def set_side_effects_and_return_values(self, mock_library): - mock_library.niDCPower_AbortWithChannels.side_effect = MockFunctionCallError( - "niDCPower_AbortWithChannels" - ) + mock_library.niDCPower_AbortWithChannels.side_effect = MockFunctionCallError("niDCPower_AbortWithChannels") mock_library.niDCPower_AbortWithChannels.return_value = 0 - mock_library.niDCPower_CalSelfCalibrate.side_effect = MockFunctionCallError( - "niDCPower_CalSelfCalibrate" - ) + mock_library.niDCPower_CalSelfCalibrate.side_effect = MockFunctionCallError("niDCPower_CalSelfCalibrate") mock_library.niDCPower_CalSelfCalibrate.return_value = 0 - mock_library.niDCPower_ClearLatchedOutputCutoffState.side_effect = ( - MockFunctionCallError("niDCPower_ClearLatchedOutputCutoffState") - ) + mock_library.niDCPower_ClearLatchedOutputCutoffState.side_effect = MockFunctionCallError("niDCPower_ClearLatchedOutputCutoffState") mock_library.niDCPower_ClearLatchedOutputCutoffState.return_value = 0 - mock_library.niDCPower_CommitWithChannels.side_effect = MockFunctionCallError( - "niDCPower_CommitWithChannels" - ) + mock_library.niDCPower_CommitWithChannels.side_effect = MockFunctionCallError("niDCPower_CommitWithChannels") mock_library.niDCPower_CommitWithChannels.return_value = 0 - mock_library.niDCPower_ConfigureApertureTime.side_effect = ( - MockFunctionCallError("niDCPower_ConfigureApertureTime") - ) + mock_library.niDCPower_ConfigureApertureTime.side_effect = MockFunctionCallError("niDCPower_ConfigureApertureTime") mock_library.niDCPower_ConfigureApertureTime.return_value = 0 - mock_library.niDCPower_CreateAdvancedSequenceCommitStepWithChannels.side_effect = MockFunctionCallError( - "niDCPower_CreateAdvancedSequenceCommitStepWithChannels" - ) - mock_library.niDCPower_CreateAdvancedSequenceCommitStepWithChannels.return_value = ( - 0 - ) - mock_library.niDCPower_CreateAdvancedSequenceStepWithChannels.side_effect = ( - MockFunctionCallError("niDCPower_CreateAdvancedSequenceStepWithChannels") - ) + mock_library.niDCPower_CreateAdvancedSequenceCommitStepWithChannels.side_effect = MockFunctionCallError("niDCPower_CreateAdvancedSequenceCommitStepWithChannels") + mock_library.niDCPower_CreateAdvancedSequenceCommitStepWithChannels.return_value = 0 + mock_library.niDCPower_CreateAdvancedSequenceStepWithChannels.side_effect = MockFunctionCallError("niDCPower_CreateAdvancedSequenceStepWithChannels") mock_library.niDCPower_CreateAdvancedSequenceStepWithChannels.return_value = 0 - mock_library.niDCPower_CreateAdvancedSequenceWithChannels.side_effect = ( - MockFunctionCallError("niDCPower_CreateAdvancedSequenceWithChannels") - ) + mock_library.niDCPower_CreateAdvancedSequenceWithChannels.side_effect = MockFunctionCallError("niDCPower_CreateAdvancedSequenceWithChannels") mock_library.niDCPower_CreateAdvancedSequenceWithChannels.return_value = 0 - mock_library.niDCPower_DeleteAdvancedSequenceWithChannels.side_effect = ( - MockFunctionCallError("niDCPower_DeleteAdvancedSequenceWithChannels") - ) + mock_library.niDCPower_DeleteAdvancedSequenceWithChannels.side_effect = MockFunctionCallError("niDCPower_DeleteAdvancedSequenceWithChannels") mock_library.niDCPower_DeleteAdvancedSequenceWithChannels.return_value = 0 - mock_library.niDCPower_Disable.side_effect = MockFunctionCallError( - "niDCPower_Disable" - ) + mock_library.niDCPower_Disable.side_effect = MockFunctionCallError("niDCPower_Disable") mock_library.niDCPower_Disable.return_value = 0 - mock_library.niDCPower_ExportAttributeConfigurationBuffer.side_effect = ( - MockFunctionCallError("niDCPower_ExportAttributeConfigurationBuffer") - ) + mock_library.niDCPower_ExportAttributeConfigurationBuffer.side_effect = MockFunctionCallError("niDCPower_ExportAttributeConfigurationBuffer") mock_library.niDCPower_ExportAttributeConfigurationBuffer.return_value = 0 - mock_library.niDCPower_ExportAttributeConfigurationFile.side_effect = ( - MockFunctionCallError("niDCPower_ExportAttributeConfigurationFile") - ) + mock_library.niDCPower_ExportAttributeConfigurationFile.side_effect = MockFunctionCallError("niDCPower_ExportAttributeConfigurationFile") mock_library.niDCPower_ExportAttributeConfigurationFile.return_value = 0 - mock_library.niDCPower_FancyInitialize.side_effect = MockFunctionCallError( - "niDCPower_FancyInitialize" - ) + mock_library.niDCPower_FancyInitialize.side_effect = MockFunctionCallError("niDCPower_FancyInitialize") mock_library.niDCPower_FancyInitialize.return_value = 0 - mock_library.niDCPower_FetchMultiple.side_effect = MockFunctionCallError( - "niDCPower_FetchMultiple" - ) + mock_library.niDCPower_FetchMultiple.side_effect = MockFunctionCallError("niDCPower_FetchMultiple") mock_library.niDCPower_FetchMultiple.return_value = 0 - mock_library.niDCPower_GetAttributeViBoolean.side_effect = ( - MockFunctionCallError("niDCPower_GetAttributeViBoolean") - ) + mock_library.niDCPower_GetAttributeViBoolean.side_effect = MockFunctionCallError("niDCPower_GetAttributeViBoolean") mock_library.niDCPower_GetAttributeViBoolean.return_value = 0 - mock_library.niDCPower_GetAttributeViInt32.side_effect = MockFunctionCallError( - "niDCPower_GetAttributeViInt32" - ) + mock_library.niDCPower_GetAttributeViInt32.side_effect = MockFunctionCallError("niDCPower_GetAttributeViInt32") mock_library.niDCPower_GetAttributeViInt32.return_value = 0 - mock_library.niDCPower_GetAttributeViInt64.side_effect = MockFunctionCallError( - "niDCPower_GetAttributeViInt64" - ) + mock_library.niDCPower_GetAttributeViInt64.side_effect = MockFunctionCallError("niDCPower_GetAttributeViInt64") mock_library.niDCPower_GetAttributeViInt64.return_value = 0 - mock_library.niDCPower_GetAttributeViReal64.side_effect = MockFunctionCallError( - "niDCPower_GetAttributeViReal64" - ) + mock_library.niDCPower_GetAttributeViReal64.side_effect = MockFunctionCallError("niDCPower_GetAttributeViReal64") mock_library.niDCPower_GetAttributeViReal64.return_value = 0 - mock_library.niDCPower_GetAttributeViString.side_effect = MockFunctionCallError( - "niDCPower_GetAttributeViString" - ) + mock_library.niDCPower_GetAttributeViString.side_effect = MockFunctionCallError("niDCPower_GetAttributeViString") mock_library.niDCPower_GetAttributeViString.return_value = 0 - mock_library.niDCPower_GetChannelName.side_effect = MockFunctionCallError( - "niDCPower_GetChannelName" - ) + mock_library.niDCPower_GetChannelName.side_effect = MockFunctionCallError("niDCPower_GetChannelName") mock_library.niDCPower_GetChannelName.return_value = 0 - mock_library.niDCPower_GetChannelNameFromString.side_effect = ( - MockFunctionCallError("niDCPower_GetChannelNameFromString") - ) + mock_library.niDCPower_GetChannelNameFromString.side_effect = MockFunctionCallError("niDCPower_GetChannelNameFromString") mock_library.niDCPower_GetChannelNameFromString.return_value = 0 - mock_library.niDCPower_GetError.side_effect = MockFunctionCallError( - "niDCPower_GetError" - ) + mock_library.niDCPower_GetError.side_effect = MockFunctionCallError("niDCPower_GetError") mock_library.niDCPower_GetError.return_value = 0 - mock_library.niDCPower_GetExtCalLastDateAndTime.side_effect = ( - MockFunctionCallError("niDCPower_GetExtCalLastDateAndTime") - ) + mock_library.niDCPower_GetExtCalLastDateAndTime.side_effect = MockFunctionCallError("niDCPower_GetExtCalLastDateAndTime") mock_library.niDCPower_GetExtCalLastDateAndTime.return_value = 0 - mock_library.niDCPower_GetExtCalLastTemp.side_effect = MockFunctionCallError( - "niDCPower_GetExtCalLastTemp" - ) + mock_library.niDCPower_GetExtCalLastTemp.side_effect = MockFunctionCallError("niDCPower_GetExtCalLastTemp") mock_library.niDCPower_GetExtCalLastTemp.return_value = 0 - mock_library.niDCPower_GetExtCalRecommendedInterval.side_effect = ( - MockFunctionCallError("niDCPower_GetExtCalRecommendedInterval") - ) + mock_library.niDCPower_GetExtCalRecommendedInterval.side_effect = MockFunctionCallError("niDCPower_GetExtCalRecommendedInterval") mock_library.niDCPower_GetExtCalRecommendedInterval.return_value = 0 - mock_library.niDCPower_GetSelfCalLastDateAndTime.side_effect = ( - MockFunctionCallError("niDCPower_GetSelfCalLastDateAndTime") - ) + mock_library.niDCPower_GetSelfCalLastDateAndTime.side_effect = MockFunctionCallError("niDCPower_GetSelfCalLastDateAndTime") mock_library.niDCPower_GetSelfCalLastDateAndTime.return_value = 0 - mock_library.niDCPower_GetSelfCalLastTemp.side_effect = MockFunctionCallError( - "niDCPower_GetSelfCalLastTemp" - ) + mock_library.niDCPower_GetSelfCalLastTemp.side_effect = MockFunctionCallError("niDCPower_GetSelfCalLastTemp") mock_library.niDCPower_GetSelfCalLastTemp.return_value = 0 - mock_library.niDCPower_ImportAttributeConfigurationBuffer.side_effect = ( - MockFunctionCallError("niDCPower_ImportAttributeConfigurationBuffer") - ) + mock_library.niDCPower_ImportAttributeConfigurationBuffer.side_effect = MockFunctionCallError("niDCPower_ImportAttributeConfigurationBuffer") mock_library.niDCPower_ImportAttributeConfigurationBuffer.return_value = 0 - mock_library.niDCPower_ImportAttributeConfigurationFile.side_effect = ( - MockFunctionCallError("niDCPower_ImportAttributeConfigurationFile") - ) + mock_library.niDCPower_ImportAttributeConfigurationFile.side_effect = MockFunctionCallError("niDCPower_ImportAttributeConfigurationFile") mock_library.niDCPower_ImportAttributeConfigurationFile.return_value = 0 - mock_library.niDCPower_InitializeWithChannels.side_effect = ( - MockFunctionCallError("niDCPower_InitializeWithChannels") - ) + mock_library.niDCPower_InitializeWithChannels.side_effect = MockFunctionCallError("niDCPower_InitializeWithChannels") mock_library.niDCPower_InitializeWithChannels.return_value = 0 - mock_library.niDCPower_InitializeWithIndependentChannels.side_effect = ( - MockFunctionCallError("niDCPower_InitializeWithIndependentChannels") - ) + mock_library.niDCPower_InitializeWithIndependentChannels.side_effect = MockFunctionCallError("niDCPower_InitializeWithIndependentChannels") mock_library.niDCPower_InitializeWithIndependentChannels.return_value = 0 - mock_library.niDCPower_InitiateWithChannels.side_effect = MockFunctionCallError( - "niDCPower_InitiateWithChannels" - ) + mock_library.niDCPower_InitiateWithChannels.side_effect = MockFunctionCallError("niDCPower_InitiateWithChannels") mock_library.niDCPower_InitiateWithChannels.return_value = 0 - mock_library.niDCPower_LockSession.side_effect = MockFunctionCallError( - "niDCPower_LockSession" - ) + mock_library.niDCPower_LockSession.side_effect = MockFunctionCallError("niDCPower_LockSession") mock_library.niDCPower_LockSession.return_value = 0 - mock_library.niDCPower_Measure.side_effect = MockFunctionCallError( - "niDCPower_Measure" - ) + mock_library.niDCPower_Measure.side_effect = MockFunctionCallError("niDCPower_Measure") mock_library.niDCPower_Measure.return_value = 0 - mock_library.niDCPower_MeasureMultiple.side_effect = MockFunctionCallError( - "niDCPower_MeasureMultiple" - ) + mock_library.niDCPower_MeasureMultiple.side_effect = MockFunctionCallError("niDCPower_MeasureMultiple") mock_library.niDCPower_MeasureMultiple.return_value = 0 - mock_library.niDCPower_ParseChannelCount.side_effect = MockFunctionCallError( - "niDCPower_ParseChannelCount" - ) + mock_library.niDCPower_ParseChannelCount.side_effect = MockFunctionCallError("niDCPower_ParseChannelCount") mock_library.niDCPower_ParseChannelCount.return_value = 0 - mock_library.niDCPower_QueryInCompliance.side_effect = MockFunctionCallError( - "niDCPower_QueryInCompliance" - ) + mock_library.niDCPower_QueryInCompliance.side_effect = MockFunctionCallError("niDCPower_QueryInCompliance") mock_library.niDCPower_QueryInCompliance.return_value = 0 - mock_library.niDCPower_QueryLatchedOutputCutoffState.side_effect = ( - MockFunctionCallError("niDCPower_QueryLatchedOutputCutoffState") - ) + mock_library.niDCPower_QueryLatchedOutputCutoffState.side_effect = MockFunctionCallError("niDCPower_QueryLatchedOutputCutoffState") mock_library.niDCPower_QueryLatchedOutputCutoffState.return_value = 0 - mock_library.niDCPower_QueryMaxCurrentLimit.side_effect = MockFunctionCallError( - "niDCPower_QueryMaxCurrentLimit" - ) + mock_library.niDCPower_QueryMaxCurrentLimit.side_effect = MockFunctionCallError("niDCPower_QueryMaxCurrentLimit") mock_library.niDCPower_QueryMaxCurrentLimit.return_value = 0 - mock_library.niDCPower_QueryMaxVoltageLevel.side_effect = MockFunctionCallError( - "niDCPower_QueryMaxVoltageLevel" - ) + mock_library.niDCPower_QueryMaxVoltageLevel.side_effect = MockFunctionCallError("niDCPower_QueryMaxVoltageLevel") mock_library.niDCPower_QueryMaxVoltageLevel.return_value = 0 - mock_library.niDCPower_QueryMinCurrentLimit.side_effect = MockFunctionCallError( - "niDCPower_QueryMinCurrentLimit" - ) + mock_library.niDCPower_QueryMinCurrentLimit.side_effect = MockFunctionCallError("niDCPower_QueryMinCurrentLimit") mock_library.niDCPower_QueryMinCurrentLimit.return_value = 0 - mock_library.niDCPower_QueryOutputState.side_effect = MockFunctionCallError( - "niDCPower_QueryOutputState" - ) + mock_library.niDCPower_QueryOutputState.side_effect = MockFunctionCallError("niDCPower_QueryOutputState") mock_library.niDCPower_QueryOutputState.return_value = 0 - mock_library.niDCPower_ReadCurrentTemperature.side_effect = ( - MockFunctionCallError("niDCPower_ReadCurrentTemperature") - ) + mock_library.niDCPower_ReadCurrentTemperature.side_effect = MockFunctionCallError("niDCPower_ReadCurrentTemperature") mock_library.niDCPower_ReadCurrentTemperature.return_value = 0 - mock_library.niDCPower_ResetDevice.side_effect = MockFunctionCallError( - "niDCPower_ResetDevice" - ) + mock_library.niDCPower_ResetDevice.side_effect = MockFunctionCallError("niDCPower_ResetDevice") mock_library.niDCPower_ResetDevice.return_value = 0 - mock_library.niDCPower_ResetWithChannels.side_effect = MockFunctionCallError( - "niDCPower_ResetWithChannels" - ) + mock_library.niDCPower_ResetWithChannels.side_effect = MockFunctionCallError("niDCPower_ResetWithChannels") mock_library.niDCPower_ResetWithChannels.return_value = 0 - mock_library.niDCPower_ResetWithDefaults.side_effect = MockFunctionCallError( - "niDCPower_ResetWithDefaults" - ) + mock_library.niDCPower_ResetWithDefaults.side_effect = MockFunctionCallError("niDCPower_ResetWithDefaults") mock_library.niDCPower_ResetWithDefaults.return_value = 0 - mock_library.niDCPower_SendSoftwareEdgeTriggerWithChannels.side_effect = ( - MockFunctionCallError("niDCPower_SendSoftwareEdgeTriggerWithChannels") - ) + mock_library.niDCPower_SendSoftwareEdgeTriggerWithChannels.side_effect = MockFunctionCallError("niDCPower_SendSoftwareEdgeTriggerWithChannels") mock_library.niDCPower_SendSoftwareEdgeTriggerWithChannels.return_value = 0 - mock_library.niDCPower_SetAttributeViBoolean.side_effect = ( - MockFunctionCallError("niDCPower_SetAttributeViBoolean") - ) + mock_library.niDCPower_SetAttributeViBoolean.side_effect = MockFunctionCallError("niDCPower_SetAttributeViBoolean") mock_library.niDCPower_SetAttributeViBoolean.return_value = 0 - mock_library.niDCPower_SetAttributeViInt32.side_effect = MockFunctionCallError( - "niDCPower_SetAttributeViInt32" - ) + mock_library.niDCPower_SetAttributeViInt32.side_effect = MockFunctionCallError("niDCPower_SetAttributeViInt32") mock_library.niDCPower_SetAttributeViInt32.return_value = 0 - mock_library.niDCPower_SetAttributeViInt64.side_effect = MockFunctionCallError( - "niDCPower_SetAttributeViInt64" - ) + mock_library.niDCPower_SetAttributeViInt64.side_effect = MockFunctionCallError("niDCPower_SetAttributeViInt64") mock_library.niDCPower_SetAttributeViInt64.return_value = 0 - mock_library.niDCPower_SetAttributeViReal64.side_effect = MockFunctionCallError( - "niDCPower_SetAttributeViReal64" - ) + mock_library.niDCPower_SetAttributeViReal64.side_effect = MockFunctionCallError("niDCPower_SetAttributeViReal64") mock_library.niDCPower_SetAttributeViReal64.return_value = 0 - mock_library.niDCPower_SetAttributeViString.side_effect = MockFunctionCallError( - "niDCPower_SetAttributeViString" - ) + mock_library.niDCPower_SetAttributeViString.side_effect = MockFunctionCallError("niDCPower_SetAttributeViString") mock_library.niDCPower_SetAttributeViString.return_value = 0 - mock_library.niDCPower_SetSequence.side_effect = MockFunctionCallError( - "niDCPower_SetSequence" - ) + mock_library.niDCPower_SetSequence.side_effect = MockFunctionCallError("niDCPower_SetSequence") mock_library.niDCPower_SetSequence.return_value = 0 - mock_library.niDCPower_UnlockSession.side_effect = MockFunctionCallError( - "niDCPower_UnlockSession" - ) + mock_library.niDCPower_UnlockSession.side_effect = MockFunctionCallError("niDCPower_UnlockSession") mock_library.niDCPower_UnlockSession.return_value = 0 - mock_library.niDCPower_WaitForEventWithChannels.side_effect = ( - MockFunctionCallError("niDCPower_WaitForEventWithChannels") - ) + mock_library.niDCPower_WaitForEventWithChannels.side_effect = MockFunctionCallError("niDCPower_WaitForEventWithChannels") mock_library.niDCPower_WaitForEventWithChannels.return_value = 0 - mock_library.niDCPower_close.side_effect = MockFunctionCallError( - "niDCPower_close" - ) + mock_library.niDCPower_close.side_effect = MockFunctionCallError("niDCPower_close") mock_library.niDCPower_close.return_value = 0 - mock_library.niDCPower_error_message.side_effect = MockFunctionCallError( - "niDCPower_error_message" - ) + mock_library.niDCPower_error_message.side_effect = MockFunctionCallError("niDCPower_error_message") mock_library.niDCPower_error_message.return_value = 0 - mock_library.niDCPower_self_test.side_effect = MockFunctionCallError( - "niDCPower_self_test" - ) + mock_library.niDCPower_self_test.side_effect = MockFunctionCallError("niDCPower_self_test") mock_library.niDCPower_self_test.return_value = 0 diff --git a/generated/nidcpower/setup.py b/generated/nidcpower/setup.py index bef30ccdf..7701e32c7 100644 --- a/generated/nidcpower/setup.py +++ b/generated/nidcpower/setup.py @@ -15,44 +15,41 @@ def finalize_options(self): def run_tests(self): import pytest - pytest.main(self.test_args) -pypi_name = "nidcpower" +pypi_name = 'nidcpower' def read_contents(file_to_read): - with open(file_to_read, "r") as f: + with open(file_to_read, 'r') as f: return f.read() setup( name=pypi_name, zip_safe=True, - version="1.4.2.dev0", - description="NI-DCPower Python API", - long_description=read_contents("README.rst"), - long_description_content_type="text/x-rst", - author="NI", + version='1.4.2.dev0', + description='NI-DCPower Python API', + long_description=read_contents('README.rst'), + long_description_content_type='text/x-rst', + author='NI', author_email="opensource@ni.com", url="https://github.com/ni/nimi-python", maintainer="NI", maintainer_email="opensource@ni.com", - keywords=["nidcpower"], - license="MIT", + keywords=['nidcpower'], + license='MIT', include_package_data=True, - packages=["nidcpower"], + packages=['nidcpower'], install_requires=[ 'enum34;python_version<"3.4"', 'singledispatch;python_version<"3.4"', - "hightime>=0.2.0", - ], - setup_requires=[ - "pytest-runner", + 'hightime>=0.2.0', ], - tests_require=["pytest"], - test_suite="tests", + setup_requires=['pytest-runner', ], + tests_require=['pytest'], + test_suite='tests', classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -67,8 +64,8 @@ def read_contents(file_to_read): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", - "Topic :: System :: Hardware :: Hardware Drivers", + "Topic :: System :: Hardware :: Hardware Drivers" ], - cmdclass={"test": PyTest}, - package_data={pypi_name: ["VERSION"]}, + cmdclass={'test': PyTest}, + package_data={pypi_name: ['VERSION']}, ) diff --git a/generated/nidigital/nidigital/__init__.py b/generated/nidigital/nidigital/__init__.py index 8af945476..815b17ddc 100644 --- a/generated/nidigital/nidigital/__init__.py +++ b/generated/nidigital/nidigital/__init__.py @@ -2,25 +2,23 @@ # This file was generated -__version__ = "1.4.2.dev0" +__version__ = '1.4.2.dev0' from nidigital.enums import * # noqa: F403,F401,H303 from nidigital.errors import DriverWarning # noqa: F401 from nidigital.errors import Error # noqa: F401 from nidigital.session import Session # noqa: F401 -from nidigital.history_ram_cycle_information import ( - HistoryRAMCycleInformation, -) # noqa: F401 +from nidigital.history_ram_cycle_information import HistoryRAMCycleInformation # noqa: F401 def get_diagnostic_information(): - """Get diagnostic information about the system state that is suitable for printing or logging + '''Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - """ + ''' import os import pkg_resources import platform @@ -28,80 +26,73 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return struct.calcsize("P") == 8 + return (struct.calcsize("P") == 8) def is_os_64bit(): - return platform.machine().endswith("64") + return platform.machine().endswith('64') def is_venv(): - return "VIRTUAL_ENV" in os.environ + return 'VIRTUAL_ENV' in os.environ info = {} - info["os"] = {} - info["python"] = {} - info["driver"] = {} - info["module"] = {} - if platform.system() == "Windows": + info['os'] = {} + info['python'] = {} + info['driver'] = {} + info['module'] = {} + if platform.system() == 'Windows': try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = "Windows" + os_name = 'Windows' try: - driver_version_key = winreg.OpenKey( - winreg.HKEY_LOCAL_MACHINE, - r"SOFTWARE\National Instruments\NI-Digital Pattern Driver\CurrentVersion", - ) + driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-Digital Pattern Driver\CurrentVersion") driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = "Unknown" - elif platform.system() == "Linux": - os_name = "Linux" - driver_version = "Unknown" + driver_version = 'Unknown' + elif platform.system() == 'Linux': + os_name = 'Linux' + driver_version = 'Unknown' else: - raise SystemError("Unsupported platform: {}".format(platform.system())) + raise SystemError('Unsupported platform: {}'.format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [ - { - "name": i.key, - "version": i.version, - } - for i in installed_packages - ] - - info["os"]["name"] = os_name - info["os"]["version"] = platform.version() - info["os"]["bits"] = "64" if is_os_64bit() else "32" - info["driver"]["name"] = "NI-Digital Pattern Driver" - info["driver"]["version"] = driver_version - info["module"]["name"] = "nidigital" - info["module"]["version"] = "1.4.2.dev0" - info["python"]["version"] = sys.version - info["python"]["bits"] = "64" if is_python_64bit() else "32" - info["python"]["is_venv"] = is_venv() - info["python"]["packages"] = installed_packages_list + installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] + + info['os']['name'] = os_name + info['os']['version'] = platform.version() + info['os']['bits'] = '64' if is_os_64bit() else '32' + info['driver']['name'] = "NI-Digital Pattern Driver" + info['driver']['version'] = driver_version + info['module']['name'] = 'nidigital' + info['module']['version'] = "1.4.2.dev0" + info['python']['version'] = sys.version + info['python']['bits'] = '64' if is_python_64bit() else '32' + info['python']['is_venv'] = is_venv() + info['python']['packages'] = installed_packages_list return info def print_diagnostic_information(): - """Print diagnostic information in a format suitable for issue report + '''Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - """ + ''' info = get_diagnostic_information() - row_format = " {:<10} {}" - for type in ["OS", "Driver", "Module", "Python"]: + row_format = ' {:<10} {}' + for type in ['OS', 'Driver', 'Module', 'Python']: typename = type.lower() - print(type + ":") + print(type + ':') for item in info[typename]: - if item != "packages": - print(row_format.format(item.title() + ":", info[typename][item])) - print(" Installed Packages:") - for p in info["python"]["packages"]: - print((" " * 8) + p["name"] + "==" + p["version"]) + if item != 'packages': + print(row_format.format(item.title() + ':', info[typename][item])) + print(' Installed Packages:') + for p in info['python']['packages']: + print((' ' * 8) + p['name'] + '==' + p['version']) return info + + diff --git a/generated/nidigital/nidigital/_attributes.py b/generated/nidigital/nidigital/_attributes.py index 5a20ca61f..277b4b001 100644 --- a/generated/nidigital/nidigital/_attributes.py +++ b/generated/nidigital/nidigital/_attributes.py @@ -6,13 +6,14 @@ class Attribute(object): - """Base class for all typed attributes.""" + '''Base class for all typed attributes.''' def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -21,19 +22,16 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): + def __get__(self, session, session_type): - return hightime.timedelta( - milliseconds=session._get_attribute_vi_int32(self._attribute_id) - ) + return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_int32( - self._attribute_id, - _converters.convert_timedelta_to_milliseconds_int32(value).value, - ) + session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) class AttributeViInt64(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -42,6 +40,7 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -50,19 +49,16 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): + def __get__(self, session, session_type): - return hightime.timedelta( - seconds=session._get_attribute_vi_real64(self._attribute_id) - ) + return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_real64( - self._attribute_id, - _converters.convert_timedelta_to_seconds_real64(value).value, - ) + session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) class AttributeViString(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -71,17 +67,16 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string( - self._attribute_id, - _converters.convert_repeated_capabilities_without_prefix(value), - ) + session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) class AttributeViBoolean(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -90,36 +85,31 @@ def __set__(self, session, value): class AttributeEnum(object): + def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type( - self._underlying_attribute.__get__(session, session_type) - ) + return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError( - "must be " - + str(self._attribute_type.__name__) - + " not " - + str(type(value).__name__) - ) + raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): + def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from nidigital.session import SessionReference - return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session( - self._attribute_id, _converters.convert_to_nitclk_session_number(value) - ) + session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) + + + diff --git a/generated/nidigital/nidigital/_converters.py b/generated/nidigital/nidigital/_converters.py index a6c2c8434..b36b311d8 100644 --- a/generated/nidigital/nidigital/_converters.py +++ b/generated/nidigital/nidigital/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - """Base version that should not be called + '''Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,38 +40,36 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - """ - raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) + ''' + raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - """Integer version""" + '''Integer version''' return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - """String version (this is the most complex) + '''String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - """ + ''' # First we deal with a list - rep_cap_list = repeated_capability.split(",") + rep_cap_list = repeated_capability.split(',') if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, "").replace(":", "-") - rc = r.split("-") + r = repeated_capability.strip().replace(prefix, '').replace(':', '-') + rc = r.split('-') if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError( - "Multiple '-' or ':'", repeated_capability - ) + raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) try: start = int(rc[0]) end = int(rc[1]) @@ -87,7 +85,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, "").strip()] + return [repeated_capability.replace(prefix, '').strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -96,7 +94,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - """Iterable version - can handle lists, ranges, and tuples""" + '''Iterable version - can handle lists, ranges, and tuples''' rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -105,22 +103,16 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - """slice version""" - + '''slice version''' def ifnone(a, b): return b if a is None else a - # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range( - ifnone(repeated_capability.start, 0), - repeated_capability.stop, - ifnone(repeated_capability.step, 1), - ) + rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=""): - """Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=''): + '''Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -128,17 +120,15 @@ def convert_repeated_capabilities(repeated_capability, prefix=""): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - """ + ''' # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [ - prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) - ] + return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] def convert_repeated_capabilities_without_prefix(repeated_capability): - """Convert a repeated capabilities object, without any prefix, to a comma delimited list + '''Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -154,8 +144,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - """ - return ",".join(convert_repeated_capabilities(repeated_capability, "")) + ''' + return ','.join(convert_repeated_capabilities(repeated_capability, '')) def _convert_timedelta(value, library_type, scaling): @@ -168,14 +158,7 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [ - _visatype.ViInt64, - _visatype.ViInt32, - _visatype.ViUInt32, - _visatype.ViInt16, - _visatype.ViUInt16, - _visatype.ViInt8, - ]: + if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -212,36 +195,34 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - "rangecheck": "RangeCheck", - "queryinstrstatus": "QueryInstrStatus", - "cache": "Cache", - "simulate": "Simulate", - "recordcoercions": "RecordCoercions", - "interchangecheck": "InterchangeCheck", - "driversetup": "DriverSetup", - "range_check": "RangeCheck", - "query_instr_status": "QueryInstrStatus", - "record_coercions": "RecordCoercions", - "interchange_check": "InterchangeCheck", - "driver_setup": "DriverSetup", + 'rangecheck': 'RangeCheck', + 'queryinstrstatus': 'QueryInstrStatus', + 'cache': 'Cache', + 'simulate': 'Simulate', + 'recordcoercions': 'RecordCoercions', + 'interchangecheck': 'InterchangeCheck', + 'driversetup': 'DriverSetup', + 'range_check': 'RangeCheck', + 'query_instr_status': 'QueryInstrStatus', + 'record_coercions': 'RecordCoercions', + 'interchange_check': 'InterchangeCheck', + 'driver_setup': 'DriverSetup', } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": - value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") - elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": + if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': + value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') + elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': if not isinstance(values[k], dict): - raise TypeError("DriverSetup must be a dictionary") - value = "DriverSetup=" + ( - ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) - ) + raise TypeError('DriverSetup must be a dictionary') + value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) else: - value = k + ("=1" if values[k] is True else "=0") + value = k + ('=1' if values[k] is True else '=0') init_with_options.append(value) - init_with_options_string = ",".join(init_with_options) + init_with_options_string = ','.join(init_with_options) return init_with_options_string @@ -270,11 +251,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(",")] + return [x.strip() for x in comma_separated_string.split(',')] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -286,17 +267,11 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - """ - chained_repeated_capability_items = convert_comma_separated_string_to_list( - chained_repeated_capability - ) - repeated_capability_lists = [ - [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) - ] + ''' + chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) + repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] for item in chained_repeated_capability_items: - repeated_capability_lists = [ - x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) - ] - return [ - ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists - ] + repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] + return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] + + diff --git a/generated/nidigital/nidigital/_library.py b/generated/nidigital/nidigital/_library.py index 5d47c2095..7912475c1 100644 --- a/generated/nidigital/nidigital/_library.py +++ b/generated/nidigital/nidigital/_library.py @@ -11,11 +11,11 @@ class Library(object): - """Library + '''Library Wrapper around driver library. Class will setup the correct ctypes information for every function on first call. - """ + ''' def __init__(self, ctypes_library): self._func_lock = threading.Lock() @@ -124,9 +124,7 @@ def _get_library_function(self, name): def niDigital_Abort(self, vi): # noqa: N802 with self._func_lock: if self.niDigital_Abort_cfunc is None: - self.niDigital_Abort_cfunc = self._get_library_function( - "niDigital_Abort" - ) + self.niDigital_Abort_cfunc = self._get_library_function('niDigital_Abort') self.niDigital_Abort_cfunc.argtypes = [ViSession] # noqa: F405 self.niDigital_Abort_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_Abort_cfunc(vi) @@ -134,1239 +132,439 @@ def niDigital_Abort(self, vi): # noqa: N802 def niDigital_AbortKeepAlive(self, vi): # noqa: N802 with self._func_lock: if self.niDigital_AbortKeepAlive_cfunc is None: - self.niDigital_AbortKeepAlive_cfunc = self._get_library_function( - "niDigital_AbortKeepAlive" - ) + self.niDigital_AbortKeepAlive_cfunc = self._get_library_function('niDigital_AbortKeepAlive') self.niDigital_AbortKeepAlive_cfunc.argtypes = [ViSession] # noqa: F405 self.niDigital_AbortKeepAlive_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_AbortKeepAlive_cfunc(vi) - def niDigital_ApplyLevelsAndTiming( - self, - vi, - site_list, - levels_sheet, - timing_sheet, - initial_state_high_pins, - initial_state_low_pins, - initial_state_tristate_pins, - ): # noqa: N802 + def niDigital_ApplyLevelsAndTiming(self, vi, site_list, levels_sheet, timing_sheet, initial_state_high_pins, initial_state_low_pins, initial_state_tristate_pins): # noqa: N802 with self._func_lock: if self.niDigital_ApplyLevelsAndTiming_cfunc is None: - self.niDigital_ApplyLevelsAndTiming_cfunc = self._get_library_function( - "niDigital_ApplyLevelsAndTiming" - ) - self.niDigital_ApplyLevelsAndTiming_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niDigital_ApplyLevelsAndTiming_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_ApplyLevelsAndTiming_cfunc( - vi, - site_list, - levels_sheet, - timing_sheet, - initial_state_high_pins, - initial_state_low_pins, - initial_state_tristate_pins, - ) - - def niDigital_ApplyTDROffsets( - self, vi, channel_list, num_offsets, offsets - ): # noqa: N802 + self.niDigital_ApplyLevelsAndTiming_cfunc = self._get_library_function('niDigital_ApplyLevelsAndTiming') + self.niDigital_ApplyLevelsAndTiming_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_ApplyLevelsAndTiming_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_ApplyLevelsAndTiming_cfunc(vi, site_list, levels_sheet, timing_sheet, initial_state_high_pins, initial_state_low_pins, initial_state_tristate_pins) + + def niDigital_ApplyTDROffsets(self, vi, channel_list, num_offsets, offsets): # noqa: N802 with self._func_lock: if self.niDigital_ApplyTDROffsets_cfunc is None: - self.niDigital_ApplyTDROffsets_cfunc = self._get_library_function( - "niDigital_ApplyTDROffsets" - ) - self.niDigital_ApplyTDROffsets_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niDigital_ApplyTDROffsets_cfunc = self._get_library_function('niDigital_ApplyTDROffsets') + self.niDigital_ApplyTDROffsets_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 self.niDigital_ApplyTDROffsets_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_ApplyTDROffsets_cfunc( - vi, channel_list, num_offsets, offsets - ) - - def niDigital_BurstPattern( - self, - vi, - site_list, - start_label, - select_digital_function, - wait_until_done, - timeout, - ): # noqa: N802 + return self.niDigital_ApplyTDROffsets_cfunc(vi, channel_list, num_offsets, offsets) + + def niDigital_BurstPattern(self, vi, site_list, start_label, select_digital_function, wait_until_done, timeout): # noqa: N802 with self._func_lock: if self.niDigital_BurstPattern_cfunc is None: - self.niDigital_BurstPattern_cfunc = self._get_library_function( - "niDigital_BurstPattern" - ) - self.niDigital_BurstPattern_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViBoolean, - ViBoolean, - ViReal64, - ] # noqa: F405 + self.niDigital_BurstPattern_cfunc = self._get_library_function('niDigital_BurstPattern') + self.niDigital_BurstPattern_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViBoolean, ViBoolean, ViReal64] # noqa: F405 self.niDigital_BurstPattern_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_BurstPattern_cfunc( - vi, - site_list, - start_label, - select_digital_function, - wait_until_done, - timeout, - ) + return self.niDigital_BurstPattern_cfunc(vi, site_list, start_label, select_digital_function, wait_until_done, timeout) def niDigital_ClockGenerator_Abort(self, vi, channel_list): # noqa: N802 with self._func_lock: if self.niDigital_ClockGenerator_Abort_cfunc is None: - self.niDigital_ClockGenerator_Abort_cfunc = self._get_library_function( - "niDigital_ClockGenerator_Abort" - ) - self.niDigital_ClockGenerator_Abort_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niDigital_ClockGenerator_Abort_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niDigital_ClockGenerator_Abort_cfunc = self._get_library_function('niDigital_ClockGenerator_Abort') + self.niDigital_ClockGenerator_Abort_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_ClockGenerator_Abort_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_ClockGenerator_Abort_cfunc(vi, channel_list) - def niDigital_ClockGenerator_GenerateClock( - self, vi, channel_list, frequency, select_digital_function - ): # noqa: N802 + def niDigital_ClockGenerator_GenerateClock(self, vi, channel_list, frequency, select_digital_function): # noqa: N802 with self._func_lock: if self.niDigital_ClockGenerator_GenerateClock_cfunc is None: - self.niDigital_ClockGenerator_GenerateClock_cfunc = ( - self._get_library_function("niDigital_ClockGenerator_GenerateClock") - ) - self.niDigital_ClockGenerator_GenerateClock_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViReal64, - ViBoolean, - ] # noqa: F405 - self.niDigital_ClockGenerator_GenerateClock_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_ClockGenerator_GenerateClock_cfunc( - vi, channel_list, frequency, select_digital_function - ) + self.niDigital_ClockGenerator_GenerateClock_cfunc = self._get_library_function('niDigital_ClockGenerator_GenerateClock') + self.niDigital_ClockGenerator_GenerateClock_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViBoolean] # noqa: F405 + self.niDigital_ClockGenerator_GenerateClock_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_ClockGenerator_GenerateClock_cfunc(vi, channel_list, frequency, select_digital_function) def niDigital_Commit(self, vi): # noqa: N802 with self._func_lock: if self.niDigital_Commit_cfunc is None: - self.niDigital_Commit_cfunc = self._get_library_function( - "niDigital_Commit" - ) + self.niDigital_Commit_cfunc = self._get_library_function('niDigital_Commit') self.niDigital_Commit_cfunc.argtypes = [ViSession] # noqa: F405 self.niDigital_Commit_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_Commit_cfunc(vi) - def niDigital_ConfigureActiveLoadLevels( - self, vi, channel_list, iol, ioh, vcom - ): # noqa: N802 + def niDigital_ConfigureActiveLoadLevels(self, vi, channel_list, iol, ioh, vcom): # noqa: N802 with self._func_lock: if self.niDigital_ConfigureActiveLoadLevels_cfunc is None: - self.niDigital_ConfigureActiveLoadLevels_cfunc = ( - self._get_library_function("niDigital_ConfigureActiveLoadLevels") - ) - self.niDigital_ConfigureActiveLoadLevels_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViReal64, - ViReal64, - ViReal64, - ] # noqa: F405 - self.niDigital_ConfigureActiveLoadLevels_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_ConfigureActiveLoadLevels_cfunc( - vi, channel_list, iol, ioh, vcom - ) + self.niDigital_ConfigureActiveLoadLevels_cfunc = self._get_library_function('niDigital_ConfigureActiveLoadLevels') + self.niDigital_ConfigureActiveLoadLevels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViReal64, ViReal64] # noqa: F405 + self.niDigital_ConfigureActiveLoadLevels_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_ConfigureActiveLoadLevels_cfunc(vi, channel_list, iol, ioh, vcom) def niDigital_ConfigurePatternBurstSites(self, vi, site_list): # noqa: N802 with self._func_lock: if self.niDigital_ConfigurePatternBurstSites_cfunc is None: - self.niDigital_ConfigurePatternBurstSites_cfunc = ( - self._get_library_function("niDigital_ConfigurePatternBurstSites") - ) - self.niDigital_ConfigurePatternBurstSites_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niDigital_ConfigurePatternBurstSites_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niDigital_ConfigurePatternBurstSites_cfunc = self._get_library_function('niDigital_ConfigurePatternBurstSites') + self.niDigital_ConfigurePatternBurstSites_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_ConfigurePatternBurstSites_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_ConfigurePatternBurstSites_cfunc(vi, site_list) - def niDigital_ConfigureTimeSetCompareEdgesStrobe( - self, vi, pin_list, time_set_name, strobe_edge - ): # noqa: N802 + def niDigital_ConfigureTimeSetCompareEdgesStrobe(self, vi, pin_list, time_set_name, strobe_edge): # noqa: N802 with self._func_lock: if self.niDigital_ConfigureTimeSetCompareEdgesStrobe_cfunc is None: - self.niDigital_ConfigureTimeSetCompareEdgesStrobe_cfunc = ( - self._get_library_function( - "niDigital_ConfigureTimeSetCompareEdgesStrobe" - ) - ) - self.niDigital_ConfigureTimeSetCompareEdgesStrobe_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViReal64, - ] # noqa: F405 - self.niDigital_ConfigureTimeSetCompareEdgesStrobe_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_ConfigureTimeSetCompareEdgesStrobe_cfunc( - vi, pin_list, time_set_name, strobe_edge - ) - - def niDigital_ConfigureTimeSetCompareEdgesStrobe2x( - self, vi, pin_list, time_set_name, strobe_edge, strobe2_edge - ): # noqa: N802 + self.niDigital_ConfigureTimeSetCompareEdgesStrobe_cfunc = self._get_library_function('niDigital_ConfigureTimeSetCompareEdgesStrobe') + self.niDigital_ConfigureTimeSetCompareEdgesStrobe_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViReal64] # noqa: F405 + self.niDigital_ConfigureTimeSetCompareEdgesStrobe_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_ConfigureTimeSetCompareEdgesStrobe_cfunc(vi, pin_list, time_set_name, strobe_edge) + + def niDigital_ConfigureTimeSetCompareEdgesStrobe2x(self, vi, pin_list, time_set_name, strobe_edge, strobe2_edge): # noqa: N802 with self._func_lock: if self.niDigital_ConfigureTimeSetCompareEdgesStrobe2x_cfunc is None: - self.niDigital_ConfigureTimeSetCompareEdgesStrobe2x_cfunc = ( - self._get_library_function( - "niDigital_ConfigureTimeSetCompareEdgesStrobe2x" - ) - ) - self.niDigital_ConfigureTimeSetCompareEdgesStrobe2x_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViReal64, - ViReal64, - ] # noqa: F405 - self.niDigital_ConfigureTimeSetCompareEdgesStrobe2x_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_ConfigureTimeSetCompareEdgesStrobe2x_cfunc( - vi, pin_list, time_set_name, strobe_edge, strobe2_edge - ) - - def niDigital_ConfigureTimeSetDriveEdges( - self, - vi, - pin_list, - time_set_name, - format, - drive_on_edge, - drive_data_edge, - drive_return_edge, - drive_off_edge, - ): # noqa: N802 + self.niDigital_ConfigureTimeSetCompareEdgesStrobe2x_cfunc = self._get_library_function('niDigital_ConfigureTimeSetCompareEdgesStrobe2x') + self.niDigital_ConfigureTimeSetCompareEdgesStrobe2x_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViReal64, ViReal64] # noqa: F405 + self.niDigital_ConfigureTimeSetCompareEdgesStrobe2x_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_ConfigureTimeSetCompareEdgesStrobe2x_cfunc(vi, pin_list, time_set_name, strobe_edge, strobe2_edge) + + def niDigital_ConfigureTimeSetDriveEdges(self, vi, pin_list, time_set_name, format, drive_on_edge, drive_data_edge, drive_return_edge, drive_off_edge): # noqa: N802 with self._func_lock: if self.niDigital_ConfigureTimeSetDriveEdges_cfunc is None: - self.niDigital_ConfigureTimeSetDriveEdges_cfunc = ( - self._get_library_function("niDigital_ConfigureTimeSetDriveEdges") - ) - self.niDigital_ConfigureTimeSetDriveEdges_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViInt32, - ViReal64, - ViReal64, - ViReal64, - ViReal64, - ] # noqa: F405 - self.niDigital_ConfigureTimeSetDriveEdges_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_ConfigureTimeSetDriveEdges_cfunc( - vi, - pin_list, - time_set_name, - format, - drive_on_edge, - drive_data_edge, - drive_return_edge, - drive_off_edge, - ) - - def niDigital_ConfigureTimeSetDriveEdges2x( - self, - vi, - pin_list, - time_set_name, - format, - drive_on_edge, - drive_data_edge, - drive_return_edge, - drive_off_edge, - drive_data2_edge, - drive_return2_edge, - ): # noqa: N802 + self.niDigital_ConfigureTimeSetDriveEdges_cfunc = self._get_library_function('niDigital_ConfigureTimeSetDriveEdges') + self.niDigital_ConfigureTimeSetDriveEdges_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ViReal64, ViReal64, ViReal64, ViReal64] # noqa: F405 + self.niDigital_ConfigureTimeSetDriveEdges_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_ConfigureTimeSetDriveEdges_cfunc(vi, pin_list, time_set_name, format, drive_on_edge, drive_data_edge, drive_return_edge, drive_off_edge) + + def niDigital_ConfigureTimeSetDriveEdges2x(self, vi, pin_list, time_set_name, format, drive_on_edge, drive_data_edge, drive_return_edge, drive_off_edge, drive_data2_edge, drive_return2_edge): # noqa: N802 with self._func_lock: if self.niDigital_ConfigureTimeSetDriveEdges2x_cfunc is None: - self.niDigital_ConfigureTimeSetDriveEdges2x_cfunc = ( - self._get_library_function("niDigital_ConfigureTimeSetDriveEdges2x") - ) - self.niDigital_ConfigureTimeSetDriveEdges2x_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViInt32, - ViReal64, - ViReal64, - ViReal64, - ViReal64, - ViReal64, - ViReal64, - ] # noqa: F405 - self.niDigital_ConfigureTimeSetDriveEdges2x_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_ConfigureTimeSetDriveEdges2x_cfunc( - vi, - pin_list, - time_set_name, - format, - drive_on_edge, - drive_data_edge, - drive_return_edge, - drive_off_edge, - drive_data2_edge, - drive_return2_edge, - ) - - def niDigital_ConfigureTimeSetDriveFormat( - self, vi, pin_list, time_set_name, drive_format - ): # noqa: N802 + self.niDigital_ConfigureTimeSetDriveEdges2x_cfunc = self._get_library_function('niDigital_ConfigureTimeSetDriveEdges2x') + self.niDigital_ConfigureTimeSetDriveEdges2x_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ViReal64, ViReal64, ViReal64, ViReal64, ViReal64, ViReal64] # noqa: F405 + self.niDigital_ConfigureTimeSetDriveEdges2x_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_ConfigureTimeSetDriveEdges2x_cfunc(vi, pin_list, time_set_name, format, drive_on_edge, drive_data_edge, drive_return_edge, drive_off_edge, drive_data2_edge, drive_return2_edge) + + def niDigital_ConfigureTimeSetDriveFormat(self, vi, pin_list, time_set_name, drive_format): # noqa: N802 with self._func_lock: if self.niDigital_ConfigureTimeSetDriveFormat_cfunc is None: - self.niDigital_ConfigureTimeSetDriveFormat_cfunc = ( - self._get_library_function("niDigital_ConfigureTimeSetDriveFormat") - ) - self.niDigital_ConfigureTimeSetDriveFormat_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViInt32, - ] # noqa: F405 - self.niDigital_ConfigureTimeSetDriveFormat_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_ConfigureTimeSetDriveFormat_cfunc( - vi, pin_list, time_set_name, drive_format - ) - - def niDigital_ConfigureTimeSetEdge( - self, vi, pin_list, time_set_name, edge, time - ): # noqa: N802 + self.niDigital_ConfigureTimeSetDriveFormat_cfunc = self._get_library_function('niDigital_ConfigureTimeSetDriveFormat') + self.niDigital_ConfigureTimeSetDriveFormat_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32] # noqa: F405 + self.niDigital_ConfigureTimeSetDriveFormat_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_ConfigureTimeSetDriveFormat_cfunc(vi, pin_list, time_set_name, drive_format) + + def niDigital_ConfigureTimeSetEdge(self, vi, pin_list, time_set_name, edge, time): # noqa: N802 with self._func_lock: if self.niDigital_ConfigureTimeSetEdge_cfunc is None: - self.niDigital_ConfigureTimeSetEdge_cfunc = self._get_library_function( - "niDigital_ConfigureTimeSetEdge" - ) - self.niDigital_ConfigureTimeSetEdge_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViInt32, - ViReal64, - ] # noqa: F405 - self.niDigital_ConfigureTimeSetEdge_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_ConfigureTimeSetEdge_cfunc( - vi, pin_list, time_set_name, edge, time - ) - - def niDigital_ConfigureTimeSetEdgeMultiplier( - self, vi, pin_list, time_set_name, edge_multiplier - ): # noqa: N802 + self.niDigital_ConfigureTimeSetEdge_cfunc = self._get_library_function('niDigital_ConfigureTimeSetEdge') + self.niDigital_ConfigureTimeSetEdge_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ViReal64] # noqa: F405 + self.niDigital_ConfigureTimeSetEdge_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_ConfigureTimeSetEdge_cfunc(vi, pin_list, time_set_name, edge, time) + + def niDigital_ConfigureTimeSetEdgeMultiplier(self, vi, pin_list, time_set_name, edge_multiplier): # noqa: N802 with self._func_lock: if self.niDigital_ConfigureTimeSetEdgeMultiplier_cfunc is None: - self.niDigital_ConfigureTimeSetEdgeMultiplier_cfunc = ( - self._get_library_function( - "niDigital_ConfigureTimeSetEdgeMultiplier" - ) - ) - self.niDigital_ConfigureTimeSetEdgeMultiplier_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViInt32, - ] # noqa: F405 - self.niDigital_ConfigureTimeSetEdgeMultiplier_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_ConfigureTimeSetEdgeMultiplier_cfunc( - vi, pin_list, time_set_name, edge_multiplier - ) + self.niDigital_ConfigureTimeSetEdgeMultiplier_cfunc = self._get_library_function('niDigital_ConfigureTimeSetEdgeMultiplier') + self.niDigital_ConfigureTimeSetEdgeMultiplier_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32] # noqa: F405 + self.niDigital_ConfigureTimeSetEdgeMultiplier_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_ConfigureTimeSetEdgeMultiplier_cfunc(vi, pin_list, time_set_name, edge_multiplier) def niDigital_ConfigureTimeSetPeriod(self, vi, time_set_name, period): # noqa: N802 with self._func_lock: if self.niDigital_ConfigureTimeSetPeriod_cfunc is None: - self.niDigital_ConfigureTimeSetPeriod_cfunc = ( - self._get_library_function("niDigital_ConfigureTimeSetPeriod") - ) - self.niDigital_ConfigureTimeSetPeriod_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViReal64, - ] # noqa: F405 - self.niDigital_ConfigureTimeSetPeriod_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niDigital_ConfigureTimeSetPeriod_cfunc = self._get_library_function('niDigital_ConfigureTimeSetPeriod') + self.niDigital_ConfigureTimeSetPeriod_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64] # noqa: F405 + self.niDigital_ConfigureTimeSetPeriod_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_ConfigureTimeSetPeriod_cfunc(vi, time_set_name, period) - def niDigital_ConfigureVoltageLevels( - self, vi, channel_list, vil, vih, vol, voh, vterm - ): # noqa: N802 + def niDigital_ConfigureVoltageLevels(self, vi, channel_list, vil, vih, vol, voh, vterm): # noqa: N802 with self._func_lock: if self.niDigital_ConfigureVoltageLevels_cfunc is None: - self.niDigital_ConfigureVoltageLevels_cfunc = ( - self._get_library_function("niDigital_ConfigureVoltageLevels") - ) - self.niDigital_ConfigureVoltageLevels_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViReal64, - ViReal64, - ViReal64, - ViReal64, - ViReal64, - ] # noqa: F405 - self.niDigital_ConfigureVoltageLevels_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_ConfigureVoltageLevels_cfunc( - vi, channel_list, vil, vih, vol, voh, vterm - ) - - def niDigital_CreateCaptureWaveformFromFileDigicapture( - self, vi, waveform_name, waveform_file_path - ): # noqa: N802 + self.niDigital_ConfigureVoltageLevels_cfunc = self._get_library_function('niDigital_ConfigureVoltageLevels') + self.niDigital_ConfigureVoltageLevels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViReal64, ViReal64, ViReal64, ViReal64] # noqa: F405 + self.niDigital_ConfigureVoltageLevels_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_ConfigureVoltageLevels_cfunc(vi, channel_list, vil, vih, vol, voh, vterm) + + def niDigital_CreateCaptureWaveformFromFileDigicapture(self, vi, waveform_name, waveform_file_path): # noqa: N802 with self._func_lock: if self.niDigital_CreateCaptureWaveformFromFileDigicapture_cfunc is None: - self.niDigital_CreateCaptureWaveformFromFileDigicapture_cfunc = ( - self._get_library_function( - "niDigital_CreateCaptureWaveformFromFileDigicapture" - ) - ) - self.niDigital_CreateCaptureWaveformFromFileDigicapture_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niDigital_CreateCaptureWaveformFromFileDigicapture_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_CreateCaptureWaveformFromFileDigicapture_cfunc( - vi, waveform_name, waveform_file_path - ) - - def niDigital_CreateCaptureWaveformParallel( - self, vi, pin_list, waveform_name - ): # noqa: N802 + self.niDigital_CreateCaptureWaveformFromFileDigicapture_cfunc = self._get_library_function('niDigital_CreateCaptureWaveformFromFileDigicapture') + self.niDigital_CreateCaptureWaveformFromFileDigicapture_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_CreateCaptureWaveformFromFileDigicapture_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_CreateCaptureWaveformFromFileDigicapture_cfunc(vi, waveform_name, waveform_file_path) + + def niDigital_CreateCaptureWaveformParallel(self, vi, pin_list, waveform_name): # noqa: N802 with self._func_lock: if self.niDigital_CreateCaptureWaveformParallel_cfunc is None: - self.niDigital_CreateCaptureWaveformParallel_cfunc = ( - self._get_library_function( - "niDigital_CreateCaptureWaveformParallel" - ) - ) - self.niDigital_CreateCaptureWaveformParallel_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niDigital_CreateCaptureWaveformParallel_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_CreateCaptureWaveformParallel_cfunc( - vi, pin_list, waveform_name - ) - - def niDigital_CreateCaptureWaveformSerial( - self, vi, pin_list, waveform_name, sample_width, bit_order - ): # noqa: N802 + self.niDigital_CreateCaptureWaveformParallel_cfunc = self._get_library_function('niDigital_CreateCaptureWaveformParallel') + self.niDigital_CreateCaptureWaveformParallel_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_CreateCaptureWaveformParallel_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_CreateCaptureWaveformParallel_cfunc(vi, pin_list, waveform_name) + + def niDigital_CreateCaptureWaveformSerial(self, vi, pin_list, waveform_name, sample_width, bit_order): # noqa: N802 with self._func_lock: if self.niDigital_CreateCaptureWaveformSerial_cfunc is None: - self.niDigital_CreateCaptureWaveformSerial_cfunc = ( - self._get_library_function("niDigital_CreateCaptureWaveformSerial") - ) - self.niDigital_CreateCaptureWaveformSerial_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViUInt32, - ViInt32, - ] # noqa: F405 - self.niDigital_CreateCaptureWaveformSerial_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_CreateCaptureWaveformSerial_cfunc( - vi, pin_list, waveform_name, sample_width, bit_order - ) - - def niDigital_CreateSourceWaveformFromFileTDMS( - self, vi, waveform_name, waveform_file_path, write_waveform_data - ): # noqa: N802 + self.niDigital_CreateCaptureWaveformSerial_cfunc = self._get_library_function('niDigital_CreateCaptureWaveformSerial') + self.niDigital_CreateCaptureWaveformSerial_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViUInt32, ViInt32] # noqa: F405 + self.niDigital_CreateCaptureWaveformSerial_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_CreateCaptureWaveformSerial_cfunc(vi, pin_list, waveform_name, sample_width, bit_order) + + def niDigital_CreateSourceWaveformFromFileTDMS(self, vi, waveform_name, waveform_file_path, write_waveform_data): # noqa: N802 with self._func_lock: if self.niDigital_CreateSourceWaveformFromFileTDMS_cfunc is None: - self.niDigital_CreateSourceWaveformFromFileTDMS_cfunc = ( - self._get_library_function( - "niDigital_CreateSourceWaveformFromFileTDMS" - ) - ) - self.niDigital_CreateSourceWaveformFromFileTDMS_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViBoolean, - ] # noqa: F405 - self.niDigital_CreateSourceWaveformFromFileTDMS_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_CreateSourceWaveformFromFileTDMS_cfunc( - vi, waveform_name, waveform_file_path, write_waveform_data - ) - - def niDigital_CreateSourceWaveformParallel( - self, vi, pin_list, waveform_name, data_mapping - ): # noqa: N802 + self.niDigital_CreateSourceWaveformFromFileTDMS_cfunc = self._get_library_function('niDigital_CreateSourceWaveformFromFileTDMS') + self.niDigital_CreateSourceWaveformFromFileTDMS_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViBoolean] # noqa: F405 + self.niDigital_CreateSourceWaveformFromFileTDMS_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_CreateSourceWaveformFromFileTDMS_cfunc(vi, waveform_name, waveform_file_path, write_waveform_data) + + def niDigital_CreateSourceWaveformParallel(self, vi, pin_list, waveform_name, data_mapping): # noqa: N802 with self._func_lock: if self.niDigital_CreateSourceWaveformParallel_cfunc is None: - self.niDigital_CreateSourceWaveformParallel_cfunc = ( - self._get_library_function("niDigital_CreateSourceWaveformParallel") - ) - self.niDigital_CreateSourceWaveformParallel_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViInt32, - ] # noqa: F405 - self.niDigital_CreateSourceWaveformParallel_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_CreateSourceWaveformParallel_cfunc( - vi, pin_list, waveform_name, data_mapping - ) - - def niDigital_CreateSourceWaveformSerial( - self, vi, pin_list, waveform_name, data_mapping, sample_width, bit_order - ): # noqa: N802 + self.niDigital_CreateSourceWaveformParallel_cfunc = self._get_library_function('niDigital_CreateSourceWaveformParallel') + self.niDigital_CreateSourceWaveformParallel_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32] # noqa: F405 + self.niDigital_CreateSourceWaveformParallel_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_CreateSourceWaveformParallel_cfunc(vi, pin_list, waveform_name, data_mapping) + + def niDigital_CreateSourceWaveformSerial(self, vi, pin_list, waveform_name, data_mapping, sample_width, bit_order): # noqa: N802 with self._func_lock: if self.niDigital_CreateSourceWaveformSerial_cfunc is None: - self.niDigital_CreateSourceWaveformSerial_cfunc = ( - self._get_library_function("niDigital_CreateSourceWaveformSerial") - ) - self.niDigital_CreateSourceWaveformSerial_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViInt32, - ViUInt32, - ViInt32, - ] # noqa: F405 - self.niDigital_CreateSourceWaveformSerial_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_CreateSourceWaveformSerial_cfunc( - vi, pin_list, waveform_name, data_mapping, sample_width, bit_order - ) + self.niDigital_CreateSourceWaveformSerial_cfunc = self._get_library_function('niDigital_CreateSourceWaveformSerial') + self.niDigital_CreateSourceWaveformSerial_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ViUInt32, ViInt32] # noqa: F405 + self.niDigital_CreateSourceWaveformSerial_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_CreateSourceWaveformSerial_cfunc(vi, pin_list, waveform_name, data_mapping, sample_width, bit_order) def niDigital_CreateTimeSet(self, vi, name): # noqa: N802 with self._func_lock: if self.niDigital_CreateTimeSet_cfunc is None: - self.niDigital_CreateTimeSet_cfunc = self._get_library_function( - "niDigital_CreateTimeSet" - ) - self.niDigital_CreateTimeSet_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDigital_CreateTimeSet_cfunc = self._get_library_function('niDigital_CreateTimeSet') + self.niDigital_CreateTimeSet_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 self.niDigital_CreateTimeSet_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_CreateTimeSet_cfunc(vi, name) def niDigital_DeleteAllTimeSets(self, vi): # noqa: N802 with self._func_lock: if self.niDigital_DeleteAllTimeSets_cfunc is None: - self.niDigital_DeleteAllTimeSets_cfunc = self._get_library_function( - "niDigital_DeleteAllTimeSets" - ) - self.niDigital_DeleteAllTimeSets_cfunc.argtypes = [ - ViSession - ] # noqa: F405 + self.niDigital_DeleteAllTimeSets_cfunc = self._get_library_function('niDigital_DeleteAllTimeSets') + self.niDigital_DeleteAllTimeSets_cfunc.argtypes = [ViSession] # noqa: F405 self.niDigital_DeleteAllTimeSets_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_DeleteAllTimeSets_cfunc(vi) def niDigital_DisableSites(self, vi, site_list): # noqa: N802 with self._func_lock: if self.niDigital_DisableSites_cfunc is None: - self.niDigital_DisableSites_cfunc = self._get_library_function( - "niDigital_DisableSites" - ) - self.niDigital_DisableSites_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDigital_DisableSites_cfunc = self._get_library_function('niDigital_DisableSites') + self.niDigital_DisableSites_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 self.niDigital_DisableSites_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_DisableSites_cfunc(vi, site_list) def niDigital_EnableSites(self, vi, site_list): # noqa: N802 with self._func_lock: if self.niDigital_EnableSites_cfunc is None: - self.niDigital_EnableSites_cfunc = self._get_library_function( - "niDigital_EnableSites" - ) - self.niDigital_EnableSites_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDigital_EnableSites_cfunc = self._get_library_function('niDigital_EnableSites') + self.niDigital_EnableSites_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 self.niDigital_EnableSites_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_EnableSites_cfunc(vi, site_list) - def niDigital_FetchCaptureWaveformU32( - self, - vi, - site_list, - waveform_name, - samples_to_read, - timeout, - data_buffer_size, - data, - actual_num_waveforms, - actual_samples_per_waveform, - ): # noqa: N802 + def niDigital_FetchCaptureWaveformU32(self, vi, site_list, waveform_name, samples_to_read, timeout, data_buffer_size, data, actual_num_waveforms, actual_samples_per_waveform): # noqa: N802 with self._func_lock: if self.niDigital_FetchCaptureWaveformU32_cfunc is None: - self.niDigital_FetchCaptureWaveformU32_cfunc = ( - self._get_library_function("niDigital_FetchCaptureWaveformU32") - ) - self.niDigital_FetchCaptureWaveformU32_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViInt32, - ViReal64, - ViInt32, - ctypes.POINTER(ViUInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niDigital_FetchCaptureWaveformU32_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_FetchCaptureWaveformU32_cfunc( - vi, - site_list, - waveform_name, - samples_to_read, - timeout, - data_buffer_size, - data, - actual_num_waveforms, - actual_samples_per_waveform, - ) - - def niDigital_FetchHistoryRAMCycleInformation( - self, - vi, - site, - sample_index, - pattern_index, - time_set_index, - vector_number, - cycle_number, - num_dut_cycles, - ): # noqa: N802 + self.niDigital_FetchCaptureWaveformU32_cfunc = self._get_library_function('niDigital_FetchCaptureWaveformU32') + self.niDigital_FetchCaptureWaveformU32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ViReal64, ViInt32, ctypes.POINTER(ViUInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDigital_FetchCaptureWaveformU32_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_FetchCaptureWaveformU32_cfunc(vi, site_list, waveform_name, samples_to_read, timeout, data_buffer_size, data, actual_num_waveforms, actual_samples_per_waveform) + + def niDigital_FetchHistoryRAMCycleInformation(self, vi, site, sample_index, pattern_index, time_set_index, vector_number, cycle_number, num_dut_cycles): # noqa: N802 with self._func_lock: if self.niDigital_FetchHistoryRAMCycleInformation_cfunc is None: - self.niDigital_FetchHistoryRAMCycleInformation_cfunc = ( - self._get_library_function( - "niDigital_FetchHistoryRAMCycleInformation" - ) - ) - self.niDigital_FetchHistoryRAMCycleInformation_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt64, - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt64), - ctypes.POINTER(ViInt64), - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niDigital_FetchHistoryRAMCycleInformation_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_FetchHistoryRAMCycleInformation_cfunc( - vi, - site, - sample_index, - pattern_index, - time_set_index, - vector_number, - cycle_number, - num_dut_cycles, - ) - - def niDigital_FetchHistoryRAMCyclePinData( - self, - vi, - site, - pin_list, - sample_index, - dut_cycle_index, - pin_data_buffer_size, - expected_pin_states, - actual_pin_states, - per_pin_pass_fail, - actual_num_pin_data, - ): # noqa: N802 + self.niDigital_FetchHistoryRAMCycleInformation_cfunc = self._get_library_function('niDigital_FetchHistoryRAMCycleInformation') + self.niDigital_FetchHistoryRAMCycleInformation_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt64, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt64), ctypes.POINTER(ViInt64), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDigital_FetchHistoryRAMCycleInformation_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_FetchHistoryRAMCycleInformation_cfunc(vi, site, sample_index, pattern_index, time_set_index, vector_number, cycle_number, num_dut_cycles) + + def niDigital_FetchHistoryRAMCyclePinData(self, vi, site, pin_list, sample_index, dut_cycle_index, pin_data_buffer_size, expected_pin_states, actual_pin_states, per_pin_pass_fail, actual_num_pin_data): # noqa: N802 with self._func_lock: if self.niDigital_FetchHistoryRAMCyclePinData_cfunc is None: - self.niDigital_FetchHistoryRAMCyclePinData_cfunc = ( - self._get_library_function("niDigital_FetchHistoryRAMCyclePinData") - ) - self.niDigital_FetchHistoryRAMCyclePinData_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViInt64, - ViInt32, - ViInt32, - ctypes.POINTER(ViUInt8), - ctypes.POINTER(ViUInt8), - ctypes.POINTER(ViBoolean), - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niDigital_FetchHistoryRAMCyclePinData_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_FetchHistoryRAMCyclePinData_cfunc( - vi, - site, - pin_list, - sample_index, - dut_cycle_index, - pin_data_buffer_size, - expected_pin_states, - actual_pin_states, - per_pin_pass_fail, - actual_num_pin_data, - ) - - def niDigital_FetchHistoryRAMScanCycleNumber( - self, vi, site, sample_index, scan_cycle_number - ): # noqa: N802 + self.niDigital_FetchHistoryRAMCyclePinData_cfunc = self._get_library_function('niDigital_FetchHistoryRAMCyclePinData') + self.niDigital_FetchHistoryRAMCyclePinData_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt64, ViInt32, ViInt32, ctypes.POINTER(ViUInt8), ctypes.POINTER(ViUInt8), ctypes.POINTER(ViBoolean), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDigital_FetchHistoryRAMCyclePinData_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_FetchHistoryRAMCyclePinData_cfunc(vi, site, pin_list, sample_index, dut_cycle_index, pin_data_buffer_size, expected_pin_states, actual_pin_states, per_pin_pass_fail, actual_num_pin_data) + + def niDigital_FetchHistoryRAMScanCycleNumber(self, vi, site, sample_index, scan_cycle_number): # noqa: N802 with self._func_lock: if self.niDigital_FetchHistoryRAMScanCycleNumber_cfunc is None: - self.niDigital_FetchHistoryRAMScanCycleNumber_cfunc = ( - self._get_library_function( - "niDigital_FetchHistoryRAMScanCycleNumber" - ) - ) - self.niDigital_FetchHistoryRAMScanCycleNumber_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt64, - ctypes.POINTER(ViInt64), - ] # noqa: F405 - self.niDigital_FetchHistoryRAMScanCycleNumber_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_FetchHistoryRAMScanCycleNumber_cfunc( - vi, site, sample_index, scan_cycle_number - ) - - def niDigital_FrequencyCounter_MeasureFrequency( - self, - vi, - channel_list, - frequencies_buffer_size, - frequencies, - actual_num_frequencies, - ): # noqa: N802 + self.niDigital_FetchHistoryRAMScanCycleNumber_cfunc = self._get_library_function('niDigital_FetchHistoryRAMScanCycleNumber') + self.niDigital_FetchHistoryRAMScanCycleNumber_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt64, ctypes.POINTER(ViInt64)] # noqa: F405 + self.niDigital_FetchHistoryRAMScanCycleNumber_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_FetchHistoryRAMScanCycleNumber_cfunc(vi, site, sample_index, scan_cycle_number) + + def niDigital_FrequencyCounter_MeasureFrequency(self, vi, channel_list, frequencies_buffer_size, frequencies, actual_num_frequencies): # noqa: N802 with self._func_lock: if self.niDigital_FrequencyCounter_MeasureFrequency_cfunc is None: - self.niDigital_FrequencyCounter_MeasureFrequency_cfunc = ( - self._get_library_function( - "niDigital_FrequencyCounter_MeasureFrequency" - ) - ) - self.niDigital_FrequencyCounter_MeasureFrequency_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niDigital_FrequencyCounter_MeasureFrequency_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_FrequencyCounter_MeasureFrequency_cfunc( - vi, - channel_list, - frequencies_buffer_size, - frequencies, - actual_num_frequencies, - ) - - def niDigital_GetAttributeViBoolean( - self, vi, channel_name, attribute, value - ): # noqa: N802 + self.niDigital_FrequencyCounter_MeasureFrequency_cfunc = self._get_library_function('niDigital_FrequencyCounter_MeasureFrequency') + self.niDigital_FrequencyCounter_MeasureFrequency_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDigital_FrequencyCounter_MeasureFrequency_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_FrequencyCounter_MeasureFrequency_cfunc(vi, channel_list, frequencies_buffer_size, frequencies, actual_num_frequencies) + + def niDigital_GetAttributeViBoolean(self, vi, channel_name, attribute, value): # noqa: N802 with self._func_lock: if self.niDigital_GetAttributeViBoolean_cfunc is None: - self.niDigital_GetAttributeViBoolean_cfunc = self._get_library_function( - "niDigital_GetAttributeViBoolean" - ) - self.niDigital_GetAttributeViBoolean_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 - self.niDigital_GetAttributeViBoolean_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_GetAttributeViBoolean_cfunc( - vi, channel_name, attribute, value - ) - - def niDigital_GetAttributeViInt32( - self, vi, channel_name, attribute, value - ): # noqa: N802 + self.niDigital_GetAttributeViBoolean_cfunc = self._get_library_function('niDigital_GetAttributeViBoolean') + self.niDigital_GetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niDigital_GetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_GetAttributeViBoolean_cfunc(vi, channel_name, attribute, value) + + def niDigital_GetAttributeViInt32(self, vi, channel_name, attribute, value): # noqa: N802 with self._func_lock: if self.niDigital_GetAttributeViInt32_cfunc is None: - self.niDigital_GetAttributeViInt32_cfunc = self._get_library_function( - "niDigital_GetAttributeViInt32" - ) - self.niDigital_GetAttributeViInt32_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niDigital_GetAttributeViInt32_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_GetAttributeViInt32_cfunc( - vi, channel_name, attribute, value - ) - - def niDigital_GetAttributeViInt64( - self, vi, channel_name, attribute, value - ): # noqa: N802 + self.niDigital_GetAttributeViInt32_cfunc = self._get_library_function('niDigital_GetAttributeViInt32') + self.niDigital_GetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDigital_GetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_GetAttributeViInt32_cfunc(vi, channel_name, attribute, value) + + def niDigital_GetAttributeViInt64(self, vi, channel_name, attribute, value): # noqa: N802 with self._func_lock: if self.niDigital_GetAttributeViInt64_cfunc is None: - self.niDigital_GetAttributeViInt64_cfunc = self._get_library_function( - "niDigital_GetAttributeViInt64" - ) - self.niDigital_GetAttributeViInt64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViInt64), - ] # noqa: F405 - self.niDigital_GetAttributeViInt64_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_GetAttributeViInt64_cfunc( - vi, channel_name, attribute, value - ) - - def niDigital_GetAttributeViReal64( - self, vi, channel_name, attribute, value - ): # noqa: N802 + self.niDigital_GetAttributeViInt64_cfunc = self._get_library_function('niDigital_GetAttributeViInt64') + self.niDigital_GetAttributeViInt64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViInt64)] # noqa: F405 + self.niDigital_GetAttributeViInt64_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_GetAttributeViInt64_cfunc(vi, channel_name, attribute, value) + + def niDigital_GetAttributeViReal64(self, vi, channel_name, attribute, value): # noqa: N802 with self._func_lock: if self.niDigital_GetAttributeViReal64_cfunc is None: - self.niDigital_GetAttributeViReal64_cfunc = self._get_library_function( - "niDigital_GetAttributeViReal64" - ) - self.niDigital_GetAttributeViReal64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViReal64), - ] # noqa: F405 - self.niDigital_GetAttributeViReal64_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_GetAttributeViReal64_cfunc( - vi, channel_name, attribute, value - ) - - def niDigital_GetAttributeViString( - self, vi, channel_name, attribute, buffer_size, value - ): # noqa: N802 + self.niDigital_GetAttributeViReal64_cfunc = self._get_library_function('niDigital_GetAttributeViReal64') + self.niDigital_GetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niDigital_GetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_GetAttributeViReal64_cfunc(vi, channel_name, attribute, value) + + def niDigital_GetAttributeViString(self, vi, channel_name, attribute, buffer_size, value): # noqa: N802 with self._func_lock: if self.niDigital_GetAttributeViString_cfunc is None: - self.niDigital_GetAttributeViString_cfunc = self._get_library_function( - "niDigital_GetAttributeViString" - ) - self.niDigital_GetAttributeViString_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niDigital_GetAttributeViString_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_GetAttributeViString_cfunc( - vi, channel_name, attribute, buffer_size, value - ) - - def niDigital_GetChannelNameFromString( - self, vi, indices, name_buffer_size, names - ): # noqa: N802 + self.niDigital_GetAttributeViString_cfunc = self._get_library_function('niDigital_GetAttributeViString') + self.niDigital_GetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_GetAttributeViString_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_GetAttributeViString_cfunc(vi, channel_name, attribute, buffer_size, value) + + def niDigital_GetChannelNameFromString(self, vi, indices, name_buffer_size, names): # noqa: N802 with self._func_lock: if self.niDigital_GetChannelNameFromString_cfunc is None: - self.niDigital_GetChannelNameFromString_cfunc = ( - self._get_library_function("niDigital_GetChannelNameFromString") - ) - self.niDigital_GetChannelNameFromString_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niDigital_GetChannelNameFromString_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_GetChannelNameFromString_cfunc( - vi, indices, name_buffer_size, names - ) - - def niDigital_GetError( - self, vi, error_code, error_description_buffer_size, error_description - ): # noqa: N802 + self.niDigital_GetChannelNameFromString_cfunc = self._get_library_function('niDigital_GetChannelNameFromString') + self.niDigital_GetChannelNameFromString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_GetChannelNameFromString_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_GetChannelNameFromString_cfunc(vi, indices, name_buffer_size, names) + + def niDigital_GetError(self, vi, error_code, error_description_buffer_size, error_description): # noqa: N802 with self._func_lock: if self.niDigital_GetError_cfunc is None: - self.niDigital_GetError_cfunc = self._get_library_function( - "niDigital_GetError" - ) - self.niDigital_GetError_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViStatus), - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDigital_GetError_cfunc = self._get_library_function('niDigital_GetError') + self.niDigital_GetError_cfunc.argtypes = [ViSession, ctypes.POINTER(ViStatus), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niDigital_GetError_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_GetError_cfunc( - vi, error_code, error_description_buffer_size, error_description - ) + return self.niDigital_GetError_cfunc(vi, error_code, error_description_buffer_size, error_description) - def niDigital_GetFailCount( - self, vi, channel_list, buffer_size, failure_count, actual_num_read - ): # noqa: N802 + def niDigital_GetFailCount(self, vi, channel_list, buffer_size, failure_count, actual_num_read): # noqa: N802 with self._func_lock: if self.niDigital_GetFailCount_cfunc is None: - self.niDigital_GetFailCount_cfunc = self._get_library_function( - "niDigital_GetFailCount" - ) - self.niDigital_GetFailCount_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViInt64), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niDigital_GetFailCount_cfunc = self._get_library_function('niDigital_GetFailCount') + self.niDigital_GetFailCount_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViInt64), ctypes.POINTER(ViInt32)] # noqa: F405 self.niDigital_GetFailCount_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_GetFailCount_cfunc( - vi, channel_list, buffer_size, failure_count, actual_num_read - ) + return self.niDigital_GetFailCount_cfunc(vi, channel_list, buffer_size, failure_count, actual_num_read) def niDigital_GetHistoryRAMSampleCount(self, vi, site, sample_count): # noqa: N802 with self._func_lock: if self.niDigital_GetHistoryRAMSampleCount_cfunc is None: - self.niDigital_GetHistoryRAMSampleCount_cfunc = ( - self._get_library_function("niDigital_GetHistoryRAMSampleCount") - ) - self.niDigital_GetHistoryRAMSampleCount_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViInt64), - ] # noqa: F405 - self.niDigital_GetHistoryRAMSampleCount_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niDigital_GetHistoryRAMSampleCount_cfunc = self._get_library_function('niDigital_GetHistoryRAMSampleCount') + self.niDigital_GetHistoryRAMSampleCount_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViInt64)] # noqa: F405 + self.niDigital_GetHistoryRAMSampleCount_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_GetHistoryRAMSampleCount_cfunc(vi, site, sample_count) - def niDigital_GetPatternName( - self, vi, pattern_index, name_buffer_size, name - ): # noqa: N802 + def niDigital_GetPatternName(self, vi, pattern_index, name_buffer_size, name): # noqa: N802 with self._func_lock: if self.niDigital_GetPatternName_cfunc is None: - self.niDigital_GetPatternName_cfunc = self._get_library_function( - "niDigital_GetPatternName" - ) - self.niDigital_GetPatternName_cfunc.argtypes = [ - ViSession, - ViInt32, - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDigital_GetPatternName_cfunc = self._get_library_function('niDigital_GetPatternName') + self.niDigital_GetPatternName_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niDigital_GetPatternName_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_GetPatternName_cfunc( - vi, pattern_index, name_buffer_size, name - ) + return self.niDigital_GetPatternName_cfunc(vi, pattern_index, name_buffer_size, name) - def niDigital_GetPatternPinList( - self, vi, start_label, pin_list_buffer_size, pin_list - ): # noqa: N802 + def niDigital_GetPatternPinList(self, vi, start_label, pin_list_buffer_size, pin_list): # noqa: N802 with self._func_lock: if self.niDigital_GetPatternPinList_cfunc is None: - self.niDigital_GetPatternPinList_cfunc = self._get_library_function( - "niDigital_GetPatternPinList" - ) - self.niDigital_GetPatternPinList_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDigital_GetPatternPinList_cfunc = self._get_library_function('niDigital_GetPatternPinList') + self.niDigital_GetPatternPinList_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niDigital_GetPatternPinList_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_GetPatternPinList_cfunc( - vi, start_label, pin_list_buffer_size, pin_list - ) + return self.niDigital_GetPatternPinList_cfunc(vi, start_label, pin_list_buffer_size, pin_list) def niDigital_GetPinName(self, vi, pin_index, name_buffer_size, name): # noqa: N802 with self._func_lock: if self.niDigital_GetPinName_cfunc is None: - self.niDigital_GetPinName_cfunc = self._get_library_function( - "niDigital_GetPinName" - ) - self.niDigital_GetPinName_cfunc.argtypes = [ - ViSession, - ViInt32, - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDigital_GetPinName_cfunc = self._get_library_function('niDigital_GetPinName') + self.niDigital_GetPinName_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niDigital_GetPinName_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_GetPinName_cfunc(vi, pin_index, name_buffer_size, name) - def niDigital_GetPinResultsPinInformation( - self, - vi, - channel_list, - buffer_size, - pin_indexes, - site_numbers, - channel_indexes, - actual_num_values, - ): # noqa: N802 + def niDigital_GetPinResultsPinInformation(self, vi, channel_list, buffer_size, pin_indexes, site_numbers, channel_indexes, actual_num_values): # noqa: N802 with self._func_lock: if self.niDigital_GetPinResultsPinInformation_cfunc is None: - self.niDigital_GetPinResultsPinInformation_cfunc = ( - self._get_library_function("niDigital_GetPinResultsPinInformation") - ) - self.niDigital_GetPinResultsPinInformation_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niDigital_GetPinResultsPinInformation_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_GetPinResultsPinInformation_cfunc( - vi, - channel_list, - buffer_size, - pin_indexes, - site_numbers, - channel_indexes, - actual_num_values, - ) - - def niDigital_GetSitePassFail( - self, vi, site_list, pass_fail_buffer_size, pass_fail, actual_num_sites - ): # noqa: N802 + self.niDigital_GetPinResultsPinInformation_cfunc = self._get_library_function('niDigital_GetPinResultsPinInformation') + self.niDigital_GetPinResultsPinInformation_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDigital_GetPinResultsPinInformation_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_GetPinResultsPinInformation_cfunc(vi, channel_list, buffer_size, pin_indexes, site_numbers, channel_indexes, actual_num_values) + + def niDigital_GetSitePassFail(self, vi, site_list, pass_fail_buffer_size, pass_fail, actual_num_sites): # noqa: N802 with self._func_lock: if self.niDigital_GetSitePassFail_cfunc is None: - self.niDigital_GetSitePassFail_cfunc = self._get_library_function( - "niDigital_GetSitePassFail" - ) - self.niDigital_GetSitePassFail_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViBoolean), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niDigital_GetSitePassFail_cfunc = self._get_library_function('niDigital_GetSitePassFail') + self.niDigital_GetSitePassFail_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViBoolean), ctypes.POINTER(ViInt32)] # noqa: F405 self.niDigital_GetSitePassFail_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_GetSitePassFail_cfunc( - vi, site_list, pass_fail_buffer_size, pass_fail, actual_num_sites - ) - - def niDigital_GetSiteResultsSiteNumbers( - self, - vi, - site_list, - site_result_type, - site_numbers_buffer_size, - site_numbers, - actual_num_site_numbers, - ): # noqa: N802 + return self.niDigital_GetSitePassFail_cfunc(vi, site_list, pass_fail_buffer_size, pass_fail, actual_num_sites) + + def niDigital_GetSiteResultsSiteNumbers(self, vi, site_list, site_result_type, site_numbers_buffer_size, site_numbers, actual_num_site_numbers): # noqa: N802 with self._func_lock: if self.niDigital_GetSiteResultsSiteNumbers_cfunc is None: - self.niDigital_GetSiteResultsSiteNumbers_cfunc = ( - self._get_library_function("niDigital_GetSiteResultsSiteNumbers") - ) - self.niDigital_GetSiteResultsSiteNumbers_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ViInt32, - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niDigital_GetSiteResultsSiteNumbers_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_GetSiteResultsSiteNumbers_cfunc( - vi, - site_list, - site_result_type, - site_numbers_buffer_size, - site_numbers, - actual_num_site_numbers, - ) - - def niDigital_GetTimeSetDriveFormat( - self, vi, pin, time_set_name, format - ): # noqa: N802 + self.niDigital_GetSiteResultsSiteNumbers_cfunc = self._get_library_function('niDigital_GetSiteResultsSiteNumbers') + self.niDigital_GetSiteResultsSiteNumbers_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViInt32, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDigital_GetSiteResultsSiteNumbers_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_GetSiteResultsSiteNumbers_cfunc(vi, site_list, site_result_type, site_numbers_buffer_size, site_numbers, actual_num_site_numbers) + + def niDigital_GetTimeSetDriveFormat(self, vi, pin, time_set_name, format): # noqa: N802 with self._func_lock: if self.niDigital_GetTimeSetDriveFormat_cfunc is None: - self.niDigital_GetTimeSetDriveFormat_cfunc = self._get_library_function( - "niDigital_GetTimeSetDriveFormat" - ) - self.niDigital_GetTimeSetDriveFormat_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niDigital_GetTimeSetDriveFormat_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_GetTimeSetDriveFormat_cfunc( - vi, pin, time_set_name, format - ) - - def niDigital_GetTimeSetEdge( - self, vi, pin, time_set_name, edge, time - ): # noqa: N802 + self.niDigital_GetTimeSetDriveFormat_cfunc = self._get_library_function('niDigital_GetTimeSetDriveFormat') + self.niDigital_GetTimeSetDriveFormat_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDigital_GetTimeSetDriveFormat_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_GetTimeSetDriveFormat_cfunc(vi, pin, time_set_name, format) + + def niDigital_GetTimeSetEdge(self, vi, pin, time_set_name, edge, time): # noqa: N802 with self._func_lock: if self.niDigital_GetTimeSetEdge_cfunc is None: - self.niDigital_GetTimeSetEdge_cfunc = self._get_library_function( - "niDigital_GetTimeSetEdge" - ) - self.niDigital_GetTimeSetEdge_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niDigital_GetTimeSetEdge_cfunc = self._get_library_function('niDigital_GetTimeSetEdge') + self.niDigital_GetTimeSetEdge_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 self.niDigital_GetTimeSetEdge_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_GetTimeSetEdge_cfunc(vi, pin, time_set_name, edge, time) - def niDigital_GetTimeSetEdgeMultiplier( - self, vi, pin, time_set_name, edge_multiplier - ): # noqa: N802 + def niDigital_GetTimeSetEdgeMultiplier(self, vi, pin, time_set_name, edge_multiplier): # noqa: N802 with self._func_lock: if self.niDigital_GetTimeSetEdgeMultiplier_cfunc is None: - self.niDigital_GetTimeSetEdgeMultiplier_cfunc = ( - self._get_library_function("niDigital_GetTimeSetEdgeMultiplier") - ) - self.niDigital_GetTimeSetEdgeMultiplier_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niDigital_GetTimeSetEdgeMultiplier_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_GetTimeSetEdgeMultiplier_cfunc( - vi, pin, time_set_name, edge_multiplier - ) - - def niDigital_GetTimeSetName( - self, vi, time_set_index, name_buffer_size, name - ): # noqa: N802 + self.niDigital_GetTimeSetEdgeMultiplier_cfunc = self._get_library_function('niDigital_GetTimeSetEdgeMultiplier') + self.niDigital_GetTimeSetEdgeMultiplier_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDigital_GetTimeSetEdgeMultiplier_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_GetTimeSetEdgeMultiplier_cfunc(vi, pin, time_set_name, edge_multiplier) + + def niDigital_GetTimeSetName(self, vi, time_set_index, name_buffer_size, name): # noqa: N802 with self._func_lock: if self.niDigital_GetTimeSetName_cfunc is None: - self.niDigital_GetTimeSetName_cfunc = self._get_library_function( - "niDigital_GetTimeSetName" - ) - self.niDigital_GetTimeSetName_cfunc.argtypes = [ - ViSession, - ViInt32, - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDigital_GetTimeSetName_cfunc = self._get_library_function('niDigital_GetTimeSetName') + self.niDigital_GetTimeSetName_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niDigital_GetTimeSetName_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_GetTimeSetName_cfunc( - vi, time_set_index, name_buffer_size, name - ) + return self.niDigital_GetTimeSetName_cfunc(vi, time_set_index, name_buffer_size, name) def niDigital_GetTimeSetPeriod(self, vi, time_set_name, period): # noqa: N802 with self._func_lock: if self.niDigital_GetTimeSetPeriod_cfunc is None: - self.niDigital_GetTimeSetPeriod_cfunc = self._get_library_function( - "niDigital_GetTimeSetPeriod" - ) - self.niDigital_GetTimeSetPeriod_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niDigital_GetTimeSetPeriod_cfunc = self._get_library_function('niDigital_GetTimeSetPeriod') + self.niDigital_GetTimeSetPeriod_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViReal64)] # noqa: F405 self.niDigital_GetTimeSetPeriod_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_GetTimeSetPeriod_cfunc(vi, time_set_name, period) - def niDigital_InitWithOptions( - self, resource_name, id_query, reset_device, option_string, new_vi - ): # noqa: N802 + def niDigital_InitWithOptions(self, resource_name, id_query, reset_device, option_string, new_vi): # noqa: N802 with self._func_lock: if self.niDigital_InitWithOptions_cfunc is None: - self.niDigital_InitWithOptions_cfunc = self._get_library_function( - "niDigital_InitWithOptions" - ) - self.niDigital_InitWithOptions_cfunc.argtypes = [ - ctypes.POINTER(ViChar), - ViBoolean, - ViBoolean, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViSession), - ] # noqa: F405 + self.niDigital_InitWithOptions_cfunc = self._get_library_function('niDigital_InitWithOptions') + self.niDigital_InitWithOptions_cfunc.argtypes = [ctypes.POINTER(ViChar), ViBoolean, ViBoolean, ctypes.POINTER(ViChar), ctypes.POINTER(ViSession)] # noqa: F405 self.niDigital_InitWithOptions_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_InitWithOptions_cfunc( - resource_name, id_query, reset_device, option_string, new_vi - ) + return self.niDigital_InitWithOptions_cfunc(resource_name, id_query, reset_device, option_string, new_vi) def niDigital_Initiate(self, vi): # noqa: N802 with self._func_lock: if self.niDigital_Initiate_cfunc is None: - self.niDigital_Initiate_cfunc = self._get_library_function( - "niDigital_Initiate" - ) + self.niDigital_Initiate_cfunc = self._get_library_function('niDigital_Initiate') self.niDigital_Initiate_cfunc.argtypes = [ViSession] # noqa: F405 self.niDigital_Initiate_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_Initiate_cfunc(vi) @@ -1374,209 +572,111 @@ def niDigital_Initiate(self, vi): # noqa: N802 def niDigital_IsDone(self, vi, done): # noqa: N802 with self._func_lock: if self.niDigital_IsDone_cfunc is None: - self.niDigital_IsDone_cfunc = self._get_library_function( - "niDigital_IsDone" - ) - self.niDigital_IsDone_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niDigital_IsDone_cfunc = self._get_library_function('niDigital_IsDone') + self.niDigital_IsDone_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niDigital_IsDone_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_IsDone_cfunc(vi, done) def niDigital_IsSiteEnabled(self, vi, site, enable): # noqa: N802 with self._func_lock: if self.niDigital_IsSiteEnabled_cfunc is None: - self.niDigital_IsSiteEnabled_cfunc = self._get_library_function( - "niDigital_IsSiteEnabled" - ) - self.niDigital_IsSiteEnabled_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niDigital_IsSiteEnabled_cfunc = self._get_library_function('niDigital_IsSiteEnabled') + self.niDigital_IsSiteEnabled_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViBoolean)] # noqa: F405 self.niDigital_IsSiteEnabled_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_IsSiteEnabled_cfunc(vi, site, enable) def niDigital_LoadLevels(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niDigital_LoadLevels_cfunc is None: - self.niDigital_LoadLevels_cfunc = self._get_library_function( - "niDigital_LoadLevels" - ) - self.niDigital_LoadLevels_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDigital_LoadLevels_cfunc = self._get_library_function('niDigital_LoadLevels') + self.niDigital_LoadLevels_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 self.niDigital_LoadLevels_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_LoadLevels_cfunc(vi, file_path) def niDigital_LoadPattern(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niDigital_LoadPattern_cfunc is None: - self.niDigital_LoadPattern_cfunc = self._get_library_function( - "niDigital_LoadPattern" - ) - self.niDigital_LoadPattern_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDigital_LoadPattern_cfunc = self._get_library_function('niDigital_LoadPattern') + self.niDigital_LoadPattern_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 self.niDigital_LoadPattern_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_LoadPattern_cfunc(vi, file_path) def niDigital_LoadPinMap(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niDigital_LoadPinMap_cfunc is None: - self.niDigital_LoadPinMap_cfunc = self._get_library_function( - "niDigital_LoadPinMap" - ) - self.niDigital_LoadPinMap_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDigital_LoadPinMap_cfunc = self._get_library_function('niDigital_LoadPinMap') + self.niDigital_LoadPinMap_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 self.niDigital_LoadPinMap_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_LoadPinMap_cfunc(vi, file_path) def niDigital_LoadSpecifications(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niDigital_LoadSpecifications_cfunc is None: - self.niDigital_LoadSpecifications_cfunc = self._get_library_function( - "niDigital_LoadSpecifications" - ) - self.niDigital_LoadSpecifications_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDigital_LoadSpecifications_cfunc = self._get_library_function('niDigital_LoadSpecifications') + self.niDigital_LoadSpecifications_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 self.niDigital_LoadSpecifications_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_LoadSpecifications_cfunc(vi, file_path) def niDigital_LoadTiming(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niDigital_LoadTiming_cfunc is None: - self.niDigital_LoadTiming_cfunc = self._get_library_function( - "niDigital_LoadTiming" - ) - self.niDigital_LoadTiming_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDigital_LoadTiming_cfunc = self._get_library_function('niDigital_LoadTiming') + self.niDigital_LoadTiming_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 self.niDigital_LoadTiming_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_LoadTiming_cfunc(vi, file_path) def niDigital_LockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niDigital_LockSession_cfunc is None: - self.niDigital_LockSession_cfunc = self._get_library_function( - "niDigital_LockSession" - ) - self.niDigital_LockSession_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niDigital_LockSession_cfunc = self._get_library_function('niDigital_LockSession') + self.niDigital_LockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niDigital_LockSession_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_LockSession_cfunc(vi, caller_has_lock) - def niDigital_PPMU_Measure( - self, - vi, - channel_list, - measurement_type, - buffer_size, - measurements, - actual_num_read, - ): # noqa: N802 + def niDigital_PPMU_Measure(self, vi, channel_list, measurement_type, buffer_size, measurements, actual_num_read): # noqa: N802 with self._func_lock: if self.niDigital_PPMU_Measure_cfunc is None: - self.niDigital_PPMU_Measure_cfunc = self._get_library_function( - "niDigital_PPMU_Measure" - ) - self.niDigital_PPMU_Measure_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ViInt32, - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niDigital_PPMU_Measure_cfunc = self._get_library_function('niDigital_PPMU_Measure') + self.niDigital_PPMU_Measure_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt32)] # noqa: F405 self.niDigital_PPMU_Measure_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_PPMU_Measure_cfunc( - vi, - channel_list, - measurement_type, - buffer_size, - measurements, - actual_num_read, - ) + return self.niDigital_PPMU_Measure_cfunc(vi, channel_list, measurement_type, buffer_size, measurements, actual_num_read) def niDigital_PPMU_Source(self, vi, channel_list): # noqa: N802 with self._func_lock: if self.niDigital_PPMU_Source_cfunc is None: - self.niDigital_PPMU_Source_cfunc = self._get_library_function( - "niDigital_PPMU_Source" - ) - self.niDigital_PPMU_Source_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDigital_PPMU_Source_cfunc = self._get_library_function('niDigital_PPMU_Source') + self.niDigital_PPMU_Source_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 self.niDigital_PPMU_Source_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_PPMU_Source_cfunc(vi, channel_list) def niDigital_ReadSequencerFlag(self, vi, flag, value): # noqa: N802 with self._func_lock: if self.niDigital_ReadSequencerFlag_cfunc is None: - self.niDigital_ReadSequencerFlag_cfunc = self._get_library_function( - "niDigital_ReadSequencerFlag" - ) - self.niDigital_ReadSequencerFlag_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niDigital_ReadSequencerFlag_cfunc = self._get_library_function('niDigital_ReadSequencerFlag') + self.niDigital_ReadSequencerFlag_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViBoolean)] # noqa: F405 self.niDigital_ReadSequencerFlag_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_ReadSequencerFlag_cfunc(vi, flag, value) def niDigital_ReadSequencerRegister(self, vi, reg, value): # noqa: N802 with self._func_lock: if self.niDigital_ReadSequencerRegister_cfunc is None: - self.niDigital_ReadSequencerRegister_cfunc = self._get_library_function( - "niDigital_ReadSequencerRegister" - ) - self.niDigital_ReadSequencerRegister_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niDigital_ReadSequencerRegister_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niDigital_ReadSequencerRegister_cfunc = self._get_library_function('niDigital_ReadSequencerRegister') + self.niDigital_ReadSequencerRegister_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDigital_ReadSequencerRegister_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_ReadSequencerRegister_cfunc(vi, reg, value) - def niDigital_ReadStatic( - self, vi, channel_list, buffer_size, data, actual_num_read - ): # noqa: N802 + def niDigital_ReadStatic(self, vi, channel_list, buffer_size, data, actual_num_read): # noqa: N802 with self._func_lock: if self.niDigital_ReadStatic_cfunc is None: - self.niDigital_ReadStatic_cfunc = self._get_library_function( - "niDigital_ReadStatic" - ) - self.niDigital_ReadStatic_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViUInt8), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niDigital_ReadStatic_cfunc = self._get_library_function('niDigital_ReadStatic') + self.niDigital_ReadStatic_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViUInt8), ctypes.POINTER(ViInt32)] # noqa: F405 self.niDigital_ReadStatic_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_ReadStatic_cfunc( - vi, channel_list, buffer_size, data, actual_num_read - ) + return self.niDigital_ReadStatic_cfunc(vi, channel_list, buffer_size, data, actual_num_read) def niDigital_ResetDevice(self, vi): # noqa: N802 with self._func_lock: if self.niDigital_ResetDevice_cfunc is None: - self.niDigital_ResetDevice_cfunc = self._get_library_function( - "niDigital_ResetDevice" - ) + self.niDigital_ResetDevice_cfunc = self._get_library_function('niDigital_ResetDevice') self.niDigital_ResetDevice_cfunc.argtypes = [ViSession] # noqa: F405 self.niDigital_ResetDevice_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_ResetDevice_cfunc(vi) @@ -1584,353 +684,151 @@ def niDigital_ResetDevice(self, vi): # noqa: N802 def niDigital_SelfCalibrate(self, vi): # noqa: N802 with self._func_lock: if self.niDigital_SelfCalibrate_cfunc is None: - self.niDigital_SelfCalibrate_cfunc = self._get_library_function( - "niDigital_SelfCalibrate" - ) + self.niDigital_SelfCalibrate_cfunc = self._get_library_function('niDigital_SelfCalibrate') self.niDigital_SelfCalibrate_cfunc.argtypes = [ViSession] # noqa: F405 self.niDigital_SelfCalibrate_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_SelfCalibrate_cfunc(vi) - def niDigital_SendSoftwareEdgeTrigger( - self, vi, trigger, trigger_identifier - ): # noqa: N802 + def niDigital_SendSoftwareEdgeTrigger(self, vi, trigger, trigger_identifier): # noqa: N802 with self._func_lock: if self.niDigital_SendSoftwareEdgeTrigger_cfunc is None: - self.niDigital_SendSoftwareEdgeTrigger_cfunc = ( - self._get_library_function("niDigital_SendSoftwareEdgeTrigger") - ) - self.niDigital_SendSoftwareEdgeTrigger_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niDigital_SendSoftwareEdgeTrigger_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_SendSoftwareEdgeTrigger_cfunc( - vi, trigger, trigger_identifier - ) - - def niDigital_SetAttributeViBoolean( - self, vi, channel_name, attribute, value - ): # noqa: N802 + self.niDigital_SendSoftwareEdgeTrigger_cfunc = self._get_library_function('niDigital_SendSoftwareEdgeTrigger') + self.niDigital_SendSoftwareEdgeTrigger_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_SendSoftwareEdgeTrigger_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_SendSoftwareEdgeTrigger_cfunc(vi, trigger, trigger_identifier) + + def niDigital_SetAttributeViBoolean(self, vi, channel_name, attribute, value): # noqa: N802 with self._func_lock: if self.niDigital_SetAttributeViBoolean_cfunc is None: - self.niDigital_SetAttributeViBoolean_cfunc = self._get_library_function( - "niDigital_SetAttributeViBoolean" - ) - self.niDigital_SetAttributeViBoolean_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViBoolean, - ] # noqa: F405 - self.niDigital_SetAttributeViBoolean_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_SetAttributeViBoolean_cfunc( - vi, channel_name, attribute, value - ) - - def niDigital_SetAttributeViInt32( - self, vi, channel_name, attribute, value - ): # noqa: N802 + self.niDigital_SetAttributeViBoolean_cfunc = self._get_library_function('niDigital_SetAttributeViBoolean') + self.niDigital_SetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViBoolean] # noqa: F405 + self.niDigital_SetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_SetAttributeViBoolean_cfunc(vi, channel_name, attribute, value) + + def niDigital_SetAttributeViInt32(self, vi, channel_name, attribute, value): # noqa: N802 with self._func_lock: if self.niDigital_SetAttributeViInt32_cfunc is None: - self.niDigital_SetAttributeViInt32_cfunc = self._get_library_function( - "niDigital_SetAttributeViInt32" - ) - self.niDigital_SetAttributeViInt32_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViInt32, - ] # noqa: F405 - self.niDigital_SetAttributeViInt32_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_SetAttributeViInt32_cfunc( - vi, channel_name, attribute, value - ) - - def niDigital_SetAttributeViInt64( - self, vi, channel_name, attribute, value - ): # noqa: N802 + self.niDigital_SetAttributeViInt32_cfunc = self._get_library_function('niDigital_SetAttributeViInt32') + self.niDigital_SetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32] # noqa: F405 + self.niDigital_SetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_SetAttributeViInt32_cfunc(vi, channel_name, attribute, value) + + def niDigital_SetAttributeViInt64(self, vi, channel_name, attribute, value): # noqa: N802 with self._func_lock: if self.niDigital_SetAttributeViInt64_cfunc is None: - self.niDigital_SetAttributeViInt64_cfunc = self._get_library_function( - "niDigital_SetAttributeViInt64" - ) - self.niDigital_SetAttributeViInt64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViInt64, - ] # noqa: F405 - self.niDigital_SetAttributeViInt64_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_SetAttributeViInt64_cfunc( - vi, channel_name, attribute, value - ) - - def niDigital_SetAttributeViReal64( - self, vi, channel_name, attribute, value - ): # noqa: N802 + self.niDigital_SetAttributeViInt64_cfunc = self._get_library_function('niDigital_SetAttributeViInt64') + self.niDigital_SetAttributeViInt64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt64] # noqa: F405 + self.niDigital_SetAttributeViInt64_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_SetAttributeViInt64_cfunc(vi, channel_name, attribute, value) + + def niDigital_SetAttributeViReal64(self, vi, channel_name, attribute, value): # noqa: N802 with self._func_lock: if self.niDigital_SetAttributeViReal64_cfunc is None: - self.niDigital_SetAttributeViReal64_cfunc = self._get_library_function( - "niDigital_SetAttributeViReal64" - ) - self.niDigital_SetAttributeViReal64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViReal64, - ] # noqa: F405 - self.niDigital_SetAttributeViReal64_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_SetAttributeViReal64_cfunc( - vi, channel_name, attribute, value - ) - - def niDigital_SetAttributeViString( - self, vi, channel_name, attribute, value - ): # noqa: N802 + self.niDigital_SetAttributeViReal64_cfunc = self._get_library_function('niDigital_SetAttributeViReal64') + self.niDigital_SetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViReal64] # noqa: F405 + self.niDigital_SetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_SetAttributeViReal64_cfunc(vi, channel_name, attribute, value) + + def niDigital_SetAttributeViString(self, vi, channel_name, attribute, value): # noqa: N802 with self._func_lock: if self.niDigital_SetAttributeViString_cfunc is None: - self.niDigital_SetAttributeViString_cfunc = self._get_library_function( - "niDigital_SetAttributeViString" - ) - self.niDigital_SetAttributeViString_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niDigital_SetAttributeViString_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_SetAttributeViString_cfunc( - vi, channel_name, attribute, value - ) - - def niDigital_TDR( - self, - vi, - channel_list, - apply_offsets, - offsets_buffer_size, - offsets, - actual_num_offsets, - ): # noqa: N802 + self.niDigital_SetAttributeViString_cfunc = self._get_library_function('niDigital_SetAttributeViString') + self.niDigital_SetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_SetAttributeViString_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_SetAttributeViString_cfunc(vi, channel_name, attribute, value) + + def niDigital_TDR(self, vi, channel_list, apply_offsets, offsets_buffer_size, offsets, actual_num_offsets): # noqa: N802 with self._func_lock: if self.niDigital_TDR_cfunc is None: - self.niDigital_TDR_cfunc = self._get_library_function("niDigital_TDR") - self.niDigital_TDR_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViBoolean, - ViInt32, - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niDigital_TDR_cfunc = self._get_library_function('niDigital_TDR') + self.niDigital_TDR_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViBoolean, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt32)] # noqa: F405 self.niDigital_TDR_cfunc.restype = ViStatus # noqa: F405 - return self.niDigital_TDR_cfunc( - vi, - channel_list, - apply_offsets, - offsets_buffer_size, - offsets, - actual_num_offsets, - ) + return self.niDigital_TDR_cfunc(vi, channel_list, apply_offsets, offsets_buffer_size, offsets, actual_num_offsets) def niDigital_UnloadAllPatterns(self, vi, unload_keep_alive_pattern): # noqa: N802 with self._func_lock: if self.niDigital_UnloadAllPatterns_cfunc is None: - self.niDigital_UnloadAllPatterns_cfunc = self._get_library_function( - "niDigital_UnloadAllPatterns" - ) - self.niDigital_UnloadAllPatterns_cfunc.argtypes = [ - ViSession, - ViBoolean, - ] # noqa: F405 + self.niDigital_UnloadAllPatterns_cfunc = self._get_library_function('niDigital_UnloadAllPatterns') + self.niDigital_UnloadAllPatterns_cfunc.argtypes = [ViSession, ViBoolean] # noqa: F405 self.niDigital_UnloadAllPatterns_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_UnloadAllPatterns_cfunc(vi, unload_keep_alive_pattern) def niDigital_UnloadSpecifications(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niDigital_UnloadSpecifications_cfunc is None: - self.niDigital_UnloadSpecifications_cfunc = self._get_library_function( - "niDigital_UnloadSpecifications" - ) - self.niDigital_UnloadSpecifications_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niDigital_UnloadSpecifications_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niDigital_UnloadSpecifications_cfunc = self._get_library_function('niDigital_UnloadSpecifications') + self.niDigital_UnloadSpecifications_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_UnloadSpecifications_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_UnloadSpecifications_cfunc(vi, file_path) def niDigital_UnlockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niDigital_UnlockSession_cfunc is None: - self.niDigital_UnlockSession_cfunc = self._get_library_function( - "niDigital_UnlockSession" - ) - self.niDigital_UnlockSession_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niDigital_UnlockSession_cfunc = self._get_library_function('niDigital_UnlockSession') + self.niDigital_UnlockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niDigital_UnlockSession_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_UnlockSession_cfunc(vi, caller_has_lock) def niDigital_WaitUntilDone(self, vi, timeout): # noqa: N802 with self._func_lock: if self.niDigital_WaitUntilDone_cfunc is None: - self.niDigital_WaitUntilDone_cfunc = self._get_library_function( - "niDigital_WaitUntilDone" - ) - self.niDigital_WaitUntilDone_cfunc.argtypes = [ - ViSession, - ViReal64, - ] # noqa: F405 + self.niDigital_WaitUntilDone_cfunc = self._get_library_function('niDigital_WaitUntilDone') + self.niDigital_WaitUntilDone_cfunc.argtypes = [ViSession, ViReal64] # noqa: F405 self.niDigital_WaitUntilDone_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_WaitUntilDone_cfunc(vi, timeout) def niDigital_WriteSequencerFlag(self, vi, flag, value): # noqa: N802 with self._func_lock: if self.niDigital_WriteSequencerFlag_cfunc is None: - self.niDigital_WriteSequencerFlag_cfunc = self._get_library_function( - "niDigital_WriteSequencerFlag" - ) - self.niDigital_WriteSequencerFlag_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViBoolean, - ] # noqa: F405 + self.niDigital_WriteSequencerFlag_cfunc = self._get_library_function('niDigital_WriteSequencerFlag') + self.niDigital_WriteSequencerFlag_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViBoolean] # noqa: F405 self.niDigital_WriteSequencerFlag_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_WriteSequencerFlag_cfunc(vi, flag, value) def niDigital_WriteSequencerRegister(self, vi, reg, value): # noqa: N802 with self._func_lock: if self.niDigital_WriteSequencerRegister_cfunc is None: - self.niDigital_WriteSequencerRegister_cfunc = ( - self._get_library_function("niDigital_WriteSequencerRegister") - ) - self.niDigital_WriteSequencerRegister_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ] # noqa: F405 - self.niDigital_WriteSequencerRegister_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niDigital_WriteSequencerRegister_cfunc = self._get_library_function('niDigital_WriteSequencerRegister') + self.niDigital_WriteSequencerRegister_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32] # noqa: F405 + self.niDigital_WriteSequencerRegister_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_WriteSequencerRegister_cfunc(vi, reg, value) - def niDigital_WriteSourceWaveformBroadcastU32( - self, vi, waveform_name, waveform_size, waveform_data - ): # noqa: N802 + def niDigital_WriteSourceWaveformBroadcastU32(self, vi, waveform_name, waveform_size, waveform_data): # noqa: N802 with self._func_lock: if self.niDigital_WriteSourceWaveformBroadcastU32_cfunc is None: - self.niDigital_WriteSourceWaveformBroadcastU32_cfunc = ( - self._get_library_function( - "niDigital_WriteSourceWaveformBroadcastU32" - ) - ) - self.niDigital_WriteSourceWaveformBroadcastU32_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViUInt32), - ] # noqa: F405 - self.niDigital_WriteSourceWaveformBroadcastU32_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_WriteSourceWaveformBroadcastU32_cfunc( - vi, waveform_name, waveform_size, waveform_data - ) - - def niDigital_WriteSourceWaveformDataFromFileTDMS( - self, vi, waveform_name, waveform_file_path - ): # noqa: N802 + self.niDigital_WriteSourceWaveformBroadcastU32_cfunc = self._get_library_function('niDigital_WriteSourceWaveformBroadcastU32') + self.niDigital_WriteSourceWaveformBroadcastU32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViUInt32)] # noqa: F405 + self.niDigital_WriteSourceWaveformBroadcastU32_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_WriteSourceWaveformBroadcastU32_cfunc(vi, waveform_name, waveform_size, waveform_data) + + def niDigital_WriteSourceWaveformDataFromFileTDMS(self, vi, waveform_name, waveform_file_path): # noqa: N802 with self._func_lock: if self.niDigital_WriteSourceWaveformDataFromFileTDMS_cfunc is None: - self.niDigital_WriteSourceWaveformDataFromFileTDMS_cfunc = ( - self._get_library_function( - "niDigital_WriteSourceWaveformDataFromFileTDMS" - ) - ) - self.niDigital_WriteSourceWaveformDataFromFileTDMS_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niDigital_WriteSourceWaveformDataFromFileTDMS_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_WriteSourceWaveformDataFromFileTDMS_cfunc( - vi, waveform_name, waveform_file_path - ) - - def niDigital_WriteSourceWaveformSiteUniqueU32( - self, - vi, - site_list, - waveform_name, - num_waveforms, - samples_per_waveform, - waveform_data, - ): # noqa: N802 + self.niDigital_WriteSourceWaveformDataFromFileTDMS_cfunc = self._get_library_function('niDigital_WriteSourceWaveformDataFromFileTDMS') + self.niDigital_WriteSourceWaveformDataFromFileTDMS_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar)] # noqa: F405 + self.niDigital_WriteSourceWaveformDataFromFileTDMS_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_WriteSourceWaveformDataFromFileTDMS_cfunc(vi, waveform_name, waveform_file_path) + + def niDigital_WriteSourceWaveformSiteUniqueU32(self, vi, site_list, waveform_name, num_waveforms, samples_per_waveform, waveform_data): # noqa: N802 with self._func_lock: if self.niDigital_WriteSourceWaveformSiteUniqueU32_cfunc is None: - self.niDigital_WriteSourceWaveformSiteUniqueU32_cfunc = ( - self._get_library_function( - "niDigital_WriteSourceWaveformSiteUniqueU32" - ) - ) - self.niDigital_WriteSourceWaveformSiteUniqueU32_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViInt32, - ViInt32, - ctypes.POINTER(ViUInt32), - ] # noqa: F405 - self.niDigital_WriteSourceWaveformSiteUniqueU32_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDigital_WriteSourceWaveformSiteUniqueU32_cfunc( - vi, - site_list, - waveform_name, - num_waveforms, - samples_per_waveform, - waveform_data, - ) + self.niDigital_WriteSourceWaveformSiteUniqueU32_cfunc = self._get_library_function('niDigital_WriteSourceWaveformSiteUniqueU32') + self.niDigital_WriteSourceWaveformSiteUniqueU32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ViInt32, ctypes.POINTER(ViUInt32)] # noqa: F405 + self.niDigital_WriteSourceWaveformSiteUniqueU32_cfunc.restype = ViStatus # noqa: F405 + return self.niDigital_WriteSourceWaveformSiteUniqueU32_cfunc(vi, site_list, waveform_name, num_waveforms, samples_per_waveform, waveform_data) def niDigital_WriteStatic(self, vi, channel_list, state): # noqa: N802 with self._func_lock: if self.niDigital_WriteStatic_cfunc is None: - self.niDigital_WriteStatic_cfunc = self._get_library_function( - "niDigital_WriteStatic" - ) - self.niDigital_WriteStatic_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViUInt8, - ] # noqa: F405 + self.niDigital_WriteStatic_cfunc = self._get_library_function('niDigital_WriteStatic') + self.niDigital_WriteStatic_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViUInt8] # noqa: F405 self.niDigital_WriteStatic_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_WriteStatic_cfunc(vi, channel_list, state) def niDigital_close(self, vi): # noqa: N802 with self._func_lock: if self.niDigital_close_cfunc is None: - self.niDigital_close_cfunc = self._get_library_function( - "niDigital_close" - ) + self.niDigital_close_cfunc = self._get_library_function('niDigital_close') self.niDigital_close_cfunc.argtypes = [ViSession] # noqa: F405 self.niDigital_close_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_close_cfunc(vi) @@ -1938,23 +836,15 @@ def niDigital_close(self, vi): # noqa: N802 def niDigital_error_message(self, vi, error_code, error_message): # noqa: N802 with self._func_lock: if self.niDigital_error_message_cfunc is None: - self.niDigital_error_message_cfunc = self._get_library_function( - "niDigital_error_message" - ) - self.niDigital_error_message_cfunc.argtypes = [ - ViSession, - ViStatus, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDigital_error_message_cfunc = self._get_library_function('niDigital_error_message') + self.niDigital_error_message_cfunc.argtypes = [ViSession, ViStatus, ctypes.POINTER(ViChar)] # noqa: F405 self.niDigital_error_message_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_error_message_cfunc(vi, error_code, error_message) def niDigital_reset(self, vi): # noqa: N802 with self._func_lock: if self.niDigital_reset_cfunc is None: - self.niDigital_reset_cfunc = self._get_library_function( - "niDigital_reset" - ) + self.niDigital_reset_cfunc = self._get_library_function('niDigital_reset') self.niDigital_reset_cfunc.argtypes = [ViSession] # noqa: F405 self.niDigital_reset_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_reset_cfunc(vi) @@ -1962,13 +852,7 @@ def niDigital_reset(self, vi): # noqa: N802 def niDigital_self_test(self, vi, test_result, test_message): # noqa: N802 with self._func_lock: if self.niDigital_self_test_cfunc is None: - self.niDigital_self_test_cfunc = self._get_library_function( - "niDigital_self_test" - ) - self.niDigital_self_test_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt16), - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDigital_self_test_cfunc = self._get_library_function('niDigital_self_test') + self.niDigital_self_test_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt16), ctypes.POINTER(ViChar)] # noqa: F405 self.niDigital_self_test_cfunc.restype = ViStatus # noqa: F405 return self.niDigital_self_test_cfunc(vi, test_result, test_message) diff --git a/generated/nidigital/nidigital/_library_singleton.py b/generated/nidigital/nidigital/_library_singleton.py index c3c24e475..f0af2a56e 100644 --- a/generated/nidigital/nidigital/_library_singleton.py +++ b/generated/nidigital/nidigital/_library_singleton.py @@ -12,36 +12,30 @@ _instance = None _instance_lock = threading.Lock() -_library_info = { - "Linux": {"64bit": {"name": "nidigital", "type": "cdll"}}, - "Windows": { - "32bit": {"name": "niDigital_32.dll", "type": "windll"}, - "64bit": {"name": "niDigital_64.dll", "type": "cdll"}, - }, -} +_library_info = {'Linux': {'64bit': {'name': 'nidigital', 'type': 'cdll'}}, + 'Windows': {'32bit': {'name': 'niDigital_32.dll', 'type': 'windll'}, + '64bit': {'name': 'niDigital_64.dll', 'type': 'cdll'}}} def _get_library_name(): try: - return ctypes.util.find_library( - _library_info[platform.system()][platform.architecture()[0]]["name"] - ) # We find and return full path to the DLL + return ctypes.util.find_library(_library_info[platform.system()][platform.architecture()[0]]['name']) # We find and return full path to the DLL except KeyError: raise errors.UnsupportedConfigurationError def _get_library_type(): try: - return _library_info[platform.system()][platform.architecture()[0]]["type"] + return _library_info[platform.system()][platform.architecture()[0]]['type'] except KeyError: raise errors.UnsupportedConfigurationError def get(): - """get + '''get Returns the library.Library singleton for nidigital. - """ + ''' global _instance global _instance_lock @@ -49,12 +43,13 @@ def get(): if _instance is None: try: library_type = _get_library_type() - if library_type == "windll": + if library_type == 'windll': ctypes_library = ctypes.WinDLL(_get_library_name()) else: - assert library_type == "cdll" + assert library_type == 'cdll' ctypes_library = ctypes.CDLL(_get_library_name()) except OSError: raise errors.DriverNotInstalledError() _instance = _library.Library(ctypes_library) return _instance + diff --git a/generated/nidigital/nidigital/_visatype.py b/generated/nidigital/nidigital/_visatype.py index bf96c3cfb..02cc41d1b 100644 --- a/generated/nidigital/nidigital/_visatype.py +++ b/generated/nidigital/nidigital/_visatype.py @@ -2,9 +2,9 @@ import ctypes -"""Definitions of the VISA types used by the C API of the driver runtime. +'''Definitions of the VISA types used by the C API of the driver runtime. These are aliased directly to ctypes types so can be used directly to call into the library. -""" +''' ViChar = ctypes.c_char @@ -26,3 +26,4 @@ ViAttr = ViUInt32 ViConstString = ViString ViRsrc = ViString + diff --git a/generated/nidigital/nidigital/enums.py b/generated/nidigital/nidigital/enums.py index f716d39bb..0542e11ad 100644 --- a/generated/nidigital/nidigital/enums.py +++ b/generated/nidigital/nidigital/enums.py @@ -6,351 +6,351 @@ class BitOrder(Enum): MSB = 2500 - r""" + r''' The most significant bit is first. The first bit is in the 2^n place, where n is the number of bits. - """ + ''' LSB = 2501 - r""" + r''' The least significant bit is first. The first bit is in the 2^0 place. - """ + ''' class DigitalEdge(Enum): RISING = 1800 - r""" + r''' Asserts the trigger when the signal transitions from low level to high level. - """ + ''' FALLING = 1801 - r""" + r''' Asserts the trigger when the signal transitions from high level to low level. - """ + ''' class DriveFormat(Enum): NR = 1500 - r""" + r''' Drive format remains at logic level after each bit. - """ + ''' RL = 1501 - r""" + r''' Drive format returns to a logic level low after each bit. - """ + ''' RH = 1502 - r""" + r''' Drive format returns to a logic level high after each bit. - """ + ''' SBC = 1503 - r""" + r''' Drive format returns to the complement logic level of the bit after each bit. - """ + ''' class FrequencyMeasurementMode(Enum): BANKED = 3700 - r""" + r''' Frequency measurements are made serially for groups of channels associated with a single frequency counter for each group. Maximum frequency measured: 200 MHz. - """ + ''' PARALLEL = 3701 - r""" + r''' Frequency measurements are made by multiple frequency counters in parallel. Maximum frequency measured: 100 MHz. - """ + ''' class HistoryRAMCyclesToAcquire(Enum): FAILED = 2303 - r""" + r''' Acquires failed cycles. - """ + ''' ALL = 2304 - r""" + r''' Acquires all cycles. - """ + ''' class HistoryRAMTriggerType(Enum): FIRST_FAILURE = 2200 - r""" + r''' First Failure History RAM trigger - """ + ''' CYCLE_NUMBER = 2201 - r""" + r''' Cycle Number History RAM trigger. - """ + ''' PATTERN_LABEL = 2202 - r""" + r''' Pattern Label History RAM trigger - """ + ''' class PPMUApertureTimeUnits(Enum): SECONDS = 2100 - r""" + r''' Unit in seconds. - """ + ''' class PPMUCurrentLimitBehavior(Enum): REGULATE = 3100 - r""" + r''' Controls output current so that it does not exceed the current limit. Power continues to generate even if the current limit is reached. - """ + ''' class PPMUMeasurementType(Enum): CURRENT = 2400 - r""" + r''' The PPMU measures current. - """ + ''' VOLTAGE = 2401 - r""" + r''' The PPMU measures voltage. - """ + ''' class PPMUOutputFunction(Enum): VOLTAGE = 1300 - r""" + r''' The PPMU forces voltage to the DUT. - """ + ''' CURRENT = 1301 - r""" + r''' The PPMU forces current to the DUT. - """ + ''' class PinState(Enum): ZERO = 0 - r""" + r''' A digital state of 0. - """ + ''' ONE = 1 - r""" + r''' A digital state of 1. - """ + ''' L = 3 - r""" + r''' A digital state of L (low). - """ + ''' H = 4 - r""" + r''' A digital state of H (high). - """ + ''' X = 5 - r""" + r''' A digital state of X (non-drive state). - """ + ''' M = 6 - r""" + r''' A digital state of M (midband). - """ + ''' V = 7 - r""" + r''' A digital state of V (compare high or low, not midband; store results from capture functionality if configured). - """ + ''' D = 8 - r""" + r''' A digital state of D (drive data from source functionality if configured). - """ + ''' E = 9 - r""" + r''' A digital state of E (compare data from source functionality if configured). - """ + ''' NOT_A_PIN_STATE = 254 - r""" + r''' Not a pin state is used for non-existent DUT cycles. - """ + ''' PIN_STATE_NOT_ACQUIRED = 255 - r""" + r''' Pin state could not be acquired because none of the pins mapped to the instrument in a multi-instrument session had any failures. - """ + ''' def __str__(self): return { - "ZERO": "0", - "ONE": "1", - "NOT_A_PIN_STATE": "Not a Pin State", - "PIN_STATE_NOT_ACQUIRED": "Pin State Not Acquired", + 'ZERO': '0', + 'ONE': '1', + 'NOT_A_PIN_STATE': 'Not a Pin State', + 'PIN_STATE_NOT_ACQUIRED': 'Pin State Not Acquired', }.get(self.name, self.name) class SelectedFunction(Enum): DIGITAL = 1100 - r""" + r''' The pattern sequencer controls the specified pin(s). If a pattern is currently bursting, the pin immediately switches to bursting the pattern. This option disconnects the PPMU. - """ + ''' PPMU = 1101 - r""" + r''' The PPMU controls the specified pin(s) and connects the PPMU. The pin driver is in a non-drive state, and the active load is disabled. The PPMU does not start sourcing or measuring until Source or Measure(PpmuMeasurementType) is called. - """ + ''' OFF = 1102 - r""" + r''' Puts the digital driver in a non-drive state, disables the active load, disconnects the PPMU, and closes the I/O switch connecting the instrument channel. - """ + ''' DISCONNECT = 1103 - r""" + r''' The I/O switch connecting the instrument channel is open to the I/O connector. If the PPMU is sourcing, it is stopped prior to opening the I/O switch. - """ + ''' RIO = 1104 - r""" + r''' Yields control of the specified pin(s) to LabVIEW FPGA. - """ + ''' class SequencerFlag(Enum): - FLAG0 = "seqflag0" - FLAG1 = "seqflag1" - FLAG2 = "seqflag2" - FLAG3 = "seqflag3" + FLAG0 = 'seqflag0' + FLAG1 = 'seqflag1' + FLAG2 = 'seqflag2' + FLAG3 = 'seqflag3' class SequencerRegister(Enum): - REGISTER0 = "reg0" - REGISTER1 = "reg1" - REGISTER2 = "reg2" - REGISTER3 = "reg3" - REGISTER4 = "reg4" - REGISTER5 = "reg5" - REGISTER6 = "reg6" - REGISTER7 = "reg7" - REGISTER8 = "reg8" - REGISTER9 = "reg9" - REGISTER10 = "reg10" - REGISTER11 = "reg11" - REGISTER12 = "reg12" - REGISTER13 = "reg13" - REGISTER14 = "reg14" - REGISTER15 = "reg15" + REGISTER0 = 'reg0' + REGISTER1 = 'reg1' + REGISTER2 = 'reg2' + REGISTER3 = 'reg3' + REGISTER4 = 'reg4' + REGISTER5 = 'reg5' + REGISTER6 = 'reg6' + REGISTER7 = 'reg7' + REGISTER8 = 'reg8' + REGISTER9 = 'reg9' + REGISTER10 = 'reg10' + REGISTER11 = 'reg11' + REGISTER12 = 'reg12' + REGISTER13 = 'reg13' + REGISTER14 = 'reg14' + REGISTER15 = 'reg15' class _SiteResultType(Enum): PASS_FAIL = 3300 - r""" + r''' Pass/fail site result. - """ + ''' CAPTURE_WAVEFORM = 3301 - r""" + r''' Capture waveform site result. - """ + ''' class SoftwareTrigger(Enum): START = 2000 - r""" + r''' Overrides the start trigger. - """ + ''' CONDITIONAL_JUMP = 2001 - r""" + r''' Specifies to route a conditional jump trigger. - """ + ''' class SourceDataMapping(Enum): BROADCAST = 2600 - r""" + r''' Broadcasts the waveform you specify to all sites. - """ + ''' SITE_UNIQUE = 2601 - r""" + r''' Sources unique waveform data to each site. - """ + ''' class TDREndpointTermination(Enum): OPEN = 3600 - r""" + r''' TDR channels are connected to an open circuit. - """ + ''' SHORT_TO_GROUND = 3601 - r""" + r''' TDR channels are connected to a short to ground. - """ + ''' class TerminationMode(Enum): ACTIVE_LOAD = 1200 - r""" + r''' The active load provides a constant current to a commutating voltage (Vcom). - """ + ''' VTERM = 1201 - r""" + r''' The pin driver drives Vterm. - """ + ''' HIGH_Z = 1202 - r""" + r''' The pin driver is in a non-drive state (in a high-impedance state) and the active load is disabled. - """ + ''' class TimeSetEdgeType(Enum): DRIVE_ON = 2800 - r""" + r''' Specifies the drive on edge of the time set. - """ + ''' DRIVE_DATA = 2801 - r""" + r''' Specifies the drive data edge of the time set. - """ + ''' DRIVE_RETURN = 2802 - r""" + r''' Specifies the drive return edge of the time set. - """ + ''' DRIVE_OFF = 2803 - r""" + r''' Specifies the drive off edge of the time set. - """ + ''' COMPARE_STROBE = 2804 - r""" + r''' Specifies the compare strobe of the time set. - """ + ''' DRIVE_DATA2 = 2805 - r""" + r''' Specifies the drive data 2 edge of the time set. - """ + ''' DRIVE_RETURN2 = 2806 - r""" + r''' Specifies the drive return 2 edge of the time set. - """ + ''' COMPARE_STROBE2 = 2807 - r""" + r''' Specifies the compare strobe 2 of the time set. - """ + ''' class TriggerType(Enum): NONE = 1700 - r""" + r''' Disables the start trigger. - """ + ''' DIGITAL_EDGE = 1701 - r""" + r''' Digital edge trigger. - """ + ''' SOFTWARE = 1702 - r""" + r''' Software start trigger. - """ + ''' class WriteStaticPinState(Enum): ZERO = 0 - r""" + r''' Specifies to drive low. - """ + ''' ONE = 1 - r""" + r''' Specifies to drive high. - """ + ''' X = 5 - r""" + r''' Specifies to not drive. - """ + ''' def __str__(self): return { - "ZERO": "0", - "ONE": "1", + 'ZERO': '0', + 'ONE': '1', }.get(self.name, self.name) diff --git a/generated/nidigital/nidigital/errors.py b/generated/nidigital/nidigital/errors.py index 3cfc94d52..e6c0a9402 100644 --- a/generated/nidigital/nidigital/errors.py +++ b/generated/nidigital/nidigital/errors.py @@ -7,103 +7,86 @@ def _is_success(code): - return code == 0 + return (code == 0) def _is_error(code): - return code < 0 + return (code < 0) def _is_warning(code): - return code > 0 + return (code > 0) class Error(Exception): - """Base error class for NI-Digital Pattern Driver""" + '''Base error class for NI-Digital Pattern Driver''' def __init__(self, message): super(Error, self).__init__(message) class DriverError(Error): - """An error originating from the NI-Digital Pattern Driver driver""" + '''An error originating from the NI-Digital Pattern Driver driver''' def __init__(self, code, description): - assert _is_error(code), "Should not raise Error if code is not fatal." + assert (_is_error(code)), "Should not raise Error if code is not fatal." self.code = code self.description = description super(DriverError, self).__init__(str(self.code) + ": " + self.description) class DriverWarning(Warning): - """A warning originating from the NI-Digital Pattern Driver driver""" + '''A warning originating from the NI-Digital Pattern Driver driver''' def __init__(self, code, description): - assert _is_warning(code), "Should not create Warning if code is not positive." - super(DriverWarning, self).__init__( - "Warning {0} occurred.\n\n{1}".format(code, description) - ) + assert (_is_warning(code)), "Should not create Warning if code is not positive." + super(DriverWarning, self).__init__('Warning {0} occurred.\n\n{1}'.format(code, description)) class UnsupportedConfigurationError(Error): - """An error due to using this module in an usupported platform.""" + '''An error due to using this module in an usupported platform.''' def __init__(self): - super(UnsupportedConfigurationError, self).__init__( - "System configuration is unsupported: " - + platform.architecture()[0] - + " " - + platform.system() - ) + super(UnsupportedConfigurationError, self).__init__('System configuration is unsupported: ' + platform.architecture()[0] + ' ' + platform.system()) class DriverNotInstalledError(Error): - """An error due to using this module without the driver runtime installed.""" + '''An error due to using this module without the driver runtime installed.''' def __init__(self): - super(DriverNotInstalledError, self).__init__( - "The NI-Digital Pattern Driver runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it." - ) + super(DriverNotInstalledError, self).__init__('The NI-Digital Pattern Driver runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it.') class DriverTooOldError(Error): - """An error due to using this module with an older version of the driver runtime.""" + '''An error due to using this module with an older version of the driver runtime.''' def __init__(self): - super(DriverTooOldError, self).__init__( - "A function was not found in the NI-Digital Pattern Driver runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it." - ) + super(DriverTooOldError, self).__init__('A function was not found in the NI-Digital Pattern Driver runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it.') class InvalidRepeatedCapabilityError(Error): - """An error due to an invalid character in a repeated capability""" + '''An error due to an invalid character in a repeated capability''' def __init__(self, invalid_character, invalid_string): - super(InvalidRepeatedCapabilityError, self).__init__( - "An invalid character ({0}) was found in repeated capability string ({1})".format( - invalid_character, invalid_string - ) - ) + super(InvalidRepeatedCapabilityError, self).__init__('An invalid character ({0}) was found in repeated capability string ({1})'.format(invalid_character, invalid_string)) class SelfTestError(Error): - """An error due to a failed self-test""" + '''An error due to a failed self-test''' def __init__(self, code, msg): self.code = code self.message = msg - super(SelfTestError, self).__init__( - "Self-test failed with code {0}: {1}".format(code, msg) - ) + super(SelfTestError, self).__init__('Self-test failed with code {0}: {1}'.format(code, msg)) def handle_error(session, code, ignore_warnings, is_error_handling): - """handle_error + '''handle_error Helper function for handling errors returned by nidigital.Library. It calls back into the session to get the corresponding error description and raises if necessary. - """ + ''' if _is_success(code) or (_is_warning(code) and ignore_warnings): return @@ -111,7 +94,7 @@ def handle_error(session, code, ignore_warnings, is_error_handling): if is_error_handling: # The caller is in the midst of error handling and an error occurred. # Don't try to get the description or we'll start recursing until the stack overflows. - description = "" + description = '' else: description = session._get_error_description(code) @@ -120,3 +103,5 @@ def handle_error(session, code, ignore_warnings, is_error_handling): assert _is_warning(code) warnings.warn(DriverWarning(code, description)) + + diff --git a/generated/nidigital/nidigital/history_ram_cycle_information.py b/generated/nidigital/nidigital/history_ram_cycle_information.py index 65d559775..78c682cf0 100644 --- a/generated/nidigital/nidigital/history_ram_cycle_information.py +++ b/generated/nidigital/nidigital/history_ram_cycle_information.py @@ -1,15 +1,5 @@ class HistoryRAMCycleInformation(object): - def __init__( - self, - pattern_name, - time_set_name, - vector_number, - cycle_number, - scan_cycle_number, - expected_pin_states, - actual_pin_states, - per_pin_pass_fail, - ): + def __init__(self, pattern_name, time_set_name, vector_number, cycle_number, scan_cycle_number, expected_pin_states, actual_pin_states, per_pin_pass_fail): self.pattern_name = pattern_name self.time_set_name = time_set_name self.vector_number = vector_number @@ -23,71 +13,40 @@ def __repr__(self): parameter_list = [ 'pattern_name="{}"'.format(self.pattern_name), 'time_set_name="{}"'.format(self.time_set_name), - "vector_number={}".format(self.vector_number), - "cycle_number={}".format(self.cycle_number), - "scan_cycle_number={}".format(self.scan_cycle_number), - "expected_pin_states={}".format( - self._digital_states_representation(self.expected_pin_states) - ), - "actual_pin_states={}".format( - self._digital_states_representation(self.actual_pin_states) - ), - "per_pin_pass_fail={}".format(self.per_pin_pass_fail), + 'vector_number={}'.format(self.vector_number), + 'cycle_number={}'.format(self.cycle_number), + 'scan_cycle_number={}'.format(self.scan_cycle_number), + 'expected_pin_states={}'.format(self._digital_states_representation(self.expected_pin_states)), + 'actual_pin_states={}'.format(self._digital_states_representation(self.actual_pin_states)), + 'per_pin_pass_fail={}'.format(self.per_pin_pass_fail), ] - return "{0}.{1}({2})".format( - self.__class__.__module__, - self.__class__.__qualname__, - ", ".join(parameter_list), - ) + return '{0}.{1}({2})'.format(self.__class__.__module__, self.__class__.__qualname__, ', '.join(parameter_list)) def __str__(self): # different format lines - row_format_d = "{:<20}: {:,}\n" - row_format_s = "{:<20}: {:}\n" + row_format_d = '{:<20}: {:,}\n' + row_format_s = '{:<20}: {:}\n' - string_representation = "" - string_representation += row_format_s.format("Pattern Name", self.pattern_name) - string_representation += row_format_s.format( - "Time Set Name", self.time_set_name - ) - string_representation += row_format_d.format( - "Vector Number", self.vector_number - ) - string_representation += row_format_d.format("Cycle Number", self.cycle_number) - string_representation += row_format_d.format( - "Scan Cycle Number", self.scan_cycle_number - ) - string_representation += row_format_s.format( - "Expected Pin States", self._digital_states_string(self.expected_pin_states) - ) - string_representation += row_format_s.format( - "Actual Pin States", self._digital_states_string(self.actual_pin_states) - ) - string_representation += row_format_s.format( - "Per Pin Pass Fail", self.per_pin_pass_fail - ) + string_representation = '' + string_representation += row_format_s.format('Pattern Name', self.pattern_name) + string_representation += row_format_s.format('Time Set Name', self.time_set_name) + string_representation += row_format_d.format('Vector Number', self.vector_number) + string_representation += row_format_d.format('Cycle Number', self.cycle_number) + string_representation += row_format_d.format('Scan Cycle Number', self.scan_cycle_number) + string_representation += row_format_s.format('Expected Pin States', self._digital_states_string(self.expected_pin_states)) + string_representation += row_format_s.format('Actual Pin States', self._digital_states_string(self.actual_pin_states)) + string_representation += row_format_s.format('Per Pin Pass Fail', self.per_pin_pass_fail) return string_representation @staticmethod def _digital_states_representation(states): - states_representation = [ - [ - "{0}.{1}.{2}".format( - i.__class__.__module__, i.__class__.__qualname__, i.name - ) - for i in j - ] - for j in states - ] - return "[{}]".format( - ", ".join(["[{}]".format(", ".join(i)) for i in states_representation]) - ) + states_representation = [['{0}.{1}.{2}'.format(i.__class__.__module__, i.__class__.__qualname__, i.name) for i in j] for j in states] + return '[{}]'.format(', '.join(['[{}]'.format(', '.join(i)) for i in states_representation])) @staticmethod def _digital_states_string(states): states_string = [[str(i) for i in j] for j in states] - return "[{}]".format( - ", ".join(["[{}]".format(", ".join(i)) for i in states_string]) - ) + return '[{}]'.format(', '.join(['[{}]'.format(', '.join(i)) for i in states_string])) + diff --git a/generated/nidigital/nidigital/session.py b/generated/nidigital/nidigital/session.py index d6fb85c2c..5fe928f87 100644 --- a/generated/nidigital/nidigital/session.py +++ b/generated/nidigital/nidigital/session.py @@ -2,7 +2,6 @@ # This file was generated import array # noqa: F401 import ctypes - # Used by @ivi_synchronized from functools import wraps @@ -20,24 +19,22 @@ # Used for __repr__ import pprint - pp = pprint.PrettyPrinter(indent=4) # Helper functions for creating ctypes needed for calling into the driver DLL def get_ctypes_pointer_for_buffer(value=None, library_type=None, size=None): if isinstance(value, array.array): - assert library_type is not None, "library_type is required for array.array" + assert library_type is not None, 'library_type is required for array.array' addr, _ = value.buffer_info() return ctypes.cast(addr, ctypes.POINTER(library_type)) elif str(type(value)).find("'numpy.ndarray'") != -1: import numpy - return numpy.ctypeslib.as_ctypes(value) elif isinstance(value, bytes): return ctypes.cast(value, ctypes.POINTER(library_type)) elif isinstance(value, list): - assert library_type is not None, "library_type is required for list" + assert library_type is not None, 'library_type is required for list' return (library_type * len(value))(*value) else: if library_type is not None and size is not None: @@ -77,7 +74,6 @@ def aux(*xs, **kws): session = xs[0] # parameter 0 is 'self' which is the session object with session.lock(): return f(*xs, **kws) - return aux @@ -98,34 +94,16 @@ def __init__(self, session, prefix, current_repeated_capability_list): self._session = session self._prefix = prefix # We need at least one element. If we get an empty list, make the one element an empty string - self._current_repeated_capability_list = ( - current_repeated_capability_list - if len(current_repeated_capability_list) > 0 - else [""] - ) + self._current_repeated_capability_list = current_repeated_capability_list if len(current_repeated_capability_list) > 0 else [''] # Now we know there is at lease one entry, so we look if it is an empty string or not - self._separator = ( - "/" if len(self._current_repeated_capability_list[0]) > 0 else "" - ) + self._separator = '/' if len(self._current_repeated_capability_list[0]) > 0 else '' def __getitem__(self, repeated_capability): - """Set/get properties or call methods with a repeated capability (i.e. channels)""" - rep_caps_list = _converters.convert_repeated_capabilities( - repeated_capability, self._prefix - ) - complete_rep_cap_list = [ - current_rep_cap + self._separator + rep_cap - for current_rep_cap in self._current_repeated_capability_list - for rep_cap in rep_caps_list - ] - - return _SessionBase( - vi=self._session._vi, - repeated_capability_list=complete_rep_cap_list, - library=self._session._library, - encoding=self._session._encoding, - freeze_it=True, - ) + '''Set/get properties or call methods with a repeated capability (i.e. channels)''' + rep_caps_list = _converters.convert_repeated_capabilities(repeated_capability, self._prefix) + complete_rep_cap_list = [current_rep_cap + self._separator + rep_cap for current_rep_cap in self._current_repeated_capability_list for rep_cap in rep_caps_list] + + return _SessionBase(vi=self._session._vi, repeated_capability_list=complete_rep_cap_list, library=self._session._library, encoding=self._session._encoding, freeze_it=True) # This is a very simple context manager we can use when we need to set/get attributes @@ -137,20 +115,20 @@ def __init__(self, session): def __enter__(self): self._repeated_capability_cache = self._session._repeated_capability - self._session._repeated_capability = "" + self._session._repeated_capability = '' def __exit__(self, exc_type, exc_value, traceback): self._session._repeated_capability = self._repeated_capability_cache class _SessionBase(object): - """Base class for all NI-Digital Pattern Driver sessions.""" + '''Base class for all NI-Digital Pattern Driver sessions.''' # This is needed during __init__. Without it, __setattr__ raises an exception _is_frozen = False active_load_ioh = _attributes.AttributeViReal64(1150013) - """Type: float + '''Type: float Specifies the current that the DUT sources to the active load while outputting a voltage above VCOM. @@ -163,9 +141,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.active_load_ioh` - """ + ''' active_load_iol = _attributes.AttributeViReal64(1150012) - """Type: float + '''Type: float Specifies the current that the DUT sinks from the active load while outputting a voltage below VCOM. @@ -178,9 +156,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.active_load_iol` - """ + ''' active_load_vcom = _attributes.AttributeViReal64(1150014) - """Type: float + '''Type: float Specifies the voltage level at which the active load circuit switches between sourcing current and sinking current. @@ -193,19 +171,19 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.active_load_vcom` - """ + ''' cache = _attributes.AttributeViBoolean(1050004) - """Type: bool + '''Type: bool Specifies whether to cache the value of properties. When caching is enabled, the instrument driver keeps track of the current instrument settings and avoids sending redundant commands to the instrument. This significantly increases execution speed. Caching is always enabled in the driver, regardless of the value of this property. - """ + ''' channel_count = _attributes.AttributeViInt32(1050203) - """Type: int + '''Type: int Returns the number of channels that the specific digital pattern instrument driver supports. - """ + ''' clock_generator_frequency = _attributes.AttributeViReal64(1150073) - """Type: float + '''Type: float Specifies the frequency for the clock generator. @@ -218,9 +196,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.clock_generator_frequency` - """ + ''' clock_generator_is_running = _attributes.AttributeViBoolean(1150074) - """Type: bool + '''Type: bool Indicates whether the clock generator is running. @@ -233,9 +211,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.clock_generator_is_running` - """ + ''' conditional_jump_trigger_terminal_name = _attributes.AttributeViString(1150040) - """Type: str + '''Type: str Specifies the terminal name from which the exported conditional jump trigger signal may be routed to other instruments through the PXI trigger bus. You can use this signal to trigger other instruments when the conditional jump trigger instance asserts on the digital pattern instrument. @@ -248,11 +226,9 @@ class _SessionBase(object): To set/get on all conditional_jump_triggers, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.conditional_jump_trigger_terminal_name` - """ - conditional_jump_trigger_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TriggerType, 1150033 - ) - """Type: enums.TriggerType + ''' + conditional_jump_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerType, 1150033) + '''Type: enums.TriggerType Disables the conditional jump trigger or configures it for either hardware triggering or software triggering. The default value is TriggerType.NONE. @@ -275,18 +251,14 @@ class _SessionBase(object): To set/get on all conditional_jump_triggers, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.conditional_jump_trigger_type` - """ - cycle_number_history_ram_trigger_cycle_number = _attributes.AttributeViInt64( - 1150044 - ) - """Type: int + ''' + cycle_number_history_ram_trigger_cycle_number = _attributes.AttributeViInt64(1150044) + '''Type: int Specifies the cycle number on which History RAM starts acquiring pattern information when configured for a cycle number trigger. - """ - digital_edge_conditional_jump_trigger_edge = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.DigitalEdge, 1150035 - ) - """Type: enums.DigitalEdge + ''' + digital_edge_conditional_jump_trigger_edge = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.DigitalEdge, 1150035) + '''Type: enums.DigitalEdge Configures the active edge of the incoming trigger signal for the conditional jump trigger instance. The default value is DigitalEdge.RISING. @@ -307,11 +279,9 @@ class _SessionBase(object): To set/get on all conditional_jump_triggers, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.digital_edge_conditional_jump_trigger_edge` - """ - digital_edge_conditional_jump_trigger_source = _attributes.AttributeViString( - 1150034 - ) - """Type: str + ''' + digital_edge_conditional_jump_trigger_source = _attributes.AttributeViString(1150034) + '''Type: str Configures the digital trigger source terminal for a conditional jump trigger instance. The PXIe-6570/6571 supports triggering through the PXI trigger bus. You can specify source terminals in one of two ways. If the digital pattern instrument is named Dev1 and your terminal is PXI_Trig0, you can specify the terminal with the fully qualified terminal name, /Dev1/PXI_Trig0, or with the shortened terminal name, PXI_Trig0. The source terminal can also be a terminal from another device, in which case the NI-Digital Pattern Driver automatically finds a route (if one is available) from that terminal to the input terminal (going through a physical PXI backplane trigger line). For example, you can set the source terminal on Dev1 to be /Dev2/ConditionalJumpTrigger0. The default value is VI_NULL. @@ -330,11 +300,9 @@ class _SessionBase(object): To set/get on all conditional_jump_triggers, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.digital_edge_conditional_jump_trigger_source` - """ - digital_edge_rio_trigger_edge = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.DigitalEdge, 1150088 - ) - """Type: enums.DigitalEdge + ''' + digital_edge_rio_trigger_edge = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.DigitalEdge, 1150088) + '''Type: enums.DigitalEdge Configures the active edge of the incoming trigger signal for the RIO trigger instance. The default value is DigitalEdge.RISING. @@ -355,9 +323,9 @@ class _SessionBase(object): To set/get on all rio_triggers, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.digital_edge_rio_trigger_edge` - """ + ''' digital_edge_rio_trigger_source = _attributes.AttributeViString(1150087) - """Type: str + '''Type: str Configures the digital trigger source terminal for a RIO trigger instance. The PXIe-6570/6571 supports triggering through the PXI trigger bus. You can specify source terminals in one of two ways. If the digital pattern instrument is named Dev1 and your terminal is PXI_Trig0, you can specify the terminal with the fully qualified terminal name, /Dev1/PXI_Trig0, or with the shortened terminal name, PXI_Trig0. The source terminal can also be a terminal from another device, in which case the NI-Digital Pattern Driver automatically finds a route (if one is available) from that terminal to the input terminal (going through a physical PXI backplane trigger line). For example, you can set the source terminal on Dev1 to be /Dev2/RIOTrigger0. The default value is VI_NULL. @@ -376,11 +344,9 @@ class _SessionBase(object): To set/get on all rio_triggers, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.digital_edge_rio_trigger_source` - """ - digital_edge_start_trigger_edge = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.DigitalEdge, 1150031 - ) - """Type: enums.DigitalEdge + ''' + digital_edge_start_trigger_edge = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.DigitalEdge, 1150031) + '''Type: enums.DigitalEdge Specifies the active edge for the Start trigger. This property is used when the start_trigger_type property is set to Digital Edge. @@ -391,9 +357,9 @@ class _SessionBase(object): +---------------------+-------------------------------------------------------------------------------+ | DigitalEdge.FALLING | Asserts the trigger when the signal transitions from high level to low level. | +---------------------+-------------------------------------------------------------------------------+ - """ + ''' digital_edge_start_trigger_source = _attributes.AttributeViString(1150030) - """Type: str + '''Type: str Specifies the source terminal for the Start trigger. This property is used when the start_trigger_type property is set to Digital Edge. You can specify source terminals in one of two ways. If the digital pattern instrument is named Dev1 and your terminal is PXI_Trig0, you can specify the terminal with the fully qualified terminal name, /Dev1/PXI_Trig0, or with the shortened terminal name, PXI_Trig0. The source terminal can also be a terminal from another device, in which case the NI-Digital Pattern Driver automatically finds a route (if one is available) from that terminal to the input terminal (going through a physical PXI backplane trigger line). For example, you can set the source terminal on Dev1 to be /Dev2/StartTrigger. @@ -416,16 +382,14 @@ class _SessionBase(object): +-----------------+--------------------+ | PXI_Trig7 | PXI trigger line 7 | +-----------------+--------------------+ - """ + ''' driver_setup = _attributes.AttributeViString(1050007) - """Type: str + '''Type: str This property returns initial values for NI-Digital Pattern Driver properties as a string. - """ - exported_conditional_jump_trigger_output_terminal = _attributes.AttributeViString( - 1150036 - ) - """Type: str + ''' + exported_conditional_jump_trigger_output_terminal = _attributes.AttributeViString(1150036) + '''Type: str Specifies the terminal to output the exported signal of the specified instance of the conditional jump trigger. The default value is VI_NULL. @@ -460,11 +424,9 @@ class _SessionBase(object): To set/get on all conditional_jump_triggers, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.exported_conditional_jump_trigger_output_terminal` - """ - exported_pattern_opcode_event_output_terminal = _attributes.AttributeViString( - 1150041 - ) - """Type: str + ''' + exported_pattern_opcode_event_output_terminal = _attributes.AttributeViString(1150041) + '''Type: str Specifies the destination terminal for exporting the Pattern Opcode Event. Terminals can be specified in one of two ways. If the digital pattern instrument is named Dev1 and your terminal is PXI_Trig0, you can specify the terminal with the fully qualified terminal name, /Dev1/PXI_Trig0, or with the shortened terminal name, PXI_Trig0. @@ -497,9 +459,9 @@ class _SessionBase(object): To set/get on all pattern_opcode_events, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.exported_pattern_opcode_event_output_terminal` - """ + ''' exported_rio_event_output_terminal = _attributes.AttributeViString(1150090) - """Type: str + '''Type: str Specifies the destination terminal for exporting the RIO Event. Terminals can be specified in one of two ways. If the digital pattern instrument is named Dev1 and your terminal is PXI_Trig0, you can specify the terminal with the fully qualified terminal name, /Dev1/PXI_Trig0, or with the shortened terminal name, PXI_Trig0. @@ -532,9 +494,9 @@ class _SessionBase(object): To set/get on all rio_events, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.exported_rio_event_output_terminal` - """ + ''' exported_start_trigger_output_terminal = _attributes.AttributeViString(1150032) - """Type: str + '''Type: str Specifies the destination terminal for exporting the Start trigger. Terminals can be specified in one of two ways. If the digital pattern instrument is named Dev1 and your terminal is PXI_Trig0, you can specify the terminal with the fully qualified terminal name, /Dev1/PXI_Trig0, or with the shortened terminal name, PXI_Trig0. @@ -559,16 +521,14 @@ class _SessionBase(object): +----------------------+-----------------------------+ | PXI_Trig7 | PXI trigger line 7 | +----------------------+-----------------------------+ - """ + ''' frequency_counter_hysteresis_enabled = _attributes.AttributeViBoolean(1150085) - """Type: bool + '''Type: bool Specifies whether hysteresis is enabled for the frequency counters of the digital pattern instrument. - """ - frequency_counter_measurement_mode = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.FrequencyMeasurementMode, 1150084 - ) - """Type: enums.FrequencyMeasurementMode + ''' + frequency_counter_measurement_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.FrequencyMeasurementMode, 1150084) + '''Type: enums.FrequencyMeasurementMode Determines how the frequency counters of the digital pattern instrument make measurements. @@ -579,11 +539,9 @@ class _SessionBase(object): +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | FrequencyMeasurementMode.PARALLEL | All discrete frequency counters make frequency measurements from all channels in parallel with one another. Use parallel mode to increase the speed of frequency measurements if you do not need access to the full measure frequency range of the instrument; in parallel mode, you can also add frequency_counter_hysteresis_enabled to reduce measurement noise. | +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - """ - frequency_counter_measurement_time = _attributes.AttributeViReal64TimeDeltaSeconds( - 1150069 - ) - """Type: float in seconds or datetime.timedelta + ''' + frequency_counter_measurement_time = _attributes.AttributeViReal64TimeDeltaSeconds(1150069) + '''Type: float in seconds or datetime.timedelta Specifies the measurement time for the frequency counter. @@ -596,19 +554,19 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.frequency_counter_measurement_time` - """ + ''' group_capabilities = _attributes.AttributeViString(1050401) - """Type: str + '''Type: str Returns a string that contains a comma-separated list of class-extension groups that the driver implements. - """ + ''' halt_on_keep_alive_opcode = _attributes.AttributeViBoolean(1150062) - """Type: bool + '''Type: bool Specifies whether keep_alive opcodes should behave like halt opcodes. - """ + ''' history_ram_buffer_size_per_site = _attributes.AttributeViInt64(1150079) - """Type: int + '''Type: int Specifies the size, in samples, of the host memory buffer. The default value is 32000. @@ -617,11 +575,9 @@ class _SessionBase(object): +===============+ | 0-INT64_MAX | +---------------+ - """ - history_ram_cycles_to_acquire = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.HistoryRAMCyclesToAcquire, 1150047 - ) - """Type: enums.HistoryRAMCyclesToAcquire + ''' + history_ram_cycles_to_acquire = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.HistoryRAMCyclesToAcquire, 1150047) + '''Type: enums.HistoryRAMCyclesToAcquire Configures which cycles History RAM acquires after the trigger conditions are met. If you configure History RAM to only acquire failed cycles, you must set the pretrigger samples for History RAM to 0. @@ -632,14 +588,14 @@ class _SessionBase(object): +----------------------------------+-----------------------------------------------------------------------------------+ | HistoryRAMCyclesToAcquire.ALL | Acquires all cycles after the triggering conditions are met. | +----------------------------------+-----------------------------------------------------------------------------------+ - """ + ''' history_ram_max_samples_to_acquire_per_site = _attributes.AttributeViInt32(1150077) - """Type: int + '''Type: int Specifies the maximum number of History RAM samples to acquire per site. If the property is set to -1, it will acquire until the History RAM buffer is full. - """ + ''' history_ram_number_of_samples_is_finite = _attributes.AttributeViBoolean(1150078) - """Type: bool + '''Type: bool Specifies whether the instrument acquires a finite number of History Ram samples or acquires continuously. The maximum number of samples that will be acquired when this property is set to True is determined by the instrument History RAM depth specification and the History RAM Max Samples to Acquire Per Site property. The default value is True. @@ -650,16 +606,14 @@ class _SessionBase(object): +---------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | False | Specifies that History RAM results will automatically start streaming into a host buffer after a pattern is burst and the History RAM has triggered. | +---------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ - """ + ''' history_ram_pretrigger_samples = _attributes.AttributeViInt32(1150048) - """Type: int + '''Type: int Specifies the number of samples to acquire before the trigger conditions are met. If you configure History RAM to only acquire failed cycles, you must set the pretrigger samples for History RAM to 0. - """ - history_ram_trigger_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.HistoryRAMTriggerType, 1150043 - ) - """Type: enums.HistoryRAMTriggerType + ''' + history_ram_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.HistoryRAMTriggerType, 1150043) + '''Type: enums.HistoryRAMTriggerType Specifies the type of trigger condition on which History RAM starts acquiring pattern information. @@ -672,9 +626,9 @@ class _SessionBase(object): +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+ | HistoryRAMTriggerType.PATTERN_LABEL | Starts acquiring pattern information in History RAM starting from a specified pattern label, augmented by vector and cycle offsets. | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+ - """ + ''' instrument_firmware_revision = _attributes.AttributeViString(1050510) - """Type: str + '''Type: str Returns a string that contains the firmware revision information for the digital pattern instrument. @@ -687,39 +641,39 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.instrument_firmware_revision` - """ + ''' instrument_manufacturer = _attributes.AttributeViString(1050511) - """Type: str + '''Type: str Returns a string ("National Instruments") that contains the name of the manufacturer of the digital pattern instrument. - """ + ''' instrument_model = _attributes.AttributeViString(1050512) - """Type: str + '''Type: str Returns a string that contains the model number or name of the digital pattern instrument. - """ + ''' interchange_check = _attributes.AttributeViBoolean(1050021) - """Type: bool + '''Type: bool This property is not supported. - """ + ''' io_resource_descriptor = _attributes.AttributeViString(1050304) - """Type: str + '''Type: str Returns a string that contains the resource descriptor that the NI-Digital Pattern Driver uses to identify the digital pattern instrument. - """ + ''' is_keep_alive_active = _attributes.AttributeViBoolean(1150063) - """Type: bool + '''Type: bool Returns True if the digital pattern instrument is driving the keep alive pattern. - """ + ''' logical_name = _attributes.AttributeViString(1050305) - """Type: str + '''Type: str Returns a string containing the logical name that you specified when opening the current IVI session. This property is not supported. - """ + ''' mask_compare = _attributes.AttributeViBoolean(1150060) - """Type: bool + '''Type: bool Specifies whether the pattern comparisons are masked or not. When set to True for a specified pin, failures on that pin will be masked. @@ -732,28 +686,24 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.mask_compare` - """ - pattern_label_history_ram_trigger_cycle_offset = _attributes.AttributeViInt64( - 1150045 - ) - """Type: int + ''' + pattern_label_history_ram_trigger_cycle_offset = _attributes.AttributeViInt64(1150045) + '''Type: int Specifies the number of cycles that follow the specified pattern label and vector offset, after which History RAM will start acquiring pattern information when configured for a pattern label trigger. - """ + ''' pattern_label_history_ram_trigger_label = _attributes.AttributeViString(1150046) - """Type: str + '''Type: str Specifies the pattern label, augmented by the vector and cycle offset, to determine the point where History RAM will start acquiring pattern information when configured for a pattern label trigger. - """ - pattern_label_history_ram_trigger_vector_offset = _attributes.AttributeViInt64( - 1150052 - ) - """Type: int + ''' + pattern_label_history_ram_trigger_vector_offset = _attributes.AttributeViInt64(1150052) + '''Type: int Specifies the number of vectors that follow the specified pattern label, after which History RAM will start acquiring pattern information when configured for a pattern label trigger. - """ + ''' pattern_opcode_event_terminal_name = _attributes.AttributeViString(1150042) - """Type: str + '''Type: str Specifies the terminal name for the output trigger signal of the specified instance of a Pattern Opcode Event. You can use this terminal name as an input signal source for another trigger. @@ -766,9 +716,9 @@ class _SessionBase(object): To set/get on all pattern_opcode_events, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.pattern_opcode_event_terminal_name` - """ + ''' ppmu_allow_extended_voltage_range = _attributes.AttributeViBoolean(1150076) - """Type: bool + '''Type: bool Enables the instrument to operate in additional voltage ranges where instrument specifications may differ from standard ranges. When set to True, this property enables extended voltage range operation. Review specification deviations for application suitability before using this property. NI recommends setting this property to False when not using the extended voltage range to avoid unintentional use of this range. The extended voltage range is supported only for PPMU, with the output method set to DC Voltage. A voltage glitch may occur when you change the PPMU output voltage from a standard range to the extended voltage range, or vice-versa, while the PPMU is sourcing. NI recommends temporarily changing the selected_function property to Off before sourcing a voltage level that requires a range change. @@ -781,9 +731,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_allow_extended_voltage_range` - """ + ''' ppmu_aperture_time = _attributes.AttributeViReal64(1150037) - """Type: float + '''Type: float Specifies the measurement aperture time for the PPMU. The ppmu_aperture_time_units property sets the units of the PPMU aperture time. @@ -796,11 +746,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_aperture_time` - """ - ppmu_aperture_time_units = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.PPMUApertureTimeUnits, 1150038 - ) - """Type: enums.PPMUApertureTimeUnits + ''' + ppmu_aperture_time_units = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.PPMUApertureTimeUnits, 1150038) + '''Type: enums.PPMUApertureTimeUnits Specifies the units of the measurement aperture time for the PPMU. @@ -819,9 +767,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_aperture_time_units` - """ + ''' ppmu_current_level = _attributes.AttributeViReal64(1150019) - """Type: float + '''Type: float Specifies the current level, in amps, that the PPMU forces to the DUT. This property is applicable only when you set the ppmu_output_function property to DC Current. Specify valid values for the current level using the PPMU_ConfigureCurrentLevelRange method. @@ -837,9 +785,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_current_level` - """ + ''' ppmu_current_level_range = _attributes.AttributeViReal64(1150020) - """Type: float + '''Type: float Specifies the range of valid values for the current level, in amps, that the PPMU forces to the DUT. This property is applicable only when you set the ppmu_output_function property to DC Current. @@ -852,9 +800,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_current_level_range` - """ + ''' ppmu_current_limit = _attributes.AttributeViReal64(1150054) - """Type: float + '''Type: float Specifies the current limit, in amps, that the output cannot exceed while the PPMU forces voltage to the DUT. This property is applicable only when you set the ppmu_output_function property to DC Voltage. The PXIe-6570/6571 does not support the ppmu_current_limit property and only allows configuration of the ppmu_current_limit_range property. @@ -867,11 +815,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_current_limit` - """ - ppmu_current_limit_behavior = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.PPMUCurrentLimitBehavior, 1150064 - ) - """Type: enums.PPMUCurrentLimitBehavior + ''' + ppmu_current_limit_behavior = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.PPMUCurrentLimitBehavior, 1150064) + '''Type: enums.PPMUCurrentLimitBehavior Specifies how the output should behave when the current limit is reached. @@ -890,9 +836,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_current_limit_behavior` - """ + ''' ppmu_current_limit_range = _attributes.AttributeViReal64(1150017) - """Type: float + '''Type: float Specifies the valid range, in amps, to which the current limit can be set while the PPMU forces voltage to the DUT. This property is applicable only when you set the ppmu_output_function property to DC Voltage. @@ -905,9 +851,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_current_limit_range` - """ + ''' ppmu_current_limit_supported = _attributes.AttributeViBoolean(1150055) - """Type: bool + '''Type: bool Returns whether the device supports configuration of a current limit when you set the ppmu_output_function property to DC Voltage. @@ -920,11 +866,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_current_limit_supported` - """ - ppmu_output_function = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.PPMUOutputFunction, 1150015 - ) - """Type: enums.PPMUOutputFunction + ''' + ppmu_output_function = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.PPMUOutputFunction, 1150015) + '''Type: enums.PPMUOutputFunction Specifies whether the PPMU forces voltage or current to the DUT. @@ -945,9 +889,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_output_function` - """ + ''' ppmu_voltage_level = _attributes.AttributeViReal64(1150016) - """Type: float + '''Type: float Specifies the voltage level, in volts, that the PPMU forces to the DUT. This property is applicable only when you set the ppmu_output_function property to DC Voltage. @@ -960,9 +904,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_voltage_level` - """ + ''' ppmu_voltage_limit_high = _attributes.AttributeViReal64(1150022) - """Type: float + '''Type: float Specifies the maximum voltage limit, or high clamp voltage (V :sub:`CH` ), in volts, at the pin when the PPMU forces current to the DUT. This property is applicable only when you set the ppmu_output_function property to DC Current. @@ -975,9 +919,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_voltage_limit_high` - """ + ''' ppmu_voltage_limit_low = _attributes.AttributeViReal64(1150021) - """Type: float + '''Type: float Specifies the minimum voltage limit, or low clamp voltage (V :sub:`CL` ), in volts, at the pin when the PPMU forces current to the DUT. This property is applicable only when you set the ppmu_output_function property to DC Current. @@ -990,24 +934,24 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.ppmu_voltage_limit_low` - """ + ''' query_instrument_status = _attributes.AttributeViBoolean(1050003) - """Type: bool + '''Type: bool Specifies whether the NI-Digital Pattern Driver queries the digital pattern instrument status after each operation. The instrument status is always queried, regardless of the property setting. - """ + ''' range_check = _attributes.AttributeViBoolean(1050002) - """Type: bool + '''Type: bool Checks the range and validates parameter and property values you pass to NI-Digital Pattern Driver methods. Ranges are always checked, regardless of the property setting. - """ + ''' record_coercions = _attributes.AttributeViBoolean(1050006) - """Type: bool + '''Type: bool Specifies whether the IVI engine keeps a list of the value coercions it makes for integer and real type properties. Enabling record value coercions is not supported. - """ + ''' rio_event_terminal_name = _attributes.AttributeViString(1150091) - """Type: str + '''Type: str Specifies the terminal name for the output signal of the specified instance of a RIO Event. You can use this terminal name as an input signal source for another trigger. @@ -1020,9 +964,9 @@ class _SessionBase(object): To set/get on all rio_events, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.rio_event_terminal_name` - """ + ''' rio_trigger_terminal_name = _attributes.AttributeViString(1150089) - """Type: str + '''Type: str Specifies the terminal name from which the exported RIO trigger signal may be routed to other instruments through the PXI trigger bus. You can use this signal to trigger other instruments when the RIO trigger instance asserts on the digital pattern instrument. @@ -1035,11 +979,9 @@ class _SessionBase(object): To set/get on all rio_triggers, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.rio_trigger_terminal_name` - """ - rio_trigger_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TriggerType, 1150086 - ) - """Type: enums.TriggerType + ''' + rio_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerType, 1150086) + '''Type: enums.TriggerType Disables the rio trigger or configures it for hardware triggering. The default value is TriggerType.NONE. @@ -1060,11 +1002,9 @@ class _SessionBase(object): To set/get on all rio_triggers, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.rio_trigger_type` - """ - selected_function = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.SelectedFunction, 1150004 - ) - """Type: enums.SelectedFunction + ''' + selected_function = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.SelectedFunction, 1150004) + '''Type: enums.SelectedFunction Caution: In the Disconnect state, some I/O protection and sensing circuitry remains exposed. Do not subject the instrument to voltage beyond its operating range. @@ -1093,14 +1033,14 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.selected_function` - """ + ''' sequencer_flag_terminal_name = _attributes.AttributeViString(1150059) - """Type: str + '''Type: str Specifies the terminal name for the output trigger signal of the Sequencer Flags trigger. You can use this terminal name as an input signal source for another trigger. - """ + ''' serial_number = _attributes.AttributeViString(1150001) - """Type: str + '''Type: str Returns the serial number of the device. @@ -1113,56 +1053,54 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.serial_number` - """ + ''' simulate = _attributes.AttributeViBoolean(1050005) - """Type: bool + '''Type: bool Simulates I/O operations. After you open a session, you cannot change the simulation state. Use the __init__ method to enable simulation. - """ + ''' specific_driver_class_spec_major_version = _attributes.AttributeViInt32(1050515) - """Type: int + '''Type: int Returns the major version number of the class specification with which NI-Digital is compliant. This property is not supported. - """ + ''' specific_driver_class_spec_minor_version = _attributes.AttributeViInt32(1050516) - """Type: int + '''Type: int Returns the minor version number of the class specification with which NI-Digital is compliant. This property is not supported. - """ + ''' specific_driver_description = _attributes.AttributeViString(1050514) - """Type: str + '''Type: str Returns a string that contains a brief description of the NI-Digital Pattern driver. - """ + ''' specific_driver_prefix = _attributes.AttributeViString(1050302) - """Type: str + '''Type: str Returns a string that contains the prefix for the NI-Digital Pattern driver. - """ + ''' specific_driver_revision = _attributes.AttributeViString(1050551) - """Type: str + '''Type: str Returns a string that contains additional version information about the NI-Digital Pattern Driver. For example, the driver can return Driver: NI-Digital 16.0 as the value of this property. - """ + ''' specific_driver_vendor = _attributes.AttributeViString(1050513) - """Type: str + '''Type: str Returns a string ("National Instruments") that contains the name of the vendor that supplies the NI-Digital Pattern Driver. - """ + ''' start_label = _attributes.AttributeViString(1150023) - """Type: str + '''Type: str Specifies the pattern name or exported pattern label from which to start bursting the pattern. - """ + ''' start_trigger_terminal_name = _attributes.AttributeViString(1150039) - """Type: str + '''Type: str Specifies the terminal name for the output trigger signal of the Start trigger. You can use this terminal name as an input signal source for another trigger. - """ - start_trigger_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TriggerType, 1150029 - ) - """Type: enums.TriggerType + ''' + start_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerType, 1150029) + '''Type: enums.TriggerType Specifies the Start trigger type. The digital pattern instrument waits for this trigger after you call the init method or the burst_pattern method, and does not burst a pattern until this trigger is received. @@ -1178,21 +1116,19 @@ class _SessionBase(object): Note: One or more of the referenced methods are not in the Python API for this driver. - """ + ''' supported_instrument_models = _attributes.AttributeViString(1050327) - """Type: str + '''Type: str Returns a comma delimited string that contains the supported digital pattern instrument models for the specific driver. - """ - tdr_endpoint_termination = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TDREndpointTermination, 1150081 - ) - """Type: enums.TDREndpointTermination + ''' + tdr_endpoint_termination = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TDREndpointTermination, 1150081) + '''Type: enums.TDREndpointTermination Specifies whether TDR Channels are connected to an open circuit or a short to ground. - """ + ''' tdr_offset = _attributes.AttributeViReal64TimeDeltaSeconds(1150051) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the TDR Offset. @@ -1205,11 +1141,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.tdr_offset` - """ - termination_mode = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TerminationMode, 1150006 - ) - """Type: enums.TerminationMode + ''' + termination_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TerminationMode, 1150006) + '''Type: enums.TerminationMode Specifies the behavior of the pin during non-drive cycles. @@ -1232,9 +1166,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.termination_mode` - """ + ''' timing_absolute_delay = _attributes.AttributeViReal64TimeDeltaSeconds(1150072) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies a timing delay, measured in seconds, and applies the delay to the digital pattern instrument in addition to TDR and calibration adjustments. If the timing_absolute_delay_enabled property is set to True, this value is the intermodule skew measured by NI-TClk. You can modify this value to override the timing delay and align the I/O timing of this instrument with another instrument that shares the same reference clock. If the timing_absolute_delay_enabled property is False, this property will return 0.0. Changing the timing_absolute_delay_enabled property from False to True will set the timing_absolute_delay value back to your previously set value. @@ -1247,14 +1181,14 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.timing_absolute_delay` - """ + ''' timing_absolute_delay_enabled = _attributes.AttributeViBoolean(1150071) - """Type: bool + '''Type: bool Specifies whether the timing_absolute_delay property should be applied to adjust the digital pattern instrument timing reference relative to other instruments in the system. Do not use this feature with digital pattern instruments in a Semiconductor Test System (STS). Timing absolute delay conflicts with the adjustment performed during STS timing calibration. When set to True, the digital pattern instrument automatically adjusts the timing absolute delay to correct the instrument timing reference relative to other instruments in the system for better timing alignment among synchronized instruments. - """ + ''' vih = _attributes.AttributeViReal64(1150008) - """Type: float + '''Type: float Specifies the voltage that the digital pattern instrument will apply to the input of the DUT when the test instrument drives a logic high (1). @@ -1267,9 +1201,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.vih` - """ + ''' vil = _attributes.AttributeViReal64(1150007) - """Type: float + '''Type: float Specifies the voltage that the digital pattern instrument will apply to the input of the DUT when the test instrument drives a logic low (0). @@ -1282,9 +1216,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.vil` - """ + ''' voh = _attributes.AttributeViReal64(1150010) - """Type: float + '''Type: float Specifies the output voltage from the DUT above which the comparator on the digital pattern test instrument interprets a logic high (H). @@ -1297,9 +1231,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.voh` - """ + ''' vol = _attributes.AttributeViReal64(1150009) - """Type: float + '''Type: float Specifies the output voltage from the DUT below which the comparator on the digital pattern test instrument interprets a logic low (L). @@ -1312,9 +1246,9 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.vol` - """ + ''' vterm = _attributes.AttributeViReal64(1150011) - """Type: float + '''Type: float Specifies the termination voltage the digital pattern instrument applies during non-drive cycles when the termination mode is set to V :sub:`term`. The instrument applies the termination voltage through a 50 Ω parallel termination resistance. @@ -1327,64 +1261,48 @@ class _SessionBase(object): To set/get on all channels or pins, you can call the property directly on the :py:class:`nidigital.Session`. Example: :py:attr:`my_session.vterm` - """ + ''' - def __init__( - self, repeated_capability_list, vi, library, encoding, freeze_it=False - ): + def __init__(self, repeated_capability_list, vi, library, encoding, freeze_it=False): self._repeated_capability_list = repeated_capability_list - self._repeated_capability = ",".join(repeated_capability_list) + self._repeated_capability = ','.join(repeated_capability_list) self._vi = vi self._library = library self._encoding = encoding # Store the parameter list for later printing in __repr__ param_list = [] - param_list.append( - "repeated_capability_list=" + pp.pformat(repeated_capability_list) - ) + param_list.append("repeated_capability_list=" + pp.pformat(repeated_capability_list)) param_list.append("vi=" + pp.pformat(vi)) param_list.append("library=" + pp.pformat(library)) param_list.append("encoding=" + pp.pformat(encoding)) - self._param_list = ", ".join(param_list) + self._param_list = ', '.join(param_list) # Instantiate any repeated capability objects - self.channels = _RepeatedCapabilities(self, "", repeated_capability_list) - self.pins = _RepeatedCapabilities(self, "", repeated_capability_list) - self.instruments = _RepeatedCapabilities(self, "", repeated_capability_list) - self.pattern_opcode_events = _RepeatedCapabilities( - self, "patternOpcodeEvent", repeated_capability_list - ) - self.conditional_jump_triggers = _RepeatedCapabilities( - self, "conditionalJumpTrigger", repeated_capability_list - ) - self.sites = _RepeatedCapabilities(self, "site", repeated_capability_list) - self.rio_events = _RepeatedCapabilities( - self, "RIOEvent", repeated_capability_list - ) - self.rio_triggers = _RepeatedCapabilities( - self, "RIOTrigger", repeated_capability_list - ) + self.channels = _RepeatedCapabilities(self, '', repeated_capability_list) + self.pins = _RepeatedCapabilities(self, '', repeated_capability_list) + self.instruments = _RepeatedCapabilities(self, '', repeated_capability_list) + self.pattern_opcode_events = _RepeatedCapabilities(self, 'patternOpcodeEvent', repeated_capability_list) + self.conditional_jump_triggers = _RepeatedCapabilities(self, 'conditionalJumpTrigger', repeated_capability_list) + self.sites = _RepeatedCapabilities(self, 'site', repeated_capability_list) + self.rio_events = _RepeatedCapabilities(self, 'RIOEvent', repeated_capability_list) + self.rio_triggers = _RepeatedCapabilities(self, 'RIOTrigger', repeated_capability_list) self._is_frozen = freeze_it def __repr__(self): - return "{0}.{1}({2})".format( - "nidigital", self.__class__.__name__, self._param_list - ) + return '{0}.{1}({2})'.format('nidigital', self.__class__.__name__, self._param_list) def __setattr__(self, key, value): if self._is_frozen and key not in dir(self): - raise AttributeError( - "'{0}' object has no attribute '{1}'".format(type(self).__name__, key) - ) + raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) object.__setattr__(self, key, value) def _get_error_description(self, error_code): - """_get_error_description + '''_get_error_description Returns the error description. - """ + ''' try: _, error_string = self._get_error() return error_string @@ -1392,28 +1310,21 @@ def _get_error_description(self, error_code): pass try: - """ + ''' It is expected for _get_error to raise when the session is invalid (IVI spec requires GetError to fail). Use _error_message instead. It doesn't require a session. - """ + ''' error_string = self._error_message(error_code) return error_string except errors.Error: return "Failed to retrieve error description." - """ These are code-generated """ + ''' These are code-generated ''' @ivi_synchronized - def apply_levels_and_timing( - self, - levels_sheet, - timing_sheet, - initial_state_high_pins=None, - initial_state_low_pins=None, - initial_state_tristate_pins=None, - ): - r"""apply_levels_and_timing + def apply_levels_and_timing(self, levels_sheet, timing_sheet, initial_state_high_pins=None, initial_state_low_pins=None, initial_state_tristate_pins=None): + r'''apply_levels_and_timing Applies digital levels and timing values defined in previously loaded levels and timing sheets. When applying a levels sheet, only the levels specified in the sheet are affected. Any levels not specified in the sheet remain unchanged. When applying a timing sheet, all existing time sets are deleted before the new time sets are loaded. @@ -1439,49 +1350,21 @@ def apply_levels_and_timing( initial_state_tristate_pins (basic sequence types or str): Comma-delimited list of pins, pin groups, or channels to initialize to a non-drive state (X) - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - levels_sheet_ctype = ctypes.create_string_buffer( - levels_sheet.encode(self._encoding) - ) # case C020 - timing_sheet_ctype = ctypes.create_string_buffer( - timing_sheet.encode(self._encoding) - ) # case C020 - initial_state_high_pins_ctype = ctypes.create_string_buffer( - _converters.convert_repeated_capabilities_without_prefix( - initial_state_high_pins - ).encode(self._encoding) - ) # case C040 - initial_state_low_pins_ctype = ctypes.create_string_buffer( - _converters.convert_repeated_capabilities_without_prefix( - initial_state_low_pins - ).encode(self._encoding) - ) # case C040 - initial_state_tristate_pins_ctype = ctypes.create_string_buffer( - _converters.convert_repeated_capabilities_without_prefix( - initial_state_tristate_pins - ).encode(self._encoding) - ) # case C040 - error_code = self._library.niDigital_ApplyLevelsAndTiming( - vi_ctype, - site_list_ctype, - levels_sheet_ctype, - timing_sheet_ctype, - initial_state_high_pins_ctype, - initial_state_low_pins_ctype, - initial_state_tristate_pins_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + site_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + levels_sheet_ctype = ctypes.create_string_buffer(levels_sheet.encode(self._encoding)) # case C020 + timing_sheet_ctype = ctypes.create_string_buffer(timing_sheet.encode(self._encoding)) # case C020 + initial_state_high_pins_ctype = ctypes.create_string_buffer(_converters.convert_repeated_capabilities_without_prefix(initial_state_high_pins).encode(self._encoding)) # case C040 + initial_state_low_pins_ctype = ctypes.create_string_buffer(_converters.convert_repeated_capabilities_without_prefix(initial_state_low_pins).encode(self._encoding)) # case C040 + initial_state_tristate_pins_ctype = ctypes.create_string_buffer(_converters.convert_repeated_capabilities_without_prefix(initial_state_tristate_pins).encode(self._encoding)) # case C040 + error_code = self._library.niDigital_ApplyLevelsAndTiming(vi_ctype, site_list_ctype, levels_sheet_ctype, timing_sheet_ctype, initial_state_high_pins_ctype, initial_state_low_pins_ctype, initial_state_tristate_pins_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def apply_tdr_offsets(self, offsets): - r"""apply_tdr_offsets + r'''apply_tdr_offsets Applies the correction for propagation delay offsets to a digital pattern instrument. Use this method to apply TDR offsets that are stored from a past measurement or are measured by means other than the tdr method. Also use this method to apply correction for offsets if the **applyOffsets** input of the tdr method was set to False at the time of measurement. @@ -1499,37 +1382,19 @@ def apply_tdr_offsets(self, offsets): Args: offsets (basic sequence of hightime.timedelta, datetime.timedelta, or float in seconds): TDR offsets to apply, in seconds. Specify an offset for each pin or channel in the repeated capabilities. If the repeated capabilities contain pin names, you must specify offsets for each site in the channel map per pin. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - num_offsets_ctype = _visatype.ViInt32( - 0 if offsets is None else len(offsets) - ) # case S160 - offsets_converted = _converters.convert_timedeltas_to_seconds_real64( - offsets - ) # case B520 - offsets_ctype = get_ctypes_pointer_for_buffer( - value=offsets_converted, library_type=_visatype.ViReal64 - ) # case B520 - error_code = self._library.niDigital_ApplyTDROffsets( - vi_ctype, channel_list_ctype, num_offsets_ctype, offsets_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + num_offsets_ctype = _visatype.ViInt32(0 if offsets is None else len(offsets)) # case S160 + offsets_converted = _converters.convert_timedeltas_to_seconds_real64(offsets) # case B520 + offsets_ctype = get_ctypes_pointer_for_buffer(value=offsets_converted, library_type=_visatype.ViReal64) # case B520 + error_code = self._library.niDigital_ApplyTDROffsets(vi_ctype, channel_list_ctype, num_offsets_ctype, offsets_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def _burst_pattern( - self, - start_label, - select_digital_function=True, - wait_until_done=True, - timeout=hightime.timedelta(seconds=10.0), - ): - r"""_burst_pattern + def _burst_pattern(self, start_label, select_digital_function=True, wait_until_done=True, timeout=hightime.timedelta(seconds=10.0)): + r'''_burst_pattern Uses the **startLabel** you specify to burst the pattern on the sites you specify and provides the option to wait for the burst to complete. Digital pins retain their state at the end of a pattern burst until the first vector of a subsequent pattern burst, a call to write_static, or a call to apply_levels_and_timing. @@ -1553,37 +1418,20 @@ def _burst_pattern( timeout (hightime.timedelta, datetime.timedelta, or float in seconds): Maximum time (in seconds) allowed for this method to complete. If this method does not complete within this time interval, this method returns an error. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - start_label_ctype = ctypes.create_string_buffer( - start_label.encode(self._encoding) - ) # case C020 - select_digital_function_ctype = _visatype.ViBoolean( - select_digital_function - ) # case S150 + site_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + start_label_ctype = ctypes.create_string_buffer(start_label.encode(self._encoding)) # case C020 + select_digital_function_ctype = _visatype.ViBoolean(select_digital_function) # case S150 wait_until_done_ctype = _visatype.ViBoolean(wait_until_done) # case S150 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64( - timeout - ) # case S140 - error_code = self._library.niDigital_BurstPattern( - vi_ctype, - site_list_ctype, - start_label_ctype, - select_digital_function_ctype, - wait_until_done_ctype, - timeout_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 + error_code = self._library.niDigital_BurstPattern(vi_ctype, site_list_ctype, start_label_ctype, select_digital_function_ctype, wait_until_done_ctype, timeout_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def clock_generator_abort(self): - r"""clock_generator_abort + r'''clock_generator_abort Stops clock generation on the specified channel(s) or pin(s) and pin group(s). @@ -1597,22 +1445,16 @@ def clock_generator_abort(self): To call the method on all channels, you can call it directly on the :py:class:`nidigital.Session`. Example: :py:meth:`my_session.clock_generator_abort` - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - error_code = self._library.niDigital_ClockGenerator_Abort( - vi_ctype, channel_list_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + error_code = self._library.niDigital_ClockGenerator_Abort(vi_ctype, channel_list_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def clock_generator_generate_clock(self, frequency, select_digital_function=True): - r"""clock_generator_generate_clock + r'''clock_generator_generate_clock Configures clock generator frequency and initiates clock generation on the specified channel(s) or pin(s) and pin group(s). @@ -1632,26 +1474,18 @@ def clock_generator_generate_clock(self, frequency, select_digital_function=True select_digital_function (bool): A Boolean that specifies whether to select the digital method for the pins specified prior to starting clock generation. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 frequency_ctype = _visatype.ViReal64(frequency) # case S150 - select_digital_function_ctype = _visatype.ViBoolean( - select_digital_function - ) # case S150 - error_code = self._library.niDigital_ClockGenerator_GenerateClock( - vi_ctype, channel_list_ctype, frequency_ctype, select_digital_function_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + select_digital_function_ctype = _visatype.ViBoolean(select_digital_function) # case S150 + error_code = self._library.niDigital_ClockGenerator_GenerateClock(vi_ctype, channel_list_ctype, frequency_ctype, select_digital_function_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def configure_active_load_levels(self, iol, ioh, vcom): - r"""configure_active_load_levels + r'''configure_active_load_levels Configures I\ :sub:`OL`, I\ :sub:`OH`, and V\ :sub:`COM` levels for the active load on the pins you specify. The DUT sources or sinks current based on the level values. To enable active load, set the termination mode to TerminationMode.ACTIVE_LOAD. To disable active load, set the termination mode of the instrument to TerminationMode.HIGH_Z or TerminationMode.VTERM. @@ -1673,25 +1507,19 @@ def configure_active_load_levels(self, iol, ioh, vcom): vcom (float): Commutating voltage level at which the active load circuit switches between sourcing current and sinking current. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 iol_ctype = _visatype.ViReal64(iol) # case S150 ioh_ctype = _visatype.ViReal64(ioh) # case S150 vcom_ctype = _visatype.ViReal64(vcom) # case S150 - error_code = self._library.niDigital_ConfigureActiveLoadLevels( - vi_ctype, channel_list_ctype, iol_ctype, ioh_ctype, vcom_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_ConfigureActiveLoadLevels(vi_ctype, channel_list_ctype, iol_ctype, ioh_ctype, vcom_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def configure_pattern_burst_sites(self): - r"""configure_pattern_burst_sites + r'''configure_pattern_burst_sites Configures which sites burst the pattern on the next call to the initiate method. The pattern burst sites can also be modified through the repeated capabilities for the burst_pattern method. If a site has been disabled through the disable_sites method, the site does not burst a pattern even if included in the pattern burst sites. @@ -1705,22 +1533,16 @@ def configure_pattern_burst_sites(self): To call the method on all sites, you can call it directly on the :py:class:`nidigital.Session`. Example: :py:meth:`my_session.configure_pattern_burst_sites` - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - error_code = self._library.niDigital_ConfigurePatternBurstSites( - vi_ctype, site_list_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + site_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + error_code = self._library.niDigital_ConfigurePatternBurstSites(vi_ctype, site_list_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def configure_time_set_compare_edges_strobe(self, time_set_name, strobe_edge): - r"""configure_time_set_compare_edges_strobe + r'''configure_time_set_compare_edges_strobe Configures the strobe edge time for the specified pins. Use this method to modify time set values after applying a timing sheet with the apply_levels_and_timing method, or to create time sets programmatically without the use of timing sheets. This method does not modify the timing sheet file or the timing sheet contents that will be used in future calls to apply_levels_and_timing; it only affects the values of the current timing context. @@ -1740,30 +1562,18 @@ def configure_time_set_compare_edges_strobe(self, time_set_name, strobe_edge): strobe_edge (hightime.timedelta, datetime.timedelta, or float in seconds): Time when the comparison happens within a vector period. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - time_set_name_ctype = ctypes.create_string_buffer( - time_set_name.encode(self._encoding) - ) # case C020 - strobe_edge_ctype = _converters.convert_timedelta_to_seconds_real64( - strobe_edge - ) # case S140 - error_code = self._library.niDigital_ConfigureTimeSetCompareEdgesStrobe( - vi_ctype, pin_list_ctype, time_set_name_ctype, strobe_edge_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + pin_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 + strobe_edge_ctype = _converters.convert_timedelta_to_seconds_real64(strobe_edge) # case S140 + error_code = self._library.niDigital_ConfigureTimeSetCompareEdgesStrobe(vi_ctype, pin_list_ctype, time_set_name_ctype, strobe_edge_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def configure_time_set_compare_edges_strobe2x( - self, time_set_name, strobe_edge, strobe2_edge - ): - r"""configure_time_set_compare_edges_strobe2x + def configure_time_set_compare_edges_strobe2x(self, time_set_name, strobe_edge, strobe2_edge): + r'''configure_time_set_compare_edges_strobe2x Configures the compare strobes for the specified pins in the time set, including the 2x strobe. Use this method to modify time set values after applying a timing sheet with the apply_levels_and_timing method, or to create time sets programmatically without the use of timing sheets. This method does not modify the timing sheet file or the timing sheet contents that will be used in future calls to apply_levels_and_timing; it only affects the values of the current timing context. @@ -1785,43 +1595,19 @@ def configure_time_set_compare_edges_strobe2x( strobe2_edge (hightime.timedelta, datetime.timedelta, or float in seconds): Time when the comparison happens for the second DUT cycle within a vector period. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - time_set_name_ctype = ctypes.create_string_buffer( - time_set_name.encode(self._encoding) - ) # case C020 - strobe_edge_ctype = _converters.convert_timedelta_to_seconds_real64( - strobe_edge - ) # case S140 - strobe2_edge_ctype = _converters.convert_timedelta_to_seconds_real64( - strobe2_edge - ) # case S140 - error_code = self._library.niDigital_ConfigureTimeSetCompareEdgesStrobe2x( - vi_ctype, - pin_list_ctype, - time_set_name_ctype, - strobe_edge_ctype, - strobe2_edge_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + pin_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 + strobe_edge_ctype = _converters.convert_timedelta_to_seconds_real64(strobe_edge) # case S140 + strobe2_edge_ctype = _converters.convert_timedelta_to_seconds_real64(strobe2_edge) # case S140 + error_code = self._library.niDigital_ConfigureTimeSetCompareEdgesStrobe2x(vi_ctype, pin_list_ctype, time_set_name_ctype, strobe_edge_ctype, strobe2_edge_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def configure_time_set_drive_edges( - self, - time_set_name, - format, - drive_on_edge, - drive_data_edge, - drive_return_edge, - drive_off_edge, - ): - r"""configure_time_set_drive_edges + def configure_time_set_drive_edges(self, time_set_name, format, drive_on_edge, drive_data_edge, drive_return_edge, drive_off_edge): + r'''configure_time_set_drive_edges Configures the drive format and drive edge placement for the specified pins. Use this method to modify time set values after applying a timing sheet with the apply_levels_and_timing method, or to create time sets programmatically without the use of timing sheets. This method does not modify the timing sheet file or the timing sheet contents that will be used in future calls to apply_levels_and_timing; it only affects the values of the current timing context. @@ -1854,59 +1640,24 @@ def configure_time_set_drive_edges( drive_off_edge (hightime.timedelta, datetime.timedelta, or float in seconds): Delay, in seconds, from the beginning of the vector period to turn off the pin driver when the next vector period uses a non-drive symbol (L, H, X, V, M, E). - """ + ''' if type(format) is not enums.DriveFormat: - raise TypeError( - "Parameter format must be of type " + str(enums.DriveFormat) - ) + raise TypeError('Parameter format must be of type ' + str(enums.DriveFormat)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - time_set_name_ctype = ctypes.create_string_buffer( - time_set_name.encode(self._encoding) - ) # case C020 + pin_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 format_ctype = _visatype.ViInt32(format.value) # case S130 - drive_on_edge_ctype = _converters.convert_timedelta_to_seconds_real64( - drive_on_edge - ) # case S140 - drive_data_edge_ctype = _converters.convert_timedelta_to_seconds_real64( - drive_data_edge - ) # case S140 - drive_return_edge_ctype = _converters.convert_timedelta_to_seconds_real64( - drive_return_edge - ) # case S140 - drive_off_edge_ctype = _converters.convert_timedelta_to_seconds_real64( - drive_off_edge - ) # case S140 - error_code = self._library.niDigital_ConfigureTimeSetDriveEdges( - vi_ctype, - pin_list_ctype, - time_set_name_ctype, - format_ctype, - drive_on_edge_ctype, - drive_data_edge_ctype, - drive_return_edge_ctype, - drive_off_edge_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + drive_on_edge_ctype = _converters.convert_timedelta_to_seconds_real64(drive_on_edge) # case S140 + drive_data_edge_ctype = _converters.convert_timedelta_to_seconds_real64(drive_data_edge) # case S140 + drive_return_edge_ctype = _converters.convert_timedelta_to_seconds_real64(drive_return_edge) # case S140 + drive_off_edge_ctype = _converters.convert_timedelta_to_seconds_real64(drive_off_edge) # case S140 + error_code = self._library.niDigital_ConfigureTimeSetDriveEdges(vi_ctype, pin_list_ctype, time_set_name_ctype, format_ctype, drive_on_edge_ctype, drive_data_edge_ctype, drive_return_edge_ctype, drive_off_edge_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def configure_time_set_drive_edges2x( - self, - time_set_name, - format, - drive_on_edge, - drive_data_edge, - drive_return_edge, - drive_off_edge, - drive_data2_edge, - drive_return2_edge, - ): - r"""configure_time_set_drive_edges2x + def configure_time_set_drive_edges2x(self, time_set_name, format, drive_on_edge, drive_data_edge, drive_return_edge, drive_off_edge, drive_data2_edge, drive_return2_edge): + r'''configure_time_set_drive_edges2x Configures the drive edges of the pins in the time set, including 2x edges. Use this method to modify time set values after applying a timing sheet with the apply_levels_and_timing method, or to create time sets programmatically without the use of timing sheets. This method does not modify the timing sheet file or the timing sheet contents that will be used in future calls to apply_levels_and_timing; it only affects the values of the current timing context. @@ -1943,57 +1694,26 @@ def configure_time_set_drive_edges2x( drive_return2_edge (hightime.timedelta, datetime.timedelta, or float in seconds): Delay, in seconds, from the beginning of the vector period until the pin changes from the pattern data in the second DUT cycle to the return value, as specified in the format. - """ + ''' if type(format) is not enums.DriveFormat: - raise TypeError( - "Parameter format must be of type " + str(enums.DriveFormat) - ) + raise TypeError('Parameter format must be of type ' + str(enums.DriveFormat)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - time_set_name_ctype = ctypes.create_string_buffer( - time_set_name.encode(self._encoding) - ) # case C020 + pin_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 format_ctype = _visatype.ViInt32(format.value) # case S130 - drive_on_edge_ctype = _converters.convert_timedelta_to_seconds_real64( - drive_on_edge - ) # case S140 - drive_data_edge_ctype = _converters.convert_timedelta_to_seconds_real64( - drive_data_edge - ) # case S140 - drive_return_edge_ctype = _converters.convert_timedelta_to_seconds_real64( - drive_return_edge - ) # case S140 - drive_off_edge_ctype = _converters.convert_timedelta_to_seconds_real64( - drive_off_edge - ) # case S140 - drive_data2_edge_ctype = _converters.convert_timedelta_to_seconds_real64( - drive_data2_edge - ) # case S140 - drive_return2_edge_ctype = _converters.convert_timedelta_to_seconds_real64( - drive_return2_edge - ) # case S140 - error_code = self._library.niDigital_ConfigureTimeSetDriveEdges2x( - vi_ctype, - pin_list_ctype, - time_set_name_ctype, - format_ctype, - drive_on_edge_ctype, - drive_data_edge_ctype, - drive_return_edge_ctype, - drive_off_edge_ctype, - drive_data2_edge_ctype, - drive_return2_edge_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + drive_on_edge_ctype = _converters.convert_timedelta_to_seconds_real64(drive_on_edge) # case S140 + drive_data_edge_ctype = _converters.convert_timedelta_to_seconds_real64(drive_data_edge) # case S140 + drive_return_edge_ctype = _converters.convert_timedelta_to_seconds_real64(drive_return_edge) # case S140 + drive_off_edge_ctype = _converters.convert_timedelta_to_seconds_real64(drive_off_edge) # case S140 + drive_data2_edge_ctype = _converters.convert_timedelta_to_seconds_real64(drive_data2_edge) # case S140 + drive_return2_edge_ctype = _converters.convert_timedelta_to_seconds_real64(drive_return2_edge) # case S140 + error_code = self._library.niDigital_ConfigureTimeSetDriveEdges2x(vi_ctype, pin_list_ctype, time_set_name_ctype, format_ctype, drive_on_edge_ctype, drive_data_edge_ctype, drive_return_edge_ctype, drive_off_edge_ctype, drive_data2_edge_ctype, drive_return2_edge_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def configure_time_set_drive_format(self, time_set_name, drive_format): - r"""configure_time_set_drive_format + r'''configure_time_set_drive_format Configures the drive format for the pins specified in the **pinList**. Use this method to modify time set values after applying a timing sheet with the apply_levels_and_timing method, or to create time sets programmatically without the use of timing sheets. This method does not modify the timing sheet file or the timing sheet contents that will be used in future calls to apply_levels_and_timing; it only affects the values of the current timing context. @@ -2018,30 +1738,20 @@ def configure_time_set_drive_format(self, time_set_name, drive_format): - DriveFormat.RH: Return to high. - DriveFormat.SBC: Surround by complement. - """ + ''' if type(drive_format) is not enums.DriveFormat: - raise TypeError( - "Parameter drive_format must be of type " + str(enums.DriveFormat) - ) + raise TypeError('Parameter drive_format must be of type ' + str(enums.DriveFormat)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - time_set_name_ctype = ctypes.create_string_buffer( - time_set_name.encode(self._encoding) - ) # case C020 + pin_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 drive_format_ctype = _visatype.ViInt32(drive_format.value) # case S130 - error_code = self._library.niDigital_ConfigureTimeSetDriveFormat( - vi_ctype, pin_list_ctype, time_set_name_ctype, drive_format_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_ConfigureTimeSetDriveFormat(vi_ctype, pin_list_ctype, time_set_name_ctype, drive_format_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def configure_time_set_edge(self, time_set_name, edge, time): - r"""configure_time_set_edge + r'''configure_time_set_edge Configures the edge placement for the pins specified in the pin list. Use this method to modify time set values after applying a timing sheet with the apply_levels_and_timing method, or to create time sets programmatically without the use of timing sheets. This method does not modify the timing sheet file or the timing sheet contents that will be used in future calls to apply_levels_and_timing; it only affects the values of the current timing context. @@ -2072,31 +1782,21 @@ def configure_time_set_edge(self, time_set_name, edge, time): time (hightime.timedelta, datetime.timedelta, or float in seconds): The time from the beginning of the vector period in which to place the edge. - """ + ''' if type(edge) is not enums.TimeSetEdgeType: - raise TypeError( - "Parameter edge must be of type " + str(enums.TimeSetEdgeType) - ) + raise TypeError('Parameter edge must be of type ' + str(enums.TimeSetEdgeType)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - time_set_name_ctype = ctypes.create_string_buffer( - time_set_name.encode(self._encoding) - ) # case C020 + pin_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 edge_ctype = _visatype.ViInt32(edge.value) # case S130 time_ctype = _converters.convert_timedelta_to_seconds_real64(time) # case S140 - error_code = self._library.niDigital_ConfigureTimeSetEdge( - vi_ctype, pin_list_ctype, time_set_name_ctype, edge_ctype, time_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_ConfigureTimeSetEdge(vi_ctype, pin_list_ctype, time_set_name_ctype, edge_ctype, time_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def configure_time_set_edge_multiplier(self, time_set_name, edge_multiplier): - r"""configure_time_set_edge_multiplier + r'''configure_time_set_edge_multiplier Configures the edge multiplier of the pins in the time set. Use this method to modify time set values after applying a timing sheet with the apply_levels_and_timing method, or to create time sets programmatically without the use of timing sheets. This method does not modify the timing sheet file or the timing sheet contents that will be used in future calls to apply_levels_and_timing; it only affects the values of the current timing context. @@ -2116,26 +1816,18 @@ def configure_time_set_edge_multiplier(self, time_set_name, edge_multiplier): edge_multiplier (int): The specified edge multiplier for the pins in the pin list. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - time_set_name_ctype = ctypes.create_string_buffer( - time_set_name.encode(self._encoding) - ) # case C020 + pin_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 edge_multiplier_ctype = _visatype.ViInt32(edge_multiplier) # case S150 - error_code = self._library.niDigital_ConfigureTimeSetEdgeMultiplier( - vi_ctype, pin_list_ctype, time_set_name_ctype, edge_multiplier_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_ConfigureTimeSetEdgeMultiplier(vi_ctype, pin_list_ctype, time_set_name_ctype, edge_multiplier_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def configure_voltage_levels(self, vil, vih, vol, voh, vterm): - r"""configure_voltage_levels + r'''configure_voltage_levels Configures voltage levels for the pins you specify. @@ -2161,33 +1853,21 @@ def configure_voltage_levels(self, vil, vih, vol, voh, vterm): vterm (float): Termination voltage the instrument applies during non-drive cycles when the termination mode is set to V\ :sub:`term`. The instrument applies the termination voltage through a 50 ohm parallel termination resistance. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 vil_ctype = _visatype.ViReal64(vil) # case S150 vih_ctype = _visatype.ViReal64(vih) # case S150 vol_ctype = _visatype.ViReal64(vol) # case S150 voh_ctype = _visatype.ViReal64(voh) # case S150 vterm_ctype = _visatype.ViReal64(vterm) # case S150 - error_code = self._library.niDigital_ConfigureVoltageLevels( - vi_ctype, - channel_list_ctype, - vil_ctype, - vih_ctype, - vol_ctype, - voh_ctype, - vterm_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_ConfigureVoltageLevels(vi_ctype, channel_list_ctype, vil_ctype, vih_ctype, vol_ctype, voh_ctype, vterm_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def create_capture_waveform_parallel(self, waveform_name): - r"""create_capture_waveform_parallel + r'''create_capture_waveform_parallel Sets the capture waveform settings for parallel acquisition. Settings apply across all sites if multiple sites are configured in the pin map. You cannot reconfigure settings after waveforms are created. @@ -2205,25 +1885,17 @@ def create_capture_waveform_parallel(self, waveform_name): Args: waveform_name (str): Waveform name you want to use. Use the waveform_name with the capture_start opcode in your pattern. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - waveform_name_ctype = ctypes.create_string_buffer( - waveform_name.encode(self._encoding) - ) # case C020 - error_code = self._library.niDigital_CreateCaptureWaveformParallel( - vi_ctype, pin_list_ctype, waveform_name_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + pin_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 + error_code = self._library.niDigital_CreateCaptureWaveformParallel(vi_ctype, pin_list_ctype, waveform_name_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def create_capture_waveform_serial(self, waveform_name, sample_width, bit_order): - r"""create_capture_waveform_serial + r'''create_capture_waveform_serial Sets the capture waveform settings for serial acquisition. Settings apply across all sites if multiple sites are configured in the pin map. You cannot reconfigure settings after waveforms are created. @@ -2248,35 +1920,21 @@ def create_capture_waveform_serial(self, waveform_name, sample_width, bit_order) - BitOrder.MSB: Specifies the bit order by most significant bit first. - BitOrder.LSB: Specifies the bit order by least significant bit first. - """ + ''' if type(bit_order) is not enums.BitOrder: - raise TypeError( - "Parameter bit_order must be of type " + str(enums.BitOrder) - ) + raise TypeError('Parameter bit_order must be of type ' + str(enums.BitOrder)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - waveform_name_ctype = ctypes.create_string_buffer( - waveform_name.encode(self._encoding) - ) # case C020 + pin_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 sample_width_ctype = _visatype.ViUInt32(sample_width) # case S150 bit_order_ctype = _visatype.ViInt32(bit_order.value) # case S130 - error_code = self._library.niDigital_CreateCaptureWaveformSerial( - vi_ctype, - pin_list_ctype, - waveform_name_ctype, - sample_width_ctype, - bit_order_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_CreateCaptureWaveformSerial(vi_ctype, pin_list_ctype, waveform_name_ctype, sample_width_ctype, bit_order_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def create_source_waveform_parallel(self, waveform_name, data_mapping): - r"""create_source_waveform_parallel + r'''create_source_waveform_parallel Sets the source waveform settings required for parallel sourcing. Settings apply across all sites if multiple sites are configured in the pin map. You cannot reconfigure settings after waveforms are created. @@ -2299,32 +1957,20 @@ def create_source_waveform_parallel(self, waveform_name, data_mapping): - SourceDataMapping.BROADCAST: Broadcasts the waveform you specify to all sites. - SourceDataMapping.SITE_UNIQUE: Sources unique waveform data to each site. - """ + ''' if type(data_mapping) is not enums.SourceDataMapping: - raise TypeError( - "Parameter data_mapping must be of type " + str(enums.SourceDataMapping) - ) + raise TypeError('Parameter data_mapping must be of type ' + str(enums.SourceDataMapping)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - waveform_name_ctype = ctypes.create_string_buffer( - waveform_name.encode(self._encoding) - ) # case C020 + pin_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 data_mapping_ctype = _visatype.ViInt32(data_mapping.value) # case S130 - error_code = self._library.niDigital_CreateSourceWaveformParallel( - vi_ctype, pin_list_ctype, waveform_name_ctype, data_mapping_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_CreateSourceWaveformParallel(vi_ctype, pin_list_ctype, waveform_name_ctype, data_mapping_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def create_source_waveform_serial( - self, waveform_name, data_mapping, sample_width, bit_order - ): - r"""create_source_waveform_serial + def create_source_waveform_serial(self, waveform_name, data_mapping, sample_width, bit_order): + r'''create_source_waveform_serial Sets the source waveform settings required for serial sourcing. Settings apply across all sites if multiple sites are configured in the pin map. You cannot reconfigure settings after waveforms are created. @@ -2354,41 +2000,24 @@ def create_source_waveform_serial( - BitOrder.MSB: Specifies the bit order by most significant bit first. - BitOrder.LSB: Specifies the bit order by least significant bit first. - """ + ''' if type(data_mapping) is not enums.SourceDataMapping: - raise TypeError( - "Parameter data_mapping must be of type " + str(enums.SourceDataMapping) - ) + raise TypeError('Parameter data_mapping must be of type ' + str(enums.SourceDataMapping)) if type(bit_order) is not enums.BitOrder: - raise TypeError( - "Parameter bit_order must be of type " + str(enums.BitOrder) - ) + raise TypeError('Parameter bit_order must be of type ' + str(enums.BitOrder)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - waveform_name_ctype = ctypes.create_string_buffer( - waveform_name.encode(self._encoding) - ) # case C020 + pin_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 data_mapping_ctype = _visatype.ViInt32(data_mapping.value) # case S130 sample_width_ctype = _visatype.ViUInt32(sample_width) # case S150 bit_order_ctype = _visatype.ViInt32(bit_order.value) # case S130 - error_code = self._library.niDigital_CreateSourceWaveformSerial( - vi_ctype, - pin_list_ctype, - waveform_name_ctype, - data_mapping_ctype, - sample_width_ctype, - bit_order_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_CreateSourceWaveformSerial(vi_ctype, pin_list_ctype, waveform_name_ctype, data_mapping_ctype, sample_width_ctype, bit_order_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def disable_sites(self): - r"""disable_sites + r'''disable_sites Disables specified sites. Disabled sites are not included in pattern bursts initiated by the initiate method or the burst_pattern method, even if the site is specified in the list of pattern burst sites in configure_pattern_burst_sites method or in the repeated capabilities for the burst_pattern method. Additionally, if you specify a list of pin or pin group names in repeated capabilities in any NI-Digital method, digital pattern instrument channels mapped to disabled sites are not affected by the method. The methods that return per-pin data, such as the ppmu_measure method, do not return data for channels mapped to disabled sites. The digital pattern instrument channels mapped to the sites specified are left in their current state. NI TestStand Semiconductor Module requires all sites to always be enabled, and manages the set of active sites without disabling the sites in the digital instrument session. Do not use this method with the Semiconductor Module. @@ -2402,20 +2031,16 @@ def disable_sites(self): To call the method on all sites, you can call it directly on the :py:class:`nidigital.Session`. Example: :py:meth:`my_session.disable_sites` - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + site_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 error_code = self._library.niDigital_DisableSites(vi_ctype, site_list_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def enable_sites(self): - r"""enable_sites + r'''enable_sites Enables the sites you specify. All sites are enabled by default. @@ -2429,26 +2054,16 @@ def enable_sites(self): To call the method on all sites, you can call it directly on the :py:class:`nidigital.Session`. Example: :py:meth:`my_session.enable_sites` - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + site_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 error_code = self._library.niDigital_EnableSites(vi_ctype, site_list_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def burst_pattern( - self, - start_label, - select_digital_function=True, - wait_until_done=True, - timeout=hightime.timedelta(seconds=10.0), - ): - """burst_pattern + def burst_pattern(self, start_label, select_digital_function=True, wait_until_done=True, timeout=hightime.timedelta(seconds=10.0)): + '''burst_pattern Uses the start_label you specify to burst the pattern on the sites you specify. If you specify wait_until_done as True, waits for the burst to complete, and returns comparison results for each site. @@ -2481,10 +2096,8 @@ def burst_pattern( pass_fail ({ int: bool, int: bool, ... }): Dictionary where each key is a site number and value is pass/fail, if wait_until_done is specified as True. Else, None. - """ - self._burst_pattern( - start_label, select_digital_function, wait_until_done, timeout - ) + ''' + self._burst_pattern(start_label, select_digital_function, wait_until_done, timeout) if wait_until_done: return self.get_site_pass_fail() @@ -2492,10 +2105,8 @@ def burst_pattern( return None @ivi_synchronized - def fetch_capture_waveform( - self, waveform_name, samples_to_read, timeout=hightime.timedelta(seconds=10.0) - ): - """fetch_capture_waveform + def fetch_capture_waveform(self, waveform_name, samples_to_read, timeout=hightime.timedelta(seconds=10.0)): + '''fetch_capture_waveform Returns dictionary where each key is a site number and value is a collection of digital states representing capture waveform data @@ -2521,17 +2132,11 @@ def fetch_capture_waveform( Returns: waveform ({ int: memoryview of array.array of unsigned int, int: memoryview of array.array of unsigned int, ... }): Dictionary where each key is a site number and value is a collection of digital states representing capture waveform data - """ - ( - data, - actual_num_waveforms, - actual_samples_per_waveform, - ) = self._fetch_capture_waveform(waveform_name, samples_to_read, timeout) + ''' + data, actual_num_waveforms, actual_samples_per_waveform = self._fetch_capture_waveform(waveform_name, samples_to_read, timeout) # Get the site list - site_list = self._get_site_results_site_numbers( - enums._SiteResultType.CAPTURE_WAVEFORM - ) + site_list = self._get_site_results_site_numbers(enums._SiteResultType.CAPTURE_WAVEFORM) assert len(site_list) == actual_num_waveforms waveforms = {} @@ -2552,75 +2157,27 @@ def _fetch_capture_waveform(self, waveform_name, samples_to_read, timeout): # the (modified) line below # Also, we want to return the two sized that normally wouldn't be returned vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - waveform_name_ctype = ctypes.create_string_buffer( - waveform_name.encode(self._encoding) - ) # case C020 + site_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 samples_to_read_ctype = _visatype.ViInt32(samples_to_read) # case S150 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64( - timeout - ) # case S140 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 data_buffer_size_ctype = _visatype.ViInt32(0) # case S190 data_ctype = None # case B610 actual_num_waveforms_ctype = _visatype.ViInt32() # case S220 actual_samples_per_waveform_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_FetchCaptureWaveformU32( - vi_ctype, - site_list_ctype, - waveform_name_ctype, - samples_to_read_ctype, - timeout_ctype, - data_buffer_size_ctype, - data_ctype, - None - if actual_num_waveforms_ctype is None - else (ctypes.pointer(actual_num_waveforms_ctype)), - None - if actual_samples_per_waveform_ctype is None - else (ctypes.pointer(actual_samples_per_waveform_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) - data_buffer_size_ctype = _visatype.ViInt32( - actual_num_waveforms_ctype.value * actual_samples_per_waveform_ctype.value - ) # case S200 (modified) - data_size = ( - actual_num_waveforms_ctype.value * actual_samples_per_waveform_ctype.value - ) # case B620 (modified) + error_code = self._library.niDigital_FetchCaptureWaveformU32(vi_ctype, site_list_ctype, waveform_name_ctype, samples_to_read_ctype, timeout_ctype, data_buffer_size_ctype, data_ctype, None if actual_num_waveforms_ctype is None else (ctypes.pointer(actual_num_waveforms_ctype)), None if actual_samples_per_waveform_ctype is None else (ctypes.pointer(actual_samples_per_waveform_ctype))) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + data_buffer_size_ctype = _visatype.ViInt32(actual_num_waveforms_ctype.value * actual_samples_per_waveform_ctype.value) # case S200 (modified) + data_size = actual_num_waveforms_ctype.value * actual_samples_per_waveform_ctype.value # case B620 (modified) data_array = array.array("L", [0] * data_size) # case B620 - data_ctype = get_ctypes_pointer_for_buffer( - value=data_array, library_type=_visatype.ViUInt32 - ) # case B620 - error_code = self._library.niDigital_FetchCaptureWaveformU32( - vi_ctype, - site_list_ctype, - waveform_name_ctype, - samples_to_read_ctype, - timeout_ctype, - data_buffer_size_ctype, - data_ctype, - None - if actual_num_waveforms_ctype is None - else (ctypes.pointer(actual_num_waveforms_ctype)), - None - if actual_samples_per_waveform_ctype is None - else (ctypes.pointer(actual_samples_per_waveform_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return ( - data_array, - actual_num_waveforms_ctype.value, - actual_samples_per_waveform_ctype.value, - ) # (modified) + data_ctype = get_ctypes_pointer_for_buffer(value=data_array, library_type=_visatype.ViUInt32) # case B620 + error_code = self._library.niDigital_FetchCaptureWaveformU32(vi_ctype, site_list_ctype, waveform_name_ctype, samples_to_read_ctype, timeout_ctype, data_buffer_size_ctype, data_ctype, None if actual_num_waveforms_ctype is None else (ctypes.pointer(actual_num_waveforms_ctype)), None if actual_samples_per_waveform_ctype is None else (ctypes.pointer(actual_samples_per_waveform_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return data_array, actual_num_waveforms_ctype.value, actual_samples_per_waveform_ctype.value # (modified) @ivi_synchronized def fetch_history_ram_cycle_information(self, position, samples_to_read): - """fetch_history_ram_cycle_information + '''fetch_history_ram_cycle_information Returns the pattern information acquired for the specified cycles. @@ -2709,56 +2266,41 @@ def fetch_history_ram_cycle_information(self, position, samples_to_read): Length of the outer list will be equal to the value of edge multiplier for the given vector. Length of the inner list will be equal to the number of pins requested. - """ + ''' # Extract the site number and pin list from repeated capability - repeated_capability_lists = ( - _converters.convert_chained_repeated_capability_to_parts( - self._repeated_capability - ) - ) + repeated_capability_lists = _converters.convert_chained_repeated_capability_to_parts(self._repeated_capability) site = repeated_capability_lists[0] - if not site.startswith("site"): - raise ValueError( - "Site number on which to retrieve pattern information must be specified via sites repeated capability." - ) - pins = ( - "" if len(repeated_capability_lists) == 1 else repeated_capability_lists[1] - ) + if not site.startswith('site'): + raise ValueError('Site number on which to retrieve pattern information must be specified via sites repeated capability.') + pins = '' if len(repeated_capability_lists) == 1 else repeated_capability_lists[1] # Put site back into repeated capability container; it will be used by other # sites-rep-cap-based methods that will be called later. self._repeated_capability = site if position < 0: - raise ValueError("position should be greater than or equal to 0.") + raise ValueError('position should be greater than or equal to 0.') if samples_to_read < -1: - raise ValueError("samples_to_read should be greater than or equal to -1.") + raise ValueError('samples_to_read should be greater than or equal to -1.') # site is passed as repeated capability samples_available = self.get_history_ram_sample_count() if position > samples_available: - raise ValueError( - "position: Specified value = {0}, Maximum value = {1}.".format( - position, samples_available - 1 - ) - ) + raise ValueError('position: Specified value = {0}, Maximum value = {1}.'.format(position, samples_available - 1)) if samples_to_read == -1: with _NoChannel(session=self): if not self.history_ram_number_of_samples_is_finite: raise RuntimeError( - "Specifying -1 to fetch all History RAM samples is not supported when the digital pattern instrument is " - "configured for continuous History RAM acquisition. You must specify an exact number of samples to fetch." - ) + 'Specifying -1 to fetch all History RAM samples is not supported when the digital pattern instrument is ' + 'configured for continuous History RAM acquisition. You must specify an exact number of samples to fetch.') samples_to_read = samples_available - position if position + samples_to_read > samples_available: raise ValueError( - "position: Specified value = {0}, samples_to_read: Specified value = {1}; Samples available = {2}.".format( - position, samples_to_read, samples_available - position - ) - ) + 'position: Specified value = {0}, samples_to_read: Specified value = {1}; Samples available = {2}.' + .format(position, samples_to_read, samples_available - position)) pattern_names = {} time_set_names = {} @@ -2766,13 +2308,7 @@ def fetch_history_ram_cycle_information(self, position, samples_to_read): for _ in range(samples_to_read): # site is passed as repeated capability - ( - pattern_index, - time_set_index, - vector_number, - cycle_number, - num_dut_cycles, - ) = self._fetch_history_ram_cycle_information(position) + pattern_index, time_set_index, vector_number, cycle_number, num_dut_cycles = self._fetch_history_ram_cycle_information(position) if pattern_index not in pattern_names: # Repeated capability is not used @@ -2792,36 +2328,27 @@ def fetch_history_ram_cycle_information(self, position, samples_to_read): vector_per_pin_pass_fail = [] for dut_cycle_index in range(num_dut_cycles): # site is passed as repeated capability - ( - cycle_expected_pin_states, - cycle_actual_pin_states, - cycle_per_pin_pass_fail, - ) = self._fetch_history_ram_cycle_pin_data( - pins, position, dut_cycle_index - ) + cycle_expected_pin_states, cycle_actual_pin_states, cycle_per_pin_pass_fail = self._fetch_history_ram_cycle_pin_data(pins, position, dut_cycle_index) vector_expected_pin_states.append(cycle_expected_pin_states) vector_actual_pin_states.append(cycle_actual_pin_states) vector_per_pin_pass_fail.append(cycle_per_pin_pass_fail) - cycle_infos.append( - history_ram_cycle_information.HistoryRAMCycleInformation( - pattern_name=pattern_name, - time_set_name=time_set_name, - vector_number=vector_number, - cycle_number=cycle_number, - scan_cycle_number=scan_cycle_number, - expected_pin_states=vector_expected_pin_states, - actual_pin_states=vector_actual_pin_states, - per_pin_pass_fail=vector_per_pin_pass_fail, - ) - ) + cycle_infos.append(history_ram_cycle_information.HistoryRAMCycleInformation( + pattern_name=pattern_name, + time_set_name=time_set_name, + vector_number=vector_number, + cycle_number=cycle_number, + scan_cycle_number=scan_cycle_number, + expected_pin_states=vector_expected_pin_states, + actual_pin_states=vector_actual_pin_states, + per_pin_pass_fail=vector_per_pin_pass_fail)) position += 1 return cycle_infos @ivi_synchronized def get_pin_results_pin_information(self): - """get_pin_results_pin_information + '''get_pin_results_pin_information Returns the pin names, site numbers, and channel names that correspond to per-pin data read from the digital pattern instrument. The method returns pin information in the same order as values read using the read_static method, ppmu_measure method, and get_fail_count method. Use this method to match values the previously listed methods return with pins, sites, and instrument channels. @@ -2843,47 +2370,26 @@ def get_pin_results_pin_information(self): - **site_number** (int) - **channel_name** (str) - """ + ''' import collections + PinInfo = collections.namedtuple('PinInformation', ['pin_name', 'site_number', 'channel_name']) - PinInfo = collections.namedtuple( - "PinInformation", ["pin_name", "site_number", "channel_name"] - ) - - ( - pin_indexes, - site_numbers, - channel_indexes, - ) = self._get_pin_results_pin_information() - assert len(pin_indexes) == len( - site_numbers - ), "length of returned arrays don't match" - assert len(pin_indexes) == len( - channel_indexes - ), "length of returned arrays don't match" + pin_indexes, site_numbers, channel_indexes = self._get_pin_results_pin_information() + assert len(pin_indexes) == len(site_numbers), "length of returned arrays don't match" + assert len(pin_indexes) == len(channel_indexes), "length of returned arrays don't match" pin_infos = [] for i in range(len(pin_indexes)): - pin_name = ( - "" if pin_indexes[i] == -1 else self._get_pin_name(pin_indexes[i]) - ) - channel_names = self.get_channel_names( - channel_indexes[i] - 1 - ) # channel_indexes are 1-based + pin_name = "" if pin_indexes[i] == -1 else self._get_pin_name(pin_indexes[i]) + channel_names = self.get_channel_names(channel_indexes[i] - 1) # channel_indexes are 1-based assert 1 == len(channel_names) - pin_infos.append( - PinInfo( - pin_name=pin_name, - site_number=site_numbers[i], - channel_name=channel_names[0], - ) - ) + pin_infos.append(PinInfo(pin_name=pin_name, site_number=site_numbers[i], channel_name=channel_names[0])) return pin_infos @ivi_synchronized def get_site_pass_fail(self): - """get_site_pass_fail + '''get_site_pass_fail Returns dictionary where each key is a site number and value is pass/fail @@ -2901,7 +2407,7 @@ def get_site_pass_fail(self): Returns: pass_fail ({ int: bool, int: bool, ... }): Dictionary where each key is a site number and value is pass/fail - """ + ''' # For site_list, we just use the repeated capability result_list = self._get_site_pass_fail() site_list = self._get_site_results_site_numbers(enums._SiteResultType.PASS_FAIL) @@ -2911,7 +2417,7 @@ def get_site_pass_fail(self): @ivi_synchronized def _fetch_history_ram_cycle_information(self, sample_index): - r"""_fetch_history_ram_cycle_information + r'''_fetch_history_ram_cycle_information Gets the per-cycle pattern information acquired for the specified cycle. @@ -2941,53 +2447,22 @@ def _fetch_history_ram_cycle_information(self, sample_index): num_dut_cycles (int): The returned number of DUT cycles contained in the cycle acquired by this History RAM sample. This is only needed if the pattern uses the edge multiplier feature. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + site_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 sample_index_ctype = _visatype.ViInt64(sample_index) # case S150 pattern_index_ctype = _visatype.ViInt32() # case S220 time_set_index_ctype = _visatype.ViInt32() # case S220 vector_number_ctype = _visatype.ViInt64() # case S220 cycle_number_ctype = _visatype.ViInt64() # case S220 num_dut_cycles_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_FetchHistoryRAMCycleInformation( - vi_ctype, - site_ctype, - sample_index_ctype, - None - if pattern_index_ctype is None - else (ctypes.pointer(pattern_index_ctype)), - None - if time_set_index_ctype is None - else (ctypes.pointer(time_set_index_ctype)), - None - if vector_number_ctype is None - else (ctypes.pointer(vector_number_ctype)), - None - if cycle_number_ctype is None - else (ctypes.pointer(cycle_number_ctype)), - None - if num_dut_cycles_ctype is None - else (ctypes.pointer(num_dut_cycles_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return ( - int(pattern_index_ctype.value), - int(time_set_index_ctype.value), - int(vector_number_ctype.value), - int(cycle_number_ctype.value), - int(num_dut_cycles_ctype.value), - ) + error_code = self._library.niDigital_FetchHistoryRAMCycleInformation(vi_ctype, site_ctype, sample_index_ctype, None if pattern_index_ctype is None else (ctypes.pointer(pattern_index_ctype)), None if time_set_index_ctype is None else (ctypes.pointer(time_set_index_ctype)), None if vector_number_ctype is None else (ctypes.pointer(vector_number_ctype)), None if cycle_number_ctype is None else (ctypes.pointer(cycle_number_ctype)), None if num_dut_cycles_ctype is None else (ctypes.pointer(num_dut_cycles_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return int(pattern_index_ctype.value), int(time_set_index_ctype.value), int(vector_number_ctype.value), int(cycle_number_ctype.value), int(num_dut_cycles_ctype.value) @ivi_synchronized - def _fetch_history_ram_cycle_pin_data( - self, pin_list, sample_index, dut_cycle_index - ): - r"""_fetch_history_ram_cycle_pin_data + def _fetch_history_ram_cycle_pin_data(self, pin_list, sample_index, dut_cycle_index): + r'''_fetch_history_ram_cycle_pin_data Gets the per-pin pattern data acquired for the specified cycle. @@ -3020,14 +2495,10 @@ def _fetch_history_ram_cycle_pin_data( per_pin_pass_fail (list of bool): The returned pass fail information for pins in the order specified in **pinList**. Pins without defined edges in the specified DUT cycle will return pass (True). - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - pin_list_ctype = ctypes.create_string_buffer( - pin_list.encode(self._encoding) - ) # case C020 + site_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + pin_list_ctype = ctypes.create_string_buffer(pin_list.encode(self._encoding)) # case C020 sample_index_ctype = _visatype.ViInt64(sample_index) # case S150 dut_cycle_index_ctype = _visatype.ViInt32(dut_cycle_index) # case S150 pin_data_buffer_size_ctype = _visatype.ViInt32(0) # case S190 @@ -3035,73 +2506,22 @@ def _fetch_history_ram_cycle_pin_data( actual_pin_states_ctype = None # case B610 per_pin_pass_fail_ctype = None # case B610 actual_num_pin_data_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_FetchHistoryRAMCyclePinData( - vi_ctype, - site_ctype, - pin_list_ctype, - sample_index_ctype, - dut_cycle_index_ctype, - pin_data_buffer_size_ctype, - expected_pin_states_ctype, - actual_pin_states_ctype, - per_pin_pass_fail_ctype, - None - if actual_num_pin_data_ctype is None - else (ctypes.pointer(actual_num_pin_data_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) - pin_data_buffer_size_ctype = _visatype.ViInt32( - actual_num_pin_data_ctype.value - ) # case S200 + error_code = self._library.niDigital_FetchHistoryRAMCyclePinData(vi_ctype, site_ctype, pin_list_ctype, sample_index_ctype, dut_cycle_index_ctype, pin_data_buffer_size_ctype, expected_pin_states_ctype, actual_pin_states_ctype, per_pin_pass_fail_ctype, None if actual_num_pin_data_ctype is None else (ctypes.pointer(actual_num_pin_data_ctype))) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + pin_data_buffer_size_ctype = _visatype.ViInt32(actual_num_pin_data_ctype.value) # case S200 expected_pin_states_size = actual_num_pin_data_ctype.value # case B620 - expected_pin_states_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViUInt8, size=expected_pin_states_size - ) # case B620 + expected_pin_states_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViUInt8, size=expected_pin_states_size) # case B620 actual_pin_states_size = actual_num_pin_data_ctype.value # case B620 - actual_pin_states_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViUInt8, size=actual_pin_states_size - ) # case B620 + actual_pin_states_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViUInt8, size=actual_pin_states_size) # case B620 per_pin_pass_fail_size = actual_num_pin_data_ctype.value # case B620 - per_pin_pass_fail_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViBoolean, size=per_pin_pass_fail_size - ) # case B620 - error_code = self._library.niDigital_FetchHistoryRAMCyclePinData( - vi_ctype, - site_ctype, - pin_list_ctype, - sample_index_ctype, - dut_cycle_index_ctype, - pin_data_buffer_size_ctype, - expected_pin_states_ctype, - actual_pin_states_ctype, - per_pin_pass_fail_ctype, - None - if actual_num_pin_data_ctype is None - else (ctypes.pointer(actual_num_pin_data_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return ( - [ - enums.PinState(expected_pin_states_ctype[i]) - for i in range(pin_data_buffer_size_ctype.value) - ], - [ - enums.PinState(actual_pin_states_ctype[i]) - for i in range(pin_data_buffer_size_ctype.value) - ], - [ - bool(per_pin_pass_fail_ctype[i]) - for i in range(pin_data_buffer_size_ctype.value) - ], - ) + per_pin_pass_fail_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViBoolean, size=per_pin_pass_fail_size) # case B620 + error_code = self._library.niDigital_FetchHistoryRAMCyclePinData(vi_ctype, site_ctype, pin_list_ctype, sample_index_ctype, dut_cycle_index_ctype, pin_data_buffer_size_ctype, expected_pin_states_ctype, actual_pin_states_ctype, per_pin_pass_fail_ctype, None if actual_num_pin_data_ctype is None else (ctypes.pointer(actual_num_pin_data_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return [enums.PinState(expected_pin_states_ctype[i]) for i in range(pin_data_buffer_size_ctype.value)], [enums.PinState(actual_pin_states_ctype[i]) for i in range(pin_data_buffer_size_ctype.value)], [bool(per_pin_pass_fail_ctype[i]) for i in range(pin_data_buffer_size_ctype.value)] @ivi_synchronized def _fetch_history_ram_scan_cycle_number(self, sample_index): - r"""_fetch_history_ram_scan_cycle_number + r'''_fetch_history_ram_scan_cycle_number Fetches the History RAM Scan Cycle Number for the sample index. If the sample is not from a scan vector, the scan cycle number will be returned as -1. @@ -3123,29 +2543,18 @@ def _fetch_history_ram_scan_cycle_number(self, sample_index): Returns: scan_cycle_number (int): Returns the scan cycle number acquired by this History RAM sample. Scan cycle numbers start at 0 from the first cycle of the scan vector. Scan cycle numbers are -1 for cycles that do not have a scan opcode. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + site_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 sample_index_ctype = _visatype.ViInt64(sample_index) # case S150 scan_cycle_number_ctype = _visatype.ViInt64() # case S220 - error_code = self._library.niDigital_FetchHistoryRAMScanCycleNumber( - vi_ctype, - site_ctype, - sample_index_ctype, - None - if scan_cycle_number_ctype is None - else (ctypes.pointer(scan_cycle_number_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_FetchHistoryRAMScanCycleNumber(vi_ctype, site_ctype, sample_index_ctype, None if scan_cycle_number_ctype is None else (ctypes.pointer(scan_cycle_number_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(scan_cycle_number_ctype.value) @ivi_synchronized def frequency_counter_measure_frequency(self): - r"""frequency_counter_measure_frequency + r'''frequency_counter_measure_frequency Measures the frequency on the specified channel(s) over the specified measurement time. All channels in the repeated capabilities should have the same measurement time. @@ -3163,53 +2572,24 @@ def frequency_counter_measure_frequency(self): Returns: frequencies (list of float): The returned frequency counter measurement, in Hz.This method returns -1 if the measurement is invalid for the channel. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 frequencies_buffer_size_ctype = _visatype.ViInt32(0) # case S190 frequencies_ctype = None # case B610 actual_num_frequencies_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_FrequencyCounter_MeasureFrequency( - vi_ctype, - channel_list_ctype, - frequencies_buffer_size_ctype, - frequencies_ctype, - None - if actual_num_frequencies_ctype is None - else (ctypes.pointer(actual_num_frequencies_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) - frequencies_buffer_size_ctype = _visatype.ViInt32( - actual_num_frequencies_ctype.value - ) # case S200 + error_code = self._library.niDigital_FrequencyCounter_MeasureFrequency(vi_ctype, channel_list_ctype, frequencies_buffer_size_ctype, frequencies_ctype, None if actual_num_frequencies_ctype is None else (ctypes.pointer(actual_num_frequencies_ctype))) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + frequencies_buffer_size_ctype = _visatype.ViInt32(actual_num_frequencies_ctype.value) # case S200 frequencies_size = actual_num_frequencies_ctype.value # case B620 - frequencies_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViReal64, size=frequencies_size - ) # case B620 - error_code = self._library.niDigital_FrequencyCounter_MeasureFrequency( - vi_ctype, - channel_list_ctype, - frequencies_buffer_size_ctype, - frequencies_ctype, - None - if actual_num_frequencies_ctype is None - else (ctypes.pointer(actual_num_frequencies_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return [ - float(frequencies_ctype[i]) - for i in range(frequencies_buffer_size_ctype.value) - ] + frequencies_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=frequencies_size) # case B620 + error_code = self._library.niDigital_FrequencyCounter_MeasureFrequency(vi_ctype, channel_list_ctype, frequencies_buffer_size_ctype, frequencies_ctype, None if actual_num_frequencies_ctype is None else (ctypes.pointer(actual_num_frequencies_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return [float(frequencies_ctype[i]) for i in range(frequencies_buffer_size_ctype.value)] @ivi_synchronized def _get_attribute_vi_boolean(self, attribute): - r"""_get_attribute_vi_boolean + r'''_get_attribute_vi_boolean Queries the value of a ViBoolean property. Use this method to get the values of digital pattern instrument-specific properties and inherent IVI properties. @@ -3231,27 +2611,18 @@ def _get_attribute_vi_boolean(self, attribute): Returns: value (bool): The returned current value of the property; pass the address of a ViBoolean variable. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 value_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niDigital_GetAttributeViBoolean( - vi_ctype, - channel_name_ctype, - attribute_ctype, - None if value_ctype is None else (ctypes.pointer(value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_GetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(value_ctype.value) @ivi_synchronized def _get_attribute_vi_int32(self, attribute): - r"""_get_attribute_vi_int32 + r'''_get_attribute_vi_int32 Queries the value of a ViInt32 property. Use this method to get the values of digital pattern instrument-specific properties and inherent IVI properties. @@ -3273,27 +2644,18 @@ def _get_attribute_vi_int32(self, attribute): Returns: value (int): The returned current value of the property; pass the address of a ViInt32 variable. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 value_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_GetAttributeViInt32( - vi_ctype, - channel_name_ctype, - attribute_ctype, - None if value_ctype is None else (ctypes.pointer(value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_GetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(value_ctype.value) @ivi_synchronized def _get_attribute_vi_int64(self, attribute): - r"""_get_attribute_vi_int64 + r'''_get_attribute_vi_int64 Queries the value of a ViInt64 property. Use this method to get the values of digital pattern instrument-specific properties and inherent IVI properties. @@ -3315,27 +2677,18 @@ def _get_attribute_vi_int64(self, attribute): Returns: value (int): The returned current value of the property; pass the address of a ViInt64 variable. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 value_ctype = _visatype.ViInt64() # case S220 - error_code = self._library.niDigital_GetAttributeViInt64( - vi_ctype, - channel_name_ctype, - attribute_ctype, - None if value_ctype is None else (ctypes.pointer(value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_GetAttributeViInt64(vi_ctype, channel_name_ctype, attribute_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(value_ctype.value) @ivi_synchronized def _get_attribute_vi_real64(self, attribute): - r"""_get_attribute_vi_real64 + r'''_get_attribute_vi_real64 This method queries the value of a ViReal64 property. Use this method to get the values of digital pattern instrument-specific properties and inherent IVI properties. @@ -3357,27 +2710,18 @@ def _get_attribute_vi_real64(self, attribute): Returns: value (float): The returned current value of the property; pass the address of a ViReal64 variable. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 value_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDigital_GetAttributeViReal64( - vi_ctype, - channel_name_ctype, - attribute_ctype, - None if value_ctype is None else (ctypes.pointer(value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_GetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(value_ctype.value) @ivi_synchronized def _get_attribute_vi_string(self, attribute): - r"""_get_attribute_vi_string + r'''_get_attribute_vi_string Queries the value of a ViString property. Use this method to get the values of digital pattern instrument-specific properties and inherent IVI properties. You must provide a ViChar array to serve as a buffer for the value. You pass the number of bytes in the buffer as the **bufferSize**. If the current value of the property, including the terminating NULL byte, is larger than the size you indicate in the **bufferSize**, the method copies (bufferSize - 1) bytes into the buffer, places an ASCII NULL byte at the end of the buffer, and returns the **bufferSize** you must pass to get the entire value. For example, if the value is "123456" and the **bufferSize** is 4, the method places "123" into the buffer and returns 7. If you want to call this method just to get the required buffer size, you can pass 0 for the **bufferSize** and VI_NULL for the value. @@ -3399,41 +2743,23 @@ def _get_attribute_vi_string(self, attribute): Returns: value (str): The buffer in which the method returns the current value of the property; the buffer must be of type ViChar and have at least as many bytes as indicated in the **bufferSize**. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 buffer_size_ctype = _visatype.ViInt32() # case S170 value_ctype = None # case C050 - error_code = self._library.niDigital_GetAttributeViString( - vi_ctype, - channel_name_ctype, - attribute_ctype, - buffer_size_ctype, - value_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niDigital_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_ctype, buffer_size_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 value_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niDigital_GetAttributeViString( - vi_ctype, - channel_name_ctype, - attribute_ctype, - buffer_size_ctype, - value_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_ctype, buffer_size_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return value_ctype.value.decode(self._encoding) @ivi_synchronized def get_channel_names(self, indices): - r"""get_channel_names + r'''get_channel_names Returns a list of channel names for given channel indices. @@ -3450,35 +2776,21 @@ def get_channel_names(self, indices): Returns: names (list of str): The channel name(s) at the specified indices. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - indices_ctype = ctypes.create_string_buffer( - _converters.convert_repeated_capabilities_without_prefix(indices).encode( - self._encoding - ) - ) # case C040 + indices_ctype = ctypes.create_string_buffer(_converters.convert_repeated_capabilities_without_prefix(indices).encode(self._encoding)) # case C040 name_buffer_size_ctype = _visatype.ViInt32() # case S170 names_ctype = None # case C050 - error_code = self._library.niDigital_GetChannelNameFromString( - vi_ctype, indices_ctype, name_buffer_size_ctype, names_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niDigital_GetChannelNameFromString(vi_ctype, indices_ctype, name_buffer_size_ctype, names_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) name_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 names_ctype = (_visatype.ViChar * name_buffer_size_ctype.value)() # case C060 - error_code = self._library.niDigital_GetChannelNameFromString( - vi_ctype, indices_ctype, name_buffer_size_ctype, names_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return _converters.convert_comma_separated_string_to_list( - names_ctype.value.decode(self._encoding) - ) + error_code = self._library.niDigital_GetChannelNameFromString(vi_ctype, indices_ctype, name_buffer_size_ctype, names_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return _converters.convert_comma_separated_string_to_list(names_ctype.value.decode(self._encoding)) def _get_error(self): - r"""_get_error + r'''_get_error Returns the error information associated with the digital pattern instrument handle. This method retrieves and then clears the error information for the session. If **vi** is VI_NULL, this method retrieves and then clears the error information for the current thread. You must provide a ViChar array to serve as a buffer for the value. You pass the number of bytes in the buffer as the buffer size. If the current value of the error description, including the terminating NULL byte, is larger than the size you indicate in the buffer size, the method copies (buffer size -1) bytes into the buffer, places an ASCII NULL byte at the end of the buffer, and returns the buffer size you must pass to get the entire value. For example, if the value is "123456" and the buffer size is 4, the method places "123" into the buffer and returns 7. If you want to call this method just to get the required buffer size, you can pass 0 for the buffer size and VI_NULL for **errorDescription**. @@ -3489,40 +2801,22 @@ def _get_error(self): If there is no description, the method returns an empty string. The buffer must contain at least as many elements as the value you specify with the buffer size parameter. If you pass 0 for **errorDescriptionBufferSize**, you can pass VI_NULL for this parameter. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus() # case S220 error_description_buffer_size_ctype = _visatype.ViInt32() # case S170 error_description_ctype = None # case C050 - error_code = self._library.niDigital_GetError( - vi_ctype, - None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), - error_description_buffer_size_ctype, - error_description_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=True - ) + error_code = self._library.niDigital_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), error_description_buffer_size_ctype, error_description_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True) error_description_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - error_description_ctype = ( - _visatype.ViChar * error_description_buffer_size_ctype.value - )() # case C060 - error_code = self._library.niDigital_GetError( - vi_ctype, - None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), - error_description_buffer_size_ctype, - error_description_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) - return int(error_code_ctype.value), error_description_ctype.value.decode( - self._encoding - ) + error_description_ctype = (_visatype.ViChar * error_description_buffer_size_ctype.value)() # case C060 + error_code = self._library.niDigital_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), error_description_buffer_size_ctype, error_description_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + return int(error_code_ctype.value), error_description_ctype.value.decode(self._encoding) @ivi_synchronized def get_fail_count(self): - r"""get_fail_count + r'''get_fail_count Returns the comparison fail count for pins in the repeated capabilities. @@ -3540,48 +2834,24 @@ def get_fail_count(self): Returns: failure_count (list of int): Number of failures in an array. If a site is disabled or not enabled for burst, the method does not return data for that site. You can also use the get_pin_results_pin_information method to obtain a sorted list of returned sites and channels. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 buffer_size_ctype = _visatype.ViInt32(0) # case S190 failure_count_ctype = None # case B610 actual_num_read_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_GetFailCount( - vi_ctype, - channel_list_ctype, - buffer_size_ctype, - failure_count_ctype, - None - if actual_num_read_ctype is None - else (ctypes.pointer(actual_num_read_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niDigital_GetFailCount(vi_ctype, channel_list_ctype, buffer_size_ctype, failure_count_ctype, None if actual_num_read_ctype is None else (ctypes.pointer(actual_num_read_ctype))) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) buffer_size_ctype = _visatype.ViInt32(actual_num_read_ctype.value) # case S200 failure_count_size = actual_num_read_ctype.value # case B620 - failure_count_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViInt64, size=failure_count_size - ) # case B620 - error_code = self._library.niDigital_GetFailCount( - vi_ctype, - channel_list_ctype, - buffer_size_ctype, - failure_count_ctype, - None - if actual_num_read_ctype is None - else (ctypes.pointer(actual_num_read_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + failure_count_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViInt64, size=failure_count_size) # case B620 + error_code = self._library.niDigital_GetFailCount(vi_ctype, channel_list_ctype, buffer_size_ctype, failure_count_ctype, None if actual_num_read_ctype is None else (ctypes.pointer(actual_num_read_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return [int(failure_count_ctype[i]) for i in range(buffer_size_ctype.value)] @ivi_synchronized def get_history_ram_sample_count(self): - r"""get_history_ram_sample_count + r'''get_history_ram_sample_count Returns the number of samples History RAM acquired on the last pattern burst. @@ -3624,27 +2894,17 @@ def get_history_ram_sample_count(self): Returns: sample_count (int): The returned number of samples that History RAM acquired. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + site_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 sample_count_ctype = _visatype.ViInt64() # case S220 - error_code = self._library.niDigital_GetHistoryRAMSampleCount( - vi_ctype, - site_ctype, - None - if sample_count_ctype is None - else (ctypes.pointer(sample_count_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_GetHistoryRAMSampleCount(vi_ctype, site_ctype, None if sample_count_ctype is None else (ctypes.pointer(sample_count_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(sample_count_ctype.value) @ivi_synchronized def _get_pattern_name(self, pattern_index): - r"""_get_pattern_name + r'''_get_pattern_name TBD @@ -3655,30 +2915,22 @@ def _get_pattern_name(self, pattern_index): Returns: name (str): - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 pattern_index_ctype = _visatype.ViInt32(pattern_index) # case S150 name_buffer_size_ctype = _visatype.ViInt32() # case S170 name_ctype = None # case C050 - error_code = self._library.niDigital_GetPatternName( - vi_ctype, pattern_index_ctype, name_buffer_size_ctype, name_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niDigital_GetPatternName(vi_ctype, pattern_index_ctype, name_buffer_size_ctype, name_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) name_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 name_ctype = (_visatype.ViChar * name_buffer_size_ctype.value)() # case C060 - error_code = self._library.niDigital_GetPatternName( - vi_ctype, pattern_index_ctype, name_buffer_size_ctype, name_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_GetPatternName(vi_ctype, pattern_index_ctype, name_buffer_size_ctype, name_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return name_ctype.value.decode(self._encoding) @ivi_synchronized def _get_pin_name(self, pin_index): - r"""_get_pin_name + r'''_get_pin_name Returns the name of the pin at the index you specify. You must provide a ViChar array to serve as a buffer for the value. You pass the number of bytes in the buffer as the **nameBufferSize**. If the current value of the property, including the terminating NULL byte, is larger than the size you indicate in the buffer size, the method copies (buffer size - 1) bytes into the buffer, places an ASCII NULL byte at the end of the buffer, and returns the buffer size you must pass to get the entire value. For example, if the value is "123456" and the buffer size is 4, the method places "123" into the buffer and returns 7. If you want to call this method just to get the required buffer size, you can pass 0 for **nameBufferSize** and VI_NULL for the name. @@ -3689,30 +2941,22 @@ def _get_pin_name(self, pin_index): Returns: name (str): Returns the pin name at the specified **pinIndex**. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 pin_index_ctype = _visatype.ViInt32(pin_index) # case S150 name_buffer_size_ctype = _visatype.ViInt32() # case S170 name_ctype = None # case C050 - error_code = self._library.niDigital_GetPinName( - vi_ctype, pin_index_ctype, name_buffer_size_ctype, name_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niDigital_GetPinName(vi_ctype, pin_index_ctype, name_buffer_size_ctype, name_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) name_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 name_ctype = (_visatype.ViChar * name_buffer_size_ctype.value)() # case C060 - error_code = self._library.niDigital_GetPinName( - vi_ctype, pin_index_ctype, name_buffer_size_ctype, name_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_GetPinName(vi_ctype, pin_index_ctype, name_buffer_size_ctype, name_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return name_ctype.value.decode(self._encoding) @ivi_synchronized def _get_pin_results_pin_information(self): - r"""_get_pin_results_pin_information + r'''_get_pin_results_pin_information Returns the pin names, site numbers, and channel names that correspond to per-pin data read from the digital pattern instrument. The method returns pin information in the same order as values read using the read_static method, ppmu_measure method, and get_fail_count method. Use this method to match values the previously listed methods return with pins, sites, and instrument channels. @@ -3736,68 +2980,30 @@ def _get_pin_results_pin_information(self): channel_indexes (list of int): The returned index of channels corresponding to data read from the digital pattern instrument using the specified repeated capabilities. If you do not want to use this parameter, pass VI_NULL. Call get_channel_name to get the name of the channel associated with an index. Channel indexes are one-based. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 buffer_size_ctype = _visatype.ViInt32(0) # case S190 pin_indexes_ctype = None # case B610 site_numbers_ctype = None # case B610 channel_indexes_ctype = None # case B610 actual_num_values_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_GetPinResultsPinInformation( - vi_ctype, - channel_list_ctype, - buffer_size_ctype, - pin_indexes_ctype, - site_numbers_ctype, - channel_indexes_ctype, - None - if actual_num_values_ctype is None - else (ctypes.pointer(actual_num_values_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) - buffer_size_ctype = _visatype.ViInt32( - actual_num_values_ctype.value - ) # case S200 + error_code = self._library.niDigital_GetPinResultsPinInformation(vi_ctype, channel_list_ctype, buffer_size_ctype, pin_indexes_ctype, site_numbers_ctype, channel_indexes_ctype, None if actual_num_values_ctype is None else (ctypes.pointer(actual_num_values_ctype))) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + buffer_size_ctype = _visatype.ViInt32(actual_num_values_ctype.value) # case S200 pin_indexes_size = actual_num_values_ctype.value # case B620 - pin_indexes_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViInt32, size=pin_indexes_size - ) # case B620 + pin_indexes_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViInt32, size=pin_indexes_size) # case B620 site_numbers_size = actual_num_values_ctype.value # case B620 - site_numbers_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViInt32, size=site_numbers_size - ) # case B620 + site_numbers_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViInt32, size=site_numbers_size) # case B620 channel_indexes_size = actual_num_values_ctype.value # case B620 - channel_indexes_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViInt32, size=channel_indexes_size - ) # case B620 - error_code = self._library.niDigital_GetPinResultsPinInformation( - vi_ctype, - channel_list_ctype, - buffer_size_ctype, - pin_indexes_ctype, - site_numbers_ctype, - channel_indexes_ctype, - None - if actual_num_values_ctype is None - else (ctypes.pointer(actual_num_values_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return ( - [int(pin_indexes_ctype[i]) for i in range(buffer_size_ctype.value)], - [int(site_numbers_ctype[i]) for i in range(buffer_size_ctype.value)], - [int(channel_indexes_ctype[i]) for i in range(buffer_size_ctype.value)], - ) + channel_indexes_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViInt32, size=channel_indexes_size) # case B620 + error_code = self._library.niDigital_GetPinResultsPinInformation(vi_ctype, channel_list_ctype, buffer_size_ctype, pin_indexes_ctype, site_numbers_ctype, channel_indexes_ctype, None if actual_num_values_ctype is None else (ctypes.pointer(actual_num_values_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return [int(pin_indexes_ctype[i]) for i in range(buffer_size_ctype.value)], [int(site_numbers_ctype[i]) for i in range(buffer_size_ctype.value)], [int(channel_indexes_ctype[i]) for i in range(buffer_size_ctype.value)] @ivi_synchronized def _get_site_pass_fail(self): - r"""_get_site_pass_fail + r'''_get_site_pass_fail Returns the pass or fail results for each site. @@ -3818,52 +3024,24 @@ def _get_site_pass_fail(self): Note: One or more of the referenced methods are not in the Python API for this driver. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + site_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 pass_fail_buffer_size_ctype = _visatype.ViInt32(0) # case S190 pass_fail_ctype = None # case B610 actual_num_sites_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_GetSitePassFail( - vi_ctype, - site_list_ctype, - pass_fail_buffer_size_ctype, - pass_fail_ctype, - None - if actual_num_sites_ctype is None - else (ctypes.pointer(actual_num_sites_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) - pass_fail_buffer_size_ctype = _visatype.ViInt32( - actual_num_sites_ctype.value - ) # case S200 + error_code = self._library.niDigital_GetSitePassFail(vi_ctype, site_list_ctype, pass_fail_buffer_size_ctype, pass_fail_ctype, None if actual_num_sites_ctype is None else (ctypes.pointer(actual_num_sites_ctype))) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + pass_fail_buffer_size_ctype = _visatype.ViInt32(actual_num_sites_ctype.value) # case S200 pass_fail_size = actual_num_sites_ctype.value # case B620 - pass_fail_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViBoolean, size=pass_fail_size - ) # case B620 - error_code = self._library.niDigital_GetSitePassFail( - vi_ctype, - site_list_ctype, - pass_fail_buffer_size_ctype, - pass_fail_ctype, - None - if actual_num_sites_ctype is None - else (ctypes.pointer(actual_num_sites_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return [ - bool(pass_fail_ctype[i]) for i in range(pass_fail_buffer_size_ctype.value) - ] + pass_fail_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViBoolean, size=pass_fail_size) # case B620 + error_code = self._library.niDigital_GetSitePassFail(vi_ctype, site_list_ctype, pass_fail_buffer_size_ctype, pass_fail_ctype, None if actual_num_sites_ctype is None else (ctypes.pointer(actual_num_sites_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return [bool(pass_fail_ctype[i]) for i in range(pass_fail_buffer_size_ctype.value)] @ivi_synchronized def _get_site_results_site_numbers(self, site_result_type): - r"""_get_site_results_site_numbers + r'''_get_site_results_site_numbers Returns the site numbers that correspond to per-site data read from the digital pattern instrument. The method returns site numbers in the same order as values read using the _get_site_pass_fail and fetch_capture_waveform_u32 methods. Use this method to match values the previously listed methods return with site numbers. @@ -3888,61 +3066,27 @@ def _get_site_results_site_numbers(self, site_result_type): Returns: site_numbers (list of int): The returned array of site numbers that correspond to the values specified by **siteResultType**. - """ + ''' if type(site_result_type) is not enums._SiteResultType: - raise TypeError( - "Parameter site_result_type must be of type " - + str(enums._SiteResultType) - ) + raise TypeError('Parameter site_result_type must be of type ' + str(enums._SiteResultType)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + site_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 site_result_type_ctype = _visatype.ViInt32(site_result_type.value) # case S130 site_numbers_buffer_size_ctype = _visatype.ViInt32(0) # case S190 site_numbers_ctype = None # case B610 actual_num_site_numbers_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_GetSiteResultsSiteNumbers( - vi_ctype, - site_list_ctype, - site_result_type_ctype, - site_numbers_buffer_size_ctype, - site_numbers_ctype, - None - if actual_num_site_numbers_ctype is None - else (ctypes.pointer(actual_num_site_numbers_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) - site_numbers_buffer_size_ctype = _visatype.ViInt32( - actual_num_site_numbers_ctype.value - ) # case S200 + error_code = self._library.niDigital_GetSiteResultsSiteNumbers(vi_ctype, site_list_ctype, site_result_type_ctype, site_numbers_buffer_size_ctype, site_numbers_ctype, None if actual_num_site_numbers_ctype is None else (ctypes.pointer(actual_num_site_numbers_ctype))) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + site_numbers_buffer_size_ctype = _visatype.ViInt32(actual_num_site_numbers_ctype.value) # case S200 site_numbers_size = actual_num_site_numbers_ctype.value # case B620 - site_numbers_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViInt32, size=site_numbers_size - ) # case B620 - error_code = self._library.niDigital_GetSiteResultsSiteNumbers( - vi_ctype, - site_list_ctype, - site_result_type_ctype, - site_numbers_buffer_size_ctype, - site_numbers_ctype, - None - if actual_num_site_numbers_ctype is None - else (ctypes.pointer(actual_num_site_numbers_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return [ - int(site_numbers_ctype[i]) - for i in range(site_numbers_buffer_size_ctype.value) - ] + site_numbers_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViInt32, size=site_numbers_size) # case B620 + error_code = self._library.niDigital_GetSiteResultsSiteNumbers(vi_ctype, site_list_ctype, site_result_type_ctype, site_numbers_buffer_size_ctype, site_numbers_ctype, None if actual_num_site_numbers_ctype is None else (ctypes.pointer(actual_num_site_numbers_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return [int(site_numbers_ctype[i]) for i in range(site_numbers_buffer_size_ctype.value)] @ivi_synchronized def get_time_set_drive_format(self, time_set_name): - r"""get_time_set_drive_format + r'''get_time_set_drive_format Returns the drive format of a pin in the specified time set. @@ -3964,29 +3108,18 @@ def get_time_set_drive_format(self, time_set_name): Returns: format (enums.DriveFormat): Returned drive format of the time set for the specified pin. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - time_set_name_ctype = ctypes.create_string_buffer( - time_set_name.encode(self._encoding) - ) # case C020 + pin_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 format_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_GetTimeSetDriveFormat( - vi_ctype, - pin_ctype, - time_set_name_ctype, - None if format_ctype is None else (ctypes.pointer(format_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_GetTimeSetDriveFormat(vi_ctype, pin_ctype, time_set_name_ctype, None if format_ctype is None else (ctypes.pointer(format_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return enums.DriveFormat(format_ctype.value) @ivi_synchronized def get_time_set_edge(self, time_set_name, edge): - r"""get_time_set_edge + r'''get_time_set_edge Returns the edge time of a pin in the specified time set. @@ -4019,35 +3152,21 @@ def get_time_set_edge(self, time_set_name, edge): Returns: time (hightime.timedelta): Time from the beginning of the vector period in which to place the edge. - """ + ''' if type(edge) is not enums.TimeSetEdgeType: - raise TypeError( - "Parameter edge must be of type " + str(enums.TimeSetEdgeType) - ) + raise TypeError('Parameter edge must be of type ' + str(enums.TimeSetEdgeType)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - time_set_name_ctype = ctypes.create_string_buffer( - time_set_name.encode(self._encoding) - ) # case C020 + pin_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 edge_ctype = _visatype.ViInt32(edge.value) # case S130 time_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDigital_GetTimeSetEdge( - vi_ctype, - pin_ctype, - time_set_name_ctype, - edge_ctype, - None if time_ctype is None else (ctypes.pointer(time_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_GetTimeSetEdge(vi_ctype, pin_ctype, time_set_name_ctype, edge_ctype, None if time_ctype is None else (ctypes.pointer(time_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return _converters.convert_seconds_real64_to_timedelta(float(time_ctype.value)) @ivi_synchronized def get_time_set_edge_multiplier(self, time_set_name): - r"""get_time_set_edge_multiplier + r'''get_time_set_edge_multiplier Returns the edge multiplier of the specified time set. @@ -4069,31 +3188,18 @@ def get_time_set_edge_multiplier(self, time_set_name): Returns: edge_multiplier (int): Returned edge multiplier of the time set for the specified pin. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - pin_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - time_set_name_ctype = ctypes.create_string_buffer( - time_set_name.encode(self._encoding) - ) # case C020 + pin_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 edge_multiplier_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_GetTimeSetEdgeMultiplier( - vi_ctype, - pin_ctype, - time_set_name_ctype, - None - if edge_multiplier_ctype is None - else (ctypes.pointer(edge_multiplier_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_GetTimeSetEdgeMultiplier(vi_ctype, pin_ctype, time_set_name_ctype, None if edge_multiplier_ctype is None else (ctypes.pointer(edge_multiplier_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(edge_multiplier_ctype.value) @ivi_synchronized def _get_time_set_name(self, time_set_index): - r"""_get_time_set_name + r'''_get_time_set_name TBD @@ -4104,30 +3210,22 @@ def _get_time_set_name(self, time_set_index): Returns: name (str): - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 time_set_index_ctype = _visatype.ViInt32(time_set_index) # case S150 name_buffer_size_ctype = _visatype.ViInt32() # case S170 name_ctype = None # case C050 - error_code = self._library.niDigital_GetTimeSetName( - vi_ctype, time_set_index_ctype, name_buffer_size_ctype, name_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niDigital_GetTimeSetName(vi_ctype, time_set_index_ctype, name_buffer_size_ctype, name_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) name_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 name_ctype = (_visatype.ViChar * name_buffer_size_ctype.value)() # case C060 - error_code = self._library.niDigital_GetTimeSetName( - vi_ctype, time_set_index_ctype, name_buffer_size_ctype, name_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_GetTimeSetName(vi_ctype, time_set_index_ctype, name_buffer_size_ctype, name_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return name_ctype.value.decode(self._encoding) @ivi_synchronized def is_site_enabled(self): - r"""is_site_enabled + r'''is_site_enabled Checks if a specified site is enabled. @@ -4147,24 +3245,16 @@ def is_site_enabled(self): Returns: enable (bool): Boolean value that returns whether the site is enabled or disabled. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + site_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 enable_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niDigital_IsSiteEnabled( - vi_ctype, - site_ctype, - None if enable_ctype is None else (ctypes.pointer(enable_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_IsSiteEnabled(vi_ctype, site_ctype, None if enable_ctype is None else (ctypes.pointer(enable_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(enable_ctype.value) def lock(self): - """lock + '''lock Obtains a multithread lock on the device session. Before doing so, the software waits until all other execution threads release their locks @@ -4192,27 +3282,25 @@ def lock(self): Returns: lock (context manager): When used in a with statement, nidigital.Session.lock acts as a context manager and unlock will be called when the with block is exited - """ + ''' self._lock_session() # We do not call _lock_session() in the context manager so that this function can # act standalone as well and let the client call unlock() explicitly. If they do use the context manager, # that will handle the unlock for them return _Lock(self) def _lock_session(self): - """_lock_session + '''_lock_session Actual call to driver - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDigital_LockSession(vi_ctype, None) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return @ivi_synchronized def ppmu_measure(self, measurement_type): - r"""ppmu_measure + r'''ppmu_measure Instructs the PPMU to measure voltage or current. This method can be called to take a voltage measurement even if the pin method is not set to PPMU. @@ -4237,56 +3325,27 @@ def ppmu_measure(self, measurement_type): Returns: measurements (list of float): The returned array of measurements in the order you specify in the repeated capabilities. If a site is disabled, the method does not return data for that site. You can also use the get_pin_results_pin_information method to obtain a sorted list of returned sites and channels. - """ + ''' if type(measurement_type) is not enums.PPMUMeasurementType: - raise TypeError( - "Parameter measurement_type must be of type " - + str(enums.PPMUMeasurementType) - ) + raise TypeError('Parameter measurement_type must be of type ' + str(enums.PPMUMeasurementType)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 measurement_type_ctype = _visatype.ViInt32(measurement_type.value) # case S130 buffer_size_ctype = _visatype.ViInt32(0) # case S190 measurements_ctype = None # case B610 actual_num_read_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_PPMU_Measure( - vi_ctype, - channel_list_ctype, - measurement_type_ctype, - buffer_size_ctype, - measurements_ctype, - None - if actual_num_read_ctype is None - else (ctypes.pointer(actual_num_read_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niDigital_PPMU_Measure(vi_ctype, channel_list_ctype, measurement_type_ctype, buffer_size_ctype, measurements_ctype, None if actual_num_read_ctype is None else (ctypes.pointer(actual_num_read_ctype))) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) buffer_size_ctype = _visatype.ViInt32(actual_num_read_ctype.value) # case S200 measurements_size = actual_num_read_ctype.value # case B620 - measurements_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViReal64, size=measurements_size - ) # case B620 - error_code = self._library.niDigital_PPMU_Measure( - vi_ctype, - channel_list_ctype, - measurement_type_ctype, - buffer_size_ctype, - measurements_ctype, - None - if actual_num_read_ctype is None - else (ctypes.pointer(actual_num_read_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + measurements_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=measurements_size) # case B620 + error_code = self._library.niDigital_PPMU_Measure(vi_ctype, channel_list_ctype, measurement_type_ctype, buffer_size_ctype, measurements_ctype, None if actual_num_read_ctype is None else (ctypes.pointer(actual_num_read_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return [float(measurements_ctype[i]) for i in range(buffer_size_ctype.value)] @ivi_synchronized def ppmu_source(self): - r"""ppmu_source + r'''ppmu_source Starts sourcing voltage or current from the PPMU. This method automatically selects the PPMU method. Changes to PPMU source settings do not take effect until you call this method. If you modify source settings after you call this method, you must call this method again for changes in the configuration to take effect. @@ -4300,20 +3359,16 @@ def ppmu_source(self): To call the method on all channels, you can call it directly on the :py:class:`nidigital.Session`. Example: :py:meth:`my_session.ppmu_source` - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 error_code = self._library.niDigital_PPMU_Source(vi_ctype, channel_list_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def read_static(self): - r"""read_static + r'''read_static Reads the current state of comparators for pins you specify in the repeated capabilities. If there are uncommitted changes to levels or the termination mode, this method commits the changes to the pins. @@ -4336,48 +3391,24 @@ def read_static(self): - PinState.M: The comparators read a midband pin state. - PinState.V: The comparators read a value that is above VOH and below VOL, which can occur when you set VOL higher than VOH. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 buffer_size_ctype = _visatype.ViInt32(0) # case S190 data_ctype = None # case B610 actual_num_read_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_ReadStatic( - vi_ctype, - channel_list_ctype, - buffer_size_ctype, - data_ctype, - None - if actual_num_read_ctype is None - else (ctypes.pointer(actual_num_read_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niDigital_ReadStatic(vi_ctype, channel_list_ctype, buffer_size_ctype, data_ctype, None if actual_num_read_ctype is None else (ctypes.pointer(actual_num_read_ctype))) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) buffer_size_ctype = _visatype.ViInt32(actual_num_read_ctype.value) # case S200 data_size = actual_num_read_ctype.value # case B620 - data_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViUInt8, size=data_size - ) # case B620 - error_code = self._library.niDigital_ReadStatic( - vi_ctype, - channel_list_ctype, - buffer_size_ctype, - data_ctype, - None - if actual_num_read_ctype is None - else (ctypes.pointer(actual_num_read_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + data_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViUInt8, size=data_size) # case B620 + error_code = self._library.niDigital_ReadStatic(vi_ctype, channel_list_ctype, buffer_size_ctype, data_ctype, None if actual_num_read_ctype is None else (ctypes.pointer(actual_num_read_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return [enums.PinState(data_ctype[i]) for i in range(buffer_size_ctype.value)] @ivi_synchronized def _set_attribute_vi_boolean(self, attribute, value): - r"""_set_attribute_vi_boolean + r'''_set_attribute_vi_boolean Sets the value of a ViBoolean property. Use this method to set the values of digital pattern instrument-specific properties and inherent IVI properties. @@ -4397,24 +3428,18 @@ def _set_attribute_vi_boolean(self, attribute, value): value (bool): The value to which you want to set the property; some of the values might not be valid depending on the current settings of the instrument session. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 value_ctype = _visatype.ViBoolean(value) # case S150 - error_code = self._library.niDigital_SetAttributeViBoolean( - vi_ctype, channel_name_ctype, attribute_ctype, value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_SetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_int32(self, attribute, value): - r"""_set_attribute_vi_int32 + r'''_set_attribute_vi_int32 Sets the value of a ViInt32 property. Use this method to set the values of digital pattern instrument-specific properties and inherent IVI properties. @@ -4434,24 +3459,18 @@ def _set_attribute_vi_int32(self, attribute, value): value (int): The value to which you want to set the property; some of the values might not be valid depending on the current settings of the instrument session. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 value_ctype = _visatype.ViInt32(value) # case S150 - error_code = self._library.niDigital_SetAttributeViInt32( - vi_ctype, channel_name_ctype, attribute_ctype, value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_SetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_int64(self, attribute, value): - r"""_set_attribute_vi_int64 + r'''_set_attribute_vi_int64 Sets the value of a ViInt64 property. Use this method to set the values of digital pattern instrument-specific properties and inherent IVI properties. @@ -4471,24 +3490,18 @@ def _set_attribute_vi_int64(self, attribute, value): value (int): The value to which you want to set the property; some of the values might not be valid depending on the current settings of the instrument session. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 value_ctype = _visatype.ViInt64(value) # case S150 - error_code = self._library.niDigital_SetAttributeViInt64( - vi_ctype, channel_name_ctype, attribute_ctype, value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_SetAttributeViInt64(vi_ctype, channel_name_ctype, attribute_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_real64(self, attribute, value): - r"""_set_attribute_vi_real64 + r'''_set_attribute_vi_real64 Sets the value of a ViIntReal64 property. Use this method to set the values of digital pattern instrument-specific properties and inherent IVI properties. @@ -4508,24 +3521,18 @@ def _set_attribute_vi_real64(self, attribute, value): value (float): The value to which you want to set the property; some of the values might not be valid depending on the current settings of the instrument session. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 value_ctype = _visatype.ViReal64(value) # case S150 - error_code = self._library.niDigital_SetAttributeViReal64( - vi_ctype, channel_name_ctype, attribute_ctype, value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_SetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_string(self, attribute, value): - r"""_set_attribute_vi_string + r'''_set_attribute_vi_string Sets the value of a ViString property. Use this method to set the values of digital pattern instrument-specific properties and inherent IVI properties. @@ -4545,26 +3552,18 @@ def _set_attribute_vi_string(self, attribute, value): value (str): The value to which you want to set the property; some of the values might not be valid depending on the current settings of the instrument session. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_ctype = _visatype.ViAttr(attribute) # case S150 - value_ctype = ctypes.create_string_buffer( - value.encode(self._encoding) - ) # case C020 - error_code = self._library.niDigital_SetAttributeViString( - vi_ctype, channel_name_ctype, attribute_ctype, value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + value_ctype = ctypes.create_string_buffer(value.encode(self._encoding)) # case C020 + error_code = self._library.niDigital_SetAttributeViString(vi_ctype, channel_name_ctype, attribute_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def tdr(self, apply_offsets=True): - r"""tdr + r'''tdr Measures propagation delays through cables, connectors, and load boards using Time-Domain Reflectometry (TDR). Ensure that the channels and pins you select are connected to an open circuit. @@ -4586,71 +3585,37 @@ def tdr(self, apply_offsets=True): Returns: offsets (list of hightime.timedelta): Measured TDR offsets specified in seconds. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 apply_offsets_ctype = _visatype.ViBoolean(apply_offsets) # case S150 offsets_buffer_size_ctype = _visatype.ViInt32(0) # case S190 offsets_ctype = None # case B610 actual_num_offsets_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_TDR( - vi_ctype, - channel_list_ctype, - apply_offsets_ctype, - offsets_buffer_size_ctype, - offsets_ctype, - None - if actual_num_offsets_ctype is None - else (ctypes.pointer(actual_num_offsets_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) - offsets_buffer_size_ctype = _visatype.ViInt32( - actual_num_offsets_ctype.value - ) # case S200 + error_code = self._library.niDigital_TDR(vi_ctype, channel_list_ctype, apply_offsets_ctype, offsets_buffer_size_ctype, offsets_ctype, None if actual_num_offsets_ctype is None else (ctypes.pointer(actual_num_offsets_ctype))) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) + offsets_buffer_size_ctype = _visatype.ViInt32(actual_num_offsets_ctype.value) # case S200 offsets_size = actual_num_offsets_ctype.value # case B620 - offsets_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViReal64, size=offsets_size - ) # case B620 - error_code = self._library.niDigital_TDR( - vi_ctype, - channel_list_ctype, - apply_offsets_ctype, - offsets_buffer_size_ctype, - offsets_ctype, - None - if actual_num_offsets_ctype is None - else (ctypes.pointer(actual_num_offsets_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return _converters.convert_seconds_real64_to_timedeltas( - [float(offsets_ctype[i]) for i in range(offsets_buffer_size_ctype.value)] - ) + offsets_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=offsets_size) # case B620 + error_code = self._library.niDigital_TDR(vi_ctype, channel_list_ctype, apply_offsets_ctype, offsets_buffer_size_ctype, offsets_ctype, None if actual_num_offsets_ctype is None else (ctypes.pointer(actual_num_offsets_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return _converters.convert_seconds_real64_to_timedeltas([float(offsets_ctype[i]) for i in range(offsets_buffer_size_ctype.value)]) def unlock(self): - """unlock + '''unlock Releases a lock that you acquired on an device session using lock. Refer to lock for additional information on session locks. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDigital_UnlockSession(vi_ctype, None) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return @ivi_synchronized - def _write_source_waveform_site_unique_u32( - self, waveform_name, num_waveforms, samples_per_waveform, waveform_data - ): - r"""_write_source_waveform_site_unique_u32 + def _write_source_waveform_site_unique_u32(self, waveform_name, num_waveforms, samples_per_waveform, waveform_data): + r'''_write_source_waveform_site_unique_u32 Writes one waveform per site. Use this write method if you set the parameter of the create source waveform method to Site Unique. @@ -4674,40 +3639,21 @@ def _write_source_waveform_site_unique_u32( waveform_data (array.array("L")): An array of samples to use as source data. Data for each site must be appended sequentially in the array (non-interleaved). - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - site_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - waveform_name_ctype = ctypes.create_string_buffer( - waveform_name.encode(self._encoding) - ) # case C020 + site_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 num_waveforms_ctype = _visatype.ViInt32(num_waveforms) # case S150 - samples_per_waveform_ctype = _visatype.ViInt32( - samples_per_waveform - ) # case S150 - waveform_data_array = get_ctypes_and_array( - value=waveform_data, array_type="L" - ) # case B550 - waveform_data_ctype = get_ctypes_pointer_for_buffer( - value=waveform_data_array, library_type=_visatype.ViUInt32 - ) # case B550 - error_code = self._library.niDigital_WriteSourceWaveformSiteUniqueU32( - vi_ctype, - site_list_ctype, - waveform_name_ctype, - num_waveforms_ctype, - samples_per_waveform_ctype, - waveform_data_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + samples_per_waveform_ctype = _visatype.ViInt32(samples_per_waveform) # case S150 + waveform_data_array = get_ctypes_and_array(value=waveform_data, array_type="L") # case B550 + waveform_data_ctype = get_ctypes_pointer_for_buffer(value=waveform_data_array, library_type=_visatype.ViUInt32) # case B550 + error_code = self._library.niDigital_WriteSourceWaveformSiteUniqueU32(vi_ctype, site_list_ctype, waveform_name_ctype, num_waveforms_ctype, samples_per_waveform_ctype, waveform_data_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def write_static(self, state): - r"""write_static + r'''write_static Writes a static state to the specified pins. The selected pins remain in the specified state until the next pattern burst or call to this method. If there are uncommitted changes to levels or the termination mode, this method commits the changes to the pins. This method does not change the selected pin method. If you write a static state to a pin that does not have the Digital method selected, the new static state is stored by the instrument, and affects the state of the pin the next time you change the selected method to Digital. @@ -4732,26 +3678,18 @@ def write_static(self, state): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - """ + ''' if type(state) is not enums.WriteStaticPinState: - raise TypeError( - "Parameter state must be of type " + str(enums.WriteStaticPinState) - ) + raise TypeError('Parameter state must be of type ' + str(enums.WriteStaticPinState)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 state_ctype = _visatype.ViUInt8(state.value) # case S130 - error_code = self._library.niDigital_WriteStatic( - vi_ctype, channel_list_ctype, state_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_WriteStatic(vi_ctype, channel_list_ctype, state_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def _error_message(self, error_code): - r"""_error_message + r'''_error_message Takes the error code returned by the digital pattern instrument driver methods, interprets it, and returns it as a user readable string. @@ -4762,24 +3700,20 @@ def _error_message(self, error_code): Returns: error_message (str): The error information formatted as a string. The array must contain at least 256 characters. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus(error_code) # case S150 error_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niDigital_error_message( - vi_ctype, error_code_ctype, error_message_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + error_code = self._library.niDigital_error_message(vi_ctype, error_code_ctype, error_message_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return error_message_ctype.value.decode(self._encoding) class Session(_SessionBase): - """An NI-Digital Pattern Driver session""" + '''An NI-Digital Pattern Driver session''' def __init__(self, resource_name, id_query=False, reset_device=False, options={}): - r"""An NI-Digital Pattern Driver session + r'''An NI-Digital Pattern Driver session Creates and returns a new session to the specified digital pattern instrument to use in all subsequent method calls. To place the instrument in a known startup state when creating a new session, set the reset parameter to True, which is equivalent to calling the reset method immediately after initializing the session. @@ -4830,23 +3764,15 @@ def __init__(self, resource_name, id_query=False, reset_device=False, options={} Returns: new_vi (int): The returned instrument session. - """ - super(Session, self).__init__( - repeated_capability_list=[], - vi=None, - library=None, - encoding=None, - freeze_it=False, - ) + ''' + super(Session, self).__init__(repeated_capability_list=[], vi=None, library=None, encoding=None, freeze_it=False) options = _converters.convert_init_with_options_dictionary(options) self._library = _library_singleton.get() - self._encoding = "windows-1251" + self._encoding = 'windows-1251' # Call specified init function self._vi = 0 # This must be set before calling _init_with_options(). - self._vi = self._init_with_options( - resource_name, id_query, reset_device, options - ) + self._vi = self._init_with_options(resource_name, id_query, reset_device, options) self.tclk = nitclk.SessionReference(self._vi) @@ -4855,7 +3781,7 @@ def __init__(self, resource_name, id_query=False, reset_device=False, options={} param_list.append("resource_name=" + pp.pformat(resource_name)) param_list.append("reset_device=" + pp.pformat(reset_device)) param_list.append("options=" + pp.pformat(options)) - self._param_list = ", ".join(param_list) + self._param_list = ', '.join(param_list) self._is_frozen = True @@ -4866,23 +3792,23 @@ def __exit__(self, exc_type, exc_value, traceback): self.close() def initiate(self): - """initiate + '''initiate Starts bursting the pattern configured by start_label, causing the NI-Digital session to be committed. To stop the pattern burst, call abort. If keep alive pattern is bursting when abort is called or upon exiting the context manager, keep alive pattern will not be stopped. To stop the keep alive pattern, call abort_keep_alive. Note: This method will return a Python context manager that will initiate on entering and abort on exit. - """ + ''' return _Burst(self) def close(self): - """close + '''close Closes the specified instrument session to a digital pattern instrument, aborts pattern execution, and unloads pattern memory. The channels on a digital pattern instrument remain in their current state. Note: This method is not needed when using the session context manager - """ + ''' try: self._close() except errors.DriverError: @@ -4890,50 +3816,44 @@ def close(self): raise self._vi = 0 - """ These are code-generated """ + ''' These are code-generated ''' @ivi_synchronized def abort(self): - r"""abort + r'''abort Stops bursting the pattern. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDigital_Abort(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def abort_keep_alive(self): - r"""abort_keep_alive + r'''abort_keep_alive Stops the keep alive pattern if it is currently running. If a pattern burst is in progress, the method aborts the pattern burst. If you start a new pattern burst while a keep alive pattern is running, the keep alive pattern runs to the last keep alive vector, and the new pattern burst starts on the next cycle. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDigital_AbortKeepAlive(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def commit(self): - r"""commit + r'''commit Applies all previously configured pin levels, termination modes, clocks, triggers, and pattern timing to a digital pattern instrument. If you do not call the commit method, then the initiate method or the burst_pattern method will implicitly call this method for you. Calling this method moves the session from the Uncommitted state to the Committed state. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDigital_Commit(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def configure_time_set_period(self, time_set_name, period): - r"""configure_time_set_period + r'''configure_time_set_period Configures the period of a time set. Use this method to modify time set values after applying a timing sheet with the apply_levels_and_timing method, or to create time sets programmatically without the use of timing sheets. This method does not modify the timing sheet file or the timing sheet contents that will be used in future calls to apply_levels_and_timing; it only affects the values of the current timing context. @@ -4942,27 +3862,17 @@ def configure_time_set_period(self, time_set_name, period): period (hightime.timedelta, datetime.timedelta, or float in seconds): Period for this time set, in seconds. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - time_set_name_ctype = ctypes.create_string_buffer( - time_set_name.encode(self._encoding) - ) # case C020 - period_ctype = _converters.convert_timedelta_to_seconds_real64( - period - ) # case S140 - error_code = self._library.niDigital_ConfigureTimeSetPeriod( - vi_ctype, time_set_name_ctype, period_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 + period_ctype = _converters.convert_timedelta_to_seconds_real64(period) # case S140 + error_code = self._library.niDigital_ConfigureTimeSetPeriod(vi_ctype, time_set_name_ctype, period_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def create_capture_waveform_from_file_digicapture( - self, waveform_name, waveform_file_path - ): - r"""create_capture_waveform_from_file_digicapture + def create_capture_waveform_from_file_digicapture(self, waveform_name, waveform_file_path): + r'''create_capture_waveform_from_file_digicapture Creates a capture waveform with the configuration information from a Digicapture file generated by the Digital Pattern Editor. @@ -4971,27 +3881,17 @@ def create_capture_waveform_from_file_digicapture( waveform_file_path (str): Absolute file path to the capture waveform file (.digicapture) you want to load. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - waveform_name_ctype = ctypes.create_string_buffer( - waveform_name.encode(self._encoding) - ) # case C020 - waveform_file_path_ctype = ctypes.create_string_buffer( - waveform_file_path.encode(self._encoding) - ) # case C020 - error_code = self._library.niDigital_CreateCaptureWaveformFromFileDigicapture( - vi_ctype, waveform_name_ctype, waveform_file_path_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 + waveform_file_path_ctype = ctypes.create_string_buffer(waveform_file_path.encode(self._encoding)) # case C020 + error_code = self._library.niDigital_CreateCaptureWaveformFromFileDigicapture(vi_ctype, waveform_name_ctype, waveform_file_path_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def create_source_waveform_from_file_tdms( - self, waveform_name, waveform_file_path, write_waveform_data=True - ): - r"""create_source_waveform_from_file_tdms + def create_source_waveform_from_file_tdms(self, waveform_name, waveform_file_path, write_waveform_data=True): + r'''create_source_waveform_from_file_tdms Creates a source waveform with configuration information from a TDMS file generated by the Digital Pattern Editor. It also optionally writes waveform data from the file. @@ -5002,69 +3902,45 @@ def create_source_waveform_from_file_tdms( write_waveform_data (bool): A Boolean that writes waveform data to source memory if True and the waveform data is in the file. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - waveform_name_ctype = ctypes.create_string_buffer( - waveform_name.encode(self._encoding) - ) # case C020 - waveform_file_path_ctype = ctypes.create_string_buffer( - waveform_file_path.encode(self._encoding) - ) # case C020 - write_waveform_data_ctype = _visatype.ViBoolean( - write_waveform_data - ) # case S150 - error_code = self._library.niDigital_CreateSourceWaveformFromFileTDMS( - vi_ctype, - waveform_name_ctype, - waveform_file_path_ctype, - write_waveform_data_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 + waveform_file_path_ctype = ctypes.create_string_buffer(waveform_file_path.encode(self._encoding)) # case C020 + write_waveform_data_ctype = _visatype.ViBoolean(write_waveform_data) # case S150 + error_code = self._library.niDigital_CreateSourceWaveformFromFileTDMS(vi_ctype, waveform_name_ctype, waveform_file_path_ctype, write_waveform_data_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def create_time_set(self, name): - r"""create_time_set + r'''create_time_set Creates a time set with the name that you specify. Use this method when you want to create time sets programmatically rather than with a timing sheet. Args: name (str): The specified name of the new time set. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - name_ctype = ctypes.create_string_buffer( - name.encode(self._encoding) - ) # case C020 + name_ctype = ctypes.create_string_buffer(name.encode(self._encoding)) # case C020 error_code = self._library.niDigital_CreateTimeSet(vi_ctype, name_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def delete_all_time_sets(self): - r"""delete_all_time_sets + r'''delete_all_time_sets Deletes all time sets from instrument memory. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDigital_DeleteAllTimeSets(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def load_specifications_levels_and_timing( - self, - specifications_file_paths=None, - levels_file_paths=None, - timing_file_paths=None, - ): - """load_specifications_levels_and_timing + def load_specifications_levels_and_timing(self, specifications_file_paths=None, levels_file_paths=None, timing_file_paths=None): + '''load_specifications_levels_and_timing Loads settings in specifications, levels, and timing sheets. These settings are not applied to the digital pattern instrument until apply_levels_and_timing is called. @@ -5080,10 +3956,8 @@ def load_specifications_levels_and_timing( timing_file_paths (str or basic sequence of str): Absolute file path of one or more timing sheet files. - """ - self._call_method_with_iterable( - self._load_specifications, specifications_file_paths - ) + ''' + self._call_method_with_iterable(self._load_specifications, specifications_file_paths) self._call_method_with_iterable(self._load_levels, levels_file_paths) self._call_method_with_iterable(self._load_timing, timing_file_paths) @@ -5097,7 +3971,7 @@ def _call_method_with_iterable(self, method, files): @ivi_synchronized def self_test(self): - """self_test + '''self_test Returns self test results from a digital pattern instrument. This test requires several minutes to execute. @@ -5113,7 +3987,7 @@ def self_test(self): +----------------+-------------------+ | 1 | Self test failed. | +----------------+-------------------+ - """ + ''' code, msg = self._self_test() if code: raise errors.SelfTestError(code, msg) @@ -5121,7 +3995,7 @@ def self_test(self): @ivi_synchronized def unload_specifications(self, file_paths): - """unload_specifications + '''unload_specifications Unloads the given specifications sheets present in the previously loaded specifications files that you select. @@ -5133,12 +4007,12 @@ def unload_specifications(self, file_paths): Args: file_paths (str or basic sequence of str): Absolute file path of one or more loaded specifications files. - """ + ''' self._call_method_with_iterable(self._unload_specifications, file_paths) @ivi_synchronized def write_source_waveform_site_unique(self, waveform_name, waveform_data): - """write_source_waveform_site_unique + '''write_source_waveform_site_unique Writes one waveform per site. Use this write method if you set the parameter of the create source waveform method to Site Unique. @@ -5147,15 +4021,10 @@ def write_source_waveform_site_unique(self, waveform_name, waveform_data): waveform_data ({ int: basic sequence of unsigned int, int: basic sequence of unsigned int, ... }): Dictionary where each key is a site number and value is a collection of samples to use as source data - """ + ''' from collections.abc import Mapping - if not isinstance(waveform_data, Mapping): - raise TypeError( - "Expecting waveform_data to be a dictionary but got {}".format( - type(waveform_data) - ) - ) + raise TypeError("Expecting waveform_data to be a dictionary but got {}".format(type(waveform_data))) site_list = [] # We assume all the entries are the same length (we'll check later) to make the array the correct size # Get an entry from the dictionary from https://stackoverflow.com/questions/30362391/how-do-you-find-the-first-key-in-a-dictionary @@ -5163,47 +4032,32 @@ def write_source_waveform_site_unique(self, waveform_name, waveform_data): actual_samples_per_waveform = 0 else: actual_samples_per_waveform = len(waveform_data[next(iter(waveform_data))]) - data = array.array( - "L", [0] * (len(waveform_data) * actual_samples_per_waveform) - ) + data = array.array('L', [0] * (len(waveform_data) * actual_samples_per_waveform)) mv = memoryview(data) i = 0 for site in waveform_data: if len(waveform_data[site]) != actual_samples_per_waveform: - raise ValueError( - "Mismatched length of waveforms. All must be the same length." - ) + raise ValueError('Mismatched length of waveforms. All must be the same length.') # Check the type by using string comparison so that we don't import numpy unnecessarily. if str(type(waveform_data[site])).find("'numpy.ndarray'") != -1: import numpy - if waveform_data[site].dtype == numpy.uint32: - wfm = array.array("L", waveform_data[site]) + wfm = array.array('L', waveform_data[site]) else: - raise TypeError( - "Unsupported dtype for waveform_data array element type. Is {0}, expected {1}".format( - waveform_data[site].dtype, numpy.int32 - ) - ) + raise TypeError("Unsupported dtype for waveform_data array element type. Is {0}, expected {1}".format(waveform_data[site].dtype, numpy.int32)) elif isinstance(waveform_data[site], array.array): - if waveform_data[site].typecode == "L": + if waveform_data[site].typecode == 'L': wfm = waveform_data[site] else: - raise TypeError( - 'Wrong waveform_data array element type. Must be unsigned 32 bit int ("L"), was {}'.format( - waveform_data[site].typecode - ) - ) + raise TypeError('Wrong waveform_data array element type. Must be unsigned 32 bit int ("L"), was {}'.format(waveform_data[site].typecode)) elif isinstance(waveform_data[site], list): - wfm = array.array("L", waveform_data[site]) + wfm = array.array('L', waveform_data[site]) else: - raise TypeError( - "Unknown array type: {}".format(type(waveform_data[site])) - ) + raise TypeError('Unknown array type: {}'.format(type(waveform_data[site]))) site_list.append(site) @@ -5213,13 +4067,11 @@ def write_source_waveform_site_unique(self, waveform_name, waveform_data): i += 1 - self.sites[site_list]._write_source_waveform_site_unique_u32( - waveform_name, len(waveform_data), actual_samples_per_waveform, data - ) + self.sites[site_list]._write_source_waveform_site_unique_u32(waveform_name, len(waveform_data), actual_samples_per_waveform, data) @ivi_synchronized def get_pattern_pin_names(self, start_label): - r"""get_pattern_pin_names + r'''get_pattern_pin_names Returns the pattern pin list. @@ -5230,36 +4082,22 @@ def get_pattern_pin_names(self, start_label): Returns: pin_list (list of str): List of pins referenced by the pattern with the **startLabel**. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - start_label_ctype = ctypes.create_string_buffer( - start_label.encode(self._encoding) - ) # case C020 + start_label_ctype = ctypes.create_string_buffer(start_label.encode(self._encoding)) # case C020 pin_list_buffer_size_ctype = _visatype.ViInt32() # case S170 pin_list_ctype = None # case C050 - error_code = self._library.niDigital_GetPatternPinList( - vi_ctype, start_label_ctype, pin_list_buffer_size_ctype, pin_list_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niDigital_GetPatternPinList(vi_ctype, start_label_ctype, pin_list_buffer_size_ctype, pin_list_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) pin_list_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - pin_list_ctype = ( - _visatype.ViChar * pin_list_buffer_size_ctype.value - )() # case C060 - error_code = self._library.niDigital_GetPatternPinList( - vi_ctype, start_label_ctype, pin_list_buffer_size_ctype, pin_list_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return _converters.convert_comma_separated_string_to_list( - pin_list_ctype.value.decode(self._encoding) - ) + pin_list_ctype = (_visatype.ViChar * pin_list_buffer_size_ctype.value)() # case C060 + error_code = self._library.niDigital_GetPatternPinList(vi_ctype, start_label_ctype, pin_list_buffer_size_ctype, pin_list_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return _converters.convert_comma_separated_string_to_list(pin_list_ctype.value.decode(self._encoding)) @ivi_synchronized def get_time_set_period(self, time_set_name): - r"""get_time_set_period + r'''get_time_set_period Returns the period of the specified time set. @@ -5270,28 +4108,16 @@ def get_time_set_period(self, time_set_name): Returns: period (hightime.timedelta): Returned period, in seconds, that the edge is configured to. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - time_set_name_ctype = ctypes.create_string_buffer( - time_set_name.encode(self._encoding) - ) # case C020 + time_set_name_ctype = ctypes.create_string_buffer(time_set_name.encode(self._encoding)) # case C020 period_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDigital_GetTimeSetPeriod( - vi_ctype, - time_set_name_ctype, - None if period_ctype is None else (ctypes.pointer(period_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return _converters.convert_seconds_real64_to_timedelta( - float(period_ctype.value) - ) - - def _init_with_options( - self, resource_name, id_query=False, reset_device=False, option_string="" - ): - r"""_init_with_options + error_code = self._library.niDigital_GetTimeSetPeriod(vi_ctype, time_set_name_ctype, None if period_ctype is None else (ctypes.pointer(period_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return _converters.convert_seconds_real64_to_timedelta(float(period_ctype.value)) + + def _init_with_options(self, resource_name, id_query=False, reset_device=False, option_string=""): + r'''_init_with_options Creates and returns a new session to the specified digital pattern instrument to use in all subsequent method calls. To place the instrument in a known startup state when creating a new session, set the reset parameter to True, which is equivalent to calling the reset method immediately after initializing the session. @@ -5316,168 +4142,126 @@ def _init_with_options( Returns: new_vi (int): The returned instrument session. - """ - resource_name_ctype = ctypes.create_string_buffer( - resource_name.encode(self._encoding) - ) # case C020 + ''' + resource_name_ctype = ctypes.create_string_buffer(resource_name.encode(self._encoding)) # case C020 id_query_ctype = _visatype.ViBoolean(id_query) # case S150 reset_device_ctype = _visatype.ViBoolean(reset_device) # case S150 - option_string_ctype = ctypes.create_string_buffer( - _converters.convert_init_with_options_dictionary(option_string).encode( - self._encoding - ) - ) # case C040 + option_string_ctype = ctypes.create_string_buffer(_converters.convert_init_with_options_dictionary(option_string).encode(self._encoding)) # case C040 new_vi_ctype = _visatype.ViSession() # case S220 - error_code = self._library.niDigital_InitWithOptions( - resource_name_ctype, - id_query_ctype, - reset_device_ctype, - option_string_ctype, - None if new_vi_ctype is None else (ctypes.pointer(new_vi_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_InitWithOptions(resource_name_ctype, id_query_ctype, reset_device_ctype, option_string_ctype, None if new_vi_ctype is None else (ctypes.pointer(new_vi_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(new_vi_ctype.value) @ivi_synchronized def _initiate(self): - r"""_initiate + r'''_initiate Starts bursting the pattern configured by start_label, causing the NI-Digital session to be committed. To stop the pattern burst, call abort. If keep alive pattern is bursting when abort is called or upon exiting the context manager, keep alive pattern will not be stopped. To stop the keep alive pattern, call abort_keep_alive. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDigital_Initiate(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def is_done(self): - r"""is_done + r'''is_done Checks the hardware to determine if the pattern burst has completed or if any errors have occurred. Returns: done (bool): A Boolean that indicates whether the pattern burst completed. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 done_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niDigital_IsDone( - vi_ctype, None if done_ctype is None else (ctypes.pointer(done_ctype)) - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_IsDone(vi_ctype, None if done_ctype is None else (ctypes.pointer(done_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(done_ctype.value) @ivi_synchronized def _load_levels(self, file_path): - r"""_load_levels + r'''_load_levels Loads a levels sheet from a specified file. Args: file_path (str): Absolute file path to the specified levels sheet file. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer( - file_path.encode(self._encoding) - ) # case C020 + file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 error_code = self._library.niDigital_LoadLevels(vi_ctype, file_path_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def load_pattern(self, file_path): - r"""load_pattern + r'''load_pattern Loads the specified pattern file. Args: file_path (str): Absolute file path of the binary .digipat pattern file to load. Specify the pattern to burst using start_label or the start_label parameter of the burst_pattern method. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer( - file_path.encode(self._encoding) - ) # case C020 + file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 error_code = self._library.niDigital_LoadPattern(vi_ctype, file_path_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def load_pin_map(self, file_path): - r"""load_pin_map + r'''load_pin_map Loads a pin map file. You can load only a single pin and channel map file during an NI-Digital Pattern Driver session. To switch pin maps, create a new session or call the reset method. Args: file_path (str): Absolute file path to a pin map file created with the Digital Pattern Editor or the NI TestStand Semiconductor Module. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer( - file_path.encode(self._encoding) - ) # case C020 + file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 error_code = self._library.niDigital_LoadPinMap(vi_ctype, file_path_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _load_specifications(self, file_path): - r"""_load_specifications + r'''_load_specifications Loads a specifications sheet from a specified file. Args: file_path (str): Absolute file path to a specifications file. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer( - file_path.encode(self._encoding) - ) # case C020 - error_code = self._library.niDigital_LoadSpecifications( - vi_ctype, file_path_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 + error_code = self._library.niDigital_LoadSpecifications(vi_ctype, file_path_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _load_timing(self, file_path): - r"""_load_timing + r'''_load_timing Loads a timing sheet from a specified file. Args: file_path (str): Absolute file path to the specified timing sheet file. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer( - file_path.encode(self._encoding) - ) # case C020 + file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 error_code = self._library.niDigital_LoadTiming(vi_ctype, file_path_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def read_sequencer_flag(self, flag): - r"""read_sequencer_flag + r'''read_sequencer_flag Reads the state of a pattern sequencer flag. Use pattern sequencer flags to coordinate execution between the pattern sequencer and a runtime test program. @@ -5493,29 +4277,19 @@ def read_sequencer_flag(self, flag): Returns: value (bool): A Boolean that indicates the state of the pattern sequencer flag you specify. - """ + ''' if type(flag) is not enums.SequencerFlag: - raise TypeError( - "Parameter flag must be of type " + str(enums.SequencerFlag) - ) + raise TypeError('Parameter flag must be of type ' + str(enums.SequencerFlag)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - flag_ctype = ctypes.create_string_buffer( - flag.value.encode(self._encoding) - ) # case C030 + flag_ctype = ctypes.create_string_buffer(flag.value.encode(self._encoding)) # case C030 value_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niDigital_ReadSequencerFlag( - vi_ctype, - flag_ctype, - None if value_ctype is None else (ctypes.pointer(value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_ReadSequencerFlag(vi_ctype, flag_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(value_ctype.value) @ivi_synchronized def read_sequencer_register(self, reg): - r"""read_sequencer_register + r'''read_sequencer_register Reads the value of a pattern sequencer register. Use pattern sequencer registers to pass numeric values between the pattern sequencer and a runtime test program. For example, you can use this method to read a register modified by the write_reg opcode during a pattern burst. @@ -5543,29 +4317,19 @@ def read_sequencer_register(self, reg): Returns: value (int): Value read from the sequencer register. - """ + ''' if type(reg) is not enums.SequencerRegister: - raise TypeError( - "Parameter reg must be of type " + str(enums.SequencerRegister) - ) + raise TypeError('Parameter reg must be of type ' + str(enums.SequencerRegister)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - reg_ctype = ctypes.create_string_buffer( - reg.value.encode(self._encoding) - ) # case C030 + reg_ctype = ctypes.create_string_buffer(reg.value.encode(self._encoding)) # case C030 value_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDigital_ReadSequencerRegister( - vi_ctype, - reg_ctype, - None if value_ctype is None else (ctypes.pointer(value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_ReadSequencerRegister(vi_ctype, reg_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(value_ctype.value) @ivi_synchronized def reset_device(self): - r"""reset_device + r'''reset_device Returns a digital pattern instrument to a known state. This method performs the following actions: @@ -5574,30 +4338,26 @@ def reset_device(self): - Resets all properties to default values, including the selected_function property that is set to SelectedFunction.DISCONNECT, causing the I/O switches to open. - Stops export of all external signals and events. - Clears over-temperature and over-power conditions. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDigital_ResetDevice(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def self_calibrate(self): - r"""self_calibrate + r'''self_calibrate Performs self-calibration on a digital pattern instrument. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDigital_SelfCalibrate(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def send_software_edge_trigger(self, trigger, trigger_identifier): - r"""send_software_edge_trigger + r'''send_software_edge_trigger Forces a particular edge-based trigger to occur regardless of how the specified trigger is configured. You can use this method as a software override. @@ -5623,91 +4383,67 @@ def send_software_edge_trigger(self, trigger, trigger_identifier): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - """ + ''' if type(trigger) is not enums.SoftwareTrigger: - raise TypeError( - "Parameter trigger must be of type " + str(enums.SoftwareTrigger) - ) + raise TypeError('Parameter trigger must be of type ' + str(enums.SoftwareTrigger)) vi_ctype = _visatype.ViSession(self._vi) # case S110 trigger_ctype = _visatype.ViInt32(trigger.value) # case S130 - trigger_identifier_ctype = ctypes.create_string_buffer( - trigger_identifier.encode(self._encoding) - ) # case C020 - error_code = self._library.niDigital_SendSoftwareEdgeTrigger( - vi_ctype, trigger_ctype, trigger_identifier_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + trigger_identifier_ctype = ctypes.create_string_buffer(trigger_identifier.encode(self._encoding)) # case C020 + error_code = self._library.niDigital_SendSoftwareEdgeTrigger(vi_ctype, trigger_ctype, trigger_identifier_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def unload_all_patterns(self, unload_keep_alive_pattern=False): - r"""unload_all_patterns + r'''unload_all_patterns Unloads all patterns, source waveforms, and capture waveforms from a digital pattern instrument. Args: unload_keep_alive_pattern (bool): A Boolean that specifies whether to keep or unload the keep alive pattern. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - unload_keep_alive_pattern_ctype = _visatype.ViBoolean( - unload_keep_alive_pattern - ) # case S150 - error_code = self._library.niDigital_UnloadAllPatterns( - vi_ctype, unload_keep_alive_pattern_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + unload_keep_alive_pattern_ctype = _visatype.ViBoolean(unload_keep_alive_pattern) # case S150 + error_code = self._library.niDigital_UnloadAllPatterns(vi_ctype, unload_keep_alive_pattern_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _unload_specifications(self, file_path): - r"""_unload_specifications + r'''_unload_specifications Unloads the given specifications sheet present in the previously loaded specifications file that you select. You must call the _load_specifications method to reload the file with updated specifications values. You must then call the apply_levels_and_timing method in order to apply the levels and timing values that reference the updated specifications values. Args: file_path (str): Absolute file path to a loaded specifications file. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer( - file_path.encode(self._encoding) - ) # case C020 - error_code = self._library.niDigital_UnloadSpecifications( - vi_ctype, file_path_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 + error_code = self._library.niDigital_UnloadSpecifications(vi_ctype, file_path_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def wait_until_done(self, timeout=hightime.timedelta(seconds=10.0)): - r"""wait_until_done + r'''wait_until_done Waits until the pattern burst has completed or the timeout has expired. Args: timeout (hightime.timedelta, datetime.timedelta, or float in seconds): Maximum time (in seconds) allowed for this method to complete. If this method does not complete within this time interval, this method returns an error. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64( - timeout - ) # case S140 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 error_code = self._library.niDigital_WaitUntilDone(vi_ctype, timeout_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def write_sequencer_flag(self, flag, value): - r"""write_sequencer_flag + r'''write_sequencer_flag Writes the state of a pattern sequencer flag. Use pattern sequencer flags to coordinate execution between the pattern sequencer and a runtime test program. @@ -5721,27 +4457,19 @@ def write_sequencer_flag(self, flag, value): value (bool): A Boolean that assigns a state to the pattern sequencer flag you specify. - """ + ''' if type(flag) is not enums.SequencerFlag: - raise TypeError( - "Parameter flag must be of type " + str(enums.SequencerFlag) - ) + raise TypeError('Parameter flag must be of type ' + str(enums.SequencerFlag)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - flag_ctype = ctypes.create_string_buffer( - flag.value.encode(self._encoding) - ) # case C030 + flag_ctype = ctypes.create_string_buffer(flag.value.encode(self._encoding)) # case C030 value_ctype = _visatype.ViBoolean(value) # case S150 - error_code = self._library.niDigital_WriteSequencerFlag( - vi_ctype, flag_ctype, value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_WriteSequencerFlag(vi_ctype, flag_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def write_sequencer_register(self, reg, value): - r"""write_sequencer_register + r'''write_sequencer_register Writes a value to a pattern sequencer register. Use pattern sequencer registers to pass numeric values between the pattern sequencer and a runtime test program. @@ -5767,27 +4495,19 @@ def write_sequencer_register(self, reg, value): value (int): The value you want to write to the register. - """ + ''' if type(reg) is not enums.SequencerRegister: - raise TypeError( - "Parameter reg must be of type " + str(enums.SequencerRegister) - ) + raise TypeError('Parameter reg must be of type ' + str(enums.SequencerRegister)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - reg_ctype = ctypes.create_string_buffer( - reg.value.encode(self._encoding) - ) # case C030 + reg_ctype = ctypes.create_string_buffer(reg.value.encode(self._encoding)) # case C030 value_ctype = _visatype.ViInt32(value) # case S150 - error_code = self._library.niDigital_WriteSequencerRegister( - vi_ctype, reg_ctype, value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDigital_WriteSequencerRegister(vi_ctype, reg_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def write_source_waveform_broadcast(self, waveform_name, waveform_data): - r"""write_source_waveform_broadcast + r'''write_source_waveform_broadcast Writes the same waveform data to all sites. Use this write method if you set the data_mapping parameter of the create source waveform method to SourceDataMapping.BROADCAST. @@ -5796,30 +4516,18 @@ def write_source_waveform_broadcast(self, waveform_name, waveform_data): waveform_data (list of int): 1D array of samples to use as source data to apply to all sites. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - waveform_name_ctype = ctypes.create_string_buffer( - waveform_name.encode(self._encoding) - ) # case C020 - waveform_size_ctype = _visatype.ViInt32( - 0 if waveform_data is None else len(waveform_data) - ) # case S160 - waveform_data_ctype = get_ctypes_pointer_for_buffer( - value=waveform_data, library_type=_visatype.ViUInt32 - ) # case B550 - error_code = self._library.niDigital_WriteSourceWaveformBroadcastU32( - vi_ctype, waveform_name_ctype, waveform_size_ctype, waveform_data_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 + waveform_size_ctype = _visatype.ViInt32(0 if waveform_data is None else len(waveform_data)) # case S160 + waveform_data_ctype = get_ctypes_pointer_for_buffer(value=waveform_data, library_type=_visatype.ViUInt32) # case B550 + error_code = self._library.niDigital_WriteSourceWaveformBroadcastU32(vi_ctype, waveform_name_ctype, waveform_size_ctype, waveform_data_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def write_source_waveform_data_from_file_tdms( - self, waveform_name, waveform_file_path - ): - r"""write_source_waveform_data_from_file_tdms + def write_source_waveform_data_from_file_tdms(self, waveform_name, waveform_file_path): + r'''write_source_waveform_data_from_file_tdms Writes a source waveform based on the waveform data and configuration information the file contains. @@ -5828,37 +4536,27 @@ def write_source_waveform_data_from_file_tdms( waveform_file_path (str): Absolute file path to the load source waveform file (.tdms). - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - waveform_name_ctype = ctypes.create_string_buffer( - waveform_name.encode(self._encoding) - ) # case C020 - waveform_file_path_ctype = ctypes.create_string_buffer( - waveform_file_path.encode(self._encoding) - ) # case C020 - error_code = self._library.niDigital_WriteSourceWaveformDataFromFileTDMS( - vi_ctype, waveform_name_ctype, waveform_file_path_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 + waveform_file_path_ctype = ctypes.create_string_buffer(waveform_file_path.encode(self._encoding)) # case C020 + error_code = self._library.niDigital_WriteSourceWaveformDataFromFileTDMS(vi_ctype, waveform_name_ctype, waveform_file_path_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def _close(self): - r"""_close + r'''_close Closes the specified instrument session to a digital pattern instrument, aborts pattern execution, and unloads pattern memory. The channels on a digital pattern instrument remain in their current state. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDigital_close(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def reset(self): - r"""reset + r'''reset Returns a digital pattern instrument to a known state. This method performs the following actions: @@ -5866,17 +4564,15 @@ def reset(self): - Clears pin maps, time sets, source and capture waveforms, and patterns. - Resets all properties to default values, including the selected_function property that is set to SelectedFunction.DISCONNECT, causing the I/O switches to open. - Stops exporting all external signals and events. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDigital_reset(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _self_test(self): - r"""_self_test + r'''_self_test Returns self test results from a digital pattern instrument. This test requires several minutes to execute. @@ -5885,18 +4581,13 @@ def _self_test(self): test_message (str): The returned self test status message. The array must contain at least 256 characters. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 test_result_ctype = _visatype.ViInt16() # case S220 test_message_ctype = (_visatype.ViChar * 2048)() # case C070 - error_code = self._library.niDigital_self_test( - vi_ctype, - None if test_result_ctype is None else (ctypes.pointer(test_result_ctype)), - test_message_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return int(test_result_ctype.value), test_message_ctype.value.decode( - self._encoding - ) + error_code = self._library.niDigital_self_test(vi_ctype, None if test_result_ctype is None else (ctypes.pointer(test_result_ctype)), test_message_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return int(test_result_ctype.value), test_message_ctype.value.decode(self._encoding) + + + diff --git a/generated/nidigital/nidigital/unit_tests/_matchers.py b/generated/nidigital/nidigital/unit_tests/_matchers.py index cf5d2362b..d451b50a2 100644 --- a/generated/nidigital/nidigital/unit_tests/_matchers.py +++ b/generated/nidigital/nidigital/unit_tests/_matchers.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # This file was generated -"""Matcher classes used by unit tests in order to set mock expectations. +'''Matcher classes used by unit tests in order to set mock expectations. These work well with our visatype definitions. -""" +''' import ctypes import nidigital._visatype as _visatype @@ -21,27 +21,15 @@ def __init__(self, expected_type, expected_value): def __eq__(self, other): if not isinstance(other, self.expected_type): - print( - "{0}: Unexpected type. Expected: {1}. Received: {2}".format( - self.__class__.__name__, self.expected_type, type(other) - ) - ) + print("{0}: Unexpected type. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_type, type(other))) return False if other.value != self.expected_value: - print( - "{0}: Unexpected value. Expected: {1}. Received: {2}".format( - self.__class__.__name__, self.expected_value, other.value - ) - ) + print("{0}: Unexpected value. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_value, other.value)) return False return True def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_type), - pp.pformat(self.expected_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) class _PointerMatcher(object): @@ -50,18 +38,12 @@ def __init__(self, expected_type): def __eq__(self, other): if not isinstance(other, ctypes.POINTER(self.expected_type)): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - ctypes.POINTER(self.expected_type), type(other) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(ctypes.POINTER(self.expected_type), type(other))) return False return True def __repr__(self): - return "{0}({1})".format( - self.__class__.__name__, pp.pformat(self.expected_type) - ) + return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_type)) class _BufferMatcher(object): @@ -88,47 +70,29 @@ def __eq__(self, other): pass # Because of object lifetimes, we may need to mock the other instance and provide lists instead of the actual array - if not isinstance(other, self.expected_type) and not isinstance( - other, list - ): - print( - "Unexpected type. Expected: {0} or {1}. Received: {2}".format( - self.expected_type, list, type(other) - ) - ) + if not isinstance(other, self.expected_type) and not isinstance(other, list): + print("Unexpected type. Expected: {0} or {1}. Received: {2}".format(self.expected_type, list, type(other))) return False if self.expected_size != len(other): - print( - "Unexpected length. Expected: {0}. Received: {1}".format( - self.expected_size, len(other) - ) - ) + print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(other))) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for i in range(0, len(self.expected_value)): if self.expected_value[i] != other[i]: - print( - "Unexpected value at index {0}. Expected: {1}. Received: {2}".format( - i, self.expected_value[i], other[i] - ) - ) + print("Unexpected value at index {0}. Expected: {1}. Received: {2}".format(i, self.expected_value[i], other[i])) return False return True def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self._expected_element_type), - pp.pformat(self._expected_size_or_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self._expected_element_type), pp.pformat(self._expected_size_or_value)) def __str__(self): - ret_str = self.__repr__() + "\n" - ret_str += " expected_type = " + str(self.expected_type) + "\n" - ret_str += " expected_value = " + str(self.expected_value) + "\n" - ret_str += " expected_size = " + str(self.expected_size) + "\n" + ret_str = self.__repr__() + '\n' + ret_str += ' expected_type = ' + str(self.expected_type) + '\n' + ret_str += ' expected_value = ' + str(self.expected_value) + '\n' + ret_str += ' expected_size = ' + str(self.expected_size) + '\n' return ret_str @@ -148,37 +112,21 @@ def __eq__(self, other): pass if not isinstance(other, ctypes.Array): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_type, type(other) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(other))) return False - if ( - len(other) < len(self.expected_string_value) + 1 - ): # +1 for NULL terminating character - print( - "Unexpected length in C string. Expected at least: {0}. Received {1}".format( - len(other), len(self.expected_string_value) + 1 - ) - ) + if len(other) < len(self.expected_string_value) + 1: # +1 for NULL terminating character + print("Unexpected length in C string. Expected at least: {0}. Received {1}".format(len(other), len(self.expected_string_value) + 1)) return False if not isinstance(other[0], bytes): print("Unexpected type. Not a string. Received: {0}".format(type(other[0]))) return False if other.value.decode("ascii") != self.expected_string_value: - print( - "Unexpected value. Expected {0}. Received: {1}".format( - self.expected_string_value, other.value.decode - ) - ) + print("Unexpected value. Expected {0}. Received: {1}".format(self.expected_string_value, other.value.decode)) return False return True def __repr__(self): - return "{0}({1})".format( - self.__class__.__name__, pp.pformat(self.expected_string_value) - ) + return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_string_value)) # Custom Type @@ -191,11 +139,7 @@ def _compare_ctype_structs(expected, actual): expected_val = getattr(expected, field_name) actual_val = getattr(actual, field_name) if expected_val != actual_val: - print( - "Unexpected value field {0}. Expected: {1}. Received: {2}".format( - field_name, expected_val, actual_val - ) - ) + print("Unexpected value field {0}. Expected: {1}. Received: {2}".format(field_name, expected_val, actual_val)) return False return True @@ -207,20 +151,12 @@ def __init__(self, expected_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_type, type(actual) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) return False return _compare_ctype_structs(self.expected_value, actual) def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_type), - pp.pformat(self.expected_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) class CustomTypeBufferMatcher(object): @@ -232,48 +168,30 @@ def __init__(self, expected_element_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print( - "Unexpected array type. Expected: {0}. Received: {1}".format( - self.expected_type, type(actual) - ) - ) + print("Unexpected array type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) return False if self.expected_size != len(actual): - print( - "Unexpected length. Expected: {0}. Received: {1}".format( - self.expected_size, len(actual) - ) - ) + print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(actual))) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for a, e in zip(actual, self.expected_value): if not isinstance(a, self.expected_element_type): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_element_type, type(a) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_element_type, type(a))) return False if not _compare_ctype_structs(e, a): return False return True def __repr__(self): - expected_val_repr = ( - "[" + ", ".join([x.__repr__() for x in self.expected_value]) + "]" - ) - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_element_type), - expected_val_repr, - ) + expected_val_repr = '[' + ', '.join([x.__repr__() for x in self.expected_value]) + ']' + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_element_type), expected_val_repr) def __str__(self): - ret_str = self.__repr__() + "\n" - ret_str += " expected_type = " + str(self.expected_type) + "\n" - ret_str += " expected_size = " + str(self.expected_size) + "\n" + ret_str = self.__repr__() + '\n' + ret_str += ' expected_type = ' + str(self.expected_type) + '\n' + ret_str += ' expected_size = ' + str(self.expected_size) + '\n' return ret_str @@ -282,9 +200,7 @@ def __str__(self): class ViBooleanMatcher(_ScalarMatcher): def __init__(self, expected_value): - _ScalarMatcher.__init__( - self, _visatype.ViBoolean, 1 if expected_value is True else 0 - ) + _ScalarMatcher.__init__(self, _visatype.ViBoolean, 1 if expected_value is True else 0) class ViSessionMatcher(_ScalarMatcher): @@ -396,3 +312,6 @@ def __init__(self, expected_size_or_value): class ViSessionBufferMatcher(_BufferMatcher): def __init__(self, expected_size_or_value): _BufferMatcher.__init__(self, _visatype.ViSession, expected_size_or_value) + + + diff --git a/generated/nidigital/nidigital/unit_tests/_mock_helper.py b/generated/nidigital/nidigital/unit_tests/_mock_helper.py index ea9d7da9f..1d3ab77f6 100644 --- a/generated/nidigital/nidigital/unit_tests/_mock_helper.py +++ b/generated/nidigital/nidigital/unit_tests/_mock_helper.py @@ -16,245 +16,243 @@ def __init__(self, function, param=None): class SideEffectsHelper(object): def __init__(self): self._defaults = {} - self._defaults["Abort"] = {} - self._defaults["Abort"]["return"] = 0 - self._defaults["AbortKeepAlive"] = {} - self._defaults["AbortKeepAlive"]["return"] = 0 - self._defaults["ApplyLevelsAndTiming"] = {} - self._defaults["ApplyLevelsAndTiming"]["return"] = 0 - self._defaults["ApplyTDROffsets"] = {} - self._defaults["ApplyTDROffsets"]["return"] = 0 - self._defaults["BurstPattern"] = {} - self._defaults["BurstPattern"]["return"] = 0 - self._defaults["ClockGenerator_Abort"] = {} - self._defaults["ClockGenerator_Abort"]["return"] = 0 - self._defaults["ClockGenerator_GenerateClock"] = {} - self._defaults["ClockGenerator_GenerateClock"]["return"] = 0 - self._defaults["Commit"] = {} - self._defaults["Commit"]["return"] = 0 - self._defaults["ConfigureActiveLoadLevels"] = {} - self._defaults["ConfigureActiveLoadLevels"]["return"] = 0 - self._defaults["ConfigurePatternBurstSites"] = {} - self._defaults["ConfigurePatternBurstSites"]["return"] = 0 - self._defaults["ConfigureTimeSetCompareEdgesStrobe"] = {} - self._defaults["ConfigureTimeSetCompareEdgesStrobe"]["return"] = 0 - self._defaults["ConfigureTimeSetCompareEdgesStrobe2x"] = {} - self._defaults["ConfigureTimeSetCompareEdgesStrobe2x"]["return"] = 0 - self._defaults["ConfigureTimeSetDriveEdges"] = {} - self._defaults["ConfigureTimeSetDriveEdges"]["return"] = 0 - self._defaults["ConfigureTimeSetDriveEdges2x"] = {} - self._defaults["ConfigureTimeSetDriveEdges2x"]["return"] = 0 - self._defaults["ConfigureTimeSetDriveFormat"] = {} - self._defaults["ConfigureTimeSetDriveFormat"]["return"] = 0 - self._defaults["ConfigureTimeSetEdge"] = {} - self._defaults["ConfigureTimeSetEdge"]["return"] = 0 - self._defaults["ConfigureTimeSetEdgeMultiplier"] = {} - self._defaults["ConfigureTimeSetEdgeMultiplier"]["return"] = 0 - self._defaults["ConfigureTimeSetPeriod"] = {} - self._defaults["ConfigureTimeSetPeriod"]["return"] = 0 - self._defaults["ConfigureVoltageLevels"] = {} - self._defaults["ConfigureVoltageLevels"]["return"] = 0 - self._defaults["CreateCaptureWaveformFromFileDigicapture"] = {} - self._defaults["CreateCaptureWaveformFromFileDigicapture"]["return"] = 0 - self._defaults["CreateCaptureWaveformParallel"] = {} - self._defaults["CreateCaptureWaveformParallel"]["return"] = 0 - self._defaults["CreateCaptureWaveformSerial"] = {} - self._defaults["CreateCaptureWaveformSerial"]["return"] = 0 - self._defaults["CreateSourceWaveformFromFileTDMS"] = {} - self._defaults["CreateSourceWaveformFromFileTDMS"]["return"] = 0 - self._defaults["CreateSourceWaveformParallel"] = {} - self._defaults["CreateSourceWaveformParallel"]["return"] = 0 - self._defaults["CreateSourceWaveformSerial"] = {} - self._defaults["CreateSourceWaveformSerial"]["return"] = 0 - self._defaults["CreateTimeSet"] = {} - self._defaults["CreateTimeSet"]["return"] = 0 - self._defaults["DeleteAllTimeSets"] = {} - self._defaults["DeleteAllTimeSets"]["return"] = 0 - self._defaults["DisableSites"] = {} - self._defaults["DisableSites"]["return"] = 0 - self._defaults["EnableSites"] = {} - self._defaults["EnableSites"]["return"] = 0 - self._defaults["FetchHistoryRAMCycleInformation"] = {} - self._defaults["FetchHistoryRAMCycleInformation"]["return"] = 0 - self._defaults["FetchHistoryRAMCycleInformation"]["patternIndex"] = None - self._defaults["FetchHistoryRAMCycleInformation"]["timeSetIndex"] = None - self._defaults["FetchHistoryRAMCycleInformation"]["vectorNumber"] = None - self._defaults["FetchHistoryRAMCycleInformation"]["cycleNumber"] = None - self._defaults["FetchHistoryRAMCycleInformation"]["numDutCycles"] = None - self._defaults["FetchHistoryRAMCyclePinData"] = {} - self._defaults["FetchHistoryRAMCyclePinData"]["return"] = 0 - self._defaults["FetchHistoryRAMCyclePinData"]["actualNumPinData"] = None - self._defaults["FetchHistoryRAMCyclePinData"]["expectedPinStates"] = None - self._defaults["FetchHistoryRAMCyclePinData"]["actualPinStates"] = None - self._defaults["FetchHistoryRAMCyclePinData"]["perPinPassFail"] = None - self._defaults["FetchHistoryRAMScanCycleNumber"] = {} - self._defaults["FetchHistoryRAMScanCycleNumber"]["return"] = 0 - self._defaults["FetchHistoryRAMScanCycleNumber"]["scanCycleNumber"] = None - self._defaults["FrequencyCounter_MeasureFrequency"] = {} - self._defaults["FrequencyCounter_MeasureFrequency"]["return"] = 0 - self._defaults["FrequencyCounter_MeasureFrequency"][ - "actualNumFrequencies" - ] = None - self._defaults["FrequencyCounter_MeasureFrequency"]["frequencies"] = None - self._defaults["GetAttributeViBoolean"] = {} - self._defaults["GetAttributeViBoolean"]["return"] = 0 - self._defaults["GetAttributeViBoolean"]["value"] = None - self._defaults["GetAttributeViInt32"] = {} - self._defaults["GetAttributeViInt32"]["return"] = 0 - self._defaults["GetAttributeViInt32"]["value"] = None - self._defaults["GetAttributeViInt64"] = {} - self._defaults["GetAttributeViInt64"]["return"] = 0 - self._defaults["GetAttributeViInt64"]["value"] = None - self._defaults["GetAttributeViReal64"] = {} - self._defaults["GetAttributeViReal64"]["return"] = 0 - self._defaults["GetAttributeViReal64"]["value"] = None - self._defaults["GetAttributeViString"] = {} - self._defaults["GetAttributeViString"]["return"] = 0 - self._defaults["GetAttributeViString"]["value"] = None - self._defaults["GetChannelNameFromString"] = {} - self._defaults["GetChannelNameFromString"]["return"] = 0 - self._defaults["GetChannelNameFromString"]["names"] = None - self._defaults["GetError"] = {} - self._defaults["GetError"]["return"] = 0 - self._defaults["GetError"]["errorCode"] = None - self._defaults["GetError"]["errorDescription"] = None - self._defaults["GetFailCount"] = {} - self._defaults["GetFailCount"]["return"] = 0 - self._defaults["GetFailCount"]["actualNumRead"] = None - self._defaults["GetFailCount"]["failureCount"] = None - self._defaults["GetHistoryRAMSampleCount"] = {} - self._defaults["GetHistoryRAMSampleCount"]["return"] = 0 - self._defaults["GetHistoryRAMSampleCount"]["sampleCount"] = None - self._defaults["GetPatternName"] = {} - self._defaults["GetPatternName"]["return"] = 0 - self._defaults["GetPatternName"]["name"] = None - self._defaults["GetPatternPinList"] = {} - self._defaults["GetPatternPinList"]["return"] = 0 - self._defaults["GetPatternPinList"]["pinList"] = None - self._defaults["GetPinName"] = {} - self._defaults["GetPinName"]["return"] = 0 - self._defaults["GetPinName"]["name"] = None - self._defaults["GetPinResultsPinInformation"] = {} - self._defaults["GetPinResultsPinInformation"]["return"] = 0 - self._defaults["GetPinResultsPinInformation"]["actualNumValues"] = None - self._defaults["GetPinResultsPinInformation"]["pinIndexes"] = None - self._defaults["GetPinResultsPinInformation"]["siteNumbers"] = None - self._defaults["GetPinResultsPinInformation"]["channelIndexes"] = None - self._defaults["GetSitePassFail"] = {} - self._defaults["GetSitePassFail"]["return"] = 0 - self._defaults["GetSitePassFail"]["actualNumSites"] = None - self._defaults["GetSitePassFail"]["passFail"] = None - self._defaults["GetSiteResultsSiteNumbers"] = {} - self._defaults["GetSiteResultsSiteNumbers"]["return"] = 0 - self._defaults["GetSiteResultsSiteNumbers"]["actualNumSiteNumbers"] = None - self._defaults["GetSiteResultsSiteNumbers"]["siteNumbers"] = None - self._defaults["GetTimeSetDriveFormat"] = {} - self._defaults["GetTimeSetDriveFormat"]["return"] = 0 - self._defaults["GetTimeSetDriveFormat"]["format"] = None - self._defaults["GetTimeSetEdge"] = {} - self._defaults["GetTimeSetEdge"]["return"] = 0 - self._defaults["GetTimeSetEdge"]["time"] = None - self._defaults["GetTimeSetEdgeMultiplier"] = {} - self._defaults["GetTimeSetEdgeMultiplier"]["return"] = 0 - self._defaults["GetTimeSetEdgeMultiplier"]["edgeMultiplier"] = None - self._defaults["GetTimeSetName"] = {} - self._defaults["GetTimeSetName"]["return"] = 0 - self._defaults["GetTimeSetName"]["name"] = None - self._defaults["GetTimeSetPeriod"] = {} - self._defaults["GetTimeSetPeriod"]["return"] = 0 - self._defaults["GetTimeSetPeriod"]["period"] = None - self._defaults["InitWithOptions"] = {} - self._defaults["InitWithOptions"]["return"] = 0 - self._defaults["InitWithOptions"]["newVi"] = None - self._defaults["Initiate"] = {} - self._defaults["Initiate"]["return"] = 0 - self._defaults["IsDone"] = {} - self._defaults["IsDone"]["return"] = 0 - self._defaults["IsDone"]["done"] = None - self._defaults["IsSiteEnabled"] = {} - self._defaults["IsSiteEnabled"]["return"] = 0 - self._defaults["IsSiteEnabled"]["enable"] = None - self._defaults["LoadLevels"] = {} - self._defaults["LoadLevels"]["return"] = 0 - self._defaults["LoadPattern"] = {} - self._defaults["LoadPattern"]["return"] = 0 - self._defaults["LoadPinMap"] = {} - self._defaults["LoadPinMap"]["return"] = 0 - self._defaults["LoadSpecifications"] = {} - self._defaults["LoadSpecifications"]["return"] = 0 - self._defaults["LoadTiming"] = {} - self._defaults["LoadTiming"]["return"] = 0 - self._defaults["LockSession"] = {} - self._defaults["LockSession"]["return"] = 0 - self._defaults["LockSession"]["callerHasLock"] = None - self._defaults["PPMU_Measure"] = {} - self._defaults["PPMU_Measure"]["return"] = 0 - self._defaults["PPMU_Measure"]["actualNumRead"] = None - self._defaults["PPMU_Measure"]["measurements"] = None - self._defaults["PPMU_Source"] = {} - self._defaults["PPMU_Source"]["return"] = 0 - self._defaults["ReadSequencerFlag"] = {} - self._defaults["ReadSequencerFlag"]["return"] = 0 - self._defaults["ReadSequencerFlag"]["value"] = None - self._defaults["ReadSequencerRegister"] = {} - self._defaults["ReadSequencerRegister"]["return"] = 0 - self._defaults["ReadSequencerRegister"]["value"] = None - self._defaults["ReadStatic"] = {} - self._defaults["ReadStatic"]["return"] = 0 - self._defaults["ReadStatic"]["actualNumRead"] = None - self._defaults["ReadStatic"]["data"] = None - self._defaults["ResetDevice"] = {} - self._defaults["ResetDevice"]["return"] = 0 - self._defaults["SelfCalibrate"] = {} - self._defaults["SelfCalibrate"]["return"] = 0 - self._defaults["SendSoftwareEdgeTrigger"] = {} - self._defaults["SendSoftwareEdgeTrigger"]["return"] = 0 - self._defaults["SetAttributeViBoolean"] = {} - self._defaults["SetAttributeViBoolean"]["return"] = 0 - self._defaults["SetAttributeViInt32"] = {} - self._defaults["SetAttributeViInt32"]["return"] = 0 - self._defaults["SetAttributeViInt64"] = {} - self._defaults["SetAttributeViInt64"]["return"] = 0 - self._defaults["SetAttributeViReal64"] = {} - self._defaults["SetAttributeViReal64"]["return"] = 0 - self._defaults["SetAttributeViString"] = {} - self._defaults["SetAttributeViString"]["return"] = 0 - self._defaults["TDR"] = {} - self._defaults["TDR"]["return"] = 0 - self._defaults["TDR"]["actualNumOffsets"] = None - self._defaults["TDR"]["offsets"] = None - self._defaults["UnloadAllPatterns"] = {} - self._defaults["UnloadAllPatterns"]["return"] = 0 - self._defaults["UnloadSpecifications"] = {} - self._defaults["UnloadSpecifications"]["return"] = 0 - self._defaults["UnlockSession"] = {} - self._defaults["UnlockSession"]["return"] = 0 - self._defaults["UnlockSession"]["callerHasLock"] = None - self._defaults["WaitUntilDone"] = {} - self._defaults["WaitUntilDone"]["return"] = 0 - self._defaults["WriteSequencerFlag"] = {} - self._defaults["WriteSequencerFlag"]["return"] = 0 - self._defaults["WriteSequencerRegister"] = {} - self._defaults["WriteSequencerRegister"]["return"] = 0 - self._defaults["WriteSourceWaveformBroadcastU32"] = {} - self._defaults["WriteSourceWaveformBroadcastU32"]["return"] = 0 - self._defaults["WriteSourceWaveformDataFromFileTDMS"] = {} - self._defaults["WriteSourceWaveformDataFromFileTDMS"]["return"] = 0 - self._defaults["WriteSourceWaveformSiteUniqueU32"] = {} - self._defaults["WriteSourceWaveformSiteUniqueU32"]["return"] = 0 - self._defaults["WriteStatic"] = {} - self._defaults["WriteStatic"]["return"] = 0 - self._defaults["close"] = {} - self._defaults["close"]["return"] = 0 - self._defaults["error_message"] = {} - self._defaults["error_message"]["return"] = 0 - self._defaults["error_message"]["errorMessage"] = None - self._defaults["reset"] = {} - self._defaults["reset"]["return"] = 0 - self._defaults["self_test"] = {} - self._defaults["self_test"]["return"] = 0 - self._defaults["self_test"]["testResult"] = None - self._defaults["self_test"]["testMessage"] = None + self._defaults['Abort'] = {} + self._defaults['Abort']['return'] = 0 + self._defaults['AbortKeepAlive'] = {} + self._defaults['AbortKeepAlive']['return'] = 0 + self._defaults['ApplyLevelsAndTiming'] = {} + self._defaults['ApplyLevelsAndTiming']['return'] = 0 + self._defaults['ApplyTDROffsets'] = {} + self._defaults['ApplyTDROffsets']['return'] = 0 + self._defaults['BurstPattern'] = {} + self._defaults['BurstPattern']['return'] = 0 + self._defaults['ClockGenerator_Abort'] = {} + self._defaults['ClockGenerator_Abort']['return'] = 0 + self._defaults['ClockGenerator_GenerateClock'] = {} + self._defaults['ClockGenerator_GenerateClock']['return'] = 0 + self._defaults['Commit'] = {} + self._defaults['Commit']['return'] = 0 + self._defaults['ConfigureActiveLoadLevels'] = {} + self._defaults['ConfigureActiveLoadLevels']['return'] = 0 + self._defaults['ConfigurePatternBurstSites'] = {} + self._defaults['ConfigurePatternBurstSites']['return'] = 0 + self._defaults['ConfigureTimeSetCompareEdgesStrobe'] = {} + self._defaults['ConfigureTimeSetCompareEdgesStrobe']['return'] = 0 + self._defaults['ConfigureTimeSetCompareEdgesStrobe2x'] = {} + self._defaults['ConfigureTimeSetCompareEdgesStrobe2x']['return'] = 0 + self._defaults['ConfigureTimeSetDriveEdges'] = {} + self._defaults['ConfigureTimeSetDriveEdges']['return'] = 0 + self._defaults['ConfigureTimeSetDriveEdges2x'] = {} + self._defaults['ConfigureTimeSetDriveEdges2x']['return'] = 0 + self._defaults['ConfigureTimeSetDriveFormat'] = {} + self._defaults['ConfigureTimeSetDriveFormat']['return'] = 0 + self._defaults['ConfigureTimeSetEdge'] = {} + self._defaults['ConfigureTimeSetEdge']['return'] = 0 + self._defaults['ConfigureTimeSetEdgeMultiplier'] = {} + self._defaults['ConfigureTimeSetEdgeMultiplier']['return'] = 0 + self._defaults['ConfigureTimeSetPeriod'] = {} + self._defaults['ConfigureTimeSetPeriod']['return'] = 0 + self._defaults['ConfigureVoltageLevels'] = {} + self._defaults['ConfigureVoltageLevels']['return'] = 0 + self._defaults['CreateCaptureWaveformFromFileDigicapture'] = {} + self._defaults['CreateCaptureWaveformFromFileDigicapture']['return'] = 0 + self._defaults['CreateCaptureWaveformParallel'] = {} + self._defaults['CreateCaptureWaveformParallel']['return'] = 0 + self._defaults['CreateCaptureWaveformSerial'] = {} + self._defaults['CreateCaptureWaveformSerial']['return'] = 0 + self._defaults['CreateSourceWaveformFromFileTDMS'] = {} + self._defaults['CreateSourceWaveformFromFileTDMS']['return'] = 0 + self._defaults['CreateSourceWaveformParallel'] = {} + self._defaults['CreateSourceWaveformParallel']['return'] = 0 + self._defaults['CreateSourceWaveformSerial'] = {} + self._defaults['CreateSourceWaveformSerial']['return'] = 0 + self._defaults['CreateTimeSet'] = {} + self._defaults['CreateTimeSet']['return'] = 0 + self._defaults['DeleteAllTimeSets'] = {} + self._defaults['DeleteAllTimeSets']['return'] = 0 + self._defaults['DisableSites'] = {} + self._defaults['DisableSites']['return'] = 0 + self._defaults['EnableSites'] = {} + self._defaults['EnableSites']['return'] = 0 + self._defaults['FetchHistoryRAMCycleInformation'] = {} + self._defaults['FetchHistoryRAMCycleInformation']['return'] = 0 + self._defaults['FetchHistoryRAMCycleInformation']['patternIndex'] = None + self._defaults['FetchHistoryRAMCycleInformation']['timeSetIndex'] = None + self._defaults['FetchHistoryRAMCycleInformation']['vectorNumber'] = None + self._defaults['FetchHistoryRAMCycleInformation']['cycleNumber'] = None + self._defaults['FetchHistoryRAMCycleInformation']['numDutCycles'] = None + self._defaults['FetchHistoryRAMCyclePinData'] = {} + self._defaults['FetchHistoryRAMCyclePinData']['return'] = 0 + self._defaults['FetchHistoryRAMCyclePinData']['actualNumPinData'] = None + self._defaults['FetchHistoryRAMCyclePinData']['expectedPinStates'] = None + self._defaults['FetchHistoryRAMCyclePinData']['actualPinStates'] = None + self._defaults['FetchHistoryRAMCyclePinData']['perPinPassFail'] = None + self._defaults['FetchHistoryRAMScanCycleNumber'] = {} + self._defaults['FetchHistoryRAMScanCycleNumber']['return'] = 0 + self._defaults['FetchHistoryRAMScanCycleNumber']['scanCycleNumber'] = None + self._defaults['FrequencyCounter_MeasureFrequency'] = {} + self._defaults['FrequencyCounter_MeasureFrequency']['return'] = 0 + self._defaults['FrequencyCounter_MeasureFrequency']['actualNumFrequencies'] = None + self._defaults['FrequencyCounter_MeasureFrequency']['frequencies'] = None + self._defaults['GetAttributeViBoolean'] = {} + self._defaults['GetAttributeViBoolean']['return'] = 0 + self._defaults['GetAttributeViBoolean']['value'] = None + self._defaults['GetAttributeViInt32'] = {} + self._defaults['GetAttributeViInt32']['return'] = 0 + self._defaults['GetAttributeViInt32']['value'] = None + self._defaults['GetAttributeViInt64'] = {} + self._defaults['GetAttributeViInt64']['return'] = 0 + self._defaults['GetAttributeViInt64']['value'] = None + self._defaults['GetAttributeViReal64'] = {} + self._defaults['GetAttributeViReal64']['return'] = 0 + self._defaults['GetAttributeViReal64']['value'] = None + self._defaults['GetAttributeViString'] = {} + self._defaults['GetAttributeViString']['return'] = 0 + self._defaults['GetAttributeViString']['value'] = None + self._defaults['GetChannelNameFromString'] = {} + self._defaults['GetChannelNameFromString']['return'] = 0 + self._defaults['GetChannelNameFromString']['names'] = None + self._defaults['GetError'] = {} + self._defaults['GetError']['return'] = 0 + self._defaults['GetError']['errorCode'] = None + self._defaults['GetError']['errorDescription'] = None + self._defaults['GetFailCount'] = {} + self._defaults['GetFailCount']['return'] = 0 + self._defaults['GetFailCount']['actualNumRead'] = None + self._defaults['GetFailCount']['failureCount'] = None + self._defaults['GetHistoryRAMSampleCount'] = {} + self._defaults['GetHistoryRAMSampleCount']['return'] = 0 + self._defaults['GetHistoryRAMSampleCount']['sampleCount'] = None + self._defaults['GetPatternName'] = {} + self._defaults['GetPatternName']['return'] = 0 + self._defaults['GetPatternName']['name'] = None + self._defaults['GetPatternPinList'] = {} + self._defaults['GetPatternPinList']['return'] = 0 + self._defaults['GetPatternPinList']['pinList'] = None + self._defaults['GetPinName'] = {} + self._defaults['GetPinName']['return'] = 0 + self._defaults['GetPinName']['name'] = None + self._defaults['GetPinResultsPinInformation'] = {} + self._defaults['GetPinResultsPinInformation']['return'] = 0 + self._defaults['GetPinResultsPinInformation']['actualNumValues'] = None + self._defaults['GetPinResultsPinInformation']['pinIndexes'] = None + self._defaults['GetPinResultsPinInformation']['siteNumbers'] = None + self._defaults['GetPinResultsPinInformation']['channelIndexes'] = None + self._defaults['GetSitePassFail'] = {} + self._defaults['GetSitePassFail']['return'] = 0 + self._defaults['GetSitePassFail']['actualNumSites'] = None + self._defaults['GetSitePassFail']['passFail'] = None + self._defaults['GetSiteResultsSiteNumbers'] = {} + self._defaults['GetSiteResultsSiteNumbers']['return'] = 0 + self._defaults['GetSiteResultsSiteNumbers']['actualNumSiteNumbers'] = None + self._defaults['GetSiteResultsSiteNumbers']['siteNumbers'] = None + self._defaults['GetTimeSetDriveFormat'] = {} + self._defaults['GetTimeSetDriveFormat']['return'] = 0 + self._defaults['GetTimeSetDriveFormat']['format'] = None + self._defaults['GetTimeSetEdge'] = {} + self._defaults['GetTimeSetEdge']['return'] = 0 + self._defaults['GetTimeSetEdge']['time'] = None + self._defaults['GetTimeSetEdgeMultiplier'] = {} + self._defaults['GetTimeSetEdgeMultiplier']['return'] = 0 + self._defaults['GetTimeSetEdgeMultiplier']['edgeMultiplier'] = None + self._defaults['GetTimeSetName'] = {} + self._defaults['GetTimeSetName']['return'] = 0 + self._defaults['GetTimeSetName']['name'] = None + self._defaults['GetTimeSetPeriod'] = {} + self._defaults['GetTimeSetPeriod']['return'] = 0 + self._defaults['GetTimeSetPeriod']['period'] = None + self._defaults['InitWithOptions'] = {} + self._defaults['InitWithOptions']['return'] = 0 + self._defaults['InitWithOptions']['newVi'] = None + self._defaults['Initiate'] = {} + self._defaults['Initiate']['return'] = 0 + self._defaults['IsDone'] = {} + self._defaults['IsDone']['return'] = 0 + self._defaults['IsDone']['done'] = None + self._defaults['IsSiteEnabled'] = {} + self._defaults['IsSiteEnabled']['return'] = 0 + self._defaults['IsSiteEnabled']['enable'] = None + self._defaults['LoadLevels'] = {} + self._defaults['LoadLevels']['return'] = 0 + self._defaults['LoadPattern'] = {} + self._defaults['LoadPattern']['return'] = 0 + self._defaults['LoadPinMap'] = {} + self._defaults['LoadPinMap']['return'] = 0 + self._defaults['LoadSpecifications'] = {} + self._defaults['LoadSpecifications']['return'] = 0 + self._defaults['LoadTiming'] = {} + self._defaults['LoadTiming']['return'] = 0 + self._defaults['LockSession'] = {} + self._defaults['LockSession']['return'] = 0 + self._defaults['LockSession']['callerHasLock'] = None + self._defaults['PPMU_Measure'] = {} + self._defaults['PPMU_Measure']['return'] = 0 + self._defaults['PPMU_Measure']['actualNumRead'] = None + self._defaults['PPMU_Measure']['measurements'] = None + self._defaults['PPMU_Source'] = {} + self._defaults['PPMU_Source']['return'] = 0 + self._defaults['ReadSequencerFlag'] = {} + self._defaults['ReadSequencerFlag']['return'] = 0 + self._defaults['ReadSequencerFlag']['value'] = None + self._defaults['ReadSequencerRegister'] = {} + self._defaults['ReadSequencerRegister']['return'] = 0 + self._defaults['ReadSequencerRegister']['value'] = None + self._defaults['ReadStatic'] = {} + self._defaults['ReadStatic']['return'] = 0 + self._defaults['ReadStatic']['actualNumRead'] = None + self._defaults['ReadStatic']['data'] = None + self._defaults['ResetDevice'] = {} + self._defaults['ResetDevice']['return'] = 0 + self._defaults['SelfCalibrate'] = {} + self._defaults['SelfCalibrate']['return'] = 0 + self._defaults['SendSoftwareEdgeTrigger'] = {} + self._defaults['SendSoftwareEdgeTrigger']['return'] = 0 + self._defaults['SetAttributeViBoolean'] = {} + self._defaults['SetAttributeViBoolean']['return'] = 0 + self._defaults['SetAttributeViInt32'] = {} + self._defaults['SetAttributeViInt32']['return'] = 0 + self._defaults['SetAttributeViInt64'] = {} + self._defaults['SetAttributeViInt64']['return'] = 0 + self._defaults['SetAttributeViReal64'] = {} + self._defaults['SetAttributeViReal64']['return'] = 0 + self._defaults['SetAttributeViString'] = {} + self._defaults['SetAttributeViString']['return'] = 0 + self._defaults['TDR'] = {} + self._defaults['TDR']['return'] = 0 + self._defaults['TDR']['actualNumOffsets'] = None + self._defaults['TDR']['offsets'] = None + self._defaults['UnloadAllPatterns'] = {} + self._defaults['UnloadAllPatterns']['return'] = 0 + self._defaults['UnloadSpecifications'] = {} + self._defaults['UnloadSpecifications']['return'] = 0 + self._defaults['UnlockSession'] = {} + self._defaults['UnlockSession']['return'] = 0 + self._defaults['UnlockSession']['callerHasLock'] = None + self._defaults['WaitUntilDone'] = {} + self._defaults['WaitUntilDone']['return'] = 0 + self._defaults['WriteSequencerFlag'] = {} + self._defaults['WriteSequencerFlag']['return'] = 0 + self._defaults['WriteSequencerRegister'] = {} + self._defaults['WriteSequencerRegister']['return'] = 0 + self._defaults['WriteSourceWaveformBroadcastU32'] = {} + self._defaults['WriteSourceWaveformBroadcastU32']['return'] = 0 + self._defaults['WriteSourceWaveformDataFromFileTDMS'] = {} + self._defaults['WriteSourceWaveformDataFromFileTDMS']['return'] = 0 + self._defaults['WriteSourceWaveformSiteUniqueU32'] = {} + self._defaults['WriteSourceWaveformSiteUniqueU32']['return'] = 0 + self._defaults['WriteStatic'] = {} + self._defaults['WriteStatic']['return'] = 0 + self._defaults['close'] = {} + self._defaults['close']['return'] = 0 + self._defaults['error_message'] = {} + self._defaults['error_message']['return'] = 0 + self._defaults['error_message']['errorMessage'] = None + self._defaults['reset'] = {} + self._defaults['reset']['return'] = 0 + self._defaults['self_test'] = {} + self._defaults['self_test']['return'] = 0 + self._defaults['self_test']['testResult'] = None + self._defaults['self_test']['testMessage'] = None def __getitem__(self, func): return self._defaults[func] @@ -263,1492 +261,989 @@ def __setitem__(self, func, val): self._defaults[func] = val def niDigital_Abort(self, vi): # noqa: N802 - if self._defaults["Abort"]["return"] != 0: - return self._defaults["Abort"]["return"] - return self._defaults["Abort"]["return"] + if self._defaults['Abort']['return'] != 0: + return self._defaults['Abort']['return'] + return self._defaults['Abort']['return'] def niDigital_AbortKeepAlive(self, vi): # noqa: N802 - if self._defaults["AbortKeepAlive"]["return"] != 0: - return self._defaults["AbortKeepAlive"]["return"] - return self._defaults["AbortKeepAlive"]["return"] - - def niDigital_ApplyLevelsAndTiming( - self, - vi, - site_list, - levels_sheet, - timing_sheet, - initial_state_high_pins, - initial_state_low_pins, - initial_state_tristate_pins, - ): # noqa: N802 - if self._defaults["ApplyLevelsAndTiming"]["return"] != 0: - return self._defaults["ApplyLevelsAndTiming"]["return"] - return self._defaults["ApplyLevelsAndTiming"]["return"] - - def niDigital_ApplyTDROffsets( - self, vi, channel_list, num_offsets, offsets - ): # noqa: N802 - if self._defaults["ApplyTDROffsets"]["return"] != 0: - return self._defaults["ApplyTDROffsets"]["return"] - return self._defaults["ApplyTDROffsets"]["return"] - - def niDigital_BurstPattern( - self, - vi, - site_list, - start_label, - select_digital_function, - wait_until_done, - timeout, - ): # noqa: N802 - if self._defaults["BurstPattern"]["return"] != 0: - return self._defaults["BurstPattern"]["return"] - return self._defaults["BurstPattern"]["return"] + if self._defaults['AbortKeepAlive']['return'] != 0: + return self._defaults['AbortKeepAlive']['return'] + return self._defaults['AbortKeepAlive']['return'] + + def niDigital_ApplyLevelsAndTiming(self, vi, site_list, levels_sheet, timing_sheet, initial_state_high_pins, initial_state_low_pins, initial_state_tristate_pins): # noqa: N802 + if self._defaults['ApplyLevelsAndTiming']['return'] != 0: + return self._defaults['ApplyLevelsAndTiming']['return'] + return self._defaults['ApplyLevelsAndTiming']['return'] + + def niDigital_ApplyTDROffsets(self, vi, channel_list, num_offsets, offsets): # noqa: N802 + if self._defaults['ApplyTDROffsets']['return'] != 0: + return self._defaults['ApplyTDROffsets']['return'] + return self._defaults['ApplyTDROffsets']['return'] + + def niDigital_BurstPattern(self, vi, site_list, start_label, select_digital_function, wait_until_done, timeout): # noqa: N802 + if self._defaults['BurstPattern']['return'] != 0: + return self._defaults['BurstPattern']['return'] + return self._defaults['BurstPattern']['return'] def niDigital_ClockGenerator_Abort(self, vi, channel_list): # noqa: N802 - if self._defaults["ClockGenerator_Abort"]["return"] != 0: - return self._defaults["ClockGenerator_Abort"]["return"] - return self._defaults["ClockGenerator_Abort"]["return"] + if self._defaults['ClockGenerator_Abort']['return'] != 0: + return self._defaults['ClockGenerator_Abort']['return'] + return self._defaults['ClockGenerator_Abort']['return'] - def niDigital_ClockGenerator_GenerateClock( - self, vi, channel_list, frequency, select_digital_function - ): # noqa: N802 - if self._defaults["ClockGenerator_GenerateClock"]["return"] != 0: - return self._defaults["ClockGenerator_GenerateClock"]["return"] - return self._defaults["ClockGenerator_GenerateClock"]["return"] + def niDigital_ClockGenerator_GenerateClock(self, vi, channel_list, frequency, select_digital_function): # noqa: N802 + if self._defaults['ClockGenerator_GenerateClock']['return'] != 0: + return self._defaults['ClockGenerator_GenerateClock']['return'] + return self._defaults['ClockGenerator_GenerateClock']['return'] def niDigital_Commit(self, vi): # noqa: N802 - if self._defaults["Commit"]["return"] != 0: - return self._defaults["Commit"]["return"] - return self._defaults["Commit"]["return"] + if self._defaults['Commit']['return'] != 0: + return self._defaults['Commit']['return'] + return self._defaults['Commit']['return'] - def niDigital_ConfigureActiveLoadLevels( - self, vi, channel_list, iol, ioh, vcom - ): # noqa: N802 - if self._defaults["ConfigureActiveLoadLevels"]["return"] != 0: - return self._defaults["ConfigureActiveLoadLevels"]["return"] - return self._defaults["ConfigureActiveLoadLevels"]["return"] + def niDigital_ConfigureActiveLoadLevels(self, vi, channel_list, iol, ioh, vcom): # noqa: N802 + if self._defaults['ConfigureActiveLoadLevels']['return'] != 0: + return self._defaults['ConfigureActiveLoadLevels']['return'] + return self._defaults['ConfigureActiveLoadLevels']['return'] def niDigital_ConfigurePatternBurstSites(self, vi, site_list): # noqa: N802 - if self._defaults["ConfigurePatternBurstSites"]["return"] != 0: - return self._defaults["ConfigurePatternBurstSites"]["return"] - return self._defaults["ConfigurePatternBurstSites"]["return"] - - def niDigital_ConfigureTimeSetCompareEdgesStrobe( - self, vi, pin_list, time_set_name, strobe_edge - ): # noqa: N802 - if self._defaults["ConfigureTimeSetCompareEdgesStrobe"]["return"] != 0: - return self._defaults["ConfigureTimeSetCompareEdgesStrobe"]["return"] - return self._defaults["ConfigureTimeSetCompareEdgesStrobe"]["return"] - - def niDigital_ConfigureTimeSetCompareEdgesStrobe2x( - self, vi, pin_list, time_set_name, strobe_edge, strobe2_edge - ): # noqa: N802 - if self._defaults["ConfigureTimeSetCompareEdgesStrobe2x"]["return"] != 0: - return self._defaults["ConfigureTimeSetCompareEdgesStrobe2x"]["return"] - return self._defaults["ConfigureTimeSetCompareEdgesStrobe2x"]["return"] - - def niDigital_ConfigureTimeSetDriveEdges( - self, - vi, - pin_list, - time_set_name, - format, - drive_on_edge, - drive_data_edge, - drive_return_edge, - drive_off_edge, - ): # noqa: N802 - if self._defaults["ConfigureTimeSetDriveEdges"]["return"] != 0: - return self._defaults["ConfigureTimeSetDriveEdges"]["return"] - return self._defaults["ConfigureTimeSetDriveEdges"]["return"] - - def niDigital_ConfigureTimeSetDriveEdges2x( - self, - vi, - pin_list, - time_set_name, - format, - drive_on_edge, - drive_data_edge, - drive_return_edge, - drive_off_edge, - drive_data2_edge, - drive_return2_edge, - ): # noqa: N802 - if self._defaults["ConfigureTimeSetDriveEdges2x"]["return"] != 0: - return self._defaults["ConfigureTimeSetDriveEdges2x"]["return"] - return self._defaults["ConfigureTimeSetDriveEdges2x"]["return"] - - def niDigital_ConfigureTimeSetDriveFormat( - self, vi, pin_list, time_set_name, drive_format - ): # noqa: N802 - if self._defaults["ConfigureTimeSetDriveFormat"]["return"] != 0: - return self._defaults["ConfigureTimeSetDriveFormat"]["return"] - return self._defaults["ConfigureTimeSetDriveFormat"]["return"] - - def niDigital_ConfigureTimeSetEdge( - self, vi, pin_list, time_set_name, edge, time - ): # noqa: N802 - if self._defaults["ConfigureTimeSetEdge"]["return"] != 0: - return self._defaults["ConfigureTimeSetEdge"]["return"] - return self._defaults["ConfigureTimeSetEdge"]["return"] - - def niDigital_ConfigureTimeSetEdgeMultiplier( - self, vi, pin_list, time_set_name, edge_multiplier - ): # noqa: N802 - if self._defaults["ConfigureTimeSetEdgeMultiplier"]["return"] != 0: - return self._defaults["ConfigureTimeSetEdgeMultiplier"]["return"] - return self._defaults["ConfigureTimeSetEdgeMultiplier"]["return"] + if self._defaults['ConfigurePatternBurstSites']['return'] != 0: + return self._defaults['ConfigurePatternBurstSites']['return'] + return self._defaults['ConfigurePatternBurstSites']['return'] + + def niDigital_ConfigureTimeSetCompareEdgesStrobe(self, vi, pin_list, time_set_name, strobe_edge): # noqa: N802 + if self._defaults['ConfigureTimeSetCompareEdgesStrobe']['return'] != 0: + return self._defaults['ConfigureTimeSetCompareEdgesStrobe']['return'] + return self._defaults['ConfigureTimeSetCompareEdgesStrobe']['return'] + + def niDigital_ConfigureTimeSetCompareEdgesStrobe2x(self, vi, pin_list, time_set_name, strobe_edge, strobe2_edge): # noqa: N802 + if self._defaults['ConfigureTimeSetCompareEdgesStrobe2x']['return'] != 0: + return self._defaults['ConfigureTimeSetCompareEdgesStrobe2x']['return'] + return self._defaults['ConfigureTimeSetCompareEdgesStrobe2x']['return'] + + def niDigital_ConfigureTimeSetDriveEdges(self, vi, pin_list, time_set_name, format, drive_on_edge, drive_data_edge, drive_return_edge, drive_off_edge): # noqa: N802 + if self._defaults['ConfigureTimeSetDriveEdges']['return'] != 0: + return self._defaults['ConfigureTimeSetDriveEdges']['return'] + return self._defaults['ConfigureTimeSetDriveEdges']['return'] + + def niDigital_ConfigureTimeSetDriveEdges2x(self, vi, pin_list, time_set_name, format, drive_on_edge, drive_data_edge, drive_return_edge, drive_off_edge, drive_data2_edge, drive_return2_edge): # noqa: N802 + if self._defaults['ConfigureTimeSetDriveEdges2x']['return'] != 0: + return self._defaults['ConfigureTimeSetDriveEdges2x']['return'] + return self._defaults['ConfigureTimeSetDriveEdges2x']['return'] + + def niDigital_ConfigureTimeSetDriveFormat(self, vi, pin_list, time_set_name, drive_format): # noqa: N802 + if self._defaults['ConfigureTimeSetDriveFormat']['return'] != 0: + return self._defaults['ConfigureTimeSetDriveFormat']['return'] + return self._defaults['ConfigureTimeSetDriveFormat']['return'] + + def niDigital_ConfigureTimeSetEdge(self, vi, pin_list, time_set_name, edge, time): # noqa: N802 + if self._defaults['ConfigureTimeSetEdge']['return'] != 0: + return self._defaults['ConfigureTimeSetEdge']['return'] + return self._defaults['ConfigureTimeSetEdge']['return'] + + def niDigital_ConfigureTimeSetEdgeMultiplier(self, vi, pin_list, time_set_name, edge_multiplier): # noqa: N802 + if self._defaults['ConfigureTimeSetEdgeMultiplier']['return'] != 0: + return self._defaults['ConfigureTimeSetEdgeMultiplier']['return'] + return self._defaults['ConfigureTimeSetEdgeMultiplier']['return'] def niDigital_ConfigureTimeSetPeriod(self, vi, time_set_name, period): # noqa: N802 - if self._defaults["ConfigureTimeSetPeriod"]["return"] != 0: - return self._defaults["ConfigureTimeSetPeriod"]["return"] - return self._defaults["ConfigureTimeSetPeriod"]["return"] - - def niDigital_ConfigureVoltageLevels( - self, vi, channel_list, vil, vih, vol, voh, vterm - ): # noqa: N802 - if self._defaults["ConfigureVoltageLevels"]["return"] != 0: - return self._defaults["ConfigureVoltageLevels"]["return"] - return self._defaults["ConfigureVoltageLevels"]["return"] - - def niDigital_CreateCaptureWaveformFromFileDigicapture( - self, vi, waveform_name, waveform_file_path - ): # noqa: N802 - if self._defaults["CreateCaptureWaveformFromFileDigicapture"]["return"] != 0: - return self._defaults["CreateCaptureWaveformFromFileDigicapture"]["return"] - return self._defaults["CreateCaptureWaveformFromFileDigicapture"]["return"] - - def niDigital_CreateCaptureWaveformParallel( - self, vi, pin_list, waveform_name - ): # noqa: N802 - if self._defaults["CreateCaptureWaveformParallel"]["return"] != 0: - return self._defaults["CreateCaptureWaveformParallel"]["return"] - return self._defaults["CreateCaptureWaveformParallel"]["return"] - - def niDigital_CreateCaptureWaveformSerial( - self, vi, pin_list, waveform_name, sample_width, bit_order - ): # noqa: N802 - if self._defaults["CreateCaptureWaveformSerial"]["return"] != 0: - return self._defaults["CreateCaptureWaveformSerial"]["return"] - return self._defaults["CreateCaptureWaveformSerial"]["return"] - - def niDigital_CreateSourceWaveformFromFileTDMS( - self, vi, waveform_name, waveform_file_path, write_waveform_data - ): # noqa: N802 - if self._defaults["CreateSourceWaveformFromFileTDMS"]["return"] != 0: - return self._defaults["CreateSourceWaveformFromFileTDMS"]["return"] - return self._defaults["CreateSourceWaveformFromFileTDMS"]["return"] - - def niDigital_CreateSourceWaveformParallel( - self, vi, pin_list, waveform_name, data_mapping - ): # noqa: N802 - if self._defaults["CreateSourceWaveformParallel"]["return"] != 0: - return self._defaults["CreateSourceWaveformParallel"]["return"] - return self._defaults["CreateSourceWaveformParallel"]["return"] - - def niDigital_CreateSourceWaveformSerial( - self, vi, pin_list, waveform_name, data_mapping, sample_width, bit_order - ): # noqa: N802 - if self._defaults["CreateSourceWaveformSerial"]["return"] != 0: - return self._defaults["CreateSourceWaveformSerial"]["return"] - return self._defaults["CreateSourceWaveformSerial"]["return"] + if self._defaults['ConfigureTimeSetPeriod']['return'] != 0: + return self._defaults['ConfigureTimeSetPeriod']['return'] + return self._defaults['ConfigureTimeSetPeriod']['return'] + + def niDigital_ConfigureVoltageLevels(self, vi, channel_list, vil, vih, vol, voh, vterm): # noqa: N802 + if self._defaults['ConfigureVoltageLevels']['return'] != 0: + return self._defaults['ConfigureVoltageLevels']['return'] + return self._defaults['ConfigureVoltageLevels']['return'] + + def niDigital_CreateCaptureWaveformFromFileDigicapture(self, vi, waveform_name, waveform_file_path): # noqa: N802 + if self._defaults['CreateCaptureWaveformFromFileDigicapture']['return'] != 0: + return self._defaults['CreateCaptureWaveformFromFileDigicapture']['return'] + return self._defaults['CreateCaptureWaveformFromFileDigicapture']['return'] + + def niDigital_CreateCaptureWaveformParallel(self, vi, pin_list, waveform_name): # noqa: N802 + if self._defaults['CreateCaptureWaveformParallel']['return'] != 0: + return self._defaults['CreateCaptureWaveformParallel']['return'] + return self._defaults['CreateCaptureWaveformParallel']['return'] + + def niDigital_CreateCaptureWaveformSerial(self, vi, pin_list, waveform_name, sample_width, bit_order): # noqa: N802 + if self._defaults['CreateCaptureWaveformSerial']['return'] != 0: + return self._defaults['CreateCaptureWaveformSerial']['return'] + return self._defaults['CreateCaptureWaveformSerial']['return'] + + def niDigital_CreateSourceWaveformFromFileTDMS(self, vi, waveform_name, waveform_file_path, write_waveform_data): # noqa: N802 + if self._defaults['CreateSourceWaveformFromFileTDMS']['return'] != 0: + return self._defaults['CreateSourceWaveformFromFileTDMS']['return'] + return self._defaults['CreateSourceWaveformFromFileTDMS']['return'] + + def niDigital_CreateSourceWaveformParallel(self, vi, pin_list, waveform_name, data_mapping): # noqa: N802 + if self._defaults['CreateSourceWaveformParallel']['return'] != 0: + return self._defaults['CreateSourceWaveformParallel']['return'] + return self._defaults['CreateSourceWaveformParallel']['return'] + + def niDigital_CreateSourceWaveformSerial(self, vi, pin_list, waveform_name, data_mapping, sample_width, bit_order): # noqa: N802 + if self._defaults['CreateSourceWaveformSerial']['return'] != 0: + return self._defaults['CreateSourceWaveformSerial']['return'] + return self._defaults['CreateSourceWaveformSerial']['return'] def niDigital_CreateTimeSet(self, vi, name): # noqa: N802 - if self._defaults["CreateTimeSet"]["return"] != 0: - return self._defaults["CreateTimeSet"]["return"] - return self._defaults["CreateTimeSet"]["return"] + if self._defaults['CreateTimeSet']['return'] != 0: + return self._defaults['CreateTimeSet']['return'] + return self._defaults['CreateTimeSet']['return'] def niDigital_DeleteAllTimeSets(self, vi): # noqa: N802 - if self._defaults["DeleteAllTimeSets"]["return"] != 0: - return self._defaults["DeleteAllTimeSets"]["return"] - return self._defaults["DeleteAllTimeSets"]["return"] + if self._defaults['DeleteAllTimeSets']['return'] != 0: + return self._defaults['DeleteAllTimeSets']['return'] + return self._defaults['DeleteAllTimeSets']['return'] def niDigital_DisableSites(self, vi, site_list): # noqa: N802 - if self._defaults["DisableSites"]["return"] != 0: - return self._defaults["DisableSites"]["return"] - return self._defaults["DisableSites"]["return"] + if self._defaults['DisableSites']['return'] != 0: + return self._defaults['DisableSites']['return'] + return self._defaults['DisableSites']['return'] def niDigital_EnableSites(self, vi, site_list): # noqa: N802 - if self._defaults["EnableSites"]["return"] != 0: - return self._defaults["EnableSites"]["return"] - return self._defaults["EnableSites"]["return"] - - def niDigital_FetchHistoryRAMCycleInformation( - self, - vi, - site, - sample_index, - pattern_index, - time_set_index, - vector_number, - cycle_number, - num_dut_cycles, - ): # noqa: N802 - if self._defaults["FetchHistoryRAMCycleInformation"]["return"] != 0: - return self._defaults["FetchHistoryRAMCycleInformation"]["return"] + if self._defaults['EnableSites']['return'] != 0: + return self._defaults['EnableSites']['return'] + return self._defaults['EnableSites']['return'] + + def niDigital_FetchHistoryRAMCycleInformation(self, vi, site, sample_index, pattern_index, time_set_index, vector_number, cycle_number, num_dut_cycles): # noqa: N802 + if self._defaults['FetchHistoryRAMCycleInformation']['return'] != 0: + return self._defaults['FetchHistoryRAMCycleInformation']['return'] # pattern_index - if self._defaults["FetchHistoryRAMCycleInformation"]["patternIndex"] is None: - raise MockFunctionCallError( - "niDigital_FetchHistoryRAMCycleInformation", param="patternIndex" - ) + if self._defaults['FetchHistoryRAMCycleInformation']['patternIndex'] is None: + raise MockFunctionCallError("niDigital_FetchHistoryRAMCycleInformation", param='patternIndex') if pattern_index is not None: - pattern_index.contents.value = self._defaults[ - "FetchHistoryRAMCycleInformation" - ]["patternIndex"] + pattern_index.contents.value = self._defaults['FetchHistoryRAMCycleInformation']['patternIndex'] # time_set_index - if self._defaults["FetchHistoryRAMCycleInformation"]["timeSetIndex"] is None: - raise MockFunctionCallError( - "niDigital_FetchHistoryRAMCycleInformation", param="timeSetIndex" - ) + if self._defaults['FetchHistoryRAMCycleInformation']['timeSetIndex'] is None: + raise MockFunctionCallError("niDigital_FetchHistoryRAMCycleInformation", param='timeSetIndex') if time_set_index is not None: - time_set_index.contents.value = self._defaults[ - "FetchHistoryRAMCycleInformation" - ]["timeSetIndex"] + time_set_index.contents.value = self._defaults['FetchHistoryRAMCycleInformation']['timeSetIndex'] # vector_number - if self._defaults["FetchHistoryRAMCycleInformation"]["vectorNumber"] is None: - raise MockFunctionCallError( - "niDigital_FetchHistoryRAMCycleInformation", param="vectorNumber" - ) + if self._defaults['FetchHistoryRAMCycleInformation']['vectorNumber'] is None: + raise MockFunctionCallError("niDigital_FetchHistoryRAMCycleInformation", param='vectorNumber') if vector_number is not None: - vector_number.contents.value = self._defaults[ - "FetchHistoryRAMCycleInformation" - ]["vectorNumber"] + vector_number.contents.value = self._defaults['FetchHistoryRAMCycleInformation']['vectorNumber'] # cycle_number - if self._defaults["FetchHistoryRAMCycleInformation"]["cycleNumber"] is None: - raise MockFunctionCallError( - "niDigital_FetchHistoryRAMCycleInformation", param="cycleNumber" - ) + if self._defaults['FetchHistoryRAMCycleInformation']['cycleNumber'] is None: + raise MockFunctionCallError("niDigital_FetchHistoryRAMCycleInformation", param='cycleNumber') if cycle_number is not None: - cycle_number.contents.value = self._defaults[ - "FetchHistoryRAMCycleInformation" - ]["cycleNumber"] + cycle_number.contents.value = self._defaults['FetchHistoryRAMCycleInformation']['cycleNumber'] # num_dut_cycles - if self._defaults["FetchHistoryRAMCycleInformation"]["numDutCycles"] is None: - raise MockFunctionCallError( - "niDigital_FetchHistoryRAMCycleInformation", param="numDutCycles" - ) + if self._defaults['FetchHistoryRAMCycleInformation']['numDutCycles'] is None: + raise MockFunctionCallError("niDigital_FetchHistoryRAMCycleInformation", param='numDutCycles') if num_dut_cycles is not None: - num_dut_cycles.contents.value = self._defaults[ - "FetchHistoryRAMCycleInformation" - ]["numDutCycles"] - return self._defaults["FetchHistoryRAMCycleInformation"]["return"] - - def niDigital_FetchHistoryRAMCyclePinData( - self, - vi, - site, - pin_list, - sample_index, - dut_cycle_index, - pin_data_buffer_size, - expected_pin_states, - actual_pin_states, - per_pin_pass_fail, - actual_num_pin_data, - ): # noqa: N802 - if self._defaults["FetchHistoryRAMCyclePinData"]["return"] != 0: - return self._defaults["FetchHistoryRAMCyclePinData"]["return"] + num_dut_cycles.contents.value = self._defaults['FetchHistoryRAMCycleInformation']['numDutCycles'] + return self._defaults['FetchHistoryRAMCycleInformation']['return'] + + def niDigital_FetchHistoryRAMCyclePinData(self, vi, site, pin_list, sample_index, dut_cycle_index, pin_data_buffer_size, expected_pin_states, actual_pin_states, per_pin_pass_fail, actual_num_pin_data): # noqa: N802 + if self._defaults['FetchHistoryRAMCyclePinData']['return'] != 0: + return self._defaults['FetchHistoryRAMCyclePinData']['return'] # actual_num_pin_data - if self._defaults["FetchHistoryRAMCyclePinData"]["actualNumPinData"] is None: - raise MockFunctionCallError( - "niDigital_FetchHistoryRAMCyclePinData", param="actualNumPinData" - ) + if self._defaults['FetchHistoryRAMCyclePinData']['actualNumPinData'] is None: + raise MockFunctionCallError("niDigital_FetchHistoryRAMCyclePinData", param='actualNumPinData') if actual_num_pin_data is not None: - actual_num_pin_data.contents.value = self._defaults[ - "FetchHistoryRAMCyclePinData" - ]["actualNumPinData"] - if self._defaults["FetchHistoryRAMCyclePinData"]["expectedPinStates"] is None: - raise MockFunctionCallError( - "niDigital_FetchHistoryRAMCyclePinData", param="expectedPinStates" - ) + actual_num_pin_data.contents.value = self._defaults['FetchHistoryRAMCyclePinData']['actualNumPinData'] + if self._defaults['FetchHistoryRAMCyclePinData']['expectedPinStates'] is None: + raise MockFunctionCallError("niDigital_FetchHistoryRAMCyclePinData", param='expectedPinStates') if pin_data_buffer_size.value == 0: - return len( - self._defaults["FetchHistoryRAMCyclePinData"]["expectedPinStates"] - ) + return len(self._defaults['FetchHistoryRAMCyclePinData']['expectedPinStates']) try: expected_pin_states_ref = expected_pin_states.contents except AttributeError: expected_pin_states_ref = expected_pin_states - for i in range( - len(self._defaults["FetchHistoryRAMCyclePinData"]["expectedPinStates"]) - ): - expected_pin_states_ref[i] = self._defaults["FetchHistoryRAMCyclePinData"][ - "expectedPinStates" - ][i] - if self._defaults["FetchHistoryRAMCyclePinData"]["actualPinStates"] is None: - raise MockFunctionCallError( - "niDigital_FetchHistoryRAMCyclePinData", param="actualPinStates" - ) + for i in range(len(self._defaults['FetchHistoryRAMCyclePinData']['expectedPinStates'])): + expected_pin_states_ref[i] = self._defaults['FetchHistoryRAMCyclePinData']['expectedPinStates'][i] + if self._defaults['FetchHistoryRAMCyclePinData']['actualPinStates'] is None: + raise MockFunctionCallError("niDigital_FetchHistoryRAMCyclePinData", param='actualPinStates') if pin_data_buffer_size.value == 0: - return len(self._defaults["FetchHistoryRAMCyclePinData"]["actualPinStates"]) + return len(self._defaults['FetchHistoryRAMCyclePinData']['actualPinStates']) try: actual_pin_states_ref = actual_pin_states.contents except AttributeError: actual_pin_states_ref = actual_pin_states - for i in range( - len(self._defaults["FetchHistoryRAMCyclePinData"]["actualPinStates"]) - ): - actual_pin_states_ref[i] = self._defaults["FetchHistoryRAMCyclePinData"][ - "actualPinStates" - ][i] - if self._defaults["FetchHistoryRAMCyclePinData"]["perPinPassFail"] is None: - raise MockFunctionCallError( - "niDigital_FetchHistoryRAMCyclePinData", param="perPinPassFail" - ) + for i in range(len(self._defaults['FetchHistoryRAMCyclePinData']['actualPinStates'])): + actual_pin_states_ref[i] = self._defaults['FetchHistoryRAMCyclePinData']['actualPinStates'][i] + if self._defaults['FetchHistoryRAMCyclePinData']['perPinPassFail'] is None: + raise MockFunctionCallError("niDigital_FetchHistoryRAMCyclePinData", param='perPinPassFail') if pin_data_buffer_size.value == 0: - return len(self._defaults["FetchHistoryRAMCyclePinData"]["perPinPassFail"]) + return len(self._defaults['FetchHistoryRAMCyclePinData']['perPinPassFail']) try: per_pin_pass_fail_ref = per_pin_pass_fail.contents except AttributeError: per_pin_pass_fail_ref = per_pin_pass_fail - for i in range( - len(self._defaults["FetchHistoryRAMCyclePinData"]["perPinPassFail"]) - ): - per_pin_pass_fail_ref[i] = self._defaults["FetchHistoryRAMCyclePinData"][ - "perPinPassFail" - ][i] - return self._defaults["FetchHistoryRAMCyclePinData"]["return"] - - def niDigital_FetchHistoryRAMScanCycleNumber( - self, vi, site, sample_index, scan_cycle_number - ): # noqa: N802 - if self._defaults["FetchHistoryRAMScanCycleNumber"]["return"] != 0: - return self._defaults["FetchHistoryRAMScanCycleNumber"]["return"] + for i in range(len(self._defaults['FetchHistoryRAMCyclePinData']['perPinPassFail'])): + per_pin_pass_fail_ref[i] = self._defaults['FetchHistoryRAMCyclePinData']['perPinPassFail'][i] + return self._defaults['FetchHistoryRAMCyclePinData']['return'] + + def niDigital_FetchHistoryRAMScanCycleNumber(self, vi, site, sample_index, scan_cycle_number): # noqa: N802 + if self._defaults['FetchHistoryRAMScanCycleNumber']['return'] != 0: + return self._defaults['FetchHistoryRAMScanCycleNumber']['return'] # scan_cycle_number - if self._defaults["FetchHistoryRAMScanCycleNumber"]["scanCycleNumber"] is None: - raise MockFunctionCallError( - "niDigital_FetchHistoryRAMScanCycleNumber", param="scanCycleNumber" - ) + if self._defaults['FetchHistoryRAMScanCycleNumber']['scanCycleNumber'] is None: + raise MockFunctionCallError("niDigital_FetchHistoryRAMScanCycleNumber", param='scanCycleNumber') if scan_cycle_number is not None: - scan_cycle_number.contents.value = self._defaults[ - "FetchHistoryRAMScanCycleNumber" - ]["scanCycleNumber"] - return self._defaults["FetchHistoryRAMScanCycleNumber"]["return"] - - def niDigital_FrequencyCounter_MeasureFrequency( - self, - vi, - channel_list, - frequencies_buffer_size, - frequencies, - actual_num_frequencies, - ): # noqa: N802 - if self._defaults["FrequencyCounter_MeasureFrequency"]["return"] != 0: - return self._defaults["FrequencyCounter_MeasureFrequency"]["return"] + scan_cycle_number.contents.value = self._defaults['FetchHistoryRAMScanCycleNumber']['scanCycleNumber'] + return self._defaults['FetchHistoryRAMScanCycleNumber']['return'] + + def niDigital_FrequencyCounter_MeasureFrequency(self, vi, channel_list, frequencies_buffer_size, frequencies, actual_num_frequencies): # noqa: N802 + if self._defaults['FrequencyCounter_MeasureFrequency']['return'] != 0: + return self._defaults['FrequencyCounter_MeasureFrequency']['return'] # actual_num_frequencies - if ( - self._defaults["FrequencyCounter_MeasureFrequency"]["actualNumFrequencies"] - is None - ): - raise MockFunctionCallError( - "niDigital_FrequencyCounter_MeasureFrequency", - param="actualNumFrequencies", - ) + if self._defaults['FrequencyCounter_MeasureFrequency']['actualNumFrequencies'] is None: + raise MockFunctionCallError("niDigital_FrequencyCounter_MeasureFrequency", param='actualNumFrequencies') if actual_num_frequencies is not None: - actual_num_frequencies.contents.value = self._defaults[ - "FrequencyCounter_MeasureFrequency" - ]["actualNumFrequencies"] - if self._defaults["FrequencyCounter_MeasureFrequency"]["frequencies"] is None: - raise MockFunctionCallError( - "niDigital_FrequencyCounter_MeasureFrequency", param="frequencies" - ) + actual_num_frequencies.contents.value = self._defaults['FrequencyCounter_MeasureFrequency']['actualNumFrequencies'] + if self._defaults['FrequencyCounter_MeasureFrequency']['frequencies'] is None: + raise MockFunctionCallError("niDigital_FrequencyCounter_MeasureFrequency", param='frequencies') if frequencies_buffer_size.value == 0: - return len( - self._defaults["FrequencyCounter_MeasureFrequency"]["frequencies"] - ) + return len(self._defaults['FrequencyCounter_MeasureFrequency']['frequencies']) try: frequencies_ref = frequencies.contents except AttributeError: frequencies_ref = frequencies - for i in range( - len(self._defaults["FrequencyCounter_MeasureFrequency"]["frequencies"]) - ): - frequencies_ref[i] = self._defaults["FrequencyCounter_MeasureFrequency"][ - "frequencies" - ][i] - return self._defaults["FrequencyCounter_MeasureFrequency"]["return"] - - def niDigital_GetAttributeViBoolean( - self, vi, channel_name, attribute, value - ): # noqa: N802 - if self._defaults["GetAttributeViBoolean"]["return"] != 0: - return self._defaults["GetAttributeViBoolean"]["return"] + for i in range(len(self._defaults['FrequencyCounter_MeasureFrequency']['frequencies'])): + frequencies_ref[i] = self._defaults['FrequencyCounter_MeasureFrequency']['frequencies'][i] + return self._defaults['FrequencyCounter_MeasureFrequency']['return'] + + def niDigital_GetAttributeViBoolean(self, vi, channel_name, attribute, value): # noqa: N802 + if self._defaults['GetAttributeViBoolean']['return'] != 0: + return self._defaults['GetAttributeViBoolean']['return'] # value - if self._defaults["GetAttributeViBoolean"]["value"] is None: - raise MockFunctionCallError( - "niDigital_GetAttributeViBoolean", param="value" - ) + if self._defaults['GetAttributeViBoolean']['value'] is None: + raise MockFunctionCallError("niDigital_GetAttributeViBoolean", param='value') if value is not None: - value.contents.value = self._defaults["GetAttributeViBoolean"]["value"] - return self._defaults["GetAttributeViBoolean"]["return"] - - def niDigital_GetAttributeViInt32( - self, vi, channel_name, attribute, value - ): # noqa: N802 - if self._defaults["GetAttributeViInt32"]["return"] != 0: - return self._defaults["GetAttributeViInt32"]["return"] + value.contents.value = self._defaults['GetAttributeViBoolean']['value'] + return self._defaults['GetAttributeViBoolean']['return'] + + def niDigital_GetAttributeViInt32(self, vi, channel_name, attribute, value): # noqa: N802 + if self._defaults['GetAttributeViInt32']['return'] != 0: + return self._defaults['GetAttributeViInt32']['return'] # value - if self._defaults["GetAttributeViInt32"]["value"] is None: - raise MockFunctionCallError("niDigital_GetAttributeViInt32", param="value") + if self._defaults['GetAttributeViInt32']['value'] is None: + raise MockFunctionCallError("niDigital_GetAttributeViInt32", param='value') if value is not None: - value.contents.value = self._defaults["GetAttributeViInt32"]["value"] - return self._defaults["GetAttributeViInt32"]["return"] - - def niDigital_GetAttributeViInt64( - self, vi, channel_name, attribute, value - ): # noqa: N802 - if self._defaults["GetAttributeViInt64"]["return"] != 0: - return self._defaults["GetAttributeViInt64"]["return"] + value.contents.value = self._defaults['GetAttributeViInt32']['value'] + return self._defaults['GetAttributeViInt32']['return'] + + def niDigital_GetAttributeViInt64(self, vi, channel_name, attribute, value): # noqa: N802 + if self._defaults['GetAttributeViInt64']['return'] != 0: + return self._defaults['GetAttributeViInt64']['return'] # value - if self._defaults["GetAttributeViInt64"]["value"] is None: - raise MockFunctionCallError("niDigital_GetAttributeViInt64", param="value") + if self._defaults['GetAttributeViInt64']['value'] is None: + raise MockFunctionCallError("niDigital_GetAttributeViInt64", param='value') if value is not None: - value.contents.value = self._defaults["GetAttributeViInt64"]["value"] - return self._defaults["GetAttributeViInt64"]["return"] - - def niDigital_GetAttributeViReal64( - self, vi, channel_name, attribute, value - ): # noqa: N802 - if self._defaults["GetAttributeViReal64"]["return"] != 0: - return self._defaults["GetAttributeViReal64"]["return"] + value.contents.value = self._defaults['GetAttributeViInt64']['value'] + return self._defaults['GetAttributeViInt64']['return'] + + def niDigital_GetAttributeViReal64(self, vi, channel_name, attribute, value): # noqa: N802 + if self._defaults['GetAttributeViReal64']['return'] != 0: + return self._defaults['GetAttributeViReal64']['return'] # value - if self._defaults["GetAttributeViReal64"]["value"] is None: - raise MockFunctionCallError("niDigital_GetAttributeViReal64", param="value") + if self._defaults['GetAttributeViReal64']['value'] is None: + raise MockFunctionCallError("niDigital_GetAttributeViReal64", param='value') if value is not None: - value.contents.value = self._defaults["GetAttributeViReal64"]["value"] - return self._defaults["GetAttributeViReal64"]["return"] - - def niDigital_GetAttributeViString( - self, vi, channel_name, attribute, buffer_size, value - ): # noqa: N802 - if self._defaults["GetAttributeViString"]["return"] != 0: - return self._defaults["GetAttributeViString"]["return"] - if self._defaults["GetAttributeViString"]["value"] is None: - raise MockFunctionCallError("niDigital_GetAttributeViString", param="value") + value.contents.value = self._defaults['GetAttributeViReal64']['value'] + return self._defaults['GetAttributeViReal64']['return'] + + def niDigital_GetAttributeViString(self, vi, channel_name, attribute, buffer_size, value): # noqa: N802 + if self._defaults['GetAttributeViString']['return'] != 0: + return self._defaults['GetAttributeViString']['return'] + if self._defaults['GetAttributeViString']['value'] is None: + raise MockFunctionCallError("niDigital_GetAttributeViString", param='value') if buffer_size.value == 0: - return len(self._defaults["GetAttributeViString"]["value"]) - value.value = self._defaults["GetAttributeViString"]["value"].encode("ascii") - return self._defaults["GetAttributeViString"]["return"] - - def niDigital_GetChannelNameFromString( - self, vi, indices, name_buffer_size, names - ): # noqa: N802 - if self._defaults["GetChannelNameFromString"]["return"] != 0: - return self._defaults["GetChannelNameFromString"]["return"] - if self._defaults["GetChannelNameFromString"]["names"] is None: - raise MockFunctionCallError( - "niDigital_GetChannelNameFromString", param="names" - ) + return len(self._defaults['GetAttributeViString']['value']) + value.value = self._defaults['GetAttributeViString']['value'].encode('ascii') + return self._defaults['GetAttributeViString']['return'] + + def niDigital_GetChannelNameFromString(self, vi, indices, name_buffer_size, names): # noqa: N802 + if self._defaults['GetChannelNameFromString']['return'] != 0: + return self._defaults['GetChannelNameFromString']['return'] + if self._defaults['GetChannelNameFromString']['names'] is None: + raise MockFunctionCallError("niDigital_GetChannelNameFromString", param='names') if name_buffer_size.value == 0: - return len(self._defaults["GetChannelNameFromString"]["names"]) - names.value = self._defaults["GetChannelNameFromString"]["names"].encode( - "ascii" - ) - return self._defaults["GetChannelNameFromString"]["return"] - - def niDigital_GetError( - self, vi, error_code, error_description_buffer_size, error_description - ): # noqa: N802 - if self._defaults["GetError"]["return"] != 0: - return self._defaults["GetError"]["return"] + return len(self._defaults['GetChannelNameFromString']['names']) + names.value = self._defaults['GetChannelNameFromString']['names'].encode('ascii') + return self._defaults['GetChannelNameFromString']['return'] + + def niDigital_GetError(self, vi, error_code, error_description_buffer_size, error_description): # noqa: N802 + if self._defaults['GetError']['return'] != 0: + return self._defaults['GetError']['return'] # error_code - if self._defaults["GetError"]["errorCode"] is None: - raise MockFunctionCallError("niDigital_GetError", param="errorCode") + if self._defaults['GetError']['errorCode'] is None: + raise MockFunctionCallError("niDigital_GetError", param='errorCode') if error_code is not None: - error_code.contents.value = self._defaults["GetError"]["errorCode"] - if self._defaults["GetError"]["errorDescription"] is None: - raise MockFunctionCallError("niDigital_GetError", param="errorDescription") + error_code.contents.value = self._defaults['GetError']['errorCode'] + if self._defaults['GetError']['errorDescription'] is None: + raise MockFunctionCallError("niDigital_GetError", param='errorDescription') if error_description_buffer_size.value == 0: - return len(self._defaults["GetError"]["errorDescription"]) - error_description.value = self._defaults["GetError"]["errorDescription"].encode( - "ascii" - ) - return self._defaults["GetError"]["return"] - - def niDigital_GetFailCount( - self, vi, channel_list, buffer_size, failure_count, actual_num_read - ): # noqa: N802 - if self._defaults["GetFailCount"]["return"] != 0: - return self._defaults["GetFailCount"]["return"] + return len(self._defaults['GetError']['errorDescription']) + error_description.value = self._defaults['GetError']['errorDescription'].encode('ascii') + return self._defaults['GetError']['return'] + + def niDigital_GetFailCount(self, vi, channel_list, buffer_size, failure_count, actual_num_read): # noqa: N802 + if self._defaults['GetFailCount']['return'] != 0: + return self._defaults['GetFailCount']['return'] # actual_num_read - if self._defaults["GetFailCount"]["actualNumRead"] is None: - raise MockFunctionCallError("niDigital_GetFailCount", param="actualNumRead") + if self._defaults['GetFailCount']['actualNumRead'] is None: + raise MockFunctionCallError("niDigital_GetFailCount", param='actualNumRead') if actual_num_read is not None: - actual_num_read.contents.value = self._defaults["GetFailCount"][ - "actualNumRead" - ] - if self._defaults["GetFailCount"]["failureCount"] is None: - raise MockFunctionCallError("niDigital_GetFailCount", param="failureCount") + actual_num_read.contents.value = self._defaults['GetFailCount']['actualNumRead'] + if self._defaults['GetFailCount']['failureCount'] is None: + raise MockFunctionCallError("niDigital_GetFailCount", param='failureCount') if buffer_size.value == 0: - return len(self._defaults["GetFailCount"]["failureCount"]) + return len(self._defaults['GetFailCount']['failureCount']) try: failure_count_ref = failure_count.contents except AttributeError: failure_count_ref = failure_count - for i in range(len(self._defaults["GetFailCount"]["failureCount"])): - failure_count_ref[i] = self._defaults["GetFailCount"]["failureCount"][i] - return self._defaults["GetFailCount"]["return"] + for i in range(len(self._defaults['GetFailCount']['failureCount'])): + failure_count_ref[i] = self._defaults['GetFailCount']['failureCount'][i] + return self._defaults['GetFailCount']['return'] def niDigital_GetHistoryRAMSampleCount(self, vi, site, sample_count): # noqa: N802 - if self._defaults["GetHistoryRAMSampleCount"]["return"] != 0: - return self._defaults["GetHistoryRAMSampleCount"]["return"] + if self._defaults['GetHistoryRAMSampleCount']['return'] != 0: + return self._defaults['GetHistoryRAMSampleCount']['return'] # sample_count - if self._defaults["GetHistoryRAMSampleCount"]["sampleCount"] is None: - raise MockFunctionCallError( - "niDigital_GetHistoryRAMSampleCount", param="sampleCount" - ) + if self._defaults['GetHistoryRAMSampleCount']['sampleCount'] is None: + raise MockFunctionCallError("niDigital_GetHistoryRAMSampleCount", param='sampleCount') if sample_count is not None: - sample_count.contents.value = self._defaults["GetHistoryRAMSampleCount"][ - "sampleCount" - ] - return self._defaults["GetHistoryRAMSampleCount"]["return"] - - def niDigital_GetPatternName( - self, vi, pattern_index, name_buffer_size, name - ): # noqa: N802 - if self._defaults["GetPatternName"]["return"] != 0: - return self._defaults["GetPatternName"]["return"] - if self._defaults["GetPatternName"]["name"] is None: - raise MockFunctionCallError("niDigital_GetPatternName", param="name") + sample_count.contents.value = self._defaults['GetHistoryRAMSampleCount']['sampleCount'] + return self._defaults['GetHistoryRAMSampleCount']['return'] + + def niDigital_GetPatternName(self, vi, pattern_index, name_buffer_size, name): # noqa: N802 + if self._defaults['GetPatternName']['return'] != 0: + return self._defaults['GetPatternName']['return'] + if self._defaults['GetPatternName']['name'] is None: + raise MockFunctionCallError("niDigital_GetPatternName", param='name') if name_buffer_size.value == 0: - return len(self._defaults["GetPatternName"]["name"]) - name.value = self._defaults["GetPatternName"]["name"].encode("ascii") - return self._defaults["GetPatternName"]["return"] - - def niDigital_GetPatternPinList( - self, vi, start_label, pin_list_buffer_size, pin_list - ): # noqa: N802 - if self._defaults["GetPatternPinList"]["return"] != 0: - return self._defaults["GetPatternPinList"]["return"] - if self._defaults["GetPatternPinList"]["pinList"] is None: - raise MockFunctionCallError("niDigital_GetPatternPinList", param="pinList") + return len(self._defaults['GetPatternName']['name']) + name.value = self._defaults['GetPatternName']['name'].encode('ascii') + return self._defaults['GetPatternName']['return'] + + def niDigital_GetPatternPinList(self, vi, start_label, pin_list_buffer_size, pin_list): # noqa: N802 + if self._defaults['GetPatternPinList']['return'] != 0: + return self._defaults['GetPatternPinList']['return'] + if self._defaults['GetPatternPinList']['pinList'] is None: + raise MockFunctionCallError("niDigital_GetPatternPinList", param='pinList') if pin_list_buffer_size.value == 0: - return len(self._defaults["GetPatternPinList"]["pinList"]) - pin_list.value = self._defaults["GetPatternPinList"]["pinList"].encode("ascii") - return self._defaults["GetPatternPinList"]["return"] + return len(self._defaults['GetPatternPinList']['pinList']) + pin_list.value = self._defaults['GetPatternPinList']['pinList'].encode('ascii') + return self._defaults['GetPatternPinList']['return'] def niDigital_GetPinName(self, vi, pin_index, name_buffer_size, name): # noqa: N802 - if self._defaults["GetPinName"]["return"] != 0: - return self._defaults["GetPinName"]["return"] - if self._defaults["GetPinName"]["name"] is None: - raise MockFunctionCallError("niDigital_GetPinName", param="name") + if self._defaults['GetPinName']['return'] != 0: + return self._defaults['GetPinName']['return'] + if self._defaults['GetPinName']['name'] is None: + raise MockFunctionCallError("niDigital_GetPinName", param='name') if name_buffer_size.value == 0: - return len(self._defaults["GetPinName"]["name"]) - name.value = self._defaults["GetPinName"]["name"].encode("ascii") - return self._defaults["GetPinName"]["return"] - - def niDigital_GetPinResultsPinInformation( - self, - vi, - channel_list, - buffer_size, - pin_indexes, - site_numbers, - channel_indexes, - actual_num_values, - ): # noqa: N802 - if self._defaults["GetPinResultsPinInformation"]["return"] != 0: - return self._defaults["GetPinResultsPinInformation"]["return"] + return len(self._defaults['GetPinName']['name']) + name.value = self._defaults['GetPinName']['name'].encode('ascii') + return self._defaults['GetPinName']['return'] + + def niDigital_GetPinResultsPinInformation(self, vi, channel_list, buffer_size, pin_indexes, site_numbers, channel_indexes, actual_num_values): # noqa: N802 + if self._defaults['GetPinResultsPinInformation']['return'] != 0: + return self._defaults['GetPinResultsPinInformation']['return'] # actual_num_values - if self._defaults["GetPinResultsPinInformation"]["actualNumValues"] is None: - raise MockFunctionCallError( - "niDigital_GetPinResultsPinInformation", param="actualNumValues" - ) + if self._defaults['GetPinResultsPinInformation']['actualNumValues'] is None: + raise MockFunctionCallError("niDigital_GetPinResultsPinInformation", param='actualNumValues') if actual_num_values is not None: - actual_num_values.contents.value = self._defaults[ - "GetPinResultsPinInformation" - ]["actualNumValues"] - if self._defaults["GetPinResultsPinInformation"]["pinIndexes"] is None: - raise MockFunctionCallError( - "niDigital_GetPinResultsPinInformation", param="pinIndexes" - ) + actual_num_values.contents.value = self._defaults['GetPinResultsPinInformation']['actualNumValues'] + if self._defaults['GetPinResultsPinInformation']['pinIndexes'] is None: + raise MockFunctionCallError("niDigital_GetPinResultsPinInformation", param='pinIndexes') if buffer_size.value == 0: - return len(self._defaults["GetPinResultsPinInformation"]["pinIndexes"]) + return len(self._defaults['GetPinResultsPinInformation']['pinIndexes']) try: pin_indexes_ref = pin_indexes.contents except AttributeError: pin_indexes_ref = pin_indexes - for i in range( - len(self._defaults["GetPinResultsPinInformation"]["pinIndexes"]) - ): - pin_indexes_ref[i] = self._defaults["GetPinResultsPinInformation"][ - "pinIndexes" - ][i] - if self._defaults["GetPinResultsPinInformation"]["siteNumbers"] is None: - raise MockFunctionCallError( - "niDigital_GetPinResultsPinInformation", param="siteNumbers" - ) + for i in range(len(self._defaults['GetPinResultsPinInformation']['pinIndexes'])): + pin_indexes_ref[i] = self._defaults['GetPinResultsPinInformation']['pinIndexes'][i] + if self._defaults['GetPinResultsPinInformation']['siteNumbers'] is None: + raise MockFunctionCallError("niDigital_GetPinResultsPinInformation", param='siteNumbers') if buffer_size.value == 0: - return len(self._defaults["GetPinResultsPinInformation"]["siteNumbers"]) + return len(self._defaults['GetPinResultsPinInformation']['siteNumbers']) try: site_numbers_ref = site_numbers.contents except AttributeError: site_numbers_ref = site_numbers - for i in range( - len(self._defaults["GetPinResultsPinInformation"]["siteNumbers"]) - ): - site_numbers_ref[i] = self._defaults["GetPinResultsPinInformation"][ - "siteNumbers" - ][i] - if self._defaults["GetPinResultsPinInformation"]["channelIndexes"] is None: - raise MockFunctionCallError( - "niDigital_GetPinResultsPinInformation", param="channelIndexes" - ) + for i in range(len(self._defaults['GetPinResultsPinInformation']['siteNumbers'])): + site_numbers_ref[i] = self._defaults['GetPinResultsPinInformation']['siteNumbers'][i] + if self._defaults['GetPinResultsPinInformation']['channelIndexes'] is None: + raise MockFunctionCallError("niDigital_GetPinResultsPinInformation", param='channelIndexes') if buffer_size.value == 0: - return len(self._defaults["GetPinResultsPinInformation"]["channelIndexes"]) + return len(self._defaults['GetPinResultsPinInformation']['channelIndexes']) try: channel_indexes_ref = channel_indexes.contents except AttributeError: channel_indexes_ref = channel_indexes - for i in range( - len(self._defaults["GetPinResultsPinInformation"]["channelIndexes"]) - ): - channel_indexes_ref[i] = self._defaults["GetPinResultsPinInformation"][ - "channelIndexes" - ][i] - return self._defaults["GetPinResultsPinInformation"]["return"] - - def niDigital_GetSitePassFail( - self, vi, site_list, pass_fail_buffer_size, pass_fail, actual_num_sites - ): # noqa: N802 - if self._defaults["GetSitePassFail"]["return"] != 0: - return self._defaults["GetSitePassFail"]["return"] + for i in range(len(self._defaults['GetPinResultsPinInformation']['channelIndexes'])): + channel_indexes_ref[i] = self._defaults['GetPinResultsPinInformation']['channelIndexes'][i] + return self._defaults['GetPinResultsPinInformation']['return'] + + def niDigital_GetSitePassFail(self, vi, site_list, pass_fail_buffer_size, pass_fail, actual_num_sites): # noqa: N802 + if self._defaults['GetSitePassFail']['return'] != 0: + return self._defaults['GetSitePassFail']['return'] # actual_num_sites - if self._defaults["GetSitePassFail"]["actualNumSites"] is None: - raise MockFunctionCallError( - "niDigital_GetSitePassFail", param="actualNumSites" - ) + if self._defaults['GetSitePassFail']['actualNumSites'] is None: + raise MockFunctionCallError("niDigital_GetSitePassFail", param='actualNumSites') if actual_num_sites is not None: - actual_num_sites.contents.value = self._defaults["GetSitePassFail"][ - "actualNumSites" - ] - if self._defaults["GetSitePassFail"]["passFail"] is None: - raise MockFunctionCallError("niDigital_GetSitePassFail", param="passFail") + actual_num_sites.contents.value = self._defaults['GetSitePassFail']['actualNumSites'] + if self._defaults['GetSitePassFail']['passFail'] is None: + raise MockFunctionCallError("niDigital_GetSitePassFail", param='passFail') if pass_fail_buffer_size.value == 0: - return len(self._defaults["GetSitePassFail"]["passFail"]) + return len(self._defaults['GetSitePassFail']['passFail']) try: pass_fail_ref = pass_fail.contents except AttributeError: pass_fail_ref = pass_fail - for i in range(len(self._defaults["GetSitePassFail"]["passFail"])): - pass_fail_ref[i] = self._defaults["GetSitePassFail"]["passFail"][i] - return self._defaults["GetSitePassFail"]["return"] - - def niDigital_GetSiteResultsSiteNumbers( - self, - vi, - site_list, - site_result_type, - site_numbers_buffer_size, - site_numbers, - actual_num_site_numbers, - ): # noqa: N802 - if self._defaults["GetSiteResultsSiteNumbers"]["return"] != 0: - return self._defaults["GetSiteResultsSiteNumbers"]["return"] + for i in range(len(self._defaults['GetSitePassFail']['passFail'])): + pass_fail_ref[i] = self._defaults['GetSitePassFail']['passFail'][i] + return self._defaults['GetSitePassFail']['return'] + + def niDigital_GetSiteResultsSiteNumbers(self, vi, site_list, site_result_type, site_numbers_buffer_size, site_numbers, actual_num_site_numbers): # noqa: N802 + if self._defaults['GetSiteResultsSiteNumbers']['return'] != 0: + return self._defaults['GetSiteResultsSiteNumbers']['return'] # actual_num_site_numbers - if self._defaults["GetSiteResultsSiteNumbers"]["actualNumSiteNumbers"] is None: - raise MockFunctionCallError( - "niDigital_GetSiteResultsSiteNumbers", param="actualNumSiteNumbers" - ) + if self._defaults['GetSiteResultsSiteNumbers']['actualNumSiteNumbers'] is None: + raise MockFunctionCallError("niDigital_GetSiteResultsSiteNumbers", param='actualNumSiteNumbers') if actual_num_site_numbers is not None: - actual_num_site_numbers.contents.value = self._defaults[ - "GetSiteResultsSiteNumbers" - ]["actualNumSiteNumbers"] - if self._defaults["GetSiteResultsSiteNumbers"]["siteNumbers"] is None: - raise MockFunctionCallError( - "niDigital_GetSiteResultsSiteNumbers", param="siteNumbers" - ) + actual_num_site_numbers.contents.value = self._defaults['GetSiteResultsSiteNumbers']['actualNumSiteNumbers'] + if self._defaults['GetSiteResultsSiteNumbers']['siteNumbers'] is None: + raise MockFunctionCallError("niDigital_GetSiteResultsSiteNumbers", param='siteNumbers') if site_numbers_buffer_size.value == 0: - return len(self._defaults["GetSiteResultsSiteNumbers"]["siteNumbers"]) + return len(self._defaults['GetSiteResultsSiteNumbers']['siteNumbers']) try: site_numbers_ref = site_numbers.contents except AttributeError: site_numbers_ref = site_numbers - for i in range(len(self._defaults["GetSiteResultsSiteNumbers"]["siteNumbers"])): - site_numbers_ref[i] = self._defaults["GetSiteResultsSiteNumbers"][ - "siteNumbers" - ][i] - return self._defaults["GetSiteResultsSiteNumbers"]["return"] - - def niDigital_GetTimeSetDriveFormat( - self, vi, pin, time_set_name, format - ): # noqa: N802 - if self._defaults["GetTimeSetDriveFormat"]["return"] != 0: - return self._defaults["GetTimeSetDriveFormat"]["return"] + for i in range(len(self._defaults['GetSiteResultsSiteNumbers']['siteNumbers'])): + site_numbers_ref[i] = self._defaults['GetSiteResultsSiteNumbers']['siteNumbers'][i] + return self._defaults['GetSiteResultsSiteNumbers']['return'] + + def niDigital_GetTimeSetDriveFormat(self, vi, pin, time_set_name, format): # noqa: N802 + if self._defaults['GetTimeSetDriveFormat']['return'] != 0: + return self._defaults['GetTimeSetDriveFormat']['return'] # format - if self._defaults["GetTimeSetDriveFormat"]["format"] is None: - raise MockFunctionCallError( - "niDigital_GetTimeSetDriveFormat", param="format" - ) + if self._defaults['GetTimeSetDriveFormat']['format'] is None: + raise MockFunctionCallError("niDigital_GetTimeSetDriveFormat", param='format') if format is not None: - format.contents.value = self._defaults["GetTimeSetDriveFormat"]["format"] - return self._defaults["GetTimeSetDriveFormat"]["return"] - - def niDigital_GetTimeSetEdge( - self, vi, pin, time_set_name, edge, time - ): # noqa: N802 - if self._defaults["GetTimeSetEdge"]["return"] != 0: - return self._defaults["GetTimeSetEdge"]["return"] + format.contents.value = self._defaults['GetTimeSetDriveFormat']['format'] + return self._defaults['GetTimeSetDriveFormat']['return'] + + def niDigital_GetTimeSetEdge(self, vi, pin, time_set_name, edge, time): # noqa: N802 + if self._defaults['GetTimeSetEdge']['return'] != 0: + return self._defaults['GetTimeSetEdge']['return'] # time - if self._defaults["GetTimeSetEdge"]["time"] is None: - raise MockFunctionCallError("niDigital_GetTimeSetEdge", param="time") + if self._defaults['GetTimeSetEdge']['time'] is None: + raise MockFunctionCallError("niDigital_GetTimeSetEdge", param='time') if time is not None: - time.contents.value = self._defaults["GetTimeSetEdge"]["time"] - return self._defaults["GetTimeSetEdge"]["return"] - - def niDigital_GetTimeSetEdgeMultiplier( - self, vi, pin, time_set_name, edge_multiplier - ): # noqa: N802 - if self._defaults["GetTimeSetEdgeMultiplier"]["return"] != 0: - return self._defaults["GetTimeSetEdgeMultiplier"]["return"] + time.contents.value = self._defaults['GetTimeSetEdge']['time'] + return self._defaults['GetTimeSetEdge']['return'] + + def niDigital_GetTimeSetEdgeMultiplier(self, vi, pin, time_set_name, edge_multiplier): # noqa: N802 + if self._defaults['GetTimeSetEdgeMultiplier']['return'] != 0: + return self._defaults['GetTimeSetEdgeMultiplier']['return'] # edge_multiplier - if self._defaults["GetTimeSetEdgeMultiplier"]["edgeMultiplier"] is None: - raise MockFunctionCallError( - "niDigital_GetTimeSetEdgeMultiplier", param="edgeMultiplier" - ) + if self._defaults['GetTimeSetEdgeMultiplier']['edgeMultiplier'] is None: + raise MockFunctionCallError("niDigital_GetTimeSetEdgeMultiplier", param='edgeMultiplier') if edge_multiplier is not None: - edge_multiplier.contents.value = self._defaults["GetTimeSetEdgeMultiplier"][ - "edgeMultiplier" - ] - return self._defaults["GetTimeSetEdgeMultiplier"]["return"] - - def niDigital_GetTimeSetName( - self, vi, time_set_index, name_buffer_size, name - ): # noqa: N802 - if self._defaults["GetTimeSetName"]["return"] != 0: - return self._defaults["GetTimeSetName"]["return"] - if self._defaults["GetTimeSetName"]["name"] is None: - raise MockFunctionCallError("niDigital_GetTimeSetName", param="name") + edge_multiplier.contents.value = self._defaults['GetTimeSetEdgeMultiplier']['edgeMultiplier'] + return self._defaults['GetTimeSetEdgeMultiplier']['return'] + + def niDigital_GetTimeSetName(self, vi, time_set_index, name_buffer_size, name): # noqa: N802 + if self._defaults['GetTimeSetName']['return'] != 0: + return self._defaults['GetTimeSetName']['return'] + if self._defaults['GetTimeSetName']['name'] is None: + raise MockFunctionCallError("niDigital_GetTimeSetName", param='name') if name_buffer_size.value == 0: - return len(self._defaults["GetTimeSetName"]["name"]) - name.value = self._defaults["GetTimeSetName"]["name"].encode("ascii") - return self._defaults["GetTimeSetName"]["return"] + return len(self._defaults['GetTimeSetName']['name']) + name.value = self._defaults['GetTimeSetName']['name'].encode('ascii') + return self._defaults['GetTimeSetName']['return'] def niDigital_GetTimeSetPeriod(self, vi, time_set_name, period): # noqa: N802 - if self._defaults["GetTimeSetPeriod"]["return"] != 0: - return self._defaults["GetTimeSetPeriod"]["return"] + if self._defaults['GetTimeSetPeriod']['return'] != 0: + return self._defaults['GetTimeSetPeriod']['return'] # period - if self._defaults["GetTimeSetPeriod"]["period"] is None: - raise MockFunctionCallError("niDigital_GetTimeSetPeriod", param="period") + if self._defaults['GetTimeSetPeriod']['period'] is None: + raise MockFunctionCallError("niDigital_GetTimeSetPeriod", param='period') if period is not None: - period.contents.value = self._defaults["GetTimeSetPeriod"]["period"] - return self._defaults["GetTimeSetPeriod"]["return"] - - def niDigital_InitWithOptions( - self, resource_name, id_query, reset_device, option_string, new_vi - ): # noqa: N802 - if self._defaults["InitWithOptions"]["return"] != 0: - return self._defaults["InitWithOptions"]["return"] + period.contents.value = self._defaults['GetTimeSetPeriod']['period'] + return self._defaults['GetTimeSetPeriod']['return'] + + def niDigital_InitWithOptions(self, resource_name, id_query, reset_device, option_string, new_vi): # noqa: N802 + if self._defaults['InitWithOptions']['return'] != 0: + return self._defaults['InitWithOptions']['return'] # new_vi - if self._defaults["InitWithOptions"]["newVi"] is None: - raise MockFunctionCallError("niDigital_InitWithOptions", param="newVi") + if self._defaults['InitWithOptions']['newVi'] is None: + raise MockFunctionCallError("niDigital_InitWithOptions", param='newVi') if new_vi is not None: - new_vi.contents.value = self._defaults["InitWithOptions"]["newVi"] - return self._defaults["InitWithOptions"]["return"] + new_vi.contents.value = self._defaults['InitWithOptions']['newVi'] + return self._defaults['InitWithOptions']['return'] def niDigital_Initiate(self, vi): # noqa: N802 - if self._defaults["Initiate"]["return"] != 0: - return self._defaults["Initiate"]["return"] - return self._defaults["Initiate"]["return"] + if self._defaults['Initiate']['return'] != 0: + return self._defaults['Initiate']['return'] + return self._defaults['Initiate']['return'] def niDigital_IsDone(self, vi, done): # noqa: N802 - if self._defaults["IsDone"]["return"] != 0: - return self._defaults["IsDone"]["return"] + if self._defaults['IsDone']['return'] != 0: + return self._defaults['IsDone']['return'] # done - if self._defaults["IsDone"]["done"] is None: - raise MockFunctionCallError("niDigital_IsDone", param="done") + if self._defaults['IsDone']['done'] is None: + raise MockFunctionCallError("niDigital_IsDone", param='done') if done is not None: - done.contents.value = self._defaults["IsDone"]["done"] - return self._defaults["IsDone"]["return"] + done.contents.value = self._defaults['IsDone']['done'] + return self._defaults['IsDone']['return'] def niDigital_IsSiteEnabled(self, vi, site, enable): # noqa: N802 - if self._defaults["IsSiteEnabled"]["return"] != 0: - return self._defaults["IsSiteEnabled"]["return"] + if self._defaults['IsSiteEnabled']['return'] != 0: + return self._defaults['IsSiteEnabled']['return'] # enable - if self._defaults["IsSiteEnabled"]["enable"] is None: - raise MockFunctionCallError("niDigital_IsSiteEnabled", param="enable") + if self._defaults['IsSiteEnabled']['enable'] is None: + raise MockFunctionCallError("niDigital_IsSiteEnabled", param='enable') if enable is not None: - enable.contents.value = self._defaults["IsSiteEnabled"]["enable"] - return self._defaults["IsSiteEnabled"]["return"] + enable.contents.value = self._defaults['IsSiteEnabled']['enable'] + return self._defaults['IsSiteEnabled']['return'] def niDigital_LoadLevels(self, vi, file_path): # noqa: N802 - if self._defaults["LoadLevels"]["return"] != 0: - return self._defaults["LoadLevels"]["return"] - return self._defaults["LoadLevels"]["return"] + if self._defaults['LoadLevels']['return'] != 0: + return self._defaults['LoadLevels']['return'] + return self._defaults['LoadLevels']['return'] def niDigital_LoadPattern(self, vi, file_path): # noqa: N802 - if self._defaults["LoadPattern"]["return"] != 0: - return self._defaults["LoadPattern"]["return"] - return self._defaults["LoadPattern"]["return"] + if self._defaults['LoadPattern']['return'] != 0: + return self._defaults['LoadPattern']['return'] + return self._defaults['LoadPattern']['return'] def niDigital_LoadPinMap(self, vi, file_path): # noqa: N802 - if self._defaults["LoadPinMap"]["return"] != 0: - return self._defaults["LoadPinMap"]["return"] - return self._defaults["LoadPinMap"]["return"] + if self._defaults['LoadPinMap']['return'] != 0: + return self._defaults['LoadPinMap']['return'] + return self._defaults['LoadPinMap']['return'] def niDigital_LoadSpecifications(self, vi, file_path): # noqa: N802 - if self._defaults["LoadSpecifications"]["return"] != 0: - return self._defaults["LoadSpecifications"]["return"] - return self._defaults["LoadSpecifications"]["return"] + if self._defaults['LoadSpecifications']['return'] != 0: + return self._defaults['LoadSpecifications']['return'] + return self._defaults['LoadSpecifications']['return'] def niDigital_LoadTiming(self, vi, file_path): # noqa: N802 - if self._defaults["LoadTiming"]["return"] != 0: - return self._defaults["LoadTiming"]["return"] - return self._defaults["LoadTiming"]["return"] + if self._defaults['LoadTiming']['return'] != 0: + return self._defaults['LoadTiming']['return'] + return self._defaults['LoadTiming']['return'] def niDigital_LockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults["LockSession"]["return"] != 0: - return self._defaults["LockSession"]["return"] + if self._defaults['LockSession']['return'] != 0: + return self._defaults['LockSession']['return'] # caller_has_lock - if self._defaults["LockSession"]["callerHasLock"] is None: - raise MockFunctionCallError("niDigital_LockSession", param="callerHasLock") + if self._defaults['LockSession']['callerHasLock'] is None: + raise MockFunctionCallError("niDigital_LockSession", param='callerHasLock') if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults["LockSession"][ - "callerHasLock" - ] - return self._defaults["LockSession"]["return"] - - def niDigital_PPMU_Measure( - self, - vi, - channel_list, - measurement_type, - buffer_size, - measurements, - actual_num_read, - ): # noqa: N802 - if self._defaults["PPMU_Measure"]["return"] != 0: - return self._defaults["PPMU_Measure"]["return"] + caller_has_lock.contents.value = self._defaults['LockSession']['callerHasLock'] + return self._defaults['LockSession']['return'] + + def niDigital_PPMU_Measure(self, vi, channel_list, measurement_type, buffer_size, measurements, actual_num_read): # noqa: N802 + if self._defaults['PPMU_Measure']['return'] != 0: + return self._defaults['PPMU_Measure']['return'] # actual_num_read - if self._defaults["PPMU_Measure"]["actualNumRead"] is None: - raise MockFunctionCallError("niDigital_PPMU_Measure", param="actualNumRead") + if self._defaults['PPMU_Measure']['actualNumRead'] is None: + raise MockFunctionCallError("niDigital_PPMU_Measure", param='actualNumRead') if actual_num_read is not None: - actual_num_read.contents.value = self._defaults["PPMU_Measure"][ - "actualNumRead" - ] - if self._defaults["PPMU_Measure"]["measurements"] is None: - raise MockFunctionCallError("niDigital_PPMU_Measure", param="measurements") + actual_num_read.contents.value = self._defaults['PPMU_Measure']['actualNumRead'] + if self._defaults['PPMU_Measure']['measurements'] is None: + raise MockFunctionCallError("niDigital_PPMU_Measure", param='measurements') if buffer_size.value == 0: - return len(self._defaults["PPMU_Measure"]["measurements"]) + return len(self._defaults['PPMU_Measure']['measurements']) try: measurements_ref = measurements.contents except AttributeError: measurements_ref = measurements - for i in range(len(self._defaults["PPMU_Measure"]["measurements"])): - measurements_ref[i] = self._defaults["PPMU_Measure"]["measurements"][i] - return self._defaults["PPMU_Measure"]["return"] + for i in range(len(self._defaults['PPMU_Measure']['measurements'])): + measurements_ref[i] = self._defaults['PPMU_Measure']['measurements'][i] + return self._defaults['PPMU_Measure']['return'] def niDigital_PPMU_Source(self, vi, channel_list): # noqa: N802 - if self._defaults["PPMU_Source"]["return"] != 0: - return self._defaults["PPMU_Source"]["return"] - return self._defaults["PPMU_Source"]["return"] + if self._defaults['PPMU_Source']['return'] != 0: + return self._defaults['PPMU_Source']['return'] + return self._defaults['PPMU_Source']['return'] def niDigital_ReadSequencerFlag(self, vi, flag, value): # noqa: N802 - if self._defaults["ReadSequencerFlag"]["return"] != 0: - return self._defaults["ReadSequencerFlag"]["return"] + if self._defaults['ReadSequencerFlag']['return'] != 0: + return self._defaults['ReadSequencerFlag']['return'] # value - if self._defaults["ReadSequencerFlag"]["value"] is None: - raise MockFunctionCallError("niDigital_ReadSequencerFlag", param="value") + if self._defaults['ReadSequencerFlag']['value'] is None: + raise MockFunctionCallError("niDigital_ReadSequencerFlag", param='value') if value is not None: - value.contents.value = self._defaults["ReadSequencerFlag"]["value"] - return self._defaults["ReadSequencerFlag"]["return"] + value.contents.value = self._defaults['ReadSequencerFlag']['value'] + return self._defaults['ReadSequencerFlag']['return'] def niDigital_ReadSequencerRegister(self, vi, reg, value): # noqa: N802 - if self._defaults["ReadSequencerRegister"]["return"] != 0: - return self._defaults["ReadSequencerRegister"]["return"] + if self._defaults['ReadSequencerRegister']['return'] != 0: + return self._defaults['ReadSequencerRegister']['return'] # value - if self._defaults["ReadSequencerRegister"]["value"] is None: - raise MockFunctionCallError( - "niDigital_ReadSequencerRegister", param="value" - ) + if self._defaults['ReadSequencerRegister']['value'] is None: + raise MockFunctionCallError("niDigital_ReadSequencerRegister", param='value') if value is not None: - value.contents.value = self._defaults["ReadSequencerRegister"]["value"] - return self._defaults["ReadSequencerRegister"]["return"] - - def niDigital_ReadStatic( - self, vi, channel_list, buffer_size, data, actual_num_read - ): # noqa: N802 - if self._defaults["ReadStatic"]["return"] != 0: - return self._defaults["ReadStatic"]["return"] + value.contents.value = self._defaults['ReadSequencerRegister']['value'] + return self._defaults['ReadSequencerRegister']['return'] + + def niDigital_ReadStatic(self, vi, channel_list, buffer_size, data, actual_num_read): # noqa: N802 + if self._defaults['ReadStatic']['return'] != 0: + return self._defaults['ReadStatic']['return'] # actual_num_read - if self._defaults["ReadStatic"]["actualNumRead"] is None: - raise MockFunctionCallError("niDigital_ReadStatic", param="actualNumRead") + if self._defaults['ReadStatic']['actualNumRead'] is None: + raise MockFunctionCallError("niDigital_ReadStatic", param='actualNumRead') if actual_num_read is not None: - actual_num_read.contents.value = self._defaults["ReadStatic"][ - "actualNumRead" - ] - if self._defaults["ReadStatic"]["data"] is None: - raise MockFunctionCallError("niDigital_ReadStatic", param="data") + actual_num_read.contents.value = self._defaults['ReadStatic']['actualNumRead'] + if self._defaults['ReadStatic']['data'] is None: + raise MockFunctionCallError("niDigital_ReadStatic", param='data') if buffer_size.value == 0: - return len(self._defaults["ReadStatic"]["data"]) + return len(self._defaults['ReadStatic']['data']) try: data_ref = data.contents except AttributeError: data_ref = data - for i in range(len(self._defaults["ReadStatic"]["data"])): - data_ref[i] = self._defaults["ReadStatic"]["data"][i] - return self._defaults["ReadStatic"]["return"] + for i in range(len(self._defaults['ReadStatic']['data'])): + data_ref[i] = self._defaults['ReadStatic']['data'][i] + return self._defaults['ReadStatic']['return'] def niDigital_ResetDevice(self, vi): # noqa: N802 - if self._defaults["ResetDevice"]["return"] != 0: - return self._defaults["ResetDevice"]["return"] - return self._defaults["ResetDevice"]["return"] + if self._defaults['ResetDevice']['return'] != 0: + return self._defaults['ResetDevice']['return'] + return self._defaults['ResetDevice']['return'] def niDigital_SelfCalibrate(self, vi): # noqa: N802 - if self._defaults["SelfCalibrate"]["return"] != 0: - return self._defaults["SelfCalibrate"]["return"] - return self._defaults["SelfCalibrate"]["return"] - - def niDigital_SendSoftwareEdgeTrigger( - self, vi, trigger, trigger_identifier - ): # noqa: N802 - if self._defaults["SendSoftwareEdgeTrigger"]["return"] != 0: - return self._defaults["SendSoftwareEdgeTrigger"]["return"] - return self._defaults["SendSoftwareEdgeTrigger"]["return"] - - def niDigital_SetAttributeViBoolean( - self, vi, channel_name, attribute, value - ): # noqa: N802 - if self._defaults["SetAttributeViBoolean"]["return"] != 0: - return self._defaults["SetAttributeViBoolean"]["return"] - return self._defaults["SetAttributeViBoolean"]["return"] - - def niDigital_SetAttributeViInt32( - self, vi, channel_name, attribute, value - ): # noqa: N802 - if self._defaults["SetAttributeViInt32"]["return"] != 0: - return self._defaults["SetAttributeViInt32"]["return"] - return self._defaults["SetAttributeViInt32"]["return"] - - def niDigital_SetAttributeViInt64( - self, vi, channel_name, attribute, value - ): # noqa: N802 - if self._defaults["SetAttributeViInt64"]["return"] != 0: - return self._defaults["SetAttributeViInt64"]["return"] - return self._defaults["SetAttributeViInt64"]["return"] - - def niDigital_SetAttributeViReal64( - self, vi, channel_name, attribute, value - ): # noqa: N802 - if self._defaults["SetAttributeViReal64"]["return"] != 0: - return self._defaults["SetAttributeViReal64"]["return"] - return self._defaults["SetAttributeViReal64"]["return"] - - def niDigital_SetAttributeViString( - self, vi, channel_name, attribute, value - ): # noqa: N802 - if self._defaults["SetAttributeViString"]["return"] != 0: - return self._defaults["SetAttributeViString"]["return"] - return self._defaults["SetAttributeViString"]["return"] - - def niDigital_TDR( - self, - vi, - channel_list, - apply_offsets, - offsets_buffer_size, - offsets, - actual_num_offsets, - ): # noqa: N802 - if self._defaults["TDR"]["return"] != 0: - return self._defaults["TDR"]["return"] + if self._defaults['SelfCalibrate']['return'] != 0: + return self._defaults['SelfCalibrate']['return'] + return self._defaults['SelfCalibrate']['return'] + + def niDigital_SendSoftwareEdgeTrigger(self, vi, trigger, trigger_identifier): # noqa: N802 + if self._defaults['SendSoftwareEdgeTrigger']['return'] != 0: + return self._defaults['SendSoftwareEdgeTrigger']['return'] + return self._defaults['SendSoftwareEdgeTrigger']['return'] + + def niDigital_SetAttributeViBoolean(self, vi, channel_name, attribute, value): # noqa: N802 + if self._defaults['SetAttributeViBoolean']['return'] != 0: + return self._defaults['SetAttributeViBoolean']['return'] + return self._defaults['SetAttributeViBoolean']['return'] + + def niDigital_SetAttributeViInt32(self, vi, channel_name, attribute, value): # noqa: N802 + if self._defaults['SetAttributeViInt32']['return'] != 0: + return self._defaults['SetAttributeViInt32']['return'] + return self._defaults['SetAttributeViInt32']['return'] + + def niDigital_SetAttributeViInt64(self, vi, channel_name, attribute, value): # noqa: N802 + if self._defaults['SetAttributeViInt64']['return'] != 0: + return self._defaults['SetAttributeViInt64']['return'] + return self._defaults['SetAttributeViInt64']['return'] + + def niDigital_SetAttributeViReal64(self, vi, channel_name, attribute, value): # noqa: N802 + if self._defaults['SetAttributeViReal64']['return'] != 0: + return self._defaults['SetAttributeViReal64']['return'] + return self._defaults['SetAttributeViReal64']['return'] + + def niDigital_SetAttributeViString(self, vi, channel_name, attribute, value): # noqa: N802 + if self._defaults['SetAttributeViString']['return'] != 0: + return self._defaults['SetAttributeViString']['return'] + return self._defaults['SetAttributeViString']['return'] + + def niDigital_TDR(self, vi, channel_list, apply_offsets, offsets_buffer_size, offsets, actual_num_offsets): # noqa: N802 + if self._defaults['TDR']['return'] != 0: + return self._defaults['TDR']['return'] # actual_num_offsets - if self._defaults["TDR"]["actualNumOffsets"] is None: - raise MockFunctionCallError("niDigital_TDR", param="actualNumOffsets") + if self._defaults['TDR']['actualNumOffsets'] is None: + raise MockFunctionCallError("niDigital_TDR", param='actualNumOffsets') if actual_num_offsets is not None: - actual_num_offsets.contents.value = self._defaults["TDR"][ - "actualNumOffsets" - ] - if self._defaults["TDR"]["offsets"] is None: - raise MockFunctionCallError("niDigital_TDR", param="offsets") + actual_num_offsets.contents.value = self._defaults['TDR']['actualNumOffsets'] + if self._defaults['TDR']['offsets'] is None: + raise MockFunctionCallError("niDigital_TDR", param='offsets') if offsets_buffer_size.value == 0: - return len(self._defaults["TDR"]["offsets"]) + return len(self._defaults['TDR']['offsets']) try: offsets_ref = offsets.contents except AttributeError: offsets_ref = offsets - for i in range(len(self._defaults["TDR"]["offsets"])): - offsets_ref[i] = self._defaults["TDR"]["offsets"][i] - return self._defaults["TDR"]["return"] + for i in range(len(self._defaults['TDR']['offsets'])): + offsets_ref[i] = self._defaults['TDR']['offsets'][i] + return self._defaults['TDR']['return'] def niDigital_UnloadAllPatterns(self, vi, unload_keep_alive_pattern): # noqa: N802 - if self._defaults["UnloadAllPatterns"]["return"] != 0: - return self._defaults["UnloadAllPatterns"]["return"] - return self._defaults["UnloadAllPatterns"]["return"] + if self._defaults['UnloadAllPatterns']['return'] != 0: + return self._defaults['UnloadAllPatterns']['return'] + return self._defaults['UnloadAllPatterns']['return'] def niDigital_UnloadSpecifications(self, vi, file_path): # noqa: N802 - if self._defaults["UnloadSpecifications"]["return"] != 0: - return self._defaults["UnloadSpecifications"]["return"] - return self._defaults["UnloadSpecifications"]["return"] + if self._defaults['UnloadSpecifications']['return'] != 0: + return self._defaults['UnloadSpecifications']['return'] + return self._defaults['UnloadSpecifications']['return'] def niDigital_UnlockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults["UnlockSession"]["return"] != 0: - return self._defaults["UnlockSession"]["return"] + if self._defaults['UnlockSession']['return'] != 0: + return self._defaults['UnlockSession']['return'] # caller_has_lock - if self._defaults["UnlockSession"]["callerHasLock"] is None: - raise MockFunctionCallError( - "niDigital_UnlockSession", param="callerHasLock" - ) + if self._defaults['UnlockSession']['callerHasLock'] is None: + raise MockFunctionCallError("niDigital_UnlockSession", param='callerHasLock') if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults["UnlockSession"][ - "callerHasLock" - ] - return self._defaults["UnlockSession"]["return"] + caller_has_lock.contents.value = self._defaults['UnlockSession']['callerHasLock'] + return self._defaults['UnlockSession']['return'] def niDigital_WaitUntilDone(self, vi, timeout): # noqa: N802 - if self._defaults["WaitUntilDone"]["return"] != 0: - return self._defaults["WaitUntilDone"]["return"] - return self._defaults["WaitUntilDone"]["return"] + if self._defaults['WaitUntilDone']['return'] != 0: + return self._defaults['WaitUntilDone']['return'] + return self._defaults['WaitUntilDone']['return'] def niDigital_WriteSequencerFlag(self, vi, flag, value): # noqa: N802 - if self._defaults["WriteSequencerFlag"]["return"] != 0: - return self._defaults["WriteSequencerFlag"]["return"] - return self._defaults["WriteSequencerFlag"]["return"] + if self._defaults['WriteSequencerFlag']['return'] != 0: + return self._defaults['WriteSequencerFlag']['return'] + return self._defaults['WriteSequencerFlag']['return'] def niDigital_WriteSequencerRegister(self, vi, reg, value): # noqa: N802 - if self._defaults["WriteSequencerRegister"]["return"] != 0: - return self._defaults["WriteSequencerRegister"]["return"] - return self._defaults["WriteSequencerRegister"]["return"] - - def niDigital_WriteSourceWaveformBroadcastU32( - self, vi, waveform_name, waveform_size, waveform_data - ): # noqa: N802 - if self._defaults["WriteSourceWaveformBroadcastU32"]["return"] != 0: - return self._defaults["WriteSourceWaveformBroadcastU32"]["return"] - return self._defaults["WriteSourceWaveformBroadcastU32"]["return"] - - def niDigital_WriteSourceWaveformDataFromFileTDMS( - self, vi, waveform_name, waveform_file_path - ): # noqa: N802 - if self._defaults["WriteSourceWaveformDataFromFileTDMS"]["return"] != 0: - return self._defaults["WriteSourceWaveformDataFromFileTDMS"]["return"] - return self._defaults["WriteSourceWaveformDataFromFileTDMS"]["return"] - - def niDigital_WriteSourceWaveformSiteUniqueU32( - self, - vi, - site_list, - waveform_name, - num_waveforms, - samples_per_waveform, - waveform_data, - ): # noqa: N802 - if self._defaults["WriteSourceWaveformSiteUniqueU32"]["return"] != 0: - return self._defaults["WriteSourceWaveformSiteUniqueU32"]["return"] - return self._defaults["WriteSourceWaveformSiteUniqueU32"]["return"] + if self._defaults['WriteSequencerRegister']['return'] != 0: + return self._defaults['WriteSequencerRegister']['return'] + return self._defaults['WriteSequencerRegister']['return'] + + def niDigital_WriteSourceWaveformBroadcastU32(self, vi, waveform_name, waveform_size, waveform_data): # noqa: N802 + if self._defaults['WriteSourceWaveformBroadcastU32']['return'] != 0: + return self._defaults['WriteSourceWaveformBroadcastU32']['return'] + return self._defaults['WriteSourceWaveformBroadcastU32']['return'] + + def niDigital_WriteSourceWaveformDataFromFileTDMS(self, vi, waveform_name, waveform_file_path): # noqa: N802 + if self._defaults['WriteSourceWaveformDataFromFileTDMS']['return'] != 0: + return self._defaults['WriteSourceWaveformDataFromFileTDMS']['return'] + return self._defaults['WriteSourceWaveformDataFromFileTDMS']['return'] + + def niDigital_WriteSourceWaveformSiteUniqueU32(self, vi, site_list, waveform_name, num_waveforms, samples_per_waveform, waveform_data): # noqa: N802 + if self._defaults['WriteSourceWaveformSiteUniqueU32']['return'] != 0: + return self._defaults['WriteSourceWaveformSiteUniqueU32']['return'] + return self._defaults['WriteSourceWaveformSiteUniqueU32']['return'] def niDigital_WriteStatic(self, vi, channel_list, state): # noqa: N802 - if self._defaults["WriteStatic"]["return"] != 0: - return self._defaults["WriteStatic"]["return"] - return self._defaults["WriteStatic"]["return"] + if self._defaults['WriteStatic']['return'] != 0: + return self._defaults['WriteStatic']['return'] + return self._defaults['WriteStatic']['return'] def niDigital_close(self, vi): # noqa: N802 - if self._defaults["close"]["return"] != 0: - return self._defaults["close"]["return"] - return self._defaults["close"]["return"] + if self._defaults['close']['return'] != 0: + return self._defaults['close']['return'] + return self._defaults['close']['return'] def niDigital_error_message(self, vi, error_code, error_message): # noqa: N802 - if self._defaults["error_message"]["return"] != 0: - return self._defaults["error_message"]["return"] + if self._defaults['error_message']['return'] != 0: + return self._defaults['error_message']['return'] # error_message - if self._defaults["error_message"]["errorMessage"] is None: - raise MockFunctionCallError("niDigital_error_message", param="errorMessage") - test_value = self._defaults["error_message"]["errorMessage"] + if self._defaults['error_message']['errorMessage'] is None: + raise MockFunctionCallError("niDigital_error_message", param='errorMessage') + test_value = self._defaults['error_message']['errorMessage'] if type(test_value) is str: - test_value = test_value.encode("ascii") + test_value = test_value.encode('ascii') assert len(error_message) >= len(test_value) for i in range(len(test_value)): error_message[i] = test_value[i] - return self._defaults["error_message"]["return"] + return self._defaults['error_message']['return'] def niDigital_reset(self, vi): # noqa: N802 - if self._defaults["reset"]["return"] != 0: - return self._defaults["reset"]["return"] - return self._defaults["reset"]["return"] + if self._defaults['reset']['return'] != 0: + return self._defaults['reset']['return'] + return self._defaults['reset']['return'] def niDigital_self_test(self, vi, test_result, test_message): # noqa: N802 - if self._defaults["self_test"]["return"] != 0: - return self._defaults["self_test"]["return"] + if self._defaults['self_test']['return'] != 0: + return self._defaults['self_test']['return'] # test_result - if self._defaults["self_test"]["testResult"] is None: - raise MockFunctionCallError("niDigital_self_test", param="testResult") + if self._defaults['self_test']['testResult'] is None: + raise MockFunctionCallError("niDigital_self_test", param='testResult') if test_result is not None: - test_result.contents.value = self._defaults["self_test"]["testResult"] + test_result.contents.value = self._defaults['self_test']['testResult'] # test_message - if self._defaults["self_test"]["testMessage"] is None: - raise MockFunctionCallError("niDigital_self_test", param="testMessage") - test_value = self._defaults["self_test"]["testMessage"] + if self._defaults['self_test']['testMessage'] is None: + raise MockFunctionCallError("niDigital_self_test", param='testMessage') + test_value = self._defaults['self_test']['testMessage'] if type(test_value) is str: - test_value = test_value.encode("ascii") + test_value = test_value.encode('ascii') assert len(test_message) >= len(test_value) for i in range(len(test_value)): test_message[i] = test_value[i] - return self._defaults["self_test"]["return"] + return self._defaults['self_test']['return'] # Helper function to setup Mock object with default side effects and return values def set_side_effects_and_return_values(self, mock_library): - mock_library.niDigital_Abort.side_effect = MockFunctionCallError( - "niDigital_Abort" - ) + mock_library.niDigital_Abort.side_effect = MockFunctionCallError("niDigital_Abort") mock_library.niDigital_Abort.return_value = 0 - mock_library.niDigital_AbortKeepAlive.side_effect = MockFunctionCallError( - "niDigital_AbortKeepAlive" - ) + mock_library.niDigital_AbortKeepAlive.side_effect = MockFunctionCallError("niDigital_AbortKeepAlive") mock_library.niDigital_AbortKeepAlive.return_value = 0 - mock_library.niDigital_ApplyLevelsAndTiming.side_effect = MockFunctionCallError( - "niDigital_ApplyLevelsAndTiming" - ) + mock_library.niDigital_ApplyLevelsAndTiming.side_effect = MockFunctionCallError("niDigital_ApplyLevelsAndTiming") mock_library.niDigital_ApplyLevelsAndTiming.return_value = 0 - mock_library.niDigital_ApplyTDROffsets.side_effect = MockFunctionCallError( - "niDigital_ApplyTDROffsets" - ) + mock_library.niDigital_ApplyTDROffsets.side_effect = MockFunctionCallError("niDigital_ApplyTDROffsets") mock_library.niDigital_ApplyTDROffsets.return_value = 0 - mock_library.niDigital_BurstPattern.side_effect = MockFunctionCallError( - "niDigital_BurstPattern" - ) + mock_library.niDigital_BurstPattern.side_effect = MockFunctionCallError("niDigital_BurstPattern") mock_library.niDigital_BurstPattern.return_value = 0 - mock_library.niDigital_ClockGenerator_Abort.side_effect = MockFunctionCallError( - "niDigital_ClockGenerator_Abort" - ) + mock_library.niDigital_ClockGenerator_Abort.side_effect = MockFunctionCallError("niDigital_ClockGenerator_Abort") mock_library.niDigital_ClockGenerator_Abort.return_value = 0 - mock_library.niDigital_ClockGenerator_GenerateClock.side_effect = ( - MockFunctionCallError("niDigital_ClockGenerator_GenerateClock") - ) + mock_library.niDigital_ClockGenerator_GenerateClock.side_effect = MockFunctionCallError("niDigital_ClockGenerator_GenerateClock") mock_library.niDigital_ClockGenerator_GenerateClock.return_value = 0 - mock_library.niDigital_Commit.side_effect = MockFunctionCallError( - "niDigital_Commit" - ) + mock_library.niDigital_Commit.side_effect = MockFunctionCallError("niDigital_Commit") mock_library.niDigital_Commit.return_value = 0 - mock_library.niDigital_ConfigureActiveLoadLevels.side_effect = ( - MockFunctionCallError("niDigital_ConfigureActiveLoadLevels") - ) + mock_library.niDigital_ConfigureActiveLoadLevels.side_effect = MockFunctionCallError("niDigital_ConfigureActiveLoadLevels") mock_library.niDigital_ConfigureActiveLoadLevels.return_value = 0 - mock_library.niDigital_ConfigurePatternBurstSites.side_effect = ( - MockFunctionCallError("niDigital_ConfigurePatternBurstSites") - ) + mock_library.niDigital_ConfigurePatternBurstSites.side_effect = MockFunctionCallError("niDigital_ConfigurePatternBurstSites") mock_library.niDigital_ConfigurePatternBurstSites.return_value = 0 - mock_library.niDigital_ConfigureTimeSetCompareEdgesStrobe.side_effect = ( - MockFunctionCallError("niDigital_ConfigureTimeSetCompareEdgesStrobe") - ) + mock_library.niDigital_ConfigureTimeSetCompareEdgesStrobe.side_effect = MockFunctionCallError("niDigital_ConfigureTimeSetCompareEdgesStrobe") mock_library.niDigital_ConfigureTimeSetCompareEdgesStrobe.return_value = 0 - mock_library.niDigital_ConfigureTimeSetCompareEdgesStrobe2x.side_effect = ( - MockFunctionCallError("niDigital_ConfigureTimeSetCompareEdgesStrobe2x") - ) + mock_library.niDigital_ConfigureTimeSetCompareEdgesStrobe2x.side_effect = MockFunctionCallError("niDigital_ConfigureTimeSetCompareEdgesStrobe2x") mock_library.niDigital_ConfigureTimeSetCompareEdgesStrobe2x.return_value = 0 - mock_library.niDigital_ConfigureTimeSetDriveEdges.side_effect = ( - MockFunctionCallError("niDigital_ConfigureTimeSetDriveEdges") - ) + mock_library.niDigital_ConfigureTimeSetDriveEdges.side_effect = MockFunctionCallError("niDigital_ConfigureTimeSetDriveEdges") mock_library.niDigital_ConfigureTimeSetDriveEdges.return_value = 0 - mock_library.niDigital_ConfigureTimeSetDriveEdges2x.side_effect = ( - MockFunctionCallError("niDigital_ConfigureTimeSetDriveEdges2x") - ) + mock_library.niDigital_ConfigureTimeSetDriveEdges2x.side_effect = MockFunctionCallError("niDigital_ConfigureTimeSetDriveEdges2x") mock_library.niDigital_ConfigureTimeSetDriveEdges2x.return_value = 0 - mock_library.niDigital_ConfigureTimeSetDriveFormat.side_effect = ( - MockFunctionCallError("niDigital_ConfigureTimeSetDriveFormat") - ) + mock_library.niDigital_ConfigureTimeSetDriveFormat.side_effect = MockFunctionCallError("niDigital_ConfigureTimeSetDriveFormat") mock_library.niDigital_ConfigureTimeSetDriveFormat.return_value = 0 - mock_library.niDigital_ConfigureTimeSetEdge.side_effect = MockFunctionCallError( - "niDigital_ConfigureTimeSetEdge" - ) + mock_library.niDigital_ConfigureTimeSetEdge.side_effect = MockFunctionCallError("niDigital_ConfigureTimeSetEdge") mock_library.niDigital_ConfigureTimeSetEdge.return_value = 0 - mock_library.niDigital_ConfigureTimeSetEdgeMultiplier.side_effect = ( - MockFunctionCallError("niDigital_ConfigureTimeSetEdgeMultiplier") - ) + mock_library.niDigital_ConfigureTimeSetEdgeMultiplier.side_effect = MockFunctionCallError("niDigital_ConfigureTimeSetEdgeMultiplier") mock_library.niDigital_ConfigureTimeSetEdgeMultiplier.return_value = 0 - mock_library.niDigital_ConfigureTimeSetPeriod.side_effect = ( - MockFunctionCallError("niDigital_ConfigureTimeSetPeriod") - ) + mock_library.niDigital_ConfigureTimeSetPeriod.side_effect = MockFunctionCallError("niDigital_ConfigureTimeSetPeriod") mock_library.niDigital_ConfigureTimeSetPeriod.return_value = 0 - mock_library.niDigital_ConfigureVoltageLevels.side_effect = ( - MockFunctionCallError("niDigital_ConfigureVoltageLevels") - ) + mock_library.niDigital_ConfigureVoltageLevels.side_effect = MockFunctionCallError("niDigital_ConfigureVoltageLevels") mock_library.niDigital_ConfigureVoltageLevels.return_value = 0 - mock_library.niDigital_CreateCaptureWaveformFromFileDigicapture.side_effect = ( - MockFunctionCallError("niDigital_CreateCaptureWaveformFromFileDigicapture") - ) + mock_library.niDigital_CreateCaptureWaveformFromFileDigicapture.side_effect = MockFunctionCallError("niDigital_CreateCaptureWaveformFromFileDigicapture") mock_library.niDigital_CreateCaptureWaveformFromFileDigicapture.return_value = 0 - mock_library.niDigital_CreateCaptureWaveformParallel.side_effect = ( - MockFunctionCallError("niDigital_CreateCaptureWaveformParallel") - ) + mock_library.niDigital_CreateCaptureWaveformParallel.side_effect = MockFunctionCallError("niDigital_CreateCaptureWaveformParallel") mock_library.niDigital_CreateCaptureWaveformParallel.return_value = 0 - mock_library.niDigital_CreateCaptureWaveformSerial.side_effect = ( - MockFunctionCallError("niDigital_CreateCaptureWaveformSerial") - ) + mock_library.niDigital_CreateCaptureWaveformSerial.side_effect = MockFunctionCallError("niDigital_CreateCaptureWaveformSerial") mock_library.niDigital_CreateCaptureWaveformSerial.return_value = 0 - mock_library.niDigital_CreateSourceWaveformFromFileTDMS.side_effect = ( - MockFunctionCallError("niDigital_CreateSourceWaveformFromFileTDMS") - ) + mock_library.niDigital_CreateSourceWaveformFromFileTDMS.side_effect = MockFunctionCallError("niDigital_CreateSourceWaveformFromFileTDMS") mock_library.niDigital_CreateSourceWaveformFromFileTDMS.return_value = 0 - mock_library.niDigital_CreateSourceWaveformParallel.side_effect = ( - MockFunctionCallError("niDigital_CreateSourceWaveformParallel") - ) + mock_library.niDigital_CreateSourceWaveformParallel.side_effect = MockFunctionCallError("niDigital_CreateSourceWaveformParallel") mock_library.niDigital_CreateSourceWaveformParallel.return_value = 0 - mock_library.niDigital_CreateSourceWaveformSerial.side_effect = ( - MockFunctionCallError("niDigital_CreateSourceWaveformSerial") - ) + mock_library.niDigital_CreateSourceWaveformSerial.side_effect = MockFunctionCallError("niDigital_CreateSourceWaveformSerial") mock_library.niDigital_CreateSourceWaveformSerial.return_value = 0 - mock_library.niDigital_CreateTimeSet.side_effect = MockFunctionCallError( - "niDigital_CreateTimeSet" - ) + mock_library.niDigital_CreateTimeSet.side_effect = MockFunctionCallError("niDigital_CreateTimeSet") mock_library.niDigital_CreateTimeSet.return_value = 0 - mock_library.niDigital_DeleteAllTimeSets.side_effect = MockFunctionCallError( - "niDigital_DeleteAllTimeSets" - ) + mock_library.niDigital_DeleteAllTimeSets.side_effect = MockFunctionCallError("niDigital_DeleteAllTimeSets") mock_library.niDigital_DeleteAllTimeSets.return_value = 0 - mock_library.niDigital_DisableSites.side_effect = MockFunctionCallError( - "niDigital_DisableSites" - ) + mock_library.niDigital_DisableSites.side_effect = MockFunctionCallError("niDigital_DisableSites") mock_library.niDigital_DisableSites.return_value = 0 - mock_library.niDigital_EnableSites.side_effect = MockFunctionCallError( - "niDigital_EnableSites" - ) + mock_library.niDigital_EnableSites.side_effect = MockFunctionCallError("niDigital_EnableSites") mock_library.niDigital_EnableSites.return_value = 0 - mock_library.niDigital_FetchHistoryRAMCycleInformation.side_effect = ( - MockFunctionCallError("niDigital_FetchHistoryRAMCycleInformation") - ) + mock_library.niDigital_FetchHistoryRAMCycleInformation.side_effect = MockFunctionCallError("niDigital_FetchHistoryRAMCycleInformation") mock_library.niDigital_FetchHistoryRAMCycleInformation.return_value = 0 - mock_library.niDigital_FetchHistoryRAMCyclePinData.side_effect = ( - MockFunctionCallError("niDigital_FetchHistoryRAMCyclePinData") - ) + mock_library.niDigital_FetchHistoryRAMCyclePinData.side_effect = MockFunctionCallError("niDigital_FetchHistoryRAMCyclePinData") mock_library.niDigital_FetchHistoryRAMCyclePinData.return_value = 0 - mock_library.niDigital_FetchHistoryRAMScanCycleNumber.side_effect = ( - MockFunctionCallError("niDigital_FetchHistoryRAMScanCycleNumber") - ) + mock_library.niDigital_FetchHistoryRAMScanCycleNumber.side_effect = MockFunctionCallError("niDigital_FetchHistoryRAMScanCycleNumber") mock_library.niDigital_FetchHistoryRAMScanCycleNumber.return_value = 0 - mock_library.niDigital_FrequencyCounter_MeasureFrequency.side_effect = ( - MockFunctionCallError("niDigital_FrequencyCounter_MeasureFrequency") - ) + mock_library.niDigital_FrequencyCounter_MeasureFrequency.side_effect = MockFunctionCallError("niDigital_FrequencyCounter_MeasureFrequency") mock_library.niDigital_FrequencyCounter_MeasureFrequency.return_value = 0 - mock_library.niDigital_GetAttributeViBoolean.side_effect = ( - MockFunctionCallError("niDigital_GetAttributeViBoolean") - ) + mock_library.niDigital_GetAttributeViBoolean.side_effect = MockFunctionCallError("niDigital_GetAttributeViBoolean") mock_library.niDigital_GetAttributeViBoolean.return_value = 0 - mock_library.niDigital_GetAttributeViInt32.side_effect = MockFunctionCallError( - "niDigital_GetAttributeViInt32" - ) + mock_library.niDigital_GetAttributeViInt32.side_effect = MockFunctionCallError("niDigital_GetAttributeViInt32") mock_library.niDigital_GetAttributeViInt32.return_value = 0 - mock_library.niDigital_GetAttributeViInt64.side_effect = MockFunctionCallError( - "niDigital_GetAttributeViInt64" - ) + mock_library.niDigital_GetAttributeViInt64.side_effect = MockFunctionCallError("niDigital_GetAttributeViInt64") mock_library.niDigital_GetAttributeViInt64.return_value = 0 - mock_library.niDigital_GetAttributeViReal64.side_effect = MockFunctionCallError( - "niDigital_GetAttributeViReal64" - ) + mock_library.niDigital_GetAttributeViReal64.side_effect = MockFunctionCallError("niDigital_GetAttributeViReal64") mock_library.niDigital_GetAttributeViReal64.return_value = 0 - mock_library.niDigital_GetAttributeViString.side_effect = MockFunctionCallError( - "niDigital_GetAttributeViString" - ) + mock_library.niDigital_GetAttributeViString.side_effect = MockFunctionCallError("niDigital_GetAttributeViString") mock_library.niDigital_GetAttributeViString.return_value = 0 - mock_library.niDigital_GetChannelNameFromString.side_effect = ( - MockFunctionCallError("niDigital_GetChannelNameFromString") - ) + mock_library.niDigital_GetChannelNameFromString.side_effect = MockFunctionCallError("niDigital_GetChannelNameFromString") mock_library.niDigital_GetChannelNameFromString.return_value = 0 - mock_library.niDigital_GetError.side_effect = MockFunctionCallError( - "niDigital_GetError" - ) + mock_library.niDigital_GetError.side_effect = MockFunctionCallError("niDigital_GetError") mock_library.niDigital_GetError.return_value = 0 - mock_library.niDigital_GetFailCount.side_effect = MockFunctionCallError( - "niDigital_GetFailCount" - ) + mock_library.niDigital_GetFailCount.side_effect = MockFunctionCallError("niDigital_GetFailCount") mock_library.niDigital_GetFailCount.return_value = 0 - mock_library.niDigital_GetHistoryRAMSampleCount.side_effect = ( - MockFunctionCallError("niDigital_GetHistoryRAMSampleCount") - ) + mock_library.niDigital_GetHistoryRAMSampleCount.side_effect = MockFunctionCallError("niDigital_GetHistoryRAMSampleCount") mock_library.niDigital_GetHistoryRAMSampleCount.return_value = 0 - mock_library.niDigital_GetPatternName.side_effect = MockFunctionCallError( - "niDigital_GetPatternName" - ) + mock_library.niDigital_GetPatternName.side_effect = MockFunctionCallError("niDigital_GetPatternName") mock_library.niDigital_GetPatternName.return_value = 0 - mock_library.niDigital_GetPatternPinList.side_effect = MockFunctionCallError( - "niDigital_GetPatternPinList" - ) + mock_library.niDigital_GetPatternPinList.side_effect = MockFunctionCallError("niDigital_GetPatternPinList") mock_library.niDigital_GetPatternPinList.return_value = 0 - mock_library.niDigital_GetPinName.side_effect = MockFunctionCallError( - "niDigital_GetPinName" - ) + mock_library.niDigital_GetPinName.side_effect = MockFunctionCallError("niDigital_GetPinName") mock_library.niDigital_GetPinName.return_value = 0 - mock_library.niDigital_GetPinResultsPinInformation.side_effect = ( - MockFunctionCallError("niDigital_GetPinResultsPinInformation") - ) + mock_library.niDigital_GetPinResultsPinInformation.side_effect = MockFunctionCallError("niDigital_GetPinResultsPinInformation") mock_library.niDigital_GetPinResultsPinInformation.return_value = 0 - mock_library.niDigital_GetSitePassFail.side_effect = MockFunctionCallError( - "niDigital_GetSitePassFail" - ) + mock_library.niDigital_GetSitePassFail.side_effect = MockFunctionCallError("niDigital_GetSitePassFail") mock_library.niDigital_GetSitePassFail.return_value = 0 - mock_library.niDigital_GetSiteResultsSiteNumbers.side_effect = ( - MockFunctionCallError("niDigital_GetSiteResultsSiteNumbers") - ) + mock_library.niDigital_GetSiteResultsSiteNumbers.side_effect = MockFunctionCallError("niDigital_GetSiteResultsSiteNumbers") mock_library.niDigital_GetSiteResultsSiteNumbers.return_value = 0 - mock_library.niDigital_GetTimeSetDriveFormat.side_effect = ( - MockFunctionCallError("niDigital_GetTimeSetDriveFormat") - ) + mock_library.niDigital_GetTimeSetDriveFormat.side_effect = MockFunctionCallError("niDigital_GetTimeSetDriveFormat") mock_library.niDigital_GetTimeSetDriveFormat.return_value = 0 - mock_library.niDigital_GetTimeSetEdge.side_effect = MockFunctionCallError( - "niDigital_GetTimeSetEdge" - ) + mock_library.niDigital_GetTimeSetEdge.side_effect = MockFunctionCallError("niDigital_GetTimeSetEdge") mock_library.niDigital_GetTimeSetEdge.return_value = 0 - mock_library.niDigital_GetTimeSetEdgeMultiplier.side_effect = ( - MockFunctionCallError("niDigital_GetTimeSetEdgeMultiplier") - ) + mock_library.niDigital_GetTimeSetEdgeMultiplier.side_effect = MockFunctionCallError("niDigital_GetTimeSetEdgeMultiplier") mock_library.niDigital_GetTimeSetEdgeMultiplier.return_value = 0 - mock_library.niDigital_GetTimeSetName.side_effect = MockFunctionCallError( - "niDigital_GetTimeSetName" - ) + mock_library.niDigital_GetTimeSetName.side_effect = MockFunctionCallError("niDigital_GetTimeSetName") mock_library.niDigital_GetTimeSetName.return_value = 0 - mock_library.niDigital_GetTimeSetPeriod.side_effect = MockFunctionCallError( - "niDigital_GetTimeSetPeriod" - ) + mock_library.niDigital_GetTimeSetPeriod.side_effect = MockFunctionCallError("niDigital_GetTimeSetPeriod") mock_library.niDigital_GetTimeSetPeriod.return_value = 0 - mock_library.niDigital_InitWithOptions.side_effect = MockFunctionCallError( - "niDigital_InitWithOptions" - ) + mock_library.niDigital_InitWithOptions.side_effect = MockFunctionCallError("niDigital_InitWithOptions") mock_library.niDigital_InitWithOptions.return_value = 0 - mock_library.niDigital_Initiate.side_effect = MockFunctionCallError( - "niDigital_Initiate" - ) + mock_library.niDigital_Initiate.side_effect = MockFunctionCallError("niDigital_Initiate") mock_library.niDigital_Initiate.return_value = 0 - mock_library.niDigital_IsDone.side_effect = MockFunctionCallError( - "niDigital_IsDone" - ) + mock_library.niDigital_IsDone.side_effect = MockFunctionCallError("niDigital_IsDone") mock_library.niDigital_IsDone.return_value = 0 - mock_library.niDigital_IsSiteEnabled.side_effect = MockFunctionCallError( - "niDigital_IsSiteEnabled" - ) + mock_library.niDigital_IsSiteEnabled.side_effect = MockFunctionCallError("niDigital_IsSiteEnabled") mock_library.niDigital_IsSiteEnabled.return_value = 0 - mock_library.niDigital_LoadLevels.side_effect = MockFunctionCallError( - "niDigital_LoadLevels" - ) + mock_library.niDigital_LoadLevels.side_effect = MockFunctionCallError("niDigital_LoadLevels") mock_library.niDigital_LoadLevels.return_value = 0 - mock_library.niDigital_LoadPattern.side_effect = MockFunctionCallError( - "niDigital_LoadPattern" - ) + mock_library.niDigital_LoadPattern.side_effect = MockFunctionCallError("niDigital_LoadPattern") mock_library.niDigital_LoadPattern.return_value = 0 - mock_library.niDigital_LoadPinMap.side_effect = MockFunctionCallError( - "niDigital_LoadPinMap" - ) + mock_library.niDigital_LoadPinMap.side_effect = MockFunctionCallError("niDigital_LoadPinMap") mock_library.niDigital_LoadPinMap.return_value = 0 - mock_library.niDigital_LoadSpecifications.side_effect = MockFunctionCallError( - "niDigital_LoadSpecifications" - ) + mock_library.niDigital_LoadSpecifications.side_effect = MockFunctionCallError("niDigital_LoadSpecifications") mock_library.niDigital_LoadSpecifications.return_value = 0 - mock_library.niDigital_LoadTiming.side_effect = MockFunctionCallError( - "niDigital_LoadTiming" - ) + mock_library.niDigital_LoadTiming.side_effect = MockFunctionCallError("niDigital_LoadTiming") mock_library.niDigital_LoadTiming.return_value = 0 - mock_library.niDigital_LockSession.side_effect = MockFunctionCallError( - "niDigital_LockSession" - ) + mock_library.niDigital_LockSession.side_effect = MockFunctionCallError("niDigital_LockSession") mock_library.niDigital_LockSession.return_value = 0 - mock_library.niDigital_PPMU_Measure.side_effect = MockFunctionCallError( - "niDigital_PPMU_Measure" - ) + mock_library.niDigital_PPMU_Measure.side_effect = MockFunctionCallError("niDigital_PPMU_Measure") mock_library.niDigital_PPMU_Measure.return_value = 0 - mock_library.niDigital_PPMU_Source.side_effect = MockFunctionCallError( - "niDigital_PPMU_Source" - ) + mock_library.niDigital_PPMU_Source.side_effect = MockFunctionCallError("niDigital_PPMU_Source") mock_library.niDigital_PPMU_Source.return_value = 0 - mock_library.niDigital_ReadSequencerFlag.side_effect = MockFunctionCallError( - "niDigital_ReadSequencerFlag" - ) + mock_library.niDigital_ReadSequencerFlag.side_effect = MockFunctionCallError("niDigital_ReadSequencerFlag") mock_library.niDigital_ReadSequencerFlag.return_value = 0 - mock_library.niDigital_ReadSequencerRegister.side_effect = ( - MockFunctionCallError("niDigital_ReadSequencerRegister") - ) + mock_library.niDigital_ReadSequencerRegister.side_effect = MockFunctionCallError("niDigital_ReadSequencerRegister") mock_library.niDigital_ReadSequencerRegister.return_value = 0 - mock_library.niDigital_ReadStatic.side_effect = MockFunctionCallError( - "niDigital_ReadStatic" - ) + mock_library.niDigital_ReadStatic.side_effect = MockFunctionCallError("niDigital_ReadStatic") mock_library.niDigital_ReadStatic.return_value = 0 - mock_library.niDigital_ResetDevice.side_effect = MockFunctionCallError( - "niDigital_ResetDevice" - ) + mock_library.niDigital_ResetDevice.side_effect = MockFunctionCallError("niDigital_ResetDevice") mock_library.niDigital_ResetDevice.return_value = 0 - mock_library.niDigital_SelfCalibrate.side_effect = MockFunctionCallError( - "niDigital_SelfCalibrate" - ) + mock_library.niDigital_SelfCalibrate.side_effect = MockFunctionCallError("niDigital_SelfCalibrate") mock_library.niDigital_SelfCalibrate.return_value = 0 - mock_library.niDigital_SendSoftwareEdgeTrigger.side_effect = ( - MockFunctionCallError("niDigital_SendSoftwareEdgeTrigger") - ) + mock_library.niDigital_SendSoftwareEdgeTrigger.side_effect = MockFunctionCallError("niDigital_SendSoftwareEdgeTrigger") mock_library.niDigital_SendSoftwareEdgeTrigger.return_value = 0 - mock_library.niDigital_SetAttributeViBoolean.side_effect = ( - MockFunctionCallError("niDigital_SetAttributeViBoolean") - ) + mock_library.niDigital_SetAttributeViBoolean.side_effect = MockFunctionCallError("niDigital_SetAttributeViBoolean") mock_library.niDigital_SetAttributeViBoolean.return_value = 0 - mock_library.niDigital_SetAttributeViInt32.side_effect = MockFunctionCallError( - "niDigital_SetAttributeViInt32" - ) + mock_library.niDigital_SetAttributeViInt32.side_effect = MockFunctionCallError("niDigital_SetAttributeViInt32") mock_library.niDigital_SetAttributeViInt32.return_value = 0 - mock_library.niDigital_SetAttributeViInt64.side_effect = MockFunctionCallError( - "niDigital_SetAttributeViInt64" - ) + mock_library.niDigital_SetAttributeViInt64.side_effect = MockFunctionCallError("niDigital_SetAttributeViInt64") mock_library.niDigital_SetAttributeViInt64.return_value = 0 - mock_library.niDigital_SetAttributeViReal64.side_effect = MockFunctionCallError( - "niDigital_SetAttributeViReal64" - ) + mock_library.niDigital_SetAttributeViReal64.side_effect = MockFunctionCallError("niDigital_SetAttributeViReal64") mock_library.niDigital_SetAttributeViReal64.return_value = 0 - mock_library.niDigital_SetAttributeViString.side_effect = MockFunctionCallError( - "niDigital_SetAttributeViString" - ) + mock_library.niDigital_SetAttributeViString.side_effect = MockFunctionCallError("niDigital_SetAttributeViString") mock_library.niDigital_SetAttributeViString.return_value = 0 mock_library.niDigital_TDR.side_effect = MockFunctionCallError("niDigital_TDR") mock_library.niDigital_TDR.return_value = 0 - mock_library.niDigital_UnloadAllPatterns.side_effect = MockFunctionCallError( - "niDigital_UnloadAllPatterns" - ) + mock_library.niDigital_UnloadAllPatterns.side_effect = MockFunctionCallError("niDigital_UnloadAllPatterns") mock_library.niDigital_UnloadAllPatterns.return_value = 0 - mock_library.niDigital_UnloadSpecifications.side_effect = MockFunctionCallError( - "niDigital_UnloadSpecifications" - ) + mock_library.niDigital_UnloadSpecifications.side_effect = MockFunctionCallError("niDigital_UnloadSpecifications") mock_library.niDigital_UnloadSpecifications.return_value = 0 - mock_library.niDigital_UnlockSession.side_effect = MockFunctionCallError( - "niDigital_UnlockSession" - ) + mock_library.niDigital_UnlockSession.side_effect = MockFunctionCallError("niDigital_UnlockSession") mock_library.niDigital_UnlockSession.return_value = 0 - mock_library.niDigital_WaitUntilDone.side_effect = MockFunctionCallError( - "niDigital_WaitUntilDone" - ) + mock_library.niDigital_WaitUntilDone.side_effect = MockFunctionCallError("niDigital_WaitUntilDone") mock_library.niDigital_WaitUntilDone.return_value = 0 - mock_library.niDigital_WriteSequencerFlag.side_effect = MockFunctionCallError( - "niDigital_WriteSequencerFlag" - ) + mock_library.niDigital_WriteSequencerFlag.side_effect = MockFunctionCallError("niDigital_WriteSequencerFlag") mock_library.niDigital_WriteSequencerFlag.return_value = 0 - mock_library.niDigital_WriteSequencerRegister.side_effect = ( - MockFunctionCallError("niDigital_WriteSequencerRegister") - ) + mock_library.niDigital_WriteSequencerRegister.side_effect = MockFunctionCallError("niDigital_WriteSequencerRegister") mock_library.niDigital_WriteSequencerRegister.return_value = 0 - mock_library.niDigital_WriteSourceWaveformBroadcastU32.side_effect = ( - MockFunctionCallError("niDigital_WriteSourceWaveformBroadcastU32") - ) + mock_library.niDigital_WriteSourceWaveformBroadcastU32.side_effect = MockFunctionCallError("niDigital_WriteSourceWaveformBroadcastU32") mock_library.niDigital_WriteSourceWaveformBroadcastU32.return_value = 0 - mock_library.niDigital_WriteSourceWaveformDataFromFileTDMS.side_effect = ( - MockFunctionCallError("niDigital_WriteSourceWaveformDataFromFileTDMS") - ) + mock_library.niDigital_WriteSourceWaveformDataFromFileTDMS.side_effect = MockFunctionCallError("niDigital_WriteSourceWaveformDataFromFileTDMS") mock_library.niDigital_WriteSourceWaveformDataFromFileTDMS.return_value = 0 - mock_library.niDigital_WriteSourceWaveformSiteUniqueU32.side_effect = ( - MockFunctionCallError("niDigital_WriteSourceWaveformSiteUniqueU32") - ) + mock_library.niDigital_WriteSourceWaveformSiteUniqueU32.side_effect = MockFunctionCallError("niDigital_WriteSourceWaveformSiteUniqueU32") mock_library.niDigital_WriteSourceWaveformSiteUniqueU32.return_value = 0 - mock_library.niDigital_WriteStatic.side_effect = MockFunctionCallError( - "niDigital_WriteStatic" - ) + mock_library.niDigital_WriteStatic.side_effect = MockFunctionCallError("niDigital_WriteStatic") mock_library.niDigital_WriteStatic.return_value = 0 - mock_library.niDigital_close.side_effect = MockFunctionCallError( - "niDigital_close" - ) + mock_library.niDigital_close.side_effect = MockFunctionCallError("niDigital_close") mock_library.niDigital_close.return_value = 0 - mock_library.niDigital_error_message.side_effect = MockFunctionCallError( - "niDigital_error_message" - ) + mock_library.niDigital_error_message.side_effect = MockFunctionCallError("niDigital_error_message") mock_library.niDigital_error_message.return_value = 0 - mock_library.niDigital_reset.side_effect = MockFunctionCallError( - "niDigital_reset" - ) + mock_library.niDigital_reset.side_effect = MockFunctionCallError("niDigital_reset") mock_library.niDigital_reset.return_value = 0 - mock_library.niDigital_self_test.side_effect = MockFunctionCallError( - "niDigital_self_test" - ) + mock_library.niDigital_self_test.side_effect = MockFunctionCallError("niDigital_self_test") mock_library.niDigital_self_test.return_value = 0 diff --git a/generated/nidigital/nidigital/unit_tests/test_nidigital.py b/generated/nidigital/nidigital/unit_tests/test_nidigital.py index c2c63b41a..547299d68 100644 --- a/generated/nidigital/nidigital/unit_tests/test_nidigital.py +++ b/generated/nidigital/nidigital/unit_tests/test_nidigital.py @@ -10,39 +10,24 @@ class TestSession(object): def setup_method(self, method): - self.patched_library_patcher = patch( - "nidigital._library.Library", autospec=True - ) + self.patched_library_patcher = patch('nidigital._library.Library', autospec=True) self.patched_library = self.patched_library_patcher.start() - self.patched_library_singleton_get = patch( - "nidigital.session._library_singleton.get", - return_value=self.patched_library, - ) + self.patched_library_singleton_get = patch('nidigital.session._library_singleton.get', return_value=self.patched_library) self.patched_library_singleton_get.start() self.side_effects_helper = _mock_helper.SideEffectsHelper() - self.side_effects_helper.set_side_effects_and_return_values( - self.patched_library - ) + self.side_effects_helper.set_side_effects_and_return_values(self.patched_library) - self.patched_library.niDigital_InitWithOptions.side_effect = ( - self.side_effects_helper.niDigital_InitWithOptions - ) - self.side_effects_helper["InitWithOptions"]["newVi"] = session_id_for_test + self.patched_library.niDigital_InitWithOptions.side_effect = self.side_effects_helper.niDigital_InitWithOptions + self.side_effects_helper['InitWithOptions']['newVi'] = session_id_for_test - self.patched_library.niDigital_close.side_effect = ( - self.side_effects_helper.niDigital_close - ) + self.patched_library.niDigital_close.side_effect = self.side_effects_helper.niDigital_close - self.patched_library.niDigital_LockSession.side_effect = ( - self.side_effects_helper.niDigital_LockSession - ) - self.side_effects_helper["LockSession"]["callerHasLock"] = True + self.patched_library.niDigital_LockSession.side_effect = self.side_effects_helper.niDigital_LockSession + self.side_effects_helper['LockSession']['callerHasLock'] = True - self.patched_library.niDigital_UnlockSession.side_effect = ( - self.side_effects_helper.niDigital_UnlockSession - ) - self.side_effects_helper["UnlockSession"]["callerHasLock"] = True + self.patched_library.niDigital_UnlockSession.side_effect = self.side_effects_helper.niDigital_UnlockSession + self.side_effects_helper['UnlockSession']['callerHasLock'] = True # for niDigital_FetchHistoryRAMCycleInformation_looping self.pattern_indices_looping = [0, 0, 0, 0, 0, 0, 0] @@ -52,271 +37,50 @@ def setup_method(self, method): self.num_duty_cycles_looping = [1, 1, 1, 2, 2, 2, 1] # for niDigital_GetTimeSetName_looping - self.time_set_name_looping = ["t0", "tScan", "t2X"] + self.time_set_name_looping = ['t0', 'tScan', 't2X'] # for niDigital_FetchHistoryRAMScanCycleNumber_looping self.scan_cycle_number_looping = [-1, 0, 1, -1, -1, -1, -1] # for niDigital_FetchHistoryRAMCyclePinData_looping self.expected_pin_states_looping = [ - [ - [ - nidigital.PinState.ZERO, - nidigital.PinState.H, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.H, - nidigital.PinState.ZERO, - nidigital.PinState.X, - nidigital.PinState.X, - ] - ], - [ - [ - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.ZERO, - nidigital.PinState.ONE, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.L, - nidigital.PinState.H, - ] - ], - [ - [ - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.ONE, - nidigital.PinState.ZERO, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.H, - nidigital.PinState.L, - ] - ], - [ - [ - nidigital.PinState.ONE, - nidigital.PinState.ONE, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.H, - nidigital.PinState.H, - nidigital.PinState.X, - nidigital.PinState.X, - ], - [ - nidigital.PinState.ZERO, - nidigital.PinState.ZERO, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.L, - nidigital.PinState.L, - nidigital.PinState.X, - nidigital.PinState.X, - ], - ], - [ - [ - nidigital.PinState.ONE, - nidigital.PinState.ONE, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.H, - nidigital.PinState.H, - nidigital.PinState.X, - nidigital.PinState.X, - ], - [ - nidigital.PinState.ZERO, - nidigital.PinState.ZERO, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.L, - nidigital.PinState.L, - nidigital.PinState.X, - nidigital.PinState.X, - ], - ], - [ - [ - nidigital.PinState.ZERO, - nidigital.PinState.ONE, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.L, - nidigital.PinState.H, - nidigital.PinState.X, - nidigital.PinState.X, - ], - [ - nidigital.PinState.ONE, - nidigital.PinState.ZERO, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.H, - nidigital.PinState.L, - nidigital.PinState.X, - nidigital.PinState.X, - ], - ], - [ - [ - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.X, - ] - ], + [[nidigital.PinState.ZERO, nidigital.PinState.H, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.H, nidigital.PinState.ZERO, nidigital.PinState.X, nidigital.PinState.X]], + [[nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.ZERO, nidigital.PinState.ONE, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.L, nidigital.PinState.H]], + [[nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.ONE, nidigital.PinState.ZERO, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.H, nidigital.PinState.L]], + [[nidigital.PinState.ONE, nidigital.PinState.ONE, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.H, nidigital.PinState.H, nidigital.PinState.X, nidigital.PinState.X], + [nidigital.PinState.ZERO, nidigital.PinState.ZERO, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.L, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X]], + [[nidigital.PinState.ONE, nidigital.PinState.ONE, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.H, nidigital.PinState.H, nidigital.PinState.X, nidigital.PinState.X], + [nidigital.PinState.ZERO, nidigital.PinState.ZERO, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.L, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X]], + [[nidigital.PinState.ZERO, nidigital.PinState.ONE, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.L, nidigital.PinState.H, nidigital.PinState.X, nidigital.PinState.X], + [nidigital.PinState.ONE, nidigital.PinState.ZERO, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.H, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X]], + [[nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X]] ] self.actual_pin_states_looping = [ - [ - [ - nidigital.PinState.L, - nidigital.PinState.L, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.L, - nidigital.PinState.L, - nidigital.PinState.X, - nidigital.PinState.X, - ] - ], - [ - [ - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.L, - nidigital.PinState.H, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.L, - nidigital.PinState.H, - ] - ], - [ - [ - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.H, - nidigital.PinState.L, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.H, - nidigital.PinState.L, - ] - ], - [ - [ - nidigital.PinState.H, - nidigital.PinState.H, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.H, - nidigital.PinState.H, - nidigital.PinState.X, - nidigital.PinState.X, - ], - [ - nidigital.PinState.L, - nidigital.PinState.L, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.L, - nidigital.PinState.L, - nidigital.PinState.X, - nidigital.PinState.X, - ], - ], - [ - [ - nidigital.PinState.H, - nidigital.PinState.H, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.H, - nidigital.PinState.H, - nidigital.PinState.X, - nidigital.PinState.X, - ], - [ - nidigital.PinState.L, - nidigital.PinState.L, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.L, - nidigital.PinState.L, - nidigital.PinState.X, - nidigital.PinState.X, - ], - ], - [ - [ - nidigital.PinState.L, - nidigital.PinState.H, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.L, - nidigital.PinState.H, - nidigital.PinState.X, - nidigital.PinState.X, - ], - [ - nidigital.PinState.H, - nidigital.PinState.L, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.H, - nidigital.PinState.L, - nidigital.PinState.X, - nidigital.PinState.X, - ], - ], - [ - [ - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.X, - nidigital.PinState.X, - ] - ], + [[nidigital.PinState.L, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.L, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X]], + [[nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.L, nidigital.PinState.H, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.L, nidigital.PinState.H]], + [[nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.H, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.H, nidigital.PinState.L]], + [[nidigital.PinState.H, nidigital.PinState.H, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.H, nidigital.PinState.H, nidigital.PinState.X, nidigital.PinState.X], + [nidigital.PinState.L, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.L, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X]], + [[nidigital.PinState.H, nidigital.PinState.H, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.H, nidigital.PinState.H, nidigital.PinState.X, nidigital.PinState.X], + [nidigital.PinState.L, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.L, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X]], + [[nidigital.PinState.L, nidigital.PinState.H, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.L, nidigital.PinState.H, nidigital.PinState.X, nidigital.PinState.X], + [nidigital.PinState.H, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.H, nidigital.PinState.L, nidigital.PinState.X, nidigital.PinState.X]], + [[nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X, nidigital.PinState.X]] ] self.per_pin_pass_fail_looping = [ [[True, False, True, True, False, True, True, True]], [[True, True, True, True, True, True, True, True]], [[True, True, True, True, True, True, True, True]], - [ - [True, True, True, True, True, True, True, True], - [True, True, True, True, True, True, True, True], - ], - [ - [True, True, True, True, True, True, True, True], - [True, True, True, True, True, True, True, True], - ], - [ - [True, True, True, True, True, True, True, True], - [True, True, True, True, True, True, True, True], - ], + [[True, True, True, True, True, True, True, True], [True, True, True, True, True, True, True, True]], + [[True, True, True, True, True, True, True, True], [True, True, True, True, True, True, True, True]], + [[True, True, True, True, True, True, True, True], [True, True, True, True, True, True, True, True]], [[True, True, True, True, True, True, True, True]], ] # for niDigital_FetchHistoryRAMCyclePinData_check_pins_looping self.expected_pin_list_check_pins_looping = None - self.expected_pin_states_check_pins_looping = [ - [[nidigital.PinState.ZERO, nidigital.PinState.H]] - ] - self.actual_pin_states_check_pins_looping = [ - [[nidigital.PinState.L, nidigital.PinState.L]] - ] + self.expected_pin_states_check_pins_looping = [[[nidigital.PinState.ZERO, nidigital.PinState.H]]] + self.actual_pin_states_check_pins_looping = [[[nidigital.PinState.L, nidigital.PinState.L]]] self.per_pin_pass_fail_check_pins_looping = [[[True, False]]] # for niDigital_GetHistoryRAMSampleCount_check_site_looping @@ -333,79 +97,46 @@ def teardown_method(self, method): # this test should be converted to a system test. (GitHub issue# 1353). def test_fetch_history_ram_cycle_information_position_out_of_bound(self): - self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = ( - self.side_effects_helper.niDigital_GetHistoryRAMSampleCount - ) - self.side_effects_helper["GetHistoryRAMSampleCount"]["sampleCount"] = 7 - with nidigital.Session("") as session: - with pytest.raises( - ValueError, match="position: Specified value = 8, Maximum value = 6." - ): - session.sites[1].fetch_history_ram_cycle_information( - position=8, samples_to_read=-1 - ) + self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = self.side_effects_helper.niDigital_GetHistoryRAMSampleCount + self.side_effects_helper['GetHistoryRAMSampleCount']['sampleCount'] = 7 + with nidigital.Session('') as session: + with pytest.raises(ValueError, match='position: Specified value = 8, Maximum value = 6.'): + session.sites[1].fetch_history_ram_cycle_information(position=8, samples_to_read=-1) # TODO(sbethur): When nidigital driver provides better simulation support (internal bug# 992370), # this test should be converted to a system test. (GitHub issue# 1353). def test_fetch_history_ram_cycle_information_position_last(self): - self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = ( - self.side_effects_helper.niDigital_GetHistoryRAMSampleCount - ) - self.side_effects_helper["GetHistoryRAMSampleCount"]["sampleCount"] = 7 - self.patched_library.niDigital_GetAttributeViBoolean.side_effect = ( - self.side_effects_helper.niDigital_GetAttributeViBoolean - ) - self.side_effects_helper["GetAttributeViBoolean"][ - "value" - ] = True # history_ram_number_of_samples_is_finite - self.patched_library.niDigital_FetchHistoryRAMCycleInformation.side_effect = ( - self.side_effects_helper.niDigital_FetchHistoryRAMCycleInformation - ) - self.side_effects_helper["FetchHistoryRAMCycleInformation"]["patternIndex"] = 0 - self.side_effects_helper["FetchHistoryRAMCycleInformation"]["timeSetIndex"] = 0 - self.side_effects_helper["FetchHistoryRAMCycleInformation"]["vectorNumber"] = 9 - self.side_effects_helper["FetchHistoryRAMCycleInformation"]["cycleNumber"] = 11 - self.side_effects_helper["FetchHistoryRAMCycleInformation"]["numDutCycles"] = 1 - self.patched_library.niDigital_GetPatternName.side_effect = ( - self.side_effects_helper.niDigital_GetPatternName - ) - self.side_effects_helper["GetPatternName"]["name"] = "new_pattern" - self.patched_library.niDigital_GetTimeSetName.side_effect = ( - self.side_effects_helper.niDigital_GetTimeSetName - ) - self.side_effects_helper["GetTimeSetName"]["name"] = "t0" - self.patched_library.niDigital_FetchHistoryRAMScanCycleNumber.side_effect = ( - self.side_effects_helper.niDigital_FetchHistoryRAMScanCycleNumber - ) - self.side_effects_helper["FetchHistoryRAMScanCycleNumber"][ - "scanCycleNumber" - ] = -1 - self.patched_library.niDigital_FetchHistoryRAMCyclePinData.side_effect = ( - self.side_effects_helper.niDigital_FetchHistoryRAMCyclePinData - ) - self.side_effects_helper["FetchHistoryRAMCyclePinData"]["actualNumPinData"] = 8 - self.side_effects_helper["FetchHistoryRAMCyclePinData"]["expectedPinStates"] = [ - nidigital.PinState.X.value - ] * 8 - self.side_effects_helper["FetchHistoryRAMCyclePinData"]["actualPinStates"] = [ - nidigital.PinState.NOT_A_PIN_STATE.value - ] * 8 - self.side_effects_helper["FetchHistoryRAMCyclePinData"]["perPinPassFail"] = [ - True - ] * 8 - with nidigital.Session("") as session: - history_ram_cycle_info = session.sites[ - 1 - ].fetch_history_ram_cycle_information(position=6, samples_to_read=-1) + self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = self.side_effects_helper.niDigital_GetHistoryRAMSampleCount + self.side_effects_helper['GetHistoryRAMSampleCount']['sampleCount'] = 7 + self.patched_library.niDigital_GetAttributeViBoolean.side_effect = self.side_effects_helper.niDigital_GetAttributeViBoolean + self.side_effects_helper['GetAttributeViBoolean']['value'] = True # history_ram_number_of_samples_is_finite + self.patched_library.niDigital_FetchHistoryRAMCycleInformation.side_effect = self.side_effects_helper.niDigital_FetchHistoryRAMCycleInformation + self.side_effects_helper['FetchHistoryRAMCycleInformation']['patternIndex'] = 0 + self.side_effects_helper['FetchHistoryRAMCycleInformation']['timeSetIndex'] = 0 + self.side_effects_helper['FetchHistoryRAMCycleInformation']['vectorNumber'] = 9 + self.side_effects_helper['FetchHistoryRAMCycleInformation']['cycleNumber'] = 11 + self.side_effects_helper['FetchHistoryRAMCycleInformation']['numDutCycles'] = 1 + self.patched_library.niDigital_GetPatternName.side_effect = self.side_effects_helper.niDigital_GetPatternName + self.side_effects_helper['GetPatternName']['name'] = 'new_pattern' + self.patched_library.niDigital_GetTimeSetName.side_effect = self.side_effects_helper.niDigital_GetTimeSetName + self.side_effects_helper['GetTimeSetName']['name'] = 't0' + self.patched_library.niDigital_FetchHistoryRAMScanCycleNumber.side_effect = self.side_effects_helper.niDigital_FetchHistoryRAMScanCycleNumber + self.side_effects_helper['FetchHistoryRAMScanCycleNumber']['scanCycleNumber'] = -1 + self.patched_library.niDigital_FetchHistoryRAMCyclePinData.side_effect = self.side_effects_helper.niDigital_FetchHistoryRAMCyclePinData + self.side_effects_helper['FetchHistoryRAMCyclePinData']['actualNumPinData'] = 8 + self.side_effects_helper['FetchHistoryRAMCyclePinData']['expectedPinStates'] = [nidigital.PinState.X.value] * 8 + self.side_effects_helper['FetchHistoryRAMCyclePinData']['actualPinStates'] = [nidigital.PinState.NOT_A_PIN_STATE.value] * 8 + self.side_effects_helper['FetchHistoryRAMCyclePinData']['perPinPassFail'] = [True] * 8 + with nidigital.Session('') as session: + history_ram_cycle_info = session.sites[1].fetch_history_ram_cycle_information( + position=6, + samples_to_read=-1) self.patched_library.niDigital_FetchHistoryRAMCycleInformation.assert_called_once() assert self.patched_library.niDigital_GetPatternName.call_count == 2 assert self.patched_library.niDigital_GetTimeSetName.call_count == 2 self.patched_library.niDigital_FetchHistoryRAMScanCycleNumber.assert_called_once() - assert ( - self.patched_library.niDigital_FetchHistoryRAMCyclePinData.call_count - == 2 - ) + assert self.patched_library.niDigital_FetchHistoryRAMCyclePinData.call_count == 2 assert len(history_ram_cycle_info) == 1 assert history_ram_cycle_info[0].vector_number == 9 @@ -415,38 +146,21 @@ def test_fetch_history_ram_cycle_information_position_last(self): # this test should be converted to a system test. (GitHub issue# 1353). def test_fetch_history_ram_cycle_information_samples_to_read_too_much(self): - self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = ( - self.side_effects_helper.niDigital_GetHistoryRAMSampleCount - ) - self.side_effects_helper["GetHistoryRAMSampleCount"]["sampleCount"] = 7 - self.patched_library.niDigital_GetAttributeViBoolean.side_effect = ( - self.side_effects_helper.niDigital_GetAttributeViBoolean - ) - self.side_effects_helper["GetAttributeViBoolean"][ - "value" - ] = True # history_ram_number_of_samples_is_finite - - with nidigital.Session("") as session: + self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = self.side_effects_helper.niDigital_GetHistoryRAMSampleCount + self.side_effects_helper['GetHistoryRAMSampleCount']['sampleCount'] = 7 + self.patched_library.niDigital_GetAttributeViBoolean.side_effect = self.side_effects_helper.niDigital_GetAttributeViBoolean + self.side_effects_helper['GetAttributeViBoolean']['value'] = True # history_ram_number_of_samples_is_finite + + with nidigital.Session('') as session: assert session.sites[1].get_history_ram_sample_count() == 7 - expected_error_description = "position: Specified value = 3, samples_to_read: Specified value = 5; Samples available = 4." + expected_error_description = ( + 'position: Specified value = 3, samples_to_read: Specified value = 5; Samples available = 4.') with pytest.raises(ValueError, match=expected_error_description): - session.sites[1].fetch_history_ram_cycle_information( - position=3, samples_to_read=5 - ) + session.sites[1].fetch_history_ram_cycle_information(position=3, samples_to_read=5) # Helper function for mocking multiple calls - def niDigital_FetchHistoryRAMCycleInformation_looping( - self, - vi, - site, - sample_index, - pattern_index, - time_set_index, - vector_number, - cycle_number, - num_dut_cycles, - ): # noqa: N802 + def niDigital_FetchHistoryRAMCycleInformation_looping(self, vi, site, sample_index, pattern_index, time_set_index, vector_number, cycle_number, num_dut_cycles): # noqa: N802 sample_index_int = int(sample_index.value) pattern_index.contents.value = self.pattern_indices_looping[sample_index_int] time_set_index.contents.value = self.time_set_indices_looping[sample_index_int] @@ -456,125 +170,66 @@ def niDigital_FetchHistoryRAMCycleInformation_looping( return 0 # Helper function for mocking multiple calls - def niDigital_GetTimeSetName_looping( - self, vi, time_set_index, name_buffer_size, name - ): # noqa: N802 + def niDigital_GetTimeSetName_looping(self, vi, time_set_index, name_buffer_size, name): # noqa: N802 time_set_index_int = int(time_set_index.value) if int(name_buffer_size.value) == 0: - return len(self.time_set_name_looping[time_set_index_int]) - bytes_to_copy = self.time_set_name_looping[time_set_index_int].encode("ascii") + return (len(self.time_set_name_looping[time_set_index_int])) + bytes_to_copy = self.time_set_name_looping[time_set_index_int].encode('ascii') for i in range(0, len(bytes_to_copy)): name[i] = bytes_to_copy[i] return 0 # Helper function for mocking multiple calls - def niDigital_FetchHistoryRAMScanCycleNumber_looping( - self, vi, site, sample_index, scan_cycle_number - ): # noqa: N802 + def niDigital_FetchHistoryRAMScanCycleNumber_looping(self, vi, site, sample_index, scan_cycle_number): # noqa: N802 sample_index_int = int(sample_index.value) - scan_cycle_number.contents.value = self.scan_cycle_number_looping[ - sample_index_int - ] + scan_cycle_number.contents.value = self.scan_cycle_number_looping[sample_index_int] return 0 # Helper function for mocking multiple calls - def niDigital_FetchHistoryRAMCyclePinData_looping( - self, - vi, - site, - pin_list, - sample_index, - dut_cycle_index, - pin_data_buffer_size, - expected_pin_states, - actual_pin_states, - per_pin_pass_fail, - actual_num_pin_data, - ): # noqa: N802 + def niDigital_FetchHistoryRAMCyclePinData_looping(self, vi, site, pin_list, sample_index, dut_cycle_index, pin_data_buffer_size, expected_pin_states, actual_pin_states, per_pin_pass_fail, actual_num_pin_data): # noqa: N802 sample_index_int = int(sample_index.value) dut_cycle_index_int = int(dut_cycle_index.value) if int(pin_data_buffer_size.value) == 0: - actual_num_pin_data.contents.value = len( - self.expected_pin_states_looping[sample_index_int][dut_cycle_index_int] - ) + actual_num_pin_data.contents.value = len(self.expected_pin_states_looping[sample_index_int][dut_cycle_index_int]) return actual_num_pin_data.contents.value for i in range(0, int(pin_data_buffer_size.value)): - expected_pin_states[i] = self.expected_pin_states_looping[sample_index_int][ - dut_cycle_index_int - ][i].value - actual_pin_states[i] = self.actual_pin_states_looping[sample_index_int][ - dut_cycle_index_int - ][i].value - per_pin_pass_fail[i] = self.per_pin_pass_fail_looping[sample_index_int][ - dut_cycle_index_int - ][i] + expected_pin_states[i] = self.expected_pin_states_looping[sample_index_int][dut_cycle_index_int][i].value + actual_pin_states[i] = self.actual_pin_states_looping[sample_index_int][dut_cycle_index_int][i].value + per_pin_pass_fail[i] = self.per_pin_pass_fail_looping[sample_index_int][dut_cycle_index_int][i] return 0 # TODO(sbethur): When nidigital driver provides better simulation support (internal bug# 992370), # this test should be converted to a system test. (GitHub issue# 1353). def test_fetch_history_ram_cycle_information_samples_to_read_all(self): - self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = ( - self.side_effects_helper.niDigital_GetHistoryRAMSampleCount - ) - self.side_effects_helper["GetHistoryRAMSampleCount"]["sampleCount"] = 7 - self.patched_library.niDigital_GetAttributeViBoolean.side_effect = ( - self.side_effects_helper.niDigital_GetAttributeViBoolean - ) - self.side_effects_helper["GetAttributeViBoolean"][ - "value" - ] = True # history_ram_number_of_samples_is_finite - self.patched_library.niDigital_FetchHistoryRAMCycleInformation.side_effect = ( - self.niDigital_FetchHistoryRAMCycleInformation_looping - ) - self.patched_library.niDigital_GetPatternName.side_effect = ( - self.side_effects_helper.niDigital_GetPatternName - ) - self.side_effects_helper["GetPatternName"]["name"] = "new_pattern" - self.patched_library.niDigital_GetTimeSetName.side_effect = ( - self.niDigital_GetTimeSetName_looping - ) - self.patched_library.niDigital_FetchHistoryRAMScanCycleNumber.side_effect = ( - self.niDigital_FetchHistoryRAMScanCycleNumber_looping - ) - self.patched_library.niDigital_FetchHistoryRAMCyclePinData.side_effect = ( - self.niDigital_FetchHistoryRAMCyclePinData_looping - ) - self.patched_library.niDigital_GetPatternPinList.side_effect = ( - self.side_effects_helper.niDigital_GetPatternPinList - ) - pin_list = ["LO" + str(i) for i in range(4)] + ["HI" + str(i) for i in range(4)] - self.side_effects_helper["GetPatternPinList"]["pinList"] = ",".join(pin_list) - with nidigital.Session("") as session: - history_ram_cycle_info = session.sites[ - 1 - ].fetch_history_ram_cycle_information(position=0, samples_to_read=-1) - assert ( - self.patched_library.niDigital_FetchHistoryRAMCycleInformation.call_count - == 7 - ) - assert ( - self.patched_library.niDigital_GetPatternName.call_count == 2 - ) # there's only one pattern, so this is a 2 - assert ( - self.patched_library.niDigital_GetTimeSetName.call_count == 6 - ) # 3 time sets, so this is a 6 - assert ( - self.patched_library.niDigital_FetchHistoryRAMScanCycleNumber.call_count - == 7 - ) - assert ( - self.patched_library.niDigital_FetchHistoryRAMCyclePinData.call_count - == 20 - ) # 10 DUT cycles + self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = self.side_effects_helper.niDigital_GetHistoryRAMSampleCount + self.side_effects_helper['GetHistoryRAMSampleCount']['sampleCount'] = 7 + self.patched_library.niDigital_GetAttributeViBoolean.side_effect = self.side_effects_helper.niDigital_GetAttributeViBoolean + self.side_effects_helper['GetAttributeViBoolean']['value'] = True # history_ram_number_of_samples_is_finite + self.patched_library.niDigital_FetchHistoryRAMCycleInformation.side_effect = self.niDigital_FetchHistoryRAMCycleInformation_looping + self.patched_library.niDigital_GetPatternName.side_effect = self.side_effects_helper.niDigital_GetPatternName + self.side_effects_helper['GetPatternName']['name'] = 'new_pattern' + self.patched_library.niDigital_GetTimeSetName.side_effect = self.niDigital_GetTimeSetName_looping + self.patched_library.niDigital_FetchHistoryRAMScanCycleNumber.side_effect = self.niDigital_FetchHistoryRAMScanCycleNumber_looping + self.patched_library.niDigital_FetchHistoryRAMCyclePinData.side_effect = self.niDigital_FetchHistoryRAMCyclePinData_looping + self.patched_library.niDigital_GetPatternPinList.side_effect = self.side_effects_helper.niDigital_GetPatternPinList + pin_list = ['LO' + str(i) for i in range(4)] + ['HI' + str(i) for i in range(4)] + self.side_effects_helper['GetPatternPinList']['pinList'] = ','.join(pin_list) + with nidigital.Session('') as session: + history_ram_cycle_info = session.sites[1].fetch_history_ram_cycle_information( + position=0, + samples_to_read=-1) + assert self.patched_library.niDigital_FetchHistoryRAMCycleInformation.call_count == 7 + assert self.patched_library.niDigital_GetPatternName.call_count == 2 # there's only one pattern, so this is a 2 + assert self.patched_library.niDigital_GetTimeSetName.call_count == 6 # 3 time sets, so this is a 6 + assert self.patched_library.niDigital_FetchHistoryRAMScanCycleNumber.call_count == 7 + assert self.patched_library.niDigital_FetchHistoryRAMCyclePinData.call_count == 20 # 10 DUT cycles assert len(history_ram_cycle_info) == 7 - assert all( - [i.pattern_name == "new_pattern" for i in history_ram_cycle_info] - ) + assert all([i.pattern_name == 'new_pattern' for i in history_ram_cycle_info]) time_set_names = [i.time_set_name for i in history_ram_cycle_info] - assert time_set_names == ["t0", "tScan", "tScan", "t2X", "t2X", "t2X", "t0"] + assert time_set_names == ['t0', 'tScan', 'tScan', 't2X', 't2X', 't2X', 't0'] vector_numbers = [i.vector_number for i in history_ram_cycle_info] assert vector_numbers == [5, 6, 6, 7, 7, 8, 9] @@ -585,7 +240,7 @@ def test_fetch_history_ram_cycle_information_samples_to_read_all(self): scan_cycle_numbers = [i.scan_cycle_number for i in history_ram_cycle_info] assert scan_cycle_numbers == [-1, 0, 1, -1, -1, -1, -1] - pin_names = session.get_pattern_pin_names("new_pattern") + pin_names = session.get_pattern_pin_names('new_pattern') assert self.patched_library.niDigital_GetPatternPinList.call_count == 2 assert pin_names == pin_list @@ -596,15 +251,9 @@ def test_fetch_history_ram_cycle_information_samples_to_read_all(self): # So, need to skip those pin states while comparing. actual_pin_states = [i.actual_pin_states for i in history_ram_cycle_info] assert len(actual_pin_states) == len(self.actual_pin_states_looping) - for vector_pin_states, vector_pin_states_expected_by_test in zip( - actual_pin_states, self.actual_pin_states_looping - ): - for cycle_pin_states, cycle_pin_states_expected_by_test in zip( - vector_pin_states, vector_pin_states_expected_by_test - ): - for pin_state, pin_state_expected_by_test in zip( - cycle_pin_states, cycle_pin_states_expected_by_test - ): + for vector_pin_states, vector_pin_states_expected_by_test in zip(actual_pin_states, self.actual_pin_states_looping): + for cycle_pin_states, cycle_pin_states_expected_by_test in zip(vector_pin_states, vector_pin_states_expected_by_test): + for pin_state, pin_state_expected_by_test in zip(cycle_pin_states, cycle_pin_states_expected_by_test): if pin_state_expected_by_test is not nidigital.PinState.X: assert pin_state == pin_state_expected_by_test @@ -613,143 +262,79 @@ def test_fetch_history_ram_cycle_information_samples_to_read_all(self): assert per_pin_pass_fail == self.per_pin_pass_fail_looping # Helper function for validating pin list behavior in fetch_history_ram_cycle_information. - def niDigital_FetchHistoryRAMCyclePinData_check_pins_looping( - self, - vi, - site, - pin_list, - sample_index, - dut_cycle_index, - pin_data_buffer_size, - expected_pin_states, - actual_pin_states, - per_pin_pass_fail, - actual_num_pin_data, - ): # noqa: N802 + def niDigital_FetchHistoryRAMCyclePinData_check_pins_looping(self, vi, site, pin_list, sample_index, dut_cycle_index, pin_data_buffer_size, expected_pin_states, actual_pin_states, per_pin_pass_fail, actual_num_pin_data): # noqa: N802 sample_index_int = int(sample_index.value) dut_cycle_index_int = int(dut_cycle_index.value) if int(pin_data_buffer_size.value) == 0: - actual_num_pin_data.contents.value = len( - self.expected_pin_states_check_pins_looping[sample_index_int][ - dut_cycle_index_int - ] - ) + actual_num_pin_data.contents.value = len(self.expected_pin_states_check_pins_looping[sample_index_int][dut_cycle_index_int]) return actual_num_pin_data.contents.value for i in range(0, int(pin_data_buffer_size.value)): - expected_pin_states[i] = self.expected_pin_states_check_pins_looping[ - sample_index_int - ][dut_cycle_index_int][i].value - actual_pin_states[i] = self.actual_pin_states_check_pins_looping[ - sample_index_int - ][dut_cycle_index_int][i].value - per_pin_pass_fail[i] = self.per_pin_pass_fail_check_pins_looping[ - sample_index_int - ][dut_cycle_index_int][i] + expected_pin_states[i] = self.expected_pin_states_check_pins_looping[sample_index_int][dut_cycle_index_int][i].value + actual_pin_states[i] = self.actual_pin_states_check_pins_looping[sample_index_int][dut_cycle_index_int][i].value + per_pin_pass_fail[i] = self.per_pin_pass_fail_check_pins_looping[sample_index_int][dut_cycle_index_int][i] assert self.expected_pin_list_check_pins_looping is not None - assert ( - pin_list.value.decode("ascii") == self.expected_pin_list_check_pins_looping - ) + assert pin_list.value.decode('ascii') == self.expected_pin_list_check_pins_looping return 0 def test_fetch_history_ram_cycle_information_pin_list(self): - self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = ( - self.side_effects_helper.niDigital_GetHistoryRAMSampleCount - ) - self.side_effects_helper["GetHistoryRAMSampleCount"]["sampleCount"] = 1 - self.patched_library.niDigital_GetAttributeViBoolean.side_effect = ( - self.side_effects_helper.niDigital_GetAttributeViBoolean - ) - self.side_effects_helper["GetAttributeViBoolean"][ - "value" - ] = True # history_ram_number_of_samples_is_finite - self.patched_library.niDigital_FetchHistoryRAMCycleInformation.side_effect = ( - self.side_effects_helper.niDigital_FetchHistoryRAMCycleInformation - ) - self.side_effects_helper["FetchHistoryRAMCycleInformation"]["patternIndex"] = 0 - self.side_effects_helper["FetchHistoryRAMCycleInformation"]["timeSetIndex"] = 0 - self.side_effects_helper["FetchHistoryRAMCycleInformation"]["vectorNumber"] = 0 - self.side_effects_helper["FetchHistoryRAMCycleInformation"]["cycleNumber"] = 0 - self.side_effects_helper["FetchHistoryRAMCycleInformation"]["numDutCycles"] = 1 - self.patched_library.niDigital_GetPatternName.side_effect = ( - self.side_effects_helper.niDigital_GetPatternName - ) - self.side_effects_helper["GetPatternName"]["name"] = "new_pattern" - self.patched_library.niDigital_GetTimeSetName.side_effect = ( - self.side_effects_helper.niDigital_GetTimeSetName - ) - self.side_effects_helper["GetTimeSetName"]["name"] = "t0" - self.patched_library.niDigital_FetchHistoryRAMScanCycleNumber.side_effect = ( - self.side_effects_helper.niDigital_FetchHistoryRAMScanCycleNumber - ) - self.side_effects_helper["FetchHistoryRAMScanCycleNumber"][ - "scanCycleNumber" - ] = -1 - self.patched_library.niDigital_FetchHistoryRAMCyclePinData.side_effect = ( - self.niDigital_FetchHistoryRAMCyclePinData_check_pins_looping - ) - with nidigital.Session("") as session: - self.expected_pin_list_check_pins_looping = "PinA,PinB" - session.sites[0].pins["PinA", "PinB"].fetch_history_ram_cycle_information( - position=0, samples_to_read=-1 - ) - self.expected_pin_list_check_pins_looping = "" - session.sites[0].fetch_history_ram_cycle_information( - position=0, samples_to_read=-1 - ) - assert ( - self.patched_library.niDigital_FetchHistoryRAMCyclePinData.call_count - == 4 - ) + self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = self.side_effects_helper.niDigital_GetHistoryRAMSampleCount + self.side_effects_helper['GetHistoryRAMSampleCount']['sampleCount'] = 1 + self.patched_library.niDigital_GetAttributeViBoolean.side_effect = self.side_effects_helper.niDigital_GetAttributeViBoolean + self.side_effects_helper['GetAttributeViBoolean']['value'] = True # history_ram_number_of_samples_is_finite + self.patched_library.niDigital_FetchHistoryRAMCycleInformation.side_effect = self.side_effects_helper.niDigital_FetchHistoryRAMCycleInformation + self.side_effects_helper['FetchHistoryRAMCycleInformation']['patternIndex'] = 0 + self.side_effects_helper['FetchHistoryRAMCycleInformation']['timeSetIndex'] = 0 + self.side_effects_helper['FetchHistoryRAMCycleInformation']['vectorNumber'] = 0 + self.side_effects_helper['FetchHistoryRAMCycleInformation']['cycleNumber'] = 0 + self.side_effects_helper['FetchHistoryRAMCycleInformation']['numDutCycles'] = 1 + self.patched_library.niDigital_GetPatternName.side_effect = self.side_effects_helper.niDigital_GetPatternName + self.side_effects_helper['GetPatternName']['name'] = 'new_pattern' + self.patched_library.niDigital_GetTimeSetName.side_effect = self.side_effects_helper.niDigital_GetTimeSetName + self.side_effects_helper['GetTimeSetName']['name'] = 't0' + self.patched_library.niDigital_FetchHistoryRAMScanCycleNumber.side_effect = self.side_effects_helper.niDigital_FetchHistoryRAMScanCycleNumber + self.side_effects_helper['FetchHistoryRAMScanCycleNumber']['scanCycleNumber'] = -1 + self.patched_library.niDigital_FetchHistoryRAMCyclePinData.side_effect = self.niDigital_FetchHistoryRAMCyclePinData_check_pins_looping + with nidigital.Session('') as session: + self.expected_pin_list_check_pins_looping = 'PinA,PinB' + session.sites[0].pins['PinA', 'PinB'].fetch_history_ram_cycle_information(position=0, samples_to_read=-1) + self.expected_pin_list_check_pins_looping = '' + session.sites[0].fetch_history_ram_cycle_information(position=0, samples_to_read=-1) + assert self.patched_library.niDigital_FetchHistoryRAMCyclePinData.call_count == 4 # Helper function for validating site behavior in fetch_history_ram_cycle_information. - def niDigital_GetHistoryRAMSampleCount_check_site_looping( - self, vi, site, sample_count - ): # noqa: N802 - assert site.value.decode("ascii") == "site{}".format( - self.site_numbers_looping[self.iteration_check_site_looping] - ) - sample_count.contents.value = ( - 0 # we don't care if this is right as long as the fetch does not error - ) + def niDigital_GetHistoryRAMSampleCount_check_site_looping(self, vi, site, sample_count): # noqa: N802 + assert site.value.decode('ascii') == 'site{}'.format(self.site_numbers_looping[self.iteration_check_site_looping]) + sample_count.contents.value = 0 # we don't care if this is right as long as the fetch does not error self.iteration_check_site_looping += 1 return 0 def test_fetch_history_ram_cycle_information_site_n(self): - self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = ( - self.niDigital_GetHistoryRAMSampleCount_check_site_looping - ) - self.side_effects_helper["GetHistoryRAMSampleCount"]["sampleCount"] = 1 + self.patched_library.niDigital_GetHistoryRAMSampleCount.side_effect = self.niDigital_GetHistoryRAMSampleCount_check_site_looping + self.side_effects_helper['GetHistoryRAMSampleCount']['sampleCount'] = 1 - with nidigital.Session("") as session: + with nidigital.Session('') as session: for s in self.site_numbers_looping: - session.sites[s].fetch_history_ram_cycle_information( - position=0, samples_to_read=0 - ) - assert ( - self.patched_library.niDigital_GetHistoryRAMSampleCount.call_count - == len(self.site_numbers_looping) - ) + session.sites[s].fetch_history_ram_cycle_information(position=0, samples_to_read=0) + assert self.patched_library.niDigital_GetHistoryRAMSampleCount.call_count == len(self.site_numbers_looping) def test_pin_state_enum_print(self): - assert str(nidigital.PinState.ZERO) == "0" - assert str(nidigital.PinState.ONE) == "1" - assert str(nidigital.PinState.NOT_A_PIN_STATE) == "Not a Pin State" - assert ( - str(nidigital.PinState.PIN_STATE_NOT_ACQUIRED) == "Pin State Not Acquired" - ) - assert str(nidigital.PinState.L) == "L" - assert str(nidigital.PinState.H) == "H" - assert str(nidigital.PinState.X) == "X" - assert str(nidigital.PinState.M) == "M" - assert str(nidigital.PinState.V) == "V" - assert str(nidigital.PinState.D) == "D" - assert str(nidigital.PinState.E) == "E" + assert str(nidigital.PinState.ZERO) == '0' + assert str(nidigital.PinState.ONE) == '1' + assert str(nidigital.PinState.NOT_A_PIN_STATE) == 'Not a Pin State' + assert str(nidigital.PinState.PIN_STATE_NOT_ACQUIRED) == 'Pin State Not Acquired' + assert str(nidigital.PinState.L) == 'L' + assert str(nidigital.PinState.H) == 'H' + assert str(nidigital.PinState.X) == 'X' + assert str(nidigital.PinState.M) == 'M' + assert str(nidigital.PinState.V) == 'V' + assert str(nidigital.PinState.D) == 'D' + assert str(nidigital.PinState.E) == 'E' def test_write_static_pin_state_enum_print(self): - assert str(nidigital.WriteStaticPinState.ZERO) == "0" - assert str(nidigital.WriteStaticPinState.ONE) == "1" - assert str(nidigital.WriteStaticPinState.X) == "X" + assert str(nidigital.WriteStaticPinState.ZERO) == '0' + assert str(nidigital.WriteStaticPinState.ONE) == '1' + assert str(nidigital.WriteStaticPinState.X) == 'X' diff --git a/generated/nidigital/setup.py b/generated/nidigital/setup.py index 4094715b1..d26953bee 100644 --- a/generated/nidigital/setup.py +++ b/generated/nidigital/setup.py @@ -15,45 +15,42 @@ def finalize_options(self): def run_tests(self): import pytest - pytest.main(self.test_args) -pypi_name = "nidigital" +pypi_name = 'nidigital' def read_contents(file_to_read): - with open(file_to_read, "r") as f: + with open(file_to_read, 'r') as f: return f.read() setup( name=pypi_name, zip_safe=True, - version="1.4.2.dev0", - description="NI-Digital Pattern Driver Python API", - long_description=read_contents("README.rst"), - long_description_content_type="text/x-rst", - author="NI", + version='1.4.2.dev0', + description='NI-Digital Pattern Driver Python API', + long_description=read_contents('README.rst'), + long_description_content_type='text/x-rst', + author='NI', author_email="opensource@ni.com", url="https://github.com/ni/nimi-python", maintainer="NI", maintainer_email="opensource@ni.com", - keywords=["nidigital"], - license="MIT", + keywords=['nidigital'], + license='MIT', include_package_data=True, - packages=["nidigital"], + packages=['nidigital'], install_requires=[ 'enum34;python_version<"3.4"', 'singledispatch;python_version<"3.4"', - "hightime>=0.2.0", - "nitclk", - ], - setup_requires=[ - "pytest-runner", + 'hightime>=0.2.0', + 'nitclk', ], - tests_require=["pytest"], - test_suite="tests", + setup_requires=['pytest-runner', ], + tests_require=['pytest'], + test_suite='tests', classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -68,8 +65,8 @@ def read_contents(file_to_read): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", - "Topic :: System :: Hardware :: Hardware Drivers", + "Topic :: System :: Hardware :: Hardware Drivers" ], - cmdclass={"test": PyTest}, - package_data={pypi_name: ["VERSION"]}, + cmdclass={'test': PyTest}, + package_data={pypi_name: ['VERSION']}, ) diff --git a/generated/nidmm/nidmm/__init__.py b/generated/nidmm/nidmm/__init__.py index 33492769b..6df35e03c 100644 --- a/generated/nidmm/nidmm/__init__.py +++ b/generated/nidmm/nidmm/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = "1.4.2.dev0" +__version__ = '1.4.2.dev0' from nidmm.enums import * # noqa: F403,F401,H303 from nidmm.errors import DriverWarning # noqa: F401 @@ -11,12 +11,12 @@ def get_diagnostic_information(): - """Get diagnostic information about the system state that is suitable for printing or logging + '''Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - """ + ''' import os import pkg_resources import platform @@ -24,80 +24,73 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return struct.calcsize("P") == 8 + return (struct.calcsize("P") == 8) def is_os_64bit(): - return platform.machine().endswith("64") + return platform.machine().endswith('64') def is_venv(): - return "VIRTUAL_ENV" in os.environ + return 'VIRTUAL_ENV' in os.environ info = {} - info["os"] = {} - info["python"] = {} - info["driver"] = {} - info["module"] = {} - if platform.system() == "Windows": + info['os'] = {} + info['python'] = {} + info['driver'] = {} + info['module'] = {} + if platform.system() == 'Windows': try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = "Windows" + os_name = 'Windows' try: - driver_version_key = winreg.OpenKey( - winreg.HKEY_LOCAL_MACHINE, - r"SOFTWARE\National Instruments\NI-DMM\CurrentVersion", - ) + driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-DMM\CurrentVersion") driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = "Unknown" - elif platform.system() == "Linux": - os_name = "Linux" - driver_version = "Unknown" + driver_version = 'Unknown' + elif platform.system() == 'Linux': + os_name = 'Linux' + driver_version = 'Unknown' else: - raise SystemError("Unsupported platform: {}".format(platform.system())) + raise SystemError('Unsupported platform: {}'.format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [ - { - "name": i.key, - "version": i.version, - } - for i in installed_packages - ] - - info["os"]["name"] = os_name - info["os"]["version"] = platform.version() - info["os"]["bits"] = "64" if is_os_64bit() else "32" - info["driver"]["name"] = "NI-DMM" - info["driver"]["version"] = driver_version - info["module"]["name"] = "nidmm" - info["module"]["version"] = "1.4.2.dev0" - info["python"]["version"] = sys.version - info["python"]["bits"] = "64" if is_python_64bit() else "32" - info["python"]["is_venv"] = is_venv() - info["python"]["packages"] = installed_packages_list + installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] + + info['os']['name'] = os_name + info['os']['version'] = platform.version() + info['os']['bits'] = '64' if is_os_64bit() else '32' + info['driver']['name'] = "NI-DMM" + info['driver']['version'] = driver_version + info['module']['name'] = 'nidmm' + info['module']['version'] = "1.4.2.dev0" + info['python']['version'] = sys.version + info['python']['bits'] = '64' if is_python_64bit() else '32' + info['python']['is_venv'] = is_venv() + info['python']['packages'] = installed_packages_list return info def print_diagnostic_information(): - """Print diagnostic information in a format suitable for issue report + '''Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - """ + ''' info = get_diagnostic_information() - row_format = " {:<10} {}" - for type in ["OS", "Driver", "Module", "Python"]: + row_format = ' {:<10} {}' + for type in ['OS', 'Driver', 'Module', 'Python']: typename = type.lower() - print(type + ":") + print(type + ':') for item in info[typename]: - if item != "packages": - print(row_format.format(item.title() + ":", info[typename][item])) - print(" Installed Packages:") - for p in info["python"]["packages"]: - print((" " * 8) + p["name"] + "==" + p["version"]) + if item != 'packages': + print(row_format.format(item.title() + ':', info[typename][item])) + print(' Installed Packages:') + for p in info['python']['packages']: + print((' ' * 8) + p['name'] + '==' + p['version']) return info + + diff --git a/generated/nidmm/nidmm/_attributes.py b/generated/nidmm/nidmm/_attributes.py index c282889a3..c4df48ab4 100644 --- a/generated/nidmm/nidmm/_attributes.py +++ b/generated/nidmm/nidmm/_attributes.py @@ -6,13 +6,14 @@ class Attribute(object): - """Base class for all typed attributes.""" + '''Base class for all typed attributes.''' def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -21,19 +22,16 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): + def __get__(self, session, session_type): - return hightime.timedelta( - milliseconds=session._get_attribute_vi_int32(self._attribute_id) - ) + return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_int32( - self._attribute_id, - _converters.convert_timedelta_to_milliseconds_int32(value).value, - ) + session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) class AttributeViInt64(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -42,6 +40,7 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -50,19 +49,16 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): + def __get__(self, session, session_type): - return hightime.timedelta( - seconds=session._get_attribute_vi_real64(self._attribute_id) - ) + return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_real64( - self._attribute_id, - _converters.convert_timedelta_to_seconds_real64(value).value, - ) + session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) class AttributeViString(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -71,17 +67,16 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string( - self._attribute_id, - _converters.convert_repeated_capabilities_without_prefix(value), - ) + session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) class AttributeViBoolean(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -90,36 +85,31 @@ def __set__(self, session, value): class AttributeEnum(object): + def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type( - self._underlying_attribute.__get__(session, session_type) - ) + return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError( - "must be " - + str(self._attribute_type.__name__) - + " not " - + str(type(value).__name__) - ) + raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): + def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from nidmm.session import SessionReference - return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session( - self._attribute_id, _converters.convert_to_nitclk_session_number(value) - ) + session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) + + + diff --git a/generated/nidmm/nidmm/_converters.py b/generated/nidmm/nidmm/_converters.py index a9c4436af..5248b0b4b 100644 --- a/generated/nidmm/nidmm/_converters.py +++ b/generated/nidmm/nidmm/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - """Base version that should not be called + '''Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,38 +40,36 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - """ - raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) + ''' + raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - """Integer version""" + '''Integer version''' return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - """String version (this is the most complex) + '''String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - """ + ''' # First we deal with a list - rep_cap_list = repeated_capability.split(",") + rep_cap_list = repeated_capability.split(',') if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, "").replace(":", "-") - rc = r.split("-") + r = repeated_capability.strip().replace(prefix, '').replace(':', '-') + rc = r.split('-') if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError( - "Multiple '-' or ':'", repeated_capability - ) + raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) try: start = int(rc[0]) end = int(rc[1]) @@ -87,7 +85,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, "").strip()] + return [repeated_capability.replace(prefix, '').strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -96,7 +94,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - """Iterable version - can handle lists, ranges, and tuples""" + '''Iterable version - can handle lists, ranges, and tuples''' rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -105,22 +103,16 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - """slice version""" - + '''slice version''' def ifnone(a, b): return b if a is None else a - # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range( - ifnone(repeated_capability.start, 0), - repeated_capability.stop, - ifnone(repeated_capability.step, 1), - ) + rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=""): - """Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=''): + '''Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -128,17 +120,15 @@ def convert_repeated_capabilities(repeated_capability, prefix=""): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - """ + ''' # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [ - prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) - ] + return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] def convert_repeated_capabilities_without_prefix(repeated_capability): - """Convert a repeated capabilities object, without any prefix, to a comma delimited list + '''Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -154,8 +144,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - """ - return ",".join(convert_repeated_capabilities(repeated_capability, "")) + ''' + return ','.join(convert_repeated_capabilities(repeated_capability, '')) def _convert_timedelta(value, library_type, scaling): @@ -168,14 +158,7 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [ - _visatype.ViInt64, - _visatype.ViInt32, - _visatype.ViUInt32, - _visatype.ViInt16, - _visatype.ViUInt16, - _visatype.ViInt8, - ]: + if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -212,36 +195,34 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - "rangecheck": "RangeCheck", - "queryinstrstatus": "QueryInstrStatus", - "cache": "Cache", - "simulate": "Simulate", - "recordcoercions": "RecordCoercions", - "interchangecheck": "InterchangeCheck", - "driversetup": "DriverSetup", - "range_check": "RangeCheck", - "query_instr_status": "QueryInstrStatus", - "record_coercions": "RecordCoercions", - "interchange_check": "InterchangeCheck", - "driver_setup": "DriverSetup", + 'rangecheck': 'RangeCheck', + 'queryinstrstatus': 'QueryInstrStatus', + 'cache': 'Cache', + 'simulate': 'Simulate', + 'recordcoercions': 'RecordCoercions', + 'interchangecheck': 'InterchangeCheck', + 'driversetup': 'DriverSetup', + 'range_check': 'RangeCheck', + 'query_instr_status': 'QueryInstrStatus', + 'record_coercions': 'RecordCoercions', + 'interchange_check': 'InterchangeCheck', + 'driver_setup': 'DriverSetup', } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": - value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") - elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": + if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': + value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') + elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': if not isinstance(values[k], dict): - raise TypeError("DriverSetup must be a dictionary") - value = "DriverSetup=" + ( - ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) - ) + raise TypeError('DriverSetup must be a dictionary') + value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) else: - value = k + ("=1" if values[k] is True else "=0") + value = k + ('=1' if values[k] is True else '=0') init_with_options.append(value) - init_with_options_string = ",".join(init_with_options) + init_with_options_string = ','.join(init_with_options) return init_with_options_string @@ -270,11 +251,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(",")] + return [x.strip() for x in comma_separated_string.split(',')] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -286,17 +267,11 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - """ - chained_repeated_capability_items = convert_comma_separated_string_to_list( - chained_repeated_capability - ) - repeated_capability_lists = [ - [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) - ] + ''' + chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) + repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] for item in chained_repeated_capability_items: - repeated_capability_lists = [ - x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) - ] - return [ - ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists - ] + repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] + return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] + + diff --git a/generated/nidmm/nidmm/_library.py b/generated/nidmm/nidmm/_library.py index c8c81ea39..f340b4096 100644 --- a/generated/nidmm/nidmm/_library.py +++ b/generated/nidmm/nidmm/_library.py @@ -9,11 +9,11 @@ class Library(object): - """Library + '''Library Wrapper around driver library. Class will setup the correct ctypes information for every function on first call. - """ + ''' def __init__(self, ctypes_library): self._func_lock = threading.Lock() @@ -79,503 +79,239 @@ def _get_library_function(self, name): def niDMM_Abort(self, vi): # noqa: N802 with self._func_lock: if self.niDMM_Abort_cfunc is None: - self.niDMM_Abort_cfunc = self._get_library_function("niDMM_Abort") + self.niDMM_Abort_cfunc = self._get_library_function('niDMM_Abort') self.niDMM_Abort_cfunc.argtypes = [ViSession] # noqa: F405 self.niDMM_Abort_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_Abort_cfunc(vi) - def niDMM_ConfigureMeasurementAbsolute( - self, vi, measurement_function, range, resolution_absolute - ): # noqa: N802 + def niDMM_ConfigureMeasurementAbsolute(self, vi, measurement_function, range, resolution_absolute): # noqa: N802 with self._func_lock: if self.niDMM_ConfigureMeasurementAbsolute_cfunc is None: - self.niDMM_ConfigureMeasurementAbsolute_cfunc = ( - self._get_library_function("niDMM_ConfigureMeasurementAbsolute") - ) - self.niDMM_ConfigureMeasurementAbsolute_cfunc.argtypes = [ - ViSession, - ViInt32, - ViReal64, - ViReal64, - ] # noqa: F405 - self.niDMM_ConfigureMeasurementAbsolute_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDMM_ConfigureMeasurementAbsolute_cfunc( - vi, measurement_function, range, resolution_absolute - ) - - def niDMM_ConfigureMeasurementDigits( - self, vi, measurement_function, range, resolution_digits - ): # noqa: N802 + self.niDMM_ConfigureMeasurementAbsolute_cfunc = self._get_library_function('niDMM_ConfigureMeasurementAbsolute') + self.niDMM_ConfigureMeasurementAbsolute_cfunc.argtypes = [ViSession, ViInt32, ViReal64, ViReal64] # noqa: F405 + self.niDMM_ConfigureMeasurementAbsolute_cfunc.restype = ViStatus # noqa: F405 + return self.niDMM_ConfigureMeasurementAbsolute_cfunc(vi, measurement_function, range, resolution_absolute) + + def niDMM_ConfigureMeasurementDigits(self, vi, measurement_function, range, resolution_digits): # noqa: N802 with self._func_lock: if self.niDMM_ConfigureMeasurementDigits_cfunc is None: - self.niDMM_ConfigureMeasurementDigits_cfunc = ( - self._get_library_function("niDMM_ConfigureMeasurementDigits") - ) - self.niDMM_ConfigureMeasurementDigits_cfunc.argtypes = [ - ViSession, - ViInt32, - ViReal64, - ViReal64, - ] # noqa: F405 - self.niDMM_ConfigureMeasurementDigits_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDMM_ConfigureMeasurementDigits_cfunc( - vi, measurement_function, range, resolution_digits - ) - - def niDMM_ConfigureMultiPoint( - self, vi, trigger_count, sample_count, sample_trigger, sample_interval - ): # noqa: N802 + self.niDMM_ConfigureMeasurementDigits_cfunc = self._get_library_function('niDMM_ConfigureMeasurementDigits') + self.niDMM_ConfigureMeasurementDigits_cfunc.argtypes = [ViSession, ViInt32, ViReal64, ViReal64] # noqa: F405 + self.niDMM_ConfigureMeasurementDigits_cfunc.restype = ViStatus # noqa: F405 + return self.niDMM_ConfigureMeasurementDigits_cfunc(vi, measurement_function, range, resolution_digits) + + def niDMM_ConfigureMultiPoint(self, vi, trigger_count, sample_count, sample_trigger, sample_interval): # noqa: N802 with self._func_lock: if self.niDMM_ConfigureMultiPoint_cfunc is None: - self.niDMM_ConfigureMultiPoint_cfunc = self._get_library_function( - "niDMM_ConfigureMultiPoint" - ) - self.niDMM_ConfigureMultiPoint_cfunc.argtypes = [ - ViSession, - ViInt32, - ViInt32, - ViInt32, - ViReal64, - ] # noqa: F405 + self.niDMM_ConfigureMultiPoint_cfunc = self._get_library_function('niDMM_ConfigureMultiPoint') + self.niDMM_ConfigureMultiPoint_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ViInt32, ViReal64] # noqa: F405 self.niDMM_ConfigureMultiPoint_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_ConfigureMultiPoint_cfunc( - vi, trigger_count, sample_count, sample_trigger, sample_interval - ) + return self.niDMM_ConfigureMultiPoint_cfunc(vi, trigger_count, sample_count, sample_trigger, sample_interval) def niDMM_ConfigureRTDCustom(self, vi, rtd_a, rtd_b, rtd_c): # noqa: N802 with self._func_lock: if self.niDMM_ConfigureRTDCustom_cfunc is None: - self.niDMM_ConfigureRTDCustom_cfunc = self._get_library_function( - "niDMM_ConfigureRTDCustom" - ) - self.niDMM_ConfigureRTDCustom_cfunc.argtypes = [ - ViSession, - ViReal64, - ViReal64, - ViReal64, - ] # noqa: F405 + self.niDMM_ConfigureRTDCustom_cfunc = self._get_library_function('niDMM_ConfigureRTDCustom') + self.niDMM_ConfigureRTDCustom_cfunc.argtypes = [ViSession, ViReal64, ViReal64, ViReal64] # noqa: F405 self.niDMM_ConfigureRTDCustom_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_ConfigureRTDCustom_cfunc(vi, rtd_a, rtd_b, rtd_c) def niDMM_ConfigureRTDType(self, vi, rtd_type, rtd_resistance): # noqa: N802 with self._func_lock: if self.niDMM_ConfigureRTDType_cfunc is None: - self.niDMM_ConfigureRTDType_cfunc = self._get_library_function( - "niDMM_ConfigureRTDType" - ) - self.niDMM_ConfigureRTDType_cfunc.argtypes = [ - ViSession, - ViInt32, - ViReal64, - ] # noqa: F405 + self.niDMM_ConfigureRTDType_cfunc = self._get_library_function('niDMM_ConfigureRTDType') + self.niDMM_ConfigureRTDType_cfunc.argtypes = [ViSession, ViInt32, ViReal64] # noqa: F405 self.niDMM_ConfigureRTDType_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_ConfigureRTDType_cfunc(vi, rtd_type, rtd_resistance) - def niDMM_ConfigureThermistorCustom( - self, vi, thermistor_a, thermistor_b, thermistor_c - ): # noqa: N802 + def niDMM_ConfigureThermistorCustom(self, vi, thermistor_a, thermistor_b, thermistor_c): # noqa: N802 with self._func_lock: if self.niDMM_ConfigureThermistorCustom_cfunc is None: - self.niDMM_ConfigureThermistorCustom_cfunc = self._get_library_function( - "niDMM_ConfigureThermistorCustom" - ) - self.niDMM_ConfigureThermistorCustom_cfunc.argtypes = [ - ViSession, - ViReal64, - ViReal64, - ViReal64, - ] # noqa: F405 - self.niDMM_ConfigureThermistorCustom_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDMM_ConfigureThermistorCustom_cfunc( - vi, thermistor_a, thermistor_b, thermistor_c - ) - - def niDMM_ConfigureThermocouple( - self, vi, thermocouple_type, reference_junction_type - ): # noqa: N802 + self.niDMM_ConfigureThermistorCustom_cfunc = self._get_library_function('niDMM_ConfigureThermistorCustom') + self.niDMM_ConfigureThermistorCustom_cfunc.argtypes = [ViSession, ViReal64, ViReal64, ViReal64] # noqa: F405 + self.niDMM_ConfigureThermistorCustom_cfunc.restype = ViStatus # noqa: F405 + return self.niDMM_ConfigureThermistorCustom_cfunc(vi, thermistor_a, thermistor_b, thermistor_c) + + def niDMM_ConfigureThermocouple(self, vi, thermocouple_type, reference_junction_type): # noqa: N802 with self._func_lock: if self.niDMM_ConfigureThermocouple_cfunc is None: - self.niDMM_ConfigureThermocouple_cfunc = self._get_library_function( - "niDMM_ConfigureThermocouple" - ) - self.niDMM_ConfigureThermocouple_cfunc.argtypes = [ - ViSession, - ViInt32, - ViInt32, - ] # noqa: F405 + self.niDMM_ConfigureThermocouple_cfunc = self._get_library_function('niDMM_ConfigureThermocouple') + self.niDMM_ConfigureThermocouple_cfunc.argtypes = [ViSession, ViInt32, ViInt32] # noqa: F405 self.niDMM_ConfigureThermocouple_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_ConfigureThermocouple_cfunc( - vi, thermocouple_type, reference_junction_type - ) + return self.niDMM_ConfigureThermocouple_cfunc(vi, thermocouple_type, reference_junction_type) def niDMM_ConfigureTrigger(self, vi, trigger_source, trigger_delay): # noqa: N802 with self._func_lock: if self.niDMM_ConfigureTrigger_cfunc is None: - self.niDMM_ConfigureTrigger_cfunc = self._get_library_function( - "niDMM_ConfigureTrigger" - ) - self.niDMM_ConfigureTrigger_cfunc.argtypes = [ - ViSession, - ViInt32, - ViReal64, - ] # noqa: F405 + self.niDMM_ConfigureTrigger_cfunc = self._get_library_function('niDMM_ConfigureTrigger') + self.niDMM_ConfigureTrigger_cfunc.argtypes = [ViSession, ViInt32, ViReal64] # noqa: F405 self.niDMM_ConfigureTrigger_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_ConfigureTrigger_cfunc(vi, trigger_source, trigger_delay) - def niDMM_ConfigureWaveformAcquisition( - self, vi, measurement_function, range, rate, waveform_points - ): # noqa: N802 + def niDMM_ConfigureWaveformAcquisition(self, vi, measurement_function, range, rate, waveform_points): # noqa: N802 with self._func_lock: if self.niDMM_ConfigureWaveformAcquisition_cfunc is None: - self.niDMM_ConfigureWaveformAcquisition_cfunc = ( - self._get_library_function("niDMM_ConfigureWaveformAcquisition") - ) - self.niDMM_ConfigureWaveformAcquisition_cfunc.argtypes = [ - ViSession, - ViInt32, - ViReal64, - ViReal64, - ViInt32, - ] # noqa: F405 - self.niDMM_ConfigureWaveformAcquisition_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDMM_ConfigureWaveformAcquisition_cfunc( - vi, measurement_function, range, rate, waveform_points - ) + self.niDMM_ConfigureWaveformAcquisition_cfunc = self._get_library_function('niDMM_ConfigureWaveformAcquisition') + self.niDMM_ConfigureWaveformAcquisition_cfunc.argtypes = [ViSession, ViInt32, ViReal64, ViReal64, ViInt32] # noqa: F405 + self.niDMM_ConfigureWaveformAcquisition_cfunc.restype = ViStatus # noqa: F405 + return self.niDMM_ConfigureWaveformAcquisition_cfunc(vi, measurement_function, range, rate, waveform_points) def niDMM_Disable(self, vi): # noqa: N802 with self._func_lock: if self.niDMM_Disable_cfunc is None: - self.niDMM_Disable_cfunc = self._get_library_function("niDMM_Disable") + self.niDMM_Disable_cfunc = self._get_library_function('niDMM_Disable') self.niDMM_Disable_cfunc.argtypes = [ViSession] # noqa: F405 self.niDMM_Disable_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_Disable_cfunc(vi) - def niDMM_ExportAttributeConfigurationBuffer( - self, vi, size, configuration - ): # noqa: N802 + def niDMM_ExportAttributeConfigurationBuffer(self, vi, size, configuration): # noqa: N802 with self._func_lock: if self.niDMM_ExportAttributeConfigurationBuffer_cfunc is None: - self.niDMM_ExportAttributeConfigurationBuffer_cfunc = ( - self._get_library_function( - "niDMM_ExportAttributeConfigurationBuffer" - ) - ) - self.niDMM_ExportAttributeConfigurationBuffer_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViInt8), - ] # noqa: F405 - self.niDMM_ExportAttributeConfigurationBuffer_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDMM_ExportAttributeConfigurationBuffer_cfunc( - vi, size, configuration - ) + self.niDMM_ExportAttributeConfigurationBuffer_cfunc = self._get_library_function('niDMM_ExportAttributeConfigurationBuffer') + self.niDMM_ExportAttributeConfigurationBuffer_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt8)] # noqa: F405 + self.niDMM_ExportAttributeConfigurationBuffer_cfunc.restype = ViStatus # noqa: F405 + return self.niDMM_ExportAttributeConfigurationBuffer_cfunc(vi, size, configuration) def niDMM_ExportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niDMM_ExportAttributeConfigurationFile_cfunc is None: - self.niDMM_ExportAttributeConfigurationFile_cfunc = ( - self._get_library_function("niDMM_ExportAttributeConfigurationFile") - ) - self.niDMM_ExportAttributeConfigurationFile_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niDMM_ExportAttributeConfigurationFile_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niDMM_ExportAttributeConfigurationFile_cfunc = self._get_library_function('niDMM_ExportAttributeConfigurationFile') + self.niDMM_ExportAttributeConfigurationFile_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDMM_ExportAttributeConfigurationFile_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_ExportAttributeConfigurationFile_cfunc(vi, file_path) def niDMM_Fetch(self, vi, maximum_time, reading): # noqa: N802 with self._func_lock: if self.niDMM_Fetch_cfunc is None: - self.niDMM_Fetch_cfunc = self._get_library_function("niDMM_Fetch") - self.niDMM_Fetch_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niDMM_Fetch_cfunc = self._get_library_function('niDMM_Fetch') + self.niDMM_Fetch_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 self.niDMM_Fetch_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_Fetch_cfunc(vi, maximum_time, reading) - def niDMM_FetchMultiPoint( - self, vi, maximum_time, array_size, reading_array, actual_number_of_points - ): # noqa: N802 + def niDMM_FetchMultiPoint(self, vi, maximum_time, array_size, reading_array, actual_number_of_points): # noqa: N802 with self._func_lock: if self.niDMM_FetchMultiPoint_cfunc is None: - self.niDMM_FetchMultiPoint_cfunc = self._get_library_function( - "niDMM_FetchMultiPoint" - ) - self.niDMM_FetchMultiPoint_cfunc.argtypes = [ - ViSession, - ViInt32, - ViInt32, - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niDMM_FetchMultiPoint_cfunc = self._get_library_function('niDMM_FetchMultiPoint') + self.niDMM_FetchMultiPoint_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt32)] # noqa: F405 self.niDMM_FetchMultiPoint_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_FetchMultiPoint_cfunc( - vi, maximum_time, array_size, reading_array, actual_number_of_points - ) + return self.niDMM_FetchMultiPoint_cfunc(vi, maximum_time, array_size, reading_array, actual_number_of_points) - def niDMM_FetchWaveform( - self, vi, maximum_time, array_size, waveform_array, actual_number_of_points - ): # noqa: N802 + def niDMM_FetchWaveform(self, vi, maximum_time, array_size, waveform_array, actual_number_of_points): # noqa: N802 with self._func_lock: if self.niDMM_FetchWaveform_cfunc is None: - self.niDMM_FetchWaveform_cfunc = self._get_library_function( - "niDMM_FetchWaveform" - ) - self.niDMM_FetchWaveform_cfunc.argtypes = [ - ViSession, - ViInt32, - ViInt32, - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niDMM_FetchWaveform_cfunc = self._get_library_function('niDMM_FetchWaveform') + self.niDMM_FetchWaveform_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt32)] # noqa: F405 self.niDMM_FetchWaveform_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_FetchWaveform_cfunc( - vi, maximum_time, array_size, waveform_array, actual_number_of_points - ) + return self.niDMM_FetchWaveform_cfunc(vi, maximum_time, array_size, waveform_array, actual_number_of_points) - def niDMM_GetAttributeViBoolean( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niDMM_GetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niDMM_GetAttributeViBoolean_cfunc is None: - self.niDMM_GetAttributeViBoolean_cfunc = self._get_library_function( - "niDMM_GetAttributeViBoolean" - ) - self.niDMM_GetAttributeViBoolean_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niDMM_GetAttributeViBoolean_cfunc = self._get_library_function('niDMM_GetAttributeViBoolean') + self.niDMM_GetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niDMM_GetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_GetAttributeViBoolean_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niDMM_GetAttributeViBoolean_cfunc(vi, channel_name, attribute_id, attribute_value) - def niDMM_GetAttributeViInt32( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niDMM_GetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niDMM_GetAttributeViInt32_cfunc is None: - self.niDMM_GetAttributeViInt32_cfunc = self._get_library_function( - "niDMM_GetAttributeViInt32" - ) - self.niDMM_GetAttributeViInt32_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niDMM_GetAttributeViInt32_cfunc = self._get_library_function('niDMM_GetAttributeViInt32') + self.niDMM_GetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViInt32)] # noqa: F405 self.niDMM_GetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_GetAttributeViInt32_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niDMM_GetAttributeViInt32_cfunc(vi, channel_name, attribute_id, attribute_value) - def niDMM_GetAttributeViReal64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niDMM_GetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niDMM_GetAttributeViReal64_cfunc is None: - self.niDMM_GetAttributeViReal64_cfunc = self._get_library_function( - "niDMM_GetAttributeViReal64" - ) - self.niDMM_GetAttributeViReal64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niDMM_GetAttributeViReal64_cfunc = self._get_library_function('niDMM_GetAttributeViReal64') + self.niDMM_GetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViReal64)] # noqa: F405 self.niDMM_GetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_GetAttributeViReal64_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niDMM_GetAttributeViReal64_cfunc(vi, channel_name, attribute_id, attribute_value) - def niDMM_GetAttributeViString( - self, vi, channel_name, attribute_id, buffer_size, attribute_value - ): # noqa: N802 + def niDMM_GetAttributeViString(self, vi, channel_name, attribute_id, buffer_size, attribute_value): # noqa: N802 with self._func_lock: if self.niDMM_GetAttributeViString_cfunc is None: - self.niDMM_GetAttributeViString_cfunc = self._get_library_function( - "niDMM_GetAttributeViString" - ) - self.niDMM_GetAttributeViString_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDMM_GetAttributeViString_cfunc = self._get_library_function('niDMM_GetAttributeViString') + self.niDMM_GetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niDMM_GetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_GetAttributeViString_cfunc( - vi, channel_name, attribute_id, buffer_size, attribute_value - ) + return self.niDMM_GetAttributeViString_cfunc(vi, channel_name, attribute_id, buffer_size, attribute_value) - def niDMM_GetCalDateAndTime( - self, vi, cal_type, month, day, year, hour, minute - ): # noqa: N802 + def niDMM_GetCalDateAndTime(self, vi, cal_type, month, day, year, hour, minute): # noqa: N802 with self._func_lock: if self.niDMM_GetCalDateAndTime_cfunc is None: - self.niDMM_GetCalDateAndTime_cfunc = self._get_library_function( - "niDMM_GetCalDateAndTime" - ) - self.niDMM_GetCalDateAndTime_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niDMM_GetCalDateAndTime_cfunc = self._get_library_function('niDMM_GetCalDateAndTime') + self.niDMM_GetCalDateAndTime_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 self.niDMM_GetCalDateAndTime_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_GetCalDateAndTime_cfunc( - vi, cal_type, month, day, year, hour, minute - ) + return self.niDMM_GetCalDateAndTime_cfunc(vi, cal_type, month, day, year, hour, minute) def niDMM_GetDevTemp(self, vi, options, temperature): # noqa: N802 with self._func_lock: if self.niDMM_GetDevTemp_cfunc is None: - self.niDMM_GetDevTemp_cfunc = self._get_library_function( - "niDMM_GetDevTemp" - ) - self.niDMM_GetDevTemp_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niDMM_GetDevTemp_cfunc = self._get_library_function('niDMM_GetDevTemp') + self.niDMM_GetDevTemp_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViReal64)] # noqa: F405 self.niDMM_GetDevTemp_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_GetDevTemp_cfunc(vi, options, temperature) def niDMM_GetError(self, vi, error_code, buffer_size, description): # noqa: N802 with self._func_lock: if self.niDMM_GetError_cfunc is None: - self.niDMM_GetError_cfunc = self._get_library_function("niDMM_GetError") - self.niDMM_GetError_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViStatus), - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDMM_GetError_cfunc = self._get_library_function('niDMM_GetError') + self.niDMM_GetError_cfunc.argtypes = [ViSession, ctypes.POINTER(ViStatus), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niDMM_GetError_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_GetError_cfunc(vi, error_code, buffer_size, description) def niDMM_GetExtCalRecommendedInterval(self, vi, months): # noqa: N802 with self._func_lock: if self.niDMM_GetExtCalRecommendedInterval_cfunc is None: - self.niDMM_GetExtCalRecommendedInterval_cfunc = ( - self._get_library_function("niDMM_GetExtCalRecommendedInterval") - ) - self.niDMM_GetExtCalRecommendedInterval_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niDMM_GetExtCalRecommendedInterval_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niDMM_GetExtCalRecommendedInterval_cfunc = self._get_library_function('niDMM_GetExtCalRecommendedInterval') + self.niDMM_GetExtCalRecommendedInterval_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32)] # noqa: F405 + self.niDMM_GetExtCalRecommendedInterval_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_GetExtCalRecommendedInterval_cfunc(vi, months) def niDMM_GetLastCalTemp(self, vi, cal_type, temperature): # noqa: N802 with self._func_lock: if self.niDMM_GetLastCalTemp_cfunc is None: - self.niDMM_GetLastCalTemp_cfunc = self._get_library_function( - "niDMM_GetLastCalTemp" - ) - self.niDMM_GetLastCalTemp_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niDMM_GetLastCalTemp_cfunc = self._get_library_function('niDMM_GetLastCalTemp') + self.niDMM_GetLastCalTemp_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 self.niDMM_GetLastCalTemp_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_GetLastCalTemp_cfunc(vi, cal_type, temperature) def niDMM_GetSelfCalSupported(self, vi, self_cal_supported): # noqa: N802 with self._func_lock: if self.niDMM_GetSelfCalSupported_cfunc is None: - self.niDMM_GetSelfCalSupported_cfunc = self._get_library_function( - "niDMM_GetSelfCalSupported" - ) - self.niDMM_GetSelfCalSupported_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niDMM_GetSelfCalSupported_cfunc = self._get_library_function('niDMM_GetSelfCalSupported') + self.niDMM_GetSelfCalSupported_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niDMM_GetSelfCalSupported_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_GetSelfCalSupported_cfunc(vi, self_cal_supported) - def niDMM_ImportAttributeConfigurationBuffer( - self, vi, size, configuration - ): # noqa: N802 + def niDMM_ImportAttributeConfigurationBuffer(self, vi, size, configuration): # noqa: N802 with self._func_lock: if self.niDMM_ImportAttributeConfigurationBuffer_cfunc is None: - self.niDMM_ImportAttributeConfigurationBuffer_cfunc = ( - self._get_library_function( - "niDMM_ImportAttributeConfigurationBuffer" - ) - ) - self.niDMM_ImportAttributeConfigurationBuffer_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViInt8), - ] # noqa: F405 - self.niDMM_ImportAttributeConfigurationBuffer_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niDMM_ImportAttributeConfigurationBuffer_cfunc( - vi, size, configuration - ) + self.niDMM_ImportAttributeConfigurationBuffer_cfunc = self._get_library_function('niDMM_ImportAttributeConfigurationBuffer') + self.niDMM_ImportAttributeConfigurationBuffer_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt8)] # noqa: F405 + self.niDMM_ImportAttributeConfigurationBuffer_cfunc.restype = ViStatus # noqa: F405 + return self.niDMM_ImportAttributeConfigurationBuffer_cfunc(vi, size, configuration) def niDMM_ImportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niDMM_ImportAttributeConfigurationFile_cfunc is None: - self.niDMM_ImportAttributeConfigurationFile_cfunc = ( - self._get_library_function("niDMM_ImportAttributeConfigurationFile") - ) - self.niDMM_ImportAttributeConfigurationFile_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niDMM_ImportAttributeConfigurationFile_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niDMM_ImportAttributeConfigurationFile_cfunc = self._get_library_function('niDMM_ImportAttributeConfigurationFile') + self.niDMM_ImportAttributeConfigurationFile_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niDMM_ImportAttributeConfigurationFile_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_ImportAttributeConfigurationFile_cfunc(vi, file_path) - def niDMM_InitWithOptions( - self, resource_name, id_query, reset_device, option_string, vi - ): # noqa: N802 + def niDMM_InitWithOptions(self, resource_name, id_query, reset_device, option_string, vi): # noqa: N802 with self._func_lock: if self.niDMM_InitWithOptions_cfunc is None: - self.niDMM_InitWithOptions_cfunc = self._get_library_function( - "niDMM_InitWithOptions" - ) - self.niDMM_InitWithOptions_cfunc.argtypes = [ - ctypes.POINTER(ViChar), - ViBoolean, - ViBoolean, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViSession), - ] # noqa: F405 + self.niDMM_InitWithOptions_cfunc = self._get_library_function('niDMM_InitWithOptions') + self.niDMM_InitWithOptions_cfunc.argtypes = [ctypes.POINTER(ViChar), ViBoolean, ViBoolean, ctypes.POINTER(ViChar), ctypes.POINTER(ViSession)] # noqa: F405 self.niDMM_InitWithOptions_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_InitWithOptions_cfunc( - resource_name, id_query, reset_device, option_string, vi - ) + return self.niDMM_InitWithOptions_cfunc(resource_name, id_query, reset_device, option_string, vi) def niDMM_Initiate(self, vi): # noqa: N802 with self._func_lock: if self.niDMM_Initiate_cfunc is None: - self.niDMM_Initiate_cfunc = self._get_library_function("niDMM_Initiate") + self.niDMM_Initiate_cfunc = self._get_library_function('niDMM_Initiate') self.niDMM_Initiate_cfunc.argtypes = [ViSession] # noqa: F405 self.niDMM_Initiate_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_Initiate_cfunc(vi) @@ -583,118 +319,63 @@ def niDMM_Initiate(self, vi): # noqa: N802 def niDMM_LockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niDMM_LockSession_cfunc is None: - self.niDMM_LockSession_cfunc = self._get_library_function( - "niDMM_LockSession" - ) - self.niDMM_LockSession_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niDMM_LockSession_cfunc = self._get_library_function('niDMM_LockSession') + self.niDMM_LockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niDMM_LockSession_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_LockSession_cfunc(vi, caller_has_lock) def niDMM_PerformOpenCableComp(self, vi, conductance, susceptance): # noqa: N802 with self._func_lock: if self.niDMM_PerformOpenCableComp_cfunc is None: - self.niDMM_PerformOpenCableComp_cfunc = self._get_library_function( - "niDMM_PerformOpenCableComp" - ) - self.niDMM_PerformOpenCableComp_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niDMM_PerformOpenCableComp_cfunc = self._get_library_function('niDMM_PerformOpenCableComp') + self.niDMM_PerformOpenCableComp_cfunc.argtypes = [ViSession, ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64)] # noqa: F405 self.niDMM_PerformOpenCableComp_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_PerformOpenCableComp_cfunc(vi, conductance, susceptance) def niDMM_PerformShortCableComp(self, vi, resistance, reactance): # noqa: N802 with self._func_lock: if self.niDMM_PerformShortCableComp_cfunc is None: - self.niDMM_PerformShortCableComp_cfunc = self._get_library_function( - "niDMM_PerformShortCableComp" - ) - self.niDMM_PerformShortCableComp_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niDMM_PerformShortCableComp_cfunc = self._get_library_function('niDMM_PerformShortCableComp') + self.niDMM_PerformShortCableComp_cfunc.argtypes = [ViSession, ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64)] # noqa: F405 self.niDMM_PerformShortCableComp_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_PerformShortCableComp_cfunc(vi, resistance, reactance) def niDMM_Read(self, vi, maximum_time, reading): # noqa: N802 with self._func_lock: if self.niDMM_Read_cfunc is None: - self.niDMM_Read_cfunc = self._get_library_function("niDMM_Read") - self.niDMM_Read_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niDMM_Read_cfunc = self._get_library_function('niDMM_Read') + self.niDMM_Read_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 self.niDMM_Read_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_Read_cfunc(vi, maximum_time, reading) - def niDMM_ReadMultiPoint( - self, vi, maximum_time, array_size, reading_array, actual_number_of_points - ): # noqa: N802 + def niDMM_ReadMultiPoint(self, vi, maximum_time, array_size, reading_array, actual_number_of_points): # noqa: N802 with self._func_lock: if self.niDMM_ReadMultiPoint_cfunc is None: - self.niDMM_ReadMultiPoint_cfunc = self._get_library_function( - "niDMM_ReadMultiPoint" - ) - self.niDMM_ReadMultiPoint_cfunc.argtypes = [ - ViSession, - ViInt32, - ViInt32, - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niDMM_ReadMultiPoint_cfunc = self._get_library_function('niDMM_ReadMultiPoint') + self.niDMM_ReadMultiPoint_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt32)] # noqa: F405 self.niDMM_ReadMultiPoint_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_ReadMultiPoint_cfunc( - vi, maximum_time, array_size, reading_array, actual_number_of_points - ) + return self.niDMM_ReadMultiPoint_cfunc(vi, maximum_time, array_size, reading_array, actual_number_of_points) - def niDMM_ReadStatus( - self, vi, acquisition_backlog, acquisition_status - ): # noqa: N802 + def niDMM_ReadStatus(self, vi, acquisition_backlog, acquisition_status): # noqa: N802 with self._func_lock: if self.niDMM_ReadStatus_cfunc is None: - self.niDMM_ReadStatus_cfunc = self._get_library_function( - "niDMM_ReadStatus" - ) - self.niDMM_ReadStatus_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt16), - ] # noqa: F405 + self.niDMM_ReadStatus_cfunc = self._get_library_function('niDMM_ReadStatus') + self.niDMM_ReadStatus_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt16)] # noqa: F405 self.niDMM_ReadStatus_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_ReadStatus_cfunc(vi, acquisition_backlog, acquisition_status) - def niDMM_ReadWaveform( - self, vi, maximum_time, array_size, waveform_array, actual_number_of_points - ): # noqa: N802 + def niDMM_ReadWaveform(self, vi, maximum_time, array_size, waveform_array, actual_number_of_points): # noqa: N802 with self._func_lock: if self.niDMM_ReadWaveform_cfunc is None: - self.niDMM_ReadWaveform_cfunc = self._get_library_function( - "niDMM_ReadWaveform" - ) - self.niDMM_ReadWaveform_cfunc.argtypes = [ - ViSession, - ViInt32, - ViInt32, - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niDMM_ReadWaveform_cfunc = self._get_library_function('niDMM_ReadWaveform') + self.niDMM_ReadWaveform_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt32)] # noqa: F405 self.niDMM_ReadWaveform_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_ReadWaveform_cfunc( - vi, maximum_time, array_size, waveform_array, actual_number_of_points - ) + return self.niDMM_ReadWaveform_cfunc(vi, maximum_time, array_size, waveform_array, actual_number_of_points) def niDMM_ResetWithDefaults(self, vi): # noqa: N802 with self._func_lock: if self.niDMM_ResetWithDefaults_cfunc is None: - self.niDMM_ResetWithDefaults_cfunc = self._get_library_function( - "niDMM_ResetWithDefaults" - ) + self.niDMM_ResetWithDefaults_cfunc = self._get_library_function('niDMM_ResetWithDefaults') self.niDMM_ResetWithDefaults_cfunc.argtypes = [ViSession] # noqa: F405 self.niDMM_ResetWithDefaults_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_ResetWithDefaults_cfunc(vi) @@ -702,7 +383,7 @@ def niDMM_ResetWithDefaults(self, vi): # noqa: N802 def niDMM_SelfCal(self, vi): # noqa: N802 with self._func_lock: if self.niDMM_SelfCal_cfunc is None: - self.niDMM_SelfCal_cfunc = self._get_library_function("niDMM_SelfCal") + self.niDMM_SelfCal_cfunc = self._get_library_function('niDMM_SelfCal') self.niDMM_SelfCal_cfunc.argtypes = [ViSession] # noqa: F405 self.niDMM_SelfCal_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_SelfCal_cfunc(vi) @@ -710,108 +391,55 @@ def niDMM_SelfCal(self, vi): # noqa: N802 def niDMM_SendSoftwareTrigger(self, vi): # noqa: N802 with self._func_lock: if self.niDMM_SendSoftwareTrigger_cfunc is None: - self.niDMM_SendSoftwareTrigger_cfunc = self._get_library_function( - "niDMM_SendSoftwareTrigger" - ) - self.niDMM_SendSoftwareTrigger_cfunc.argtypes = [ - ViSession - ] # noqa: F405 + self.niDMM_SendSoftwareTrigger_cfunc = self._get_library_function('niDMM_SendSoftwareTrigger') + self.niDMM_SendSoftwareTrigger_cfunc.argtypes = [ViSession] # noqa: F405 self.niDMM_SendSoftwareTrigger_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_SendSoftwareTrigger_cfunc(vi) - def niDMM_SetAttributeViBoolean( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niDMM_SetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niDMM_SetAttributeViBoolean_cfunc is None: - self.niDMM_SetAttributeViBoolean_cfunc = self._get_library_function( - "niDMM_SetAttributeViBoolean" - ) - self.niDMM_SetAttributeViBoolean_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViBoolean, - ] # noqa: F405 + self.niDMM_SetAttributeViBoolean_cfunc = self._get_library_function('niDMM_SetAttributeViBoolean') + self.niDMM_SetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViBoolean] # noqa: F405 self.niDMM_SetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_SetAttributeViBoolean_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niDMM_SetAttributeViBoolean_cfunc(vi, channel_name, attribute_id, attribute_value) - def niDMM_SetAttributeViInt32( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niDMM_SetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niDMM_SetAttributeViInt32_cfunc is None: - self.niDMM_SetAttributeViInt32_cfunc = self._get_library_function( - "niDMM_SetAttributeViInt32" - ) - self.niDMM_SetAttributeViInt32_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViInt32, - ] # noqa: F405 + self.niDMM_SetAttributeViInt32_cfunc = self._get_library_function('niDMM_SetAttributeViInt32') + self.niDMM_SetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32] # noqa: F405 self.niDMM_SetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_SetAttributeViInt32_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niDMM_SetAttributeViInt32_cfunc(vi, channel_name, attribute_id, attribute_value) - def niDMM_SetAttributeViReal64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niDMM_SetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niDMM_SetAttributeViReal64_cfunc is None: - self.niDMM_SetAttributeViReal64_cfunc = self._get_library_function( - "niDMM_SetAttributeViReal64" - ) - self.niDMM_SetAttributeViReal64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViReal64, - ] # noqa: F405 + self.niDMM_SetAttributeViReal64_cfunc = self._get_library_function('niDMM_SetAttributeViReal64') + self.niDMM_SetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViReal64] # noqa: F405 self.niDMM_SetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_SetAttributeViReal64_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niDMM_SetAttributeViReal64_cfunc(vi, channel_name, attribute_id, attribute_value) - def niDMM_SetAttributeViString( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niDMM_SetAttributeViString(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niDMM_SetAttributeViString_cfunc is None: - self.niDMM_SetAttributeViString_cfunc = self._get_library_function( - "niDMM_SetAttributeViString" - ) - self.niDMM_SetAttributeViString_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDMM_SetAttributeViString_cfunc = self._get_library_function('niDMM_SetAttributeViString') + self.niDMM_SetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViChar)] # noqa: F405 self.niDMM_SetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niDMM_SetAttributeViString_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niDMM_SetAttributeViString_cfunc(vi, channel_name, attribute_id, attribute_value) def niDMM_UnlockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niDMM_UnlockSession_cfunc is None: - self.niDMM_UnlockSession_cfunc = self._get_library_function( - "niDMM_UnlockSession" - ) - self.niDMM_UnlockSession_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niDMM_UnlockSession_cfunc = self._get_library_function('niDMM_UnlockSession') + self.niDMM_UnlockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niDMM_UnlockSession_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_UnlockSession_cfunc(vi, caller_has_lock) def niDMM_close(self, vi): # noqa: N802 with self._func_lock: if self.niDMM_close_cfunc is None: - self.niDMM_close_cfunc = self._get_library_function("niDMM_close") + self.niDMM_close_cfunc = self._get_library_function('niDMM_close') self.niDMM_close_cfunc.argtypes = [ViSession] # noqa: F405 self.niDMM_close_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_close_cfunc(vi) @@ -819,21 +447,15 @@ def niDMM_close(self, vi): # noqa: N802 def niDMM_error_message(self, vi, error_code, error_message): # noqa: N802 with self._func_lock: if self.niDMM_error_message_cfunc is None: - self.niDMM_error_message_cfunc = self._get_library_function( - "niDMM_error_message" - ) - self.niDMM_error_message_cfunc.argtypes = [ - ViSession, - ViStatus, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDMM_error_message_cfunc = self._get_library_function('niDMM_error_message') + self.niDMM_error_message_cfunc.argtypes = [ViSession, ViStatus, ctypes.POINTER(ViChar)] # noqa: F405 self.niDMM_error_message_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_error_message_cfunc(vi, error_code, error_message) def niDMM_reset(self, vi): # noqa: N802 with self._func_lock: if self.niDMM_reset_cfunc is None: - self.niDMM_reset_cfunc = self._get_library_function("niDMM_reset") + self.niDMM_reset_cfunc = self._get_library_function('niDMM_reset') self.niDMM_reset_cfunc.argtypes = [ViSession] # noqa: F405 self.niDMM_reset_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_reset_cfunc(vi) @@ -841,13 +463,7 @@ def niDMM_reset(self, vi): # noqa: N802 def niDMM_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 with self._func_lock: if self.niDMM_self_test_cfunc is None: - self.niDMM_self_test_cfunc = self._get_library_function( - "niDMM_self_test" - ) - self.niDMM_self_test_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt16), - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niDMM_self_test_cfunc = self._get_library_function('niDMM_self_test') + self.niDMM_self_test_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt16), ctypes.POINTER(ViChar)] # noqa: F405 self.niDMM_self_test_cfunc.restype = ViStatus # noqa: F405 return self.niDMM_self_test_cfunc(vi, self_test_result, self_test_message) diff --git a/generated/nidmm/nidmm/_library_singleton.py b/generated/nidmm/nidmm/_library_singleton.py index 34b5a9ca3..40d500f36 100644 --- a/generated/nidmm/nidmm/_library_singleton.py +++ b/generated/nidmm/nidmm/_library_singleton.py @@ -12,36 +12,30 @@ _instance = None _instance_lock = threading.Lock() -_library_info = { - "Linux": {"64bit": {"name": "nidmm", "type": "cdll"}}, - "Windows": { - "32bit": {"name": "nidmm_32.dll", "type": "windll"}, - "64bit": {"name": "nidmm_64.dll", "type": "cdll"}, - }, -} +_library_info = {'Linux': {'64bit': {'name': 'nidmm', 'type': 'cdll'}}, + 'Windows': {'32bit': {'name': 'nidmm_32.dll', 'type': 'windll'}, + '64bit': {'name': 'nidmm_64.dll', 'type': 'cdll'}}} def _get_library_name(): try: - return ctypes.util.find_library( - _library_info[platform.system()][platform.architecture()[0]]["name"] - ) # We find and return full path to the DLL + return ctypes.util.find_library(_library_info[platform.system()][platform.architecture()[0]]['name']) # We find and return full path to the DLL except KeyError: raise errors.UnsupportedConfigurationError def _get_library_type(): try: - return _library_info[platform.system()][platform.architecture()[0]]["type"] + return _library_info[platform.system()][platform.architecture()[0]]['type'] except KeyError: raise errors.UnsupportedConfigurationError def get(): - """get + '''get Returns the library.Library singleton for nidmm. - """ + ''' global _instance global _instance_lock @@ -49,12 +43,13 @@ def get(): if _instance is None: try: library_type = _get_library_type() - if library_type == "windll": + if library_type == 'windll': ctypes_library = ctypes.WinDLL(_get_library_name()) else: - assert library_type == "cdll" + assert library_type == 'cdll' ctypes_library = ctypes.CDLL(_get_library_name()) except OSError: raise errors.DriverNotInstalledError() _instance = _library.Library(ctypes_library) return _instance + diff --git a/generated/nidmm/nidmm/_visatype.py b/generated/nidmm/nidmm/_visatype.py index bf96c3cfb..02cc41d1b 100644 --- a/generated/nidmm/nidmm/_visatype.py +++ b/generated/nidmm/nidmm/_visatype.py @@ -2,9 +2,9 @@ import ctypes -"""Definitions of the VISA types used by the C API of the driver runtime. +'''Definitions of the VISA types used by the C API of the driver runtime. These are aliased directly to ctypes types so can be used directly to call into the library. -""" +''' ViChar = ctypes.c_char @@ -26,3 +26,4 @@ ViAttr = ViUInt32 ViConstString = ViString ViRsrc = ViString + diff --git a/generated/nidmm/nidmm/enums.py b/generated/nidmm/nidmm/enums.py index c20c6025f..b476424ce 100644 --- a/generated/nidmm/nidmm/enums.py +++ b/generated/nidmm/nidmm/enums.py @@ -6,487 +6,487 @@ class ADCCalibration(Enum): AUTO = -1 - r""" + r''' The DMM enables or disables ADC calibration for you. - """ + ''' OFF = 0 - r""" + r''' The DMM does not compensate for changes to the gain. - """ + ''' ON = 1 - r""" + r''' The DMM measures an internal reference to calculate the correct gain for the measurement. - """ + ''' class AcquisitionStatus(Enum): RUNNING = 0 - r""" + r''' Running - """ + ''' FINISHED_WITH_BACKLOG = 1 - r""" + r''' Finished with **Backlog** - """ + ''' FINISHED_WITH_NO_BACKLOG = 2 - r""" + r''' Finished with no **Backlog** - """ + ''' PAUSED = 3 - r""" + r''' Paused - """ + ''' NO_ACQUISITION_IN_PROGRESS = 4 - r""" + r''' No acquisition in progress - """ + ''' class ApertureTimeUnits(Enum): SECONDS = 0 - r""" + r''' Seconds - """ + ''' POWER_LINE_CYCLES = 1 - r""" + r''' Powerline Cycles - """ + ''' class AutoZero(Enum): AUTO = -1 - r""" + r''' The drivers chooses the AutoZero setting based on the configured method and resolution. - """ + ''' OFF = 0 - r""" + r''' Disables AutoZero. - """ + ''' ON = 1 - r""" + r''' The DMM internally disconnects the input signal following each measurement and takes a zero reading. It then subtracts the zero reading from the preceding reading. - """ + ''' ONCE = 2 - r""" + r''' The DMM internally disconnects the input signal for the first measurement and takes a zero reading. It then subtracts the zero reading from the first reading and the following readings. - """ + ''' class CableCompensationType(Enum): NONE = 0 - r""" + r''' No Cable Compensation - """ + ''' OPEN = 1 - r""" + r''' Open Cable Compensation - """ + ''' SHORT = 2 - r""" + r''' Short Cable Compensation - """ + ''' OPEN_AND_SHORT = 3 - r""" + r''' Open and Short Cable Compensation - """ + ''' class DCNoiseRejection(Enum): AUTO = -1 - r""" + r''' The driver chooses the DC noise rejection setting based on the configured method and resolution. - """ + ''' NORMAL = 0 - r""" + r''' NI-DMM weighs all samples equally. - """ + ''' SECOND_ORDER = 1 - r""" + r''' NI-DMM weighs the samples taken in the middle of the aperture time more than samples taken at the beginning and the end of the measurement using a triangular weighing method. - """ + ''' HIGH_ORDER = 2 - r""" + r''' NI-DMM weighs the samples taken in the middle of the aperture time more than samples taken at the beginning and the end of the measurement using a bell-curve weighing method. - """ + ''' class Function(Enum): DC_VOLTS = 1 - r""" + r''' DC Voltage - """ + ''' AC_VOLTS = 2 - r""" + r''' AC Voltage - """ + ''' DC_CURRENT = 3 - r""" + r''' DC Current - """ + ''' AC_CURRENT = 4 - r""" + r''' AC Current - """ + ''' TWO_WIRE_RES = 5 - r""" + r''' 2-Wire Resistance - """ + ''' FOUR_WIRE_RES = 101 - r""" + r''' 4-Wire Resistance - """ + ''' FREQ = 104 - r""" + r''' Frequency - """ + ''' PERIOD = 105 - r""" + r''' Period - """ + ''' TEMPERATURE = 108 - r""" + r''' NI 4065, NI 4070/4071/4072, and NI 4080/4081/4182 supported. - """ + ''' AC_VOLTS_DC_COUPLED = 1001 - r""" + r''' AC Voltage with DC Coupling - """ + ''' DIODE = 1002 - r""" + r''' Diode - """ + ''' WAVEFORM_VOLTAGE = 1003 - r""" + r''' Waveform voltage - """ + ''' WAVEFORM_CURRENT = 1004 - r""" + r''' Waveform current - """ + ''' CAPACITANCE = 1005 - r""" + r''' Capacitance - """ + ''' INDUCTANCE = 1006 - r""" + r''' Inductance - """ + ''' class LCCalculationModel(Enum): AUTO = -1 - r""" + r''' NI-DMM chooses the algorithm based on method and range - """ + ''' SERIES = 0 - r""" + r''' NI-DMM uses the series impedance model to calculate capacitance and inductance - """ + ''' PARALLEL = 1 - r""" + r''' NI-DMM uses the parallel admittance model to calculate capacitance and inductance - """ + ''' class MeasurementCompleteDest(Enum): NONE = -1 - r""" + r''' No Trigger - """ + ''' EXTERNAL = 2 - r""" + r''' AUX I/O Connector - """ + ''' PXI_TRIG0 = 111 - r""" + r''' PXI Trigger Line 0 - """ + ''' PXI_TRIG1 = 112 - r""" + r''' PXI Trigger Line 1 - """ + ''' PXI_TRIG2 = 113 - r""" + r''' PXI Trigger Line 2 - """ + ''' PXI_TRIG3 = 114 - r""" + r''' PXI Trigger Line 3 - """ + ''' PXI_TRIG4 = 115 - r""" + r''' PXI Trigger Line 4 - """ + ''' PXI_TRIG5 = 116 - r""" + r''' PXI Trigger Line 5 - """ + ''' PXI_TRIG6 = 117 - r""" + r''' PXI Trigger Line 6 - """ + ''' PXI_TRIG7 = 118 - r""" + r''' PXI Trigger Line 7 - """ + ''' LBR_TRIG0 = 1003 - r""" + r''' Internal Trigger Line of a PXI/SCXI Combination Chassis - """ + ''' class OperationMode(Enum): IVIDMM = 0 - r""" + r''' IviDmm Mode - """ + ''' WAVEFORM = 1 - r""" + r''' Waveform acquisition mode - """ + ''' class RTDType(Enum): CUSTOM = 0 - r""" + r''' Performs Callendar-Van Dusen RTD scaling with the user-specified A, B, and C coefficients. - """ + ''' PT3750 = 1 - r""" + r''' Performs scaling for a Pt 3750 RTD. - """ + ''' PT3851 = 2 - r""" + r''' Performs scaling for a Pt 3851 RTD. - """ + ''' PT3911 = 3 - r""" + r''' Performs scaling for a Pt 3911 RTD. - """ + ''' PT3916 = 4 - r""" + r''' Performs scaling for a Pt 3916 RTD. - """ + ''' PT3920 = 5 - r""" + r''' Performs scaling for a Pt 3920 RTD. - """ + ''' PT3928 = 6 - r""" + r''' Performs scaling for a Pt 3928 RTD. - """ + ''' class SampleTrigger(Enum): IMMEDIATE = 1 - r""" + r''' No Trigger - """ + ''' EXTERNAL = 2 - r""" + r''' AUX I/O Connector Trigger Line 0 - """ + ''' SOFTWARE_TRIG = 3 - r""" + r''' Software Trigger - """ + ''' INTERVAL = 10 - r""" + r''' Interval Trigger - """ + ''' PXI_TRIG0 = 111 - r""" + r''' PXI Trigger Line 0 - """ + ''' PXI_TRIG1 = 112 - r""" + r''' PXI Trigger Line 1 - """ + ''' PXI_TRIG2 = 113 - r""" + r''' PXI Trigger Line 2 - """ + ''' PXI_TRIG3 = 114 - r""" + r''' PXI Trigger Line 3 - """ + ''' PXI_TRIG4 = 115 - r""" + r''' PXI Trigger Line 4 - """ + ''' PXI_TRIG5 = 116 - r""" + r''' PXI Trigger Line 5 - """ + ''' PXI_TRIG6 = 117 - r""" + r''' PXI Trigger Line 6 - """ + ''' PXI_TRIG7 = 118 - r""" + r''' PXI Trigger Line 7 - """ + ''' PXI_STAR = 131 - r""" + r''' PXI Star Trigger Line - """ + ''' AUX_TRIG1 = 1001 - r""" + r''' AUX I/0 Connector Trigger Line 1 - """ + ''' LBR_TRIG1 = 1004 - r""" + r''' Internal Trigger Line of a PXI/SCXI Combination Chassis - """ + ''' class ThermistorType(Enum): CUSTOM = 0 - r""" + r''' Custom - """ + ''' THERMISTOR_44004 = 1 - r""" + r''' 44004 - """ + ''' THERMISTOR_44006 = 2 - r""" + r''' 44006 - """ + ''' THERMISTOR_44007 = 3 - r""" + r''' 44007 - """ + ''' class ThermocoupleReferenceJunctionType(Enum): FIXED = 2 - r""" + r''' Thermocouple reference juction is fixed at the user-specified temperature. - """ + ''' class ThermocoupleType(Enum): B = 1 - r""" + r''' Thermocouple type B - """ + ''' E = 4 - r""" + r''' Thermocouple type E - """ + ''' J = 6 - r""" + r''' Thermocouple type J - """ + ''' K = 7 - r""" + r''' Thermocouple type K - """ + ''' N = 8 - r""" + r''' Thermocouple type N - """ + ''' R = 9 - r""" + r''' Thermocouple type R - """ + ''' S = 10 - r""" + r''' Thermocouple type S - """ + ''' T = 11 - r""" + r''' Thermocouple type T - """ + ''' class TransducerType(Enum): THERMOCOUPLE = 1 - r""" + r''' Thermocouple - """ + ''' THERMISTOR = 2 - r""" + r''' Thermistor - """ + ''' TWO_WIRE_RTD = 3 - r""" + r''' 2-wire RTD - """ + ''' FOUR_WIRE_RTD = 4 - r""" + r''' 4-wire RTD - """ + ''' class TriggerSource(Enum): IMMEDIATE = 1 - r""" + r''' No Trigger - """ + ''' EXTERNAL = 2 - r""" + r''' AUX I/O Connector Trigger Line 0 - """ + ''' SOFTWARE_TRIG = 3 - r""" + r''' Software Trigger - """ + ''' PXI_TRIG0 = 111 - r""" + r''' PXI Trigger Line 0 - """ + ''' PXI_TRIG1 = 112 - r""" + r''' PXI Trigger Line 1 - """ + ''' PXI_TRIG2 = 113 - r""" + r''' PXI Trigger Line 2 - """ + ''' PXI_TRIG3 = 114 - r""" + r''' PXI Trigger Line 3 - """ + ''' PXI_TRIG4 = 115 - r""" + r''' PXI Trigger Line 4 - """ + ''' PXI_TRIG5 = 116 - r""" + r''' PXI Trigger Line 5 - """ + ''' PXI_TRIG6 = 117 - r""" + r''' PXI Trigger Line 6 - """ + ''' PXI_TRIG7 = 118 - r""" + r''' PXI Trigger Line 7 - """ + ''' PXI_STAR = 131 - r""" + r''' PXI Star Trigger Line - """ + ''' AUX_TRIG1 = 1001 - r""" + r''' AUX I/O Connector Trigger Line 1 - """ + ''' LBR_TRIG1 = 1004 - r""" + r''' Internal Trigger Line of a PXI/SCXI Combination Chassis - """ + ''' class WaveformCoupling(Enum): AC = 0 - r""" + r''' AC Coupled - """ + ''' DC = 1 - r""" + r''' DC Coupled - """ + ''' diff --git a/generated/nidmm/nidmm/errors.py b/generated/nidmm/nidmm/errors.py index 468f08e69..ba47b30ce 100644 --- a/generated/nidmm/nidmm/errors.py +++ b/generated/nidmm/nidmm/errors.py @@ -7,103 +7,86 @@ def _is_success(code): - return code == 0 + return (code == 0) def _is_error(code): - return code < 0 + return (code < 0) def _is_warning(code): - return code > 0 + return (code > 0) class Error(Exception): - """Base error class for NI-DMM""" + '''Base error class for NI-DMM''' def __init__(self, message): super(Error, self).__init__(message) class DriverError(Error): - """An error originating from the NI-DMM driver""" + '''An error originating from the NI-DMM driver''' def __init__(self, code, description): - assert _is_error(code), "Should not raise Error if code is not fatal." + assert (_is_error(code)), "Should not raise Error if code is not fatal." self.code = code self.description = description super(DriverError, self).__init__(str(self.code) + ": " + self.description) class DriverWarning(Warning): - """A warning originating from the NI-DMM driver""" + '''A warning originating from the NI-DMM driver''' def __init__(self, code, description): - assert _is_warning(code), "Should not create Warning if code is not positive." - super(DriverWarning, self).__init__( - "Warning {0} occurred.\n\n{1}".format(code, description) - ) + assert (_is_warning(code)), "Should not create Warning if code is not positive." + super(DriverWarning, self).__init__('Warning {0} occurred.\n\n{1}'.format(code, description)) class UnsupportedConfigurationError(Error): - """An error due to using this module in an usupported platform.""" + '''An error due to using this module in an usupported platform.''' def __init__(self): - super(UnsupportedConfigurationError, self).__init__( - "System configuration is unsupported: " - + platform.architecture()[0] - + " " - + platform.system() - ) + super(UnsupportedConfigurationError, self).__init__('System configuration is unsupported: ' + platform.architecture()[0] + ' ' + platform.system()) class DriverNotInstalledError(Error): - """An error due to using this module without the driver runtime installed.""" + '''An error due to using this module without the driver runtime installed.''' def __init__(self): - super(DriverNotInstalledError, self).__init__( - "The NI-DMM runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it." - ) + super(DriverNotInstalledError, self).__init__('The NI-DMM runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it.') class DriverTooOldError(Error): - """An error due to using this module with an older version of the driver runtime.""" + '''An error due to using this module with an older version of the driver runtime.''' def __init__(self): - super(DriverTooOldError, self).__init__( - "A function was not found in the NI-DMM runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it." - ) + super(DriverTooOldError, self).__init__('A function was not found in the NI-DMM runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it.') class InvalidRepeatedCapabilityError(Error): - """An error due to an invalid character in a repeated capability""" + '''An error due to an invalid character in a repeated capability''' def __init__(self, invalid_character, invalid_string): - super(InvalidRepeatedCapabilityError, self).__init__( - "An invalid character ({0}) was found in repeated capability string ({1})".format( - invalid_character, invalid_string - ) - ) + super(InvalidRepeatedCapabilityError, self).__init__('An invalid character ({0}) was found in repeated capability string ({1})'.format(invalid_character, invalid_string)) class SelfTestError(Error): - """An error due to a failed self-test""" + '''An error due to a failed self-test''' def __init__(self, code, msg): self.code = code self.message = msg - super(SelfTestError, self).__init__( - "Self-test failed with code {0}: {1}".format(code, msg) - ) + super(SelfTestError, self).__init__('Self-test failed with code {0}: {1}'.format(code, msg)) def handle_error(session, code, ignore_warnings, is_error_handling): - """handle_error + '''handle_error Helper function for handling errors returned by nidmm.Library. It calls back into the session to get the corresponding error description and raises if necessary. - """ + ''' if _is_success(code) or (_is_warning(code) and ignore_warnings): return @@ -111,7 +94,7 @@ def handle_error(session, code, ignore_warnings, is_error_handling): if is_error_handling: # The caller is in the midst of error handling and an error occurred. # Don't try to get the description or we'll start recursing until the stack overflows. - description = "" + description = '' else: description = session._get_error_description(code) @@ -120,3 +103,5 @@ def handle_error(session, code, ignore_warnings, is_error_handling): assert _is_warning(code) warnings.warn(DriverWarning(code, description)) + + diff --git a/generated/nidmm/nidmm/session.py b/generated/nidmm/nidmm/session.py index 80093e14b..ad9fabd46 100644 --- a/generated/nidmm/nidmm/session.py +++ b/generated/nidmm/nidmm/session.py @@ -2,7 +2,6 @@ # This file was generated import array # noqa: F401 import ctypes - # Used by @ivi_synchronized from functools import wraps @@ -17,24 +16,22 @@ # Used for __repr__ import pprint - pp = pprint.PrettyPrinter(indent=4) # Helper functions for creating ctypes needed for calling into the driver DLL def get_ctypes_pointer_for_buffer(value=None, library_type=None, size=None): if isinstance(value, array.array): - assert library_type is not None, "library_type is required for array.array" + assert library_type is not None, 'library_type is required for array.array' addr, _ = value.buffer_info() return ctypes.cast(addr, ctypes.POINTER(library_type)) elif str(type(value)).find("'numpy.ndarray'") != -1: import numpy - return numpy.ctypeslib.as_ctypes(value) elif isinstance(value, bytes): return ctypes.cast(value, ctypes.POINTER(library_type)) elif isinstance(value, list): - assert library_type is not None, "library_type is required for list" + assert library_type is not None, 'library_type is required for list' return (library_type * len(value))(*value) else: if library_type is not None and size is not None: @@ -74,7 +71,6 @@ def aux(*xs, **kws): session = xs[0] # parameter 0 is 'self' which is the session object with session.lock(): return f(*xs, **kws) - return aux @@ -91,32 +87,30 @@ def __exit__(self, exc_type, exc_value, traceback): class _SessionBase(object): - """Base class for all NI-DMM sessions.""" + '''Base class for all NI-DMM sessions.''' # This is needed during __init__. Without it, __setattr__ raises an exception _is_frozen = False ac_max_freq = _attributes.AttributeViReal64(1250007) - """Type: float + '''Type: float Specifies the maximum frequency component of the input signal for AC measurements. This property is used only for error checking and verifies that the value of this parameter is less than the maximum frequency of the device. This property affects the DMM only when you set the method property to AC measurements. The valid range is 1 Hz-300 kHz for the NI 4070/4071/4072, 10 Hz-100 kHz for the NI 4065, and 20 Hz-25 kHz for the NI 4050 and NI 4060. - """ + ''' ac_min_freq = _attributes.AttributeViReal64(1250006) - """Type: float + '''Type: float Specifies the minimum frequency component of the input signal for AC measurements. This property affects the DMM only when you set the method property to AC measurements. The valid range is 1 Hz-300 kHz for the NI 4070/4071/4072, 10 Hz-100 kHz for the NI 4065, and 20 Hz-25 kHz for the NI 4050 and NI 4060. - """ - adc_calibration = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.ADCCalibration, 1150022 - ) - """Type: enums.ADCCalibration + ''' + adc_calibration = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ADCCalibration, 1150022) + '''Type: enums.ADCCalibration For the NI 4070/4071/4072 only, specifies the ADC calibration mode. - """ + ''' aperture_time = _attributes.AttributeViReal64(1250321) - """Type: float + '''Type: float Specifies the measurement aperture time for the current configuration. Aperture time is specified in units set by aperture_time_units. To override the default aperture, set this property to the desired aperture time after calling ConfigureMeasurement. To return to the default, set this property to NIDMM_VAL_APERTURE_TIME_AUTO (-1). On the NI 4070/4071/4072, the minimum aperture time is 8.89 usec, and the maximum aperture time is 149 sec. Any number of powerline cycles (PLCs) within the minimum and maximum ranges is allowed on the NI 4070/4071/4072. @@ -128,189 +122,173 @@ class _SessionBase(object): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - """ - aperture_time_units = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.ApertureTimeUnits, 1250322 - ) - """Type: enums.ApertureTimeUnits + ''' + aperture_time_units = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ApertureTimeUnits, 1250322) + '''Type: enums.ApertureTimeUnits Specifies the units of aperture time for the current configuration. The NI 4060 does not support an aperture time set in seconds. - """ + ''' auto_range_value = _attributes.AttributeViReal64(1250331) - """Type: float + '''Type: float Specifies the value of the range. If auto ranging, shows the actual value of the active range. The value of this property is set during a read operation. - """ - auto_zero = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.AutoZero, 1250332 - ) - """Type: enums.AutoZero + ''' + auto_zero = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.AutoZero, 1250332) + '''Type: enums.AutoZero Specifies the AutoZero mode. The NI 4050 is not supported. - """ + ''' buffer_size = _attributes.AttributeViInt32(1150037) - """Type: int + '''Type: int Size in samples of the internal data buffer. Maximum is 134,217,727 (OX7FFFFFF) samples. When set to NIDMM_VAL_BUFFER_SIZE_AUTO (-1), NI-DMM chooses the buffer size. Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - """ - cable_comp_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.CableCompensationType, 1150045 - ) - """Type: enums.CableCompensationType + ''' + cable_comp_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.CableCompensationType, 1150045) + '''Type: enums.CableCompensationType For the NI 4072 only, the type of cable compensation that is applied to the current capacitance or inductance measurement for the current range. Changing the method or the range through this property or through configure_measurement_digits resets the value of this property to the default value. - """ + ''' channel_count = _attributes.AttributeViInt32(1050203) - """Type: int + '''Type: int Indicates the number of channels that the specific instrument driver supports. For each property for which the IVI_VAL_MULTI_CHANNEL flag property is set, the IVI engine maintains a separate cache value for each channel. - """ + ''' current_source = _attributes.AttributeViReal64(1150025) - """Type: float + '''Type: float Specifies the current source provided during diode measurements. The NI 4050 and NI 4060 are not supported. - """ + ''' dc_bias = _attributes.AttributeViInt32(1150053) - """Type: int + '''Type: int For the NI 4072 only, controls the available DC bias for capacitance measurements. - """ - dc_noise_rejection = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.DCNoiseRejection, 1150026 - ) - """Type: enums.DCNoiseRejection + ''' + dc_noise_rejection = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.DCNoiseRejection, 1150026) + '''Type: enums.DCNoiseRejection Specifies the DC noise rejection mode. The NI 4050 and NI 4060 are not supported. - """ + ''' driver_setup = _attributes.AttributeViString(1050007) - """Type: str + '''Type: str This property indicates the Driver Setup string that the user specified when initializing the driver. Some cases exist where the end-user must specify instrument driver options at initialization time. An example of this is specifying a particular instrument model from among a family of instruments that the driver supports. This is useful when using simulation. The end-user can specify driver-specific options through the DriverSetup keyword in the optionsString parameter to the niDMM Init With Options.vi. If the user does not specify a Driver Setup string, this property returns an empty string. - """ + ''' freq_voltage_auto_range = _attributes.AttributeViReal64(1150044) - """Type: float + '''Type: float For the NI 4070/4071/4072 only, specifies the value of the frequency voltage range. If Auto Ranging, shows the actual value of the active frequency voltage range. If not Auto Ranging, the value of this property is the same as that of freq_voltage_range. - """ + ''' freq_voltage_range = _attributes.AttributeViReal64(1250101) - """Type: float + '''Type: float Specifies the maximum amplitude of the input signal for frequency measurements. - """ - function = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.Function, 1250001 - ) - """Type: enums.Function + ''' + function = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.Function, 1250001) + '''Type: enums.Function Specifies the measurement method. Refer to the method topic in the NI Digital Multimeters Help for device-specific information. If you are setting this property directly, you must also set the operation_mode property, which controls whether the DMM takes standard single or multipoint measurements, or acquires a waveform. If you are programming properties directly, you must set the operation_mode property before setting other configuration properties. If the operation_mode property is set to OperationMode.WAVEFORM, the only valid method types are Method.WAVEFORM_VOLTAGE and Method.WAVEFORM_CURRENT. Set the operation_mode property to OperationMode.IVIDMM to set all other method values. - """ + ''' input_resistance = _attributes.AttributeViReal64(1150029) - """Type: float + '''Type: float Specifies the input resistance of the instrument. The NI 4050 and NI 4060 are not supported. - """ + ''' instrument_firmware_revision = _attributes.AttributeViString(1050510) - """Type: str + '''Type: str A string containing the instrument firmware revision number. - """ + ''' instrument_manufacturer = _attributes.AttributeViString(1050511) - """Type: str + '''Type: str A string containing the manufacturer of the instrument. - """ + ''' instrument_model = _attributes.AttributeViString(1050512) - """Type: str + '''Type: str A string containing the instrument model. - """ + ''' instrument_product_id = _attributes.AttributeViInt32(1150061) - """Type: int + '''Type: int The PCI product ID. - """ + ''' io_resource_descriptor = _attributes.AttributeViString(1050304) - """Type: str + '''Type: str A string containing the resource descriptor of the instrument. - """ - lc_calculation_model = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.LCCalculationModel, 1150052 - ) - """Type: enums.LCCalculationModel + ''' + lc_calculation_model = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.LCCalculationModel, 1150052) + '''Type: enums.LCCalculationModel For the NI 4072 only, specifies the type of algorithm that the measurement processing uses for capacitance and inductance measurements. - """ + ''' lc_number_meas_to_average = _attributes.AttributeViInt32(1150055) - """Type: int + '''Type: int For the NI 4072 only, specifies the number of LC measurements that are averaged to produce one reading. - """ + ''' logical_name = _attributes.AttributeViString(1050305) - """Type: str + '''Type: str A string containing the logical name of the instrument. - """ - meas_complete_dest = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.MeasurementCompleteDest, 1250305 - ) - """Type: enums.MeasurementCompleteDest + ''' + meas_complete_dest = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.MeasurementCompleteDest, 1250305) + '''Type: enums.MeasurementCompleteDest Specifies the destination of the measurement complete (MC) signal. The NI 4050 is not supported. To determine which values are supported by each device, refer to the LabWindows/CVI Trigger Routing section in the NI Digital Multimeters Help. - """ + ''' number_of_averages = _attributes.AttributeViInt32(1150032) - """Type: int + '''Type: int Specifies the number of averages to perform in a measurement. For the NI 4070/4071/4072, applies only when the aperture time is not set to AUTO and Auto Zero is ON. The default is 1. The NI 4050 and NI 4060 are not supported. - """ + ''' offset_comp_ohms = _attributes.AttributeViInt32(1150023) - """Type: int + '''Type: int For the NI 4070/4071/4072 only, enables or disables offset compensated ohms. - """ + ''' open_cable_comp_conductance = _attributes.AttributeViReal64(1150049) - """Type: float + '''Type: float For the NI 4072 only, specifies the active part (conductance) of the open cable compensation. The valid range is any real number greater than 0. The default value (-1.0) indicates that compensation has not taken place. Changing the method or the range through this property or through configure_measurement_digits resets the value of this property to the default value. - """ + ''' open_cable_comp_susceptance = _attributes.AttributeViReal64(1150048) - """Type: float + '''Type: float For the NI 4072 only, specifies the reactive part (susceptance) of the open cable compensation. The valid range is any real number greater than 0. The default value (-1.0) indicates that compensation has not taken place. Changing the method or the range through this property or through configure_measurement_digits resets the value of this property to the default value. - """ - operation_mode = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.OperationMode, 1150014 - ) - """Type: enums.OperationMode + ''' + operation_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.OperationMode, 1150014) + '''Type: enums.OperationMode Specifies how the NI 4065 and NI 4070/4071/4072 acquire data. When you call configure_measurement_digits, NI-DMM sets this property to OperationMode.IVIDMM. When you call configure_waveform_acquisition, NI-DMM sets this property to OperationMode.WAVEFORM. If you are programming properties directly, you must set this property before setting other configuration properties. - """ + ''' powerline_freq = _attributes.AttributeViReal64(1250333) - """Type: float + '''Type: float Specifies the powerline frequency. The NI 4050 and NI 4060 use this value to select an aperture time to reject powerline noise by selecting the appropriate internal sample clock and filter. The NI 4065 and NI 4070/4071/4072 use this value to select a timebase for setting the aperture_time property in powerline cycles (PLCs). After configuring powerline frequency, set the aperture_time_units property to PLCs. When setting the aperture_time property, select the number of PLCs for the powerline frequency. For example, if powerline frequency = 50 Hz (or 20ms) and aperture time in PLCs = 5, then aperture time in Seconds = 20ms * 5 PLCs = 100 ms. Similarly, if powerline frequency = 60 Hz (or 16.667 ms) and aperture time in PLCs = 6, then aperture time in Seconds = 16.667 ms * 6 PLCs = 100 ms. - """ + ''' range = _attributes.AttributeViReal64(1250002) - """Type: float + '''Type: float Specifies the measurement range. Use positive values to represent the absolute value of the maximum expected measurement. The value is in units appropriate for the current value of the method property. For example, if method is set to NIDMM_VAL_VOLTS, the units are volts. The NI 4050 and NI 4060 only support Auto Range when the trigger and sample trigger is set to IMMEDIATE. @@ -323,197 +301,185 @@ class _SessionBase(object): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - """ + ''' resolution_absolute = _attributes.AttributeViReal64(1250008) - """Type: float + '''Type: float Specifies the measurement resolution in absolute units. Setting this property to higher values increases the measurement accuracy. Setting this property to lower values increases the measurement speed. NI-DMM ignores this property for capacitance and inductance measurements on the NI 4072. To achieve better resolution for such measurements, use the lc_number_meas_to_average property. - """ + ''' resolution_digits = _attributes.AttributeViReal64(1250003) - """Type: float + '''Type: float Specifies the measurement resolution in digits. Setting this property to higher values increases the measurement accuracy. Setting this property to lower values increases the measurement speed. NI-DMM ignores this property for capacitance and inductance measurements on the NI 4072. To achieve better resolution for such measurements, use the lc_number_meas_to_average property. - """ + ''' sample_count = _attributes.AttributeViInt32(1250301) - """Type: int + '''Type: int Specifies the number of measurements the DMM takes each time it receives a trigger in a multiple point acquisition. - """ + ''' sample_interval = _attributes.AttributeViReal64TimeDeltaSeconds(1250303) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the amount of time in seconds the DMM waits between measurement cycles. This property only applies when the sample_trigger property is set to INTERVAL. On the NI 4060, the value for this property is used as the settling time. When this property is set to 0, the NI 4060 does not settle between measurement cycles. The onboard timing resolution is 1 µs on the NI 4060. The NI 4065 and NI 4070/4071/4072 use the value specified in this property as additional delay. On the NI 4065 and NI 4070/4071/4072, the onboard timing resolution is 34.72 ns and the valid range is 0-149 s. Only positive values are valid when setting the sample interval. The NI 4050 is not supported. - """ - sample_trigger = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.SampleTrigger, 1250302 - ) - """Type: enums.SampleTrigger + ''' + sample_trigger = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.SampleTrigger, 1250302) + '''Type: enums.SampleTrigger Specifies the sample trigger source. To determine which values are supported by each device, refer to the LabWindows/CVI Trigger Routing section in the NI Digital Multimeters Help. - """ + ''' serial_number = _attributes.AttributeViString(1150054) - """Type: str + '''Type: str A string containing the serial number of the instrument. This property corresponds to the serial number label that is attached to most products. - """ + ''' settle_time = _attributes.AttributeViReal64TimeDeltaSeconds(1150028) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the settling time in seconds. To override the default settling time, set this property. To return to the default, set this property to NIDMM_VAL_SETTLE_TIME_AUTO (-1). The NI 4050 and NI 4060 are not supported. Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - """ + ''' short_cable_comp_reactance = _attributes.AttributeViReal64(1150046) - """Type: float + '''Type: float For the NI 4072 only, represents the reactive part (reactance) of the short cable compensation. The valid range is any real number greater than 0. The default value (-1) indicates that compensation has not taken place. Changing the method or the range through this property or through configure_measurement_digits resets the value of this property to the default value. - """ + ''' short_cable_comp_resistance = _attributes.AttributeViReal64(1150047) - """Type: float + '''Type: float For the NI 4072 only, represents the active part (resistance) of the short cable compensation. The valid range is any real number greater than 0. The default value (-1) indicates that compensation has not taken place. Changing the method or the range through this property or through configure_measurement_digits resets the value of this property to the default value. - """ + ''' simulate = _attributes.AttributeViBoolean(1050005) - """Type: bool + '''Type: bool Specifies whether or not to simulate instrument driver I/O operations. If simulation is enabled, instrument driver methods perform range checking and call IVI Get and Set methods, but they do not perform instrument I/O. For output parameters that represent instrument data, the instrument driver methods return calculated values. The default value is False (0). Use the __init__ method to override this setting. Simulate can only be set within the InitWithOptions method. The property value cannot be changed outside of the method. - """ + ''' specific_driver_description = _attributes.AttributeViString(1050514) - """Type: str + '''Type: str A string containing a description of the specific driver. - """ + ''' specific_driver_major_version = _attributes.AttributeViInt32(1050503) - """Type: int + '''Type: int Returns the major version number of this instrument driver. - """ + ''' specific_driver_minor_version = _attributes.AttributeViInt32(1050504) - """Type: int + '''Type: int The minor version number of this instrument driver. - """ + ''' specific_driver_revision = _attributes.AttributeViString(1050551) - """Type: str + '''Type: str A string that contains additional version information about this specific instrument driver. - """ + ''' specific_driver_vendor = _attributes.AttributeViString(1050513) - """Type: str + '''Type: str A string containing the vendor of the specific driver. - """ + ''' supported_instrument_models = _attributes.AttributeViString(1050327) - """Type: str + '''Type: str A string containing the instrument models supported by the specific driver. - """ + ''' temp_rtd_a = _attributes.AttributeViReal64(1150121) - """Type: float + '''Type: float Specifies the Callendar-Van Dusen A coefficient for RTD scaling when the RTD Type property is set to Custom. The default value is 3.9083e-3 (Pt3851). - """ + ''' temp_rtd_b = _attributes.AttributeViReal64(1150122) - """Type: float + '''Type: float Specifies the Callendar-Van Dusen B coefficient for RTD scaling when the RTD Type property is set to Custom. The default value is -5.775e-7(Pt3851). - """ + ''' temp_rtd_c = _attributes.AttributeViReal64(1150123) - """Type: float + '''Type: float Specifies the Callendar-Van Dusen C coefficient for RTD scaling when the RTD Type property is set to Custom. The default value is -4.183e-12(Pt3851). - """ + ''' temp_rtd_res = _attributes.AttributeViReal64(1250242) - """Type: float + '''Type: float Specifies the RTD resistance at 0 degrees Celsius. This applies to all supported RTDs, including custom RTDs. The default value is 100 (?). - """ - temp_rtd_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.RTDType, 1150120 - ) - """Type: enums.RTDType + ''' + temp_rtd_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.RTDType, 1150120) + '''Type: enums.RTDType Specifies the type of RTD used to measure temperature. The default value is RTDType.PT3851. Refer to the temp_rtd_type topic in the NI Digital Multimeters Help for additional information about defined values. - """ + ''' temp_tc_fixed_ref_junc = _attributes.AttributeViReal64(1250233) - """Type: float + '''Type: float Specifies the reference junction temperature when a fixed reference junction is used to take a thermocouple measurement. The default value is 25.0 (°C). - """ - temp_tc_ref_junc_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.ThermocoupleReferenceJunctionType, 1250232 - ) - """Type: enums.ThermocoupleReferenceJunctionType + ''' + temp_tc_ref_junc_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ThermocoupleReferenceJunctionType, 1250232) + '''Type: enums.ThermocoupleReferenceJunctionType Specifies the type of reference junction to be used in the reference junction compensation of a thermocouple. The only supported value, NIDMM_VAL_TEMP_REF_JUNC_FIXED, is fixed. Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - """ - temp_tc_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.ThermocoupleType, 1250231 - ) - """Type: enums.ThermocoupleType + ''' + temp_tc_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ThermocoupleType, 1250231) + '''Type: enums.ThermocoupleType Specifies the type of thermocouple used to measure the temperature. The default value is ThermocoupleType.J. - """ + ''' temp_thermistor_a = _attributes.AttributeViReal64(1150125) - """Type: float + '''Type: float Specifies the Steinhart-Hart A coefficient for thermistor scaling when the Thermistor Type property is set to Custom. The default value is 0.0010295 (44006). - """ + ''' temp_thermistor_b = _attributes.AttributeViReal64(1150126) - """Type: float + '''Type: float Specifies the Steinhart-Hart B coefficient for thermistor scaling when the Thermistor Type proerty is set to Custom. The default value is 0.0002391 (44006). - """ + ''' temp_thermistor_c = _attributes.AttributeViReal64(1150127) - """Type: float + '''Type: float Specifies the Steinhart-Hart C coefficient for thermistor scaling when the Thermistor Type property is set to Custom. The default value is 1.568e-7 (44006). - """ - temp_thermistor_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.ThermistorType, 1150124 - ) - """Type: enums.ThermistorType + ''' + temp_thermistor_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ThermistorType, 1150124) + '''Type: enums.ThermistorType Specifies the type of thermistor used to measure the temperature. The default value is ThermistorType.THERMISTOR_44006. Refer to the temp_thermistor_type topic in the NI Digital Multimeters Help for additional information about defined values. - """ - temp_transducer_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TransducerType, 1250201 - ) - """Type: enums.TransducerType + ''' + temp_transducer_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TransducerType, 1250201) + '''Type: enums.TransducerType Specifies the type of device used to measure the temperature. The default value is NIDMM_VAL_4_THERMOCOUPLE. Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - """ + ''' trigger_count = _attributes.AttributeViInt32(1250304) - """Type: int + '''Type: int Specifies the number of triggers the DMM receives before returning to the Idle state. This property can be set to any positive ViInt32 value for the NI 4065 and NI 4070/4071/4072. The NI 4050 and NI 4060 support this property being set to 1. Refer to the Multiple Point Acquisitions section of the NI Digital Multimeters Help for more information. - """ + ''' trigger_delay = _attributes.AttributeViReal64TimeDeltaSeconds(1250005) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the time (in seconds) that the DMM waits after it has received a trigger before taking a measurement. The default value is AUTO DELAY (-1), which means that the DMM waits an appropriate settling time before taking the measurement. (-1) signifies that AUTO DELAY is on, and (-2) signifies that AUTO DELAY is off. The NI 4065 and NI 4070/4071/4072 use the value specified in this property as additional settling time. For the The NI 4065 and NI 4070/4071/4072, the valid range for Trigger Delay is AUTO DELAY (-1) or 0.0-149.0 seconds and the onboard timing resolution is 34.72 ns. @@ -525,70 +491,60 @@ class _SessionBase(object): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - """ - trigger_source = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TriggerSource, 1250004 - ) - """Type: enums.TriggerSource + ''' + trigger_source = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerSource, 1250004) + '''Type: enums.TriggerSource Specifies the trigger source. When _initiate is called, the DMM waits for the trigger specified with this property. After it receives the trigger, the DMM waits the length of time specified with the trigger_delay property. The DMM then takes a measurement. This property is not supported on the NI 4050. To determine which values are supported by each device, refer to the LabWindows/CVI Trigger Routing section in the NI Digital Multimeters Help. - """ - waveform_coupling = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.WaveformCoupling, 1150027 - ) - """Type: enums.WaveformCoupling + ''' + waveform_coupling = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.WaveformCoupling, 1150027) + '''Type: enums.WaveformCoupling For the NI 4070/4071/4072 only, specifies the coupling during a waveform acquisition. - """ + ''' waveform_points = _attributes.AttributeViInt32(1150019) - """Type: int + '''Type: int For the NI 4070/4071/4072 only, specifies the number of points to acquire in a waveform acquisition. - """ + ''' waveform_rate = _attributes.AttributeViReal64(1150018) - """Type: float + '''Type: float For the NI 4070/4071/4072 only, specifies the rate of the waveform acquisition in Samples per second (S/s). The valid Range is 10.0-1,800,000 S/s. Values are coerced to the closest integer divisor of 1,800,000. The default value is 1,800,000. - """ + ''' - def __init__( - self, repeated_capability_list, vi, library, encoding, freeze_it=False - ): + def __init__(self, repeated_capability_list, vi, library, encoding, freeze_it=False): self._repeated_capability_list = repeated_capability_list - self._repeated_capability = ",".join(repeated_capability_list) + self._repeated_capability = ','.join(repeated_capability_list) self._vi = vi self._library = library self._encoding = encoding # Store the parameter list for later printing in __repr__ param_list = [] - param_list.append( - "repeated_capability_list=" + pp.pformat(repeated_capability_list) - ) + param_list.append("repeated_capability_list=" + pp.pformat(repeated_capability_list)) param_list.append("vi=" + pp.pformat(vi)) param_list.append("library=" + pp.pformat(library)) param_list.append("encoding=" + pp.pformat(encoding)) - self._param_list = ", ".join(param_list) + self._param_list = ', '.join(param_list) self._is_frozen = freeze_it def __repr__(self): - return "{0}.{1}({2})".format("nidmm", self.__class__.__name__, self._param_list) + return '{0}.{1}({2})'.format('nidmm', self.__class__.__name__, self._param_list) def __setattr__(self, key, value): if self._is_frozen and key not in dir(self): - raise AttributeError( - "'{0}' object has no attribute '{1}'".format(type(self).__name__, key) - ) + raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) object.__setattr__(self, key, value) def _get_error_description(self, error_code): - """_get_error_description + '''_get_error_description Returns the error description. - """ + ''' try: _, error_string = self._get_error() return error_string @@ -596,21 +552,21 @@ def _get_error_description(self, error_code): pass try: - """ + ''' It is expected for _get_error to raise when the session is invalid (IVI spec requires GetError to fail). Use _error_message instead. It doesn't require a session. - """ + ''' error_string = self._error_message(error_code) return error_string except errors.Error: return "Failed to retrieve error description." - """ These are code-generated """ + ''' These are code-generated ''' @ivi_synchronized def _get_attribute_vi_boolean(self, attribute_id): - r"""_get_attribute_vi_boolean + r'''_get_attribute_vi_boolean Queries the value of a ViBoolean property. You can use this method to get the values of instrument-specific properties and inherent IVI @@ -642,29 +598,18 @@ def _get_attribute_vi_boolean(self, attribute_id): attribute_value (bool): Returns the current value of the property. Pass the address of a ViBoolean variable. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niDMM_GetAttributeViBoolean( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - None - if attribute_value_ctype is None - else (ctypes.pointer(attribute_value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_GetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_int32(self, attribute_id): - r"""_get_attribute_vi_int32 + r'''_get_attribute_vi_int32 Queries the value of a ViInt32 property. You can use this method to get the values of instrument-specific properties and inherent IVI @@ -696,29 +641,18 @@ def _get_attribute_vi_int32(self, attribute_id): attribute_value (int): Returns the current value of the property. Pass the address of a ViInt32 variable. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDMM_GetAttributeViInt32( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - None - if attribute_value_ctype is None - else (ctypes.pointer(attribute_value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_GetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_real64(self, attribute_id): - r"""_get_attribute_vi_real64 + r'''_get_attribute_vi_real64 Queries the value of a ViReal64 property. You can use this method to get the values of instrument-specific properties and inherent IVI @@ -750,29 +684,18 @@ def _get_attribute_vi_real64(self, attribute_id): attribute_value (float): Returns the current value of the property. Pass the address of a ViReal64 variable. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDMM_GetAttributeViReal64( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - None - if attribute_value_ctype is None - else (ctypes.pointer(attribute_value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_GetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_string(self, attribute_id): - r"""_get_attribute_vi_string + r'''_get_attribute_vi_string Queries the value of a ViString property. You can use this method to get the values of instrument-specific properties and inherent IVI @@ -811,42 +734,22 @@ def _get_attribute_vi_string(self, attribute_id): If you specify 0 for the **Buffer_Size** parameter, you can pass VI_NULL for this parameter. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 buffer_size_ctype = _visatype.ViInt32() # case S170 attribute_value_ctype = None # case C050 - error_code = self._library.niDMM_GetAttributeViString( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - buffer_size_ctype, - attribute_value_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niDMM_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, buffer_size_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - attribute_value_ctype = ( - _visatype.ViChar * buffer_size_ctype.value - )() # case C060 - error_code = self._library.niDMM_GetAttributeViString( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - buffer_size_ctype, - attribute_value_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + attribute_value_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 + error_code = self._library.niDMM_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, buffer_size_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return attribute_value_ctype.value.decode(self._encoding) def _get_error(self): - r"""_get_error + r'''_get_error Returns the error information associated with the **Instrument_Handle**. This method retrieves and then clears the @@ -865,37 +768,21 @@ def _get_error(self): you specify with the **Buffer_Size** parameter. If you pass 0 for the **Buffer_Size**, you can pass VI_NULL for this parameter. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus() # case S220 buffer_size_ctype = _visatype.ViInt32() # case S170 description_ctype = None # case C050 - error_code = self._library.niDMM_GetError( - vi_ctype, - None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), - buffer_size_ctype, - description_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=True - ) + error_code = self._library.niDMM_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), buffer_size_ctype, description_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 description_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niDMM_GetError( - vi_ctype, - None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), - buffer_size_ctype, - description_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) - return int(error_code_ctype.value), description_ctype.value.decode( - self._encoding - ) + error_code = self._library.niDMM_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), buffer_size_ctype, description_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + return int(error_code_ctype.value), description_ctype.value.decode(self._encoding) def lock(self): - """lock + '''lock Obtains a multithread lock on the device session. Before doing so, the software waits until all other execution threads release their locks @@ -923,27 +810,25 @@ def lock(self): Returns: lock (context manager): When used in a with statement, nidmm.Session.lock acts as a context manager and unlock will be called when the with block is exited - """ + ''' self._lock_session() # We do not call _lock_session() in the context manager so that this function can # act standalone as well and let the client call unlock() explicitly. If they do use the context manager, # that will handle the unlock for them return _Lock(self) def _lock_session(self): - """_lock_session + '''_lock_session Actual call to driver - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDMM_LockSession(vi_ctype, None) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return @ivi_synchronized def _set_attribute_vi_boolean(self, attribute_id, attribute_value): - r"""_set_attribute_vi_boolean + r'''_set_attribute_vi_boolean This method sets the value of a ViBoolean property. @@ -987,24 +872,18 @@ def _set_attribute_vi_boolean(self, attribute_id, attribute_value): attribute_value (bool): Pass the value that you want to set the property to. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViBoolean(attribute_value) # case S150 - error_code = self._library.niDMM_SetAttributeViBoolean( - vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_SetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_int32(self, attribute_id, attribute_value): - r"""_set_attribute_vi_int32 + r'''_set_attribute_vi_int32 This method sets the value of a ViInt32 property. @@ -1048,24 +927,18 @@ def _set_attribute_vi_int32(self, attribute_id, attribute_value): attribute_value (int): Pass the value that you want to set the property to. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt32(attribute_value) # case S150 - error_code = self._library.niDMM_SetAttributeViInt32( - vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_SetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_real64(self, attribute_id, attribute_value): - r"""_set_attribute_vi_real64 + r'''_set_attribute_vi_real64 This method sets the value of a ViReal64 property. @@ -1109,24 +982,18 @@ def _set_attribute_vi_real64(self, attribute_id, attribute_value): attribute_value (float): Pass the value that you want to set the property to. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViReal64(attribute_value) # case S150 - error_code = self._library.niDMM_SetAttributeViReal64( - vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_SetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_string(self, attribute_id, attribute_value): - r"""_set_attribute_vi_string + r'''_set_attribute_vi_string This method sets the value of a ViString property. @@ -1170,39 +1037,29 @@ def _set_attribute_vi_string(self, attribute_id, attribute_value): attribute_value (str): Pass the value that you want to set the property to. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 - attribute_value_ctype = ctypes.create_string_buffer( - attribute_value.encode(self._encoding) - ) # case C020 - error_code = self._library.niDMM_SetAttributeViString( - vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + attribute_value_ctype = ctypes.create_string_buffer(attribute_value.encode(self._encoding)) # case C020 + error_code = self._library.niDMM_SetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def unlock(self): - """unlock + '''unlock Releases a lock that you acquired on an device session using lock. Refer to lock for additional information on session locks. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDMM_UnlockSession(vi_ctype, None) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return def _error_message(self, error_code): - r"""_error_message + r'''_error_message Takes the **Error_Code** returned by the instrument driver methods, interprets it, and returns it as a user-readable string. @@ -1215,24 +1072,20 @@ def _error_message(self, error_code): Returns: error_message (str): The error information formatted into a string. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus(error_code) # case S150 error_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niDMM_error_message( - vi_ctype, error_code_ctype, error_message_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + error_code = self._library.niDMM_error_message(vi_ctype, error_code_ctype, error_message_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return error_message_ctype.value.decode(self._encoding) class Session(_SessionBase): - """An NI-DMM session to a National Instruments Digital Multimeter""" + '''An NI-DMM session to a National Instruments Digital Multimeter''' def __init__(self, resource_name, id_query=False, reset_device=False, options={}): - r"""An NI-DMM session to a National Instruments Digital Multimeter + r'''An NI-DMM session to a National Instruments Digital Multimeter This method completes the following tasks: @@ -1330,30 +1183,22 @@ def __init__(self, resource_name, id_query=False, reset_device=False, options={} Returns: session (nidmm.Session): A session object representing the device. - """ - super(Session, self).__init__( - repeated_capability_list=[], - vi=None, - library=None, - encoding=None, - freeze_it=False, - ) + ''' + super(Session, self).__init__(repeated_capability_list=[], vi=None, library=None, encoding=None, freeze_it=False) options = _converters.convert_init_with_options_dictionary(options) self._library = _library_singleton.get() - self._encoding = "windows-1251" + self._encoding = 'windows-1251' # Call specified init function self._vi = 0 # This must be set before calling _init_with_options(). - self._vi = self._init_with_options( - resource_name, id_query, reset_device, options - ) + self._vi = self._init_with_options(resource_name, id_query, reset_device, options) # Store the parameter list for later printing in __repr__ param_list = [] param_list.append("resource_name=" + pp.pformat(resource_name)) param_list.append("reset_device=" + pp.pformat(reset_device)) param_list.append("options=" + pp.pformat(options)) - self._param_list = ", ".join(param_list) + self._param_list = ', '.join(param_list) self._is_frozen = True @@ -1364,7 +1209,7 @@ def __exit__(self, exc_type, exc_value, traceback): self.close() def initiate(self): - """initiate + '''initiate Initiates an acquisition. After you call this method, the DMM leaves the Idle state and enters the Wait-for-Trigger state. If trigger is set @@ -1374,17 +1219,17 @@ def initiate(self): Note: This method will return a Python context manager that will initiate on entering and abort on exit. - """ + ''' return _Acquisition(self) def close(self): - """close + '''close Closes the specified session and deallocates resources that it reserved. Note: This method is not needed when using the session context manager - """ + ''' try: self._close() except errors.DriverError: @@ -1392,27 +1237,23 @@ def close(self): raise self._vi = 0 - """ These are code-generated """ + ''' These are code-generated ''' @ivi_synchronized def abort(self): - r"""abort + r'''abort Aborts a previously initiated measurement and returns the DMM to the Idle state. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDMM_Abort(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def configure_measurement_absolute( - self, measurement_function, range, resolution_absolute - ): - r"""configure_measurement_absolute + def configure_measurement_absolute(self, measurement_function, range, resolution_absolute): + r'''configure_measurement_absolute Configures the common properties of the measurement. These properties include method, range, and @@ -1466,30 +1307,20 @@ def configure_measurement_absolute( Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - """ + ''' if type(measurement_function) is not enums.Function: - raise TypeError( - "Parameter measurement_function must be of type " + str(enums.Function) - ) + raise TypeError('Parameter measurement_function must be of type ' + str(enums.Function)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - measurement_function_ctype = _visatype.ViInt32( - measurement_function.value - ) # case S130 + measurement_function_ctype = _visatype.ViInt32(measurement_function.value) # case S130 range_ctype = _visatype.ViReal64(range) # case S150 resolution_absolute_ctype = _visatype.ViReal64(resolution_absolute) # case S150 - error_code = self._library.niDMM_ConfigureMeasurementAbsolute( - vi_ctype, measurement_function_ctype, range_ctype, resolution_absolute_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_ConfigureMeasurementAbsolute(vi_ctype, measurement_function_ctype, range_ctype, resolution_absolute_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def configure_measurement_digits( - self, measurement_function, range, resolution_digits - ): - r"""configure_measurement_digits + def configure_measurement_digits(self, measurement_function, range, resolution_digits): + r'''configure_measurement_digits Configures the common properties of the measurement. These properties include method, range, and @@ -1544,34 +1375,20 @@ def configure_measurement_digits( Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - """ + ''' if type(measurement_function) is not enums.Function: - raise TypeError( - "Parameter measurement_function must be of type " + str(enums.Function) - ) + raise TypeError('Parameter measurement_function must be of type ' + str(enums.Function)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - measurement_function_ctype = _visatype.ViInt32( - measurement_function.value - ) # case S130 + measurement_function_ctype = _visatype.ViInt32(measurement_function.value) # case S130 range_ctype = _visatype.ViReal64(range) # case S150 resolution_digits_ctype = _visatype.ViReal64(resolution_digits) # case S150 - error_code = self._library.niDMM_ConfigureMeasurementDigits( - vi_ctype, measurement_function_ctype, range_ctype, resolution_digits_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_ConfigureMeasurementDigits(vi_ctype, measurement_function_ctype, range_ctype, resolution_digits_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def configure_multi_point( - self, - trigger_count, - sample_count, - sample_trigger=enums.SampleTrigger.IMMEDIATE, - sample_interval=hightime.timedelta(seconds=-1), - ): - r"""configure_multi_point + def configure_multi_point(self, trigger_count, sample_count, sample_trigger=enums.SampleTrigger.IMMEDIATE, sample_interval=hightime.timedelta(seconds=-1)): + r'''configure_multi_point Configures the properties for multipoint measurements. These properties include trigger_count, sample_count, @@ -1617,33 +1434,21 @@ def configure_multi_point( Note: This property is not used on the NI 4080/4081/4082 and the NI 4050. - """ + ''' if type(sample_trigger) is not enums.SampleTrigger: - raise TypeError( - "Parameter sample_trigger must be of type " + str(enums.SampleTrigger) - ) + raise TypeError('Parameter sample_trigger must be of type ' + str(enums.SampleTrigger)) vi_ctype = _visatype.ViSession(self._vi) # case S110 trigger_count_ctype = _visatype.ViInt32(trigger_count) # case S150 sample_count_ctype = _visatype.ViInt32(sample_count) # case S150 sample_trigger_ctype = _visatype.ViInt32(sample_trigger.value) # case S130 - sample_interval_ctype = _converters.convert_timedelta_to_seconds_real64( - sample_interval - ) # case S140 - error_code = self._library.niDMM_ConfigureMultiPoint( - vi_ctype, - trigger_count_ctype, - sample_count_ctype, - sample_trigger_ctype, - sample_interval_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + sample_interval_ctype = _converters.convert_timedelta_to_seconds_real64(sample_interval) # case S140 + error_code = self._library.niDMM_ConfigureMultiPoint(vi_ctype, trigger_count_ctype, sample_count_ctype, sample_trigger_ctype, sample_interval_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def configure_rtd_custom(self, rtd_a, rtd_b, rtd_c): - r"""configure_rtd_custom + r'''configure_rtd_custom Configures the A, B, and C parameters for a custom RTD. @@ -1660,22 +1465,18 @@ def configure_rtd_custom(self, rtd_a, rtd_b, rtd_c): Type parameter is set to Custom in the configure_rtd_type method. The default is -4.183e-12 (Pt3851). - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 rtd_a_ctype = _visatype.ViReal64(rtd_a) # case S150 rtd_b_ctype = _visatype.ViReal64(rtd_b) # case S150 rtd_c_ctype = _visatype.ViReal64(rtd_c) # case S150 - error_code = self._library.niDMM_ConfigureRTDCustom( - vi_ctype, rtd_a_ctype, rtd_b_ctype, rtd_c_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_ConfigureRTDCustom(vi_ctype, rtd_a_ctype, rtd_b_ctype, rtd_c_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def configure_rtd_type(self, rtd_type, rtd_resistance): - r"""configure_rtd_type + r'''configure_rtd_type Configures the RTD Type and RTD Resistance parameters for an RTD. @@ -1707,23 +1508,19 @@ def configure_rtd_type(self, rtd_type, rtd_resistance): rtd_resistance (float): Specifies the RTD resistance in ohms at 0 °C. NI-DMM uses this value to set the RTD Resistance property. The default is 100 (Ω). - """ + ''' if type(rtd_type) is not enums.RTDType: - raise TypeError("Parameter rtd_type must be of type " + str(enums.RTDType)) + raise TypeError('Parameter rtd_type must be of type ' + str(enums.RTDType)) vi_ctype = _visatype.ViSession(self._vi) # case S110 rtd_type_ctype = _visatype.ViInt32(rtd_type.value) # case S130 rtd_resistance_ctype = _visatype.ViReal64(rtd_resistance) # case S150 - error_code = self._library.niDMM_ConfigureRTDType( - vi_ctype, rtd_type_ctype, rtd_resistance_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_ConfigureRTDType(vi_ctype, rtd_type_ctype, rtd_resistance_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def configure_thermistor_custom(self, thermistor_a, thermistor_b, thermistor_c): - r"""configure_thermistor_custom + r'''configure_thermistor_custom Configures the A, B, and C parameters for a custom thermistor. @@ -1749,26 +1546,18 @@ def configure_thermistor_custom(self, thermistor_a, thermistor_b, thermistor_c): Note: One or more of the referenced methods are not in the Python API for this driver. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 thermistor_a_ctype = _visatype.ViReal64(thermistor_a) # case S150 thermistor_b_ctype = _visatype.ViReal64(thermistor_b) # case S150 thermistor_c_ctype = _visatype.ViReal64(thermistor_c) # case S150 - error_code = self._library.niDMM_ConfigureThermistorCustom( - vi_ctype, thermistor_a_ctype, thermistor_b_ctype, thermistor_c_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_ConfigureThermistorCustom(vi_ctype, thermistor_a_ctype, thermistor_b_ctype, thermistor_c_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def configure_thermocouple( - self, - thermocouple_type, - reference_junction_type=enums.ThermocoupleReferenceJunctionType.FIXED, - ): - r"""configure_thermocouple + def configure_thermocouple(self, thermocouple_type, reference_junction_type=enums.ThermocoupleReferenceJunctionType.FIXED): + r'''configure_thermocouple Configures the thermocouple type and reference junction type for a chosen thermocouple. @@ -1804,37 +1593,21 @@ def configure_thermocouple( Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - """ + ''' if type(thermocouple_type) is not enums.ThermocoupleType: - raise TypeError( - "Parameter thermocouple_type must be of type " - + str(enums.ThermocoupleType) - ) + raise TypeError('Parameter thermocouple_type must be of type ' + str(enums.ThermocoupleType)) if type(reference_junction_type) is not enums.ThermocoupleReferenceJunctionType: - raise TypeError( - "Parameter reference_junction_type must be of type " - + str(enums.ThermocoupleReferenceJunctionType) - ) + raise TypeError('Parameter reference_junction_type must be of type ' + str(enums.ThermocoupleReferenceJunctionType)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - thermocouple_type_ctype = _visatype.ViInt32( - thermocouple_type.value - ) # case S130 - reference_junction_type_ctype = _visatype.ViInt32( - reference_junction_type.value - ) # case S130 - error_code = self._library.niDMM_ConfigureThermocouple( - vi_ctype, thermocouple_type_ctype, reference_junction_type_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + thermocouple_type_ctype = _visatype.ViInt32(thermocouple_type.value) # case S130 + reference_junction_type_ctype = _visatype.ViInt32(reference_junction_type.value) # case S130 + error_code = self._library.niDMM_ConfigureThermocouple(vi_ctype, thermocouple_type_ctype, reference_junction_type_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def configure_trigger( - self, trigger_source, trigger_delay=hightime.timedelta(seconds=-1) - ): - r"""configure_trigger + def configure_trigger(self, trigger_source, trigger_delay=hightime.timedelta(seconds=-1)): + r'''configure_trigger Configures the DMM **Trigger_Source** and **Trigger_Delay**. Refer to `Triggering `__ and `Using @@ -1868,29 +1641,19 @@ def configure_trigger( Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - """ + ''' if type(trigger_source) is not enums.TriggerSource: - raise TypeError( - "Parameter trigger_source must be of type " + str(enums.TriggerSource) - ) + raise TypeError('Parameter trigger_source must be of type ' + str(enums.TriggerSource)) vi_ctype = _visatype.ViSession(self._vi) # case S110 trigger_source_ctype = _visatype.ViInt32(trigger_source.value) # case S130 - trigger_delay_ctype = _converters.convert_timedelta_to_seconds_real64( - trigger_delay - ) # case S140 - error_code = self._library.niDMM_ConfigureTrigger( - vi_ctype, trigger_source_ctype, trigger_delay_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + trigger_delay_ctype = _converters.convert_timedelta_to_seconds_real64(trigger_delay) # case S140 + error_code = self._library.niDMM_ConfigureTrigger(vi_ctype, trigger_source_ctype, trigger_delay_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def configure_waveform_acquisition( - self, measurement_function, range, rate, waveform_points - ): - r"""configure_waveform_acquisition + def configure_waveform_acquisition(self, measurement_function, range, rate, waveform_points): + r'''configure_waveform_acquisition Configures the DMM for waveform acquisitions. This feature is supported on the NI 4080/4081/4082 and the NI 4070/4071/4072. @@ -1932,48 +1695,34 @@ def configure_waveform_acquisition( The default value is 500. - """ + ''' if type(measurement_function) is not enums.Function: - raise TypeError( - "Parameter measurement_function must be of type " + str(enums.Function) - ) + raise TypeError('Parameter measurement_function must be of type ' + str(enums.Function)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - measurement_function_ctype = _visatype.ViInt32( - measurement_function.value - ) # case S130 + measurement_function_ctype = _visatype.ViInt32(measurement_function.value) # case S130 range_ctype = _visatype.ViReal64(range) # case S150 rate_ctype = _visatype.ViReal64(rate) # case S150 waveform_points_ctype = _visatype.ViInt32(waveform_points) # case S150 - error_code = self._library.niDMM_ConfigureWaveformAcquisition( - vi_ctype, - measurement_function_ctype, - range_ctype, - rate_ctype, - waveform_points_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_ConfigureWaveformAcquisition(vi_ctype, measurement_function_ctype, range_ctype, rate_ctype, waveform_points_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def disable(self): - r"""disable + r'''disable Places the instrument in a quiescent state where it has minimal or no impact on the system to which it is connected. If a measurement is in progress when this method is called, the measurement is aborted. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDMM_Disable(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def export_attribute_configuration_buffer(self): - r"""export_attribute_configuration_buffer + r'''export_attribute_configuration_buffer Exports the property configuration of the session to the specified configuration buffer. @@ -2015,33 +1764,23 @@ def export_attribute_configuration_buffer(self): configuration (bytes): Specifies the byte array buffer to be populated with the exported property configuration. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 size_ctype = _visatype.ViInt32() # case S170 configuration_ctype = None # case B580 - error_code = self._library.niDMM_ExportAttributeConfigurationBuffer( - vi_ctype, size_ctype, configuration_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niDMM_ExportAttributeConfigurationBuffer(vi_ctype, size_ctype, configuration_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) size_ctype = _visatype.ViInt32(error_code) # case S180 configuration_size = size_ctype.value # case B590 configuration_array = array.array("b", [0] * configuration_size) # case B590 - configuration_ctype = get_ctypes_pointer_for_buffer( - value=configuration_array, library_type=_visatype.ViInt8 - ) # case B590 - error_code = self._library.niDMM_ExportAttributeConfigurationBuffer( - vi_ctype, size_ctype, configuration_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + configuration_ctype = get_ctypes_pointer_for_buffer(value=configuration_array, library_type=_visatype.ViInt8) # case B590 + error_code = self._library.niDMM_ExportAttributeConfigurationBuffer(vi_ctype, size_ctype, configuration_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return _converters.convert_to_bytes(configuration_array) @ivi_synchronized def export_attribute_configuration_file(self, file_path): - r"""export_attribute_configuration_file + r'''export_attribute_configuration_file Exports the property configuration of the session to the specified file. @@ -2085,22 +1824,16 @@ def export_attribute_configuration_file(self, file_path): method returns an error. **Default file extension:**\ .nidmmconfig - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer( - file_path.encode(self._encoding) - ) # case C020 - error_code = self._library.niDMM_ExportAttributeConfigurationFile( - vi_ctype, file_path_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 + error_code = self._library.niDMM_ExportAttributeConfigurationFile(vi_ctype, file_path_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def fetch(self, maximum_time=hightime.timedelta(milliseconds=-1)): - r"""fetch + r'''fetch Returns the value from a previously initiated measurement. You must call _initiate before calling this method. @@ -2124,27 +1857,17 @@ def fetch(self, maximum_time=hightime.timedelta(milliseconds=-1)): Returns: reading (float): The measured value returned from the DMM. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32( - maximum_time - ) # case S140 + maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32(maximum_time) # case S140 reading_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDMM_Fetch( - vi_ctype, - maximum_time_ctype, - None if reading_ctype is None else (ctypes.pointer(reading_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_Fetch(vi_ctype, maximum_time_ctype, None if reading_ctype is None else (ctypes.pointer(reading_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(reading_ctype.value) @ivi_synchronized - def fetch_multi_point( - self, array_size, maximum_time=hightime.timedelta(milliseconds=-1) - ): - r"""fetch_multi_point + def fetch_multi_point(self, array_size, maximum_time=hightime.timedelta(milliseconds=-1)): + r'''fetch_multi_point Returns an array of values from a previously initiated multipoint measurement. The number of measurements the DMM makes is determined by @@ -2185,37 +1908,21 @@ def fetch_multi_point( actual_number_of_points (int): Indicates the number of measured values actually retrieved from the DMM. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32( - maximum_time - ) # case S140 + maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32(maximum_time) # case S140 array_size_ctype = _visatype.ViInt32(array_size) # case S210 reading_array_size = array_size # case B600 reading_array_array = array.array("d", [0] * reading_array_size) # case B600 - reading_array_ctype = get_ctypes_pointer_for_buffer( - value=reading_array_array, library_type=_visatype.ViReal64 - ) # case B600 + reading_array_ctype = get_ctypes_pointer_for_buffer(value=reading_array_array, library_type=_visatype.ViReal64) # case B600 actual_number_of_points_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDMM_FetchMultiPoint( - vi_ctype, - maximum_time_ctype, - array_size_ctype, - reading_array_ctype, - None - if actual_number_of_points_ctype is None - else (ctypes.pointer(actual_number_of_points_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_FetchMultiPoint(vi_ctype, maximum_time_ctype, array_size_ctype, reading_array_ctype, None if actual_number_of_points_ctype is None else (ctypes.pointer(actual_number_of_points_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return reading_array_array @ivi_synchronized - def fetch_waveform( - self, array_size, maximum_time=hightime.timedelta(milliseconds=-1) - ): - r"""fetch_waveform + def fetch_waveform(self, array_size, maximum_time=hightime.timedelta(milliseconds=-1)): + r'''fetch_waveform For the NI 4080/4081/4082 and the NI 4070/4071/4072, returns an array of values from a previously initiated waveform acquisition. You must call @@ -2248,37 +1955,21 @@ def fetch_waveform( actual_number_of_points (int): Indicates the number of measured values actually retrieved from the DMM. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32( - maximum_time - ) # case S140 + maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32(maximum_time) # case S140 array_size_ctype = _visatype.ViInt32(array_size) # case S210 waveform_array_size = array_size # case B600 waveform_array_array = array.array("d", [0] * waveform_array_size) # case B600 - waveform_array_ctype = get_ctypes_pointer_for_buffer( - value=waveform_array_array, library_type=_visatype.ViReal64 - ) # case B600 + waveform_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_array_array, library_type=_visatype.ViReal64) # case B600 actual_number_of_points_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDMM_FetchWaveform( - vi_ctype, - maximum_time_ctype, - array_size_ctype, - waveform_array_ctype, - None - if actual_number_of_points_ctype is None - else (ctypes.pointer(actual_number_of_points_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_FetchWaveform(vi_ctype, maximum_time_ctype, array_size_ctype, waveform_array_ctype, None if actual_number_of_points_ctype is None else (ctypes.pointer(actual_number_of_points_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return waveform_array_array @ivi_synchronized - def fetch_waveform_into( - self, waveform_array, maximum_time=hightime.timedelta(milliseconds=-1) - ): - r"""fetch_waveform + def fetch_waveform_into(self, waveform_array, maximum_time=hightime.timedelta(milliseconds=-1)): + r'''fetch_waveform For the NI 4080/4081/4082 and the NI 4070/4071/4072, returns an array of values from a previously initiated waveform acquisition. You must call @@ -2309,50 +2000,29 @@ def fetch_waveform_into( actual_number_of_points (int): Indicates the number of measured values actually retrieved from the DMM. - """ + ''' import numpy if type(waveform_array) is not numpy.ndarray: - raise TypeError( - "waveform_array must be {0}, is {1}".format( - numpy.ndarray, type(waveform_array) - ) - ) + raise TypeError('waveform_array must be {0}, is {1}'.format(numpy.ndarray, type(waveform_array))) if numpy.isfortran(waveform_array) is True: - raise TypeError("waveform_array must be in C-order") - if waveform_array.dtype is not numpy.dtype("float64"): - raise TypeError( - "waveform_array must be numpy.ndarray of dtype=float64, is " - + str(waveform_array.dtype) - ) + raise TypeError('waveform_array must be in C-order') + if waveform_array.dtype is not numpy.dtype('float64'): + raise TypeError('waveform_array must be numpy.ndarray of dtype=float64, is ' + str(waveform_array.dtype)) array_size = len(waveform_array) vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32( - maximum_time - ) # case S140 + maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32(maximum_time) # case S140 array_size_ctype = _visatype.ViInt32(array_size) # case S210 - waveform_array_ctype = get_ctypes_pointer_for_buffer( - value=waveform_array - ) # case B510 + waveform_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_array) # case B510 actual_number_of_points_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDMM_FetchWaveform( - vi_ctype, - maximum_time_ctype, - array_size_ctype, - waveform_array_ctype, - None - if actual_number_of_points_ctype is None - else (ctypes.pointer(actual_number_of_points_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_FetchWaveform(vi_ctype, maximum_time_ctype, array_size_ctype, waveform_array_ctype, None if actual_number_of_points_ctype is None else (ctypes.pointer(actual_number_of_points_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _get_cal_date_and_time(self, cal_type): - r"""_get_cal_date_and_time + r'''_get_cal_date_and_time Returns the date and time of the last calibration performed. @@ -2385,7 +2055,7 @@ def _get_cal_date_and_time(self, cal_type): minute (int): Indicates the **minute** of the last calibration. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 cal_type_ctype = _visatype.ViInt32(cal_type) # case S150 month_ctype = _visatype.ViInt32() # case S220 @@ -2393,29 +2063,13 @@ def _get_cal_date_and_time(self, cal_type): year_ctype = _visatype.ViInt32() # case S220 hour_ctype = _visatype.ViInt32() # case S220 minute_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDMM_GetCalDateAndTime( - vi_ctype, - cal_type_ctype, - None if month_ctype is None else (ctypes.pointer(month_ctype)), - None if day_ctype is None else (ctypes.pointer(day_ctype)), - None if year_ctype is None else (ctypes.pointer(year_ctype)), - None if hour_ctype is None else (ctypes.pointer(hour_ctype)), - None if minute_ctype is None else (ctypes.pointer(minute_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return ( - int(month_ctype.value), - int(day_ctype.value), - int(year_ctype.value), - int(hour_ctype.value), - int(minute_ctype.value), - ) + error_code = self._library.niDMM_GetCalDateAndTime(vi_ctype, cal_type_ctype, None if month_ctype is None else (ctypes.pointer(month_ctype)), None if day_ctype is None else (ctypes.pointer(day_ctype)), None if year_ctype is None else (ctypes.pointer(year_ctype)), None if hour_ctype is None else (ctypes.pointer(hour_ctype)), None if minute_ctype is None else (ctypes.pointer(minute_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return int(month_ctype.value), int(day_ctype.value), int(year_ctype.value), int(hour_ctype.value), int(minute_ctype.value) @ivi_synchronized def get_dev_temp(self, options=""): - r"""get_dev_temp + r'''get_dev_temp Returns the current **Temperature** of the device. @@ -2428,25 +2082,17 @@ def get_dev_temp(self, options=""): Returns: temperature (float): Returns the current **temperature** of the device. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - options_ctype = ctypes.create_string_buffer( - options.encode(self._encoding) - ) # case C020 + options_ctype = ctypes.create_string_buffer(options.encode(self._encoding)) # case C020 temperature_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDMM_GetDevTemp( - vi_ctype, - options_ctype, - None if temperature_ctype is None else (ctypes.pointer(temperature_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_GetDevTemp(vi_ctype, options_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(temperature_ctype.value) @ivi_synchronized def get_ext_cal_recommended_interval(self): - r"""get_ext_cal_recommended_interval + r'''get_ext_cal_recommended_interval Returns the recommended interval between external recalibration in **Months**. @@ -2457,20 +2103,16 @@ def get_ext_cal_recommended_interval(self): months (hightime.timedelta): Returns the recommended number of **months** between external calibrations. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 months_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDMM_GetExtCalRecommendedInterval( - vi_ctype, None if months_ctype is None else (ctypes.pointer(months_ctype)) - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_GetExtCalRecommendedInterval(vi_ctype, None if months_ctype is None else (ctypes.pointer(months_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return _converters.convert_month_to_timedelta(int(months_ctype.value)) @ivi_synchronized def get_cal_date_and_time(self, cal_type): - """get_cal_date_and_time + '''get_cal_date_and_time Returns the date and time of the last calibration performed. @@ -2494,13 +2136,13 @@ def get_cal_date_and_time(self, cal_type): Returns: month (hightime.datetime): Indicates date and time of the last calibration. - """ + ''' month, day, year, hour, minute = self._get_cal_date_and_time(cal_type) return hightime.datetime(year, month, day, hour, minute) @ivi_synchronized def get_last_cal_temp(self, cal_type): - r"""get_last_cal_temp + r'''get_last_cal_temp Returns the **Temperature** during the last calibration procedure. @@ -2525,23 +2167,17 @@ def get_last_cal_temp(self, cal_type): Returns: temperature (float): Returns the **temperature** during the last calibration. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 cal_type_ctype = _visatype.ViInt32(cal_type) # case S150 temperature_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDMM_GetLastCalTemp( - vi_ctype, - cal_type_ctype, - None if temperature_ctype is None else (ctypes.pointer(temperature_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_GetLastCalTemp(vi_ctype, cal_type_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(temperature_ctype.value) @ivi_synchronized def get_self_cal_supported(self): - r"""get_self_cal_supported + r'''get_self_cal_supported Returns a Boolean value that expresses whether or not the DMM that you are using can perform self-calibration. @@ -2556,23 +2192,16 @@ def get_self_cal_supported(self): | False | 0 | The DMM that you are using cannot perform self-calibration. | +-------+---+-------------------------------------------------------------+ - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 self_cal_supported_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niDMM_GetSelfCalSupported( - vi_ctype, - None - if self_cal_supported_ctype is None - else (ctypes.pointer(self_cal_supported_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_GetSelfCalSupported(vi_ctype, None if self_cal_supported_ctype is None else (ctypes.pointer(self_cal_supported_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(self_cal_supported_ctype.value) @ivi_synchronized def import_attribute_configuration_buffer(self, configuration): - r"""import_attribute_configuration_buffer + r'''import_attribute_configuration_buffer Imports a property configuration to the session from the specified configuration buffer. @@ -2610,28 +2239,18 @@ def import_attribute_configuration_buffer(self, configuration): configuration (bytes): Specifies the byte array buffer that contains the property configuration to import. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - size_ctype = _visatype.ViInt32( - 0 if configuration is None else len(configuration) - ) # case S160 - configuration_converted = _converters.convert_to_bytes( - configuration - ) # case B520 - configuration_ctype = get_ctypes_pointer_for_buffer( - value=configuration_converted, library_type=_visatype.ViInt8 - ) # case B520 - error_code = self._library.niDMM_ImportAttributeConfigurationBuffer( - vi_ctype, size_ctype, configuration_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + size_ctype = _visatype.ViInt32(0 if configuration is None else len(configuration)) # case S160 + configuration_converted = _converters.convert_to_bytes(configuration) # case B520 + configuration_ctype = get_ctypes_pointer_for_buffer(value=configuration_converted, library_type=_visatype.ViInt8) # case B520 + error_code = self._library.niDMM_ImportAttributeConfigurationBuffer(vi_ctype, size_ctype, configuration_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def import_attribute_configuration_file(self, file_path): - r"""import_attribute_configuration_file + r'''import_attribute_configuration_file Imports a property configuration to the session from the specified file. @@ -2671,23 +2290,15 @@ def import_attribute_configuration_file(self, file_path): method returns an error. **Default File Extension:**\ .nidmmconfig - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer( - file_path.encode(self._encoding) - ) # case C020 - error_code = self._library.niDMM_ImportAttributeConfigurationFile( - vi_ctype, file_path_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 + error_code = self._library.niDMM_ImportAttributeConfigurationFile(vi_ctype, file_path_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return - def _init_with_options( - self, resource_name, id_query=False, reset_device=False, option_string="" - ): - r"""_init_with_options + def _init_with_options(self, resource_name, id_query=False, reset_device=False, option_string=""): + r'''_init_with_options This method completes the following tasks: @@ -2792,50 +2403,34 @@ def _init_with_options( vi (int): Returns a ViSession handle that you use to identify the instrument in all subsequent instrument driver method calls. - """ - resource_name_ctype = ctypes.create_string_buffer( - resource_name.encode(self._encoding) - ) # case C020 + ''' + resource_name_ctype = ctypes.create_string_buffer(resource_name.encode(self._encoding)) # case C020 id_query_ctype = _visatype.ViBoolean(id_query) # case S150 reset_device_ctype = _visatype.ViBoolean(reset_device) # case S150 - option_string_ctype = ctypes.create_string_buffer( - _converters.convert_init_with_options_dictionary(option_string).encode( - self._encoding - ) - ) # case C040 + option_string_ctype = ctypes.create_string_buffer(_converters.convert_init_with_options_dictionary(option_string).encode(self._encoding)) # case C040 vi_ctype = _visatype.ViSession() # case S220 - error_code = self._library.niDMM_InitWithOptions( - resource_name_ctype, - id_query_ctype, - reset_device_ctype, - option_string_ctype, - None if vi_ctype is None else (ctypes.pointer(vi_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_InitWithOptions(resource_name_ctype, id_query_ctype, reset_device_ctype, option_string_ctype, None if vi_ctype is None else (ctypes.pointer(vi_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(vi_ctype.value) @ivi_synchronized def _initiate(self): - r"""_initiate + r'''_initiate Initiates an acquisition. After you call this method, the DMM leaves the Idle state and enters the Wait-for-Trigger state. If trigger is set to Immediate mode, the DMM begins acquiring measurement data. Use fetch, fetch_multi_point, or fetch_waveform to retrieve the measurement data. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDMM_Initiate(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def perform_open_cable_comp(self): - r"""perform_open_cable_comp + r'''perform_open_cable_comp For the NI 4082 and NI 4072 only, performs the open cable compensation measurements for the current capacitance/inductance range, and returns @@ -2857,23 +2452,17 @@ def perform_open_cable_comp(self): susceptance (float): **susceptance** is the measured value of open cable compensation **susceptance**. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 conductance_ctype = _visatype.ViReal64() # case S220 susceptance_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDMM_PerformOpenCableComp( - vi_ctype, - None if conductance_ctype is None else (ctypes.pointer(conductance_ctype)), - None if susceptance_ctype is None else (ctypes.pointer(susceptance_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_PerformOpenCableComp(vi_ctype, None if conductance_ctype is None else (ctypes.pointer(conductance_ctype)), None if susceptance_ctype is None else (ctypes.pointer(susceptance_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(conductance_ctype.value), float(susceptance_ctype.value) @ivi_synchronized def perform_short_cable_comp(self): - r"""perform_short_cable_comp + r'''perform_short_cable_comp Performs the short cable compensation measurements for the current capacitance/inductance range, and returns short cable compensation @@ -2894,23 +2483,17 @@ def perform_short_cable_comp(self): reactance (float): **reactance** is the measured value of short cable compensation **reactance**. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 resistance_ctype = _visatype.ViReal64() # case S220 reactance_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDMM_PerformShortCableComp( - vi_ctype, - None if resistance_ctype is None else (ctypes.pointer(resistance_ctype)), - None if reactance_ctype is None else (ctypes.pointer(reactance_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_PerformShortCableComp(vi_ctype, None if resistance_ctype is None else (ctypes.pointer(resistance_ctype)), None if reactance_ctype is None else (ctypes.pointer(reactance_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(resistance_ctype.value), float(reactance_ctype.value) @ivi_synchronized def read(self, maximum_time=hightime.timedelta(milliseconds=-1)): - r"""read + r'''read Acquires a single measurement and returns the measured value. @@ -2933,27 +2516,17 @@ def read(self, maximum_time=hightime.timedelta(milliseconds=-1)): Returns: reading (float): The measured value returned from the DMM. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32( - maximum_time - ) # case S140 + maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32(maximum_time) # case S140 reading_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niDMM_Read( - vi_ctype, - maximum_time_ctype, - None if reading_ctype is None else (ctypes.pointer(reading_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_Read(vi_ctype, maximum_time_ctype, None if reading_ctype is None else (ctypes.pointer(reading_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(reading_ctype.value) @ivi_synchronized - def read_multi_point( - self, array_size, maximum_time=hightime.timedelta(milliseconds=-1) - ): - r"""read_multi_point + def read_multi_point(self, array_size, maximum_time=hightime.timedelta(milliseconds=-1)): + r'''read_multi_point Acquires multiple measurements and returns an array of measured values. The number of measurements the DMM makes is determined by the values you @@ -2993,35 +2566,21 @@ def read_multi_point( actual_number_of_points (int): Indicates the number of measured values actually retrieved from the DMM. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32( - maximum_time - ) # case S140 + maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32(maximum_time) # case S140 array_size_ctype = _visatype.ViInt32(array_size) # case S210 reading_array_size = array_size # case B600 reading_array_array = array.array("d", [0] * reading_array_size) # case B600 - reading_array_ctype = get_ctypes_pointer_for_buffer( - value=reading_array_array, library_type=_visatype.ViReal64 - ) # case B600 + reading_array_ctype = get_ctypes_pointer_for_buffer(value=reading_array_array, library_type=_visatype.ViReal64) # case B600 actual_number_of_points_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDMM_ReadMultiPoint( - vi_ctype, - maximum_time_ctype, - array_size_ctype, - reading_array_ctype, - None - if actual_number_of_points_ctype is None - else (ctypes.pointer(actual_number_of_points_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_ReadMultiPoint(vi_ctype, maximum_time_ctype, array_size_ctype, reading_array_ctype, None if actual_number_of_points_ctype is None else (ctypes.pointer(actual_number_of_points_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return reading_array_array @ivi_synchronized def read_status(self): - r"""read_status + r'''read_status Returns measurement backlog and acquisition status. Use this method to determine how many measurements are available before calling @@ -3056,31 +2615,17 @@ def read_status(self): | 4 | No acquisition in progress | +---+----------------------------+ - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 acquisition_backlog_ctype = _visatype.ViInt32() # case S220 acquisition_status_ctype = _visatype.ViInt16() # case S220 - error_code = self._library.niDMM_ReadStatus( - vi_ctype, - None - if acquisition_backlog_ctype is None - else (ctypes.pointer(acquisition_backlog_ctype)), - None - if acquisition_status_ctype is None - else (ctypes.pointer(acquisition_status_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return int(acquisition_backlog_ctype.value), enums.AcquisitionStatus( - acquisition_status_ctype.value - ) + error_code = self._library.niDMM_ReadStatus(vi_ctype, None if acquisition_backlog_ctype is None else (ctypes.pointer(acquisition_backlog_ctype)), None if acquisition_status_ctype is None else (ctypes.pointer(acquisition_status_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return int(acquisition_backlog_ctype.value), enums.AcquisitionStatus(acquisition_status_ctype.value) @ivi_synchronized - def read_waveform( - self, array_size, maximum_time=hightime.timedelta(milliseconds=-1) - ): - r"""read_waveform + def read_waveform(self, array_size, maximum_time=hightime.timedelta(milliseconds=-1)): + r'''read_waveform For the NI 4080/4081/4082 and the NI 4070/4071/4072, acquires a waveform and returns data as an array of values or as a waveform data type. The @@ -3118,51 +2663,35 @@ def read_waveform( actual_number_of_points (int): Indicates the number of measured values actually retrieved from the DMM. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32( - maximum_time - ) # case S140 + maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32(maximum_time) # case S140 array_size_ctype = _visatype.ViInt32(array_size) # case S210 waveform_array_size = array_size # case B600 waveform_array_array = array.array("d", [0] * waveform_array_size) # case B600 - waveform_array_ctype = get_ctypes_pointer_for_buffer( - value=waveform_array_array, library_type=_visatype.ViReal64 - ) # case B600 + waveform_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_array_array, library_type=_visatype.ViReal64) # case B600 actual_number_of_points_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niDMM_ReadWaveform( - vi_ctype, - maximum_time_ctype, - array_size_ctype, - waveform_array_ctype, - None - if actual_number_of_points_ctype is None - else (ctypes.pointer(actual_number_of_points_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niDMM_ReadWaveform(vi_ctype, maximum_time_ctype, array_size_ctype, waveform_array_ctype, None if actual_number_of_points_ctype is None else (ctypes.pointer(actual_number_of_points_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return waveform_array_array @ivi_synchronized def reset_with_defaults(self): - r"""reset_with_defaults + r'''reset_with_defaults Resets the instrument to a known state and sends initialization commands to the DMM. The initialization commands set the DMM settings to the state necessary for the operation of NI-DMM. All user-defined default values associated with a logical name are applied after setting the DMM. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDMM_ResetWithDefaults(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def self_cal(self): - r"""self_cal + r'''self_cal For the NI 4080/4081/4082 and the NI 4070/4071/4072, executes the self-calibration routine to maintain measurement accuracy. @@ -3171,17 +2700,15 @@ def self_cal(self): This method calls reset, and any configurations previous to the call will be lost. All properties will be set to their default values after the call returns. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDMM_SelfCal(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def send_software_trigger(self): - r"""send_software_trigger + r'''send_software_trigger Sends a command to trigger the DMM. Call this method if you have configured either the trigger_source or @@ -3193,29 +2720,25 @@ def send_software_trigger(self): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDMM_SendSoftwareTrigger(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def _close(self): - r"""_close + r'''_close Closes the specified session and deallocates resources that it reserved. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDMM_close(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def self_test(self): - """self_test + '''self_test Performs a self-test on the DMM to ensure that the DMM is functioning properly. Self-test does not calibrate the DMM. Zero @@ -3232,7 +2755,7 @@ def self_test(self): Note: Self-test does not check the fuse on the NI 4065, NI 4071, and NI 4081. Hence, even if the fuse is blown on the device, self-test does not return error code 1013. Note: This method calls reset, and any configurations previous to the call will be lost. All properties will be set to their default values after the call returns. - """ + ''' code, msg = self._self_test() if code: raise errors.SelfTestError(code, msg) @@ -3240,22 +2763,20 @@ def self_test(self): @ivi_synchronized def reset(self): - r"""reset + r'''reset Resets the instrument to a known state and sends initialization commands to the instrument. The initialization commands set instrument settings to the state necessary for the operation of the instrument driver. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niDMM_reset(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _self_test(self): - r"""_self_test + r'''_self_test Performs a self-test on the DMM to ensure that the DMM is functioning properly. Self-test does not calibrate the DMM. @@ -3293,20 +2814,13 @@ def _self_test(self): returned for a self-test failure is NIDMM_ERROR_SELF_TEST_FAILURE. This error code indicates that the DMM should be repaired. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 self_test_result_ctype = _visatype.ViInt16() # case S220 self_test_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niDMM_self_test( - vi_ctype, - None - if self_test_result_ctype is None - else (ctypes.pointer(self_test_result_ctype)), - self_test_message_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return int(self_test_result_ctype.value), self_test_message_ctype.value.decode( - self._encoding - ) + error_code = self._library.niDMM_self_test(vi_ctype, None if self_test_result_ctype is None else (ctypes.pointer(self_test_result_ctype)), self_test_message_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return int(self_test_result_ctype.value), self_test_message_ctype.value.decode(self._encoding) + + + diff --git a/generated/nidmm/nidmm/unit_tests/_matchers.py b/generated/nidmm/nidmm/unit_tests/_matchers.py index e6efe7c2f..82b1c614a 100644 --- a/generated/nidmm/nidmm/unit_tests/_matchers.py +++ b/generated/nidmm/nidmm/unit_tests/_matchers.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # This file was generated -"""Matcher classes used by unit tests in order to set mock expectations. +'''Matcher classes used by unit tests in order to set mock expectations. These work well with our visatype definitions. -""" +''' import ctypes import nidmm._visatype as _visatype @@ -21,27 +21,15 @@ def __init__(self, expected_type, expected_value): def __eq__(self, other): if not isinstance(other, self.expected_type): - print( - "{0}: Unexpected type. Expected: {1}. Received: {2}".format( - self.__class__.__name__, self.expected_type, type(other) - ) - ) + print("{0}: Unexpected type. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_type, type(other))) return False if other.value != self.expected_value: - print( - "{0}: Unexpected value. Expected: {1}. Received: {2}".format( - self.__class__.__name__, self.expected_value, other.value - ) - ) + print("{0}: Unexpected value. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_value, other.value)) return False return True def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_type), - pp.pformat(self.expected_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) class _PointerMatcher(object): @@ -50,18 +38,12 @@ def __init__(self, expected_type): def __eq__(self, other): if not isinstance(other, ctypes.POINTER(self.expected_type)): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - ctypes.POINTER(self.expected_type), type(other) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(ctypes.POINTER(self.expected_type), type(other))) return False return True def __repr__(self): - return "{0}({1})".format( - self.__class__.__name__, pp.pformat(self.expected_type) - ) + return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_type)) class _BufferMatcher(object): @@ -88,47 +70,29 @@ def __eq__(self, other): pass # Because of object lifetimes, we may need to mock the other instance and provide lists instead of the actual array - if not isinstance(other, self.expected_type) and not isinstance( - other, list - ): - print( - "Unexpected type. Expected: {0} or {1}. Received: {2}".format( - self.expected_type, list, type(other) - ) - ) + if not isinstance(other, self.expected_type) and not isinstance(other, list): + print("Unexpected type. Expected: {0} or {1}. Received: {2}".format(self.expected_type, list, type(other))) return False if self.expected_size != len(other): - print( - "Unexpected length. Expected: {0}. Received: {1}".format( - self.expected_size, len(other) - ) - ) + print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(other))) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for i in range(0, len(self.expected_value)): if self.expected_value[i] != other[i]: - print( - "Unexpected value at index {0}. Expected: {1}. Received: {2}".format( - i, self.expected_value[i], other[i] - ) - ) + print("Unexpected value at index {0}. Expected: {1}. Received: {2}".format(i, self.expected_value[i], other[i])) return False return True def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self._expected_element_type), - pp.pformat(self._expected_size_or_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self._expected_element_type), pp.pformat(self._expected_size_or_value)) def __str__(self): - ret_str = self.__repr__() + "\n" - ret_str += " expected_type = " + str(self.expected_type) + "\n" - ret_str += " expected_value = " + str(self.expected_value) + "\n" - ret_str += " expected_size = " + str(self.expected_size) + "\n" + ret_str = self.__repr__() + '\n' + ret_str += ' expected_type = ' + str(self.expected_type) + '\n' + ret_str += ' expected_value = ' + str(self.expected_value) + '\n' + ret_str += ' expected_size = ' + str(self.expected_size) + '\n' return ret_str @@ -148,37 +112,21 @@ def __eq__(self, other): pass if not isinstance(other, ctypes.Array): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_type, type(other) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(other))) return False - if ( - len(other) < len(self.expected_string_value) + 1 - ): # +1 for NULL terminating character - print( - "Unexpected length in C string. Expected at least: {0}. Received {1}".format( - len(other), len(self.expected_string_value) + 1 - ) - ) + if len(other) < len(self.expected_string_value) + 1: # +1 for NULL terminating character + print("Unexpected length in C string. Expected at least: {0}. Received {1}".format(len(other), len(self.expected_string_value) + 1)) return False if not isinstance(other[0], bytes): print("Unexpected type. Not a string. Received: {0}".format(type(other[0]))) return False if other.value.decode("ascii") != self.expected_string_value: - print( - "Unexpected value. Expected {0}. Received: {1}".format( - self.expected_string_value, other.value.decode - ) - ) + print("Unexpected value. Expected {0}. Received: {1}".format(self.expected_string_value, other.value.decode)) return False return True def __repr__(self): - return "{0}({1})".format( - self.__class__.__name__, pp.pformat(self.expected_string_value) - ) + return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_string_value)) # Custom Type @@ -191,11 +139,7 @@ def _compare_ctype_structs(expected, actual): expected_val = getattr(expected, field_name) actual_val = getattr(actual, field_name) if expected_val != actual_val: - print( - "Unexpected value field {0}. Expected: {1}. Received: {2}".format( - field_name, expected_val, actual_val - ) - ) + print("Unexpected value field {0}. Expected: {1}. Received: {2}".format(field_name, expected_val, actual_val)) return False return True @@ -207,20 +151,12 @@ def __init__(self, expected_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_type, type(actual) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) return False return _compare_ctype_structs(self.expected_value, actual) def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_type), - pp.pformat(self.expected_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) class CustomTypeBufferMatcher(object): @@ -232,48 +168,30 @@ def __init__(self, expected_element_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print( - "Unexpected array type. Expected: {0}. Received: {1}".format( - self.expected_type, type(actual) - ) - ) + print("Unexpected array type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) return False if self.expected_size != len(actual): - print( - "Unexpected length. Expected: {0}. Received: {1}".format( - self.expected_size, len(actual) - ) - ) + print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(actual))) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for a, e in zip(actual, self.expected_value): if not isinstance(a, self.expected_element_type): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_element_type, type(a) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_element_type, type(a))) return False if not _compare_ctype_structs(e, a): return False return True def __repr__(self): - expected_val_repr = ( - "[" + ", ".join([x.__repr__() for x in self.expected_value]) + "]" - ) - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_element_type), - expected_val_repr, - ) + expected_val_repr = '[' + ', '.join([x.__repr__() for x in self.expected_value]) + ']' + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_element_type), expected_val_repr) def __str__(self): - ret_str = self.__repr__() + "\n" - ret_str += " expected_type = " + str(self.expected_type) + "\n" - ret_str += " expected_size = " + str(self.expected_size) + "\n" + ret_str = self.__repr__() + '\n' + ret_str += ' expected_type = ' + str(self.expected_type) + '\n' + ret_str += ' expected_size = ' + str(self.expected_size) + '\n' return ret_str @@ -282,9 +200,7 @@ def __str__(self): class ViBooleanMatcher(_ScalarMatcher): def __init__(self, expected_value): - _ScalarMatcher.__init__( - self, _visatype.ViBoolean, 1 if expected_value is True else 0 - ) + _ScalarMatcher.__init__(self, _visatype.ViBoolean, 1 if expected_value is True else 0) class ViSessionMatcher(_ScalarMatcher): @@ -396,3 +312,6 @@ def __init__(self, expected_size_or_value): class ViSessionBufferMatcher(_BufferMatcher): def __init__(self, expected_size_or_value): _BufferMatcher.__init__(self, _visatype.ViSession, expected_size_or_value) + + + diff --git a/generated/nidmm/nidmm/unit_tests/_mock_helper.py b/generated/nidmm/nidmm/unit_tests/_mock_helper.py index 958036fa1..e3ac3ba12 100644 --- a/generated/nidmm/nidmm/unit_tests/_mock_helper.py +++ b/generated/nidmm/nidmm/unit_tests/_mock_helper.py @@ -16,142 +16,142 @@ def __init__(self, function, param=None): class SideEffectsHelper(object): def __init__(self): self._defaults = {} - self._defaults["Abort"] = {} - self._defaults["Abort"]["return"] = 0 - self._defaults["ConfigureMeasurementAbsolute"] = {} - self._defaults["ConfigureMeasurementAbsolute"]["return"] = 0 - self._defaults["ConfigureMeasurementDigits"] = {} - self._defaults["ConfigureMeasurementDigits"]["return"] = 0 - self._defaults["ConfigureMultiPoint"] = {} - self._defaults["ConfigureMultiPoint"]["return"] = 0 - self._defaults["ConfigureRTDCustom"] = {} - self._defaults["ConfigureRTDCustom"]["return"] = 0 - self._defaults["ConfigureRTDType"] = {} - self._defaults["ConfigureRTDType"]["return"] = 0 - self._defaults["ConfigureThermistorCustom"] = {} - self._defaults["ConfigureThermistorCustom"]["return"] = 0 - self._defaults["ConfigureThermocouple"] = {} - self._defaults["ConfigureThermocouple"]["return"] = 0 - self._defaults["ConfigureTrigger"] = {} - self._defaults["ConfigureTrigger"]["return"] = 0 - self._defaults["ConfigureWaveformAcquisition"] = {} - self._defaults["ConfigureWaveformAcquisition"]["return"] = 0 - self._defaults["Disable"] = {} - self._defaults["Disable"]["return"] = 0 - self._defaults["ExportAttributeConfigurationBuffer"] = {} - self._defaults["ExportAttributeConfigurationBuffer"]["return"] = 0 - self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] = None - self._defaults["ExportAttributeConfigurationFile"] = {} - self._defaults["ExportAttributeConfigurationFile"]["return"] = 0 - self._defaults["Fetch"] = {} - self._defaults["Fetch"]["return"] = 0 - self._defaults["Fetch"]["reading"] = None - self._defaults["FetchMultiPoint"] = {} - self._defaults["FetchMultiPoint"]["return"] = 0 - self._defaults["FetchMultiPoint"]["readingArray"] = None - self._defaults["FetchMultiPoint"]["actualNumberOfPoints"] = None - self._defaults["FetchWaveform"] = {} - self._defaults["FetchWaveform"]["return"] = 0 - self._defaults["FetchWaveform"]["waveformArray"] = None - self._defaults["FetchWaveform"]["actualNumberOfPoints"] = None - self._defaults["GetAttributeViBoolean"] = {} - self._defaults["GetAttributeViBoolean"]["return"] = 0 - self._defaults["GetAttributeViBoolean"]["attributeValue"] = None - self._defaults["GetAttributeViInt32"] = {} - self._defaults["GetAttributeViInt32"]["return"] = 0 - self._defaults["GetAttributeViInt32"]["attributeValue"] = None - self._defaults["GetAttributeViReal64"] = {} - self._defaults["GetAttributeViReal64"]["return"] = 0 - self._defaults["GetAttributeViReal64"]["attributeValue"] = None - self._defaults["GetAttributeViString"] = {} - self._defaults["GetAttributeViString"]["return"] = 0 - self._defaults["GetAttributeViString"]["attributeValue"] = None - self._defaults["GetCalDateAndTime"] = {} - self._defaults["GetCalDateAndTime"]["return"] = 0 - self._defaults["GetCalDateAndTime"]["month"] = None - self._defaults["GetCalDateAndTime"]["day"] = None - self._defaults["GetCalDateAndTime"]["year"] = None - self._defaults["GetCalDateAndTime"]["hour"] = None - self._defaults["GetCalDateAndTime"]["minute"] = None - self._defaults["GetDevTemp"] = {} - self._defaults["GetDevTemp"]["return"] = 0 - self._defaults["GetDevTemp"]["temperature"] = None - self._defaults["GetError"] = {} - self._defaults["GetError"]["return"] = 0 - self._defaults["GetError"]["errorCode"] = None - self._defaults["GetError"]["description"] = None - self._defaults["GetExtCalRecommendedInterval"] = {} - self._defaults["GetExtCalRecommendedInterval"]["return"] = 0 - self._defaults["GetExtCalRecommendedInterval"]["months"] = None - self._defaults["GetLastCalTemp"] = {} - self._defaults["GetLastCalTemp"]["return"] = 0 - self._defaults["GetLastCalTemp"]["temperature"] = None - self._defaults["GetSelfCalSupported"] = {} - self._defaults["GetSelfCalSupported"]["return"] = 0 - self._defaults["GetSelfCalSupported"]["selfCalSupported"] = None - self._defaults["ImportAttributeConfigurationBuffer"] = {} - self._defaults["ImportAttributeConfigurationBuffer"]["return"] = 0 - self._defaults["ImportAttributeConfigurationFile"] = {} - self._defaults["ImportAttributeConfigurationFile"]["return"] = 0 - self._defaults["InitWithOptions"] = {} - self._defaults["InitWithOptions"]["return"] = 0 - self._defaults["InitWithOptions"]["vi"] = None - self._defaults["Initiate"] = {} - self._defaults["Initiate"]["return"] = 0 - self._defaults["LockSession"] = {} - self._defaults["LockSession"]["return"] = 0 - self._defaults["LockSession"]["callerHasLock"] = None - self._defaults["PerformOpenCableComp"] = {} - self._defaults["PerformOpenCableComp"]["return"] = 0 - self._defaults["PerformOpenCableComp"]["conductance"] = None - self._defaults["PerformOpenCableComp"]["susceptance"] = None - self._defaults["PerformShortCableComp"] = {} - self._defaults["PerformShortCableComp"]["return"] = 0 - self._defaults["PerformShortCableComp"]["resistance"] = None - self._defaults["PerformShortCableComp"]["reactance"] = None - self._defaults["Read"] = {} - self._defaults["Read"]["return"] = 0 - self._defaults["Read"]["reading"] = None - self._defaults["ReadMultiPoint"] = {} - self._defaults["ReadMultiPoint"]["return"] = 0 - self._defaults["ReadMultiPoint"]["readingArray"] = None - self._defaults["ReadMultiPoint"]["actualNumberOfPoints"] = None - self._defaults["ReadStatus"] = {} - self._defaults["ReadStatus"]["return"] = 0 - self._defaults["ReadStatus"]["acquisitionBacklog"] = None - self._defaults["ReadStatus"]["acquisitionStatus"] = None - self._defaults["ReadWaveform"] = {} - self._defaults["ReadWaveform"]["return"] = 0 - self._defaults["ReadWaveform"]["waveformArray"] = None - self._defaults["ReadWaveform"]["actualNumberOfPoints"] = None - self._defaults["ResetWithDefaults"] = {} - self._defaults["ResetWithDefaults"]["return"] = 0 - self._defaults["SelfCal"] = {} - self._defaults["SelfCal"]["return"] = 0 - self._defaults["SendSoftwareTrigger"] = {} - self._defaults["SendSoftwareTrigger"]["return"] = 0 - self._defaults["SetAttributeViBoolean"] = {} - self._defaults["SetAttributeViBoolean"]["return"] = 0 - self._defaults["SetAttributeViInt32"] = {} - self._defaults["SetAttributeViInt32"]["return"] = 0 - self._defaults["SetAttributeViReal64"] = {} - self._defaults["SetAttributeViReal64"]["return"] = 0 - self._defaults["SetAttributeViString"] = {} - self._defaults["SetAttributeViString"]["return"] = 0 - self._defaults["UnlockSession"] = {} - self._defaults["UnlockSession"]["return"] = 0 - self._defaults["UnlockSession"]["callerHasLock"] = None - self._defaults["close"] = {} - self._defaults["close"]["return"] = 0 - self._defaults["error_message"] = {} - self._defaults["error_message"]["return"] = 0 - self._defaults["error_message"]["errorMessage"] = None - self._defaults["reset"] = {} - self._defaults["reset"]["return"] = 0 - self._defaults["self_test"] = {} - self._defaults["self_test"]["return"] = 0 - self._defaults["self_test"]["selfTestResult"] = None - self._defaults["self_test"]["selfTestMessage"] = None + self._defaults['Abort'] = {} + self._defaults['Abort']['return'] = 0 + self._defaults['ConfigureMeasurementAbsolute'] = {} + self._defaults['ConfigureMeasurementAbsolute']['return'] = 0 + self._defaults['ConfigureMeasurementDigits'] = {} + self._defaults['ConfigureMeasurementDigits']['return'] = 0 + self._defaults['ConfigureMultiPoint'] = {} + self._defaults['ConfigureMultiPoint']['return'] = 0 + self._defaults['ConfigureRTDCustom'] = {} + self._defaults['ConfigureRTDCustom']['return'] = 0 + self._defaults['ConfigureRTDType'] = {} + self._defaults['ConfigureRTDType']['return'] = 0 + self._defaults['ConfigureThermistorCustom'] = {} + self._defaults['ConfigureThermistorCustom']['return'] = 0 + self._defaults['ConfigureThermocouple'] = {} + self._defaults['ConfigureThermocouple']['return'] = 0 + self._defaults['ConfigureTrigger'] = {} + self._defaults['ConfigureTrigger']['return'] = 0 + self._defaults['ConfigureWaveformAcquisition'] = {} + self._defaults['ConfigureWaveformAcquisition']['return'] = 0 + self._defaults['Disable'] = {} + self._defaults['Disable']['return'] = 0 + self._defaults['ExportAttributeConfigurationBuffer'] = {} + self._defaults['ExportAttributeConfigurationBuffer']['return'] = 0 + self._defaults['ExportAttributeConfigurationBuffer']['configuration'] = None + self._defaults['ExportAttributeConfigurationFile'] = {} + self._defaults['ExportAttributeConfigurationFile']['return'] = 0 + self._defaults['Fetch'] = {} + self._defaults['Fetch']['return'] = 0 + self._defaults['Fetch']['reading'] = None + self._defaults['FetchMultiPoint'] = {} + self._defaults['FetchMultiPoint']['return'] = 0 + self._defaults['FetchMultiPoint']['readingArray'] = None + self._defaults['FetchMultiPoint']['actualNumberOfPoints'] = None + self._defaults['FetchWaveform'] = {} + self._defaults['FetchWaveform']['return'] = 0 + self._defaults['FetchWaveform']['waveformArray'] = None + self._defaults['FetchWaveform']['actualNumberOfPoints'] = None + self._defaults['GetAttributeViBoolean'] = {} + self._defaults['GetAttributeViBoolean']['return'] = 0 + self._defaults['GetAttributeViBoolean']['attributeValue'] = None + self._defaults['GetAttributeViInt32'] = {} + self._defaults['GetAttributeViInt32']['return'] = 0 + self._defaults['GetAttributeViInt32']['attributeValue'] = None + self._defaults['GetAttributeViReal64'] = {} + self._defaults['GetAttributeViReal64']['return'] = 0 + self._defaults['GetAttributeViReal64']['attributeValue'] = None + self._defaults['GetAttributeViString'] = {} + self._defaults['GetAttributeViString']['return'] = 0 + self._defaults['GetAttributeViString']['attributeValue'] = None + self._defaults['GetCalDateAndTime'] = {} + self._defaults['GetCalDateAndTime']['return'] = 0 + self._defaults['GetCalDateAndTime']['month'] = None + self._defaults['GetCalDateAndTime']['day'] = None + self._defaults['GetCalDateAndTime']['year'] = None + self._defaults['GetCalDateAndTime']['hour'] = None + self._defaults['GetCalDateAndTime']['minute'] = None + self._defaults['GetDevTemp'] = {} + self._defaults['GetDevTemp']['return'] = 0 + self._defaults['GetDevTemp']['temperature'] = None + self._defaults['GetError'] = {} + self._defaults['GetError']['return'] = 0 + self._defaults['GetError']['errorCode'] = None + self._defaults['GetError']['description'] = None + self._defaults['GetExtCalRecommendedInterval'] = {} + self._defaults['GetExtCalRecommendedInterval']['return'] = 0 + self._defaults['GetExtCalRecommendedInterval']['months'] = None + self._defaults['GetLastCalTemp'] = {} + self._defaults['GetLastCalTemp']['return'] = 0 + self._defaults['GetLastCalTemp']['temperature'] = None + self._defaults['GetSelfCalSupported'] = {} + self._defaults['GetSelfCalSupported']['return'] = 0 + self._defaults['GetSelfCalSupported']['selfCalSupported'] = None + self._defaults['ImportAttributeConfigurationBuffer'] = {} + self._defaults['ImportAttributeConfigurationBuffer']['return'] = 0 + self._defaults['ImportAttributeConfigurationFile'] = {} + self._defaults['ImportAttributeConfigurationFile']['return'] = 0 + self._defaults['InitWithOptions'] = {} + self._defaults['InitWithOptions']['return'] = 0 + self._defaults['InitWithOptions']['vi'] = None + self._defaults['Initiate'] = {} + self._defaults['Initiate']['return'] = 0 + self._defaults['LockSession'] = {} + self._defaults['LockSession']['return'] = 0 + self._defaults['LockSession']['callerHasLock'] = None + self._defaults['PerformOpenCableComp'] = {} + self._defaults['PerformOpenCableComp']['return'] = 0 + self._defaults['PerformOpenCableComp']['conductance'] = None + self._defaults['PerformOpenCableComp']['susceptance'] = None + self._defaults['PerformShortCableComp'] = {} + self._defaults['PerformShortCableComp']['return'] = 0 + self._defaults['PerformShortCableComp']['resistance'] = None + self._defaults['PerformShortCableComp']['reactance'] = None + self._defaults['Read'] = {} + self._defaults['Read']['return'] = 0 + self._defaults['Read']['reading'] = None + self._defaults['ReadMultiPoint'] = {} + self._defaults['ReadMultiPoint']['return'] = 0 + self._defaults['ReadMultiPoint']['readingArray'] = None + self._defaults['ReadMultiPoint']['actualNumberOfPoints'] = None + self._defaults['ReadStatus'] = {} + self._defaults['ReadStatus']['return'] = 0 + self._defaults['ReadStatus']['acquisitionBacklog'] = None + self._defaults['ReadStatus']['acquisitionStatus'] = None + self._defaults['ReadWaveform'] = {} + self._defaults['ReadWaveform']['return'] = 0 + self._defaults['ReadWaveform']['waveformArray'] = None + self._defaults['ReadWaveform']['actualNumberOfPoints'] = None + self._defaults['ResetWithDefaults'] = {} + self._defaults['ResetWithDefaults']['return'] = 0 + self._defaults['SelfCal'] = {} + self._defaults['SelfCal']['return'] = 0 + self._defaults['SendSoftwareTrigger'] = {} + self._defaults['SendSoftwareTrigger']['return'] = 0 + self._defaults['SetAttributeViBoolean'] = {} + self._defaults['SetAttributeViBoolean']['return'] = 0 + self._defaults['SetAttributeViInt32'] = {} + self._defaults['SetAttributeViInt32']['return'] = 0 + self._defaults['SetAttributeViReal64'] = {} + self._defaults['SetAttributeViReal64']['return'] = 0 + self._defaults['SetAttributeViString'] = {} + self._defaults['SetAttributeViString']['return'] = 0 + self._defaults['UnlockSession'] = {} + self._defaults['UnlockSession']['return'] = 0 + self._defaults['UnlockSession']['callerHasLock'] = None + self._defaults['close'] = {} + self._defaults['close']['return'] = 0 + self._defaults['error_message'] = {} + self._defaults['error_message']['return'] = 0 + self._defaults['error_message']['errorMessage'] = None + self._defaults['reset'] = {} + self._defaults['reset']['return'] = 0 + self._defaults['self_test'] = {} + self._defaults['self_test']['return'] = 0 + self._defaults['self_test']['selfTestResult'] = None + self._defaults['self_test']['selfTestMessage'] = None def __getitem__(self, func): return self._defaults[func] @@ -160,124 +160,97 @@ def __setitem__(self, func, val): self._defaults[func] = val def niDMM_Abort(self, vi): # noqa: N802 - if self._defaults["Abort"]["return"] != 0: - return self._defaults["Abort"]["return"] - return self._defaults["Abort"]["return"] - - def niDMM_ConfigureMeasurementAbsolute( - self, vi, measurement_function, range, resolution_absolute - ): # noqa: N802 - if self._defaults["ConfigureMeasurementAbsolute"]["return"] != 0: - return self._defaults["ConfigureMeasurementAbsolute"]["return"] - return self._defaults["ConfigureMeasurementAbsolute"]["return"] - - def niDMM_ConfigureMeasurementDigits( - self, vi, measurement_function, range, resolution_digits - ): # noqa: N802 - if self._defaults["ConfigureMeasurementDigits"]["return"] != 0: - return self._defaults["ConfigureMeasurementDigits"]["return"] - return self._defaults["ConfigureMeasurementDigits"]["return"] - - def niDMM_ConfigureMultiPoint( - self, vi, trigger_count, sample_count, sample_trigger, sample_interval - ): # noqa: N802 - if self._defaults["ConfigureMultiPoint"]["return"] != 0: - return self._defaults["ConfigureMultiPoint"]["return"] - return self._defaults["ConfigureMultiPoint"]["return"] + if self._defaults['Abort']['return'] != 0: + return self._defaults['Abort']['return'] + return self._defaults['Abort']['return'] + + def niDMM_ConfigureMeasurementAbsolute(self, vi, measurement_function, range, resolution_absolute): # noqa: N802 + if self._defaults['ConfigureMeasurementAbsolute']['return'] != 0: + return self._defaults['ConfigureMeasurementAbsolute']['return'] + return self._defaults['ConfigureMeasurementAbsolute']['return'] + + def niDMM_ConfigureMeasurementDigits(self, vi, measurement_function, range, resolution_digits): # noqa: N802 + if self._defaults['ConfigureMeasurementDigits']['return'] != 0: + return self._defaults['ConfigureMeasurementDigits']['return'] + return self._defaults['ConfigureMeasurementDigits']['return'] + + def niDMM_ConfigureMultiPoint(self, vi, trigger_count, sample_count, sample_trigger, sample_interval): # noqa: N802 + if self._defaults['ConfigureMultiPoint']['return'] != 0: + return self._defaults['ConfigureMultiPoint']['return'] + return self._defaults['ConfigureMultiPoint']['return'] def niDMM_ConfigureRTDCustom(self, vi, rtd_a, rtd_b, rtd_c): # noqa: N802 - if self._defaults["ConfigureRTDCustom"]["return"] != 0: - return self._defaults["ConfigureRTDCustom"]["return"] - return self._defaults["ConfigureRTDCustom"]["return"] + if self._defaults['ConfigureRTDCustom']['return'] != 0: + return self._defaults['ConfigureRTDCustom']['return'] + return self._defaults['ConfigureRTDCustom']['return'] def niDMM_ConfigureRTDType(self, vi, rtd_type, rtd_resistance): # noqa: N802 - if self._defaults["ConfigureRTDType"]["return"] != 0: - return self._defaults["ConfigureRTDType"]["return"] - return self._defaults["ConfigureRTDType"]["return"] - - def niDMM_ConfigureThermistorCustom( - self, vi, thermistor_a, thermistor_b, thermistor_c - ): # noqa: N802 - if self._defaults["ConfigureThermistorCustom"]["return"] != 0: - return self._defaults["ConfigureThermistorCustom"]["return"] - return self._defaults["ConfigureThermistorCustom"]["return"] - - def niDMM_ConfigureThermocouple( - self, vi, thermocouple_type, reference_junction_type - ): # noqa: N802 - if self._defaults["ConfigureThermocouple"]["return"] != 0: - return self._defaults["ConfigureThermocouple"]["return"] - return self._defaults["ConfigureThermocouple"]["return"] + if self._defaults['ConfigureRTDType']['return'] != 0: + return self._defaults['ConfigureRTDType']['return'] + return self._defaults['ConfigureRTDType']['return'] + + def niDMM_ConfigureThermistorCustom(self, vi, thermistor_a, thermistor_b, thermistor_c): # noqa: N802 + if self._defaults['ConfigureThermistorCustom']['return'] != 0: + return self._defaults['ConfigureThermistorCustom']['return'] + return self._defaults['ConfigureThermistorCustom']['return'] + + def niDMM_ConfigureThermocouple(self, vi, thermocouple_type, reference_junction_type): # noqa: N802 + if self._defaults['ConfigureThermocouple']['return'] != 0: + return self._defaults['ConfigureThermocouple']['return'] + return self._defaults['ConfigureThermocouple']['return'] def niDMM_ConfigureTrigger(self, vi, trigger_source, trigger_delay): # noqa: N802 - if self._defaults["ConfigureTrigger"]["return"] != 0: - return self._defaults["ConfigureTrigger"]["return"] - return self._defaults["ConfigureTrigger"]["return"] + if self._defaults['ConfigureTrigger']['return'] != 0: + return self._defaults['ConfigureTrigger']['return'] + return self._defaults['ConfigureTrigger']['return'] - def niDMM_ConfigureWaveformAcquisition( - self, vi, measurement_function, range, rate, waveform_points - ): # noqa: N802 - if self._defaults["ConfigureWaveformAcquisition"]["return"] != 0: - return self._defaults["ConfigureWaveformAcquisition"]["return"] - return self._defaults["ConfigureWaveformAcquisition"]["return"] + def niDMM_ConfigureWaveformAcquisition(self, vi, measurement_function, range, rate, waveform_points): # noqa: N802 + if self._defaults['ConfigureWaveformAcquisition']['return'] != 0: + return self._defaults['ConfigureWaveformAcquisition']['return'] + return self._defaults['ConfigureWaveformAcquisition']['return'] def niDMM_Disable(self, vi): # noqa: N802 - if self._defaults["Disable"]["return"] != 0: - return self._defaults["Disable"]["return"] - return self._defaults["Disable"]["return"] - - def niDMM_ExportAttributeConfigurationBuffer( - self, vi, size, configuration - ): # noqa: N802 - if self._defaults["ExportAttributeConfigurationBuffer"]["return"] != 0: - return self._defaults["ExportAttributeConfigurationBuffer"]["return"] - if ( - self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] - is None - ): - raise MockFunctionCallError( - "niDMM_ExportAttributeConfigurationBuffer", param="configuration" - ) + if self._defaults['Disable']['return'] != 0: + return self._defaults['Disable']['return'] + return self._defaults['Disable']['return'] + + def niDMM_ExportAttributeConfigurationBuffer(self, vi, size, configuration): # noqa: N802 + if self._defaults['ExportAttributeConfigurationBuffer']['return'] != 0: + return self._defaults['ExportAttributeConfigurationBuffer']['return'] + if self._defaults['ExportAttributeConfigurationBuffer']['configuration'] is None: + raise MockFunctionCallError("niDMM_ExportAttributeConfigurationBuffer", param='configuration') if size.value == 0: - return len( - self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] - ) + return len(self._defaults['ExportAttributeConfigurationBuffer']['configuration']) try: configuration_ref = configuration.contents except AttributeError: configuration_ref = configuration - for i in range( - len(self._defaults["ExportAttributeConfigurationBuffer"]["configuration"]) - ): - configuration_ref[i] = self._defaults["ExportAttributeConfigurationBuffer"][ - "configuration" - ][i] - return self._defaults["ExportAttributeConfigurationBuffer"]["return"] + for i in range(len(self._defaults['ExportAttributeConfigurationBuffer']['configuration'])): + configuration_ref[i] = self._defaults['ExportAttributeConfigurationBuffer']['configuration'][i] + return self._defaults['ExportAttributeConfigurationBuffer']['return'] def niDMM_ExportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 - if self._defaults["ExportAttributeConfigurationFile"]["return"] != 0: - return self._defaults["ExportAttributeConfigurationFile"]["return"] - return self._defaults["ExportAttributeConfigurationFile"]["return"] + if self._defaults['ExportAttributeConfigurationFile']['return'] != 0: + return self._defaults['ExportAttributeConfigurationFile']['return'] + return self._defaults['ExportAttributeConfigurationFile']['return'] def niDMM_Fetch(self, vi, maximum_time, reading): # noqa: N802 - if self._defaults["Fetch"]["return"] != 0: - return self._defaults["Fetch"]["return"] + if self._defaults['Fetch']['return'] != 0: + return self._defaults['Fetch']['return'] # reading - if self._defaults["Fetch"]["reading"] is None: - raise MockFunctionCallError("niDMM_Fetch", param="reading") + if self._defaults['Fetch']['reading'] is None: + raise MockFunctionCallError("niDMM_Fetch", param='reading') if reading is not None: - reading.contents.value = self._defaults["Fetch"]["reading"] - return self._defaults["Fetch"]["return"] - - def niDMM_FetchMultiPoint( - self, vi, maximum_time, array_size, reading_array, actual_number_of_points - ): # noqa: N802 - if self._defaults["FetchMultiPoint"]["return"] != 0: - return self._defaults["FetchMultiPoint"]["return"] + reading.contents.value = self._defaults['Fetch']['reading'] + return self._defaults['Fetch']['return'] + + def niDMM_FetchMultiPoint(self, vi, maximum_time, array_size, reading_array, actual_number_of_points): # noqa: N802 + if self._defaults['FetchMultiPoint']['return'] != 0: + return self._defaults['FetchMultiPoint']['return'] # reading_array - if self._defaults["FetchMultiPoint"]["readingArray"] is None: - raise MockFunctionCallError("niDMM_FetchMultiPoint", param="readingArray") - test_value = self._defaults["FetchMultiPoint"]["readingArray"] + if self._defaults['FetchMultiPoint']['readingArray'] is None: + raise MockFunctionCallError("niDMM_FetchMultiPoint", param='readingArray') + test_value = self._defaults['FetchMultiPoint']['readingArray'] try: reading_array_ref = reading_array.contents except AttributeError: @@ -286,25 +259,19 @@ def niDMM_FetchMultiPoint( for i in range(len(test_value)): reading_array_ref[i] = test_value[i] # actual_number_of_points - if self._defaults["FetchMultiPoint"]["actualNumberOfPoints"] is None: - raise MockFunctionCallError( - "niDMM_FetchMultiPoint", param="actualNumberOfPoints" - ) + if self._defaults['FetchMultiPoint']['actualNumberOfPoints'] is None: + raise MockFunctionCallError("niDMM_FetchMultiPoint", param='actualNumberOfPoints') if actual_number_of_points is not None: - actual_number_of_points.contents.value = self._defaults["FetchMultiPoint"][ - "actualNumberOfPoints" - ] - return self._defaults["FetchMultiPoint"]["return"] - - def niDMM_FetchWaveform( - self, vi, maximum_time, array_size, waveform_array, actual_number_of_points - ): # noqa: N802 - if self._defaults["FetchWaveform"]["return"] != 0: - return self._defaults["FetchWaveform"]["return"] + actual_number_of_points.contents.value = self._defaults['FetchMultiPoint']['actualNumberOfPoints'] + return self._defaults['FetchMultiPoint']['return'] + + def niDMM_FetchWaveform(self, vi, maximum_time, array_size, waveform_array, actual_number_of_points): # noqa: N802 + if self._defaults['FetchWaveform']['return'] != 0: + return self._defaults['FetchWaveform']['return'] # waveform_array - if self._defaults["FetchWaveform"]["waveformArray"] is None: - raise MockFunctionCallError("niDMM_FetchWaveform", param="waveformArray") - test_value = self._defaults["FetchWaveform"]["waveformArray"] + if self._defaults['FetchWaveform']['waveformArray'] is None: + raise MockFunctionCallError("niDMM_FetchWaveform", param='waveformArray') + test_value = self._defaults['FetchWaveform']['waveformArray'] try: waveform_array_ref = waveform_array.contents except AttributeError: @@ -313,281 +280,219 @@ def niDMM_FetchWaveform( for i in range(len(test_value)): waveform_array_ref[i] = test_value[i] # actual_number_of_points - if self._defaults["FetchWaveform"]["actualNumberOfPoints"] is None: - raise MockFunctionCallError( - "niDMM_FetchWaveform", param="actualNumberOfPoints" - ) + if self._defaults['FetchWaveform']['actualNumberOfPoints'] is None: + raise MockFunctionCallError("niDMM_FetchWaveform", param='actualNumberOfPoints') if actual_number_of_points is not None: - actual_number_of_points.contents.value = self._defaults["FetchWaveform"][ - "actualNumberOfPoints" - ] - return self._defaults["FetchWaveform"]["return"] - - def niDMM_GetAttributeViBoolean( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["GetAttributeViBoolean"]["return"] != 0: - return self._defaults["GetAttributeViBoolean"]["return"] + actual_number_of_points.contents.value = self._defaults['FetchWaveform']['actualNumberOfPoints'] + return self._defaults['FetchWaveform']['return'] + + def niDMM_GetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['GetAttributeViBoolean']['return'] != 0: + return self._defaults['GetAttributeViBoolean']['return'] # attribute_value - if self._defaults["GetAttributeViBoolean"]["attributeValue"] is None: - raise MockFunctionCallError( - "niDMM_GetAttributeViBoolean", param="attributeValue" - ) + if self._defaults['GetAttributeViBoolean']['attributeValue'] is None: + raise MockFunctionCallError("niDMM_GetAttributeViBoolean", param='attributeValue') if attribute_value is not None: - attribute_value.contents.value = self._defaults["GetAttributeViBoolean"][ - "attributeValue" - ] - return self._defaults["GetAttributeViBoolean"]["return"] - - def niDMM_GetAttributeViInt32( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["GetAttributeViInt32"]["return"] != 0: - return self._defaults["GetAttributeViInt32"]["return"] + attribute_value.contents.value = self._defaults['GetAttributeViBoolean']['attributeValue'] + return self._defaults['GetAttributeViBoolean']['return'] + + def niDMM_GetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['GetAttributeViInt32']['return'] != 0: + return self._defaults['GetAttributeViInt32']['return'] # attribute_value - if self._defaults["GetAttributeViInt32"]["attributeValue"] is None: - raise MockFunctionCallError( - "niDMM_GetAttributeViInt32", param="attributeValue" - ) + if self._defaults['GetAttributeViInt32']['attributeValue'] is None: + raise MockFunctionCallError("niDMM_GetAttributeViInt32", param='attributeValue') if attribute_value is not None: - attribute_value.contents.value = self._defaults["GetAttributeViInt32"][ - "attributeValue" - ] - return self._defaults["GetAttributeViInt32"]["return"] - - def niDMM_GetAttributeViReal64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["GetAttributeViReal64"]["return"] != 0: - return self._defaults["GetAttributeViReal64"]["return"] + attribute_value.contents.value = self._defaults['GetAttributeViInt32']['attributeValue'] + return self._defaults['GetAttributeViInt32']['return'] + + def niDMM_GetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['GetAttributeViReal64']['return'] != 0: + return self._defaults['GetAttributeViReal64']['return'] # attribute_value - if self._defaults["GetAttributeViReal64"]["attributeValue"] is None: - raise MockFunctionCallError( - "niDMM_GetAttributeViReal64", param="attributeValue" - ) + if self._defaults['GetAttributeViReal64']['attributeValue'] is None: + raise MockFunctionCallError("niDMM_GetAttributeViReal64", param='attributeValue') if attribute_value is not None: - attribute_value.contents.value = self._defaults["GetAttributeViReal64"][ - "attributeValue" - ] - return self._defaults["GetAttributeViReal64"]["return"] - - def niDMM_GetAttributeViString( - self, vi, channel_name, attribute_id, buffer_size, attribute_value - ): # noqa: N802 - if self._defaults["GetAttributeViString"]["return"] != 0: - return self._defaults["GetAttributeViString"]["return"] - if self._defaults["GetAttributeViString"]["attributeValue"] is None: - raise MockFunctionCallError( - "niDMM_GetAttributeViString", param="attributeValue" - ) + attribute_value.contents.value = self._defaults['GetAttributeViReal64']['attributeValue'] + return self._defaults['GetAttributeViReal64']['return'] + + def niDMM_GetAttributeViString(self, vi, channel_name, attribute_id, buffer_size, attribute_value): # noqa: N802 + if self._defaults['GetAttributeViString']['return'] != 0: + return self._defaults['GetAttributeViString']['return'] + if self._defaults['GetAttributeViString']['attributeValue'] is None: + raise MockFunctionCallError("niDMM_GetAttributeViString", param='attributeValue') if buffer_size.value == 0: - return len(self._defaults["GetAttributeViString"]["attributeValue"]) - attribute_value.value = self._defaults["GetAttributeViString"][ - "attributeValue" - ].encode("ascii") - return self._defaults["GetAttributeViString"]["return"] - - def niDMM_GetCalDateAndTime( - self, vi, cal_type, month, day, year, hour, minute - ): # noqa: N802 - if self._defaults["GetCalDateAndTime"]["return"] != 0: - return self._defaults["GetCalDateAndTime"]["return"] + return len(self._defaults['GetAttributeViString']['attributeValue']) + attribute_value.value = self._defaults['GetAttributeViString']['attributeValue'].encode('ascii') + return self._defaults['GetAttributeViString']['return'] + + def niDMM_GetCalDateAndTime(self, vi, cal_type, month, day, year, hour, minute): # noqa: N802 + if self._defaults['GetCalDateAndTime']['return'] != 0: + return self._defaults['GetCalDateAndTime']['return'] # month - if self._defaults["GetCalDateAndTime"]["month"] is None: - raise MockFunctionCallError("niDMM_GetCalDateAndTime", param="month") + if self._defaults['GetCalDateAndTime']['month'] is None: + raise MockFunctionCallError("niDMM_GetCalDateAndTime", param='month') if month is not None: - month.contents.value = self._defaults["GetCalDateAndTime"]["month"] + month.contents.value = self._defaults['GetCalDateAndTime']['month'] # day - if self._defaults["GetCalDateAndTime"]["day"] is None: - raise MockFunctionCallError("niDMM_GetCalDateAndTime", param="day") + if self._defaults['GetCalDateAndTime']['day'] is None: + raise MockFunctionCallError("niDMM_GetCalDateAndTime", param='day') if day is not None: - day.contents.value = self._defaults["GetCalDateAndTime"]["day"] + day.contents.value = self._defaults['GetCalDateAndTime']['day'] # year - if self._defaults["GetCalDateAndTime"]["year"] is None: - raise MockFunctionCallError("niDMM_GetCalDateAndTime", param="year") + if self._defaults['GetCalDateAndTime']['year'] is None: + raise MockFunctionCallError("niDMM_GetCalDateAndTime", param='year') if year is not None: - year.contents.value = self._defaults["GetCalDateAndTime"]["year"] + year.contents.value = self._defaults['GetCalDateAndTime']['year'] # hour - if self._defaults["GetCalDateAndTime"]["hour"] is None: - raise MockFunctionCallError("niDMM_GetCalDateAndTime", param="hour") + if self._defaults['GetCalDateAndTime']['hour'] is None: + raise MockFunctionCallError("niDMM_GetCalDateAndTime", param='hour') if hour is not None: - hour.contents.value = self._defaults["GetCalDateAndTime"]["hour"] + hour.contents.value = self._defaults['GetCalDateAndTime']['hour'] # minute - if self._defaults["GetCalDateAndTime"]["minute"] is None: - raise MockFunctionCallError("niDMM_GetCalDateAndTime", param="minute") + if self._defaults['GetCalDateAndTime']['minute'] is None: + raise MockFunctionCallError("niDMM_GetCalDateAndTime", param='minute') if minute is not None: - minute.contents.value = self._defaults["GetCalDateAndTime"]["minute"] - return self._defaults["GetCalDateAndTime"]["return"] + minute.contents.value = self._defaults['GetCalDateAndTime']['minute'] + return self._defaults['GetCalDateAndTime']['return'] def niDMM_GetDevTemp(self, vi, options, temperature): # noqa: N802 - if self._defaults["GetDevTemp"]["return"] != 0: - return self._defaults["GetDevTemp"]["return"] + if self._defaults['GetDevTemp']['return'] != 0: + return self._defaults['GetDevTemp']['return'] # temperature - if self._defaults["GetDevTemp"]["temperature"] is None: - raise MockFunctionCallError("niDMM_GetDevTemp", param="temperature") + if self._defaults['GetDevTemp']['temperature'] is None: + raise MockFunctionCallError("niDMM_GetDevTemp", param='temperature') if temperature is not None: - temperature.contents.value = self._defaults["GetDevTemp"]["temperature"] - return self._defaults["GetDevTemp"]["return"] + temperature.contents.value = self._defaults['GetDevTemp']['temperature'] + return self._defaults['GetDevTemp']['return'] def niDMM_GetError(self, vi, error_code, buffer_size, description): # noqa: N802 - if self._defaults["GetError"]["return"] != 0: - return self._defaults["GetError"]["return"] + if self._defaults['GetError']['return'] != 0: + return self._defaults['GetError']['return'] # error_code - if self._defaults["GetError"]["errorCode"] is None: - raise MockFunctionCallError("niDMM_GetError", param="errorCode") + if self._defaults['GetError']['errorCode'] is None: + raise MockFunctionCallError("niDMM_GetError", param='errorCode') if error_code is not None: - error_code.contents.value = self._defaults["GetError"]["errorCode"] - if self._defaults["GetError"]["description"] is None: - raise MockFunctionCallError("niDMM_GetError", param="description") + error_code.contents.value = self._defaults['GetError']['errorCode'] + if self._defaults['GetError']['description'] is None: + raise MockFunctionCallError("niDMM_GetError", param='description') if buffer_size.value == 0: - return len(self._defaults["GetError"]["description"]) - description.value = self._defaults["GetError"]["description"].encode("ascii") - return self._defaults["GetError"]["return"] + return len(self._defaults['GetError']['description']) + description.value = self._defaults['GetError']['description'].encode('ascii') + return self._defaults['GetError']['return'] def niDMM_GetExtCalRecommendedInterval(self, vi, months): # noqa: N802 - if self._defaults["GetExtCalRecommendedInterval"]["return"] != 0: - return self._defaults["GetExtCalRecommendedInterval"]["return"] + if self._defaults['GetExtCalRecommendedInterval']['return'] != 0: + return self._defaults['GetExtCalRecommendedInterval']['return'] # months - if self._defaults["GetExtCalRecommendedInterval"]["months"] is None: - raise MockFunctionCallError( - "niDMM_GetExtCalRecommendedInterval", param="months" - ) + if self._defaults['GetExtCalRecommendedInterval']['months'] is None: + raise MockFunctionCallError("niDMM_GetExtCalRecommendedInterval", param='months') if months is not None: - months.contents.value = self._defaults["GetExtCalRecommendedInterval"][ - "months" - ] - return self._defaults["GetExtCalRecommendedInterval"]["return"] + months.contents.value = self._defaults['GetExtCalRecommendedInterval']['months'] + return self._defaults['GetExtCalRecommendedInterval']['return'] def niDMM_GetLastCalTemp(self, vi, cal_type, temperature): # noqa: N802 - if self._defaults["GetLastCalTemp"]["return"] != 0: - return self._defaults["GetLastCalTemp"]["return"] + if self._defaults['GetLastCalTemp']['return'] != 0: + return self._defaults['GetLastCalTemp']['return'] # temperature - if self._defaults["GetLastCalTemp"]["temperature"] is None: - raise MockFunctionCallError("niDMM_GetLastCalTemp", param="temperature") + if self._defaults['GetLastCalTemp']['temperature'] is None: + raise MockFunctionCallError("niDMM_GetLastCalTemp", param='temperature') if temperature is not None: - temperature.contents.value = self._defaults["GetLastCalTemp"]["temperature"] - return self._defaults["GetLastCalTemp"]["return"] + temperature.contents.value = self._defaults['GetLastCalTemp']['temperature'] + return self._defaults['GetLastCalTemp']['return'] def niDMM_GetSelfCalSupported(self, vi, self_cal_supported): # noqa: N802 - if self._defaults["GetSelfCalSupported"]["return"] != 0: - return self._defaults["GetSelfCalSupported"]["return"] + if self._defaults['GetSelfCalSupported']['return'] != 0: + return self._defaults['GetSelfCalSupported']['return'] # self_cal_supported - if self._defaults["GetSelfCalSupported"]["selfCalSupported"] is None: - raise MockFunctionCallError( - "niDMM_GetSelfCalSupported", param="selfCalSupported" - ) + if self._defaults['GetSelfCalSupported']['selfCalSupported'] is None: + raise MockFunctionCallError("niDMM_GetSelfCalSupported", param='selfCalSupported') if self_cal_supported is not None: - self_cal_supported.contents.value = self._defaults["GetSelfCalSupported"][ - "selfCalSupported" - ] - return self._defaults["GetSelfCalSupported"]["return"] - - def niDMM_ImportAttributeConfigurationBuffer( - self, vi, size, configuration - ): # noqa: N802 - if self._defaults["ImportAttributeConfigurationBuffer"]["return"] != 0: - return self._defaults["ImportAttributeConfigurationBuffer"]["return"] - return self._defaults["ImportAttributeConfigurationBuffer"]["return"] + self_cal_supported.contents.value = self._defaults['GetSelfCalSupported']['selfCalSupported'] + return self._defaults['GetSelfCalSupported']['return'] + + def niDMM_ImportAttributeConfigurationBuffer(self, vi, size, configuration): # noqa: N802 + if self._defaults['ImportAttributeConfigurationBuffer']['return'] != 0: + return self._defaults['ImportAttributeConfigurationBuffer']['return'] + return self._defaults['ImportAttributeConfigurationBuffer']['return'] def niDMM_ImportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 - if self._defaults["ImportAttributeConfigurationFile"]["return"] != 0: - return self._defaults["ImportAttributeConfigurationFile"]["return"] - return self._defaults["ImportAttributeConfigurationFile"]["return"] - - def niDMM_InitWithOptions( - self, resource_name, id_query, reset_device, option_string, vi - ): # noqa: N802 - if self._defaults["InitWithOptions"]["return"] != 0: - return self._defaults["InitWithOptions"]["return"] + if self._defaults['ImportAttributeConfigurationFile']['return'] != 0: + return self._defaults['ImportAttributeConfigurationFile']['return'] + return self._defaults['ImportAttributeConfigurationFile']['return'] + + def niDMM_InitWithOptions(self, resource_name, id_query, reset_device, option_string, vi): # noqa: N802 + if self._defaults['InitWithOptions']['return'] != 0: + return self._defaults['InitWithOptions']['return'] # vi - if self._defaults["InitWithOptions"]["vi"] is None: - raise MockFunctionCallError("niDMM_InitWithOptions", param="vi") + if self._defaults['InitWithOptions']['vi'] is None: + raise MockFunctionCallError("niDMM_InitWithOptions", param='vi') if vi is not None: - vi.contents.value = self._defaults["InitWithOptions"]["vi"] - return self._defaults["InitWithOptions"]["return"] + vi.contents.value = self._defaults['InitWithOptions']['vi'] + return self._defaults['InitWithOptions']['return'] def niDMM_Initiate(self, vi): # noqa: N802 - if self._defaults["Initiate"]["return"] != 0: - return self._defaults["Initiate"]["return"] - return self._defaults["Initiate"]["return"] + if self._defaults['Initiate']['return'] != 0: + return self._defaults['Initiate']['return'] + return self._defaults['Initiate']['return'] def niDMM_LockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults["LockSession"]["return"] != 0: - return self._defaults["LockSession"]["return"] + if self._defaults['LockSession']['return'] != 0: + return self._defaults['LockSession']['return'] # caller_has_lock - if self._defaults["LockSession"]["callerHasLock"] is None: - raise MockFunctionCallError("niDMM_LockSession", param="callerHasLock") + if self._defaults['LockSession']['callerHasLock'] is None: + raise MockFunctionCallError("niDMM_LockSession", param='callerHasLock') if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults["LockSession"][ - "callerHasLock" - ] - return self._defaults["LockSession"]["return"] + caller_has_lock.contents.value = self._defaults['LockSession']['callerHasLock'] + return self._defaults['LockSession']['return'] def niDMM_PerformOpenCableComp(self, vi, conductance, susceptance): # noqa: N802 - if self._defaults["PerformOpenCableComp"]["return"] != 0: - return self._defaults["PerformOpenCableComp"]["return"] + if self._defaults['PerformOpenCableComp']['return'] != 0: + return self._defaults['PerformOpenCableComp']['return'] # conductance - if self._defaults["PerformOpenCableComp"]["conductance"] is None: - raise MockFunctionCallError( - "niDMM_PerformOpenCableComp", param="conductance" - ) + if self._defaults['PerformOpenCableComp']['conductance'] is None: + raise MockFunctionCallError("niDMM_PerformOpenCableComp", param='conductance') if conductance is not None: - conductance.contents.value = self._defaults["PerformOpenCableComp"][ - "conductance" - ] + conductance.contents.value = self._defaults['PerformOpenCableComp']['conductance'] # susceptance - if self._defaults["PerformOpenCableComp"]["susceptance"] is None: - raise MockFunctionCallError( - "niDMM_PerformOpenCableComp", param="susceptance" - ) + if self._defaults['PerformOpenCableComp']['susceptance'] is None: + raise MockFunctionCallError("niDMM_PerformOpenCableComp", param='susceptance') if susceptance is not None: - susceptance.contents.value = self._defaults["PerformOpenCableComp"][ - "susceptance" - ] - return self._defaults["PerformOpenCableComp"]["return"] + susceptance.contents.value = self._defaults['PerformOpenCableComp']['susceptance'] + return self._defaults['PerformOpenCableComp']['return'] def niDMM_PerformShortCableComp(self, vi, resistance, reactance): # noqa: N802 - if self._defaults["PerformShortCableComp"]["return"] != 0: - return self._defaults["PerformShortCableComp"]["return"] + if self._defaults['PerformShortCableComp']['return'] != 0: + return self._defaults['PerformShortCableComp']['return'] # resistance - if self._defaults["PerformShortCableComp"]["resistance"] is None: - raise MockFunctionCallError( - "niDMM_PerformShortCableComp", param="resistance" - ) + if self._defaults['PerformShortCableComp']['resistance'] is None: + raise MockFunctionCallError("niDMM_PerformShortCableComp", param='resistance') if resistance is not None: - resistance.contents.value = self._defaults["PerformShortCableComp"][ - "resistance" - ] + resistance.contents.value = self._defaults['PerformShortCableComp']['resistance'] # reactance - if self._defaults["PerformShortCableComp"]["reactance"] is None: - raise MockFunctionCallError( - "niDMM_PerformShortCableComp", param="reactance" - ) + if self._defaults['PerformShortCableComp']['reactance'] is None: + raise MockFunctionCallError("niDMM_PerformShortCableComp", param='reactance') if reactance is not None: - reactance.contents.value = self._defaults["PerformShortCableComp"][ - "reactance" - ] - return self._defaults["PerformShortCableComp"]["return"] + reactance.contents.value = self._defaults['PerformShortCableComp']['reactance'] + return self._defaults['PerformShortCableComp']['return'] def niDMM_Read(self, vi, maximum_time, reading): # noqa: N802 - if self._defaults["Read"]["return"] != 0: - return self._defaults["Read"]["return"] + if self._defaults['Read']['return'] != 0: + return self._defaults['Read']['return'] # reading - if self._defaults["Read"]["reading"] is None: - raise MockFunctionCallError("niDMM_Read", param="reading") + if self._defaults['Read']['reading'] is None: + raise MockFunctionCallError("niDMM_Read", param='reading') if reading is not None: - reading.contents.value = self._defaults["Read"]["reading"] - return self._defaults["Read"]["return"] - - def niDMM_ReadMultiPoint( - self, vi, maximum_time, array_size, reading_array, actual_number_of_points - ): # noqa: N802 - if self._defaults["ReadMultiPoint"]["return"] != 0: - return self._defaults["ReadMultiPoint"]["return"] + reading.contents.value = self._defaults['Read']['reading'] + return self._defaults['Read']['return'] + + def niDMM_ReadMultiPoint(self, vi, maximum_time, array_size, reading_array, actual_number_of_points): # noqa: N802 + if self._defaults['ReadMultiPoint']['return'] != 0: + return self._defaults['ReadMultiPoint']['return'] # reading_array - if self._defaults["ReadMultiPoint"]["readingArray"] is None: - raise MockFunctionCallError("niDMM_ReadMultiPoint", param="readingArray") - test_value = self._defaults["ReadMultiPoint"]["readingArray"] + if self._defaults['ReadMultiPoint']['readingArray'] is None: + raise MockFunctionCallError("niDMM_ReadMultiPoint", param='readingArray') + test_value = self._defaults['ReadMultiPoint']['readingArray'] try: reading_array_ref = reading_array.contents except AttributeError: @@ -596,46 +501,34 @@ def niDMM_ReadMultiPoint( for i in range(len(test_value)): reading_array_ref[i] = test_value[i] # actual_number_of_points - if self._defaults["ReadMultiPoint"]["actualNumberOfPoints"] is None: - raise MockFunctionCallError( - "niDMM_ReadMultiPoint", param="actualNumberOfPoints" - ) + if self._defaults['ReadMultiPoint']['actualNumberOfPoints'] is None: + raise MockFunctionCallError("niDMM_ReadMultiPoint", param='actualNumberOfPoints') if actual_number_of_points is not None: - actual_number_of_points.contents.value = self._defaults["ReadMultiPoint"][ - "actualNumberOfPoints" - ] - return self._defaults["ReadMultiPoint"]["return"] - - def niDMM_ReadStatus( - self, vi, acquisition_backlog, acquisition_status - ): # noqa: N802 - if self._defaults["ReadStatus"]["return"] != 0: - return self._defaults["ReadStatus"]["return"] + actual_number_of_points.contents.value = self._defaults['ReadMultiPoint']['actualNumberOfPoints'] + return self._defaults['ReadMultiPoint']['return'] + + def niDMM_ReadStatus(self, vi, acquisition_backlog, acquisition_status): # noqa: N802 + if self._defaults['ReadStatus']['return'] != 0: + return self._defaults['ReadStatus']['return'] # acquisition_backlog - if self._defaults["ReadStatus"]["acquisitionBacklog"] is None: - raise MockFunctionCallError("niDMM_ReadStatus", param="acquisitionBacklog") + if self._defaults['ReadStatus']['acquisitionBacklog'] is None: + raise MockFunctionCallError("niDMM_ReadStatus", param='acquisitionBacklog') if acquisition_backlog is not None: - acquisition_backlog.contents.value = self._defaults["ReadStatus"][ - "acquisitionBacklog" - ] + acquisition_backlog.contents.value = self._defaults['ReadStatus']['acquisitionBacklog'] # acquisition_status - if self._defaults["ReadStatus"]["acquisitionStatus"] is None: - raise MockFunctionCallError("niDMM_ReadStatus", param="acquisitionStatus") + if self._defaults['ReadStatus']['acquisitionStatus'] is None: + raise MockFunctionCallError("niDMM_ReadStatus", param='acquisitionStatus') if acquisition_status is not None: - acquisition_status.contents.value = self._defaults["ReadStatus"][ - "acquisitionStatus" - ] - return self._defaults["ReadStatus"]["return"] - - def niDMM_ReadWaveform( - self, vi, maximum_time, array_size, waveform_array, actual_number_of_points - ): # noqa: N802 - if self._defaults["ReadWaveform"]["return"] != 0: - return self._defaults["ReadWaveform"]["return"] + acquisition_status.contents.value = self._defaults['ReadStatus']['acquisitionStatus'] + return self._defaults['ReadStatus']['return'] + + def niDMM_ReadWaveform(self, vi, maximum_time, array_size, waveform_array, actual_number_of_points): # noqa: N802 + if self._defaults['ReadWaveform']['return'] != 0: + return self._defaults['ReadWaveform']['return'] # waveform_array - if self._defaults["ReadWaveform"]["waveformArray"] is None: - raise MockFunctionCallError("niDMM_ReadWaveform", param="waveformArray") - test_value = self._defaults["ReadWaveform"]["waveformArray"] + if self._defaults['ReadWaveform']['waveformArray'] is None: + raise MockFunctionCallError("niDMM_ReadWaveform", param='waveformArray') + test_value = self._defaults['ReadWaveform']['waveformArray'] try: waveform_array_ref = waveform_array.contents except AttributeError: @@ -644,297 +537,197 @@ def niDMM_ReadWaveform( for i in range(len(test_value)): waveform_array_ref[i] = test_value[i] # actual_number_of_points - if self._defaults["ReadWaveform"]["actualNumberOfPoints"] is None: - raise MockFunctionCallError( - "niDMM_ReadWaveform", param="actualNumberOfPoints" - ) + if self._defaults['ReadWaveform']['actualNumberOfPoints'] is None: + raise MockFunctionCallError("niDMM_ReadWaveform", param='actualNumberOfPoints') if actual_number_of_points is not None: - actual_number_of_points.contents.value = self._defaults["ReadWaveform"][ - "actualNumberOfPoints" - ] - return self._defaults["ReadWaveform"]["return"] + actual_number_of_points.contents.value = self._defaults['ReadWaveform']['actualNumberOfPoints'] + return self._defaults['ReadWaveform']['return'] def niDMM_ResetWithDefaults(self, vi): # noqa: N802 - if self._defaults["ResetWithDefaults"]["return"] != 0: - return self._defaults["ResetWithDefaults"]["return"] - return self._defaults["ResetWithDefaults"]["return"] + if self._defaults['ResetWithDefaults']['return'] != 0: + return self._defaults['ResetWithDefaults']['return'] + return self._defaults['ResetWithDefaults']['return'] def niDMM_SelfCal(self, vi): # noqa: N802 - if self._defaults["SelfCal"]["return"] != 0: - return self._defaults["SelfCal"]["return"] - return self._defaults["SelfCal"]["return"] + if self._defaults['SelfCal']['return'] != 0: + return self._defaults['SelfCal']['return'] + return self._defaults['SelfCal']['return'] def niDMM_SendSoftwareTrigger(self, vi): # noqa: N802 - if self._defaults["SendSoftwareTrigger"]["return"] != 0: - return self._defaults["SendSoftwareTrigger"]["return"] - return self._defaults["SendSoftwareTrigger"]["return"] - - def niDMM_SetAttributeViBoolean( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["SetAttributeViBoolean"]["return"] != 0: - return self._defaults["SetAttributeViBoolean"]["return"] - return self._defaults["SetAttributeViBoolean"]["return"] - - def niDMM_SetAttributeViInt32( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["SetAttributeViInt32"]["return"] != 0: - return self._defaults["SetAttributeViInt32"]["return"] - return self._defaults["SetAttributeViInt32"]["return"] - - def niDMM_SetAttributeViReal64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["SetAttributeViReal64"]["return"] != 0: - return self._defaults["SetAttributeViReal64"]["return"] - return self._defaults["SetAttributeViReal64"]["return"] - - def niDMM_SetAttributeViString( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["SetAttributeViString"]["return"] != 0: - return self._defaults["SetAttributeViString"]["return"] - return self._defaults["SetAttributeViString"]["return"] + if self._defaults['SendSoftwareTrigger']['return'] != 0: + return self._defaults['SendSoftwareTrigger']['return'] + return self._defaults['SendSoftwareTrigger']['return'] + + def niDMM_SetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['SetAttributeViBoolean']['return'] != 0: + return self._defaults['SetAttributeViBoolean']['return'] + return self._defaults['SetAttributeViBoolean']['return'] + + def niDMM_SetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['SetAttributeViInt32']['return'] != 0: + return self._defaults['SetAttributeViInt32']['return'] + return self._defaults['SetAttributeViInt32']['return'] + + def niDMM_SetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['SetAttributeViReal64']['return'] != 0: + return self._defaults['SetAttributeViReal64']['return'] + return self._defaults['SetAttributeViReal64']['return'] + + def niDMM_SetAttributeViString(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['SetAttributeViString']['return'] != 0: + return self._defaults['SetAttributeViString']['return'] + return self._defaults['SetAttributeViString']['return'] def niDMM_UnlockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults["UnlockSession"]["return"] != 0: - return self._defaults["UnlockSession"]["return"] + if self._defaults['UnlockSession']['return'] != 0: + return self._defaults['UnlockSession']['return'] # caller_has_lock - if self._defaults["UnlockSession"]["callerHasLock"] is None: - raise MockFunctionCallError("niDMM_UnlockSession", param="callerHasLock") + if self._defaults['UnlockSession']['callerHasLock'] is None: + raise MockFunctionCallError("niDMM_UnlockSession", param='callerHasLock') if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults["UnlockSession"][ - "callerHasLock" - ] - return self._defaults["UnlockSession"]["return"] + caller_has_lock.contents.value = self._defaults['UnlockSession']['callerHasLock'] + return self._defaults['UnlockSession']['return'] def niDMM_close(self, vi): # noqa: N802 - if self._defaults["close"]["return"] != 0: - return self._defaults["close"]["return"] - return self._defaults["close"]["return"] + if self._defaults['close']['return'] != 0: + return self._defaults['close']['return'] + return self._defaults['close']['return'] def niDMM_error_message(self, vi, error_code, error_message): # noqa: N802 - if self._defaults["error_message"]["return"] != 0: - return self._defaults["error_message"]["return"] + if self._defaults['error_message']['return'] != 0: + return self._defaults['error_message']['return'] # error_message - if self._defaults["error_message"]["errorMessage"] is None: - raise MockFunctionCallError("niDMM_error_message", param="errorMessage") - test_value = self._defaults["error_message"]["errorMessage"] + if self._defaults['error_message']['errorMessage'] is None: + raise MockFunctionCallError("niDMM_error_message", param='errorMessage') + test_value = self._defaults['error_message']['errorMessage'] if type(test_value) is str: - test_value = test_value.encode("ascii") + test_value = test_value.encode('ascii') assert len(error_message) >= len(test_value) for i in range(len(test_value)): error_message[i] = test_value[i] - return self._defaults["error_message"]["return"] + return self._defaults['error_message']['return'] def niDMM_reset(self, vi): # noqa: N802 - if self._defaults["reset"]["return"] != 0: - return self._defaults["reset"]["return"] - return self._defaults["reset"]["return"] + if self._defaults['reset']['return'] != 0: + return self._defaults['reset']['return'] + return self._defaults['reset']['return'] def niDMM_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 - if self._defaults["self_test"]["return"] != 0: - return self._defaults["self_test"]["return"] + if self._defaults['self_test']['return'] != 0: + return self._defaults['self_test']['return'] # self_test_result - if self._defaults["self_test"]["selfTestResult"] is None: - raise MockFunctionCallError("niDMM_self_test", param="selfTestResult") + if self._defaults['self_test']['selfTestResult'] is None: + raise MockFunctionCallError("niDMM_self_test", param='selfTestResult') if self_test_result is not None: - self_test_result.contents.value = self._defaults["self_test"][ - "selfTestResult" - ] + self_test_result.contents.value = self._defaults['self_test']['selfTestResult'] # self_test_message - if self._defaults["self_test"]["selfTestMessage"] is None: - raise MockFunctionCallError("niDMM_self_test", param="selfTestMessage") - test_value = self._defaults["self_test"]["selfTestMessage"] + if self._defaults['self_test']['selfTestMessage'] is None: + raise MockFunctionCallError("niDMM_self_test", param='selfTestMessage') + test_value = self._defaults['self_test']['selfTestMessage'] if type(test_value) is str: - test_value = test_value.encode("ascii") + test_value = test_value.encode('ascii') assert len(self_test_message) >= len(test_value) for i in range(len(test_value)): self_test_message[i] = test_value[i] - return self._defaults["self_test"]["return"] + return self._defaults['self_test']['return'] # Helper function to setup Mock object with default side effects and return values def set_side_effects_and_return_values(self, mock_library): mock_library.niDMM_Abort.side_effect = MockFunctionCallError("niDMM_Abort") mock_library.niDMM_Abort.return_value = 0 - mock_library.niDMM_ConfigureMeasurementAbsolute.side_effect = ( - MockFunctionCallError("niDMM_ConfigureMeasurementAbsolute") - ) + mock_library.niDMM_ConfigureMeasurementAbsolute.side_effect = MockFunctionCallError("niDMM_ConfigureMeasurementAbsolute") mock_library.niDMM_ConfigureMeasurementAbsolute.return_value = 0 - mock_library.niDMM_ConfigureMeasurementDigits.side_effect = ( - MockFunctionCallError("niDMM_ConfigureMeasurementDigits") - ) + mock_library.niDMM_ConfigureMeasurementDigits.side_effect = MockFunctionCallError("niDMM_ConfigureMeasurementDigits") mock_library.niDMM_ConfigureMeasurementDigits.return_value = 0 - mock_library.niDMM_ConfigureMultiPoint.side_effect = MockFunctionCallError( - "niDMM_ConfigureMultiPoint" - ) + mock_library.niDMM_ConfigureMultiPoint.side_effect = MockFunctionCallError("niDMM_ConfigureMultiPoint") mock_library.niDMM_ConfigureMultiPoint.return_value = 0 - mock_library.niDMM_ConfigureRTDCustom.side_effect = MockFunctionCallError( - "niDMM_ConfigureRTDCustom" - ) + mock_library.niDMM_ConfigureRTDCustom.side_effect = MockFunctionCallError("niDMM_ConfigureRTDCustom") mock_library.niDMM_ConfigureRTDCustom.return_value = 0 - mock_library.niDMM_ConfigureRTDType.side_effect = MockFunctionCallError( - "niDMM_ConfigureRTDType" - ) + mock_library.niDMM_ConfigureRTDType.side_effect = MockFunctionCallError("niDMM_ConfigureRTDType") mock_library.niDMM_ConfigureRTDType.return_value = 0 - mock_library.niDMM_ConfigureThermistorCustom.side_effect = ( - MockFunctionCallError("niDMM_ConfigureThermistorCustom") - ) + mock_library.niDMM_ConfigureThermistorCustom.side_effect = MockFunctionCallError("niDMM_ConfigureThermistorCustom") mock_library.niDMM_ConfigureThermistorCustom.return_value = 0 - mock_library.niDMM_ConfigureThermocouple.side_effect = MockFunctionCallError( - "niDMM_ConfigureThermocouple" - ) + mock_library.niDMM_ConfigureThermocouple.side_effect = MockFunctionCallError("niDMM_ConfigureThermocouple") mock_library.niDMM_ConfigureThermocouple.return_value = 0 - mock_library.niDMM_ConfigureTrigger.side_effect = MockFunctionCallError( - "niDMM_ConfigureTrigger" - ) + mock_library.niDMM_ConfigureTrigger.side_effect = MockFunctionCallError("niDMM_ConfigureTrigger") mock_library.niDMM_ConfigureTrigger.return_value = 0 - mock_library.niDMM_ConfigureWaveformAcquisition.side_effect = ( - MockFunctionCallError("niDMM_ConfigureWaveformAcquisition") - ) + mock_library.niDMM_ConfigureWaveformAcquisition.side_effect = MockFunctionCallError("niDMM_ConfigureWaveformAcquisition") mock_library.niDMM_ConfigureWaveformAcquisition.return_value = 0 mock_library.niDMM_Disable.side_effect = MockFunctionCallError("niDMM_Disable") mock_library.niDMM_Disable.return_value = 0 - mock_library.niDMM_ExportAttributeConfigurationBuffer.side_effect = ( - MockFunctionCallError("niDMM_ExportAttributeConfigurationBuffer") - ) + mock_library.niDMM_ExportAttributeConfigurationBuffer.side_effect = MockFunctionCallError("niDMM_ExportAttributeConfigurationBuffer") mock_library.niDMM_ExportAttributeConfigurationBuffer.return_value = 0 - mock_library.niDMM_ExportAttributeConfigurationFile.side_effect = ( - MockFunctionCallError("niDMM_ExportAttributeConfigurationFile") - ) + mock_library.niDMM_ExportAttributeConfigurationFile.side_effect = MockFunctionCallError("niDMM_ExportAttributeConfigurationFile") mock_library.niDMM_ExportAttributeConfigurationFile.return_value = 0 mock_library.niDMM_Fetch.side_effect = MockFunctionCallError("niDMM_Fetch") mock_library.niDMM_Fetch.return_value = 0 - mock_library.niDMM_FetchMultiPoint.side_effect = MockFunctionCallError( - "niDMM_FetchMultiPoint" - ) + mock_library.niDMM_FetchMultiPoint.side_effect = MockFunctionCallError("niDMM_FetchMultiPoint") mock_library.niDMM_FetchMultiPoint.return_value = 0 - mock_library.niDMM_FetchWaveform.side_effect = MockFunctionCallError( - "niDMM_FetchWaveform" - ) + mock_library.niDMM_FetchWaveform.side_effect = MockFunctionCallError("niDMM_FetchWaveform") mock_library.niDMM_FetchWaveform.return_value = 0 - mock_library.niDMM_GetAttributeViBoolean.side_effect = MockFunctionCallError( - "niDMM_GetAttributeViBoolean" - ) + mock_library.niDMM_GetAttributeViBoolean.side_effect = MockFunctionCallError("niDMM_GetAttributeViBoolean") mock_library.niDMM_GetAttributeViBoolean.return_value = 0 - mock_library.niDMM_GetAttributeViInt32.side_effect = MockFunctionCallError( - "niDMM_GetAttributeViInt32" - ) + mock_library.niDMM_GetAttributeViInt32.side_effect = MockFunctionCallError("niDMM_GetAttributeViInt32") mock_library.niDMM_GetAttributeViInt32.return_value = 0 - mock_library.niDMM_GetAttributeViReal64.side_effect = MockFunctionCallError( - "niDMM_GetAttributeViReal64" - ) + mock_library.niDMM_GetAttributeViReal64.side_effect = MockFunctionCallError("niDMM_GetAttributeViReal64") mock_library.niDMM_GetAttributeViReal64.return_value = 0 - mock_library.niDMM_GetAttributeViString.side_effect = MockFunctionCallError( - "niDMM_GetAttributeViString" - ) + mock_library.niDMM_GetAttributeViString.side_effect = MockFunctionCallError("niDMM_GetAttributeViString") mock_library.niDMM_GetAttributeViString.return_value = 0 - mock_library.niDMM_GetCalDateAndTime.side_effect = MockFunctionCallError( - "niDMM_GetCalDateAndTime" - ) + mock_library.niDMM_GetCalDateAndTime.side_effect = MockFunctionCallError("niDMM_GetCalDateAndTime") mock_library.niDMM_GetCalDateAndTime.return_value = 0 - mock_library.niDMM_GetDevTemp.side_effect = MockFunctionCallError( - "niDMM_GetDevTemp" - ) + mock_library.niDMM_GetDevTemp.side_effect = MockFunctionCallError("niDMM_GetDevTemp") mock_library.niDMM_GetDevTemp.return_value = 0 - mock_library.niDMM_GetError.side_effect = MockFunctionCallError( - "niDMM_GetError" - ) + mock_library.niDMM_GetError.side_effect = MockFunctionCallError("niDMM_GetError") mock_library.niDMM_GetError.return_value = 0 - mock_library.niDMM_GetExtCalRecommendedInterval.side_effect = ( - MockFunctionCallError("niDMM_GetExtCalRecommendedInterval") - ) + mock_library.niDMM_GetExtCalRecommendedInterval.side_effect = MockFunctionCallError("niDMM_GetExtCalRecommendedInterval") mock_library.niDMM_GetExtCalRecommendedInterval.return_value = 0 - mock_library.niDMM_GetLastCalTemp.side_effect = MockFunctionCallError( - "niDMM_GetLastCalTemp" - ) + mock_library.niDMM_GetLastCalTemp.side_effect = MockFunctionCallError("niDMM_GetLastCalTemp") mock_library.niDMM_GetLastCalTemp.return_value = 0 - mock_library.niDMM_GetSelfCalSupported.side_effect = MockFunctionCallError( - "niDMM_GetSelfCalSupported" - ) + mock_library.niDMM_GetSelfCalSupported.side_effect = MockFunctionCallError("niDMM_GetSelfCalSupported") mock_library.niDMM_GetSelfCalSupported.return_value = 0 - mock_library.niDMM_ImportAttributeConfigurationBuffer.side_effect = ( - MockFunctionCallError("niDMM_ImportAttributeConfigurationBuffer") - ) + mock_library.niDMM_ImportAttributeConfigurationBuffer.side_effect = MockFunctionCallError("niDMM_ImportAttributeConfigurationBuffer") mock_library.niDMM_ImportAttributeConfigurationBuffer.return_value = 0 - mock_library.niDMM_ImportAttributeConfigurationFile.side_effect = ( - MockFunctionCallError("niDMM_ImportAttributeConfigurationFile") - ) + mock_library.niDMM_ImportAttributeConfigurationFile.side_effect = MockFunctionCallError("niDMM_ImportAttributeConfigurationFile") mock_library.niDMM_ImportAttributeConfigurationFile.return_value = 0 - mock_library.niDMM_InitWithOptions.side_effect = MockFunctionCallError( - "niDMM_InitWithOptions" - ) + mock_library.niDMM_InitWithOptions.side_effect = MockFunctionCallError("niDMM_InitWithOptions") mock_library.niDMM_InitWithOptions.return_value = 0 - mock_library.niDMM_Initiate.side_effect = MockFunctionCallError( - "niDMM_Initiate" - ) + mock_library.niDMM_Initiate.side_effect = MockFunctionCallError("niDMM_Initiate") mock_library.niDMM_Initiate.return_value = 0 - mock_library.niDMM_LockSession.side_effect = MockFunctionCallError( - "niDMM_LockSession" - ) + mock_library.niDMM_LockSession.side_effect = MockFunctionCallError("niDMM_LockSession") mock_library.niDMM_LockSession.return_value = 0 - mock_library.niDMM_PerformOpenCableComp.side_effect = MockFunctionCallError( - "niDMM_PerformOpenCableComp" - ) + mock_library.niDMM_PerformOpenCableComp.side_effect = MockFunctionCallError("niDMM_PerformOpenCableComp") mock_library.niDMM_PerformOpenCableComp.return_value = 0 - mock_library.niDMM_PerformShortCableComp.side_effect = MockFunctionCallError( - "niDMM_PerformShortCableComp" - ) + mock_library.niDMM_PerformShortCableComp.side_effect = MockFunctionCallError("niDMM_PerformShortCableComp") mock_library.niDMM_PerformShortCableComp.return_value = 0 mock_library.niDMM_Read.side_effect = MockFunctionCallError("niDMM_Read") mock_library.niDMM_Read.return_value = 0 - mock_library.niDMM_ReadMultiPoint.side_effect = MockFunctionCallError( - "niDMM_ReadMultiPoint" - ) + mock_library.niDMM_ReadMultiPoint.side_effect = MockFunctionCallError("niDMM_ReadMultiPoint") mock_library.niDMM_ReadMultiPoint.return_value = 0 - mock_library.niDMM_ReadStatus.side_effect = MockFunctionCallError( - "niDMM_ReadStatus" - ) + mock_library.niDMM_ReadStatus.side_effect = MockFunctionCallError("niDMM_ReadStatus") mock_library.niDMM_ReadStatus.return_value = 0 - mock_library.niDMM_ReadWaveform.side_effect = MockFunctionCallError( - "niDMM_ReadWaveform" - ) + mock_library.niDMM_ReadWaveform.side_effect = MockFunctionCallError("niDMM_ReadWaveform") mock_library.niDMM_ReadWaveform.return_value = 0 - mock_library.niDMM_ResetWithDefaults.side_effect = MockFunctionCallError( - "niDMM_ResetWithDefaults" - ) + mock_library.niDMM_ResetWithDefaults.side_effect = MockFunctionCallError("niDMM_ResetWithDefaults") mock_library.niDMM_ResetWithDefaults.return_value = 0 mock_library.niDMM_SelfCal.side_effect = MockFunctionCallError("niDMM_SelfCal") mock_library.niDMM_SelfCal.return_value = 0 - mock_library.niDMM_SendSoftwareTrigger.side_effect = MockFunctionCallError( - "niDMM_SendSoftwareTrigger" - ) + mock_library.niDMM_SendSoftwareTrigger.side_effect = MockFunctionCallError("niDMM_SendSoftwareTrigger") mock_library.niDMM_SendSoftwareTrigger.return_value = 0 - mock_library.niDMM_SetAttributeViBoolean.side_effect = MockFunctionCallError( - "niDMM_SetAttributeViBoolean" - ) + mock_library.niDMM_SetAttributeViBoolean.side_effect = MockFunctionCallError("niDMM_SetAttributeViBoolean") mock_library.niDMM_SetAttributeViBoolean.return_value = 0 - mock_library.niDMM_SetAttributeViInt32.side_effect = MockFunctionCallError( - "niDMM_SetAttributeViInt32" - ) + mock_library.niDMM_SetAttributeViInt32.side_effect = MockFunctionCallError("niDMM_SetAttributeViInt32") mock_library.niDMM_SetAttributeViInt32.return_value = 0 - mock_library.niDMM_SetAttributeViReal64.side_effect = MockFunctionCallError( - "niDMM_SetAttributeViReal64" - ) + mock_library.niDMM_SetAttributeViReal64.side_effect = MockFunctionCallError("niDMM_SetAttributeViReal64") mock_library.niDMM_SetAttributeViReal64.return_value = 0 - mock_library.niDMM_SetAttributeViString.side_effect = MockFunctionCallError( - "niDMM_SetAttributeViString" - ) + mock_library.niDMM_SetAttributeViString.side_effect = MockFunctionCallError("niDMM_SetAttributeViString") mock_library.niDMM_SetAttributeViString.return_value = 0 - mock_library.niDMM_UnlockSession.side_effect = MockFunctionCallError( - "niDMM_UnlockSession" - ) + mock_library.niDMM_UnlockSession.side_effect = MockFunctionCallError("niDMM_UnlockSession") mock_library.niDMM_UnlockSession.return_value = 0 mock_library.niDMM_close.side_effect = MockFunctionCallError("niDMM_close") mock_library.niDMM_close.return_value = 0 - mock_library.niDMM_error_message.side_effect = MockFunctionCallError( - "niDMM_error_message" - ) + mock_library.niDMM_error_message.side_effect = MockFunctionCallError("niDMM_error_message") mock_library.niDMM_error_message.return_value = 0 mock_library.niDMM_reset.side_effect = MockFunctionCallError("niDMM_reset") mock_library.niDMM_reset.return_value = 0 - mock_library.niDMM_self_test.side_effect = MockFunctionCallError( - "niDMM_self_test" - ) + mock_library.niDMM_self_test.side_effect = MockFunctionCallError("niDMM_self_test") mock_library.niDMM_self_test.return_value = 0 diff --git a/generated/nidmm/setup.py b/generated/nidmm/setup.py index c35d4f511..2d094e8fe 100644 --- a/generated/nidmm/setup.py +++ b/generated/nidmm/setup.py @@ -15,44 +15,41 @@ def finalize_options(self): def run_tests(self): import pytest - pytest.main(self.test_args) -pypi_name = "nidmm" +pypi_name = 'nidmm' def read_contents(file_to_read): - with open(file_to_read, "r") as f: + with open(file_to_read, 'r') as f: return f.read() setup( name=pypi_name, zip_safe=True, - version="1.4.2.dev0", - description="NI-DMM Python API", - long_description=read_contents("README.rst"), - long_description_content_type="text/x-rst", - author="NI", + version='1.4.2.dev0', + description='NI-DMM Python API', + long_description=read_contents('README.rst'), + long_description_content_type='text/x-rst', + author='NI', author_email="opensource@ni.com", url="https://github.com/ni/nimi-python", maintainer="NI", maintainer_email="opensource@ni.com", - keywords=["nidmm"], - license="MIT", + keywords=['nidmm'], + license='MIT', include_package_data=True, - packages=["nidmm"], + packages=['nidmm'], install_requires=[ 'enum34;python_version<"3.4"', 'singledispatch;python_version<"3.4"', - "hightime>=0.2.0", - ], - setup_requires=[ - "pytest-runner", + 'hightime>=0.2.0', ], - tests_require=["pytest"], - test_suite="tests", + setup_requires=['pytest-runner', ], + tests_require=['pytest'], + test_suite='tests', classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -67,8 +64,8 @@ def read_contents(file_to_read): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", - "Topic :: System :: Hardware :: Hardware Drivers", + "Topic :: System :: Hardware :: Hardware Drivers" ], - cmdclass={"test": PyTest}, - package_data={pypi_name: ["VERSION"]}, + cmdclass={'test': PyTest}, + package_data={pypi_name: ['VERSION']}, ) diff --git a/generated/nifake/nifake/__init__.py b/generated/nifake/nifake/__init__.py index 646bbfef1..ae0e67e8e 100644 --- a/generated/nifake/nifake/__init__.py +++ b/generated/nifake/nifake/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = "1.4.2.dev0" +__version__ = '1.4.2.dev0' from nifake.enums import * # noqa: F403,F401,H303 from nifake.errors import DriverWarning # noqa: F401 @@ -15,12 +15,12 @@ def get_diagnostic_information(): - """Get diagnostic information about the system state that is suitable for printing or logging + '''Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - """ + ''' import os import pkg_resources import platform @@ -28,80 +28,73 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return struct.calcsize("P") == 8 + return (struct.calcsize("P") == 8) def is_os_64bit(): - return platform.machine().endswith("64") + return platform.machine().endswith('64') def is_venv(): - return "VIRTUAL_ENV" in os.environ + return 'VIRTUAL_ENV' in os.environ info = {} - info["os"] = {} - info["python"] = {} - info["driver"] = {} - info["module"] = {} - if platform.system() == "Windows": + info['os'] = {} + info['python'] = {} + info['driver'] = {} + info['module'] = {} + if platform.system() == 'Windows': try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = "Windows" + os_name = 'Windows' try: - driver_version_key = winreg.OpenKey( - winreg.HKEY_LOCAL_MACHINE, - r"SOFTWARE\National Instruments\NI-FAKE\CurrentVersion", - ) + driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-FAKE\CurrentVersion") driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = "Unknown" - elif platform.system() == "Linux": - os_name = "Linux" - driver_version = "Unknown" + driver_version = 'Unknown' + elif platform.system() == 'Linux': + os_name = 'Linux' + driver_version = 'Unknown' else: - raise SystemError("Unsupported platform: {}".format(platform.system())) + raise SystemError('Unsupported platform: {}'.format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [ - { - "name": i.key, - "version": i.version, - } - for i in installed_packages - ] - - info["os"]["name"] = os_name - info["os"]["version"] = platform.version() - info["os"]["bits"] = "64" if is_os_64bit() else "32" - info["driver"]["name"] = "NI-FAKE" - info["driver"]["version"] = driver_version - info["module"]["name"] = "nifake" - info["module"]["version"] = "1.4.2.dev0" - info["python"]["version"] = sys.version - info["python"]["bits"] = "64" if is_python_64bit() else "32" - info["python"]["is_venv"] = is_venv() - info["python"]["packages"] = installed_packages_list + installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] + + info['os']['name'] = os_name + info['os']['version'] = platform.version() + info['os']['bits'] = '64' if is_os_64bit() else '32' + info['driver']['name'] = "NI-FAKE" + info['driver']['version'] = driver_version + info['module']['name'] = 'nifake' + info['module']['version'] = "1.4.2.dev0" + info['python']['version'] = sys.version + info['python']['bits'] = '64' if is_python_64bit() else '32' + info['python']['is_venv'] = is_venv() + info['python']['packages'] = installed_packages_list return info def print_diagnostic_information(): - """Print diagnostic information in a format suitable for issue report + '''Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - """ + ''' info = get_diagnostic_information() - row_format = " {:<10} {}" - for type in ["OS", "Driver", "Module", "Python"]: + row_format = ' {:<10} {}' + for type in ['OS', 'Driver', 'Module', 'Python']: typename = type.lower() - print(type + ":") + print(type + ':') for item in info[typename]: - if item != "packages": - print(row_format.format(item.title() + ":", info[typename][item])) - print(" Installed Packages:") - for p in info["python"]["packages"]: - print((" " * 8) + p["name"] + "==" + p["version"]) + if item != 'packages': + print(row_format.format(item.title() + ':', info[typename][item])) + print(' Installed Packages:') + for p in info['python']['packages']: + print((' ' * 8) + p['name'] + '==' + p['version']) return info + + diff --git a/generated/nifake/nifake/_attributes.py b/generated/nifake/nifake/_attributes.py index 00744f460..1b8c55874 100644 --- a/generated/nifake/nifake/_attributes.py +++ b/generated/nifake/nifake/_attributes.py @@ -6,13 +6,14 @@ class Attribute(object): - """Base class for all typed attributes.""" + '''Base class for all typed attributes.''' def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -21,19 +22,16 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): + def __get__(self, session, session_type): - return hightime.timedelta( - milliseconds=session._get_attribute_vi_int32(self._attribute_id) - ) + return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_int32( - self._attribute_id, - _converters.convert_timedelta_to_milliseconds_int32(value).value, - ) + session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) class AttributeViInt64(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -42,6 +40,7 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -50,19 +49,16 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): + def __get__(self, session, session_type): - return hightime.timedelta( - seconds=session._get_attribute_vi_real64(self._attribute_id) - ) + return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_real64( - self._attribute_id, - _converters.convert_timedelta_to_seconds_real64(value).value, - ) + session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) class AttributeViString(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -71,17 +67,16 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string( - self._attribute_id, - _converters.convert_repeated_capabilities_without_prefix(value), - ) + session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) class AttributeViBoolean(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -90,36 +85,31 @@ def __set__(self, session, value): class AttributeEnum(object): + def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type( - self._underlying_attribute.__get__(session, session_type) - ) + return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError( - "must be " - + str(self._attribute_type.__name__) - + " not " - + str(type(value).__name__) - ) + raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): + def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from nifake.session import SessionReference - return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session( - self._attribute_id, _converters.convert_to_nitclk_session_number(value) - ) + session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) + + + diff --git a/generated/nifake/nifake/_converters.py b/generated/nifake/nifake/_converters.py index 8b81598c1..608ae5753 100644 --- a/generated/nifake/nifake/_converters.py +++ b/generated/nifake/nifake/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - """Base version that should not be called + '''Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,38 +40,36 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - """ - raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) + ''' + raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - """Integer version""" + '''Integer version''' return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - """String version (this is the most complex) + '''String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - """ + ''' # First we deal with a list - rep_cap_list = repeated_capability.split(",") + rep_cap_list = repeated_capability.split(',') if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, "").replace(":", "-") - rc = r.split("-") + r = repeated_capability.strip().replace(prefix, '').replace(':', '-') + rc = r.split('-') if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError( - "Multiple '-' or ':'", repeated_capability - ) + raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) try: start = int(rc[0]) end = int(rc[1]) @@ -87,7 +85,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, "").strip()] + return [repeated_capability.replace(prefix, '').strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -96,7 +94,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - """Iterable version - can handle lists, ranges, and tuples""" + '''Iterable version - can handle lists, ranges, and tuples''' rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -105,22 +103,16 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - """slice version""" - + '''slice version''' def ifnone(a, b): return b if a is None else a - # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range( - ifnone(repeated_capability.start, 0), - repeated_capability.stop, - ifnone(repeated_capability.step, 1), - ) + rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=""): - """Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=''): + '''Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -128,17 +120,15 @@ def convert_repeated_capabilities(repeated_capability, prefix=""): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - """ + ''' # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [ - prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) - ] + return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] def convert_repeated_capabilities_without_prefix(repeated_capability): - """Convert a repeated capabilities object, without any prefix, to a comma delimited list + '''Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -154,8 +144,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - """ - return ",".join(convert_repeated_capabilities(repeated_capability, "")) + ''' + return ','.join(convert_repeated_capabilities(repeated_capability, '')) def _convert_timedelta(value, library_type, scaling): @@ -168,14 +158,7 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [ - _visatype.ViInt64, - _visatype.ViInt32, - _visatype.ViUInt32, - _visatype.ViInt16, - _visatype.ViUInt16, - _visatype.ViInt8, - ]: + if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -212,36 +195,34 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - "rangecheck": "RangeCheck", - "queryinstrstatus": "QueryInstrStatus", - "cache": "Cache", - "simulate": "Simulate", - "recordcoercions": "RecordCoercions", - "interchangecheck": "InterchangeCheck", - "driversetup": "DriverSetup", - "range_check": "RangeCheck", - "query_instr_status": "QueryInstrStatus", - "record_coercions": "RecordCoercions", - "interchange_check": "InterchangeCheck", - "driver_setup": "DriverSetup", + 'rangecheck': 'RangeCheck', + 'queryinstrstatus': 'QueryInstrStatus', + 'cache': 'Cache', + 'simulate': 'Simulate', + 'recordcoercions': 'RecordCoercions', + 'interchangecheck': 'InterchangeCheck', + 'driversetup': 'DriverSetup', + 'range_check': 'RangeCheck', + 'query_instr_status': 'QueryInstrStatus', + 'record_coercions': 'RecordCoercions', + 'interchange_check': 'InterchangeCheck', + 'driver_setup': 'DriverSetup', } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": - value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") - elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": + if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': + value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') + elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': if not isinstance(values[k], dict): - raise TypeError("DriverSetup must be a dictionary") - value = "DriverSetup=" + ( - ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) - ) + raise TypeError('DriverSetup must be a dictionary') + value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) else: - value = k + ("=1" if values[k] is True else "=0") + value = k + ('=1' if values[k] is True else '=0') init_with_options.append(value) - init_with_options_string = ",".join(init_with_options) + init_with_options_string = ','.join(init_with_options) return init_with_options_string @@ -270,11 +251,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(",")] + return [x.strip() for x in comma_separated_string.split(',')] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -286,22 +267,16 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - """ - chained_repeated_capability_items = convert_comma_separated_string_to_list( - chained_repeated_capability - ) - repeated_capability_lists = [ - [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) - ] + ''' + chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) + repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] for item in chained_repeated_capability_items: - repeated_capability_lists = [ - x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) - ] - return [ - ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists - ] + repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] + return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] # nifake specific converter(s) - used only for testing def convert_double_each_element(numbers): return [x * 2 for x in numbers] + + diff --git a/generated/nifake/nifake/_library.py b/generated/nifake/nifake/_library.py index 1b2df9b00..293ea9d04 100644 --- a/generated/nifake/nifake/_library.py +++ b/generated/nifake/nifake/_library.py @@ -11,11 +11,11 @@ class Library(object): - """Library + '''Library Wrapper around driver library. Class will setup the correct ctypes information for every function on first call. - """ + ''' def __init__(self, ctypes_library): self._func_lock = threading.Lock() @@ -91,7 +91,7 @@ def _get_library_function(self, name): def niFake_Abort(self, vi): # noqa: N802 with self._func_lock: if self.niFake_Abort_cfunc is None: - self.niFake_Abort_cfunc = self._get_library_function("niFake_Abort") + self.niFake_Abort_cfunc = self._get_library_function('niFake_Abort') self.niFake_Abort_cfunc.argtypes = [ViSession] # noqa: F405 self.niFake_Abort_cfunc.restype = ViStatus # noqa: F405 return self.niFake_Abort_cfunc(vi) @@ -99,525 +99,247 @@ def niFake_Abort(self, vi): # noqa: N802 def niFake_AcceptListOfDurationsInSeconds(self, vi, count, delays): # noqa: N802 with self._func_lock: if self.niFake_AcceptListOfDurationsInSeconds_cfunc is None: - self.niFake_AcceptListOfDurationsInSeconds_cfunc = ( - self._get_library_function("niFake_AcceptListOfDurationsInSeconds") - ) - self.niFake_AcceptListOfDurationsInSeconds_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViReal64), - ] # noqa: F405 - self.niFake_AcceptListOfDurationsInSeconds_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niFake_AcceptListOfDurationsInSeconds_cfunc = self._get_library_function('niFake_AcceptListOfDurationsInSeconds') + self.niFake_AcceptListOfDurationsInSeconds_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niFake_AcceptListOfDurationsInSeconds_cfunc.restype = ViStatus # noqa: F405 return self.niFake_AcceptListOfDurationsInSeconds_cfunc(vi, count, delays) - def niFake_BoolArrayOutputFunction( - self, vi, number_of_elements, an_array - ): # noqa: N802 + def niFake_BoolArrayOutputFunction(self, vi, number_of_elements, an_array): # noqa: N802 with self._func_lock: if self.niFake_BoolArrayOutputFunction_cfunc is None: - self.niFake_BoolArrayOutputFunction_cfunc = self._get_library_function( - "niFake_BoolArrayOutputFunction" - ) - self.niFake_BoolArrayOutputFunction_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 - self.niFake_BoolArrayOutputFunction_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFake_BoolArrayOutputFunction_cfunc( - vi, number_of_elements, an_array - ) + self.niFake_BoolArrayOutputFunction_cfunc = self._get_library_function('niFake_BoolArrayOutputFunction') + self.niFake_BoolArrayOutputFunction_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niFake_BoolArrayOutputFunction_cfunc.restype = ViStatus # noqa: F405 + return self.niFake_BoolArrayOutputFunction_cfunc(vi, number_of_elements, an_array) def niFake_DoubleAllTheNums(self, vi, number_count, numbers): # noqa: N802 with self._func_lock: if self.niFake_DoubleAllTheNums_cfunc is None: - self.niFake_DoubleAllTheNums_cfunc = self._get_library_function( - "niFake_DoubleAllTheNums" - ) - self.niFake_DoubleAllTheNums_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niFake_DoubleAllTheNums_cfunc = self._get_library_function('niFake_DoubleAllTheNums') + self.niFake_DoubleAllTheNums_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 self.niFake_DoubleAllTheNums_cfunc.restype = ViStatus # noqa: F405 return self.niFake_DoubleAllTheNums_cfunc(vi, number_count, numbers) - def niFake_EnumArrayOutputFunction( - self, vi, number_of_elements, an_array - ): # noqa: N802 + def niFake_EnumArrayOutputFunction(self, vi, number_of_elements, an_array): # noqa: N802 with self._func_lock: if self.niFake_EnumArrayOutputFunction_cfunc is None: - self.niFake_EnumArrayOutputFunction_cfunc = self._get_library_function( - "niFake_EnumArrayOutputFunction" - ) - self.niFake_EnumArrayOutputFunction_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViInt16), - ] # noqa: F405 - self.niFake_EnumArrayOutputFunction_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFake_EnumArrayOutputFunction_cfunc( - vi, number_of_elements, an_array - ) + self.niFake_EnumArrayOutputFunction_cfunc = self._get_library_function('niFake_EnumArrayOutputFunction') + self.niFake_EnumArrayOutputFunction_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt16)] # noqa: F405 + self.niFake_EnumArrayOutputFunction_cfunc.restype = ViStatus # noqa: F405 + return self.niFake_EnumArrayOutputFunction_cfunc(vi, number_of_elements, an_array) def niFake_EnumInputFunctionWithDefaults(self, vi, a_turtle): # noqa: N802 with self._func_lock: if self.niFake_EnumInputFunctionWithDefaults_cfunc is None: - self.niFake_EnumInputFunctionWithDefaults_cfunc = ( - self._get_library_function("niFake_EnumInputFunctionWithDefaults") - ) - self.niFake_EnumInputFunctionWithDefaults_cfunc.argtypes = [ - ViSession, - ViInt16, - ] # noqa: F405 - self.niFake_EnumInputFunctionWithDefaults_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niFake_EnumInputFunctionWithDefaults_cfunc = self._get_library_function('niFake_EnumInputFunctionWithDefaults') + self.niFake_EnumInputFunctionWithDefaults_cfunc.argtypes = [ViSession, ViInt16] # noqa: F405 + self.niFake_EnumInputFunctionWithDefaults_cfunc.restype = ViStatus # noqa: F405 return self.niFake_EnumInputFunctionWithDefaults_cfunc(vi, a_turtle) - def niFake_ExportAttributeConfigurationBuffer( - self, vi, size_in_bytes, configuration - ): # noqa: N802 + def niFake_ExportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 with self._func_lock: if self.niFake_ExportAttributeConfigurationBuffer_cfunc is None: - self.niFake_ExportAttributeConfigurationBuffer_cfunc = ( - self._get_library_function( - "niFake_ExportAttributeConfigurationBuffer" - ) - ) - self.niFake_ExportAttributeConfigurationBuffer_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViInt8), - ] # noqa: F405 - self.niFake_ExportAttributeConfigurationBuffer_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFake_ExportAttributeConfigurationBuffer_cfunc( - vi, size_in_bytes, configuration - ) - - def niFake_FetchWaveform( - self, vi, number_of_samples, waveform_data, actual_number_of_samples - ): # noqa: N802 + self.niFake_ExportAttributeConfigurationBuffer_cfunc = self._get_library_function('niFake_ExportAttributeConfigurationBuffer') + self.niFake_ExportAttributeConfigurationBuffer_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt8)] # noqa: F405 + self.niFake_ExportAttributeConfigurationBuffer_cfunc.restype = ViStatus # noqa: F405 + return self.niFake_ExportAttributeConfigurationBuffer_cfunc(vi, size_in_bytes, configuration) + + def niFake_FetchWaveform(self, vi, number_of_samples, waveform_data, actual_number_of_samples): # noqa: N802 with self._func_lock: if self.niFake_FetchWaveform_cfunc is None: - self.niFake_FetchWaveform_cfunc = self._get_library_function( - "niFake_FetchWaveform" - ) - self.niFake_FetchWaveform_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niFake_FetchWaveform_cfunc = self._get_library_function('niFake_FetchWaveform') + self.niFake_FetchWaveform_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt32)] # noqa: F405 self.niFake_FetchWaveform_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_FetchWaveform_cfunc( - vi, number_of_samples, waveform_data, actual_number_of_samples - ) + return self.niFake_FetchWaveform_cfunc(vi, number_of_samples, waveform_data, actual_number_of_samples) def niFake_GetABoolean(self, vi, a_boolean): # noqa: N802 with self._func_lock: if self.niFake_GetABoolean_cfunc is None: - self.niFake_GetABoolean_cfunc = self._get_library_function( - "niFake_GetABoolean" - ) - self.niFake_GetABoolean_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niFake_GetABoolean_cfunc = self._get_library_function('niFake_GetABoolean') + self.niFake_GetABoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niFake_GetABoolean_cfunc.restype = ViStatus # noqa: F405 return self.niFake_GetABoolean_cfunc(vi, a_boolean) def niFake_GetANumber(self, vi, a_number): # noqa: N802 with self._func_lock: if self.niFake_GetANumber_cfunc is None: - self.niFake_GetANumber_cfunc = self._get_library_function( - "niFake_GetANumber" - ) - self.niFake_GetANumber_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt16), - ] # noqa: F405 + self.niFake_GetANumber_cfunc = self._get_library_function('niFake_GetANumber') + self.niFake_GetANumber_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt16)] # noqa: F405 self.niFake_GetANumber_cfunc.restype = ViStatus # noqa: F405 return self.niFake_GetANumber_cfunc(vi, a_number) def niFake_GetAStringOfFixedMaximumSize(self, vi, a_string): # noqa: N802 with self._func_lock: if self.niFake_GetAStringOfFixedMaximumSize_cfunc is None: - self.niFake_GetAStringOfFixedMaximumSize_cfunc = ( - self._get_library_function("niFake_GetAStringOfFixedMaximumSize") - ) - self.niFake_GetAStringOfFixedMaximumSize_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niFake_GetAStringOfFixedMaximumSize_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niFake_GetAStringOfFixedMaximumSize_cfunc = self._get_library_function('niFake_GetAStringOfFixedMaximumSize') + self.niFake_GetAStringOfFixedMaximumSize_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niFake_GetAStringOfFixedMaximumSize_cfunc.restype = ViStatus # noqa: F405 return self.niFake_GetAStringOfFixedMaximumSize_cfunc(vi, a_string) def niFake_GetAStringUsingPythonCode(self, vi, a_number, a_string): # noqa: N802 with self._func_lock: if self.niFake_GetAStringUsingPythonCode_cfunc is None: - self.niFake_GetAStringUsingPythonCode_cfunc = ( - self._get_library_function("niFake_GetAStringUsingPythonCode") - ) - self.niFake_GetAStringUsingPythonCode_cfunc.argtypes = [ - ViSession, - ViInt16, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niFake_GetAStringUsingPythonCode_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niFake_GetAStringUsingPythonCode_cfunc = self._get_library_function('niFake_GetAStringUsingPythonCode') + self.niFake_GetAStringUsingPythonCode_cfunc.argtypes = [ViSession, ViInt16, ctypes.POINTER(ViChar)] # noqa: F405 + self.niFake_GetAStringUsingPythonCode_cfunc.restype = ViStatus # noqa: F405 return self.niFake_GetAStringUsingPythonCode_cfunc(vi, a_number, a_string) def niFake_GetAnIviDanceString(self, vi, buffer_size, a_string): # noqa: N802 with self._func_lock: if self.niFake_GetAnIviDanceString_cfunc is None: - self.niFake_GetAnIviDanceString_cfunc = self._get_library_function( - "niFake_GetAnIviDanceString" - ) - self.niFake_GetAnIviDanceString_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niFake_GetAnIviDanceString_cfunc = self._get_library_function('niFake_GetAnIviDanceString') + self.niFake_GetAnIviDanceString_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niFake_GetAnIviDanceString_cfunc.restype = ViStatus # noqa: F405 return self.niFake_GetAnIviDanceString_cfunc(vi, buffer_size, a_string) - def niFake_GetAnIviDanceWithATwistString( - self, vi, buffer_size, a_string, actual_size - ): # noqa: N802 + def niFake_GetAnIviDanceWithATwistString(self, vi, buffer_size, a_string, actual_size): # noqa: N802 with self._func_lock: if self.niFake_GetAnIviDanceWithATwistString_cfunc is None: - self.niFake_GetAnIviDanceWithATwistString_cfunc = ( - self._get_library_function("niFake_GetAnIviDanceWithATwistString") - ) - self.niFake_GetAnIviDanceWithATwistString_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niFake_GetAnIviDanceWithATwistString_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFake_GetAnIviDanceWithATwistString_cfunc( - vi, buffer_size, a_string, actual_size - ) - - def niFake_GetArrayForPythonCodeCustomType( - self, vi, number_of_elements, array_out - ): # noqa: N802 + self.niFake_GetAnIviDanceWithATwistString_cfunc = self._get_library_function('niFake_GetAnIviDanceWithATwistString') + self.niFake_GetAnIviDanceWithATwistString_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niFake_GetAnIviDanceWithATwistString_cfunc.restype = ViStatus # noqa: F405 + return self.niFake_GetAnIviDanceWithATwistString_cfunc(vi, buffer_size, a_string, actual_size) + + def niFake_GetArrayForPythonCodeCustomType(self, vi, number_of_elements, array_out): # noqa: N802 with self._func_lock: if self.niFake_GetArrayForPythonCodeCustomType_cfunc is None: - self.niFake_GetArrayForPythonCodeCustomType_cfunc = ( - self._get_library_function("niFake_GetArrayForPythonCodeCustomType") - ) - self.niFake_GetArrayForPythonCodeCustomType_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(custom_struct.struct_CustomStruct), - ] # noqa: F405 - self.niFake_GetArrayForPythonCodeCustomType_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFake_GetArrayForPythonCodeCustomType_cfunc( - vi, number_of_elements, array_out - ) - - def niFake_GetArrayForPythonCodeDouble( - self, vi, number_of_elements, array_out - ): # noqa: N802 + self.niFake_GetArrayForPythonCodeCustomType_cfunc = self._get_library_function('niFake_GetArrayForPythonCodeCustomType') + self.niFake_GetArrayForPythonCodeCustomType_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(custom_struct.struct_CustomStruct)] # noqa: F405 + self.niFake_GetArrayForPythonCodeCustomType_cfunc.restype = ViStatus # noqa: F405 + return self.niFake_GetArrayForPythonCodeCustomType_cfunc(vi, number_of_elements, array_out) + + def niFake_GetArrayForPythonCodeDouble(self, vi, number_of_elements, array_out): # noqa: N802 with self._func_lock: if self.niFake_GetArrayForPythonCodeDouble_cfunc is None: - self.niFake_GetArrayForPythonCodeDouble_cfunc = ( - self._get_library_function("niFake_GetArrayForPythonCodeDouble") - ) - self.niFake_GetArrayForPythonCodeDouble_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViReal64), - ] # noqa: F405 - self.niFake_GetArrayForPythonCodeDouble_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFake_GetArrayForPythonCodeDouble_cfunc( - vi, number_of_elements, array_out - ) + self.niFake_GetArrayForPythonCodeDouble_cfunc = self._get_library_function('niFake_GetArrayForPythonCodeDouble') + self.niFake_GetArrayForPythonCodeDouble_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niFake_GetArrayForPythonCodeDouble_cfunc.restype = ViStatus # noqa: F405 + return self.niFake_GetArrayForPythonCodeDouble_cfunc(vi, number_of_elements, array_out) def niFake_GetArraySizeForPythonCode(self, vi, size_out): # noqa: N802 with self._func_lock: if self.niFake_GetArraySizeForPythonCode_cfunc is None: - self.niFake_GetArraySizeForPythonCode_cfunc = ( - self._get_library_function("niFake_GetArraySizeForPythonCode") - ) - self.niFake_GetArraySizeForPythonCode_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niFake_GetArraySizeForPythonCode_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niFake_GetArraySizeForPythonCode_cfunc = self._get_library_function('niFake_GetArraySizeForPythonCode') + self.niFake_GetArraySizeForPythonCode_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32)] # noqa: F405 + self.niFake_GetArraySizeForPythonCode_cfunc.restype = ViStatus # noqa: F405 return self.niFake_GetArraySizeForPythonCode_cfunc(vi, size_out) def niFake_GetArrayUsingIviDance(self, vi, array_size, array_out): # noqa: N802 with self._func_lock: if self.niFake_GetArrayUsingIviDance_cfunc is None: - self.niFake_GetArrayUsingIviDance_cfunc = self._get_library_function( - "niFake_GetArrayUsingIviDance" - ) - self.niFake_GetArrayUsingIviDance_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niFake_GetArrayUsingIviDance_cfunc = self._get_library_function('niFake_GetArrayUsingIviDance') + self.niFake_GetArrayUsingIviDance_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 self.niFake_GetArrayUsingIviDance_cfunc.restype = ViStatus # noqa: F405 return self.niFake_GetArrayUsingIviDance_cfunc(vi, array_size, array_out) - def niFake_GetAttributeViBoolean( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niFake_GetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niFake_GetAttributeViBoolean_cfunc is None: - self.niFake_GetAttributeViBoolean_cfunc = self._get_library_function( - "niFake_GetAttributeViBoolean" - ) - self.niFake_GetAttributeViBoolean_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niFake_GetAttributeViBoolean_cfunc = self._get_library_function('niFake_GetAttributeViBoolean') + self.niFake_GetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niFake_GetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_GetAttributeViBoolean_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niFake_GetAttributeViBoolean_cfunc(vi, channel_name, attribute_id, attribute_value) - def niFake_GetAttributeViInt32( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niFake_GetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niFake_GetAttributeViInt32_cfunc is None: - self.niFake_GetAttributeViInt32_cfunc = self._get_library_function( - "niFake_GetAttributeViInt32" - ) - self.niFake_GetAttributeViInt32_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niFake_GetAttributeViInt32_cfunc = self._get_library_function('niFake_GetAttributeViInt32') + self.niFake_GetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViInt32)] # noqa: F405 self.niFake_GetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_GetAttributeViInt32_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niFake_GetAttributeViInt32_cfunc(vi, channel_name, attribute_id, attribute_value) - def niFake_GetAttributeViInt64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niFake_GetAttributeViInt64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niFake_GetAttributeViInt64_cfunc is None: - self.niFake_GetAttributeViInt64_cfunc = self._get_library_function( - "niFake_GetAttributeViInt64" - ) - self.niFake_GetAttributeViInt64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViInt64), - ] # noqa: F405 + self.niFake_GetAttributeViInt64_cfunc = self._get_library_function('niFake_GetAttributeViInt64') + self.niFake_GetAttributeViInt64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViInt64)] # noqa: F405 self.niFake_GetAttributeViInt64_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_GetAttributeViInt64_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niFake_GetAttributeViInt64_cfunc(vi, channel_name, attribute_id, attribute_value) - def niFake_GetAttributeViReal64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niFake_GetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niFake_GetAttributeViReal64_cfunc is None: - self.niFake_GetAttributeViReal64_cfunc = self._get_library_function( - "niFake_GetAttributeViReal64" - ) - self.niFake_GetAttributeViReal64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niFake_GetAttributeViReal64_cfunc = self._get_library_function('niFake_GetAttributeViReal64') + self.niFake_GetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViReal64)] # noqa: F405 self.niFake_GetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_GetAttributeViReal64_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niFake_GetAttributeViReal64_cfunc(vi, channel_name, attribute_id, attribute_value) - def niFake_GetAttributeViString( - self, vi, channel_name, attribute_id, buffer_size, attribute_value - ): # noqa: N802 + def niFake_GetAttributeViString(self, vi, channel_name, attribute_id, buffer_size, attribute_value): # noqa: N802 with self._func_lock: if self.niFake_GetAttributeViString_cfunc is None: - self.niFake_GetAttributeViString_cfunc = self._get_library_function( - "niFake_GetAttributeViString" - ) - self.niFake_GetAttributeViString_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niFake_GetAttributeViString_cfunc = self._get_library_function('niFake_GetAttributeViString') + self.niFake_GetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niFake_GetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_GetAttributeViString_cfunc( - vi, channel_name, attribute_id, buffer_size, attribute_value - ) + return self.niFake_GetAttributeViString_cfunc(vi, channel_name, attribute_id, buffer_size, attribute_value) - def niFake_GetCalDateAndTime( - self, vi, cal_type, month, day, year, hour, minute - ): # noqa: N802 + def niFake_GetCalDateAndTime(self, vi, cal_type, month, day, year, hour, minute): # noqa: N802 with self._func_lock: if self.niFake_GetCalDateAndTime_cfunc is None: - self.niFake_GetCalDateAndTime_cfunc = self._get_library_function( - "niFake_GetCalDateAndTime" - ) - self.niFake_GetCalDateAndTime_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niFake_GetCalDateAndTime_cfunc = self._get_library_function('niFake_GetCalDateAndTime') + self.niFake_GetCalDateAndTime_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 self.niFake_GetCalDateAndTime_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_GetCalDateAndTime_cfunc( - vi, cal_type, month, day, year, hour, minute - ) + return self.niFake_GetCalDateAndTime_cfunc(vi, cal_type, month, day, year, hour, minute) def niFake_GetCalInterval(self, vi, months): # noqa: N802 with self._func_lock: if self.niFake_GetCalInterval_cfunc is None: - self.niFake_GetCalInterval_cfunc = self._get_library_function( - "niFake_GetCalInterval" - ) - self.niFake_GetCalInterval_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niFake_GetCalInterval_cfunc = self._get_library_function('niFake_GetCalInterval') + self.niFake_GetCalInterval_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32)] # noqa: F405 self.niFake_GetCalInterval_cfunc.restype = ViStatus # noqa: F405 return self.niFake_GetCalInterval_cfunc(vi, months) def niFake_GetCustomType(self, vi, cs): # noqa: N802 with self._func_lock: if self.niFake_GetCustomType_cfunc is None: - self.niFake_GetCustomType_cfunc = self._get_library_function( - "niFake_GetCustomType" - ) - self.niFake_GetCustomType_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(custom_struct.struct_CustomStruct), - ] # noqa: F405 + self.niFake_GetCustomType_cfunc = self._get_library_function('niFake_GetCustomType') + self.niFake_GetCustomType_cfunc.argtypes = [ViSession, ctypes.POINTER(custom_struct.struct_CustomStruct)] # noqa: F405 self.niFake_GetCustomType_cfunc.restype = ViStatus # noqa: F405 return self.niFake_GetCustomType_cfunc(vi, cs) def niFake_GetCustomTypeArray(self, vi, number_of_elements, cs): # noqa: N802 with self._func_lock: if self.niFake_GetCustomTypeArray_cfunc is None: - self.niFake_GetCustomTypeArray_cfunc = self._get_library_function( - "niFake_GetCustomTypeArray" - ) - self.niFake_GetCustomTypeArray_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(custom_struct.struct_CustomStruct), - ] # noqa: F405 + self.niFake_GetCustomTypeArray_cfunc = self._get_library_function('niFake_GetCustomTypeArray') + self.niFake_GetCustomTypeArray_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(custom_struct.struct_CustomStruct)] # noqa: F405 self.niFake_GetCustomTypeArray_cfunc.restype = ViStatus # noqa: F405 return self.niFake_GetCustomTypeArray_cfunc(vi, number_of_elements, cs) def niFake_GetEnumValue(self, vi, a_quantity, a_turtle): # noqa: N802 with self._func_lock: if self.niFake_GetEnumValue_cfunc is None: - self.niFake_GetEnumValue_cfunc = self._get_library_function( - "niFake_GetEnumValue" - ) - self.niFake_GetEnumValue_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt16), - ] # noqa: F405 + self.niFake_GetEnumValue_cfunc = self._get_library_function('niFake_GetEnumValue') + self.niFake_GetEnumValue_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt16)] # noqa: F405 self.niFake_GetEnumValue_cfunc.restype = ViStatus # noqa: F405 return self.niFake_GetEnumValue_cfunc(vi, a_quantity, a_turtle) def niFake_GetError(self, vi, error_code, buffer_size, description): # noqa: N802 with self._func_lock: if self.niFake_GetError_cfunc is None: - self.niFake_GetError_cfunc = self._get_library_function( - "niFake_GetError" - ) - self.niFake_GetError_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViStatus), - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niFake_GetError_cfunc = self._get_library_function('niFake_GetError') + self.niFake_GetError_cfunc.argtypes = [ViSession, ctypes.POINTER(ViStatus), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niFake_GetError_cfunc.restype = ViStatus # noqa: F405 return self.niFake_GetError_cfunc(vi, error_code, buffer_size, description) - def niFake_ImportAttributeConfigurationBuffer( - self, vi, size_in_bytes, configuration - ): # noqa: N802 + def niFake_ImportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 with self._func_lock: if self.niFake_ImportAttributeConfigurationBuffer_cfunc is None: - self.niFake_ImportAttributeConfigurationBuffer_cfunc = ( - self._get_library_function( - "niFake_ImportAttributeConfigurationBuffer" - ) - ) - self.niFake_ImportAttributeConfigurationBuffer_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViInt8), - ] # noqa: F405 - self.niFake_ImportAttributeConfigurationBuffer_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFake_ImportAttributeConfigurationBuffer_cfunc( - vi, size_in_bytes, configuration - ) - - def niFake_InitWithOptions( - self, resource_name, id_query, reset_device, option_string, vi - ): # noqa: N802 + self.niFake_ImportAttributeConfigurationBuffer_cfunc = self._get_library_function('niFake_ImportAttributeConfigurationBuffer') + self.niFake_ImportAttributeConfigurationBuffer_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt8)] # noqa: F405 + self.niFake_ImportAttributeConfigurationBuffer_cfunc.restype = ViStatus # noqa: F405 + return self.niFake_ImportAttributeConfigurationBuffer_cfunc(vi, size_in_bytes, configuration) + + def niFake_InitWithOptions(self, resource_name, id_query, reset_device, option_string, vi): # noqa: N802 with self._func_lock: if self.niFake_InitWithOptions_cfunc is None: - self.niFake_InitWithOptions_cfunc = self._get_library_function( - "niFake_InitWithOptions" - ) - self.niFake_InitWithOptions_cfunc.argtypes = [ - ctypes.POINTER(ViChar), - ViBoolean, - ViBoolean, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViSession), - ] # noqa: F405 + self.niFake_InitWithOptions_cfunc = self._get_library_function('niFake_InitWithOptions') + self.niFake_InitWithOptions_cfunc.argtypes = [ctypes.POINTER(ViChar), ViBoolean, ViBoolean, ctypes.POINTER(ViChar), ctypes.POINTER(ViSession)] # noqa: F405 self.niFake_InitWithOptions_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_InitWithOptions_cfunc( - resource_name, id_query, reset_device, option_string, vi - ) + return self.niFake_InitWithOptions_cfunc(resource_name, id_query, reset_device, option_string, vi) def niFake_Initiate(self, vi): # noqa: N802 with self._func_lock: if self.niFake_Initiate_cfunc is None: - self.niFake_Initiate_cfunc = self._get_library_function( - "niFake_Initiate" - ) + self.niFake_Initiate_cfunc = self._get_library_function('niFake_Initiate') self.niFake_Initiate_cfunc.argtypes = [ViSession] # noqa: F405 self.niFake_Initiate_cfunc.restype = ViStatus # noqa: F405 return self.niFake_Initiate_cfunc(vi) @@ -625,475 +347,199 @@ def niFake_Initiate(self, vi): # noqa: N802 def niFake_LockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niFake_LockSession_cfunc is None: - self.niFake_LockSession_cfunc = self._get_library_function( - "niFake_LockSession" - ) - self.niFake_LockSession_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niFake_LockSession_cfunc = self._get_library_function('niFake_LockSession') + self.niFake_LockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niFake_LockSession_cfunc.restype = ViStatus # noqa: F405 return self.niFake_LockSession_cfunc(vi, caller_has_lock) - def niFake_MultipleArrayTypes( - self, - vi, - output_array_size, - output_array, - output_array_of_fixed_length, - input_array_sizes, - input_array_of_floats, - input_array_of_integers, - ): # noqa: N802 + def niFake_MultipleArrayTypes(self, vi, output_array_size, output_array, output_array_of_fixed_length, input_array_sizes, input_array_of_floats, input_array_of_integers): # noqa: N802 with self._func_lock: if self.niFake_MultipleArrayTypes_cfunc is None: - self.niFake_MultipleArrayTypes_cfunc = self._get_library_function( - "niFake_MultipleArrayTypes" - ) - self.niFake_MultipleArrayTypes_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViReal64), - ViInt32, - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViInt16), - ] # noqa: F405 + self.niFake_MultipleArrayTypes_cfunc = self._get_library_function('niFake_MultipleArrayTypes') + self.niFake_MultipleArrayTypes_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt16)] # noqa: F405 self.niFake_MultipleArrayTypes_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_MultipleArrayTypes_cfunc( - vi, - output_array_size, - output_array, - output_array_of_fixed_length, - input_array_sizes, - input_array_of_floats, - input_array_of_integers, - ) - - def niFake_MultipleArraysSameSize( - self, vi, values1, values2, values3, values4, size - ): # noqa: N802 + return self.niFake_MultipleArrayTypes_cfunc(vi, output_array_size, output_array, output_array_of_fixed_length, input_array_sizes, input_array_of_floats, input_array_of_integers) + + def niFake_MultipleArraysSameSize(self, vi, values1, values2, values3, values4, size): # noqa: N802 with self._func_lock: if self.niFake_MultipleArraysSameSize_cfunc is None: - self.niFake_MultipleArraysSameSize_cfunc = self._get_library_function( - "niFake_MultipleArraysSameSize" - ) - self.niFake_MultipleArraysSameSize_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViReal64), - ViInt32, - ] # noqa: F405 - self.niFake_MultipleArraysSameSize_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFake_MultipleArraysSameSize_cfunc( - vi, values1, values2, values3, values4, size - ) + self.niFake_MultipleArraysSameSize_cfunc = self._get_library_function('niFake_MultipleArraysSameSize') + self.niFake_MultipleArraysSameSize_cfunc.argtypes = [ViSession, ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ViInt32] # noqa: F405 + self.niFake_MultipleArraysSameSize_cfunc.restype = ViStatus # noqa: F405 + return self.niFake_MultipleArraysSameSize_cfunc(vi, values1, values2, values3, values4, size) def niFake_OneInputFunction(self, vi, a_number): # noqa: N802 with self._func_lock: if self.niFake_OneInputFunction_cfunc is None: - self.niFake_OneInputFunction_cfunc = self._get_library_function( - "niFake_OneInputFunction" - ) - self.niFake_OneInputFunction_cfunc.argtypes = [ - ViSession, - ViInt32, - ] # noqa: F405 + self.niFake_OneInputFunction_cfunc = self._get_library_function('niFake_OneInputFunction') + self.niFake_OneInputFunction_cfunc.argtypes = [ViSession, ViInt32] # noqa: F405 self.niFake_OneInputFunction_cfunc.restype = ViStatus # noqa: F405 return self.niFake_OneInputFunction_cfunc(vi, a_number) - def niFake_ParametersAreMultipleTypes( - self, - vi, - a_boolean, - an_int32, - an_int64, - an_int_enum, - a_float, - a_float_enum, - string_size, - a_string, - ): # noqa: N802 + def niFake_ParametersAreMultipleTypes(self, vi, a_boolean, an_int32, an_int64, an_int_enum, a_float, a_float_enum, string_size, a_string): # noqa: N802 with self._func_lock: if self.niFake_ParametersAreMultipleTypes_cfunc is None: - self.niFake_ParametersAreMultipleTypes_cfunc = ( - self._get_library_function("niFake_ParametersAreMultipleTypes") - ) - self.niFake_ParametersAreMultipleTypes_cfunc.argtypes = [ - ViSession, - ViBoolean, - ViInt32, - ViInt64, - ViInt16, - ViReal64, - ViReal64, - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niFake_ParametersAreMultipleTypes_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFake_ParametersAreMultipleTypes_cfunc( - vi, - a_boolean, - an_int32, - an_int64, - an_int_enum, - a_float, - a_float_enum, - string_size, - a_string, - ) + self.niFake_ParametersAreMultipleTypes_cfunc = self._get_library_function('niFake_ParametersAreMultipleTypes') + self.niFake_ParametersAreMultipleTypes_cfunc.argtypes = [ViSession, ViBoolean, ViInt32, ViInt64, ViInt16, ViReal64, ViReal64, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niFake_ParametersAreMultipleTypes_cfunc.restype = ViStatus # noqa: F405 + return self.niFake_ParametersAreMultipleTypes_cfunc(vi, a_boolean, an_int32, an_int64, an_int_enum, a_float, a_float_enum, string_size, a_string) def niFake_PoorlyNamedSimpleFunction(self, vi): # noqa: N802 with self._func_lock: if self.niFake_PoorlyNamedSimpleFunction_cfunc is None: - self.niFake_PoorlyNamedSimpleFunction_cfunc = ( - self._get_library_function("niFake_PoorlyNamedSimpleFunction") - ) - self.niFake_PoorlyNamedSimpleFunction_cfunc.argtypes = [ - ViSession - ] # noqa: F405 - self.niFake_PoorlyNamedSimpleFunction_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niFake_PoorlyNamedSimpleFunction_cfunc = self._get_library_function('niFake_PoorlyNamedSimpleFunction') + self.niFake_PoorlyNamedSimpleFunction_cfunc.argtypes = [ViSession] # noqa: F405 + self.niFake_PoorlyNamedSimpleFunction_cfunc.restype = ViStatus # noqa: F405 return self.niFake_PoorlyNamedSimpleFunction_cfunc(vi) def niFake_Read(self, vi, maximum_time, reading): # noqa: N802 with self._func_lock: if self.niFake_Read_cfunc is None: - self.niFake_Read_cfunc = self._get_library_function("niFake_Read") - self.niFake_Read_cfunc.argtypes = [ - ViSession, - ViReal64, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niFake_Read_cfunc = self._get_library_function('niFake_Read') + self.niFake_Read_cfunc.argtypes = [ViSession, ViReal64, ctypes.POINTER(ViReal64)] # noqa: F405 self.niFake_Read_cfunc.restype = ViStatus # noqa: F405 return self.niFake_Read_cfunc(vi, maximum_time, reading) - def niFake_ReadFromChannel( - self, vi, channel_name, maximum_time, reading - ): # noqa: N802 + def niFake_ReadFromChannel(self, vi, channel_name, maximum_time, reading): # noqa: N802 with self._func_lock: if self.niFake_ReadFromChannel_cfunc is None: - self.niFake_ReadFromChannel_cfunc = self._get_library_function( - "niFake_ReadFromChannel" - ) - self.niFake_ReadFromChannel_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niFake_ReadFromChannel_cfunc = self._get_library_function('niFake_ReadFromChannel') + self.niFake_ReadFromChannel_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 self.niFake_ReadFromChannel_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_ReadFromChannel_cfunc( - vi, channel_name, maximum_time, reading - ) + return self.niFake_ReadFromChannel_cfunc(vi, channel_name, maximum_time, reading) def niFake_ReturnANumberAndAString(self, vi, a_number, a_string): # noqa: N802 with self._func_lock: if self.niFake_ReturnANumberAndAString_cfunc is None: - self.niFake_ReturnANumberAndAString_cfunc = self._get_library_function( - "niFake_ReturnANumberAndAString" - ) - self.niFake_ReturnANumberAndAString_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt16), - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niFake_ReturnANumberAndAString_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niFake_ReturnANumberAndAString_cfunc = self._get_library_function('niFake_ReturnANumberAndAString') + self.niFake_ReturnANumberAndAString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt16), ctypes.POINTER(ViChar)] # noqa: F405 + self.niFake_ReturnANumberAndAString_cfunc.restype = ViStatus # noqa: F405 return self.niFake_ReturnANumberAndAString_cfunc(vi, a_number, a_string) def niFake_ReturnDurationInSeconds(self, vi, timedelta): # noqa: N802 with self._func_lock: if self.niFake_ReturnDurationInSeconds_cfunc is None: - self.niFake_ReturnDurationInSeconds_cfunc = self._get_library_function( - "niFake_ReturnDurationInSeconds" - ) - self.niFake_ReturnDurationInSeconds_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViReal64), - ] # noqa: F405 - self.niFake_ReturnDurationInSeconds_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niFake_ReturnDurationInSeconds_cfunc = self._get_library_function('niFake_ReturnDurationInSeconds') + self.niFake_ReturnDurationInSeconds_cfunc.argtypes = [ViSession, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niFake_ReturnDurationInSeconds_cfunc.restype = ViStatus # noqa: F405 return self.niFake_ReturnDurationInSeconds_cfunc(vi, timedelta) - def niFake_ReturnListOfDurationsInSeconds( - self, vi, number_of_elements, timedeltas - ): # noqa: N802 + def niFake_ReturnListOfDurationsInSeconds(self, vi, number_of_elements, timedeltas): # noqa: N802 with self._func_lock: if self.niFake_ReturnListOfDurationsInSeconds_cfunc is None: - self.niFake_ReturnListOfDurationsInSeconds_cfunc = ( - self._get_library_function("niFake_ReturnListOfDurationsInSeconds") - ) - self.niFake_ReturnListOfDurationsInSeconds_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViReal64), - ] # noqa: F405 - self.niFake_ReturnListOfDurationsInSeconds_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFake_ReturnListOfDurationsInSeconds_cfunc( - vi, number_of_elements, timedeltas - ) - - def niFake_ReturnMultipleTypes( - self, - vi, - a_boolean, - an_int32, - an_int64, - an_int_enum, - a_float, - a_float_enum, - array_size, - an_array, - string_size, - a_string, - ): # noqa: N802 + self.niFake_ReturnListOfDurationsInSeconds_cfunc = self._get_library_function('niFake_ReturnListOfDurationsInSeconds') + self.niFake_ReturnListOfDurationsInSeconds_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niFake_ReturnListOfDurationsInSeconds_cfunc.restype = ViStatus # noqa: F405 + return self.niFake_ReturnListOfDurationsInSeconds_cfunc(vi, number_of_elements, timedeltas) + + def niFake_ReturnMultipleTypes(self, vi, a_boolean, an_int32, an_int64, an_int_enum, a_float, a_float_enum, array_size, an_array, string_size, a_string): # noqa: N802 with self._func_lock: if self.niFake_ReturnMultipleTypes_cfunc is None: - self.niFake_ReturnMultipleTypes_cfunc = self._get_library_function( - "niFake_ReturnMultipleTypes" - ) - self.niFake_ReturnMultipleTypes_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViBoolean), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt64), - ctypes.POINTER(ViInt16), - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViReal64), - ViInt32, - ctypes.POINTER(ViReal64), - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niFake_ReturnMultipleTypes_cfunc = self._get_library_function('niFake_ReturnMultipleTypes') + self.niFake_ReturnMultipleTypes_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt64), ctypes.POINTER(ViInt16), ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ViInt32, ctypes.POINTER(ViReal64), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niFake_ReturnMultipleTypes_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_ReturnMultipleTypes_cfunc( - vi, - a_boolean, - an_int32, - an_int64, - an_int_enum, - a_float, - a_float_enum, - array_size, - an_array, - string_size, - a_string, - ) - - def niFake_SetAttributeViBoolean( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + return self.niFake_ReturnMultipleTypes_cfunc(vi, a_boolean, an_int32, an_int64, an_int_enum, a_float, a_float_enum, array_size, an_array, string_size, a_string) + + def niFake_SetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niFake_SetAttributeViBoolean_cfunc is None: - self.niFake_SetAttributeViBoolean_cfunc = self._get_library_function( - "niFake_SetAttributeViBoolean" - ) - self.niFake_SetAttributeViBoolean_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViBoolean, - ] # noqa: F405 + self.niFake_SetAttributeViBoolean_cfunc = self._get_library_function('niFake_SetAttributeViBoolean') + self.niFake_SetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViBoolean] # noqa: F405 self.niFake_SetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_SetAttributeViBoolean_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niFake_SetAttributeViBoolean_cfunc(vi, channel_name, attribute_id, attribute_value) - def niFake_SetAttributeViInt32( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niFake_SetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niFake_SetAttributeViInt32_cfunc is None: - self.niFake_SetAttributeViInt32_cfunc = self._get_library_function( - "niFake_SetAttributeViInt32" - ) - self.niFake_SetAttributeViInt32_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViInt32, - ] # noqa: F405 + self.niFake_SetAttributeViInt32_cfunc = self._get_library_function('niFake_SetAttributeViInt32') + self.niFake_SetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32] # noqa: F405 self.niFake_SetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_SetAttributeViInt32_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niFake_SetAttributeViInt32_cfunc(vi, channel_name, attribute_id, attribute_value) - def niFake_SetAttributeViInt64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niFake_SetAttributeViInt64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niFake_SetAttributeViInt64_cfunc is None: - self.niFake_SetAttributeViInt64_cfunc = self._get_library_function( - "niFake_SetAttributeViInt64" - ) - self.niFake_SetAttributeViInt64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViInt64, - ] # noqa: F405 + self.niFake_SetAttributeViInt64_cfunc = self._get_library_function('niFake_SetAttributeViInt64') + self.niFake_SetAttributeViInt64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt64] # noqa: F405 self.niFake_SetAttributeViInt64_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_SetAttributeViInt64_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niFake_SetAttributeViInt64_cfunc(vi, channel_name, attribute_id, attribute_value) - def niFake_SetAttributeViReal64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niFake_SetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niFake_SetAttributeViReal64_cfunc is None: - self.niFake_SetAttributeViReal64_cfunc = self._get_library_function( - "niFake_SetAttributeViReal64" - ) - self.niFake_SetAttributeViReal64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViReal64, - ] # noqa: F405 + self.niFake_SetAttributeViReal64_cfunc = self._get_library_function('niFake_SetAttributeViReal64') + self.niFake_SetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViReal64] # noqa: F405 self.niFake_SetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_SetAttributeViReal64_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niFake_SetAttributeViReal64_cfunc(vi, channel_name, attribute_id, attribute_value) - def niFake_SetAttributeViString( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niFake_SetAttributeViString(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niFake_SetAttributeViString_cfunc is None: - self.niFake_SetAttributeViString_cfunc = self._get_library_function( - "niFake_SetAttributeViString" - ) - self.niFake_SetAttributeViString_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niFake_SetAttributeViString_cfunc = self._get_library_function('niFake_SetAttributeViString') + self.niFake_SetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViChar)] # noqa: F405 self.niFake_SetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niFake_SetAttributeViString_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niFake_SetAttributeViString_cfunc(vi, channel_name, attribute_id, attribute_value) def niFake_SetCustomType(self, vi, cs): # noqa: N802 with self._func_lock: if self.niFake_SetCustomType_cfunc is None: - self.niFake_SetCustomType_cfunc = self._get_library_function( - "niFake_SetCustomType" - ) - self.niFake_SetCustomType_cfunc.argtypes = [ - ViSession, - custom_struct.struct_CustomStruct, - ] # noqa: F405 + self.niFake_SetCustomType_cfunc = self._get_library_function('niFake_SetCustomType') + self.niFake_SetCustomType_cfunc.argtypes = [ViSession, custom_struct.struct_CustomStruct] # noqa: F405 self.niFake_SetCustomType_cfunc.restype = ViStatus # noqa: F405 return self.niFake_SetCustomType_cfunc(vi, cs) def niFake_SetCustomTypeArray(self, vi, number_of_elements, cs): # noqa: N802 with self._func_lock: if self.niFake_SetCustomTypeArray_cfunc is None: - self.niFake_SetCustomTypeArray_cfunc = self._get_library_function( - "niFake_SetCustomTypeArray" - ) - self.niFake_SetCustomTypeArray_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(custom_struct.struct_CustomStruct), - ] # noqa: F405 + self.niFake_SetCustomTypeArray_cfunc = self._get_library_function('niFake_SetCustomTypeArray') + self.niFake_SetCustomTypeArray_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(custom_struct.struct_CustomStruct)] # noqa: F405 self.niFake_SetCustomTypeArray_cfunc.restype = ViStatus # noqa: F405 return self.niFake_SetCustomTypeArray_cfunc(vi, number_of_elements, cs) - def niFake_StringValuedEnumInputFunctionWithDefaults( - self, vi, a_mobile_os_name - ): # noqa: N802 + def niFake_StringValuedEnumInputFunctionWithDefaults(self, vi, a_mobile_os_name): # noqa: N802 with self._func_lock: if self.niFake_StringValuedEnumInputFunctionWithDefaults_cfunc is None: - self.niFake_StringValuedEnumInputFunctionWithDefaults_cfunc = ( - self._get_library_function( - "niFake_StringValuedEnumInputFunctionWithDefaults" - ) - ) - self.niFake_StringValuedEnumInputFunctionWithDefaults_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niFake_StringValuedEnumInputFunctionWithDefaults_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFake_StringValuedEnumInputFunctionWithDefaults_cfunc( - vi, a_mobile_os_name - ) + self.niFake_StringValuedEnumInputFunctionWithDefaults_cfunc = self._get_library_function('niFake_StringValuedEnumInputFunctionWithDefaults') + self.niFake_StringValuedEnumInputFunctionWithDefaults_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niFake_StringValuedEnumInputFunctionWithDefaults_cfunc.restype = ViStatus # noqa: F405 + return self.niFake_StringValuedEnumInputFunctionWithDefaults_cfunc(vi, a_mobile_os_name) def niFake_TwoInputFunction(self, vi, a_number, a_string): # noqa: N802 with self._func_lock: if self.niFake_TwoInputFunction_cfunc is None: - self.niFake_TwoInputFunction_cfunc = self._get_library_function( - "niFake_TwoInputFunction" - ) - self.niFake_TwoInputFunction_cfunc.argtypes = [ - ViSession, - ViReal64, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niFake_TwoInputFunction_cfunc = self._get_library_function('niFake_TwoInputFunction') + self.niFake_TwoInputFunction_cfunc.argtypes = [ViSession, ViReal64, ctypes.POINTER(ViChar)] # noqa: F405 self.niFake_TwoInputFunction_cfunc.restype = ViStatus # noqa: F405 return self.niFake_TwoInputFunction_cfunc(vi, a_number, a_string) def niFake_UnlockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niFake_UnlockSession_cfunc is None: - self.niFake_UnlockSession_cfunc = self._get_library_function( - "niFake_UnlockSession" - ) - self.niFake_UnlockSession_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niFake_UnlockSession_cfunc = self._get_library_function('niFake_UnlockSession') + self.niFake_UnlockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niFake_UnlockSession_cfunc.restype = ViStatus # noqa: F405 return self.niFake_UnlockSession_cfunc(vi, caller_has_lock) def niFake_Use64BitNumber(self, vi, input, output): # noqa: N802 with self._func_lock: if self.niFake_Use64BitNumber_cfunc is None: - self.niFake_Use64BitNumber_cfunc = self._get_library_function( - "niFake_Use64BitNumber" - ) - self.niFake_Use64BitNumber_cfunc.argtypes = [ - ViSession, - ViInt64, - ctypes.POINTER(ViInt64), - ] # noqa: F405 + self.niFake_Use64BitNumber_cfunc = self._get_library_function('niFake_Use64BitNumber') + self.niFake_Use64BitNumber_cfunc.argtypes = [ViSession, ViInt64, ctypes.POINTER(ViInt64)] # noqa: F405 self.niFake_Use64BitNumber_cfunc.restype = ViStatus # noqa: F405 return self.niFake_Use64BitNumber_cfunc(vi, input, output) def niFake_WriteWaveform(self, vi, number_of_samples, waveform): # noqa: N802 with self._func_lock: if self.niFake_WriteWaveform_cfunc is None: - self.niFake_WriteWaveform_cfunc = self._get_library_function( - "niFake_WriteWaveform" - ) - self.niFake_WriteWaveform_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niFake_WriteWaveform_cfunc = self._get_library_function('niFake_WriteWaveform') + self.niFake_WriteWaveform_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 self.niFake_WriteWaveform_cfunc.restype = ViStatus # noqa: F405 return self.niFake_WriteWaveform_cfunc(vi, number_of_samples, waveform) def niFake_close(self, vi): # noqa: N802 with self._func_lock: if self.niFake_close_cfunc is None: - self.niFake_close_cfunc = self._get_library_function("niFake_close") + self.niFake_close_cfunc = self._get_library_function('niFake_close') self.niFake_close_cfunc.argtypes = [ViSession] # noqa: F405 self.niFake_close_cfunc.restype = ViStatus # noqa: F405 return self.niFake_close_cfunc(vi) @@ -1101,27 +547,15 @@ def niFake_close(self, vi): # noqa: N802 def niFake_error_message(self, vi, error_code, error_message): # noqa: N802 with self._func_lock: if self.niFake_error_message_cfunc is None: - self.niFake_error_message_cfunc = self._get_library_function( - "niFake_error_message" - ) - self.niFake_error_message_cfunc.argtypes = [ - ViSession, - ViStatus, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niFake_error_message_cfunc = self._get_library_function('niFake_error_message') + self.niFake_error_message_cfunc.argtypes = [ViSession, ViStatus, ctypes.POINTER(ViChar)] # noqa: F405 self.niFake_error_message_cfunc.restype = ViStatus # noqa: F405 return self.niFake_error_message_cfunc(vi, error_code, error_message) def niFake_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 with self._func_lock: if self.niFake_self_test_cfunc is None: - self.niFake_self_test_cfunc = self._get_library_function( - "niFake_self_test" - ) - self.niFake_self_test_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt16), - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niFake_self_test_cfunc = self._get_library_function('niFake_self_test') + self.niFake_self_test_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt16), ctypes.POINTER(ViChar)] # noqa: F405 self.niFake_self_test_cfunc.restype = ViStatus # noqa: F405 return self.niFake_self_test_cfunc(vi, self_test_result, self_test_message) diff --git a/generated/nifake/nifake/_library_singleton.py b/generated/nifake/nifake/_library_singleton.py index 090defcf4..f8353e299 100644 --- a/generated/nifake/nifake/_library_singleton.py +++ b/generated/nifake/nifake/_library_singleton.py @@ -12,36 +12,30 @@ _instance = None _instance_lock = threading.Lock() -_library_info = { - "Linux": {"64bit": {"name": "nifake", "type": "cdll"}}, - "Windows": { - "32bit": {"name": "nifake_32.dll", "type": "windll"}, - "64bit": {"name": "nifake_64.dll", "type": "cdll"}, - }, -} +_library_info = {'Linux': {'64bit': {'name': 'nifake', 'type': 'cdll'}}, + 'Windows': {'32bit': {'name': 'nifake_32.dll', 'type': 'windll'}, + '64bit': {'name': 'nifake_64.dll', 'type': 'cdll'}}} def _get_library_name(): try: - return ctypes.util.find_library( - _library_info[platform.system()][platform.architecture()[0]]["name"] - ) # We find and return full path to the DLL + return ctypes.util.find_library(_library_info[platform.system()][platform.architecture()[0]]['name']) # We find and return full path to the DLL except KeyError: raise errors.UnsupportedConfigurationError def _get_library_type(): try: - return _library_info[platform.system()][platform.architecture()[0]]["type"] + return _library_info[platform.system()][platform.architecture()[0]]['type'] except KeyError: raise errors.UnsupportedConfigurationError def get(): - """get + '''get Returns the library.Library singleton for nifake. - """ + ''' global _instance global _instance_lock @@ -49,12 +43,13 @@ def get(): if _instance is None: try: library_type = _get_library_type() - if library_type == "windll": + if library_type == 'windll': ctypes_library = ctypes.WinDLL(_get_library_name()) else: - assert library_type == "cdll" + assert library_type == 'cdll' ctypes_library = ctypes.CDLL(_get_library_name()) except OSError: raise errors.DriverNotInstalledError() _instance = _library.Library(ctypes_library) return _instance + diff --git a/generated/nifake/nifake/_visatype.py b/generated/nifake/nifake/_visatype.py index bf96c3cfb..02cc41d1b 100644 --- a/generated/nifake/nifake/_visatype.py +++ b/generated/nifake/nifake/_visatype.py @@ -2,9 +2,9 @@ import ctypes -"""Definitions of the VISA types used by the C API of the driver runtime. +'''Definitions of the VISA types used by the C API of the driver runtime. These are aliased directly to ctypes types so can be used directly to call into the library. -""" +''' ViChar = ctypes.c_char @@ -26,3 +26,4 @@ ViAttr = ViUInt32 ViConstString = ViString ViRsrc = ViString + diff --git a/generated/nifake/nifake/custom_struct.py b/generated/nifake/nifake/custom_struct.py index 90fb0fb24..0778036fb 100644 --- a/generated/nifake/nifake/custom_struct.py +++ b/generated/nifake/nifake/custom_struct.py @@ -8,8 +8,8 @@ # Name must match exactly what the name of the structure type is named in the C API. class struct_CustomStruct(ctypes.Structure): # noqa N801 _fields_ = [ - ("struct_int", nifake._visatype.ViInt32), - ("struct_double", nifake._visatype.ViReal64), + ('struct_int', nifake._visatype.ViInt32), + ('struct_double', nifake._visatype.ViReal64), ] def __init__(self, data=None, struct_int=0, struct_double=0.0): @@ -22,9 +22,7 @@ def __init__(self, data=None, struct_int=0, struct_double=0.0): self.struct_double = struct_double def __repr__(self): - return "{0}(data=None, struct_int={1}, struct_double={2})".format( - self.__class__.__name__, self.struct_int, self.struct_double - ) + return '{0}(data=None, struct_int={1}, struct_double={2})'.format(self.__class__.__name__, self.struct_int, self.struct_double) def __str__(self): return self.__repr__() @@ -40,9 +38,9 @@ def __init__(self, data=None, struct_int=0, struct_double=0.0): self.struct_double = struct_double def __repr__(self): - return "{0}(data=None, struct_int={1}, struct_double={2})".format( - self.__class__.__name__, self.struct_int, self.struct_double - ) + return '{0}(data=None, struct_int={1}, struct_double={2})'.format(self.__class__.__name__, self.struct_int, self.struct_double) def __str__(self): return self.__repr__() + + diff --git a/generated/nifake/nifake/enums.py b/generated/nifake/nifake/enums.py index e23e70b21..7414d6ca2 100644 --- a/generated/nifake/nifake/enums.py +++ b/generated/nifake/nifake/enums.py @@ -6,75 +6,75 @@ class Color(Enum): RED = 1 - r""" + r''' Like blood. - """ + ''' BLUE = 2 - r""" + r''' Like the sky. - """ + ''' YELLOW = 5 - r""" + r''' Like a banana. - """ + ''' BLACK = 42 - r""" + r''' Like this developer's conscience. - """ + ''' class FloatEnum(Enum): THREE_POINT_FIVE = 3.5 - r""" + r''' Specifies 3.5 digits resolution. - """ + ''' FOUR_POINT_FIVE = 4.5 - r""" + r''' Specifies 4.5 digits resolution. - """ + ''' FIVE_POINT_FIVE = 5.5 - r""" + r''' Specifies 5.5 digits resolution. - """ + ''' SIX_POINT_FIVE = 6.5 - r""" + r''' Specifies 6.5 digits resolution. - """ + ''' SEVEN_POINT_FIVE = 7.5 - r""" + r''' Specifies 7.5 digits resolution. - """ + ''' class MobileOSNames(Enum): - ANDROID = "Android" - r""" + ANDROID = 'Android' + r''' Most popular OS. - """ - IOS = "iOS" - r""" + ''' + IOS = 'iOS' + r''' Most secure OS. - """ - NONE = "None" - r""" + ''' + NONE = 'None' + r''' Remember Symbian?. - """ + ''' class Turtle(Enum): LEONARDO = 0 - r""" + r''' Wields two katanas. - """ + ''' DONATELLO = 1 - r""" + r''' Uses a bo staff. - """ + ''' RAPHAEL = 2 - r""" + r''' Has a pair of sai. - """ + ''' MICHELANGELO = 3 - r""" + r''' Owns nunchucks. - """ + ''' diff --git a/generated/nifake/nifake/errors.py b/generated/nifake/nifake/errors.py index a3ddf4472..df501045f 100644 --- a/generated/nifake/nifake/errors.py +++ b/generated/nifake/nifake/errors.py @@ -7,103 +7,86 @@ def _is_success(code): - return code == 0 + return (code == 0) def _is_error(code): - return code < 0 + return (code < 0) def _is_warning(code): - return code > 0 + return (code > 0) class Error(Exception): - """Base error class for NI-FAKE""" + '''Base error class for NI-FAKE''' def __init__(self, message): super(Error, self).__init__(message) class DriverError(Error): - """An error originating from the NI-FAKE driver""" + '''An error originating from the NI-FAKE driver''' def __init__(self, code, description): - assert _is_error(code), "Should not raise Error if code is not fatal." + assert (_is_error(code)), "Should not raise Error if code is not fatal." self.code = code self.description = description super(DriverError, self).__init__(str(self.code) + ": " + self.description) class DriverWarning(Warning): - """A warning originating from the NI-FAKE driver""" + '''A warning originating from the NI-FAKE driver''' def __init__(self, code, description): - assert _is_warning(code), "Should not create Warning if code is not positive." - super(DriverWarning, self).__init__( - "Warning {0} occurred.\n\n{1}".format(code, description) - ) + assert (_is_warning(code)), "Should not create Warning if code is not positive." + super(DriverWarning, self).__init__('Warning {0} occurred.\n\n{1}'.format(code, description)) class UnsupportedConfigurationError(Error): - """An error due to using this module in an usupported platform.""" + '''An error due to using this module in an usupported platform.''' def __init__(self): - super(UnsupportedConfigurationError, self).__init__( - "System configuration is unsupported: " - + platform.architecture()[0] - + " " - + platform.system() - ) + super(UnsupportedConfigurationError, self).__init__('System configuration is unsupported: ' + platform.architecture()[0] + ' ' + platform.system()) class DriverNotInstalledError(Error): - """An error due to using this module without the driver runtime installed.""" + '''An error due to using this module without the driver runtime installed.''' def __init__(self): - super(DriverNotInstalledError, self).__init__( - "The NI-FAKE runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it." - ) + super(DriverNotInstalledError, self).__init__('The NI-FAKE runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it.') class DriverTooOldError(Error): - """An error due to using this module with an older version of the driver runtime.""" + '''An error due to using this module with an older version of the driver runtime.''' def __init__(self): - super(DriverTooOldError, self).__init__( - "A function was not found in the NI-FAKE runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it." - ) + super(DriverTooOldError, self).__init__('A function was not found in the NI-FAKE runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it.') class InvalidRepeatedCapabilityError(Error): - """An error due to an invalid character in a repeated capability""" + '''An error due to an invalid character in a repeated capability''' def __init__(self, invalid_character, invalid_string): - super(InvalidRepeatedCapabilityError, self).__init__( - "An invalid character ({0}) was found in repeated capability string ({1})".format( - invalid_character, invalid_string - ) - ) + super(InvalidRepeatedCapabilityError, self).__init__('An invalid character ({0}) was found in repeated capability string ({1})'.format(invalid_character, invalid_string)) class SelfTestError(Error): - """An error due to a failed self-test""" + '''An error due to a failed self-test''' def __init__(self, code, msg): self.code = code self.message = msg - super(SelfTestError, self).__init__( - "Self-test failed with code {0}: {1}".format(code, msg) - ) + super(SelfTestError, self).__init__('Self-test failed with code {0}: {1}'.format(code, msg)) def handle_error(session, code, ignore_warnings, is_error_handling): - """handle_error + '''handle_error Helper function for handling errors returned by nifake.Library. It calls back into the session to get the corresponding error description and raises if necessary. - """ + ''' if _is_success(code) or (_is_warning(code) and ignore_warnings): return @@ -111,7 +94,7 @@ def handle_error(session, code, ignore_warnings, is_error_handling): if is_error_handling: # The caller is in the midst of error handling and an error occurred. # Don't try to get the description or we'll start recursing until the stack overflows. - description = "" + description = '' else: description = session._get_error_description(code) @@ -120,3 +103,5 @@ def handle_error(session, code, ignore_warnings, is_error_handling): assert _is_warning(code) warnings.warn(DriverWarning(code, description)) + + diff --git a/generated/nifake/nifake/session.py b/generated/nifake/nifake/session.py index d75af960d..cc1e5c0ea 100644 --- a/generated/nifake/nifake/session.py +++ b/generated/nifake/nifake/session.py @@ -2,7 +2,6 @@ # This file was generated import array # noqa: F401 import ctypes - # Used by @ivi_synchronized from functools import wraps @@ -20,24 +19,22 @@ # Used for __repr__ import pprint - pp = pprint.PrettyPrinter(indent=4) # Helper functions for creating ctypes needed for calling into the driver DLL def get_ctypes_pointer_for_buffer(value=None, library_type=None, size=None): if isinstance(value, array.array): - assert library_type is not None, "library_type is required for array.array" + assert library_type is not None, 'library_type is required for array.array' addr, _ = value.buffer_info() return ctypes.cast(addr, ctypes.POINTER(library_type)) elif str(type(value)).find("'numpy.ndarray'") != -1: import numpy - return numpy.ctypeslib.as_ctypes(value) elif isinstance(value, bytes): return ctypes.cast(value, ctypes.POINTER(library_type)) elif isinstance(value, list): - assert library_type is not None, "library_type is required for list" + assert library_type is not None, 'library_type is required for list' return (library_type * len(value))(*value) else: if library_type is not None and size is not None: @@ -77,7 +74,6 @@ def aux(*xs, **kws): session = xs[0] # parameter 0 is 'self' which is the session object with session.lock(): return f(*xs, **kws) - return aux @@ -98,34 +94,16 @@ def __init__(self, session, prefix, current_repeated_capability_list): self._session = session self._prefix = prefix # We need at least one element. If we get an empty list, make the one element an empty string - self._current_repeated_capability_list = ( - current_repeated_capability_list - if len(current_repeated_capability_list) > 0 - else [""] - ) + self._current_repeated_capability_list = current_repeated_capability_list if len(current_repeated_capability_list) > 0 else [''] # Now we know there is at lease one entry, so we look if it is an empty string or not - self._separator = ( - "/" if len(self._current_repeated_capability_list[0]) > 0 else "" - ) + self._separator = '/' if len(self._current_repeated_capability_list[0]) > 0 else '' def __getitem__(self, repeated_capability): - """Set/get properties or call methods with a repeated capability (i.e. channels)""" - rep_caps_list = _converters.convert_repeated_capabilities( - repeated_capability, self._prefix - ) - complete_rep_cap_list = [ - current_rep_cap + self._separator + rep_cap - for current_rep_cap in self._current_repeated_capability_list - for rep_cap in rep_caps_list - ] - - return _SessionBase( - vi=self._session._vi, - repeated_capability_list=complete_rep_cap_list, - library=self._session._library, - encoding=self._session._encoding, - freeze_it=True, - ) + '''Set/get properties or call methods with a repeated capability (i.e. channels)''' + rep_caps_list = _converters.convert_repeated_capabilities(repeated_capability, self._prefix) + complete_rep_cap_list = [current_rep_cap + self._separator + rep_cap for current_rep_cap in self._current_repeated_capability_list for rep_cap in rep_caps_list] + + return _SessionBase(vi=self._session._vi, repeated_capability_list=complete_rep_cap_list, library=self._session._library, encoding=self._session._encoding, freeze_it=True) # This is a very simple context manager we can use when we need to set/get attributes @@ -137,51 +115,45 @@ def __init__(self, session): def __enter__(self): self._repeated_capability_cache = self._session._repeated_capability - self._session._repeated_capability = "" + self._session._repeated_capability = '' def __exit__(self, exc_type, exc_value, traceback): self._session._repeated_capability = self._repeated_capability_cache class _SessionBase(object): - """Base class for all NI-FAKE sessions.""" + '''Base class for all NI-FAKE sessions.''' # This is needed during __init__. Without it, __setattr__ raises an exception _is_frozen = False - float_enum = _attributes.AttributeEnum( - _attributes.AttributeViReal64, enums.FloatEnum, 1000005 - ) - """Type: enums.FloatEnum + float_enum = _attributes.AttributeEnum(_attributes.AttributeViReal64, enums.FloatEnum, 1000005) + '''Type: enums.FloatEnum A property with an enum that is also a float - """ + ''' read_write_bool = _attributes.AttributeViBoolean(1000000) - """Type: bool + '''Type: bool A property of type bool with read/write access. - """ - read_write_color = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.Color, 1000003 - ) - """Type: enums.Color + ''' + read_write_color = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.Color, 1000003) + '''Type: enums.Color A property of type Color with read/write access. - """ + ''' read_write_double = _attributes.AttributeViReal64(1000001) - """Type: float + '''Type: float A property of type float with read/write access. - """ - read_write_double_with_converter = _attributes.AttributeViReal64TimeDeltaSeconds( - 1000007 - ) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + ''' + read_write_double_with_converter = _attributes.AttributeViReal64TimeDeltaSeconds(1000007) + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds Property in seconds - """ + ''' read_write_double_with_repeated_capability = _attributes.AttributeViReal64(1000009) - """Type: float + '''Type: float Tip: This property can be set/get on specific channels within your :py:class:`nifake.Session` instance. @@ -192,33 +164,29 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifake.Session`. Example: :py:attr:`my_session.read_write_double_with_repeated_capability` - """ + ''' read_write_int64 = _attributes.AttributeViInt64(1000006) - """Type: int + '''Type: int A property of type 64-bit integer with read/write access. - """ + ''' read_write_integer = _attributes.AttributeViInt32(1000004) - """Type: int + '''Type: int A property of type integer with read/write access. - """ - read_write_integer_with_converter = ( - _attributes.AttributeViInt32TimeDeltaMilliseconds(1000008) - ) - """Type: hightime.timedelta, datetime.timedelta, or int in milliseconds + ''' + read_write_integer_with_converter = _attributes.AttributeViInt32TimeDeltaMilliseconds(1000008) + '''Type: hightime.timedelta, datetime.timedelta, or int in milliseconds Property in milliseconds - """ + ''' read_write_string = _attributes.AttributeViString(1000002) - """Type: str + '''Type: str A property of type string with read/write access. - """ - read_write_string_repeated_capability = ( - _attributes.AttributeViStringRepeatedCapability(1000010) - ) - """Type: Any repeated capability type, as defined in nimi-python: + ''' + read_write_string_repeated_capability = _attributes.AttributeViStringRepeatedCapability(1000010) + '''Type: Any repeated capability type, as defined in nimi-python: - str - str - Comma delimited list - str - Range (using '-' or ':') @@ -236,51 +204,43 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`nifake.Session`. Example: :py:attr:`my_session.read_write_string_repeated_capability` - """ + ''' - def __init__( - self, repeated_capability_list, vi, library, encoding, freeze_it=False - ): + def __init__(self, repeated_capability_list, vi, library, encoding, freeze_it=False): self._repeated_capability_list = repeated_capability_list - self._repeated_capability = ",".join(repeated_capability_list) + self._repeated_capability = ','.join(repeated_capability_list) self._vi = vi self._library = library self._encoding = encoding # Store the parameter list for later printing in __repr__ param_list = [] - param_list.append( - "repeated_capability_list=" + pp.pformat(repeated_capability_list) - ) + param_list.append("repeated_capability_list=" + pp.pformat(repeated_capability_list)) param_list.append("vi=" + pp.pformat(vi)) param_list.append("library=" + pp.pformat(library)) param_list.append("encoding=" + pp.pformat(encoding)) - self._param_list = ", ".join(param_list) + self._param_list = ', '.join(param_list) # Instantiate any repeated capability objects - self.channels = _RepeatedCapabilities(self, "", repeated_capability_list) - self.sites = _RepeatedCapabilities(self, "site", repeated_capability_list) - self.instruments = _RepeatedCapabilities(self, "", repeated_capability_list) + self.channels = _RepeatedCapabilities(self, '', repeated_capability_list) + self.sites = _RepeatedCapabilities(self, 'site', repeated_capability_list) + self.instruments = _RepeatedCapabilities(self, '', repeated_capability_list) self._is_frozen = freeze_it def __repr__(self): - return "{0}.{1}({2})".format( - "nifake", self.__class__.__name__, self._param_list - ) + return '{0}.{1}({2})'.format('nifake', self.__class__.__name__, self._param_list) def __setattr__(self, key, value): if self._is_frozen and key not in dir(self): - raise AttributeError( - "'{0}' object has no attribute '{1}'".format(type(self).__name__, key) - ) + raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) object.__setattr__(self, key, value) def _get_error_description(self, error_code): - """_get_error_description + '''_get_error_description Returns the error description. - """ + ''' try: _, error_string = self._get_error() return error_string @@ -288,21 +248,21 @@ def _get_error_description(self, error_code): pass try: - """ + ''' It is expected for _get_error to raise when the session is invalid (IVI spec requires GetError to fail). Use _error_message instead. It doesn't require a session. - """ + ''' error_string = self._error_message(error_code) return error_string except errors.Error: return "Failed to retrieve error description." - """ These are code-generated """ + ''' These are code-generated ''' @ivi_synchronized def _get_attribute_vi_boolean(self, attribute_id): - r"""_get_attribute_vi_boolean + r'''_get_attribute_vi_boolean Queries the value of a ViBoolean property. @@ -324,29 +284,18 @@ def _get_attribute_vi_boolean(self, attribute_id): Returns: attribute_value (bool): Returns the value of the property. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niFake_GetAttributeViBoolean( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - None - if attribute_value_ctype is None - else (ctypes.pointer(attribute_value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_GetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_int32(self, attribute_id): - r"""_get_attribute_vi_int32 + r'''_get_attribute_vi_int32 Queries the value of a ViInt32 property. @@ -368,29 +317,18 @@ def _get_attribute_vi_int32(self, attribute_id): Returns: attribute_value (int): Returns the value of the property. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFake_GetAttributeViInt32( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - None - if attribute_value_ctype is None - else (ctypes.pointer(attribute_value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_GetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_int64(self, attribute_id): - r"""_get_attribute_vi_int64 + r'''_get_attribute_vi_int64 Queries the value of a ViInt64 property. @@ -412,29 +350,18 @@ def _get_attribute_vi_int64(self, attribute_id): Returns: attribute_value (int): Returns the value of the property. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt64() # case S220 - error_code = self._library.niFake_GetAttributeViInt64( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - None - if attribute_value_ctype is None - else (ctypes.pointer(attribute_value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_GetAttributeViInt64(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_real64(self, attribute_id): - r"""_get_attribute_vi_real64 + r'''_get_attribute_vi_real64 Queries the value of a ViReal property. @@ -456,29 +383,18 @@ def _get_attribute_vi_real64(self, attribute_id): Returns: attribute_value (float): Returns the value of the property. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niFake_GetAttributeViReal64( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - None - if attribute_value_ctype is None - else (ctypes.pointer(attribute_value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_GetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_string(self, attribute_id): - r"""_get_attribute_vi_string + r'''_get_attribute_vi_string Queries the value of a ViBoolean property. @@ -500,42 +416,22 @@ def _get_attribute_vi_string(self, attribute_id): Returns: attribute_value (str): Returns the value of the property. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 buffer_size_ctype = _visatype.ViInt32() # case S170 attribute_value_ctype = None # case C050 - error_code = self._library.niFake_GetAttributeViString( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - buffer_size_ctype, - attribute_value_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niFake_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, buffer_size_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - attribute_value_ctype = ( - _visatype.ViChar * buffer_size_ctype.value - )() # case C060 - error_code = self._library.niFake_GetAttributeViString( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - buffer_size_ctype, - attribute_value_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + attribute_value_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 + error_code = self._library.niFake_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, buffer_size_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return attribute_value_ctype.value.decode(self._encoding) def _get_error(self): - r"""_get_error + r'''_get_error Returns the error information associated with the session. @@ -544,37 +440,21 @@ def _get_error(self): description (str): At least bufferSize big, string comes out here. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus() # case S220 buffer_size_ctype = _visatype.ViInt32() # case S170 description_ctype = None # case C050 - error_code = self._library.niFake_GetError( - vi_ctype, - None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), - buffer_size_ctype, - description_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=True - ) + error_code = self._library.niFake_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), buffer_size_ctype, description_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 description_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niFake_GetError( - vi_ctype, - None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), - buffer_size_ctype, - description_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) - return int(error_code_ctype.value), description_ctype.value.decode( - self._encoding - ) + error_code = self._library.niFake_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), buffer_size_ctype, description_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + return int(error_code_ctype.value), description_ctype.value.decode(self._encoding) def lock(self): - """lock + '''lock Obtains a multithread lock on the device session. Before doing so, the software waits until all other execution threads release their locks @@ -602,27 +482,25 @@ def lock(self): Returns: lock (context manager): When used in a with statement, nifake.Session.lock acts as a context manager and unlock will be called when the with block is exited - """ + ''' self._lock_session() # We do not call _lock_session() in the context manager so that this function can # act standalone as well and let the client call unlock() explicitly. If they do use the context manager, # that will handle the unlock for them return _Lock(self) def _lock_session(self): - """_lock_session + '''_lock_session Actual call to driver - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFake_LockSession(vi_ctype, None) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return @ivi_synchronized def read_from_channel(self, maximum_time): - r"""read_from_channel + r'''read_from_channel Acquires a single measurement and returns the measured value. @@ -644,29 +522,18 @@ def read_from_channel(self, maximum_time): Returns: reading (float): The measured value. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32( - maximum_time - ) # case S140 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + maximum_time_ctype = _converters.convert_timedelta_to_milliseconds_int32(maximum_time) # case S140 reading_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niFake_ReadFromChannel( - vi_ctype, - channel_name_ctype, - maximum_time_ctype, - None if reading_ctype is None else (ctypes.pointer(reading_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_ReadFromChannel(vi_ctype, channel_name_ctype, maximum_time_ctype, None if reading_ctype is None else (ctypes.pointer(reading_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(reading_ctype.value) @ivi_synchronized def _set_attribute_vi_boolean(self, attribute_id, attribute_value): - r"""_set_attribute_vi_boolean + r'''_set_attribute_vi_boolean This method sets the value of a ViBoolean property. @@ -686,24 +553,18 @@ def _set_attribute_vi_boolean(self, attribute_id, attribute_value): attribute_value (bool): Pass the value that you want to set the property to. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViBoolean(attribute_value) # case S150 - error_code = self._library.niFake_SetAttributeViBoolean( - vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_SetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_int32(self, attribute_id, attribute_value): - r"""_set_attribute_vi_int32 + r'''_set_attribute_vi_int32 This method sets the value of a ViInt32 property. @@ -723,24 +584,18 @@ def _set_attribute_vi_int32(self, attribute_id, attribute_value): attribute_value (int): Pass the value that you want to set the property to. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt32(attribute_value) # case S150 - error_code = self._library.niFake_SetAttributeViInt32( - vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_SetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_int64(self, attribute_id, attribute_value): - r"""_set_attribute_vi_int64 + r'''_set_attribute_vi_int64 This method sets the value of a ViInt64 property. @@ -760,24 +615,18 @@ def _set_attribute_vi_int64(self, attribute_id, attribute_value): attribute_value (int): Pass the value that you want to set the property to. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt64(attribute_value) # case S150 - error_code = self._library.niFake_SetAttributeViInt64( - vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_SetAttributeViInt64(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_real64(self, attribute_id, attribute_value): - r"""_set_attribute_vi_real64 + r'''_set_attribute_vi_real64 This method sets the value of a ViReal64 property. @@ -797,24 +646,18 @@ def _set_attribute_vi_real64(self, attribute_id, attribute_value): attribute_value (float): Pass the value that you want to set the property to. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViReal64(attribute_value) # case S150 - error_code = self._library.niFake_SetAttributeViReal64( - vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_SetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_string(self, attribute_id, attribute_value): - r"""_set_attribute_vi_string + r'''_set_attribute_vi_string This method sets the value of a ViString property. @@ -834,39 +677,29 @@ def _set_attribute_vi_string(self, attribute_id, attribute_value): attribute_value (str): Pass the value that you want to set the property to. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 - attribute_value_ctype = ctypes.create_string_buffer( - attribute_value.encode(self._encoding) - ) # case C020 - error_code = self._library.niFake_SetAttributeViString( - vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + attribute_value_ctype = ctypes.create_string_buffer(attribute_value.encode(self._encoding)) # case C020 + error_code = self._library.niFake_SetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def unlock(self): - """unlock + '''unlock Releases a lock that you acquired on an device session using lock. Refer to lock for additional information on session locks. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFake_UnlockSession(vi_ctype, None) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return def _error_message(self, error_code): - r"""_error_message + r'''_error_message Takes the errorCode returned by a functiona and returns it as a user-readable string. @@ -877,24 +710,20 @@ def _error_message(self, error_code): Returns: error_message (str): The error information formatted into a string. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus(error_code) # case S150 error_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niFake_error_message( - vi_ctype, error_code_ctype, error_message_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + error_code = self._library.niFake_error_message(vi_ctype, error_code_ctype, error_message_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return error_message_ctype.value.decode(self._encoding) class Session(_SessionBase): - """An NI-FAKE session to a fake MI driver whose sole purpose is to test nimi-python code generation""" + '''An NI-FAKE session to a fake MI driver whose sole purpose is to test nimi-python code generation''' def __init__(self, resource_name, options={}, id_query=False, reset_device=False): - r"""An NI-FAKE session to a fake MI driver whose sole purpose is to test nimi-python code generation + r'''An NI-FAKE session to a fake MI driver whose sole purpose is to test nimi-python code generation Creates a new IVI instrument driver session. @@ -951,23 +780,15 @@ def __init__(self, resource_name, options={}, id_query=False, reset_device=False Returns: session (nifake.Session): A session object representing the device. - """ - super(Session, self).__init__( - repeated_capability_list=[], - vi=None, - library=None, - encoding=None, - freeze_it=False, - ) + ''' + super(Session, self).__init__(repeated_capability_list=[], vi=None, library=None, encoding=None, freeze_it=False) options = _converters.convert_init_with_options_dictionary(options) self._library = _library_singleton.get() - self._encoding = "windows-1251" + self._encoding = 'windows-1251' # Call specified init function self._vi = 0 # This must be set before calling _init_with_options(). - self._vi = self._init_with_options( - resource_name, options, id_query, reset_device - ) + self._vi = self._init_with_options(resource_name, options, id_query, reset_device) self.tclk = nitclk.SessionReference(self._vi) @@ -976,7 +797,7 @@ def __init__(self, resource_name, options={}, id_query=False, reset_device=False param_list.append("resource_name=" + pp.pformat(resource_name)) param_list.append("options=" + pp.pformat(options)) param_list.append("reset_device=" + pp.pformat(reset_device)) - self._param_list = ", ".join(param_list) + self._param_list = ', '.join(param_list) self._is_frozen = True @@ -987,23 +808,23 @@ def __exit__(self, exc_type, exc_value, traceback): self.close() def initiate(self): - """initiate + '''initiate Initiates a thingie. Note: This method will return a Python context manager that will initiate on entering and abort on exit. - """ + ''' return _Acquisition(self) def close(self): - """close + '''close Closes the specified session and deallocates resources that it reserved. Note: This method is not needed when using the session context manager - """ + ''' try: self._close() except errors.DriverError: @@ -1011,52 +832,40 @@ def close(self): raise self._vi = 0 - """ These are code-generated """ + ''' These are code-generated ''' @ivi_synchronized def abort(self): - r"""abort + r'''abort Aborts a previously initiated thingie. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFake_Abort(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def accept_list_of_durations_in_seconds(self, delays): - r"""accept_list_of_durations_in_seconds + r'''accept_list_of_durations_in_seconds Accepts list of hightime.timedelta or datetime.timedelta or float instances representing time delays. Args: delays (hightime.timedelta, datetime.timedelta, or float in seconds): A collection of time delay values. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - count_ctype = _visatype.ViInt32( - 0 if delays is None else len(delays) - ) # case S160 - delays_converted = _converters.convert_timedeltas_to_seconds_real64( - delays - ) # case B520 - delays_ctype = get_ctypes_pointer_for_buffer( - value=delays_converted, library_type=_visatype.ViReal64 - ) # case B520 - error_code = self._library.niFake_AcceptListOfDurationsInSeconds( - vi_ctype, count_ctype, delays_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + count_ctype = _visatype.ViInt32(0 if delays is None else len(delays)) # case S160 + delays_converted = _converters.convert_timedeltas_to_seconds_real64(delays) # case B520 + delays_ctype = get_ctypes_pointer_for_buffer(value=delays_converted, library_type=_visatype.ViReal64) # case B520 + error_code = self._library.niFake_AcceptListOfDurationsInSeconds(vi_ctype, count_ctype, delays_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def bool_array_output_function(self, number_of_elements): - r"""bool_array_output_function + r'''bool_array_output_function This method returns an array of booleans. @@ -1067,52 +876,36 @@ def bool_array_output_function(self, number_of_elements): Returns: an_array (list of bool): Contains an array of booleans - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 number_of_elements_ctype = _visatype.ViInt32(number_of_elements) # case S210 an_array_size = number_of_elements # case B600 - an_array_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViBoolean, size=an_array_size - ) # case B600 - error_code = self._library.niFake_BoolArrayOutputFunction( - vi_ctype, number_of_elements_ctype, an_array_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + an_array_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViBoolean, size=an_array_size) # case B600 + error_code = self._library.niFake_BoolArrayOutputFunction(vi_ctype, number_of_elements_ctype, an_array_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return [bool(an_array_ctype[i]) for i in range(number_of_elements_ctype.value)] @ivi_synchronized def double_all_the_nums(self, numbers): - r"""double_all_the_nums + r'''double_all_the_nums Test for buffer with converter Args: numbers (list of float): numbers is an array of numbers we want to double. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - number_count_ctype = _visatype.ViInt32( - 0 if numbers is None else len(numbers) - ) # case S160 - numbers_converted = _converters.convert_double_each_element( - numbers - ) # case B520 - numbers_ctype = get_ctypes_pointer_for_buffer( - value=numbers_converted, library_type=_visatype.ViReal64 - ) # case B520 - error_code = self._library.niFake_DoubleAllTheNums( - vi_ctype, number_count_ctype, numbers_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + number_count_ctype = _visatype.ViInt32(0 if numbers is None else len(numbers)) # case S160 + numbers_converted = _converters.convert_double_each_element(numbers) # case B520 + numbers_ctype = get_ctypes_pointer_for_buffer(value=numbers_converted, library_type=_visatype.ViReal64) # case B520 + error_code = self._library.niFake_DoubleAllTheNums(vi_ctype, number_count_ctype, numbers_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def enum_array_output_function(self, number_of_elements): - r"""enum_array_output_function + r'''enum_array_output_function This method returns an array of enums, stored as 16 bit integers under the hood. @@ -1123,27 +916,18 @@ def enum_array_output_function(self, number_of_elements): Returns: an_array (list of enums.Turtle): Contains an array of enums, stored as 16 bit integers under the hood - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 number_of_elements_ctype = _visatype.ViInt32(number_of_elements) # case S210 an_array_size = number_of_elements # case B600 - an_array_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViInt16, size=an_array_size - ) # case B600 - error_code = self._library.niFake_EnumArrayOutputFunction( - vi_ctype, number_of_elements_ctype, an_array_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return [ - enums.Turtle(an_array_ctype[i]) - for i in range(number_of_elements_ctype.value) - ] + an_array_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViInt16, size=an_array_size) # case B600 + error_code = self._library.niFake_EnumArrayOutputFunction(vi_ctype, number_of_elements_ctype, an_array_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return [enums.Turtle(an_array_ctype[i]) for i in range(number_of_elements_ctype.value)] @ivi_synchronized def enum_input_function_with_defaults(self, a_turtle=enums.Turtle.LEONARDO): - r"""enum_input_function_with_defaults + r'''enum_input_function_with_defaults This method takes one parameter other than the session, which happens to be an enum and has a default value. @@ -1160,55 +944,41 @@ def enum_input_function_with_defaults(self, a_turtle=enums.Turtle.LEONARDO): | 3 | Mich elangelo | +---+---------------+ - """ + ''' if type(a_turtle) is not enums.Turtle: - raise TypeError("Parameter a_turtle must be of type " + str(enums.Turtle)) + raise TypeError('Parameter a_turtle must be of type ' + str(enums.Turtle)) vi_ctype = _visatype.ViSession(self._vi) # case S110 a_turtle_ctype = _visatype.ViInt16(a_turtle.value) # case S130 - error_code = self._library.niFake_EnumInputFunctionWithDefaults( - vi_ctype, a_turtle_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_EnumInputFunctionWithDefaults(vi_ctype, a_turtle_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def export_attribute_configuration_buffer(self): - r"""export_attribute_configuration_buffer + r'''export_attribute_configuration_buffer Export configuration buffer. Returns: configuration (bytes): - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 size_in_bytes_ctype = _visatype.ViInt32() # case S170 configuration_ctype = None # case B580 - error_code = self._library.niFake_ExportAttributeConfigurationBuffer( - vi_ctype, size_in_bytes_ctype, configuration_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niFake_ExportAttributeConfigurationBuffer(vi_ctype, size_in_bytes_ctype, configuration_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) size_in_bytes_ctype = _visatype.ViInt32(error_code) # case S180 configuration_size = size_in_bytes_ctype.value # case B590 configuration_array = array.array("b", [0] * configuration_size) # case B590 - configuration_ctype = get_ctypes_pointer_for_buffer( - value=configuration_array, library_type=_visatype.ViInt8 - ) # case B590 - error_code = self._library.niFake_ExportAttributeConfigurationBuffer( - vi_ctype, size_in_bytes_ctype, configuration_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + configuration_ctype = get_ctypes_pointer_for_buffer(value=configuration_array, library_type=_visatype.ViInt8) # case B590 + error_code = self._library.niFake_ExportAttributeConfigurationBuffer(vi_ctype, size_in_bytes_ctype, configuration_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return _converters.convert_to_bytes(configuration_array) @ivi_synchronized def fetch_waveform(self, number_of_samples): - r"""fetch_waveform + r'''fetch_waveform Returns waveform data. @@ -1221,31 +991,20 @@ def fetch_waveform(self, number_of_samples): actual_number_of_samples (int): Number of samples actually fetched. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 number_of_samples_ctype = _visatype.ViInt32(number_of_samples) # case S210 waveform_data_size = number_of_samples # case B600 waveform_data_array = array.array("d", [0] * waveform_data_size) # case B600 - waveform_data_ctype = get_ctypes_pointer_for_buffer( - value=waveform_data_array, library_type=_visatype.ViReal64 - ) # case B600 + waveform_data_ctype = get_ctypes_pointer_for_buffer(value=waveform_data_array, library_type=_visatype.ViReal64) # case B600 actual_number_of_samples_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFake_FetchWaveform( - vi_ctype, - number_of_samples_ctype, - waveform_data_ctype, - None - if actual_number_of_samples_ctype is None - else (ctypes.pointer(actual_number_of_samples_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_FetchWaveform(vi_ctype, number_of_samples_ctype, waveform_data_ctype, None if actual_number_of_samples_ctype is None else (ctypes.pointer(actual_number_of_samples_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return waveform_data_array @ivi_synchronized def fetch_waveform_into(self, waveform_data): - r"""fetch_waveform + r'''fetch_waveform Returns waveform data. @@ -1258,46 +1017,28 @@ def fetch_waveform_into(self, waveform_data): actual_number_of_samples (int): Number of samples actually fetched. - """ + ''' import numpy if type(waveform_data) is not numpy.ndarray: - raise TypeError( - "waveform_data must be {0}, is {1}".format( - numpy.ndarray, type(waveform_data) - ) - ) + raise TypeError('waveform_data must be {0}, is {1}'.format(numpy.ndarray, type(waveform_data))) if numpy.isfortran(waveform_data) is True: - raise TypeError("waveform_data must be in C-order") - if waveform_data.dtype is not numpy.dtype("float64"): - raise TypeError( - "waveform_data must be numpy.ndarray of dtype=float64, is " - + str(waveform_data.dtype) - ) + raise TypeError('waveform_data must be in C-order') + if waveform_data.dtype is not numpy.dtype('float64'): + raise TypeError('waveform_data must be numpy.ndarray of dtype=float64, is ' + str(waveform_data.dtype)) number_of_samples = len(waveform_data) vi_ctype = _visatype.ViSession(self._vi) # case S110 number_of_samples_ctype = _visatype.ViInt32(number_of_samples) # case S210 - waveform_data_ctype = get_ctypes_pointer_for_buffer( - value=waveform_data - ) # case B510 + waveform_data_ctype = get_ctypes_pointer_for_buffer(value=waveform_data) # case B510 actual_number_of_samples_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFake_FetchWaveform( - vi_ctype, - number_of_samples_ctype, - waveform_data_ctype, - None - if actual_number_of_samples_ctype is None - else (ctypes.pointer(actual_number_of_samples_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_FetchWaveform(vi_ctype, number_of_samples_ctype, waveform_data_ctype, None if actual_number_of_samples_ctype is None else (ctypes.pointer(actual_number_of_samples_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def get_a_boolean(self): - r"""get_a_boolean + r'''get_a_boolean Returns a boolean. @@ -1306,21 +1047,16 @@ def get_a_boolean(self): Returns: a_boolean (bool): Contains a boolean. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 a_boolean_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niFake_GetABoolean( - vi_ctype, - None if a_boolean_ctype is None else (ctypes.pointer(a_boolean_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_GetABoolean(vi_ctype, None if a_boolean_ctype is None else (ctypes.pointer(a_boolean_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(a_boolean_ctype.value) @ivi_synchronized def get_a_number(self): - r"""get_a_number + r'''get_a_number Returns a number. @@ -1329,41 +1065,32 @@ def get_a_number(self): Returns: a_number (int): Contains a number. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 a_number_ctype = _visatype.ViInt16() # case S220 - error_code = self._library.niFake_GetANumber( - vi_ctype, - None if a_number_ctype is None else (ctypes.pointer(a_number_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_GetANumber(vi_ctype, None if a_number_ctype is None else (ctypes.pointer(a_number_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(a_number_ctype.value) @ivi_synchronized def get_a_string_of_fixed_maximum_size(self): - r"""get_a_string_of_fixed_maximum_size + r'''get_a_string_of_fixed_maximum_size Illustrates returning a string of fixed size. Returns: a_string (str): String comes back here. Buffer must be 256 big. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 a_string_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niFake_GetAStringOfFixedMaximumSize( - vi_ctype, a_string_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_GetAStringOfFixedMaximumSize(vi_ctype, a_string_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return a_string_ctype.value.decode(self._encoding) @ivi_synchronized def get_a_string_using_python_code(self, a_number): - r"""get_a_string_using_python_code + r'''get_a_string_using_python_code Returns a number and a string. @@ -1376,197 +1103,134 @@ def get_a_string_using_python_code(self, a_number): Returns: a_string (str): Contains a string of length aNumber. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 a_number_ctype = _visatype.ViInt16(a_number) # case S150 a_string_ctype = (_visatype.ViChar * a_number)() # case C080 - error_code = self._library.niFake_GetAStringUsingPythonCode( - vi_ctype, a_number_ctype, a_string_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_GetAStringUsingPythonCode(vi_ctype, a_number_ctype, a_string_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return a_string_ctype.value.decode(self._encoding) @ivi_synchronized def get_an_ivi_dance_string(self): - r"""get_an_ivi_dance_string + r'''get_an_ivi_dance_string Returns a string using the IVI dance. Returns: a_string (str): Returns the string. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 buffer_size_ctype = _visatype.ViInt32() # case S170 a_string_ctype = None # case C050 - error_code = self._library.niFake_GetAnIviDanceString( - vi_ctype, buffer_size_ctype, a_string_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niFake_GetAnIviDanceString(vi_ctype, buffer_size_ctype, a_string_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 a_string_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niFake_GetAnIviDanceString( - vi_ctype, buffer_size_ctype, a_string_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_GetAnIviDanceString(vi_ctype, buffer_size_ctype, a_string_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return a_string_ctype.value.decode(self._encoding) @ivi_synchronized def get_an_ivi_dance_with_a_twist_string(self): - r"""get_an_ivi_dance_with_a_twist_string + r'''get_an_ivi_dance_with_a_twist_string TBD Returns: a_string (str): - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 buffer_size_ctype = _visatype.ViInt32(0) # case S190 a_string_ctype = None # case C090 actual_size_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFake_GetAnIviDanceWithATwistString( - vi_ctype, - buffer_size_ctype, - a_string_ctype, - None if actual_size_ctype is None else (ctypes.pointer(actual_size_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niFake_GetAnIviDanceWithATwistString(vi_ctype, buffer_size_ctype, a_string_ctype, None if actual_size_ctype is None else (ctypes.pointer(actual_size_ctype))) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) buffer_size_ctype = _visatype.ViInt32(actual_size_ctype.value) # case S200 a_string_ctype = (_visatype.ViChar * actual_size_ctype.value)() # case C100 - error_code = self._library.niFake_GetAnIviDanceWithATwistString( - vi_ctype, - buffer_size_ctype, - a_string_ctype, - None if actual_size_ctype is None else (ctypes.pointer(actual_size_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_GetAnIviDanceWithATwistString(vi_ctype, buffer_size_ctype, a_string_ctype, None if actual_size_ctype is None else (ctypes.pointer(actual_size_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return a_string_ctype.value.decode(self._encoding) @ivi_synchronized def get_array_for_python_code_custom_type(self): - r"""get_array_for_python_code_custom_type + r'''get_array_for_python_code_custom_type This method returns an array for use in python-code size mechanism. Returns: array_out (list of CustomStruct): Array of custom type using python-code size mechanism - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - number_of_elements_ctype = _visatype.ViInt32( - self.get_array_size_for_python_code() - ) # case S120 + number_of_elements_ctype = _visatype.ViInt32(self.get_array_size_for_python_code()) # case S120 array_out_size = self.get_array_size_for_python_code() # case B560 - array_out_ctype = get_ctypes_pointer_for_buffer( - library_type=custom_struct.struct_CustomStruct, size=array_out_size - ) # case B560 - error_code = self._library.niFake_GetArrayForPythonCodeCustomType( - vi_ctype, number_of_elements_ctype, array_out_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return [ - custom_struct.CustomStruct(array_out_ctype[i]) - for i in range(self.get_array_size_for_python_code()) - ] + array_out_ctype = get_ctypes_pointer_for_buffer(library_type=custom_struct.struct_CustomStruct, size=array_out_size) # case B560 + error_code = self._library.niFake_GetArrayForPythonCodeCustomType(vi_ctype, number_of_elements_ctype, array_out_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return [custom_struct.CustomStruct(array_out_ctype[i]) for i in range(self.get_array_size_for_python_code())] @ivi_synchronized def get_array_for_python_code_double(self): - r"""get_array_for_python_code_double + r'''get_array_for_python_code_double This method returns an array for use in python-code size mechanism. Returns: array_out (list of float): Array of double using python-code size mechanism - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - number_of_elements_ctype = _visatype.ViInt32( - self.get_array_size_for_python_code() - ) # case S120 + number_of_elements_ctype = _visatype.ViInt32(self.get_array_size_for_python_code()) # case S120 array_out_size = self.get_array_size_for_python_code() # case B560 - array_out_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViReal64, size=array_out_size - ) # case B560 - error_code = self._library.niFake_GetArrayForPythonCodeDouble( - vi_ctype, number_of_elements_ctype, array_out_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return [ - float(array_out_ctype[i]) - for i in range(self.get_array_size_for_python_code()) - ] + array_out_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=array_out_size) # case B560 + error_code = self._library.niFake_GetArrayForPythonCodeDouble(vi_ctype, number_of_elements_ctype, array_out_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return [float(array_out_ctype[i]) for i in range(self.get_array_size_for_python_code())] @ivi_synchronized def get_array_size_for_python_code(self): - r"""get_array_size_for_python_code + r'''get_array_size_for_python_code This method returns the size of the array for use in python-code size mechanism. Returns: size_out (int): Size of array - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 size_out_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFake_GetArraySizeForPythonCode( - vi_ctype, - None if size_out_ctype is None else (ctypes.pointer(size_out_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_GetArraySizeForPythonCode(vi_ctype, None if size_out_ctype is None else (ctypes.pointer(size_out_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(size_out_ctype.value) @ivi_synchronized def get_array_using_ivi_dance(self): - r"""get_array_using_ivi_dance + r'''get_array_using_ivi_dance This method returns an array of float whose size is determined with the IVI dance. Returns: array_out (list of float): The array returned by this method - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 array_size_ctype = _visatype.ViInt32() # case S170 array_out_ctype = None # case B580 - error_code = self._library.niFake_GetArrayUsingIviDance( - vi_ctype, array_size_ctype, array_out_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niFake_GetArrayUsingIviDance(vi_ctype, array_size_ctype, array_out_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) array_size_ctype = _visatype.ViInt32(error_code) # case S180 array_out_size = array_size_ctype.value # case B590 - array_out_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViReal64, size=array_out_size - ) # case B590 - error_code = self._library.niFake_GetArrayUsingIviDance( - vi_ctype, array_size_ctype, array_out_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + array_out_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=array_out_size) # case B590 + error_code = self._library.niFake_GetArrayUsingIviDance(vi_ctype, array_size_ctype, array_out_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return [float(array_out_ctype[i]) for i in range(array_size_ctype.value)] @ivi_synchronized def _get_cal_date_and_time(self, cal_type): - r"""_get_cal_date_and_time + r'''_get_cal_date_and_time Returns the date and time of the last calibration performed. @@ -1585,7 +1249,7 @@ def _get_cal_date_and_time(self, cal_type): minute (int): Indicates the **minute** of the last calibration. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 cal_type_ctype = _visatype.ViInt32(cal_type) # case S150 month_ctype = _visatype.ViInt32() # case S220 @@ -1593,69 +1257,45 @@ def _get_cal_date_and_time(self, cal_type): year_ctype = _visatype.ViInt32() # case S220 hour_ctype = _visatype.ViInt32() # case S220 minute_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFake_GetCalDateAndTime( - vi_ctype, - cal_type_ctype, - None if month_ctype is None else (ctypes.pointer(month_ctype)), - None if day_ctype is None else (ctypes.pointer(day_ctype)), - None if year_ctype is None else (ctypes.pointer(year_ctype)), - None if hour_ctype is None else (ctypes.pointer(hour_ctype)), - None if minute_ctype is None else (ctypes.pointer(minute_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return ( - int(month_ctype.value), - int(day_ctype.value), - int(year_ctype.value), - int(hour_ctype.value), - int(minute_ctype.value), - ) + error_code = self._library.niFake_GetCalDateAndTime(vi_ctype, cal_type_ctype, None if month_ctype is None else (ctypes.pointer(month_ctype)), None if day_ctype is None else (ctypes.pointer(day_ctype)), None if year_ctype is None else (ctypes.pointer(year_ctype)), None if hour_ctype is None else (ctypes.pointer(hour_ctype)), None if minute_ctype is None else (ctypes.pointer(minute_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return int(month_ctype.value), int(day_ctype.value), int(year_ctype.value), int(hour_ctype.value), int(minute_ctype.value) @ivi_synchronized def get_cal_interval(self): - r"""get_cal_interval + r'''get_cal_interval Returns the recommended maximum interval, in **months**, between external calibrations. Returns: months (hightime.timedelta): Specifies the recommended maximum interval, in **months**, between external calibrations. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 months_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFake_GetCalInterval( - vi_ctype, None if months_ctype is None else (ctypes.pointer(months_ctype)) - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_GetCalInterval(vi_ctype, None if months_ctype is None else (ctypes.pointer(months_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return _converters.convert_month_to_timedelta(int(months_ctype.value)) @ivi_synchronized def get_custom_type(self): - r"""get_custom_type + r'''get_custom_type This method returns a custom type. Returns: cs (CustomStruct): Set using custom type - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 cs_ctype = custom_struct.struct_CustomStruct() # case S220 - error_code = self._library.niFake_GetCustomType( - vi_ctype, None if cs_ctype is None else (ctypes.pointer(cs_ctype)) - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_GetCustomType(vi_ctype, None if cs_ctype is None else (ctypes.pointer(cs_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return custom_struct.CustomStruct(cs_ctype) @ivi_synchronized def get_custom_type_array(self, number_of_elements): - r"""get_custom_type_array + r'''get_custom_type_array This method returns a custom type. @@ -1666,27 +1306,18 @@ def get_custom_type_array(self, number_of_elements): Returns: cs (list of CustomStruct): Get using custom type - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 number_of_elements_ctype = _visatype.ViInt32(number_of_elements) # case S210 cs_size = number_of_elements # case B600 - cs_ctype = get_ctypes_pointer_for_buffer( - library_type=custom_struct.struct_CustomStruct, size=cs_size - ) # case B600 - error_code = self._library.niFake_GetCustomTypeArray( - vi_ctype, number_of_elements_ctype, cs_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return [ - custom_struct.CustomStruct(cs_ctype[i]) - for i in range(number_of_elements_ctype.value) - ] + cs_ctype = get_ctypes_pointer_for_buffer(library_type=custom_struct.struct_CustomStruct, size=cs_size) # case B600 + error_code = self._library.niFake_GetCustomTypeArray(vi_ctype, number_of_elements_ctype, cs_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return [custom_struct.CustomStruct(cs_ctype[i]) for i in range(number_of_elements_ctype.value)] @ivi_synchronized def get_enum_value(self): - r"""get_enum_value + r'''get_enum_value Returns an enum value @@ -1709,23 +1340,17 @@ def get_enum_value(self): | 3 | Mich elangelo | +---+---------------+ - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 a_quantity_ctype = _visatype.ViInt32() # case S220 a_turtle_ctype = _visatype.ViInt16() # case S220 - error_code = self._library.niFake_GetEnumValue( - vi_ctype, - None if a_quantity_ctype is None else (ctypes.pointer(a_quantity_ctype)), - None if a_turtle_ctype is None else (ctypes.pointer(a_turtle_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_GetEnumValue(vi_ctype, None if a_quantity_ctype is None else (ctypes.pointer(a_quantity_ctype)), None if a_turtle_ctype is None else (ctypes.pointer(a_turtle_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(a_quantity_ctype.value), enums.Turtle(a_turtle_ctype.value) @ivi_synchronized def get_cal_date_and_time(self, cal_type): - """get_cal_date_and_time + '''get_cal_date_and_time Returns the date and time of the last calibration performed. @@ -1736,42 +1361,30 @@ def get_cal_date_and_time(self, cal_type): Returns: month (hightime.datetime): Indicates date and time of the last calibration. - """ + ''' month, day, year, hour, minute = self._get_cal_date_and_time(cal_type) return hightime.datetime(year, month, day, hour, minute) @ivi_synchronized def import_attribute_configuration_buffer(self, configuration): - r"""import_attribute_configuration_buffer + r'''import_attribute_configuration_buffer Import configuration buffer. Args: configuration (bytes): - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - size_in_bytes_ctype = _visatype.ViInt32( - 0 if configuration is None else len(configuration) - ) # case S160 - configuration_converted = _converters.convert_to_bytes( - configuration - ) # case B520 - configuration_ctype = get_ctypes_pointer_for_buffer( - value=configuration_converted, library_type=_visatype.ViInt8 - ) # case B520 - error_code = self._library.niFake_ImportAttributeConfigurationBuffer( - vi_ctype, size_in_bytes_ctype, configuration_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + size_in_bytes_ctype = _visatype.ViInt32(0 if configuration is None else len(configuration)) # case S160 + configuration_converted = _converters.convert_to_bytes(configuration) # case B520 + configuration_ctype = get_ctypes_pointer_for_buffer(value=configuration_converted, library_type=_visatype.ViInt8) # case B520 + error_code = self._library.niFake_ImportAttributeConfigurationBuffer(vi_ctype, size_in_bytes_ctype, configuration_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return - def _init_with_options( - self, resource_name, option_string, id_query=False, reset_device=False - ): - r"""_init_with_options + def _init_with_options(self, resource_name, option_string, id_query=False, reset_device=False): + r'''_init_with_options Creates a new IVI instrument driver session. @@ -1802,48 +1415,30 @@ def _init_with_options( Returns: vi (int): Returns a ViSession handle that you use. - """ - resource_name_ctype = ctypes.create_string_buffer( - resource_name.encode(self._encoding) - ) # case C020 + ''' + resource_name_ctype = ctypes.create_string_buffer(resource_name.encode(self._encoding)) # case C020 id_query_ctype = _visatype.ViBoolean(id_query) # case S150 reset_device_ctype = _visatype.ViBoolean(reset_device) # case S150 - option_string_ctype = ctypes.create_string_buffer( - _converters.convert_init_with_options_dictionary(option_string).encode( - self._encoding - ) - ) # case C040 + option_string_ctype = ctypes.create_string_buffer(_converters.convert_init_with_options_dictionary(option_string).encode(self._encoding)) # case C040 vi_ctype = _visatype.ViSession() # case S220 - error_code = self._library.niFake_InitWithOptions( - resource_name_ctype, - id_query_ctype, - reset_device_ctype, - option_string_ctype, - None if vi_ctype is None else (ctypes.pointer(vi_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_InitWithOptions(resource_name_ctype, id_query_ctype, reset_device_ctype, option_string_ctype, None if vi_ctype is None else (ctypes.pointer(vi_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(vi_ctype.value) @ivi_synchronized def _initiate(self): - r"""_initiate + r'''_initiate Initiates a thingie. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFake_Initiate(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def multiple_array_types( - self, output_array_size, input_array_of_floats, input_array_of_integers=None - ): - r"""multiple_array_types + def multiple_array_types(self, output_array_size, input_array_of_floats, input_array_of_integers=None): + r'''multiple_array_types Receives and returns multiple types of arrays. @@ -1862,51 +1457,25 @@ def multiple_array_types( output_array_of_fixed_length (list of float): An array of doubles with fixed size. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 output_array_size_ctype = _visatype.ViInt32(output_array_size) # case S210 output_array_size = output_array_size # case B600 - output_array_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViReal64, size=output_array_size - ) # case B600 + output_array_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=output_array_size) # case B600 output_array_of_fixed_length_size = 3 # case B570 - output_array_of_fixed_length_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViReal64, size=output_array_of_fixed_length_size - ) # case B570 - input_array_sizes_ctype = _visatype.ViInt32( - 0 if input_array_of_floats is None else len(input_array_of_floats) - ) # case S160 - if input_array_of_integers is not None and len(input_array_of_integers) != len( - input_array_of_floats - ): # case S160 - raise ValueError( - "Length of input_array_of_integers and input_array_of_floats parameters do not match." - ) # case S160 - input_array_of_floats_ctype = get_ctypes_pointer_for_buffer( - value=input_array_of_floats, library_type=_visatype.ViReal64 - ) # case B550 - input_array_of_integers_ctype = get_ctypes_pointer_for_buffer( - value=input_array_of_integers, library_type=_visatype.ViInt16 - ) # case B550 - error_code = self._library.niFake_MultipleArrayTypes( - vi_ctype, - output_array_size_ctype, - output_array_ctype, - output_array_of_fixed_length_ctype, - input_array_sizes_ctype, - input_array_of_floats_ctype, - input_array_of_integers_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return [ - float(output_array_ctype[i]) for i in range(output_array_size_ctype.value) - ], [float(output_array_of_fixed_length_ctype[i]) for i in range(3)] + output_array_of_fixed_length_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=output_array_of_fixed_length_size) # case B570 + input_array_sizes_ctype = _visatype.ViInt32(0 if input_array_of_floats is None else len(input_array_of_floats)) # case S160 + if input_array_of_integers is not None and len(input_array_of_integers) != len(input_array_of_floats): # case S160 + raise ValueError("Length of input_array_of_integers and input_array_of_floats parameters do not match.") # case S160 + input_array_of_floats_ctype = get_ctypes_pointer_for_buffer(value=input_array_of_floats, library_type=_visatype.ViReal64) # case B550 + input_array_of_integers_ctype = get_ctypes_pointer_for_buffer(value=input_array_of_integers, library_type=_visatype.ViInt16) # case B550 + error_code = self._library.niFake_MultipleArrayTypes(vi_ctype, output_array_size_ctype, output_array_ctype, output_array_of_fixed_length_ctype, input_array_sizes_ctype, input_array_of_floats_ctype, input_array_of_integers_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return [float(output_array_ctype[i]) for i in range(output_array_size_ctype.value)], [float(output_array_of_fixed_length_ctype[i]) for i in range(3)] @ivi_synchronized def multiple_arrays_same_size(self, values1, values2, values3, values4): - r"""multiple_arrays_same_size + r'''multiple_arrays_same_size Method to test multiple arrays that use the same size @@ -1919,78 +1488,42 @@ def multiple_arrays_same_size(self, values1, values2, values3, values4): values4 (list of float): Array 4 of same size. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - values1_ctype = get_ctypes_pointer_for_buffer( - value=values1, library_type=_visatype.ViReal64 - ) # case B550 - values2_ctype = get_ctypes_pointer_for_buffer( - value=values2, library_type=_visatype.ViReal64 - ) # case B550 - values3_ctype = get_ctypes_pointer_for_buffer( - value=values3, library_type=_visatype.ViReal64 - ) # case B550 - values4_ctype = get_ctypes_pointer_for_buffer( - value=values4, library_type=_visatype.ViReal64 - ) # case B550 - size_ctype = _visatype.ViInt32( - 0 if values1 is None else len(values1) - ) # case S160 + values1_ctype = get_ctypes_pointer_for_buffer(value=values1, library_type=_visatype.ViReal64) # case B550 + values2_ctype = get_ctypes_pointer_for_buffer(value=values2, library_type=_visatype.ViReal64) # case B550 + values3_ctype = get_ctypes_pointer_for_buffer(value=values3, library_type=_visatype.ViReal64) # case B550 + values4_ctype = get_ctypes_pointer_for_buffer(value=values4, library_type=_visatype.ViReal64) # case B550 + size_ctype = _visatype.ViInt32(0 if values1 is None else len(values1)) # case S160 if values2 is not None and len(values2) != len(values1): # case S160 - raise ValueError( - "Length of values2 and values1 parameters do not match." - ) # case S160 + raise ValueError("Length of values2 and values1 parameters do not match.") # case S160 if values3 is not None and len(values3) != len(values1): # case S160 - raise ValueError( - "Length of values3 and values1 parameters do not match." - ) # case S160 + raise ValueError("Length of values3 and values1 parameters do not match.") # case S160 if values4 is not None and len(values4) != len(values1): # case S160 - raise ValueError( - "Length of values4 and values1 parameters do not match." - ) # case S160 - error_code = self._library.niFake_MultipleArraysSameSize( - vi_ctype, - values1_ctype, - values2_ctype, - values3_ctype, - values4_ctype, - size_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + raise ValueError("Length of values4 and values1 parameters do not match.") # case S160 + error_code = self._library.niFake_MultipleArraysSameSize(vi_ctype, values1_ctype, values2_ctype, values3_ctype, values4_ctype, size_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def one_input_function(self, a_number): - r"""one_input_function + r'''one_input_function This method takes one parameter other than the session. Args: a_number (int): Contains a number - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 a_number_ctype = _visatype.ViInt32(a_number) # case S150 error_code = self._library.niFake_OneInputFunction(vi_ctype, a_number_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def parameters_are_multiple_types( - self, - a_boolean, - an_int32, - an_int64, - an_int_enum, - a_float, - a_float_enum, - a_string, - ): - r"""parameters_are_multiple_types + def parameters_are_multiple_types(self, a_boolean, an_int32, an_int64, an_int_enum, a_float, a_float_enum, a_string): + r'''parameters_are_multiple_types Has parameters of multiple types. @@ -2019,15 +1552,11 @@ def parameters_are_multiple_types( a_string (str): An IVI dance string. - """ + ''' if type(an_int_enum) is not enums.Turtle: - raise TypeError( - "Parameter an_int_enum must be of type " + str(enums.Turtle) - ) + raise TypeError('Parameter an_int_enum must be of type ' + str(enums.Turtle)) if type(a_float_enum) is not enums.FloatEnum: - raise TypeError( - "Parameter a_float_enum must be of type " + str(enums.FloatEnum) - ) + raise TypeError('Parameter a_float_enum must be of type ' + str(enums.FloatEnum)) vi_ctype = _visatype.ViSession(self._vi) # case S110 a_boolean_ctype = _visatype.ViBoolean(a_boolean) # case S150 an_int32_ctype = _visatype.ViInt32(an_int32) # case S150 @@ -2035,44 +1564,26 @@ def parameters_are_multiple_types( an_int_enum_ctype = _visatype.ViInt16(an_int_enum.value) # case S130 a_float_ctype = _visatype.ViReal64(a_float) # case S150 a_float_enum_ctype = _visatype.ViReal64(a_float_enum.value) # case S130 - string_size_ctype = _visatype.ViInt32( - 0 if a_string is None else len(a_string) - ) # case S160 - a_string_ctype = ctypes.create_string_buffer( - a_string.encode(self._encoding) - ) # case C020 - error_code = self._library.niFake_ParametersAreMultipleTypes( - vi_ctype, - a_boolean_ctype, - an_int32_ctype, - an_int64_ctype, - an_int_enum_ctype, - a_float_ctype, - a_float_enum_ctype, - string_size_ctype, - a_string_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + string_size_ctype = _visatype.ViInt32(0 if a_string is None else len(a_string)) # case S160 + a_string_ctype = ctypes.create_string_buffer(a_string.encode(self._encoding)) # case C020 + error_code = self._library.niFake_ParametersAreMultipleTypes(vi_ctype, a_boolean_ctype, an_int32_ctype, an_int64_ctype, an_int_enum_ctype, a_float_ctype, a_float_enum_ctype, string_size_ctype, a_string_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def simple_function(self): - r"""simple_function + r'''simple_function This method takes no parameters other than the session. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFake_PoorlyNamedSimpleFunction(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def read(self, maximum_time): - r"""read + r'''read Acquires a single measurement and returns the measured value. @@ -2083,25 +1594,17 @@ def read(self, maximum_time): Returns: reading (float): The measured value. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_time_ctype = _converters.convert_timedelta_to_seconds_real64( - maximum_time - ) # case S140 + maximum_time_ctype = _converters.convert_timedelta_to_seconds_real64(maximum_time) # case S140 reading_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niFake_Read( - vi_ctype, - maximum_time_ctype, - None if reading_ctype is None else (ctypes.pointer(reading_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_Read(vi_ctype, maximum_time_ctype, None if reading_ctype is None else (ctypes.pointer(reading_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(reading_ctype.value) @ivi_synchronized def return_a_number_and_a_string(self): - r"""return_a_number_and_a_string + r'''return_a_number_and_a_string Returns a number and a string. @@ -2112,46 +1615,33 @@ def return_a_number_and_a_string(self): a_string (str): Contains a string. Buffer must be 256 bytes or larger. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 a_number_ctype = _visatype.ViInt16() # case S220 a_string_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niFake_ReturnANumberAndAString( - vi_ctype, - None if a_number_ctype is None else (ctypes.pointer(a_number_ctype)), - a_string_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_ReturnANumberAndAString(vi_ctype, None if a_number_ctype is None else (ctypes.pointer(a_number_ctype)), a_string_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(a_number_ctype.value), a_string_ctype.value.decode(self._encoding) @ivi_synchronized def return_duration_in_seconds(self): - r"""return_duration_in_seconds + r'''return_duration_in_seconds Returns a hightime.timedelta instance. Returns: timedelta (hightime.timedelta): Duration in seconds. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 timedelta_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niFake_ReturnDurationInSeconds( - vi_ctype, - None if timedelta_ctype is None else (ctypes.pointer(timedelta_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return _converters.convert_seconds_real64_to_timedelta( - float(timedelta_ctype.value) - ) + error_code = self._library.niFake_ReturnDurationInSeconds(vi_ctype, None if timedelta_ctype is None else (ctypes.pointer(timedelta_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return _converters.convert_seconds_real64_to_timedelta(float(timedelta_ctype.value)) @ivi_synchronized def return_list_of_durations_in_seconds(self, number_of_elements): - r"""return_list_of_durations_in_seconds + r'''return_list_of_durations_in_seconds Returns a list of hightime.timedelta instances. @@ -2162,26 +1652,18 @@ def return_list_of_durations_in_seconds(self, number_of_elements): Returns: timedeltas (hightime.timedelta): Contains a list of hightime.timedelta instances. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 number_of_elements_ctype = _visatype.ViInt32(number_of_elements) # case S210 timedeltas_size = number_of_elements # case B600 - timedeltas_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViReal64, size=timedeltas_size - ) # case B600 - error_code = self._library.niFake_ReturnListOfDurationsInSeconds( - vi_ctype, number_of_elements_ctype, timedeltas_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return _converters.convert_seconds_real64_to_timedeltas( - [float(timedeltas_ctype[i]) for i in range(number_of_elements_ctype.value)] - ) + timedeltas_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=timedeltas_size) # case B600 + error_code = self._library.niFake_ReturnListOfDurationsInSeconds(vi_ctype, number_of_elements_ctype, timedeltas_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return _converters.convert_seconds_real64_to_timedeltas([float(timedeltas_ctype[i]) for i in range(number_of_elements_ctype.value)]) @ivi_synchronized def return_multiple_types(self, array_size): - r"""return_multiple_types + r'''return_multiple_types Returns multiple types. @@ -2218,7 +1700,7 @@ def return_multiple_types(self, array_size): a_string (str): An IVI dance string. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 a_boolean_ctype = _visatype.ViBoolean() # case S220 an_int32_ctype = _visatype.ViInt32() # case S220 @@ -2228,109 +1710,53 @@ def return_multiple_types(self, array_size): a_float_enum_ctype = _visatype.ViReal64() # case S220 array_size_ctype = _visatype.ViInt32(array_size) # case S210 an_array_size = array_size # case B600 - an_array_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViReal64, size=an_array_size - ) # case B600 + an_array_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=an_array_size) # case B600 string_size_ctype = _visatype.ViInt32() # case S170 a_string_ctype = None # case C050 - error_code = self._library.niFake_ReturnMultipleTypes( - vi_ctype, - None if a_boolean_ctype is None else (ctypes.pointer(a_boolean_ctype)), - None if an_int32_ctype is None else (ctypes.pointer(an_int32_ctype)), - None if an_int64_ctype is None else (ctypes.pointer(an_int64_ctype)), - None if an_int_enum_ctype is None else (ctypes.pointer(an_int_enum_ctype)), - None if a_float_ctype is None else (ctypes.pointer(a_float_ctype)), - None - if a_float_enum_ctype is None - else (ctypes.pointer(a_float_enum_ctype)), - array_size_ctype, - an_array_ctype, - string_size_ctype, - a_string_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niFake_ReturnMultipleTypes(vi_ctype, None if a_boolean_ctype is None else (ctypes.pointer(a_boolean_ctype)), None if an_int32_ctype is None else (ctypes.pointer(an_int32_ctype)), None if an_int64_ctype is None else (ctypes.pointer(an_int64_ctype)), None if an_int_enum_ctype is None else (ctypes.pointer(an_int_enum_ctype)), None if a_float_ctype is None else (ctypes.pointer(a_float_ctype)), None if a_float_enum_ctype is None else (ctypes.pointer(a_float_enum_ctype)), array_size_ctype, an_array_ctype, string_size_ctype, a_string_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) string_size_ctype = _visatype.ViInt32(error_code) # case S180 a_string_ctype = (_visatype.ViChar * string_size_ctype.value)() # case C060 - error_code = self._library.niFake_ReturnMultipleTypes( - vi_ctype, - None if a_boolean_ctype is None else (ctypes.pointer(a_boolean_ctype)), - None if an_int32_ctype is None else (ctypes.pointer(an_int32_ctype)), - None if an_int64_ctype is None else (ctypes.pointer(an_int64_ctype)), - None if an_int_enum_ctype is None else (ctypes.pointer(an_int_enum_ctype)), - None if a_float_ctype is None else (ctypes.pointer(a_float_ctype)), - None - if a_float_enum_ctype is None - else (ctypes.pointer(a_float_enum_ctype)), - array_size_ctype, - an_array_ctype, - string_size_ctype, - a_string_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return ( - bool(a_boolean_ctype.value), - int(an_int32_ctype.value), - int(an_int64_ctype.value), - enums.Turtle(an_int_enum_ctype.value), - float(a_float_ctype.value), - enums.FloatEnum(a_float_enum_ctype.value), - [float(an_array_ctype[i]) for i in range(array_size_ctype.value)], - a_string_ctype.value.decode(self._encoding), - ) + error_code = self._library.niFake_ReturnMultipleTypes(vi_ctype, None if a_boolean_ctype is None else (ctypes.pointer(a_boolean_ctype)), None if an_int32_ctype is None else (ctypes.pointer(an_int32_ctype)), None if an_int64_ctype is None else (ctypes.pointer(an_int64_ctype)), None if an_int_enum_ctype is None else (ctypes.pointer(an_int_enum_ctype)), None if a_float_ctype is None else (ctypes.pointer(a_float_ctype)), None if a_float_enum_ctype is None else (ctypes.pointer(a_float_enum_ctype)), array_size_ctype, an_array_ctype, string_size_ctype, a_string_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return bool(a_boolean_ctype.value), int(an_int32_ctype.value), int(an_int64_ctype.value), enums.Turtle(an_int_enum_ctype.value), float(a_float_ctype.value), enums.FloatEnum(a_float_enum_ctype.value), [float(an_array_ctype[i]) for i in range(array_size_ctype.value)], a_string_ctype.value.decode(self._encoding) @ivi_synchronized def set_custom_type(self, cs): - r"""set_custom_type + r'''set_custom_type This method takes a custom type. Args: cs (CustomStruct): Set using custom type - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 cs_ctype = custom_struct.struct_CustomStruct(cs) # case S150 error_code = self._library.niFake_SetCustomType(vi_ctype, cs_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def set_custom_type_array(self, cs): - r"""set_custom_type_array + r'''set_custom_type_array This method takes an array of custom types. Args: cs (list of CustomStruct): Set using custom type - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - number_of_elements_ctype = _visatype.ViInt32( - 0 if cs is None else len(cs) - ) # case S160 - cs_ctype = get_ctypes_pointer_for_buffer( - [custom_struct.struct_CustomStruct(c) for c in cs], - library_type=custom_struct.struct_CustomStruct, - ) # case B540 - error_code = self._library.niFake_SetCustomTypeArray( - vi_ctype, number_of_elements_ctype, cs_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + number_of_elements_ctype = _visatype.ViInt32(0 if cs is None else len(cs)) # case S160 + cs_ctype = get_ctypes_pointer_for_buffer([custom_struct.struct_CustomStruct(c) for c in cs], library_type=custom_struct.struct_CustomStruct) # case B540 + error_code = self._library.niFake_SetCustomTypeArray(vi_ctype, number_of_elements_ctype, cs_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def string_valued_enum_input_function_with_defaults( - self, a_mobile_os_name=enums.MobileOSNames.ANDROID - ): - r"""string_valued_enum_input_function_with_defaults + def string_valued_enum_input_function_with_defaults(self, a_mobile_os_name=enums.MobileOSNames.ANDROID): + r'''string_valued_enum_input_function_with_defaults This method takes one parameter other than the session, which happens to be a string-valued enum and has a default value. @@ -2345,26 +1771,18 @@ def string_valued_enum_input_function_with_defaults( | NONE | None | +---------+---------+ - """ + ''' if type(a_mobile_os_name) is not enums.MobileOSNames: - raise TypeError( - "Parameter a_mobile_os_name must be of type " + str(enums.MobileOSNames) - ) + raise TypeError('Parameter a_mobile_os_name must be of type ' + str(enums.MobileOSNames)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - a_mobile_os_name_ctype = ctypes.create_string_buffer( - a_mobile_os_name.value.encode(self._encoding) - ) # case C030 - error_code = self._library.niFake_StringValuedEnumInputFunctionWithDefaults( - vi_ctype, a_mobile_os_name_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + a_mobile_os_name_ctype = ctypes.create_string_buffer(a_mobile_os_name.value.encode(self._encoding)) # case C030 + error_code = self._library.niFake_StringValuedEnumInputFunctionWithDefaults(vi_ctype, a_mobile_os_name_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def two_input_function(self, a_number, a_string): - r"""two_input_function + r'''two_input_function This method takes two parameters other than the session. @@ -2373,23 +1791,17 @@ def two_input_function(self, a_number, a_string): a_string (str): Contains a string - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 a_number_ctype = _visatype.ViReal64(a_number) # case S150 - a_string_ctype = ctypes.create_string_buffer( - a_string.encode(self._encoding) - ) # case C020 - error_code = self._library.niFake_TwoInputFunction( - vi_ctype, a_number_ctype, a_string_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + a_string_ctype = ctypes.create_string_buffer(a_string.encode(self._encoding)) # case C020 + error_code = self._library.niFake_TwoInputFunction(vi_ctype, a_number_ctype, a_string_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def use64_bit_number(self, input): - r"""use64_bit_number + r'''use64_bit_number Returns a number and a string. @@ -2402,102 +1814,73 @@ def use64_bit_number(self, input): Returns: output (int): A big number on its way out. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 input_ctype = _visatype.ViInt64(input) # case S150 output_ctype = _visatype.ViInt64() # case S220 - error_code = self._library.niFake_Use64BitNumber( - vi_ctype, - input_ctype, - None if output_ctype is None else (ctypes.pointer(output_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_Use64BitNumber(vi_ctype, input_ctype, None if output_ctype is None else (ctypes.pointer(output_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(output_ctype.value) @ivi_synchronized def write_waveform(self, waveform): - r"""write_waveform + r'''write_waveform Writes waveform to the driver Args: waveform (array.array("d")): Waveform data. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - number_of_samples_ctype = _visatype.ViInt32( - 0 if waveform is None else len(waveform) - ) # case S160 - waveform_array = get_ctypes_and_array( - value=waveform, array_type="d" - ) # case B550 - waveform_ctype = get_ctypes_pointer_for_buffer( - value=waveform_array, library_type=_visatype.ViReal64 - ) # case B550 - error_code = self._library.niFake_WriteWaveform( - vi_ctype, number_of_samples_ctype, waveform_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + number_of_samples_ctype = _visatype.ViInt32(0 if waveform is None else len(waveform)) # case S160 + waveform_array = get_ctypes_and_array(value=waveform, array_type="d") # case B550 + waveform_ctype = get_ctypes_pointer_for_buffer(value=waveform_array, library_type=_visatype.ViReal64) # case B550 + error_code = self._library.niFake_WriteWaveform(vi_ctype, number_of_samples_ctype, waveform_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def write_waveform_numpy(self, waveform): - r"""write_waveform + r'''write_waveform Writes waveform to the driver Args: waveform (numpy.array(dtype=numpy.float64)): Waveform data. - """ + ''' import numpy if type(waveform) is not numpy.ndarray: - raise TypeError( - "waveform must be {0}, is {1}".format(numpy.ndarray, type(waveform)) - ) + raise TypeError('waveform must be {0}, is {1}'.format(numpy.ndarray, type(waveform))) if numpy.isfortran(waveform) is True: - raise TypeError("waveform must be in C-order") - if waveform.dtype is not numpy.dtype("float64"): - raise TypeError( - "waveform must be numpy.ndarray of dtype=float64, is " - + str(waveform.dtype) - ) + raise TypeError('waveform must be in C-order') + if waveform.dtype is not numpy.dtype('float64'): + raise TypeError('waveform must be numpy.ndarray of dtype=float64, is ' + str(waveform.dtype)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - number_of_samples_ctype = _visatype.ViInt32( - 0 if waveform is None else len(waveform) - ) # case S160 + number_of_samples_ctype = _visatype.ViInt32(0 if waveform is None else len(waveform)) # case S160 waveform_ctype = get_ctypes_pointer_for_buffer(value=waveform) # case B510 - error_code = self._library.niFake_WriteWaveform( - vi_ctype, number_of_samples_ctype, waveform_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFake_WriteWaveform(vi_ctype, number_of_samples_ctype, waveform_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def _close(self): - r"""_close + r'''_close Closes the specified session and deallocates resources that it reserved. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFake_close(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def self_test(self): - """self_test + '''self_test Performs a self-test - """ + ''' code, msg = self._self_test() if code: raise errors.SelfTestError(code, msg) @@ -2505,7 +1888,7 @@ def self_test(self): @ivi_synchronized def _self_test(self): - r"""_self_test + r'''_self_test Performs a self-test. @@ -2514,20 +1897,13 @@ def _self_test(self): self_test_message (str): This parameter contains the string returned from the instrument self-test. The array must contain at least 256 elements. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 self_test_result_ctype = _visatype.ViInt16() # case S220 self_test_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niFake_self_test( - vi_ctype, - None - if self_test_result_ctype is None - else (ctypes.pointer(self_test_result_ctype)), - self_test_message_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return int(self_test_result_ctype.value), self_test_message_ctype.value.decode( - self._encoding - ) + error_code = self._library.niFake_self_test(vi_ctype, None if self_test_result_ctype is None else (ctypes.pointer(self_test_result_ctype)), self_test_message_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return int(self_test_result_ctype.value), self_test_message_ctype.value.decode(self._encoding) + + + diff --git a/generated/nifake/nifake/unit_tests/_matchers.py b/generated/nifake/nifake/unit_tests/_matchers.py index 1cc981e9b..1fb27f232 100644 --- a/generated/nifake/nifake/unit_tests/_matchers.py +++ b/generated/nifake/nifake/unit_tests/_matchers.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # This file was generated -"""Matcher classes used by unit tests in order to set mock expectations. +'''Matcher classes used by unit tests in order to set mock expectations. These work well with our visatype definitions. -""" +''' import ctypes import nifake._visatype as _visatype @@ -21,27 +21,15 @@ def __init__(self, expected_type, expected_value): def __eq__(self, other): if not isinstance(other, self.expected_type): - print( - "{0}: Unexpected type. Expected: {1}. Received: {2}".format( - self.__class__.__name__, self.expected_type, type(other) - ) - ) + print("{0}: Unexpected type. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_type, type(other))) return False if other.value != self.expected_value: - print( - "{0}: Unexpected value. Expected: {1}. Received: {2}".format( - self.__class__.__name__, self.expected_value, other.value - ) - ) + print("{0}: Unexpected value. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_value, other.value)) return False return True def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_type), - pp.pformat(self.expected_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) class _PointerMatcher(object): @@ -50,18 +38,12 @@ def __init__(self, expected_type): def __eq__(self, other): if not isinstance(other, ctypes.POINTER(self.expected_type)): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - ctypes.POINTER(self.expected_type), type(other) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(ctypes.POINTER(self.expected_type), type(other))) return False return True def __repr__(self): - return "{0}({1})".format( - self.__class__.__name__, pp.pformat(self.expected_type) - ) + return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_type)) class _BufferMatcher(object): @@ -88,47 +70,29 @@ def __eq__(self, other): pass # Because of object lifetimes, we may need to mock the other instance and provide lists instead of the actual array - if not isinstance(other, self.expected_type) and not isinstance( - other, list - ): - print( - "Unexpected type. Expected: {0} or {1}. Received: {2}".format( - self.expected_type, list, type(other) - ) - ) + if not isinstance(other, self.expected_type) and not isinstance(other, list): + print("Unexpected type. Expected: {0} or {1}. Received: {2}".format(self.expected_type, list, type(other))) return False if self.expected_size != len(other): - print( - "Unexpected length. Expected: {0}. Received: {1}".format( - self.expected_size, len(other) - ) - ) + print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(other))) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for i in range(0, len(self.expected_value)): if self.expected_value[i] != other[i]: - print( - "Unexpected value at index {0}. Expected: {1}. Received: {2}".format( - i, self.expected_value[i], other[i] - ) - ) + print("Unexpected value at index {0}. Expected: {1}. Received: {2}".format(i, self.expected_value[i], other[i])) return False return True def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self._expected_element_type), - pp.pformat(self._expected_size_or_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self._expected_element_type), pp.pformat(self._expected_size_or_value)) def __str__(self): - ret_str = self.__repr__() + "\n" - ret_str += " expected_type = " + str(self.expected_type) + "\n" - ret_str += " expected_value = " + str(self.expected_value) + "\n" - ret_str += " expected_size = " + str(self.expected_size) + "\n" + ret_str = self.__repr__() + '\n' + ret_str += ' expected_type = ' + str(self.expected_type) + '\n' + ret_str += ' expected_value = ' + str(self.expected_value) + '\n' + ret_str += ' expected_size = ' + str(self.expected_size) + '\n' return ret_str @@ -148,37 +112,21 @@ def __eq__(self, other): pass if not isinstance(other, ctypes.Array): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_type, type(other) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(other))) return False - if ( - len(other) < len(self.expected_string_value) + 1 - ): # +1 for NULL terminating character - print( - "Unexpected length in C string. Expected at least: {0}. Received {1}".format( - len(other), len(self.expected_string_value) + 1 - ) - ) + if len(other) < len(self.expected_string_value) + 1: # +1 for NULL terminating character + print("Unexpected length in C string. Expected at least: {0}. Received {1}".format(len(other), len(self.expected_string_value) + 1)) return False if not isinstance(other[0], bytes): print("Unexpected type. Not a string. Received: {0}".format(type(other[0]))) return False if other.value.decode("ascii") != self.expected_string_value: - print( - "Unexpected value. Expected {0}. Received: {1}".format( - self.expected_string_value, other.value.decode - ) - ) + print("Unexpected value. Expected {0}. Received: {1}".format(self.expected_string_value, other.value.decode)) return False return True def __repr__(self): - return "{0}({1})".format( - self.__class__.__name__, pp.pformat(self.expected_string_value) - ) + return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_string_value)) # Custom Type @@ -191,11 +139,7 @@ def _compare_ctype_structs(expected, actual): expected_val = getattr(expected, field_name) actual_val = getattr(actual, field_name) if expected_val != actual_val: - print( - "Unexpected value field {0}. Expected: {1}. Received: {2}".format( - field_name, expected_val, actual_val - ) - ) + print("Unexpected value field {0}. Expected: {1}. Received: {2}".format(field_name, expected_val, actual_val)) return False return True @@ -207,20 +151,12 @@ def __init__(self, expected_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_type, type(actual) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) return False return _compare_ctype_structs(self.expected_value, actual) def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_type), - pp.pformat(self.expected_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) class CustomTypeBufferMatcher(object): @@ -232,48 +168,30 @@ def __init__(self, expected_element_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print( - "Unexpected array type. Expected: {0}. Received: {1}".format( - self.expected_type, type(actual) - ) - ) + print("Unexpected array type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) return False if self.expected_size != len(actual): - print( - "Unexpected length. Expected: {0}. Received: {1}".format( - self.expected_size, len(actual) - ) - ) + print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(actual))) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for a, e in zip(actual, self.expected_value): if not isinstance(a, self.expected_element_type): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_element_type, type(a) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_element_type, type(a))) return False if not _compare_ctype_structs(e, a): return False return True def __repr__(self): - expected_val_repr = ( - "[" + ", ".join([x.__repr__() for x in self.expected_value]) + "]" - ) - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_element_type), - expected_val_repr, - ) + expected_val_repr = '[' + ', '.join([x.__repr__() for x in self.expected_value]) + ']' + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_element_type), expected_val_repr) def __str__(self): - ret_str = self.__repr__() + "\n" - ret_str += " expected_type = " + str(self.expected_type) + "\n" - ret_str += " expected_size = " + str(self.expected_size) + "\n" + ret_str = self.__repr__() + '\n' + ret_str += ' expected_type = ' + str(self.expected_type) + '\n' + ret_str += ' expected_size = ' + str(self.expected_size) + '\n' return ret_str @@ -282,9 +200,7 @@ def __str__(self): class ViBooleanMatcher(_ScalarMatcher): def __init__(self, expected_value): - _ScalarMatcher.__init__( - self, _visatype.ViBoolean, 1 if expected_value is True else 0 - ) + _ScalarMatcher.__init__(self, _visatype.ViBoolean, 1 if expected_value is True else 0) class ViSessionMatcher(_ScalarMatcher): @@ -396,3 +312,6 @@ def __init__(self, expected_size_or_value): class ViSessionBufferMatcher(_BufferMatcher): def __init__(self, expected_size_or_value): _BufferMatcher.__init__(self, _visatype.ViSession, expected_size_or_value) + + + diff --git a/generated/nifake/nifake/unit_tests/_mock_helper.py b/generated/nifake/nifake/unit_tests/_mock_helper.py index c96a11fd2..5099d6498 100644 --- a/generated/nifake/nifake/unit_tests/_mock_helper.py +++ b/generated/nifake/nifake/unit_tests/_mock_helper.py @@ -16,180 +16,180 @@ def __init__(self, function, param=None): class SideEffectsHelper(object): def __init__(self): self._defaults = {} - self._defaults["Abort"] = {} - self._defaults["Abort"]["return"] = 0 - self._defaults["AcceptListOfDurationsInSeconds"] = {} - self._defaults["AcceptListOfDurationsInSeconds"]["return"] = 0 - self._defaults["BoolArrayOutputFunction"] = {} - self._defaults["BoolArrayOutputFunction"]["return"] = 0 - self._defaults["BoolArrayOutputFunction"]["anArray"] = None - self._defaults["DoubleAllTheNums"] = {} - self._defaults["DoubleAllTheNums"]["return"] = 0 - self._defaults["EnumArrayOutputFunction"] = {} - self._defaults["EnumArrayOutputFunction"]["return"] = 0 - self._defaults["EnumArrayOutputFunction"]["anArray"] = None - self._defaults["EnumInputFunctionWithDefaults"] = {} - self._defaults["EnumInputFunctionWithDefaults"]["return"] = 0 - self._defaults["ExportAttributeConfigurationBuffer"] = {} - self._defaults["ExportAttributeConfigurationBuffer"]["return"] = 0 - self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] = None - self._defaults["FetchWaveform"] = {} - self._defaults["FetchWaveform"]["return"] = 0 - self._defaults["FetchWaveform"]["waveformData"] = None - self._defaults["FetchWaveform"]["actualNumberOfSamples"] = None - self._defaults["GetABoolean"] = {} - self._defaults["GetABoolean"]["return"] = 0 - self._defaults["GetABoolean"]["aBoolean"] = None - self._defaults["GetANumber"] = {} - self._defaults["GetANumber"]["return"] = 0 - self._defaults["GetANumber"]["aNumber"] = None - self._defaults["GetAStringOfFixedMaximumSize"] = {} - self._defaults["GetAStringOfFixedMaximumSize"]["return"] = 0 - self._defaults["GetAStringOfFixedMaximumSize"]["aString"] = None - self._defaults["GetAStringUsingPythonCode"] = {} - self._defaults["GetAStringUsingPythonCode"]["return"] = 0 - self._defaults["GetAStringUsingPythonCode"]["aString"] = None - self._defaults["GetAnIviDanceString"] = {} - self._defaults["GetAnIviDanceString"]["return"] = 0 - self._defaults["GetAnIviDanceString"]["aString"] = None - self._defaults["GetAnIviDanceWithATwistString"] = {} - self._defaults["GetAnIviDanceWithATwistString"]["return"] = 0 - self._defaults["GetAnIviDanceWithATwistString"]["actualSize"] = None - self._defaults["GetAnIviDanceWithATwistString"]["aString"] = None - self._defaults["GetArrayForPythonCodeCustomType"] = {} - self._defaults["GetArrayForPythonCodeCustomType"]["return"] = 0 - self._defaults["GetArrayForPythonCodeCustomType"]["arrayOut"] = None - self._defaults["GetArrayForPythonCodeDouble"] = {} - self._defaults["GetArrayForPythonCodeDouble"]["return"] = 0 - self._defaults["GetArrayForPythonCodeDouble"]["arrayOut"] = None - self._defaults["GetArraySizeForPythonCode"] = {} - self._defaults["GetArraySizeForPythonCode"]["return"] = 0 - self._defaults["GetArraySizeForPythonCode"]["sizeOut"] = None - self._defaults["GetArrayUsingIviDance"] = {} - self._defaults["GetArrayUsingIviDance"]["return"] = 0 - self._defaults["GetArrayUsingIviDance"]["arrayOut"] = None - self._defaults["GetAttributeViBoolean"] = {} - self._defaults["GetAttributeViBoolean"]["return"] = 0 - self._defaults["GetAttributeViBoolean"]["attributeValue"] = None - self._defaults["GetAttributeViInt32"] = {} - self._defaults["GetAttributeViInt32"]["return"] = 0 - self._defaults["GetAttributeViInt32"]["attributeValue"] = None - self._defaults["GetAttributeViInt64"] = {} - self._defaults["GetAttributeViInt64"]["return"] = 0 - self._defaults["GetAttributeViInt64"]["attributeValue"] = None - self._defaults["GetAttributeViReal64"] = {} - self._defaults["GetAttributeViReal64"]["return"] = 0 - self._defaults["GetAttributeViReal64"]["attributeValue"] = None - self._defaults["GetAttributeViString"] = {} - self._defaults["GetAttributeViString"]["return"] = 0 - self._defaults["GetAttributeViString"]["attributeValue"] = None - self._defaults["GetCalDateAndTime"] = {} - self._defaults["GetCalDateAndTime"]["return"] = 0 - self._defaults["GetCalDateAndTime"]["month"] = None - self._defaults["GetCalDateAndTime"]["day"] = None - self._defaults["GetCalDateAndTime"]["year"] = None - self._defaults["GetCalDateAndTime"]["hour"] = None - self._defaults["GetCalDateAndTime"]["minute"] = None - self._defaults["GetCalInterval"] = {} - self._defaults["GetCalInterval"]["return"] = 0 - self._defaults["GetCalInterval"]["months"] = None - self._defaults["GetCustomType"] = {} - self._defaults["GetCustomType"]["return"] = 0 - self._defaults["GetCustomType"]["cs"] = None - self._defaults["GetCustomTypeArray"] = {} - self._defaults["GetCustomTypeArray"]["return"] = 0 - self._defaults["GetCustomTypeArray"]["cs"] = None - self._defaults["GetEnumValue"] = {} - self._defaults["GetEnumValue"]["return"] = 0 - self._defaults["GetEnumValue"]["aQuantity"] = None - self._defaults["GetEnumValue"]["aTurtle"] = None - self._defaults["GetError"] = {} - self._defaults["GetError"]["return"] = 0 - self._defaults["GetError"]["errorCode"] = None - self._defaults["GetError"]["description"] = None - self._defaults["ImportAttributeConfigurationBuffer"] = {} - self._defaults["ImportAttributeConfigurationBuffer"]["return"] = 0 - self._defaults["InitWithOptions"] = {} - self._defaults["InitWithOptions"]["return"] = 0 - self._defaults["InitWithOptions"]["vi"] = None - self._defaults["Initiate"] = {} - self._defaults["Initiate"]["return"] = 0 - self._defaults["LockSession"] = {} - self._defaults["LockSession"]["return"] = 0 - self._defaults["LockSession"]["callerHasLock"] = None - self._defaults["MultipleArrayTypes"] = {} - self._defaults["MultipleArrayTypes"]["return"] = 0 - self._defaults["MultipleArrayTypes"]["outputArray"] = None - self._defaults["MultipleArrayTypes"]["outputArrayOfFixedLength"] = None - self._defaults["MultipleArraysSameSize"] = {} - self._defaults["MultipleArraysSameSize"]["return"] = 0 - self._defaults["OneInputFunction"] = {} - self._defaults["OneInputFunction"]["return"] = 0 - self._defaults["ParametersAreMultipleTypes"] = {} - self._defaults["ParametersAreMultipleTypes"]["return"] = 0 - self._defaults["PoorlyNamedSimpleFunction"] = {} - self._defaults["PoorlyNamedSimpleFunction"]["return"] = 0 - self._defaults["Read"] = {} - self._defaults["Read"]["return"] = 0 - self._defaults["Read"]["reading"] = None - self._defaults["ReadFromChannel"] = {} - self._defaults["ReadFromChannel"]["return"] = 0 - self._defaults["ReadFromChannel"]["reading"] = None - self._defaults["ReturnANumberAndAString"] = {} - self._defaults["ReturnANumberAndAString"]["return"] = 0 - self._defaults["ReturnANumberAndAString"]["aNumber"] = None - self._defaults["ReturnANumberAndAString"]["aString"] = None - self._defaults["ReturnDurationInSeconds"] = {} - self._defaults["ReturnDurationInSeconds"]["return"] = 0 - self._defaults["ReturnDurationInSeconds"]["timedelta"] = None - self._defaults["ReturnListOfDurationsInSeconds"] = {} - self._defaults["ReturnListOfDurationsInSeconds"]["return"] = 0 - self._defaults["ReturnListOfDurationsInSeconds"]["timedeltas"] = None - self._defaults["ReturnMultipleTypes"] = {} - self._defaults["ReturnMultipleTypes"]["return"] = 0 - self._defaults["ReturnMultipleTypes"]["aBoolean"] = None - self._defaults["ReturnMultipleTypes"]["anInt32"] = None - self._defaults["ReturnMultipleTypes"]["anInt64"] = None - self._defaults["ReturnMultipleTypes"]["anIntEnum"] = None - self._defaults["ReturnMultipleTypes"]["aFloat"] = None - self._defaults["ReturnMultipleTypes"]["aFloatEnum"] = None - self._defaults["ReturnMultipleTypes"]["anArray"] = None - self._defaults["ReturnMultipleTypes"]["aString"] = None - self._defaults["SetAttributeViBoolean"] = {} - self._defaults["SetAttributeViBoolean"]["return"] = 0 - self._defaults["SetAttributeViInt32"] = {} - self._defaults["SetAttributeViInt32"]["return"] = 0 - self._defaults["SetAttributeViInt64"] = {} - self._defaults["SetAttributeViInt64"]["return"] = 0 - self._defaults["SetAttributeViReal64"] = {} - self._defaults["SetAttributeViReal64"]["return"] = 0 - self._defaults["SetAttributeViString"] = {} - self._defaults["SetAttributeViString"]["return"] = 0 - self._defaults["SetCustomType"] = {} - self._defaults["SetCustomType"]["return"] = 0 - self._defaults["SetCustomTypeArray"] = {} - self._defaults["SetCustomTypeArray"]["return"] = 0 - self._defaults["StringValuedEnumInputFunctionWithDefaults"] = {} - self._defaults["StringValuedEnumInputFunctionWithDefaults"]["return"] = 0 - self._defaults["TwoInputFunction"] = {} - self._defaults["TwoInputFunction"]["return"] = 0 - self._defaults["UnlockSession"] = {} - self._defaults["UnlockSession"]["return"] = 0 - self._defaults["UnlockSession"]["callerHasLock"] = None - self._defaults["Use64BitNumber"] = {} - self._defaults["Use64BitNumber"]["return"] = 0 - self._defaults["Use64BitNumber"]["output"] = None - self._defaults["WriteWaveform"] = {} - self._defaults["WriteWaveform"]["return"] = 0 - self._defaults["close"] = {} - self._defaults["close"]["return"] = 0 - self._defaults["error_message"] = {} - self._defaults["error_message"]["return"] = 0 - self._defaults["error_message"]["errorMessage"] = None - self._defaults["self_test"] = {} - self._defaults["self_test"]["return"] = 0 - self._defaults["self_test"]["selfTestResult"] = None - self._defaults["self_test"]["selfTestMessage"] = None + self._defaults['Abort'] = {} + self._defaults['Abort']['return'] = 0 + self._defaults['AcceptListOfDurationsInSeconds'] = {} + self._defaults['AcceptListOfDurationsInSeconds']['return'] = 0 + self._defaults['BoolArrayOutputFunction'] = {} + self._defaults['BoolArrayOutputFunction']['return'] = 0 + self._defaults['BoolArrayOutputFunction']['anArray'] = None + self._defaults['DoubleAllTheNums'] = {} + self._defaults['DoubleAllTheNums']['return'] = 0 + self._defaults['EnumArrayOutputFunction'] = {} + self._defaults['EnumArrayOutputFunction']['return'] = 0 + self._defaults['EnumArrayOutputFunction']['anArray'] = None + self._defaults['EnumInputFunctionWithDefaults'] = {} + self._defaults['EnumInputFunctionWithDefaults']['return'] = 0 + self._defaults['ExportAttributeConfigurationBuffer'] = {} + self._defaults['ExportAttributeConfigurationBuffer']['return'] = 0 + self._defaults['ExportAttributeConfigurationBuffer']['configuration'] = None + self._defaults['FetchWaveform'] = {} + self._defaults['FetchWaveform']['return'] = 0 + self._defaults['FetchWaveform']['waveformData'] = None + self._defaults['FetchWaveform']['actualNumberOfSamples'] = None + self._defaults['GetABoolean'] = {} + self._defaults['GetABoolean']['return'] = 0 + self._defaults['GetABoolean']['aBoolean'] = None + self._defaults['GetANumber'] = {} + self._defaults['GetANumber']['return'] = 0 + self._defaults['GetANumber']['aNumber'] = None + self._defaults['GetAStringOfFixedMaximumSize'] = {} + self._defaults['GetAStringOfFixedMaximumSize']['return'] = 0 + self._defaults['GetAStringOfFixedMaximumSize']['aString'] = None + self._defaults['GetAStringUsingPythonCode'] = {} + self._defaults['GetAStringUsingPythonCode']['return'] = 0 + self._defaults['GetAStringUsingPythonCode']['aString'] = None + self._defaults['GetAnIviDanceString'] = {} + self._defaults['GetAnIviDanceString']['return'] = 0 + self._defaults['GetAnIviDanceString']['aString'] = None + self._defaults['GetAnIviDanceWithATwistString'] = {} + self._defaults['GetAnIviDanceWithATwistString']['return'] = 0 + self._defaults['GetAnIviDanceWithATwistString']['actualSize'] = None + self._defaults['GetAnIviDanceWithATwistString']['aString'] = None + self._defaults['GetArrayForPythonCodeCustomType'] = {} + self._defaults['GetArrayForPythonCodeCustomType']['return'] = 0 + self._defaults['GetArrayForPythonCodeCustomType']['arrayOut'] = None + self._defaults['GetArrayForPythonCodeDouble'] = {} + self._defaults['GetArrayForPythonCodeDouble']['return'] = 0 + self._defaults['GetArrayForPythonCodeDouble']['arrayOut'] = None + self._defaults['GetArraySizeForPythonCode'] = {} + self._defaults['GetArraySizeForPythonCode']['return'] = 0 + self._defaults['GetArraySizeForPythonCode']['sizeOut'] = None + self._defaults['GetArrayUsingIviDance'] = {} + self._defaults['GetArrayUsingIviDance']['return'] = 0 + self._defaults['GetArrayUsingIviDance']['arrayOut'] = None + self._defaults['GetAttributeViBoolean'] = {} + self._defaults['GetAttributeViBoolean']['return'] = 0 + self._defaults['GetAttributeViBoolean']['attributeValue'] = None + self._defaults['GetAttributeViInt32'] = {} + self._defaults['GetAttributeViInt32']['return'] = 0 + self._defaults['GetAttributeViInt32']['attributeValue'] = None + self._defaults['GetAttributeViInt64'] = {} + self._defaults['GetAttributeViInt64']['return'] = 0 + self._defaults['GetAttributeViInt64']['attributeValue'] = None + self._defaults['GetAttributeViReal64'] = {} + self._defaults['GetAttributeViReal64']['return'] = 0 + self._defaults['GetAttributeViReal64']['attributeValue'] = None + self._defaults['GetAttributeViString'] = {} + self._defaults['GetAttributeViString']['return'] = 0 + self._defaults['GetAttributeViString']['attributeValue'] = None + self._defaults['GetCalDateAndTime'] = {} + self._defaults['GetCalDateAndTime']['return'] = 0 + self._defaults['GetCalDateAndTime']['month'] = None + self._defaults['GetCalDateAndTime']['day'] = None + self._defaults['GetCalDateAndTime']['year'] = None + self._defaults['GetCalDateAndTime']['hour'] = None + self._defaults['GetCalDateAndTime']['minute'] = None + self._defaults['GetCalInterval'] = {} + self._defaults['GetCalInterval']['return'] = 0 + self._defaults['GetCalInterval']['months'] = None + self._defaults['GetCustomType'] = {} + self._defaults['GetCustomType']['return'] = 0 + self._defaults['GetCustomType']['cs'] = None + self._defaults['GetCustomTypeArray'] = {} + self._defaults['GetCustomTypeArray']['return'] = 0 + self._defaults['GetCustomTypeArray']['cs'] = None + self._defaults['GetEnumValue'] = {} + self._defaults['GetEnumValue']['return'] = 0 + self._defaults['GetEnumValue']['aQuantity'] = None + self._defaults['GetEnumValue']['aTurtle'] = None + self._defaults['GetError'] = {} + self._defaults['GetError']['return'] = 0 + self._defaults['GetError']['errorCode'] = None + self._defaults['GetError']['description'] = None + self._defaults['ImportAttributeConfigurationBuffer'] = {} + self._defaults['ImportAttributeConfigurationBuffer']['return'] = 0 + self._defaults['InitWithOptions'] = {} + self._defaults['InitWithOptions']['return'] = 0 + self._defaults['InitWithOptions']['vi'] = None + self._defaults['Initiate'] = {} + self._defaults['Initiate']['return'] = 0 + self._defaults['LockSession'] = {} + self._defaults['LockSession']['return'] = 0 + self._defaults['LockSession']['callerHasLock'] = None + self._defaults['MultipleArrayTypes'] = {} + self._defaults['MultipleArrayTypes']['return'] = 0 + self._defaults['MultipleArrayTypes']['outputArray'] = None + self._defaults['MultipleArrayTypes']['outputArrayOfFixedLength'] = None + self._defaults['MultipleArraysSameSize'] = {} + self._defaults['MultipleArraysSameSize']['return'] = 0 + self._defaults['OneInputFunction'] = {} + self._defaults['OneInputFunction']['return'] = 0 + self._defaults['ParametersAreMultipleTypes'] = {} + self._defaults['ParametersAreMultipleTypes']['return'] = 0 + self._defaults['PoorlyNamedSimpleFunction'] = {} + self._defaults['PoorlyNamedSimpleFunction']['return'] = 0 + self._defaults['Read'] = {} + self._defaults['Read']['return'] = 0 + self._defaults['Read']['reading'] = None + self._defaults['ReadFromChannel'] = {} + self._defaults['ReadFromChannel']['return'] = 0 + self._defaults['ReadFromChannel']['reading'] = None + self._defaults['ReturnANumberAndAString'] = {} + self._defaults['ReturnANumberAndAString']['return'] = 0 + self._defaults['ReturnANumberAndAString']['aNumber'] = None + self._defaults['ReturnANumberAndAString']['aString'] = None + self._defaults['ReturnDurationInSeconds'] = {} + self._defaults['ReturnDurationInSeconds']['return'] = 0 + self._defaults['ReturnDurationInSeconds']['timedelta'] = None + self._defaults['ReturnListOfDurationsInSeconds'] = {} + self._defaults['ReturnListOfDurationsInSeconds']['return'] = 0 + self._defaults['ReturnListOfDurationsInSeconds']['timedeltas'] = None + self._defaults['ReturnMultipleTypes'] = {} + self._defaults['ReturnMultipleTypes']['return'] = 0 + self._defaults['ReturnMultipleTypes']['aBoolean'] = None + self._defaults['ReturnMultipleTypes']['anInt32'] = None + self._defaults['ReturnMultipleTypes']['anInt64'] = None + self._defaults['ReturnMultipleTypes']['anIntEnum'] = None + self._defaults['ReturnMultipleTypes']['aFloat'] = None + self._defaults['ReturnMultipleTypes']['aFloatEnum'] = None + self._defaults['ReturnMultipleTypes']['anArray'] = None + self._defaults['ReturnMultipleTypes']['aString'] = None + self._defaults['SetAttributeViBoolean'] = {} + self._defaults['SetAttributeViBoolean']['return'] = 0 + self._defaults['SetAttributeViInt32'] = {} + self._defaults['SetAttributeViInt32']['return'] = 0 + self._defaults['SetAttributeViInt64'] = {} + self._defaults['SetAttributeViInt64']['return'] = 0 + self._defaults['SetAttributeViReal64'] = {} + self._defaults['SetAttributeViReal64']['return'] = 0 + self._defaults['SetAttributeViString'] = {} + self._defaults['SetAttributeViString']['return'] = 0 + self._defaults['SetCustomType'] = {} + self._defaults['SetCustomType']['return'] = 0 + self._defaults['SetCustomTypeArray'] = {} + self._defaults['SetCustomTypeArray']['return'] = 0 + self._defaults['StringValuedEnumInputFunctionWithDefaults'] = {} + self._defaults['StringValuedEnumInputFunctionWithDefaults']['return'] = 0 + self._defaults['TwoInputFunction'] = {} + self._defaults['TwoInputFunction']['return'] = 0 + self._defaults['UnlockSession'] = {} + self._defaults['UnlockSession']['return'] = 0 + self._defaults['UnlockSession']['callerHasLock'] = None + self._defaults['Use64BitNumber'] = {} + self._defaults['Use64BitNumber']['return'] = 0 + self._defaults['Use64BitNumber']['output'] = None + self._defaults['WriteWaveform'] = {} + self._defaults['WriteWaveform']['return'] = 0 + self._defaults['close'] = {} + self._defaults['close']['return'] = 0 + self._defaults['error_message'] = {} + self._defaults['error_message']['return'] = 0 + self._defaults['error_message']['errorMessage'] = None + self._defaults['self_test'] = {} + self._defaults['self_test']['return'] = 0 + self._defaults['self_test']['selfTestResult'] = None + self._defaults['self_test']['selfTestMessage'] = None def __getitem__(self, func): return self._defaults[func] @@ -198,26 +198,22 @@ def __setitem__(self, func, val): self._defaults[func] = val def niFake_Abort(self, vi): # noqa: N802 - if self._defaults["Abort"]["return"] != 0: - return self._defaults["Abort"]["return"] - return self._defaults["Abort"]["return"] + if self._defaults['Abort']['return'] != 0: + return self._defaults['Abort']['return'] + return self._defaults['Abort']['return'] def niFake_AcceptListOfDurationsInSeconds(self, vi, count, delays): # noqa: N802 - if self._defaults["AcceptListOfDurationsInSeconds"]["return"] != 0: - return self._defaults["AcceptListOfDurationsInSeconds"]["return"] - return self._defaults["AcceptListOfDurationsInSeconds"]["return"] - - def niFake_BoolArrayOutputFunction( - self, vi, number_of_elements, an_array - ): # noqa: N802 - if self._defaults["BoolArrayOutputFunction"]["return"] != 0: - return self._defaults["BoolArrayOutputFunction"]["return"] + if self._defaults['AcceptListOfDurationsInSeconds']['return'] != 0: + return self._defaults['AcceptListOfDurationsInSeconds']['return'] + return self._defaults['AcceptListOfDurationsInSeconds']['return'] + + def niFake_BoolArrayOutputFunction(self, vi, number_of_elements, an_array): # noqa: N802 + if self._defaults['BoolArrayOutputFunction']['return'] != 0: + return self._defaults['BoolArrayOutputFunction']['return'] # an_array - if self._defaults["BoolArrayOutputFunction"]["anArray"] is None: - raise MockFunctionCallError( - "niFake_BoolArrayOutputFunction", param="anArray" - ) - test_value = self._defaults["BoolArrayOutputFunction"]["anArray"] + if self._defaults['BoolArrayOutputFunction']['anArray'] is None: + raise MockFunctionCallError("niFake_BoolArrayOutputFunction", param='anArray') + test_value = self._defaults['BoolArrayOutputFunction']['anArray'] try: an_array_ref = an_array.contents except AttributeError: @@ -225,24 +221,20 @@ def niFake_BoolArrayOutputFunction( assert len(an_array_ref) >= len(test_value) for i in range(len(test_value)): an_array_ref[i] = test_value[i] - return self._defaults["BoolArrayOutputFunction"]["return"] + return self._defaults['BoolArrayOutputFunction']['return'] def niFake_DoubleAllTheNums(self, vi, number_count, numbers): # noqa: N802 - if self._defaults["DoubleAllTheNums"]["return"] != 0: - return self._defaults["DoubleAllTheNums"]["return"] - return self._defaults["DoubleAllTheNums"]["return"] - - def niFake_EnumArrayOutputFunction( - self, vi, number_of_elements, an_array - ): # noqa: N802 - if self._defaults["EnumArrayOutputFunction"]["return"] != 0: - return self._defaults["EnumArrayOutputFunction"]["return"] + if self._defaults['DoubleAllTheNums']['return'] != 0: + return self._defaults['DoubleAllTheNums']['return'] + return self._defaults['DoubleAllTheNums']['return'] + + def niFake_EnumArrayOutputFunction(self, vi, number_of_elements, an_array): # noqa: N802 + if self._defaults['EnumArrayOutputFunction']['return'] != 0: + return self._defaults['EnumArrayOutputFunction']['return'] # an_array - if self._defaults["EnumArrayOutputFunction"]["anArray"] is None: - raise MockFunctionCallError( - "niFake_EnumArrayOutputFunction", param="anArray" - ) - test_value = self._defaults["EnumArrayOutputFunction"]["anArray"] + if self._defaults['EnumArrayOutputFunction']['anArray'] is None: + raise MockFunctionCallError("niFake_EnumArrayOutputFunction", param='anArray') + test_value = self._defaults['EnumArrayOutputFunction']['anArray'] try: an_array_ref = an_array.contents except AttributeError: @@ -250,50 +242,35 @@ def niFake_EnumArrayOutputFunction( assert len(an_array_ref) >= len(test_value) for i in range(len(test_value)): an_array_ref[i] = test_value[i] - return self._defaults["EnumArrayOutputFunction"]["return"] + return self._defaults['EnumArrayOutputFunction']['return'] def niFake_EnumInputFunctionWithDefaults(self, vi, a_turtle): # noqa: N802 - if self._defaults["EnumInputFunctionWithDefaults"]["return"] != 0: - return self._defaults["EnumInputFunctionWithDefaults"]["return"] - return self._defaults["EnumInputFunctionWithDefaults"]["return"] - - def niFake_ExportAttributeConfigurationBuffer( - self, vi, size_in_bytes, configuration - ): # noqa: N802 - if self._defaults["ExportAttributeConfigurationBuffer"]["return"] != 0: - return self._defaults["ExportAttributeConfigurationBuffer"]["return"] - if ( - self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] - is None - ): - raise MockFunctionCallError( - "niFake_ExportAttributeConfigurationBuffer", param="configuration" - ) + if self._defaults['EnumInputFunctionWithDefaults']['return'] != 0: + return self._defaults['EnumInputFunctionWithDefaults']['return'] + return self._defaults['EnumInputFunctionWithDefaults']['return'] + + def niFake_ExportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 + if self._defaults['ExportAttributeConfigurationBuffer']['return'] != 0: + return self._defaults['ExportAttributeConfigurationBuffer']['return'] + if self._defaults['ExportAttributeConfigurationBuffer']['configuration'] is None: + raise MockFunctionCallError("niFake_ExportAttributeConfigurationBuffer", param='configuration') if size_in_bytes.value == 0: - return len( - self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] - ) + return len(self._defaults['ExportAttributeConfigurationBuffer']['configuration']) try: configuration_ref = configuration.contents except AttributeError: configuration_ref = configuration - for i in range( - len(self._defaults["ExportAttributeConfigurationBuffer"]["configuration"]) - ): - configuration_ref[i] = self._defaults["ExportAttributeConfigurationBuffer"][ - "configuration" - ][i] - return self._defaults["ExportAttributeConfigurationBuffer"]["return"] - - def niFake_FetchWaveform( - self, vi, number_of_samples, waveform_data, actual_number_of_samples - ): # noqa: N802 - if self._defaults["FetchWaveform"]["return"] != 0: - return self._defaults["FetchWaveform"]["return"] + for i in range(len(self._defaults['ExportAttributeConfigurationBuffer']['configuration'])): + configuration_ref[i] = self._defaults['ExportAttributeConfigurationBuffer']['configuration'][i] + return self._defaults['ExportAttributeConfigurationBuffer']['return'] + + def niFake_FetchWaveform(self, vi, number_of_samples, waveform_data, actual_number_of_samples): # noqa: N802 + if self._defaults['FetchWaveform']['return'] != 0: + return self._defaults['FetchWaveform']['return'] # waveform_data - if self._defaults["FetchWaveform"]["waveformData"] is None: - raise MockFunctionCallError("niFake_FetchWaveform", param="waveformData") - test_value = self._defaults["FetchWaveform"]["waveformData"] + if self._defaults['FetchWaveform']['waveformData'] is None: + raise MockFunctionCallError("niFake_FetchWaveform", param='waveformData') + test_value = self._defaults['FetchWaveform']['waveformData'] try: waveform_data_ref = waveform_data.contents except AttributeError: @@ -302,116 +279,92 @@ def niFake_FetchWaveform( for i in range(len(test_value)): waveform_data_ref[i] = test_value[i] # actual_number_of_samples - if self._defaults["FetchWaveform"]["actualNumberOfSamples"] is None: - raise MockFunctionCallError( - "niFake_FetchWaveform", param="actualNumberOfSamples" - ) + if self._defaults['FetchWaveform']['actualNumberOfSamples'] is None: + raise MockFunctionCallError("niFake_FetchWaveform", param='actualNumberOfSamples') if actual_number_of_samples is not None: - actual_number_of_samples.contents.value = self._defaults["FetchWaveform"][ - "actualNumberOfSamples" - ] - return self._defaults["FetchWaveform"]["return"] + actual_number_of_samples.contents.value = self._defaults['FetchWaveform']['actualNumberOfSamples'] + return self._defaults['FetchWaveform']['return'] def niFake_GetABoolean(self, vi, a_boolean): # noqa: N802 - if self._defaults["GetABoolean"]["return"] != 0: - return self._defaults["GetABoolean"]["return"] + if self._defaults['GetABoolean']['return'] != 0: + return self._defaults['GetABoolean']['return'] # a_boolean - if self._defaults["GetABoolean"]["aBoolean"] is None: - raise MockFunctionCallError("niFake_GetABoolean", param="aBoolean") + if self._defaults['GetABoolean']['aBoolean'] is None: + raise MockFunctionCallError("niFake_GetABoolean", param='aBoolean') if a_boolean is not None: - a_boolean.contents.value = self._defaults["GetABoolean"]["aBoolean"] - return self._defaults["GetABoolean"]["return"] + a_boolean.contents.value = self._defaults['GetABoolean']['aBoolean'] + return self._defaults['GetABoolean']['return'] def niFake_GetANumber(self, vi, a_number): # noqa: N802 - if self._defaults["GetANumber"]["return"] != 0: - return self._defaults["GetANumber"]["return"] + if self._defaults['GetANumber']['return'] != 0: + return self._defaults['GetANumber']['return'] # a_number - if self._defaults["GetANumber"]["aNumber"] is None: - raise MockFunctionCallError("niFake_GetANumber", param="aNumber") + if self._defaults['GetANumber']['aNumber'] is None: + raise MockFunctionCallError("niFake_GetANumber", param='aNumber') if a_number is not None: - a_number.contents.value = self._defaults["GetANumber"]["aNumber"] - return self._defaults["GetANumber"]["return"] + a_number.contents.value = self._defaults['GetANumber']['aNumber'] + return self._defaults['GetANumber']['return'] def niFake_GetAStringOfFixedMaximumSize(self, vi, a_string): # noqa: N802 - if self._defaults["GetAStringOfFixedMaximumSize"]["return"] != 0: - return self._defaults["GetAStringOfFixedMaximumSize"]["return"] + if self._defaults['GetAStringOfFixedMaximumSize']['return'] != 0: + return self._defaults['GetAStringOfFixedMaximumSize']['return'] # a_string - if self._defaults["GetAStringOfFixedMaximumSize"]["aString"] is None: - raise MockFunctionCallError( - "niFake_GetAStringOfFixedMaximumSize", param="aString" - ) - test_value = self._defaults["GetAStringOfFixedMaximumSize"]["aString"] + if self._defaults['GetAStringOfFixedMaximumSize']['aString'] is None: + raise MockFunctionCallError("niFake_GetAStringOfFixedMaximumSize", param='aString') + test_value = self._defaults['GetAStringOfFixedMaximumSize']['aString'] if type(test_value) is str: - test_value = test_value.encode("ascii") + test_value = test_value.encode('ascii') assert len(a_string) >= len(test_value) for i in range(len(test_value)): a_string[i] = test_value[i] - return self._defaults["GetAStringOfFixedMaximumSize"]["return"] + return self._defaults['GetAStringOfFixedMaximumSize']['return'] def niFake_GetAStringUsingPythonCode(self, vi, a_number, a_string): # noqa: N802 - if self._defaults["GetAStringUsingPythonCode"]["return"] != 0: - return self._defaults["GetAStringUsingPythonCode"]["return"] + if self._defaults['GetAStringUsingPythonCode']['return'] != 0: + return self._defaults['GetAStringUsingPythonCode']['return'] # a_string - if self._defaults["GetAStringUsingPythonCode"]["aString"] is None: - raise MockFunctionCallError( - "niFake_GetAStringUsingPythonCode", param="aString" - ) - test_value = self._defaults["GetAStringUsingPythonCode"]["aString"] + if self._defaults['GetAStringUsingPythonCode']['aString'] is None: + raise MockFunctionCallError("niFake_GetAStringUsingPythonCode", param='aString') + test_value = self._defaults['GetAStringUsingPythonCode']['aString'] if type(test_value) is str: - test_value = test_value.encode("ascii") + test_value = test_value.encode('ascii') assert len(a_string) >= len(test_value) for i in range(len(test_value)): a_string[i] = test_value[i] - return self._defaults["GetAStringUsingPythonCode"]["return"] + return self._defaults['GetAStringUsingPythonCode']['return'] def niFake_GetAnIviDanceString(self, vi, buffer_size, a_string): # noqa: N802 - if self._defaults["GetAnIviDanceString"]["return"] != 0: - return self._defaults["GetAnIviDanceString"]["return"] - if self._defaults["GetAnIviDanceString"]["aString"] is None: - raise MockFunctionCallError("niFake_GetAnIviDanceString", param="aString") + if self._defaults['GetAnIviDanceString']['return'] != 0: + return self._defaults['GetAnIviDanceString']['return'] + if self._defaults['GetAnIviDanceString']['aString'] is None: + raise MockFunctionCallError("niFake_GetAnIviDanceString", param='aString') if buffer_size.value == 0: - return len(self._defaults["GetAnIviDanceString"]["aString"]) - a_string.value = self._defaults["GetAnIviDanceString"]["aString"].encode( - "ascii" - ) - return self._defaults["GetAnIviDanceString"]["return"] - - def niFake_GetAnIviDanceWithATwistString( - self, vi, buffer_size, a_string, actual_size - ): # noqa: N802 - if self._defaults["GetAnIviDanceWithATwistString"]["return"] != 0: - return self._defaults["GetAnIviDanceWithATwistString"]["return"] + return len(self._defaults['GetAnIviDanceString']['aString']) + a_string.value = self._defaults['GetAnIviDanceString']['aString'].encode('ascii') + return self._defaults['GetAnIviDanceString']['return'] + + def niFake_GetAnIviDanceWithATwistString(self, vi, buffer_size, a_string, actual_size): # noqa: N802 + if self._defaults['GetAnIviDanceWithATwistString']['return'] != 0: + return self._defaults['GetAnIviDanceWithATwistString']['return'] # actual_size - if self._defaults["GetAnIviDanceWithATwistString"]["actualSize"] is None: - raise MockFunctionCallError( - "niFake_GetAnIviDanceWithATwistString", param="actualSize" - ) + if self._defaults['GetAnIviDanceWithATwistString']['actualSize'] is None: + raise MockFunctionCallError("niFake_GetAnIviDanceWithATwistString", param='actualSize') if actual_size is not None: - actual_size.contents.value = self._defaults[ - "GetAnIviDanceWithATwistString" - ]["actualSize"] - if self._defaults["GetAnIviDanceWithATwistString"]["aString"] is None: - raise MockFunctionCallError( - "niFake_GetAnIviDanceWithATwistString", param="aString" - ) + actual_size.contents.value = self._defaults['GetAnIviDanceWithATwistString']['actualSize'] + if self._defaults['GetAnIviDanceWithATwistString']['aString'] is None: + raise MockFunctionCallError("niFake_GetAnIviDanceWithATwistString", param='aString') if buffer_size.value == 0: - return len(self._defaults["GetAnIviDanceWithATwistString"]["aString"]) - a_string.value = self._defaults["GetAnIviDanceWithATwistString"][ - "aString" - ].encode("ascii") - return self._defaults["GetAnIviDanceWithATwistString"]["return"] - - def niFake_GetArrayForPythonCodeCustomType( - self, vi, number_of_elements, array_out - ): # noqa: N802 - if self._defaults["GetArrayForPythonCodeCustomType"]["return"] != 0: - return self._defaults["GetArrayForPythonCodeCustomType"]["return"] + return len(self._defaults['GetAnIviDanceWithATwistString']['aString']) + a_string.value = self._defaults['GetAnIviDanceWithATwistString']['aString'].encode('ascii') + return self._defaults['GetAnIviDanceWithATwistString']['return'] + + def niFake_GetArrayForPythonCodeCustomType(self, vi, number_of_elements, array_out): # noqa: N802 + if self._defaults['GetArrayForPythonCodeCustomType']['return'] != 0: + return self._defaults['GetArrayForPythonCodeCustomType']['return'] # array_out - if self._defaults["GetArrayForPythonCodeCustomType"]["arrayOut"] is None: - raise MockFunctionCallError( - "niFake_GetArrayForPythonCodeCustomType", param="arrayOut" - ) - test_value = self._defaults["GetArrayForPythonCodeCustomType"]["arrayOut"] + if self._defaults['GetArrayForPythonCodeCustomType']['arrayOut'] is None: + raise MockFunctionCallError("niFake_GetArrayForPythonCodeCustomType", param='arrayOut') + test_value = self._defaults['GetArrayForPythonCodeCustomType']['arrayOut'] try: array_out_ref = array_out.contents except AttributeError: @@ -419,19 +372,15 @@ def niFake_GetArrayForPythonCodeCustomType( assert len(array_out_ref) >= len(test_value) for i in range(len(test_value)): array_out_ref[i] = test_value[i] - return self._defaults["GetArrayForPythonCodeCustomType"]["return"] + return self._defaults['GetArrayForPythonCodeCustomType']['return'] - def niFake_GetArrayForPythonCodeDouble( - self, vi, number_of_elements, array_out - ): # noqa: N802 - if self._defaults["GetArrayForPythonCodeDouble"]["return"] != 0: - return self._defaults["GetArrayForPythonCodeDouble"]["return"] + def niFake_GetArrayForPythonCodeDouble(self, vi, number_of_elements, array_out): # noqa: N802 + if self._defaults['GetArrayForPythonCodeDouble']['return'] != 0: + return self._defaults['GetArrayForPythonCodeDouble']['return'] # array_out - if self._defaults["GetArrayForPythonCodeDouble"]["arrayOut"] is None: - raise MockFunctionCallError( - "niFake_GetArrayForPythonCodeDouble", param="arrayOut" - ) - test_value = self._defaults["GetArrayForPythonCodeDouble"]["arrayOut"] + if self._defaults['GetArrayForPythonCodeDouble']['arrayOut'] is None: + raise MockFunctionCallError("niFake_GetArrayForPythonCodeDouble", param='arrayOut') + test_value = self._defaults['GetArrayForPythonCodeDouble']['arrayOut'] try: array_out_ref = array_out.contents except AttributeError: @@ -439,183 +388,141 @@ def niFake_GetArrayForPythonCodeDouble( assert len(array_out_ref) >= len(test_value) for i in range(len(test_value)): array_out_ref[i] = test_value[i] - return self._defaults["GetArrayForPythonCodeDouble"]["return"] + return self._defaults['GetArrayForPythonCodeDouble']['return'] def niFake_GetArraySizeForPythonCode(self, vi, size_out): # noqa: N802 - if self._defaults["GetArraySizeForPythonCode"]["return"] != 0: - return self._defaults["GetArraySizeForPythonCode"]["return"] + if self._defaults['GetArraySizeForPythonCode']['return'] != 0: + return self._defaults['GetArraySizeForPythonCode']['return'] # size_out - if self._defaults["GetArraySizeForPythonCode"]["sizeOut"] is None: - raise MockFunctionCallError( - "niFake_GetArraySizeForPythonCode", param="sizeOut" - ) + if self._defaults['GetArraySizeForPythonCode']['sizeOut'] is None: + raise MockFunctionCallError("niFake_GetArraySizeForPythonCode", param='sizeOut') if size_out is not None: - size_out.contents.value = self._defaults["GetArraySizeForPythonCode"][ - "sizeOut" - ] - return self._defaults["GetArraySizeForPythonCode"]["return"] + size_out.contents.value = self._defaults['GetArraySizeForPythonCode']['sizeOut'] + return self._defaults['GetArraySizeForPythonCode']['return'] def niFake_GetArrayUsingIviDance(self, vi, array_size, array_out): # noqa: N802 - if self._defaults["GetArrayUsingIviDance"]["return"] != 0: - return self._defaults["GetArrayUsingIviDance"]["return"] - if self._defaults["GetArrayUsingIviDance"]["arrayOut"] is None: - raise MockFunctionCallError( - "niFake_GetArrayUsingIviDance", param="arrayOut" - ) + if self._defaults['GetArrayUsingIviDance']['return'] != 0: + return self._defaults['GetArrayUsingIviDance']['return'] + if self._defaults['GetArrayUsingIviDance']['arrayOut'] is None: + raise MockFunctionCallError("niFake_GetArrayUsingIviDance", param='arrayOut') if array_size.value == 0: - return len(self._defaults["GetArrayUsingIviDance"]["arrayOut"]) + return len(self._defaults['GetArrayUsingIviDance']['arrayOut']) try: array_out_ref = array_out.contents except AttributeError: array_out_ref = array_out - for i in range(len(self._defaults["GetArrayUsingIviDance"]["arrayOut"])): - array_out_ref[i] = self._defaults["GetArrayUsingIviDance"]["arrayOut"][i] - return self._defaults["GetArrayUsingIviDance"]["return"] - - def niFake_GetAttributeViBoolean( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["GetAttributeViBoolean"]["return"] != 0: - return self._defaults["GetAttributeViBoolean"]["return"] + for i in range(len(self._defaults['GetArrayUsingIviDance']['arrayOut'])): + array_out_ref[i] = self._defaults['GetArrayUsingIviDance']['arrayOut'][i] + return self._defaults['GetArrayUsingIviDance']['return'] + + def niFake_GetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['GetAttributeViBoolean']['return'] != 0: + return self._defaults['GetAttributeViBoolean']['return'] # attribute_value - if self._defaults["GetAttributeViBoolean"]["attributeValue"] is None: - raise MockFunctionCallError( - "niFake_GetAttributeViBoolean", param="attributeValue" - ) + if self._defaults['GetAttributeViBoolean']['attributeValue'] is None: + raise MockFunctionCallError("niFake_GetAttributeViBoolean", param='attributeValue') if attribute_value is not None: - attribute_value.contents.value = self._defaults["GetAttributeViBoolean"][ - "attributeValue" - ] - return self._defaults["GetAttributeViBoolean"]["return"] - - def niFake_GetAttributeViInt32( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["GetAttributeViInt32"]["return"] != 0: - return self._defaults["GetAttributeViInt32"]["return"] + attribute_value.contents.value = self._defaults['GetAttributeViBoolean']['attributeValue'] + return self._defaults['GetAttributeViBoolean']['return'] + + def niFake_GetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['GetAttributeViInt32']['return'] != 0: + return self._defaults['GetAttributeViInt32']['return'] # attribute_value - if self._defaults["GetAttributeViInt32"]["attributeValue"] is None: - raise MockFunctionCallError( - "niFake_GetAttributeViInt32", param="attributeValue" - ) + if self._defaults['GetAttributeViInt32']['attributeValue'] is None: + raise MockFunctionCallError("niFake_GetAttributeViInt32", param='attributeValue') if attribute_value is not None: - attribute_value.contents.value = self._defaults["GetAttributeViInt32"][ - "attributeValue" - ] - return self._defaults["GetAttributeViInt32"]["return"] - - def niFake_GetAttributeViInt64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["GetAttributeViInt64"]["return"] != 0: - return self._defaults["GetAttributeViInt64"]["return"] + attribute_value.contents.value = self._defaults['GetAttributeViInt32']['attributeValue'] + return self._defaults['GetAttributeViInt32']['return'] + + def niFake_GetAttributeViInt64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['GetAttributeViInt64']['return'] != 0: + return self._defaults['GetAttributeViInt64']['return'] # attribute_value - if self._defaults["GetAttributeViInt64"]["attributeValue"] is None: - raise MockFunctionCallError( - "niFake_GetAttributeViInt64", param="attributeValue" - ) + if self._defaults['GetAttributeViInt64']['attributeValue'] is None: + raise MockFunctionCallError("niFake_GetAttributeViInt64", param='attributeValue') if attribute_value is not None: - attribute_value.contents.value = self._defaults["GetAttributeViInt64"][ - "attributeValue" - ] - return self._defaults["GetAttributeViInt64"]["return"] - - def niFake_GetAttributeViReal64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["GetAttributeViReal64"]["return"] != 0: - return self._defaults["GetAttributeViReal64"]["return"] + attribute_value.contents.value = self._defaults['GetAttributeViInt64']['attributeValue'] + return self._defaults['GetAttributeViInt64']['return'] + + def niFake_GetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['GetAttributeViReal64']['return'] != 0: + return self._defaults['GetAttributeViReal64']['return'] # attribute_value - if self._defaults["GetAttributeViReal64"]["attributeValue"] is None: - raise MockFunctionCallError( - "niFake_GetAttributeViReal64", param="attributeValue" - ) + if self._defaults['GetAttributeViReal64']['attributeValue'] is None: + raise MockFunctionCallError("niFake_GetAttributeViReal64", param='attributeValue') if attribute_value is not None: - attribute_value.contents.value = self._defaults["GetAttributeViReal64"][ - "attributeValue" - ] - return self._defaults["GetAttributeViReal64"]["return"] - - def niFake_GetAttributeViString( - self, vi, channel_name, attribute_id, buffer_size, attribute_value - ): # noqa: N802 - if self._defaults["GetAttributeViString"]["return"] != 0: - return self._defaults["GetAttributeViString"]["return"] - if self._defaults["GetAttributeViString"]["attributeValue"] is None: - raise MockFunctionCallError( - "niFake_GetAttributeViString", param="attributeValue" - ) + attribute_value.contents.value = self._defaults['GetAttributeViReal64']['attributeValue'] + return self._defaults['GetAttributeViReal64']['return'] + + def niFake_GetAttributeViString(self, vi, channel_name, attribute_id, buffer_size, attribute_value): # noqa: N802 + if self._defaults['GetAttributeViString']['return'] != 0: + return self._defaults['GetAttributeViString']['return'] + if self._defaults['GetAttributeViString']['attributeValue'] is None: + raise MockFunctionCallError("niFake_GetAttributeViString", param='attributeValue') if buffer_size.value == 0: - return len(self._defaults["GetAttributeViString"]["attributeValue"]) - attribute_value.value = self._defaults["GetAttributeViString"][ - "attributeValue" - ].encode("ascii") - return self._defaults["GetAttributeViString"]["return"] - - def niFake_GetCalDateAndTime( - self, vi, cal_type, month, day, year, hour, minute - ): # noqa: N802 - if self._defaults["GetCalDateAndTime"]["return"] != 0: - return self._defaults["GetCalDateAndTime"]["return"] + return len(self._defaults['GetAttributeViString']['attributeValue']) + attribute_value.value = self._defaults['GetAttributeViString']['attributeValue'].encode('ascii') + return self._defaults['GetAttributeViString']['return'] + + def niFake_GetCalDateAndTime(self, vi, cal_type, month, day, year, hour, minute): # noqa: N802 + if self._defaults['GetCalDateAndTime']['return'] != 0: + return self._defaults['GetCalDateAndTime']['return'] # month - if self._defaults["GetCalDateAndTime"]["month"] is None: - raise MockFunctionCallError("niFake_GetCalDateAndTime", param="month") + if self._defaults['GetCalDateAndTime']['month'] is None: + raise MockFunctionCallError("niFake_GetCalDateAndTime", param='month') if month is not None: - month.contents.value = self._defaults["GetCalDateAndTime"]["month"] + month.contents.value = self._defaults['GetCalDateAndTime']['month'] # day - if self._defaults["GetCalDateAndTime"]["day"] is None: - raise MockFunctionCallError("niFake_GetCalDateAndTime", param="day") + if self._defaults['GetCalDateAndTime']['day'] is None: + raise MockFunctionCallError("niFake_GetCalDateAndTime", param='day') if day is not None: - day.contents.value = self._defaults["GetCalDateAndTime"]["day"] + day.contents.value = self._defaults['GetCalDateAndTime']['day'] # year - if self._defaults["GetCalDateAndTime"]["year"] is None: - raise MockFunctionCallError("niFake_GetCalDateAndTime", param="year") + if self._defaults['GetCalDateAndTime']['year'] is None: + raise MockFunctionCallError("niFake_GetCalDateAndTime", param='year') if year is not None: - year.contents.value = self._defaults["GetCalDateAndTime"]["year"] + year.contents.value = self._defaults['GetCalDateAndTime']['year'] # hour - if self._defaults["GetCalDateAndTime"]["hour"] is None: - raise MockFunctionCallError("niFake_GetCalDateAndTime", param="hour") + if self._defaults['GetCalDateAndTime']['hour'] is None: + raise MockFunctionCallError("niFake_GetCalDateAndTime", param='hour') if hour is not None: - hour.contents.value = self._defaults["GetCalDateAndTime"]["hour"] + hour.contents.value = self._defaults['GetCalDateAndTime']['hour'] # minute - if self._defaults["GetCalDateAndTime"]["minute"] is None: - raise MockFunctionCallError("niFake_GetCalDateAndTime", param="minute") + if self._defaults['GetCalDateAndTime']['minute'] is None: + raise MockFunctionCallError("niFake_GetCalDateAndTime", param='minute') if minute is not None: - minute.contents.value = self._defaults["GetCalDateAndTime"]["minute"] - return self._defaults["GetCalDateAndTime"]["return"] + minute.contents.value = self._defaults['GetCalDateAndTime']['minute'] + return self._defaults['GetCalDateAndTime']['return'] def niFake_GetCalInterval(self, vi, months): # noqa: N802 - if self._defaults["GetCalInterval"]["return"] != 0: - return self._defaults["GetCalInterval"]["return"] + if self._defaults['GetCalInterval']['return'] != 0: + return self._defaults['GetCalInterval']['return'] # months - if self._defaults["GetCalInterval"]["months"] is None: - raise MockFunctionCallError("niFake_GetCalInterval", param="months") + if self._defaults['GetCalInterval']['months'] is None: + raise MockFunctionCallError("niFake_GetCalInterval", param='months') if months is not None: - months.contents.value = self._defaults["GetCalInterval"]["months"] - return self._defaults["GetCalInterval"]["return"] + months.contents.value = self._defaults['GetCalInterval']['months'] + return self._defaults['GetCalInterval']['return'] def niFake_GetCustomType(self, vi, cs): # noqa: N802 - if self._defaults["GetCustomType"]["return"] != 0: - return self._defaults["GetCustomType"]["return"] + if self._defaults['GetCustomType']['return'] != 0: + return self._defaults['GetCustomType']['return'] # cs - if self._defaults["GetCustomType"]["cs"] is None: - raise MockFunctionCallError("niFake_GetCustomType", param="cs") - for field in self._defaults["GetCustomType"]["cs"]._fields_: + if self._defaults['GetCustomType']['cs'] is None: + raise MockFunctionCallError("niFake_GetCustomType", param='cs') + for field in self._defaults['GetCustomType']['cs']._fields_: field_name = field[0] - setattr( - cs.contents, - field_name, - getattr(self._defaults["GetCustomType"]["cs"], field_name), - ) - return self._defaults["GetCustomType"]["return"] + setattr(cs.contents, field_name, getattr(self._defaults['GetCustomType']['cs'], field_name)) + return self._defaults['GetCustomType']['return'] def niFake_GetCustomTypeArray(self, vi, number_of_elements, cs): # noqa: N802 - if self._defaults["GetCustomTypeArray"]["return"] != 0: - return self._defaults["GetCustomTypeArray"]["return"] + if self._defaults['GetCustomTypeArray']['return'] != 0: + return self._defaults['GetCustomTypeArray']['return'] # cs - if self._defaults["GetCustomTypeArray"]["cs"] is None: - raise MockFunctionCallError("niFake_GetCustomTypeArray", param="cs") - test_value = self._defaults["GetCustomTypeArray"]["cs"] + if self._defaults['GetCustomTypeArray']['cs'] is None: + raise MockFunctionCallError("niFake_GetCustomTypeArray", param='cs') + test_value = self._defaults['GetCustomTypeArray']['cs'] try: cs_ref = cs.contents except AttributeError: @@ -623,92 +530,75 @@ def niFake_GetCustomTypeArray(self, vi, number_of_elements, cs): # noqa: N802 assert len(cs_ref) >= len(test_value) for i in range(len(test_value)): cs_ref[i] = test_value[i] - return self._defaults["GetCustomTypeArray"]["return"] + return self._defaults['GetCustomTypeArray']['return'] def niFake_GetEnumValue(self, vi, a_quantity, a_turtle): # noqa: N802 - if self._defaults["GetEnumValue"]["return"] != 0: - return self._defaults["GetEnumValue"]["return"] + if self._defaults['GetEnumValue']['return'] != 0: + return self._defaults['GetEnumValue']['return'] # a_quantity - if self._defaults["GetEnumValue"]["aQuantity"] is None: - raise MockFunctionCallError("niFake_GetEnumValue", param="aQuantity") + if self._defaults['GetEnumValue']['aQuantity'] is None: + raise MockFunctionCallError("niFake_GetEnumValue", param='aQuantity') if a_quantity is not None: - a_quantity.contents.value = self._defaults["GetEnumValue"]["aQuantity"] + a_quantity.contents.value = self._defaults['GetEnumValue']['aQuantity'] # a_turtle - if self._defaults["GetEnumValue"]["aTurtle"] is None: - raise MockFunctionCallError("niFake_GetEnumValue", param="aTurtle") + if self._defaults['GetEnumValue']['aTurtle'] is None: + raise MockFunctionCallError("niFake_GetEnumValue", param='aTurtle') if a_turtle is not None: - a_turtle.contents.value = self._defaults["GetEnumValue"]["aTurtle"] - return self._defaults["GetEnumValue"]["return"] + a_turtle.contents.value = self._defaults['GetEnumValue']['aTurtle'] + return self._defaults['GetEnumValue']['return'] def niFake_GetError(self, vi, error_code, buffer_size, description): # noqa: N802 - if self._defaults["GetError"]["return"] != 0: - return self._defaults["GetError"]["return"] + if self._defaults['GetError']['return'] != 0: + return self._defaults['GetError']['return'] # error_code - if self._defaults["GetError"]["errorCode"] is None: - raise MockFunctionCallError("niFake_GetError", param="errorCode") + if self._defaults['GetError']['errorCode'] is None: + raise MockFunctionCallError("niFake_GetError", param='errorCode') if error_code is not None: - error_code.contents.value = self._defaults["GetError"]["errorCode"] - if self._defaults["GetError"]["description"] is None: - raise MockFunctionCallError("niFake_GetError", param="description") + error_code.contents.value = self._defaults['GetError']['errorCode'] + if self._defaults['GetError']['description'] is None: + raise MockFunctionCallError("niFake_GetError", param='description') if buffer_size.value == 0: - return len(self._defaults["GetError"]["description"]) - description.value = self._defaults["GetError"]["description"].encode("ascii") - return self._defaults["GetError"]["return"] - - def niFake_ImportAttributeConfigurationBuffer( - self, vi, size_in_bytes, configuration - ): # noqa: N802 - if self._defaults["ImportAttributeConfigurationBuffer"]["return"] != 0: - return self._defaults["ImportAttributeConfigurationBuffer"]["return"] - return self._defaults["ImportAttributeConfigurationBuffer"]["return"] - - def niFake_InitWithOptions( - self, resource_name, id_query, reset_device, option_string, vi - ): # noqa: N802 - if self._defaults["InitWithOptions"]["return"] != 0: - return self._defaults["InitWithOptions"]["return"] + return len(self._defaults['GetError']['description']) + description.value = self._defaults['GetError']['description'].encode('ascii') + return self._defaults['GetError']['return'] + + def niFake_ImportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 + if self._defaults['ImportAttributeConfigurationBuffer']['return'] != 0: + return self._defaults['ImportAttributeConfigurationBuffer']['return'] + return self._defaults['ImportAttributeConfigurationBuffer']['return'] + + def niFake_InitWithOptions(self, resource_name, id_query, reset_device, option_string, vi): # noqa: N802 + if self._defaults['InitWithOptions']['return'] != 0: + return self._defaults['InitWithOptions']['return'] # vi - if self._defaults["InitWithOptions"]["vi"] is None: - raise MockFunctionCallError("niFake_InitWithOptions", param="vi") + if self._defaults['InitWithOptions']['vi'] is None: + raise MockFunctionCallError("niFake_InitWithOptions", param='vi') if vi is not None: - vi.contents.value = self._defaults["InitWithOptions"]["vi"] - return self._defaults["InitWithOptions"]["return"] + vi.contents.value = self._defaults['InitWithOptions']['vi'] + return self._defaults['InitWithOptions']['return'] def niFake_Initiate(self, vi): # noqa: N802 - if self._defaults["Initiate"]["return"] != 0: - return self._defaults["Initiate"]["return"] - return self._defaults["Initiate"]["return"] + if self._defaults['Initiate']['return'] != 0: + return self._defaults['Initiate']['return'] + return self._defaults['Initiate']['return'] def niFake_LockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults["LockSession"]["return"] != 0: - return self._defaults["LockSession"]["return"] + if self._defaults['LockSession']['return'] != 0: + return self._defaults['LockSession']['return'] # caller_has_lock - if self._defaults["LockSession"]["callerHasLock"] is None: - raise MockFunctionCallError("niFake_LockSession", param="callerHasLock") + if self._defaults['LockSession']['callerHasLock'] is None: + raise MockFunctionCallError("niFake_LockSession", param='callerHasLock') if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults["LockSession"][ - "callerHasLock" - ] - return self._defaults["LockSession"]["return"] - - def niFake_MultipleArrayTypes( - self, - vi, - output_array_size, - output_array, - output_array_of_fixed_length, - input_array_sizes, - input_array_of_floats, - input_array_of_integers, - ): # noqa: N802 - if self._defaults["MultipleArrayTypes"]["return"] != 0: - return self._defaults["MultipleArrayTypes"]["return"] + caller_has_lock.contents.value = self._defaults['LockSession']['callerHasLock'] + return self._defaults['LockSession']['return'] + + def niFake_MultipleArrayTypes(self, vi, output_array_size, output_array, output_array_of_fixed_length, input_array_sizes, input_array_of_floats, input_array_of_integers): # noqa: N802 + if self._defaults['MultipleArrayTypes']['return'] != 0: + return self._defaults['MultipleArrayTypes']['return'] # output_array - if self._defaults["MultipleArrayTypes"]["outputArray"] is None: - raise MockFunctionCallError( - "niFake_MultipleArrayTypes", param="outputArray" - ) - test_value = self._defaults["MultipleArrayTypes"]["outputArray"] + if self._defaults['MultipleArrayTypes']['outputArray'] is None: + raise MockFunctionCallError("niFake_MultipleArrayTypes", param='outputArray') + test_value = self._defaults['MultipleArrayTypes']['outputArray'] try: output_array_ref = output_array.contents except AttributeError: @@ -717,11 +607,9 @@ def niFake_MultipleArrayTypes( for i in range(len(test_value)): output_array_ref[i] = test_value[i] # output_array_of_fixed_length - if self._defaults["MultipleArrayTypes"]["outputArrayOfFixedLength"] is None: - raise MockFunctionCallError( - "niFake_MultipleArrayTypes", param="outputArrayOfFixedLength" - ) - test_value = self._defaults["MultipleArrayTypes"]["outputArrayOfFixedLength"] + if self._defaults['MultipleArrayTypes']['outputArrayOfFixedLength'] is None: + raise MockFunctionCallError("niFake_MultipleArrayTypes", param='outputArrayOfFixedLength') + test_value = self._defaults['MultipleArrayTypes']['outputArrayOfFixedLength'] try: output_array_of_fixed_length_ref = output_array_of_fixed_length.contents except AttributeError: @@ -729,113 +617,84 @@ def niFake_MultipleArrayTypes( assert len(output_array_of_fixed_length_ref) >= len(test_value) for i in range(len(test_value)): output_array_of_fixed_length_ref[i] = test_value[i] - return self._defaults["MultipleArrayTypes"]["return"] + return self._defaults['MultipleArrayTypes']['return'] - def niFake_MultipleArraysSameSize( - self, vi, values1, values2, values3, values4, size - ): # noqa: N802 - if self._defaults["MultipleArraysSameSize"]["return"] != 0: - return self._defaults["MultipleArraysSameSize"]["return"] - return self._defaults["MultipleArraysSameSize"]["return"] + def niFake_MultipleArraysSameSize(self, vi, values1, values2, values3, values4, size): # noqa: N802 + if self._defaults['MultipleArraysSameSize']['return'] != 0: + return self._defaults['MultipleArraysSameSize']['return'] + return self._defaults['MultipleArraysSameSize']['return'] def niFake_OneInputFunction(self, vi, a_number): # noqa: N802 - if self._defaults["OneInputFunction"]["return"] != 0: - return self._defaults["OneInputFunction"]["return"] - return self._defaults["OneInputFunction"]["return"] - - def niFake_ParametersAreMultipleTypes( - self, - vi, - a_boolean, - an_int32, - an_int64, - an_int_enum, - a_float, - a_float_enum, - string_size, - a_string, - ): # noqa: N802 - if self._defaults["ParametersAreMultipleTypes"]["return"] != 0: - return self._defaults["ParametersAreMultipleTypes"]["return"] - return self._defaults["ParametersAreMultipleTypes"]["return"] + if self._defaults['OneInputFunction']['return'] != 0: + return self._defaults['OneInputFunction']['return'] + return self._defaults['OneInputFunction']['return'] + + def niFake_ParametersAreMultipleTypes(self, vi, a_boolean, an_int32, an_int64, an_int_enum, a_float, a_float_enum, string_size, a_string): # noqa: N802 + if self._defaults['ParametersAreMultipleTypes']['return'] != 0: + return self._defaults['ParametersAreMultipleTypes']['return'] + return self._defaults['ParametersAreMultipleTypes']['return'] def niFake_PoorlyNamedSimpleFunction(self, vi): # noqa: N802 - if self._defaults["PoorlyNamedSimpleFunction"]["return"] != 0: - return self._defaults["PoorlyNamedSimpleFunction"]["return"] - return self._defaults["PoorlyNamedSimpleFunction"]["return"] + if self._defaults['PoorlyNamedSimpleFunction']['return'] != 0: + return self._defaults['PoorlyNamedSimpleFunction']['return'] + return self._defaults['PoorlyNamedSimpleFunction']['return'] def niFake_Read(self, vi, maximum_time, reading): # noqa: N802 - if self._defaults["Read"]["return"] != 0: - return self._defaults["Read"]["return"] + if self._defaults['Read']['return'] != 0: + return self._defaults['Read']['return'] # reading - if self._defaults["Read"]["reading"] is None: - raise MockFunctionCallError("niFake_Read", param="reading") + if self._defaults['Read']['reading'] is None: + raise MockFunctionCallError("niFake_Read", param='reading') if reading is not None: - reading.contents.value = self._defaults["Read"]["reading"] - return self._defaults["Read"]["return"] - - def niFake_ReadFromChannel( - self, vi, channel_name, maximum_time, reading - ): # noqa: N802 - if self._defaults["ReadFromChannel"]["return"] != 0: - return self._defaults["ReadFromChannel"]["return"] + reading.contents.value = self._defaults['Read']['reading'] + return self._defaults['Read']['return'] + + def niFake_ReadFromChannel(self, vi, channel_name, maximum_time, reading): # noqa: N802 + if self._defaults['ReadFromChannel']['return'] != 0: + return self._defaults['ReadFromChannel']['return'] # reading - if self._defaults["ReadFromChannel"]["reading"] is None: - raise MockFunctionCallError("niFake_ReadFromChannel", param="reading") + if self._defaults['ReadFromChannel']['reading'] is None: + raise MockFunctionCallError("niFake_ReadFromChannel", param='reading') if reading is not None: - reading.contents.value = self._defaults["ReadFromChannel"]["reading"] - return self._defaults["ReadFromChannel"]["return"] + reading.contents.value = self._defaults['ReadFromChannel']['reading'] + return self._defaults['ReadFromChannel']['return'] def niFake_ReturnANumberAndAString(self, vi, a_number, a_string): # noqa: N802 - if self._defaults["ReturnANumberAndAString"]["return"] != 0: - return self._defaults["ReturnANumberAndAString"]["return"] + if self._defaults['ReturnANumberAndAString']['return'] != 0: + return self._defaults['ReturnANumberAndAString']['return'] # a_number - if self._defaults["ReturnANumberAndAString"]["aNumber"] is None: - raise MockFunctionCallError( - "niFake_ReturnANumberAndAString", param="aNumber" - ) + if self._defaults['ReturnANumberAndAString']['aNumber'] is None: + raise MockFunctionCallError("niFake_ReturnANumberAndAString", param='aNumber') if a_number is not None: - a_number.contents.value = self._defaults["ReturnANumberAndAString"][ - "aNumber" - ] + a_number.contents.value = self._defaults['ReturnANumberAndAString']['aNumber'] # a_string - if self._defaults["ReturnANumberAndAString"]["aString"] is None: - raise MockFunctionCallError( - "niFake_ReturnANumberAndAString", param="aString" - ) - test_value = self._defaults["ReturnANumberAndAString"]["aString"] + if self._defaults['ReturnANumberAndAString']['aString'] is None: + raise MockFunctionCallError("niFake_ReturnANumberAndAString", param='aString') + test_value = self._defaults['ReturnANumberAndAString']['aString'] if type(test_value) is str: - test_value = test_value.encode("ascii") + test_value = test_value.encode('ascii') assert len(a_string) >= len(test_value) for i in range(len(test_value)): a_string[i] = test_value[i] - return self._defaults["ReturnANumberAndAString"]["return"] + return self._defaults['ReturnANumberAndAString']['return'] def niFake_ReturnDurationInSeconds(self, vi, timedelta): # noqa: N802 - if self._defaults["ReturnDurationInSeconds"]["return"] != 0: - return self._defaults["ReturnDurationInSeconds"]["return"] + if self._defaults['ReturnDurationInSeconds']['return'] != 0: + return self._defaults['ReturnDurationInSeconds']['return'] # timedelta - if self._defaults["ReturnDurationInSeconds"]["timedelta"] is None: - raise MockFunctionCallError( - "niFake_ReturnDurationInSeconds", param="timedelta" - ) + if self._defaults['ReturnDurationInSeconds']['timedelta'] is None: + raise MockFunctionCallError("niFake_ReturnDurationInSeconds", param='timedelta') if timedelta is not None: - timedelta.contents.value = self._defaults["ReturnDurationInSeconds"][ - "timedelta" - ] - return self._defaults["ReturnDurationInSeconds"]["return"] - - def niFake_ReturnListOfDurationsInSeconds( - self, vi, number_of_elements, timedeltas - ): # noqa: N802 - if self._defaults["ReturnListOfDurationsInSeconds"]["return"] != 0: - return self._defaults["ReturnListOfDurationsInSeconds"]["return"] + timedelta.contents.value = self._defaults['ReturnDurationInSeconds']['timedelta'] + return self._defaults['ReturnDurationInSeconds']['return'] + + def niFake_ReturnListOfDurationsInSeconds(self, vi, number_of_elements, timedeltas): # noqa: N802 + if self._defaults['ReturnListOfDurationsInSeconds']['return'] != 0: + return self._defaults['ReturnListOfDurationsInSeconds']['return'] # timedeltas - if self._defaults["ReturnListOfDurationsInSeconds"]["timedeltas"] is None: - raise MockFunctionCallError( - "niFake_ReturnListOfDurationsInSeconds", param="timedeltas" - ) - test_value = self._defaults["ReturnListOfDurationsInSeconds"]["timedeltas"] + if self._defaults['ReturnListOfDurationsInSeconds']['timedeltas'] is None: + raise MockFunctionCallError("niFake_ReturnListOfDurationsInSeconds", param='timedeltas') + test_value = self._defaults['ReturnListOfDurationsInSeconds']['timedeltas'] try: timedeltas_ref = timedeltas.contents except AttributeError: @@ -843,64 +702,45 @@ def niFake_ReturnListOfDurationsInSeconds( assert len(timedeltas_ref) >= len(test_value) for i in range(len(test_value)): timedeltas_ref[i] = test_value[i] - return self._defaults["ReturnListOfDurationsInSeconds"]["return"] - - def niFake_ReturnMultipleTypes( - self, - vi, - a_boolean, - an_int32, - an_int64, - an_int_enum, - a_float, - a_float_enum, - array_size, - an_array, - string_size, - a_string, - ): # noqa: N802 - if self._defaults["ReturnMultipleTypes"]["return"] != 0: - return self._defaults["ReturnMultipleTypes"]["return"] + return self._defaults['ReturnListOfDurationsInSeconds']['return'] + + def niFake_ReturnMultipleTypes(self, vi, a_boolean, an_int32, an_int64, an_int_enum, a_float, a_float_enum, array_size, an_array, string_size, a_string): # noqa: N802 + if self._defaults['ReturnMultipleTypes']['return'] != 0: + return self._defaults['ReturnMultipleTypes']['return'] # a_boolean - if self._defaults["ReturnMultipleTypes"]["aBoolean"] is None: - raise MockFunctionCallError("niFake_ReturnMultipleTypes", param="aBoolean") + if self._defaults['ReturnMultipleTypes']['aBoolean'] is None: + raise MockFunctionCallError("niFake_ReturnMultipleTypes", param='aBoolean') if a_boolean is not None: - a_boolean.contents.value = self._defaults["ReturnMultipleTypes"]["aBoolean"] + a_boolean.contents.value = self._defaults['ReturnMultipleTypes']['aBoolean'] # an_int32 - if self._defaults["ReturnMultipleTypes"]["anInt32"] is None: - raise MockFunctionCallError("niFake_ReturnMultipleTypes", param="anInt32") + if self._defaults['ReturnMultipleTypes']['anInt32'] is None: + raise MockFunctionCallError("niFake_ReturnMultipleTypes", param='anInt32') if an_int32 is not None: - an_int32.contents.value = self._defaults["ReturnMultipleTypes"]["anInt32"] + an_int32.contents.value = self._defaults['ReturnMultipleTypes']['anInt32'] # an_int64 - if self._defaults["ReturnMultipleTypes"]["anInt64"] is None: - raise MockFunctionCallError("niFake_ReturnMultipleTypes", param="anInt64") + if self._defaults['ReturnMultipleTypes']['anInt64'] is None: + raise MockFunctionCallError("niFake_ReturnMultipleTypes", param='anInt64') if an_int64 is not None: - an_int64.contents.value = self._defaults["ReturnMultipleTypes"]["anInt64"] + an_int64.contents.value = self._defaults['ReturnMultipleTypes']['anInt64'] # an_int_enum - if self._defaults["ReturnMultipleTypes"]["anIntEnum"] is None: - raise MockFunctionCallError("niFake_ReturnMultipleTypes", param="anIntEnum") + if self._defaults['ReturnMultipleTypes']['anIntEnum'] is None: + raise MockFunctionCallError("niFake_ReturnMultipleTypes", param='anIntEnum') if an_int_enum is not None: - an_int_enum.contents.value = self._defaults["ReturnMultipleTypes"][ - "anIntEnum" - ] + an_int_enum.contents.value = self._defaults['ReturnMultipleTypes']['anIntEnum'] # a_float - if self._defaults["ReturnMultipleTypes"]["aFloat"] is None: - raise MockFunctionCallError("niFake_ReturnMultipleTypes", param="aFloat") + if self._defaults['ReturnMultipleTypes']['aFloat'] is None: + raise MockFunctionCallError("niFake_ReturnMultipleTypes", param='aFloat') if a_float is not None: - a_float.contents.value = self._defaults["ReturnMultipleTypes"]["aFloat"] + a_float.contents.value = self._defaults['ReturnMultipleTypes']['aFloat'] # a_float_enum - if self._defaults["ReturnMultipleTypes"]["aFloatEnum"] is None: - raise MockFunctionCallError( - "niFake_ReturnMultipleTypes", param="aFloatEnum" - ) + if self._defaults['ReturnMultipleTypes']['aFloatEnum'] is None: + raise MockFunctionCallError("niFake_ReturnMultipleTypes", param='aFloatEnum') if a_float_enum is not None: - a_float_enum.contents.value = self._defaults["ReturnMultipleTypes"][ - "aFloatEnum" - ] + a_float_enum.contents.value = self._defaults['ReturnMultipleTypes']['aFloatEnum'] # an_array - if self._defaults["ReturnMultipleTypes"]["anArray"] is None: - raise MockFunctionCallError("niFake_ReturnMultipleTypes", param="anArray") - test_value = self._defaults["ReturnMultipleTypes"]["anArray"] + if self._defaults['ReturnMultipleTypes']['anArray'] is None: + raise MockFunctionCallError("niFake_ReturnMultipleTypes", param='anArray') + test_value = self._defaults['ReturnMultipleTypes']['anArray'] try: an_array_ref = an_array.contents except AttributeError: @@ -908,368 +748,238 @@ def niFake_ReturnMultipleTypes( assert len(an_array_ref) >= len(test_value) for i in range(len(test_value)): an_array_ref[i] = test_value[i] - if self._defaults["ReturnMultipleTypes"]["aString"] is None: - raise MockFunctionCallError("niFake_ReturnMultipleTypes", param="aString") + if self._defaults['ReturnMultipleTypes']['aString'] is None: + raise MockFunctionCallError("niFake_ReturnMultipleTypes", param='aString') if string_size.value == 0: - return len(self._defaults["ReturnMultipleTypes"]["aString"]) - a_string.value = self._defaults["ReturnMultipleTypes"]["aString"].encode( - "ascii" - ) - return self._defaults["ReturnMultipleTypes"]["return"] - - def niFake_SetAttributeViBoolean( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["SetAttributeViBoolean"]["return"] != 0: - return self._defaults["SetAttributeViBoolean"]["return"] - return self._defaults["SetAttributeViBoolean"]["return"] - - def niFake_SetAttributeViInt32( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["SetAttributeViInt32"]["return"] != 0: - return self._defaults["SetAttributeViInt32"]["return"] - return self._defaults["SetAttributeViInt32"]["return"] - - def niFake_SetAttributeViInt64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["SetAttributeViInt64"]["return"] != 0: - return self._defaults["SetAttributeViInt64"]["return"] - return self._defaults["SetAttributeViInt64"]["return"] - - def niFake_SetAttributeViReal64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["SetAttributeViReal64"]["return"] != 0: - return self._defaults["SetAttributeViReal64"]["return"] - return self._defaults["SetAttributeViReal64"]["return"] - - def niFake_SetAttributeViString( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["SetAttributeViString"]["return"] != 0: - return self._defaults["SetAttributeViString"]["return"] - return self._defaults["SetAttributeViString"]["return"] + return len(self._defaults['ReturnMultipleTypes']['aString']) + a_string.value = self._defaults['ReturnMultipleTypes']['aString'].encode('ascii') + return self._defaults['ReturnMultipleTypes']['return'] + + def niFake_SetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['SetAttributeViBoolean']['return'] != 0: + return self._defaults['SetAttributeViBoolean']['return'] + return self._defaults['SetAttributeViBoolean']['return'] + + def niFake_SetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['SetAttributeViInt32']['return'] != 0: + return self._defaults['SetAttributeViInt32']['return'] + return self._defaults['SetAttributeViInt32']['return'] + + def niFake_SetAttributeViInt64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['SetAttributeViInt64']['return'] != 0: + return self._defaults['SetAttributeViInt64']['return'] + return self._defaults['SetAttributeViInt64']['return'] + + def niFake_SetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['SetAttributeViReal64']['return'] != 0: + return self._defaults['SetAttributeViReal64']['return'] + return self._defaults['SetAttributeViReal64']['return'] + + def niFake_SetAttributeViString(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['SetAttributeViString']['return'] != 0: + return self._defaults['SetAttributeViString']['return'] + return self._defaults['SetAttributeViString']['return'] def niFake_SetCustomType(self, vi, cs): # noqa: N802 - if self._defaults["SetCustomType"]["return"] != 0: - return self._defaults["SetCustomType"]["return"] - return self._defaults["SetCustomType"]["return"] + if self._defaults['SetCustomType']['return'] != 0: + return self._defaults['SetCustomType']['return'] + return self._defaults['SetCustomType']['return'] def niFake_SetCustomTypeArray(self, vi, number_of_elements, cs): # noqa: N802 - if self._defaults["SetCustomTypeArray"]["return"] != 0: - return self._defaults["SetCustomTypeArray"]["return"] - return self._defaults["SetCustomTypeArray"]["return"] + if self._defaults['SetCustomTypeArray']['return'] != 0: + return self._defaults['SetCustomTypeArray']['return'] + return self._defaults['SetCustomTypeArray']['return'] - def niFake_StringValuedEnumInputFunctionWithDefaults( - self, vi, a_mobile_os_name - ): # noqa: N802 - if self._defaults["StringValuedEnumInputFunctionWithDefaults"]["return"] != 0: - return self._defaults["StringValuedEnumInputFunctionWithDefaults"]["return"] - return self._defaults["StringValuedEnumInputFunctionWithDefaults"]["return"] + def niFake_StringValuedEnumInputFunctionWithDefaults(self, vi, a_mobile_os_name): # noqa: N802 + if self._defaults['StringValuedEnumInputFunctionWithDefaults']['return'] != 0: + return self._defaults['StringValuedEnumInputFunctionWithDefaults']['return'] + return self._defaults['StringValuedEnumInputFunctionWithDefaults']['return'] def niFake_TwoInputFunction(self, vi, a_number, a_string): # noqa: N802 - if self._defaults["TwoInputFunction"]["return"] != 0: - return self._defaults["TwoInputFunction"]["return"] - return self._defaults["TwoInputFunction"]["return"] + if self._defaults['TwoInputFunction']['return'] != 0: + return self._defaults['TwoInputFunction']['return'] + return self._defaults['TwoInputFunction']['return'] def niFake_UnlockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults["UnlockSession"]["return"] != 0: - return self._defaults["UnlockSession"]["return"] + if self._defaults['UnlockSession']['return'] != 0: + return self._defaults['UnlockSession']['return'] # caller_has_lock - if self._defaults["UnlockSession"]["callerHasLock"] is None: - raise MockFunctionCallError("niFake_UnlockSession", param="callerHasLock") + if self._defaults['UnlockSession']['callerHasLock'] is None: + raise MockFunctionCallError("niFake_UnlockSession", param='callerHasLock') if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults["UnlockSession"][ - "callerHasLock" - ] - return self._defaults["UnlockSession"]["return"] + caller_has_lock.contents.value = self._defaults['UnlockSession']['callerHasLock'] + return self._defaults['UnlockSession']['return'] def niFake_Use64BitNumber(self, vi, input, output): # noqa: N802 - if self._defaults["Use64BitNumber"]["return"] != 0: - return self._defaults["Use64BitNumber"]["return"] + if self._defaults['Use64BitNumber']['return'] != 0: + return self._defaults['Use64BitNumber']['return'] # output - if self._defaults["Use64BitNumber"]["output"] is None: - raise MockFunctionCallError("niFake_Use64BitNumber", param="output") + if self._defaults['Use64BitNumber']['output'] is None: + raise MockFunctionCallError("niFake_Use64BitNumber", param='output') if output is not None: - output.contents.value = self._defaults["Use64BitNumber"]["output"] - return self._defaults["Use64BitNumber"]["return"] + output.contents.value = self._defaults['Use64BitNumber']['output'] + return self._defaults['Use64BitNumber']['return'] def niFake_WriteWaveform(self, vi, number_of_samples, waveform): # noqa: N802 - if self._defaults["WriteWaveform"]["return"] != 0: - return self._defaults["WriteWaveform"]["return"] - return self._defaults["WriteWaveform"]["return"] + if self._defaults['WriteWaveform']['return'] != 0: + return self._defaults['WriteWaveform']['return'] + return self._defaults['WriteWaveform']['return'] def niFake_close(self, vi): # noqa: N802 - if self._defaults["close"]["return"] != 0: - return self._defaults["close"]["return"] - return self._defaults["close"]["return"] + if self._defaults['close']['return'] != 0: + return self._defaults['close']['return'] + return self._defaults['close']['return'] def niFake_error_message(self, vi, error_code, error_message): # noqa: N802 - if self._defaults["error_message"]["return"] != 0: - return self._defaults["error_message"]["return"] + if self._defaults['error_message']['return'] != 0: + return self._defaults['error_message']['return'] # error_message - if self._defaults["error_message"]["errorMessage"] is None: - raise MockFunctionCallError("niFake_error_message", param="errorMessage") - test_value = self._defaults["error_message"]["errorMessage"] + if self._defaults['error_message']['errorMessage'] is None: + raise MockFunctionCallError("niFake_error_message", param='errorMessage') + test_value = self._defaults['error_message']['errorMessage'] if type(test_value) is str: - test_value = test_value.encode("ascii") + test_value = test_value.encode('ascii') assert len(error_message) >= len(test_value) for i in range(len(test_value)): error_message[i] = test_value[i] - return self._defaults["error_message"]["return"] + return self._defaults['error_message']['return'] def niFake_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 - if self._defaults["self_test"]["return"] != 0: - return self._defaults["self_test"]["return"] + if self._defaults['self_test']['return'] != 0: + return self._defaults['self_test']['return'] # self_test_result - if self._defaults["self_test"]["selfTestResult"] is None: - raise MockFunctionCallError("niFake_self_test", param="selfTestResult") + if self._defaults['self_test']['selfTestResult'] is None: + raise MockFunctionCallError("niFake_self_test", param='selfTestResult') if self_test_result is not None: - self_test_result.contents.value = self._defaults["self_test"][ - "selfTestResult" - ] + self_test_result.contents.value = self._defaults['self_test']['selfTestResult'] # self_test_message - if self._defaults["self_test"]["selfTestMessage"] is None: - raise MockFunctionCallError("niFake_self_test", param="selfTestMessage") - test_value = self._defaults["self_test"]["selfTestMessage"] + if self._defaults['self_test']['selfTestMessage'] is None: + raise MockFunctionCallError("niFake_self_test", param='selfTestMessage') + test_value = self._defaults['self_test']['selfTestMessage'] if type(test_value) is str: - test_value = test_value.encode("ascii") + test_value = test_value.encode('ascii') assert len(self_test_message) >= len(test_value) for i in range(len(test_value)): self_test_message[i] = test_value[i] - return self._defaults["self_test"]["return"] + return self._defaults['self_test']['return'] # Helper function to setup Mock object with default side effects and return values def set_side_effects_and_return_values(self, mock_library): mock_library.niFake_Abort.side_effect = MockFunctionCallError("niFake_Abort") mock_library.niFake_Abort.return_value = 0 - mock_library.niFake_AcceptListOfDurationsInSeconds.side_effect = ( - MockFunctionCallError("niFake_AcceptListOfDurationsInSeconds") - ) + mock_library.niFake_AcceptListOfDurationsInSeconds.side_effect = MockFunctionCallError("niFake_AcceptListOfDurationsInSeconds") mock_library.niFake_AcceptListOfDurationsInSeconds.return_value = 0 - mock_library.niFake_BoolArrayOutputFunction.side_effect = MockFunctionCallError( - "niFake_BoolArrayOutputFunction" - ) + mock_library.niFake_BoolArrayOutputFunction.side_effect = MockFunctionCallError("niFake_BoolArrayOutputFunction") mock_library.niFake_BoolArrayOutputFunction.return_value = 0 - mock_library.niFake_DoubleAllTheNums.side_effect = MockFunctionCallError( - "niFake_DoubleAllTheNums" - ) + mock_library.niFake_DoubleAllTheNums.side_effect = MockFunctionCallError("niFake_DoubleAllTheNums") mock_library.niFake_DoubleAllTheNums.return_value = 0 - mock_library.niFake_EnumArrayOutputFunction.side_effect = MockFunctionCallError( - "niFake_EnumArrayOutputFunction" - ) + mock_library.niFake_EnumArrayOutputFunction.side_effect = MockFunctionCallError("niFake_EnumArrayOutputFunction") mock_library.niFake_EnumArrayOutputFunction.return_value = 0 - mock_library.niFake_EnumInputFunctionWithDefaults.side_effect = ( - MockFunctionCallError("niFake_EnumInputFunctionWithDefaults") - ) + mock_library.niFake_EnumInputFunctionWithDefaults.side_effect = MockFunctionCallError("niFake_EnumInputFunctionWithDefaults") mock_library.niFake_EnumInputFunctionWithDefaults.return_value = 0 - mock_library.niFake_ExportAttributeConfigurationBuffer.side_effect = ( - MockFunctionCallError("niFake_ExportAttributeConfigurationBuffer") - ) + mock_library.niFake_ExportAttributeConfigurationBuffer.side_effect = MockFunctionCallError("niFake_ExportAttributeConfigurationBuffer") mock_library.niFake_ExportAttributeConfigurationBuffer.return_value = 0 - mock_library.niFake_FetchWaveform.side_effect = MockFunctionCallError( - "niFake_FetchWaveform" - ) + mock_library.niFake_FetchWaveform.side_effect = MockFunctionCallError("niFake_FetchWaveform") mock_library.niFake_FetchWaveform.return_value = 0 - mock_library.niFake_GetABoolean.side_effect = MockFunctionCallError( - "niFake_GetABoolean" - ) + mock_library.niFake_GetABoolean.side_effect = MockFunctionCallError("niFake_GetABoolean") mock_library.niFake_GetABoolean.return_value = 0 - mock_library.niFake_GetANumber.side_effect = MockFunctionCallError( - "niFake_GetANumber" - ) + mock_library.niFake_GetANumber.side_effect = MockFunctionCallError("niFake_GetANumber") mock_library.niFake_GetANumber.return_value = 0 - mock_library.niFake_GetAStringOfFixedMaximumSize.side_effect = ( - MockFunctionCallError("niFake_GetAStringOfFixedMaximumSize") - ) + mock_library.niFake_GetAStringOfFixedMaximumSize.side_effect = MockFunctionCallError("niFake_GetAStringOfFixedMaximumSize") mock_library.niFake_GetAStringOfFixedMaximumSize.return_value = 0 - mock_library.niFake_GetAStringUsingPythonCode.side_effect = ( - MockFunctionCallError("niFake_GetAStringUsingPythonCode") - ) + mock_library.niFake_GetAStringUsingPythonCode.side_effect = MockFunctionCallError("niFake_GetAStringUsingPythonCode") mock_library.niFake_GetAStringUsingPythonCode.return_value = 0 - mock_library.niFake_GetAnIviDanceString.side_effect = MockFunctionCallError( - "niFake_GetAnIviDanceString" - ) + mock_library.niFake_GetAnIviDanceString.side_effect = MockFunctionCallError("niFake_GetAnIviDanceString") mock_library.niFake_GetAnIviDanceString.return_value = 0 - mock_library.niFake_GetAnIviDanceWithATwistString.side_effect = ( - MockFunctionCallError("niFake_GetAnIviDanceWithATwistString") - ) + mock_library.niFake_GetAnIviDanceWithATwistString.side_effect = MockFunctionCallError("niFake_GetAnIviDanceWithATwistString") mock_library.niFake_GetAnIviDanceWithATwistString.return_value = 0 - mock_library.niFake_GetArrayForPythonCodeCustomType.side_effect = ( - MockFunctionCallError("niFake_GetArrayForPythonCodeCustomType") - ) + mock_library.niFake_GetArrayForPythonCodeCustomType.side_effect = MockFunctionCallError("niFake_GetArrayForPythonCodeCustomType") mock_library.niFake_GetArrayForPythonCodeCustomType.return_value = 0 - mock_library.niFake_GetArrayForPythonCodeDouble.side_effect = ( - MockFunctionCallError("niFake_GetArrayForPythonCodeDouble") - ) + mock_library.niFake_GetArrayForPythonCodeDouble.side_effect = MockFunctionCallError("niFake_GetArrayForPythonCodeDouble") mock_library.niFake_GetArrayForPythonCodeDouble.return_value = 0 - mock_library.niFake_GetArraySizeForPythonCode.side_effect = ( - MockFunctionCallError("niFake_GetArraySizeForPythonCode") - ) + mock_library.niFake_GetArraySizeForPythonCode.side_effect = MockFunctionCallError("niFake_GetArraySizeForPythonCode") mock_library.niFake_GetArraySizeForPythonCode.return_value = 0 - mock_library.niFake_GetArrayUsingIviDance.side_effect = MockFunctionCallError( - "niFake_GetArrayUsingIviDance" - ) + mock_library.niFake_GetArrayUsingIviDance.side_effect = MockFunctionCallError("niFake_GetArrayUsingIviDance") mock_library.niFake_GetArrayUsingIviDance.return_value = 0 - mock_library.niFake_GetAttributeViBoolean.side_effect = MockFunctionCallError( - "niFake_GetAttributeViBoolean" - ) + mock_library.niFake_GetAttributeViBoolean.side_effect = MockFunctionCallError("niFake_GetAttributeViBoolean") mock_library.niFake_GetAttributeViBoolean.return_value = 0 - mock_library.niFake_GetAttributeViInt32.side_effect = MockFunctionCallError( - "niFake_GetAttributeViInt32" - ) + mock_library.niFake_GetAttributeViInt32.side_effect = MockFunctionCallError("niFake_GetAttributeViInt32") mock_library.niFake_GetAttributeViInt32.return_value = 0 - mock_library.niFake_GetAttributeViInt64.side_effect = MockFunctionCallError( - "niFake_GetAttributeViInt64" - ) + mock_library.niFake_GetAttributeViInt64.side_effect = MockFunctionCallError("niFake_GetAttributeViInt64") mock_library.niFake_GetAttributeViInt64.return_value = 0 - mock_library.niFake_GetAttributeViReal64.side_effect = MockFunctionCallError( - "niFake_GetAttributeViReal64" - ) + mock_library.niFake_GetAttributeViReal64.side_effect = MockFunctionCallError("niFake_GetAttributeViReal64") mock_library.niFake_GetAttributeViReal64.return_value = 0 - mock_library.niFake_GetAttributeViString.side_effect = MockFunctionCallError( - "niFake_GetAttributeViString" - ) + mock_library.niFake_GetAttributeViString.side_effect = MockFunctionCallError("niFake_GetAttributeViString") mock_library.niFake_GetAttributeViString.return_value = 0 - mock_library.niFake_GetCalDateAndTime.side_effect = MockFunctionCallError( - "niFake_GetCalDateAndTime" - ) + mock_library.niFake_GetCalDateAndTime.side_effect = MockFunctionCallError("niFake_GetCalDateAndTime") mock_library.niFake_GetCalDateAndTime.return_value = 0 - mock_library.niFake_GetCalInterval.side_effect = MockFunctionCallError( - "niFake_GetCalInterval" - ) + mock_library.niFake_GetCalInterval.side_effect = MockFunctionCallError("niFake_GetCalInterval") mock_library.niFake_GetCalInterval.return_value = 0 - mock_library.niFake_GetCustomType.side_effect = MockFunctionCallError( - "niFake_GetCustomType" - ) + mock_library.niFake_GetCustomType.side_effect = MockFunctionCallError("niFake_GetCustomType") mock_library.niFake_GetCustomType.return_value = 0 - mock_library.niFake_GetCustomTypeArray.side_effect = MockFunctionCallError( - "niFake_GetCustomTypeArray" - ) + mock_library.niFake_GetCustomTypeArray.side_effect = MockFunctionCallError("niFake_GetCustomTypeArray") mock_library.niFake_GetCustomTypeArray.return_value = 0 - mock_library.niFake_GetEnumValue.side_effect = MockFunctionCallError( - "niFake_GetEnumValue" - ) + mock_library.niFake_GetEnumValue.side_effect = MockFunctionCallError("niFake_GetEnumValue") mock_library.niFake_GetEnumValue.return_value = 0 - mock_library.niFake_GetError.side_effect = MockFunctionCallError( - "niFake_GetError" - ) + mock_library.niFake_GetError.side_effect = MockFunctionCallError("niFake_GetError") mock_library.niFake_GetError.return_value = 0 - mock_library.niFake_ImportAttributeConfigurationBuffer.side_effect = ( - MockFunctionCallError("niFake_ImportAttributeConfigurationBuffer") - ) + mock_library.niFake_ImportAttributeConfigurationBuffer.side_effect = MockFunctionCallError("niFake_ImportAttributeConfigurationBuffer") mock_library.niFake_ImportAttributeConfigurationBuffer.return_value = 0 - mock_library.niFake_InitWithOptions.side_effect = MockFunctionCallError( - "niFake_InitWithOptions" - ) + mock_library.niFake_InitWithOptions.side_effect = MockFunctionCallError("niFake_InitWithOptions") mock_library.niFake_InitWithOptions.return_value = 0 - mock_library.niFake_Initiate.side_effect = MockFunctionCallError( - "niFake_Initiate" - ) + mock_library.niFake_Initiate.side_effect = MockFunctionCallError("niFake_Initiate") mock_library.niFake_Initiate.return_value = 0 - mock_library.niFake_LockSession.side_effect = MockFunctionCallError( - "niFake_LockSession" - ) + mock_library.niFake_LockSession.side_effect = MockFunctionCallError("niFake_LockSession") mock_library.niFake_LockSession.return_value = 0 - mock_library.niFake_MultipleArrayTypes.side_effect = MockFunctionCallError( - "niFake_MultipleArrayTypes" - ) + mock_library.niFake_MultipleArrayTypes.side_effect = MockFunctionCallError("niFake_MultipleArrayTypes") mock_library.niFake_MultipleArrayTypes.return_value = 0 - mock_library.niFake_MultipleArraysSameSize.side_effect = MockFunctionCallError( - "niFake_MultipleArraysSameSize" - ) + mock_library.niFake_MultipleArraysSameSize.side_effect = MockFunctionCallError("niFake_MultipleArraysSameSize") mock_library.niFake_MultipleArraysSameSize.return_value = 0 - mock_library.niFake_OneInputFunction.side_effect = MockFunctionCallError( - "niFake_OneInputFunction" - ) + mock_library.niFake_OneInputFunction.side_effect = MockFunctionCallError("niFake_OneInputFunction") mock_library.niFake_OneInputFunction.return_value = 0 - mock_library.niFake_ParametersAreMultipleTypes.side_effect = ( - MockFunctionCallError("niFake_ParametersAreMultipleTypes") - ) + mock_library.niFake_ParametersAreMultipleTypes.side_effect = MockFunctionCallError("niFake_ParametersAreMultipleTypes") mock_library.niFake_ParametersAreMultipleTypes.return_value = 0 - mock_library.niFake_PoorlyNamedSimpleFunction.side_effect = ( - MockFunctionCallError("niFake_PoorlyNamedSimpleFunction") - ) + mock_library.niFake_PoorlyNamedSimpleFunction.side_effect = MockFunctionCallError("niFake_PoorlyNamedSimpleFunction") mock_library.niFake_PoorlyNamedSimpleFunction.return_value = 0 mock_library.niFake_Read.side_effect = MockFunctionCallError("niFake_Read") mock_library.niFake_Read.return_value = 0 - mock_library.niFake_ReadFromChannel.side_effect = MockFunctionCallError( - "niFake_ReadFromChannel" - ) + mock_library.niFake_ReadFromChannel.side_effect = MockFunctionCallError("niFake_ReadFromChannel") mock_library.niFake_ReadFromChannel.return_value = 0 - mock_library.niFake_ReturnANumberAndAString.side_effect = MockFunctionCallError( - "niFake_ReturnANumberAndAString" - ) + mock_library.niFake_ReturnANumberAndAString.side_effect = MockFunctionCallError("niFake_ReturnANumberAndAString") mock_library.niFake_ReturnANumberAndAString.return_value = 0 - mock_library.niFake_ReturnDurationInSeconds.side_effect = MockFunctionCallError( - "niFake_ReturnDurationInSeconds" - ) + mock_library.niFake_ReturnDurationInSeconds.side_effect = MockFunctionCallError("niFake_ReturnDurationInSeconds") mock_library.niFake_ReturnDurationInSeconds.return_value = 0 - mock_library.niFake_ReturnListOfDurationsInSeconds.side_effect = ( - MockFunctionCallError("niFake_ReturnListOfDurationsInSeconds") - ) + mock_library.niFake_ReturnListOfDurationsInSeconds.side_effect = MockFunctionCallError("niFake_ReturnListOfDurationsInSeconds") mock_library.niFake_ReturnListOfDurationsInSeconds.return_value = 0 - mock_library.niFake_ReturnMultipleTypes.side_effect = MockFunctionCallError( - "niFake_ReturnMultipleTypes" - ) + mock_library.niFake_ReturnMultipleTypes.side_effect = MockFunctionCallError("niFake_ReturnMultipleTypes") mock_library.niFake_ReturnMultipleTypes.return_value = 0 - mock_library.niFake_SetAttributeViBoolean.side_effect = MockFunctionCallError( - "niFake_SetAttributeViBoolean" - ) + mock_library.niFake_SetAttributeViBoolean.side_effect = MockFunctionCallError("niFake_SetAttributeViBoolean") mock_library.niFake_SetAttributeViBoolean.return_value = 0 - mock_library.niFake_SetAttributeViInt32.side_effect = MockFunctionCallError( - "niFake_SetAttributeViInt32" - ) + mock_library.niFake_SetAttributeViInt32.side_effect = MockFunctionCallError("niFake_SetAttributeViInt32") mock_library.niFake_SetAttributeViInt32.return_value = 0 - mock_library.niFake_SetAttributeViInt64.side_effect = MockFunctionCallError( - "niFake_SetAttributeViInt64" - ) + mock_library.niFake_SetAttributeViInt64.side_effect = MockFunctionCallError("niFake_SetAttributeViInt64") mock_library.niFake_SetAttributeViInt64.return_value = 0 - mock_library.niFake_SetAttributeViReal64.side_effect = MockFunctionCallError( - "niFake_SetAttributeViReal64" - ) + mock_library.niFake_SetAttributeViReal64.side_effect = MockFunctionCallError("niFake_SetAttributeViReal64") mock_library.niFake_SetAttributeViReal64.return_value = 0 - mock_library.niFake_SetAttributeViString.side_effect = MockFunctionCallError( - "niFake_SetAttributeViString" - ) + mock_library.niFake_SetAttributeViString.side_effect = MockFunctionCallError("niFake_SetAttributeViString") mock_library.niFake_SetAttributeViString.return_value = 0 - mock_library.niFake_SetCustomType.side_effect = MockFunctionCallError( - "niFake_SetCustomType" - ) + mock_library.niFake_SetCustomType.side_effect = MockFunctionCallError("niFake_SetCustomType") mock_library.niFake_SetCustomType.return_value = 0 - mock_library.niFake_SetCustomTypeArray.side_effect = MockFunctionCallError( - "niFake_SetCustomTypeArray" - ) + mock_library.niFake_SetCustomTypeArray.side_effect = MockFunctionCallError("niFake_SetCustomTypeArray") mock_library.niFake_SetCustomTypeArray.return_value = 0 - mock_library.niFake_StringValuedEnumInputFunctionWithDefaults.side_effect = ( - MockFunctionCallError("niFake_StringValuedEnumInputFunctionWithDefaults") - ) + mock_library.niFake_StringValuedEnumInputFunctionWithDefaults.side_effect = MockFunctionCallError("niFake_StringValuedEnumInputFunctionWithDefaults") mock_library.niFake_StringValuedEnumInputFunctionWithDefaults.return_value = 0 - mock_library.niFake_TwoInputFunction.side_effect = MockFunctionCallError( - "niFake_TwoInputFunction" - ) + mock_library.niFake_TwoInputFunction.side_effect = MockFunctionCallError("niFake_TwoInputFunction") mock_library.niFake_TwoInputFunction.return_value = 0 - mock_library.niFake_UnlockSession.side_effect = MockFunctionCallError( - "niFake_UnlockSession" - ) + mock_library.niFake_UnlockSession.side_effect = MockFunctionCallError("niFake_UnlockSession") mock_library.niFake_UnlockSession.return_value = 0 - mock_library.niFake_Use64BitNumber.side_effect = MockFunctionCallError( - "niFake_Use64BitNumber" - ) + mock_library.niFake_Use64BitNumber.side_effect = MockFunctionCallError("niFake_Use64BitNumber") mock_library.niFake_Use64BitNumber.return_value = 0 - mock_library.niFake_WriteWaveform.side_effect = MockFunctionCallError( - "niFake_WriteWaveform" - ) + mock_library.niFake_WriteWaveform.side_effect = MockFunctionCallError("niFake_WriteWaveform") mock_library.niFake_WriteWaveform.return_value = 0 mock_library.niFake_close.side_effect = MockFunctionCallError("niFake_close") mock_library.niFake_close.return_value = 0 - mock_library.niFake_error_message.side_effect = MockFunctionCallError( - "niFake_error_message" - ) + mock_library.niFake_error_message.side_effect = MockFunctionCallError("niFake_error_message") mock_library.niFake_error_message.return_value = 0 - mock_library.niFake_self_test.side_effect = MockFunctionCallError( - "niFake_self_test" - ) + mock_library.niFake_self_test.side_effect = MockFunctionCallError("niFake_self_test") mock_library.niFake_self_test.return_value = 0 diff --git a/generated/nifake/nifake/unit_tests/test_converters.py b/generated/nifake/nifake/unit_tests/test_converters.py index 98506e9d0..f828fce72 100644 --- a/generated/nifake/nifake/unit_tests/test_converters.py +++ b/generated/nifake/nifake/unit_tests/test_converters.py @@ -7,80 +7,24 @@ def test_convert_init_with_options_dictionary(): - assert _converters.convert_init_with_options_dictionary("") == "" - assert ( - _converters.convert_init_with_options_dictionary("Simulate=1") == "Simulate=1" - ) - assert ( - _converters.convert_init_with_options_dictionary( - { - "Simulate": True, - } - ) - == "Simulate=1" - ) - assert ( - _converters.convert_init_with_options_dictionary( - { - "Simulate": False, - } - ) - == "Simulate=0" - ) - assert ( - _converters.convert_init_with_options_dictionary( - {"Simulate": True, "Cache": False} - ) - == "Cache=0,Simulate=1" - ) - assert ( - _converters.convert_init_with_options_dictionary( - {"DriverSetup": {"Model": "5162 (4CH)", "Bitfile": "CustomProcessing"}} - ) - == "DriverSetup=Bitfile:CustomProcessing;Model:5162 (4CH)" - ) - assert ( - _converters.convert_init_with_options_dictionary( - { - "Simulate": True, - "DriverSetup": {"Model": "5162 (4CH)", "Bitfile": "CustomProcessing"}, - } - ) - == "DriverSetup=Bitfile:CustomProcessing;Model:5162 (4CH),Simulate=1" - ) - assert ( - _converters.convert_init_with_options_dictionary( - {"simulate": True, "cache": False} - ) - == "Cache=0,Simulate=1" - ) - assert ( - _converters.convert_init_with_options_dictionary( - {"driver_setup": {"Model": "5162 (4CH)", "Bitfile": "CustomProcessing"}} - ) - == "DriverSetup=Bitfile:CustomProcessing;Model:5162 (4CH)" - ) - assert ( - _converters.convert_init_with_options_dictionary( - { - "simulate": True, - "driver_setup": {"Model": "5162 (4CH)", "Bitfile": "CustomProcessing"}, - } - ) - == "DriverSetup=Bitfile:CustomProcessing;Model:5162 (4CH),Simulate=1" - ) + assert _converters.convert_init_with_options_dictionary('') == '' + assert _converters.convert_init_with_options_dictionary('Simulate=1') == 'Simulate=1' + assert _converters.convert_init_with_options_dictionary({'Simulate': True, }) == 'Simulate=1' + assert _converters.convert_init_with_options_dictionary({'Simulate': False, }) == 'Simulate=0' + assert _converters.convert_init_with_options_dictionary({'Simulate': True, 'Cache': False}) == 'Cache=0,Simulate=1' + assert _converters.convert_init_with_options_dictionary({'DriverSetup': {'Model': '5162 (4CH)', 'Bitfile': 'CustomProcessing'}}) == 'DriverSetup=Bitfile:CustomProcessing;Model:5162 (4CH)' + assert _converters.convert_init_with_options_dictionary({'Simulate': True, 'DriverSetup': {'Model': '5162 (4CH)', 'Bitfile': 'CustomProcessing'}}) == 'DriverSetup=Bitfile:CustomProcessing;Model:5162 (4CH),Simulate=1' + assert _converters.convert_init_with_options_dictionary({'simulate': True, 'cache': False}) == 'Cache=0,Simulate=1' + assert _converters.convert_init_with_options_dictionary({'driver_setup': {'Model': '5162 (4CH)', 'Bitfile': 'CustomProcessing'}}) == 'DriverSetup=Bitfile:CustomProcessing;Model:5162 (4CH)' + assert _converters.convert_init_with_options_dictionary({'simulate': True, 'driver_setup': {'Model': '5162 (4CH)', 'Bitfile': 'CustomProcessing'}}) == 'DriverSetup=Bitfile:CustomProcessing;Model:5162 (4CH),Simulate=1' # Tests - time def test_convert_timedelta_to_seconds_double(): - test_result = _converters.convert_timedelta_to_seconds_real64( - hightime.timedelta(seconds=10) - ) + test_result = _converters.convert_timedelta_to_seconds_real64(hightime.timedelta(seconds=10)) assert test_result.value == 10.0 assert isinstance(test_result, _visatype.ViReal64) - test_result = _converters.convert_timedelta_to_seconds_real64( - hightime.timedelta(nanoseconds=-0.5) - ) + test_result = _converters.convert_timedelta_to_seconds_real64(hightime.timedelta(nanoseconds=-0.5)) assert test_result.value == pytest.approx(-5e-10) assert isinstance(test_result, _visatype.ViReal64) test_result = _converters.convert_timedelta_to_seconds_real64(10.5) @@ -92,14 +36,10 @@ def test_convert_timedelta_to_seconds_double(): def test_convert_timedelta_to_milliseconds_int32(): - test_result = _converters.convert_timedelta_to_milliseconds_int32( - hightime.timedelta(seconds=10) - ) + test_result = _converters.convert_timedelta_to_milliseconds_int32(hightime.timedelta(seconds=10)) assert test_result.value == 10000 assert isinstance(test_result, _visatype.ViInt32) - test_result = _converters.convert_timedelta_to_milliseconds_int32( - hightime.timedelta(seconds=-5) - ) + test_result = _converters.convert_timedelta_to_milliseconds_int32(hightime.timedelta(seconds=-5)) assert test_result.value == -5000 assert isinstance(test_result, _visatype.ViInt32) test_result = _converters.convert_timedelta_to_milliseconds_int32(10.5) @@ -113,24 +53,11 @@ def test_convert_timedelta_to_milliseconds_int32(): def test_convert_timedeltas_to_seconds_real64(): time_values = [10.5, -5e-10] test_result = _converters.convert_timedeltas_to_seconds_real64(time_values) - assert all( - [ - actual.value == pytest.approx(expected) - for actual, expected in zip(test_result, time_values) - ] - ) + assert all([actual.value == pytest.approx(expected) for actual, expected in zip(test_result, time_values)]) assert all([isinstance(i, _visatype.ViReal64) for i in test_result]) - test_input = [ - hightime.timedelta(seconds=10.5), - hightime.timedelta(nanoseconds=-0.5), - ] + test_input = [hightime.timedelta(seconds=10.5), hightime.timedelta(nanoseconds=-0.5)] test_result = _converters.convert_timedeltas_to_seconds_real64(test_input) - assert all( - [ - actual.value == pytest.approx(expected) - for actual, expected in zip(test_result, time_values) - ] - ) + assert all([actual.value == pytest.approx(expected) for actual, expected in zip(test_result, time_values)]) assert all([isinstance(i, _visatype.ViReal64) for i in test_result]) @@ -144,247 +71,138 @@ def test_convert_seconds_real64_to_timedelta(): def test_convert_seconds_real64_to_timedeltas(): time_values = [10.5, -5e-10] test_result = _converters.convert_seconds_real64_to_timedeltas(time_values) - assert all( - [ - actual.total_seconds() == pytest.approx(expected) - for actual, expected in zip(test_result, time_values) - ] - ) + assert all([actual.total_seconds() == pytest.approx(expected) for actual, expected in zip(test_result, time_values)]) assert all([isinstance(x, hightime.timedelta) for x in test_result]) # Tests - repeated capabilities def test_repeated_capabilities_string_channel(): - test_result_list = _converters.convert_repeated_capabilities("0") - assert test_result_list == ["0"] - test_result_list = _converters.convert_repeated_capabilities("r0") - assert test_result_list == ["r0"] - test_result_list = _converters.convert_repeated_capabilities("0,1") - assert test_result_list == ["0", "1"] + test_result_list = _converters.convert_repeated_capabilities('0') + assert test_result_list == ['0'] + test_result_list = _converters.convert_repeated_capabilities('r0') + assert test_result_list == ['r0'] + test_result_list = _converters.convert_repeated_capabilities('0,1') + assert test_result_list == ['0', '1'] def test_repeated_capabilities_string_prefix(): - test_result_list = _converters.convert_repeated_capabilities( - "0", prefix="ScriptTrigger" - ) - assert test_result_list == ["ScriptTrigger0"] + test_result_list = _converters.convert_repeated_capabilities('0', prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0'] def test_repeated_capabilities_list_channel(): - test_result_list = _converters.convert_repeated_capabilities(["0"]) - assert test_result_list == ["0"] - test_result_list = _converters.convert_repeated_capabilities(["r0"]) - assert test_result_list == ["r0"] - test_result_list = _converters.convert_repeated_capabilities(["0", "1"]) - assert test_result_list == ["0", "1"] + test_result_list = _converters.convert_repeated_capabilities(['0']) + assert test_result_list == ['0'] + test_result_list = _converters.convert_repeated_capabilities(['r0']) + assert test_result_list == ['r0'] + test_result_list = _converters.convert_repeated_capabilities(['0', '1']) + assert test_result_list == ['0', '1'] test_result_list = _converters.convert_repeated_capabilities([0, 1]) - assert test_result_list == ["0", "1"] - test_result_list = _converters.convert_repeated_capabilities([0, 1, "3"]) - assert test_result_list == ["0", "1", "3"] + assert test_result_list == ['0', '1'] + test_result_list = _converters.convert_repeated_capabilities([0, 1, '3']) + assert test_result_list == ['0', '1', '3'] def test_repeated_capabilities_list_prefix(): - test_result_list = _converters.convert_repeated_capabilities( - ["ScriptTrigger0", "ScriptTrigger1"], prefix="ScriptTrigger" - ) - assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] - test_result_list = _converters.convert_repeated_capabilities( - ["0"], prefix="ScriptTrigger" - ) - assert test_result_list == ["ScriptTrigger0"] - test_result_list = _converters.convert_repeated_capabilities( - ["0", "1"], prefix="ScriptTrigger" - ) - assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] - test_result_list = _converters.convert_repeated_capabilities( - [0, 1], prefix="ScriptTrigger" - ) - assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] + test_result_list = _converters.convert_repeated_capabilities(['ScriptTrigger0', 'ScriptTrigger1'], prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = _converters.convert_repeated_capabilities(['0'], prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0'] + test_result_list = _converters.convert_repeated_capabilities(['0', '1'], prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = _converters.convert_repeated_capabilities([0, 1], prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] def test_repeated_capabilities_tuple_channel(): - test_result_list = _converters.convert_repeated_capabilities(("0")) - assert test_result_list == ["0"] - test_result_list = _converters.convert_repeated_capabilities(("0,1")) - assert test_result_list == ["0", "1"] - test_result_list = _converters.convert_repeated_capabilities(("0", "1")) - assert test_result_list == ["0", "1"] + test_result_list = _converters.convert_repeated_capabilities(('0')) + assert test_result_list == ['0'] + test_result_list = _converters.convert_repeated_capabilities(('0,1')) + assert test_result_list == ['0', '1'] + test_result_list = _converters.convert_repeated_capabilities(('0', '1')) + assert test_result_list == ['0', '1'] test_result_list = _converters.convert_repeated_capabilities((0, 1)) - assert test_result_list == ["0", "1"] - test_result_list = _converters.convert_repeated_capabilities((0, 1, "3")) - assert test_result_list == ["0", "1", "3"] + assert test_result_list == ['0', '1'] + test_result_list = _converters.convert_repeated_capabilities((0, 1, '3')) + assert test_result_list == ['0', '1', '3'] def test_repeated_capabilities_tuple_prefix(): - test_result_list = _converters.convert_repeated_capabilities( - ("ScriptTrigger0,ScriptTrigger1"), prefix="ScriptTrigger" - ) - assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] - test_result_list = _converters.convert_repeated_capabilities( - ("0"), prefix="ScriptTrigger" - ) - assert test_result_list == ["ScriptTrigger0"] - test_result_list = _converters.convert_repeated_capabilities( - ("0", "1"), prefix="ScriptTrigger" - ) - assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] - test_result_list = _converters.convert_repeated_capabilities( - (0, 1), prefix="ScriptTrigger" - ) - assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] + test_result_list = _converters.convert_repeated_capabilities(('ScriptTrigger0,ScriptTrigger1'), prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = _converters.convert_repeated_capabilities(('0'), prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0'] + test_result_list = _converters.convert_repeated_capabilities(('0', '1'), prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = _converters.convert_repeated_capabilities((0, 1), prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] def test_repeated_capabilities_unicode(): - test_result_list = _converters.convert_repeated_capabilities( - "ScriptTrigger0,ScriptTrigger1", prefix="ScriptTrigger" - ) - assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] - test_result_list = _converters.convert_repeated_capabilities( - "ScriptTrigger0,ScriptTrigger1", prefix="ScriptTrigger" - ) - assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] - test_result_list = _converters.convert_repeated_capabilities( - "ScriptTrigger0,ScriptTrigger1", prefix="ScriptTrigger" - ) - assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] + test_result_list = _converters.convert_repeated_capabilities(u'ScriptTrigger0,ScriptTrigger1', prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = _converters.convert_repeated_capabilities(u'ScriptTrigger0,ScriptTrigger1', prefix=u'ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = _converters.convert_repeated_capabilities('ScriptTrigger0,ScriptTrigger1', prefix=u'ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] def test_repeated_capabilities_raw(): - test_result_list = _converters.convert_repeated_capabilities( - r"ScriptTrigger0,ScriptTrigger1", prefix="ScriptTrigger" - ) - assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] - test_result_list = _converters.convert_repeated_capabilities( - r"ScriptTrigger0,ScriptTrigger1", prefix=r"ScriptTrigger" - ) - assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] - test_result_list = _converters.convert_repeated_capabilities( - "ScriptTrigger0,ScriptTrigger1", prefix=r"ScriptTrigger" - ) - assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] - test_result_list = _converters.convert_repeated_capabilities( - r"ScriptTrigger0,ScriptTrigger1", prefix="ScriptTrigger" - ) - assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] - test_result_list = _converters.convert_repeated_capabilities( - r"ScriptTrigger0,ScriptTrigger1", prefix=r"ScriptTrigger" - ) - assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] - test_result_list = _converters.convert_repeated_capabilities( - "ScriptTrigger0,ScriptTrigger1", prefix=r"ScriptTrigger" - ) - assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] + test_result_list = _converters.convert_repeated_capabilities(r'ScriptTrigger0,ScriptTrigger1', prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = _converters.convert_repeated_capabilities(r'ScriptTrigger0,ScriptTrigger1', prefix=r'ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = _converters.convert_repeated_capabilities('ScriptTrigger0,ScriptTrigger1', prefix=r'ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = _converters.convert_repeated_capabilities(r'ScriptTrigger0,ScriptTrigger1', prefix=u'ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = _converters.convert_repeated_capabilities(r'ScriptTrigger0,ScriptTrigger1', prefix=r'ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = _converters.convert_repeated_capabilities(u'ScriptTrigger0,ScriptTrigger1', prefix=r'ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] def test_repeated_capabilities_slice_channel(): test_result_list = _converters.convert_repeated_capabilities(slice(0, 1)) - assert test_result_list == ["0"] + assert test_result_list == ['0'] test_result_list = _converters.convert_repeated_capabilities(slice(0, 2)) - assert test_result_list == ["0", "1"] + assert test_result_list == ['0', '1'] test_result_list = _converters.convert_repeated_capabilities(slice(None, 2)) - assert test_result_list == ["0", "1"] + assert test_result_list == ['0', '1'] def test_repeated_capabilities_mixed_channel(): - test_result_list = _converters.convert_repeated_capabilities( - (slice(0, 1), "2", [4, "5-6"], "7-9", "11:14", "16, 17") - ) - assert test_result_list == [ - "0", - "2", - "4", - "5", - "6", - "7", - "8", - "9", - "11", - "12", - "13", - "14", - "16", - "17", - ] - test_result_list = _converters.convert_repeated_capabilities( - [slice(0, 1), "2", [4, "5-6"], "7-9", "11:14", "16, 17"] - ) - assert test_result_list == [ - "0", - "2", - "4", - "5", - "6", - "7", - "8", - "9", - "11", - "12", - "13", - "14", - "16", - "17", - ] + test_result_list = _converters.convert_repeated_capabilities((slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17')) + assert test_result_list == ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] + test_result_list = _converters.convert_repeated_capabilities([slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17']) + assert test_result_list == ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] def test_repeated_capabilities_mixed_prefix(): - test_result_list = _converters.convert_repeated_capabilities( - (slice(0, 1), "2", [4, "5-6"], "7-9", "11:14", "16, 17"), prefix="ScriptTrigger" - ) - assert test_result_list == [ - "ScriptTrigger0", - "ScriptTrigger2", - "ScriptTrigger4", - "ScriptTrigger5", - "ScriptTrigger6", - "ScriptTrigger7", - "ScriptTrigger8", - "ScriptTrigger9", - "ScriptTrigger11", - "ScriptTrigger12", - "ScriptTrigger13", - "ScriptTrigger14", - "ScriptTrigger16", - "ScriptTrigger17", - ] - test_result_list = _converters.convert_repeated_capabilities( - [slice(0, 1), "2", [4, "5-6"], "7-9", "11:14", "16, 17"], prefix="ScriptTrigger" - ) - assert test_result_list == [ - "ScriptTrigger0", - "ScriptTrigger2", - "ScriptTrigger4", - "ScriptTrigger5", - "ScriptTrigger6", - "ScriptTrigger7", - "ScriptTrigger8", - "ScriptTrigger9", - "ScriptTrigger11", - "ScriptTrigger12", - "ScriptTrigger13", - "ScriptTrigger14", - "ScriptTrigger16", - "ScriptTrigger17", - ] + test_result_list = _converters.convert_repeated_capabilities((slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17'), prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger2', 'ScriptTrigger4', 'ScriptTrigger5', 'ScriptTrigger6', 'ScriptTrigger7', 'ScriptTrigger8', 'ScriptTrigger9', 'ScriptTrigger11', 'ScriptTrigger12', 'ScriptTrigger13', 'ScriptTrigger14', 'ScriptTrigger16', 'ScriptTrigger17'] + test_result_list = _converters.convert_repeated_capabilities([slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17'], prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger2', 'ScriptTrigger4', 'ScriptTrigger5', 'ScriptTrigger6', 'ScriptTrigger7', 'ScriptTrigger8', 'ScriptTrigger9', 'ScriptTrigger11', 'ScriptTrigger12', 'ScriptTrigger13', 'ScriptTrigger14', 'ScriptTrigger16', 'ScriptTrigger17'] def test_invalid_repeated_capabilities(): try: - _converters.convert_repeated_capabilities("6-8-10") + _converters.convert_repeated_capabilities('6-8-10') assert False except errors.InvalidRepeatedCapabilityError: pass try: - _converters.convert_repeated_capabilities(["5", "6-8-10"]) + _converters.convert_repeated_capabilities(['5', '6-8-10']) assert False except errors.InvalidRepeatedCapabilityError: pass try: - _converters.convert_repeated_capabilities(("5", "6-8-10")) + _converters.convert_repeated_capabilities(('5', '6-8-10')) assert False except errors.InvalidRepeatedCapabilityError: pass try: - _converters.convert_repeated_capabilities("5,6-8-10") + _converters.convert_repeated_capabilities('5,6-8-10') assert False except errors.InvalidRepeatedCapabilityError: pass @@ -394,187 +212,129 @@ def test_invalid_repeated_capabilities(): except errors.InvalidRepeatedCapabilityError: pass try: - _converters.convert_repeated_capabilities([5.0, "0"]) + _converters.convert_repeated_capabilities([5.0, '0']) assert False except errors.InvalidRepeatedCapabilityError: pass try: - _converters.convert_repeated_capabilities((5.0, "0")) + _converters.convert_repeated_capabilities((5.0, '0')) assert False except errors.InvalidRepeatedCapabilityError: pass def test_repeated_capabilities_slice_prefix(): - test_result_list = _converters.convert_repeated_capabilities( - slice(0, 1), prefix="ScriptTrigger" - ) - assert test_result_list == ["ScriptTrigger0"] - test_result_list = _converters.convert_repeated_capabilities( - slice(0, 2), prefix="ScriptTrigger" - ) - assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] - test_result_list = _converters.convert_repeated_capabilities( - slice(None, 2), prefix="ScriptTrigger" - ) - assert test_result_list == ["ScriptTrigger0", "ScriptTrigger1"] + test_result_list = _converters.convert_repeated_capabilities(slice(0, 1), prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0'] + test_result_list = _converters.convert_repeated_capabilities(slice(0, 2), prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] + test_result_list = _converters.convert_repeated_capabilities(slice(None, 2), prefix='ScriptTrigger') + assert test_result_list == ['ScriptTrigger0', 'ScriptTrigger1'] def test_repeated_capabilities_without_prefix(): - test_result = _converters.convert_repeated_capabilities_without_prefix( - (slice(0, 1), "2", [4, "5-6"], "7-9", "11:14", "16, 17") - ) - assert test_result == "0,2,4,5,6,7,8,9,11,12,13,14,16,17" + test_result = _converters.convert_repeated_capabilities_without_prefix((slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17')) + assert test_result == '0,2,4,5,6,7,8,9,11,12,13,14,16,17' def test_repeated_capabilities_string_resource_name(): - test_result_list = _converters.convert_repeated_capabilities_without_prefix("Dev1") - assert test_result_list == "Dev1" - test_result_list = _converters.convert_repeated_capabilities_without_prefix( - "Dev1,Dev2" - ) - assert test_result_list == "Dev1,Dev2" - test_result_list = _converters.convert_repeated_capabilities_without_prefix( - "Dev1/0" - ) - assert test_result_list == "Dev1/0" - test_result_list = _converters.convert_repeated_capabilities_without_prefix( - "Dev1/0:1, Dev2/0-1" - ) - assert test_result_list == "Dev1/0:1,Dev2/0-1" - test_result_list = _converters.convert_repeated_capabilities_without_prefix( - "Dev1, Dev2/0-2" - ) - assert test_result_list == "Dev1,Dev2/0-2" + test_result_list = _converters.convert_repeated_capabilities_without_prefix('Dev1') + assert test_result_list == 'Dev1' + test_result_list = _converters.convert_repeated_capabilities_without_prefix('Dev1,Dev2') + assert test_result_list == 'Dev1,Dev2' + test_result_list = _converters.convert_repeated_capabilities_without_prefix('Dev1/0') + assert test_result_list == 'Dev1/0' + test_result_list = _converters.convert_repeated_capabilities_without_prefix('Dev1/0:1, Dev2/0-1') + assert test_result_list == 'Dev1/0:1,Dev2/0-1' + test_result_list = _converters.convert_repeated_capabilities_without_prefix('Dev1, Dev2/0-2') + assert test_result_list == 'Dev1,Dev2/0-2' def test_repeated_capabilities_list_resource_name(): - test_result_list = _converters.convert_repeated_capabilities_without_prefix( - ["Dev1"] - ) - assert test_result_list == "Dev1" - test_result_list = _converters.convert_repeated_capabilities_without_prefix( - ["Dev1", "Dev2"] - ) - assert test_result_list == "Dev1,Dev2" - test_result_list = _converters.convert_repeated_capabilities_without_prefix( - ["Dev1/0"] - ) - assert test_result_list == "Dev1/0" - test_result_list = _converters.convert_repeated_capabilities_without_prefix( - ["Dev1/0:1", "Dev2/0-1"] - ) - assert test_result_list == "Dev1/0:1,Dev2/0-1" - test_result_list = _converters.convert_repeated_capabilities_without_prefix( - ["Dev1", "Dev2/0-2"] - ) - assert test_result_list == "Dev1,Dev2/0-2" + test_result_list = _converters.convert_repeated_capabilities_without_prefix(['Dev1']) + assert test_result_list == 'Dev1' + test_result_list = _converters.convert_repeated_capabilities_without_prefix(['Dev1', 'Dev2']) + assert test_result_list == 'Dev1,Dev2' + test_result_list = _converters.convert_repeated_capabilities_without_prefix(['Dev1/0']) + assert test_result_list == 'Dev1/0' + test_result_list = _converters.convert_repeated_capabilities_without_prefix(['Dev1/0:1', 'Dev2/0-1']) + assert test_result_list == 'Dev1/0:1,Dev2/0-1' + test_result_list = _converters.convert_repeated_capabilities_without_prefix(['Dev1', 'Dev2/0-2']) + assert test_result_list == 'Dev1,Dev2/0-2' def test_repeated_capabilities_tuple_resource_name(): - test_result_list = _converters.convert_repeated_capabilities_without_prefix( - ("Dev1") - ) - assert test_result_list == "Dev1" - test_result_list = _converters.convert_repeated_capabilities_without_prefix( - ("Dev1", "Dev2") - ) - assert test_result_list == "Dev1,Dev2" - test_result_list = _converters.convert_repeated_capabilities_without_prefix( - ("Dev1/0") - ) - assert test_result_list == "Dev1/0" - test_result_list = _converters.convert_repeated_capabilities_without_prefix( - ("Dev1/0:1", "Dev2/0-1") - ) - assert test_result_list == "Dev1/0:1,Dev2/0-1" - test_result_list = _converters.convert_repeated_capabilities_without_prefix( - ("Dev1", "Dev2/0-2") - ) - assert test_result_list == "Dev1,Dev2/0-2" + test_result_list = _converters.convert_repeated_capabilities_without_prefix(('Dev1')) + assert test_result_list == 'Dev1' + test_result_list = _converters.convert_repeated_capabilities_without_prefix(('Dev1', 'Dev2')) + assert test_result_list == 'Dev1,Dev2' + test_result_list = _converters.convert_repeated_capabilities_without_prefix(('Dev1/0')) + assert test_result_list == 'Dev1/0' + test_result_list = _converters.convert_repeated_capabilities_without_prefix(('Dev1/0:1', 'Dev2/0-1')) + assert test_result_list == 'Dev1/0:1,Dev2/0-1' + test_result_list = _converters.convert_repeated_capabilities_without_prefix(('Dev1', 'Dev2/0-2')) + assert test_result_list == 'Dev1,Dev2/0-2' def test_repeated_capabilities_mixed_resource_name(): - test_result_list = _converters.convert_repeated_capabilities_without_prefix( - ["Dev1", ("Dev2/0", "Dev2/1"), ["Dev3/0:1", "Dev4/1:2"], "Dev5/1"] - ) - assert test_result_list == "Dev1,Dev2/0,Dev2/1,Dev3/0:1,Dev4/1:2,Dev5/1" + test_result_list = _converters.convert_repeated_capabilities_without_prefix(['Dev1', ('Dev2/0', 'Dev2/1'), ['Dev3/0:1', 'Dev4/1:2'], 'Dev5/1']) + assert test_result_list == 'Dev1,Dev2/0,Dev2/1,Dev3/0:1,Dev4/1:2,Dev5/1' def test_repeated_capabilities_invalid_resource_names(): - test_result_list = _converters.convert_repeated_capabilities_without_prefix("/") - assert test_result_list == "/" - test_result_list = _converters.convert_repeated_capabilities_without_prefix("Dev/") - assert test_result_list == "Dev/" - test_result_list = _converters.convert_repeated_capabilities_without_prefix("Dev,") - assert test_result_list == "Dev," - test_result_list = _converters.convert_repeated_capabilities_without_prefix( - "Dev/1/1," - ) - assert test_result_list == "Dev/1/1," - test_result_list = _converters.convert_repeated_capabilities_without_prefix( - "0/1:2," - ) - assert test_result_list == "0/1:2," + test_result_list = _converters.convert_repeated_capabilities_without_prefix('/') + assert test_result_list == '/' + test_result_list = _converters.convert_repeated_capabilities_without_prefix('Dev/') + assert test_result_list == 'Dev/' + test_result_list = _converters.convert_repeated_capabilities_without_prefix('Dev,') + assert test_result_list == 'Dev,' + test_result_list = _converters.convert_repeated_capabilities_without_prefix('Dev/1/1,') + assert test_result_list == 'Dev/1/1,' + test_result_list = _converters.convert_repeated_capabilities_without_prefix('0/1:2,') + assert test_result_list == '0/1:2,' def test_convert_chained_repeated_capability_to_parts_three_parts(): - chained_rep_cap = ( - "site0/test/PinA,site0/test/PinB,site0/test/PinC," - "site1/test/PinA,site1/test/PinB,site1/test/PinC" - ) - rep_cap_list = _converters.convert_chained_repeated_capability_to_parts( - chained_rep_cap - ) - assert rep_cap_list == ["site0,site1", "test", "PinA,PinB,PinC"] + chained_rep_cap = ('site0/test/PinA,site0/test/PinB,site0/test/PinC,' + 'site1/test/PinA,site1/test/PinB,site1/test/PinC') + rep_cap_list = _converters.convert_chained_repeated_capability_to_parts(chained_rep_cap) + assert rep_cap_list == ['site0,site1', 'test', 'PinA,PinB,PinC'] def test_convert_chained_repeated_capability_to_parts_single_part(): - rep_cap_list = _converters.convert_chained_repeated_capability_to_parts( - "site0, site1" - ) - assert rep_cap_list == ["site0,site1"] + rep_cap_list = _converters.convert_chained_repeated_capability_to_parts('site0, site1') + assert rep_cap_list == ['site0,site1'] def test_convert_chained_repeated_capability_to_parts_empty_string(): - rep_cap_list = _converters.convert_chained_repeated_capability_to_parts("") - assert rep_cap_list == [""] + rep_cap_list = _converters.convert_chained_repeated_capability_to_parts('') + assert rep_cap_list == [''] def test_string_to_list_channel(): - test_result = _converters._convert_repeated_capabilities("r0", "") - assert test_result == ["r0"] - test_result = _converters._convert_repeated_capabilities(["0-2"], "") - assert test_result == ["0", "1", "2"] - test_result = _converters._convert_repeated_capabilities(["3:7"], "") - assert test_result == ["3", "4", "5", "6", "7"] - test_result = _converters._convert_repeated_capabilities(["2-0"], "") - assert test_result == ["2", "1", "0"] - test_result = _converters._convert_repeated_capabilities(["2:0"], "") - assert test_result == ["2", "1", "0"] + test_result = _converters._convert_repeated_capabilities('r0', '') + assert test_result == ['r0'] + test_result = _converters._convert_repeated_capabilities(['0-2'], '') + assert test_result == ['0', '1', '2'] + test_result = _converters._convert_repeated_capabilities(['3:7'], '') + assert test_result == ['3', '4', '5', '6', '7'] + test_result = _converters._convert_repeated_capabilities(['2-0'], '') + assert test_result == ['2', '1', '0'] + test_result = _converters._convert_repeated_capabilities(['2:0'], '') + assert test_result == ['2', '1', '0'] def test_string_to_list_prefix(): - test_result = _converters._convert_repeated_capabilities( - ["ScriptTrigger3-ScriptTrigger7"], "ScriptTrigger" - ) - assert test_result == ["3", "4", "5", "6", "7"] - test_result = _converters._convert_repeated_capabilities( - ["ScriptTrigger3:ScriptTrigger7"], "ScriptTrigger" - ) - assert test_result == ["3", "4", "5", "6", "7"] - test_result = _converters._convert_repeated_capabilities( - ["ScriptTrigger2-ScriptTrigger0"], "ScriptTrigger" - ) - assert test_result == ["2", "1", "0"] - test_result = _converters._convert_repeated_capabilities( - ["ScriptTrigger2:ScriptTrigger0"], "ScriptTrigger" - ) - assert test_result == ["2", "1", "0"] + test_result = _converters._convert_repeated_capabilities(['ScriptTrigger3-ScriptTrigger7'], 'ScriptTrigger') + assert test_result == ['3', '4', '5', '6', '7'] + test_result = _converters._convert_repeated_capabilities(['ScriptTrigger3:ScriptTrigger7'], 'ScriptTrigger') + assert test_result == ['3', '4', '5', '6', '7'] + test_result = _converters._convert_repeated_capabilities(['ScriptTrigger2-ScriptTrigger0'], 'ScriptTrigger') + assert test_result == ['2', '1', '0'] + test_result = _converters._convert_repeated_capabilities(['ScriptTrigger2:ScriptTrigger0'], 'ScriptTrigger') + assert test_result == ['2', '1', '0'] def test_convert_comma_separated_string_to_list(): - out_list = _converters.convert_comma_separated_string_to_list( - " PinA , PinB , PinC " - ) - assert out_list == ["PinA", "PinB", "PinC"] + out_list = _converters.convert_comma_separated_string_to_list(' PinA , PinB , PinC ') + assert out_list == ['PinA', 'PinB', 'PinC'] diff --git a/generated/nifake/nifake/unit_tests/test_session.py b/generated/nifake/nifake/unit_tests/test_session.py index fd9688d38..1edc33d80 100644 --- a/generated/nifake/nifake/unit_tests/test_session.py +++ b/generated/nifake/nifake/unit_tests/test_session.py @@ -22,52 +22,35 @@ class TestSession(object): + def setup_method(self, method): - self.patched_library_patcher = patch("nifake._library.Library", autospec=True) + self.patched_library_patcher = patch('nifake._library.Library', autospec=True) self.patched_library = self.patched_library_patcher.start() - self.patched_library_singleton_get = patch( - "nifake.session._library_singleton.get", return_value=self.patched_library - ) + self.patched_library_singleton_get = patch('nifake.session._library_singleton.get', return_value=self.patched_library) self.patched_library_singleton_get.start() # We don't actually call into the nitclk DLL, but we do need to mock the function since it is called - self.tclk_patched_library_singleton_get = patch( - "nitclk.session._library_singleton.get", return_value=None - ) + self.tclk_patched_library_singleton_get = patch('nitclk.session._library_singleton.get', return_value=None) self.tclk_patched_library_singleton_get.start() self.side_effects_helper = _mock_helper.SideEffectsHelper() - self.side_effects_helper.set_side_effects_and_return_values( - self.patched_library - ) - self.patched_library.niFake_InitWithOptions.side_effect = ( - self.side_effects_helper.niFake_InitWithOptions - ) + self.side_effects_helper.set_side_effects_and_return_values(self.patched_library) + self.patched_library.niFake_InitWithOptions.side_effect = self.side_effects_helper.niFake_InitWithOptions self.disallow_close = self.patched_library.niFake_close.side_effect - self.patched_library.niFake_close.side_effect = ( - self.side_effects_helper.niFake_close - ) + self.patched_library.niFake_close.side_effect = self.side_effects_helper.niFake_close - self.side_effects_helper["InitWithOptions"]["vi"] = SESSION_NUM_FOR_TEST + self.side_effects_helper['InitWithOptions']['vi'] = SESSION_NUM_FOR_TEST self.get_ctypes_pointer_for_buffer_side_effect_count = 0 self.get_ctypes_pointer_for_buffer_side_effect_items = [] # Mock lock/unlock - self.LockSession_side_effect_cache = ( - self.patched_library.niFake_LockSession.side_effect - ) - self.patched_library.niFake_LockSession.side_effect = ( - self.side_effects_helper.niFake_LockSession - ) - self.side_effects_helper["LockSession"]["callerHasLock"] = True - self.UnlockSession_side_effect_cache = ( - self.patched_library.niFake_UnlockSession.side_effect - ) - self.patched_library.niFake_UnlockSession.side_effect = ( - self.side_effects_helper.niFake_UnlockSession - ) - self.side_effects_helper["UnlockSession"]["callerHasLock"] = False + self.LockSession_side_effect_cache = self.patched_library.niFake_LockSession.side_effect + self.patched_library.niFake_LockSession.side_effect = self.side_effects_helper.niFake_LockSession + self.side_effects_helper['LockSession']['callerHasLock'] = True + self.UnlockSession_side_effect_cache = self.patched_library.niFake_UnlockSession.side_effect + self.patched_library.niFake_UnlockSession.side_effect = self.side_effects_helper.niFake_UnlockSession + self.side_effects_helper['UnlockSession']['callerHasLock'] = False def teardown_method(self, method): self.patched_library_singleton_get.stop() @@ -79,92 +62,53 @@ def niFake_read_warning(self, vi, maximum_time, reading): # noqa: N802 return self.error_code_return def get_ctypes_pointer_for_buffer_side_effect(self, value, library_type=None): - ret_val = self.get_ctypes_pointer_for_buffer_side_effect_items[ - self.get_ctypes_pointer_for_buffer_side_effect_count - ] + ret_val = self.get_ctypes_pointer_for_buffer_side_effect_items[self.get_ctypes_pointer_for_buffer_side_effect_count] self.get_ctypes_pointer_for_buffer_side_effect_count += 1 return ret_val # Session management def test_init_with_options_and_close(self): - errors_patcher = patch( - "nifake.session.errors", spec_set=["handle_error", "_is_error"] - ) + errors_patcher = patch('nifake.session.errors', spec_set=['handle_error', '_is_error']) patched_errors = errors_patcher.start() patched_errors._is_error.return_value = 0 - session = nifake.Session("dev1") - self.patched_library.niFake_InitWithOptions.assert_called_once_with( - _matchers.ViStringMatcher("dev1"), - _matchers.ViBooleanMatcher(False), - _matchers.ViBooleanMatcher(False), - _matchers.ViStringMatcher(""), - _matchers.ViSessionPointerMatcher(), - ) - patched_errors.handle_error.assert_called_once_with( - session, - self.patched_library.niFake_InitWithOptions.return_value, - ignore_warnings=False, - is_error_handling=False, - ) + session = nifake.Session('dev1') + self.patched_library.niFake_InitWithOptions.assert_called_once_with(_matchers.ViStringMatcher('dev1'), _matchers.ViBooleanMatcher(False), _matchers.ViBooleanMatcher(False), _matchers.ViStringMatcher(''), _matchers.ViSessionPointerMatcher()) + patched_errors.handle_error.assert_called_once_with(session, self.patched_library.niFake_InitWithOptions.return_value, ignore_warnings=False, is_error_handling=False) session.close() - self.patched_library.niFake_close.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) - ) + self.patched_library.niFake_close.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) errors_patcher.stop() def test_init_with_options_nondefault_and_close(self): - session = nifake.Session("FakeDevice", "Some string", True, True) - self.patched_library.niFake_InitWithOptions.assert_called_once_with( - _matchers.ViStringMatcher("FakeDevice"), - _matchers.ViBooleanMatcher(True), - _matchers.ViBooleanMatcher(True), - _matchers.ViStringMatcher("Some string"), - _matchers.ViSessionPointerMatcher(), - ) + session = nifake.Session('FakeDevice', 'Some string', True, True) + self.patched_library.niFake_InitWithOptions.assert_called_once_with(_matchers.ViStringMatcher('FakeDevice'), _matchers.ViBooleanMatcher(True), _matchers.ViBooleanMatcher(True), _matchers.ViStringMatcher('Some string'), _matchers.ViSessionPointerMatcher()) session.close() - self.patched_library.niFake_close.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) - ) + self.patched_library.niFake_close.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) def test_close(self): - session = nifake.Session("dev1") + session = nifake.Session('dev1') session.close() - self.patched_library.niFake_close.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) - ) + self.patched_library.niFake_close.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) def test_session_context_manager(self): - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: assert type(session) == nifake.Session - self.patched_library.niFake_InitWithOptions.assert_called_once_with( - _matchers.ViStringMatcher("dev1"), - _matchers.ViBooleanMatcher(False), - _matchers.ViBooleanMatcher(False), - _matchers.ViStringMatcher(""), - _matchers.ViSessionPointerMatcher(), - ) - self.patched_library.niFake_close.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) - ) + self.patched_library.niFake_InitWithOptions.assert_called_once_with(_matchers.ViStringMatcher('dev1'), _matchers.ViBooleanMatcher(False), _matchers.ViBooleanMatcher(False), _matchers.ViStringMatcher(''), _matchers.ViSessionPointerMatcher()) + self.patched_library.niFake_close.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) def test_init_with_error(self): test_error_code = -1 - test_error_desc = "Test" - self.patched_library.niFake_InitWithOptions.side_effect = ( - self.side_effects_helper.niFake_InitWithOptions - ) - self.side_effects_helper["InitWithOptions"]["return"] = test_error_code - self.side_effects_helper["InitWithOptions"]["vi"] = SESSION_NUM_FOR_TEST - self.patched_library.niFake_GetError.side_effect = ( - self.side_effects_helper.niFake_GetError - ) - self.side_effects_helper["GetError"]["errorCode"] = test_error_code - self.side_effects_helper["GetError"]["description"] = test_error_desc + test_error_desc = 'Test' + self.patched_library.niFake_InitWithOptions.side_effect = self.side_effects_helper.niFake_InitWithOptions + self.side_effects_helper['InitWithOptions']['return'] = test_error_code + self.side_effects_helper['InitWithOptions']['vi'] = SESSION_NUM_FOR_TEST + self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError + self.side_effects_helper['GetError']['errorCode'] = test_error_code + self.side_effects_helper['GetError']['description'] = test_error_desc try: - nifake.Session("dev1") + nifake.Session('dev1') assert False except nifake.Error as e: assert e.code == test_error_code @@ -172,17 +116,13 @@ def test_init_with_error(self): def test_close_with_error(self): test_error_code = -1 - test_error_desc = "Test" - self.patched_library.niFake_close.side_effect = ( - self.side_effects_helper.niFake_close - ) - session = nifake.Session("dev1") - self.side_effects_helper["close"]["return"] = test_error_code - self.patched_library.niFake_GetError.side_effect = ( - self.side_effects_helper.niFake_GetError - ) - self.side_effects_helper["GetError"]["errorCode"] = test_error_code - self.side_effects_helper["GetError"]["description"] = test_error_desc + test_error_desc = 'Test' + self.patched_library.niFake_close.side_effect = self.side_effects_helper.niFake_close + session = nifake.Session('dev1') + self.side_effects_helper['close']['return'] = test_error_code + self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError + self.side_effects_helper['GetError']['errorCode'] = test_error_code + self.side_effects_helper['GetError']['description'] = test_error_desc try: session.close() assert False @@ -190,25 +130,19 @@ def test_close_with_error(self): assert e.code == test_error_code assert e.description == test_error_desc assert session._vi == 0 - self.patched_library.niFake_close.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) - ) + self.patched_library.niFake_close.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) def test_session_context_manager_init_with_error(self): test_error_code = -1 - test_error_desc = "Test" - self.patched_library.niFake_InitWithOptions.side_effect = ( - self.side_effects_helper.niFake_InitWithOptions - ) - self.side_effects_helper["InitWithOptions"]["return"] = test_error_code - self.side_effects_helper["InitWithOptions"]["vi"] = SESSION_NUM_FOR_TEST - self.patched_library.niFake_GetError.side_effect = ( - self.side_effects_helper.niFake_GetError - ) - self.side_effects_helper["GetError"]["errorCode"] = test_error_code - self.side_effects_helper["GetError"]["description"] = test_error_desc + test_error_desc = 'Test' + self.patched_library.niFake_InitWithOptions.side_effect = self.side_effects_helper.niFake_InitWithOptions + self.side_effects_helper['InitWithOptions']['return'] = test_error_code + self.side_effects_helper['InitWithOptions']['vi'] = SESSION_NUM_FOR_TEST + self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError + self.side_effects_helper['GetError']['errorCode'] = test_error_code + self.side_effects_helper['GetError']['description'] = test_error_desc try: - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: assert type(session) == nifake.Session assert False except nifake.Error as e: @@ -217,18 +151,14 @@ def test_session_context_manager_init_with_error(self): def test_session_context_manager_close_with_error(self): test_error_code = -1 - test_error_desc = "Test" - self.patched_library.niFake_close.side_effect = ( - self.side_effects_helper.niFake_close - ) - self.side_effects_helper["close"]["return"] = test_error_code - self.patched_library.niFake_GetError.side_effect = ( - self.side_effects_helper.niFake_GetError - ) - self.side_effects_helper["GetError"]["errorCode"] = test_error_code - self.side_effects_helper["GetError"]["description"] = test_error_desc + test_error_desc = 'Test' + self.patched_library.niFake_close.side_effect = self.side_effects_helper.niFake_close + self.side_effects_helper['close']['return'] = test_error_code + self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError + self.side_effects_helper['GetError']['errorCode'] = test_error_code + self.side_effects_helper['GetError']['description'] = test_error_desc try: - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: assert type(session) == nifake.Session assert False except nifake.Error as e: @@ -237,74 +167,54 @@ def test_session_context_manager_close_with_error(self): # Session locking def test_lock_session_none(self): - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: session.lock() - self.patched_library.niFake_LockSession.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None - ) + self.patched_library.niFake_LockSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None) def test_unlock_session_none(self): - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: session.unlock() - self.patched_library.niFake_UnlockSession.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None - ) + self.patched_library.niFake_UnlockSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None) def test_lock_context_manager(self): - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: with session.lock(): pass - self.patched_library.niFake_LockSession.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None - ) - self.patched_library.niFake_UnlockSession.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None - ) + self.patched_library.niFake_LockSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None) + self.patched_library.niFake_UnlockSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None) def test_lock_context_manager_abnormal_exit(self): - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: try: with session.lock(): - raise nifake.Error("Fake exception") + raise nifake.Error('Fake exception') except nifake.Error: pass - self.patched_library.niFake_LockSession.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None - ) - self.patched_library.niFake_UnlockSession.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None - ) + self.patched_library.niFake_LockSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None) + self.patched_library.niFake_UnlockSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), None) # Methods def test_simple_function(self): - self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = ( - self.side_effects_helper.niFake_PoorlyNamedSimpleFunction - ) - with nifake.Session("dev1") as session: + self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = self.side_effects_helper.niFake_PoorlyNamedSimpleFunction + with nifake.Session('dev1') as session: session.simple_function() - self.patched_library.niFake_PoorlyNamedSimpleFunction.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) - ) + self.patched_library.niFake_PoorlyNamedSimpleFunction.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) def test_self_test(self): - self.patched_library.niFake_self_test.side_effect = ( - self.side_effects_helper.niFake_self_test - ) + self.patched_library.niFake_self_test.side_effect = self.side_effects_helper.niFake_self_test test_error_code = 0 - self.side_effects_helper["self_test"]["selfTestResult"] = test_error_code - self.side_effects_helper["self_test"]["selfTestMessage"] = "" - with nifake.Session("dev1") as session: + self.side_effects_helper['self_test']['selfTestResult'] = test_error_code + self.side_effects_helper['self_test']['selfTestMessage'] = '' + with nifake.Session('dev1') as session: session.self_test() def test_self_test_fail(self): - self.patched_library.niFake_self_test.side_effect = ( - self.side_effects_helper.niFake_self_test - ) + self.patched_library.niFake_self_test.side_effect = self.side_effects_helper.niFake_self_test test_error_code = 1 - test_error_message = "error message" - self.side_effects_helper["self_test"]["selfTestResult"] = test_error_code - self.side_effects_helper["self_test"]["selfTestMessage"] = test_error_message - with nifake.Session("dev1") as session: + test_error_message = 'error message' + self.side_effects_helper['self_test']['selfTestResult'] = test_error_code + self.side_effects_helper['self_test']['selfTestMessage'] = test_error_message + with nifake.Session('dev1') as session: try: session.self_test() assert False @@ -314,279 +224,160 @@ def test_self_test_fail(self): def test_get_a_number(self): test_number = 16 - self.patched_library.niFake_GetANumber.side_effect = ( - self.side_effects_helper.niFake_GetANumber - ) - self.side_effects_helper["GetANumber"]["aNumber"] = test_number - with nifake.Session("dev1") as session: + self.patched_library.niFake_GetANumber.side_effect = self.side_effects_helper.niFake_GetANumber + self.side_effects_helper['GetANumber']['aNumber'] = test_number + with nifake.Session('dev1') as session: test_result = session.get_a_number() assert isinstance(test_result, int) assert test_result == test_number - self.patched_library.niFake_GetANumber.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt16PointerMatcher(), - ) + self.patched_library.niFake_GetANumber.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt16PointerMatcher()) def test_one_input_function(self): test_number = 1 - self.patched_library.niFake_OneInputFunction.side_effect = ( - self.side_effects_helper.niFake_OneInputFunction - ) - with nifake.Session("dev1") as session: + self.patched_library.niFake_OneInputFunction.side_effect = self.side_effects_helper.niFake_OneInputFunction + with nifake.Session('dev1') as session: session.one_input_function(test_number) - self.patched_library.niFake_OneInputFunction.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt32Matcher(test_number), - ) + self.patched_library.niFake_OneInputFunction.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(test_number)) def test_vi_int_64_function(self): input_value = 1099511627776 # 2^40 output_value = 2199023255552 # 2^41 - self.patched_library.niFake_Use64BitNumber.side_effect = ( - self.side_effects_helper.niFake_Use64BitNumber - ) - self.side_effects_helper["Use64BitNumber"]["output"] = output_value - with nifake.Session("dev1") as session: + self.patched_library.niFake_Use64BitNumber.side_effect = self.side_effects_helper.niFake_Use64BitNumber + self.side_effects_helper['Use64BitNumber']['output'] = output_value + with nifake.Session('dev1') as session: assert session.use64_bit_number(input_value) == output_value - self.patched_library.niFake_Use64BitNumber.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt64Matcher(input_value), - _matchers.ViInt64PointerMatcher(), - ) + self.patched_library.niFake_Use64BitNumber.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt64Matcher(input_value), _matchers.ViInt64PointerMatcher()) def test_two_input_function(self): test_number = 1.5 - test_string = "test" - self.patched_library.niFake_TwoInputFunction.side_effect = ( - self.side_effects_helper.niFake_TwoInputFunction - ) - with nifake.Session("dev1") as session: + test_string = 'test' + self.patched_library.niFake_TwoInputFunction.side_effect = self.side_effects_helper.niFake_TwoInputFunction + with nifake.Session('dev1') as session: session.two_input_function(test_number, test_string) - self.patched_library.niFake_TwoInputFunction.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViReal64Matcher(test_number), - _matchers.ViStringMatcher(test_string), - ) + self.patched_library.niFake_TwoInputFunction.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViReal64Matcher(test_number), _matchers.ViStringMatcher(test_string)) def test_get_enum_value(self): test_number = 1 test_turtle = nifake.Turtle.LEONARDO - self.patched_library.niFake_GetEnumValue.side_effect = ( - self.side_effects_helper.niFake_GetEnumValue - ) - self.side_effects_helper["GetEnumValue"]["aQuantity"] = test_number - self.side_effects_helper["GetEnumValue"]["aTurtle"] = 0 - with nifake.Session("dev1") as session: + self.patched_library.niFake_GetEnumValue.side_effect = self.side_effects_helper.niFake_GetEnumValue + self.side_effects_helper['GetEnumValue']['aQuantity'] = test_number + self.side_effects_helper['GetEnumValue']['aTurtle'] = 0 + with nifake.Session('dev1') as session: test_result_number, test_result_enum = session.get_enum_value() assert isinstance(test_result_number, int) assert test_result_number == test_number assert isinstance(test_result_enum, nifake.Turtle) assert test_result_enum == test_turtle - self.patched_library.niFake_GetEnumValue.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt32PointerMatcher(), - _matchers.ViInt16PointerMatcher(), - ) + self.patched_library.niFake_GetEnumValue.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32PointerMatcher(), _matchers.ViInt16PointerMatcher()) def test_get_a_list_enums(self): - self.patched_library.niFake_EnumArrayOutputFunction.side_effect = ( - self.side_effects_helper.niFake_EnumArrayOutputFunction - ) + self.patched_library.niFake_EnumArrayOutputFunction.side_effect = self.side_effects_helper.niFake_EnumArrayOutputFunction test_list = [1, 1, 0] - self.side_effects_helper["EnumArrayOutputFunction"]["anArray"] = test_list - with nifake.Session("dev1") as session: + self.side_effects_helper['EnumArrayOutputFunction']['anArray'] = test_list + with nifake.Session('dev1') as session: test_result = session.enum_array_output_function(len(test_list)) assert len(test_list) == len(test_result) for expected_value, actual_value in zip(test_list, test_result): assert isinstance(actual_value, nifake.Turtle) assert actual_value.value == expected_value - self.patched_library.niFake_EnumArrayOutputFunction.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt32Matcher(len(test_list)), - _matchers.ViInt16BufferMatcher(len(test_list)), - ) + self.patched_library.niFake_EnumArrayOutputFunction.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(test_list)), _matchers.ViInt16BufferMatcher(len(test_list))) def test_get_a_boolean(self): - self.patched_library.niFake_GetABoolean.side_effect = ( - self.side_effects_helper.niFake_GetABoolean - ) - self.side_effects_helper["GetABoolean"]["aBoolean"] = 1 - with nifake.Session("dev1") as session: + self.patched_library.niFake_GetABoolean.side_effect = self.side_effects_helper.niFake_GetABoolean + self.side_effects_helper['GetABoolean']['aBoolean'] = 1 + with nifake.Session('dev1') as session: test_result = session.get_a_boolean() assert isinstance(test_result, bool) assert test_result - self.patched_library.niFake_GetABoolean.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViBooleanPointerMatcher(), - ) + self.patched_library.niFake_GetABoolean.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViBooleanPointerMatcher()) def test_get_a_list_booleans(self): - self.patched_library.niFake_BoolArrayOutputFunction.side_effect = ( - self.side_effects_helper.niFake_BoolArrayOutputFunction - ) + self.patched_library.niFake_BoolArrayOutputFunction.side_effect = self.side_effects_helper.niFake_BoolArrayOutputFunction test_list = [1, 1, 0] - self.side_effects_helper["BoolArrayOutputFunction"]["anArray"] = test_list - with nifake.Session("dev1") as session: + self.side_effects_helper['BoolArrayOutputFunction']['anArray'] = test_list + with nifake.Session('dev1') as session: test_result = session.bool_array_output_function(len(test_list)) assert len(test_list) == len(test_result) for expected_value, actual_value in zip(test_list, test_result): assert isinstance(actual_value, bool) assert actual_value == bool(expected_value) - self.patched_library.niFake_BoolArrayOutputFunction.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt32Matcher(len(test_list)), - _matchers.ViBooleanBufferMatcher(len(test_list)), - ) + self.patched_library.niFake_BoolArrayOutputFunction.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(test_list)), _matchers.ViBooleanBufferMatcher(len(test_list))) def test_acquisition_context_manager(self): - self.patched_library.niFake_Initiate.side_effect = ( - self.side_effects_helper.niFake_Initiate - ) - self.patched_library.niFake_Abort.side_effect = ( - self.side_effects_helper.niFake_Abort - ) - with nifake.Session("dev1") as session: + self.patched_library.niFake_Initiate.side_effect = self.side_effects_helper.niFake_Initiate + self.patched_library.niFake_Abort.side_effect = self.side_effects_helper.niFake_Abort + with nifake.Session('dev1') as session: with session.initiate(): - self.patched_library.niFake_Initiate.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) - ) - self.patched_library.niFake_Abort.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) - ) - self.patched_library.niFake_close.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) - ) + self.patched_library.niFake_Initiate.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) + self.patched_library.niFake_Abort.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) + self.patched_library.niFake_close.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) def test_acquisition_no_context_manager(self): - self.patched_library.niFake_Initiate.side_effect = ( - self.side_effects_helper.niFake_Initiate - ) - self.patched_library.niFake_Abort.side_effect = ( - self.side_effects_helper.niFake_Abort - ) - with nifake.Session("dev1") as session: + self.patched_library.niFake_Initiate.side_effect = self.side_effects_helper.niFake_Initiate + self.patched_library.niFake_Abort.side_effect = self.side_effects_helper.niFake_Abort + with nifake.Session('dev1') as session: session.initiate() - self.patched_library.niFake_Initiate.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) - ) + self.patched_library.niFake_Initiate.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) session.abort() - self.patched_library.niFake_Abort.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) - ) - self.patched_library.niFake_close.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) - ) + self.patched_library.niFake_Abort.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) + self.patched_library.niFake_close.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) def test_single_point_read_timedelta(self): - test_maximum_time_ns = 1 # nanoseconds + test_maximum_time_ns = 1 # nanoseconds test_maximum_time_s = 1e-9 # seconds - test_maximum_time_timedelta = hightime.timedelta( - nanoseconds=test_maximum_time_ns - ) + test_maximum_time_timedelta = hightime.timedelta(nanoseconds=test_maximum_time_ns) test_reading = 5 - self.patched_library.niFake_Read.side_effect = ( - self.side_effects_helper.niFake_Read - ) - self.side_effects_helper["Read"]["reading"] = test_reading - with nifake.Session("dev1") as session: + self.patched_library.niFake_Read.side_effect = self.side_effects_helper.niFake_Read + self.side_effects_helper['Read']['reading'] = test_reading + with nifake.Session('dev1') as session: assert test_reading == session.read(test_maximum_time_timedelta) - self.patched_library.niFake_Read.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViReal64Matcher(test_maximum_time_s), - _matchers.ViReal64PointerMatcher(), - ) + self.patched_library.niFake_Read.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViReal64Matcher(test_maximum_time_s), _matchers.ViReal64PointerMatcher()) def test_single_point_read_nan(self): test_maximum_time_s = 10.0 test_maximum_time = hightime.timedelta(seconds=test_maximum_time_s) - test_reading = float("NaN") - self.patched_library.niFake_Read.side_effect = ( - self.side_effects_helper.niFake_Read - ) - self.side_effects_helper["Read"]["reading"] = test_reading - with nifake.Session("dev1") as session: + test_reading = float('NaN') + self.patched_library.niFake_Read.side_effect = self.side_effects_helper.niFake_Read + self.side_effects_helper['Read']['reading'] = test_reading + with nifake.Session('dev1') as session: assert math.isnan(session.read(test_maximum_time)) def test_enum_input_function_with_defaults(self): test_turtle = nifake.Turtle.DONATELLO - self.patched_library.niFake_EnumInputFunctionWithDefaults.side_effect = ( - self.side_effects_helper.niFake_EnumInputFunctionWithDefaults - ) - with nifake.Session("dev1") as session: + self.patched_library.niFake_EnumInputFunctionWithDefaults.side_effect = self.side_effects_helper.niFake_EnumInputFunctionWithDefaults + with nifake.Session('dev1') as session: session.enum_input_function_with_defaults() session.enum_input_function_with_defaults(test_turtle) from unittest.mock import call - - calls = [ - call( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt16Matcher(0), - ), - call( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt16Matcher(1), - ), - ] # 0 is the value of the default of nifake.Turtle.LEONARDO, 1 is the value of nifake.Turtle.DONATELLO - self.patched_library.niFake_EnumInputFunctionWithDefaults.assert_has_calls( - calls - ) + calls = [call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt16Matcher(0)), call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt16Matcher(1))] # 0 is the value of the default of nifake.Turtle.LEONARDO, 1 is the value of nifake.Turtle.DONATELLO + self.patched_library.niFake_EnumInputFunctionWithDefaults.assert_has_calls(calls) def test_string_valued_enum_input_function_with_defaults(self): test_mobile_os_name = nifake.MobileOSNames.IOS - self.patched_library.niFake_StringValuedEnumInputFunctionWithDefaults.side_effect = ( - self.side_effects_helper.niFake_StringValuedEnumInputFunctionWithDefaults - ) - with nifake.Session("dev1") as session: + self.patched_library.niFake_StringValuedEnumInputFunctionWithDefaults.side_effect = self.side_effects_helper.niFake_StringValuedEnumInputFunctionWithDefaults + with nifake.Session('dev1') as session: session.string_valued_enum_input_function_with_defaults() session.string_valued_enum_input_function_with_defaults(test_mobile_os_name) from unittest.mock import call - - calls = [ - call( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher("Android"), - ), - call( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher("iOS"), - ), - ] # 'ANDROID' is the value of the default of nifake.MobileOSNames.Android, 'iOS' is the value of nifake.MobileOSNames.IOS - self.patched_library.niFake_StringValuedEnumInputFunctionWithDefaults.assert_has_calls( - calls - ) + calls = [call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher('Android')), call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher('iOS'))] # 'ANDROID' is the value of the default of nifake.MobileOSNames.Android, 'iOS' is the value of nifake.MobileOSNames.IOS + self.patched_library.niFake_StringValuedEnumInputFunctionWithDefaults.assert_has_calls(calls) def test_fetch_waveform(self): - expected_waveform_list = [1.0, 0.1, 42, 0.42] - self.patched_library.niFake_FetchWaveform.side_effect = ( - self.side_effects_helper.niFake_FetchWaveform - ) - self.side_effects_helper["FetchWaveform"][ - "waveformData" - ] = expected_waveform_list - self.side_effects_helper["FetchWaveform"]["actualNumberOfSamples"] = len( - expected_waveform_list - ) + expected_waveform_list = [1.0, 0.1, 42, .42] + self.patched_library.niFake_FetchWaveform.side_effect = self.side_effects_helper.niFake_FetchWaveform + self.side_effects_helper['FetchWaveform']['waveformData'] = expected_waveform_list + self.side_effects_helper['FetchWaveform']['actualNumberOfSamples'] = len(expected_waveform_list) # Because we are mocking get_ctypes_pointer_for_buffer() we don't end up using the array allocated in the function call. Instead, we will allocate the arrays here # and have the mock return them. These are the ones that are actually filled in by the function. - expected_waveform = array.array("d", [0] * len(expected_waveform_list)) - expected_waveform_ctypes = ctypes.cast( - expected_waveform.buffer_info()[0], - ctypes.POINTER(nifake._visatype.ViReal64 * len(expected_waveform_list)), - ) - - with nifake.Session("dev1") as session: - self.get_ctypes_pointer_for_buffer_side_effect_items = [ - expected_waveform_ctypes - ] + expected_waveform = array.array('d', [0] * len(expected_waveform_list)) + expected_waveform_ctypes = ctypes.cast(expected_waveform.buffer_info()[0], ctypes.POINTER(nifake._visatype.ViReal64 * len(expected_waveform_list))) + + with nifake.Session('dev1') as session: + self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_waveform_ctypes] self.get_ctypes_pointer_for_buffer_side_effect_count = 0 - self.patched_library.niFake_WriteWaveform.side_effect = ( - self.side_effects_helper.niFake_WriteWaveform - ) - with patch( - "nifake.session.get_ctypes_pointer_for_buffer", - side_effect=self.get_ctypes_pointer_for_buffer_side_effect, - ): + self.patched_library.niFake_WriteWaveform.side_effect = self.side_effects_helper.niFake_WriteWaveform + with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect): # Because we have mocked away get_ctypes_pointer_for_buffer(), we ignore the return values here and look at our already allocated arrays to make # sure they are filled in correctly session.fetch_waveform(len(expected_waveform_list)) @@ -594,36 +385,22 @@ def test_fetch_waveform(self): assert len(expected_waveform) == len(expected_waveform_list) for i in range(len(expected_waveform)): assert expected_waveform[i] == expected_waveform_list[i] - self.patched_library.niFake_FetchWaveform.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt32Matcher(len(expected_waveform)), - _matchers.ViReal64BufferMatcher(expected_waveform), - _matchers.ViInt32PointerMatcher(), - ) + self.patched_library.niFake_FetchWaveform.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(expected_waveform)), _matchers.ViReal64BufferMatcher(expected_waveform), _matchers.ViInt32PointerMatcher()) def test_fetch_waveform_into(self): - expected_waveform = [1.0, 0.1, 42, 0.42] - self.patched_library.niFake_FetchWaveform.side_effect = ( - self.side_effects_helper.niFake_FetchWaveform - ) - self.side_effects_helper["FetchWaveform"]["waveformData"] = expected_waveform - self.side_effects_helper["FetchWaveform"]["actualNumberOfSamples"] = len( - expected_waveform - ) - with nifake.Session("dev1") as session: + expected_waveform = [1.0, 0.1, 42, .42] + self.patched_library.niFake_FetchWaveform.side_effect = self.side_effects_helper.niFake_FetchWaveform + self.side_effects_helper['FetchWaveform']['waveformData'] = expected_waveform + self.side_effects_helper['FetchWaveform']['actualNumberOfSamples'] = len(expected_waveform) + with nifake.Session('dev1') as session: waveform = numpy.empty(len(expected_waveform), numpy.float64) session.fetch_waveform_into(waveform) assert numpy.array_equal(waveform, expected_waveform) - self.patched_library.niFake_FetchWaveform.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt32Matcher(len(expected_waveform)), - _matchers.ViReal64BufferMatcher(expected_waveform), - _matchers.ViInt32PointerMatcher(), - ) + self.patched_library.niFake_FetchWaveform.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(expected_waveform)), _matchers.ViReal64BufferMatcher(expected_waveform), _matchers.ViInt32PointerMatcher()) def test_fetch_waveform_into_wrong_type(self): length = 10 - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: waveforms = [ 10, 10.5, @@ -631,7 +408,7 @@ def test_fetch_waveform_into_wrong_type(self): range(length), [i + 0.0 for i in range(length)], numpy.empty(length, numpy.int32), - numpy.empty(length, numpy.uint8), + numpy.empty(length, numpy.uint8) ] for w in waveforms: try: @@ -642,41 +419,24 @@ def test_fetch_waveform_into_wrong_type(self): def test_write_waveform(self): expected_waveform = [1.1, 2.2, 3.3, 4.4] - expected_array = array.array("d", expected_waveform) - with nifake.Session("dev1") as session: + expected_array = array.array('d', expected_waveform) + with nifake.Session('dev1') as session: self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_waveform] self.get_ctypes_pointer_for_buffer_side_effect_count = 0 - self.patched_library.niFake_WriteWaveform.side_effect = ( - self.side_effects_helper.niFake_WriteWaveform - ) - with patch( - "nifake.session.get_ctypes_pointer_for_buffer", - side_effect=self.get_ctypes_pointer_for_buffer_side_effect, - ): + self.patched_library.niFake_WriteWaveform.side_effect = self.side_effects_helper.niFake_WriteWaveform + with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect): session.write_waveform(expected_array) - self.patched_library.niFake_WriteWaveform.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt32Matcher(len(expected_waveform)), - _matchers.ViReal64BufferMatcher(expected_array), - ) + self.patched_library.niFake_WriteWaveform.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(expected_waveform)), _matchers.ViReal64BufferMatcher(expected_array)) def test_write_waveform_numpy(self): - expected_waveform = numpy.array([1.1, 2.2, 3.3, 4.4], order="C") - self.patched_library.niFake_WriteWaveform.side_effect = ( - self.side_effects_helper.niFake_WriteWaveform - ) - with nifake.Session("dev1") as session: + expected_waveform = numpy.array([1.1, 2.2, 3.3, 4.4], order='C') + self.patched_library.niFake_WriteWaveform.side_effect = self.side_effects_helper.niFake_WriteWaveform + with nifake.Session('dev1') as session: session.write_waveform_numpy(expected_waveform) - self.patched_library.niFake_WriteWaveform.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt32Matcher(len(expected_waveform)), - _matchers.ViReal64BufferMatcher(expected_waveform), - ) + self.patched_library.niFake_WriteWaveform.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(expected_waveform)), _matchers.ViReal64BufferMatcher(expected_waveform)) def test_return_multiple_types(self): - self.patched_library.niFake_ReturnMultipleTypes.side_effect = ( - self.side_effects_helper.niFake_ReturnMultipleTypes - ) + self.patched_library.niFake_ReturnMultipleTypes.side_effect = self.side_effects_helper.niFake_ReturnMultipleTypes boolean_val = True int32_val = 32 int64_val = 6000000000 @@ -685,30 +445,19 @@ def test_return_multiple_types(self): float_enum_val = nifake.FloatEnum.SIX_POINT_FIVE array_val = [0, 1, 2] array_size = len(array_val) - string_val = "Testing is fun?" - self.side_effects_helper["ReturnMultipleTypes"]["return"] = len(string_val) - self.side_effects_helper["ReturnMultipleTypes"]["aBoolean"] = boolean_val - self.side_effects_helper["ReturnMultipleTypes"]["anInt32"] = int32_val - self.side_effects_helper["ReturnMultipleTypes"]["anInt64"] = int64_val - self.side_effects_helper["ReturnMultipleTypes"]["anIntEnum"] = enum_val.value - self.side_effects_helper["ReturnMultipleTypes"]["aFloat"] = float_val - self.side_effects_helper["ReturnMultipleTypes"][ - "aFloatEnum" - ] = float_enum_val.value - self.side_effects_helper["ReturnMultipleTypes"]["anArray"] = array_val - self.side_effects_helper["ReturnMultipleTypes"]["aString"] = string_val - self.side_effects_helper["ReturnMultipleTypes"]["return"] = 0 - with nifake.Session("dev1") as session: - ( - result_boolean, - result_int32, - result_int64, - result_enum, - result_float, - result_float_enum, - result_array, - result_string, - ) = session.return_multiple_types(array_size) + string_val = 'Testing is fun?' + self.side_effects_helper['ReturnMultipleTypes']['return'] = len(string_val) + self.side_effects_helper['ReturnMultipleTypes']['aBoolean'] = boolean_val + self.side_effects_helper['ReturnMultipleTypes']['anInt32'] = int32_val + self.side_effects_helper['ReturnMultipleTypes']['anInt64'] = int64_val + self.side_effects_helper['ReturnMultipleTypes']['anIntEnum'] = enum_val.value + self.side_effects_helper['ReturnMultipleTypes']['aFloat'] = float_val + self.side_effects_helper['ReturnMultipleTypes']['aFloatEnum'] = float_enum_val.value + self.side_effects_helper['ReturnMultipleTypes']['anArray'] = array_val + self.side_effects_helper['ReturnMultipleTypes']['aString'] = string_val + self.side_effects_helper['ReturnMultipleTypes']['return'] = 0 + with nifake.Session('dev1') as session: + result_boolean, result_int32, result_int64, result_enum, result_float, result_float_enum, result_array, result_string = session.return_multiple_types(array_size) assert result_boolean == boolean_val assert isinstance(result_boolean, bool) assert result_int32 == int32_val @@ -729,85 +478,58 @@ def test_return_multiple_types(self): assert self.patched_library.niFake_ReturnMultipleTypes.call_count == 2 def test_multiple_array_types(self): - self.patched_library.niFake_MultipleArrayTypes.side_effect = ( - self.side_effects_helper.niFake_MultipleArrayTypes - ) + self.patched_library.niFake_MultipleArrayTypes.side_effect = self.side_effects_helper.niFake_MultipleArrayTypes expected_output_array = [0.2, 0.4] expected_output_array_of_fixed_length = [-6, -7, -8] output_array_size = len(expected_output_array) input_array_of_integers = [1, 2] input_array_of_floats = [-1.0, -2.0] - self.side_effects_helper["MultipleArrayTypes"][ - "outputArray" - ] = expected_output_array - self.side_effects_helper["MultipleArrayTypes"][ - "outputArrayOfFixedLength" - ] = expected_output_array_of_fixed_length - with nifake.Session("dev1") as session: - output_array, output_array_of_fixed_length = session.multiple_array_types( - output_array_size, input_array_of_floats, input_array_of_integers - ) + self.side_effects_helper['MultipleArrayTypes']['outputArray'] = expected_output_array + self.side_effects_helper['MultipleArrayTypes']['outputArrayOfFixedLength'] = expected_output_array_of_fixed_length + with nifake.Session('dev1') as session: + output_array, output_array_of_fixed_length = session.multiple_array_types(output_array_size, input_array_of_floats, input_array_of_integers) assert output_array == output_array assert expected_output_array_of_fixed_length == output_array_of_fixed_length self.patched_library.niFake_MultipleArrayTypes.assert_called_once_with( _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(output_array_size), _matchers.ViReal64BufferMatcher(output_array_size), - _matchers.ViReal64BufferMatcher( - len(expected_output_array_of_fixed_length) - ), + _matchers.ViReal64BufferMatcher(len(expected_output_array_of_fixed_length)), _matchers.ViInt32Matcher(len(input_array_of_integers)), _matchers.ViReal64BufferMatcher(input_array_of_floats), _matchers.ViInt16BufferMatcher(input_array_of_integers), ) def test_multiple_array_types_none_input(self): - self.patched_library.niFake_MultipleArrayTypes.side_effect = ( - self.side_effects_helper.niFake_MultipleArrayTypes - ) + self.patched_library.niFake_MultipleArrayTypes.side_effect = self.side_effects_helper.niFake_MultipleArrayTypes expected_output_array = [0.2, 0.4] expected_output_array_of_fixed_length = [-6, -7, -8] output_array_size = len(expected_output_array) input_array_of_floats = [0.1, 0.2] - self.side_effects_helper["MultipleArrayTypes"][ - "outputArray" - ] = expected_output_array - self.side_effects_helper["MultipleArrayTypes"][ - "outputArrayOfFixedLength" - ] = expected_output_array_of_fixed_length - with nifake.Session("dev1") as session: - output_array, output_array_of_fixed_length = session.multiple_array_types( - output_array_size, input_array_of_floats - ) + self.side_effects_helper['MultipleArrayTypes']['outputArray'] = expected_output_array + self.side_effects_helper['MultipleArrayTypes']['outputArrayOfFixedLength'] = expected_output_array_of_fixed_length + with nifake.Session('dev1') as session: + output_array, output_array_of_fixed_length = session.multiple_array_types(output_array_size, input_array_of_floats) assert output_array == output_array assert expected_output_array_of_fixed_length == output_array_of_fixed_length self.patched_library.niFake_MultipleArrayTypes.assert_called_once_with( _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(output_array_size), _matchers.ViReal64BufferMatcher(output_array_size), - _matchers.ViReal64BufferMatcher( - len(expected_output_array_of_fixed_length) - ), + _matchers.ViReal64BufferMatcher(len(expected_output_array_of_fixed_length)), _matchers.ViInt32Matcher(len(input_array_of_floats)), _matchers.ViReal64BufferMatcher(input_array_of_floats), - None, + None ) def test_multiple_arrays_same_size(self): - self.patched_library.niFake_MultipleArraysSameSize.side_effect = ( - self.side_effects_helper.niFake_MultipleArraysSameSize - ) + self.patched_library.niFake_MultipleArraysSameSize.side_effect = self.side_effects_helper.niFake_MultipleArraysSameSize input_array_of_floats1 = [0.041, 0.042, 0.043, 0.044] input_array_of_floats2 = [0.410, 0.420, 0.430, 0.440] input_array_of_floats3 = [4.100, 4.200, 4.300, 4.400] input_array_of_floats4 = [41.00, 42.00, 43.00, 44.00] - with nifake.Session("dev1") as session: - session.multiple_arrays_same_size( - input_array_of_floats1, - input_array_of_floats2, - input_array_of_floats3, - input_array_of_floats4, - ) + with nifake.Session('dev1') as session: + session.multiple_arrays_same_size(input_array_of_floats1, input_array_of_floats2, input_array_of_floats3, input_array_of_floats4) self.patched_library.niFake_MultipleArraysSameSize.assert_called_once_with( _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViReal64BufferMatcher(input_array_of_floats1), @@ -818,11 +540,9 @@ def test_multiple_arrays_same_size(self): ) def test_multiple_arrays_same_size_none_input(self): - self.patched_library.niFake_MultipleArraysSameSize.side_effect = ( - self.side_effects_helper.niFake_MultipleArraysSameSize - ) + self.patched_library.niFake_MultipleArraysSameSize.side_effect = self.side_effects_helper.niFake_MultipleArraysSameSize input_array_of_floats1 = [0.041, 0.042, 0.043, 0.044] - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: session.multiple_arrays_same_size(input_array_of_floats1, None, None, None) self.patched_library.niFake_MultipleArraysSameSize.assert_called_once_with( _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), @@ -834,154 +554,85 @@ def test_multiple_arrays_same_size_none_input(self): ) def test_multiple_arrays_same_size_wrong_size_2(self): - self.patched_library.niFake_MultipleArraysSameSize.side_effect = ( - self.side_effects_helper.niFake_MultipleArraysSameSize - ) + self.patched_library.niFake_MultipleArraysSameSize.side_effect = self.side_effects_helper.niFake_MultipleArraysSameSize input_array_of_floats1 = [0.041, 0.042, 0.043, 0.044] input_array_of_floats2 = [0.410, 0.420, 0.430] input_array_of_floats3 = [4.100, 4.200, 4.300, 4.400] input_array_of_floats4 = [41.00, 42.00, 43.00, 44.00] - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: try: - session.multiple_arrays_same_size( - input_array_of_floats1, - input_array_of_floats2, - input_array_of_floats3, - input_array_of_floats4, - ) + session.multiple_arrays_same_size(input_array_of_floats1, input_array_of_floats2, input_array_of_floats3, input_array_of_floats4) assert False except ValueError: pass def test_multiple_arrays_same_size_wrong_size_3(self): - self.patched_library.niFake_MultipleArraysSameSize.side_effect = ( - self.side_effects_helper.niFake_MultipleArraysSameSize - ) + self.patched_library.niFake_MultipleArraysSameSize.side_effect = self.side_effects_helper.niFake_MultipleArraysSameSize input_array_of_floats1 = [0.041, 0.042, 0.043, 0.044] input_array_of_floats2 = [0.410, 0.420, 0.430, 0.440] input_array_of_floats3 = [4.100, 4.200, 4.400] input_array_of_floats4 = [41.00, 42.00, 43.00, 44.00] - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: try: - session.multiple_arrays_same_size( - input_array_of_floats1, - input_array_of_floats2, - input_array_of_floats3, - input_array_of_floats4, - ) + session.multiple_arrays_same_size(input_array_of_floats1, input_array_of_floats2, input_array_of_floats3, input_array_of_floats4) assert False except ValueError: pass def test_multiple_arrays_same_size_wrong_size_4(self): - self.patched_library.niFake_MultipleArraysSameSize.side_effect = ( - self.side_effects_helper.niFake_MultipleArraysSameSize - ) + self.patched_library.niFake_MultipleArraysSameSize.side_effect = self.side_effects_helper.niFake_MultipleArraysSameSize input_array_of_floats1 = [0.041, 0.042, 0.043, 0.044] input_array_of_floats2 = [0.410, 0.420, 0.430, 0.440] input_array_of_floats3 = [4.100, 4.200, 4.300, 4.400] input_array_of_floats4 = [41.00, 42.00, 43.00, 44.00, 45.00] - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: try: - session.multiple_arrays_same_size( - input_array_of_floats1, - input_array_of_floats2, - input_array_of_floats3, - input_array_of_floats4, - ) + session.multiple_arrays_same_size(input_array_of_floats1, input_array_of_floats2, input_array_of_floats3, input_array_of_floats4) assert False except ValueError: pass def test_parameters_are_multiple_types(self): - self.patched_library.niFake_ParametersAreMultipleTypes.side_effect = ( - self.side_effects_helper.niFake_ParametersAreMultipleTypes - ) + self.patched_library.niFake_ParametersAreMultipleTypes.side_effect = self.side_effects_helper.niFake_ParametersAreMultipleTypes boolean_val = True int32_val = 32 int64_val = 6000000000 enum_val = nifake.Turtle.LEONARDO float_val = 1.23 float_enum_val = nifake.FloatEnum.SIX_POINT_FIVE - string_val = "Testing is fun?" - with nifake.Session("dev1") as session: - session.parameters_are_multiple_types( - boolean_val, - int32_val, - int64_val, - enum_val, - float_val, - float_enum_val, - string_val, - ) - self.patched_library.niFake_ParametersAreMultipleTypes.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViBooleanMatcher(boolean_val), - _matchers.ViInt32Matcher(int32_val), - _matchers.ViInt64Matcher(int64_val), - _matchers.ViInt16Matcher(enum_val.value), - _matchers.ViReal64Matcher(float_val), - _matchers.ViReal64Matcher(float_enum_val.value), - _matchers.ViInt32Matcher(len(string_val)), - _matchers.ViStringMatcher(string_val), - ) + string_val = 'Testing is fun?' + with nifake.Session('dev1') as session: + session.parameters_are_multiple_types(boolean_val, int32_val, int64_val, enum_val, float_val, float_enum_val, string_val) + self.patched_library.niFake_ParametersAreMultipleTypes.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViBooleanMatcher(boolean_val), _matchers.ViInt32Matcher(int32_val), _matchers.ViInt64Matcher(int64_val), _matchers.ViInt16Matcher(enum_val.value), _matchers.ViReal64Matcher(float_val), _matchers.ViReal64Matcher(float_enum_val.value), _matchers.ViInt32Matcher(len(string_val)), _matchers.ViStringMatcher(string_val)) def test_parameters_are_multiple_types_error(self): test_error_code = -42 test_error_desc = "The answer to the ultimate question" - self.patched_library.niFake_ParametersAreMultipleTypes.side_effect = ( - self.side_effects_helper.niFake_ParametersAreMultipleTypes - ) - self.side_effects_helper["ParametersAreMultipleTypes"][ - "return" - ] = test_error_code - self.patched_library.niFake_GetError.side_effect = ( - self.side_effects_helper.niFake_GetError - ) - self.side_effects_helper["GetError"]["errorCode"] = test_error_code - self.side_effects_helper["GetError"]["description"] = test_error_desc - self.patched_library.niFake_ParametersAreMultipleTypes.side_effect = ( - self.side_effects_helper.niFake_ParametersAreMultipleTypes - ) - self.side_effects_helper["ParametersAreMultipleTypes"][ - "return" - ] = test_error_code - self.patched_library.niFake_GetError.side_effect = ( - self.side_effects_helper.niFake_GetError - ) - self.side_effects_helper["GetError"]["errorCode"] = test_error_code - self.side_effects_helper["GetError"]["description"] = test_error_desc + self.patched_library.niFake_ParametersAreMultipleTypes.side_effect = self.side_effects_helper.niFake_ParametersAreMultipleTypes + self.side_effects_helper['ParametersAreMultipleTypes']['return'] = test_error_code + self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError + self.side_effects_helper['GetError']['errorCode'] = test_error_code + self.side_effects_helper['GetError']['description'] = test_error_desc + self.patched_library.niFake_ParametersAreMultipleTypes.side_effect = self.side_effects_helper.niFake_ParametersAreMultipleTypes + self.side_effects_helper['ParametersAreMultipleTypes']['return'] = test_error_code + self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError + self.side_effects_helper['GetError']['errorCode'] = test_error_code + self.side_effects_helper['GetError']['description'] = test_error_desc boolean_val = True int32_val = 32 int64_val = 6000000000 enum_val = nifake.Turtle.LEONARDO float_val = 1.23 float_enum_val = nifake.FloatEnum.SIX_POINT_FIVE - string_val = "Testing is fun?" - with nifake.Session("dev1") as session: + string_val = 'Testing is fun?' + with nifake.Session('dev1') as session: try: - session.parameters_are_multiple_types( - boolean_val, - int32_val, - int64_val, - 123, - float_val, - float_enum_val, - string_val, - ) + session.parameters_are_multiple_types(boolean_val, int32_val, int64_val, 123, float_val, float_enum_val, string_val) assert False except TypeError: pass try: - session.parameters_are_multiple_types( - boolean_val, - int32_val, - int64_val, - enum_val, - float_val, - 0.123, - string_val, - ) + session.parameters_are_multiple_types(boolean_val, int32_val, int64_val, enum_val, float_val, 0.123, string_val) assert False except TypeError: pass @@ -989,18 +640,12 @@ def test_parameters_are_multiple_types_error(self): def test_method_with_error(self): test_error_code = -42 test_error_desc = "The answer to the ultimate question" - self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = ( - self.side_effects_helper.niFake_PoorlyNamedSimpleFunction - ) - self.side_effects_helper["PoorlyNamedSimpleFunction"][ - "return" - ] = test_error_code - self.patched_library.niFake_GetError.side_effect = ( - self.side_effects_helper.niFake_GetError - ) - self.side_effects_helper["GetError"]["errorCode"] = test_error_code - self.side_effects_helper["GetError"]["description"] = test_error_desc - with nifake.Session("dev1") as session: + self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = self.side_effects_helper.niFake_PoorlyNamedSimpleFunction + self.side_effects_helper['PoorlyNamedSimpleFunction']['return'] = test_error_code + self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError + self.side_effects_helper['GetError']['errorCode'] = test_error_code + self.side_effects_helper['GetError']['description'] = test_error_desc + with nifake.Session('dev1') as session: try: session.simple_function() assert False @@ -1011,25 +656,21 @@ def test_method_with_error(self): def test_error_with_rep_cap(self): test_error_code = -42 test_error_desc = "The answer to the ultimate question" - self.patched_library.niFake_SetAttributeViReal64.side_effect = ( - self.side_effects_helper.niFake_SetAttributeViReal64 - ) - self.side_effects_helper["SetAttributeViReal64"]["return"] = test_error_code - self.patched_library.niFake_GetError.side_effect = ( - self.side_effects_helper.niFake_GetError - ) - self.side_effects_helper["GetError"]["errorCode"] = test_error_code - self.side_effects_helper["GetError"]["description"] = test_error_desc - with nifake.Session("dev1") as session: + self.patched_library.niFake_SetAttributeViReal64.side_effect = self.side_effects_helper.niFake_SetAttributeViReal64 + self.side_effects_helper['SetAttributeViReal64']['return'] = test_error_code + self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError + self.side_effects_helper['GetError']['errorCode'] = test_error_code + self.side_effects_helper['GetError']['description'] = test_error_desc + with nifake.Session('dev1') as session: try: - session.channels["100"].read_write_double = 5.0 + session.channels['100'].read_write_double = 5.0 assert False except nifake.Error as e: assert e.code == test_error_code assert e.description == test_error_desc def test_call_not_enough_parameters_error(self): - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: try: session.multiple_array_types(10) assert False @@ -1037,19 +678,17 @@ def test_call_not_enough_parameters_error(self): pass def test_invalid_method_call_wrong_type_error(self): - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: try: - session.multiple_array_types("potato", [0.0, 0.1, 0.2]) + session.multiple_array_types('potato', [0.0, 0.1, 0.2]) assert False except TypeError: pass def test_enum_input_function_with_defaults_bad_type_error(self): test_turtle = 123 - self.patched_library.niFake_EnumInputFunctionWithDefaults.side_effect = ( - self.side_effects_helper.niFake_EnumInputFunctionWithDefaults - ) - with nifake.Session("dev1") as session: + self.patched_library.niFake_EnumInputFunctionWithDefaults.side_effect = self.side_effects_helper.niFake_EnumInputFunctionWithDefaults + with nifake.Session('dev1') as session: try: session.enum_input_function_with_defaults(test_turtle) assert False @@ -1062,18 +701,12 @@ def test_method_with_warning(self): test_error_code = 42 test_error_desc = "The answer to the ultimate question, only positive" - self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = ( - self.side_effects_helper.niFake_PoorlyNamedSimpleFunction - ) - self.side_effects_helper["PoorlyNamedSimpleFunction"][ - "return" - ] = test_error_code - self.patched_library.niFake_GetError.side_effect = ( - self.side_effects_helper.niFake_GetError - ) - self.side_effects_helper["GetError"]["errorCode"] = test_error_code - self.side_effects_helper["GetError"]["description"] = test_error_desc - with nifake.Session("dev1") as session: + self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = self.side_effects_helper.niFake_PoorlyNamedSimpleFunction + self.side_effects_helper['PoorlyNamedSimpleFunction']['return'] = test_error_code + self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError + self.side_effects_helper['GetError']['errorCode'] = test_error_code + self.side_effects_helper['GetError']['description'] = test_error_desc + with nifake.Session('dev1') as session: with warnings.catch_warnings(record=True) as w: session.simple_function() assert len(w) == 1 @@ -1086,18 +719,16 @@ def test_read_with_warning(self): test_maximum_time_s = 10.0 test_maximum_time = hightime.timedelta(seconds=test_maximum_time_s) - test_reading = float("nan") + test_reading = float('nan') test_error_code = 42 test_error_desc = "The answer to the ultimate question, only positive" self.patched_library.niFake_Read.side_effect = self.niFake_read_warning self.error_code_return = test_error_code self.reading = test_reading - self.patched_library.niFake_GetError.side_effect = ( - self.side_effects_helper.niFake_GetError - ) - self.side_effects_helper["GetError"]["errorCode"] = test_error_code - self.side_effects_helper["GetError"]["description"] = test_error_desc - with nifake.Session("dev1") as session: + self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError + self.side_effects_helper['GetError']['errorCode'] = test_error_code + self.side_effects_helper['GetError']['description'] = test_error_desc + with nifake.Session('dev1') as session: with warnings.catch_warnings(record=True) as w: assert math.isnan(session.read(test_maximum_time)) assert len(w) == 1 @@ -1107,103 +738,60 @@ def test_read_with_warning(self): # Retrieving buffers and strings def test_get_a_string_of_fixed_maximum_size(self): - test_string = ( - "A string no larger than the max size of 256 allowed by the function." - ) - self.patched_library.niFake_GetAStringOfFixedMaximumSize.side_effect = ( - self.side_effects_helper.niFake_GetAStringOfFixedMaximumSize - ) - self.side_effects_helper["GetAStringOfFixedMaximumSize"][ - "aString" - ] = test_string - with nifake.Session("dev1") as session: + test_string = "A string no larger than the max size of 256 allowed by the function." + self.patched_library.niFake_GetAStringOfFixedMaximumSize.side_effect = self.side_effects_helper.niFake_GetAStringOfFixedMaximumSize + self.side_effects_helper['GetAStringOfFixedMaximumSize']['aString'] = test_string + with nifake.Session('dev1') as session: returned_string = session.get_a_string_of_fixed_maximum_size() assert returned_string == test_string - self.patched_library.niFake_GetAStringOfFixedMaximumSize.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViCharBufferMatcher(256), - ) + self.patched_library.niFake_GetAStringOfFixedMaximumSize.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViCharBufferMatcher(256)) def test_get_a_string_of_size_python_code(self): test_size = 4 expected_string_size = test_size - 1 test_string = "A string that is larger than test_size." expected_string = test_string[:expected_string_size] - self.patched_library.niFake_GetAStringUsingPythonCode.side_effect = ( - self.side_effects_helper.niFake_GetAStringUsingPythonCode - ) - self.side_effects_helper["GetAStringUsingPythonCode"][ - "aString" - ] = expected_string - with nifake.Session("dev1") as session: + self.patched_library.niFake_GetAStringUsingPythonCode.side_effect = self.side_effects_helper.niFake_GetAStringUsingPythonCode + self.side_effects_helper['GetAStringUsingPythonCode']['aString'] = expected_string + with nifake.Session('dev1') as session: returned_string = session.get_a_string_using_python_code(test_size) assert returned_string == expected_string - self.patched_library.niFake_GetAStringUsingPythonCode.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt16Matcher(test_size), - _matchers.ViCharBufferMatcher(test_size), - ) + self.patched_library.niFake_GetAStringUsingPythonCode.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt16Matcher(test_size), _matchers.ViCharBufferMatcher(test_size)) def test_return_a_number_and_a_string(self): test_string = "this string" test_number = 13 - self.patched_library.niFake_ReturnANumberAndAString.side_effect = ( - self.side_effects_helper.niFake_ReturnANumberAndAString - ) - self.side_effects_helper["ReturnANumberAndAString"]["aString"] = test_string - self.side_effects_helper["ReturnANumberAndAString"]["aNumber"] = test_number - with nifake.Session("dev1") as session: + self.patched_library.niFake_ReturnANumberAndAString.side_effect = self.side_effects_helper.niFake_ReturnANumberAndAString + self.side_effects_helper['ReturnANumberAndAString']['aString'] = test_string + self.side_effects_helper['ReturnANumberAndAString']['aNumber'] = test_number + with nifake.Session('dev1') as session: returned_number, returned_string = session.return_a_number_and_a_string() - assert returned_string == test_string - assert returned_number == test_number - self.patched_library.niFake_ReturnANumberAndAString.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt16PointerMatcher(), - _matchers.ViCharBufferMatcher(256), - ) + assert (returned_string == test_string) + assert (returned_number == test_number) + self.patched_library.niFake_ReturnANumberAndAString.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt16PointerMatcher(), _matchers.ViCharBufferMatcher(256)) def test_get_an_ivi_dance_string(self): - self.patched_library.niFake_GetAnIviDanceString.side_effect = ( - self.side_effects_helper.niFake_GetAnIviDanceString - ) - string_val = "Testing is fun?" - self.side_effects_helper["GetAnIviDanceString"]["aString"] = string_val - with nifake.Session("dev1") as session: + self.patched_library.niFake_GetAnIviDanceString.side_effect = self.side_effects_helper.niFake_GetAnIviDanceString + string_val = 'Testing is fun?' + self.side_effects_helper['GetAnIviDanceString']['aString'] = string_val + with nifake.Session('dev1') as session: result_string = session.get_an_ivi_dance_string() assert result_string == string_val from unittest.mock import call - - calls = [ - call( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt32Matcher(0), - None, - ), - call( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt32Matcher(len(string_val)), - _matchers.ViCharBufferMatcher(len(string_val)), - ), - ] + calls = [call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(0), None), call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(string_val)), _matchers.ViCharBufferMatcher(len(string_val)))] self.patched_library.niFake_GetAnIviDanceString.assert_has_calls(calls) assert self.patched_library.niFake_GetAnIviDanceString.call_count == 2 def test_get_string_ivi_dance_error(self): test_error_code = -1234 test_error_desc = "ascending order" - self.patched_library.niFake_GetAttributeViString.side_effect = ( - self.side_effects_helper.niFake_GetAttributeViString - ) - self.side_effects_helper["GetAttributeViString"][ - "attributeValue" - ] = "Testing is fun?" - self.side_effects_helper["GetAttributeViString"]["return"] = test_error_code - self.patched_library.niFake_GetError.side_effect = ( - self.side_effects_helper.niFake_GetError - ) - self.side_effects_helper["GetError"]["errorCode"] = test_error_code - self.side_effects_helper["GetError"]["description"] = test_error_desc - with nifake.Session("dev1") as session: + self.patched_library.niFake_GetAttributeViString.side_effect = self.side_effects_helper.niFake_GetAttributeViString + self.side_effects_helper['GetAttributeViString']['attributeValue'] = 'Testing is fun?' + self.side_effects_helper['GetAttributeViString']['return'] = test_error_code + self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError + self.side_effects_helper['GetError']['errorCode'] = test_error_code + self.side_effects_helper['GetError']['description'] = test_error_desc + with nifake.Session('dev1') as session: try: session.read_write_string assert False @@ -1212,532 +800,284 @@ def test_get_string_ivi_dance_error(self): assert e.description == test_error_desc def test_get_an_ivi_dance_with_a_twist_string(self): - self.patched_library.niFake_GetAnIviDanceWithATwistString.side_effect = ( - self.side_effects_helper.niFake_GetAnIviDanceWithATwistString - ) - string_val = "Testing is fun?" - self.side_effects_helper["GetAnIviDanceWithATwistString"][ - "aString" - ] = string_val - self.side_effects_helper["GetAnIviDanceWithATwistString"]["actualSize"] = len( - string_val - ) - with nifake.Session("dev1") as session: + self.patched_library.niFake_GetAnIviDanceWithATwistString.side_effect = self.side_effects_helper.niFake_GetAnIviDanceWithATwistString + string_val = 'Testing is fun?' + self.side_effects_helper['GetAnIviDanceWithATwistString']['aString'] = string_val + self.side_effects_helper['GetAnIviDanceWithATwistString']['actualSize'] = len(string_val) + with nifake.Session('dev1') as session: result_string = session.get_an_ivi_dance_with_a_twist_string() assert result_string == string_val from unittest.mock import call - calls = [ - call( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt32Matcher(0), - None, - _matchers.ViInt32PointerMatcher(), - ), - call( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt32Matcher(len(string_val)), - _matchers.ViCharBufferMatcher(len(string_val)), - _matchers.ViInt32PointerMatcher(), - ), + call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(0), None, _matchers.ViInt32PointerMatcher()), + call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(string_val)), _matchers.ViCharBufferMatcher(len(string_val)), _matchers.ViInt32PointerMatcher()) ] - self.patched_library.niFake_GetAnIviDanceWithATwistString.assert_has_calls( - calls - ) - assert ( - self.patched_library.niFake_GetAnIviDanceWithATwistString.call_count - == 2 - ) + self.patched_library.niFake_GetAnIviDanceWithATwistString.assert_has_calls(calls) + assert self.patched_library.niFake_GetAnIviDanceWithATwistString.call_count == 2 def test_get_array_using_ivi_dance(self): - self.patched_library.niFake_GetArrayUsingIviDance.side_effect = ( - self.side_effects_helper.niFake_GetArrayUsingIviDance - ) - self.side_effects_helper["GetArrayUsingIviDance"]["arrayOut"] = [1.1, 2.2] - with nifake.Session("dev1") as session: + self.patched_library.niFake_GetArrayUsingIviDance.side_effect = self.side_effects_helper.niFake_GetArrayUsingIviDance + self.side_effects_helper['GetArrayUsingIviDance']['arrayOut'] = [1.1, 2.2] + with nifake.Session('dev1') as session: result_array = session.get_array_using_ivi_dance() assert result_array == [1.1, 2.2] # Repeated Capabilities def test_repeated_capability_method_on_session_timedelta(self): - test_maximum_time_ms = 10 # milliseconds - test_maximum_time_timedelta = hightime.timedelta( - milliseconds=test_maximum_time_ms - ) + test_maximum_time_ms = 10 # milliseconds + test_maximum_time_timedelta = hightime.timedelta(milliseconds=test_maximum_time_ms) test_reading = 5 - self.patched_library.niFake_ReadFromChannel.side_effect = ( - self.side_effects_helper.niFake_ReadFromChannel - ) - self.side_effects_helper["ReadFromChannel"]["reading"] = test_reading - with nifake.Session("dev1") as session: + self.patched_library.niFake_ReadFromChannel.side_effect = self.side_effects_helper.niFake_ReadFromChannel + self.side_effects_helper['ReadFromChannel']['reading'] = test_reading + with nifake.Session('dev1') as session: value = session.read_from_channel(test_maximum_time_timedelta) - self.patched_library.niFake_ReadFromChannel.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViInt32Matcher(test_maximum_time_ms), - _matchers.ViReal64PointerMatcher(), - ) + self.patched_library.niFake_ReadFromChannel.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViInt32Matcher(test_maximum_time_ms), _matchers.ViReal64PointerMatcher()) assert value == test_reading def test_repeated_capability_method_on_specific_channel(self): - test_maximum_time_ms = 10 # milliseconds + test_maximum_time_ms = 10 # milliseconds test_maximum_time = hightime.timedelta(milliseconds=test_maximum_time_ms) test_reading = 5 - self.patched_library.niFake_ReadFromChannel.side_effect = ( - self.side_effects_helper.niFake_ReadFromChannel - ) - self.side_effects_helper["ReadFromChannel"]["reading"] = test_reading - with nifake.Session("dev1") as session: - value = session.channels["3"].read_from_channel(test_maximum_time) - self.patched_library.niFake_ReadFromChannel.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher("3"), - _matchers.ViInt32Matcher(test_maximum_time_ms), - _matchers.ViReal64PointerMatcher(), - ) + self.patched_library.niFake_ReadFromChannel.side_effect = self.side_effects_helper.niFake_ReadFromChannel + self.side_effects_helper['ReadFromChannel']['reading'] = test_reading + with nifake.Session('dev1') as session: + value = session.channels['3'].read_from_channel(test_maximum_time) + self.patched_library.niFake_ReadFromChannel.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher('3'), _matchers.ViInt32Matcher(test_maximum_time_ms), _matchers.ViReal64PointerMatcher()) assert value == test_reading def test_device_method_not_exist_on_repeated_capability_error(self): - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: try: - session.channels["3"].simple_function() - assert ( - False - ), "Method has no repeated capability so it shouldn't exist on _RepeatedCapability" + session.channels['3'].simple_function() + assert False, 'Method has no repeated capability so it shouldn\'t exist on _RepeatedCapability' except AttributeError: pass def test_repeated_capabilities_list(self): - with nifake.Session("dev1") as session: - assert session.channels["r0"]._repeated_capability_list == ["r0"] + with nifake.Session('dev1') as session: + assert session.channels['r0']._repeated_capability_list == ['r0'] def test_chained_repeated_capabilities_list(self): - with nifake.Session("dev1") as session: - assert session.sites[0, 1].channels[2, 3]._repeated_capability_list == [ - "site0/2", - "site0/3", - "site1/2", - "site1/3", - ] + with nifake.Session('dev1') as session: + assert session.sites[0, 1].channels[2, 3]._repeated_capability_list == ['site0/2', 'site0/3', 'site1/2', 'site1/3'] def test_chained_repeated_capability_method_on_specific_channel(self): - test_maximum_time_ms = 10 # milliseconds + test_maximum_time_ms = 10 # milliseconds test_maximum_time = hightime.timedelta(milliseconds=test_maximum_time_ms) test_reading = 5 - self.patched_library.niFake_ReadFromChannel.side_effect = ( - self.side_effects_helper.niFake_ReadFromChannel - ) - self.side_effects_helper["ReadFromChannel"]["reading"] = test_reading - with nifake.Session("dev1") as session: - value = ( - session.sites[0, 1].channels[2, 3].read_from_channel(test_maximum_time) - ) - self.patched_library.niFake_ReadFromChannel.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher("site0/2,site0/3,site1/2,site1/3"), - _matchers.ViInt32Matcher(test_maximum_time_ms), - _matchers.ViReal64PointerMatcher(), - ) + self.patched_library.niFake_ReadFromChannel.side_effect = self.side_effects_helper.niFake_ReadFromChannel + self.side_effects_helper['ReadFromChannel']['reading'] = test_reading + with nifake.Session('dev1') as session: + value = session.sites[0, 1].channels[2, 3].read_from_channel(test_maximum_time) + self.patched_library.niFake_ReadFromChannel.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher('site0/2,site0/3,site1/2,site1/3'), _matchers.ViInt32Matcher(test_maximum_time_ms), _matchers.ViReal64PointerMatcher()) assert value == test_reading # Attributes def test_get_attribute_int32(self): - self.patched_library.niFake_GetAttributeViInt32.side_effect = ( - self.side_effects_helper.niFake_GetAttributeViInt32 - ) + self.patched_library.niFake_GetAttributeViInt32.side_effect = self.side_effects_helper.niFake_GetAttributeViInt32 test_number = 3 - self.side_effects_helper["GetAttributeViInt32"]["attributeValue"] = test_number - with nifake.Session("dev1") as session: + self.side_effects_helper['GetAttributeViInt32']['attributeValue'] = test_number + with nifake.Session('dev1') as session: attr_int = session.read_write_integer - assert attr_int == test_number - self.patched_library.niFake_GetAttributeViInt32.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(1000004), - _matchers.ViInt32PointerMatcher(), - ) + assert(attr_int == test_number) + self.patched_library.niFake_GetAttributeViInt32.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000004), _matchers.ViInt32PointerMatcher()) def test_set_attribute_int32(self): - self.patched_library.niFake_SetAttributeViInt32.side_effect = ( - self.side_effects_helper.niFake_SetAttributeViInt32 - ) + self.patched_library.niFake_SetAttributeViInt32.side_effect = self.side_effects_helper.niFake_SetAttributeViInt32 attribute_id = 1000004 test_number = -10 - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: session.read_write_integer = test_number - self.patched_library.niFake_SetAttributeViInt32.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViInt32Matcher(test_number), - ) + self.patched_library.niFake_SetAttributeViInt32.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt32Matcher(test_number)) def test_get_attribute_int32_with_converter(self): - self.patched_library.niFake_GetAttributeViInt32.side_effect = ( - self.side_effects_helper.niFake_GetAttributeViInt32 - ) + self.patched_library.niFake_GetAttributeViInt32.side_effect = self.side_effects_helper.niFake_GetAttributeViInt32 attribute_id = 1000008 test_number_ms = 3 test_number_s = 0.003 - self.side_effects_helper["GetAttributeViInt32"][ - "attributeValue" - ] = test_number_ms - with nifake.Session("dev1") as session: + self.side_effects_helper['GetAttributeViInt32']['attributeValue'] = test_number_ms + with nifake.Session('dev1') as session: attr_timedelta = session.read_write_integer_with_converter - assert attr_timedelta.total_seconds() == test_number_s - self.patched_library.niFake_GetAttributeViInt32.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViInt32PointerMatcher(), - ) + assert(attr_timedelta.total_seconds() == test_number_s) + self.patched_library.niFake_GetAttributeViInt32.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt32PointerMatcher()) def test_set_attribute_int32_with_converter(self): - self.patched_library.niFake_SetAttributeViInt32.side_effect = ( - self.side_effects_helper.niFake_SetAttributeViInt32 - ) + self.patched_library.niFake_SetAttributeViInt32.side_effect = self.side_effects_helper.niFake_SetAttributeViInt32 attribute_id = 1000008 test_number_ms = -10000 - with nifake.Session("dev1") as session: - session.read_write_integer_with_converter = hightime.timedelta( - milliseconds=test_number_ms - ) - self.patched_library.niFake_SetAttributeViInt32.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViInt32Matcher(test_number_ms), - ) + with nifake.Session('dev1') as session: + session.read_write_integer_with_converter = hightime.timedelta(milliseconds=test_number_ms) + self.patched_library.niFake_SetAttributeViInt32.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt32Matcher(test_number_ms)) def test_get_attribute_real64(self): - self.patched_library.niFake_GetAttributeViReal64.side_effect = ( - self.side_effects_helper.niFake_GetAttributeViReal64 - ) + self.patched_library.niFake_GetAttributeViReal64.side_effect = self.side_effects_helper.niFake_GetAttributeViReal64 test_number = 1.5 - self.side_effects_helper["GetAttributeViReal64"]["attributeValue"] = test_number - with nifake.Session("dev1") as session: + self.side_effects_helper['GetAttributeViReal64']['attributeValue'] = test_number + with nifake.Session('dev1') as session: attr_double = session.read_write_double assert attr_double == test_number - self.patched_library.niFake_GetAttributeViReal64.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(1000001), - _matchers.ViReal64PointerMatcher(), - ) + self.patched_library.niFake_GetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000001), _matchers.ViReal64PointerMatcher()) def test_set_attribute_real64(self): - self.patched_library.niFake_SetAttributeViReal64.side_effect = ( - self.side_effects_helper.niFake_SetAttributeViReal64 - ) + self.patched_library.niFake_SetAttributeViReal64.side_effect = self.side_effects_helper.niFake_SetAttributeViReal64 attribute_id = 1000001 test_number = 10.1 - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: session.read_write_double = test_number - self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViReal64Matcher(test_number), - ) + self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64Matcher(test_number)) def test_get_attribute_real64_with_converter(self): - self.patched_library.niFake_GetAttributeViReal64.side_effect = ( - self.side_effects_helper.niFake_GetAttributeViReal64 - ) + self.patched_library.niFake_GetAttributeViReal64.side_effect = self.side_effects_helper.niFake_GetAttributeViReal64 attribute_id = 1000007 test_number = 1e-9 - self.side_effects_helper["GetAttributeViReal64"]["attributeValue"] = test_number - with nifake.Session("dev1") as session: + self.side_effects_helper['GetAttributeViReal64']['attributeValue'] = test_number + with nifake.Session('dev1') as session: attr_timedelta = session.read_write_double_with_converter assert attr_timedelta.total_seconds() == test_number - self.patched_library.niFake_GetAttributeViReal64.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViReal64PointerMatcher(), - ) + self.patched_library.niFake_GetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64PointerMatcher()) def test_set_attribute_real64_with_converter(self): - self.patched_library.niFake_SetAttributeViReal64.side_effect = ( - self.side_effects_helper.niFake_SetAttributeViReal64 - ) + self.patched_library.niFake_SetAttributeViReal64.side_effect = self.side_effects_helper.niFake_SetAttributeViReal64 attribute_id = 1000007 test_number = 1e-9 - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: session.read_write_double_with_converter = hightime.timedelta(nanoseconds=1) - self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViReal64Matcher(test_number), - ) + self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64Matcher(test_number)) def test_get_attribute_string(self): - self.patched_library.niFake_GetAttributeViString.side_effect = ( - self.side_effects_helper.niFake_GetAttributeViString - ) - string = "Testing is fun?" - self.side_effects_helper["GetAttributeViString"]["attributeValue"] = string - with nifake.Session("dev1") as session: + self.patched_library.niFake_GetAttributeViString.side_effect = self.side_effects_helper.niFake_GetAttributeViString + string = 'Testing is fun?' + self.side_effects_helper['GetAttributeViString']['attributeValue'] = string + with nifake.Session('dev1') as session: attr_string = session.read_write_string assert attr_string == string from unittest.mock import call - - calls = [ - call( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(1000002), - _matchers.ViInt32Matcher(0), - None, - ), - call( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(1000002), - _matchers.ViInt32Matcher(15), - _matchers.ViCharBufferMatcher(len(string)), - ), - ] + calls = [call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000002), _matchers.ViInt32Matcher(0), None), call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000002), _matchers.ViInt32Matcher(15), _matchers.ViCharBufferMatcher(len(string)))] self.patched_library.niFake_GetAttributeViString.assert_has_calls(calls) assert self.patched_library.niFake_GetAttributeViString.call_count == 2 def test_set_attribute_string(self): - self.patched_library.niFake_SetAttributeViString.side_effect = ( - self.side_effects_helper.niFake_SetAttributeViString - ) + self.patched_library.niFake_SetAttributeViString.side_effect = self.side_effects_helper.niFake_SetAttributeViString attribute_id = 1000002 - attrib_string = "This is test string" - with nifake.Session("dev1") as session: + attrib_string = 'This is test string' + with nifake.Session('dev1') as session: session.read_write_string = attrib_string - self.patched_library.niFake_SetAttributeViString.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViStringMatcher("This is test string"), - ) + self.patched_library.niFake_SetAttributeViString.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViStringMatcher('This is test string')) def test_get_attribute_string_with_converter(self): - self.patched_library.niFake_GetAttributeViString.side_effect = ( - self.side_effects_helper.niFake_GetAttributeViString - ) - string = "not that interesting" - self.side_effects_helper["GetAttributeViString"]["attributeValue"] = string - with nifake.Session("dev1") as session: + self.patched_library.niFake_GetAttributeViString.side_effect = self.side_effects_helper.niFake_GetAttributeViString + string = 'not that interesting' + self.side_effects_helper['GetAttributeViString']['attributeValue'] = string + with nifake.Session('dev1') as session: attr_string = session.read_write_string_repeated_capability assert attr_string == string from unittest.mock import call - - calls = [ - call( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(1000010), - _matchers.ViInt32Matcher(0), - None, - ), - call( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(1000010), - _matchers.ViInt32Matcher(20), - _matchers.ViCharBufferMatcher(len(string)), - ), - ] + calls = [call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000010), _matchers.ViInt32Matcher(0), None), call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000010), _matchers.ViInt32Matcher(20), _matchers.ViCharBufferMatcher(len(string)))] self.patched_library.niFake_GetAttributeViString.assert_has_calls(calls) assert self.patched_library.niFake_GetAttributeViString.call_count == 2 def test_set_attribute_string_with_converter(self): - self.patched_library.niFake_SetAttributeViString.side_effect = ( - self.side_effects_helper.niFake_SetAttributeViString - ) + self.patched_library.niFake_SetAttributeViString.side_effect = self.side_effects_helper.niFake_SetAttributeViString attribute_id = 1000010 - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: session.read_write_string_repeated_capability = 42 - self.patched_library.niFake_SetAttributeViString.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViStringMatcher("42"), - ) + self.patched_library.niFake_SetAttributeViString.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViStringMatcher('42')) def test_get_attribute_boolean(self): - self.patched_library.niFake_GetAttributeViBoolean.side_effect = ( - self.side_effects_helper.niFake_GetAttributeViBoolean - ) - self.side_effects_helper["GetAttributeViBoolean"]["attributeValue"] = 1 - with nifake.Session("dev1") as session: + self.patched_library.niFake_GetAttributeViBoolean.side_effect = self.side_effects_helper.niFake_GetAttributeViBoolean + self.side_effects_helper['GetAttributeViBoolean']['attributeValue'] = 1 + with nifake.Session('dev1') as session: assert session.read_write_bool - self.patched_library.niFake_GetAttributeViBoolean.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(1000000), - _matchers.ViBooleanPointerMatcher(), - ) + self.patched_library.niFake_GetAttributeViBoolean.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000000), _matchers.ViBooleanPointerMatcher()) def test_set_attribute_boolean(self): - self.patched_library.niFake_SetAttributeViBoolean.side_effect = ( - self.side_effects_helper.niFake_SetAttributeViBoolean - ) + self.patched_library.niFake_SetAttributeViBoolean.side_effect = self.side_effects_helper.niFake_SetAttributeViBoolean attribute_id = 1000000 attrib_bool = True - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: session.read_write_bool = attrib_bool - self.patched_library.niFake_SetAttributeViBoolean.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViBooleanMatcher(True), - ) + self.patched_library.niFake_SetAttributeViBoolean.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViBooleanMatcher(True)) def test_get_attribute_enum_int32(self): - self.patched_library.niFake_GetAttributeViInt32.side_effect = ( - self.side_effects_helper.niFake_GetAttributeViInt32 - ) - self.side_effects_helper["GetAttributeViInt32"][ - "attributeValue" - ] = nifake.Color.BLUE.value - with nifake.Session("dev1") as session: + self.patched_library.niFake_GetAttributeViInt32.side_effect = self.side_effects_helper.niFake_GetAttributeViInt32 + self.side_effects_helper['GetAttributeViInt32']['attributeValue'] = nifake.Color.BLUE.value + with nifake.Session('dev1') as session: assert session.read_write_color == nifake.Color.BLUE attribute_id = 1000003 - self.patched_library.niFake_GetAttributeViInt32.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViInt32PointerMatcher(), - ) + self.patched_library.niFake_GetAttributeViInt32.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt32PointerMatcher()) def test_set_attribute_enum_int32(self): - self.patched_library.niFake_SetAttributeViInt32.side_effect = ( - self.side_effects_helper.niFake_SetAttributeViInt32 - ) + self.patched_library.niFake_SetAttributeViInt32.side_effect = self.side_effects_helper.niFake_SetAttributeViInt32 enum_value = nifake.Color.RED - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: session.read_write_color = enum_value attribute_id = 1000003 - self.patched_library.niFake_SetAttributeViInt32.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViInt32Matcher(enum_value.value), - ) + self.patched_library.niFake_SetAttributeViInt32.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt32Matcher(enum_value.value)) def test_get_attribute_enum_real64(self): - self.patched_library.niFake_GetAttributeViReal64.side_effect = ( - self.side_effects_helper.niFake_GetAttributeViReal64 - ) + self.patched_library.niFake_GetAttributeViReal64.side_effect = self.side_effects_helper.niFake_GetAttributeViReal64 enum_value = nifake.FloatEnum.SIX_POINT_FIVE - self.side_effects_helper["GetAttributeViReal64"][ - "attributeValue" - ] = enum_value.value - with nifake.Session("dev1") as session: + self.side_effects_helper['GetAttributeViReal64']['attributeValue'] = enum_value.value + with nifake.Session('dev1') as session: assert session.float_enum == enum_value attribute_id = 1000005 - self.patched_library.niFake_GetAttributeViReal64.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViReal64PointerMatcher(), - ) + self.patched_library.niFake_GetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64PointerMatcher()) def test_set_attribute_enum_real64(self): - self.patched_library.niFake_SetAttributeViReal64.side_effect = ( - self.side_effects_helper.niFake_SetAttributeViReal64 - ) + self.patched_library.niFake_SetAttributeViReal64.side_effect = self.side_effects_helper.niFake_SetAttributeViReal64 enum_value = nifake.FloatEnum.FIVE_POINT_FIVE - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: session.float_enum = enum_value attribute_id = 1000005 - self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViReal64Matcher(enum_value.value), - ) + self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64Matcher(enum_value.value)) def test_get_attribute_channel(self): - self.patched_library.niFake_GetAttributeViInt32.side_effect = ( - self.side_effects_helper.niFake_GetAttributeViInt32 - ) + self.patched_library.niFake_GetAttributeViInt32.side_effect = self.side_effects_helper.niFake_GetAttributeViInt32 test_number = 100 - self.side_effects_helper["GetAttributeViInt32"]["attributeValue"] = test_number - with nifake.Session("dev1") as session: - attr_int = session.channels[["0", "1"]].read_write_integer - assert attr_int == test_number - self.patched_library.niFake_GetAttributeViInt32.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher("0,1"), - _matchers.ViAttrMatcher(1000004), - _matchers.ViInt32PointerMatcher(), - ) + self.side_effects_helper['GetAttributeViInt32']['attributeValue'] = test_number + with nifake.Session('dev1') as session: + attr_int = session.channels[['0', '1']].read_write_integer + assert(attr_int == test_number) + self.patched_library.niFake_GetAttributeViInt32.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher('0,1'), _matchers.ViAttrMatcher(1000004), _matchers.ViInt32PointerMatcher()) def test_set_attribute_channel(self): - self.patched_library.niFake_SetAttributeViReal64.side_effect = ( - self.side_effects_helper.niFake_SetAttributeViReal64 - ) + self.patched_library.niFake_SetAttributeViReal64.side_effect = self.side_effects_helper.niFake_SetAttributeViReal64 attribute_id = 1000001 test_number = 0.001 - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: session.channels[range(24)].read_write_double = test_number - self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher( - "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23" - ), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViReal64Matcher(test_number), - ) + self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher('0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23'), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64Matcher(test_number)) def test_get_attribute_int64(self): - self.patched_library.niFake_GetAttributeViInt64.side_effect = ( - self.side_effects_helper.niFake_GetAttributeViInt64 - ) + self.patched_library.niFake_GetAttributeViInt64.side_effect = self.side_effects_helper.niFake_GetAttributeViInt64 attribute_id = 1000006 test_number = 6000000000 - self.side_effects_helper["GetAttributeViInt64"]["attributeValue"] = test_number - with nifake.Session("dev1") as session: + self.side_effects_helper['GetAttributeViInt64']['attributeValue'] = test_number + with nifake.Session('dev1') as session: attr_int = session.read_write_int64 - assert attr_int == test_number - self.patched_library.niFake_GetAttributeViInt64.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViInt64PointerMatcher(), - ) + assert(attr_int == test_number) + self.patched_library.niFake_GetAttributeViInt64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt64PointerMatcher()) def test_set_attribute_int64(self): - self.patched_library.niFake_SetAttributeViInt64.side_effect = ( - self.side_effects_helper.niFake_SetAttributeViInt64 - ) + self.patched_library.niFake_SetAttributeViInt64.side_effect = self.side_effects_helper.niFake_SetAttributeViInt64 attribute_id = 1000006 test_number = -6000000000 - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: session.read_write_int64 = test_number - self.patched_library.niFake_SetAttributeViInt64.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViInt64Matcher(test_number), - ) + self.patched_library.niFake_SetAttributeViInt64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt64Matcher(test_number)) def test_get_attribute_error(self): test_error_code = -123 test_error_desc = "ascending order" - self.patched_library.niFake_GetAttributeViReal64.side_effect = ( - self.side_effects_helper.niFake_GetAttributeViReal64 - ) - self.side_effects_helper["GetAttributeViReal64"][ - "attributeValue" - ] = "Testing is fun?" - self.side_effects_helper["GetAttributeViReal64"]["return"] = test_error_code - self.patched_library.niFake_GetError.side_effect = ( - self.side_effects_helper.niFake_GetError - ) - self.side_effects_helper["GetError"]["errorCode"] = test_error_code - self.side_effects_helper["GetError"]["description"] = test_error_desc - with nifake.Session("dev1") as session: + self.patched_library.niFake_GetAttributeViReal64.side_effect = self.side_effects_helper.niFake_GetAttributeViReal64 + self.side_effects_helper['GetAttributeViReal64']['attributeValue'] = 'Testing is fun?' + self.side_effects_helper['GetAttributeViReal64']['return'] = test_error_code + self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError + self.side_effects_helper['GetError']['errorCode'] = test_error_code + self.side_effects_helper['GetError']['description'] = test_error_desc + with nifake.Session('dev1') as session: try: session.read_write_double assert False @@ -1747,210 +1087,138 @@ def test_get_attribute_error(self): def test_set_attribute_error(self): test_error_code = -1 - test_error_desc = "Test" - self.patched_library.niFake_SetAttributeViReal64.side_effect = ( - self.side_effects_helper.niFake_SetAttributeViReal64 - ) - self.side_effects_helper["SetAttributeViReal64"]["return"] = test_error_code - self.patched_library.niFake_GetError.side_effect = ( - self.side_effects_helper.niFake_GetError - ) - self.side_effects_helper["GetError"]["errorCode"] = test_error_code - self.side_effects_helper["GetError"]["description"] = test_error_desc - with nifake.Session("dev1") as session: + test_error_desc = 'Test' + self.patched_library.niFake_SetAttributeViReal64.side_effect = self.side_effects_helper.niFake_SetAttributeViReal64 + self.side_effects_helper['SetAttributeViReal64']['return'] = test_error_code + self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError + self.side_effects_helper['GetError']['errorCode'] = test_error_code + self.side_effects_helper['GetError']['description'] = test_error_desc + with nifake.Session('dev1') as session: try: session.read_write_double = -42.0 assert False except nifake.Error as e: assert e.code == test_error_code assert e.description == test_error_desc - self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(1000001), - _matchers.ViReal64Matcher(-42.0), - ) + self.patched_library.niFake_SetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(1000001), _matchers.ViReal64Matcher(-42.0)) def test_add_properties_to_session_error_set(self): - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: try: session.non_existent_property = 5 assert False except AttributeError as e: - assert ( - str(e) - == "'Session' object has no attribute 'non_existent_property'" - ) + assert str(e) == "'Session' object has no attribute 'non_existent_property'" def test_add_properties_to_session_error_get(self): - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: try: value = session.non_existent_property # noqa: F841 assert False except AttributeError as e: - assert ( - str(e) - == "'Session' object has no attribute 'non_existent_property'" - ) + assert str(e) == "'Session' object has no attribute 'non_existent_property'" def test_add_properties_to_repeated_capability_error_set(self): - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: try: - session.channels["0"].non_existent_property = 5 + session.channels['0'].non_existent_property = 5 assert False except AttributeError as e: - assert ( - str(e) - == "'_SessionBase' object has no attribute 'non_existent_property'" - ) + assert str(e) == "'_SessionBase' object has no attribute 'non_existent_property'" def test_add_properties_to_repeated_capability_error_get(self): - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: try: - value = session.channels["0"].non_existent_property # noqa: F841 + value = session.channels['0'].non_existent_property # noqa: F841 assert False except AttributeError as e: - assert ( - str(e) - == "'_SessionBase' object has no attribute 'non_existent_property'" - ) + assert str(e) == "'_SessionBase' object has no attribute 'non_existent_property'" def test_set_enum_attribute_int32_error(self): - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: try: session.read_write_color = 5 except TypeError as e: - assert str(e) == "must be Color not int" + assert str(e) == 'must be Color not int' def test_set_wrong_enum_attribute_int32_error(self): - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: try: session.read_write_color = nifake.FloatEnum.SIX_POINT_FIVE except TypeError as e: - assert str(e) == "must be Color not FloatEnum" + assert str(e) == 'must be Color not FloatEnum' # Error descriptions def test_get_error_and_error_message_returns_error(self): test_error_code = -42 - self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = ( - self.side_effects_helper.niFake_PoorlyNamedSimpleFunction - ) - self.side_effects_helper["PoorlyNamedSimpleFunction"][ - "return" - ] = test_error_code - self.patched_library.niFake_GetError.side_effect = ( - self.side_effects_helper.niFake_GetError - ) - self.side_effects_helper["GetError"]["errorCode"] = -1 - self.side_effects_helper["GetError"]["description"] = "Shouldn't get this" - self.side_effects_helper["GetError"]["return"] = -2 - self.patched_library.niFake_error_message.side_effect = ( - self.side_effects_helper.niFake_error_message - ) - self.side_effects_helper["error_message"][ - "errorMessage" - ] = "Also shouldn't get this" - self.side_effects_helper["error_message"]["return"] = -3 - with nifake.Session("dev1") as session: + self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = self.side_effects_helper.niFake_PoorlyNamedSimpleFunction + self.side_effects_helper['PoorlyNamedSimpleFunction']['return'] = test_error_code + self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError + self.side_effects_helper['GetError']['errorCode'] = -1 + self.side_effects_helper['GetError']['description'] = "Shouldn't get this" + self.side_effects_helper['GetError']['return'] = -2 + self.patched_library.niFake_error_message.side_effect = self.side_effects_helper.niFake_error_message + self.side_effects_helper['error_message']['errorMessage'] = "Also shouldn't get this" + self.side_effects_helper['error_message']['return'] = -3 + with nifake.Session('dev1') as session: try: session.simple_function() except nifake.Error as e: assert e.code == test_error_code - assert e.description == "Failed to retrieve error description." + assert e.description == 'Failed to retrieve error description.' def test_get_error_description_error_message_error(self): test_error_code = -42 test_error_desc = "The answer to the ultimate question" - self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = ( - self.side_effects_helper.niFake_PoorlyNamedSimpleFunction - ) - self.side_effects_helper["PoorlyNamedSimpleFunction"][ - "return" - ] = test_error_code - self.patched_library.niFake_GetError.side_effect = ( - self.side_effects_helper.niFake_GetError - ) - self.side_effects_helper["GetError"]["errorCode"] = -1 - self.side_effects_helper["GetError"]["description"] = "Shouldn't get this" - self.side_effects_helper["GetError"]["return"] = -2 - self.patched_library.niFake_error_message.side_effect = ( - self.side_effects_helper.niFake_error_message - ) - self.side_effects_helper["error_message"]["errorMessage"] = test_error_desc - with nifake.Session("dev1") as session: + self.patched_library.niFake_PoorlyNamedSimpleFunction.side_effect = self.side_effects_helper.niFake_PoorlyNamedSimpleFunction + self.side_effects_helper['PoorlyNamedSimpleFunction']['return'] = test_error_code + self.patched_library.niFake_GetError.side_effect = self.side_effects_helper.niFake_GetError + self.side_effects_helper['GetError']['errorCode'] = -1 + self.side_effects_helper['GetError']['description'] = "Shouldn't get this" + self.side_effects_helper['GetError']['return'] = -2 + self.patched_library.niFake_error_message.side_effect = self.side_effects_helper.niFake_error_message + self.side_effects_helper['error_message']['errorMessage'] = test_error_desc + with nifake.Session('dev1') as session: try: session.simple_function() except nifake.Error as e: assert e.code == test_error_code assert e.description == test_error_desc - self.patched_library.niFake_error_message.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt32Matcher(test_error_code), - _matchers.ViCharBufferMatcher(256), - ) + self.patched_library.niFake_error_message.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(test_error_code), _matchers.ViCharBufferMatcher(256)) # Custom types def test_set_custom_type(self): - self.patched_library.niFake_SetCustomType.side_effect = ( - self.side_effects_helper.niFake_SetCustomType - ) + self.patched_library.niFake_SetCustomType.side_effect = self.side_effects_helper.niFake_SetCustomType cs = nifake.CustomStruct(struct_int=42, struct_double=4.2) - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: session.set_custom_type(cs) - self.patched_library.niFake_SetCustomType.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.CustomTypeMatcher( - nifake.struct_CustomStruct, nifake.struct_CustomStruct(cs) - ), - ) + self.patched_library.niFake_SetCustomType.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.CustomTypeMatcher(nifake.struct_CustomStruct, nifake.struct_CustomStruct(cs))) def test_get_custom_type(self): - self.patched_library.niFake_GetCustomType.side_effect = ( - self.side_effects_helper.niFake_GetCustomType - ) + self.patched_library.niFake_GetCustomType.side_effect = self.side_effects_helper.niFake_GetCustomType cs_ctype = nifake.struct_CustomStruct(struct_int=42, struct_double=4.2) - self.side_effects_helper["GetCustomType"]["cs"] = cs_ctype - with nifake.Session("dev1") as session: + self.side_effects_helper['GetCustomType']['cs'] = cs_ctype + with nifake.Session('dev1') as session: cs = session.get_custom_type() assert cs.struct_int == cs_ctype.struct_int assert cs.struct_double == cs_ctype.struct_double def test_set_custom_type_array(self): - self.patched_library.niFake_SetCustomTypeArray.side_effect = ( - self.side_effects_helper.niFake_SetCustomTypeArray - ) - cs = [ - nifake.CustomStruct(struct_int=42, struct_double=4.2), - nifake.CustomStruct(struct_int=43, struct_double=4.3), - nifake.CustomStruct(struct_int=42, struct_double=4.3), - ] - cs_ctype = (nifake.struct_CustomStruct * len(cs))( - *[nifake.struct_CustomStruct(c) for c in cs] - ) - with nifake.Session("dev1") as session: + self.patched_library.niFake_SetCustomTypeArray.side_effect = self.side_effects_helper.niFake_SetCustomTypeArray + cs = [nifake.CustomStruct(struct_int=42, struct_double=4.2), nifake.CustomStruct(struct_int=43, struct_double=4.3), nifake.CustomStruct(struct_int=42, struct_double=4.3)] + cs_ctype = (nifake.struct_CustomStruct * len(cs))(*[nifake.struct_CustomStruct(c) for c in cs]) + with nifake.Session('dev1') as session: session.set_custom_type_array(cs) - self.patched_library.niFake_SetCustomTypeArray.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt32Matcher(len(cs)), - _matchers.CustomTypeBufferMatcher(nifake.struct_CustomStruct, cs_ctype), - ) + self.patched_library.niFake_SetCustomTypeArray.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(cs)), _matchers.CustomTypeBufferMatcher(nifake.struct_CustomStruct, cs_ctype)) def test_get_custom_type_array(self): - self.patched_library.niFake_GetCustomTypeArray.side_effect = ( - self.side_effects_helper.niFake_GetCustomTypeArray - ) - cs = [ - nifake.CustomStruct(struct_int=42, struct_double=4.2), - nifake.CustomStruct(struct_int=43, struct_double=4.3), - nifake.CustomStruct(struct_int=42, struct_double=4.3), - ] - cs_ctype = (nifake.struct_CustomStruct * len(cs))( - *[nifake.struct_CustomStruct(c) for c in cs] - ) - self.side_effects_helper["GetCustomTypeArray"]["cs"] = cs_ctype - with nifake.Session("dev1") as session: + self.patched_library.niFake_GetCustomTypeArray.side_effect = self.side_effects_helper.niFake_GetCustomTypeArray + cs = [nifake.CustomStruct(struct_int=42, struct_double=4.2), nifake.CustomStruct(struct_int=43, struct_double=4.3), nifake.CustomStruct(struct_int=42, struct_double=4.3)] + cs_ctype = (nifake.struct_CustomStruct * len(cs))(*[nifake.struct_CustomStruct(c) for c in cs]) + self.side_effects_helper['GetCustomTypeArray']['cs'] = cs_ctype + with nifake.Session('dev1') as session: cs_test = session.get_custom_type_array(len(cs_ctype)) assert len(cs_test) == len(cs_ctype) for actual, expected in zip(cs_test, cs): @@ -1961,22 +1229,13 @@ def test_get_custom_type_array(self): def test_get_array_using_python_code_double(self): import nifake._visatype - - self.patched_library.niFake_GetArraySizeForPythonCode.side_effect = ( - self.side_effects_helper.niFake_GetArraySizeForPythonCode - ) - self.patched_library.niFake_GetArrayForPythonCodeDouble.side_effect = ( - self.side_effects_helper.niFake_GetArrayForPythonCodeDouble - ) + self.patched_library.niFake_GetArraySizeForPythonCode.side_effect = self.side_effects_helper.niFake_GetArraySizeForPythonCode + self.patched_library.niFake_GetArrayForPythonCodeDouble.side_effect = self.side_effects_helper.niFake_GetArrayForPythonCodeDouble array_out = [42.0, 43.0, 44.0] array_out_ctype = (nifake._visatype.ViReal64 * len(array_out))(*array_out) - self.side_effects_helper["GetArraySizeForPythonCode"]["sizeOut"] = len( - array_out - ) - self.side_effects_helper["GetArrayForPythonCodeDouble"][ - "arrayOut" - ] = array_out_ctype - with nifake.Session("dev1") as session: + self.side_effects_helper['GetArraySizeForPythonCode']['sizeOut'] = len(array_out) + self.side_effects_helper['GetArrayForPythonCodeDouble']['arrayOut'] = array_out_ctype + with nifake.Session('dev1') as session: array_out_test = session.get_array_for_python_code_double() assert len(array_out_test) == len(array_out) for actual, expected in zip(array_out_test, array_out): @@ -1984,26 +1243,13 @@ def test_get_array_using_python_code_double(self): def test_get_array_using_python_code_custom_type(self): import nifake._visatype - - self.patched_library.niFake_GetArraySizeForPythonCode.side_effect = ( - self.side_effects_helper.niFake_GetArraySizeForPythonCode - ) - self.patched_library.niFake_GetArrayForPythonCodeCustomType.side_effect = ( - self.side_effects_helper.niFake_GetArrayForPythonCodeCustomType - ) - cs = [ - nifake.CustomStruct(struct_int=42, struct_double=4.2), - nifake.CustomStruct(struct_int=43, struct_double=4.3), - nifake.CustomStruct(struct_int=42, struct_double=4.3), - ] - cs_ctype = (nifake.struct_CustomStruct * len(cs))( - *[nifake.struct_CustomStruct(c) for c in cs] - ) - self.side_effects_helper["GetArraySizeForPythonCode"]["sizeOut"] = len(cs) - self.side_effects_helper["GetArrayForPythonCodeCustomType"][ - "arrayOut" - ] = cs_ctype - with nifake.Session("dev1") as session: + self.patched_library.niFake_GetArraySizeForPythonCode.side_effect = self.side_effects_helper.niFake_GetArraySizeForPythonCode + self.patched_library.niFake_GetArrayForPythonCodeCustomType.side_effect = self.side_effects_helper.niFake_GetArrayForPythonCodeCustomType + cs = [nifake.CustomStruct(struct_int=42, struct_double=4.2), nifake.CustomStruct(struct_int=43, struct_double=4.3), nifake.CustomStruct(struct_int=42, struct_double=4.3)] + cs_ctype = (nifake.struct_CustomStruct * len(cs))(*[nifake.struct_CustomStruct(c) for c in cs]) + self.side_effects_helper['GetArraySizeForPythonCode']['sizeOut'] = len(cs) + self.side_effects_helper['GetArrayForPythonCodeCustomType']['arrayOut'] = cs_ctype + with nifake.Session('dev1') as session: cs_test = session.get_array_for_python_code_custom_type() assert len(cs_test) == len(cs) for actual, expected in zip(cs_test, cs): @@ -2011,31 +1257,27 @@ def test_get_array_using_python_code_custom_type(self): assert actual.struct_double == expected.struct_double def test_get_cal_date_time(self): - self.patched_library.niFake_GetCalDateAndTime.side_effect = ( - self.side_effects_helper.niFake_GetCalDateAndTime - ) + self.patched_library.niFake_GetCalDateAndTime.side_effect = self.side_effects_helper.niFake_GetCalDateAndTime month = 12 day = 30 year = 1988 hour = 10 minute = 15 - self.side_effects_helper["GetCalDateAndTime"]["return"] = 0 - self.side_effects_helper["GetCalDateAndTime"]["month"] = month - self.side_effects_helper["GetCalDateAndTime"]["day"] = day - self.side_effects_helper["GetCalDateAndTime"]["year"] = year - self.side_effects_helper["GetCalDateAndTime"]["hour"] = hour - self.side_effects_helper["GetCalDateAndTime"]["minute"] = minute - with nifake.Session("dev1") as session: + self.side_effects_helper['GetCalDateAndTime']['return'] = 0 + self.side_effects_helper['GetCalDateAndTime']['month'] = month + self.side_effects_helper['GetCalDateAndTime']['day'] = day + self.side_effects_helper['GetCalDateAndTime']['year'] = year + self.side_effects_helper['GetCalDateAndTime']['hour'] = hour + self.side_effects_helper['GetCalDateAndTime']['minute'] = minute + with nifake.Session('dev1') as session: last_cal = session.get_cal_date_and_time(0) assert isinstance(last_cal, hightime.datetime) assert hightime.datetime(year, month, day, hour, minute) == last_cal def test_get_cal_interval(self): - self.patched_library.niFake_GetCalInterval = ( - self.side_effects_helper.niFake_GetCalInterval - ) - self.side_effects_helper["GetCalInterval"]["months"] = 24 - with nifake.Session("dev1") as session: + self.patched_library.niFake_GetCalInterval = self.side_effects_helper.niFake_GetCalInterval + self.side_effects_helper['GetCalInterval']['months'] = 24 + with nifake.Session('dev1') as session: last_cal = session.get_cal_interval() assert isinstance(last_cal, hightime.timedelta) assert 730 == last_cal.days @@ -2043,119 +1285,69 @@ def test_get_cal_interval(self): # Import/Export functions def test_import_attribute_configuration_buffer_list_i8(self): - self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = ( - self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer - ) - expected_list = [ord("a"), ord("b"), ord("c"), ord("d")] + self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer + expected_list = [ord('a'), ord('b'), ord('c'), ord('d')] configuration = expected_list - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list] self.get_ctypes_pointer_for_buffer_side_effect_count = 0 - with patch( - "nifake.session.get_ctypes_pointer_for_buffer", - side_effect=self.get_ctypes_pointer_for_buffer_side_effect, - ): + with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect): session.import_attribute_configuration_buffer(configuration) - self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt32Matcher(len(configuration)), - _matchers.ViInt8BufferMatcher(expected_list), - ) + self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(configuration)), _matchers.ViInt8BufferMatcher(expected_list)) def test_import_attribute_configuration_buffer_bytes(self): - self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = ( - self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer - ) - expected_list = [ord("a"), ord("b"), ord("c"), ord("d")] - configuration = b"abcd" - with nifake.Session("dev1") as session: + self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer + expected_list = [ord('a'), ord('b'), ord('c'), ord('d')] + configuration = b'abcd' + with nifake.Session('dev1') as session: self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list] self.get_ctypes_pointer_for_buffer_side_effect_count = 0 - with patch( - "nifake.session.get_ctypes_pointer_for_buffer", - side_effect=self.get_ctypes_pointer_for_buffer_side_effect, - ): + with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect): session.import_attribute_configuration_buffer(configuration) - self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt32Matcher(len(configuration)), - _matchers.ViInt8BufferMatcher(expected_list), - ) + self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(configuration)), _matchers.ViInt8BufferMatcher(expected_list)) def test_import_attribute_configuration_buffer_bytearray(self): - self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = ( - self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer - ) - expected_list = [ord("a"), ord("b"), ord("c"), ord("d")] - configuration = bytearray(b"abcd") - with nifake.Session("dev1") as session: + self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer + expected_list = [ord('a'), ord('b'), ord('c'), ord('d')] + configuration = bytearray(b'abcd') + with nifake.Session('dev1') as session: self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list] self.get_ctypes_pointer_for_buffer_side_effect_count = 0 - with patch( - "nifake.session.get_ctypes_pointer_for_buffer", - side_effect=self.get_ctypes_pointer_for_buffer_side_effect, - ): + with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect): session.import_attribute_configuration_buffer(configuration) - self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt32Matcher(len(configuration)), - _matchers.ViInt8BufferMatcher(expected_list), - ) + self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(configuration)), _matchers.ViInt8BufferMatcher(expected_list)) def test_import_attribute_configuration_buffer_array_bytes(self): - self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = ( - self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer - ) - expected_list = [ord("a"), ord("b"), ord("c"), ord("d")] - configuration = array.array("b", b"abcd") - with nifake.Session("dev1") as session: + self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer + expected_list = [ord('a'), ord('b'), ord('c'), ord('d')] + configuration = array.array('b', b'abcd') + with nifake.Session('dev1') as session: self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list] self.get_ctypes_pointer_for_buffer_side_effect_count = 0 - with patch( - "nifake.session.get_ctypes_pointer_for_buffer", - side_effect=self.get_ctypes_pointer_for_buffer_side_effect, - ): + with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect): session.import_attribute_configuration_buffer(configuration) - self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt32Matcher(len(configuration)), - _matchers.ViInt8BufferMatcher(expected_list), - ) + self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(configuration)), _matchers.ViInt8BufferMatcher(expected_list)) def test_import_attribute_configuration_buffer_str(self): - self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = ( - self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer - ) - expected_list = [ord("a"), ord("b"), ord("c"), ord("d")] - configuration = "abcd" - with nifake.Session("dev1") as session: + self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer + expected_list = [ord('a'), ord('b'), ord('c'), ord('d')] + configuration = 'abcd' + with nifake.Session('dev1') as session: self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list] self.get_ctypes_pointer_for_buffer_side_effect_count = 0 - with patch( - "nifake.session.get_ctypes_pointer_for_buffer", - side_effect=self.get_ctypes_pointer_for_buffer_side_effect, - ): + with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect): session.import_attribute_configuration_buffer(configuration) - self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt32Matcher(len(configuration)), - _matchers.ViInt8BufferMatcher(expected_list), - ) + self.patched_library.niFake_ImportAttributeConfigurationBuffer.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(configuration)), _matchers.ViInt8BufferMatcher(expected_list)) # Invalid types def test_import_attribute_configuration_buffer_list_i8_big(self): - self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = ( - self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer - ) - expected_list = [ord("a") * 100, ord("b") * 100, ord("c") * 100, ord("d") * 100] + self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer + expected_list = [ord('a') * 100, ord('b') * 100, ord('c') * 100, ord('d') * 100] configuration = expected_list - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list] self.get_ctypes_pointer_for_buffer_side_effect_count = 0 - with patch( - "nifake.session.get_ctypes_pointer_for_buffer", - side_effect=self.get_ctypes_pointer_for_buffer_side_effect, - ): + with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect): try: session.import_attribute_configuration_buffer(configuration) assert False @@ -2163,18 +1355,13 @@ def test_import_attribute_configuration_buffer_list_i8_big(self): pass def test_import_attribute_configuration_buffer_list_i8_float(self): - self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = ( - self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer - ) - expected_list = [ord("a") * 1.0, ord("b") * 1.0, ord("c") * 1.0, ord("d") * 1.0] + self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer + expected_list = [ord('a') * 1.0, ord('b') * 1.0, ord('c') * 1.0, ord('d') * 1.0] configuration = expected_list - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list] self.get_ctypes_pointer_for_buffer_side_effect_count = 0 - with patch( - "nifake.session.get_ctypes_pointer_for_buffer", - side_effect=self.get_ctypes_pointer_for_buffer_side_effect, - ): + with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect): try: session.import_attribute_configuration_buffer(configuration) assert False @@ -2182,23 +1369,13 @@ def test_import_attribute_configuration_buffer_list_i8_float(self): pass def test_import_attribute_configuration_buffer_list_i8_big_float(self): - self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = ( - self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer - ) - expected_list = [ - ord("a") * 100.0, - ord("b") * 100.0, - ord("c") * 100.0, - ord("d") * 100.0, - ] + self.patched_library.niFake_ImportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ImportAttributeConfigurationBuffer + expected_list = [ord('a') * 100.0, ord('b') * 100.0, ord('c') * 100.0, ord('d') * 100.0] configuration = expected_list - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_list] self.get_ctypes_pointer_for_buffer_side_effect_count = 0 - with patch( - "nifake.session.get_ctypes_pointer_for_buffer", - side_effect=self.get_ctypes_pointer_for_buffer_side_effect, - ): + with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect): try: session.import_attribute_configuration_buffer(configuration) assert False @@ -2206,36 +1383,19 @@ def test_import_attribute_configuration_buffer_list_i8_big_float(self): pass def test_export_attribute_configuration_buffer(self): - self.patched_library.niFake_ExportAttributeConfigurationBuffer.side_effect = ( - self.side_effects_helper.niFake_ExportAttributeConfigurationBuffer - ) - expected_buffer_list = [ - ord("a"), - ord("b"), - ord("c"), - ord("d"), - ] + self.patched_library.niFake_ExportAttributeConfigurationBuffer.side_effect = self.side_effects_helper.niFake_ExportAttributeConfigurationBuffer + expected_buffer_list = [ord('a'), ord('b'), ord('c'), ord('d'), ] # Because we are mocking get_ctypes_pointer_for_buffer() we don't end up using the array allocated in the function call. Instead, we will allocate the arrays here # and have the mock return them. These are the ones that are actually filled in by the function. - expected_buffer = array.array("b", [0] * len(expected_buffer_list)) - expected_buffer_ctypes = ctypes.cast( - expected_buffer.buffer_info()[0], - ctypes.POINTER(nifake._visatype.ViInt8 * len(expected_buffer_list)), - ) - - self.side_effects_helper["ExportAttributeConfigurationBuffer"][ - "configuration" - ] = expected_buffer_list - with nifake.Session("dev1") as session: - self.get_ctypes_pointer_for_buffer_side_effect_items = [ - expected_buffer_ctypes - ] + expected_buffer = array.array('b', [0] * len(expected_buffer_list)) + expected_buffer_ctypes = ctypes.cast(expected_buffer.buffer_info()[0], ctypes.POINTER(nifake._visatype.ViInt8 * len(expected_buffer_list))) + + self.side_effects_helper['ExportAttributeConfigurationBuffer']['configuration'] = expected_buffer_list + with nifake.Session('dev1') as session: + self.get_ctypes_pointer_for_buffer_side_effect_items = [expected_buffer_ctypes] self.get_ctypes_pointer_for_buffer_side_effect_count = 0 - with patch( - "nifake.session.get_ctypes_pointer_for_buffer", - side_effect=self.get_ctypes_pointer_for_buffer_side_effect, - ): + with patch('nifake.session.get_ctypes_pointer_for_buffer', side_effect=self.get_ctypes_pointer_for_buffer_side_effect): actual_configuration = session.export_attribute_configuration_buffer() assert type(actual_configuration) is bytes assert len(actual_configuration) == len(expected_buffer_list) @@ -2245,170 +1405,111 @@ def test_export_attribute_configuration_buffer(self): assert expected_buffer[i] == expected_buffer_list[i] def test_matcher_prints(self): - assert ( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST).__repr__() - == "ViSessionMatcher(" + str(nifake._visatype.ViSession) + ", 42)" - ) - assert ( - _matchers.ViAttrMatcher(SESSION_NUM_FOR_TEST).__repr__() - == "ViAttrMatcher(" + str(nifake._visatype.ViAttr) + ", 42)" - ) - assert ( - _matchers.ViInt32Matcher(4).__repr__() - == "ViInt32Matcher(" + str(nifake._visatype.ViInt32) + ", 4)" - ) - assert _matchers.ViStringMatcher("0-24").__repr__() == "ViStringMatcher('0-24')" - assert ( - _matchers.ViReal64Matcher(-42.0).__repr__() - == "ViReal64Matcher(" + str(nifake._visatype.ViReal64) + ", -42.0)" - ) - assert ( - _matchers.ViReal64PointerMatcher().__repr__() - == "ViReal64PointerMatcher(" + str(nifake._visatype.ViReal64) + ")" - ) - assert ( - _matchers.ViInt32PointerMatcher().__repr__() - == "ViInt32PointerMatcher(" + str(nifake._visatype.ViInt32) + ")" - ) - cs = [ - nifake.CustomStruct(struct_int=42, struct_double=4.2), - nifake.CustomStruct(struct_int=43, struct_double=4.3), - nifake.CustomStruct(struct_int=42, struct_double=4.3), - ] - cs_ctype = (nifake.struct_CustomStruct * len(cs))( - *[nifake.struct_CustomStruct(c) for c in cs] - ) - assert ( - _matchers.CustomTypeMatcher( - nifake.struct_CustomStruct, nifake.struct_CustomStruct(cs[0]) - ).__repr__() - == "CustomTypeMatcher(, struct_CustomStruct(data=None, struct_int=42, struct_double=4.2))" - ) - assert ( - _matchers.CustomTypeBufferMatcher( - nifake.struct_CustomStruct, cs_ctype - ).__repr__() - == "CustomTypeBufferMatcher(, [struct_CustomStruct(data=None, struct_int=42, struct_double=4.2), struct_CustomStruct(data=None, struct_int=43, struct_double=4.3), struct_CustomStruct(data=None, struct_int=42, struct_double=4.3)])" - ) + assert _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST).__repr__() == "ViSessionMatcher(" + str(nifake._visatype.ViSession) + ", 42)" + assert _matchers.ViAttrMatcher(SESSION_NUM_FOR_TEST).__repr__() == "ViAttrMatcher(" + str(nifake._visatype.ViAttr) + ", 42)" + assert _matchers.ViInt32Matcher(4).__repr__() == "ViInt32Matcher(" + str(nifake._visatype.ViInt32) + ", 4)" + assert _matchers.ViStringMatcher('0-24').__repr__() == "ViStringMatcher('0-24')" + assert _matchers.ViReal64Matcher(-42.0).__repr__() == "ViReal64Matcher(" + str(nifake._visatype.ViReal64) + ", -42.0)" + assert _matchers.ViReal64PointerMatcher().__repr__() == "ViReal64PointerMatcher(" + str(nifake._visatype.ViReal64) + ")" + assert _matchers.ViInt32PointerMatcher().__repr__() == "ViInt32PointerMatcher(" + str(nifake._visatype.ViInt32) + ")" + cs = [nifake.CustomStruct(struct_int=42, struct_double=4.2), nifake.CustomStruct(struct_int=43, struct_double=4.3), nifake.CustomStruct(struct_int=42, struct_double=4.3)] + cs_ctype = (nifake.struct_CustomStruct * len(cs))(*[nifake.struct_CustomStruct(c) for c in cs]) + assert _matchers.CustomTypeMatcher(nifake.struct_CustomStruct, nifake.struct_CustomStruct(cs[0])).__repr__() == "CustomTypeMatcher(, struct_CustomStruct(data=None, struct_int=42, struct_double=4.2))" + assert _matchers.CustomTypeBufferMatcher(nifake.struct_CustomStruct, cs_ctype).__repr__() == "CustomTypeBufferMatcher(, [struct_CustomStruct(data=None, struct_int=42, struct_double=4.2), struct_CustomStruct(data=None, struct_int=43, struct_double=4.3), struct_CustomStruct(data=None, struct_int=42, struct_double=4.3)])" def test_channel_on_session(self): - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: try: - session["100"].read_write_double = 5.0 + session['100'].read_write_double = 5.0 assert False except TypeError: pass def test_function_name(self): - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: # Pick a function that uses @ivi_synchronized - assert ( - session.bool_array_output_function.__name__ - == "bool_array_output_function" - ) + assert session.bool_array_output_function.__name__ == 'bool_array_output_function' # Pick several functions that do not use @ivi_synchronized to make sure they don't break in the future - assert session.lock.__name__ == "lock" - assert session._error_message.__name__ == "_error_message" - assert session.initiate.__name__ == "initiate" + assert session.lock.__name__ == 'lock' + assert session._error_message.__name__ == '_error_message' + assert session.initiate.__name__ == 'initiate' # Cannot use session..__name__ since that invokes the get attribute value and the returned value # (string, int, float) don't have __name__ properties def test_buffer_converter(self): - self.patched_library.niFake_DoubleAllTheNums.side_effect = ( - self.side_effects_helper.niFake_DoubleAllTheNums - ) + self.patched_library.niFake_DoubleAllTheNums.side_effect = self.side_effects_helper.niFake_DoubleAllTheNums nums = [1, 2, 3, 4.2] nums_x2 = [x * 2 for x in nums] - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: session.double_all_the_nums(nums) - self.patched_library.niFake_DoubleAllTheNums.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViInt32Matcher(len(nums)), - _matchers.ViReal64BufferMatcher(nums_x2), - ) + self.patched_library.niFake_DoubleAllTheNums.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(nums)), _matchers.ViReal64BufferMatcher(nums_x2)) def test_nitclk_integration(self): - with nifake.Session("dev1") as session: - assert ( - str(type(session.tclk)) == "" - ) + with nifake.Session('dev1') as session: + assert str(type(session.tclk)) == "" def test_accept_list_of_time_values_as_floats(self): - self.patched_library.niFake_AcceptListOfDurationsInSeconds.side_effect = ( - self.side_effects_helper.niFake_AcceptListOfDurationsInSeconds - ) + self.patched_library.niFake_AcceptListOfDurationsInSeconds.side_effect = self.side_effects_helper.niFake_AcceptListOfDurationsInSeconds delays = [-1.5, 2.0] - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: session.accept_list_of_durations_in_seconds(delays) self.patched_library.niFake_AcceptListOfDurationsInSeconds.assert_called_once_with( _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(delays)), - _matchers.ViReal64BufferMatcher(delays), + _matchers.ViReal64BufferMatcher(delays) ) def test_accept_array_of_time_values_as_floats(self): - self.patched_library.niFake_AcceptListOfDurationsInSeconds.side_effect = ( - self.side_effects_helper.niFake_AcceptListOfDurationsInSeconds - ) + self.patched_library.niFake_AcceptListOfDurationsInSeconds.side_effect = self.side_effects_helper.niFake_AcceptListOfDurationsInSeconds time_values = [-1.5, 2.0] - delays = array.array("d", time_values) - with nifake.Session("dev1") as session: + delays = array.array('d', time_values) + with nifake.Session('dev1') as session: session.accept_list_of_durations_in_seconds(delays) self.patched_library.niFake_AcceptListOfDurationsInSeconds.assert_called_once_with( _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(delays)), - _matchers.ViReal64BufferMatcher(time_values), + _matchers.ViReal64BufferMatcher(time_values) ) def test_accept_list_of_time_values_as_timedelta_instances(self): - self.patched_library.niFake_AcceptListOfDurationsInSeconds.side_effect = ( - self.side_effects_helper.niFake_AcceptListOfDurationsInSeconds - ) + self.patched_library.niFake_AcceptListOfDurationsInSeconds.side_effect = self.side_effects_helper.niFake_AcceptListOfDurationsInSeconds time_values = [-1.5, 2e-9] delays = [datetime.timedelta(seconds=-1.5), hightime.timedelta(nanoseconds=2)] - with nifake.Session("dev1") as session: + with nifake.Session('dev1') as session: session.accept_list_of_durations_in_seconds(delays) self.patched_library.niFake_AcceptListOfDurationsInSeconds.assert_called_once_with( _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(delays)), - _matchers.ViReal64BufferMatcher(time_values), + _matchers.ViReal64BufferMatcher(time_values) ) def test_return_timedelta(self): - self.patched_library.niFake_ReturnDurationInSeconds.side_effect = ( - self.side_effects_helper.niFake_ReturnDurationInSeconds - ) + self.patched_library.niFake_ReturnDurationInSeconds.side_effect = self.side_effects_helper.niFake_ReturnDurationInSeconds time_value = -1.5 expected_timedelta = hightime.timedelta(seconds=time_value) - self.side_effects_helper["ReturnDurationInSeconds"]["timedelta"] = time_value - with nifake.Session("dev1") as session: + self.side_effects_helper['ReturnDurationInSeconds']['timedelta'] = time_value + with nifake.Session('dev1') as session: returned_timedelta = session.return_duration_in_seconds() assert returned_timedelta == expected_timedelta self.patched_library.niFake_ReturnDurationInSeconds.assert_called_once_with( _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViReal64PointerMatcher(), + _matchers.ViReal64PointerMatcher() ) def test_return_timedeltas(self): - self.patched_library.niFake_ReturnListOfDurationsInSeconds.side_effect = ( - self.side_effects_helper.niFake_ReturnListOfDurationsInSeconds - ) + self.patched_library.niFake_ReturnListOfDurationsInSeconds.side_effect = self.side_effects_helper.niFake_ReturnListOfDurationsInSeconds time_values = [-1.5, 2.0] time_values_ctype = (nifake._visatype.ViReal64 * len(time_values))(*time_values) expected_timedeltas = [hightime.timedelta(seconds=i) for i in time_values] - self.side_effects_helper["ReturnListOfDurationsInSeconds"][ - "timedeltas" - ] = time_values_ctype - with nifake.Session("dev1") as session: - returned_timedeltas = session.return_list_of_durations_in_seconds( - len(expected_timedeltas) - ) + self.side_effects_helper['ReturnListOfDurationsInSeconds']['timedeltas'] = time_values_ctype + with nifake.Session('dev1') as session: + returned_timedeltas = session.return_list_of_durations_in_seconds(len(expected_timedeltas)) assert len(returned_timedeltas) == len(expected_timedeltas) assert returned_timedeltas == expected_timedeltas self.patched_library.niFake_ReturnListOfDurationsInSeconds.assert_called_once_with( _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViInt32Matcher(len(time_values)), - _matchers.ViReal64BufferMatcher(len(time_values)), + _matchers.ViReal64BufferMatcher(len(time_values)) ) @@ -2419,15 +1520,15 @@ def test_diagnostic_information(): def test_dunder_version(): - print("Version = {}".format(nifake.__version__)) + print('Version = {}'.format(nifake.__version__)) assert type(nifake.__version__) is str def test_library_error(): - if platform.architecture()[0] == "64bit": - ctypes_class_name = "ctypes.CDLL" + if platform.architecture()[0] == '64bit': + ctypes_class_name = 'ctypes.CDLL' else: - ctypes_class_name = "ctypes.WinDLL" + ctypes_class_name = 'ctypes.WinDLL' mock_ctypes = patch(ctypes_class_name).start() mock_ctypes_instance = mock_ctypes.return_value # Ensure these methods return 0 because they are called in session creation @@ -2435,16 +1536,13 @@ def test_library_error(): mock_ctypes_instance.niFake_LockSession.return_value = 0 mock_ctypes_instance.niFake_UnlockSession.return_value = 0 # Delete function to simulate missing function from driver runtime - delattr(mock_ctypes_instance, "niFake_Abort") + delattr(mock_ctypes_instance, 'niFake_Abort') - session = nifake.Session("dev1") + session = nifake.Session('dev1') try: session.abort() assert False except nifake.errors.DriverTooOldError as e: message = e.args[0] - assert ( - message - == "A function was not found in the NI-FAKE runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it." - ) + assert message == 'A function was not found in the NI-FAKE runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it.' diff --git a/generated/nifake/setup.py b/generated/nifake/setup.py index 859266663..65ff38cd5 100644 --- a/generated/nifake/setup.py +++ b/generated/nifake/setup.py @@ -15,45 +15,42 @@ def finalize_options(self): def run_tests(self): import pytest - pytest.main(self.test_args) -pypi_name = "nifake" +pypi_name = 'nifake' def read_contents(file_to_read): - with open(file_to_read, "r") as f: + with open(file_to_read, 'r') as f: return f.read() setup( name=pypi_name, zip_safe=True, - version="1.4.2.dev0", - description="NI-FAKE Python API", - long_description=read_contents("README.rst"), - long_description_content_type="text/x-rst", - author="NI", + version='1.4.2.dev0', + description='NI-FAKE Python API', + long_description=read_contents('README.rst'), + long_description_content_type='text/x-rst', + author='NI', author_email="opensource@ni.com", url="https://github.com/ni/nimi-python", maintainer="NI", maintainer_email="opensource@ni.com", - keywords=["nifake"], - license="MIT", + keywords=['nifake'], + license='MIT', include_package_data=True, - packages=["nifake"], + packages=['nifake'], install_requires=[ 'enum34;python_version<"3.4"', 'singledispatch;python_version<"3.4"', - "hightime>=0.2.0", - "nitclk", - ], - setup_requires=[ - "pytest-runner", + 'hightime>=0.2.0', + 'nitclk', ], - tests_require=["pytest"], - test_suite="tests", + setup_requires=['pytest-runner', ], + tests_require=['pytest'], + test_suite='tests', classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -68,8 +65,8 @@ def read_contents(file_to_read): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", - "Topic :: System :: Hardware :: Hardware Drivers", + "Topic :: System :: Hardware :: Hardware Drivers" ], - cmdclass={"test": PyTest}, - package_data={pypi_name: ["VERSION"]}, + cmdclass={'test': PyTest}, + package_data={pypi_name: ['VERSION']}, ) diff --git a/generated/nifgen/nifgen/__init__.py b/generated/nifgen/nifgen/__init__.py index 061ff0f45..072fbdf5b 100644 --- a/generated/nifgen/nifgen/__init__.py +++ b/generated/nifgen/nifgen/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = "1.4.2.dev0" +__version__ = '1.4.2.dev0' from nifgen.enums import * # noqa: F403,F401,H303 from nifgen.errors import DriverWarning # noqa: F401 @@ -11,12 +11,12 @@ def get_diagnostic_information(): - """Get diagnostic information about the system state that is suitable for printing or logging + '''Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - """ + ''' import os import pkg_resources import platform @@ -24,80 +24,73 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return struct.calcsize("P") == 8 + return (struct.calcsize("P") == 8) def is_os_64bit(): - return platform.machine().endswith("64") + return platform.machine().endswith('64') def is_venv(): - return "VIRTUAL_ENV" in os.environ + return 'VIRTUAL_ENV' in os.environ info = {} - info["os"] = {} - info["python"] = {} - info["driver"] = {} - info["module"] = {} - if platform.system() == "Windows": + info['os'] = {} + info['python'] = {} + info['driver'] = {} + info['module'] = {} + if platform.system() == 'Windows': try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = "Windows" + os_name = 'Windows' try: - driver_version_key = winreg.OpenKey( - winreg.HKEY_LOCAL_MACHINE, - r"SOFTWARE\National Instruments\NI-FGEN\CurrentVersion", - ) + driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-FGEN\CurrentVersion") driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = "Unknown" - elif platform.system() == "Linux": - os_name = "Linux" - driver_version = "Unknown" + driver_version = 'Unknown' + elif platform.system() == 'Linux': + os_name = 'Linux' + driver_version = 'Unknown' else: - raise SystemError("Unsupported platform: {}".format(platform.system())) + raise SystemError('Unsupported platform: {}'.format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [ - { - "name": i.key, - "version": i.version, - } - for i in installed_packages - ] - - info["os"]["name"] = os_name - info["os"]["version"] = platform.version() - info["os"]["bits"] = "64" if is_os_64bit() else "32" - info["driver"]["name"] = "NI-FGEN" - info["driver"]["version"] = driver_version - info["module"]["name"] = "nifgen" - info["module"]["version"] = "1.4.2.dev0" - info["python"]["version"] = sys.version - info["python"]["bits"] = "64" if is_python_64bit() else "32" - info["python"]["is_venv"] = is_venv() - info["python"]["packages"] = installed_packages_list + installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] + + info['os']['name'] = os_name + info['os']['version'] = platform.version() + info['os']['bits'] = '64' if is_os_64bit() else '32' + info['driver']['name'] = "NI-FGEN" + info['driver']['version'] = driver_version + info['module']['name'] = 'nifgen' + info['module']['version'] = "1.4.2.dev0" + info['python']['version'] = sys.version + info['python']['bits'] = '64' if is_python_64bit() else '32' + info['python']['is_venv'] = is_venv() + info['python']['packages'] = installed_packages_list return info def print_diagnostic_information(): - """Print diagnostic information in a format suitable for issue report + '''Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - """ + ''' info = get_diagnostic_information() - row_format = " {:<10} {}" - for type in ["OS", "Driver", "Module", "Python"]: + row_format = ' {:<10} {}' + for type in ['OS', 'Driver', 'Module', 'Python']: typename = type.lower() - print(type + ":") + print(type + ':') for item in info[typename]: - if item != "packages": - print(row_format.format(item.title() + ":", info[typename][item])) - print(" Installed Packages:") - for p in info["python"]["packages"]: - print((" " * 8) + p["name"] + "==" + p["version"]) + if item != 'packages': + print(row_format.format(item.title() + ':', info[typename][item])) + print(' Installed Packages:') + for p in info['python']['packages']: + print((' ' * 8) + p['name'] + '==' + p['version']) return info + + diff --git a/generated/nifgen/nifgen/_attributes.py b/generated/nifgen/nifgen/_attributes.py index acb2517c0..13fb143f1 100644 --- a/generated/nifgen/nifgen/_attributes.py +++ b/generated/nifgen/nifgen/_attributes.py @@ -6,13 +6,14 @@ class Attribute(object): - """Base class for all typed attributes.""" + '''Base class for all typed attributes.''' def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -21,19 +22,16 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): + def __get__(self, session, session_type): - return hightime.timedelta( - milliseconds=session._get_attribute_vi_int32(self._attribute_id) - ) + return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_int32( - self._attribute_id, - _converters.convert_timedelta_to_milliseconds_int32(value).value, - ) + session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) class AttributeViInt64(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -42,6 +40,7 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -50,19 +49,16 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): + def __get__(self, session, session_type): - return hightime.timedelta( - seconds=session._get_attribute_vi_real64(self._attribute_id) - ) + return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_real64( - self._attribute_id, - _converters.convert_timedelta_to_seconds_real64(value).value, - ) + session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) class AttributeViString(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -71,17 +67,16 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string( - self._attribute_id, - _converters.convert_repeated_capabilities_without_prefix(value), - ) + session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) class AttributeViBoolean(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -90,36 +85,31 @@ def __set__(self, session, value): class AttributeEnum(object): + def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type( - self._underlying_attribute.__get__(session, session_type) - ) + return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError( - "must be " - + str(self._attribute_type.__name__) - + " not " - + str(type(value).__name__) - ) + raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): + def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from nifgen.session import SessionReference - return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session( - self._attribute_id, _converters.convert_to_nitclk_session_number(value) - ) + session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) + + + diff --git a/generated/nifgen/nifgen/_converters.py b/generated/nifgen/nifgen/_converters.py index 77a87d2cd..a20b22b28 100644 --- a/generated/nifgen/nifgen/_converters.py +++ b/generated/nifgen/nifgen/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - """Base version that should not be called + '''Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,38 +40,36 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - """ - raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) + ''' + raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - """Integer version""" + '''Integer version''' return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - """String version (this is the most complex) + '''String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - """ + ''' # First we deal with a list - rep_cap_list = repeated_capability.split(",") + rep_cap_list = repeated_capability.split(',') if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, "").replace(":", "-") - rc = r.split("-") + r = repeated_capability.strip().replace(prefix, '').replace(':', '-') + rc = r.split('-') if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError( - "Multiple '-' or ':'", repeated_capability - ) + raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) try: start = int(rc[0]) end = int(rc[1]) @@ -87,7 +85,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, "").strip()] + return [repeated_capability.replace(prefix, '').strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -96,7 +94,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - """Iterable version - can handle lists, ranges, and tuples""" + '''Iterable version - can handle lists, ranges, and tuples''' rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -105,22 +103,16 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - """slice version""" - + '''slice version''' def ifnone(a, b): return b if a is None else a - # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range( - ifnone(repeated_capability.start, 0), - repeated_capability.stop, - ifnone(repeated_capability.step, 1), - ) + rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=""): - """Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=''): + '''Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -128,17 +120,15 @@ def convert_repeated_capabilities(repeated_capability, prefix=""): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - """ + ''' # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [ - prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) - ] + return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] def convert_repeated_capabilities_without_prefix(repeated_capability): - """Convert a repeated capabilities object, without any prefix, to a comma delimited list + '''Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -154,8 +144,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - """ - return ",".join(convert_repeated_capabilities(repeated_capability, "")) + ''' + return ','.join(convert_repeated_capabilities(repeated_capability, '')) def _convert_timedelta(value, library_type, scaling): @@ -168,14 +158,7 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [ - _visatype.ViInt64, - _visatype.ViInt32, - _visatype.ViUInt32, - _visatype.ViInt16, - _visatype.ViUInt16, - _visatype.ViInt8, - ]: + if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -212,36 +195,34 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - "rangecheck": "RangeCheck", - "queryinstrstatus": "QueryInstrStatus", - "cache": "Cache", - "simulate": "Simulate", - "recordcoercions": "RecordCoercions", - "interchangecheck": "InterchangeCheck", - "driversetup": "DriverSetup", - "range_check": "RangeCheck", - "query_instr_status": "QueryInstrStatus", - "record_coercions": "RecordCoercions", - "interchange_check": "InterchangeCheck", - "driver_setup": "DriverSetup", + 'rangecheck': 'RangeCheck', + 'queryinstrstatus': 'QueryInstrStatus', + 'cache': 'Cache', + 'simulate': 'Simulate', + 'recordcoercions': 'RecordCoercions', + 'interchangecheck': 'InterchangeCheck', + 'driversetup': 'DriverSetup', + 'range_check': 'RangeCheck', + 'query_instr_status': 'QueryInstrStatus', + 'record_coercions': 'RecordCoercions', + 'interchange_check': 'InterchangeCheck', + 'driver_setup': 'DriverSetup', } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": - value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") - elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": + if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': + value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') + elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': if not isinstance(values[k], dict): - raise TypeError("DriverSetup must be a dictionary") - value = "DriverSetup=" + ( - ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) - ) + raise TypeError('DriverSetup must be a dictionary') + value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) else: - value = k + ("=1" if values[k] is True else "=0") + value = k + ('=1' if values[k] is True else '=0') init_with_options.append(value) - init_with_options_string = ",".join(init_with_options) + init_with_options_string = ','.join(init_with_options) return init_with_options_string @@ -270,11 +251,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(",")] + return [x.strip() for x in comma_separated_string.split(',')] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -286,17 +267,11 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - """ - chained_repeated_capability_items = convert_comma_separated_string_to_list( - chained_repeated_capability - ) - repeated_capability_lists = [ - [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) - ] + ''' + chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) + repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] for item in chained_repeated_capability_items: - repeated_capability_lists = [ - x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) - ] - return [ - ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists - ] + repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] + return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] + + diff --git a/generated/nifgen/nifgen/_library.py b/generated/nifgen/nifgen/_library.py index 30b233ef8..e92309a92 100644 --- a/generated/nifgen/nifgen/_library.py +++ b/generated/nifgen/nifgen/_library.py @@ -9,11 +9,11 @@ class Library(object): - """Library + '''Library Wrapper around driver library. Class will setup the correct ctypes information for every function on first call. - """ + ''' def __init__(self, ctypes_library): self._func_lock = threading.Lock() @@ -102,57 +102,31 @@ def _get_library_function(self, name): def niFgen_AbortGeneration(self, vi): # noqa: N802 with self._func_lock: if self.niFgen_AbortGeneration_cfunc is None: - self.niFgen_AbortGeneration_cfunc = self._get_library_function( - "niFgen_AbortGeneration" - ) + self.niFgen_AbortGeneration_cfunc = self._get_library_function('niFgen_AbortGeneration') self.niFgen_AbortGeneration_cfunc.argtypes = [ViSession] # noqa: F405 self.niFgen_AbortGeneration_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_AbortGeneration_cfunc(vi) - def niFgen_AllocateNamedWaveform( - self, vi, channel_name, waveform_name, waveform_size - ): # noqa: N802 + def niFgen_AllocateNamedWaveform(self, vi, channel_name, waveform_name, waveform_size): # noqa: N802 with self._func_lock: if self.niFgen_AllocateNamedWaveform_cfunc is None: - self.niFgen_AllocateNamedWaveform_cfunc = self._get_library_function( - "niFgen_AllocateNamedWaveform" - ) - self.niFgen_AllocateNamedWaveform_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViInt32, - ] # noqa: F405 + self.niFgen_AllocateNamedWaveform_cfunc = self._get_library_function('niFgen_AllocateNamedWaveform') + self.niFgen_AllocateNamedWaveform_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32] # noqa: F405 self.niFgen_AllocateNamedWaveform_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_AllocateNamedWaveform_cfunc( - vi, channel_name, waveform_name, waveform_size - ) + return self.niFgen_AllocateNamedWaveform_cfunc(vi, channel_name, waveform_name, waveform_size) - def niFgen_AllocateWaveform( - self, vi, channel_name, waveform_size, waveform_handle - ): # noqa: N802 + def niFgen_AllocateWaveform(self, vi, channel_name, waveform_size, waveform_handle): # noqa: N802 with self._func_lock: if self.niFgen_AllocateWaveform_cfunc is None: - self.niFgen_AllocateWaveform_cfunc = self._get_library_function( - "niFgen_AllocateWaveform" - ) - self.niFgen_AllocateWaveform_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niFgen_AllocateWaveform_cfunc = self._get_library_function('niFgen_AllocateWaveform') + self.niFgen_AllocateWaveform_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViInt32)] # noqa: F405 self.niFgen_AllocateWaveform_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_AllocateWaveform_cfunc( - vi, channel_name, waveform_size, waveform_handle - ) + return self.niFgen_AllocateWaveform_cfunc(vi, channel_name, waveform_size, waveform_handle) def niFgen_ClearArbMemory(self, vi): # noqa: N802 with self._func_lock: if self.niFgen_ClearArbMemory_cfunc is None: - self.niFgen_ClearArbMemory_cfunc = self._get_library_function( - "niFgen_ClearArbMemory" - ) + self.niFgen_ClearArbMemory_cfunc = self._get_library_function('niFgen_ClearArbMemory') self.niFgen_ClearArbMemory_cfunc.argtypes = [ViSession] # noqa: F405 self.niFgen_ClearArbMemory_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_ClearArbMemory_cfunc(vi) @@ -160,904 +134,383 @@ def niFgen_ClearArbMemory(self, vi): # noqa: N802 def niFgen_ClearArbSequence(self, vi, sequence_handle): # noqa: N802 with self._func_lock: if self.niFgen_ClearArbSequence_cfunc is None: - self.niFgen_ClearArbSequence_cfunc = self._get_library_function( - "niFgen_ClearArbSequence" - ) - self.niFgen_ClearArbSequence_cfunc.argtypes = [ - ViSession, - ViInt32, - ] # noqa: F405 + self.niFgen_ClearArbSequence_cfunc = self._get_library_function('niFgen_ClearArbSequence') + self.niFgen_ClearArbSequence_cfunc.argtypes = [ViSession, ViInt32] # noqa: F405 self.niFgen_ClearArbSequence_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_ClearArbSequence_cfunc(vi, sequence_handle) def niFgen_ClearArbWaveform(self, vi, waveform_handle): # noqa: N802 with self._func_lock: if self.niFgen_ClearArbWaveform_cfunc is None: - self.niFgen_ClearArbWaveform_cfunc = self._get_library_function( - "niFgen_ClearArbWaveform" - ) - self.niFgen_ClearArbWaveform_cfunc.argtypes = [ - ViSession, - ViInt32, - ] # noqa: F405 + self.niFgen_ClearArbWaveform_cfunc = self._get_library_function('niFgen_ClearArbWaveform') + self.niFgen_ClearArbWaveform_cfunc.argtypes = [ViSession, ViInt32] # noqa: F405 self.niFgen_ClearArbWaveform_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_ClearArbWaveform_cfunc(vi, waveform_handle) def niFgen_ClearFreqList(self, vi, frequency_list_handle): # noqa: N802 with self._func_lock: if self.niFgen_ClearFreqList_cfunc is None: - self.niFgen_ClearFreqList_cfunc = self._get_library_function( - "niFgen_ClearFreqList" - ) - self.niFgen_ClearFreqList_cfunc.argtypes = [ - ViSession, - ViInt32, - ] # noqa: F405 + self.niFgen_ClearFreqList_cfunc = self._get_library_function('niFgen_ClearFreqList') + self.niFgen_ClearFreqList_cfunc.argtypes = [ViSession, ViInt32] # noqa: F405 self.niFgen_ClearFreqList_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_ClearFreqList_cfunc(vi, frequency_list_handle) def niFgen_ClearUserStandardWaveform(self, vi, channel_name): # noqa: N802 with self._func_lock: if self.niFgen_ClearUserStandardWaveform_cfunc is None: - self.niFgen_ClearUserStandardWaveform_cfunc = ( - self._get_library_function("niFgen_ClearUserStandardWaveform") - ) - self.niFgen_ClearUserStandardWaveform_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niFgen_ClearUserStandardWaveform_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niFgen_ClearUserStandardWaveform_cfunc = self._get_library_function('niFgen_ClearUserStandardWaveform') + self.niFgen_ClearUserStandardWaveform_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niFgen_ClearUserStandardWaveform_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_ClearUserStandardWaveform_cfunc(vi, channel_name) def niFgen_Commit(self, vi): # noqa: N802 with self._func_lock: if self.niFgen_Commit_cfunc is None: - self.niFgen_Commit_cfunc = self._get_library_function("niFgen_Commit") + self.niFgen_Commit_cfunc = self._get_library_function('niFgen_Commit') self.niFgen_Commit_cfunc.argtypes = [ViSession] # noqa: F405 self.niFgen_Commit_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_Commit_cfunc(vi) - def niFgen_ConfigureArbSequence( - self, vi, channel_name, sequence_handle, gain, offset - ): # noqa: N802 + def niFgen_ConfigureArbSequence(self, vi, channel_name, sequence_handle, gain, offset): # noqa: N802 with self._func_lock: if self.niFgen_ConfigureArbSequence_cfunc is None: - self.niFgen_ConfigureArbSequence_cfunc = self._get_library_function( - "niFgen_ConfigureArbSequence" - ) - self.niFgen_ConfigureArbSequence_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ViReal64, - ViReal64, - ] # noqa: F405 + self.niFgen_ConfigureArbSequence_cfunc = self._get_library_function('niFgen_ConfigureArbSequence') + self.niFgen_ConfigureArbSequence_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViReal64, ViReal64] # noqa: F405 self.niFgen_ConfigureArbSequence_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_ConfigureArbSequence_cfunc( - vi, channel_name, sequence_handle, gain, offset - ) + return self.niFgen_ConfigureArbSequence_cfunc(vi, channel_name, sequence_handle, gain, offset) - def niFgen_ConfigureArbWaveform( - self, vi, channel_name, waveform_handle, gain, offset - ): # noqa: N802 + def niFgen_ConfigureArbWaveform(self, vi, channel_name, waveform_handle, gain, offset): # noqa: N802 with self._func_lock: if self.niFgen_ConfigureArbWaveform_cfunc is None: - self.niFgen_ConfigureArbWaveform_cfunc = self._get_library_function( - "niFgen_ConfigureArbWaveform" - ) - self.niFgen_ConfigureArbWaveform_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ViReal64, - ViReal64, - ] # noqa: F405 + self.niFgen_ConfigureArbWaveform_cfunc = self._get_library_function('niFgen_ConfigureArbWaveform') + self.niFgen_ConfigureArbWaveform_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViReal64, ViReal64] # noqa: F405 self.niFgen_ConfigureArbWaveform_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_ConfigureArbWaveform_cfunc( - vi, channel_name, waveform_handle, gain, offset - ) + return self.niFgen_ConfigureArbWaveform_cfunc(vi, channel_name, waveform_handle, gain, offset) - def niFgen_ConfigureFreqList( - self, vi, channel_name, frequency_list_handle, amplitude, dc_offset, start_phase - ): # noqa: N802 + def niFgen_ConfigureFreqList(self, vi, channel_name, frequency_list_handle, amplitude, dc_offset, start_phase): # noqa: N802 with self._func_lock: if self.niFgen_ConfigureFreqList_cfunc is None: - self.niFgen_ConfigureFreqList_cfunc = self._get_library_function( - "niFgen_ConfigureFreqList" - ) - self.niFgen_ConfigureFreqList_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ViReal64, - ViReal64, - ViReal64, - ] # noqa: F405 + self.niFgen_ConfigureFreqList_cfunc = self._get_library_function('niFgen_ConfigureFreqList') + self.niFgen_ConfigureFreqList_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViReal64, ViReal64, ViReal64] # noqa: F405 self.niFgen_ConfigureFreqList_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_ConfigureFreqList_cfunc( - vi, channel_name, frequency_list_handle, amplitude, dc_offset, start_phase - ) + return self.niFgen_ConfigureFreqList_cfunc(vi, channel_name, frequency_list_handle, amplitude, dc_offset, start_phase) - def niFgen_ConfigureStandardWaveform( - self, vi, channel_name, waveform, amplitude, dc_offset, frequency, start_phase - ): # noqa: N802 + def niFgen_ConfigureStandardWaveform(self, vi, channel_name, waveform, amplitude, dc_offset, frequency, start_phase): # noqa: N802 with self._func_lock: if self.niFgen_ConfigureStandardWaveform_cfunc is None: - self.niFgen_ConfigureStandardWaveform_cfunc = ( - self._get_library_function("niFgen_ConfigureStandardWaveform") - ) - self.niFgen_ConfigureStandardWaveform_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ViReal64, - ViReal64, - ViReal64, - ViReal64, - ] # noqa: F405 - self.niFgen_ConfigureStandardWaveform_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFgen_ConfigureStandardWaveform_cfunc( - vi, channel_name, waveform, amplitude, dc_offset, frequency, start_phase - ) - - def niFgen_CreateAdvancedArbSequence( - self, - vi, - sequence_length, - waveform_handles_array, - loop_counts_array, - sample_counts_array, - marker_location_array, - coerced_markers_array, - sequence_handle, - ): # noqa: N802 + self.niFgen_ConfigureStandardWaveform_cfunc = self._get_library_function('niFgen_ConfigureStandardWaveform') + self.niFgen_ConfigureStandardWaveform_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViReal64, ViReal64, ViReal64, ViReal64] # noqa: F405 + self.niFgen_ConfigureStandardWaveform_cfunc.restype = ViStatus # noqa: F405 + return self.niFgen_ConfigureStandardWaveform_cfunc(vi, channel_name, waveform, amplitude, dc_offset, frequency, start_phase) + + def niFgen_CreateAdvancedArbSequence(self, vi, sequence_length, waveform_handles_array, loop_counts_array, sample_counts_array, marker_location_array, coerced_markers_array, sequence_handle): # noqa: N802 with self._func_lock: if self.niFgen_CreateAdvancedArbSequence_cfunc is None: - self.niFgen_CreateAdvancedArbSequence_cfunc = ( - self._get_library_function("niFgen_CreateAdvancedArbSequence") - ) - self.niFgen_CreateAdvancedArbSequence_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niFgen_CreateAdvancedArbSequence_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFgen_CreateAdvancedArbSequence_cfunc( - vi, - sequence_length, - waveform_handles_array, - loop_counts_array, - sample_counts_array, - marker_location_array, - coerced_markers_array, - sequence_handle, - ) - - def niFgen_CreateArbSequence( - self, - vi, - sequence_length, - waveform_handles_array, - loop_counts_array, - sequence_handle, - ): # noqa: N802 + self.niFgen_CreateAdvancedArbSequence_cfunc = self._get_library_function('niFgen_CreateAdvancedArbSequence') + self.niFgen_CreateAdvancedArbSequence_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niFgen_CreateAdvancedArbSequence_cfunc.restype = ViStatus # noqa: F405 + return self.niFgen_CreateAdvancedArbSequence_cfunc(vi, sequence_length, waveform_handles_array, loop_counts_array, sample_counts_array, marker_location_array, coerced_markers_array, sequence_handle) + + def niFgen_CreateArbSequence(self, vi, sequence_length, waveform_handles_array, loop_counts_array, sequence_handle): # noqa: N802 with self._func_lock: if self.niFgen_CreateArbSequence_cfunc is None: - self.niFgen_CreateArbSequence_cfunc = self._get_library_function( - "niFgen_CreateArbSequence" - ) - self.niFgen_CreateArbSequence_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niFgen_CreateArbSequence_cfunc = self._get_library_function('niFgen_CreateArbSequence') + self.niFgen_CreateArbSequence_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 self.niFgen_CreateArbSequence_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_CreateArbSequence_cfunc( - vi, - sequence_length, - waveform_handles_array, - loop_counts_array, - sequence_handle, - ) - - def niFgen_CreateFreqList( - self, - vi, - waveform, - frequency_list_length, - frequency_array, - duration_array, - frequency_list_handle, - ): # noqa: N802 + return self.niFgen_CreateArbSequence_cfunc(vi, sequence_length, waveform_handles_array, loop_counts_array, sequence_handle) + + def niFgen_CreateFreqList(self, vi, waveform, frequency_list_length, frequency_array, duration_array, frequency_list_handle): # noqa: N802 with self._func_lock: if self.niFgen_CreateFreqList_cfunc is None: - self.niFgen_CreateFreqList_cfunc = self._get_library_function( - "niFgen_CreateFreqList" - ) - self.niFgen_CreateFreqList_cfunc.argtypes = [ - ViSession, - ViInt32, - ViInt32, - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niFgen_CreateFreqList_cfunc = self._get_library_function('niFgen_CreateFreqList') + self.niFgen_CreateFreqList_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt32)] # noqa: F405 self.niFgen_CreateFreqList_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_CreateFreqList_cfunc( - vi, - waveform, - frequency_list_length, - frequency_array, - duration_array, - frequency_list_handle, - ) - - def niFgen_CreateWaveformF64( - self, vi, channel_name, waveform_size, waveform_data_array, waveform_handle - ): # noqa: N802 + return self.niFgen_CreateFreqList_cfunc(vi, waveform, frequency_list_length, frequency_array, duration_array, frequency_list_handle) + + def niFgen_CreateWaveformF64(self, vi, channel_name, waveform_size, waveform_data_array, waveform_handle): # noqa: N802 with self._func_lock: if self.niFgen_CreateWaveformF64_cfunc is None: - self.niFgen_CreateWaveformF64_cfunc = self._get_library_function( - "niFgen_CreateWaveformF64" - ) - self.niFgen_CreateWaveformF64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niFgen_CreateWaveformF64_cfunc = self._get_library_function('niFgen_CreateWaveformF64') + self.niFgen_CreateWaveformF64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt32)] # noqa: F405 self.niFgen_CreateWaveformF64_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_CreateWaveformF64_cfunc( - vi, channel_name, waveform_size, waveform_data_array, waveform_handle - ) + return self.niFgen_CreateWaveformF64_cfunc(vi, channel_name, waveform_size, waveform_data_array, waveform_handle) - def niFgen_CreateWaveformFromFileF64( - self, vi, channel_name, file_name, byte_order, waveform_handle - ): # noqa: N802 + def niFgen_CreateWaveformFromFileF64(self, vi, channel_name, file_name, byte_order, waveform_handle): # noqa: N802 with self._func_lock: if self.niFgen_CreateWaveformFromFileF64_cfunc is None: - self.niFgen_CreateWaveformFromFileF64_cfunc = ( - self._get_library_function("niFgen_CreateWaveformFromFileF64") - ) - self.niFgen_CreateWaveformFromFileF64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niFgen_CreateWaveformFromFileF64_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFgen_CreateWaveformFromFileF64_cfunc( - vi, channel_name, file_name, byte_order, waveform_handle - ) - - def niFgen_CreateWaveformFromFileI16( - self, vi, channel_name, file_name, byte_order, waveform_handle - ): # noqa: N802 + self.niFgen_CreateWaveformFromFileF64_cfunc = self._get_library_function('niFgen_CreateWaveformFromFileF64') + self.niFgen_CreateWaveformFromFileF64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViInt32)] # noqa: F405 + self.niFgen_CreateWaveformFromFileF64_cfunc.restype = ViStatus # noqa: F405 + return self.niFgen_CreateWaveformFromFileF64_cfunc(vi, channel_name, file_name, byte_order, waveform_handle) + + def niFgen_CreateWaveformFromFileI16(self, vi, channel_name, file_name, byte_order, waveform_handle): # noqa: N802 with self._func_lock: if self.niFgen_CreateWaveformFromFileI16_cfunc is None: - self.niFgen_CreateWaveformFromFileI16_cfunc = ( - self._get_library_function("niFgen_CreateWaveformFromFileI16") - ) - self.niFgen_CreateWaveformFromFileI16_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niFgen_CreateWaveformFromFileI16_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFgen_CreateWaveformFromFileI16_cfunc( - vi, channel_name, file_name, byte_order, waveform_handle - ) - - def niFgen_CreateWaveformI16( - self, vi, channel_name, waveform_size, waveform_data_array, waveform_handle - ): # noqa: N802 + self.niFgen_CreateWaveformFromFileI16_cfunc = self._get_library_function('niFgen_CreateWaveformFromFileI16') + self.niFgen_CreateWaveformFromFileI16_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViInt32)] # noqa: F405 + self.niFgen_CreateWaveformFromFileI16_cfunc.restype = ViStatus # noqa: F405 + return self.niFgen_CreateWaveformFromFileI16_cfunc(vi, channel_name, file_name, byte_order, waveform_handle) + + def niFgen_CreateWaveformI16(self, vi, channel_name, waveform_size, waveform_data_array, waveform_handle): # noqa: N802 with self._func_lock: if self.niFgen_CreateWaveformI16_cfunc is None: - self.niFgen_CreateWaveformI16_cfunc = self._get_library_function( - "niFgen_CreateWaveformI16" - ) - self.niFgen_CreateWaveformI16_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViInt16), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niFgen_CreateWaveformI16_cfunc = self._get_library_function('niFgen_CreateWaveformI16') + self.niFgen_CreateWaveformI16_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViInt16), ctypes.POINTER(ViInt32)] # noqa: F405 self.niFgen_CreateWaveformI16_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_CreateWaveformI16_cfunc( - vi, channel_name, waveform_size, waveform_data_array, waveform_handle - ) + return self.niFgen_CreateWaveformI16_cfunc(vi, channel_name, waveform_size, waveform_data_array, waveform_handle) - def niFgen_DefineUserStandardWaveform( - self, vi, channel_name, waveform_size, waveform_data_array - ): # noqa: N802 + def niFgen_DefineUserStandardWaveform(self, vi, channel_name, waveform_size, waveform_data_array): # noqa: N802 with self._func_lock: if self.niFgen_DefineUserStandardWaveform_cfunc is None: - self.niFgen_DefineUserStandardWaveform_cfunc = ( - self._get_library_function("niFgen_DefineUserStandardWaveform") - ) - self.niFgen_DefineUserStandardWaveform_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViReal64), - ] # noqa: F405 - self.niFgen_DefineUserStandardWaveform_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFgen_DefineUserStandardWaveform_cfunc( - vi, channel_name, waveform_size, waveform_data_array - ) + self.niFgen_DefineUserStandardWaveform_cfunc = self._get_library_function('niFgen_DefineUserStandardWaveform') + self.niFgen_DefineUserStandardWaveform_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niFgen_DefineUserStandardWaveform_cfunc.restype = ViStatus # noqa: F405 + return self.niFgen_DefineUserStandardWaveform_cfunc(vi, channel_name, waveform_size, waveform_data_array) def niFgen_DeleteNamedWaveform(self, vi, channel_name, waveform_name): # noqa: N802 with self._func_lock: if self.niFgen_DeleteNamedWaveform_cfunc is None: - self.niFgen_DeleteNamedWaveform_cfunc = self._get_library_function( - "niFgen_DeleteNamedWaveform" - ) - self.niFgen_DeleteNamedWaveform_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niFgen_DeleteNamedWaveform_cfunc = self._get_library_function('niFgen_DeleteNamedWaveform') + self.niFgen_DeleteNamedWaveform_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar)] # noqa: F405 self.niFgen_DeleteNamedWaveform_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_DeleteNamedWaveform_cfunc(vi, channel_name, waveform_name) def niFgen_DeleteScript(self, vi, channel_name, script_name): # noqa: N802 with self._func_lock: if self.niFgen_DeleteScript_cfunc is None: - self.niFgen_DeleteScript_cfunc = self._get_library_function( - "niFgen_DeleteScript" - ) - self.niFgen_DeleteScript_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niFgen_DeleteScript_cfunc = self._get_library_function('niFgen_DeleteScript') + self.niFgen_DeleteScript_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar)] # noqa: F405 self.niFgen_DeleteScript_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_DeleteScript_cfunc(vi, channel_name, script_name) def niFgen_Disable(self, vi): # noqa: N802 with self._func_lock: if self.niFgen_Disable_cfunc is None: - self.niFgen_Disable_cfunc = self._get_library_function("niFgen_Disable") + self.niFgen_Disable_cfunc = self._get_library_function('niFgen_Disable') self.niFgen_Disable_cfunc.argtypes = [ViSession] # noqa: F405 self.niFgen_Disable_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_Disable_cfunc(vi) - def niFgen_ExportAttributeConfigurationBuffer( - self, vi, size_in_bytes, configuration - ): # noqa: N802 + def niFgen_ExportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 with self._func_lock: if self.niFgen_ExportAttributeConfigurationBuffer_cfunc is None: - self.niFgen_ExportAttributeConfigurationBuffer_cfunc = ( - self._get_library_function( - "niFgen_ExportAttributeConfigurationBuffer" - ) - ) - self.niFgen_ExportAttributeConfigurationBuffer_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViInt8), - ] # noqa: F405 - self.niFgen_ExportAttributeConfigurationBuffer_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFgen_ExportAttributeConfigurationBuffer_cfunc( - vi, size_in_bytes, configuration - ) + self.niFgen_ExportAttributeConfigurationBuffer_cfunc = self._get_library_function('niFgen_ExportAttributeConfigurationBuffer') + self.niFgen_ExportAttributeConfigurationBuffer_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt8)] # noqa: F405 + self.niFgen_ExportAttributeConfigurationBuffer_cfunc.restype = ViStatus # noqa: F405 + return self.niFgen_ExportAttributeConfigurationBuffer_cfunc(vi, size_in_bytes, configuration) def niFgen_ExportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niFgen_ExportAttributeConfigurationFile_cfunc is None: - self.niFgen_ExportAttributeConfigurationFile_cfunc = ( - self._get_library_function( - "niFgen_ExportAttributeConfigurationFile" - ) - ) - self.niFgen_ExportAttributeConfigurationFile_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niFgen_ExportAttributeConfigurationFile_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niFgen_ExportAttributeConfigurationFile_cfunc = self._get_library_function('niFgen_ExportAttributeConfigurationFile') + self.niFgen_ExportAttributeConfigurationFile_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niFgen_ExportAttributeConfigurationFile_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_ExportAttributeConfigurationFile_cfunc(vi, file_path) - def niFgen_GetAttributeViBoolean( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niFgen_GetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niFgen_GetAttributeViBoolean_cfunc is None: - self.niFgen_GetAttributeViBoolean_cfunc = self._get_library_function( - "niFgen_GetAttributeViBoolean" - ) - self.niFgen_GetAttributeViBoolean_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niFgen_GetAttributeViBoolean_cfunc = self._get_library_function('niFgen_GetAttributeViBoolean') + self.niFgen_GetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niFgen_GetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_GetAttributeViBoolean_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niFgen_GetAttributeViBoolean_cfunc(vi, channel_name, attribute_id, attribute_value) - def niFgen_GetAttributeViInt32( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niFgen_GetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niFgen_GetAttributeViInt32_cfunc is None: - self.niFgen_GetAttributeViInt32_cfunc = self._get_library_function( - "niFgen_GetAttributeViInt32" - ) - self.niFgen_GetAttributeViInt32_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niFgen_GetAttributeViInt32_cfunc = self._get_library_function('niFgen_GetAttributeViInt32') + self.niFgen_GetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViInt32)] # noqa: F405 self.niFgen_GetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_GetAttributeViInt32_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niFgen_GetAttributeViInt32_cfunc(vi, channel_name, attribute_id, attribute_value) - def niFgen_GetAttributeViReal64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niFgen_GetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niFgen_GetAttributeViReal64_cfunc is None: - self.niFgen_GetAttributeViReal64_cfunc = self._get_library_function( - "niFgen_GetAttributeViReal64" - ) - self.niFgen_GetAttributeViReal64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niFgen_GetAttributeViReal64_cfunc = self._get_library_function('niFgen_GetAttributeViReal64') + self.niFgen_GetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViReal64)] # noqa: F405 self.niFgen_GetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_GetAttributeViReal64_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niFgen_GetAttributeViReal64_cfunc(vi, channel_name, attribute_id, attribute_value) - def niFgen_GetAttributeViString( - self, vi, channel_name, attribute_id, array_size, attribute_value - ): # noqa: N802 + def niFgen_GetAttributeViString(self, vi, channel_name, attribute_id, array_size, attribute_value): # noqa: N802 with self._func_lock: if self.niFgen_GetAttributeViString_cfunc is None: - self.niFgen_GetAttributeViString_cfunc = self._get_library_function( - "niFgen_GetAttributeViString" - ) - self.niFgen_GetAttributeViString_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niFgen_GetAttributeViString_cfunc = self._get_library_function('niFgen_GetAttributeViString') + self.niFgen_GetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niFgen_GetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_GetAttributeViString_cfunc( - vi, channel_name, attribute_id, array_size, attribute_value - ) + return self.niFgen_GetAttributeViString_cfunc(vi, channel_name, attribute_id, array_size, attribute_value) - def niFgen_GetChannelName( - self, vi, index, buffer_size, channel_string - ): # noqa: N802 + def niFgen_GetChannelName(self, vi, index, buffer_size, channel_string): # noqa: N802 with self._func_lock: if self.niFgen_GetChannelName_cfunc is None: - self.niFgen_GetChannelName_cfunc = self._get_library_function( - "niFgen_GetChannelName" - ) - self.niFgen_GetChannelName_cfunc.argtypes = [ - ViSession, - ViInt32, - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niFgen_GetChannelName_cfunc = self._get_library_function('niFgen_GetChannelName') + self.niFgen_GetChannelName_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niFgen_GetChannelName_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_GetChannelName_cfunc(vi, index, buffer_size, channel_string) - def niFgen_GetError( - self, vi, error_code, error_description_buffer_size, error_description - ): # noqa: N802 + def niFgen_GetError(self, vi, error_code, error_description_buffer_size, error_description): # noqa: N802 with self._func_lock: if self.niFgen_GetError_cfunc is None: - self.niFgen_GetError_cfunc = self._get_library_function( - "niFgen_GetError" - ) - self.niFgen_GetError_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViStatus), - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niFgen_GetError_cfunc = self._get_library_function('niFgen_GetError') + self.niFgen_GetError_cfunc.argtypes = [ViSession, ctypes.POINTER(ViStatus), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niFgen_GetError_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_GetError_cfunc( - vi, error_code, error_description_buffer_size, error_description - ) + return self.niFgen_GetError_cfunc(vi, error_code, error_description_buffer_size, error_description) - def niFgen_GetExtCalLastDateAndTime( - self, vi, year, month, day, hour, minute - ): # noqa: N802 + def niFgen_GetExtCalLastDateAndTime(self, vi, year, month, day, hour, minute): # noqa: N802 with self._func_lock: if self.niFgen_GetExtCalLastDateAndTime_cfunc is None: - self.niFgen_GetExtCalLastDateAndTime_cfunc = self._get_library_function( - "niFgen_GetExtCalLastDateAndTime" - ) - self.niFgen_GetExtCalLastDateAndTime_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niFgen_GetExtCalLastDateAndTime_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFgen_GetExtCalLastDateAndTime_cfunc( - vi, year, month, day, hour, minute - ) + self.niFgen_GetExtCalLastDateAndTime_cfunc = self._get_library_function('niFgen_GetExtCalLastDateAndTime') + self.niFgen_GetExtCalLastDateAndTime_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niFgen_GetExtCalLastDateAndTime_cfunc.restype = ViStatus # noqa: F405 + return self.niFgen_GetExtCalLastDateAndTime_cfunc(vi, year, month, day, hour, minute) def niFgen_GetExtCalLastTemp(self, vi, temperature): # noqa: N802 with self._func_lock: if self.niFgen_GetExtCalLastTemp_cfunc is None: - self.niFgen_GetExtCalLastTemp_cfunc = self._get_library_function( - "niFgen_GetExtCalLastTemp" - ) - self.niFgen_GetExtCalLastTemp_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niFgen_GetExtCalLastTemp_cfunc = self._get_library_function('niFgen_GetExtCalLastTemp') + self.niFgen_GetExtCalLastTemp_cfunc.argtypes = [ViSession, ctypes.POINTER(ViReal64)] # noqa: F405 self.niFgen_GetExtCalLastTemp_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_GetExtCalLastTemp_cfunc(vi, temperature) def niFgen_GetExtCalRecommendedInterval(self, vi, months): # noqa: N802 with self._func_lock: if self.niFgen_GetExtCalRecommendedInterval_cfunc is None: - self.niFgen_GetExtCalRecommendedInterval_cfunc = ( - self._get_library_function("niFgen_GetExtCalRecommendedInterval") - ) - self.niFgen_GetExtCalRecommendedInterval_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niFgen_GetExtCalRecommendedInterval_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niFgen_GetExtCalRecommendedInterval_cfunc = self._get_library_function('niFgen_GetExtCalRecommendedInterval') + self.niFgen_GetExtCalRecommendedInterval_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32)] # noqa: F405 + self.niFgen_GetExtCalRecommendedInterval_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_GetExtCalRecommendedInterval_cfunc(vi, months) def niFgen_GetHardwareState(self, vi, state): # noqa: N802 with self._func_lock: if self.niFgen_GetHardwareState_cfunc is None: - self.niFgen_GetHardwareState_cfunc = self._get_library_function( - "niFgen_GetHardwareState" - ) - self.niFgen_GetHardwareState_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niFgen_GetHardwareState_cfunc = self._get_library_function('niFgen_GetHardwareState') + self.niFgen_GetHardwareState_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32)] # noqa: F405 self.niFgen_GetHardwareState_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_GetHardwareState_cfunc(vi, state) def niFgen_GetLastExtCalLastDateAndTime(self, vi, month): # noqa: N802 with self._func_lock: if self.niFgen_GetLastExtCalLastDateAndTime_cfunc is None: - self.niFgen_GetLastExtCalLastDateAndTime_cfunc = ( - self._get_library_function("niFgen_GetLastExtCalLastDateAndTime") - ) - self.niFgen_GetLastExtCalLastDateAndTime_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(hightime.datetime), - ] # noqa: F405 - self.niFgen_GetLastExtCalLastDateAndTime_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niFgen_GetLastExtCalLastDateAndTime_cfunc = self._get_library_function('niFgen_GetLastExtCalLastDateAndTime') + self.niFgen_GetLastExtCalLastDateAndTime_cfunc.argtypes = [ViSession, ctypes.POINTER(hightime.datetime)] # noqa: F405 + self.niFgen_GetLastExtCalLastDateAndTime_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_GetLastExtCalLastDateAndTime_cfunc(vi, month) def niFgen_GetLastSelfCalLastDateAndTime(self, vi, month): # noqa: N802 with self._func_lock: if self.niFgen_GetLastSelfCalLastDateAndTime_cfunc is None: - self.niFgen_GetLastSelfCalLastDateAndTime_cfunc = ( - self._get_library_function("niFgen_GetLastSelfCalLastDateAndTime") - ) - self.niFgen_GetLastSelfCalLastDateAndTime_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(hightime.datetime), - ] # noqa: F405 - self.niFgen_GetLastSelfCalLastDateAndTime_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niFgen_GetLastSelfCalLastDateAndTime_cfunc = self._get_library_function('niFgen_GetLastSelfCalLastDateAndTime') + self.niFgen_GetLastSelfCalLastDateAndTime_cfunc.argtypes = [ViSession, ctypes.POINTER(hightime.datetime)] # noqa: F405 + self.niFgen_GetLastSelfCalLastDateAndTime_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_GetLastSelfCalLastDateAndTime_cfunc(vi, month) - def niFgen_GetSelfCalLastDateAndTime( - self, vi, year, month, day, hour, minute - ): # noqa: N802 + def niFgen_GetSelfCalLastDateAndTime(self, vi, year, month, day, hour, minute): # noqa: N802 with self._func_lock: if self.niFgen_GetSelfCalLastDateAndTime_cfunc is None: - self.niFgen_GetSelfCalLastDateAndTime_cfunc = ( - self._get_library_function("niFgen_GetSelfCalLastDateAndTime") - ) - self.niFgen_GetSelfCalLastDateAndTime_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niFgen_GetSelfCalLastDateAndTime_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFgen_GetSelfCalLastDateAndTime_cfunc( - vi, year, month, day, hour, minute - ) + self.niFgen_GetSelfCalLastDateAndTime_cfunc = self._get_library_function('niFgen_GetSelfCalLastDateAndTime') + self.niFgen_GetSelfCalLastDateAndTime_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niFgen_GetSelfCalLastDateAndTime_cfunc.restype = ViStatus # noqa: F405 + return self.niFgen_GetSelfCalLastDateAndTime_cfunc(vi, year, month, day, hour, minute) def niFgen_GetSelfCalLastTemp(self, vi, temperature): # noqa: N802 with self._func_lock: if self.niFgen_GetSelfCalLastTemp_cfunc is None: - self.niFgen_GetSelfCalLastTemp_cfunc = self._get_library_function( - "niFgen_GetSelfCalLastTemp" - ) - self.niFgen_GetSelfCalLastTemp_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niFgen_GetSelfCalLastTemp_cfunc = self._get_library_function('niFgen_GetSelfCalLastTemp') + self.niFgen_GetSelfCalLastTemp_cfunc.argtypes = [ViSession, ctypes.POINTER(ViReal64)] # noqa: F405 self.niFgen_GetSelfCalLastTemp_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_GetSelfCalLastTemp_cfunc(vi, temperature) def niFgen_GetSelfCalSupported(self, vi, self_cal_supported): # noqa: N802 with self._func_lock: if self.niFgen_GetSelfCalSupported_cfunc is None: - self.niFgen_GetSelfCalSupported_cfunc = self._get_library_function( - "niFgen_GetSelfCalSupported" - ) - self.niFgen_GetSelfCalSupported_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niFgen_GetSelfCalSupported_cfunc = self._get_library_function('niFgen_GetSelfCalSupported') + self.niFgen_GetSelfCalSupported_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niFgen_GetSelfCalSupported_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_GetSelfCalSupported_cfunc(vi, self_cal_supported) - def niFgen_ImportAttributeConfigurationBuffer( - self, vi, size_in_bytes, configuration - ): # noqa: N802 + def niFgen_ImportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 with self._func_lock: if self.niFgen_ImportAttributeConfigurationBuffer_cfunc is None: - self.niFgen_ImportAttributeConfigurationBuffer_cfunc = ( - self._get_library_function( - "niFgen_ImportAttributeConfigurationBuffer" - ) - ) - self.niFgen_ImportAttributeConfigurationBuffer_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViInt8), - ] # noqa: F405 - self.niFgen_ImportAttributeConfigurationBuffer_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFgen_ImportAttributeConfigurationBuffer_cfunc( - vi, size_in_bytes, configuration - ) + self.niFgen_ImportAttributeConfigurationBuffer_cfunc = self._get_library_function('niFgen_ImportAttributeConfigurationBuffer') + self.niFgen_ImportAttributeConfigurationBuffer_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt8)] # noqa: F405 + self.niFgen_ImportAttributeConfigurationBuffer_cfunc.restype = ViStatus # noqa: F405 + return self.niFgen_ImportAttributeConfigurationBuffer_cfunc(vi, size_in_bytes, configuration) def niFgen_ImportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niFgen_ImportAttributeConfigurationFile_cfunc is None: - self.niFgen_ImportAttributeConfigurationFile_cfunc = ( - self._get_library_function( - "niFgen_ImportAttributeConfigurationFile" - ) - ) - self.niFgen_ImportAttributeConfigurationFile_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niFgen_ImportAttributeConfigurationFile_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niFgen_ImportAttributeConfigurationFile_cfunc = self._get_library_function('niFgen_ImportAttributeConfigurationFile') + self.niFgen_ImportAttributeConfigurationFile_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niFgen_ImportAttributeConfigurationFile_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_ImportAttributeConfigurationFile_cfunc(vi, file_path) - def niFgen_InitializeWithChannels( - self, resource_name, channel_name, reset_device, option_string, vi - ): # noqa: N802 + def niFgen_InitializeWithChannels(self, resource_name, channel_name, reset_device, option_string, vi): # noqa: N802 with self._func_lock: if self.niFgen_InitializeWithChannels_cfunc is None: - self.niFgen_InitializeWithChannels_cfunc = self._get_library_function( - "niFgen_InitializeWithChannels" - ) - self.niFgen_InitializeWithChannels_cfunc.argtypes = [ - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViBoolean, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViSession), - ] # noqa: F405 - self.niFgen_InitializeWithChannels_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFgen_InitializeWithChannels_cfunc( - resource_name, channel_name, reset_device, option_string, vi - ) + self.niFgen_InitializeWithChannels_cfunc = self._get_library_function('niFgen_InitializeWithChannels') + self.niFgen_InitializeWithChannels_cfunc.argtypes = [ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViBoolean, ctypes.POINTER(ViChar), ctypes.POINTER(ViSession)] # noqa: F405 + self.niFgen_InitializeWithChannels_cfunc.restype = ViStatus # noqa: F405 + return self.niFgen_InitializeWithChannels_cfunc(resource_name, channel_name, reset_device, option_string, vi) def niFgen_InitiateGeneration(self, vi): # noqa: N802 with self._func_lock: if self.niFgen_InitiateGeneration_cfunc is None: - self.niFgen_InitiateGeneration_cfunc = self._get_library_function( - "niFgen_InitiateGeneration" - ) - self.niFgen_InitiateGeneration_cfunc.argtypes = [ - ViSession - ] # noqa: F405 + self.niFgen_InitiateGeneration_cfunc = self._get_library_function('niFgen_InitiateGeneration') + self.niFgen_InitiateGeneration_cfunc.argtypes = [ViSession] # noqa: F405 self.niFgen_InitiateGeneration_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_InitiateGeneration_cfunc(vi) def niFgen_IsDone(self, vi, done): # noqa: N802 with self._func_lock: if self.niFgen_IsDone_cfunc is None: - self.niFgen_IsDone_cfunc = self._get_library_function("niFgen_IsDone") - self.niFgen_IsDone_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niFgen_IsDone_cfunc = self._get_library_function('niFgen_IsDone') + self.niFgen_IsDone_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niFgen_IsDone_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_IsDone_cfunc(vi, done) def niFgen_LockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niFgen_LockSession_cfunc is None: - self.niFgen_LockSession_cfunc = self._get_library_function( - "niFgen_LockSession" - ) - self.niFgen_LockSession_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niFgen_LockSession_cfunc = self._get_library_function('niFgen_LockSession') + self.niFgen_LockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niFgen_LockSession_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_LockSession_cfunc(vi, caller_has_lock) - def niFgen_QueryArbSeqCapabilities( - self, - vi, - maximum_number_of_sequences, - minimum_sequence_length, - maximum_sequence_length, - maximum_loop_count, - ): # noqa: N802 + def niFgen_QueryArbSeqCapabilities(self, vi, maximum_number_of_sequences, minimum_sequence_length, maximum_sequence_length, maximum_loop_count): # noqa: N802 with self._func_lock: if self.niFgen_QueryArbSeqCapabilities_cfunc is None: - self.niFgen_QueryArbSeqCapabilities_cfunc = self._get_library_function( - "niFgen_QueryArbSeqCapabilities" - ) - self.niFgen_QueryArbSeqCapabilities_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niFgen_QueryArbSeqCapabilities_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFgen_QueryArbSeqCapabilities_cfunc( - vi, - maximum_number_of_sequences, - minimum_sequence_length, - maximum_sequence_length, - maximum_loop_count, - ) - - def niFgen_QueryArbWfmCapabilities( - self, - vi, - maximum_number_of_waveforms, - waveform_quantum, - minimum_waveform_size, - maximum_waveform_size, - ): # noqa: N802 + self.niFgen_QueryArbSeqCapabilities_cfunc = self._get_library_function('niFgen_QueryArbSeqCapabilities') + self.niFgen_QueryArbSeqCapabilities_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niFgen_QueryArbSeqCapabilities_cfunc.restype = ViStatus # noqa: F405 + return self.niFgen_QueryArbSeqCapabilities_cfunc(vi, maximum_number_of_sequences, minimum_sequence_length, maximum_sequence_length, maximum_loop_count) + + def niFgen_QueryArbWfmCapabilities(self, vi, maximum_number_of_waveforms, waveform_quantum, minimum_waveform_size, maximum_waveform_size): # noqa: N802 with self._func_lock: if self.niFgen_QueryArbWfmCapabilities_cfunc is None: - self.niFgen_QueryArbWfmCapabilities_cfunc = self._get_library_function( - "niFgen_QueryArbWfmCapabilities" - ) - self.niFgen_QueryArbWfmCapabilities_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niFgen_QueryArbWfmCapabilities_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFgen_QueryArbWfmCapabilities_cfunc( - vi, - maximum_number_of_waveforms, - waveform_quantum, - minimum_waveform_size, - maximum_waveform_size, - ) - - def niFgen_QueryFreqListCapabilities( - self, - vi, - maximum_number_of_freq_lists, - minimum_frequency_list_length, - maximum_frequency_list_length, - minimum_frequency_list_duration, - maximum_frequency_list_duration, - frequency_list_duration_quantum, - ): # noqa: N802 + self.niFgen_QueryArbWfmCapabilities_cfunc = self._get_library_function('niFgen_QueryArbWfmCapabilities') + self.niFgen_QueryArbWfmCapabilities_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niFgen_QueryArbWfmCapabilities_cfunc.restype = ViStatus # noqa: F405 + return self.niFgen_QueryArbWfmCapabilities_cfunc(vi, maximum_number_of_waveforms, waveform_quantum, minimum_waveform_size, maximum_waveform_size) + + def niFgen_QueryFreqListCapabilities(self, vi, maximum_number_of_freq_lists, minimum_frequency_list_length, maximum_frequency_list_length, minimum_frequency_list_duration, maximum_frequency_list_duration, frequency_list_duration_quantum): # noqa: N802 with self._func_lock: if self.niFgen_QueryFreqListCapabilities_cfunc is None: - self.niFgen_QueryFreqListCapabilities_cfunc = ( - self._get_library_function("niFgen_QueryFreqListCapabilities") - ) - self.niFgen_QueryFreqListCapabilities_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViReal64), - ] # noqa: F405 - self.niFgen_QueryFreqListCapabilities_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFgen_QueryFreqListCapabilities_cfunc( - vi, - maximum_number_of_freq_lists, - minimum_frequency_list_length, - maximum_frequency_list_length, - minimum_frequency_list_duration, - maximum_frequency_list_duration, - frequency_list_duration_quantum, - ) + self.niFgen_QueryFreqListCapabilities_cfunc = self._get_library_function('niFgen_QueryFreqListCapabilities') + self.niFgen_QueryFreqListCapabilities_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64)] # noqa: F405 + self.niFgen_QueryFreqListCapabilities_cfunc.restype = ViStatus # noqa: F405 + return self.niFgen_QueryFreqListCapabilities_cfunc(vi, maximum_number_of_freq_lists, minimum_frequency_list_length, maximum_frequency_list_length, minimum_frequency_list_duration, maximum_frequency_list_duration, frequency_list_duration_quantum) def niFgen_ReadCurrentTemperature(self, vi, temperature): # noqa: N802 with self._func_lock: if self.niFgen_ReadCurrentTemperature_cfunc is None: - self.niFgen_ReadCurrentTemperature_cfunc = self._get_library_function( - "niFgen_ReadCurrentTemperature" - ) - self.niFgen_ReadCurrentTemperature_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViReal64), - ] # noqa: F405 - self.niFgen_ReadCurrentTemperature_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niFgen_ReadCurrentTemperature_cfunc = self._get_library_function('niFgen_ReadCurrentTemperature') + self.niFgen_ReadCurrentTemperature_cfunc.argtypes = [ViSession, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niFgen_ReadCurrentTemperature_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_ReadCurrentTemperature_cfunc(vi, temperature) def niFgen_ResetDevice(self, vi): # noqa: N802 with self._func_lock: if self.niFgen_ResetDevice_cfunc is None: - self.niFgen_ResetDevice_cfunc = self._get_library_function( - "niFgen_ResetDevice" - ) + self.niFgen_ResetDevice_cfunc = self._get_library_function('niFgen_ResetDevice') self.niFgen_ResetDevice_cfunc.argtypes = [ViSession] # noqa: F405 self.niFgen_ResetDevice_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_ResetDevice_cfunc(vi) @@ -1065,9 +518,7 @@ def niFgen_ResetDevice(self, vi): # noqa: N802 def niFgen_ResetWithDefaults(self, vi): # noqa: N802 with self._func_lock: if self.niFgen_ResetWithDefaults_cfunc is None: - self.niFgen_ResetWithDefaults_cfunc = self._get_library_function( - "niFgen_ResetWithDefaults" - ) + self.niFgen_ResetWithDefaults_cfunc = self._get_library_function('niFgen_ResetWithDefaults') self.niFgen_ResetWithDefaults_cfunc.argtypes = [ViSession] # noqa: F405 self.niFgen_ResetWithDefaults_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_ResetWithDefaults_cfunc(vi) @@ -1075,7 +526,7 @@ def niFgen_ResetWithDefaults(self, vi): # noqa: N802 def niFgen_SelfCal(self, vi): # noqa: N802 with self._func_lock: if self.niFgen_SelfCal_cfunc is None: - self.niFgen_SelfCal_cfunc = self._get_library_function("niFgen_SelfCal") + self.niFgen_SelfCal_cfunc = self._get_library_function('niFgen_SelfCal') self.niFgen_SelfCal_cfunc.argtypes = [ViSession] # noqa: F405 self.niFgen_SelfCal_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_SelfCal_cfunc(vi) @@ -1083,265 +534,119 @@ def niFgen_SelfCal(self, vi): # noqa: N802 def niFgen_SendSoftwareEdgeTrigger(self, vi, trigger, trigger_id): # noqa: N802 with self._func_lock: if self.niFgen_SendSoftwareEdgeTrigger_cfunc is None: - self.niFgen_SendSoftwareEdgeTrigger_cfunc = self._get_library_function( - "niFgen_SendSoftwareEdgeTrigger" - ) - self.niFgen_SendSoftwareEdgeTrigger_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niFgen_SendSoftwareEdgeTrigger_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niFgen_SendSoftwareEdgeTrigger_cfunc = self._get_library_function('niFgen_SendSoftwareEdgeTrigger') + self.niFgen_SendSoftwareEdgeTrigger_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niFgen_SendSoftwareEdgeTrigger_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_SendSoftwareEdgeTrigger_cfunc(vi, trigger, trigger_id) - def niFgen_SetAttributeViBoolean( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niFgen_SetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niFgen_SetAttributeViBoolean_cfunc is None: - self.niFgen_SetAttributeViBoolean_cfunc = self._get_library_function( - "niFgen_SetAttributeViBoolean" - ) - self.niFgen_SetAttributeViBoolean_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViBoolean, - ] # noqa: F405 + self.niFgen_SetAttributeViBoolean_cfunc = self._get_library_function('niFgen_SetAttributeViBoolean') + self.niFgen_SetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViBoolean] # noqa: F405 self.niFgen_SetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_SetAttributeViBoolean_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niFgen_SetAttributeViBoolean_cfunc(vi, channel_name, attribute_id, attribute_value) - def niFgen_SetAttributeViInt32( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niFgen_SetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niFgen_SetAttributeViInt32_cfunc is None: - self.niFgen_SetAttributeViInt32_cfunc = self._get_library_function( - "niFgen_SetAttributeViInt32" - ) - self.niFgen_SetAttributeViInt32_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViInt32, - ] # noqa: F405 + self.niFgen_SetAttributeViInt32_cfunc = self._get_library_function('niFgen_SetAttributeViInt32') + self.niFgen_SetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32] # noqa: F405 self.niFgen_SetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_SetAttributeViInt32_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niFgen_SetAttributeViInt32_cfunc(vi, channel_name, attribute_id, attribute_value) - def niFgen_SetAttributeViReal64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niFgen_SetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niFgen_SetAttributeViReal64_cfunc is None: - self.niFgen_SetAttributeViReal64_cfunc = self._get_library_function( - "niFgen_SetAttributeViReal64" - ) - self.niFgen_SetAttributeViReal64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViReal64, - ] # noqa: F405 + self.niFgen_SetAttributeViReal64_cfunc = self._get_library_function('niFgen_SetAttributeViReal64') + self.niFgen_SetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViReal64] # noqa: F405 self.niFgen_SetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_SetAttributeViReal64_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niFgen_SetAttributeViReal64_cfunc(vi, channel_name, attribute_id, attribute_value) - def niFgen_SetAttributeViString( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niFgen_SetAttributeViString(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niFgen_SetAttributeViString_cfunc is None: - self.niFgen_SetAttributeViString_cfunc = self._get_library_function( - "niFgen_SetAttributeViString" - ) - self.niFgen_SetAttributeViString_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niFgen_SetAttributeViString_cfunc = self._get_library_function('niFgen_SetAttributeViString') + self.niFgen_SetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViChar)] # noqa: F405 self.niFgen_SetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_SetAttributeViString_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niFgen_SetAttributeViString_cfunc(vi, channel_name, attribute_id, attribute_value) - def niFgen_SetNamedWaveformNextWritePosition( - self, vi, channel_name, waveform_name, relative_to, offset - ): # noqa: N802 + def niFgen_SetNamedWaveformNextWritePosition(self, vi, channel_name, waveform_name, relative_to, offset): # noqa: N802 with self._func_lock: if self.niFgen_SetNamedWaveformNextWritePosition_cfunc is None: - self.niFgen_SetNamedWaveformNextWritePosition_cfunc = ( - self._get_library_function( - "niFgen_SetNamedWaveformNextWritePosition" - ) - ) - self.niFgen_SetNamedWaveformNextWritePosition_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViInt32, - ViInt32, - ] # noqa: F405 - self.niFgen_SetNamedWaveformNextWritePosition_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFgen_SetNamedWaveformNextWritePosition_cfunc( - vi, channel_name, waveform_name, relative_to, offset - ) - - def niFgen_SetWaveformNextWritePosition( - self, vi, channel_name, waveform_handle, relative_to, offset - ): # noqa: N802 + self.niFgen_SetNamedWaveformNextWritePosition_cfunc = self._get_library_function('niFgen_SetNamedWaveformNextWritePosition') + self.niFgen_SetNamedWaveformNextWritePosition_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ViInt32] # noqa: F405 + self.niFgen_SetNamedWaveformNextWritePosition_cfunc.restype = ViStatus # noqa: F405 + return self.niFgen_SetNamedWaveformNextWritePosition_cfunc(vi, channel_name, waveform_name, relative_to, offset) + + def niFgen_SetWaveformNextWritePosition(self, vi, channel_name, waveform_handle, relative_to, offset): # noqa: N802 with self._func_lock: if self.niFgen_SetWaveformNextWritePosition_cfunc is None: - self.niFgen_SetWaveformNextWritePosition_cfunc = ( - self._get_library_function("niFgen_SetWaveformNextWritePosition") - ) - self.niFgen_SetWaveformNextWritePosition_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ViInt32, - ViInt32, - ] # noqa: F405 - self.niFgen_SetWaveformNextWritePosition_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niFgen_SetWaveformNextWritePosition_cfunc( - vi, channel_name, waveform_handle, relative_to, offset - ) + self.niFgen_SetWaveformNextWritePosition_cfunc = self._get_library_function('niFgen_SetWaveformNextWritePosition') + self.niFgen_SetWaveformNextWritePosition_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViInt32, ViInt32] # noqa: F405 + self.niFgen_SetWaveformNextWritePosition_cfunc.restype = ViStatus # noqa: F405 + return self.niFgen_SetWaveformNextWritePosition_cfunc(vi, channel_name, waveform_handle, relative_to, offset) def niFgen_UnlockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niFgen_UnlockSession_cfunc is None: - self.niFgen_UnlockSession_cfunc = self._get_library_function( - "niFgen_UnlockSession" - ) - self.niFgen_UnlockSession_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niFgen_UnlockSession_cfunc = self._get_library_function('niFgen_UnlockSession') + self.niFgen_UnlockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niFgen_UnlockSession_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_UnlockSession_cfunc(vi, caller_has_lock) def niFgen_WaitUntilDone(self, vi, max_time): # noqa: N802 with self._func_lock: if self.niFgen_WaitUntilDone_cfunc is None: - self.niFgen_WaitUntilDone_cfunc = self._get_library_function( - "niFgen_WaitUntilDone" - ) - self.niFgen_WaitUntilDone_cfunc.argtypes = [ - ViSession, - ViInt32, - ] # noqa: F405 + self.niFgen_WaitUntilDone_cfunc = self._get_library_function('niFgen_WaitUntilDone') + self.niFgen_WaitUntilDone_cfunc.argtypes = [ViSession, ViInt32] # noqa: F405 self.niFgen_WaitUntilDone_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_WaitUntilDone_cfunc(vi, max_time) - def niFgen_WriteBinary16Waveform( - self, vi, channel_name, waveform_handle, size, data - ): # noqa: N802 + def niFgen_WriteBinary16Waveform(self, vi, channel_name, waveform_handle, size, data): # noqa: N802 with self._func_lock: if self.niFgen_WriteBinary16Waveform_cfunc is None: - self.niFgen_WriteBinary16Waveform_cfunc = self._get_library_function( - "niFgen_WriteBinary16Waveform" - ) - self.niFgen_WriteBinary16Waveform_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ViInt32, - ctypes.POINTER(ViInt16), - ] # noqa: F405 + self.niFgen_WriteBinary16Waveform_cfunc = self._get_library_function('niFgen_WriteBinary16Waveform') + self.niFgen_WriteBinary16Waveform_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViInt32, ctypes.POINTER(ViInt16)] # noqa: F405 self.niFgen_WriteBinary16Waveform_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_WriteBinary16Waveform_cfunc( - vi, channel_name, waveform_handle, size, data - ) + return self.niFgen_WriteBinary16Waveform_cfunc(vi, channel_name, waveform_handle, size, data) - def niFgen_WriteNamedWaveformF64( - self, vi, channel_name, waveform_name, size, data - ): # noqa: N802 + def niFgen_WriteNamedWaveformF64(self, vi, channel_name, waveform_name, size, data): # noqa: N802 with self._func_lock: if self.niFgen_WriteNamedWaveformF64_cfunc is None: - self.niFgen_WriteNamedWaveformF64_cfunc = self._get_library_function( - "niFgen_WriteNamedWaveformF64" - ) - self.niFgen_WriteNamedWaveformF64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niFgen_WriteNamedWaveformF64_cfunc = self._get_library_function('niFgen_WriteNamedWaveformF64') + self.niFgen_WriteNamedWaveformF64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 self.niFgen_WriteNamedWaveformF64_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_WriteNamedWaveformF64_cfunc( - vi, channel_name, waveform_name, size, data - ) + return self.niFgen_WriteNamedWaveformF64_cfunc(vi, channel_name, waveform_name, size, data) - def niFgen_WriteNamedWaveformI16( - self, vi, channel_name, waveform_name, size, data - ): # noqa: N802 + def niFgen_WriteNamedWaveformI16(self, vi, channel_name, waveform_name, size, data): # noqa: N802 with self._func_lock: if self.niFgen_WriteNamedWaveformI16_cfunc is None: - self.niFgen_WriteNamedWaveformI16_cfunc = self._get_library_function( - "niFgen_WriteNamedWaveformI16" - ) - self.niFgen_WriteNamedWaveformI16_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViInt16), - ] # noqa: F405 + self.niFgen_WriteNamedWaveformI16_cfunc = self._get_library_function('niFgen_WriteNamedWaveformI16') + self.niFgen_WriteNamedWaveformI16_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViInt16)] # noqa: F405 self.niFgen_WriteNamedWaveformI16_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_WriteNamedWaveformI16_cfunc( - vi, channel_name, waveform_name, size, data - ) + return self.niFgen_WriteNamedWaveformI16_cfunc(vi, channel_name, waveform_name, size, data) def niFgen_WriteScript(self, vi, channel_name, script): # noqa: N802 with self._func_lock: if self.niFgen_WriteScript_cfunc is None: - self.niFgen_WriteScript_cfunc = self._get_library_function( - "niFgen_WriteScript" - ) - self.niFgen_WriteScript_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niFgen_WriteScript_cfunc = self._get_library_function('niFgen_WriteScript') + self.niFgen_WriteScript_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar)] # noqa: F405 self.niFgen_WriteScript_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_WriteScript_cfunc(vi, channel_name, script) - def niFgen_WriteWaveform( - self, vi, channel_name, waveform_handle, size, data - ): # noqa: N802 + def niFgen_WriteWaveform(self, vi, channel_name, waveform_handle, size, data): # noqa: N802 with self._func_lock: if self.niFgen_WriteWaveform_cfunc is None: - self.niFgen_WriteWaveform_cfunc = self._get_library_function( - "niFgen_WriteWaveform" - ) - self.niFgen_WriteWaveform_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ViInt32, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niFgen_WriteWaveform_cfunc = self._get_library_function('niFgen_WriteWaveform') + self.niFgen_WriteWaveform_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 self.niFgen_WriteWaveform_cfunc.restype = ViStatus # noqa: F405 - return self.niFgen_WriteWaveform_cfunc( - vi, channel_name, waveform_handle, size, data - ) + return self.niFgen_WriteWaveform_cfunc(vi, channel_name, waveform_handle, size, data) def niFgen_close(self, vi): # noqa: N802 with self._func_lock: if self.niFgen_close_cfunc is None: - self.niFgen_close_cfunc = self._get_library_function("niFgen_close") + self.niFgen_close_cfunc = self._get_library_function('niFgen_close') self.niFgen_close_cfunc.argtypes = [ViSession] # noqa: F405 self.niFgen_close_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_close_cfunc(vi) @@ -1349,21 +654,15 @@ def niFgen_close(self, vi): # noqa: N802 def niFgen_error_message(self, vi, error_code, error_message): # noqa: N802 with self._func_lock: if self.niFgen_error_message_cfunc is None: - self.niFgen_error_message_cfunc = self._get_library_function( - "niFgen_error_message" - ) - self.niFgen_error_message_cfunc.argtypes = [ - ViSession, - ViStatus, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niFgen_error_message_cfunc = self._get_library_function('niFgen_error_message') + self.niFgen_error_message_cfunc.argtypes = [ViSession, ViStatus, ctypes.POINTER(ViChar)] # noqa: F405 self.niFgen_error_message_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_error_message_cfunc(vi, error_code, error_message) def niFgen_reset(self, vi): # noqa: N802 with self._func_lock: if self.niFgen_reset_cfunc is None: - self.niFgen_reset_cfunc = self._get_library_function("niFgen_reset") + self.niFgen_reset_cfunc = self._get_library_function('niFgen_reset') self.niFgen_reset_cfunc.argtypes = [ViSession] # noqa: F405 self.niFgen_reset_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_reset_cfunc(vi) @@ -1371,13 +670,7 @@ def niFgen_reset(self, vi): # noqa: N802 def niFgen_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 with self._func_lock: if self.niFgen_self_test_cfunc is None: - self.niFgen_self_test_cfunc = self._get_library_function( - "niFgen_self_test" - ) - self.niFgen_self_test_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt16), - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niFgen_self_test_cfunc = self._get_library_function('niFgen_self_test') + self.niFgen_self_test_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt16), ctypes.POINTER(ViChar)] # noqa: F405 self.niFgen_self_test_cfunc.restype = ViStatus # noqa: F405 return self.niFgen_self_test_cfunc(vi, self_test_result, self_test_message) diff --git a/generated/nifgen/nifgen/_library_singleton.py b/generated/nifgen/nifgen/_library_singleton.py index 8072e04d3..cf3648624 100644 --- a/generated/nifgen/nifgen/_library_singleton.py +++ b/generated/nifgen/nifgen/_library_singleton.py @@ -12,36 +12,30 @@ _instance = None _instance_lock = threading.Lock() -_library_info = { - "Linux": {"64bit": {"name": "nifgen", "type": "cdll"}}, - "Windows": { - "32bit": {"name": "niFgen_32.dll", "type": "windll"}, - "64bit": {"name": "niFgen_64.dll", "type": "cdll"}, - }, -} +_library_info = {'Linux': {'64bit': {'name': 'nifgen', 'type': 'cdll'}}, + 'Windows': {'32bit': {'name': 'niFgen_32.dll', 'type': 'windll'}, + '64bit': {'name': 'niFgen_64.dll', 'type': 'cdll'}}} def _get_library_name(): try: - return ctypes.util.find_library( - _library_info[platform.system()][platform.architecture()[0]]["name"] - ) # We find and return full path to the DLL + return ctypes.util.find_library(_library_info[platform.system()][platform.architecture()[0]]['name']) # We find and return full path to the DLL except KeyError: raise errors.UnsupportedConfigurationError def _get_library_type(): try: - return _library_info[platform.system()][platform.architecture()[0]]["type"] + return _library_info[platform.system()][platform.architecture()[0]]['type'] except KeyError: raise errors.UnsupportedConfigurationError def get(): - """get + '''get Returns the library.Library singleton for nifgen. - """ + ''' global _instance global _instance_lock @@ -49,12 +43,13 @@ def get(): if _instance is None: try: library_type = _get_library_type() - if library_type == "windll": + if library_type == 'windll': ctypes_library = ctypes.WinDLL(_get_library_name()) else: - assert library_type == "cdll" + assert library_type == 'cdll' ctypes_library = ctypes.CDLL(_get_library_name()) except OSError: raise errors.DriverNotInstalledError() _instance = _library.Library(ctypes_library) return _instance + diff --git a/generated/nifgen/nifgen/_visatype.py b/generated/nifgen/nifgen/_visatype.py index bf96c3cfb..02cc41d1b 100644 --- a/generated/nifgen/nifgen/_visatype.py +++ b/generated/nifgen/nifgen/_visatype.py @@ -2,9 +2,9 @@ import ctypes -"""Definitions of the VISA types used by the C API of the driver runtime. +'''Definitions of the VISA types used by the C API of the driver runtime. These are aliased directly to ctypes types so can be used directly to call into the library. -""" +''' ViChar = ctypes.c_char @@ -26,3 +26,4 @@ ViAttr = ViUInt32 ViConstString = ViString ViRsrc = ViString + diff --git a/generated/nifgen/nifgen/enums.py b/generated/nifgen/nifgen/enums.py index c3cc01484..f9a4c7678 100644 --- a/generated/nifgen/nifgen/enums.py +++ b/generated/nifgen/nifgen/enums.py @@ -6,52 +6,52 @@ class AnalogPath(Enum): MAIN = 0 - r""" + r''' Specifies use of the main path. NI-FGEN chooses the amplifier based on the user-specified gain. - """ + ''' DIRECT = 1 - r""" + r''' Specifies use of the direct path. - """ + ''' FIXED_LOW_GAIN = 2 - r""" + r''' Specifies use of the low-gain amplifier in the main path, no matter what value the user specifies for gain. This setting limits the output range. - """ + ''' FIXED_HIGH_GAIN = 3 - r""" + r''' Specifies use of the high-gain amplifier in the main path. - """ + ''' class BusType(Enum): INVALID = 0 - r""" + r''' Indicates an invalid bus type. - """ + ''' AT = 1 - r""" + r''' Indicates the signal generator is the AT bus type. - """ + ''' PCI = 2 - r""" + r''' Indicates the signal generator is the PCI bus type. - """ + ''' PXI = 3 - r""" + r''' Indicates the signal generator is the PXI bus type. - """ + ''' VXI = 4 - r""" + r''' Indicates the signal generator is the VXI bus type. - """ + ''' PCMCIA = 5 - r""" + r''' Indicates the signal generator is the PCI-CMA bus type. - """ + ''' PXIE = 6 - r""" + r''' Indicates the signal generator is the PXI Express bus type. - """ + ''' class ByteOrder(Enum): @@ -61,28 +61,28 @@ class ByteOrder(Enum): class ClockMode(Enum): HIGH_RESOLUTION = 0 - r""" + r''' High resolution sampling—Sample rate is generated by a high–resolution clock source. - """ + ''' DIVIDE_DOWN = 1 - r""" + r''' Divide down sampling—Sample rates are generated by dividing the source frequency. - """ + ''' AUTOMATIC = 2 - r""" + r''' Automatic Selection—NI-FGEN selects between the divide–down and high–resolution clocking modes. - """ + ''' class DataMarkerEventLevelPolarity(Enum): HIGH = 101 - r""" + r''' When the operation is ready to start, the Ready for Start event level is high. - """ + ''' LOW = 102 - r""" + r''' When the operation is ready to start, the Ready for Start event level is low. - """ + ''' class HardwareState(Enum): @@ -95,62 +95,62 @@ class HardwareState(Enum): class IdleBehavior(Enum): HOLD_LAST = 400 - r""" + r''' While in an Idle or Wait state, the output signal remains at the last voltage generated prior to entering the state. - """ + ''' JUMP_TO = 401 - r""" + r''' While in an Idle or Wait state, the output signal remains at the value configured in the Idle or Wait value property. - """ + ''' class OutputMode(Enum): FUNC = 0 - r""" + r''' Standard Method mode— Generates standard method waveforms such as sine, square, triangle, and so on. - """ + ''' ARB = 1 - r""" + r''' Arbitrary waveform mode—Generates waveforms from user-created/provided waveform arrays of numeric data. - """ + ''' SEQ = 2 - r""" + r''' Arbitrary sequence mode — Generates downloaded waveforms in an order your specify. - """ + ''' FREQ_LIST = 101 - r""" + r''' Frequency List mode—Generates a standard method using a list of frequencies you define. - """ + ''' SCRIPT = 102 - r""" + r''' **Script mode—**\ Allows you to use scripting to link and loop multiple waveforms in complex combinations. - """ + ''' class ReferenceClockSource(Enum): - CLOCK_IN = "ClkIn" - r""" + CLOCK_IN = 'ClkIn' + r''' Specifies that the CLK IN input signal from the front panel connector is used as the Reference Clock source. - """ - NONE = "None" - r""" + ''' + NONE = 'None' + r''' Specifies that a Reference Clock is not used. - """ - ONBOARD_REFERENCE_CLOCK = "OnboardRefClk" - r""" + ''' + ONBOARD_REFERENCE_CLOCK = 'OnboardRefClk' + r''' Specifies that the onboard Reference Clock is used as the Reference Clock source. - """ - PXI_CLOCK = "PXI_Clk" - r""" + ''' + PXI_CLOCK = 'PXI_Clk' + r''' Specifies the PXI Clock is used as the Reference Clock source. - """ - RTSI_7 = "RTSI7" - r""" + ''' + RTSI_7 = 'RTSI7' + r''' Specifies that the RTSI line 7 is used as the Reference Clock source. - """ + ''' class RelativeTo(Enum): @@ -159,148 +159,148 @@ class RelativeTo(Enum): class SampleClockSource(Enum): - CLOCK_IN = "ClkIn" - r""" + CLOCK_IN = 'ClkIn' + r''' Specifies that the signal at the CLK IN front panel connector is used as the Sample Clock source. - """ - DDC_CLOCK_IN = "DDC_ClkIn" - r""" + ''' + DDC_CLOCK_IN = 'DDC_ClkIn' + r''' Specifies that the Sample Clock from DDC connector is used as the Sample Clock source. - """ - ONBOARD_CLOCK = "OnboardClock" - r""" + ''' + ONBOARD_CLOCK = 'OnboardClock' + r''' Specifies that the onboard clock is used as the Sample Clock source. - """ - PXI_STAR_LINE = "PXI_Star" - r""" + ''' + PXI_STAR_LINE = 'PXI_Star' + r''' Specifies that the PXI\_STAR trigger line is used as the Sample Clock source. - """ - PXI_TRIGGER_LINE_0_RTSI_0 = "PXI_Trig0" - r""" + ''' + PXI_TRIGGER_LINE_0_RTSI_0 = 'PXI_Trig0' + r''' Specifies that the PXI or RTSI line 0 is used as the Sample Clock source. - """ - PXI_TRIGGER_LINE_1_RTSI_1 = "PXI_Trig1" - r""" + ''' + PXI_TRIGGER_LINE_1_RTSI_1 = 'PXI_Trig1' + r''' Specifies that the PXI or RTSI line 1 is used as the Sample Clock source. - """ - PXI_TRIGGER_LINE_2_RTSI_2 = "PXI_Trig2" - r""" + ''' + PXI_TRIGGER_LINE_2_RTSI_2 = 'PXI_Trig2' + r''' Specifies that the PXI or RTSI line 2 is used as the Sample Clock source. - """ - PXI_TRIGGER_LINE_3_RTSI_3 = "PXI_Trig3" - r""" + ''' + PXI_TRIGGER_LINE_3_RTSI_3 = 'PXI_Trig3' + r''' Specifies that the PXI or RTSI line 3 is used as the Sample Clock source. - """ - PXI_TRIGGER_LINE_4_RTSI_4 = "PXI_Trig4" - r""" + ''' + PXI_TRIGGER_LINE_4_RTSI_4 = 'PXI_Trig4' + r''' Specifies that the PXI or RTSI line 4 is used as the Sample Clock source. - """ - PXI_TRIGGER_LINE_5_RTSI_5 = "PXI_Trig5" - r""" + ''' + PXI_TRIGGER_LINE_5_RTSI_5 = 'PXI_Trig5' + r''' Specifies that the PXI or RTSI line 5 is used as the Sample Clock source. - """ - PXI_TRIGGER_LINE_6_RTSI_6 = "PXI_Trig6" - r""" + ''' + PXI_TRIGGER_LINE_6_RTSI_6 = 'PXI_Trig6' + r''' Specifies that the PXI or RTSI line 6 is used as the Sample Clock source. - """ - PXI_TRIGGER_LINE_7_RTSI_7 = "PXI_Trig7" - r""" + ''' + PXI_TRIGGER_LINE_7_RTSI_7 = 'PXI_Trig7' + r''' Specifies that the PXI or RTSI line 7 is used as the Sample Clock source. - """ + ''' class SampleClockTimebaseSource(Enum): - CLOCK_IN = "ClkIn" - r""" + CLOCK_IN = 'ClkIn' + r''' Specifies that the external signal on the CLK IN front panel connector is used as the source. - """ - ONBOARD_CLOCK = "OnboardClock" - r""" + ''' + ONBOARD_CLOCK = 'OnboardClock' + r''' Specifies that the onboard Sample Clock timebase is used as the source. - """ + ''' class ScriptTriggerDigitalEdgeEdge(Enum): RISING = 101 - r""" + r''' Rising Edge - """ + ''' FALLING = 102 - r""" + r''' Falling Edge - """ + ''' class ScriptTriggerType(Enum): TRIG_NONE = 101 - r""" + r''' No trigger is configured. Signal generation starts immediately. - """ + ''' DIGITAL_EDGE = 102 - r""" + r''' Trigger is asserted when a digital edge is detected. - """ + ''' DIGITAL_LEVEL = 103 - r""" + r''' Trigger is asserted when a digital level is detected. - """ + ''' SOFTWARE_EDGE = 104 - r""" + r''' Trigger is asserted when a software edge is detected. - """ + ''' class StartTriggerDigitalEdgeEdge(Enum): RISING = 101 - r""" + r''' Rising Edge - """ + ''' FALLING = 102 - r""" + r''' Falling Edge - """ + ''' class StartTriggerType(Enum): TRIG_NONE = 101 - r""" + r''' None - """ + ''' DIGITAL_EDGE = 102 - r""" + r''' Digital Edge - """ + ''' SOFTWARE_EDGE = 104 - r""" + r''' Software Edge - """ + ''' P2P_ENDPOINT_FULLNESS = 106 - r""" + r''' P2P Endpoint Fullness - """ + ''' class TerminalConfiguration(Enum): SINGLE_ENDED = 300 - r""" + r''' Single-ended operation - """ + ''' DIFFERENTIAL = 301 - r""" + r''' Differential operation - """ + ''' class Trigger(Enum): @@ -310,70 +310,70 @@ class Trigger(Enum): class TriggerMode(Enum): SINGLE = 1 - r""" + r''' Single Trigger Mode - The waveform you describe in the sequence list is generated only once by going through the entire staging list. Only one trigger is required to start the waveform generation. You can use Single trigger mode with the output mode in any mode. After a trigger is received, the waveform generation starts from the first stage and continues through to the last stage. Then, the last stage generates repeatedly until you stop the waveform generation. - """ + ''' CONTINUOUS = 2 - r""" + r''' Continuous Trigger Mode - The waveform you describe in the staging list generates infinitely by repeatedly cycling through the staging list. After a trigger is received, the waveform generation starts from the first stage and continues through to the last stage. After the last stage completes, the waveform generation loops back to the start of the first stage and continues until it is stopped. Only one trigger is required to start the waveform generation. - """ + ''' STEPPED = 3 - r""" + r''' Stepped Trigger Mode - After a start trigger is received, the waveform described by the first stage generates. Then, the device waits for the next trigger signal. On the next trigger, the waveform described by the second stage generates, and so on. After the staging list completes, the waveform generation returns to the first stage and continues in a cyclic fashion. After any stage has generated completely, the first eight samples of the next stage are repeated continuously until the next trigger is received. trigger mode. Note: In Frequency List mode, Stepped trigger mode is the same as Burst - """ + ''' BURST = 4 - r""" + r''' Burst Trigger Mode - After a start trigger is received, the waveform described by the first stage generates until another trigger is received. At the next trigger, the buffer of the previous stage completes, and then the waveform described by the second stage generates. After the staging list completes, the waveform generation returns to the first stage and continues in a cyclic fashion. In Frequency List mode, the duration instruction is ignored, and the trigger switches the frequency to the next frequency in the list. trigger mode. Note: In Frequency List mode, Stepped trigger mode is the same as Burst - """ + ''' class WaitBehavior(Enum): HOLD_LAST = 400 - r""" + r''' While in an Idle or Wait state, the output signal remains at the last voltage generated prior to entering the state. - """ + ''' JUMP_TO = 401 - r""" + r''' While in an Idle or Wait state, the output signal remains at the value configured in the Idle or Wait value property. - """ + ''' class Waveform(Enum): SINE = 1 - r""" + r''' Sinusoid waveform - """ + ''' SQUARE = 2 - r""" + r''' Square waveform - """ + ''' TRIANGLE = 3 - r""" + r''' Triange waveform - """ + ''' RAMP_UP = 4 - r""" + r''' Positive ramp waveform - """ + ''' RAMP_DOWN = 5 - r""" + r''' Negative ramp waveform - """ + ''' DC = 6 - r""" + r''' Constant voltage - """ + ''' NOISE = 101 - r""" + r''' White noise - """ + ''' USER = 102 - r""" + r''' User-defined waveform as defined by the define_user_standard_waveform method. - """ + ''' diff --git a/generated/nifgen/nifgen/errors.py b/generated/nifgen/nifgen/errors.py index cdc09eeb0..8399964da 100644 --- a/generated/nifgen/nifgen/errors.py +++ b/generated/nifgen/nifgen/errors.py @@ -7,103 +7,86 @@ def _is_success(code): - return code == 0 + return (code == 0) def _is_error(code): - return code < 0 + return (code < 0) def _is_warning(code): - return code > 0 + return (code > 0) class Error(Exception): - """Base error class for NI-FGEN""" + '''Base error class for NI-FGEN''' def __init__(self, message): super(Error, self).__init__(message) class DriverError(Error): - """An error originating from the NI-FGEN driver""" + '''An error originating from the NI-FGEN driver''' def __init__(self, code, description): - assert _is_error(code), "Should not raise Error if code is not fatal." + assert (_is_error(code)), "Should not raise Error if code is not fatal." self.code = code self.description = description super(DriverError, self).__init__(str(self.code) + ": " + self.description) class DriverWarning(Warning): - """A warning originating from the NI-FGEN driver""" + '''A warning originating from the NI-FGEN driver''' def __init__(self, code, description): - assert _is_warning(code), "Should not create Warning if code is not positive." - super(DriverWarning, self).__init__( - "Warning {0} occurred.\n\n{1}".format(code, description) - ) + assert (_is_warning(code)), "Should not create Warning if code is not positive." + super(DriverWarning, self).__init__('Warning {0} occurred.\n\n{1}'.format(code, description)) class UnsupportedConfigurationError(Error): - """An error due to using this module in an usupported platform.""" + '''An error due to using this module in an usupported platform.''' def __init__(self): - super(UnsupportedConfigurationError, self).__init__( - "System configuration is unsupported: " - + platform.architecture()[0] - + " " - + platform.system() - ) + super(UnsupportedConfigurationError, self).__init__('System configuration is unsupported: ' + platform.architecture()[0] + ' ' + platform.system()) class DriverNotInstalledError(Error): - """An error due to using this module without the driver runtime installed.""" + '''An error due to using this module without the driver runtime installed.''' def __init__(self): - super(DriverNotInstalledError, self).__init__( - "The NI-FGEN runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it." - ) + super(DriverNotInstalledError, self).__init__('The NI-FGEN runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it.') class DriverTooOldError(Error): - """An error due to using this module with an older version of the driver runtime.""" + '''An error due to using this module with an older version of the driver runtime.''' def __init__(self): - super(DriverTooOldError, self).__init__( - "A function was not found in the NI-FGEN runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it." - ) + super(DriverTooOldError, self).__init__('A function was not found in the NI-FGEN runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it.') class InvalidRepeatedCapabilityError(Error): - """An error due to an invalid character in a repeated capability""" + '''An error due to an invalid character in a repeated capability''' def __init__(self, invalid_character, invalid_string): - super(InvalidRepeatedCapabilityError, self).__init__( - "An invalid character ({0}) was found in repeated capability string ({1})".format( - invalid_character, invalid_string - ) - ) + super(InvalidRepeatedCapabilityError, self).__init__('An invalid character ({0}) was found in repeated capability string ({1})'.format(invalid_character, invalid_string)) class SelfTestError(Error): - """An error due to a failed self-test""" + '''An error due to a failed self-test''' def __init__(self, code, msg): self.code = code self.message = msg - super(SelfTestError, self).__init__( - "Self-test failed with code {0}: {1}".format(code, msg) - ) + super(SelfTestError, self).__init__('Self-test failed with code {0}: {1}'.format(code, msg)) def handle_error(session, code, ignore_warnings, is_error_handling): - """handle_error + '''handle_error Helper function for handling errors returned by nifgen.Library. It calls back into the session to get the corresponding error description and raises if necessary. - """ + ''' if _is_success(code) or (_is_warning(code) and ignore_warnings): return @@ -111,7 +94,7 @@ def handle_error(session, code, ignore_warnings, is_error_handling): if is_error_handling: # The caller is in the midst of error handling and an error occurred. # Don't try to get the description or we'll start recursing until the stack overflows. - description = "" + description = '' else: description = session._get_error_description(code) @@ -120,3 +103,5 @@ def handle_error(session, code, ignore_warnings, is_error_handling): assert _is_warning(code) warnings.warn(DriverWarning(code, description)) + + diff --git a/generated/nifgen/nifgen/session.py b/generated/nifgen/nifgen/session.py index 5e15cb230..4e4a79116 100644 --- a/generated/nifgen/nifgen/session.py +++ b/generated/nifgen/nifgen/session.py @@ -2,7 +2,6 @@ # This file was generated import array # noqa: F401 import ctypes - # Used by @ivi_synchronized from functools import wraps @@ -18,24 +17,22 @@ # Used for __repr__ import pprint - pp = pprint.PrettyPrinter(indent=4) # Helper functions for creating ctypes needed for calling into the driver DLL def get_ctypes_pointer_for_buffer(value=None, library_type=None, size=None): if isinstance(value, array.array): - assert library_type is not None, "library_type is required for array.array" + assert library_type is not None, 'library_type is required for array.array' addr, _ = value.buffer_info() return ctypes.cast(addr, ctypes.POINTER(library_type)) elif str(type(value)).find("'numpy.ndarray'") != -1: import numpy - return numpy.ctypeslib.as_ctypes(value) elif isinstance(value, bytes): return ctypes.cast(value, ctypes.POINTER(library_type)) elif isinstance(value, list): - assert library_type is not None, "library_type is required for list" + assert library_type is not None, 'library_type is required for list' return (library_type * len(value))(*value) else: if library_type is not None and size is not None: @@ -75,7 +72,6 @@ def aux(*xs, **kws): session = xs[0] # parameter 0 is 'self' which is the session object with session.lock(): return f(*xs, **kws) - return aux @@ -96,34 +92,16 @@ def __init__(self, session, prefix, current_repeated_capability_list): self._session = session self._prefix = prefix # We need at least one element. If we get an empty list, make the one element an empty string - self._current_repeated_capability_list = ( - current_repeated_capability_list - if len(current_repeated_capability_list) > 0 - else [""] - ) + self._current_repeated_capability_list = current_repeated_capability_list if len(current_repeated_capability_list) > 0 else [''] # Now we know there is at lease one entry, so we look if it is an empty string or not - self._separator = ( - "/" if len(self._current_repeated_capability_list[0]) > 0 else "" - ) + self._separator = '/' if len(self._current_repeated_capability_list[0]) > 0 else '' def __getitem__(self, repeated_capability): - """Set/get properties or call methods with a repeated capability (i.e. channels)""" - rep_caps_list = _converters.convert_repeated_capabilities( - repeated_capability, self._prefix - ) - complete_rep_cap_list = [ - current_rep_cap + self._separator + rep_cap - for current_rep_cap in self._current_repeated_capability_list - for rep_cap in rep_caps_list - ] - - return _SessionBase( - vi=self._session._vi, - repeated_capability_list=complete_rep_cap_list, - library=self._session._library, - encoding=self._session._encoding, - freeze_it=True, - ) + '''Set/get properties or call methods with a repeated capability (i.e. channels)''' + rep_caps_list = _converters.convert_repeated_capabilities(repeated_capability, self._prefix) + complete_rep_cap_list = [current_rep_cap + self._separator + rep_cap for current_rep_cap in self._current_repeated_capability_list for rep_cap in rep_caps_list] + + return _SessionBase(vi=self._session._vi, repeated_capability_list=complete_rep_cap_list, library=self._session._library, encoding=self._session._encoding, freeze_it=True) # This is a very simple context manager we can use when we need to set/get attributes @@ -135,20 +113,20 @@ def __init__(self, session): def __enter__(self): self._repeated_capability_cache = self._session._repeated_capability - self._session._repeated_capability = "" + self._session._repeated_capability = '' def __exit__(self, exc_type, exc_value, traceback): self._session._repeated_capability = self._repeated_capability_cache class _SessionBase(object): - """Base class for all NI-FGEN sessions.""" + '''Base class for all NI-FGEN sessions.''' # This is needed during __init__. Without it, __setattr__ raises an exception _is_frozen = False absolute_delay = _attributes.AttributeViReal64(1150413) - """Type: float + '''Type: float Specifies the sub-Sample Clock delay, in seconds, to apply to the waveform. Use this property to reduce the trigger jitter when @@ -165,42 +143,40 @@ class _SessionBase(object): Note: If this property is set, NI-TClk cannot perform any sub-Sample Clock adjustment. - """ + ''' all_marker_events_latched_status = _attributes.AttributeViInt32(1150349) - """Type: int + '''Type: int Returns a bit field of the latched status of all Marker Events. Write 0 to this property to clear the latched status of all Marker Events. - """ + ''' all_marker_events_live_status = _attributes.AttributeViInt32(1150344) - """Type: int + '''Type: int Returns a bit field of the live status of all Marker Events. - """ + ''' analog_data_mask = _attributes.AttributeViInt32(1150234) - """Type: int + '''Type: int Specifies the mask to apply to the analog output. The masked data is replaced with the data in analog_static_value. - """ + ''' analog_filter_enabled = _attributes.AttributeViBoolean(1150103) - """Type: bool + '''Type: bool Controls whether the signal generator applies to an analog filter to the output signal. This property is valid in arbitrary waveform, arbitrary sequence, and script modes. This property can also be used in standard method and frequency list modes for user-defined waveforms. - """ - analog_path = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.AnalogPath, 1150222 - ) - """Type: enums.AnalogPath + ''' + analog_path = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.AnalogPath, 1150222) + '''Type: enums.AnalogPath Specifies the analog signal path that should be used. The main path allows you to configure gain, offset, analog filter status, output impedance, and output enable. The main path has two amplifier options, high- and low-gain. The direct path presents a much smaller gain range, and you cannot adjust offset or the filter status. The direct path also provides a smaller output range but also lower distortion. NI-FGEN normally chooses the amplifier based on the user-specified gain. - """ + ''' analog_static_value = _attributes.AttributeViInt32(1150235) - """Type: int + '''Type: int Specifies the static value that replaces data masked by analog_data_mask. - """ + ''' arb_gain = _attributes.AttributeViReal64(1250202) - """Type: float + '''Type: float Specifies the factor by which the signal generator scales the arbitrary waveform data. When you create arbitrary waveforms, you must first normalize the data points to the range -1.0 to +1.0. Use this property to scale the arbitrary waveform to other ranges. For example, when you set this property to 2.0, the output signal ranges from -2.0 V to +2.0 V. @@ -215,18 +191,18 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.arb_gain` - """ + ''' arb_marker_position = _attributes.AttributeViInt32(1150327) - """Type: int + '''Type: int Specifies the position for a marker to be asserted in the arbitrary waveform. This property defaults to -1 when no marker position is specified. Use this property when output_mode is set to OutputMode.ARB. Use ExportSignal to export the marker signal. Note: One or more of the referenced methods are not in the Python API for this driver. - """ + ''' arb_offset = _attributes.AttributeViReal64(1250203) - """Type: float + '''Type: float Specifies the value that the signal generator adds to the arbitrary waveform data. When you create arbitrary waveforms, you must first normalize the data points to the range -1.0 to +1.0. Use this property to shift the arbitrary waveform range. For example, when you set this property to 1.0, the output signal ranges from 2.0 V to 0.0 V. @@ -242,21 +218,21 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.arb_offset` - """ + ''' arb_repeat_count = _attributes.AttributeViInt32(1150328) - """Type: int + '''Type: int Specifies number of times to repeat the arbitrary waveform when the triggerMode parameter of ConfigureTriggerMode is set to TriggerMode.SINGLE or TriggerMode.STEPPED. This property is ignored if the triggerMode parameter is set to TriggerMode.CONTINUOUS or TriggerMode.BURST. Use this property when output_mode is set to OutputMode.ARB. When used during streaming, this property specifies the number of times to repeat the streaming waveform (the onboard memory allocated for streaming). For more information about streaming, refer to the Streaming topic. - """ + ''' arb_sample_rate = _attributes.AttributeViReal64(1250204) - """Type: float + '''Type: float Specifies the rate at which the signal generator outputs the points in arbitrary waveforms. Use this property when output_mode is set to OutputMode.ARB or OutputMode.SEQ. Units: Samples/s - """ + ''' arb_sequence_handle = _attributes.AttributeViInt32(1250211) - """Type: int + '''Type: int This channel-based property identifies which sequence the signal generator produces. You can create multiple sequences using create_arb_sequence. create_arb_sequence returns a handle that you can use to identify the particular sequence. To configure the signal generator to produce a particular sequence, set this property to the sequence handle. Use this property only when output_mode is set to OutputMode.SEQ. @@ -270,9 +246,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.arb_sequence_handle` - """ + ''' arb_waveform_handle = _attributes.AttributeViInt32(1250201) - """Type: int + '''Type: int Selects which arbitrary waveform the signal generator produces. You can create multiple arbitrary waveforms using one of the following niFgen Create Waveform methods: create_waveform @@ -291,21 +267,19 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.arb_waveform_handle` - """ + ''' aux_power_enabled = _attributes.AttributeViBoolean(1150411) - """Type: bool + '''Type: bool Controls the specified auxiliary power pin. Setting this property to TRUE energizes the auxiliary power when the session is committed. When this property is FALSE, the power pin of the connector outputs no power. - """ - bus_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.BusType, 1150215 - ) - """Type: enums.BusType + ''' + bus_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.BusType, 1150215) + '''Type: enums.BusType The bus type of the signal generator. - """ + ''' channel_delay = _attributes.AttributeViReal64(1150369) - """Type: float + '''Type: float Specifies, in seconds, the delay to apply to the analog output of the channel specified by the channel string. You can use the channel delay to configure the timing relationship between channels on a multichannel device. Values for this property can be zero or positive. A value of zero indicates that the channels are aligned. A positive value delays the analog output by the specified number of seconds. @@ -318,17 +292,15 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.channel_delay` - """ - clock_mode = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.ClockMode, 1150110 - ) - """Type: enums.ClockMode + ''' + clock_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ClockMode, 1150110) + '''Type: enums.ClockMode Controls which clock mode is used for the signal generator. For signal generators that support it, this property allows switching the sample clock to High-Resolution mode. When in Divide-Down mode, the sample rate can only be set to certain frequences, based on dividing down the update clock. However, in High-Resolution mode, the sample rate may be set to any value. - """ + ''' common_mode_offset = _attributes.AttributeViReal64(1150366) - """Type: float + '''Type: float Specifies, in volts, the value the signal generator adds to or subtracts from the arbitrary waveform data. This property applies only when you set the terminal_configuration property to TerminalConfiguration.DIFFERENTIAL. Common mode offset is applied to the signals generated at each differential output terminal. @@ -341,14 +313,14 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.common_mode_offset` - """ + ''' data_marker_events_count = _attributes.AttributeViInt32(1150273) - """Type: int + '''Type: int Returns the number of Data Marker Events supported by the device. - """ + ''' data_marker_event_data_bit_number = _attributes.AttributeViInt32(1150337) - """Type: int + '''Type: int Specifies the bit number to assign to the Data Marker Event. @@ -361,11 +333,9 @@ class _SessionBase(object): To set/get on all data_markers, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.data_marker_event_data_bit_number` - """ - data_marker_event_level_polarity = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.DataMarkerEventLevelPolarity, 1150338 - ) - """Type: enums.DataMarkerEventLevelPolarity + ''' + data_marker_event_level_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.DataMarkerEventLevelPolarity, 1150338) + '''Type: enums.DataMarkerEventLevelPolarity Specifies the output polarity of the Data marker event. @@ -378,9 +348,9 @@ class _SessionBase(object): To set/get on all data_markers, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.data_marker_event_level_polarity` - """ + ''' data_marker_event_output_terminal = _attributes.AttributeViString(1150339) - """Type: str + '''Type: str Specifies the destination terminal for the Data Marker Event. @@ -393,26 +363,26 @@ class _SessionBase(object): To set/get on all data_markers, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.data_marker_event_output_terminal` - """ + ''' data_transfer_block_size = _attributes.AttributeViInt32(1150241) - """Type: int + '''Type: int The number of samples at a time to download to onboard memory. Useful when the total data to be transferred to onboard memory is large. - """ + ''' data_transfer_maximum_bandwidth = _attributes.AttributeViReal64(1150373) - """Type: float + '''Type: float Specifies the maximum amount of bus bandwidth (in bytes per second) to use for data transfers. The signal generator limits data transfer speeds on the PCIe bus to the value you specify for this property. Set this property to optimize bus bandwidth usage for multi-device streaming applications by preventing the signal generator from consuming all of the available bandwidth on a PCI express link when waveforms are being written to the onboard memory of the device. - """ + ''' data_transfer_maximum_in_flight_reads = _attributes.AttributeViInt32(1150375) - """Type: int + '''Type: int Specifies the maximum number of concurrent PCI Express read requests the signal generator can issue. When transferring data from computer memory to device onboard memory across the PCI Express bus, the signal generator can issue multiple memory reads at the same time. In general, the larger the number of read requests, the more efficiently the device uses the bus because the multiple read requests keep the data flowing, even in a PCI Express topology that has high latency due to PCI Express switches in the data path. Most NI devices can issue a large number of read requests (typically 8 or 16). By default, this property is set to the highest value the signal generator supports. If other devices in your system cannot tolerate long data latencies, it may be helpful to decrease the number of in-flight read requests the NI signal generator issues. This helps to reduce the amount of data the signal generator reads at one time. - """ + ''' data_transfer_preferred_packet_size = _attributes.AttributeViInt32(1150374) - """Type: int + '''Type: int Specifies the preferred size of the data field in a PCI Express read request packet. In general, the larger the packet size, the more efficiently the device uses the bus. By default, NI signal generators use the largest packet size allowed by the system. However, due to different system implementations, some systems may perform better with smaller packet sizes. Recommended values for this property are powers of two between 64 and 512. @@ -421,16 +391,14 @@ class _SessionBase(object): Note: : - """ + ''' digital_data_mask = _attributes.AttributeViInt32(1150236) - """Type: int + '''Type: int Specifies the mask to apply to the output on the digital connector. The masked data is replaced with the data in digital_static_value. - """ - digital_edge_script_trigger_edge = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.ScriptTriggerDigitalEdgeEdge, 1150292 - ) - """Type: enums.ScriptTriggerDigitalEdgeEdge + ''' + digital_edge_script_trigger_edge = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ScriptTriggerDigitalEdgeEdge, 1150292) + '''Type: enums.ScriptTriggerDigitalEdgeEdge Specifies the active edge for the Script trigger. This property is used when script_trigger_type is set to Digital Edge. @@ -443,9 +411,9 @@ class _SessionBase(object): To set/get on all script_triggers, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.digital_edge_script_trigger_edge` - """ + ''' digital_edge_script_trigger_source = _attributes.AttributeViString(1150291) - """Type: str + '''Type: str Specifies the source terminal for the Script trigger. This property is used when script_trigger_type is set to Digital Edge. @@ -458,103 +426,97 @@ class _SessionBase(object): To set/get on all script_triggers, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.digital_edge_script_trigger_source` - """ - digital_edge_start_trigger_edge = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.StartTriggerDigitalEdgeEdge, 1150282 - ) - """Type: enums.StartTriggerDigitalEdgeEdge + ''' + digital_edge_start_trigger_edge = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.StartTriggerDigitalEdgeEdge, 1150282) + '''Type: enums.StartTriggerDigitalEdgeEdge Specifies the active edge for the Start trigger. This property is used only when start_trigger_type is set to Digital Edge. - """ + ''' digital_edge_start_trigger_source = _attributes.AttributeViString(1150281) - """Type: str + '''Type: str Specifies the source terminal for the Start trigger. This property is used only when start_trigger_type is set to Digital Edge. - """ + ''' digital_filter_enabled = _attributes.AttributeViBoolean(1150102) - """Type: bool + '''Type: bool Controls whether the signal generator applies a digital filter to the output signal. This property is valid in arbitrary waveform, arbitrary sequence, and script modes. This property can also be used in standard method and frequency list modes for user-defined waveforms. - """ + ''' digital_filter_interpolation_factor = _attributes.AttributeViReal64(1150218) - """Type: float + '''Type: float This property only affects the device when digital_filter_enabled is set to True. If you do not set this property directly, NI-FGEN automatically selects the maximum interpolation factor allowed for the current sample rate. Valid values are 2, 4, and 8. - """ + ''' digital_gain = _attributes.AttributeViReal64(1150254) - """Type: float + '''Type: float Specifies a factor by which the signal generator digitally multiplies generated data before converting it to an analog signal in the DAC. For a digital gain greater than 1.0, the product of digital gain times the generated data must be inside the range plus or minus 1.0 (assuming floating point data). If the product exceeds these limits, the signal generator clips the output signal, and an error results. Some signal generators support both digital gain and an analog gain (analog gain is specified with the func_amplitude property or the arb_gain property). Digital gain can be changed during generation without the glitches that may occur when changing analog gains, due to relay switching. However, the DAC output resolution is a method of analog gain, so only analog gain makes full use of the resolution of the DAC. - """ + ''' digital_pattern_enabled = _attributes.AttributeViBoolean(1150101) - """Type: bool + '''Type: bool Controls whether the signal generator generates a digital pattern of the output signal. - """ + ''' digital_static_value = _attributes.AttributeViInt32(1150237) - """Type: int + '''Type: int Specifies the static value that replaces data masked by digital_data_mask. - """ + ''' done_event_output_terminal = _attributes.AttributeViString(1150315) - """Type: str + '''Type: str Specifies the destination terminal for the Done Event. - """ + ''' driver_setup = _attributes.AttributeViString(1050007) - """Type: str + '''Type: str Specifies the driver setup portion of the option string that was passed into the InitWithOptions method. Note: One or more of the referenced methods are not in the Python API for this driver. - """ - exported_onboard_reference_clock_output_terminal = _attributes.AttributeViString( - 1150322 - ) - """Type: str + ''' + exported_onboard_reference_clock_output_terminal = _attributes.AttributeViString(1150322) + '''Type: str Specifies the terminal to which to export the Onboard Reference Clock. - """ + ''' exported_reference_clock_output_terminal = _attributes.AttributeViString(1150321) - """Type: str + '''Type: str Specifies the terminal to which to export the Reference Clock. - """ + ''' exported_sample_clock_divisor = _attributes.AttributeViInt32(1150219) - """Type: int + '''Type: int Specifies the factor by which to divide the Sample clock, also known as the Update clock, before it is exported. To export the Sample clock, use the ExportSignal method or the exported_sample_clock_output_terminal property. Note: One or more of the referenced methods are not in the Python API for this driver. - """ + ''' exported_sample_clock_output_terminal = _attributes.AttributeViString(1150320) - """Type: str + '''Type: str Specifies the terminal to which to export the Sample Clock. - """ + ''' exported_sample_clock_timebase_divisor = _attributes.AttributeViInt32(1150230) - """Type: int + '''Type: int Specifies the factor by which to divide the sample clock timebase (board clock) before it is exported. To export the Sample clock timebase, use the ExportSignal method or the exported_sample_clock_timebase_output_terminal property. Note: One or more of the referenced methods are not in the Python API for this driver. - """ - exported_sample_clock_timebase_output_terminal = _attributes.AttributeViString( - 1150329 - ) - """Type: str + ''' + exported_sample_clock_timebase_output_terminal = _attributes.AttributeViString(1150329) + '''Type: str Specifies the terminal to which to export the Sample clock timebase. If you specify a divisor with the exported_sample_clock_timebase_divisor property, the Sample clock exported with the exported_sample_clock_timebase_output_terminal property is the value of the Sample clock timebase after it is divided-down. For a list of the terminals available on your device, refer to the Device Routes tab in MAX. To change the device configuration, call abort or wait for the generation to complete. Note: The signal generator must not be in the Generating state when you change this property. - """ + ''' exported_script_trigger_output_terminal = _attributes.AttributeViString(1150295) - """Type: str + '''Type: str Specifies the output terminal for the exported Script trigger. Setting this property to an empty string means that when you commit the session, the signal is removed from that terminal and, if possible, the terminal is tristated. @@ -568,55 +530,55 @@ class _SessionBase(object): To set/get on all script_triggers, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.exported_script_trigger_output_terminal` - """ + ''' exported_start_trigger_output_terminal = _attributes.AttributeViString(1150283) - """Type: str + '''Type: str Specifies the destination terminal for exporting the Start trigger. - """ + ''' external_clock_delay_binary_value = _attributes.AttributeViInt32(1150233) - """Type: int + '''Type: int Binary value of the external clock delay. - """ + ''' external_sample_clock_multiplier = _attributes.AttributeViReal64(1150376) - """Type: float + '''Type: float Specifies a multiplication factor to use to obtain a desired sample rate from an external Sample clock. The resulting sample rate is equal to this factor multiplied by the external Sample clock rate. You can use this property to generate samples at a rate higher than your external clock rate. When using this property, you do not need to explicitly set the external clock rate. - """ + ''' file_transfer_block_size = _attributes.AttributeViInt32(1150240) - """Type: int + '''Type: int The number of samples at a time to read from the file and download to onboard memory. Used in conjunction with the Create From File and Write From File methods. - """ + ''' filter_correction_frequency = _attributes.AttributeViReal64(1150104) - """Type: float + '''Type: float Controls the filter correction frequency of the analog filter. This property corrects for the ripples in the analog filter frequency response at the frequency specified. For standard waveform output, the filter correction frequency should be set to be the same as the frequency of the standard waveform. To have no filter correction, set this property to 0 Hz. - """ + ''' flatness_correction_enabled = _attributes.AttributeViBoolean(1150323) - """Type: bool + '''Type: bool When True, the signal generator applies a flatness correction factor to the generated sine wave in order to ensure the same output power level at all frequencies. This property should be set to False when performing Flatness Calibration. - """ + ''' fpga_bitfile_path = _attributes.AttributeViString(1150412) - """Type: str + '''Type: str Gets the absolute file path to the bitfile loaded on the FPGA. - """ + ''' freq_list_duration_quantum = _attributes.AttributeViReal64(1150214) - """Type: float + '''Type: float Returns the quantum of which all durations must be a multiple in a frequency list. - """ + ''' freq_list_handle = _attributes.AttributeViInt32(1150208) - """Type: int + '''Type: int Sets which frequency list the signal generator produces. Create a frequency list using create_freq_list. create_freq_list returns a handle that you can use to identify the list. - """ + ''' func_amplitude = _attributes.AttributeViReal64(1250102) - """Type: float + '''Type: float Controls the amplitude of the standard waveform that the signal generator produces. This value is the amplitude at the output terminal. For example, to produce a waveform ranging from -5.00 V to +5.00 V, set the amplitude to 10.00 V. @@ -634,17 +596,17 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.func_amplitude` - """ + ''' func_buffer_size = _attributes.AttributeViInt32(1150238) - """Type: int + '''Type: int This property contains the number of samples used in the standard method waveform buffer. This property is only valid on devices that implement standard method mode in software, and is read-only for all other devices. implementation of Standard Method Mode on your device. Note: Refer to the Standard Method Mode topic for more information on the - """ + ''' func_dc_offset = _attributes.AttributeViReal64(1250103) - """Type: float + '''Type: float Controls the DC offset of the standard waveform that the signal generator produces. This value is the offset at the output terminal. The value is the offset from ground to the center of the waveform that you specify with the Waveform parameter. For example, to configure a waveform with an amplitude of 10.00 V to range from 0.00 V to +10.00 V, set DC Offset to 5.00 V. @@ -659,9 +621,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.func_dc_offset` - """ + ''' func_duty_cycle_high = _attributes.AttributeViReal64(1250106) - """Type: float + '''Type: float Controls the duty cycle of the square wave the signal generator produces. Specify this property as a percentage of the time the square wave is high in a cycle. set the Waveform parameter to Waveform.SQUARE. @@ -678,9 +640,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.func_duty_cycle_high` - """ + ''' func_frequency = _attributes.AttributeViReal64(1250104) - """Type: float + '''Type: float Controls the frequency of the standard waveform that the signal generator produces. Units: hertz @@ -699,17 +661,17 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.func_frequency` - """ + ''' func_max_buffer_size = _attributes.AttributeViInt32(1150239) - """Type: int + '''Type: int This property sets the maximum number of samples that can be used in the standard method waveform buffer. Increasing this value may increase the quality of the waveform. This property is only valid on devices that implement standard method mode in software, and is read-only for all other devices. implementation of Standard Method Mode on your device. Note: Refer to the Standard Method Mode topic for more information on the - """ + ''' func_start_phase = _attributes.AttributeViReal64(1250105) - """Type: float + '''Type: float Controls horizontal offset of the standard waveform the signal generator produces. Specify this property in degrees of one waveform cycle. A start phase of 180 degrees means output generation begins halfway through the waveform. A start phase of 360 degrees offsets the output by an entire waveform cycle, which is identical to a start phase of 0 degrees. @@ -727,11 +689,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.func_start_phase` - """ - func_waveform = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.Waveform, 1250101 - ) - """Type: enums.Waveform + ''' + func_waveform = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.Waveform, 1250101) + '''Type: enums.Waveform This channel-based property specifies which standard waveform the signal generator produces. Use this property only when output_mode is set to OutputMode.FUNC. @@ -754,65 +714,63 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.func_waveform` - """ - idle_behavior = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.IdleBehavior, 1150377 - ) - """Type: enums.IdleBehavior + ''' + idle_behavior = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.IdleBehavior, 1150377) + '''Type: enums.IdleBehavior Specifies the behavior of the output during the Idle state. The output can be configured to hold the last generated voltage before entering the Idle state or jump to the Idle Value. - """ + ''' idle_value = _attributes.AttributeViInt32(1150378) - """Type: int + '''Type: int Specifies the value to generate in the Idle state. The Idle Behavior must be configured to jump to this value. - """ + ''' instrument_firmware_revision = _attributes.AttributeViString(1050510) - """Type: str + '''Type: str A string that contains the firmware revision information for the device that you are currently using. - """ + ''' instrument_manufacturer = _attributes.AttributeViString(1050511) - """Type: str + '''Type: str A string that contains the name of the device manufacturer you are currently using. - """ + ''' instrument_model = _attributes.AttributeViString(1050512) - """Type: str + '''Type: str A string that contains the model number or name of the device that you are currently using. - """ + ''' io_resource_descriptor = _attributes.AttributeViString(1050304) - """Type: str + '''Type: str Indicates the resource descriptor that NI-FGEN uses to identify the physical device. If you initialize NI-FGEN with a logical name, this property contains the resource descriptor that corresponds to the entry in the IVI Configuration Utility. If you initialize NI-FGEN with the resource descriptor, this property contains that value. - """ + ''' load_impedance = _attributes.AttributeViReal64(1150220) - """Type: float + '''Type: float This channel-based property specifies the load impedance connected to the analog output of the channel. If you set this property to NIFGEN_VAL_MATCHED_LOAD_IMPEDANCE (-1.0), NI-FGEN assumes that the load impedance matches the output impedance. NI-FGEN compensates to give the desired peak-to-peak voltage amplitude or arbitrary gain (relative to 1 V). Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - """ + ''' logical_name = _attributes.AttributeViString(1050305) - """Type: str + '''Type: str A string containing the logical name that you specified when opening the current IVI session. You may pass a logical name to init or InitWithOptions. The IVI Configuration Utility must contain an entry for the logical name. The logical name entry refers to a virtual instrument section in the IVI Configuration file. The virtual instrument section specifies a physical device and initial user options. Note: One or more of the referenced methods are not in the Python API for this driver. - """ + ''' marker_events_count = _attributes.AttributeViInt32(1150271) - """Type: int + '''Type: int Returns the number of markers supported by the device. Use this property when output_mode is set to OutputMode.SCRIPT. - """ + ''' marker_event_output_terminal = _attributes.AttributeViString(1150312) - """Type: str + '''Type: str Specifies the destination terminal for the Marker Event. @@ -825,85 +783,85 @@ class _SessionBase(object): To set/get on all markers, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.marker_event_output_terminal` - """ + ''' max_freq_list_duration = _attributes.AttributeViReal64(1150213) - """Type: float + '''Type: float Returns the maximum duration of any one step in the frequency list. - """ + ''' max_freq_list_length = _attributes.AttributeViInt32(1150211) - """Type: int + '''Type: int Returns the maximum number of steps that can be in a frequency list. - """ + ''' max_loop_count = _attributes.AttributeViInt32(1250215) - """Type: int + '''Type: int Returns the maximum number of times that the signal generator can repeat a waveform in a sequence. Typically, this value is constant for the signal generator. - """ + ''' max_num_freq_lists = _attributes.AttributeViInt32(1150209) - """Type: int + '''Type: int Returns the maximum number of frequency lists the signal generator allows. - """ + ''' max_num_sequences = _attributes.AttributeViInt32(1250212) - """Type: int + '''Type: int Returns the maximum number of arbitrary sequences that the signal generator allows. Typically, this value is constant for the signal generator. - """ + ''' max_num_waveforms = _attributes.AttributeViInt32(1250205) - """Type: int + '''Type: int Returns the maximum number of arbitrary waveforms that the signal generator allows. Typically, this value is constant for the signal generator. - """ + ''' max_sequence_length = _attributes.AttributeViInt32(1250214) - """Type: int + '''Type: int Returns the maximum number of arbitrary waveforms that the signal generator allows in a sequence. Typically, this value is constant for the signal generator. - """ + ''' max_waveform_size = _attributes.AttributeViInt32(1250208) - """Type: int + '''Type: int Returns the size, in samples, of the largest waveform that can be created. This property reflects the space currently available, taking into account previously allocated waveforms and instructions. - """ + ''' memory_size = _attributes.AttributeViInt32(1150242) - """Type: int + '''Type: int The total amount of memory, in bytes, on the signal generator. - """ + ''' min_freq_list_duration = _attributes.AttributeViReal64(1150212) - """Type: float + '''Type: float Returns the minimum number of steps that can be in a frequency list. - """ + ''' min_freq_list_length = _attributes.AttributeViInt32(1150210) - """Type: int + '''Type: int Returns the minimum number of frequency lists that the signal generator allows. - """ + ''' min_sequence_length = _attributes.AttributeViInt32(1250213) - """Type: int + '''Type: int Returns the minimum number of arbitrary waveforms that the signal generator allows in a sequence. Typically, this value is constant for the signal generator. - """ + ''' min_waveform_size = _attributes.AttributeViInt32(1250207) - """Type: int + '''Type: int Returns the minimum number of points that the signal generator allows in an arbitrary waveform. Typically, this value is constant for the signal generator. - """ + ''' module_revision = _attributes.AttributeViString(1150390) - """Type: str + '''Type: str A string that contains the module revision for the device that you are currently using. - """ + ''' channel_count = _attributes.AttributeViInt32(1050203) - """Type: int + '''Type: int Indicates the number of channels that the specific instrument driver supports. For each property for which IVI_VAL_MULTI_CHANNEL is set, the IVI Engine maintains a separate cache value for each channel. - """ + ''' output_enabled = _attributes.AttributeViBoolean(1250003) - """Type: bool + '''Type: bool This channel-based property specifies whether the signal that the signal generator produces appears at the output connector. @@ -916,9 +874,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.output_enabled` - """ + ''' output_impedance = _attributes.AttributeViReal64(1250004) - """Type: float + '''Type: float This channel-based property specifies the signal generator output impedance at the output connector. NI signal sources modules have an output impedance of 50 ohms and an optional 75 ohms on select modules. If the load impedance matches the output impedance, then the voltage at the signal output connector is at the needed level. The voltage at the signal output connector varies with load output impedance, up to doubling the voltage for a high-impedance load. @@ -931,81 +889,71 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.output_impedance` - """ - output_mode = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.OutputMode, 1250001 - ) - """Type: enums.OutputMode + ''' + output_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.OutputMode, 1250001) + '''Type: enums.OutputMode Sets which output mode the signal generator will use. The value you specify determines which methods and properties you use to configure the waveform the signal generator produces. Note: The signal generator must not be in the Generating state when you change this property. To change the device configuration, call abort or wait for the generation to complete. - """ + ''' ready_for_start_event_output_terminal = _attributes.AttributeViString(1150310) - """Type: str + '''Type: str Specifies the destination terminal for the Ready for Start Event. - """ - reference_clock_source = _attributes.AttributeEnum( - _attributes.AttributeViString, enums.ReferenceClockSource, 1150113 - ) - """Type: enums.ReferenceClockSource + ''' + reference_clock_source = _attributes.AttributeEnum(_attributes.AttributeViString, enums.ReferenceClockSource, 1150113) + '''Type: enums.ReferenceClockSource Specifies the reference clock source used by the signal generator. The signal generator derives the frequencies and sample rates that it uses to generate waveforms from the source you specify. For example, when you set this property to ClkIn, the signal generator uses the signal it receives at the CLK IN front panel connector as the Reference clock. To change the device configuration, call abort or wait for the generation to complete. Note: The signal generator must not be in the Generating state when you change this property. - """ + ''' ref_clock_frequency = _attributes.AttributeViReal64(1150107) - """Type: float + '''Type: float Sets the frequency of the signal generator reference clock. The signal generator uses the reference clock to derive frequencies and sample rates when generating output. - """ - sample_clock_source = _attributes.AttributeEnum( - _attributes.AttributeViString, enums.SampleClockSource, 1150112 - ) - """Type: enums.SampleClockSource + ''' + sample_clock_source = _attributes.AttributeEnum(_attributes.AttributeViString, enums.SampleClockSource, 1150112) + '''Type: enums.SampleClockSource Specifies the Sample clock source. If you specify a divisor with the exported_sample_clock_divisor property, the Sample clock exported with the exported_sample_clock_output_terminal property is the value of the Sample clock after it is divided-down. For a list of the terminals available on your device, refer to the Device Routes tab in MAX. To change the device configuration, call abort or wait for the generation to complete. Note: The signal generator must not be in the Generating state when you change this property. - """ + ''' sample_clock_timebase_rate = _attributes.AttributeViReal64(1150368) - """Type: float + '''Type: float Specifies the Sample clock timebase rate. This property applies only to external Sample clock timebases. To change the device configuration, call abort or wait for the generation to complete. Note: The signal generator must not be in the Generating state when you change this property. - """ - sample_clock_timebase_source = _attributes.AttributeEnum( - _attributes.AttributeViString, enums.SampleClockTimebaseSource, 1150367 - ) - """Type: enums.SampleClockTimebaseSource + ''' + sample_clock_timebase_source = _attributes.AttributeEnum(_attributes.AttributeViString, enums.SampleClockTimebaseSource, 1150367) + '''Type: enums.SampleClockTimebaseSource Specifies the Sample Clock Timebase source. To change the device configuration, call the abort method or wait for the generation to complete. Note: The signal generator must not be in the Generating state when you change this property. - """ + ''' script_to_generate = _attributes.AttributeViString(1150270) - """Type: str + '''Type: str Specifies which script the generator produces. To configure the generator to run a particular script, set this property to the name of the script. Use write_script to create multiple scripts. Use this property when output_mode is set to OutputMode.SCRIPT. Note: The signal generator must not be in the Generating state when you change this property. To change the device configuration, call abort or wait for the generation to complete. - """ + ''' script_triggers_count = _attributes.AttributeViInt32(1150272) - """Type: int + '''Type: int Specifies the number of Script triggers supported by the device. Use this property when output_mode is set to OutputMode.SCRIPT. - """ - script_trigger_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.ScriptTriggerType, 1150290 - ) - """Type: enums.ScriptTriggerType + ''' + script_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ScriptTriggerType, 1150290) + '''Type: enums.ScriptTriggerType Specifies the Script trigger type. Depending upon the value of this property, additional properties may need to be configured to fully configure the trigger. @@ -1018,14 +966,14 @@ class _SessionBase(object): To set/get on all script_triggers, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.script_trigger_type` - """ + ''' serial_number = _attributes.AttributeViString(1150243) - """Type: str + '''Type: str The signal generator's serial number. - """ + ''' simulate = _attributes.AttributeViBoolean(1050005) - """Type: bool + '''Type: bool Specifies whether to simulate NI-FGEN I/O operations. If simulation is enabled, NI-FGEN methods perform range checking and call Ivi_GetAttribute and Ivi_SetAttribute, but they do not perform device I/O. For output parameters that represent device data, NI-FGEN methods return calculated values. Default Value: False @@ -1033,77 +981,73 @@ class _SessionBase(object): Note: One or more of the referenced methods are not in the Python API for this driver. - """ + ''' specific_driver_description = _attributes.AttributeViString(1050514) - """Type: str + '''Type: str Returns a brief description of NI-FGEN. - """ + ''' major_version = _attributes.AttributeViInt32(1050503) - """Type: int + '''Type: int Returns the major version number of NI-FGEN. - """ + ''' minor_version = _attributes.AttributeViInt32(1050504) - """Type: int + '''Type: int Returns the minor version number of NI-FGEN. - """ + ''' specific_driver_revision = _attributes.AttributeViString(1050551) - """Type: str + '''Type: str A string that contains additional version information about NI-FGEN. - """ + ''' specific_driver_vendor = _attributes.AttributeViString(1050513) - """Type: str + '''Type: str A string that contains the name of the vendor that supplies NI-FGEN. - """ + ''' started_event_output_terminal = _attributes.AttributeViString(1150314) - """Type: str + '''Type: str Specifies the destination terminal for the Started Event. - """ - start_trigger_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.StartTriggerType, 1150280 - ) - """Type: enums.StartTriggerType + ''' + start_trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.StartTriggerType, 1150280) + '''Type: enums.StartTriggerType Specifies whether you want the Start trigger to be a Digital Edge, or Software trigger. You can also choose None as the value for this property. - """ + ''' streaming_space_available_in_waveform = _attributes.AttributeViInt32(1150325) - """Type: int + '''Type: int Indicates the space available (in samples) in the streaming waveform for writing new data. During generation, this available space may be in multiple locations with, for example, part of the available space at the end of the streaming waveform and the rest at the beginning. In this situation, writing a block of waveform data the size of the total space available in the streaming waveform causes NI-FGEN to return an error, as NI-FGEN will not wrap the data from the end of the waveform to the beginning and cannot write data past the end of the waveform buffer. To avoid writing data past the end of the waveform, write new data to the waveform in a fixed size that is an integer divisor of the total size of the streaming waveform. Used in conjunction with the streaming_waveform_handle or streaming_waveform_name properties. - """ + ''' streaming_waveform_handle = _attributes.AttributeViInt32(1150324) - """Type: int + '''Type: int Specifies the waveform handle of the waveform used to continuously stream data during generation. This property defaults to -1 when no streaming waveform is specified. Used in conjunction with streaming_space_available_in_waveform. - """ + ''' streaming_waveform_name = _attributes.AttributeViString(1150326) - """Type: str + '''Type: str Specifies the name of the waveform used to continuously stream data during generation. This property defaults to // when no streaming waveform is specified. Use in conjunction with streaming_space_available_in_waveform. - """ + ''' streaming_write_timeout = _attributes.AttributeViReal64TimeDeltaSeconds(1150409) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the maximum amount of time allowed to complete a streaming write operation. - """ + ''' supported_instrument_models = _attributes.AttributeViString(1050327) - """Type: str + '''Type: str Returns a model code of the device. For NI-FGEN versions that support more than one device, this property contains a comma-separated list of supported device models. - """ - terminal_configuration = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TerminalConfiguration, 1150365 - ) - """Type: enums.TerminalConfiguration + ''' + terminal_configuration = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TerminalConfiguration, 1150365) + '''Type: enums.TerminalConfiguration Specifies whether gain and offset values will be analyzed based on single-ended or differential operation. @@ -1116,11 +1060,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.terminal_configuration` - """ - trigger_mode = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TriggerMode, 1150108 - ) - """Type: enums.TriggerMode + ''' + trigger_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerMode, 1150108) + '''Type: enums.TriggerMode Controls the trigger mode. @@ -1133,74 +1075,60 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`nifgen.Session`. Example: :py:attr:`my_session.trigger_mode` - """ - wait_behavior = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.WaitBehavior, 1150379 - ) - """Type: enums.WaitBehavior + ''' + wait_behavior = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.WaitBehavior, 1150379) + '''Type: enums.WaitBehavior Specifies the behavior of the output while waiting for a script trigger or during a wait instruction. The output can be configured to hold the last generated voltage before waiting or jump to the Wait Value. - """ + ''' wait_value = _attributes.AttributeViInt32(1150380) - """Type: int + '''Type: int Specifies the value to generate while waiting. The Wait Behavior must be configured to jump to this value. - """ + ''' waveform_quantum = _attributes.AttributeViInt32(1250206) - """Type: int + '''Type: int The size of each arbitrary waveform must be a multiple of a quantum value. This property returns the quantum value that the signal generator allows. For example, when this property returns a value of 8, all waveform sizes must be a multiple of 8. Typically, this value is constant for the signal generator. - """ + ''' - def __init__( - self, repeated_capability_list, vi, library, encoding, freeze_it=False - ): + def __init__(self, repeated_capability_list, vi, library, encoding, freeze_it=False): self._repeated_capability_list = repeated_capability_list - self._repeated_capability = ",".join(repeated_capability_list) + self._repeated_capability = ','.join(repeated_capability_list) self._vi = vi self._library = library self._encoding = encoding # Store the parameter list for later printing in __repr__ param_list = [] - param_list.append( - "repeated_capability_list=" + pp.pformat(repeated_capability_list) - ) + param_list.append("repeated_capability_list=" + pp.pformat(repeated_capability_list)) param_list.append("vi=" + pp.pformat(vi)) param_list.append("library=" + pp.pformat(library)) param_list.append("encoding=" + pp.pformat(encoding)) - self._param_list = ", ".join(param_list) + self._param_list = ', '.join(param_list) # Instantiate any repeated capability objects - self.channels = _RepeatedCapabilities(self, "", repeated_capability_list) - self.script_triggers = _RepeatedCapabilities( - self, "ScriptTrigger", repeated_capability_list - ) - self.markers = _RepeatedCapabilities(self, "Marker", repeated_capability_list) - self.data_markers = _RepeatedCapabilities( - self, "DataMarker", repeated_capability_list - ) + self.channels = _RepeatedCapabilities(self, '', repeated_capability_list) + self.script_triggers = _RepeatedCapabilities(self, 'ScriptTrigger', repeated_capability_list) + self.markers = _RepeatedCapabilities(self, 'Marker', repeated_capability_list) + self.data_markers = _RepeatedCapabilities(self, 'DataMarker', repeated_capability_list) self._is_frozen = freeze_it def __repr__(self): - return "{0}.{1}({2})".format( - "nifgen", self.__class__.__name__, self._param_list - ) + return '{0}.{1}({2})'.format('nifgen', self.__class__.__name__, self._param_list) def __setattr__(self, key, value): if self._is_frozen and key not in dir(self): - raise AttributeError( - "'{0}' object has no attribute '{1}'".format(type(self).__name__, key) - ) + raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) object.__setattr__(self, key, value) def _get_error_description(self, error_code): - """_get_error_description + '''_get_error_description Returns the error description. - """ + ''' try: _, error_string = self._get_error() return error_string @@ -1208,21 +1136,21 @@ def _get_error_description(self, error_code): pass try: - """ + ''' It is expected for _get_error to raise when the session is invalid (IVI spec requires GetError to fail). Use _error_message instead. It doesn't require a session. - """ + ''' error_string = self._error_message(error_code) return error_string except errors.Error: return "Failed to retrieve error description." - """ These are code-generated """ + ''' These are code-generated ''' @ivi_synchronized def allocate_named_waveform(self, waveform_name, waveform_size): - r"""allocate_named_waveform + r'''allocate_named_waveform Specifies the size of a named waveform up front so that it can be allocated in onboard memory before loading the associated data. Data can @@ -1247,26 +1175,18 @@ def allocate_named_waveform(self, waveform_name, waveform_size): **Default Value**: "4096" - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - waveform_name_ctype = ctypes.create_string_buffer( - waveform_name.encode(self._encoding) - ) # case C020 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 waveform_size_ctype = _visatype.ViInt32(waveform_size) # case S150 - error_code = self._library.niFgen_AllocateNamedWaveform( - vi_ctype, channel_name_ctype, waveform_name_ctype, waveform_size_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_AllocateNamedWaveform(vi_ctype, channel_name_ctype, waveform_name_ctype, waveform_size_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def allocate_waveform(self, waveform_size): - r"""allocate_waveform + r'''allocate_waveform Specifies the size of a waveform so that it can be allocated in onboard memory before loading the associated data. Data can then be loaded in @@ -1295,29 +1215,18 @@ def allocate_waveform(self, waveform_size): waveform_handle (int): The handle that identifies the new waveform. This handle is used later when referring to this waveform. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 waveform_size_ctype = _visatype.ViInt32(waveform_size) # case S150 waveform_handle_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_AllocateWaveform( - vi_ctype, - channel_name_ctype, - waveform_size_ctype, - None - if waveform_handle_ctype is None - else (ctypes.pointer(waveform_handle_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_AllocateWaveform(vi_ctype, channel_name_ctype, waveform_size_ctype, None if waveform_handle_ctype is None else (ctypes.pointer(waveform_handle_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(waveform_handle_ctype.value) @ivi_synchronized def clear_user_standard_waveform(self): - r"""clear_user_standard_waveform + r'''clear_user_standard_waveform Clears the user-defined waveform created by the define_user_standard_waveform method. @@ -1332,22 +1241,16 @@ def clear_user_standard_waveform(self): To call the method on all channels, you can call it directly on the :py:class:`nifgen.Session`. Example: :py:meth:`my_session.clear_user_standard_waveform` - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - error_code = self._library.niFgen_ClearUserStandardWaveform( - vi_ctype, channel_name_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + error_code = self._library.niFgen_ClearUserStandardWaveform(vi_ctype, channel_name_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def configure_arb_sequence(self, sequence_handle, gain, offset): - r"""configure_arb_sequence + r'''configure_arb_sequence Configures the signal generator properties that affect arbitrary sequence generation. Sets the arb_sequence_handle, @@ -1404,29 +1307,19 @@ def configure_arb_sequence(self, sequence_handle, gain, offset): **Default Value**: None - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 sequence_handle_ctype = _visatype.ViInt32(sequence_handle) # case S150 gain_ctype = _visatype.ViReal64(gain) # case S150 offset_ctype = _visatype.ViReal64(offset) # case S150 - error_code = self._library.niFgen_ConfigureArbSequence( - vi_ctype, - channel_name_ctype, - sequence_handle_ctype, - gain_ctype, - offset_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_ConfigureArbSequence(vi_ctype, channel_name_ctype, sequence_handle_ctype, gain_ctype, offset_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def configure_arb_waveform(self, waveform_handle, gain, offset): - r"""configure_arb_waveform + r'''configure_arb_waveform Configures the properties of the signal generator that affect arbitrary waveform generation. Sets the arb_waveform_handle, @@ -1489,31 +1382,19 @@ def configure_arb_waveform(self, waveform_handle, gain, offset): **Default Value**: None - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 waveform_handle_ctype = _visatype.ViInt32(waveform_handle) # case S150 gain_ctype = _visatype.ViReal64(gain) # case S150 offset_ctype = _visatype.ViReal64(offset) # case S150 - error_code = self._library.niFgen_ConfigureArbWaveform( - vi_ctype, - channel_name_ctype, - waveform_handle_ctype, - gain_ctype, - offset_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_ConfigureArbWaveform(vi_ctype, channel_name_ctype, waveform_handle_ctype, gain_ctype, offset_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def configure_freq_list( - self, frequency_list_handle, amplitude, dc_offset=0.0, start_phase=0.0 - ): - r"""configure_freq_list + def configure_freq_list(self, frequency_list_handle, amplitude, dc_offset=0.0, start_phase=0.0): + r'''configure_freq_list Configures the properties of the signal generator that affect frequency list generation (the freq_list_handle, @@ -1588,35 +1469,20 @@ def configure_freq_list( This parameter does not affect signal generator behavior when you set the **waveform** parameter to Waveform.DC. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - frequency_list_handle_ctype = _visatype.ViInt32( - frequency_list_handle - ) # case S150 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + frequency_list_handle_ctype = _visatype.ViInt32(frequency_list_handle) # case S150 amplitude_ctype = _visatype.ViReal64(amplitude) # case S150 dc_offset_ctype = _visatype.ViReal64(dc_offset) # case S150 start_phase_ctype = _visatype.ViReal64(start_phase) # case S150 - error_code = self._library.niFgen_ConfigureFreqList( - vi_ctype, - channel_name_ctype, - frequency_list_handle_ctype, - amplitude_ctype, - dc_offset_ctype, - start_phase_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_ConfigureFreqList(vi_ctype, channel_name_ctype, frequency_list_handle_ctype, amplitude_ctype, dc_offset_ctype, start_phase_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def configure_standard_waveform( - self, waveform, amplitude, frequency, dc_offset=0.0, start_phase=0.0 - ): - r"""configure_standard_waveform + def configure_standard_waveform(self, waveform, amplitude, frequency, dc_offset=0.0, start_phase=0.0): + r'''configure_standard_waveform Configures the following properties of the signal generator that affect standard waveform generation: @@ -1731,35 +1597,23 @@ def configure_standard_waveform( This parameter does not affect signal generator behavior when you set the **waveform** parameter to Waveform.DC. - """ + ''' if type(waveform) is not enums.Waveform: - raise TypeError("Parameter waveform must be of type " + str(enums.Waveform)) + raise TypeError('Parameter waveform must be of type ' + str(enums.Waveform)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 waveform_ctype = _visatype.ViInt32(waveform.value) # case S130 amplitude_ctype = _visatype.ViReal64(amplitude) # case S150 dc_offset_ctype = _visatype.ViReal64(dc_offset) # case S150 frequency_ctype = _visatype.ViReal64(frequency) # case S150 start_phase_ctype = _visatype.ViReal64(start_phase) # case S150 - error_code = self._library.niFgen_ConfigureStandardWaveform( - vi_ctype, - channel_name_ctype, - waveform_ctype, - amplitude_ctype, - dc_offset_ctype, - frequency_ctype, - start_phase_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_ConfigureStandardWaveform(vi_ctype, channel_name_ctype, waveform_ctype, amplitude_ctype, dc_offset_ctype, frequency_ctype, start_phase_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def create_waveform(self, waveform_data_array): - """create_waveform + '''create_waveform Creates an onboard waveform for use in Arbitrary Waveform output mode or Arbitrary Sequence output mode. @@ -1783,38 +1637,29 @@ def create_waveform(self, waveform_data_array): Returns: waveform_handle (int): The handle that identifies the new waveform. This handle is used in other methods when referring to this waveform. - """ + ''' # Check the type by using string comparison so that we don't import numpy unnecessarily. if str(type(waveform_data_array)).find("'numpy.ndarray'") != -1: import numpy - if waveform_data_array.dtype == numpy.float64: return self._create_waveform_f64_numpy(waveform_data_array) elif waveform_data_array.dtype == numpy.int16: return self._create_waveform_i16_numpy(waveform_data_array) else: - raise TypeError( - "Unsupported dtype. Is {0}, expected {1} or {2}".format( - waveform_data_array.dtype, numpy.float64, numpy.int16 - ) - ) + raise TypeError("Unsupported dtype. Is {0}, expected {1} or {2}".format(waveform_data_array.dtype, numpy.float64, numpy.int16)) elif isinstance(waveform_data_array, array.array): - if waveform_data_array.typecode == "d": + if waveform_data_array.typecode == 'd': return self._create_waveform_f64(waveform_data_array) - elif waveform_data_array.typecode == "h": + elif waveform_data_array.typecode == 'h': return self._create_waveform_i16(waveform_data_array) else: - raise TypeError( - "Unsupported dtype. Is {0}, expected {1} or {2}".format( - waveform_data_array.typecode, "d (double)", "h (16 bit int)" - ) - ) + raise TypeError("Unsupported dtype. Is {0}, expected {1} or {2}".format(waveform_data_array.typecode, 'd (double)', 'h (16 bit int)')) return self._create_waveform_f64(waveform_data_array) @ivi_synchronized def _create_waveform_f64(self, waveform_data_array): - r"""_create_waveform_f64 + r'''_create_waveform_f64 Creates an onboard waveform from binary F64 (floating point double) data for use in Arbitrary Waveform output mode or Arbitrary Sequence output @@ -1853,38 +1698,20 @@ def _create_waveform_f64(self, waveform_data_array): waveform_handle (int): The handle that identifies the new waveform. This handle is used later when referring to this waveform. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - waveform_size_ctype = _visatype.ViInt32( - 0 if waveform_data_array is None else len(waveform_data_array) - ) # case S160 - waveform_data_array_array = get_ctypes_and_array( - value=waveform_data_array, array_type="d" - ) # case B550 - waveform_data_array_ctype = get_ctypes_pointer_for_buffer( - value=waveform_data_array_array, library_type=_visatype.ViReal64 - ) # case B550 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + waveform_size_ctype = _visatype.ViInt32(0 if waveform_data_array is None else len(waveform_data_array)) # case S160 + waveform_data_array_array = get_ctypes_and_array(value=waveform_data_array, array_type="d") # case B550 + waveform_data_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_data_array_array, library_type=_visatype.ViReal64) # case B550 waveform_handle_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_CreateWaveformF64( - vi_ctype, - channel_name_ctype, - waveform_size_ctype, - waveform_data_array_ctype, - None - if waveform_handle_ctype is None - else (ctypes.pointer(waveform_handle_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_CreateWaveformF64(vi_ctype, channel_name_ctype, waveform_size_ctype, waveform_data_array_ctype, None if waveform_handle_ctype is None else (ctypes.pointer(waveform_handle_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(waveform_handle_ctype.value) @ivi_synchronized def _create_waveform_f64_numpy(self, waveform_data_array): - r"""_create_waveform_f64 + r'''_create_waveform_f64 Creates an onboard waveform from binary F64 (floating point double) data for use in Arbitrary Waveform output mode or Arbitrary Sequence output @@ -1923,50 +1750,27 @@ def _create_waveform_f64_numpy(self, waveform_data_array): waveform_handle (int): The handle that identifies the new waveform. This handle is used later when referring to this waveform. - """ + ''' import numpy if type(waveform_data_array) is not numpy.ndarray: - raise TypeError( - "waveform_data_array must be {0}, is {1}".format( - numpy.ndarray, type(waveform_data_array) - ) - ) + raise TypeError('waveform_data_array must be {0}, is {1}'.format(numpy.ndarray, type(waveform_data_array))) if numpy.isfortran(waveform_data_array) is True: - raise TypeError("waveform_data_array must be in C-order") - if waveform_data_array.dtype is not numpy.dtype("float64"): - raise TypeError( - "waveform_data_array must be numpy.ndarray of dtype=float64, is " - + str(waveform_data_array.dtype) - ) + raise TypeError('waveform_data_array must be in C-order') + if waveform_data_array.dtype is not numpy.dtype('float64'): + raise TypeError('waveform_data_array must be numpy.ndarray of dtype=float64, is ' + str(waveform_data_array.dtype)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - waveform_size_ctype = _visatype.ViInt32( - 0 if waveform_data_array is None else len(waveform_data_array) - ) # case S160 - waveform_data_array_ctype = get_ctypes_pointer_for_buffer( - value=waveform_data_array - ) # case B510 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + waveform_size_ctype = _visatype.ViInt32(0 if waveform_data_array is None else len(waveform_data_array)) # case S160 + waveform_data_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_data_array) # case B510 waveform_handle_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_CreateWaveformF64( - vi_ctype, - channel_name_ctype, - waveform_size_ctype, - waveform_data_array_ctype, - None - if waveform_handle_ctype is None - else (ctypes.pointer(waveform_handle_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_CreateWaveformF64(vi_ctype, channel_name_ctype, waveform_size_ctype, waveform_data_array_ctype, None if waveform_handle_ctype is None else (ctypes.pointer(waveform_handle_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(waveform_handle_ctype.value) @ivi_synchronized def create_waveform_from_file_f64(self, file_name, byte_order): - r"""create_waveform_from_file_f64 + r'''create_waveform_from_file_f64 This method takes the floating point double (F64) data from the specified file and creates an onboard waveform for use in Arbitrary @@ -2019,37 +1823,21 @@ def create_waveform_from_file_f64(self, file_name, byte_order): waveform_handle (int): The handle that identifies the new waveform. This handle is used later when referring to this waveform. - """ + ''' if type(byte_order) is not enums.ByteOrder: - raise TypeError( - "Parameter byte_order must be of type " + str(enums.ByteOrder) - ) + raise TypeError('Parameter byte_order must be of type ' + str(enums.ByteOrder)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - file_name_ctype = ctypes.create_string_buffer( - file_name.encode(self._encoding) - ) # case C020 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + file_name_ctype = ctypes.create_string_buffer(file_name.encode(self._encoding)) # case C020 byte_order_ctype = _visatype.ViInt32(byte_order.value) # case S130 waveform_handle_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_CreateWaveformFromFileF64( - vi_ctype, - channel_name_ctype, - file_name_ctype, - byte_order_ctype, - None - if waveform_handle_ctype is None - else (ctypes.pointer(waveform_handle_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_CreateWaveformFromFileF64(vi_ctype, channel_name_ctype, file_name_ctype, byte_order_ctype, None if waveform_handle_ctype is None else (ctypes.pointer(waveform_handle_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(waveform_handle_ctype.value) @ivi_synchronized def create_waveform_from_file_i16(self, file_name, byte_order): - r"""create_waveform_from_file_i16 + r'''create_waveform_from_file_i16 Takes the binary 16-bit signed integer (I16) data from the specified file and creates an onboard waveform for use in Arbitrary Waveform or @@ -2102,37 +1890,21 @@ def create_waveform_from_file_i16(self, file_name, byte_order): waveform_handle (int): The handle that identifies the new waveform. This handle is used later when referring to this waveform. - """ + ''' if type(byte_order) is not enums.ByteOrder: - raise TypeError( - "Parameter byte_order must be of type " + str(enums.ByteOrder) - ) + raise TypeError('Parameter byte_order must be of type ' + str(enums.ByteOrder)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - file_name_ctype = ctypes.create_string_buffer( - file_name.encode(self._encoding) - ) # case C020 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + file_name_ctype = ctypes.create_string_buffer(file_name.encode(self._encoding)) # case C020 byte_order_ctype = _visatype.ViInt32(byte_order.value) # case S130 waveform_handle_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_CreateWaveformFromFileI16( - vi_ctype, - channel_name_ctype, - file_name_ctype, - byte_order_ctype, - None - if waveform_handle_ctype is None - else (ctypes.pointer(waveform_handle_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_CreateWaveformFromFileI16(vi_ctype, channel_name_ctype, file_name_ctype, byte_order_ctype, None if waveform_handle_ctype is None else (ctypes.pointer(waveform_handle_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(waveform_handle_ctype.value) @ivi_synchronized def _create_waveform_i16_numpy(self, waveform_data_array): - r"""_create_waveform_i16 + r'''_create_waveform_i16 Creates an onboard waveform from binary 16-bit signed integer (I16) data for use in Arbitrary Waveform or Arbitrary Sequence output mode. The @@ -2169,50 +1941,27 @@ def _create_waveform_i16_numpy(self, waveform_data_array): waveform_handle (int): The handle that identifies the new waveform. This handle is used later when referring to this waveform. - """ + ''' import numpy if type(waveform_data_array) is not numpy.ndarray: - raise TypeError( - "waveform_data_array must be {0}, is {1}".format( - numpy.ndarray, type(waveform_data_array) - ) - ) + raise TypeError('waveform_data_array must be {0}, is {1}'.format(numpy.ndarray, type(waveform_data_array))) if numpy.isfortran(waveform_data_array) is True: - raise TypeError("waveform_data_array must be in C-order") - if waveform_data_array.dtype is not numpy.dtype("int16"): - raise TypeError( - "waveform_data_array must be numpy.ndarray of dtype=int16, is " - + str(waveform_data_array.dtype) - ) + raise TypeError('waveform_data_array must be in C-order') + if waveform_data_array.dtype is not numpy.dtype('int16'): + raise TypeError('waveform_data_array must be numpy.ndarray of dtype=int16, is ' + str(waveform_data_array.dtype)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - waveform_size_ctype = _visatype.ViInt32( - 0 if waveform_data_array is None else len(waveform_data_array) - ) # case S160 - waveform_data_array_ctype = get_ctypes_pointer_for_buffer( - value=waveform_data_array - ) # case B510 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + waveform_size_ctype = _visatype.ViInt32(0 if waveform_data_array is None else len(waveform_data_array)) # case S160 + waveform_data_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_data_array) # case B510 waveform_handle_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_CreateWaveformI16( - vi_ctype, - channel_name_ctype, - waveform_size_ctype, - waveform_data_array_ctype, - None - if waveform_handle_ctype is None - else (ctypes.pointer(waveform_handle_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_CreateWaveformI16(vi_ctype, channel_name_ctype, waveform_size_ctype, waveform_data_array_ctype, None if waveform_handle_ctype is None else (ctypes.pointer(waveform_handle_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(waveform_handle_ctype.value) @ivi_synchronized def define_user_standard_waveform(self, waveform_data_array): - r"""define_user_standard_waveform + r'''define_user_standard_waveform Defines a user waveform for use in either Standard Method or Frequency List output mode. @@ -2251,28 +2000,18 @@ def define_user_standard_waveform(self, waveform_data_array): **Default Value**: None - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - waveform_size_ctype = _visatype.ViInt32( - 0 if waveform_data_array is None else len(waveform_data_array) - ) # case S160 - waveform_data_array_ctype = get_ctypes_pointer_for_buffer( - value=waveform_data_array, library_type=_visatype.ViReal64 - ) # case B550 - error_code = self._library.niFgen_DefineUserStandardWaveform( - vi_ctype, channel_name_ctype, waveform_size_ctype, waveform_data_array_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + waveform_size_ctype = _visatype.ViInt32(0 if waveform_data_array is None else len(waveform_data_array)) # case S160 + waveform_data_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_data_array, library_type=_visatype.ViReal64) # case B550 + error_code = self._library.niFgen_DefineUserStandardWaveform(vi_ctype, channel_name_ctype, waveform_size_ctype, waveform_data_array_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _delete_named_waveform(self, waveform_name): - r"""_delete_named_waveform + r'''_delete_named_waveform Removes a previously created arbitrary waveform from the signal generator memory and invalidates the waveform handle. @@ -2295,25 +2034,17 @@ def _delete_named_waveform(self, waveform_name): Args: waveform_name (str): Specifies the name to associate with the allocated waveform. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - waveform_name_ctype = ctypes.create_string_buffer( - waveform_name.encode(self._encoding) - ) # case C020 - error_code = self._library.niFgen_DeleteNamedWaveform( - vi_ctype, channel_name_ctype, waveform_name_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 + error_code = self._library.niFgen_DeleteNamedWaveform(vi_ctype, channel_name_ctype, waveform_name_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def delete_script(self, script_name): - r"""delete_script + r'''delete_script Deletes the specified script from onboard memory. @@ -2332,25 +2063,17 @@ def delete_script(self, script_name): script_name (str): Specifies the name of the script you want to delete. The script name appears in the text of the script following the script keyword. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - script_name_ctype = ctypes.create_string_buffer( - script_name.encode(self._encoding) - ) # case C020 - error_code = self._library.niFgen_DeleteScript( - vi_ctype, channel_name_ctype, script_name_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + script_name_ctype = ctypes.create_string_buffer(script_name.encode(self._encoding)) # case C020 + error_code = self._library.niFgen_DeleteScript(vi_ctype, channel_name_ctype, script_name_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def delete_waveform(self, waveform_name_or_handle): - """delete_waveform + '''delete_waveform Removes a previously created arbitrary waveform from the signal generator memory. @@ -2370,7 +2093,7 @@ def delete_waveform(self, waveform_name_or_handle): Args: waveform_name_or_handle (str or int): The name (str) or handle (int) of an arbitrary waveform previously allocated with allocate_named_waveform, allocate_waveform or create_waveform. - """ + ''' if isinstance(waveform_name_or_handle, str): return self._delete_named_waveform(waveform_name_or_handle) else: @@ -2378,7 +2101,7 @@ def delete_waveform(self, waveform_name_or_handle): @ivi_synchronized def _get_attribute_vi_boolean(self, attribute_id): - r"""_get_attribute_vi_boolean + r'''_get_attribute_vi_boolean Queries the value of a ViBoolean property. @@ -2410,29 +2133,18 @@ def _get_attribute_vi_boolean(self, attribute_id): attribute_value (bool): Returns the current value of the property. Pass the address of a ViBoolean variable. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niFgen_GetAttributeViBoolean( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - None - if attribute_value_ctype is None - else (ctypes.pointer(attribute_value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_GetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_int32(self, attribute_id): - r"""_get_attribute_vi_int32 + r'''_get_attribute_vi_int32 Queries the value of a ViInt32 property. You can use this method to get the values of instrument-specific properties and inherent IVI @@ -2462,29 +2174,18 @@ def _get_attribute_vi_int32(self, attribute_id): attribute_value (int): Returns the current value of the property. Pass the address of a ViInt32 variable. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_GetAttributeViInt32( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - None - if attribute_value_ctype is None - else (ctypes.pointer(attribute_value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_GetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_real64(self, attribute_id): - r"""_get_attribute_vi_real64 + r'''_get_attribute_vi_real64 Queries the value of a ViReal64 property. @@ -2516,29 +2217,18 @@ def _get_attribute_vi_real64(self, attribute_id): attribute_value (float): Returns the current value of the property. Pass the address of a ViReal64 variable. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niFgen_GetAttributeViReal64( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - None - if attribute_value_ctype is None - else (ctypes.pointer(attribute_value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_GetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_string(self, attribute_id): - r"""_get_attribute_vi_string + r'''_get_attribute_vi_string Queries the value of a ViString property. @@ -2600,42 +2290,22 @@ def _get_attribute_vi_string(self, attribute_id): If you specify 0 for the **arraySize** parameter, you can pass VI_NULL for this parameter. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 array_size_ctype = _visatype.ViInt32() # case S170 attribute_value_ctype = None # case C050 - error_code = self._library.niFgen_GetAttributeViString( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - array_size_ctype, - attribute_value_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niFgen_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, array_size_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) array_size_ctype = _visatype.ViInt32(error_code) # case S180 - attribute_value_ctype = ( - _visatype.ViChar * array_size_ctype.value - )() # case C060 - error_code = self._library.niFgen_GetAttributeViString( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - array_size_ctype, - attribute_value_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + attribute_value_ctype = (_visatype.ViChar * array_size_ctype.value)() # case C060 + error_code = self._library.niFgen_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, array_size_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return attribute_value_ctype.value.decode(self._encoding) def _get_error(self): - r"""_get_error + r'''_get_error Returns the error information associated with an IVI session or with the current execution thread. If you specify a valid IVI session for the @@ -2669,39 +2339,21 @@ def _get_error(self): Otherwise, you must pass a ViChar array of a size specified with the **errorDescriptionBufferSize** parameter. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus() # case S220 error_description_buffer_size_ctype = _visatype.ViInt32() # case S170 error_description_ctype = None # case C050 - error_code = self._library.niFgen_GetError( - vi_ctype, - None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), - error_description_buffer_size_ctype, - error_description_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=True - ) + error_code = self._library.niFgen_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), error_description_buffer_size_ctype, error_description_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True) error_description_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - error_description_ctype = ( - _visatype.ViChar * error_description_buffer_size_ctype.value - )() # case C060 - error_code = self._library.niFgen_GetError( - vi_ctype, - None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), - error_description_buffer_size_ctype, - error_description_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) - return int(error_code_ctype.value), error_description_ctype.value.decode( - self._encoding - ) + error_description_ctype = (_visatype.ViChar * error_description_buffer_size_ctype.value)() # case C060 + error_code = self._library.niFgen_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), error_description_buffer_size_ctype, error_description_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + return int(error_code_ctype.value), error_description_ctype.value.decode(self._encoding) def lock(self): - """lock + '''lock Obtains a multithread lock on the device session. Before doing so, the software waits until all other execution threads release their locks @@ -2729,27 +2381,25 @@ def lock(self): Returns: lock (context manager): When used in a with statement, nifgen.Session.lock acts as a context manager and unlock will be called when the with block is exited - """ + ''' self._lock_session() # We do not call _lock_session() in the context manager so that this function can # act standalone as well and let the client call unlock() explicitly. If they do use the context manager, # that will handle the unlock for them return _Lock(self) def _lock_session(self): - """_lock_session + '''_lock_session Actual call to driver - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_LockSession(vi_ctype, None) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return @ivi_synchronized def send_software_edge_trigger(self, trigger=None, trigger_id=None): - """send_software_edge_trigger + '''send_software_edge_trigger Sends a command to trigger the signal generator. This VI can act as an override for an external edge trigger. @@ -2774,14 +2424,10 @@ def send_software_edge_trigger(self, trigger=None, trigger_id=None): trigger_id (str): Trigger ID specifies the Script Trigger to use for triggering. - """ + ''' if trigger is None or trigger_id is None: import warnings - - warnings.warn( - "trigger and trigger_id should now always be passed in to the method", - category=DeprecationWarning, - ) + warnings.warn('trigger and trigger_id should now always be passed in to the method', category=DeprecationWarning) # We look at whether we are called directly on the session or a repeated capability container to determine how to behave if len(self._repeated_capability) > 0: @@ -2795,30 +2441,20 @@ def send_software_edge_trigger(self, trigger=None, trigger_id=None): pass # This is how the function should be called else: - raise ValueError( - "Both trigger ({0}) and trigger_id ({1}) should be passed in to the method".format( - str(trigger), str(trigger_id) - ) - ) + raise ValueError('Both trigger ({0}) and trigger_id ({1}) should be passed in to the method'.format(str(trigger), str(trigger_id))) if type(trigger) is not enums.Trigger: - raise TypeError("Parameter trigger must be of type " + str(enums.Trigger)) + raise TypeError('Parameter trigger must be of type ' + str(enums.Trigger)) vi_ctype = _visatype.ViSession(self._vi) # case S110 trigger_ctype = _visatype.ViInt32(trigger.value) # case S130 - trigger_id_ctype = ctypes.create_string_buffer( - trigger_id.encode(self._encoding) - ) # case C020 - error_code = self._library.niFgen_SendSoftwareEdgeTrigger( - vi_ctype, trigger_ctype, trigger_id_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + trigger_id_ctype = ctypes.create_string_buffer(trigger_id.encode(self._encoding)) # case C020 + error_code = self._library.niFgen_SendSoftwareEdgeTrigger(vi_ctype, trigger_ctype, trigger_id_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_boolean(self, attribute_id, attribute_value): - r"""_set_attribute_vi_boolean + r'''_set_attribute_vi_boolean Sets the value of a ViBoolean property. @@ -2866,24 +2502,18 @@ def _set_attribute_vi_boolean(self, attribute_id, attribute_value): Some of the values might not be valid depending on the current settings of the instrument session. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViBoolean(attribute_value) # case S150 - error_code = self._library.niFgen_SetAttributeViBoolean( - vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_SetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_int32(self, attribute_id, attribute_value): - r"""_set_attribute_vi_int32 + r'''_set_attribute_vi_int32 Sets the value of a ViInt32 property. @@ -2931,24 +2561,18 @@ def _set_attribute_vi_int32(self, attribute_id, attribute_value): Some of the values might not be valid depending on the current settings of the instrument session. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt32(attribute_value) # case S150 - error_code = self._library.niFgen_SetAttributeViInt32( - vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_SetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_real64(self, attribute_id, attribute_value): - r"""_set_attribute_vi_real64 + r'''_set_attribute_vi_real64 Sets the value of a ViReal64 property. @@ -2996,24 +2620,18 @@ def _set_attribute_vi_real64(self, attribute_id, attribute_value): Some of the values might not be valid depending on the current settings of the instrument session. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViReal64(attribute_value) # case S150 - error_code = self._library.niFgen_SetAttributeViReal64( - vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_SetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_string(self, attribute_id, attribute_value): - r"""_set_attribute_vi_string + r'''_set_attribute_vi_string Sets the value of a ViString property. @@ -3061,28 +2679,18 @@ def _set_attribute_vi_string(self, attribute_id, attribute_value): Some of the values might not be valid depending on the current settings of the instrument session. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 - attribute_value_ctype = ctypes.create_string_buffer( - attribute_value.encode(self._encoding) - ) # case C020 - error_code = self._library.niFgen_SetAttributeViString( - vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + attribute_value_ctype = ctypes.create_string_buffer(attribute_value.encode(self._encoding)) # case C020 + error_code = self._library.niFgen_SetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def _set_named_waveform_next_write_position( - self, waveform_name, relative_to, offset - ): - r"""_set_named_waveform_next_write_position + def _set_named_waveform_next_write_position(self, waveform_name, relative_to, offset): + r'''_set_named_waveform_next_write_position Sets the position in the waveform to which data is written at the next write. This method allows you to write to arbitrary locations within @@ -3127,35 +2735,21 @@ def _set_named_waveform_next_write_position( offset (int): Specifies the offset from the **relativeTo** parameter at which to start loading the data into the waveform. - """ + ''' if type(relative_to) is not enums.RelativeTo: - raise TypeError( - "Parameter relative_to must be of type " + str(enums.RelativeTo) - ) + raise TypeError('Parameter relative_to must be of type ' + str(enums.RelativeTo)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - waveform_name_ctype = ctypes.create_string_buffer( - waveform_name.encode(self._encoding) - ) # case C020 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 relative_to_ctype = _visatype.ViInt32(relative_to.value) # case S130 offset_ctype = _visatype.ViInt32(offset) # case S150 - error_code = self._library.niFgen_SetNamedWaveformNextWritePosition( - vi_ctype, - channel_name_ctype, - waveform_name_ctype, - relative_to_ctype, - offset_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_SetNamedWaveformNextWritePosition(vi_ctype, channel_name_ctype, waveform_name_ctype, relative_to_ctype, offset_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def set_next_write_position(self, waveform_name_or_handle, relative_to, offset): - """set_next_write_position + '''set_next_write_position Sets the position in the waveform at which the next waveform data is written. This method allows you to write to arbitrary locations within @@ -3195,19 +2789,15 @@ def set_next_write_position(self, waveform_name_or_handle, relative_to, offset): offset (int): Specifies the offset from **relativeTo** at which to start loading the data into the waveform. - """ + ''' if isinstance(waveform_name_or_handle, str): - return self._set_named_waveform_next_write_position( - waveform_name_or_handle, relative_to, offset - ) + return self._set_named_waveform_next_write_position(waveform_name_or_handle, relative_to, offset) else: - return self._set_waveform_next_write_position( - waveform_name_or_handle, relative_to, offset - ) + return self._set_waveform_next_write_position(waveform_name_or_handle, relative_to, offset) @ivi_synchronized def _set_waveform_next_write_position(self, waveform_handle, relative_to, offset): - r"""_set_waveform_next_write_position + r'''_set_waveform_next_write_position Sets the position in the waveform at which the next waveform data is written. This method allows you to write to arbitrary locations within @@ -3253,47 +2843,33 @@ def _set_waveform_next_write_position(self, waveform_handle, relative_to, offset offset (int): Specifies the offset from **relativeTo** at which to start loading the data into the waveform. - """ + ''' if type(relative_to) is not enums.RelativeTo: - raise TypeError( - "Parameter relative_to must be of type " + str(enums.RelativeTo) - ) + raise TypeError('Parameter relative_to must be of type ' + str(enums.RelativeTo)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 waveform_handle_ctype = _visatype.ViInt32(waveform_handle) # case S150 relative_to_ctype = _visatype.ViInt32(relative_to.value) # case S130 offset_ctype = _visatype.ViInt32(offset) # case S150 - error_code = self._library.niFgen_SetWaveformNextWritePosition( - vi_ctype, - channel_name_ctype, - waveform_handle_ctype, - relative_to_ctype, - offset_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_SetWaveformNextWritePosition(vi_ctype, channel_name_ctype, waveform_handle_ctype, relative_to_ctype, offset_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def unlock(self): - """unlock + '''unlock Releases a lock that you acquired on an device session using lock. Refer to lock for additional information on session locks. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_UnlockSession(vi_ctype, None) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return @ivi_synchronized def _write_binary16_waveform_numpy(self, waveform_handle, data): - r"""_write_binary16_waveform + r'''_write_binary16_waveform Writes binary data to the waveform in onboard memory. The waveform handle passed must have been created by a call to the @@ -3327,37 +2903,27 @@ def _write_binary16_waveform_numpy(self, waveform_handle, data): have at least as many elements as the value in **size**. The binary data is left-justified. - """ + ''' import numpy if type(data) is not numpy.ndarray: - raise TypeError( - "data must be {0}, is {1}".format(numpy.ndarray, type(data)) - ) + raise TypeError('data must be {0}, is {1}'.format(numpy.ndarray, type(data))) if numpy.isfortran(data) is True: - raise TypeError("data must be in C-order") - if data.dtype is not numpy.dtype("int16"): - raise TypeError( - "data must be numpy.ndarray of dtype=int16, is " + str(data.dtype) - ) + raise TypeError('data must be in C-order') + if data.dtype is not numpy.dtype('int16'): + raise TypeError('data must be numpy.ndarray of dtype=int16, is ' + str(data.dtype)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 waveform_handle_ctype = _visatype.ViInt32(waveform_handle) # case S150 size_ctype = _visatype.ViInt32(0 if data is None else len(data)) # case S160 data_ctype = get_ctypes_pointer_for_buffer(value=data) # case B510 - error_code = self._library.niFgen_WriteBinary16Waveform( - vi_ctype, channel_name_ctype, waveform_handle_ctype, size_ctype, data_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_WriteBinary16Waveform(vi_ctype, channel_name_ctype, waveform_handle_ctype, size_ctype, data_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _write_named_waveform_f64(self, waveform_name, data): - r"""_write_named_waveform_f64 + r'''_write_named_waveform_f64 Writes floating-point data to the waveform in onboard memory. The waveform handle passed in must have been created by a call to the @@ -3395,30 +2961,20 @@ def _write_named_waveform_f64(self, waveform_name, data): data (array.array("d")): Specifies the array of data to load into the waveform. The array must have at least as many elements as the value in **size**. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - waveform_name_ctype = ctypes.create_string_buffer( - waveform_name.encode(self._encoding) - ) # case C020 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 size_ctype = _visatype.ViInt32(0 if data is None else len(data)) # case S160 data_array = get_ctypes_and_array(value=data, array_type="d") # case B550 - data_ctype = get_ctypes_pointer_for_buffer( - value=data_array, library_type=_visatype.ViReal64 - ) # case B550 - error_code = self._library.niFgen_WriteNamedWaveformF64( - vi_ctype, channel_name_ctype, waveform_name_ctype, size_ctype, data_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + data_ctype = get_ctypes_pointer_for_buffer(value=data_array, library_type=_visatype.ViReal64) # case B550 + error_code = self._library.niFgen_WriteNamedWaveformF64(vi_ctype, channel_name_ctype, waveform_name_ctype, size_ctype, data_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _write_named_waveform_f64_numpy(self, waveform_name, data): - r"""_write_named_waveform_f64 + r'''_write_named_waveform_f64 Writes floating-point data to the waveform in onboard memory. The waveform handle passed in must have been created by a call to the @@ -3456,39 +3012,27 @@ def _write_named_waveform_f64_numpy(self, waveform_name, data): data (numpy.array(dtype=numpy.float64)): Specifies the array of data to load into the waveform. The array must have at least as many elements as the value in **size**. - """ + ''' import numpy if type(data) is not numpy.ndarray: - raise TypeError( - "data must be {0}, is {1}".format(numpy.ndarray, type(data)) - ) + raise TypeError('data must be {0}, is {1}'.format(numpy.ndarray, type(data))) if numpy.isfortran(data) is True: - raise TypeError("data must be in C-order") - if data.dtype is not numpy.dtype("float64"): - raise TypeError( - "data must be numpy.ndarray of dtype=float64, is " + str(data.dtype) - ) + raise TypeError('data must be in C-order') + if data.dtype is not numpy.dtype('float64'): + raise TypeError('data must be numpy.ndarray of dtype=float64, is ' + str(data.dtype)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - waveform_name_ctype = ctypes.create_string_buffer( - waveform_name.encode(self._encoding) - ) # case C020 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 size_ctype = _visatype.ViInt32(0 if data is None else len(data)) # case S160 data_ctype = get_ctypes_pointer_for_buffer(value=data) # case B510 - error_code = self._library.niFgen_WriteNamedWaveformF64( - vi_ctype, channel_name_ctype, waveform_name_ctype, size_ctype, data_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_WriteNamedWaveformF64(vi_ctype, channel_name_ctype, waveform_name_ctype, size_ctype, data_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _write_named_waveform_i16_numpy(self, waveform_name, data): - r"""_write_named_waveform_i16 + r'''_write_named_waveform_i16 Writes binary data to the named waveform in onboard memory. @@ -3518,39 +3062,27 @@ def _write_named_waveform_i16_numpy(self, waveform_name, data): data (numpy.array(dtype=numpy.int16)): Specifies the array of data to load into the waveform. The array must have at least as many elements as the value in **size**. - """ + ''' import numpy if type(data) is not numpy.ndarray: - raise TypeError( - "data must be {0}, is {1}".format(numpy.ndarray, type(data)) - ) + raise TypeError('data must be {0}, is {1}'.format(numpy.ndarray, type(data))) if numpy.isfortran(data) is True: - raise TypeError("data must be in C-order") - if data.dtype is not numpy.dtype("int16"): - raise TypeError( - "data must be numpy.ndarray of dtype=int16, is " + str(data.dtype) - ) + raise TypeError('data must be in C-order') + if data.dtype is not numpy.dtype('int16'): + raise TypeError('data must be numpy.ndarray of dtype=int16, is ' + str(data.dtype)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - waveform_name_ctype = ctypes.create_string_buffer( - waveform_name.encode(self._encoding) - ) # case C020 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + waveform_name_ctype = ctypes.create_string_buffer(waveform_name.encode(self._encoding)) # case C020 size_ctype = _visatype.ViInt32(0 if data is None else len(data)) # case S160 data_ctype = get_ctypes_pointer_for_buffer(value=data) # case B510 - error_code = self._library.niFgen_WriteNamedWaveformI16( - vi_ctype, channel_name_ctype, waveform_name_ctype, size_ctype, data_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_WriteNamedWaveformI16(vi_ctype, channel_name_ctype, waveform_name_ctype, size_ctype, data_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def write_script(self, script): - r"""write_script + r'''write_script Writes a string containing one or more scripts that govern the generation of waveforms. @@ -3572,25 +3104,17 @@ def write_script(self, script): Instructions `__ for more information about writing scripts. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - script_ctype = ctypes.create_string_buffer( - script.encode(self._encoding) - ) # case C020 - error_code = self._library.niFgen_WriteScript( - vi_ctype, channel_name_ctype, script_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + script_ctype = ctypes.create_string_buffer(script.encode(self._encoding)) # case C020 + error_code = self._library.niFgen_WriteScript(vi_ctype, channel_name_ctype, script_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _write_waveform(self, waveform_handle, data): - r"""_write_waveform + r'''_write_waveform Writes floating-point data to the waveform in onboard memory. The waveform handle passed in must have been created by a call to the @@ -3629,28 +3153,20 @@ def _write_waveform(self, waveform_handle, data): data (array.array("d")): Specifies the array of data to load into the waveform. The array must have at least as many elements as the value in **size**. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 waveform_handle_ctype = _visatype.ViInt32(waveform_handle) # case S150 size_ctype = _visatype.ViInt32(0 if data is None else len(data)) # case S160 data_array = get_ctypes_and_array(value=data, array_type="d") # case B550 - data_ctype = get_ctypes_pointer_for_buffer( - value=data_array, library_type=_visatype.ViReal64 - ) # case B550 - error_code = self._library.niFgen_WriteWaveform( - vi_ctype, channel_name_ctype, waveform_handle_ctype, size_ctype, data_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + data_ctype = get_ctypes_pointer_for_buffer(value=data_array, library_type=_visatype.ViReal64) # case B550 + error_code = self._library.niFgen_WriteWaveform(vi_ctype, channel_name_ctype, waveform_handle_ctype, size_ctype, data_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _write_waveform_numpy(self, waveform_handle, data): - r"""_write_waveform + r'''_write_waveform Writes floating-point data to the waveform in onboard memory. The waveform handle passed in must have been created by a call to the @@ -3689,37 +3205,27 @@ def _write_waveform_numpy(self, waveform_handle, data): data (numpy.array(dtype=numpy.float64)): Specifies the array of data to load into the waveform. The array must have at least as many elements as the value in **size**. - """ + ''' import numpy if type(data) is not numpy.ndarray: - raise TypeError( - "data must be {0}, is {1}".format(numpy.ndarray, type(data)) - ) + raise TypeError('data must be {0}, is {1}'.format(numpy.ndarray, type(data))) if numpy.isfortran(data) is True: - raise TypeError("data must be in C-order") - if data.dtype is not numpy.dtype("float64"): - raise TypeError( - "data must be numpy.ndarray of dtype=float64, is " + str(data.dtype) - ) + raise TypeError('data must be in C-order') + if data.dtype is not numpy.dtype('float64'): + raise TypeError('data must be numpy.ndarray of dtype=float64, is ' + str(data.dtype)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 waveform_handle_ctype = _visatype.ViInt32(waveform_handle) # case S150 size_ctype = _visatype.ViInt32(0 if data is None else len(data)) # case S160 data_ctype = get_ctypes_pointer_for_buffer(value=data) # case B510 - error_code = self._library.niFgen_WriteWaveform( - vi_ctype, channel_name_ctype, waveform_handle_ctype, size_ctype, data_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_WriteWaveform(vi_ctype, channel_name_ctype, waveform_handle_ctype, size_ctype, data_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def write_waveform(self, waveform_name_or_handle, data): - """write_waveform + '''write_waveform Writes data to the waveform in onboard memory. @@ -3744,60 +3250,29 @@ def write_waveform(self, waveform_name_or_handle, data): data (list of float): Array of data to load into the waveform. This may be an iterable of float, or for best performance a numpy.ndarray of dtype int16 or float64. - """ + ''' use_named = isinstance(waveform_name_or_handle, str) # Check the type by using string comparison so that we don't import numpy unnecessarily. if str(type(data)).find("'numpy.ndarray'") != -1: import numpy - if data.dtype == numpy.float64: - return ( - self._write_named_waveform_f64_numpy(waveform_name_or_handle, data) - if use_named - else self._write_waveform_numpy(waveform_name_or_handle, data) - ) + return self._write_named_waveform_f64_numpy(waveform_name_or_handle, data) if use_named else self._write_waveform_numpy(waveform_name_or_handle, data) elif data.dtype == numpy.int16: - return ( - self._write_named_waveform_i16_numpy(waveform_name_or_handle, data) - if use_named - else self._write_binary16_waveform_numpy( - waveform_name_or_handle, data - ) - ) + return self._write_named_waveform_i16_numpy(waveform_name_or_handle, data) if use_named else self._write_binary16_waveform_numpy(waveform_name_or_handle, data) else: - raise TypeError( - "Unsupported dtype. Is {0}, expected {1} or {2}".format( - data.dtype, numpy.float64, numpy.int16 - ) - ) + raise TypeError("Unsupported dtype. Is {0}, expected {1} or {2}".format(data.dtype, numpy.float64, numpy.int16)) elif isinstance(data, array.array): - if data.typecode == "d": - return ( - self._write_named_waveform_f64(waveform_name_or_handle, data) - if use_named - else self._write_waveform(waveform_name_or_handle, data) - ) - elif data.typecode == "h": - return ( - self._write_named_waveform_i16(waveform_name_or_handle, data) - if use_named - else self._write_binary16_waveform(waveform_name_or_handle, data) - ) + if data.typecode == 'd': + return self._write_named_waveform_f64(waveform_name_or_handle, data) if use_named else self._write_waveform(waveform_name_or_handle, data) + elif data.typecode == 'h': + return self._write_named_waveform_i16(waveform_name_or_handle, data) if use_named else self._write_binary16_waveform(waveform_name_or_handle, data) else: - raise TypeError( - "Unsupported dtype. Is {0}, expected {1} or {2}".format( - data.typecode, "d (double)", "h (16 bit int)" - ) - ) - - return ( - self._write_named_waveform_f64(waveform_name_or_handle, data) - if use_named - else self._write_waveform(waveform_name_or_handle, data) - ) + raise TypeError("Unsupported dtype. Is {0}, expected {1} or {2}".format(data.typecode, 'd (double)', 'h (16 bit int)')) + + return self._write_named_waveform_f64(waveform_name_or_handle, data) if use_named else self._write_waveform(waveform_name_or_handle, data) def _error_message(self, error_code): - r"""_error_message + r'''_error_message Converts a status code returned by an NI-FGEN method into a user-readable string. @@ -3815,26 +3290,20 @@ def _error_message(self, error_code): You must pass a ViChar array with at least 256 bytes. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus(error_code) # case S150 error_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niFgen_error_message( - vi_ctype, error_code_ctype, error_message_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + error_code = self._library.niFgen_error_message(vi_ctype, error_code_ctype, error_message_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return error_message_ctype.value.decode(self._encoding) class Session(_SessionBase): - """An NI-FGEN session to a National Instruments Signal Generator.""" + '''An NI-FGEN session to a National Instruments Signal Generator.''' - def __init__( - self, resource_name, channel_name=None, reset_device=False, options={} - ): - r"""An NI-FGEN session to a National Instruments Signal Generator. + def __init__(self, resource_name, channel_name=None, reset_device=False, options={}): + r'''An NI-FGEN session to a National Instruments Signal Generator. Creates and returns a new NI-FGEN session to the specified channel of a waveform generator that is used in all subsequent NI-FGEN method @@ -3939,26 +3408,16 @@ def __init__( Returns: session (nifgen.Session): A session object representing the device. - """ - super(Session, self).__init__( - repeated_capability_list=[], - vi=None, - library=None, - encoding=None, - freeze_it=False, - ) - channel_name = _converters.convert_repeated_capabilities_without_prefix( - channel_name - ) + ''' + super(Session, self).__init__(repeated_capability_list=[], vi=None, library=None, encoding=None, freeze_it=False) + channel_name = _converters.convert_repeated_capabilities_without_prefix(channel_name) options = _converters.convert_init_with_options_dictionary(options) self._library = _library_singleton.get() - self._encoding = "windows-1251" + self._encoding = 'windows-1251' # Call specified init function self._vi = 0 # This must be set before calling _initialize_with_channels(). - self._vi = self._initialize_with_channels( - resource_name, channel_name, reset_device, options - ) + self._vi = self._initialize_with_channels(resource_name, channel_name, reset_device, options) self.tclk = nitclk.SessionReference(self._vi) @@ -3968,7 +3427,7 @@ def __init__( param_list.append("channel_name=" + pp.pformat(channel_name)) param_list.append("reset_device=" + pp.pformat(reset_device)) param_list.append("options=" + pp.pformat(options)) - self._param_list = ", ".join(param_list) + self._param_list = ', '.join(param_list) self._is_frozen = True @@ -3979,7 +3438,7 @@ def __exit__(self, exc_type, exc_value, traceback): self.close() def initiate(self): - """initiate + '''initiate Initiates signal generation. If you want to abort signal generation, call the abort method. After the signal generation @@ -3988,11 +3447,11 @@ def initiate(self): Note: This method will return a Python context manager that will initiate on entering and abort on exit. - """ + ''' return _Generation(self) def close(self): - """close + '''close Performs the following operations: @@ -4019,7 +3478,7 @@ def close(self): Note: This method is not needed when using the session context manager - """ + ''' try: self._close() except errors.DriverError: @@ -4027,26 +3486,24 @@ def close(self): raise self._vi = 0 - """ These are code-generated """ + ''' These are code-generated ''' @ivi_synchronized def abort(self): - r"""abort + r'''abort Aborts any previously initiated signal generation. Call the initiate method to cause the signal generator to produce a signal again. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_AbortGeneration(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def clear_arb_memory(self): - r"""clear_arb_memory + r'''clear_arb_memory Removes all previously created arbitrary waveforms, sequences, and scripts from the signal generator memory and invalidates all waveform @@ -4055,17 +3512,15 @@ def clear_arb_memory(self): Note: The signal generator must not be in the Generating state when you call this method. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_ClearArbMemory(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def clear_arb_sequence(self, sequence_handle): - r"""clear_arb_sequence + r'''clear_arb_sequence Removes a previously created arbitrary sequence from the signal generator memory and invalidates the sequence handle. @@ -4089,20 +3544,16 @@ def clear_arb_sequence(self, sequence_handle): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 sequence_handle_ctype = _visatype.ViInt32(sequence_handle) # case S150 - error_code = self._library.niFgen_ClearArbSequence( - vi_ctype, sequence_handle_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_ClearArbSequence(vi_ctype, sequence_handle_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _clear_arb_waveform(self, waveform_handle): - r"""_clear_arb_waveform + r'''_clear_arb_waveform Removes a previously created arbitrary waveform from the signal generator memory and invalidates the waveform handle. @@ -4133,20 +3584,16 @@ def _clear_arb_waveform(self, waveform_handle): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 waveform_handle_ctype = _visatype.ViInt32(waveform_handle) # case S150 - error_code = self._library.niFgen_ClearArbWaveform( - vi_ctype, waveform_handle_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_ClearArbWaveform(vi_ctype, waveform_handle_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def clear_freq_list(self, frequency_list_handle): - r"""clear_freq_list + r'''clear_freq_list Removes a previously created frequency list from the signal generator memory and invalidates the frequency list handle. @@ -4172,22 +3619,16 @@ def clear_freq_list(self, frequency_list_handle): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - frequency_list_handle_ctype = _visatype.ViInt32( - frequency_list_handle - ) # case S150 - error_code = self._library.niFgen_ClearFreqList( - vi_ctype, frequency_list_handle_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + frequency_list_handle_ctype = _visatype.ViInt32(frequency_list_handle) # case S150 + error_code = self._library.niFgen_ClearFreqList(vi_ctype, frequency_list_handle_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def commit(self): - r"""commit + r'''commit Causes a transition to the Committed state. This method verifies property values, reserves the device, and commits the property values @@ -4209,23 +3650,15 @@ def commit(self): - Any Reference Clock and external clock circuits are phase-locked. - A subsequent initiate method can run faster because the device is already configured. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_Commit(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def create_advanced_arb_sequence( - self, - waveform_handles_array, - loop_counts_array, - sample_counts_array=None, - marker_location_array=None, - ): - r"""create_advanced_arb_sequence + def create_advanced_arb_sequence(self, waveform_handles_array, loop_counts_array, sample_counts_array=None, marker_location_array=None): + r'''create_advanced_arb_sequence Creates an arbitrary sequence from an array of waveform handles and an array of corresponding loop counts. This method returns a handle that @@ -4322,73 +3755,29 @@ def create_advanced_arb_sequence( pass this handle to configure_arb_sequence to generate the arbitrary sequence. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - sequence_length_ctype = _visatype.ViInt32( - 0 if waveform_handles_array is None else len(waveform_handles_array) - ) # case S160 - if loop_counts_array is not None and len(loop_counts_array) != len( - waveform_handles_array - ): # case S160 - raise ValueError( - "Length of loop_counts_array and waveform_handles_array parameters do not match." - ) # case S160 - if sample_counts_array is not None and len(sample_counts_array) != len( - waveform_handles_array - ): # case S160 - raise ValueError( - "Length of sample_counts_array and waveform_handles_array parameters do not match." - ) # case S160 - if marker_location_array is not None and len(marker_location_array) != len( - waveform_handles_array - ): # case S160 - raise ValueError( - "Length of marker_location_array and waveform_handles_array parameters do not match." - ) # case S160 - waveform_handles_array_ctype = get_ctypes_pointer_for_buffer( - value=waveform_handles_array, library_type=_visatype.ViInt32 - ) # case B550 - loop_counts_array_ctype = get_ctypes_pointer_for_buffer( - value=loop_counts_array, library_type=_visatype.ViInt32 - ) # case B550 - sample_counts_array_ctype = get_ctypes_pointer_for_buffer( - value=sample_counts_array, library_type=_visatype.ViInt32 - ) # case B550 - marker_location_array_ctype = get_ctypes_pointer_for_buffer( - value=marker_location_array, library_type=_visatype.ViInt32 - ) # case B550 - coerced_markers_array_size = ( - 0 if marker_location_array is None else len(marker_location_array) - ) # case B560 - coerced_markers_array_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViInt32, size=coerced_markers_array_size - ) # case B560 + sequence_length_ctype = _visatype.ViInt32(0 if waveform_handles_array is None else len(waveform_handles_array)) # case S160 + if loop_counts_array is not None and len(loop_counts_array) != len(waveform_handles_array): # case S160 + raise ValueError("Length of loop_counts_array and waveform_handles_array parameters do not match.") # case S160 + if sample_counts_array is not None and len(sample_counts_array) != len(waveform_handles_array): # case S160 + raise ValueError("Length of sample_counts_array and waveform_handles_array parameters do not match.") # case S160 + if marker_location_array is not None and len(marker_location_array) != len(waveform_handles_array): # case S160 + raise ValueError("Length of marker_location_array and waveform_handles_array parameters do not match.") # case S160 + waveform_handles_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_handles_array, library_type=_visatype.ViInt32) # case B550 + loop_counts_array_ctype = get_ctypes_pointer_for_buffer(value=loop_counts_array, library_type=_visatype.ViInt32) # case B550 + sample_counts_array_ctype = get_ctypes_pointer_for_buffer(value=sample_counts_array, library_type=_visatype.ViInt32) # case B550 + marker_location_array_ctype = get_ctypes_pointer_for_buffer(value=marker_location_array, library_type=_visatype.ViInt32) # case B550 + coerced_markers_array_size = (0 if marker_location_array is None else len(marker_location_array)) # case B560 + coerced_markers_array_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViInt32, size=coerced_markers_array_size) # case B560 sequence_handle_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_CreateAdvancedArbSequence( - vi_ctype, - sequence_length_ctype, - waveform_handles_array_ctype, - loop_counts_array_ctype, - sample_counts_array_ctype, - marker_location_array_ctype, - coerced_markers_array_ctype, - None - if sequence_handle_ctype is None - else (ctypes.pointer(sequence_handle_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return [ - int(coerced_markers_array_ctype[i]) - for i in range( - (0 if marker_location_array is None else len(marker_location_array)) - ) - ], int(sequence_handle_ctype.value) + error_code = self._library.niFgen_CreateAdvancedArbSequence(vi_ctype, sequence_length_ctype, waveform_handles_array_ctype, loop_counts_array_ctype, sample_counts_array_ctype, marker_location_array_ctype, coerced_markers_array_ctype, None if sequence_handle_ctype is None else (ctypes.pointer(sequence_handle_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return [int(coerced_markers_array_ctype[i]) for i in range((0 if marker_location_array is None else len(marker_location_array)))], int(sequence_handle_ctype.value) @ivi_synchronized def create_arb_sequence(self, waveform_handles_array, loop_counts_array): - r"""create_arb_sequence + r'''create_arb_sequence Creates an arbitrary sequence from an array of waveform handles and an array of corresponding loop counts. This method returns a handle that @@ -4441,41 +3830,21 @@ def create_arb_sequence(self, waveform_handles_array, loop_counts_array): pass this handle to configure_arb_sequence to generate the arbitrary sequence. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - sequence_length_ctype = _visatype.ViInt32( - 0 if waveform_handles_array is None else len(waveform_handles_array) - ) # case S160 - if loop_counts_array is not None and len(loop_counts_array) != len( - waveform_handles_array - ): # case S160 - raise ValueError( - "Length of loop_counts_array and waveform_handles_array parameters do not match." - ) # case S160 - waveform_handles_array_ctype = get_ctypes_pointer_for_buffer( - value=waveform_handles_array, library_type=_visatype.ViInt32 - ) # case B550 - loop_counts_array_ctype = get_ctypes_pointer_for_buffer( - value=loop_counts_array, library_type=_visatype.ViInt32 - ) # case B550 + sequence_length_ctype = _visatype.ViInt32(0 if waveform_handles_array is None else len(waveform_handles_array)) # case S160 + if loop_counts_array is not None and len(loop_counts_array) != len(waveform_handles_array): # case S160 + raise ValueError("Length of loop_counts_array and waveform_handles_array parameters do not match.") # case S160 + waveform_handles_array_ctype = get_ctypes_pointer_for_buffer(value=waveform_handles_array, library_type=_visatype.ViInt32) # case B550 + loop_counts_array_ctype = get_ctypes_pointer_for_buffer(value=loop_counts_array, library_type=_visatype.ViInt32) # case B550 sequence_handle_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_CreateArbSequence( - vi_ctype, - sequence_length_ctype, - waveform_handles_array_ctype, - loop_counts_array_ctype, - None - if sequence_handle_ctype is None - else (ctypes.pointer(sequence_handle_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_CreateArbSequence(vi_ctype, sequence_length_ctype, waveform_handles_array_ctype, loop_counts_array_ctype, None if sequence_handle_ctype is None else (ctypes.pointer(sequence_handle_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(sequence_handle_ctype.value) @ivi_synchronized def create_freq_list(self, waveform, frequency_array, duration_array): - r"""create_freq_list + r'''create_freq_list Creates a frequency list from an array of frequencies (**frequencyArray**) and an array of durations (**durationArray**). The @@ -4547,60 +3916,37 @@ def create_freq_list(self, waveform, frequency_array, duration_array): this handle to configure_freq_list to generate the arbitrary sequence. - """ + ''' if type(waveform) is not enums.Waveform: - raise TypeError("Parameter waveform must be of type " + str(enums.Waveform)) + raise TypeError('Parameter waveform must be of type ' + str(enums.Waveform)) vi_ctype = _visatype.ViSession(self._vi) # case S110 waveform_ctype = _visatype.ViInt32(waveform.value) # case S130 - frequency_list_length_ctype = _visatype.ViInt32( - 0 if frequency_array is None else len(frequency_array) - ) # case S160 - if duration_array is not None and len(duration_array) != len( - frequency_array - ): # case S160 - raise ValueError( - "Length of duration_array and frequency_array parameters do not match." - ) # case S160 - frequency_array_ctype = get_ctypes_pointer_for_buffer( - value=frequency_array, library_type=_visatype.ViReal64 - ) # case B550 - duration_array_ctype = get_ctypes_pointer_for_buffer( - value=duration_array, library_type=_visatype.ViReal64 - ) # case B550 + frequency_list_length_ctype = _visatype.ViInt32(0 if frequency_array is None else len(frequency_array)) # case S160 + if duration_array is not None and len(duration_array) != len(frequency_array): # case S160 + raise ValueError("Length of duration_array and frequency_array parameters do not match.") # case S160 + frequency_array_ctype = get_ctypes_pointer_for_buffer(value=frequency_array, library_type=_visatype.ViReal64) # case B550 + duration_array_ctype = get_ctypes_pointer_for_buffer(value=duration_array, library_type=_visatype.ViReal64) # case B550 frequency_list_handle_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_CreateFreqList( - vi_ctype, - waveform_ctype, - frequency_list_length_ctype, - frequency_array_ctype, - duration_array_ctype, - None - if frequency_list_handle_ctype is None - else (ctypes.pointer(frequency_list_handle_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_CreateFreqList(vi_ctype, waveform_ctype, frequency_list_length_ctype, frequency_array_ctype, duration_array_ctype, None if frequency_list_handle_ctype is None else (ctypes.pointer(frequency_list_handle_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(frequency_list_handle_ctype.value) @ivi_synchronized def disable(self): - r"""disable + r'''disable Places the instrument in a quiescent state where it has minimal or no impact on the system to which it is connected. The analog output and all exported signals are disabled. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_Disable(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def export_attribute_configuration_buffer(self): - r"""export_attribute_configuration_buffer + r'''export_attribute_configuration_buffer Exports the property configuration of the session to a configuration buffer. @@ -4617,33 +3963,23 @@ def export_attribute_configuration_buffer(self): configuration (bytes): Specifies the byte array buffer to be populated with the exported property configuration. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 size_in_bytes_ctype = _visatype.ViInt32() # case S170 configuration_ctype = None # case B580 - error_code = self._library.niFgen_ExportAttributeConfigurationBuffer( - vi_ctype, size_in_bytes_ctype, configuration_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niFgen_ExportAttributeConfigurationBuffer(vi_ctype, size_in_bytes_ctype, configuration_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) size_in_bytes_ctype = _visatype.ViInt32(error_code) # case S180 configuration_size = size_in_bytes_ctype.value # case B590 configuration_array = array.array("b", [0] * configuration_size) # case B590 - configuration_ctype = get_ctypes_pointer_for_buffer( - value=configuration_array, library_type=_visatype.ViInt8 - ) # case B590 - error_code = self._library.niFgen_ExportAttributeConfigurationBuffer( - vi_ctype, size_in_bytes_ctype, configuration_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + configuration_ctype = get_ctypes_pointer_for_buffer(value=configuration_array, library_type=_visatype.ViInt8) # case B590 + error_code = self._library.niFgen_ExportAttributeConfigurationBuffer(vi_ctype, size_in_bytes_ctype, configuration_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return _converters.convert_to_bytes(configuration_array) @ivi_synchronized def export_attribute_configuration_file(self, file_path): - r"""export_attribute_configuration_file + r'''export_attribute_configuration_file Exports the property configuration of the session to the specified file. @@ -4662,22 +3998,16 @@ def export_attribute_configuration_file(self, file_path): method returns an error. **Default file extension:** .nifgenconfig - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer( - file_path.encode(self._encoding) - ) # case C020 - error_code = self._library.niFgen_ExportAttributeConfigurationFile( - vi_ctype, file_path_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 + error_code = self._library.niFgen_ExportAttributeConfigurationFile(vi_ctype, file_path_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def get_channel_name(self, index): - r"""get_channel_name + r'''get_channel_name Returns the channel string that is in the channel table at an index you specify. @@ -4694,32 +4024,22 @@ def get_channel_name(self, index): channel_string (str): Returns the channel string that is in the channel table at the index you specify. Do not modify the contents of the channel string. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 index_ctype = _visatype.ViInt32(index) # case S150 buffer_size_ctype = _visatype.ViInt32() # case S170 channel_string_ctype = None # case C050 - error_code = self._library.niFgen_GetChannelName( - vi_ctype, index_ctype, buffer_size_ctype, channel_string_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niFgen_GetChannelName(vi_ctype, index_ctype, buffer_size_ctype, channel_string_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - channel_string_ctype = ( - _visatype.ViChar * buffer_size_ctype.value - )() # case C060 - error_code = self._library.niFgen_GetChannelName( - vi_ctype, index_ctype, buffer_size_ctype, channel_string_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + channel_string_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 + error_code = self._library.niFgen_GetChannelName(vi_ctype, index_ctype, buffer_size_ctype, channel_string_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return channel_string_ctype.value.decode(self._encoding) @ivi_synchronized def _get_ext_cal_last_date_and_time(self): - r"""_get_ext_cal_last_date_and_time + r'''_get_ext_cal_last_date_and_time Returns the date and time of the last successful external calibration. The time returned is 24-hour (military) local time; for example, if the @@ -4737,35 +4057,20 @@ def _get_ext_cal_last_date_and_time(self): minute (int): Specifies the minute of the last successful calibration. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 year_ctype = _visatype.ViInt32() # case S220 month_ctype = _visatype.ViInt32() # case S220 day_ctype = _visatype.ViInt32() # case S220 hour_ctype = _visatype.ViInt32() # case S220 minute_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_GetExtCalLastDateAndTime( - vi_ctype, - None if year_ctype is None else (ctypes.pointer(year_ctype)), - None if month_ctype is None else (ctypes.pointer(month_ctype)), - None if day_ctype is None else (ctypes.pointer(day_ctype)), - None if hour_ctype is None else (ctypes.pointer(hour_ctype)), - None if minute_ctype is None else (ctypes.pointer(minute_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return ( - int(year_ctype.value), - int(month_ctype.value), - int(day_ctype.value), - int(hour_ctype.value), - int(minute_ctype.value), - ) + error_code = self._library.niFgen_GetExtCalLastDateAndTime(vi_ctype, None if year_ctype is None else (ctypes.pointer(year_ctype)), None if month_ctype is None else (ctypes.pointer(month_ctype)), None if day_ctype is None else (ctypes.pointer(day_ctype)), None if hour_ctype is None else (ctypes.pointer(hour_ctype)), None if minute_ctype is None else (ctypes.pointer(minute_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return int(year_ctype.value), int(month_ctype.value), int(day_ctype.value), int(hour_ctype.value), int(minute_ctype.value) @ivi_synchronized def get_ext_cal_last_temp(self): - r"""get_ext_cal_last_temp + r'''get_ext_cal_last_temp Returns the temperature at the last successful external calibration. The temperature is returned in degrees Celsius. @@ -4774,21 +4079,16 @@ def get_ext_cal_last_temp(self): temperature (float): Specifies the temperature at the last successful calibration in degrees Celsius. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 temperature_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niFgen_GetExtCalLastTemp( - vi_ctype, - None if temperature_ctype is None else (ctypes.pointer(temperature_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_GetExtCalLastTemp(vi_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(temperature_ctype.value) @ivi_synchronized def get_ext_cal_recommended_interval(self): - r"""get_ext_cal_recommended_interval + r'''get_ext_cal_recommended_interval Returns the recommended interval between external calibrations in months. @@ -4797,20 +4097,16 @@ def get_ext_cal_recommended_interval(self): months (hightime.timedelta): Specifies the recommended interval between external calibrations in months. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 months_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_GetExtCalRecommendedInterval( - vi_ctype, None if months_ctype is None else (ctypes.pointer(months_ctype)) - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_GetExtCalRecommendedInterval(vi_ctype, None if months_ctype is None else (ctypes.pointer(months_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return _converters.convert_month_to_timedelta(int(months_ctype.value)) @ivi_synchronized def get_hardware_state(self): - r"""get_hardware_state + r'''get_hardware_state Returns the current hardware state of the device and, if the device is in the hardware error state, the current hardware error. @@ -4834,46 +4130,42 @@ def get_hardware_state(self): | HardwareState.HARDWARE_ERROR | There is a hardware error. | +-----------------------------------------+--------------------------------------------+ - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 state_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_GetHardwareState( - vi_ctype, None if state_ctype is None else (ctypes.pointer(state_ctype)) - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_GetHardwareState(vi_ctype, None if state_ctype is None else (ctypes.pointer(state_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return enums.HardwareState(state_ctype.value) @ivi_synchronized def get_ext_cal_last_date_and_time(self): - """get_ext_cal_last_date_and_time + '''get_ext_cal_last_date_and_time Returns the date and time of the last successful external calibration. The time returned is 24-hour (military) local time; for example, if the device was calibrated at 2:30 PM, this method returns 14 for the **hour** parameter and 30 for the **minute** parameter. Returns: month (hightime.datetime): Indicates date and time of the last calibration. - """ + ''' year, month, day, hour, minute = self._get_ext_cal_last_date_and_time() return hightime.datetime(year, month, day, hour, minute) @ivi_synchronized def get_self_cal_last_date_and_time(self): - """get_self_cal_last_date_and_time + '''get_self_cal_last_date_and_time Returns the date and time of the last successful self-calibration. Returns: month (hightime.datetime): Returns the date and time the device was last calibrated. - """ + ''' year, month, day, hour, minute = self._get_self_cal_last_date_and_time() return hightime.datetime(year, month, day, hour, minute) @ivi_synchronized def _get_self_cal_last_date_and_time(self): - r"""_get_self_cal_last_date_and_time + r'''_get_self_cal_last_date_and_time Returns the date and time of the last successful self-calibration. @@ -4898,35 +4190,20 @@ def _get_self_cal_last_date_and_time(self): minute (int): Specifies the minute of the last successful calibration. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 year_ctype = _visatype.ViInt32() # case S220 month_ctype = _visatype.ViInt32() # case S220 day_ctype = _visatype.ViInt32() # case S220 hour_ctype = _visatype.ViInt32() # case S220 minute_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_GetSelfCalLastDateAndTime( - vi_ctype, - None if year_ctype is None else (ctypes.pointer(year_ctype)), - None if month_ctype is None else (ctypes.pointer(month_ctype)), - None if day_ctype is None else (ctypes.pointer(day_ctype)), - None if hour_ctype is None else (ctypes.pointer(hour_ctype)), - None if minute_ctype is None else (ctypes.pointer(minute_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return ( - int(year_ctype.value), - int(month_ctype.value), - int(day_ctype.value), - int(hour_ctype.value), - int(minute_ctype.value), - ) + error_code = self._library.niFgen_GetSelfCalLastDateAndTime(vi_ctype, None if year_ctype is None else (ctypes.pointer(year_ctype)), None if month_ctype is None else (ctypes.pointer(month_ctype)), None if day_ctype is None else (ctypes.pointer(day_ctype)), None if hour_ctype is None else (ctypes.pointer(hour_ctype)), None if minute_ctype is None else (ctypes.pointer(minute_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return int(year_ctype.value), int(month_ctype.value), int(day_ctype.value), int(hour_ctype.value), int(minute_ctype.value) @ivi_synchronized def get_self_cal_last_temp(self): - r"""get_self_cal_last_temp + r'''get_self_cal_last_temp Returns the temperature at the last successful self-calibration. The temperature is returned in degrees Celsius. @@ -4935,21 +4212,16 @@ def get_self_cal_last_temp(self): temperature (float): Specifies the temperature at the last successful calibration in degrees Celsius. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 temperature_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niFgen_GetSelfCalLastTemp( - vi_ctype, - None if temperature_ctype is None else (ctypes.pointer(temperature_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_GetSelfCalLastTemp(vi_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(temperature_ctype.value) @ivi_synchronized def get_self_cal_supported(self): - r"""get_self_cal_supported + r'''get_self_cal_supported Returns whether the device supports self–calibration. @@ -4964,23 +4236,16 @@ def get_self_cal_supported(self): | False | Self–calibration is not supported. | +-------+------------------------------------+ - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 self_cal_supported_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niFgen_GetSelfCalSupported( - vi_ctype, - None - if self_cal_supported_ctype is None - else (ctypes.pointer(self_cal_supported_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_GetSelfCalSupported(vi_ctype, None if self_cal_supported_ctype is None else (ctypes.pointer(self_cal_supported_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(self_cal_supported_ctype.value) @ivi_synchronized def import_attribute_configuration_buffer(self, configuration): - r"""import_attribute_configuration_buffer + r'''import_attribute_configuration_buffer Imports a property configuration to the session from the specified configuration buffer. @@ -4997,28 +4262,18 @@ def import_attribute_configuration_buffer(self, configuration): configuration (bytes): Specifies the byte array buffer that contains the property configuration to import. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - size_in_bytes_ctype = _visatype.ViInt32( - 0 if configuration is None else len(configuration) - ) # case S160 - configuration_converted = _converters.convert_to_bytes( - configuration - ) # case B520 - configuration_ctype = get_ctypes_pointer_for_buffer( - value=configuration_converted, library_type=_visatype.ViInt8 - ) # case B520 - error_code = self._library.niFgen_ImportAttributeConfigurationBuffer( - vi_ctype, size_in_bytes_ctype, configuration_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + size_in_bytes_ctype = _visatype.ViInt32(0 if configuration is None else len(configuration)) # case S160 + configuration_converted = _converters.convert_to_bytes(configuration) # case B520 + configuration_ctype = get_ctypes_pointer_for_buffer(value=configuration_converted, library_type=_visatype.ViInt8) # case B520 + error_code = self._library.niFgen_ImportAttributeConfigurationBuffer(vi_ctype, size_in_bytes_ctype, configuration_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def import_attribute_configuration_file(self, file_path): - r"""import_attribute_configuration_file + r'''import_attribute_configuration_file Imports a property configuration to the session from the specified file. @@ -5037,23 +4292,15 @@ def import_attribute_configuration_file(self, file_path): method returns an error. **Default File Extension:** .nifgenconfig - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer( - file_path.encode(self._encoding) - ) # case C020 - error_code = self._library.niFgen_ImportAttributeConfigurationFile( - vi_ctype, file_path_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 + error_code = self._library.niFgen_ImportAttributeConfigurationFile(vi_ctype, file_path_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return - def _initialize_with_channels( - self, resource_name, channel_name=None, reset_device=False, option_string="" - ): - r"""_initialize_with_channels + def _initialize_with_channels(self, resource_name, channel_name=None, reset_device=False, option_string=""): + r'''_initialize_with_channels Creates and returns a new NI-FGEN session to the specified channel of a waveform generator that is used in all subsequent NI-FGEN method @@ -5182,53 +4429,33 @@ def _initialize_with_channels( vi (int): Returns a session handle that you can use to identify the device in all subsequent NI-FGEN method calls. - """ - resource_name_ctype = ctypes.create_string_buffer( - resource_name.encode(self._encoding) - ) # case C020 - channel_name_ctype = ctypes.create_string_buffer( - _converters.convert_repeated_capabilities_without_prefix( - channel_name - ).encode(self._encoding) - ) # case C040 + ''' + resource_name_ctype = ctypes.create_string_buffer(resource_name.encode(self._encoding)) # case C020 + channel_name_ctype = ctypes.create_string_buffer(_converters.convert_repeated_capabilities_without_prefix(channel_name).encode(self._encoding)) # case C040 reset_device_ctype = _visatype.ViBoolean(reset_device) # case S150 - option_string_ctype = ctypes.create_string_buffer( - _converters.convert_init_with_options_dictionary(option_string).encode( - self._encoding - ) - ) # case C040 + option_string_ctype = ctypes.create_string_buffer(_converters.convert_init_with_options_dictionary(option_string).encode(self._encoding)) # case C040 vi_ctype = _visatype.ViSession() # case S220 - error_code = self._library.niFgen_InitializeWithChannels( - resource_name_ctype, - channel_name_ctype, - reset_device_ctype, - option_string_ctype, - None if vi_ctype is None else (ctypes.pointer(vi_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_InitializeWithChannels(resource_name_ctype, channel_name_ctype, reset_device_ctype, option_string_ctype, None if vi_ctype is None else (ctypes.pointer(vi_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(vi_ctype.value) @ivi_synchronized def _initiate_generation(self): - r"""_initiate_generation + r'''_initiate_generation Initiates signal generation. If you want to abort signal generation, call the abort method. After the signal generation is aborted, you can call the initiate method to cause the signal generator to produce a signal again. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_InitiateGeneration(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def is_done(self): - r"""is_done + r'''is_done Determines whether the current generation is complete. This method sets the **done** parameter to True if the session is in the Idle or @@ -5249,20 +4476,16 @@ def is_done(self): | False | Generation is not complete. | +-------+-----------------------------+ - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 done_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niFgen_IsDone( - vi_ctype, None if done_ctype is None else (ctypes.pointer(done_ctype)) - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_IsDone(vi_ctype, None if done_ctype is None else (ctypes.pointer(done_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(done_ctype.value) @ivi_synchronized def query_arb_seq_capabilities(self): - r"""query_arb_seq_capabilities + r'''query_arb_seq_capabilities Returns the properties of the signal generator that are related to creating arbitrary sequences (the max_num_sequences, @@ -5287,40 +4510,19 @@ def query_arb_seq_capabilities(self): arbitrary waveform in a sequence. NI-FGEN obtains this value from the max_loop_count property. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 maximum_number_of_sequences_ctype = _visatype.ViInt32() # case S220 minimum_sequence_length_ctype = _visatype.ViInt32() # case S220 maximum_sequence_length_ctype = _visatype.ViInt32() # case S220 maximum_loop_count_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_QueryArbSeqCapabilities( - vi_ctype, - None - if maximum_number_of_sequences_ctype is None - else (ctypes.pointer(maximum_number_of_sequences_ctype)), - None - if minimum_sequence_length_ctype is None - else (ctypes.pointer(minimum_sequence_length_ctype)), - None - if maximum_sequence_length_ctype is None - else (ctypes.pointer(maximum_sequence_length_ctype)), - None - if maximum_loop_count_ctype is None - else (ctypes.pointer(maximum_loop_count_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return ( - int(maximum_number_of_sequences_ctype.value), - int(minimum_sequence_length_ctype.value), - int(maximum_sequence_length_ctype.value), - int(maximum_loop_count_ctype.value), - ) + error_code = self._library.niFgen_QueryArbSeqCapabilities(vi_ctype, None if maximum_number_of_sequences_ctype is None else (ctypes.pointer(maximum_number_of_sequences_ctype)), None if minimum_sequence_length_ctype is None else (ctypes.pointer(minimum_sequence_length_ctype)), None if maximum_sequence_length_ctype is None else (ctypes.pointer(maximum_sequence_length_ctype)), None if maximum_loop_count_ctype is None else (ctypes.pointer(maximum_loop_count_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return int(maximum_number_of_sequences_ctype.value), int(minimum_sequence_length_ctype.value), int(maximum_sequence_length_ctype.value), int(maximum_loop_count_ctype.value) @ivi_synchronized def query_arb_wfm_capabilities(self): - r"""query_arb_wfm_capabilities + r'''query_arb_wfm_capabilities Returns the properties of the signal generator that are related to creating arbitrary waveforms. These properties are the maximum number of @@ -5352,40 +4554,19 @@ def query_arb_wfm_capabilities(self): a waveform. NI-FGEN obtains this value from the max_waveform_size property. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 maximum_number_of_waveforms_ctype = _visatype.ViInt32() # case S220 waveform_quantum_ctype = _visatype.ViInt32() # case S220 minimum_waveform_size_ctype = _visatype.ViInt32() # case S220 maximum_waveform_size_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niFgen_QueryArbWfmCapabilities( - vi_ctype, - None - if maximum_number_of_waveforms_ctype is None - else (ctypes.pointer(maximum_number_of_waveforms_ctype)), - None - if waveform_quantum_ctype is None - else (ctypes.pointer(waveform_quantum_ctype)), - None - if minimum_waveform_size_ctype is None - else (ctypes.pointer(minimum_waveform_size_ctype)), - None - if maximum_waveform_size_ctype is None - else (ctypes.pointer(maximum_waveform_size_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return ( - int(maximum_number_of_waveforms_ctype.value), - int(waveform_quantum_ctype.value), - int(minimum_waveform_size_ctype.value), - int(maximum_waveform_size_ctype.value), - ) + error_code = self._library.niFgen_QueryArbWfmCapabilities(vi_ctype, None if maximum_number_of_waveforms_ctype is None else (ctypes.pointer(maximum_number_of_waveforms_ctype)), None if waveform_quantum_ctype is None else (ctypes.pointer(waveform_quantum_ctype)), None if minimum_waveform_size_ctype is None else (ctypes.pointer(minimum_waveform_size_ctype)), None if maximum_waveform_size_ctype is None else (ctypes.pointer(maximum_waveform_size_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return int(maximum_number_of_waveforms_ctype.value), int(waveform_quantum_ctype.value), int(minimum_waveform_size_ctype.value), int(maximum_waveform_size_ctype.value) @ivi_synchronized def query_freq_list_capabilities(self): - r"""query_freq_list_capabilities + r'''query_freq_list_capabilities Returns the properties of the signal generator that are related to creating frequency lists. These properties are @@ -5421,7 +4602,7 @@ def query_freq_list_capabilities(self): frequency list. NI-FGEN obtains this value from the freq_list_duration_quantum property. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 maximum_number_of_freq_lists_ctype = _visatype.ViInt32() # case S220 minimum_frequency_list_length_ctype = _visatype.ViInt32() # case S220 @@ -5429,42 +4610,13 @@ def query_freq_list_capabilities(self): minimum_frequency_list_duration_ctype = _visatype.ViReal64() # case S220 maximum_frequency_list_duration_ctype = _visatype.ViReal64() # case S220 frequency_list_duration_quantum_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niFgen_QueryFreqListCapabilities( - vi_ctype, - None - if maximum_number_of_freq_lists_ctype is None - else (ctypes.pointer(maximum_number_of_freq_lists_ctype)), - None - if minimum_frequency_list_length_ctype is None - else (ctypes.pointer(minimum_frequency_list_length_ctype)), - None - if maximum_frequency_list_length_ctype is None - else (ctypes.pointer(maximum_frequency_list_length_ctype)), - None - if minimum_frequency_list_duration_ctype is None - else (ctypes.pointer(minimum_frequency_list_duration_ctype)), - None - if maximum_frequency_list_duration_ctype is None - else (ctypes.pointer(maximum_frequency_list_duration_ctype)), - None - if frequency_list_duration_quantum_ctype is None - else (ctypes.pointer(frequency_list_duration_quantum_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return ( - int(maximum_number_of_freq_lists_ctype.value), - int(minimum_frequency_list_length_ctype.value), - int(maximum_frequency_list_length_ctype.value), - float(minimum_frequency_list_duration_ctype.value), - float(maximum_frequency_list_duration_ctype.value), - float(frequency_list_duration_quantum_ctype.value), - ) + error_code = self._library.niFgen_QueryFreqListCapabilities(vi_ctype, None if maximum_number_of_freq_lists_ctype is None else (ctypes.pointer(maximum_number_of_freq_lists_ctype)), None if minimum_frequency_list_length_ctype is None else (ctypes.pointer(minimum_frequency_list_length_ctype)), None if maximum_frequency_list_length_ctype is None else (ctypes.pointer(maximum_frequency_list_length_ctype)), None if minimum_frequency_list_duration_ctype is None else (ctypes.pointer(minimum_frequency_list_duration_ctype)), None if maximum_frequency_list_duration_ctype is None else (ctypes.pointer(maximum_frequency_list_duration_ctype)), None if frequency_list_duration_quantum_ctype is None else (ctypes.pointer(frequency_list_duration_quantum_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return int(maximum_number_of_freq_lists_ctype.value), int(minimum_frequency_list_length_ctype.value), int(maximum_frequency_list_length_ctype.value), float(minimum_frequency_list_duration_ctype.value), float(maximum_frequency_list_duration_ctype.value), float(frequency_list_duration_quantum_ctype.value) @ivi_synchronized def read_current_temperature(self): - r"""read_current_temperature + r'''read_current_temperature Reads the current onboard temperature of the device. The temperature is returned in degrees Celsius. @@ -5473,68 +4625,57 @@ def read_current_temperature(self): temperature (float): Returns the current temperature read from onboard temperature sensors, in degrees Celsius. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 temperature_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niFgen_ReadCurrentTemperature( - vi_ctype, - None if temperature_ctype is None else (ctypes.pointer(temperature_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niFgen_ReadCurrentTemperature(vi_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(temperature_ctype.value) @ivi_synchronized def reset_device(self): - r"""reset_device + r'''reset_device Performs a hard reset on the device. Generation is stopped, all routes are released, external bidirectional terminals are tristated, FPGAs are reset, hardware is configured to its default state, and all session properties are reset to their default states. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_ResetDevice(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def reset_with_defaults(self): - r"""reset_with_defaults + r'''reset_with_defaults Resets the instrument and reapplies initial user–specified settings from the logical name that was used to initialize the session. If the session was created without a logical name, this method is equivalent to the reset method. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_ResetWithDefaults(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def self_cal(self): - r"""self_cal + r'''self_cal Performs a full internal self-calibration on the device. If the calibration is successful, new calibration data and constants are stored in the onboard EEPROM. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_SelfCal(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def wait_until_done(self, max_time=hightime.timedelta(seconds=10.0)): - r"""wait_until_done + r'''wait_until_done Waits until the device is done generating or until the maximum time has expired. @@ -5542,19 +4683,15 @@ def wait_until_done(self, max_time=hightime.timedelta(seconds=10.0)): Args: max_time (hightime.timedelta, datetime.timedelta, or int in milliseconds): Specifies the timeout value in milliseconds. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - max_time_ctype = _converters.convert_timedelta_to_milliseconds_int32( - max_time - ) # case S140 + max_time_ctype = _converters.convert_timedelta_to_milliseconds_int32(max_time) # case S140 error_code = self._library.niFgen_WaitUntilDone(vi_ctype, max_time_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def _close(self): - r"""_close + r'''_close Performs the following operations: @@ -5578,17 +4715,15 @@ def _close(self): Note: After calling _close, you cannot use NI-FGEN again until you call the init or InitWithOptions methods. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_close(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def self_test(self): - """self_test + '''self_test Runs the instrument self-test routine and returns the test result(s). @@ -5610,7 +4745,7 @@ def self_test(self): self_test method runs. If you use the self_test method, your device may not be in its previously configured state after the method runs. - """ + ''' code, msg = self._self_test() if code: raise errors.SelfTestError(code, msg) @@ -5618,7 +4753,7 @@ def self_test(self): @ivi_synchronized def reset(self): - r"""reset + r'''reset Resets the instrument to a known state. This method aborts the generation, clears all routes, and resets session properties to the @@ -5628,17 +4763,15 @@ def reset(self): Note: For the NI 5401/5404/5411/5431, this method exhibits the same behavior as the reset_device method. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niFgen_reset(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _self_test(self): - r"""_self_test + r'''_self_test Runs the instrument self-test routine and returns the test result(s). @@ -5664,20 +4797,13 @@ def _self_test(self): You must pass a ViChar array with at least 256 bytes. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 self_test_result_ctype = _visatype.ViInt16() # case S220 self_test_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niFgen_self_test( - vi_ctype, - None - if self_test_result_ctype is None - else (ctypes.pointer(self_test_result_ctype)), - self_test_message_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return int(self_test_result_ctype.value), self_test_message_ctype.value.decode( - self._encoding - ) + error_code = self._library.niFgen_self_test(vi_ctype, None if self_test_result_ctype is None else (ctypes.pointer(self_test_result_ctype)), self_test_message_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return int(self_test_result_ctype.value), self_test_message_ctype.value.decode(self._encoding) + + + diff --git a/generated/nifgen/nifgen/unit_tests/_matchers.py b/generated/nifgen/nifgen/unit_tests/_matchers.py index ab40701a8..75961fcbb 100644 --- a/generated/nifgen/nifgen/unit_tests/_matchers.py +++ b/generated/nifgen/nifgen/unit_tests/_matchers.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # This file was generated -"""Matcher classes used by unit tests in order to set mock expectations. +'''Matcher classes used by unit tests in order to set mock expectations. These work well with our visatype definitions. -""" +''' import ctypes import nifgen._visatype as _visatype @@ -21,27 +21,15 @@ def __init__(self, expected_type, expected_value): def __eq__(self, other): if not isinstance(other, self.expected_type): - print( - "{0}: Unexpected type. Expected: {1}. Received: {2}".format( - self.__class__.__name__, self.expected_type, type(other) - ) - ) + print("{0}: Unexpected type. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_type, type(other))) return False if other.value != self.expected_value: - print( - "{0}: Unexpected value. Expected: {1}. Received: {2}".format( - self.__class__.__name__, self.expected_value, other.value - ) - ) + print("{0}: Unexpected value. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_value, other.value)) return False return True def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_type), - pp.pformat(self.expected_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) class _PointerMatcher(object): @@ -50,18 +38,12 @@ def __init__(self, expected_type): def __eq__(self, other): if not isinstance(other, ctypes.POINTER(self.expected_type)): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - ctypes.POINTER(self.expected_type), type(other) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(ctypes.POINTER(self.expected_type), type(other))) return False return True def __repr__(self): - return "{0}({1})".format( - self.__class__.__name__, pp.pformat(self.expected_type) - ) + return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_type)) class _BufferMatcher(object): @@ -88,47 +70,29 @@ def __eq__(self, other): pass # Because of object lifetimes, we may need to mock the other instance and provide lists instead of the actual array - if not isinstance(other, self.expected_type) and not isinstance( - other, list - ): - print( - "Unexpected type. Expected: {0} or {1}. Received: {2}".format( - self.expected_type, list, type(other) - ) - ) + if not isinstance(other, self.expected_type) and not isinstance(other, list): + print("Unexpected type. Expected: {0} or {1}. Received: {2}".format(self.expected_type, list, type(other))) return False if self.expected_size != len(other): - print( - "Unexpected length. Expected: {0}. Received: {1}".format( - self.expected_size, len(other) - ) - ) + print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(other))) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for i in range(0, len(self.expected_value)): if self.expected_value[i] != other[i]: - print( - "Unexpected value at index {0}. Expected: {1}. Received: {2}".format( - i, self.expected_value[i], other[i] - ) - ) + print("Unexpected value at index {0}. Expected: {1}. Received: {2}".format(i, self.expected_value[i], other[i])) return False return True def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self._expected_element_type), - pp.pformat(self._expected_size_or_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self._expected_element_type), pp.pformat(self._expected_size_or_value)) def __str__(self): - ret_str = self.__repr__() + "\n" - ret_str += " expected_type = " + str(self.expected_type) + "\n" - ret_str += " expected_value = " + str(self.expected_value) + "\n" - ret_str += " expected_size = " + str(self.expected_size) + "\n" + ret_str = self.__repr__() + '\n' + ret_str += ' expected_type = ' + str(self.expected_type) + '\n' + ret_str += ' expected_value = ' + str(self.expected_value) + '\n' + ret_str += ' expected_size = ' + str(self.expected_size) + '\n' return ret_str @@ -148,37 +112,21 @@ def __eq__(self, other): pass if not isinstance(other, ctypes.Array): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_type, type(other) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(other))) return False - if ( - len(other) < len(self.expected_string_value) + 1 - ): # +1 for NULL terminating character - print( - "Unexpected length in C string. Expected at least: {0}. Received {1}".format( - len(other), len(self.expected_string_value) + 1 - ) - ) + if len(other) < len(self.expected_string_value) + 1: # +1 for NULL terminating character + print("Unexpected length in C string. Expected at least: {0}. Received {1}".format(len(other), len(self.expected_string_value) + 1)) return False if not isinstance(other[0], bytes): print("Unexpected type. Not a string. Received: {0}".format(type(other[0]))) return False if other.value.decode("ascii") != self.expected_string_value: - print( - "Unexpected value. Expected {0}. Received: {1}".format( - self.expected_string_value, other.value.decode - ) - ) + print("Unexpected value. Expected {0}. Received: {1}".format(self.expected_string_value, other.value.decode)) return False return True def __repr__(self): - return "{0}({1})".format( - self.__class__.__name__, pp.pformat(self.expected_string_value) - ) + return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_string_value)) # Custom Type @@ -191,11 +139,7 @@ def _compare_ctype_structs(expected, actual): expected_val = getattr(expected, field_name) actual_val = getattr(actual, field_name) if expected_val != actual_val: - print( - "Unexpected value field {0}. Expected: {1}. Received: {2}".format( - field_name, expected_val, actual_val - ) - ) + print("Unexpected value field {0}. Expected: {1}. Received: {2}".format(field_name, expected_val, actual_val)) return False return True @@ -207,20 +151,12 @@ def __init__(self, expected_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_type, type(actual) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) return False return _compare_ctype_structs(self.expected_value, actual) def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_type), - pp.pformat(self.expected_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) class CustomTypeBufferMatcher(object): @@ -232,48 +168,30 @@ def __init__(self, expected_element_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print( - "Unexpected array type. Expected: {0}. Received: {1}".format( - self.expected_type, type(actual) - ) - ) + print("Unexpected array type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) return False if self.expected_size != len(actual): - print( - "Unexpected length. Expected: {0}. Received: {1}".format( - self.expected_size, len(actual) - ) - ) + print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(actual))) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for a, e in zip(actual, self.expected_value): if not isinstance(a, self.expected_element_type): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_element_type, type(a) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_element_type, type(a))) return False if not _compare_ctype_structs(e, a): return False return True def __repr__(self): - expected_val_repr = ( - "[" + ", ".join([x.__repr__() for x in self.expected_value]) + "]" - ) - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_element_type), - expected_val_repr, - ) + expected_val_repr = '[' + ', '.join([x.__repr__() for x in self.expected_value]) + ']' + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_element_type), expected_val_repr) def __str__(self): - ret_str = self.__repr__() + "\n" - ret_str += " expected_type = " + str(self.expected_type) + "\n" - ret_str += " expected_size = " + str(self.expected_size) + "\n" + ret_str = self.__repr__() + '\n' + ret_str += ' expected_type = ' + str(self.expected_type) + '\n' + ret_str += ' expected_size = ' + str(self.expected_size) + '\n' return ret_str @@ -282,9 +200,7 @@ def __str__(self): class ViBooleanMatcher(_ScalarMatcher): def __init__(self, expected_value): - _ScalarMatcher.__init__( - self, _visatype.ViBoolean, 1 if expected_value is True else 0 - ) + _ScalarMatcher.__init__(self, _visatype.ViBoolean, 1 if expected_value is True else 0) class ViSessionMatcher(_ScalarMatcher): @@ -396,3 +312,6 @@ def __init__(self, expected_size_or_value): class ViSessionBufferMatcher(_BufferMatcher): def __init__(self, expected_size_or_value): _BufferMatcher.__init__(self, _visatype.ViSession, expected_size_or_value) + + + diff --git a/generated/nifgen/nifgen/unit_tests/_mock_helper.py b/generated/nifgen/nifgen/unit_tests/_mock_helper.py index 7e573c88b..a0ba88469 100644 --- a/generated/nifgen/nifgen/unit_tests/_mock_helper.py +++ b/generated/nifgen/nifgen/unit_tests/_mock_helper.py @@ -16,212 +16,206 @@ def __init__(self, function, param=None): class SideEffectsHelper(object): def __init__(self): self._defaults = {} - self._defaults["AbortGeneration"] = {} - self._defaults["AbortGeneration"]["return"] = 0 - self._defaults["AllocateNamedWaveform"] = {} - self._defaults["AllocateNamedWaveform"]["return"] = 0 - self._defaults["AllocateWaveform"] = {} - self._defaults["AllocateWaveform"]["return"] = 0 - self._defaults["AllocateWaveform"]["waveformHandle"] = None - self._defaults["ClearArbMemory"] = {} - self._defaults["ClearArbMemory"]["return"] = 0 - self._defaults["ClearArbSequence"] = {} - self._defaults["ClearArbSequence"]["return"] = 0 - self._defaults["ClearArbWaveform"] = {} - self._defaults["ClearArbWaveform"]["return"] = 0 - self._defaults["ClearFreqList"] = {} - self._defaults["ClearFreqList"]["return"] = 0 - self._defaults["ClearUserStandardWaveform"] = {} - self._defaults["ClearUserStandardWaveform"]["return"] = 0 - self._defaults["Commit"] = {} - self._defaults["Commit"]["return"] = 0 - self._defaults["ConfigureArbSequence"] = {} - self._defaults["ConfigureArbSequence"]["return"] = 0 - self._defaults["ConfigureArbWaveform"] = {} - self._defaults["ConfigureArbWaveform"]["return"] = 0 - self._defaults["ConfigureFreqList"] = {} - self._defaults["ConfigureFreqList"]["return"] = 0 - self._defaults["ConfigureStandardWaveform"] = {} - self._defaults["ConfigureStandardWaveform"]["return"] = 0 - self._defaults["CreateAdvancedArbSequence"] = {} - self._defaults["CreateAdvancedArbSequence"]["return"] = 0 - self._defaults["CreateAdvancedArbSequence"]["coercedMarkersArray"] = None - self._defaults["CreateAdvancedArbSequence"]["sequenceHandle"] = None - self._defaults["CreateArbSequence"] = {} - self._defaults["CreateArbSequence"]["return"] = 0 - self._defaults["CreateArbSequence"]["sequenceHandle"] = None - self._defaults["CreateFreqList"] = {} - self._defaults["CreateFreqList"]["return"] = 0 - self._defaults["CreateFreqList"]["frequencyListHandle"] = None - self._defaults["CreateWaveformF64"] = {} - self._defaults["CreateWaveformF64"]["return"] = 0 - self._defaults["CreateWaveformF64"]["waveformHandle"] = None - self._defaults["CreateWaveformFromFileF64"] = {} - self._defaults["CreateWaveformFromFileF64"]["return"] = 0 - self._defaults["CreateWaveformFromFileF64"]["waveformHandle"] = None - self._defaults["CreateWaveformFromFileI16"] = {} - self._defaults["CreateWaveformFromFileI16"]["return"] = 0 - self._defaults["CreateWaveformFromFileI16"]["waveformHandle"] = None - self._defaults["CreateWaveformI16"] = {} - self._defaults["CreateWaveformI16"]["return"] = 0 - self._defaults["CreateWaveformI16"]["waveformHandle"] = None - self._defaults["DefineUserStandardWaveform"] = {} - self._defaults["DefineUserStandardWaveform"]["return"] = 0 - self._defaults["DeleteNamedWaveform"] = {} - self._defaults["DeleteNamedWaveform"]["return"] = 0 - self._defaults["DeleteScript"] = {} - self._defaults["DeleteScript"]["return"] = 0 - self._defaults["Disable"] = {} - self._defaults["Disable"]["return"] = 0 - self._defaults["ExportAttributeConfigurationBuffer"] = {} - self._defaults["ExportAttributeConfigurationBuffer"]["return"] = 0 - self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] = None - self._defaults["ExportAttributeConfigurationFile"] = {} - self._defaults["ExportAttributeConfigurationFile"]["return"] = 0 - self._defaults["GetAttributeViBoolean"] = {} - self._defaults["GetAttributeViBoolean"]["return"] = 0 - self._defaults["GetAttributeViBoolean"]["attributeValue"] = None - self._defaults["GetAttributeViInt32"] = {} - self._defaults["GetAttributeViInt32"]["return"] = 0 - self._defaults["GetAttributeViInt32"]["attributeValue"] = None - self._defaults["GetAttributeViReal64"] = {} - self._defaults["GetAttributeViReal64"]["return"] = 0 - self._defaults["GetAttributeViReal64"]["attributeValue"] = None - self._defaults["GetAttributeViString"] = {} - self._defaults["GetAttributeViString"]["return"] = 0 - self._defaults["GetAttributeViString"]["attributeValue"] = None - self._defaults["GetChannelName"] = {} - self._defaults["GetChannelName"]["return"] = 0 - self._defaults["GetChannelName"]["channelString"] = None - self._defaults["GetError"] = {} - self._defaults["GetError"]["return"] = 0 - self._defaults["GetError"]["errorCode"] = None - self._defaults["GetError"]["errorDescription"] = None - self._defaults["GetExtCalLastDateAndTime"] = {} - self._defaults["GetExtCalLastDateAndTime"]["return"] = 0 - self._defaults["GetExtCalLastDateAndTime"]["year"] = None - self._defaults["GetExtCalLastDateAndTime"]["month"] = None - self._defaults["GetExtCalLastDateAndTime"]["day"] = None - self._defaults["GetExtCalLastDateAndTime"]["hour"] = None - self._defaults["GetExtCalLastDateAndTime"]["minute"] = None - self._defaults["GetExtCalLastTemp"] = {} - self._defaults["GetExtCalLastTemp"]["return"] = 0 - self._defaults["GetExtCalLastTemp"]["temperature"] = None - self._defaults["GetExtCalRecommendedInterval"] = {} - self._defaults["GetExtCalRecommendedInterval"]["return"] = 0 - self._defaults["GetExtCalRecommendedInterval"]["months"] = None - self._defaults["GetHardwareState"] = {} - self._defaults["GetHardwareState"]["return"] = 0 - self._defaults["GetHardwareState"]["state"] = None - self._defaults["GetLastExtCalLastDateAndTime"] = {} - self._defaults["GetLastExtCalLastDateAndTime"]["return"] = 0 - self._defaults["GetLastExtCalLastDateAndTime"]["month"] = None - self._defaults["GetLastSelfCalLastDateAndTime"] = {} - self._defaults["GetLastSelfCalLastDateAndTime"]["return"] = 0 - self._defaults["GetLastSelfCalLastDateAndTime"]["month"] = None - self._defaults["GetSelfCalLastDateAndTime"] = {} - self._defaults["GetSelfCalLastDateAndTime"]["return"] = 0 - self._defaults["GetSelfCalLastDateAndTime"]["year"] = None - self._defaults["GetSelfCalLastDateAndTime"]["month"] = None - self._defaults["GetSelfCalLastDateAndTime"]["day"] = None - self._defaults["GetSelfCalLastDateAndTime"]["hour"] = None - self._defaults["GetSelfCalLastDateAndTime"]["minute"] = None - self._defaults["GetSelfCalLastTemp"] = {} - self._defaults["GetSelfCalLastTemp"]["return"] = 0 - self._defaults["GetSelfCalLastTemp"]["temperature"] = None - self._defaults["GetSelfCalSupported"] = {} - self._defaults["GetSelfCalSupported"]["return"] = 0 - self._defaults["GetSelfCalSupported"]["selfCalSupported"] = None - self._defaults["ImportAttributeConfigurationBuffer"] = {} - self._defaults["ImportAttributeConfigurationBuffer"]["return"] = 0 - self._defaults["ImportAttributeConfigurationFile"] = {} - self._defaults["ImportAttributeConfigurationFile"]["return"] = 0 - self._defaults["InitializeWithChannels"] = {} - self._defaults["InitializeWithChannels"]["return"] = 0 - self._defaults["InitializeWithChannels"]["vi"] = None - self._defaults["InitiateGeneration"] = {} - self._defaults["InitiateGeneration"]["return"] = 0 - self._defaults["IsDone"] = {} - self._defaults["IsDone"]["return"] = 0 - self._defaults["IsDone"]["done"] = None - self._defaults["LockSession"] = {} - self._defaults["LockSession"]["return"] = 0 - self._defaults["LockSession"]["callerHasLock"] = None - self._defaults["QueryArbSeqCapabilities"] = {} - self._defaults["QueryArbSeqCapabilities"]["return"] = 0 - self._defaults["QueryArbSeqCapabilities"]["maximumNumberOfSequences"] = None - self._defaults["QueryArbSeqCapabilities"]["minimumSequenceLength"] = None - self._defaults["QueryArbSeqCapabilities"]["maximumSequenceLength"] = None - self._defaults["QueryArbSeqCapabilities"]["maximumLoopCount"] = None - self._defaults["QueryArbWfmCapabilities"] = {} - self._defaults["QueryArbWfmCapabilities"]["return"] = 0 - self._defaults["QueryArbWfmCapabilities"]["maximumNumberOfWaveforms"] = None - self._defaults["QueryArbWfmCapabilities"]["waveformQuantum"] = None - self._defaults["QueryArbWfmCapabilities"]["minimumWaveformSize"] = None - self._defaults["QueryArbWfmCapabilities"]["maximumWaveformSize"] = None - self._defaults["QueryFreqListCapabilities"] = {} - self._defaults["QueryFreqListCapabilities"]["return"] = 0 - self._defaults["QueryFreqListCapabilities"]["maximumNumberOfFreqLists"] = None - self._defaults["QueryFreqListCapabilities"]["minimumFrequencyListLength"] = None - self._defaults["QueryFreqListCapabilities"]["maximumFrequencyListLength"] = None - self._defaults["QueryFreqListCapabilities"][ - "minimumFrequencyListDuration" - ] = None - self._defaults["QueryFreqListCapabilities"][ - "maximumFrequencyListDuration" - ] = None - self._defaults["QueryFreqListCapabilities"][ - "frequencyListDurationQuantum" - ] = None - self._defaults["ReadCurrentTemperature"] = {} - self._defaults["ReadCurrentTemperature"]["return"] = 0 - self._defaults["ReadCurrentTemperature"]["temperature"] = None - self._defaults["ResetDevice"] = {} - self._defaults["ResetDevice"]["return"] = 0 - self._defaults["ResetWithDefaults"] = {} - self._defaults["ResetWithDefaults"]["return"] = 0 - self._defaults["SelfCal"] = {} - self._defaults["SelfCal"]["return"] = 0 - self._defaults["SendSoftwareEdgeTrigger"] = {} - self._defaults["SendSoftwareEdgeTrigger"]["return"] = 0 - self._defaults["SetAttributeViBoolean"] = {} - self._defaults["SetAttributeViBoolean"]["return"] = 0 - self._defaults["SetAttributeViInt32"] = {} - self._defaults["SetAttributeViInt32"]["return"] = 0 - self._defaults["SetAttributeViReal64"] = {} - self._defaults["SetAttributeViReal64"]["return"] = 0 - self._defaults["SetAttributeViString"] = {} - self._defaults["SetAttributeViString"]["return"] = 0 - self._defaults["SetNamedWaveformNextWritePosition"] = {} - self._defaults["SetNamedWaveformNextWritePosition"]["return"] = 0 - self._defaults["SetWaveformNextWritePosition"] = {} - self._defaults["SetWaveformNextWritePosition"]["return"] = 0 - self._defaults["UnlockSession"] = {} - self._defaults["UnlockSession"]["return"] = 0 - self._defaults["UnlockSession"]["callerHasLock"] = None - self._defaults["WaitUntilDone"] = {} - self._defaults["WaitUntilDone"]["return"] = 0 - self._defaults["WriteBinary16Waveform"] = {} - self._defaults["WriteBinary16Waveform"]["return"] = 0 - self._defaults["WriteNamedWaveformF64"] = {} - self._defaults["WriteNamedWaveformF64"]["return"] = 0 - self._defaults["WriteNamedWaveformI16"] = {} - self._defaults["WriteNamedWaveformI16"]["return"] = 0 - self._defaults["WriteScript"] = {} - self._defaults["WriteScript"]["return"] = 0 - self._defaults["WriteWaveform"] = {} - self._defaults["WriteWaveform"]["return"] = 0 - self._defaults["close"] = {} - self._defaults["close"]["return"] = 0 - self._defaults["error_message"] = {} - self._defaults["error_message"]["return"] = 0 - self._defaults["error_message"]["errorMessage"] = None - self._defaults["reset"] = {} - self._defaults["reset"]["return"] = 0 - self._defaults["self_test"] = {} - self._defaults["self_test"]["return"] = 0 - self._defaults["self_test"]["selfTestResult"] = None - self._defaults["self_test"]["selfTestMessage"] = None + self._defaults['AbortGeneration'] = {} + self._defaults['AbortGeneration']['return'] = 0 + self._defaults['AllocateNamedWaveform'] = {} + self._defaults['AllocateNamedWaveform']['return'] = 0 + self._defaults['AllocateWaveform'] = {} + self._defaults['AllocateWaveform']['return'] = 0 + self._defaults['AllocateWaveform']['waveformHandle'] = None + self._defaults['ClearArbMemory'] = {} + self._defaults['ClearArbMemory']['return'] = 0 + self._defaults['ClearArbSequence'] = {} + self._defaults['ClearArbSequence']['return'] = 0 + self._defaults['ClearArbWaveform'] = {} + self._defaults['ClearArbWaveform']['return'] = 0 + self._defaults['ClearFreqList'] = {} + self._defaults['ClearFreqList']['return'] = 0 + self._defaults['ClearUserStandardWaveform'] = {} + self._defaults['ClearUserStandardWaveform']['return'] = 0 + self._defaults['Commit'] = {} + self._defaults['Commit']['return'] = 0 + self._defaults['ConfigureArbSequence'] = {} + self._defaults['ConfigureArbSequence']['return'] = 0 + self._defaults['ConfigureArbWaveform'] = {} + self._defaults['ConfigureArbWaveform']['return'] = 0 + self._defaults['ConfigureFreqList'] = {} + self._defaults['ConfigureFreqList']['return'] = 0 + self._defaults['ConfigureStandardWaveform'] = {} + self._defaults['ConfigureStandardWaveform']['return'] = 0 + self._defaults['CreateAdvancedArbSequence'] = {} + self._defaults['CreateAdvancedArbSequence']['return'] = 0 + self._defaults['CreateAdvancedArbSequence']['coercedMarkersArray'] = None + self._defaults['CreateAdvancedArbSequence']['sequenceHandle'] = None + self._defaults['CreateArbSequence'] = {} + self._defaults['CreateArbSequence']['return'] = 0 + self._defaults['CreateArbSequence']['sequenceHandle'] = None + self._defaults['CreateFreqList'] = {} + self._defaults['CreateFreqList']['return'] = 0 + self._defaults['CreateFreqList']['frequencyListHandle'] = None + self._defaults['CreateWaveformF64'] = {} + self._defaults['CreateWaveformF64']['return'] = 0 + self._defaults['CreateWaveformF64']['waveformHandle'] = None + self._defaults['CreateWaveformFromFileF64'] = {} + self._defaults['CreateWaveformFromFileF64']['return'] = 0 + self._defaults['CreateWaveformFromFileF64']['waveformHandle'] = None + self._defaults['CreateWaveformFromFileI16'] = {} + self._defaults['CreateWaveformFromFileI16']['return'] = 0 + self._defaults['CreateWaveformFromFileI16']['waveformHandle'] = None + self._defaults['CreateWaveformI16'] = {} + self._defaults['CreateWaveformI16']['return'] = 0 + self._defaults['CreateWaveformI16']['waveformHandle'] = None + self._defaults['DefineUserStandardWaveform'] = {} + self._defaults['DefineUserStandardWaveform']['return'] = 0 + self._defaults['DeleteNamedWaveform'] = {} + self._defaults['DeleteNamedWaveform']['return'] = 0 + self._defaults['DeleteScript'] = {} + self._defaults['DeleteScript']['return'] = 0 + self._defaults['Disable'] = {} + self._defaults['Disable']['return'] = 0 + self._defaults['ExportAttributeConfigurationBuffer'] = {} + self._defaults['ExportAttributeConfigurationBuffer']['return'] = 0 + self._defaults['ExportAttributeConfigurationBuffer']['configuration'] = None + self._defaults['ExportAttributeConfigurationFile'] = {} + self._defaults['ExportAttributeConfigurationFile']['return'] = 0 + self._defaults['GetAttributeViBoolean'] = {} + self._defaults['GetAttributeViBoolean']['return'] = 0 + self._defaults['GetAttributeViBoolean']['attributeValue'] = None + self._defaults['GetAttributeViInt32'] = {} + self._defaults['GetAttributeViInt32']['return'] = 0 + self._defaults['GetAttributeViInt32']['attributeValue'] = None + self._defaults['GetAttributeViReal64'] = {} + self._defaults['GetAttributeViReal64']['return'] = 0 + self._defaults['GetAttributeViReal64']['attributeValue'] = None + self._defaults['GetAttributeViString'] = {} + self._defaults['GetAttributeViString']['return'] = 0 + self._defaults['GetAttributeViString']['attributeValue'] = None + self._defaults['GetChannelName'] = {} + self._defaults['GetChannelName']['return'] = 0 + self._defaults['GetChannelName']['channelString'] = None + self._defaults['GetError'] = {} + self._defaults['GetError']['return'] = 0 + self._defaults['GetError']['errorCode'] = None + self._defaults['GetError']['errorDescription'] = None + self._defaults['GetExtCalLastDateAndTime'] = {} + self._defaults['GetExtCalLastDateAndTime']['return'] = 0 + self._defaults['GetExtCalLastDateAndTime']['year'] = None + self._defaults['GetExtCalLastDateAndTime']['month'] = None + self._defaults['GetExtCalLastDateAndTime']['day'] = None + self._defaults['GetExtCalLastDateAndTime']['hour'] = None + self._defaults['GetExtCalLastDateAndTime']['minute'] = None + self._defaults['GetExtCalLastTemp'] = {} + self._defaults['GetExtCalLastTemp']['return'] = 0 + self._defaults['GetExtCalLastTemp']['temperature'] = None + self._defaults['GetExtCalRecommendedInterval'] = {} + self._defaults['GetExtCalRecommendedInterval']['return'] = 0 + self._defaults['GetExtCalRecommendedInterval']['months'] = None + self._defaults['GetHardwareState'] = {} + self._defaults['GetHardwareState']['return'] = 0 + self._defaults['GetHardwareState']['state'] = None + self._defaults['GetLastExtCalLastDateAndTime'] = {} + self._defaults['GetLastExtCalLastDateAndTime']['return'] = 0 + self._defaults['GetLastExtCalLastDateAndTime']['month'] = None + self._defaults['GetLastSelfCalLastDateAndTime'] = {} + self._defaults['GetLastSelfCalLastDateAndTime']['return'] = 0 + self._defaults['GetLastSelfCalLastDateAndTime']['month'] = None + self._defaults['GetSelfCalLastDateAndTime'] = {} + self._defaults['GetSelfCalLastDateAndTime']['return'] = 0 + self._defaults['GetSelfCalLastDateAndTime']['year'] = None + self._defaults['GetSelfCalLastDateAndTime']['month'] = None + self._defaults['GetSelfCalLastDateAndTime']['day'] = None + self._defaults['GetSelfCalLastDateAndTime']['hour'] = None + self._defaults['GetSelfCalLastDateAndTime']['minute'] = None + self._defaults['GetSelfCalLastTemp'] = {} + self._defaults['GetSelfCalLastTemp']['return'] = 0 + self._defaults['GetSelfCalLastTemp']['temperature'] = None + self._defaults['GetSelfCalSupported'] = {} + self._defaults['GetSelfCalSupported']['return'] = 0 + self._defaults['GetSelfCalSupported']['selfCalSupported'] = None + self._defaults['ImportAttributeConfigurationBuffer'] = {} + self._defaults['ImportAttributeConfigurationBuffer']['return'] = 0 + self._defaults['ImportAttributeConfigurationFile'] = {} + self._defaults['ImportAttributeConfigurationFile']['return'] = 0 + self._defaults['InitializeWithChannels'] = {} + self._defaults['InitializeWithChannels']['return'] = 0 + self._defaults['InitializeWithChannels']['vi'] = None + self._defaults['InitiateGeneration'] = {} + self._defaults['InitiateGeneration']['return'] = 0 + self._defaults['IsDone'] = {} + self._defaults['IsDone']['return'] = 0 + self._defaults['IsDone']['done'] = None + self._defaults['LockSession'] = {} + self._defaults['LockSession']['return'] = 0 + self._defaults['LockSession']['callerHasLock'] = None + self._defaults['QueryArbSeqCapabilities'] = {} + self._defaults['QueryArbSeqCapabilities']['return'] = 0 + self._defaults['QueryArbSeqCapabilities']['maximumNumberOfSequences'] = None + self._defaults['QueryArbSeqCapabilities']['minimumSequenceLength'] = None + self._defaults['QueryArbSeqCapabilities']['maximumSequenceLength'] = None + self._defaults['QueryArbSeqCapabilities']['maximumLoopCount'] = None + self._defaults['QueryArbWfmCapabilities'] = {} + self._defaults['QueryArbWfmCapabilities']['return'] = 0 + self._defaults['QueryArbWfmCapabilities']['maximumNumberOfWaveforms'] = None + self._defaults['QueryArbWfmCapabilities']['waveformQuantum'] = None + self._defaults['QueryArbWfmCapabilities']['minimumWaveformSize'] = None + self._defaults['QueryArbWfmCapabilities']['maximumWaveformSize'] = None + self._defaults['QueryFreqListCapabilities'] = {} + self._defaults['QueryFreqListCapabilities']['return'] = 0 + self._defaults['QueryFreqListCapabilities']['maximumNumberOfFreqLists'] = None + self._defaults['QueryFreqListCapabilities']['minimumFrequencyListLength'] = None + self._defaults['QueryFreqListCapabilities']['maximumFrequencyListLength'] = None + self._defaults['QueryFreqListCapabilities']['minimumFrequencyListDuration'] = None + self._defaults['QueryFreqListCapabilities']['maximumFrequencyListDuration'] = None + self._defaults['QueryFreqListCapabilities']['frequencyListDurationQuantum'] = None + self._defaults['ReadCurrentTemperature'] = {} + self._defaults['ReadCurrentTemperature']['return'] = 0 + self._defaults['ReadCurrentTemperature']['temperature'] = None + self._defaults['ResetDevice'] = {} + self._defaults['ResetDevice']['return'] = 0 + self._defaults['ResetWithDefaults'] = {} + self._defaults['ResetWithDefaults']['return'] = 0 + self._defaults['SelfCal'] = {} + self._defaults['SelfCal']['return'] = 0 + self._defaults['SendSoftwareEdgeTrigger'] = {} + self._defaults['SendSoftwareEdgeTrigger']['return'] = 0 + self._defaults['SetAttributeViBoolean'] = {} + self._defaults['SetAttributeViBoolean']['return'] = 0 + self._defaults['SetAttributeViInt32'] = {} + self._defaults['SetAttributeViInt32']['return'] = 0 + self._defaults['SetAttributeViReal64'] = {} + self._defaults['SetAttributeViReal64']['return'] = 0 + self._defaults['SetAttributeViString'] = {} + self._defaults['SetAttributeViString']['return'] = 0 + self._defaults['SetNamedWaveformNextWritePosition'] = {} + self._defaults['SetNamedWaveformNextWritePosition']['return'] = 0 + self._defaults['SetWaveformNextWritePosition'] = {} + self._defaults['SetWaveformNextWritePosition']['return'] = 0 + self._defaults['UnlockSession'] = {} + self._defaults['UnlockSession']['return'] = 0 + self._defaults['UnlockSession']['callerHasLock'] = None + self._defaults['WaitUntilDone'] = {} + self._defaults['WaitUntilDone']['return'] = 0 + self._defaults['WriteBinary16Waveform'] = {} + self._defaults['WriteBinary16Waveform']['return'] = 0 + self._defaults['WriteNamedWaveformF64'] = {} + self._defaults['WriteNamedWaveformF64']['return'] = 0 + self._defaults['WriteNamedWaveformI16'] = {} + self._defaults['WriteNamedWaveformI16']['return'] = 0 + self._defaults['WriteScript'] = {} + self._defaults['WriteScript']['return'] = 0 + self._defaults['WriteWaveform'] = {} + self._defaults['WriteWaveform']['return'] = 0 + self._defaults['close'] = {} + self._defaults['close']['return'] = 0 + self._defaults['error_message'] = {} + self._defaults['error_message']['return'] = 0 + self._defaults['error_message']['errorMessage'] = None + self._defaults['reset'] = {} + self._defaults['reset']['return'] = 0 + self._defaults['self_test'] = {} + self._defaults['self_test']['return'] = 0 + self._defaults['self_test']['selfTestResult'] = None + self._defaults['self_test']['selfTestMessage'] = None def __getitem__(self, func): return self._defaults[func] @@ -230,110 +224,82 @@ def __setitem__(self, func, val): self._defaults[func] = val def niFgen_AbortGeneration(self, vi): # noqa: N802 - if self._defaults["AbortGeneration"]["return"] != 0: - return self._defaults["AbortGeneration"]["return"] - return self._defaults["AbortGeneration"]["return"] - - def niFgen_AllocateNamedWaveform( - self, vi, channel_name, waveform_name, waveform_size - ): # noqa: N802 - if self._defaults["AllocateNamedWaveform"]["return"] != 0: - return self._defaults["AllocateNamedWaveform"]["return"] - return self._defaults["AllocateNamedWaveform"]["return"] - - def niFgen_AllocateWaveform( - self, vi, channel_name, waveform_size, waveform_handle - ): # noqa: N802 - if self._defaults["AllocateWaveform"]["return"] != 0: - return self._defaults["AllocateWaveform"]["return"] + if self._defaults['AbortGeneration']['return'] != 0: + return self._defaults['AbortGeneration']['return'] + return self._defaults['AbortGeneration']['return'] + + def niFgen_AllocateNamedWaveform(self, vi, channel_name, waveform_name, waveform_size): # noqa: N802 + if self._defaults['AllocateNamedWaveform']['return'] != 0: + return self._defaults['AllocateNamedWaveform']['return'] + return self._defaults['AllocateNamedWaveform']['return'] + + def niFgen_AllocateWaveform(self, vi, channel_name, waveform_size, waveform_handle): # noqa: N802 + if self._defaults['AllocateWaveform']['return'] != 0: + return self._defaults['AllocateWaveform']['return'] # waveform_handle - if self._defaults["AllocateWaveform"]["waveformHandle"] is None: - raise MockFunctionCallError( - "niFgen_AllocateWaveform", param="waveformHandle" - ) + if self._defaults['AllocateWaveform']['waveformHandle'] is None: + raise MockFunctionCallError("niFgen_AllocateWaveform", param='waveformHandle') if waveform_handle is not None: - waveform_handle.contents.value = self._defaults["AllocateWaveform"][ - "waveformHandle" - ] - return self._defaults["AllocateWaveform"]["return"] + waveform_handle.contents.value = self._defaults['AllocateWaveform']['waveformHandle'] + return self._defaults['AllocateWaveform']['return'] def niFgen_ClearArbMemory(self, vi): # noqa: N802 - if self._defaults["ClearArbMemory"]["return"] != 0: - return self._defaults["ClearArbMemory"]["return"] - return self._defaults["ClearArbMemory"]["return"] + if self._defaults['ClearArbMemory']['return'] != 0: + return self._defaults['ClearArbMemory']['return'] + return self._defaults['ClearArbMemory']['return'] def niFgen_ClearArbSequence(self, vi, sequence_handle): # noqa: N802 - if self._defaults["ClearArbSequence"]["return"] != 0: - return self._defaults["ClearArbSequence"]["return"] - return self._defaults["ClearArbSequence"]["return"] + if self._defaults['ClearArbSequence']['return'] != 0: + return self._defaults['ClearArbSequence']['return'] + return self._defaults['ClearArbSequence']['return'] def niFgen_ClearArbWaveform(self, vi, waveform_handle): # noqa: N802 - if self._defaults["ClearArbWaveform"]["return"] != 0: - return self._defaults["ClearArbWaveform"]["return"] - return self._defaults["ClearArbWaveform"]["return"] + if self._defaults['ClearArbWaveform']['return'] != 0: + return self._defaults['ClearArbWaveform']['return'] + return self._defaults['ClearArbWaveform']['return'] def niFgen_ClearFreqList(self, vi, frequency_list_handle): # noqa: N802 - if self._defaults["ClearFreqList"]["return"] != 0: - return self._defaults["ClearFreqList"]["return"] - return self._defaults["ClearFreqList"]["return"] + if self._defaults['ClearFreqList']['return'] != 0: + return self._defaults['ClearFreqList']['return'] + return self._defaults['ClearFreqList']['return'] def niFgen_ClearUserStandardWaveform(self, vi, channel_name): # noqa: N802 - if self._defaults["ClearUserStandardWaveform"]["return"] != 0: - return self._defaults["ClearUserStandardWaveform"]["return"] - return self._defaults["ClearUserStandardWaveform"]["return"] + if self._defaults['ClearUserStandardWaveform']['return'] != 0: + return self._defaults['ClearUserStandardWaveform']['return'] + return self._defaults['ClearUserStandardWaveform']['return'] def niFgen_Commit(self, vi): # noqa: N802 - if self._defaults["Commit"]["return"] != 0: - return self._defaults["Commit"]["return"] - return self._defaults["Commit"]["return"] - - def niFgen_ConfigureArbSequence( - self, vi, channel_name, sequence_handle, gain, offset - ): # noqa: N802 - if self._defaults["ConfigureArbSequence"]["return"] != 0: - return self._defaults["ConfigureArbSequence"]["return"] - return self._defaults["ConfigureArbSequence"]["return"] - - def niFgen_ConfigureArbWaveform( - self, vi, channel_name, waveform_handle, gain, offset - ): # noqa: N802 - if self._defaults["ConfigureArbWaveform"]["return"] != 0: - return self._defaults["ConfigureArbWaveform"]["return"] - return self._defaults["ConfigureArbWaveform"]["return"] - - def niFgen_ConfigureFreqList( - self, vi, channel_name, frequency_list_handle, amplitude, dc_offset, start_phase - ): # noqa: N802 - if self._defaults["ConfigureFreqList"]["return"] != 0: - return self._defaults["ConfigureFreqList"]["return"] - return self._defaults["ConfigureFreqList"]["return"] - - def niFgen_ConfigureStandardWaveform( - self, vi, channel_name, waveform, amplitude, dc_offset, frequency, start_phase - ): # noqa: N802 - if self._defaults["ConfigureStandardWaveform"]["return"] != 0: - return self._defaults["ConfigureStandardWaveform"]["return"] - return self._defaults["ConfigureStandardWaveform"]["return"] - - def niFgen_CreateAdvancedArbSequence( - self, - vi, - sequence_length, - waveform_handles_array, - loop_counts_array, - sample_counts_array, - marker_location_array, - coerced_markers_array, - sequence_handle, - ): # noqa: N802 - if self._defaults["CreateAdvancedArbSequence"]["return"] != 0: - return self._defaults["CreateAdvancedArbSequence"]["return"] + if self._defaults['Commit']['return'] != 0: + return self._defaults['Commit']['return'] + return self._defaults['Commit']['return'] + + def niFgen_ConfigureArbSequence(self, vi, channel_name, sequence_handle, gain, offset): # noqa: N802 + if self._defaults['ConfigureArbSequence']['return'] != 0: + return self._defaults['ConfigureArbSequence']['return'] + return self._defaults['ConfigureArbSequence']['return'] + + def niFgen_ConfigureArbWaveform(self, vi, channel_name, waveform_handle, gain, offset): # noqa: N802 + if self._defaults['ConfigureArbWaveform']['return'] != 0: + return self._defaults['ConfigureArbWaveform']['return'] + return self._defaults['ConfigureArbWaveform']['return'] + + def niFgen_ConfigureFreqList(self, vi, channel_name, frequency_list_handle, amplitude, dc_offset, start_phase): # noqa: N802 + if self._defaults['ConfigureFreqList']['return'] != 0: + return self._defaults['ConfigureFreqList']['return'] + return self._defaults['ConfigureFreqList']['return'] + + def niFgen_ConfigureStandardWaveform(self, vi, channel_name, waveform, amplitude, dc_offset, frequency, start_phase): # noqa: N802 + if self._defaults['ConfigureStandardWaveform']['return'] != 0: + return self._defaults['ConfigureStandardWaveform']['return'] + return self._defaults['ConfigureStandardWaveform']['return'] + + def niFgen_CreateAdvancedArbSequence(self, vi, sequence_length, waveform_handles_array, loop_counts_array, sample_counts_array, marker_location_array, coerced_markers_array, sequence_handle): # noqa: N802 + if self._defaults['CreateAdvancedArbSequence']['return'] != 0: + return self._defaults['CreateAdvancedArbSequence']['return'] # coerced_markers_array - if self._defaults["CreateAdvancedArbSequence"]["coercedMarkersArray"] is None: - raise MockFunctionCallError( - "niFgen_CreateAdvancedArbSequence", param="coercedMarkersArray" - ) - test_value = self._defaults["CreateAdvancedArbSequence"]["coercedMarkersArray"] + if self._defaults['CreateAdvancedArbSequence']['coercedMarkersArray'] is None: + raise MockFunctionCallError("niFgen_CreateAdvancedArbSequence", param='coercedMarkersArray') + test_value = self._defaults['CreateAdvancedArbSequence']['coercedMarkersArray'] try: coerced_markers_array_ref = coerced_markers_array.contents except AttributeError: @@ -342,1134 +308,723 @@ def niFgen_CreateAdvancedArbSequence( for i in range(len(test_value)): coerced_markers_array_ref[i] = test_value[i] # sequence_handle - if self._defaults["CreateAdvancedArbSequence"]["sequenceHandle"] is None: - raise MockFunctionCallError( - "niFgen_CreateAdvancedArbSequence", param="sequenceHandle" - ) + if self._defaults['CreateAdvancedArbSequence']['sequenceHandle'] is None: + raise MockFunctionCallError("niFgen_CreateAdvancedArbSequence", param='sequenceHandle') if sequence_handle is not None: - sequence_handle.contents.value = self._defaults[ - "CreateAdvancedArbSequence" - ]["sequenceHandle"] - return self._defaults["CreateAdvancedArbSequence"]["return"] - - def niFgen_CreateArbSequence( - self, - vi, - sequence_length, - waveform_handles_array, - loop_counts_array, - sequence_handle, - ): # noqa: N802 - if self._defaults["CreateArbSequence"]["return"] != 0: - return self._defaults["CreateArbSequence"]["return"] + sequence_handle.contents.value = self._defaults['CreateAdvancedArbSequence']['sequenceHandle'] + return self._defaults['CreateAdvancedArbSequence']['return'] + + def niFgen_CreateArbSequence(self, vi, sequence_length, waveform_handles_array, loop_counts_array, sequence_handle): # noqa: N802 + if self._defaults['CreateArbSequence']['return'] != 0: + return self._defaults['CreateArbSequence']['return'] # sequence_handle - if self._defaults["CreateArbSequence"]["sequenceHandle"] is None: - raise MockFunctionCallError( - "niFgen_CreateArbSequence", param="sequenceHandle" - ) + if self._defaults['CreateArbSequence']['sequenceHandle'] is None: + raise MockFunctionCallError("niFgen_CreateArbSequence", param='sequenceHandle') if sequence_handle is not None: - sequence_handle.contents.value = self._defaults["CreateArbSequence"][ - "sequenceHandle" - ] - return self._defaults["CreateArbSequence"]["return"] - - def niFgen_CreateFreqList( - self, - vi, - waveform, - frequency_list_length, - frequency_array, - duration_array, - frequency_list_handle, - ): # noqa: N802 - if self._defaults["CreateFreqList"]["return"] != 0: - return self._defaults["CreateFreqList"]["return"] + sequence_handle.contents.value = self._defaults['CreateArbSequence']['sequenceHandle'] + return self._defaults['CreateArbSequence']['return'] + + def niFgen_CreateFreqList(self, vi, waveform, frequency_list_length, frequency_array, duration_array, frequency_list_handle): # noqa: N802 + if self._defaults['CreateFreqList']['return'] != 0: + return self._defaults['CreateFreqList']['return'] # frequency_list_handle - if self._defaults["CreateFreqList"]["frequencyListHandle"] is None: - raise MockFunctionCallError( - "niFgen_CreateFreqList", param="frequencyListHandle" - ) + if self._defaults['CreateFreqList']['frequencyListHandle'] is None: + raise MockFunctionCallError("niFgen_CreateFreqList", param='frequencyListHandle') if frequency_list_handle is not None: - frequency_list_handle.contents.value = self._defaults["CreateFreqList"][ - "frequencyListHandle" - ] - return self._defaults["CreateFreqList"]["return"] - - def niFgen_CreateWaveformF64( - self, vi, channel_name, waveform_size, waveform_data_array, waveform_handle - ): # noqa: N802 - if self._defaults["CreateWaveformF64"]["return"] != 0: - return self._defaults["CreateWaveformF64"]["return"] + frequency_list_handle.contents.value = self._defaults['CreateFreqList']['frequencyListHandle'] + return self._defaults['CreateFreqList']['return'] + + def niFgen_CreateWaveformF64(self, vi, channel_name, waveform_size, waveform_data_array, waveform_handle): # noqa: N802 + if self._defaults['CreateWaveformF64']['return'] != 0: + return self._defaults['CreateWaveformF64']['return'] # waveform_handle - if self._defaults["CreateWaveformF64"]["waveformHandle"] is None: - raise MockFunctionCallError( - "niFgen_CreateWaveformF64", param="waveformHandle" - ) + if self._defaults['CreateWaveformF64']['waveformHandle'] is None: + raise MockFunctionCallError("niFgen_CreateWaveformF64", param='waveformHandle') if waveform_handle is not None: - waveform_handle.contents.value = self._defaults["CreateWaveformF64"][ - "waveformHandle" - ] - return self._defaults["CreateWaveformF64"]["return"] - - def niFgen_CreateWaveformFromFileF64( - self, vi, channel_name, file_name, byte_order, waveform_handle - ): # noqa: N802 - if self._defaults["CreateWaveformFromFileF64"]["return"] != 0: - return self._defaults["CreateWaveformFromFileF64"]["return"] + waveform_handle.contents.value = self._defaults['CreateWaveformF64']['waveformHandle'] + return self._defaults['CreateWaveformF64']['return'] + + def niFgen_CreateWaveformFromFileF64(self, vi, channel_name, file_name, byte_order, waveform_handle): # noqa: N802 + if self._defaults['CreateWaveformFromFileF64']['return'] != 0: + return self._defaults['CreateWaveformFromFileF64']['return'] # waveform_handle - if self._defaults["CreateWaveformFromFileF64"]["waveformHandle"] is None: - raise MockFunctionCallError( - "niFgen_CreateWaveformFromFileF64", param="waveformHandle" - ) + if self._defaults['CreateWaveformFromFileF64']['waveformHandle'] is None: + raise MockFunctionCallError("niFgen_CreateWaveformFromFileF64", param='waveformHandle') if waveform_handle is not None: - waveform_handle.contents.value = self._defaults[ - "CreateWaveformFromFileF64" - ]["waveformHandle"] - return self._defaults["CreateWaveformFromFileF64"]["return"] - - def niFgen_CreateWaveformFromFileI16( - self, vi, channel_name, file_name, byte_order, waveform_handle - ): # noqa: N802 - if self._defaults["CreateWaveformFromFileI16"]["return"] != 0: - return self._defaults["CreateWaveformFromFileI16"]["return"] + waveform_handle.contents.value = self._defaults['CreateWaveformFromFileF64']['waveformHandle'] + return self._defaults['CreateWaveformFromFileF64']['return'] + + def niFgen_CreateWaveformFromFileI16(self, vi, channel_name, file_name, byte_order, waveform_handle): # noqa: N802 + if self._defaults['CreateWaveformFromFileI16']['return'] != 0: + return self._defaults['CreateWaveformFromFileI16']['return'] # waveform_handle - if self._defaults["CreateWaveformFromFileI16"]["waveformHandle"] is None: - raise MockFunctionCallError( - "niFgen_CreateWaveformFromFileI16", param="waveformHandle" - ) + if self._defaults['CreateWaveformFromFileI16']['waveformHandle'] is None: + raise MockFunctionCallError("niFgen_CreateWaveformFromFileI16", param='waveformHandle') if waveform_handle is not None: - waveform_handle.contents.value = self._defaults[ - "CreateWaveformFromFileI16" - ]["waveformHandle"] - return self._defaults["CreateWaveformFromFileI16"]["return"] - - def niFgen_CreateWaveformI16( - self, vi, channel_name, waveform_size, waveform_data_array, waveform_handle - ): # noqa: N802 - if self._defaults["CreateWaveformI16"]["return"] != 0: - return self._defaults["CreateWaveformI16"]["return"] + waveform_handle.contents.value = self._defaults['CreateWaveformFromFileI16']['waveformHandle'] + return self._defaults['CreateWaveformFromFileI16']['return'] + + def niFgen_CreateWaveformI16(self, vi, channel_name, waveform_size, waveform_data_array, waveform_handle): # noqa: N802 + if self._defaults['CreateWaveformI16']['return'] != 0: + return self._defaults['CreateWaveformI16']['return'] # waveform_handle - if self._defaults["CreateWaveformI16"]["waveformHandle"] is None: - raise MockFunctionCallError( - "niFgen_CreateWaveformI16", param="waveformHandle" - ) + if self._defaults['CreateWaveformI16']['waveformHandle'] is None: + raise MockFunctionCallError("niFgen_CreateWaveformI16", param='waveformHandle') if waveform_handle is not None: - waveform_handle.contents.value = self._defaults["CreateWaveformI16"][ - "waveformHandle" - ] - return self._defaults["CreateWaveformI16"]["return"] - - def niFgen_DefineUserStandardWaveform( - self, vi, channel_name, waveform_size, waveform_data_array - ): # noqa: N802 - if self._defaults["DefineUserStandardWaveform"]["return"] != 0: - return self._defaults["DefineUserStandardWaveform"]["return"] - return self._defaults["DefineUserStandardWaveform"]["return"] + waveform_handle.contents.value = self._defaults['CreateWaveformI16']['waveformHandle'] + return self._defaults['CreateWaveformI16']['return'] + + def niFgen_DefineUserStandardWaveform(self, vi, channel_name, waveform_size, waveform_data_array): # noqa: N802 + if self._defaults['DefineUserStandardWaveform']['return'] != 0: + return self._defaults['DefineUserStandardWaveform']['return'] + return self._defaults['DefineUserStandardWaveform']['return'] def niFgen_DeleteNamedWaveform(self, vi, channel_name, waveform_name): # noqa: N802 - if self._defaults["DeleteNamedWaveform"]["return"] != 0: - return self._defaults["DeleteNamedWaveform"]["return"] - return self._defaults["DeleteNamedWaveform"]["return"] + if self._defaults['DeleteNamedWaveform']['return'] != 0: + return self._defaults['DeleteNamedWaveform']['return'] + return self._defaults['DeleteNamedWaveform']['return'] def niFgen_DeleteScript(self, vi, channel_name, script_name): # noqa: N802 - if self._defaults["DeleteScript"]["return"] != 0: - return self._defaults["DeleteScript"]["return"] - return self._defaults["DeleteScript"]["return"] + if self._defaults['DeleteScript']['return'] != 0: + return self._defaults['DeleteScript']['return'] + return self._defaults['DeleteScript']['return'] def niFgen_Disable(self, vi): # noqa: N802 - if self._defaults["Disable"]["return"] != 0: - return self._defaults["Disable"]["return"] - return self._defaults["Disable"]["return"] - - def niFgen_ExportAttributeConfigurationBuffer( - self, vi, size_in_bytes, configuration - ): # noqa: N802 - if self._defaults["ExportAttributeConfigurationBuffer"]["return"] != 0: - return self._defaults["ExportAttributeConfigurationBuffer"]["return"] - if ( - self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] - is None - ): - raise MockFunctionCallError( - "niFgen_ExportAttributeConfigurationBuffer", param="configuration" - ) + if self._defaults['Disable']['return'] != 0: + return self._defaults['Disable']['return'] + return self._defaults['Disable']['return'] + + def niFgen_ExportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 + if self._defaults['ExportAttributeConfigurationBuffer']['return'] != 0: + return self._defaults['ExportAttributeConfigurationBuffer']['return'] + if self._defaults['ExportAttributeConfigurationBuffer']['configuration'] is None: + raise MockFunctionCallError("niFgen_ExportAttributeConfigurationBuffer", param='configuration') if size_in_bytes.value == 0: - return len( - self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] - ) + return len(self._defaults['ExportAttributeConfigurationBuffer']['configuration']) try: configuration_ref = configuration.contents except AttributeError: configuration_ref = configuration - for i in range( - len(self._defaults["ExportAttributeConfigurationBuffer"]["configuration"]) - ): - configuration_ref[i] = self._defaults["ExportAttributeConfigurationBuffer"][ - "configuration" - ][i] - return self._defaults["ExportAttributeConfigurationBuffer"]["return"] + for i in range(len(self._defaults['ExportAttributeConfigurationBuffer']['configuration'])): + configuration_ref[i] = self._defaults['ExportAttributeConfigurationBuffer']['configuration'][i] + return self._defaults['ExportAttributeConfigurationBuffer']['return'] def niFgen_ExportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 - if self._defaults["ExportAttributeConfigurationFile"]["return"] != 0: - return self._defaults["ExportAttributeConfigurationFile"]["return"] - return self._defaults["ExportAttributeConfigurationFile"]["return"] - - def niFgen_GetAttributeViBoolean( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["GetAttributeViBoolean"]["return"] != 0: - return self._defaults["GetAttributeViBoolean"]["return"] + if self._defaults['ExportAttributeConfigurationFile']['return'] != 0: + return self._defaults['ExportAttributeConfigurationFile']['return'] + return self._defaults['ExportAttributeConfigurationFile']['return'] + + def niFgen_GetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['GetAttributeViBoolean']['return'] != 0: + return self._defaults['GetAttributeViBoolean']['return'] # attribute_value - if self._defaults["GetAttributeViBoolean"]["attributeValue"] is None: - raise MockFunctionCallError( - "niFgen_GetAttributeViBoolean", param="attributeValue" - ) + if self._defaults['GetAttributeViBoolean']['attributeValue'] is None: + raise MockFunctionCallError("niFgen_GetAttributeViBoolean", param='attributeValue') if attribute_value is not None: - attribute_value.contents.value = self._defaults["GetAttributeViBoolean"][ - "attributeValue" - ] - return self._defaults["GetAttributeViBoolean"]["return"] - - def niFgen_GetAttributeViInt32( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["GetAttributeViInt32"]["return"] != 0: - return self._defaults["GetAttributeViInt32"]["return"] + attribute_value.contents.value = self._defaults['GetAttributeViBoolean']['attributeValue'] + return self._defaults['GetAttributeViBoolean']['return'] + + def niFgen_GetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['GetAttributeViInt32']['return'] != 0: + return self._defaults['GetAttributeViInt32']['return'] # attribute_value - if self._defaults["GetAttributeViInt32"]["attributeValue"] is None: - raise MockFunctionCallError( - "niFgen_GetAttributeViInt32", param="attributeValue" - ) + if self._defaults['GetAttributeViInt32']['attributeValue'] is None: + raise MockFunctionCallError("niFgen_GetAttributeViInt32", param='attributeValue') if attribute_value is not None: - attribute_value.contents.value = self._defaults["GetAttributeViInt32"][ - "attributeValue" - ] - return self._defaults["GetAttributeViInt32"]["return"] - - def niFgen_GetAttributeViReal64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["GetAttributeViReal64"]["return"] != 0: - return self._defaults["GetAttributeViReal64"]["return"] + attribute_value.contents.value = self._defaults['GetAttributeViInt32']['attributeValue'] + return self._defaults['GetAttributeViInt32']['return'] + + def niFgen_GetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['GetAttributeViReal64']['return'] != 0: + return self._defaults['GetAttributeViReal64']['return'] # attribute_value - if self._defaults["GetAttributeViReal64"]["attributeValue"] is None: - raise MockFunctionCallError( - "niFgen_GetAttributeViReal64", param="attributeValue" - ) + if self._defaults['GetAttributeViReal64']['attributeValue'] is None: + raise MockFunctionCallError("niFgen_GetAttributeViReal64", param='attributeValue') if attribute_value is not None: - attribute_value.contents.value = self._defaults["GetAttributeViReal64"][ - "attributeValue" - ] - return self._defaults["GetAttributeViReal64"]["return"] - - def niFgen_GetAttributeViString( - self, vi, channel_name, attribute_id, array_size, attribute_value - ): # noqa: N802 - if self._defaults["GetAttributeViString"]["return"] != 0: - return self._defaults["GetAttributeViString"]["return"] - if self._defaults["GetAttributeViString"]["attributeValue"] is None: - raise MockFunctionCallError( - "niFgen_GetAttributeViString", param="attributeValue" - ) + attribute_value.contents.value = self._defaults['GetAttributeViReal64']['attributeValue'] + return self._defaults['GetAttributeViReal64']['return'] + + def niFgen_GetAttributeViString(self, vi, channel_name, attribute_id, array_size, attribute_value): # noqa: N802 + if self._defaults['GetAttributeViString']['return'] != 0: + return self._defaults['GetAttributeViString']['return'] + if self._defaults['GetAttributeViString']['attributeValue'] is None: + raise MockFunctionCallError("niFgen_GetAttributeViString", param='attributeValue') if array_size.value == 0: - return len(self._defaults["GetAttributeViString"]["attributeValue"]) - attribute_value.value = self._defaults["GetAttributeViString"][ - "attributeValue" - ].encode("ascii") - return self._defaults["GetAttributeViString"]["return"] - - def niFgen_GetChannelName( - self, vi, index, buffer_size, channel_string - ): # noqa: N802 - if self._defaults["GetChannelName"]["return"] != 0: - return self._defaults["GetChannelName"]["return"] - if self._defaults["GetChannelName"]["channelString"] is None: - raise MockFunctionCallError("niFgen_GetChannelName", param="channelString") + return len(self._defaults['GetAttributeViString']['attributeValue']) + attribute_value.value = self._defaults['GetAttributeViString']['attributeValue'].encode('ascii') + return self._defaults['GetAttributeViString']['return'] + + def niFgen_GetChannelName(self, vi, index, buffer_size, channel_string): # noqa: N802 + if self._defaults['GetChannelName']['return'] != 0: + return self._defaults['GetChannelName']['return'] + if self._defaults['GetChannelName']['channelString'] is None: + raise MockFunctionCallError("niFgen_GetChannelName", param='channelString') if buffer_size.value == 0: - return len(self._defaults["GetChannelName"]["channelString"]) - channel_string.value = self._defaults["GetChannelName"]["channelString"].encode( - "ascii" - ) - return self._defaults["GetChannelName"]["return"] - - def niFgen_GetError( - self, vi, error_code, error_description_buffer_size, error_description - ): # noqa: N802 - if self._defaults["GetError"]["return"] != 0: - return self._defaults["GetError"]["return"] + return len(self._defaults['GetChannelName']['channelString']) + channel_string.value = self._defaults['GetChannelName']['channelString'].encode('ascii') + return self._defaults['GetChannelName']['return'] + + def niFgen_GetError(self, vi, error_code, error_description_buffer_size, error_description): # noqa: N802 + if self._defaults['GetError']['return'] != 0: + return self._defaults['GetError']['return'] # error_code - if self._defaults["GetError"]["errorCode"] is None: - raise MockFunctionCallError("niFgen_GetError", param="errorCode") + if self._defaults['GetError']['errorCode'] is None: + raise MockFunctionCallError("niFgen_GetError", param='errorCode') if error_code is not None: - error_code.contents.value = self._defaults["GetError"]["errorCode"] - if self._defaults["GetError"]["errorDescription"] is None: - raise MockFunctionCallError("niFgen_GetError", param="errorDescription") + error_code.contents.value = self._defaults['GetError']['errorCode'] + if self._defaults['GetError']['errorDescription'] is None: + raise MockFunctionCallError("niFgen_GetError", param='errorDescription') if error_description_buffer_size.value == 0: - return len(self._defaults["GetError"]["errorDescription"]) - error_description.value = self._defaults["GetError"]["errorDescription"].encode( - "ascii" - ) - return self._defaults["GetError"]["return"] - - def niFgen_GetExtCalLastDateAndTime( - self, vi, year, month, day, hour, minute - ): # noqa: N802 - if self._defaults["GetExtCalLastDateAndTime"]["return"] != 0: - return self._defaults["GetExtCalLastDateAndTime"]["return"] + return len(self._defaults['GetError']['errorDescription']) + error_description.value = self._defaults['GetError']['errorDescription'].encode('ascii') + return self._defaults['GetError']['return'] + + def niFgen_GetExtCalLastDateAndTime(self, vi, year, month, day, hour, minute): # noqa: N802 + if self._defaults['GetExtCalLastDateAndTime']['return'] != 0: + return self._defaults['GetExtCalLastDateAndTime']['return'] # year - if self._defaults["GetExtCalLastDateAndTime"]["year"] is None: - raise MockFunctionCallError("niFgen_GetExtCalLastDateAndTime", param="year") + if self._defaults['GetExtCalLastDateAndTime']['year'] is None: + raise MockFunctionCallError("niFgen_GetExtCalLastDateAndTime", param='year') if year is not None: - year.contents.value = self._defaults["GetExtCalLastDateAndTime"]["year"] + year.contents.value = self._defaults['GetExtCalLastDateAndTime']['year'] # month - if self._defaults["GetExtCalLastDateAndTime"]["month"] is None: - raise MockFunctionCallError( - "niFgen_GetExtCalLastDateAndTime", param="month" - ) + if self._defaults['GetExtCalLastDateAndTime']['month'] is None: + raise MockFunctionCallError("niFgen_GetExtCalLastDateAndTime", param='month') if month is not None: - month.contents.value = self._defaults["GetExtCalLastDateAndTime"]["month"] + month.contents.value = self._defaults['GetExtCalLastDateAndTime']['month'] # day - if self._defaults["GetExtCalLastDateAndTime"]["day"] is None: - raise MockFunctionCallError("niFgen_GetExtCalLastDateAndTime", param="day") + if self._defaults['GetExtCalLastDateAndTime']['day'] is None: + raise MockFunctionCallError("niFgen_GetExtCalLastDateAndTime", param='day') if day is not None: - day.contents.value = self._defaults["GetExtCalLastDateAndTime"]["day"] + day.contents.value = self._defaults['GetExtCalLastDateAndTime']['day'] # hour - if self._defaults["GetExtCalLastDateAndTime"]["hour"] is None: - raise MockFunctionCallError("niFgen_GetExtCalLastDateAndTime", param="hour") + if self._defaults['GetExtCalLastDateAndTime']['hour'] is None: + raise MockFunctionCallError("niFgen_GetExtCalLastDateAndTime", param='hour') if hour is not None: - hour.contents.value = self._defaults["GetExtCalLastDateAndTime"]["hour"] + hour.contents.value = self._defaults['GetExtCalLastDateAndTime']['hour'] # minute - if self._defaults["GetExtCalLastDateAndTime"]["minute"] is None: - raise MockFunctionCallError( - "niFgen_GetExtCalLastDateAndTime", param="minute" - ) + if self._defaults['GetExtCalLastDateAndTime']['minute'] is None: + raise MockFunctionCallError("niFgen_GetExtCalLastDateAndTime", param='minute') if minute is not None: - minute.contents.value = self._defaults["GetExtCalLastDateAndTime"]["minute"] - return self._defaults["GetExtCalLastDateAndTime"]["return"] + minute.contents.value = self._defaults['GetExtCalLastDateAndTime']['minute'] + return self._defaults['GetExtCalLastDateAndTime']['return'] def niFgen_GetExtCalLastTemp(self, vi, temperature): # noqa: N802 - if self._defaults["GetExtCalLastTemp"]["return"] != 0: - return self._defaults["GetExtCalLastTemp"]["return"] + if self._defaults['GetExtCalLastTemp']['return'] != 0: + return self._defaults['GetExtCalLastTemp']['return'] # temperature - if self._defaults["GetExtCalLastTemp"]["temperature"] is None: - raise MockFunctionCallError("niFgen_GetExtCalLastTemp", param="temperature") + if self._defaults['GetExtCalLastTemp']['temperature'] is None: + raise MockFunctionCallError("niFgen_GetExtCalLastTemp", param='temperature') if temperature is not None: - temperature.contents.value = self._defaults["GetExtCalLastTemp"][ - "temperature" - ] - return self._defaults["GetExtCalLastTemp"]["return"] + temperature.contents.value = self._defaults['GetExtCalLastTemp']['temperature'] + return self._defaults['GetExtCalLastTemp']['return'] def niFgen_GetExtCalRecommendedInterval(self, vi, months): # noqa: N802 - if self._defaults["GetExtCalRecommendedInterval"]["return"] != 0: - return self._defaults["GetExtCalRecommendedInterval"]["return"] + if self._defaults['GetExtCalRecommendedInterval']['return'] != 0: + return self._defaults['GetExtCalRecommendedInterval']['return'] # months - if self._defaults["GetExtCalRecommendedInterval"]["months"] is None: - raise MockFunctionCallError( - "niFgen_GetExtCalRecommendedInterval", param="months" - ) + if self._defaults['GetExtCalRecommendedInterval']['months'] is None: + raise MockFunctionCallError("niFgen_GetExtCalRecommendedInterval", param='months') if months is not None: - months.contents.value = self._defaults["GetExtCalRecommendedInterval"][ - "months" - ] - return self._defaults["GetExtCalRecommendedInterval"]["return"] + months.contents.value = self._defaults['GetExtCalRecommendedInterval']['months'] + return self._defaults['GetExtCalRecommendedInterval']['return'] def niFgen_GetHardwareState(self, vi, state): # noqa: N802 - if self._defaults["GetHardwareState"]["return"] != 0: - return self._defaults["GetHardwareState"]["return"] + if self._defaults['GetHardwareState']['return'] != 0: + return self._defaults['GetHardwareState']['return'] # state - if self._defaults["GetHardwareState"]["state"] is None: - raise MockFunctionCallError("niFgen_GetHardwareState", param="state") + if self._defaults['GetHardwareState']['state'] is None: + raise MockFunctionCallError("niFgen_GetHardwareState", param='state') if state is not None: - state.contents.value = self._defaults["GetHardwareState"]["state"] - return self._defaults["GetHardwareState"]["return"] + state.contents.value = self._defaults['GetHardwareState']['state'] + return self._defaults['GetHardwareState']['return'] def niFgen_GetLastExtCalLastDateAndTime(self, vi, month): # noqa: N802 - if self._defaults["GetLastExtCalLastDateAndTime"]["return"] != 0: - return self._defaults["GetLastExtCalLastDateAndTime"]["return"] + if self._defaults['GetLastExtCalLastDateAndTime']['return'] != 0: + return self._defaults['GetLastExtCalLastDateAndTime']['return'] # month - if self._defaults["GetLastExtCalLastDateAndTime"]["month"] is None: - raise MockFunctionCallError( - "niFgen_GetLastExtCalLastDateAndTime", param="month" - ) + if self._defaults['GetLastExtCalLastDateAndTime']['month'] is None: + raise MockFunctionCallError("niFgen_GetLastExtCalLastDateAndTime", param='month') if month is not None: - month.contents.value = self._defaults["GetLastExtCalLastDateAndTime"][ - "month" - ] - return self._defaults["GetLastExtCalLastDateAndTime"]["return"] + month.contents.value = self._defaults['GetLastExtCalLastDateAndTime']['month'] + return self._defaults['GetLastExtCalLastDateAndTime']['return'] def niFgen_GetLastSelfCalLastDateAndTime(self, vi, month): # noqa: N802 - if self._defaults["GetLastSelfCalLastDateAndTime"]["return"] != 0: - return self._defaults["GetLastSelfCalLastDateAndTime"]["return"] + if self._defaults['GetLastSelfCalLastDateAndTime']['return'] != 0: + return self._defaults['GetLastSelfCalLastDateAndTime']['return'] # month - if self._defaults["GetLastSelfCalLastDateAndTime"]["month"] is None: - raise MockFunctionCallError( - "niFgen_GetLastSelfCalLastDateAndTime", param="month" - ) + if self._defaults['GetLastSelfCalLastDateAndTime']['month'] is None: + raise MockFunctionCallError("niFgen_GetLastSelfCalLastDateAndTime", param='month') if month is not None: - month.contents.value = self._defaults["GetLastSelfCalLastDateAndTime"][ - "month" - ] - return self._defaults["GetLastSelfCalLastDateAndTime"]["return"] - - def niFgen_GetSelfCalLastDateAndTime( - self, vi, year, month, day, hour, minute - ): # noqa: N802 - if self._defaults["GetSelfCalLastDateAndTime"]["return"] != 0: - return self._defaults["GetSelfCalLastDateAndTime"]["return"] + month.contents.value = self._defaults['GetLastSelfCalLastDateAndTime']['month'] + return self._defaults['GetLastSelfCalLastDateAndTime']['return'] + + def niFgen_GetSelfCalLastDateAndTime(self, vi, year, month, day, hour, minute): # noqa: N802 + if self._defaults['GetSelfCalLastDateAndTime']['return'] != 0: + return self._defaults['GetSelfCalLastDateAndTime']['return'] # year - if self._defaults["GetSelfCalLastDateAndTime"]["year"] is None: - raise MockFunctionCallError( - "niFgen_GetSelfCalLastDateAndTime", param="year" - ) + if self._defaults['GetSelfCalLastDateAndTime']['year'] is None: + raise MockFunctionCallError("niFgen_GetSelfCalLastDateAndTime", param='year') if year is not None: - year.contents.value = self._defaults["GetSelfCalLastDateAndTime"]["year"] + year.contents.value = self._defaults['GetSelfCalLastDateAndTime']['year'] # month - if self._defaults["GetSelfCalLastDateAndTime"]["month"] is None: - raise MockFunctionCallError( - "niFgen_GetSelfCalLastDateAndTime", param="month" - ) + if self._defaults['GetSelfCalLastDateAndTime']['month'] is None: + raise MockFunctionCallError("niFgen_GetSelfCalLastDateAndTime", param='month') if month is not None: - month.contents.value = self._defaults["GetSelfCalLastDateAndTime"]["month"] + month.contents.value = self._defaults['GetSelfCalLastDateAndTime']['month'] # day - if self._defaults["GetSelfCalLastDateAndTime"]["day"] is None: - raise MockFunctionCallError("niFgen_GetSelfCalLastDateAndTime", param="day") + if self._defaults['GetSelfCalLastDateAndTime']['day'] is None: + raise MockFunctionCallError("niFgen_GetSelfCalLastDateAndTime", param='day') if day is not None: - day.contents.value = self._defaults["GetSelfCalLastDateAndTime"]["day"] + day.contents.value = self._defaults['GetSelfCalLastDateAndTime']['day'] # hour - if self._defaults["GetSelfCalLastDateAndTime"]["hour"] is None: - raise MockFunctionCallError( - "niFgen_GetSelfCalLastDateAndTime", param="hour" - ) + if self._defaults['GetSelfCalLastDateAndTime']['hour'] is None: + raise MockFunctionCallError("niFgen_GetSelfCalLastDateAndTime", param='hour') if hour is not None: - hour.contents.value = self._defaults["GetSelfCalLastDateAndTime"]["hour"] + hour.contents.value = self._defaults['GetSelfCalLastDateAndTime']['hour'] # minute - if self._defaults["GetSelfCalLastDateAndTime"]["minute"] is None: - raise MockFunctionCallError( - "niFgen_GetSelfCalLastDateAndTime", param="minute" - ) + if self._defaults['GetSelfCalLastDateAndTime']['minute'] is None: + raise MockFunctionCallError("niFgen_GetSelfCalLastDateAndTime", param='minute') if minute is not None: - minute.contents.value = self._defaults["GetSelfCalLastDateAndTime"][ - "minute" - ] - return self._defaults["GetSelfCalLastDateAndTime"]["return"] + minute.contents.value = self._defaults['GetSelfCalLastDateAndTime']['minute'] + return self._defaults['GetSelfCalLastDateAndTime']['return'] def niFgen_GetSelfCalLastTemp(self, vi, temperature): # noqa: N802 - if self._defaults["GetSelfCalLastTemp"]["return"] != 0: - return self._defaults["GetSelfCalLastTemp"]["return"] + if self._defaults['GetSelfCalLastTemp']['return'] != 0: + return self._defaults['GetSelfCalLastTemp']['return'] # temperature - if self._defaults["GetSelfCalLastTemp"]["temperature"] is None: - raise MockFunctionCallError( - "niFgen_GetSelfCalLastTemp", param="temperature" - ) + if self._defaults['GetSelfCalLastTemp']['temperature'] is None: + raise MockFunctionCallError("niFgen_GetSelfCalLastTemp", param='temperature') if temperature is not None: - temperature.contents.value = self._defaults["GetSelfCalLastTemp"][ - "temperature" - ] - return self._defaults["GetSelfCalLastTemp"]["return"] + temperature.contents.value = self._defaults['GetSelfCalLastTemp']['temperature'] + return self._defaults['GetSelfCalLastTemp']['return'] def niFgen_GetSelfCalSupported(self, vi, self_cal_supported): # noqa: N802 - if self._defaults["GetSelfCalSupported"]["return"] != 0: - return self._defaults["GetSelfCalSupported"]["return"] + if self._defaults['GetSelfCalSupported']['return'] != 0: + return self._defaults['GetSelfCalSupported']['return'] # self_cal_supported - if self._defaults["GetSelfCalSupported"]["selfCalSupported"] is None: - raise MockFunctionCallError( - "niFgen_GetSelfCalSupported", param="selfCalSupported" - ) + if self._defaults['GetSelfCalSupported']['selfCalSupported'] is None: + raise MockFunctionCallError("niFgen_GetSelfCalSupported", param='selfCalSupported') if self_cal_supported is not None: - self_cal_supported.contents.value = self._defaults["GetSelfCalSupported"][ - "selfCalSupported" - ] - return self._defaults["GetSelfCalSupported"]["return"] - - def niFgen_ImportAttributeConfigurationBuffer( - self, vi, size_in_bytes, configuration - ): # noqa: N802 - if self._defaults["ImportAttributeConfigurationBuffer"]["return"] != 0: - return self._defaults["ImportAttributeConfigurationBuffer"]["return"] - return self._defaults["ImportAttributeConfigurationBuffer"]["return"] + self_cal_supported.contents.value = self._defaults['GetSelfCalSupported']['selfCalSupported'] + return self._defaults['GetSelfCalSupported']['return'] + + def niFgen_ImportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 + if self._defaults['ImportAttributeConfigurationBuffer']['return'] != 0: + return self._defaults['ImportAttributeConfigurationBuffer']['return'] + return self._defaults['ImportAttributeConfigurationBuffer']['return'] def niFgen_ImportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 - if self._defaults["ImportAttributeConfigurationFile"]["return"] != 0: - return self._defaults["ImportAttributeConfigurationFile"]["return"] - return self._defaults["ImportAttributeConfigurationFile"]["return"] - - def niFgen_InitializeWithChannels( - self, resource_name, channel_name, reset_device, option_string, vi - ): # noqa: N802 - if self._defaults["InitializeWithChannels"]["return"] != 0: - return self._defaults["InitializeWithChannels"]["return"] + if self._defaults['ImportAttributeConfigurationFile']['return'] != 0: + return self._defaults['ImportAttributeConfigurationFile']['return'] + return self._defaults['ImportAttributeConfigurationFile']['return'] + + def niFgen_InitializeWithChannels(self, resource_name, channel_name, reset_device, option_string, vi): # noqa: N802 + if self._defaults['InitializeWithChannels']['return'] != 0: + return self._defaults['InitializeWithChannels']['return'] # vi - if self._defaults["InitializeWithChannels"]["vi"] is None: - raise MockFunctionCallError("niFgen_InitializeWithChannels", param="vi") + if self._defaults['InitializeWithChannels']['vi'] is None: + raise MockFunctionCallError("niFgen_InitializeWithChannels", param='vi') if vi is not None: - vi.contents.value = self._defaults["InitializeWithChannels"]["vi"] - return self._defaults["InitializeWithChannels"]["return"] + vi.contents.value = self._defaults['InitializeWithChannels']['vi'] + return self._defaults['InitializeWithChannels']['return'] def niFgen_InitiateGeneration(self, vi): # noqa: N802 - if self._defaults["InitiateGeneration"]["return"] != 0: - return self._defaults["InitiateGeneration"]["return"] - return self._defaults["InitiateGeneration"]["return"] + if self._defaults['InitiateGeneration']['return'] != 0: + return self._defaults['InitiateGeneration']['return'] + return self._defaults['InitiateGeneration']['return'] def niFgen_IsDone(self, vi, done): # noqa: N802 - if self._defaults["IsDone"]["return"] != 0: - return self._defaults["IsDone"]["return"] + if self._defaults['IsDone']['return'] != 0: + return self._defaults['IsDone']['return'] # done - if self._defaults["IsDone"]["done"] is None: - raise MockFunctionCallError("niFgen_IsDone", param="done") + if self._defaults['IsDone']['done'] is None: + raise MockFunctionCallError("niFgen_IsDone", param='done') if done is not None: - done.contents.value = self._defaults["IsDone"]["done"] - return self._defaults["IsDone"]["return"] + done.contents.value = self._defaults['IsDone']['done'] + return self._defaults['IsDone']['return'] def niFgen_LockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults["LockSession"]["return"] != 0: - return self._defaults["LockSession"]["return"] + if self._defaults['LockSession']['return'] != 0: + return self._defaults['LockSession']['return'] # caller_has_lock - if self._defaults["LockSession"]["callerHasLock"] is None: - raise MockFunctionCallError("niFgen_LockSession", param="callerHasLock") + if self._defaults['LockSession']['callerHasLock'] is None: + raise MockFunctionCallError("niFgen_LockSession", param='callerHasLock') if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults["LockSession"][ - "callerHasLock" - ] - return self._defaults["LockSession"]["return"] - - def niFgen_QueryArbSeqCapabilities( - self, - vi, - maximum_number_of_sequences, - minimum_sequence_length, - maximum_sequence_length, - maximum_loop_count, - ): # noqa: N802 - if self._defaults["QueryArbSeqCapabilities"]["return"] != 0: - return self._defaults["QueryArbSeqCapabilities"]["return"] + caller_has_lock.contents.value = self._defaults['LockSession']['callerHasLock'] + return self._defaults['LockSession']['return'] + + def niFgen_QueryArbSeqCapabilities(self, vi, maximum_number_of_sequences, minimum_sequence_length, maximum_sequence_length, maximum_loop_count): # noqa: N802 + if self._defaults['QueryArbSeqCapabilities']['return'] != 0: + return self._defaults['QueryArbSeqCapabilities']['return'] # maximum_number_of_sequences - if ( - self._defaults["QueryArbSeqCapabilities"]["maximumNumberOfSequences"] - is None - ): - raise MockFunctionCallError( - "niFgen_QueryArbSeqCapabilities", param="maximumNumberOfSequences" - ) + if self._defaults['QueryArbSeqCapabilities']['maximumNumberOfSequences'] is None: + raise MockFunctionCallError("niFgen_QueryArbSeqCapabilities", param='maximumNumberOfSequences') if maximum_number_of_sequences is not None: - maximum_number_of_sequences.contents.value = self._defaults[ - "QueryArbSeqCapabilities" - ]["maximumNumberOfSequences"] + maximum_number_of_sequences.contents.value = self._defaults['QueryArbSeqCapabilities']['maximumNumberOfSequences'] # minimum_sequence_length - if self._defaults["QueryArbSeqCapabilities"]["minimumSequenceLength"] is None: - raise MockFunctionCallError( - "niFgen_QueryArbSeqCapabilities", param="minimumSequenceLength" - ) + if self._defaults['QueryArbSeqCapabilities']['minimumSequenceLength'] is None: + raise MockFunctionCallError("niFgen_QueryArbSeqCapabilities", param='minimumSequenceLength') if minimum_sequence_length is not None: - minimum_sequence_length.contents.value = self._defaults[ - "QueryArbSeqCapabilities" - ]["minimumSequenceLength"] + minimum_sequence_length.contents.value = self._defaults['QueryArbSeqCapabilities']['minimumSequenceLength'] # maximum_sequence_length - if self._defaults["QueryArbSeqCapabilities"]["maximumSequenceLength"] is None: - raise MockFunctionCallError( - "niFgen_QueryArbSeqCapabilities", param="maximumSequenceLength" - ) + if self._defaults['QueryArbSeqCapabilities']['maximumSequenceLength'] is None: + raise MockFunctionCallError("niFgen_QueryArbSeqCapabilities", param='maximumSequenceLength') if maximum_sequence_length is not None: - maximum_sequence_length.contents.value = self._defaults[ - "QueryArbSeqCapabilities" - ]["maximumSequenceLength"] + maximum_sequence_length.contents.value = self._defaults['QueryArbSeqCapabilities']['maximumSequenceLength'] # maximum_loop_count - if self._defaults["QueryArbSeqCapabilities"]["maximumLoopCount"] is None: - raise MockFunctionCallError( - "niFgen_QueryArbSeqCapabilities", param="maximumLoopCount" - ) + if self._defaults['QueryArbSeqCapabilities']['maximumLoopCount'] is None: + raise MockFunctionCallError("niFgen_QueryArbSeqCapabilities", param='maximumLoopCount') if maximum_loop_count is not None: - maximum_loop_count.contents.value = self._defaults[ - "QueryArbSeqCapabilities" - ]["maximumLoopCount"] - return self._defaults["QueryArbSeqCapabilities"]["return"] - - def niFgen_QueryArbWfmCapabilities( - self, - vi, - maximum_number_of_waveforms, - waveform_quantum, - minimum_waveform_size, - maximum_waveform_size, - ): # noqa: N802 - if self._defaults["QueryArbWfmCapabilities"]["return"] != 0: - return self._defaults["QueryArbWfmCapabilities"]["return"] + maximum_loop_count.contents.value = self._defaults['QueryArbSeqCapabilities']['maximumLoopCount'] + return self._defaults['QueryArbSeqCapabilities']['return'] + + def niFgen_QueryArbWfmCapabilities(self, vi, maximum_number_of_waveforms, waveform_quantum, minimum_waveform_size, maximum_waveform_size): # noqa: N802 + if self._defaults['QueryArbWfmCapabilities']['return'] != 0: + return self._defaults['QueryArbWfmCapabilities']['return'] # maximum_number_of_waveforms - if ( - self._defaults["QueryArbWfmCapabilities"]["maximumNumberOfWaveforms"] - is None - ): - raise MockFunctionCallError( - "niFgen_QueryArbWfmCapabilities", param="maximumNumberOfWaveforms" - ) + if self._defaults['QueryArbWfmCapabilities']['maximumNumberOfWaveforms'] is None: + raise MockFunctionCallError("niFgen_QueryArbWfmCapabilities", param='maximumNumberOfWaveforms') if maximum_number_of_waveforms is not None: - maximum_number_of_waveforms.contents.value = self._defaults[ - "QueryArbWfmCapabilities" - ]["maximumNumberOfWaveforms"] + maximum_number_of_waveforms.contents.value = self._defaults['QueryArbWfmCapabilities']['maximumNumberOfWaveforms'] # waveform_quantum - if self._defaults["QueryArbWfmCapabilities"]["waveformQuantum"] is None: - raise MockFunctionCallError( - "niFgen_QueryArbWfmCapabilities", param="waveformQuantum" - ) + if self._defaults['QueryArbWfmCapabilities']['waveformQuantum'] is None: + raise MockFunctionCallError("niFgen_QueryArbWfmCapabilities", param='waveformQuantum') if waveform_quantum is not None: - waveform_quantum.contents.value = self._defaults["QueryArbWfmCapabilities"][ - "waveformQuantum" - ] + waveform_quantum.contents.value = self._defaults['QueryArbWfmCapabilities']['waveformQuantum'] # minimum_waveform_size - if self._defaults["QueryArbWfmCapabilities"]["minimumWaveformSize"] is None: - raise MockFunctionCallError( - "niFgen_QueryArbWfmCapabilities", param="minimumWaveformSize" - ) + if self._defaults['QueryArbWfmCapabilities']['minimumWaveformSize'] is None: + raise MockFunctionCallError("niFgen_QueryArbWfmCapabilities", param='minimumWaveformSize') if minimum_waveform_size is not None: - minimum_waveform_size.contents.value = self._defaults[ - "QueryArbWfmCapabilities" - ]["minimumWaveformSize"] + minimum_waveform_size.contents.value = self._defaults['QueryArbWfmCapabilities']['minimumWaveformSize'] # maximum_waveform_size - if self._defaults["QueryArbWfmCapabilities"]["maximumWaveformSize"] is None: - raise MockFunctionCallError( - "niFgen_QueryArbWfmCapabilities", param="maximumWaveformSize" - ) + if self._defaults['QueryArbWfmCapabilities']['maximumWaveformSize'] is None: + raise MockFunctionCallError("niFgen_QueryArbWfmCapabilities", param='maximumWaveformSize') if maximum_waveform_size is not None: - maximum_waveform_size.contents.value = self._defaults[ - "QueryArbWfmCapabilities" - ]["maximumWaveformSize"] - return self._defaults["QueryArbWfmCapabilities"]["return"] - - def niFgen_QueryFreqListCapabilities( - self, - vi, - maximum_number_of_freq_lists, - minimum_frequency_list_length, - maximum_frequency_list_length, - minimum_frequency_list_duration, - maximum_frequency_list_duration, - frequency_list_duration_quantum, - ): # noqa: N802 - if self._defaults["QueryFreqListCapabilities"]["return"] != 0: - return self._defaults["QueryFreqListCapabilities"]["return"] + maximum_waveform_size.contents.value = self._defaults['QueryArbWfmCapabilities']['maximumWaveformSize'] + return self._defaults['QueryArbWfmCapabilities']['return'] + + def niFgen_QueryFreqListCapabilities(self, vi, maximum_number_of_freq_lists, minimum_frequency_list_length, maximum_frequency_list_length, minimum_frequency_list_duration, maximum_frequency_list_duration, frequency_list_duration_quantum): # noqa: N802 + if self._defaults['QueryFreqListCapabilities']['return'] != 0: + return self._defaults['QueryFreqListCapabilities']['return'] # maximum_number_of_freq_lists - if ( - self._defaults["QueryFreqListCapabilities"]["maximumNumberOfFreqLists"] - is None - ): - raise MockFunctionCallError( - "niFgen_QueryFreqListCapabilities", param="maximumNumberOfFreqLists" - ) + if self._defaults['QueryFreqListCapabilities']['maximumNumberOfFreqLists'] is None: + raise MockFunctionCallError("niFgen_QueryFreqListCapabilities", param='maximumNumberOfFreqLists') if maximum_number_of_freq_lists is not None: - maximum_number_of_freq_lists.contents.value = self._defaults[ - "QueryFreqListCapabilities" - ]["maximumNumberOfFreqLists"] + maximum_number_of_freq_lists.contents.value = self._defaults['QueryFreqListCapabilities']['maximumNumberOfFreqLists'] # minimum_frequency_list_length - if ( - self._defaults["QueryFreqListCapabilities"]["minimumFrequencyListLength"] - is None - ): - raise MockFunctionCallError( - "niFgen_QueryFreqListCapabilities", param="minimumFrequencyListLength" - ) + if self._defaults['QueryFreqListCapabilities']['minimumFrequencyListLength'] is None: + raise MockFunctionCallError("niFgen_QueryFreqListCapabilities", param='minimumFrequencyListLength') if minimum_frequency_list_length is not None: - minimum_frequency_list_length.contents.value = self._defaults[ - "QueryFreqListCapabilities" - ]["minimumFrequencyListLength"] + minimum_frequency_list_length.contents.value = self._defaults['QueryFreqListCapabilities']['minimumFrequencyListLength'] # maximum_frequency_list_length - if ( - self._defaults["QueryFreqListCapabilities"]["maximumFrequencyListLength"] - is None - ): - raise MockFunctionCallError( - "niFgen_QueryFreqListCapabilities", param="maximumFrequencyListLength" - ) + if self._defaults['QueryFreqListCapabilities']['maximumFrequencyListLength'] is None: + raise MockFunctionCallError("niFgen_QueryFreqListCapabilities", param='maximumFrequencyListLength') if maximum_frequency_list_length is not None: - maximum_frequency_list_length.contents.value = self._defaults[ - "QueryFreqListCapabilities" - ]["maximumFrequencyListLength"] + maximum_frequency_list_length.contents.value = self._defaults['QueryFreqListCapabilities']['maximumFrequencyListLength'] # minimum_frequency_list_duration - if ( - self._defaults["QueryFreqListCapabilities"]["minimumFrequencyListDuration"] - is None - ): - raise MockFunctionCallError( - "niFgen_QueryFreqListCapabilities", param="minimumFrequencyListDuration" - ) + if self._defaults['QueryFreqListCapabilities']['minimumFrequencyListDuration'] is None: + raise MockFunctionCallError("niFgen_QueryFreqListCapabilities", param='minimumFrequencyListDuration') if minimum_frequency_list_duration is not None: - minimum_frequency_list_duration.contents.value = self._defaults[ - "QueryFreqListCapabilities" - ]["minimumFrequencyListDuration"] + minimum_frequency_list_duration.contents.value = self._defaults['QueryFreqListCapabilities']['minimumFrequencyListDuration'] # maximum_frequency_list_duration - if ( - self._defaults["QueryFreqListCapabilities"]["maximumFrequencyListDuration"] - is None - ): - raise MockFunctionCallError( - "niFgen_QueryFreqListCapabilities", param="maximumFrequencyListDuration" - ) + if self._defaults['QueryFreqListCapabilities']['maximumFrequencyListDuration'] is None: + raise MockFunctionCallError("niFgen_QueryFreqListCapabilities", param='maximumFrequencyListDuration') if maximum_frequency_list_duration is not None: - maximum_frequency_list_duration.contents.value = self._defaults[ - "QueryFreqListCapabilities" - ]["maximumFrequencyListDuration"] + maximum_frequency_list_duration.contents.value = self._defaults['QueryFreqListCapabilities']['maximumFrequencyListDuration'] # frequency_list_duration_quantum - if ( - self._defaults["QueryFreqListCapabilities"]["frequencyListDurationQuantum"] - is None - ): - raise MockFunctionCallError( - "niFgen_QueryFreqListCapabilities", param="frequencyListDurationQuantum" - ) + if self._defaults['QueryFreqListCapabilities']['frequencyListDurationQuantum'] is None: + raise MockFunctionCallError("niFgen_QueryFreqListCapabilities", param='frequencyListDurationQuantum') if frequency_list_duration_quantum is not None: - frequency_list_duration_quantum.contents.value = self._defaults[ - "QueryFreqListCapabilities" - ]["frequencyListDurationQuantum"] - return self._defaults["QueryFreqListCapabilities"]["return"] + frequency_list_duration_quantum.contents.value = self._defaults['QueryFreqListCapabilities']['frequencyListDurationQuantum'] + return self._defaults['QueryFreqListCapabilities']['return'] def niFgen_ReadCurrentTemperature(self, vi, temperature): # noqa: N802 - if self._defaults["ReadCurrentTemperature"]["return"] != 0: - return self._defaults["ReadCurrentTemperature"]["return"] + if self._defaults['ReadCurrentTemperature']['return'] != 0: + return self._defaults['ReadCurrentTemperature']['return'] # temperature - if self._defaults["ReadCurrentTemperature"]["temperature"] is None: - raise MockFunctionCallError( - "niFgen_ReadCurrentTemperature", param="temperature" - ) + if self._defaults['ReadCurrentTemperature']['temperature'] is None: + raise MockFunctionCallError("niFgen_ReadCurrentTemperature", param='temperature') if temperature is not None: - temperature.contents.value = self._defaults["ReadCurrentTemperature"][ - "temperature" - ] - return self._defaults["ReadCurrentTemperature"]["return"] + temperature.contents.value = self._defaults['ReadCurrentTemperature']['temperature'] + return self._defaults['ReadCurrentTemperature']['return'] def niFgen_ResetDevice(self, vi): # noqa: N802 - if self._defaults["ResetDevice"]["return"] != 0: - return self._defaults["ResetDevice"]["return"] - return self._defaults["ResetDevice"]["return"] + if self._defaults['ResetDevice']['return'] != 0: + return self._defaults['ResetDevice']['return'] + return self._defaults['ResetDevice']['return'] def niFgen_ResetWithDefaults(self, vi): # noqa: N802 - if self._defaults["ResetWithDefaults"]["return"] != 0: - return self._defaults["ResetWithDefaults"]["return"] - return self._defaults["ResetWithDefaults"]["return"] + if self._defaults['ResetWithDefaults']['return'] != 0: + return self._defaults['ResetWithDefaults']['return'] + return self._defaults['ResetWithDefaults']['return'] def niFgen_SelfCal(self, vi): # noqa: N802 - if self._defaults["SelfCal"]["return"] != 0: - return self._defaults["SelfCal"]["return"] - return self._defaults["SelfCal"]["return"] + if self._defaults['SelfCal']['return'] != 0: + return self._defaults['SelfCal']['return'] + return self._defaults['SelfCal']['return'] def niFgen_SendSoftwareEdgeTrigger(self, vi, trigger, trigger_id): # noqa: N802 - if self._defaults["SendSoftwareEdgeTrigger"]["return"] != 0: - return self._defaults["SendSoftwareEdgeTrigger"]["return"] - return self._defaults["SendSoftwareEdgeTrigger"]["return"] - - def niFgen_SetAttributeViBoolean( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["SetAttributeViBoolean"]["return"] != 0: - return self._defaults["SetAttributeViBoolean"]["return"] - return self._defaults["SetAttributeViBoolean"]["return"] - - def niFgen_SetAttributeViInt32( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["SetAttributeViInt32"]["return"] != 0: - return self._defaults["SetAttributeViInt32"]["return"] - return self._defaults["SetAttributeViInt32"]["return"] - - def niFgen_SetAttributeViReal64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["SetAttributeViReal64"]["return"] != 0: - return self._defaults["SetAttributeViReal64"]["return"] - return self._defaults["SetAttributeViReal64"]["return"] - - def niFgen_SetAttributeViString( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["SetAttributeViString"]["return"] != 0: - return self._defaults["SetAttributeViString"]["return"] - return self._defaults["SetAttributeViString"]["return"] - - def niFgen_SetNamedWaveformNextWritePosition( - self, vi, channel_name, waveform_name, relative_to, offset - ): # noqa: N802 - if self._defaults["SetNamedWaveformNextWritePosition"]["return"] != 0: - return self._defaults["SetNamedWaveformNextWritePosition"]["return"] - return self._defaults["SetNamedWaveformNextWritePosition"]["return"] - - def niFgen_SetWaveformNextWritePosition( - self, vi, channel_name, waveform_handle, relative_to, offset - ): # noqa: N802 - if self._defaults["SetWaveformNextWritePosition"]["return"] != 0: - return self._defaults["SetWaveformNextWritePosition"]["return"] - return self._defaults["SetWaveformNextWritePosition"]["return"] + if self._defaults['SendSoftwareEdgeTrigger']['return'] != 0: + return self._defaults['SendSoftwareEdgeTrigger']['return'] + return self._defaults['SendSoftwareEdgeTrigger']['return'] + + def niFgen_SetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['SetAttributeViBoolean']['return'] != 0: + return self._defaults['SetAttributeViBoolean']['return'] + return self._defaults['SetAttributeViBoolean']['return'] + + def niFgen_SetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['SetAttributeViInt32']['return'] != 0: + return self._defaults['SetAttributeViInt32']['return'] + return self._defaults['SetAttributeViInt32']['return'] + + def niFgen_SetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['SetAttributeViReal64']['return'] != 0: + return self._defaults['SetAttributeViReal64']['return'] + return self._defaults['SetAttributeViReal64']['return'] + + def niFgen_SetAttributeViString(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['SetAttributeViString']['return'] != 0: + return self._defaults['SetAttributeViString']['return'] + return self._defaults['SetAttributeViString']['return'] + + def niFgen_SetNamedWaveformNextWritePosition(self, vi, channel_name, waveform_name, relative_to, offset): # noqa: N802 + if self._defaults['SetNamedWaveformNextWritePosition']['return'] != 0: + return self._defaults['SetNamedWaveformNextWritePosition']['return'] + return self._defaults['SetNamedWaveformNextWritePosition']['return'] + + def niFgen_SetWaveformNextWritePosition(self, vi, channel_name, waveform_handle, relative_to, offset): # noqa: N802 + if self._defaults['SetWaveformNextWritePosition']['return'] != 0: + return self._defaults['SetWaveformNextWritePosition']['return'] + return self._defaults['SetWaveformNextWritePosition']['return'] def niFgen_UnlockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults["UnlockSession"]["return"] != 0: - return self._defaults["UnlockSession"]["return"] + if self._defaults['UnlockSession']['return'] != 0: + return self._defaults['UnlockSession']['return'] # caller_has_lock - if self._defaults["UnlockSession"]["callerHasLock"] is None: - raise MockFunctionCallError("niFgen_UnlockSession", param="callerHasLock") + if self._defaults['UnlockSession']['callerHasLock'] is None: + raise MockFunctionCallError("niFgen_UnlockSession", param='callerHasLock') if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults["UnlockSession"][ - "callerHasLock" - ] - return self._defaults["UnlockSession"]["return"] + caller_has_lock.contents.value = self._defaults['UnlockSession']['callerHasLock'] + return self._defaults['UnlockSession']['return'] def niFgen_WaitUntilDone(self, vi, max_time): # noqa: N802 - if self._defaults["WaitUntilDone"]["return"] != 0: - return self._defaults["WaitUntilDone"]["return"] - return self._defaults["WaitUntilDone"]["return"] - - def niFgen_WriteBinary16Waveform( - self, vi, channel_name, waveform_handle, size, data - ): # noqa: N802 - if self._defaults["WriteBinary16Waveform"]["return"] != 0: - return self._defaults["WriteBinary16Waveform"]["return"] - return self._defaults["WriteBinary16Waveform"]["return"] - - def niFgen_WriteNamedWaveformF64( - self, vi, channel_name, waveform_name, size, data - ): # noqa: N802 - if self._defaults["WriteNamedWaveformF64"]["return"] != 0: - return self._defaults["WriteNamedWaveformF64"]["return"] - return self._defaults["WriteNamedWaveformF64"]["return"] - - def niFgen_WriteNamedWaveformI16( - self, vi, channel_name, waveform_name, size, data - ): # noqa: N802 - if self._defaults["WriteNamedWaveformI16"]["return"] != 0: - return self._defaults["WriteNamedWaveformI16"]["return"] - return self._defaults["WriteNamedWaveformI16"]["return"] + if self._defaults['WaitUntilDone']['return'] != 0: + return self._defaults['WaitUntilDone']['return'] + return self._defaults['WaitUntilDone']['return'] + + def niFgen_WriteBinary16Waveform(self, vi, channel_name, waveform_handle, size, data): # noqa: N802 + if self._defaults['WriteBinary16Waveform']['return'] != 0: + return self._defaults['WriteBinary16Waveform']['return'] + return self._defaults['WriteBinary16Waveform']['return'] + + def niFgen_WriteNamedWaveformF64(self, vi, channel_name, waveform_name, size, data): # noqa: N802 + if self._defaults['WriteNamedWaveformF64']['return'] != 0: + return self._defaults['WriteNamedWaveformF64']['return'] + return self._defaults['WriteNamedWaveformF64']['return'] + + def niFgen_WriteNamedWaveformI16(self, vi, channel_name, waveform_name, size, data): # noqa: N802 + if self._defaults['WriteNamedWaveformI16']['return'] != 0: + return self._defaults['WriteNamedWaveformI16']['return'] + return self._defaults['WriteNamedWaveformI16']['return'] def niFgen_WriteScript(self, vi, channel_name, script): # noqa: N802 - if self._defaults["WriteScript"]["return"] != 0: - return self._defaults["WriteScript"]["return"] - return self._defaults["WriteScript"]["return"] + if self._defaults['WriteScript']['return'] != 0: + return self._defaults['WriteScript']['return'] + return self._defaults['WriteScript']['return'] - def niFgen_WriteWaveform( - self, vi, channel_name, waveform_handle, size, data - ): # noqa: N802 - if self._defaults["WriteWaveform"]["return"] != 0: - return self._defaults["WriteWaveform"]["return"] - return self._defaults["WriteWaveform"]["return"] + def niFgen_WriteWaveform(self, vi, channel_name, waveform_handle, size, data): # noqa: N802 + if self._defaults['WriteWaveform']['return'] != 0: + return self._defaults['WriteWaveform']['return'] + return self._defaults['WriteWaveform']['return'] def niFgen_close(self, vi): # noqa: N802 - if self._defaults["close"]["return"] != 0: - return self._defaults["close"]["return"] - return self._defaults["close"]["return"] + if self._defaults['close']['return'] != 0: + return self._defaults['close']['return'] + return self._defaults['close']['return'] def niFgen_error_message(self, vi, error_code, error_message): # noqa: N802 - if self._defaults["error_message"]["return"] != 0: - return self._defaults["error_message"]["return"] + if self._defaults['error_message']['return'] != 0: + return self._defaults['error_message']['return'] # error_message - if self._defaults["error_message"]["errorMessage"] is None: - raise MockFunctionCallError("niFgen_error_message", param="errorMessage") - test_value = self._defaults["error_message"]["errorMessage"] + if self._defaults['error_message']['errorMessage'] is None: + raise MockFunctionCallError("niFgen_error_message", param='errorMessage') + test_value = self._defaults['error_message']['errorMessage'] if type(test_value) is str: - test_value = test_value.encode("ascii") + test_value = test_value.encode('ascii') assert len(error_message) >= len(test_value) for i in range(len(test_value)): error_message[i] = test_value[i] - return self._defaults["error_message"]["return"] + return self._defaults['error_message']['return'] def niFgen_reset(self, vi): # noqa: N802 - if self._defaults["reset"]["return"] != 0: - return self._defaults["reset"]["return"] - return self._defaults["reset"]["return"] + if self._defaults['reset']['return'] != 0: + return self._defaults['reset']['return'] + return self._defaults['reset']['return'] def niFgen_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 - if self._defaults["self_test"]["return"] != 0: - return self._defaults["self_test"]["return"] + if self._defaults['self_test']['return'] != 0: + return self._defaults['self_test']['return'] # self_test_result - if self._defaults["self_test"]["selfTestResult"] is None: - raise MockFunctionCallError("niFgen_self_test", param="selfTestResult") + if self._defaults['self_test']['selfTestResult'] is None: + raise MockFunctionCallError("niFgen_self_test", param='selfTestResult') if self_test_result is not None: - self_test_result.contents.value = self._defaults["self_test"][ - "selfTestResult" - ] + self_test_result.contents.value = self._defaults['self_test']['selfTestResult'] # self_test_message - if self._defaults["self_test"]["selfTestMessage"] is None: - raise MockFunctionCallError("niFgen_self_test", param="selfTestMessage") - test_value = self._defaults["self_test"]["selfTestMessage"] + if self._defaults['self_test']['selfTestMessage'] is None: + raise MockFunctionCallError("niFgen_self_test", param='selfTestMessage') + test_value = self._defaults['self_test']['selfTestMessage'] if type(test_value) is str: - test_value = test_value.encode("ascii") + test_value = test_value.encode('ascii') assert len(self_test_message) >= len(test_value) for i in range(len(test_value)): self_test_message[i] = test_value[i] - return self._defaults["self_test"]["return"] + return self._defaults['self_test']['return'] # Helper function to setup Mock object with default side effects and return values def set_side_effects_and_return_values(self, mock_library): - mock_library.niFgen_AbortGeneration.side_effect = MockFunctionCallError( - "niFgen_AbortGeneration" - ) + mock_library.niFgen_AbortGeneration.side_effect = MockFunctionCallError("niFgen_AbortGeneration") mock_library.niFgen_AbortGeneration.return_value = 0 - mock_library.niFgen_AllocateNamedWaveform.side_effect = MockFunctionCallError( - "niFgen_AllocateNamedWaveform" - ) + mock_library.niFgen_AllocateNamedWaveform.side_effect = MockFunctionCallError("niFgen_AllocateNamedWaveform") mock_library.niFgen_AllocateNamedWaveform.return_value = 0 - mock_library.niFgen_AllocateWaveform.side_effect = MockFunctionCallError( - "niFgen_AllocateWaveform" - ) + mock_library.niFgen_AllocateWaveform.side_effect = MockFunctionCallError("niFgen_AllocateWaveform") mock_library.niFgen_AllocateWaveform.return_value = 0 - mock_library.niFgen_ClearArbMemory.side_effect = MockFunctionCallError( - "niFgen_ClearArbMemory" - ) + mock_library.niFgen_ClearArbMemory.side_effect = MockFunctionCallError("niFgen_ClearArbMemory") mock_library.niFgen_ClearArbMemory.return_value = 0 - mock_library.niFgen_ClearArbSequence.side_effect = MockFunctionCallError( - "niFgen_ClearArbSequence" - ) + mock_library.niFgen_ClearArbSequence.side_effect = MockFunctionCallError("niFgen_ClearArbSequence") mock_library.niFgen_ClearArbSequence.return_value = 0 - mock_library.niFgen_ClearArbWaveform.side_effect = MockFunctionCallError( - "niFgen_ClearArbWaveform" - ) + mock_library.niFgen_ClearArbWaveform.side_effect = MockFunctionCallError("niFgen_ClearArbWaveform") mock_library.niFgen_ClearArbWaveform.return_value = 0 - mock_library.niFgen_ClearFreqList.side_effect = MockFunctionCallError( - "niFgen_ClearFreqList" - ) + mock_library.niFgen_ClearFreqList.side_effect = MockFunctionCallError("niFgen_ClearFreqList") mock_library.niFgen_ClearFreqList.return_value = 0 - mock_library.niFgen_ClearUserStandardWaveform.side_effect = ( - MockFunctionCallError("niFgen_ClearUserStandardWaveform") - ) + mock_library.niFgen_ClearUserStandardWaveform.side_effect = MockFunctionCallError("niFgen_ClearUserStandardWaveform") mock_library.niFgen_ClearUserStandardWaveform.return_value = 0 mock_library.niFgen_Commit.side_effect = MockFunctionCallError("niFgen_Commit") mock_library.niFgen_Commit.return_value = 0 - mock_library.niFgen_ConfigureArbSequence.side_effect = MockFunctionCallError( - "niFgen_ConfigureArbSequence" - ) + mock_library.niFgen_ConfigureArbSequence.side_effect = MockFunctionCallError("niFgen_ConfigureArbSequence") mock_library.niFgen_ConfigureArbSequence.return_value = 0 - mock_library.niFgen_ConfigureArbWaveform.side_effect = MockFunctionCallError( - "niFgen_ConfigureArbWaveform" - ) + mock_library.niFgen_ConfigureArbWaveform.side_effect = MockFunctionCallError("niFgen_ConfigureArbWaveform") mock_library.niFgen_ConfigureArbWaveform.return_value = 0 - mock_library.niFgen_ConfigureFreqList.side_effect = MockFunctionCallError( - "niFgen_ConfigureFreqList" - ) + mock_library.niFgen_ConfigureFreqList.side_effect = MockFunctionCallError("niFgen_ConfigureFreqList") mock_library.niFgen_ConfigureFreqList.return_value = 0 - mock_library.niFgen_ConfigureStandardWaveform.side_effect = ( - MockFunctionCallError("niFgen_ConfigureStandardWaveform") - ) + mock_library.niFgen_ConfigureStandardWaveform.side_effect = MockFunctionCallError("niFgen_ConfigureStandardWaveform") mock_library.niFgen_ConfigureStandardWaveform.return_value = 0 - mock_library.niFgen_CreateAdvancedArbSequence.side_effect = ( - MockFunctionCallError("niFgen_CreateAdvancedArbSequence") - ) + mock_library.niFgen_CreateAdvancedArbSequence.side_effect = MockFunctionCallError("niFgen_CreateAdvancedArbSequence") mock_library.niFgen_CreateAdvancedArbSequence.return_value = 0 - mock_library.niFgen_CreateArbSequence.side_effect = MockFunctionCallError( - "niFgen_CreateArbSequence" - ) + mock_library.niFgen_CreateArbSequence.side_effect = MockFunctionCallError("niFgen_CreateArbSequence") mock_library.niFgen_CreateArbSequence.return_value = 0 - mock_library.niFgen_CreateFreqList.side_effect = MockFunctionCallError( - "niFgen_CreateFreqList" - ) + mock_library.niFgen_CreateFreqList.side_effect = MockFunctionCallError("niFgen_CreateFreqList") mock_library.niFgen_CreateFreqList.return_value = 0 - mock_library.niFgen_CreateWaveformF64.side_effect = MockFunctionCallError( - "niFgen_CreateWaveformF64" - ) + mock_library.niFgen_CreateWaveformF64.side_effect = MockFunctionCallError("niFgen_CreateWaveformF64") mock_library.niFgen_CreateWaveformF64.return_value = 0 - mock_library.niFgen_CreateWaveformFromFileF64.side_effect = ( - MockFunctionCallError("niFgen_CreateWaveformFromFileF64") - ) + mock_library.niFgen_CreateWaveformFromFileF64.side_effect = MockFunctionCallError("niFgen_CreateWaveformFromFileF64") mock_library.niFgen_CreateWaveformFromFileF64.return_value = 0 - mock_library.niFgen_CreateWaveformFromFileI16.side_effect = ( - MockFunctionCallError("niFgen_CreateWaveformFromFileI16") - ) + mock_library.niFgen_CreateWaveformFromFileI16.side_effect = MockFunctionCallError("niFgen_CreateWaveformFromFileI16") mock_library.niFgen_CreateWaveformFromFileI16.return_value = 0 - mock_library.niFgen_CreateWaveformI16.side_effect = MockFunctionCallError( - "niFgen_CreateWaveformI16" - ) + mock_library.niFgen_CreateWaveformI16.side_effect = MockFunctionCallError("niFgen_CreateWaveformI16") mock_library.niFgen_CreateWaveformI16.return_value = 0 - mock_library.niFgen_DefineUserStandardWaveform.side_effect = ( - MockFunctionCallError("niFgen_DefineUserStandardWaveform") - ) + mock_library.niFgen_DefineUserStandardWaveform.side_effect = MockFunctionCallError("niFgen_DefineUserStandardWaveform") mock_library.niFgen_DefineUserStandardWaveform.return_value = 0 - mock_library.niFgen_DeleteNamedWaveform.side_effect = MockFunctionCallError( - "niFgen_DeleteNamedWaveform" - ) + mock_library.niFgen_DeleteNamedWaveform.side_effect = MockFunctionCallError("niFgen_DeleteNamedWaveform") mock_library.niFgen_DeleteNamedWaveform.return_value = 0 - mock_library.niFgen_DeleteScript.side_effect = MockFunctionCallError( - "niFgen_DeleteScript" - ) + mock_library.niFgen_DeleteScript.side_effect = MockFunctionCallError("niFgen_DeleteScript") mock_library.niFgen_DeleteScript.return_value = 0 - mock_library.niFgen_Disable.side_effect = MockFunctionCallError( - "niFgen_Disable" - ) + mock_library.niFgen_Disable.side_effect = MockFunctionCallError("niFgen_Disable") mock_library.niFgen_Disable.return_value = 0 - mock_library.niFgen_ExportAttributeConfigurationBuffer.side_effect = ( - MockFunctionCallError("niFgen_ExportAttributeConfigurationBuffer") - ) + mock_library.niFgen_ExportAttributeConfigurationBuffer.side_effect = MockFunctionCallError("niFgen_ExportAttributeConfigurationBuffer") mock_library.niFgen_ExportAttributeConfigurationBuffer.return_value = 0 - mock_library.niFgen_ExportAttributeConfigurationFile.side_effect = ( - MockFunctionCallError("niFgen_ExportAttributeConfigurationFile") - ) + mock_library.niFgen_ExportAttributeConfigurationFile.side_effect = MockFunctionCallError("niFgen_ExportAttributeConfigurationFile") mock_library.niFgen_ExportAttributeConfigurationFile.return_value = 0 - mock_library.niFgen_GetAttributeViBoolean.side_effect = MockFunctionCallError( - "niFgen_GetAttributeViBoolean" - ) + mock_library.niFgen_GetAttributeViBoolean.side_effect = MockFunctionCallError("niFgen_GetAttributeViBoolean") mock_library.niFgen_GetAttributeViBoolean.return_value = 0 - mock_library.niFgen_GetAttributeViInt32.side_effect = MockFunctionCallError( - "niFgen_GetAttributeViInt32" - ) + mock_library.niFgen_GetAttributeViInt32.side_effect = MockFunctionCallError("niFgen_GetAttributeViInt32") mock_library.niFgen_GetAttributeViInt32.return_value = 0 - mock_library.niFgen_GetAttributeViReal64.side_effect = MockFunctionCallError( - "niFgen_GetAttributeViReal64" - ) + mock_library.niFgen_GetAttributeViReal64.side_effect = MockFunctionCallError("niFgen_GetAttributeViReal64") mock_library.niFgen_GetAttributeViReal64.return_value = 0 - mock_library.niFgen_GetAttributeViString.side_effect = MockFunctionCallError( - "niFgen_GetAttributeViString" - ) + mock_library.niFgen_GetAttributeViString.side_effect = MockFunctionCallError("niFgen_GetAttributeViString") mock_library.niFgen_GetAttributeViString.return_value = 0 - mock_library.niFgen_GetChannelName.side_effect = MockFunctionCallError( - "niFgen_GetChannelName" - ) + mock_library.niFgen_GetChannelName.side_effect = MockFunctionCallError("niFgen_GetChannelName") mock_library.niFgen_GetChannelName.return_value = 0 - mock_library.niFgen_GetError.side_effect = MockFunctionCallError( - "niFgen_GetError" - ) + mock_library.niFgen_GetError.side_effect = MockFunctionCallError("niFgen_GetError") mock_library.niFgen_GetError.return_value = 0 - mock_library.niFgen_GetExtCalLastDateAndTime.side_effect = ( - MockFunctionCallError("niFgen_GetExtCalLastDateAndTime") - ) + mock_library.niFgen_GetExtCalLastDateAndTime.side_effect = MockFunctionCallError("niFgen_GetExtCalLastDateAndTime") mock_library.niFgen_GetExtCalLastDateAndTime.return_value = 0 - mock_library.niFgen_GetExtCalLastTemp.side_effect = MockFunctionCallError( - "niFgen_GetExtCalLastTemp" - ) + mock_library.niFgen_GetExtCalLastTemp.side_effect = MockFunctionCallError("niFgen_GetExtCalLastTemp") mock_library.niFgen_GetExtCalLastTemp.return_value = 0 - mock_library.niFgen_GetExtCalRecommendedInterval.side_effect = ( - MockFunctionCallError("niFgen_GetExtCalRecommendedInterval") - ) + mock_library.niFgen_GetExtCalRecommendedInterval.side_effect = MockFunctionCallError("niFgen_GetExtCalRecommendedInterval") mock_library.niFgen_GetExtCalRecommendedInterval.return_value = 0 - mock_library.niFgen_GetHardwareState.side_effect = MockFunctionCallError( - "niFgen_GetHardwareState" - ) + mock_library.niFgen_GetHardwareState.side_effect = MockFunctionCallError("niFgen_GetHardwareState") mock_library.niFgen_GetHardwareState.return_value = 0 - mock_library.niFgen_GetLastExtCalLastDateAndTime.side_effect = ( - MockFunctionCallError("niFgen_GetLastExtCalLastDateAndTime") - ) + mock_library.niFgen_GetLastExtCalLastDateAndTime.side_effect = MockFunctionCallError("niFgen_GetLastExtCalLastDateAndTime") mock_library.niFgen_GetLastExtCalLastDateAndTime.return_value = 0 - mock_library.niFgen_GetLastSelfCalLastDateAndTime.side_effect = ( - MockFunctionCallError("niFgen_GetLastSelfCalLastDateAndTime") - ) + mock_library.niFgen_GetLastSelfCalLastDateAndTime.side_effect = MockFunctionCallError("niFgen_GetLastSelfCalLastDateAndTime") mock_library.niFgen_GetLastSelfCalLastDateAndTime.return_value = 0 - mock_library.niFgen_GetSelfCalLastDateAndTime.side_effect = ( - MockFunctionCallError("niFgen_GetSelfCalLastDateAndTime") - ) + mock_library.niFgen_GetSelfCalLastDateAndTime.side_effect = MockFunctionCallError("niFgen_GetSelfCalLastDateAndTime") mock_library.niFgen_GetSelfCalLastDateAndTime.return_value = 0 - mock_library.niFgen_GetSelfCalLastTemp.side_effect = MockFunctionCallError( - "niFgen_GetSelfCalLastTemp" - ) + mock_library.niFgen_GetSelfCalLastTemp.side_effect = MockFunctionCallError("niFgen_GetSelfCalLastTemp") mock_library.niFgen_GetSelfCalLastTemp.return_value = 0 - mock_library.niFgen_GetSelfCalSupported.side_effect = MockFunctionCallError( - "niFgen_GetSelfCalSupported" - ) + mock_library.niFgen_GetSelfCalSupported.side_effect = MockFunctionCallError("niFgen_GetSelfCalSupported") mock_library.niFgen_GetSelfCalSupported.return_value = 0 - mock_library.niFgen_ImportAttributeConfigurationBuffer.side_effect = ( - MockFunctionCallError("niFgen_ImportAttributeConfigurationBuffer") - ) + mock_library.niFgen_ImportAttributeConfigurationBuffer.side_effect = MockFunctionCallError("niFgen_ImportAttributeConfigurationBuffer") mock_library.niFgen_ImportAttributeConfigurationBuffer.return_value = 0 - mock_library.niFgen_ImportAttributeConfigurationFile.side_effect = ( - MockFunctionCallError("niFgen_ImportAttributeConfigurationFile") - ) + mock_library.niFgen_ImportAttributeConfigurationFile.side_effect = MockFunctionCallError("niFgen_ImportAttributeConfigurationFile") mock_library.niFgen_ImportAttributeConfigurationFile.return_value = 0 - mock_library.niFgen_InitializeWithChannels.side_effect = MockFunctionCallError( - "niFgen_InitializeWithChannels" - ) + mock_library.niFgen_InitializeWithChannels.side_effect = MockFunctionCallError("niFgen_InitializeWithChannels") mock_library.niFgen_InitializeWithChannels.return_value = 0 - mock_library.niFgen_InitiateGeneration.side_effect = MockFunctionCallError( - "niFgen_InitiateGeneration" - ) + mock_library.niFgen_InitiateGeneration.side_effect = MockFunctionCallError("niFgen_InitiateGeneration") mock_library.niFgen_InitiateGeneration.return_value = 0 mock_library.niFgen_IsDone.side_effect = MockFunctionCallError("niFgen_IsDone") mock_library.niFgen_IsDone.return_value = 0 - mock_library.niFgen_LockSession.side_effect = MockFunctionCallError( - "niFgen_LockSession" - ) + mock_library.niFgen_LockSession.side_effect = MockFunctionCallError("niFgen_LockSession") mock_library.niFgen_LockSession.return_value = 0 - mock_library.niFgen_QueryArbSeqCapabilities.side_effect = MockFunctionCallError( - "niFgen_QueryArbSeqCapabilities" - ) + mock_library.niFgen_QueryArbSeqCapabilities.side_effect = MockFunctionCallError("niFgen_QueryArbSeqCapabilities") mock_library.niFgen_QueryArbSeqCapabilities.return_value = 0 - mock_library.niFgen_QueryArbWfmCapabilities.side_effect = MockFunctionCallError( - "niFgen_QueryArbWfmCapabilities" - ) + mock_library.niFgen_QueryArbWfmCapabilities.side_effect = MockFunctionCallError("niFgen_QueryArbWfmCapabilities") mock_library.niFgen_QueryArbWfmCapabilities.return_value = 0 - mock_library.niFgen_QueryFreqListCapabilities.side_effect = ( - MockFunctionCallError("niFgen_QueryFreqListCapabilities") - ) + mock_library.niFgen_QueryFreqListCapabilities.side_effect = MockFunctionCallError("niFgen_QueryFreqListCapabilities") mock_library.niFgen_QueryFreqListCapabilities.return_value = 0 - mock_library.niFgen_ReadCurrentTemperature.side_effect = MockFunctionCallError( - "niFgen_ReadCurrentTemperature" - ) + mock_library.niFgen_ReadCurrentTemperature.side_effect = MockFunctionCallError("niFgen_ReadCurrentTemperature") mock_library.niFgen_ReadCurrentTemperature.return_value = 0 - mock_library.niFgen_ResetDevice.side_effect = MockFunctionCallError( - "niFgen_ResetDevice" - ) + mock_library.niFgen_ResetDevice.side_effect = MockFunctionCallError("niFgen_ResetDevice") mock_library.niFgen_ResetDevice.return_value = 0 - mock_library.niFgen_ResetWithDefaults.side_effect = MockFunctionCallError( - "niFgen_ResetWithDefaults" - ) + mock_library.niFgen_ResetWithDefaults.side_effect = MockFunctionCallError("niFgen_ResetWithDefaults") mock_library.niFgen_ResetWithDefaults.return_value = 0 - mock_library.niFgen_SelfCal.side_effect = MockFunctionCallError( - "niFgen_SelfCal" - ) + mock_library.niFgen_SelfCal.side_effect = MockFunctionCallError("niFgen_SelfCal") mock_library.niFgen_SelfCal.return_value = 0 - mock_library.niFgen_SendSoftwareEdgeTrigger.side_effect = MockFunctionCallError( - "niFgen_SendSoftwareEdgeTrigger" - ) + mock_library.niFgen_SendSoftwareEdgeTrigger.side_effect = MockFunctionCallError("niFgen_SendSoftwareEdgeTrigger") mock_library.niFgen_SendSoftwareEdgeTrigger.return_value = 0 - mock_library.niFgen_SetAttributeViBoolean.side_effect = MockFunctionCallError( - "niFgen_SetAttributeViBoolean" - ) + mock_library.niFgen_SetAttributeViBoolean.side_effect = MockFunctionCallError("niFgen_SetAttributeViBoolean") mock_library.niFgen_SetAttributeViBoolean.return_value = 0 - mock_library.niFgen_SetAttributeViInt32.side_effect = MockFunctionCallError( - "niFgen_SetAttributeViInt32" - ) + mock_library.niFgen_SetAttributeViInt32.side_effect = MockFunctionCallError("niFgen_SetAttributeViInt32") mock_library.niFgen_SetAttributeViInt32.return_value = 0 - mock_library.niFgen_SetAttributeViReal64.side_effect = MockFunctionCallError( - "niFgen_SetAttributeViReal64" - ) + mock_library.niFgen_SetAttributeViReal64.side_effect = MockFunctionCallError("niFgen_SetAttributeViReal64") mock_library.niFgen_SetAttributeViReal64.return_value = 0 - mock_library.niFgen_SetAttributeViString.side_effect = MockFunctionCallError( - "niFgen_SetAttributeViString" - ) + mock_library.niFgen_SetAttributeViString.side_effect = MockFunctionCallError("niFgen_SetAttributeViString") mock_library.niFgen_SetAttributeViString.return_value = 0 - mock_library.niFgen_SetNamedWaveformNextWritePosition.side_effect = ( - MockFunctionCallError("niFgen_SetNamedWaveformNextWritePosition") - ) + mock_library.niFgen_SetNamedWaveformNextWritePosition.side_effect = MockFunctionCallError("niFgen_SetNamedWaveformNextWritePosition") mock_library.niFgen_SetNamedWaveformNextWritePosition.return_value = 0 - mock_library.niFgen_SetWaveformNextWritePosition.side_effect = ( - MockFunctionCallError("niFgen_SetWaveformNextWritePosition") - ) + mock_library.niFgen_SetWaveformNextWritePosition.side_effect = MockFunctionCallError("niFgen_SetWaveformNextWritePosition") mock_library.niFgen_SetWaveformNextWritePosition.return_value = 0 - mock_library.niFgen_UnlockSession.side_effect = MockFunctionCallError( - "niFgen_UnlockSession" - ) + mock_library.niFgen_UnlockSession.side_effect = MockFunctionCallError("niFgen_UnlockSession") mock_library.niFgen_UnlockSession.return_value = 0 - mock_library.niFgen_WaitUntilDone.side_effect = MockFunctionCallError( - "niFgen_WaitUntilDone" - ) + mock_library.niFgen_WaitUntilDone.side_effect = MockFunctionCallError("niFgen_WaitUntilDone") mock_library.niFgen_WaitUntilDone.return_value = 0 - mock_library.niFgen_WriteBinary16Waveform.side_effect = MockFunctionCallError( - "niFgen_WriteBinary16Waveform" - ) + mock_library.niFgen_WriteBinary16Waveform.side_effect = MockFunctionCallError("niFgen_WriteBinary16Waveform") mock_library.niFgen_WriteBinary16Waveform.return_value = 0 - mock_library.niFgen_WriteNamedWaveformF64.side_effect = MockFunctionCallError( - "niFgen_WriteNamedWaveformF64" - ) + mock_library.niFgen_WriteNamedWaveformF64.side_effect = MockFunctionCallError("niFgen_WriteNamedWaveformF64") mock_library.niFgen_WriteNamedWaveformF64.return_value = 0 - mock_library.niFgen_WriteNamedWaveformI16.side_effect = MockFunctionCallError( - "niFgen_WriteNamedWaveformI16" - ) + mock_library.niFgen_WriteNamedWaveformI16.side_effect = MockFunctionCallError("niFgen_WriteNamedWaveformI16") mock_library.niFgen_WriteNamedWaveformI16.return_value = 0 - mock_library.niFgen_WriteScript.side_effect = MockFunctionCallError( - "niFgen_WriteScript" - ) + mock_library.niFgen_WriteScript.side_effect = MockFunctionCallError("niFgen_WriteScript") mock_library.niFgen_WriteScript.return_value = 0 - mock_library.niFgen_WriteWaveform.side_effect = MockFunctionCallError( - "niFgen_WriteWaveform" - ) + mock_library.niFgen_WriteWaveform.side_effect = MockFunctionCallError("niFgen_WriteWaveform") mock_library.niFgen_WriteWaveform.return_value = 0 mock_library.niFgen_close.side_effect = MockFunctionCallError("niFgen_close") mock_library.niFgen_close.return_value = 0 - mock_library.niFgen_error_message.side_effect = MockFunctionCallError( - "niFgen_error_message" - ) + mock_library.niFgen_error_message.side_effect = MockFunctionCallError("niFgen_error_message") mock_library.niFgen_error_message.return_value = 0 mock_library.niFgen_reset.side_effect = MockFunctionCallError("niFgen_reset") mock_library.niFgen_reset.return_value = 0 - mock_library.niFgen_self_test.side_effect = MockFunctionCallError( - "niFgen_self_test" - ) + mock_library.niFgen_self_test.side_effect = MockFunctionCallError("niFgen_self_test") mock_library.niFgen_self_test.return_value = 0 diff --git a/generated/nifgen/setup.py b/generated/nifgen/setup.py index 53bb9762d..04f91f5a2 100644 --- a/generated/nifgen/setup.py +++ b/generated/nifgen/setup.py @@ -15,45 +15,42 @@ def finalize_options(self): def run_tests(self): import pytest - pytest.main(self.test_args) -pypi_name = "nifgen" +pypi_name = 'nifgen' def read_contents(file_to_read): - with open(file_to_read, "r") as f: + with open(file_to_read, 'r') as f: return f.read() setup( name=pypi_name, zip_safe=True, - version="1.4.2.dev0", - description="NI-FGEN Python API", - long_description=read_contents("README.rst"), - long_description_content_type="text/x-rst", - author="NI", + version='1.4.2.dev0', + description='NI-FGEN Python API', + long_description=read_contents('README.rst'), + long_description_content_type='text/x-rst', + author='NI', author_email="opensource@ni.com", url="https://github.com/ni/nimi-python", maintainer="NI", maintainer_email="opensource@ni.com", - keywords=["nifgen"], - license="MIT", + keywords=['nifgen'], + license='MIT', include_package_data=True, - packages=["nifgen"], + packages=['nifgen'], install_requires=[ 'enum34;python_version<"3.4"', 'singledispatch;python_version<"3.4"', - "hightime>=0.2.0", - "nitclk", - ], - setup_requires=[ - "pytest-runner", + 'hightime>=0.2.0', + 'nitclk', ], - tests_require=["pytest"], - test_suite="tests", + setup_requires=['pytest-runner', ], + tests_require=['pytest'], + test_suite='tests', classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -68,8 +65,8 @@ def read_contents(file_to_read): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", - "Topic :: System :: Hardware :: Hardware Drivers", + "Topic :: System :: Hardware :: Hardware Drivers" ], - cmdclass={"test": PyTest}, - package_data={pypi_name: ["VERSION"]}, + cmdclass={'test': PyTest}, + package_data={pypi_name: ['VERSION']}, ) diff --git a/generated/nimodinst/nimodinst/__init__.py b/generated/nimodinst/nimodinst/__init__.py index 649a9858b..2419dd9ac 100644 --- a/generated/nimodinst/nimodinst/__init__.py +++ b/generated/nimodinst/nimodinst/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = "1.4.2.dev0" +__version__ = '1.4.2.dev0' from nimodinst.errors import DriverWarning # noqa: F401 from nimodinst.errors import Error # noqa: F401 @@ -10,12 +10,12 @@ def get_diagnostic_information(): - """Get diagnostic information about the system state that is suitable for printing or logging + '''Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - """ + ''' import os import pkg_resources import platform @@ -23,80 +23,73 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return struct.calcsize("P") == 8 + return (struct.calcsize("P") == 8) def is_os_64bit(): - return platform.machine().endswith("64") + return platform.machine().endswith('64') def is_venv(): - return "VIRTUAL_ENV" in os.environ + return 'VIRTUAL_ENV' in os.environ info = {} - info["os"] = {} - info["python"] = {} - info["driver"] = {} - info["module"] = {} - if platform.system() == "Windows": + info['os'] = {} + info['python'] = {} + info['driver'] = {} + info['module'] = {} + if platform.system() == 'Windows': try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = "Windows" + os_name = 'Windows' try: - driver_version_key = winreg.OpenKey( - winreg.HKEY_LOCAL_MACHINE, - r"SOFTWARE\National Instruments\NI-ModInst\CurrentVersion", - ) + driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-ModInst\CurrentVersion") driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = "Unknown" - elif platform.system() == "Linux": - os_name = "Linux" - driver_version = "Unknown" + driver_version = 'Unknown' + elif platform.system() == 'Linux': + os_name = 'Linux' + driver_version = 'Unknown' else: - raise SystemError("Unsupported platform: {}".format(platform.system())) + raise SystemError('Unsupported platform: {}'.format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [ - { - "name": i.key, - "version": i.version, - } - for i in installed_packages - ] - - info["os"]["name"] = os_name - info["os"]["version"] = platform.version() - info["os"]["bits"] = "64" if is_os_64bit() else "32" - info["driver"]["name"] = "NI-ModInst" - info["driver"]["version"] = driver_version - info["module"]["name"] = "nimodinst" - info["module"]["version"] = "1.4.2.dev0" - info["python"]["version"] = sys.version - info["python"]["bits"] = "64" if is_python_64bit() else "32" - info["python"]["is_venv"] = is_venv() - info["python"]["packages"] = installed_packages_list + installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] + + info['os']['name'] = os_name + info['os']['version'] = platform.version() + info['os']['bits'] = '64' if is_os_64bit() else '32' + info['driver']['name'] = "NI-ModInst" + info['driver']['version'] = driver_version + info['module']['name'] = 'nimodinst' + info['module']['version'] = "1.4.2.dev0" + info['python']['version'] = sys.version + info['python']['bits'] = '64' if is_python_64bit() else '32' + info['python']['is_venv'] = is_venv() + info['python']['packages'] = installed_packages_list return info def print_diagnostic_information(): - """Print diagnostic information in a format suitable for issue report + '''Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - """ + ''' info = get_diagnostic_information() - row_format = " {:<10} {}" - for type in ["OS", "Driver", "Module", "Python"]: + row_format = ' {:<10} {}' + for type in ['OS', 'Driver', 'Module', 'Python']: typename = type.lower() - print(type + ":") + print(type + ':') for item in info[typename]: - if item != "packages": - print(row_format.format(item.title() + ":", info[typename][item])) - print(" Installed Packages:") - for p in info["python"]["packages"]: - print((" " * 8) + p["name"] + "==" + p["version"]) + if item != 'packages': + print(row_format.format(item.title() + ':', info[typename][item])) + print(' Installed Packages:') + for p in info['python']['packages']: + print((' ' * 8) + p['name'] + '==' + p['version']) return info + + diff --git a/generated/nimodinst/nimodinst/_converters.py b/generated/nimodinst/nimodinst/_converters.py index f58b2d776..8851ba799 100644 --- a/generated/nimodinst/nimodinst/_converters.py +++ b/generated/nimodinst/nimodinst/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - """Base version that should not be called + '''Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,38 +40,36 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - """ - raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) + ''' + raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - """Integer version""" + '''Integer version''' return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - """String version (this is the most complex) + '''String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - """ + ''' # First we deal with a list - rep_cap_list = repeated_capability.split(",") + rep_cap_list = repeated_capability.split(',') if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, "").replace(":", "-") - rc = r.split("-") + r = repeated_capability.strip().replace(prefix, '').replace(':', '-') + rc = r.split('-') if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError( - "Multiple '-' or ':'", repeated_capability - ) + raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) try: start = int(rc[0]) end = int(rc[1]) @@ -87,7 +85,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, "").strip()] + return [repeated_capability.replace(prefix, '').strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -96,7 +94,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - """Iterable version - can handle lists, ranges, and tuples""" + '''Iterable version - can handle lists, ranges, and tuples''' rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -105,22 +103,16 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - """slice version""" - + '''slice version''' def ifnone(a, b): return b if a is None else a - # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range( - ifnone(repeated_capability.start, 0), - repeated_capability.stop, - ifnone(repeated_capability.step, 1), - ) + rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=""): - """Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=''): + '''Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -128,17 +120,15 @@ def convert_repeated_capabilities(repeated_capability, prefix=""): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - """ + ''' # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [ - prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) - ] + return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] def convert_repeated_capabilities_without_prefix(repeated_capability): - """Convert a repeated capabilities object, without any prefix, to a comma delimited list + '''Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -154,8 +144,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - """ - return ",".join(convert_repeated_capabilities(repeated_capability, "")) + ''' + return ','.join(convert_repeated_capabilities(repeated_capability, '')) def _convert_timedelta(value, library_type, scaling): @@ -168,14 +158,7 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [ - _visatype.ViInt64, - _visatype.ViInt32, - _visatype.ViUInt32, - _visatype.ViInt16, - _visatype.ViUInt16, - _visatype.ViInt8, - ]: + if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -212,36 +195,34 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - "rangecheck": "RangeCheck", - "queryinstrstatus": "QueryInstrStatus", - "cache": "Cache", - "simulate": "Simulate", - "recordcoercions": "RecordCoercions", - "interchangecheck": "InterchangeCheck", - "driversetup": "DriverSetup", - "range_check": "RangeCheck", - "query_instr_status": "QueryInstrStatus", - "record_coercions": "RecordCoercions", - "interchange_check": "InterchangeCheck", - "driver_setup": "DriverSetup", + 'rangecheck': 'RangeCheck', + 'queryinstrstatus': 'QueryInstrStatus', + 'cache': 'Cache', + 'simulate': 'Simulate', + 'recordcoercions': 'RecordCoercions', + 'interchangecheck': 'InterchangeCheck', + 'driversetup': 'DriverSetup', + 'range_check': 'RangeCheck', + 'query_instr_status': 'QueryInstrStatus', + 'record_coercions': 'RecordCoercions', + 'interchange_check': 'InterchangeCheck', + 'driver_setup': 'DriverSetup', } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": - value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") - elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": + if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': + value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') + elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': if not isinstance(values[k], dict): - raise TypeError("DriverSetup must be a dictionary") - value = "DriverSetup=" + ( - ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) - ) + raise TypeError('DriverSetup must be a dictionary') + value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) else: - value = k + ("=1" if values[k] is True else "=0") + value = k + ('=1' if values[k] is True else '=0') init_with_options.append(value) - init_with_options_string = ",".join(init_with_options) + init_with_options_string = ','.join(init_with_options) return init_with_options_string @@ -270,11 +251,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(",")] + return [x.strip() for x in comma_separated_string.split(',')] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -286,17 +267,11 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - """ - chained_repeated_capability_items = convert_comma_separated_string_to_list( - chained_repeated_capability - ) - repeated_capability_lists = [ - [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) - ] + ''' + chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) + repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] for item in chained_repeated_capability_items: - repeated_capability_lists = [ - x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) - ] - return [ - ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists - ] + repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] + return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] + + diff --git a/generated/nimodinst/nimodinst/_library.py b/generated/nimodinst/nimodinst/_library.py index c6bcc66d2..7f1f8f140 100644 --- a/generated/nimodinst/nimodinst/_library.py +++ b/generated/nimodinst/nimodinst/_library.py @@ -9,11 +9,11 @@ class Library(object): - """Library + '''Library Wrapper around driver library. Class will setup the correct ctypes information for every function on first call. - """ + ''' def __init__(self, ctypes_library): self._func_lock = threading.Lock() @@ -35,99 +35,39 @@ def _get_library_function(self, name): def niModInst_CloseInstalledDevicesSession(self, handle): # noqa: N802 with self._func_lock: if self.niModInst_CloseInstalledDevicesSession_cfunc is None: - self.niModInst_CloseInstalledDevicesSession_cfunc = ( - self._get_library_function("niModInst_CloseInstalledDevicesSession") - ) - self.niModInst_CloseInstalledDevicesSession_cfunc.argtypes = [ - ViSession - ] # noqa: F405 - self.niModInst_CloseInstalledDevicesSession_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niModInst_CloseInstalledDevicesSession_cfunc = self._get_library_function('niModInst_CloseInstalledDevicesSession') + self.niModInst_CloseInstalledDevicesSession_cfunc.argtypes = [ViSession] # noqa: F405 + self.niModInst_CloseInstalledDevicesSession_cfunc.restype = ViStatus # noqa: F405 return self.niModInst_CloseInstalledDevicesSession_cfunc(handle) - def niModInst_GetExtendedErrorInfo( - self, error_info_buffer_size, error_info - ): # noqa: N802 + def niModInst_GetExtendedErrorInfo(self, error_info_buffer_size, error_info): # noqa: N802 with self._func_lock: if self.niModInst_GetExtendedErrorInfo_cfunc is None: - self.niModInst_GetExtendedErrorInfo_cfunc = self._get_library_function( - "niModInst_GetExtendedErrorInfo" - ) - self.niModInst_GetExtendedErrorInfo_cfunc.argtypes = [ - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niModInst_GetExtendedErrorInfo_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niModInst_GetExtendedErrorInfo_cfunc( - error_info_buffer_size, error_info - ) + self.niModInst_GetExtendedErrorInfo_cfunc = self._get_library_function('niModInst_GetExtendedErrorInfo') + self.niModInst_GetExtendedErrorInfo_cfunc.argtypes = [ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niModInst_GetExtendedErrorInfo_cfunc.restype = ViStatus # noqa: F405 + return self.niModInst_GetExtendedErrorInfo_cfunc(error_info_buffer_size, error_info) - def niModInst_GetInstalledDeviceAttributeViInt32( - self, handle, index, attribute_id, attribute_value - ): # noqa: N802 + def niModInst_GetInstalledDeviceAttributeViInt32(self, handle, index, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niModInst_GetInstalledDeviceAttributeViInt32_cfunc is None: - self.niModInst_GetInstalledDeviceAttributeViInt32_cfunc = ( - self._get_library_function( - "niModInst_GetInstalledDeviceAttributeViInt32" - ) - ) - self.niModInst_GetInstalledDeviceAttributeViInt32_cfunc.argtypes = [ - ViSession, - ViInt32, - ViInt32, - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niModInst_GetInstalledDeviceAttributeViInt32_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niModInst_GetInstalledDeviceAttributeViInt32_cfunc( - handle, index, attribute_id, attribute_value - ) + self.niModInst_GetInstalledDeviceAttributeViInt32_cfunc = self._get_library_function('niModInst_GetInstalledDeviceAttributeViInt32') + self.niModInst_GetInstalledDeviceAttributeViInt32_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViInt32)] # noqa: F405 + self.niModInst_GetInstalledDeviceAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 + return self.niModInst_GetInstalledDeviceAttributeViInt32_cfunc(handle, index, attribute_id, attribute_value) - def niModInst_GetInstalledDeviceAttributeViString( - self, handle, index, attribute_id, attribute_value_buffer_size, attribute_value - ): # noqa: N802 + def niModInst_GetInstalledDeviceAttributeViString(self, handle, index, attribute_id, attribute_value_buffer_size, attribute_value): # noqa: N802 with self._func_lock: if self.niModInst_GetInstalledDeviceAttributeViString_cfunc is None: - self.niModInst_GetInstalledDeviceAttributeViString_cfunc = ( - self._get_library_function( - "niModInst_GetInstalledDeviceAttributeViString" - ) - ) - self.niModInst_GetInstalledDeviceAttributeViString_cfunc.argtypes = [ - ViSession, - ViInt32, - ViInt32, - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niModInst_GetInstalledDeviceAttributeViString_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niModInst_GetInstalledDeviceAttributeViString_cfunc( - handle, index, attribute_id, attribute_value_buffer_size, attribute_value - ) + self.niModInst_GetInstalledDeviceAttributeViString_cfunc = self._get_library_function('niModInst_GetInstalledDeviceAttributeViString') + self.niModInst_GetInstalledDeviceAttributeViString_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niModInst_GetInstalledDeviceAttributeViString_cfunc.restype = ViStatus # noqa: F405 + return self.niModInst_GetInstalledDeviceAttributeViString_cfunc(handle, index, attribute_id, attribute_value_buffer_size, attribute_value) - def niModInst_OpenInstalledDevicesSession( - self, driver, handle, device_count - ): # noqa: N802 + def niModInst_OpenInstalledDevicesSession(self, driver, handle, device_count): # noqa: N802 with self._func_lock: if self.niModInst_OpenInstalledDevicesSession_cfunc is None: - self.niModInst_OpenInstalledDevicesSession_cfunc = ( - self._get_library_function("niModInst_OpenInstalledDevicesSession") - ) - self.niModInst_OpenInstalledDevicesSession_cfunc.argtypes = [ - ctypes.POINTER(ViChar), - ctypes.POINTER(ViSession), - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niModInst_OpenInstalledDevicesSession_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niModInst_OpenInstalledDevicesSession_cfunc( - driver, handle, device_count - ) + self.niModInst_OpenInstalledDevicesSession_cfunc = self._get_library_function('niModInst_OpenInstalledDevicesSession') + self.niModInst_OpenInstalledDevicesSession_cfunc.argtypes = [ctypes.POINTER(ViChar), ctypes.POINTER(ViSession), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niModInst_OpenInstalledDevicesSession_cfunc.restype = ViStatus # noqa: F405 + return self.niModInst_OpenInstalledDevicesSession_cfunc(driver, handle, device_count) diff --git a/generated/nimodinst/nimodinst/_library_singleton.py b/generated/nimodinst/nimodinst/_library_singleton.py index c2cdc3fa1..283ecb6c1 100644 --- a/generated/nimodinst/nimodinst/_library_singleton.py +++ b/generated/nimodinst/nimodinst/_library_singleton.py @@ -12,36 +12,30 @@ _instance = None _instance_lock = threading.Lock() -_library_info = { - "Linux": {"64bit": {"name": "nimodinst", "type": "cdll"}}, - "Windows": { - "32bit": {"name": "niModInst.dll", "type": "windll"}, - "64bit": {"name": "niModInst_64.dll", "type": "cdll"}, - }, -} +_library_info = {'Linux': {'64bit': {'name': 'nimodinst', 'type': 'cdll'}}, + 'Windows': {'32bit': {'name': 'niModInst.dll', 'type': 'windll'}, + '64bit': {'name': 'niModInst_64.dll', 'type': 'cdll'}}} def _get_library_name(): try: - return ctypes.util.find_library( - _library_info[platform.system()][platform.architecture()[0]]["name"] - ) # We find and return full path to the DLL + return ctypes.util.find_library(_library_info[platform.system()][platform.architecture()[0]]['name']) # We find and return full path to the DLL except KeyError: raise errors.UnsupportedConfigurationError def _get_library_type(): try: - return _library_info[platform.system()][platform.architecture()[0]]["type"] + return _library_info[platform.system()][platform.architecture()[0]]['type'] except KeyError: raise errors.UnsupportedConfigurationError def get(): - """get + '''get Returns the library.Library singleton for nimodinst. - """ + ''' global _instance global _instance_lock @@ -49,12 +43,13 @@ def get(): if _instance is None: try: library_type = _get_library_type() - if library_type == "windll": + if library_type == 'windll': ctypes_library = ctypes.WinDLL(_get_library_name()) else: - assert library_type == "cdll" + assert library_type == 'cdll' ctypes_library = ctypes.CDLL(_get_library_name()) except OSError: raise errors.DriverNotInstalledError() _instance = _library.Library(ctypes_library) return _instance + diff --git a/generated/nimodinst/nimodinst/_visatype.py b/generated/nimodinst/nimodinst/_visatype.py index bf96c3cfb..02cc41d1b 100644 --- a/generated/nimodinst/nimodinst/_visatype.py +++ b/generated/nimodinst/nimodinst/_visatype.py @@ -2,9 +2,9 @@ import ctypes -"""Definitions of the VISA types used by the C API of the driver runtime. +'''Definitions of the VISA types used by the C API of the driver runtime. These are aliased directly to ctypes types so can be used directly to call into the library. -""" +''' ViChar = ctypes.c_char @@ -26,3 +26,4 @@ ViAttr = ViUInt32 ViConstString = ViString ViRsrc = ViString + diff --git a/generated/nimodinst/nimodinst/errors.py b/generated/nimodinst/nimodinst/errors.py index d7451e47a..08f307aac 100644 --- a/generated/nimodinst/nimodinst/errors.py +++ b/generated/nimodinst/nimodinst/errors.py @@ -7,81 +7,70 @@ def _is_success(code): - return code == 0 + return (code == 0) def _is_error(code): - return code < 0 + return (code < 0) def _is_warning(code): - return code > 0 + return (code > 0) class Error(Exception): - """Base error class for NI-ModInst""" + '''Base error class for NI-ModInst''' def __init__(self, message): super(Error, self).__init__(message) class DriverError(Error): - """An error originating from the NI-ModInst driver""" + '''An error originating from the NI-ModInst driver''' def __init__(self, code, description): - assert _is_error(code), "Should not raise Error if code is not fatal." + assert (_is_error(code)), "Should not raise Error if code is not fatal." self.code = code self.description = description super(DriverError, self).__init__(str(self.code) + ": " + self.description) class DriverWarning(Warning): - """A warning originating from the NI-ModInst driver""" + '''A warning originating from the NI-ModInst driver''' def __init__(self, code, description): - assert _is_warning(code), "Should not create Warning if code is not positive." - super(DriverWarning, self).__init__( - "Warning {0} occurred.\n\n{1}".format(code, description) - ) + assert (_is_warning(code)), "Should not create Warning if code is not positive." + super(DriverWarning, self).__init__('Warning {0} occurred.\n\n{1}'.format(code, description)) class UnsupportedConfigurationError(Error): - """An error due to using this module in an usupported platform.""" + '''An error due to using this module in an usupported platform.''' def __init__(self): - super(UnsupportedConfigurationError, self).__init__( - "System configuration is unsupported: " - + platform.architecture()[0] - + " " - + platform.system() - ) + super(UnsupportedConfigurationError, self).__init__('System configuration is unsupported: ' + platform.architecture()[0] + ' ' + platform.system()) class DriverNotInstalledError(Error): - """An error due to using this module without the driver runtime installed.""" + '''An error due to using this module without the driver runtime installed.''' def __init__(self): - super(DriverNotInstalledError, self).__init__( - "The NI-ModInst runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it." - ) + super(DriverNotInstalledError, self).__init__('The NI-ModInst runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it.') class DriverTooOldError(Error): - """An error due to using this module with an older version of the driver runtime.""" + '''An error due to using this module with an older version of the driver runtime.''' def __init__(self): - super(DriverTooOldError, self).__init__( - "A function was not found in the NI-ModInst runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it." - ) + super(DriverTooOldError, self).__init__('A function was not found in the NI-ModInst runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it.') def handle_error(session, code, ignore_warnings, is_error_handling): - """handle_error + '''handle_error Helper function for handling errors returned by nimodinst.Library. It calls back into the session to get the corresponding error description and raises if necessary. - """ + ''' if _is_success(code) or (_is_warning(code) and ignore_warnings): return @@ -89,7 +78,7 @@ def handle_error(session, code, ignore_warnings, is_error_handling): if is_error_handling: # The caller is in the midst of error handling and an error occurred. # Don't try to get the description or we'll start recursing until the stack overflows. - description = "" + description = '' else: description = session._get_error_description(code) @@ -98,3 +87,5 @@ def handle_error(session, code, ignore_warnings, is_error_handling): assert _is_warning(code) warnings.warn(DriverWarning(code, description)) + + diff --git a/generated/nimodinst/nimodinst/session.py b/generated/nimodinst/nimodinst/session.py index 42630f897..423587a81 100644 --- a/generated/nimodinst/nimodinst/session.py +++ b/generated/nimodinst/nimodinst/session.py @@ -13,27 +13,25 @@ class AttributeViInt32(object): + def __init__(self, owner, attribute_id, index): self._owner = owner self._index = index self._attribute_id = attribute_id def __getitem__(self, index): - return self._owner._get_installed_device_attribute_vi_int32( - self._index, self._attribute_id - ) + return self._owner._get_installed_device_attribute_vi_int32(self._index, self._attribute_id) class AttributeViString(object): + def __init__(self, owner, attribute_id, index): self._owner = owner self._index = index self._attribute_id = attribute_id def __getitem__(self, index): - return self._owner._get_installed_device_attribute_vi_string( - self._index, self._attribute_id - ) + return self._owner._get_installed_device_attribute_vi_string(self._index, self._attribute_id) class _Device(object): @@ -44,81 +42,62 @@ class _Device(object): def __init__(self, owner, index): self._index = index self.bus_number = AttributeViInt32(owner, 12, index=index) - """ + ''' The bus on which the device has been enumerated. - """ + ''' self.chassis_number = AttributeViInt32(owner, 11, index=index) - """ + ''' The number of the chassis in which the device is installed. This property can only be queried for PXI devices installed in a chassis that has been properly identified in MAX. - """ + ''' self.device_model = AttributeViString(owner, 1, index=index) - """ + ''' The model of the device (for example, NI PXI-5122) - """ + ''' self.device_name = AttributeViString(owner, 0, index=index) - """ + ''' The name of the device, which can be used to open an instrument driver session for that device - """ + ''' self.max_pciexpress_link_width = AttributeViInt32(owner, 18, index=index) - """ + ''' **MAX_PCIEXPRESS_LINK_WIDTH** - """ + ''' self.pciexpress_link_width = AttributeViInt32(owner, 17, index=index) - """ + ''' **PCIEXPRESS_LINK_WIDTH** - """ + ''' self.serial_number = AttributeViString(owner, 2, index=index) - """ + ''' The serial number of the device - """ + ''' self.slot_number = AttributeViInt32(owner, 10, index=index) - """ + ''' The slot (for example, in a PXI chassis) in which the device is installed. This property can only be queried for PXI devices installed in a chassis that has been properly identified in MAX. - """ + ''' self.socket_number = AttributeViInt32(owner, 13, index=index) - """ + ''' The socket number on which the device has been enumerated - """ - self._param_list = "owner=" + pp.pformat(owner) + ", index=" + pp.pformat(index) + ''' + self._param_list = 'owner=' + pp.pformat(owner) + ', index=' + pp.pformat(index) self._is_frozen = True def __repr__(self): - return "{0}.{1}({2})".format( - "nimodinst", self.__class__.__name__, self._param_list - ) + return '{0}.{1}({2})'.format('nimodinst', self.__class__.__name__, self._param_list) def __str__(self): - ret_str = self.__repr__() + ":\n" - ret_str += " bus_number = " + pp.pformat(self.bus_number) + "\n" - ret_str += " chassis_number = " + pp.pformat(self.chassis_number) + "\n" - ret_str += " device_model = " + pp.pformat(self.device_model) + "\n" - ret_str += " device_name = " + pp.pformat(self.device_name) + "\n" - ret_str += ( - " max_pciexpress_link_width = " - + pp.pformat(self.max_pciexpress_link_width) - + "\n" - ) - ret_str += ( - " pciexpress_link_width = " - + pp.pformat(self.pciexpress_link_width) - + "\n" - ) - ret_str += " serial_number = " + pp.pformat(self.serial_number) + "\n" - ret_str += " slot_number = " + pp.pformat(self.slot_number) + "\n" - ret_str += " socket_number = " + pp.pformat(self.socket_number) + "\n" + ret_str = self.__repr__() + ':\n' + ret_str += ' bus_number = ' + pp.pformat(self.bus_number) + '\n' + ret_str += ' chassis_number = ' + pp.pformat(self.chassis_number) + '\n' + ret_str += ' device_model = ' + pp.pformat(self.device_model) + '\n' + ret_str += ' device_name = ' + pp.pformat(self.device_name) + '\n' + ret_str += ' max_pciexpress_link_width = ' + pp.pformat(self.max_pciexpress_link_width) + '\n' + ret_str += ' pciexpress_link_width = ' + pp.pformat(self.pciexpress_link_width) + '\n' + ret_str += ' serial_number = ' + pp.pformat(self.serial_number) + '\n' + ret_str += ' slot_number = ' + pp.pformat(self.slot_number) + '\n' + ret_str += ' socket_number = ' + pp.pformat(self.socket_number) + '\n' return ret_str def __getattribute__(self, name): - if name in [ - "_is_frozen", - "index", - "_param_list", - "__class__", - "__name__", - "__repr__", - "__str__", - "__setattr__", - ]: + if name in ['_is_frozen', 'index', '_param_list', '__class__', '__name__', '__repr__', '__str__', '__setattr__', ]: return object.__getattribute__(self, name) else: return object.__getattribute__(self, name).__getitem__(None) @@ -134,7 +113,7 @@ def __init__(self, owner, count): self._current_index = 0 self._owner = owner self._count = count - self._param_list = "owner=" + pp.pformat(owner) + ", count=" + pp.pformat(count) + self._param_list = 'owner=' + pp.pformat(owner) + ', count=' + pp.pformat(count) self._is_frozen = True def _get_next(self): @@ -152,18 +131,16 @@ def __next__(self): return self._get_next() def __repr__(self): - return "{0}.{1}({2})".format( - "nimodinst", self.__class__.__name__, self._param_list - ) + return '{0}.{1}({2})'.format('nimodinst', self.__class__.__name__, self._param_list) def __str__(self): - ret_str = self.__repr__() + ":\n" - ret_str += " current index = {0}".format(self._current_index) + ret_str = self.__repr__() + ':\n' + ret_str += ' current index = {0}'.format(self._current_index) return ret_str class Session(object): - """A NI-ModInst session to get device information""" + '''A NI-ModInst session to get device information''' # This is needed during __init__. Without it, __setattr__ raises an exception _is_frozen = False @@ -172,7 +149,7 @@ def __init__(self, driver): self._handle = 0 self._item_count = 0 self._current_item = 0 - self._encoding = "windows-1251" + self._encoding = 'windows-1251' self._library = _library_singleton.get() self._handle, self._item_count = self._open_installed_devices_session(driver) self._param_list = "driver=" + pp.pformat(driver) @@ -184,14 +161,12 @@ def __init__(self, driver): self._is_frozen = True def __repr__(self): - return "{0}.{1}({2})".format( - "nimodinst", self.__class__.__name__, self._param_list - ) + return '{0}.{1}({2})'.format('nimodinst', self.__class__.__name__, self._param_list) def __str__(self): - ret_str = self.__repr__() + ":\n" + ret_str = self.__repr__() + ':\n' for i in range(self._item_count): - ret_str += str(_Device(self, i)) + "\n" + ret_str += str(_Device(self, i)) + '\n' return ret_str def __setattr__(self, key, value): @@ -206,29 +181,23 @@ def __exit__(self, exc_type, exc_value, traceback): self.close() def _get_error_description(self, error_code): - """_get_error_description + '''_get_error_description Returns the error description. - """ + ''' # We hand-maintain the code that calls into self._library rather than leverage code-generation # because niModInst_GetExtendedErrorInfo() does not properly do the IVI-dance. # See https://github.com/ni/nimi-python/issues/166 error_info_buffer_size_ctype = _visatype.ViInt32() # case S170 error_info_ctype = None # case C050 - error_code = self._library.niModInst_GetExtendedErrorInfo( - error_info_buffer_size_ctype, error_info_ctype - ) + error_code = self._library.niModInst_GetExtendedErrorInfo(error_info_buffer_size_ctype, error_info_ctype) if error_code <= 0: return "Failed to retrieve error description." error_info_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - error_info_ctype = ( - _visatype.ViChar * error_info_buffer_size_ctype.value - )() # case C060 + error_info_ctype = (_visatype.ViChar * error_info_buffer_size_ctype.value)() # case C060 # Note we don't look at the return value. This is intentional as niModInst returns the # original error code rather than 0 (VI_SUCCESS). - self._library.niModInst_GetExtendedErrorInfo( - error_info_buffer_size_ctype, error_info_ctype - ) + self._library.niModInst_GetExtendedErrorInfo(error_info_buffer_size_ctype, error_info_ctype) return error_info_ctype.value.decode("ascii") # Iterator functions @@ -246,24 +215,21 @@ def close(self): raise self._handle = 0 - """ These are code-generated """ - + ''' These are code-generated ''' def _close_installed_devices_session(self): - r"""_close_installed_devices_session + r'''_close_installed_devices_session Cleans up the NI-ModInst session created by a call to _open_installed_devices_session. Call this method when you are finished using the session handle and do not use this handle again. - """ + ''' handle_ctype = _visatype.ViSession(self._handle) # case S110 error_code = self._library.niModInst_CloseInstalledDevicesSession(handle_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def _get_extended_error_info(self): - r"""_get_extended_error_info + r'''_get_extended_error_info Returns detailed information about the last error that occurred in the current thread during a call to one of the NI-ModInst methods. When @@ -283,29 +249,19 @@ def _get_extended_error_info(self): Returns: error_info (str): The character buffer into which the error information string is copied. - """ + ''' error_info_buffer_size_ctype = _visatype.ViInt32() # case S170 error_info_ctype = None # case C050 - error_code = self._library.niModInst_GetExtendedErrorInfo( - error_info_buffer_size_ctype, error_info_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=True - ) + error_code = self._library.niModInst_GetExtendedErrorInfo(error_info_buffer_size_ctype, error_info_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True) error_info_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - error_info_ctype = ( - _visatype.ViChar * error_info_buffer_size_ctype.value - )() # case C060 - error_code = self._library.niModInst_GetExtendedErrorInfo( - error_info_buffer_size_ctype, error_info_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + error_info_ctype = (_visatype.ViChar * error_info_buffer_size_ctype.value)() # case C060 + error_code = self._library.niModInst_GetExtendedErrorInfo(error_info_buffer_size_ctype, error_info_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return error_info_ctype.value.decode(self._encoding) def _get_installed_device_attribute_vi_int32(self, index, attribute_id): - r"""_get_installed_device_attribute_vi_int32 + r'''_get_installed_device_attribute_vi_int32 Returns an integer property specified by the attributeID parameter for a device specified by the handle and index parameters. The handle @@ -338,26 +294,17 @@ def _get_installed_device_attribute_vi_int32(self, index, attribute_id): attribute_value (int): A pointer to a signed 32-bit integer variable that receives the value of the requested property. - """ + ''' handle_ctype = _visatype.ViSession(self._handle) # case S110 index_ctype = _visatype.ViInt32(index) # case S150 attribute_id_ctype = _visatype.ViInt32(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niModInst_GetInstalledDeviceAttributeViInt32( - handle_ctype, - index_ctype, - attribute_id_ctype, - None - if attribute_value_ctype is None - else (ctypes.pointer(attribute_value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niModInst_GetInstalledDeviceAttributeViInt32(handle_ctype, index_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(attribute_value_ctype.value) def _get_installed_device_attribute_vi_string(self, index, attribute_id): - r"""_get_installed_device_attribute_vi_string + r'''_get_installed_device_attribute_vi_string Returns a string property specified by the attributeID parameter for a device specified by the handle and index parameters. The handle @@ -389,40 +336,22 @@ def _get_installed_device_attribute_vi_string(self, index, attribute_id): Returns: attribute_value (str): The character buffer into which the property value string is copied. - """ + ''' handle_ctype = _visatype.ViSession(self._handle) # case S110 index_ctype = _visatype.ViInt32(index) # case S150 attribute_id_ctype = _visatype.ViInt32(attribute_id) # case S150 attribute_value_buffer_size_ctype = _visatype.ViInt32() # case S170 attribute_value_ctype = None # case C050 - error_code = self._library.niModInst_GetInstalledDeviceAttributeViString( - handle_ctype, - index_ctype, - attribute_id_ctype, - attribute_value_buffer_size_ctype, - attribute_value_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niModInst_GetInstalledDeviceAttributeViString(handle_ctype, index_ctype, attribute_id_ctype, attribute_value_buffer_size_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) attribute_value_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - attribute_value_ctype = ( - _visatype.ViChar * attribute_value_buffer_size_ctype.value - )() # case C060 - error_code = self._library.niModInst_GetInstalledDeviceAttributeViString( - handle_ctype, - index_ctype, - attribute_id_ctype, - attribute_value_buffer_size_ctype, - attribute_value_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + attribute_value_ctype = (_visatype.ViChar * attribute_value_buffer_size_ctype.value)() # case C060 + error_code = self._library.niModInst_GetInstalledDeviceAttributeViString(handle_ctype, index_ctype, attribute_id_ctype, attribute_value_buffer_size_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return attribute_value_ctype.value.decode(self._encoding) def _open_installed_devices_session(self, driver): - r"""_open_installed_devices_session + r'''_open_installed_devices_session Creates a handle to a list of installed devices supported by the specified driver. Call this method and pass in the name of a National @@ -456,20 +385,12 @@ def _open_installed_devices_session(self, driver): found in the system that are supported by the driver specified in the driver parameter. - """ - driver_ctype = ctypes.create_string_buffer( - driver.encode(self._encoding) - ) # case C020 + ''' + driver_ctype = ctypes.create_string_buffer(driver.encode(self._encoding)) # case C020 handle_ctype = _visatype.ViSession() # case S220 device_count_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niModInst_OpenInstalledDevicesSession( - driver_ctype, - None if handle_ctype is None else (ctypes.pointer(handle_ctype)), - None - if device_count_ctype is None - else (ctypes.pointer(device_count_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niModInst_OpenInstalledDevicesSession(driver_ctype, None if handle_ctype is None else (ctypes.pointer(handle_ctype)), None if device_count_ctype is None else (ctypes.pointer(device_count_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(handle_ctype.value), int(device_count_ctype.value) + + diff --git a/generated/nimodinst/nimodinst/unit_tests/_matchers.py b/generated/nimodinst/nimodinst/unit_tests/_matchers.py index 4749a584e..879e2b3ff 100644 --- a/generated/nimodinst/nimodinst/unit_tests/_matchers.py +++ b/generated/nimodinst/nimodinst/unit_tests/_matchers.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # This file was generated -"""Matcher classes used by unit tests in order to set mock expectations. +'''Matcher classes used by unit tests in order to set mock expectations. These work well with our visatype definitions. -""" +''' import ctypes import nimodinst._visatype as _visatype @@ -21,27 +21,15 @@ def __init__(self, expected_type, expected_value): def __eq__(self, other): if not isinstance(other, self.expected_type): - print( - "{0}: Unexpected type. Expected: {1}. Received: {2}".format( - self.__class__.__name__, self.expected_type, type(other) - ) - ) + print("{0}: Unexpected type. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_type, type(other))) return False if other.value != self.expected_value: - print( - "{0}: Unexpected value. Expected: {1}. Received: {2}".format( - self.__class__.__name__, self.expected_value, other.value - ) - ) + print("{0}: Unexpected value. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_value, other.value)) return False return True def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_type), - pp.pformat(self.expected_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) class _PointerMatcher(object): @@ -50,18 +38,12 @@ def __init__(self, expected_type): def __eq__(self, other): if not isinstance(other, ctypes.POINTER(self.expected_type)): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - ctypes.POINTER(self.expected_type), type(other) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(ctypes.POINTER(self.expected_type), type(other))) return False return True def __repr__(self): - return "{0}({1})".format( - self.__class__.__name__, pp.pformat(self.expected_type) - ) + return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_type)) class _BufferMatcher(object): @@ -88,47 +70,29 @@ def __eq__(self, other): pass # Because of object lifetimes, we may need to mock the other instance and provide lists instead of the actual array - if not isinstance(other, self.expected_type) and not isinstance( - other, list - ): - print( - "Unexpected type. Expected: {0} or {1}. Received: {2}".format( - self.expected_type, list, type(other) - ) - ) + if not isinstance(other, self.expected_type) and not isinstance(other, list): + print("Unexpected type. Expected: {0} or {1}. Received: {2}".format(self.expected_type, list, type(other))) return False if self.expected_size != len(other): - print( - "Unexpected length. Expected: {0}. Received: {1}".format( - self.expected_size, len(other) - ) - ) + print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(other))) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for i in range(0, len(self.expected_value)): if self.expected_value[i] != other[i]: - print( - "Unexpected value at index {0}. Expected: {1}. Received: {2}".format( - i, self.expected_value[i], other[i] - ) - ) + print("Unexpected value at index {0}. Expected: {1}. Received: {2}".format(i, self.expected_value[i], other[i])) return False return True def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self._expected_element_type), - pp.pformat(self._expected_size_or_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self._expected_element_type), pp.pformat(self._expected_size_or_value)) def __str__(self): - ret_str = self.__repr__() + "\n" - ret_str += " expected_type = " + str(self.expected_type) + "\n" - ret_str += " expected_value = " + str(self.expected_value) + "\n" - ret_str += " expected_size = " + str(self.expected_size) + "\n" + ret_str = self.__repr__() + '\n' + ret_str += ' expected_type = ' + str(self.expected_type) + '\n' + ret_str += ' expected_value = ' + str(self.expected_value) + '\n' + ret_str += ' expected_size = ' + str(self.expected_size) + '\n' return ret_str @@ -148,37 +112,21 @@ def __eq__(self, other): pass if not isinstance(other, ctypes.Array): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_type, type(other) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(other))) return False - if ( - len(other) < len(self.expected_string_value) + 1 - ): # +1 for NULL terminating character - print( - "Unexpected length in C string. Expected at least: {0}. Received {1}".format( - len(other), len(self.expected_string_value) + 1 - ) - ) + if len(other) < len(self.expected_string_value) + 1: # +1 for NULL terminating character + print("Unexpected length in C string. Expected at least: {0}. Received {1}".format(len(other), len(self.expected_string_value) + 1)) return False if not isinstance(other[0], bytes): print("Unexpected type. Not a string. Received: {0}".format(type(other[0]))) return False if other.value.decode("ascii") != self.expected_string_value: - print( - "Unexpected value. Expected {0}. Received: {1}".format( - self.expected_string_value, other.value.decode - ) - ) + print("Unexpected value. Expected {0}. Received: {1}".format(self.expected_string_value, other.value.decode)) return False return True def __repr__(self): - return "{0}({1})".format( - self.__class__.__name__, pp.pformat(self.expected_string_value) - ) + return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_string_value)) # Custom Type @@ -191,11 +139,7 @@ def _compare_ctype_structs(expected, actual): expected_val = getattr(expected, field_name) actual_val = getattr(actual, field_name) if expected_val != actual_val: - print( - "Unexpected value field {0}. Expected: {1}. Received: {2}".format( - field_name, expected_val, actual_val - ) - ) + print("Unexpected value field {0}. Expected: {1}. Received: {2}".format(field_name, expected_val, actual_val)) return False return True @@ -207,20 +151,12 @@ def __init__(self, expected_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_type, type(actual) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) return False return _compare_ctype_structs(self.expected_value, actual) def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_type), - pp.pformat(self.expected_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) class CustomTypeBufferMatcher(object): @@ -232,48 +168,30 @@ def __init__(self, expected_element_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print( - "Unexpected array type. Expected: {0}. Received: {1}".format( - self.expected_type, type(actual) - ) - ) + print("Unexpected array type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) return False if self.expected_size != len(actual): - print( - "Unexpected length. Expected: {0}. Received: {1}".format( - self.expected_size, len(actual) - ) - ) + print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(actual))) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for a, e in zip(actual, self.expected_value): if not isinstance(a, self.expected_element_type): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_element_type, type(a) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_element_type, type(a))) return False if not _compare_ctype_structs(e, a): return False return True def __repr__(self): - expected_val_repr = ( - "[" + ", ".join([x.__repr__() for x in self.expected_value]) + "]" - ) - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_element_type), - expected_val_repr, - ) + expected_val_repr = '[' + ', '.join([x.__repr__() for x in self.expected_value]) + ']' + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_element_type), expected_val_repr) def __str__(self): - ret_str = self.__repr__() + "\n" - ret_str += " expected_type = " + str(self.expected_type) + "\n" - ret_str += " expected_size = " + str(self.expected_size) + "\n" + ret_str = self.__repr__() + '\n' + ret_str += ' expected_type = ' + str(self.expected_type) + '\n' + ret_str += ' expected_size = ' + str(self.expected_size) + '\n' return ret_str @@ -282,9 +200,7 @@ def __str__(self): class ViBooleanMatcher(_ScalarMatcher): def __init__(self, expected_value): - _ScalarMatcher.__init__( - self, _visatype.ViBoolean, 1 if expected_value is True else 0 - ) + _ScalarMatcher.__init__(self, _visatype.ViBoolean, 1 if expected_value is True else 0) class ViSessionMatcher(_ScalarMatcher): @@ -396,3 +312,6 @@ def __init__(self, expected_size_or_value): class ViSessionBufferMatcher(_BufferMatcher): def __init__(self, expected_size_or_value): _BufferMatcher.__init__(self, _visatype.ViSession, expected_size_or_value) + + + diff --git a/generated/nimodinst/nimodinst/unit_tests/_mock_helper.py b/generated/nimodinst/nimodinst/unit_tests/_mock_helper.py index 03ab8d5b6..8493cf03a 100644 --- a/generated/nimodinst/nimodinst/unit_tests/_mock_helper.py +++ b/generated/nimodinst/nimodinst/unit_tests/_mock_helper.py @@ -16,21 +16,21 @@ def __init__(self, function, param=None): class SideEffectsHelper(object): def __init__(self): self._defaults = {} - self._defaults["CloseInstalledDevicesSession"] = {} - self._defaults["CloseInstalledDevicesSession"]["return"] = 0 - self._defaults["GetExtendedErrorInfo"] = {} - self._defaults["GetExtendedErrorInfo"]["return"] = 0 - self._defaults["GetExtendedErrorInfo"]["errorInfo"] = None - self._defaults["GetInstalledDeviceAttributeViInt32"] = {} - self._defaults["GetInstalledDeviceAttributeViInt32"]["return"] = 0 - self._defaults["GetInstalledDeviceAttributeViInt32"]["attributeValue"] = None - self._defaults["GetInstalledDeviceAttributeViString"] = {} - self._defaults["GetInstalledDeviceAttributeViString"]["return"] = 0 - self._defaults["GetInstalledDeviceAttributeViString"]["attributeValue"] = None - self._defaults["OpenInstalledDevicesSession"] = {} - self._defaults["OpenInstalledDevicesSession"]["return"] = 0 - self._defaults["OpenInstalledDevicesSession"]["handle"] = None - self._defaults["OpenInstalledDevicesSession"]["deviceCount"] = None + self._defaults['CloseInstalledDevicesSession'] = {} + self._defaults['CloseInstalledDevicesSession']['return'] = 0 + self._defaults['GetExtendedErrorInfo'] = {} + self._defaults['GetExtendedErrorInfo']['return'] = 0 + self._defaults['GetExtendedErrorInfo']['errorInfo'] = None + self._defaults['GetInstalledDeviceAttributeViInt32'] = {} + self._defaults['GetInstalledDeviceAttributeViInt32']['return'] = 0 + self._defaults['GetInstalledDeviceAttributeViInt32']['attributeValue'] = None + self._defaults['GetInstalledDeviceAttributeViString'] = {} + self._defaults['GetInstalledDeviceAttributeViString']['return'] = 0 + self._defaults['GetInstalledDeviceAttributeViString']['attributeValue'] = None + self._defaults['OpenInstalledDevicesSession'] = {} + self._defaults['OpenInstalledDevicesSession']['return'] = 0 + self._defaults['OpenInstalledDevicesSession']['handle'] = None + self._defaults['OpenInstalledDevicesSession']['deviceCount'] = None def __getitem__(self, func): return self._defaults[func] @@ -39,110 +39,64 @@ def __setitem__(self, func, val): self._defaults[func] = val def niModInst_CloseInstalledDevicesSession(self, handle): # noqa: N802 - if self._defaults["CloseInstalledDevicesSession"]["return"] != 0: - return self._defaults["CloseInstalledDevicesSession"]["return"] - return self._defaults["CloseInstalledDevicesSession"]["return"] + if self._defaults['CloseInstalledDevicesSession']['return'] != 0: + return self._defaults['CloseInstalledDevicesSession']['return'] + return self._defaults['CloseInstalledDevicesSession']['return'] - def niModInst_GetExtendedErrorInfo( - self, error_info_buffer_size, error_info - ): # noqa: N802 - if self._defaults["GetExtendedErrorInfo"]["return"] != 0: - return self._defaults["GetExtendedErrorInfo"]["return"] - if self._defaults["GetExtendedErrorInfo"]["errorInfo"] is None: - raise MockFunctionCallError( - "niModInst_GetExtendedErrorInfo", param="errorInfo" - ) + def niModInst_GetExtendedErrorInfo(self, error_info_buffer_size, error_info): # noqa: N802 + if self._defaults['GetExtendedErrorInfo']['return'] != 0: + return self._defaults['GetExtendedErrorInfo']['return'] + if self._defaults['GetExtendedErrorInfo']['errorInfo'] is None: + raise MockFunctionCallError("niModInst_GetExtendedErrorInfo", param='errorInfo') if error_info_buffer_size.value == 0: - return len(self._defaults["GetExtendedErrorInfo"]["errorInfo"]) - error_info.value = self._defaults["GetExtendedErrorInfo"]["errorInfo"].encode( - "ascii" - ) - return self._defaults["GetExtendedErrorInfo"]["return"] + return len(self._defaults['GetExtendedErrorInfo']['errorInfo']) + error_info.value = self._defaults['GetExtendedErrorInfo']['errorInfo'].encode('ascii') + return self._defaults['GetExtendedErrorInfo']['return'] - def niModInst_GetInstalledDeviceAttributeViInt32( - self, handle, index, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["GetInstalledDeviceAttributeViInt32"]["return"] != 0: - return self._defaults["GetInstalledDeviceAttributeViInt32"]["return"] + def niModInst_GetInstalledDeviceAttributeViInt32(self, handle, index, attribute_id, attribute_value): # noqa: N802 + if self._defaults['GetInstalledDeviceAttributeViInt32']['return'] != 0: + return self._defaults['GetInstalledDeviceAttributeViInt32']['return'] # attribute_value - if ( - self._defaults["GetInstalledDeviceAttributeViInt32"]["attributeValue"] - is None - ): - raise MockFunctionCallError( - "niModInst_GetInstalledDeviceAttributeViInt32", param="attributeValue" - ) + if self._defaults['GetInstalledDeviceAttributeViInt32']['attributeValue'] is None: + raise MockFunctionCallError("niModInst_GetInstalledDeviceAttributeViInt32", param='attributeValue') if attribute_value is not None: - attribute_value.contents.value = self._defaults[ - "GetInstalledDeviceAttributeViInt32" - ]["attributeValue"] - return self._defaults["GetInstalledDeviceAttributeViInt32"]["return"] + attribute_value.contents.value = self._defaults['GetInstalledDeviceAttributeViInt32']['attributeValue'] + return self._defaults['GetInstalledDeviceAttributeViInt32']['return'] - def niModInst_GetInstalledDeviceAttributeViString( - self, handle, index, attribute_id, attribute_value_buffer_size, attribute_value - ): # noqa: N802 - if self._defaults["GetInstalledDeviceAttributeViString"]["return"] != 0: - return self._defaults["GetInstalledDeviceAttributeViString"]["return"] - if ( - self._defaults["GetInstalledDeviceAttributeViString"]["attributeValue"] - is None - ): - raise MockFunctionCallError( - "niModInst_GetInstalledDeviceAttributeViString", param="attributeValue" - ) + def niModInst_GetInstalledDeviceAttributeViString(self, handle, index, attribute_id, attribute_value_buffer_size, attribute_value): # noqa: N802 + if self._defaults['GetInstalledDeviceAttributeViString']['return'] != 0: + return self._defaults['GetInstalledDeviceAttributeViString']['return'] + if self._defaults['GetInstalledDeviceAttributeViString']['attributeValue'] is None: + raise MockFunctionCallError("niModInst_GetInstalledDeviceAttributeViString", param='attributeValue') if attribute_value_buffer_size.value == 0: - return len( - self._defaults["GetInstalledDeviceAttributeViString"]["attributeValue"] - ) - attribute_value.value = self._defaults["GetInstalledDeviceAttributeViString"][ - "attributeValue" - ].encode("ascii") - return self._defaults["GetInstalledDeviceAttributeViString"]["return"] + return len(self._defaults['GetInstalledDeviceAttributeViString']['attributeValue']) + attribute_value.value = self._defaults['GetInstalledDeviceAttributeViString']['attributeValue'].encode('ascii') + return self._defaults['GetInstalledDeviceAttributeViString']['return'] - def niModInst_OpenInstalledDevicesSession( - self, driver, handle, device_count - ): # noqa: N802 - if self._defaults["OpenInstalledDevicesSession"]["return"] != 0: - return self._defaults["OpenInstalledDevicesSession"]["return"] + def niModInst_OpenInstalledDevicesSession(self, driver, handle, device_count): # noqa: N802 + if self._defaults['OpenInstalledDevicesSession']['return'] != 0: + return self._defaults['OpenInstalledDevicesSession']['return'] # handle - if self._defaults["OpenInstalledDevicesSession"]["handle"] is None: - raise MockFunctionCallError( - "niModInst_OpenInstalledDevicesSession", param="handle" - ) + if self._defaults['OpenInstalledDevicesSession']['handle'] is None: + raise MockFunctionCallError("niModInst_OpenInstalledDevicesSession", param='handle') if handle is not None: - handle.contents.value = self._defaults["OpenInstalledDevicesSession"][ - "handle" - ] + handle.contents.value = self._defaults['OpenInstalledDevicesSession']['handle'] # device_count - if self._defaults["OpenInstalledDevicesSession"]["deviceCount"] is None: - raise MockFunctionCallError( - "niModInst_OpenInstalledDevicesSession", param="deviceCount" - ) + if self._defaults['OpenInstalledDevicesSession']['deviceCount'] is None: + raise MockFunctionCallError("niModInst_OpenInstalledDevicesSession", param='deviceCount') if device_count is not None: - device_count.contents.value = self._defaults["OpenInstalledDevicesSession"][ - "deviceCount" - ] - return self._defaults["OpenInstalledDevicesSession"]["return"] + device_count.contents.value = self._defaults['OpenInstalledDevicesSession']['deviceCount'] + return self._defaults['OpenInstalledDevicesSession']['return'] # Helper function to setup Mock object with default side effects and return values def set_side_effects_and_return_values(self, mock_library): - mock_library.niModInst_CloseInstalledDevicesSession.side_effect = ( - MockFunctionCallError("niModInst_CloseInstalledDevicesSession") - ) + mock_library.niModInst_CloseInstalledDevicesSession.side_effect = MockFunctionCallError("niModInst_CloseInstalledDevicesSession") mock_library.niModInst_CloseInstalledDevicesSession.return_value = 0 - mock_library.niModInst_GetExtendedErrorInfo.side_effect = MockFunctionCallError( - "niModInst_GetExtendedErrorInfo" - ) + mock_library.niModInst_GetExtendedErrorInfo.side_effect = MockFunctionCallError("niModInst_GetExtendedErrorInfo") mock_library.niModInst_GetExtendedErrorInfo.return_value = 0 - mock_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = ( - MockFunctionCallError("niModInst_GetInstalledDeviceAttributeViInt32") - ) + mock_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = MockFunctionCallError("niModInst_GetInstalledDeviceAttributeViInt32") mock_library.niModInst_GetInstalledDeviceAttributeViInt32.return_value = 0 - mock_library.niModInst_GetInstalledDeviceAttributeViString.side_effect = ( - MockFunctionCallError("niModInst_GetInstalledDeviceAttributeViString") - ) + mock_library.niModInst_GetInstalledDeviceAttributeViString.side_effect = MockFunctionCallError("niModInst_GetInstalledDeviceAttributeViString") mock_library.niModInst_GetInstalledDeviceAttributeViString.return_value = 0 - mock_library.niModInst_OpenInstalledDevicesSession.side_effect = ( - MockFunctionCallError("niModInst_OpenInstalledDevicesSession") - ) + mock_library.niModInst_OpenInstalledDevicesSession.side_effect = MockFunctionCallError("niModInst_OpenInstalledDevicesSession") mock_library.niModInst_OpenInstalledDevicesSession.return_value = 0 diff --git a/generated/nimodinst/nimodinst/unit_tests/test_modinst.py b/generated/nimodinst/nimodinst/unit_tests/test_modinst.py index 60424d545..92f3bea51 100644 --- a/generated/nimodinst/nimodinst/unit_tests/test_modinst.py +++ b/generated/nimodinst/nimodinst/unit_tests/test_modinst.py @@ -11,34 +11,19 @@ class TestSession(object): def setup_method(self, method): - self.patched_library_patcher = patch( - "nimodinst._library.Library", autospec=True - ) + self.patched_library_patcher = patch('nimodinst._library.Library', autospec=True) self.patched_library = self.patched_library_patcher.start() - self.patched_library_singleton_get = patch( - "nimodinst.session._library_singleton.get", - return_value=self.patched_library, - ) + self.patched_library_singleton_get = patch('nimodinst.session._library_singleton.get', return_value=self.patched_library) self.patched_library_singleton_get.start() self.side_effects_helper = _mock_helper.SideEffectsHelper() - self.side_effects_helper.set_side_effects_and_return_values( - self.patched_library - ) - self.patched_library.niModInst_OpenInstalledDevicesSession.side_effect = ( - self.side_effects_helper.niModInst_OpenInstalledDevicesSession - ) - self.disallow_close = ( - self.patched_library.niModInst_CloseInstalledDevicesSession.side_effect - ) - self.patched_library.niModInst_CloseInstalledDevicesSession.side_effect = ( - self.side_effects_helper.niModInst_CloseInstalledDevicesSession - ) - - self.side_effects_helper["OpenInstalledDevicesSession"][ - "handle" - ] = SESSION_NUM_FOR_TEST - self.side_effects_helper["OpenInstalledDevicesSession"]["deviceCount"] = 1 + self.side_effects_helper.set_side_effects_and_return_values(self.patched_library) + self.patched_library.niModInst_OpenInstalledDevicesSession.side_effect = self.side_effects_helper.niModInst_OpenInstalledDevicesSession + self.disallow_close = self.patched_library.niModInst_CloseInstalledDevicesSession.side_effect + self.patched_library.niModInst_CloseInstalledDevicesSession.side_effect = self.side_effects_helper.niModInst_CloseInstalledDevicesSession + + self.side_effects_helper['OpenInstalledDevicesSession']['handle'] = SESSION_NUM_FOR_TEST + self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = 1 self.iteration_device_looping = 0 self.num_int_devices_looping = 3 @@ -51,66 +36,44 @@ def teardown_method(self, method): self.patched_library_patcher.stop() # Helper function for mocking multiple devices - def niModInst_GetInstalledDeviceAttributeViString_looping( - self, handle, index, attribute_id, attribute_value_buffer_size, attribute_value - ): # noqa: N802 + def niModInst_GetInstalledDeviceAttributeViString_looping(self, handle, index, attribute_id, attribute_value_buffer_size, attribute_value): # noqa: N802 if attribute_value_buffer_size.value == 0: # TODO(marcoskirsch): What about the byte for the NULL character? Issue #526 - return len(self.string_vals_device_looping[self.iteration_device_looping]) - bytes_to_copy = self.string_vals_device_looping[ - self.iteration_device_looping - ].encode("ascii") + return (len(self.string_vals_device_looping[self.iteration_device_looping])) + bytes_to_copy = self.string_vals_device_looping[self.iteration_device_looping].encode('ascii') for i in range(0, len(bytes_to_copy)): attribute_value[i] = bytes_to_copy[i] self.iteration_device_looping += 1 return 0 # Helper function for mocking multiple devices - def niModInst_GetInstalledDeviceAttributeViInt32_looping( - self, handle, index, attribute_id, attribute_value - ): # noqa: N802 - attribute_value.contents.value = self.int_vals_device_looping[ - self.iteration_device_looping - ] + def niModInst_GetInstalledDeviceAttributeViInt32_looping(self, handle, index, attribute_id, attribute_value): # noqa: N802 + attribute_value.contents.value = self.int_vals_device_looping[self.iteration_device_looping] self.iteration_device_looping += 1 return 0 # API Tests def test_open_and_close(self): - session = nimodinst.Session("") - self.patched_library.niModInst_OpenInstalledDevicesSession.assert_called_once_with( - _matchers.ViStringMatcher(""), - _matchers.ViSessionPointerMatcher(), - _matchers.ViInt32PointerMatcher(), - ) + session = nimodinst.Session('') + self.patched_library.niModInst_OpenInstalledDevicesSession.assert_called_once_with(_matchers.ViStringMatcher(''), _matchers.ViSessionPointerMatcher(), _matchers.ViInt32PointerMatcher()) session.close() - self.patched_library.niModInst_CloseInstalledDevicesSession.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) - ) + self.patched_library.niModInst_CloseInstalledDevicesSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) def test_close(self): - session = nimodinst.Session("") + session = nimodinst.Session('') session.close() - self.patched_library.niModInst_CloseInstalledDevicesSession.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) - ) + self.patched_library.niModInst_CloseInstalledDevicesSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) def test_context_manager(self): - with nimodinst.Session("") as session: + with nimodinst.Session('') as session: assert type(session) == nimodinst.Session - self.patched_library.niModInst_OpenInstalledDevicesSession.assert_called_once_with( - _matchers.ViStringMatcher(""), - _matchers.ViSessionPointerMatcher(), - _matchers.ViInt32PointerMatcher(), - ) - self.patched_library.niModInst_CloseInstalledDevicesSession.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST) - ) + self.patched_library.niModInst_OpenInstalledDevicesSession.assert_called_once_with(_matchers.ViStringMatcher(''), _matchers.ViSessionPointerMatcher(), _matchers.ViInt32PointerMatcher()) + self.patched_library.niModInst_CloseInstalledDevicesSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST)) def test_iterating_for(self): - self.side_effects_helper["OpenInstalledDevicesSession"]["deviceCount"] = 2 - with nimodinst.Session("") as session: + self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = 2 + with nimodinst.Session('') as session: assert len(session) == 2 count = 0 for d in session: @@ -118,8 +81,8 @@ def test_iterating_for(self): assert count == len(session) def test_iterating_for_empty(self): - self.side_effects_helper["OpenInstalledDevicesSession"]["deviceCount"] = 0 - with nimodinst.Session("") as session: + self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = 0 + with nimodinst.Session('') as session: assert len(session) == 0 count = 0 for d in session: @@ -127,90 +90,60 @@ def test_iterating_for_empty(self): assert count == len(session) def test_get_extended_error_info(self): - error_string = "Error" - self.patched_library.niModInst_GetExtendedErrorInfo.side_effect = ( - self.side_effects_helper.niModInst_GetExtendedErrorInfo - ) - self.side_effects_helper["GetExtendedErrorInfo"]["errorInfo"] = error_string - with nimodinst.Session("") as session: + error_string = 'Error' + self.patched_library.niModInst_GetExtendedErrorInfo.side_effect = self.side_effects_helper.niModInst_GetExtendedErrorInfo + self.side_effects_helper['GetExtendedErrorInfo']['errorInfo'] = error_string + with nimodinst.Session('') as session: # Calling the private function directly, as _get_extended_error_info() functions differently than other IVI Dance functions. # As a result, it cannot be used directly during error handling. result = session._get_extended_error_info() assert result == error_string def test_get_error_description_fails(self): - self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = ( - self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 - ) - self.side_effects_helper["GetInstalledDeviceAttributeViInt32"]["return"] = -1 - self.patched_library.niModInst_GetExtendedErrorInfo.side_effect = ( - self.side_effects_helper.niModInst_GetExtendedErrorInfo - ) - self.side_effects_helper["GetExtendedErrorInfo"]["return"] = -2 - with nimodinst.Session("") as session: + self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 + self.side_effects_helper['GetInstalledDeviceAttributeViInt32']['return'] = -1 + self.patched_library.niModInst_GetExtendedErrorInfo.side_effect = self.side_effects_helper.niModInst_GetExtendedErrorInfo + self.side_effects_helper['GetExtendedErrorInfo']['return'] = -2 + with nimodinst.Session('') as session: try: session.devices[0].chassis_number except nimodinst.Error as e: - assert ( - e.code == -1 - ) # we want the original error code from getting the attribute. + assert e.code == -1 # we want the original error code from getting the attribute. assert e.description == "Failed to retrieve error description." def test_get_attribute_session(self): val = 123 - self.side_effects_helper["OpenInstalledDevicesSession"]["deviceCount"] = 1 - self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = ( - self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 - ) - self.side_effects_helper["GetInstalledDeviceAttributeViInt32"][ - "attributeValue" - ] = val - with nimodinst.Session("") as session: + self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = 1 + self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 + self.side_effects_helper['GetInstalledDeviceAttributeViInt32']['attributeValue'] = val + with nimodinst.Session('') as session: attr_int = session.devices[0].chassis_number - assert attr_int == val + assert(attr_int == val) def test_get_attribute_vi_int32_for_loop_index(self): - self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = ( - self.niModInst_GetInstalledDeviceAttributeViInt32_looping - ) - self.side_effects_helper["OpenInstalledDevicesSession"][ - "deviceCount" - ] = self.num_int_devices_looping + self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = self.niModInst_GetInstalledDeviceAttributeViInt32_looping + self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = self.num_int_devices_looping index = 0 - with nimodinst.Session("") as session: + with nimodinst.Session('') as session: attr_int = session.devices[index].chassis_number index += 1 - assert ( - attr_int - == self.int_vals_device_looping[self.iteration_device_looping - 1] - ) # Have to subtract once since it was already incremented in the callback function + assert(attr_int == self.int_vals_device_looping[self.iteration_device_looping - 1]) # Have to subtract once since it was already incremented in the callback function def test_get_attribute_vi_string_for_loop_index(self): - self.patched_library.niModInst_GetInstalledDeviceAttributeViString.side_effect = ( - self.niModInst_GetInstalledDeviceAttributeViString_looping - ) - self.side_effects_helper["OpenInstalledDevicesSession"][ - "deviceCount" - ] = self.num_string_devices_looping + self.patched_library.niModInst_GetInstalledDeviceAttributeViString.side_effect = self.niModInst_GetInstalledDeviceAttributeViString_looping + self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = self.num_string_devices_looping index = 0 - with nimodinst.Session("") as session: + with nimodinst.Session('') as session: attr_int = session.devices[index].device_name index += 1 - assert ( - attr_int - == self.string_vals_device_looping[self.iteration_device_looping - 1] - ) # Have to subtract once since it was already incremented in the callback function + assert(attr_int == self.string_vals_device_looping[self.iteration_device_looping - 1]) # Have to subtract once since it was already incremented in the callback function def test_get_attribute_session_no_index(self): val = 123 - self.side_effects_helper["OpenInstalledDevicesSession"]["deviceCount"] = 1 - self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = ( - self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 - ) - self.side_effects_helper["GetInstalledDeviceAttributeViInt32"][ - "attributeValue" - ] = val - with nimodinst.Session("") as session: + self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = 1 + self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 + self.side_effects_helper['GetInstalledDeviceAttributeViInt32']['attributeValue'] = val + with nimodinst.Session('') as session: try: session.chassis_number assert False @@ -218,40 +151,24 @@ def test_get_attribute_session_no_index(self): assert str(e) == "'Session' object has no attribute 'chassis_number'" def test_get_attribute_vi_int32_for_loop_multiple_devices(self): - self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = ( - self.niModInst_GetInstalledDeviceAttributeViInt32_looping - ) - self.side_effects_helper["OpenInstalledDevicesSession"][ - "deviceCount" - ] = self.num_int_devices_looping - with nimodinst.Session("") as session: + self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = self.niModInst_GetInstalledDeviceAttributeViInt32_looping + self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = self.num_int_devices_looping + with nimodinst.Session('') as session: for d in session: attr_int = d.chassis_number - assert ( - attr_int - == self.int_vals_device_looping[self.iteration_device_looping - 1] - ) # Have to subtract once since it was already incremented in the callback function + assert(attr_int == self.int_vals_device_looping[self.iteration_device_looping - 1]) # Have to subtract once since it was already incremented in the callback function def test_get_attribute_vi_string_for_loop_multiple_devices(self): - self.patched_library.niModInst_GetInstalledDeviceAttributeViString.side_effect = ( - self.niModInst_GetInstalledDeviceAttributeViString_looping - ) - self.side_effects_helper["OpenInstalledDevicesSession"][ - "deviceCount" - ] = self.num_string_devices_looping - with nimodinst.Session("") as session: + self.patched_library.niModInst_GetInstalledDeviceAttributeViString.side_effect = self.niModInst_GetInstalledDeviceAttributeViString_looping + self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = self.num_string_devices_looping + with nimodinst.Session('') as session: for d in session: attr_int = d.device_name - assert ( - attr_int - == self.string_vals_device_looping[ - self.iteration_device_looping - 1 - ] - ) # Have to subtract once since it was already incremented in the callback function + assert(attr_int == self.string_vals_device_looping[self.iteration_device_looping - 1]) # Have to subtract once since it was already incremented in the callback function # Error Tests def test_cannot_add_properties_to_session_set(self): - with nimodinst.Session("") as session: + with nimodinst.Session('') as session: try: session.non_existent_property = 5 assert False @@ -259,18 +176,15 @@ def test_cannot_add_properties_to_session_set(self): assert str(e) == "__setattr__ not supported." def test_cannot_add_properties_to_session_get(self): - with nimodinst.Session("") as session: + with nimodinst.Session('') as session: try: session.non_existent_property assert False except AttributeError as e: - assert ( - str(e) - == "'Session' object has no attribute 'non_existent_property'" - ) + assert str(e) == "'Session' object has no attribute 'non_existent_property'" def test_cannot_add_properties_to_device_set(self): - with nimodinst.Session("") as session: + with nimodinst.Session('') as session: try: session.devices[0].non_existent_property = 5 assert False @@ -278,19 +192,16 @@ def test_cannot_add_properties_to_device_set(self): assert str(e) == "__setattr__ not supported." def test_cannot_add_properties_to_device_get(self): - with nimodinst.Session("") as session: + with nimodinst.Session('') as session: try: session.devices[0].non_existent_property assert False except AttributeError as e: - assert ( - str(e) - == "'_Device' object has no attribute 'non_existent_property'" - ) + assert str(e) == "'_Device' object has no attribute 'non_existent_property'" def test_vi_int32_attribute_read_only(self): - self.side_effects_helper["OpenInstalledDevicesSession"]["deviceCount"] = 1 - with nimodinst.Session("") as session: + self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = 1 + with nimodinst.Session('') as session: try: session.devices[0].chassis_number = 5 assert False @@ -298,8 +209,8 @@ def test_vi_int32_attribute_read_only(self): assert str(e) == "__setattr__ not supported." def test_vi_string_attribute_read_only(self): - self.side_effects_helper["OpenInstalledDevicesSession"]["deviceCount"] = 1 - with nimodinst.Session("") as session: + self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = 1 + with nimodinst.Session('') as session: try: session.devices[0].device_name = "Not Possible" assert False @@ -308,21 +219,13 @@ def test_vi_string_attribute_read_only(self): def test_int_attribute_error(self): error_code = -1234 - error_string = "Error" - self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = ( - self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 - ) - self.side_effects_helper["GetInstalledDeviceAttributeViInt32"][ - "attributeValue" - ] = -1 - self.side_effects_helper["GetInstalledDeviceAttributeViInt32"][ - "return" - ] = error_code - self.patched_library.niModInst_GetExtendedErrorInfo.side_effect = ( - self.side_effects_helper.niModInst_GetExtendedErrorInfo - ) - self.side_effects_helper["GetExtendedErrorInfo"]["errorInfo"] = error_string - with nimodinst.Session("") as session: + error_string = 'Error' + self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 + self.side_effects_helper['GetInstalledDeviceAttributeViInt32']['attributeValue'] = -1 + self.side_effects_helper['GetInstalledDeviceAttributeViInt32']['return'] = error_code + self.patched_library.niModInst_GetExtendedErrorInfo.side_effect = self.side_effects_helper.niModInst_GetExtendedErrorInfo + self.side_effects_helper['GetExtendedErrorInfo']['errorInfo'] = error_string + with nimodinst.Session('') as session: try: session.devices[0].chassis_number assert False @@ -332,21 +235,13 @@ def test_int_attribute_error(self): def test_int_attribute_warning(self): warning_code = 1234 - error_string = "Error" - self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = ( - self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 - ) - self.side_effects_helper["GetInstalledDeviceAttributeViInt32"][ - "attributeValue" - ] = -1 - self.side_effects_helper["GetInstalledDeviceAttributeViInt32"][ - "return" - ] = warning_code - self.patched_library.niModInst_GetExtendedErrorInfo.side_effect = ( - self.side_effects_helper.niModInst_GetExtendedErrorInfo - ) - self.side_effects_helper["GetExtendedErrorInfo"]["errorInfo"] = error_string - with nimodinst.Session("") as session: + error_string = 'Error' + self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 + self.side_effects_helper['GetInstalledDeviceAttributeViInt32']['attributeValue'] = -1 + self.side_effects_helper['GetInstalledDeviceAttributeViInt32']['return'] = warning_code + self.patched_library.niModInst_GetExtendedErrorInfo.side_effect = self.side_effects_helper.niModInst_GetExtendedErrorInfo + self.side_effects_helper['GetExtendedErrorInfo']['errorInfo'] = error_string + with nimodinst.Session('') as session: with warnings.catch_warnings(record=True) as w: session.devices[0].chassis_number assert len(w) == 1 @@ -354,20 +249,12 @@ def test_int_attribute_warning(self): assert error_string in str(w[0].message) def test_repr_and_str(self): - self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = ( - self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 - ) - self.patched_library.niModInst_GetInstalledDeviceAttributeViString.side_effect = ( - self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViString - ) - self.side_effects_helper["OpenInstalledDevicesSession"]["deviceCount"] = 2 - self.side_effects_helper["GetInstalledDeviceAttributeViInt32"][ - "attributeValue" - ] = 42 - self.side_effects_helper["GetInstalledDeviceAttributeViString"][ - "attributeValue" - ] = "fourty two" - with nimodinst.Session("") as session: + self.patched_library.niModInst_GetInstalledDeviceAttributeViInt32.side_effect = self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViInt32 + self.patched_library.niModInst_GetInstalledDeviceAttributeViString.side_effect = self.side_effects_helper.niModInst_GetInstalledDeviceAttributeViString + self.side_effects_helper['OpenInstalledDevicesSession']['deviceCount'] = 2 + self.side_effects_helper['GetInstalledDeviceAttributeViInt32']['attributeValue'] = 42 + self.side_effects_helper['GetInstalledDeviceAttributeViString']['attributeValue'] = 'fourty two' + with nimodinst.Session('') as session: session print(session) for d in session: diff --git a/generated/nimodinst/setup.py b/generated/nimodinst/setup.py index 7e1c2d8d7..36e8d21f7 100644 --- a/generated/nimodinst/setup.py +++ b/generated/nimodinst/setup.py @@ -15,44 +15,41 @@ def finalize_options(self): def run_tests(self): import pytest - pytest.main(self.test_args) -pypi_name = "nimodinst" +pypi_name = 'nimodinst' def read_contents(file_to_read): - with open(file_to_read, "r") as f: + with open(file_to_read, 'r') as f: return f.read() setup( name=pypi_name, zip_safe=True, - version="1.4.2.dev0", - description="NI-ModInst Python API", - long_description=read_contents("README.rst"), - long_description_content_type="text/x-rst", - author="NI", + version='1.4.2.dev0', + description='NI-ModInst Python API', + long_description=read_contents('README.rst'), + long_description_content_type='text/x-rst', + author='NI', author_email="opensource@ni.com", url="https://github.com/ni/nimi-python", maintainer="NI", maintainer_email="opensource@ni.com", - keywords=["nimodinst"], - license="MIT", + keywords=['nimodinst'], + license='MIT', include_package_data=True, - packages=["nimodinst"], + packages=['nimodinst'], install_requires=[ 'enum34;python_version<"3.4"', 'singledispatch;python_version<"3.4"', - "hightime>=0.2.0", - ], - setup_requires=[ - "pytest-runner", + 'hightime>=0.2.0', ], - tests_require=["pytest"], - test_suite="tests", + setup_requires=['pytest-runner', ], + tests_require=['pytest'], + test_suite='tests', classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -67,8 +64,8 @@ def read_contents(file_to_read): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", - "Topic :: System :: Hardware :: Hardware Drivers", + "Topic :: System :: Hardware :: Hardware Drivers" ], - cmdclass={"test": PyTest}, - package_data={pypi_name: ["VERSION"]}, + cmdclass={'test': PyTest}, + package_data={pypi_name: ['VERSION']}, ) diff --git a/generated/niscope/niscope/__init__.py b/generated/niscope/niscope/__init__.py index bcc8677f0..cb3b1a12e 100644 --- a/generated/niscope/niscope/__init__.py +++ b/generated/niscope/niscope/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = "1.4.2.dev0" +__version__ = '1.4.2.dev0' from niscope.enums import * # noqa: F403,F401,H303 from niscope.errors import DriverWarning # noqa: F401 @@ -17,12 +17,12 @@ def get_diagnostic_information(): - """Get diagnostic information about the system state that is suitable for printing or logging + '''Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - """ + ''' import os import pkg_resources import platform @@ -30,80 +30,73 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return struct.calcsize("P") == 8 + return (struct.calcsize("P") == 8) def is_os_64bit(): - return platform.machine().endswith("64") + return platform.machine().endswith('64') def is_venv(): - return "VIRTUAL_ENV" in os.environ + return 'VIRTUAL_ENV' in os.environ info = {} - info["os"] = {} - info["python"] = {} - info["driver"] = {} - info["module"] = {} - if platform.system() == "Windows": + info['os'] = {} + info['python'] = {} + info['driver'] = {} + info['module'] = {} + if platform.system() == 'Windows': try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = "Windows" + os_name = 'Windows' try: - driver_version_key = winreg.OpenKey( - winreg.HKEY_LOCAL_MACHINE, - r"SOFTWARE\National Instruments\NI-SCOPE\CurrentVersion", - ) + driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-SCOPE\CurrentVersion") driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = "Unknown" - elif platform.system() == "Linux": - os_name = "Linux" - driver_version = "Unknown" + driver_version = 'Unknown' + elif platform.system() == 'Linux': + os_name = 'Linux' + driver_version = 'Unknown' else: - raise SystemError("Unsupported platform: {}".format(platform.system())) + raise SystemError('Unsupported platform: {}'.format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [ - { - "name": i.key, - "version": i.version, - } - for i in installed_packages - ] - - info["os"]["name"] = os_name - info["os"]["version"] = platform.version() - info["os"]["bits"] = "64" if is_os_64bit() else "32" - info["driver"]["name"] = "NI-SCOPE" - info["driver"]["version"] = driver_version - info["module"]["name"] = "niscope" - info["module"]["version"] = "1.4.2.dev0" - info["python"]["version"] = sys.version - info["python"]["bits"] = "64" if is_python_64bit() else "32" - info["python"]["is_venv"] = is_venv() - info["python"]["packages"] = installed_packages_list + installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] + + info['os']['name'] = os_name + info['os']['version'] = platform.version() + info['os']['bits'] = '64' if is_os_64bit() else '32' + info['driver']['name'] = "NI-SCOPE" + info['driver']['version'] = driver_version + info['module']['name'] = 'niscope' + info['module']['version'] = "1.4.2.dev0" + info['python']['version'] = sys.version + info['python']['bits'] = '64' if is_python_64bit() else '32' + info['python']['is_venv'] = is_venv() + info['python']['packages'] = installed_packages_list return info def print_diagnostic_information(): - """Print diagnostic information in a format suitable for issue report + '''Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - """ + ''' info = get_diagnostic_information() - row_format = " {:<10} {}" - for type in ["OS", "Driver", "Module", "Python"]: + row_format = ' {:<10} {}' + for type in ['OS', 'Driver', 'Module', 'Python']: typename = type.lower() - print(type + ":") + print(type + ':') for item in info[typename]: - if item != "packages": - print(row_format.format(item.title() + ":", info[typename][item])) - print(" Installed Packages:") - for p in info["python"]["packages"]: - print((" " * 8) + p["name"] + "==" + p["version"]) + if item != 'packages': + print(row_format.format(item.title() + ':', info[typename][item])) + print(' Installed Packages:') + for p in info['python']['packages']: + print((' ' * 8) + p['name'] + '==' + p['version']) return info + + diff --git a/generated/niscope/niscope/_attributes.py b/generated/niscope/niscope/_attributes.py index d1522c6ef..4647d930d 100644 --- a/generated/niscope/niscope/_attributes.py +++ b/generated/niscope/niscope/_attributes.py @@ -6,13 +6,14 @@ class Attribute(object): - """Base class for all typed attributes.""" + '''Base class for all typed attributes.''' def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -21,19 +22,16 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): + def __get__(self, session, session_type): - return hightime.timedelta( - milliseconds=session._get_attribute_vi_int32(self._attribute_id) - ) + return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_int32( - self._attribute_id, - _converters.convert_timedelta_to_milliseconds_int32(value).value, - ) + session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) class AttributeViInt64(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -42,6 +40,7 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -50,19 +49,16 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): + def __get__(self, session, session_type): - return hightime.timedelta( - seconds=session._get_attribute_vi_real64(self._attribute_id) - ) + return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_real64( - self._attribute_id, - _converters.convert_timedelta_to_seconds_real64(value).value, - ) + session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) class AttributeViString(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -71,17 +67,16 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string( - self._attribute_id, - _converters.convert_repeated_capabilities_without_prefix(value), - ) + session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) class AttributeViBoolean(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -90,36 +85,31 @@ def __set__(self, session, value): class AttributeEnum(object): + def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type( - self._underlying_attribute.__get__(session, session_type) - ) + return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError( - "must be " - + str(self._attribute_type.__name__) - + " not " - + str(type(value).__name__) - ) + raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): + def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from niscope.session import SessionReference - return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session( - self._attribute_id, _converters.convert_to_nitclk_session_number(value) - ) + session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) + + + diff --git a/generated/niscope/niscope/_converters.py b/generated/niscope/niscope/_converters.py index 8839d84e2..223d8e26b 100644 --- a/generated/niscope/niscope/_converters.py +++ b/generated/niscope/niscope/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - """Base version that should not be called + '''Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,38 +40,36 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - """ - raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) + ''' + raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - """Integer version""" + '''Integer version''' return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - """String version (this is the most complex) + '''String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - """ + ''' # First we deal with a list - rep_cap_list = repeated_capability.split(",") + rep_cap_list = repeated_capability.split(',') if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, "").replace(":", "-") - rc = r.split("-") + r = repeated_capability.strip().replace(prefix, '').replace(':', '-') + rc = r.split('-') if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError( - "Multiple '-' or ':'", repeated_capability - ) + raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) try: start = int(rc[0]) end = int(rc[1]) @@ -87,7 +85,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, "").strip()] + return [repeated_capability.replace(prefix, '').strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -96,7 +94,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - """Iterable version - can handle lists, ranges, and tuples""" + '''Iterable version - can handle lists, ranges, and tuples''' rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -105,22 +103,16 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - """slice version""" - + '''slice version''' def ifnone(a, b): return b if a is None else a - # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range( - ifnone(repeated_capability.start, 0), - repeated_capability.stop, - ifnone(repeated_capability.step, 1), - ) + rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=""): - """Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=''): + '''Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -128,17 +120,15 @@ def convert_repeated_capabilities(repeated_capability, prefix=""): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - """ + ''' # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [ - prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) - ] + return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] def convert_repeated_capabilities_without_prefix(repeated_capability): - """Convert a repeated capabilities object, without any prefix, to a comma delimited list + '''Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -154,8 +144,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - """ - return ",".join(convert_repeated_capabilities(repeated_capability, "")) + ''' + return ','.join(convert_repeated_capabilities(repeated_capability, '')) def _convert_timedelta(value, library_type, scaling): @@ -168,14 +158,7 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [ - _visatype.ViInt64, - _visatype.ViInt32, - _visatype.ViUInt32, - _visatype.ViInt16, - _visatype.ViUInt16, - _visatype.ViInt8, - ]: + if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -212,36 +195,34 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - "rangecheck": "RangeCheck", - "queryinstrstatus": "QueryInstrStatus", - "cache": "Cache", - "simulate": "Simulate", - "recordcoercions": "RecordCoercions", - "interchangecheck": "InterchangeCheck", - "driversetup": "DriverSetup", - "range_check": "RangeCheck", - "query_instr_status": "QueryInstrStatus", - "record_coercions": "RecordCoercions", - "interchange_check": "InterchangeCheck", - "driver_setup": "DriverSetup", + 'rangecheck': 'RangeCheck', + 'queryinstrstatus': 'QueryInstrStatus', + 'cache': 'Cache', + 'simulate': 'Simulate', + 'recordcoercions': 'RecordCoercions', + 'interchangecheck': 'InterchangeCheck', + 'driversetup': 'DriverSetup', + 'range_check': 'RangeCheck', + 'query_instr_status': 'QueryInstrStatus', + 'record_coercions': 'RecordCoercions', + 'interchange_check': 'InterchangeCheck', + 'driver_setup': 'DriverSetup', } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": - value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") - elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": + if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': + value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') + elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': if not isinstance(values[k], dict): - raise TypeError("DriverSetup must be a dictionary") - value = "DriverSetup=" + ( - ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) - ) + raise TypeError('DriverSetup must be a dictionary') + value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) else: - value = k + ("=1" if values[k] is True else "=0") + value = k + ('=1' if values[k] is True else '=0') init_with_options.append(value) - init_with_options_string = ",".join(init_with_options) + init_with_options_string = ','.join(init_with_options) return init_with_options_string @@ -270,11 +251,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(",")] + return [x.strip() for x in comma_separated_string.split(',')] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -286,17 +267,11 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - """ - chained_repeated_capability_items = convert_comma_separated_string_to_list( - chained_repeated_capability - ) - repeated_capability_lists = [ - [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) - ] + ''' + chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) + repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] for item in chained_repeated_capability_items: - repeated_capability_lists = [ - x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) - ] - return [ - ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists - ] + repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] + return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] + + diff --git a/generated/niscope/niscope/_library.py b/generated/niscope/niscope/_library.py index 2a6dd4a82..54b93fcdb 100644 --- a/generated/niscope/niscope/_library.py +++ b/generated/niscope/niscope/_library.py @@ -13,11 +13,11 @@ class Library(object): - """Library + '''Library Wrapper around driver library. Class will setup the correct ctypes information for every function on first call. - """ + ''' def __init__(self, ctypes_library): self._func_lock = threading.Lock() @@ -95,7 +95,7 @@ def _get_library_function(self, name): def niScope_Abort(self, vi): # noqa: N802 with self._func_lock: if self.niScope_Abort_cfunc is None: - self.niScope_Abort_cfunc = self._get_library_function("niScope_Abort") + self.niScope_Abort_cfunc = self._get_library_function('niScope_Abort') self.niScope_Abort_cfunc.argtypes = [ViSession] # noqa: F405 self.niScope_Abort_cfunc.restype = ViStatus # noqa: F405 return self.niScope_Abort_cfunc(vi) @@ -103,72 +103,39 @@ def niScope_Abort(self, vi): # noqa: N802 def niScope_AcquisitionStatus(self, vi, acquisition_status): # noqa: N802 with self._func_lock: if self.niScope_AcquisitionStatus_cfunc is None: - self.niScope_AcquisitionStatus_cfunc = self._get_library_function( - "niScope_AcquisitionStatus" - ) - self.niScope_AcquisitionStatus_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niScope_AcquisitionStatus_cfunc = self._get_library_function('niScope_AcquisitionStatus') + self.niScope_AcquisitionStatus_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32)] # noqa: F405 self.niScope_AcquisitionStatus_cfunc.restype = ViStatus # noqa: F405 return self.niScope_AcquisitionStatus_cfunc(vi, acquisition_status) - def niScope_ActualMeasWfmSize( - self, vi, array_meas_function, meas_waveform_size - ): # noqa: N802 + def niScope_ActualMeasWfmSize(self, vi, array_meas_function, meas_waveform_size): # noqa: N802 with self._func_lock: if self.niScope_ActualMeasWfmSize_cfunc is None: - self.niScope_ActualMeasWfmSize_cfunc = self._get_library_function( - "niScope_ActualMeasWfmSize" - ) - self.niScope_ActualMeasWfmSize_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niScope_ActualMeasWfmSize_cfunc = self._get_library_function('niScope_ActualMeasWfmSize') + self.niScope_ActualMeasWfmSize_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt32)] # noqa: F405 self.niScope_ActualMeasWfmSize_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_ActualMeasWfmSize_cfunc( - vi, array_meas_function, meas_waveform_size - ) + return self.niScope_ActualMeasWfmSize_cfunc(vi, array_meas_function, meas_waveform_size) def niScope_ActualNumWfms(self, vi, channel_list, num_wfms): # noqa: N802 with self._func_lock: if self.niScope_ActualNumWfms_cfunc is None: - self.niScope_ActualNumWfms_cfunc = self._get_library_function( - "niScope_ActualNumWfms" - ) - self.niScope_ActualNumWfms_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niScope_ActualNumWfms_cfunc = self._get_library_function('niScope_ActualNumWfms') + self.niScope_ActualNumWfms_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32)] # noqa: F405 self.niScope_ActualNumWfms_cfunc.restype = ViStatus # noqa: F405 return self.niScope_ActualNumWfms_cfunc(vi, channel_list, num_wfms) - def niScope_AddWaveformProcessing( - self, vi, channel_list, meas_function - ): # noqa: N802 + def niScope_AddWaveformProcessing(self, vi, channel_list, meas_function): # noqa: N802 with self._func_lock: if self.niScope_AddWaveformProcessing_cfunc is None: - self.niScope_AddWaveformProcessing_cfunc = self._get_library_function( - "niScope_AddWaveformProcessing" - ) - self.niScope_AddWaveformProcessing_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ] # noqa: F405 - self.niScope_AddWaveformProcessing_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niScope_AddWaveformProcessing_cfunc = self._get_library_function('niScope_AddWaveformProcessing') + self.niScope_AddWaveformProcessing_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32] # noqa: F405 + self.niScope_AddWaveformProcessing_cfunc.restype = ViStatus # noqa: F405 return self.niScope_AddWaveformProcessing_cfunc(vi, channel_list, meas_function) def niScope_AutoSetup(self, vi): # noqa: N802 with self._func_lock: if self.niScope_AutoSetup_cfunc is None: - self.niScope_AutoSetup_cfunc = self._get_library_function( - "niScope_AutoSetup" - ) + self.niScope_AutoSetup_cfunc = self._get_library_function('niScope_AutoSetup') self.niScope_AutoSetup_cfunc.argtypes = [ViSession] # noqa: F405 self.niScope_AutoSetup_cfunc.restype = ViStatus # noqa: F405 return self.niScope_AutoSetup_cfunc(vi) @@ -176,892 +143,343 @@ def niScope_AutoSetup(self, vi): # noqa: N802 def niScope_CalFetchDate(self, vi, which_one, year, month, day): # noqa: N802 with self._func_lock: if self.niScope_CalFetchDate_cfunc is None: - self.niScope_CalFetchDate_cfunc = self._get_library_function( - "niScope_CalFetchDate" - ) - self.niScope_CalFetchDate_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niScope_CalFetchDate_cfunc = self._get_library_function('niScope_CalFetchDate') + self.niScope_CalFetchDate_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 self.niScope_CalFetchDate_cfunc.restype = ViStatus # noqa: F405 return self.niScope_CalFetchDate_cfunc(vi, which_one, year, month, day) def niScope_CalFetchTemperature(self, vi, which_one, temperature): # noqa: N802 with self._func_lock: if self.niScope_CalFetchTemperature_cfunc is None: - self.niScope_CalFetchTemperature_cfunc = self._get_library_function( - "niScope_CalFetchTemperature" - ) - self.niScope_CalFetchTemperature_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niScope_CalFetchTemperature_cfunc = self._get_library_function('niScope_CalFetchTemperature') + self.niScope_CalFetchTemperature_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 self.niScope_CalFetchTemperature_cfunc.restype = ViStatus # noqa: F405 return self.niScope_CalFetchTemperature_cfunc(vi, which_one, temperature) def niScope_CalSelfCalibrate(self, vi, channel_list, option): # noqa: N802 with self._func_lock: if self.niScope_CalSelfCalibrate_cfunc is None: - self.niScope_CalSelfCalibrate_cfunc = self._get_library_function( - "niScope_CalSelfCalibrate" - ) - self.niScope_CalSelfCalibrate_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ] # noqa: F405 + self.niScope_CalSelfCalibrate_cfunc = self._get_library_function('niScope_CalSelfCalibrate') + self.niScope_CalSelfCalibrate_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32] # noqa: F405 self.niScope_CalSelfCalibrate_cfunc.restype = ViStatus # noqa: F405 return self.niScope_CalSelfCalibrate_cfunc(vi, channel_list, option) - def niScope_ClearWaveformMeasurementStats( - self, vi, channel_list, clearable_measurement_function - ): # noqa: N802 + def niScope_ClearWaveformMeasurementStats(self, vi, channel_list, clearable_measurement_function): # noqa: N802 with self._func_lock: if self.niScope_ClearWaveformMeasurementStats_cfunc is None: - self.niScope_ClearWaveformMeasurementStats_cfunc = ( - self._get_library_function("niScope_ClearWaveformMeasurementStats") - ) - self.niScope_ClearWaveformMeasurementStats_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ] # noqa: F405 - self.niScope_ClearWaveformMeasurementStats_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niScope_ClearWaveformMeasurementStats_cfunc( - vi, channel_list, clearable_measurement_function - ) + self.niScope_ClearWaveformMeasurementStats_cfunc = self._get_library_function('niScope_ClearWaveformMeasurementStats') + self.niScope_ClearWaveformMeasurementStats_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32] # noqa: F405 + self.niScope_ClearWaveformMeasurementStats_cfunc.restype = ViStatus # noqa: F405 + return self.niScope_ClearWaveformMeasurementStats_cfunc(vi, channel_list, clearable_measurement_function) def niScope_ClearWaveformProcessing(self, vi, channel_list): # noqa: N802 with self._func_lock: if self.niScope_ClearWaveformProcessing_cfunc is None: - self.niScope_ClearWaveformProcessing_cfunc = self._get_library_function( - "niScope_ClearWaveformProcessing" - ) - self.niScope_ClearWaveformProcessing_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niScope_ClearWaveformProcessing_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niScope_ClearWaveformProcessing_cfunc = self._get_library_function('niScope_ClearWaveformProcessing') + self.niScope_ClearWaveformProcessing_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niScope_ClearWaveformProcessing_cfunc.restype = ViStatus # noqa: F405 return self.niScope_ClearWaveformProcessing_cfunc(vi, channel_list) def niScope_Commit(self, vi): # noqa: N802 with self._func_lock: if self.niScope_Commit_cfunc is None: - self.niScope_Commit_cfunc = self._get_library_function("niScope_Commit") + self.niScope_Commit_cfunc = self._get_library_function('niScope_Commit') self.niScope_Commit_cfunc.argtypes = [ViSession] # noqa: F405 self.niScope_Commit_cfunc.restype = ViStatus # noqa: F405 return self.niScope_Commit_cfunc(vi) - def niScope_ConfigureChanCharacteristics( - self, vi, channel_list, input_impedance, max_input_frequency - ): # noqa: N802 + def niScope_ConfigureChanCharacteristics(self, vi, channel_list, input_impedance, max_input_frequency): # noqa: N802 with self._func_lock: if self.niScope_ConfigureChanCharacteristics_cfunc is None: - self.niScope_ConfigureChanCharacteristics_cfunc = ( - self._get_library_function("niScope_ConfigureChanCharacteristics") - ) - self.niScope_ConfigureChanCharacteristics_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViReal64, - ViReal64, - ] # noqa: F405 - self.niScope_ConfigureChanCharacteristics_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niScope_ConfigureChanCharacteristics_cfunc( - vi, channel_list, input_impedance, max_input_frequency - ) - - def niScope_ConfigureEqualizationFilterCoefficients( - self, vi, channel_list, number_of_coefficients, coefficients - ): # noqa: N802 + self.niScope_ConfigureChanCharacteristics_cfunc = self._get_library_function('niScope_ConfigureChanCharacteristics') + self.niScope_ConfigureChanCharacteristics_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViReal64] # noqa: F405 + self.niScope_ConfigureChanCharacteristics_cfunc.restype = ViStatus # noqa: F405 + return self.niScope_ConfigureChanCharacteristics_cfunc(vi, channel_list, input_impedance, max_input_frequency) + + def niScope_ConfigureEqualizationFilterCoefficients(self, vi, channel_list, number_of_coefficients, coefficients): # noqa: N802 with self._func_lock: if self.niScope_ConfigureEqualizationFilterCoefficients_cfunc is None: - self.niScope_ConfigureEqualizationFilterCoefficients_cfunc = ( - self._get_library_function( - "niScope_ConfigureEqualizationFilterCoefficients" - ) - ) - self.niScope_ConfigureEqualizationFilterCoefficients_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViReal64), - ] # noqa: F405 - self.niScope_ConfigureEqualizationFilterCoefficients_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niScope_ConfigureEqualizationFilterCoefficients_cfunc( - vi, channel_list, number_of_coefficients, coefficients - ) - - def niScope_ConfigureHorizontalTiming( - self, - vi, - min_sample_rate, - min_num_pts, - ref_position, - num_records, - enforce_realtime, - ): # noqa: N802 + self.niScope_ConfigureEqualizationFilterCoefficients_cfunc = self._get_library_function('niScope_ConfigureEqualizationFilterCoefficients') + self.niScope_ConfigureEqualizationFilterCoefficients_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niScope_ConfigureEqualizationFilterCoefficients_cfunc.restype = ViStatus # noqa: F405 + return self.niScope_ConfigureEqualizationFilterCoefficients_cfunc(vi, channel_list, number_of_coefficients, coefficients) + + def niScope_ConfigureHorizontalTiming(self, vi, min_sample_rate, min_num_pts, ref_position, num_records, enforce_realtime): # noqa: N802 with self._func_lock: if self.niScope_ConfigureHorizontalTiming_cfunc is None: - self.niScope_ConfigureHorizontalTiming_cfunc = ( - self._get_library_function("niScope_ConfigureHorizontalTiming") - ) - self.niScope_ConfigureHorizontalTiming_cfunc.argtypes = [ - ViSession, - ViReal64, - ViInt32, - ViReal64, - ViInt32, - ViBoolean, - ] # noqa: F405 - self.niScope_ConfigureHorizontalTiming_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niScope_ConfigureHorizontalTiming_cfunc( - vi, - min_sample_rate, - min_num_pts, - ref_position, - num_records, - enforce_realtime, - ) + self.niScope_ConfigureHorizontalTiming_cfunc = self._get_library_function('niScope_ConfigureHorizontalTiming') + self.niScope_ConfigureHorizontalTiming_cfunc.argtypes = [ViSession, ViReal64, ViInt32, ViReal64, ViInt32, ViBoolean] # noqa: F405 + self.niScope_ConfigureHorizontalTiming_cfunc.restype = ViStatus # noqa: F405 + return self.niScope_ConfigureHorizontalTiming_cfunc(vi, min_sample_rate, min_num_pts, ref_position, num_records, enforce_realtime) def niScope_ConfigureRefLevels(self, vi, low, mid, high): # noqa: N802 with self._func_lock: if self.niScope_ConfigureRefLevels_cfunc is None: - self.niScope_ConfigureRefLevels_cfunc = self._get_library_function( - "niScope_ConfigureRefLevels" - ) - self.niScope_ConfigureRefLevels_cfunc.argtypes = [ - ViSession, - ViReal64, - ViReal64, - ViReal64, - ] # noqa: F405 + self.niScope_ConfigureRefLevels_cfunc = self._get_library_function('niScope_ConfigureRefLevels') + self.niScope_ConfigureRefLevels_cfunc.argtypes = [ViSession, ViReal64, ViReal64, ViReal64] # noqa: F405 self.niScope_ConfigureRefLevels_cfunc.restype = ViStatus # noqa: F405 return self.niScope_ConfigureRefLevels_cfunc(vi, low, mid, high) - def niScope_ConfigureTriggerDigital( - self, vi, trigger_source, slope, holdoff, delay - ): # noqa: N802 + def niScope_ConfigureTriggerDigital(self, vi, trigger_source, slope, holdoff, delay): # noqa: N802 with self._func_lock: if self.niScope_ConfigureTriggerDigital_cfunc is None: - self.niScope_ConfigureTriggerDigital_cfunc = self._get_library_function( - "niScope_ConfigureTriggerDigital" - ) - self.niScope_ConfigureTriggerDigital_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ViReal64, - ViReal64, - ] # noqa: F405 - self.niScope_ConfigureTriggerDigital_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niScope_ConfigureTriggerDigital_cfunc( - vi, trigger_source, slope, holdoff, delay - ) - - def niScope_ConfigureTriggerEdge( - self, vi, trigger_source, level, slope, trigger_coupling, holdoff, delay - ): # noqa: N802 + self.niScope_ConfigureTriggerDigital_cfunc = self._get_library_function('niScope_ConfigureTriggerDigital') + self.niScope_ConfigureTriggerDigital_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViReal64, ViReal64] # noqa: F405 + self.niScope_ConfigureTriggerDigital_cfunc.restype = ViStatus # noqa: F405 + return self.niScope_ConfigureTriggerDigital_cfunc(vi, trigger_source, slope, holdoff, delay) + + def niScope_ConfigureTriggerEdge(self, vi, trigger_source, level, slope, trigger_coupling, holdoff, delay): # noqa: N802 with self._func_lock: if self.niScope_ConfigureTriggerEdge_cfunc is None: - self.niScope_ConfigureTriggerEdge_cfunc = self._get_library_function( - "niScope_ConfigureTriggerEdge" - ) - self.niScope_ConfigureTriggerEdge_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViReal64, - ViInt32, - ViInt32, - ViReal64, - ViReal64, - ] # noqa: F405 + self.niScope_ConfigureTriggerEdge_cfunc = self._get_library_function('niScope_ConfigureTriggerEdge') + self.niScope_ConfigureTriggerEdge_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViInt32, ViInt32, ViReal64, ViReal64] # noqa: F405 self.niScope_ConfigureTriggerEdge_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_ConfigureTriggerEdge_cfunc( - vi, trigger_source, level, slope, trigger_coupling, holdoff, delay - ) - - def niScope_ConfigureTriggerHysteresis( - self, - vi, - trigger_source, - level, - hysteresis, - slope, - trigger_coupling, - holdoff, - delay, - ): # noqa: N802 + return self.niScope_ConfigureTriggerEdge_cfunc(vi, trigger_source, level, slope, trigger_coupling, holdoff, delay) + + def niScope_ConfigureTriggerHysteresis(self, vi, trigger_source, level, hysteresis, slope, trigger_coupling, holdoff, delay): # noqa: N802 with self._func_lock: if self.niScope_ConfigureTriggerHysteresis_cfunc is None: - self.niScope_ConfigureTriggerHysteresis_cfunc = ( - self._get_library_function("niScope_ConfigureTriggerHysteresis") - ) - self.niScope_ConfigureTriggerHysteresis_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViReal64, - ViReal64, - ViInt32, - ViInt32, - ViReal64, - ViReal64, - ] # noqa: F405 - self.niScope_ConfigureTriggerHysteresis_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niScope_ConfigureTriggerHysteresis_cfunc( - vi, - trigger_source, - level, - hysteresis, - slope, - trigger_coupling, - holdoff, - delay, - ) + self.niScope_ConfigureTriggerHysteresis_cfunc = self._get_library_function('niScope_ConfigureTriggerHysteresis') + self.niScope_ConfigureTriggerHysteresis_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViReal64, ViInt32, ViInt32, ViReal64, ViReal64] # noqa: F405 + self.niScope_ConfigureTriggerHysteresis_cfunc.restype = ViStatus # noqa: F405 + return self.niScope_ConfigureTriggerHysteresis_cfunc(vi, trigger_source, level, hysteresis, slope, trigger_coupling, holdoff, delay) def niScope_ConfigureTriggerImmediate(self, vi): # noqa: N802 with self._func_lock: if self.niScope_ConfigureTriggerImmediate_cfunc is None: - self.niScope_ConfigureTriggerImmediate_cfunc = ( - self._get_library_function("niScope_ConfigureTriggerImmediate") - ) - self.niScope_ConfigureTriggerImmediate_cfunc.argtypes = [ - ViSession - ] # noqa: F405 - self.niScope_ConfigureTriggerImmediate_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niScope_ConfigureTriggerImmediate_cfunc = self._get_library_function('niScope_ConfigureTriggerImmediate') + self.niScope_ConfigureTriggerImmediate_cfunc.argtypes = [ViSession] # noqa: F405 + self.niScope_ConfigureTriggerImmediate_cfunc.restype = ViStatus # noqa: F405 return self.niScope_ConfigureTriggerImmediate_cfunc(vi) def niScope_ConfigureTriggerSoftware(self, vi, holdoff, delay): # noqa: N802 with self._func_lock: if self.niScope_ConfigureTriggerSoftware_cfunc is None: - self.niScope_ConfigureTriggerSoftware_cfunc = ( - self._get_library_function("niScope_ConfigureTriggerSoftware") - ) - self.niScope_ConfigureTriggerSoftware_cfunc.argtypes = [ - ViSession, - ViReal64, - ViReal64, - ] # noqa: F405 - self.niScope_ConfigureTriggerSoftware_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niScope_ConfigureTriggerSoftware_cfunc = self._get_library_function('niScope_ConfigureTriggerSoftware') + self.niScope_ConfigureTriggerSoftware_cfunc.argtypes = [ViSession, ViReal64, ViReal64] # noqa: F405 + self.niScope_ConfigureTriggerSoftware_cfunc.restype = ViStatus # noqa: F405 return self.niScope_ConfigureTriggerSoftware_cfunc(vi, holdoff, delay) - def niScope_ConfigureTriggerVideo( - self, - vi, - trigger_source, - enable_dc_restore, - signal_format, - event, - line_number, - polarity, - trigger_coupling, - holdoff, - delay, - ): # noqa: N802 + def niScope_ConfigureTriggerVideo(self, vi, trigger_source, enable_dc_restore, signal_format, event, line_number, polarity, trigger_coupling, holdoff, delay): # noqa: N802 with self._func_lock: if self.niScope_ConfigureTriggerVideo_cfunc is None: - self.niScope_ConfigureTriggerVideo_cfunc = self._get_library_function( - "niScope_ConfigureTriggerVideo" - ) - self.niScope_ConfigureTriggerVideo_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViBoolean, - ViInt32, - ViInt32, - ViInt32, - ViInt32, - ViInt32, - ViReal64, - ViReal64, - ] # noqa: F405 - self.niScope_ConfigureTriggerVideo_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niScope_ConfigureTriggerVideo_cfunc( - vi, - trigger_source, - enable_dc_restore, - signal_format, - event, - line_number, - polarity, - trigger_coupling, - holdoff, - delay, - ) - - def niScope_ConfigureTriggerWindow( - self, - vi, - trigger_source, - low_level, - high_level, - window_mode, - trigger_coupling, - holdoff, - delay, - ): # noqa: N802 + self.niScope_ConfigureTriggerVideo_cfunc = self._get_library_function('niScope_ConfigureTriggerVideo') + self.niScope_ConfigureTriggerVideo_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViBoolean, ViInt32, ViInt32, ViInt32, ViInt32, ViInt32, ViReal64, ViReal64] # noqa: F405 + self.niScope_ConfigureTriggerVideo_cfunc.restype = ViStatus # noqa: F405 + return self.niScope_ConfigureTriggerVideo_cfunc(vi, trigger_source, enable_dc_restore, signal_format, event, line_number, polarity, trigger_coupling, holdoff, delay) + + def niScope_ConfigureTriggerWindow(self, vi, trigger_source, low_level, high_level, window_mode, trigger_coupling, holdoff, delay): # noqa: N802 with self._func_lock: if self.niScope_ConfigureTriggerWindow_cfunc is None: - self.niScope_ConfigureTriggerWindow_cfunc = self._get_library_function( - "niScope_ConfigureTriggerWindow" - ) - self.niScope_ConfigureTriggerWindow_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViReal64, - ViReal64, - ViInt32, - ViInt32, - ViReal64, - ViReal64, - ] # noqa: F405 - self.niScope_ConfigureTriggerWindow_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niScope_ConfigureTriggerWindow_cfunc( - vi, - trigger_source, - low_level, - high_level, - window_mode, - trigger_coupling, - holdoff, - delay, - ) - - def niScope_ConfigureVertical( - self, vi, channel_list, range, offset, coupling, probe_attenuation, enabled - ): # noqa: N802 + self.niScope_ConfigureTriggerWindow_cfunc = self._get_library_function('niScope_ConfigureTriggerWindow') + self.niScope_ConfigureTriggerWindow_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViReal64, ViInt32, ViInt32, ViReal64, ViReal64] # noqa: F405 + self.niScope_ConfigureTriggerWindow_cfunc.restype = ViStatus # noqa: F405 + return self.niScope_ConfigureTriggerWindow_cfunc(vi, trigger_source, low_level, high_level, window_mode, trigger_coupling, holdoff, delay) + + def niScope_ConfigureVertical(self, vi, channel_list, range, offset, coupling, probe_attenuation, enabled): # noqa: N802 with self._func_lock: if self.niScope_ConfigureVertical_cfunc is None: - self.niScope_ConfigureVertical_cfunc = self._get_library_function( - "niScope_ConfigureVertical" - ) - self.niScope_ConfigureVertical_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViReal64, - ViReal64, - ViInt32, - ViReal64, - ViBoolean, - ] # noqa: F405 + self.niScope_ConfigureVertical_cfunc = self._get_library_function('niScope_ConfigureVertical') + self.niScope_ConfigureVertical_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViReal64, ViInt32, ViReal64, ViBoolean] # noqa: F405 self.niScope_ConfigureVertical_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_ConfigureVertical_cfunc( - vi, channel_list, range, offset, coupling, probe_attenuation, enabled - ) + return self.niScope_ConfigureVertical_cfunc(vi, channel_list, range, offset, coupling, probe_attenuation, enabled) def niScope_Disable(self, vi): # noqa: N802 with self._func_lock: if self.niScope_Disable_cfunc is None: - self.niScope_Disable_cfunc = self._get_library_function( - "niScope_Disable" - ) + self.niScope_Disable_cfunc = self._get_library_function('niScope_Disable') self.niScope_Disable_cfunc.argtypes = [ViSession] # noqa: F405 self.niScope_Disable_cfunc.restype = ViStatus # noqa: F405 return self.niScope_Disable_cfunc(vi) - def niScope_ExportAttributeConfigurationBuffer( - self, vi, size_in_bytes, configuration - ): # noqa: N802 + def niScope_ExportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 with self._func_lock: if self.niScope_ExportAttributeConfigurationBuffer_cfunc is None: - self.niScope_ExportAttributeConfigurationBuffer_cfunc = ( - self._get_library_function( - "niScope_ExportAttributeConfigurationBuffer" - ) - ) - self.niScope_ExportAttributeConfigurationBuffer_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViInt8), - ] # noqa: F405 - self.niScope_ExportAttributeConfigurationBuffer_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niScope_ExportAttributeConfigurationBuffer_cfunc( - vi, size_in_bytes, configuration - ) + self.niScope_ExportAttributeConfigurationBuffer_cfunc = self._get_library_function('niScope_ExportAttributeConfigurationBuffer') + self.niScope_ExportAttributeConfigurationBuffer_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt8)] # noqa: F405 + self.niScope_ExportAttributeConfigurationBuffer_cfunc.restype = ViStatus # noqa: F405 + return self.niScope_ExportAttributeConfigurationBuffer_cfunc(vi, size_in_bytes, configuration) def niScope_ExportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niScope_ExportAttributeConfigurationFile_cfunc is None: - self.niScope_ExportAttributeConfigurationFile_cfunc = ( - self._get_library_function( - "niScope_ExportAttributeConfigurationFile" - ) - ) - self.niScope_ExportAttributeConfigurationFile_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niScope_ExportAttributeConfigurationFile_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niScope_ExportAttributeConfigurationFile_cfunc = self._get_library_function('niScope_ExportAttributeConfigurationFile') + self.niScope_ExportAttributeConfigurationFile_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niScope_ExportAttributeConfigurationFile_cfunc.restype = ViStatus # noqa: F405 return self.niScope_ExportAttributeConfigurationFile_cfunc(vi, file_path) - def niScope_Fetch( - self, vi, channel_list, timeout, num_samples, waveform, wfm_info - ): # noqa: N802 + def niScope_Fetch(self, vi, channel_list, timeout, num_samples, waveform, wfm_info): # noqa: N802 with self._func_lock: if self.niScope_Fetch_cfunc is None: - self.niScope_Fetch_cfunc = self._get_library_function("niScope_Fetch") - self.niScope_Fetch_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViReal64, - ViInt32, - ctypes.POINTER(ViReal64), - ctypes.POINTER(waveform_info.struct_niScope_wfmInfo), - ] # noqa: F405 + self.niScope_Fetch_cfunc = self._get_library_function('niScope_Fetch') + self.niScope_Fetch_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(waveform_info.struct_niScope_wfmInfo)] # noqa: F405 self.niScope_Fetch_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_Fetch_cfunc( - vi, channel_list, timeout, num_samples, waveform, wfm_info - ) - - def niScope_FetchArrayMeasurement( - self, - vi, - channel_list, - timeout, - array_meas_function, - measurement_waveform_size, - meas_wfm, - wfm_info, - ): # noqa: N802 + return self.niScope_Fetch_cfunc(vi, channel_list, timeout, num_samples, waveform, wfm_info) + + def niScope_FetchArrayMeasurement(self, vi, channel_list, timeout, array_meas_function, measurement_waveform_size, meas_wfm, wfm_info): # noqa: N802 with self._func_lock: if self.niScope_FetchArrayMeasurement_cfunc is None: - self.niScope_FetchArrayMeasurement_cfunc = self._get_library_function( - "niScope_FetchArrayMeasurement" - ) - self.niScope_FetchArrayMeasurement_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViReal64, - ViInt32, - ViInt32, - ctypes.POINTER(ViReal64), - ctypes.POINTER(waveform_info.struct_niScope_wfmInfo), - ] # noqa: F405 - self.niScope_FetchArrayMeasurement_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niScope_FetchArrayMeasurement_cfunc( - vi, - channel_list, - timeout, - array_meas_function, - measurement_waveform_size, - meas_wfm, - wfm_info, - ) - - def niScope_FetchBinary16( - self, vi, channel_list, timeout, num_samples, waveform, wfm_info - ): # noqa: N802 + self.niScope_FetchArrayMeasurement_cfunc = self._get_library_function('niScope_FetchArrayMeasurement') + self.niScope_FetchArrayMeasurement_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViInt32, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(waveform_info.struct_niScope_wfmInfo)] # noqa: F405 + self.niScope_FetchArrayMeasurement_cfunc.restype = ViStatus # noqa: F405 + return self.niScope_FetchArrayMeasurement_cfunc(vi, channel_list, timeout, array_meas_function, measurement_waveform_size, meas_wfm, wfm_info) + + def niScope_FetchBinary16(self, vi, channel_list, timeout, num_samples, waveform, wfm_info): # noqa: N802 with self._func_lock: if self.niScope_FetchBinary16_cfunc is None: - self.niScope_FetchBinary16_cfunc = self._get_library_function( - "niScope_FetchBinary16" - ) - self.niScope_FetchBinary16_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViReal64, - ViInt32, - ctypes.POINTER(ViInt16), - ctypes.POINTER(waveform_info.struct_niScope_wfmInfo), - ] # noqa: F405 + self.niScope_FetchBinary16_cfunc = self._get_library_function('niScope_FetchBinary16') + self.niScope_FetchBinary16_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViInt32, ctypes.POINTER(ViInt16), ctypes.POINTER(waveform_info.struct_niScope_wfmInfo)] # noqa: F405 self.niScope_FetchBinary16_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_FetchBinary16_cfunc( - vi, channel_list, timeout, num_samples, waveform, wfm_info - ) + return self.niScope_FetchBinary16_cfunc(vi, channel_list, timeout, num_samples, waveform, wfm_info) - def niScope_FetchBinary32( - self, vi, channel_list, timeout, num_samples, waveform, wfm_info - ): # noqa: N802 + def niScope_FetchBinary32(self, vi, channel_list, timeout, num_samples, waveform, wfm_info): # noqa: N802 with self._func_lock: if self.niScope_FetchBinary32_cfunc is None: - self.niScope_FetchBinary32_cfunc = self._get_library_function( - "niScope_FetchBinary32" - ) - self.niScope_FetchBinary32_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViReal64, - ViInt32, - ctypes.POINTER(ViInt32), - ctypes.POINTER(waveform_info.struct_niScope_wfmInfo), - ] # noqa: F405 + self.niScope_FetchBinary32_cfunc = self._get_library_function('niScope_FetchBinary32') + self.niScope_FetchBinary32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViInt32, ctypes.POINTER(ViInt32), ctypes.POINTER(waveform_info.struct_niScope_wfmInfo)] # noqa: F405 self.niScope_FetchBinary32_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_FetchBinary32_cfunc( - vi, channel_list, timeout, num_samples, waveform, wfm_info - ) + return self.niScope_FetchBinary32_cfunc(vi, channel_list, timeout, num_samples, waveform, wfm_info) - def niScope_FetchBinary8( - self, vi, channel_list, timeout, num_samples, waveform, wfm_info - ): # noqa: N802 + def niScope_FetchBinary8(self, vi, channel_list, timeout, num_samples, waveform, wfm_info): # noqa: N802 with self._func_lock: if self.niScope_FetchBinary8_cfunc is None: - self.niScope_FetchBinary8_cfunc = self._get_library_function( - "niScope_FetchBinary8" - ) - self.niScope_FetchBinary8_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViReal64, - ViInt32, - ctypes.POINTER(ViInt8), - ctypes.POINTER(waveform_info.struct_niScope_wfmInfo), - ] # noqa: F405 + self.niScope_FetchBinary8_cfunc = self._get_library_function('niScope_FetchBinary8') + self.niScope_FetchBinary8_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViInt32, ctypes.POINTER(ViInt8), ctypes.POINTER(waveform_info.struct_niScope_wfmInfo)] # noqa: F405 self.niScope_FetchBinary8_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_FetchBinary8_cfunc( - vi, channel_list, timeout, num_samples, waveform, wfm_info - ) - - def niScope_FetchMeasurementStats( - self, - vi, - channel_list, - timeout, - scalar_meas_function, - result, - mean, - stdev, - min, - max, - num_in_stats, - ): # noqa: N802 + return self.niScope_FetchBinary8_cfunc(vi, channel_list, timeout, num_samples, waveform, wfm_info) + + def niScope_FetchMeasurementStats(self, vi, channel_list, timeout, scalar_meas_function, result, mean, stdev, min, max, num_in_stats): # noqa: N802 with self._func_lock: if self.niScope_FetchMeasurementStats_cfunc is None: - self.niScope_FetchMeasurementStats_cfunc = self._get_library_function( - "niScope_FetchMeasurementStats" - ) - self.niScope_FetchMeasurementStats_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViReal64, - ViInt32, - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViReal64), - ctypes.POINTER(ViInt32), - ] # noqa: F405 - self.niScope_FetchMeasurementStats_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niScope_FetchMeasurementStats_cfunc( - vi, - channel_list, - timeout, - scalar_meas_function, - result, - mean, - stdev, - min, - max, - num_in_stats, - ) - - def niScope_GetAttributeViBoolean( - self, vi, channel_list, attribute_id, value - ): # noqa: N802 + self.niScope_FetchMeasurementStats_cfunc = self._get_library_function('niScope_FetchMeasurementStats') + self.niScope_FetchMeasurementStats_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ctypes.POINTER(ViReal64), ctypes.POINTER(ViInt32)] # noqa: F405 + self.niScope_FetchMeasurementStats_cfunc.restype = ViStatus # noqa: F405 + return self.niScope_FetchMeasurementStats_cfunc(vi, channel_list, timeout, scalar_meas_function, result, mean, stdev, min, max, num_in_stats) + + def niScope_GetAttributeViBoolean(self, vi, channel_list, attribute_id, value): # noqa: N802 with self._func_lock: if self.niScope_GetAttributeViBoolean_cfunc is None: - self.niScope_GetAttributeViBoolean_cfunc = self._get_library_function( - "niScope_GetAttributeViBoolean" - ) - self.niScope_GetAttributeViBoolean_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 - self.niScope_GetAttributeViBoolean_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niScope_GetAttributeViBoolean_cfunc( - vi, channel_list, attribute_id, value - ) - - def niScope_GetAttributeViInt32( - self, vi, channel_list, attribute_id, value - ): # noqa: N802 + self.niScope_GetAttributeViBoolean_cfunc = self._get_library_function('niScope_GetAttributeViBoolean') + self.niScope_GetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niScope_GetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 + return self.niScope_GetAttributeViBoolean_cfunc(vi, channel_list, attribute_id, value) + + def niScope_GetAttributeViInt32(self, vi, channel_list, attribute_id, value): # noqa: N802 with self._func_lock: if self.niScope_GetAttributeViInt32_cfunc is None: - self.niScope_GetAttributeViInt32_cfunc = self._get_library_function( - "niScope_GetAttributeViInt32" - ) - self.niScope_GetAttributeViInt32_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niScope_GetAttributeViInt32_cfunc = self._get_library_function('niScope_GetAttributeViInt32') + self.niScope_GetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViInt32)] # noqa: F405 self.niScope_GetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_GetAttributeViInt32_cfunc( - vi, channel_list, attribute_id, value - ) + return self.niScope_GetAttributeViInt32_cfunc(vi, channel_list, attribute_id, value) - def niScope_GetAttributeViInt64( - self, vi, channel_list, attribute_id, value - ): # noqa: N802 + def niScope_GetAttributeViInt64(self, vi, channel_list, attribute_id, value): # noqa: N802 with self._func_lock: if self.niScope_GetAttributeViInt64_cfunc is None: - self.niScope_GetAttributeViInt64_cfunc = self._get_library_function( - "niScope_GetAttributeViInt64" - ) - self.niScope_GetAttributeViInt64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViInt64), - ] # noqa: F405 + self.niScope_GetAttributeViInt64_cfunc = self._get_library_function('niScope_GetAttributeViInt64') + self.niScope_GetAttributeViInt64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViInt64)] # noqa: F405 self.niScope_GetAttributeViInt64_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_GetAttributeViInt64_cfunc( - vi, channel_list, attribute_id, value - ) + return self.niScope_GetAttributeViInt64_cfunc(vi, channel_list, attribute_id, value) - def niScope_GetAttributeViReal64( - self, vi, channel_list, attribute_id, value - ): # noqa: N802 + def niScope_GetAttributeViReal64(self, vi, channel_list, attribute_id, value): # noqa: N802 with self._func_lock: if self.niScope_GetAttributeViReal64_cfunc is None: - self.niScope_GetAttributeViReal64_cfunc = self._get_library_function( - "niScope_GetAttributeViReal64" - ) - self.niScope_GetAttributeViReal64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niScope_GetAttributeViReal64_cfunc = self._get_library_function('niScope_GetAttributeViReal64') + self.niScope_GetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViReal64)] # noqa: F405 self.niScope_GetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_GetAttributeViReal64_cfunc( - vi, channel_list, attribute_id, value - ) + return self.niScope_GetAttributeViReal64_cfunc(vi, channel_list, attribute_id, value) - def niScope_GetAttributeViString( - self, vi, channel_list, attribute_id, buf_size, value - ): # noqa: N802 + def niScope_GetAttributeViString(self, vi, channel_list, attribute_id, buf_size, value): # noqa: N802 with self._func_lock: if self.niScope_GetAttributeViString_cfunc is None: - self.niScope_GetAttributeViString_cfunc = self._get_library_function( - "niScope_GetAttributeViString" - ) - self.niScope_GetAttributeViString_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niScope_GetAttributeViString_cfunc = self._get_library_function('niScope_GetAttributeViString') + self.niScope_GetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niScope_GetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_GetAttributeViString_cfunc( - vi, channel_list, attribute_id, buf_size, value - ) + return self.niScope_GetAttributeViString_cfunc(vi, channel_list, attribute_id, buf_size, value) - def niScope_GetEqualizationFilterCoefficients( - self, vi, channel, number_of_coefficients, coefficients - ): # noqa: N802 + def niScope_GetEqualizationFilterCoefficients(self, vi, channel, number_of_coefficients, coefficients): # noqa: N802 with self._func_lock: if self.niScope_GetEqualizationFilterCoefficients_cfunc is None: - self.niScope_GetEqualizationFilterCoefficients_cfunc = ( - self._get_library_function( - "niScope_GetEqualizationFilterCoefficients" - ) - ) - self.niScope_GetEqualizationFilterCoefficients_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViReal64), - ] # noqa: F405 - self.niScope_GetEqualizationFilterCoefficients_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niScope_GetEqualizationFilterCoefficients_cfunc( - vi, channel, number_of_coefficients, coefficients - ) + self.niScope_GetEqualizationFilterCoefficients_cfunc = self._get_library_function('niScope_GetEqualizationFilterCoefficients') + self.niScope_GetEqualizationFilterCoefficients_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niScope_GetEqualizationFilterCoefficients_cfunc.restype = ViStatus # noqa: F405 + return self.niScope_GetEqualizationFilterCoefficients_cfunc(vi, channel, number_of_coefficients, coefficients) def niScope_GetError(self, vi, error_code, buffer_size, description): # noqa: N802 with self._func_lock: if self.niScope_GetError_cfunc is None: - self.niScope_GetError_cfunc = self._get_library_function( - "niScope_GetError" - ) - self.niScope_GetError_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViStatus), - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niScope_GetError_cfunc = self._get_library_function('niScope_GetError') + self.niScope_GetError_cfunc.argtypes = [ViSession, ctypes.POINTER(ViStatus), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niScope_GetError_cfunc.restype = ViStatus # noqa: F405 return self.niScope_GetError_cfunc(vi, error_code, buffer_size, description) - def niScope_ImportAttributeConfigurationBuffer( - self, vi, size_in_bytes, configuration - ): # noqa: N802 + def niScope_ImportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 with self._func_lock: if self.niScope_ImportAttributeConfigurationBuffer_cfunc is None: - self.niScope_ImportAttributeConfigurationBuffer_cfunc = ( - self._get_library_function( - "niScope_ImportAttributeConfigurationBuffer" - ) - ) - self.niScope_ImportAttributeConfigurationBuffer_cfunc.argtypes = [ - ViSession, - ViInt32, - ctypes.POINTER(ViInt8), - ] # noqa: F405 - self.niScope_ImportAttributeConfigurationBuffer_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niScope_ImportAttributeConfigurationBuffer_cfunc( - vi, size_in_bytes, configuration - ) + self.niScope_ImportAttributeConfigurationBuffer_cfunc = self._get_library_function('niScope_ImportAttributeConfigurationBuffer') + self.niScope_ImportAttributeConfigurationBuffer_cfunc.argtypes = [ViSession, ViInt32, ctypes.POINTER(ViInt8)] # noqa: F405 + self.niScope_ImportAttributeConfigurationBuffer_cfunc.restype = ViStatus # noqa: F405 + return self.niScope_ImportAttributeConfigurationBuffer_cfunc(vi, size_in_bytes, configuration) def niScope_ImportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 with self._func_lock: if self.niScope_ImportAttributeConfigurationFile_cfunc is None: - self.niScope_ImportAttributeConfigurationFile_cfunc = ( - self._get_library_function( - "niScope_ImportAttributeConfigurationFile" - ) - ) - self.niScope_ImportAttributeConfigurationFile_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niScope_ImportAttributeConfigurationFile_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niScope_ImportAttributeConfigurationFile_cfunc = self._get_library_function('niScope_ImportAttributeConfigurationFile') + self.niScope_ImportAttributeConfigurationFile_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 + self.niScope_ImportAttributeConfigurationFile_cfunc.restype = ViStatus # noqa: F405 return self.niScope_ImportAttributeConfigurationFile_cfunc(vi, file_path) - def niScope_InitWithOptions( - self, resource_name, id_query, reset_device, option_string, vi - ): # noqa: N802 + def niScope_InitWithOptions(self, resource_name, id_query, reset_device, option_string, vi): # noqa: N802 with self._func_lock: if self.niScope_InitWithOptions_cfunc is None: - self.niScope_InitWithOptions_cfunc = self._get_library_function( - "niScope_InitWithOptions" - ) - self.niScope_InitWithOptions_cfunc.argtypes = [ - ctypes.POINTER(ViChar), - ViBoolean, - ViBoolean, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViSession), - ] # noqa: F405 + self.niScope_InitWithOptions_cfunc = self._get_library_function('niScope_InitWithOptions') + self.niScope_InitWithOptions_cfunc.argtypes = [ctypes.POINTER(ViChar), ViBoolean, ViBoolean, ctypes.POINTER(ViChar), ctypes.POINTER(ViSession)] # noqa: F405 self.niScope_InitWithOptions_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_InitWithOptions_cfunc( - resource_name, id_query, reset_device, option_string, vi - ) + return self.niScope_InitWithOptions_cfunc(resource_name, id_query, reset_device, option_string, vi) def niScope_InitiateAcquisition(self, vi): # noqa: N802 with self._func_lock: if self.niScope_InitiateAcquisition_cfunc is None: - self.niScope_InitiateAcquisition_cfunc = self._get_library_function( - "niScope_InitiateAcquisition" - ) - self.niScope_InitiateAcquisition_cfunc.argtypes = [ - ViSession - ] # noqa: F405 + self.niScope_InitiateAcquisition_cfunc = self._get_library_function('niScope_InitiateAcquisition') + self.niScope_InitiateAcquisition_cfunc.argtypes = [ViSession] # noqa: F405 self.niScope_InitiateAcquisition_cfunc.restype = ViStatus # noqa: F405 return self.niScope_InitiateAcquisition_cfunc(vi) def niScope_LockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niScope_LockSession_cfunc is None: - self.niScope_LockSession_cfunc = self._get_library_function( - "niScope_LockSession" - ) - self.niScope_LockSession_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niScope_LockSession_cfunc = self._get_library_function('niScope_LockSession') + self.niScope_LockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niScope_LockSession_cfunc.restype = ViStatus # noqa: F405 return self.niScope_LockSession_cfunc(vi, caller_has_lock) def niScope_ProbeCompensationSignalStart(self, vi): # noqa: N802 with self._func_lock: if self.niScope_ProbeCompensationSignalStart_cfunc is None: - self.niScope_ProbeCompensationSignalStart_cfunc = ( - self._get_library_function("niScope_ProbeCompensationSignalStart") - ) - self.niScope_ProbeCompensationSignalStart_cfunc.argtypes = [ - ViSession - ] # noqa: F405 - self.niScope_ProbeCompensationSignalStart_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niScope_ProbeCompensationSignalStart_cfunc = self._get_library_function('niScope_ProbeCompensationSignalStart') + self.niScope_ProbeCompensationSignalStart_cfunc.argtypes = [ViSession] # noqa: F405 + self.niScope_ProbeCompensationSignalStart_cfunc.restype = ViStatus # noqa: F405 return self.niScope_ProbeCompensationSignalStart_cfunc(vi) def niScope_ProbeCompensationSignalStop(self, vi): # noqa: N802 with self._func_lock: if self.niScope_ProbeCompensationSignalStop_cfunc is None: - self.niScope_ProbeCompensationSignalStop_cfunc = ( - self._get_library_function("niScope_ProbeCompensationSignalStop") - ) - self.niScope_ProbeCompensationSignalStop_cfunc.argtypes = [ - ViSession - ] # noqa: F405 - self.niScope_ProbeCompensationSignalStop_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niScope_ProbeCompensationSignalStop_cfunc = self._get_library_function('niScope_ProbeCompensationSignalStop') + self.niScope_ProbeCompensationSignalStop_cfunc.argtypes = [ViSession] # noqa: F405 + self.niScope_ProbeCompensationSignalStop_cfunc.restype = ViStatus # noqa: F405 return self.niScope_ProbeCompensationSignalStop_cfunc(vi) - def niScope_Read( - self, vi, channel_list, timeout, num_samples, waveform, wfm_info - ): # noqa: N802 + def niScope_Read(self, vi, channel_list, timeout, num_samples, waveform, wfm_info): # noqa: N802 with self._func_lock: if self.niScope_Read_cfunc is None: - self.niScope_Read_cfunc = self._get_library_function("niScope_Read") - self.niScope_Read_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViReal64, - ViInt32, - ctypes.POINTER(ViReal64), - ctypes.POINTER(waveform_info.struct_niScope_wfmInfo), - ] # noqa: F405 + self.niScope_Read_cfunc = self._get_library_function('niScope_Read') + self.niScope_Read_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViReal64, ViInt32, ctypes.POINTER(ViReal64), ctypes.POINTER(waveform_info.struct_niScope_wfmInfo)] # noqa: F405 self.niScope_Read_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_Read_cfunc( - vi, channel_list, timeout, num_samples, waveform, wfm_info - ) + return self.niScope_Read_cfunc(vi, channel_list, timeout, num_samples, waveform, wfm_info) def niScope_ResetDevice(self, vi): # noqa: N802 with self._func_lock: if self.niScope_ResetDevice_cfunc is None: - self.niScope_ResetDevice_cfunc = self._get_library_function( - "niScope_ResetDevice" - ) + self.niScope_ResetDevice_cfunc = self._get_library_function('niScope_ResetDevice') self.niScope_ResetDevice_cfunc.argtypes = [ViSession] # noqa: F405 self.niScope_ResetDevice_cfunc.restype = ViStatus # noqa: F405 return self.niScope_ResetDevice_cfunc(vi) @@ -1069,144 +487,71 @@ def niScope_ResetDevice(self, vi): # noqa: N802 def niScope_ResetWithDefaults(self, vi): # noqa: N802 with self._func_lock: if self.niScope_ResetWithDefaults_cfunc is None: - self.niScope_ResetWithDefaults_cfunc = self._get_library_function( - "niScope_ResetWithDefaults" - ) - self.niScope_ResetWithDefaults_cfunc.argtypes = [ - ViSession - ] # noqa: F405 + self.niScope_ResetWithDefaults_cfunc = self._get_library_function('niScope_ResetWithDefaults') + self.niScope_ResetWithDefaults_cfunc.argtypes = [ViSession] # noqa: F405 self.niScope_ResetWithDefaults_cfunc.restype = ViStatus # noqa: F405 return self.niScope_ResetWithDefaults_cfunc(vi) def niScope_SendSoftwareTriggerEdge(self, vi, which_trigger): # noqa: N802 with self._func_lock: if self.niScope_SendSoftwareTriggerEdge_cfunc is None: - self.niScope_SendSoftwareTriggerEdge_cfunc = self._get_library_function( - "niScope_SendSoftwareTriggerEdge" - ) - self.niScope_SendSoftwareTriggerEdge_cfunc.argtypes = [ - ViSession, - ViInt32, - ] # noqa: F405 - self.niScope_SendSoftwareTriggerEdge_cfunc.restype = ( - ViStatus # noqa: F405 - ) + self.niScope_SendSoftwareTriggerEdge_cfunc = self._get_library_function('niScope_SendSoftwareTriggerEdge') + self.niScope_SendSoftwareTriggerEdge_cfunc.argtypes = [ViSession, ViInt32] # noqa: F405 + self.niScope_SendSoftwareTriggerEdge_cfunc.restype = ViStatus # noqa: F405 return self.niScope_SendSoftwareTriggerEdge_cfunc(vi, which_trigger) - def niScope_SetAttributeViBoolean( - self, vi, channel_list, attribute_id, value - ): # noqa: N802 + def niScope_SetAttributeViBoolean(self, vi, channel_list, attribute_id, value): # noqa: N802 with self._func_lock: if self.niScope_SetAttributeViBoolean_cfunc is None: - self.niScope_SetAttributeViBoolean_cfunc = self._get_library_function( - "niScope_SetAttributeViBoolean" - ) - self.niScope_SetAttributeViBoolean_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViBoolean, - ] # noqa: F405 - self.niScope_SetAttributeViBoolean_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niScope_SetAttributeViBoolean_cfunc( - vi, channel_list, attribute_id, value - ) - - def niScope_SetAttributeViInt32( - self, vi, channel_list, attribute_id, value - ): # noqa: N802 + self.niScope_SetAttributeViBoolean_cfunc = self._get_library_function('niScope_SetAttributeViBoolean') + self.niScope_SetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViBoolean] # noqa: F405 + self.niScope_SetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 + return self.niScope_SetAttributeViBoolean_cfunc(vi, channel_list, attribute_id, value) + + def niScope_SetAttributeViInt32(self, vi, channel_list, attribute_id, value): # noqa: N802 with self._func_lock: if self.niScope_SetAttributeViInt32_cfunc is None: - self.niScope_SetAttributeViInt32_cfunc = self._get_library_function( - "niScope_SetAttributeViInt32" - ) - self.niScope_SetAttributeViInt32_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViInt32, - ] # noqa: F405 + self.niScope_SetAttributeViInt32_cfunc = self._get_library_function('niScope_SetAttributeViInt32') + self.niScope_SetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32] # noqa: F405 self.niScope_SetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_SetAttributeViInt32_cfunc( - vi, channel_list, attribute_id, value - ) + return self.niScope_SetAttributeViInt32_cfunc(vi, channel_list, attribute_id, value) - def niScope_SetAttributeViInt64( - self, vi, channel_list, attribute_id, value - ): # noqa: N802 + def niScope_SetAttributeViInt64(self, vi, channel_list, attribute_id, value): # noqa: N802 with self._func_lock: if self.niScope_SetAttributeViInt64_cfunc is None: - self.niScope_SetAttributeViInt64_cfunc = self._get_library_function( - "niScope_SetAttributeViInt64" - ) - self.niScope_SetAttributeViInt64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViInt64, - ] # noqa: F405 + self.niScope_SetAttributeViInt64_cfunc = self._get_library_function('niScope_SetAttributeViInt64') + self.niScope_SetAttributeViInt64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt64] # noqa: F405 self.niScope_SetAttributeViInt64_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_SetAttributeViInt64_cfunc( - vi, channel_list, attribute_id, value - ) + return self.niScope_SetAttributeViInt64_cfunc(vi, channel_list, attribute_id, value) - def niScope_SetAttributeViReal64( - self, vi, channel_list, attribute_id, value - ): # noqa: N802 + def niScope_SetAttributeViReal64(self, vi, channel_list, attribute_id, value): # noqa: N802 with self._func_lock: if self.niScope_SetAttributeViReal64_cfunc is None: - self.niScope_SetAttributeViReal64_cfunc = self._get_library_function( - "niScope_SetAttributeViReal64" - ) - self.niScope_SetAttributeViReal64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViReal64, - ] # noqa: F405 + self.niScope_SetAttributeViReal64_cfunc = self._get_library_function('niScope_SetAttributeViReal64') + self.niScope_SetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViReal64] # noqa: F405 self.niScope_SetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_SetAttributeViReal64_cfunc( - vi, channel_list, attribute_id, value - ) + return self.niScope_SetAttributeViReal64_cfunc(vi, channel_list, attribute_id, value) - def niScope_SetAttributeViString( - self, vi, channel_list, attribute_id, value - ): # noqa: N802 + def niScope_SetAttributeViString(self, vi, channel_list, attribute_id, value): # noqa: N802 with self._func_lock: if self.niScope_SetAttributeViString_cfunc is None: - self.niScope_SetAttributeViString_cfunc = self._get_library_function( - "niScope_SetAttributeViString" - ) - self.niScope_SetAttributeViString_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niScope_SetAttributeViString_cfunc = self._get_library_function('niScope_SetAttributeViString') + self.niScope_SetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViChar)] # noqa: F405 self.niScope_SetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niScope_SetAttributeViString_cfunc( - vi, channel_list, attribute_id, value - ) + return self.niScope_SetAttributeViString_cfunc(vi, channel_list, attribute_id, value) def niScope_UnlockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niScope_UnlockSession_cfunc is None: - self.niScope_UnlockSession_cfunc = self._get_library_function( - "niScope_UnlockSession" - ) - self.niScope_UnlockSession_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niScope_UnlockSession_cfunc = self._get_library_function('niScope_UnlockSession') + self.niScope_UnlockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niScope_UnlockSession_cfunc.restype = ViStatus # noqa: F405 return self.niScope_UnlockSession_cfunc(vi, caller_has_lock) def niScope_close(self, vi): # noqa: N802 with self._func_lock: if self.niScope_close_cfunc is None: - self.niScope_close_cfunc = self._get_library_function("niScope_close") + self.niScope_close_cfunc = self._get_library_function('niScope_close') self.niScope_close_cfunc.argtypes = [ViSession] # noqa: F405 self.niScope_close_cfunc.restype = ViStatus # noqa: F405 return self.niScope_close_cfunc(vi) @@ -1214,21 +559,15 @@ def niScope_close(self, vi): # noqa: N802 def niScope_error_message(self, vi, error_code, error_message): # noqa: N802 with self._func_lock: if self.niScope_error_message_cfunc is None: - self.niScope_error_message_cfunc = self._get_library_function( - "niScope_error_message" - ) - self.niScope_error_message_cfunc.argtypes = [ - ViSession, - ViStatus, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niScope_error_message_cfunc = self._get_library_function('niScope_error_message') + self.niScope_error_message_cfunc.argtypes = [ViSession, ViStatus, ctypes.POINTER(ViChar)] # noqa: F405 self.niScope_error_message_cfunc.restype = ViStatus # noqa: F405 return self.niScope_error_message_cfunc(vi, error_code, error_message) def niScope_reset(self, vi): # noqa: N802 with self._func_lock: if self.niScope_reset_cfunc is None: - self.niScope_reset_cfunc = self._get_library_function("niScope_reset") + self.niScope_reset_cfunc = self._get_library_function('niScope_reset') self.niScope_reset_cfunc.argtypes = [ViSession] # noqa: F405 self.niScope_reset_cfunc.restype = ViStatus # noqa: F405 return self.niScope_reset_cfunc(vi) @@ -1236,13 +575,7 @@ def niScope_reset(self, vi): # noqa: N802 def niScope_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 with self._func_lock: if self.niScope_self_test_cfunc is None: - self.niScope_self_test_cfunc = self._get_library_function( - "niScope_self_test" - ) - self.niScope_self_test_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt16), - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niScope_self_test_cfunc = self._get_library_function('niScope_self_test') + self.niScope_self_test_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt16), ctypes.POINTER(ViChar)] # noqa: F405 self.niScope_self_test_cfunc.restype = ViStatus # noqa: F405 return self.niScope_self_test_cfunc(vi, self_test_result, self_test_message) diff --git a/generated/niscope/niscope/_library_singleton.py b/generated/niscope/niscope/_library_singleton.py index fac599547..bd32f4d36 100644 --- a/generated/niscope/niscope/_library_singleton.py +++ b/generated/niscope/niscope/_library_singleton.py @@ -12,36 +12,30 @@ _instance = None _instance_lock = threading.Lock() -_library_info = { - "Linux": {"64bit": {"name": "niscope", "type": "cdll"}}, - "Windows": { - "32bit": {"name": "niScope_32.dll", "type": "windll"}, - "64bit": {"name": "niScope_64.dll", "type": "cdll"}, - }, -} +_library_info = {'Linux': {'64bit': {'name': 'niscope', 'type': 'cdll'}}, + 'Windows': {'32bit': {'name': 'niScope_32.dll', 'type': 'windll'}, + '64bit': {'name': 'niScope_64.dll', 'type': 'cdll'}}} def _get_library_name(): try: - return ctypes.util.find_library( - _library_info[platform.system()][platform.architecture()[0]]["name"] - ) # We find and return full path to the DLL + return ctypes.util.find_library(_library_info[platform.system()][platform.architecture()[0]]['name']) # We find and return full path to the DLL except KeyError: raise errors.UnsupportedConfigurationError def _get_library_type(): try: - return _library_info[platform.system()][platform.architecture()[0]]["type"] + return _library_info[platform.system()][platform.architecture()[0]]['type'] except KeyError: raise errors.UnsupportedConfigurationError def get(): - """get + '''get Returns the library.Library singleton for niscope. - """ + ''' global _instance global _instance_lock @@ -49,12 +43,13 @@ def get(): if _instance is None: try: library_type = _get_library_type() - if library_type == "windll": + if library_type == 'windll': ctypes_library = ctypes.WinDLL(_get_library_name()) else: - assert library_type == "cdll" + assert library_type == 'cdll' ctypes_library = ctypes.CDLL(_get_library_name()) except OSError: raise errors.DriverNotInstalledError() _instance = _library.Library(ctypes_library) return _instance + diff --git a/generated/niscope/niscope/_visatype.py b/generated/niscope/niscope/_visatype.py index bf96c3cfb..02cc41d1b 100644 --- a/generated/niscope/niscope/_visatype.py +++ b/generated/niscope/niscope/_visatype.py @@ -2,9 +2,9 @@ import ctypes -"""Definitions of the VISA types used by the C API of the driver runtime. +'''Definitions of the VISA types used by the C API of the driver runtime. These are aliased directly to ctypes types so can be used directly to call into the library. -""" +''' ViChar = ctypes.c_char @@ -26,3 +26,4 @@ ViAttr = ViUInt32 ViConstString = ViString ViRsrc = ViString + diff --git a/generated/niscope/niscope/enums.py b/generated/niscope/niscope/enums.py index af0a2ff24..5b4391e73 100644 --- a/generated/niscope/niscope/enums.py +++ b/generated/niscope/niscope/enums.py @@ -12,139 +12,139 @@ class AcquisitionStatus(Enum): class AcquisitionType(Enum): NORMAL = 0 - r""" + r''' Sets the digitizer to normal resolution mode. The digitizer can use real-time sampling or equivalent-time sampling. - """ + ''' FLEXRES = 1001 - r""" + r''' Sets the digitizer to flexible resolution mode if supported. The digitizer uses different hardware configurations to change the resolution depending on the sampling rate used. - """ + ''' DDC = 1002 - r""" + r''' Sets the digitizer to DDC mode on the NI 5620/5621. - """ + ''' class ArrayMeasurement(Enum): NO_MEASUREMENT = 4000 - r""" + r''' None - """ + ''' LAST_ACQ_HISTOGRAM = 4001 - r""" + r''' Last Acquisition Histogram - """ + ''' FFT_PHASE_SPECTRUM = 4002 - r""" + r''' FFT Phase Spectrum - """ + ''' FFT_AMP_SPECTRUM_VOLTS_RMS = 4003 - r""" + r''' FFT Amp. Spectrum (Volts RMS) - """ + ''' MULTI_ACQ_VOLTAGE_HISTOGRAM = 4004 - r""" + r''' Multi Acquisition Voltage Histogram - """ + ''' MULTI_ACQ_TIME_HISTOGRAM = 4005 - r""" + r''' Multi Acquisition Time Histogram - """ + ''' ARRAY_INTEGRAL = 4006 - r""" + r''' Array Integral - """ + ''' DERIVATIVE = 4007 - r""" + r''' Derivative - """ + ''' INVERSE = 4008 - r""" + r''' Inverse - """ + ''' HANNING_WINDOW = 4009 - r""" + r''' Hanning Window - """ + ''' FLAT_TOP_WINDOW = 4010 - r""" + r''' Flat Top Window - """ + ''' POLYNOMIAL_INTERPOLATION = 4011 - r""" + r''' Polynomial Interpolation - """ + ''' MULTIPLY_CHANNELS = 4012 - r""" + r''' Multiply Channels - """ + ''' ADD_CHANNELS = 4013 - r""" + r''' Add Channels - """ + ''' SUBTRACT_CHANNELS = 4014 - r""" + r''' Subtract Channels - """ + ''' DIVIDE_CHANNELS = 4015 - r""" + r''' Divide Channels - """ + ''' MULTI_ACQ_AVERAGE = 4016 - r""" + r''' Multi Acquisition Average - """ + ''' BUTTERWORTH_FILTER = 4017 - r""" + r''' Butterworth IIR Filter - """ + ''' CHEBYSHEV_FILTER = 4018 - r""" + r''' Chebyshev IIR Filter - """ + ''' FFT_AMP_SPECTRUM_DB = 4019 - r""" + r''' FFT Amp. Spectrum (dB) - """ + ''' HAMMING_WINDOW = 4020 - r""" + r''' Hamming Window - """ + ''' WINDOWED_FIR_FILTER = 4021 - r""" + r''' FIR Windowed Filter - """ + ''' BESSEL_FILTER = 4022 - r""" + r''' Bessel IIR Filter - """ + ''' TRIANGLE_WINDOW = 4023 - r""" + r''' Triangle Window - """ + ''' BLACKMAN_WINDOW = 4024 - r""" + r''' Blackman Window - """ + ''' ARRAY_OFFSET = 4025 - r""" + r''' Array Offset - """ + ''' ARRAY_GAIN = 4026 - r""" + r''' Array Gain - """ + ''' class CableSenseMode(Enum): DISABLED = 0 - r""" + r''' The oscilloscope is not configured to emit a CableSense signal. - """ + ''' ON_DEMAND = 1 - r""" + r''' The oscilloscope is configured to emit a single CableSense pulse. - """ + ''' class _CalibrationTypes(Enum): @@ -225,223 +225,223 @@ class ClearableMeasurement(Enum): class FIRFilterWindow(Enum): NONE = 0 - r""" + r''' No window. - """ + ''' HANNING = 409 - r""" + r''' Specifies a Hanning window. - """ + ''' FLAT_TOP = 410 - r""" + r''' Specifies a Flat Top window. - """ + ''' HAMMING = 420 - r""" + r''' Specifies a Hamming window. - """ + ''' TRIANGLE = 423 - r""" + r''' Specifies a Triangle window. - """ + ''' BLACKMAN = 424 - r""" + r''' Specifies a Blackman window. - """ + ''' class FetchRelativeTo(Enum): READ_POINTER = 388 - r""" + r''' The read pointer is set to zero when a new acquisition is initiated. After every fetch the read pointer is incremeted to be the sample after the last sample retrieved. Therefore, you can repeatedly fetch relative to the read pointer for a continuous acquisition program. - """ + ''' PRETRIGGER = 477 - r""" + r''' Fetches relative to the first pretrigger point requested with configure_horizontal_timing. - """ + ''' NOW = 481 - r""" + r''' Fetch data at the last sample acquired. - """ + ''' START = 482 - r""" + r''' Fetch data starting at the first point sampled by the digitizer. - """ + ''' TRIGGER = 483 - r""" + r''' Fetch at the first posttrigger sample. - """ + ''' class FilterType(Enum): LOWPASS = 0 - r""" + r''' Specifies lowpass as the filter type. - """ + ''' HIGHPASS = 1 - r""" + r''' Specifies highpass as the filter type. - """ + ''' BANDPASS = 2 - r""" + r''' Specifies bandpass as the filter type. - """ + ''' BANDSTOP = 3 - r""" + r''' Specifies bandstop as the filter type. - """ + ''' class FlexFIRAntialiasFilterType(Enum): FOURTYEIGHT_TAP_STANDARD = 0 - r""" + r''' This filter is optimized for alias protection and frequency-domain flatness - """ + ''' FOURTYEIGHT_TAP_HANNING = 1 - r""" + r''' This filter is optimized for the lowest possible bandwidth for a 48 tap filter and maximizes the SNR - """ + ''' SIXTEEN_TAP_HANNING = 2 - r""" + r''' This filter is optimized for the lowest possible bandwidth for a 16 tap filter and maximizes the SNR - """ + ''' EIGHT_TAP_HANNING = 3 - r""" + r''' This filter is optimized for the lowest possible bandwidth for a 8 tap filter and maximizes the SNR - """ + ''' class GlitchCondition(Enum): GREATER = 2 - r""" + r''' Trigger on pulses with a duration greater than the specified glitch width. - """ + ''' LESS = 1 - r""" + r''' Trigger on pulses with a duration shorter than the specified glitch width. - """ + ''' class GlitchPolarity(Enum): POSITIVE = 1 - r""" + r''' Trigger on pulses of positive polarity relative to the trigger threshold. - """ + ''' NEGATIVE = 2 - r""" + r''' Trigger on pulses of negative polarity relative to the trigger threshold. - """ + ''' EITHER = 3 - r""" + r''' Trigger on pulses of either positive or negative polarity. - """ + ''' class Option(Enum): SELF_CALIBRATE_ALL_CHANNELS = 0 - r""" + r''' Self Calibrating all Channels - """ + ''' RESTORE_EXTERNAL_CALIBRATION = 1 - r""" + r''' Restore External Calibration. - """ + ''' class PercentageMethod(Enum): LOWHIGH = 0 - r""" + r''' Specifies that the reference level percentages should be computed using the low/high method, - """ + ''' MINMAX = 1 - r""" + r''' Reference level percentages are computed using the min/max method. - """ + ''' BASETOP = 2 - r""" + r''' Reference level percentages are computed using the base/top method. - """ + ''' class RISMethod(Enum): EXACT_NUM_AVERAGES = 1 - r""" + r''' Acquires exactly the specified number of records for each bin in the RIS acquisition. An error is returned from the fetch method if the RIS acquisition does not successfully acquire the specified number of waveforms within the timeout period. You may call the fetch method again to allow more time for the acquisition to finish. - """ + ''' MIN_NUM_AVERAGES = 2 - r""" + r''' Each RIS sample is the average of a least a minimum number of randomly distributed points. - """ + ''' INCOMPLETE = 3 - r""" + r''' Returns the RIS waveform after the specified timeout even if it is incomplete. If no waveforms have been acquired in certain bins, these bins will have a NaN (when fetching scaled data) or a zero (when fetching binary data). A warning (positive error code) is returned from the fetch method if the RIS acquisition did not finish. The acquisition aborts when data is returned. - """ + ''' LIMITED_BIN_WIDTH = 5 - r""" + r''' Limits the waveforms in the various bins to be within 200 ps of the center of the bin. - """ + ''' class RefLevelUnits(Enum): VOLTS = 0 - r""" + r''' Specifies that the reference levels are given in units of volts. - """ + ''' PERCENTAGE = 1 - r""" + r''' (Default) Specifies that the reference levels are given in percentage units. - """ + ''' class RefTriggerDetectorLocation(Enum): ANALOG_DETECTION_CIRCUIT = 0 - r""" + r''' use the hardware analog circuitry to implement the reference trigger. This option will trigger before any onboard signal processing. - """ + ''' DDC_OUTPUT = 1 - r""" + r''' use the onboard signal processing logic to implement the reference trigger. This option will trigger based on the onboard signal processed data. - """ + ''' class RuntPolarity(Enum): POSITIVE = 1 - r""" + r''' Trigger on pulses of positive polarity relative to runt_low_threshold that do not cross runt_high_threshold. - """ + ''' NEGATIVE = 2 - r""" + r''' Trigger on pulses of negative polarity relative to runt_high_threshold that do not cross runt_low_threshold. - """ + ''' EITHER = 3 - r""" + r''' Trigger on pulses of either positive or negative polarity. - """ + ''' class RuntTimeCondition(Enum): NONE = 0 - r""" + r''' Time qualification is disabled. Trigger on runt pulses based solely on the voltage level of the pulses. - """ + ''' WITHIN = 1 - r""" + r''' Trigger on pulses that, in addition to meeting runt voltage criteria, have a duration within the range bounded by runt_time_low_limit and runt_time_high_limit. - """ + ''' OUTSIDE = 2 - r""" + r''' Trigger on pulses that, in addition to meeting runt voltage criteria, have a duration not within the range bounded by runt_time_low_limit and runt_time_high_limit. - """ + ''' class ScalarMeasurement(Enum): NO_MEASUREMENT = 4000 - r""" + r''' None - """ + ''' RISE_TIME = 0 FALL_TIME = 1 FREQUENCY = 2 @@ -485,234 +485,234 @@ class ScalarMeasurement(Enum): class TerminalConfiguration(Enum): SINGLE_ENDED = 0 - r""" + r''' Channel is single ended - """ + ''' UNBALANCED_DIFFERENTIAL = 1 - r""" + r''' Channel is unbalanced differential - """ + ''' DIFFERENTIAL = 2 - r""" + r''' Channel is differential - """ + ''' class TriggerCoupling(Enum): AC = 0 - r""" + r''' AC coupling - """ + ''' DC = 1 - r""" + r''' DC coupling - """ + ''' HF_REJECT = 3 - r""" + r''' Highpass filter coupling - """ + ''' LF_REJECT = 4 - r""" + r''' Lowpass filter coupling - """ + ''' AC_PLUS_HF_REJECT = 1001 - r""" + r''' Highpass and lowpass filter coupling - """ + ''' class TriggerModifier(Enum): NO_TRIGGER_MOD = 1 - r""" + r''' Normal triggering. - """ + ''' AUTO = 2 - r""" + r''' Software will trigger an acquisition automatically if no trigger arrives after a certain amount of time. - """ + ''' AUTO_LEVEL = 3 class TriggerSlope(Enum): NEGATIVE = 0 - r""" + r''' Falling edge - """ + ''' POSITIVE = 1 - r""" + r''' Rising edge - """ + ''' SLOPE_EITHER = 3 - r""" + r''' Either edge - """ + ''' class TriggerType(Enum): EDGE = 1 - r""" + r''' Configures the digitizer for edge triggering. An edge trigger occurs when the trigger signal crosses the trigger level specified with the set trigger slope. You configure the trigger level and slope with configure_trigger_edge. - """ + ''' HYSTERESIS = 1001 - r""" + r''' Configures the digitizer for hysteresis triggering. A hysteresis trigger occurs when the trigger signal crosses the trigger level with the specified slope and passes through the hysteresis window you specify. You configure the trigger level, slope, and hysteresis with configure_trigger_hysteresis. - """ + ''' DIGITAL = 1002 - r""" + r''' Configures the digitizer for digital triggering. A digital trigger occurs when the trigger signal has the specified slope. You configure the trigger slope with configure_trigger_digital. - """ + ''' WINDOW = 1003 - r""" + r''' Configures the digitizer for window triggering. A window trigger occurs when the trigger signal enters or leaves the window defined by the values you specify with the Low Window Level, High Window Level, and Window Mode Parameters. You configure the low window level high window level, and window mode with configure_trigger_window. - """ + ''' SOFTWARE = 1004 - r""" + r''' Configures the digitizer for software triggering. A software trigger occurs when SendSoftwareTrigger is called. - """ + ''' TV = 5 - r""" + r''' Configures the digitizer for video/TV triggering. You configure the video trigger parameters like signal Format, Line to trigger off of, Polarity, and Enable DC Restore with configure_trigger_video. - """ + ''' GLITCH = 4 WIDTH = 2 RUNT = 3 IMMEDIATE = 6 - r""" + r''' Configures the digitizer for immediate triggering. An immediate trigger occurs as soon as the pretrigger samples are acquired. - """ + ''' class TriggerWindowMode(Enum): ENTERING = 0 - r""" + r''' Trigger upon entering the window - """ + ''' LEAVING = 1 - r""" + r''' Trigger upon leaving the window - """ + ''' ENTERING_OR_LEAVING = 2 class VerticalCoupling(Enum): AC = 0 - r""" + r''' AC coupling - """ + ''' DC = 1 - r""" + r''' DC coupling - """ + ''' GND = 2 - r""" + r''' GND coupling - """ + ''' class VideoPolarity(Enum): POSITIVE = 1 - r""" + r''' Specifies that the video signal has positive polarity. - """ + ''' NEGATIVE = 2 - r""" + r''' Specifies that the video signal has negative polarity. - """ + ''' class VideoSignalFormat(Enum): NTSC = 1 - r""" + r''' NTSC signal format supports line numbers from 1 to 525 - """ + ''' PAL = 2 - r""" + r''' PAL signal format supports line numbers from 1 to 625 - """ + ''' SECAM = 3 - r""" + r''' SECAM signal format supports line numbers from 1 to 625 - """ + ''' M_PAL = 1001 - r""" + r''' M-PAL signal format supports line numbers from 1 to 525 - """ + ''' VIDEO_480I_59_94_FIELDS_PER_SECOND = 1010 - r""" + r''' 480 lines, interlaced, 59.94 fields per second - """ + ''' VIDEO_480I_60_FIELDS_PER_SECOND = 1011 - r""" + r''' 480 lines, interlaced, 60 fields per second - """ + ''' VIDEO_480P_59_94_FRAMES_PER_SECOND = 1015 - r""" + r''' 480 lines, progressive, 59.94 frames per second - """ + ''' VIDEO_480P_60_FRAMES_PER_SECOND = 1016 - r""" + r''' 480 lines, progressive,60 frames per second - """ + ''' VIDEO_576I_50_FIELDS_PER_SECOND = 1020 - r""" + r''' 576 lines, interlaced, 50 fields per second - """ + ''' VIDEO_576P_50_FRAMES_PER_SECOND = 1025 - r""" + r''' 576 lines, progressive, 50 frames per second - """ + ''' VIDEO_720P_50_FRAMES_PER_SECOND = 1031 - r""" + r''' 720 lines, progressive, 50 frames per second - """ + ''' VIDEO_720P_59_94_FRAMES_PER_SECOND = 1032 - r""" + r''' 720 lines, progressive, 59.94 frames per second - """ + ''' VIDEO_720P_60_FRAMES_PER_SECOND = 1033 - r""" + r''' 720 lines, progressive, 60 frames per second - """ + ''' VIDEO_1080I_50_FIELDS_PER_SECOND = 1040 - r""" + r''' 1,080 lines, interlaced, 50 fields per second - """ + ''' VIDEO_1080I_59_94_FIELDS_PER_SECOND = 1041 - r""" + r''' 1,080 lines, interlaced, 59.94 fields per second - """ + ''' VIDEO_1080I_60_FIELDS_PER_SECOND = 1042 - r""" + r''' 1,080 lines, interlaced, 60 fields per second - """ + ''' VIDEO_1080P_24_FRAMES_PER_SECOND = 1045 - r""" + r''' 1,080 lines, progressive, 24 frames per second - """ + ''' class VideoTriggerEvent(Enum): FIELD1 = 1 - r""" + r''' Trigger on field 1 of the signal - """ + ''' FIELD2 = 2 - r""" + r''' Trigger on field 2 of the signal - """ + ''' ANY_FIELD = 3 - r""" + r''' Trigger on the first field acquired - """ + ''' ANY_LINE = 4 - r""" + r''' Trigger on the first line acquired - """ + ''' LINE_NUMBER = 5 - r""" + r''' Trigger on a specific line of a video signal. Valid values vary depending on the signal format configured. - """ + ''' class WhichTrigger(Enum): @@ -724,25 +724,25 @@ class WhichTrigger(Enum): class WidthCondition(Enum): WITHIN = 1 - r""" + r''' Trigger on pulses with a duration within the range bounded by width_low_threshold and width_high_threshold. - """ + ''' OUTSIDE = 2 - r""" + r''' Trigger on pulses with a duration not within the range bounded by width_low_threshold and width_high_threshold. - """ + ''' class WidthPolarity(Enum): POSITIVE = 1 - r""" + r''' Trigger on pulses of positive polarity relative to the trigger threshold. - """ + ''' NEGATIVE = 2 - r""" + r''' Trigger on pulses of negative polarity relative to the trigger threshold. - """ + ''' EITHER = 3 - r""" + r''' Trigger on pulses of either positive or negative polarity. - """ + ''' diff --git a/generated/niscope/niscope/errors.py b/generated/niscope/niscope/errors.py index f4f3abc5c..fea4821a9 100644 --- a/generated/niscope/niscope/errors.py +++ b/generated/niscope/niscope/errors.py @@ -7,103 +7,86 @@ def _is_success(code): - return code == 0 + return (code == 0) def _is_error(code): - return code < 0 + return (code < 0) def _is_warning(code): - return code > 0 + return (code > 0) class Error(Exception): - """Base error class for NI-SCOPE""" + '''Base error class for NI-SCOPE''' def __init__(self, message): super(Error, self).__init__(message) class DriverError(Error): - """An error originating from the NI-SCOPE driver""" + '''An error originating from the NI-SCOPE driver''' def __init__(self, code, description): - assert _is_error(code), "Should not raise Error if code is not fatal." + assert (_is_error(code)), "Should not raise Error if code is not fatal." self.code = code self.description = description super(DriverError, self).__init__(str(self.code) + ": " + self.description) class DriverWarning(Warning): - """A warning originating from the NI-SCOPE driver""" + '''A warning originating from the NI-SCOPE driver''' def __init__(self, code, description): - assert _is_warning(code), "Should not create Warning if code is not positive." - super(DriverWarning, self).__init__( - "Warning {0} occurred.\n\n{1}".format(code, description) - ) + assert (_is_warning(code)), "Should not create Warning if code is not positive." + super(DriverWarning, self).__init__('Warning {0} occurred.\n\n{1}'.format(code, description)) class UnsupportedConfigurationError(Error): - """An error due to using this module in an usupported platform.""" + '''An error due to using this module in an usupported platform.''' def __init__(self): - super(UnsupportedConfigurationError, self).__init__( - "System configuration is unsupported: " - + platform.architecture()[0] - + " " - + platform.system() - ) + super(UnsupportedConfigurationError, self).__init__('System configuration is unsupported: ' + platform.architecture()[0] + ' ' + platform.system()) class DriverNotInstalledError(Error): - """An error due to using this module without the driver runtime installed.""" + '''An error due to using this module without the driver runtime installed.''' def __init__(self): - super(DriverNotInstalledError, self).__init__( - "The NI-SCOPE runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it." - ) + super(DriverNotInstalledError, self).__init__('The NI-SCOPE runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it.') class DriverTooOldError(Error): - """An error due to using this module with an older version of the driver runtime.""" + '''An error due to using this module with an older version of the driver runtime.''' def __init__(self): - super(DriverTooOldError, self).__init__( - "A function was not found in the NI-SCOPE runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it." - ) + super(DriverTooOldError, self).__init__('A function was not found in the NI-SCOPE runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it.') class InvalidRepeatedCapabilityError(Error): - """An error due to an invalid character in a repeated capability""" + '''An error due to an invalid character in a repeated capability''' def __init__(self, invalid_character, invalid_string): - super(InvalidRepeatedCapabilityError, self).__init__( - "An invalid character ({0}) was found in repeated capability string ({1})".format( - invalid_character, invalid_string - ) - ) + super(InvalidRepeatedCapabilityError, self).__init__('An invalid character ({0}) was found in repeated capability string ({1})'.format(invalid_character, invalid_string)) class SelfTestError(Error): - """An error due to a failed self-test""" + '''An error due to a failed self-test''' def __init__(self, code, msg): self.code = code self.message = msg - super(SelfTestError, self).__init__( - "Self-test failed with code {0}: {1}".format(code, msg) - ) + super(SelfTestError, self).__init__('Self-test failed with code {0}: {1}'.format(code, msg)) def handle_error(session, code, ignore_warnings, is_error_handling): - """handle_error + '''handle_error Helper function for handling errors returned by niscope.Library. It calls back into the session to get the corresponding error description and raises if necessary. - """ + ''' if _is_success(code) or (_is_warning(code) and ignore_warnings): return @@ -111,7 +94,7 @@ def handle_error(session, code, ignore_warnings, is_error_handling): if is_error_handling: # The caller is in the midst of error handling and an error occurred. # Don't try to get the description or we'll start recursing until the stack overflows. - description = "" + description = '' else: description = session._get_error_description(code) @@ -120,3 +103,5 @@ def handle_error(session, code, ignore_warnings, is_error_handling): assert _is_warning(code) warnings.warn(DriverWarning(code, description)) + + diff --git a/generated/niscope/niscope/measurement_stats.py b/generated/niscope/niscope/measurement_stats.py index f4ba79914..178f0f6f1 100644 --- a/generated/niscope/niscope/measurement_stats.py +++ b/generated/niscope/niscope/measurement_stats.py @@ -1,7 +1,5 @@ class MeasurementStats(object): - def __init__( - self, result=0.0, mean=0.0, stdev=0.0, min_val=0.0, max_val=0.0, num_in_stats=0 - ): + def __init__(self, result=0.0, mean=0.0, stdev=0.0, min_val=0.0, max_val=0.0, num_in_stats=0): self.result = result self.mean = mean self.stdev = stdev @@ -14,34 +12,32 @@ def __init__( def __repr__(self): parameter_list = [ - "result={}".format(self.result), - "mean={}".format(self.mean), - "stdev={}".format(self.stdev), - "min_val={}".format(self.min_val), - "max_val={}".format(self.max_val), - "num_in_stats={}".format(self.num_in_stats), + 'result={}'.format(self.result), + 'mean={}'.format(self.mean), + 'stdev={}'.format(self.stdev), + 'min_val={}'.format(self.min_val), + 'max_val={}'.format(self.max_val), + 'num_in_stats={}'.format(self.num_in_stats) ] - return "{0}({1})".format(self.__class__.__name__, ", ".join(parameter_list)) + return '{0}({1})'.format(self.__class__.__name__, ', '.join(parameter_list)) def __str__(self): - row_format_g = "{:<20}: {:,.6g}\n" - row_format_d = "{:<20}: {:,}\n" - row_format_s = "{:<20}: {:}\n" + row_format_g = '{:<20}: {:,.6g}\n' + row_format_d = '{:<20}: {:,}\n' + row_format_s = '{:<20}: {:}\n' - string_representation = "" + string_representation = '' if self.channel is not None: - string_representation += row_format_s.format("Channel", self.channel) + string_representation += row_format_s.format('Channel', self.channel) if self.record is not None: - string_representation += row_format_d.format("Record", self.record) + string_representation += row_format_d.format('Record', self.record) - string_representation += row_format_g.format("Result", self.result) - string_representation += row_format_g.format("Mean", self.mean) - string_representation += row_format_g.format("Standard Deviation", self.stdev) - string_representation += row_format_g.format("Minimum Value", self.min_val) - string_representation += row_format_g.format("Maximum Value", self.max_val) - string_representation += row_format_d.format( - "Number in Stats", self.num_in_stats - ) + string_representation += row_format_g.format('Result', self.result) + string_representation += row_format_g.format('Mean', self.mean) + string_representation += row_format_g.format('Standard Deviation', self.stdev) + string_representation += row_format_g.format('Minimum Value', self.min_val) + string_representation += row_format_g.format('Maximum Value', self.max_val) + string_representation += row_format_d.format('Number in Stats', self.num_in_stats) return string_representation diff --git a/generated/niscope/niscope/session.py b/generated/niscope/niscope/session.py index bddc9f8a9..2bbffb2d1 100644 --- a/generated/niscope/niscope/session.py +++ b/generated/niscope/niscope/session.py @@ -2,7 +2,6 @@ # This file was generated import array # noqa: F401 import ctypes - # Used by @ivi_synchronized from functools import wraps @@ -22,24 +21,22 @@ # Used for __repr__ import pprint - pp = pprint.PrettyPrinter(indent=4) # Helper functions for creating ctypes needed for calling into the driver DLL def get_ctypes_pointer_for_buffer(value=None, library_type=None, size=None): if isinstance(value, array.array): - assert library_type is not None, "library_type is required for array.array" + assert library_type is not None, 'library_type is required for array.array' addr, _ = value.buffer_info() return ctypes.cast(addr, ctypes.POINTER(library_type)) elif str(type(value)).find("'numpy.ndarray'") != -1: import numpy - return numpy.ctypeslib.as_ctypes(value) elif isinstance(value, bytes): return ctypes.cast(value, ctypes.POINTER(library_type)) elif isinstance(value, list): - assert library_type is not None, "library_type is required for list" + assert library_type is not None, 'library_type is required for list' return (library_type * len(value))(*value) else: if library_type is not None and size is not None: @@ -79,7 +76,6 @@ def aux(*xs, **kws): session = xs[0] # parameter 0 is 'self' which is the session object with session.lock(): return f(*xs, **kws) - return aux @@ -100,34 +96,16 @@ def __init__(self, session, prefix, current_repeated_capability_list): self._session = session self._prefix = prefix # We need at least one element. If we get an empty list, make the one element an empty string - self._current_repeated_capability_list = ( - current_repeated_capability_list - if len(current_repeated_capability_list) > 0 - else [""] - ) + self._current_repeated_capability_list = current_repeated_capability_list if len(current_repeated_capability_list) > 0 else [''] # Now we know there is at lease one entry, so we look if it is an empty string or not - self._separator = ( - "/" if len(self._current_repeated_capability_list[0]) > 0 else "" - ) + self._separator = '/' if len(self._current_repeated_capability_list[0]) > 0 else '' def __getitem__(self, repeated_capability): - """Set/get properties or call methods with a repeated capability (i.e. channels)""" - rep_caps_list = _converters.convert_repeated_capabilities( - repeated_capability, self._prefix - ) - complete_rep_cap_list = [ - current_rep_cap + self._separator + rep_cap - for current_rep_cap in self._current_repeated_capability_list - for rep_cap in rep_caps_list - ] - - return _SessionBase( - vi=self._session._vi, - repeated_capability_list=complete_rep_cap_list, - library=self._session._library, - encoding=self._session._encoding, - freeze_it=True, - ) + '''Set/get properties or call methods with a repeated capability (i.e. channels)''' + rep_caps_list = _converters.convert_repeated_capabilities(repeated_capability, self._prefix) + complete_rep_cap_list = [current_rep_cap + self._separator + rep_cap for current_rep_cap in self._current_repeated_capability_list for rep_cap in rep_caps_list] + + return _SessionBase(vi=self._session._vi, repeated_capability_list=complete_rep_cap_list, library=self._session._library, encoding=self._session._encoding, freeze_it=True) # This is a very simple context manager we can use when we need to set/get attributes @@ -139,22 +117,20 @@ def __init__(self, session): def __enter__(self): self._repeated_capability_cache = self._session._repeated_capability - self._session._repeated_capability = "" + self._session._repeated_capability = '' def __exit__(self, exc_type, exc_value, traceback): self._session._repeated_capability = self._repeated_capability_cache class _SessionBase(object): - """Base class for all NI-SCOPE sessions.""" + '''Base class for all NI-SCOPE sessions.''' # This is needed during __init__. Without it, __setattr__ raises an exception _is_frozen = False - absolute_sample_clock_offset = _attributes.AttributeViReal64TimeDeltaSeconds( - 1150374 - ) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + absolute_sample_clock_offset = _attributes.AttributeViReal64TimeDeltaSeconds(1150374) + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds Gets or sets the absolute time offset of the sample clock relative to the reference clock in terms of seconds. @@ -167,21 +143,19 @@ class _SessionBase(object): The range of the absolute sample clock offset is [-.5 sample clock periods, .5 sample clock periods]. The default absolute sample clock offset is 0s. - """ + ''' acquisition_start_time = _attributes.AttributeViReal64TimeDeltaSeconds(1250109) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the length of time from the trigger event to the first point in the waveform record in seconds. If the value is positive, the first point in the waveform record occurs after the trigger event (same as specifying trigger_delay_time). If the value is negative, the first point in the waveform record occurs before the trigger event (same as specifying horz_record_ref_position). - """ - acquisition_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.AcquisitionType, 1250101 - ) - """Type: enums.AcquisitionType + ''' + acquisition_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.AcquisitionType, 1250101) + '''Type: enums.AcquisitionType Specifies how the digitizer acquires data and fills the waveform record. - """ + ''' acq_arm_source = _attributes.AttributeViString(1150053) - """Type: str + '''Type: str Specifies the source the digitizer monitors for a start (acquisition arm) trigger. When the start trigger is received, the digitizer begins acquiring pretrigger samples. Valid Values: @@ -200,34 +174,34 @@ class _SessionBase(object): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - """ + ''' advance_trigger_terminal_name = _attributes.AttributeViString(1150143) - """Type: str + '''Type: str Returns the fully qualified name for the Advance Trigger terminal. You can use this terminal as the source for another trigger. - """ + ''' adv_trig_src = _attributes.AttributeViString(1150094) - """Type: str + '''Type: str Specifies the source the digitizer monitors for an advance trigger. When the advance trigger is received, the digitizer begins acquiring pretrigger samples. - """ + ''' allow_more_records_than_memory = _attributes.AttributeViBoolean(1150068) - """Type: bool + '''Type: bool Indicates whether more records can be configured with configure_horizontal_timing than fit in the onboard memory. If this property is set to True, it is necessary to fetch records while the acquisition is in progress. Eventually, some of the records will be overwritten. An error is returned from the fetch method if you attempt to fetch a record that has been overwritten. - """ + ''' arm_ref_trig_src = _attributes.AttributeViString(1150095) - """Type: str + '''Type: str Specifies the source the digitizer monitors for an arm reference trigger. When the arm reference trigger is received, the digitizer begins looking for a reference (stop) trigger from the user-configured trigger source. - """ + ''' backlog = _attributes.AttributeViReal64(1150084) - """Type: float + '''Type: float Returns the number of samples (points_done) that have been acquired but not fetched for the record specified by fetch_record_number. - """ + ''' bandpass_filter_enabled = _attributes.AttributeViBoolean(1150318) - """Type: bool + '''Type: bool Enables the bandpass filter on the specificed channel. The default value is FALSE. @@ -240,19 +214,17 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.bandpass_filter_enabled` - """ + ''' binary_sample_width = _attributes.AttributeViInt32(1150005) - """Type: int + '''Type: int Indicates the bit width of the binary data in the acquired waveform. Useful for determining which Binary Fetch method to use. Compare to resolution. To configure the device to store samples with a lower resolution that the native, set this property to the desired binary width. This can be useful for streaming at faster speeds at the cost of resolution. The least significant bits will be lost with this configuration. Valid Values: 8, 16, 32 - """ - cable_sense_mode = _attributes.AttributeEnum( - _attributes.AttributeViReal64, enums.CableSenseMode, 1150138 - ) - """Type: enums.CableSenseMode + ''' + cable_sense_mode = _attributes.AttributeEnum(_attributes.AttributeViReal64, enums.CableSenseMode, 1150138) + '''Type: enums.CableSenseMode Specifies whether and how the oscilloscope is configured to generate a CableSense signal on the specified channels when the CableSenseSignalStart method is called. @@ -279,14 +251,14 @@ class _SessionBase(object): Note: One or more of the referenced methods are not in the Python API for this driver. - """ + ''' cable_sense_signal_enable = _attributes.AttributeViBoolean(1150139) - """Type: bool + '''Type: bool TBD - """ + ''' cable_sense_voltage = _attributes.AttributeViReal64(1150137) - """Type: float + '''Type: float Returns the voltage of the CableSense signal that is written to the EEPROM of the oscilloscope during factory calibration. @@ -303,15 +275,15 @@ class _SessionBase(object): +-----------------------+ | PXIe-5162 | +-----------------------+ - """ + ''' channel_count = _attributes.AttributeViInt32(1050203) - """Type: int + '''Type: int Indicates the number of channels that the specific instrument driver supports. For channel-based properties, the IVI engine maintains a separate cache value for each channel. - """ + ''' channel_enabled = _attributes.AttributeViBoolean(1250005) - """Type: bool + '''Type: bool Specifies whether the digitizer acquires a waveform for the channel. Valid Values: @@ -327,11 +299,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.channel_enabled` - """ - channel_terminal_configuration = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TerminalConfiguration, 1150107 - ) - """Type: enums.TerminalConfiguration + ''' + channel_terminal_configuration = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TerminalConfiguration, 1150107) + '''Type: enums.TerminalConfiguration Specifies the terminal configuration for the channel. @@ -344,24 +314,24 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.channel_terminal_configuration` - """ + ''' data_transfer_block_size = _attributes.AttributeViInt32(1150316) - """Type: int + '''Type: int Specifies the maximum number of samples to transfer at one time from the device to host memory. Increasing this number should result in better fetching performance because the driver does not need to restart the transfers as often. However, increasing this number may also increase the amount of page-locked memory required from the system. - """ + ''' data_transfer_maximum_bandwidth = _attributes.AttributeViReal64(1150321) - """Type: float + '''Type: float This property specifies the maximum bandwidth that the device is allowed to consume. - """ + ''' data_transfer_preferred_packet_size = _attributes.AttributeViInt32(1150322) - """Type: int + '''Type: int This property specifies the size of (read request|memory write) data payload. Due to alignment of the data buffers, the hardware may not always generate a packet of this size. - """ + ''' device_temperature = _attributes.AttributeViReal64(1150086) - """Type: float + '''Type: float Returns the temperature of the device in degrees Celsius from the onboard sensor. @@ -374,9 +344,9 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.device_temperature` - """ + ''' enabled_channels = _attributes.AttributeViString(1150140) - """Type: str + '''Type: str Returns a comma-separated list of the channels enabled for the session in ascending order. @@ -386,17 +356,17 @@ class _SessionBase(object): Because this property returns channels in ascending order, but the order in which you specify channels for the input is important, the value of this property may not necessarily reflect the order in which NI-SCOPE performs certain actions. Refer to Channel String Syntax in the NI High-Speed Digitizers Help for more information on the effects of channel order in NI-SCOPE. - """ + ''' enable_dc_restore = _attributes.AttributeViBoolean(1150093) - """Type: bool + '''Type: bool Restores the video-triggered data retrieved by the digitizer to the video signal's zero reference point. Valid Values: True - Enable DC restore False - Disable DC restore - """ + ''' enable_time_interleaved_sampling = _attributes.AttributeViBoolean(1150128) - """Type: bool + '''Type: bool Specifies whether the digitizer acquires the waveform using multiple ADCs for the channel enabling a higher maximum real-time sampling rate. Valid Values: @@ -412,33 +382,31 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.enable_time_interleaved_sampling` - """ + ''' end_of_acquisition_event_output_terminal = _attributes.AttributeViString(1150101) - """Type: str + '''Type: str Specifies the destination for the End of Acquisition Event. When this event is asserted, the digitizer has completed sampling for all records. Consult your device documentation for a specific list of valid destinations. - """ + ''' end_of_acquisition_event_terminal_name = _attributes.AttributeViString(1150141) - """Type: str + '''Type: str Returns the fully qualified name for the End of Acquisition Event terminal. You can use this terminal as the source for a trigger. - """ + ''' end_of_record_event_output_terminal = _attributes.AttributeViString(1150099) - """Type: str + '''Type: str Specifies the destination for the End of Record Event. When this event is asserted, the digitizer has completed sampling for the current record. Consult your device documentation for a specific list of valid destinations. - """ + ''' end_of_record_event_terminal_name = _attributes.AttributeViString(1150142) - """Type: str + '''Type: str Returns the fully qualified name for the End of Record Event terminal. You can use this terminal as the source for a trigger. - """ - end_of_record_to_advance_trigger_holdoff = ( - _attributes.AttributeViReal64TimeDeltaSeconds(1150366) - ) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + ''' + end_of_record_to_advance_trigger_holdoff = _attributes.AttributeViReal64TimeDeltaSeconds(1150366) + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds End of Record to Advance Trigger Holdoff is the length of time (in seconds) that a device waits between the completion of one record and @@ -447,9 +415,9 @@ class _SessionBase(object): Advance Trigger state, and will not store samples in onboard memory, accept an Advance Trigger, or trigger on the input signal.. **Supported Devices**: NI 5185/5186 - """ + ''' equalization_filter_enabled = _attributes.AttributeViBoolean(1150313) - """Type: bool + '''Type: bool Enables the onboard signal processing FIR block. This block is connected directly to the input signal. This filter is designed to compensate the input signal for artifacts introduced to the signal outside of the digitizer. However, since this is a generic FIR filter any coefficients are valid. Coefficients should be between +1 and -1 in value. @@ -462,9 +430,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.equalization_filter_enabled` - """ + ''' equalization_num_coefficients = _attributes.AttributeViInt32(1150312) - """Type: int + '''Type: int Returns the number of coefficients that the FIR filter can accept. This filter is designed to compensate the input signal for artifacts introduced to the signal outside of the digitizer. However, since this is a generic FIR filter any coefficients are valid. Coefficients should be between +1 and -1 in value. @@ -477,61 +445,57 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.equalization_num_coefficients` - """ + ''' exported_advance_trigger_output_terminal = _attributes.AttributeViString(1150109) - """Type: str + '''Type: str Specifies the destination to export the advance trigger. When the advance trigger is received, the digitizer begins acquiring samples for the Nth record. Consult your device documentation for a specific list of valid destinations. - """ + ''' exported_ref_trigger_output_terminal = _attributes.AttributeViString(1150098) - """Type: str + '''Type: str Specifies the destination export for the reference (stop) trigger. Consult your device documentation for a specific list of valid destinations. - """ + ''' exported_start_trigger_output_terminal = _attributes.AttributeViString(1150097) - """Type: str + '''Type: str Specifies the destination to export the Start trigger. When the start trigger is received, the digitizer begins acquiring samples. Consult your device documentation for a specific list of valid destinations. - """ + ''' _fetch_meas_num_samples = _attributes.AttributeViInt32(1150081) - """Type: int + '''Type: int Number of samples to fetch when performing a measurement. Use -1 to fetch the actual record length. Default Value: -1 - """ + ''' _fetch_num_records = _attributes.AttributeViInt32(1150080) - """Type: int + '''Type: int Number of records to fetch. Use -1 to fetch all configured records. Default Value: -1 - """ + ''' _fetch_offset = _attributes.AttributeViInt32(1150078) - """Type: int + '''Type: int Offset in samples to start fetching data within each record. The offset is applied relative to fetch_relative_to.The offset can be positive or negative. Default Value: 0 - """ + ''' _fetch_record_number = _attributes.AttributeViInt32(1150079) - """Type: int + '''Type: int Zero-based index of the first record to fetch. Use NISCOPE_FETCH_NUM_RECORDS to set the number of records to fetch. Default Value: 0. - """ - _fetch_relative_to = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.FetchRelativeTo, 1150077 - ) - """Type: enums.FetchRelativeTo + ''' + _fetch_relative_to = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.FetchRelativeTo, 1150077) + '''Type: enums.FetchRelativeTo Position to start fetching within one record. Default Value: FetchRelativeTo.PRETRIGGER - """ - flex_fir_antialias_filter_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.FlexFIRAntialiasFilterType, 1150271 - ) - """Type: enums.FlexFIRAntialiasFilterType + ''' + flex_fir_antialias_filter_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.FlexFIRAntialiasFilterType, 1150271) + '''Type: enums.FlexFIRAntialiasFilterType The NI 5922 flexible-resolution digitizer uses an onboard FIR lowpass antialias filter. Use this property to select from several types of filters to achieve desired filtering characteristics. @@ -545,37 +509,33 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.flex_fir_antialias_filter_type` - """ + ''' fpga_bitfile_path = _attributes.AttributeViString(1150375) - """Type: str + '''Type: str Gets the absolute file path to the bitfile loaded on the FPGA. Note: Gets the absolute file path to the bitfile loaded on the FPGA. - """ - glitch_condition = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.GlitchCondition, 1250403 - ) - """Type: enums.GlitchCondition + ''' + glitch_condition = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.GlitchCondition, 1250403) + '''Type: enums.GlitchCondition Specifies whether the oscilloscope triggers on pulses of duration less than or greater than the value specified by the glitch_width property. - """ - glitch_polarity = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.GlitchPolarity, 1250402 - ) - """Type: enums.GlitchPolarity + ''' + glitch_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.GlitchPolarity, 1250402) + '''Type: enums.GlitchPolarity Specifies the polarity of pulses that trigger the oscilloscope for glitch triggering. - """ + ''' glitch_width = _attributes.AttributeViReal64(1250401) - """Type: float + '''Type: float Specifies the glitch duration, in seconds. The oscilloscope triggers when it detects of pulse of duration either less than or greater than this value depending on the value of the glitch_condition property. - """ + ''' high_pass_filter_frequency = _attributes.AttributeViReal64(1150377) - """Type: float + '''Type: float Specifies the frequency for the highpass filter in Hz. The device uses one of the valid values listed below. If an invalid value is specified, @@ -594,54 +554,54 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.high_pass_filter_frequency` - """ + ''' horz_enforce_realtime = _attributes.AttributeViBoolean(1150004) - """Type: bool + '''Type: bool Indicates whether the digitizer enforces real-time measurements or allows equivalent-time measurements. - """ + ''' horz_min_num_pts = _attributes.AttributeViInt32(1250009) - """Type: int + '''Type: int Specifies the minimum number of points you require in the waveform record for each channel. NI-SCOPE uses the value you specify to configure the record length that the digitizer uses for waveform acquisition. horz_record_length returns the actual record length. Valid Values: 1 - available onboard memory - """ + ''' horz_num_records = _attributes.AttributeViInt32(1150001) - """Type: int + '''Type: int Specifies the number of records to acquire. Can be used for multi-record acquisition and single-record acquisitions. Setting this to 1 indicates a single-record acquisition. - """ + ''' horz_record_length = _attributes.AttributeViInt32(1250008) - """Type: int + '''Type: int Returns the actual number of points the digitizer acquires for each channel. The value is equal to or greater than the minimum number of points you specify with horz_min_num_pts. Allocate a ViReal64 array of this size or greater to pass as the WaveformArray parameter of the Read and Fetch methods. This property is only valid after a call to the one of the Configure Horizontal methods. - """ + ''' horz_record_ref_position = _attributes.AttributeViReal64(1250011) - """Type: float + '''Type: float Specifies the position of the Reference Event in the waveform record. When the digitizer detects a trigger, it waits the length of time the trigger_delay_time property specifies. The event that occurs when the delay time elapses is the Reference Event. The Reference Event is relative to the start of the record and is a percentage of the record length. For example, the value 50.0 corresponds to the center of the waveform record and 0.0 corresponds to the first element in the waveform record. Valid Values: 0.0 - 100.0 - """ + ''' horz_sample_rate = _attributes.AttributeViReal64(1250010) - """Type: float + '''Type: float Returns the effective sample rate using the current configuration. The units are samples per second. This property is only valid after a call to the one of the Configure Horizontal methods. Units: Hertz (Samples / Second) - """ + ''' horz_time_per_record = _attributes.AttributeViReal64TimeDeltaSeconds(1250007) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the length of time that corresponds to the record length. Units: Seconds - """ + ''' input_clock_source = _attributes.AttributeViString(1150002) - """Type: str + '''Type: str Specifies the input source for the PLL reference clock (the 1 MHz to 20 MHz clock on the NI 5122, the 10 MHz clock for the NI 5112/5620/5621/5911) to which the digitizer will be phase-locked; for the NI 5102, this is the source of the board clock. - """ + ''' input_impedance = _attributes.AttributeViReal64(1250103) - """Type: float + '''Type: float Specifies the input impedance for the channel in Ohms. @@ -654,9 +614,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.input_impedance` - """ + ''' instrument_firmware_revision = _attributes.AttributeViString(1050510) - """Type: str + '''Type: str A string that contains the firmware revision information for the instrument you are currently using. @@ -669,19 +629,19 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.instrument_firmware_revision` - """ + ''' instrument_manufacturer = _attributes.AttributeViString(1050511) - """Type: str + '''Type: str A string that contains the name of the instrument manufacturer. - """ + ''' instrument_model = _attributes.AttributeViString(1050512) - """Type: str + '''Type: str A string that contains the model number of the current instrument. - """ + ''' interleaving_offset_correction_enabled = _attributes.AttributeViBoolean(1150376) - """Type: bool + '''Type: bool Enables the interleaving offset correction on the specified channel. The default value is TRUE. @@ -700,18 +660,18 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.interleaving_offset_correction_enabled` - """ + ''' io_resource_descriptor = _attributes.AttributeViString(1050304) - """Type: str + '''Type: str Indicates the resource descriptor the driver uses to identify the physical device. If you initialize the driver with a logical name, this property contains the resource descriptor that corresponds to the entry in the IVI Configuration utility. If you initialize the instrument driver with the resource descriptor, this property contains that value.You can pass a logical name to Init or __init__. The IVI Configuration utility must contain an entry for the logical name. The logical name entry refers to a virtual instrument section in the IVI Configuration file. The virtual instrument section specifies a physical device and initial user options. Note: One or more of the referenced methods are not in the Python API for this driver. - """ + ''' is_probe_comp_on = _attributes.AttributeViBoolean(1150066) - """Type: bool + '''Type: bool Tip: This property can be set/get on specific instruments within your :py:class:`niscope.Session` instance. @@ -722,22 +682,22 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.is_probe_comp_on` - """ + ''' logical_name = _attributes.AttributeViString(1050305) - """Type: str + '''Type: str A string containing the logical name you specified when opening the current IVI session. You can pass a logical name to Init or __init__. The IVI Configuration utility must contain an entry for the logical name. The logical name entry refers to a virtual instrument section in the IVI Configuration file. The virtual instrument section specifies a physical device and initial user options. Note: One or more of the referenced methods are not in the Python API for this driver. - """ + ''' master_enable = _attributes.AttributeViBoolean(1150008) - """Type: bool + '''Type: bool Specifies whether you want the device to be a master or a slave. The master typically originates the trigger signal and clock sync pulse. For a standalone device, set this property to False. - """ + ''' max_input_frequency = _attributes.AttributeViReal64(1250006) - """Type: float + '''Type: float Specifies the bandwidth of the channel. Express this value as the frequency at which the input circuitry attenuates the input signal by 3 dB. The units are hertz. Defined Values: @@ -760,19 +720,19 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.max_input_frequency` - """ + ''' max_real_time_sampling_rate = _attributes.AttributeViReal64(1150073) - """Type: float + '''Type: float Returns the maximum real time sample rate in Hz. - """ + ''' max_ris_rate = _attributes.AttributeViReal64(1150074) - """Type: float + '''Type: float Returns the maximum sample rate in RIS mode in Hz. - """ + ''' meas_array_gain = _attributes.AttributeViReal64(1150043) - """Type: float + '''Type: float Every element of an array is multiplied by this scalar value during the Array Gain measurement. Refer to ArrayMeasurement.ARRAY_GAIN for more information. Default: 1.0 @@ -786,9 +746,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_array_gain` - """ + ''' meas_array_offset = _attributes.AttributeViReal64(1150044) - """Type: float + '''Type: float Every element of an array is added to this scalar value during the Array Offset measurement. Refer to ArrayMeasurement.ARRAY_OFFSET for more information. Default: 0.0 @@ -802,9 +762,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_array_offset` - """ + ''' meas_chan_high_ref_level = _attributes.AttributeViReal64(1150040) - """Type: float + '''Type: float Stores the high reference level used in many scalar measurements. Different channels may have different reference levels. Do not use the IVI-defined, nonchannel-based properties such as meas_high_ref if you use this property to set various channels to different values. Default: 90% @@ -818,9 +778,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_chan_high_ref_level` - """ + ''' meas_chan_low_ref_level = _attributes.AttributeViReal64(1150038) - """Type: float + '''Type: float Stores the low reference level used in many scalar measurements. Different channels may have different reference levels. Do not use the IVI-defined, nonchannel-based properties such as meas_low_ref if you use this property to set various channels to different values. Default: 10% @@ -834,9 +794,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_chan_low_ref_level` - """ + ''' meas_chan_mid_ref_level = _attributes.AttributeViReal64(1150039) - """Type: float + '''Type: float Stores the mid reference level used in many scalar measurements. Different channels may have different reference levels. Do not use the IVI-defined, nonchannel-based properties such as meas_mid_ref if you use this property to set various channels to different values. Default: 50% @@ -850,9 +810,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_chan_mid_ref_level` - """ + ''' meas_filter_center_freq = _attributes.AttributeViReal64(1150032) - """Type: float + '''Type: float The center frequency in hertz for filters of type bandpass and bandstop. The width of the filter is specified by meas_filter_width, where the cutoff frequencies are the center ± width. Default: 1.0e6 Hz @@ -866,9 +826,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_filter_center_freq` - """ + ''' meas_filter_cutoff_freq = _attributes.AttributeViReal64(1150031) - """Type: float + '''Type: float Specifies the cutoff frequency in hertz for filters of type lowpass and highpass. The cutoff frequency definition varies depending on the filter. Default: 1.0e6 Hz @@ -882,9 +842,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_filter_cutoff_freq` - """ + ''' meas_filter_order = _attributes.AttributeViInt32(1150036) - """Type: int + '''Type: int Specifies the order of an IIR filter. All positive integers are valid. Default: 2 @@ -898,9 +858,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_filter_order` - """ + ''' meas_filter_ripple = _attributes.AttributeViReal64(1150033) - """Type: float + '''Type: float Specifies the amount of ripple in the passband in units of decibels (positive values). Used only for Chebyshev filters. The more ripple allowed gives a sharper cutoff for a given filter order. Default: 0.1 dB @@ -914,9 +874,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_filter_ripple` - """ + ''' meas_filter_taps = _attributes.AttributeViInt32(1150037) - """Type: int + '''Type: int Defines the number of taps (coefficients) for an FIR filter. Default: 25 @@ -930,9 +890,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_filter_taps` - """ + ''' meas_filter_transient_waveform_percent = _attributes.AttributeViReal64(1150034) - """Type: float + '''Type: float The percentage (0 - 100%) of the IIR filtered waveform to eliminate from the beginning of the waveform. This allows eliminating the transient portion of the waveform that is undefined due to the assumptions necessary at the boundary condition. Default: 20.0% @@ -946,11 +906,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_filter_transient_waveform_percent` - """ - meas_filter_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.FilterType, 1150035 - ) - """Type: enums.FilterType + ''' + meas_filter_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.FilterType, 1150035) + '''Type: enums.FilterType Specifies the type of filter, for both IIR and FIR filters. The allowed values are the following: · NISCOPE_VAL_MEAS_LOWPASS @@ -971,9 +929,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_filter_type` - """ + ''' meas_filter_width = _attributes.AttributeViReal64(1150041) - """Type: float + '''Type: float Specifies the width of bandpass and bandstop type filters in hertz. The cutoff frequencies occur at meas_filter_center_freq ± one-half width. Default: 1.0e3 Hz @@ -987,11 +945,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_filter_width` - """ - meas_fir_filter_window = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.FIRFilterWindow, 1150042 - ) - """Type: enums.FIRFilterWindow + ''' + meas_fir_filter_window = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.FIRFilterWindow, 1150042) + '''Type: enums.FIRFilterWindow Specifies the FIR window type. The possible choices are: FIRFilterWindow.NONE @@ -1012,10 +968,10 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_fir_filter_window` - """ + ''' meas_high_ref = _attributes.AttributeViReal64(1250607) meas_hysteresis_percent = _attributes.AttributeViReal64(1150019) - """Type: float + '''Type: float Digital hysteresis that is used in several of the scalar waveform measurements. This property specifies the percentage of the full-scale vertical range for the hysteresis window size. Default: 2% @@ -1029,9 +985,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_hysteresis_percent` - """ + ''' meas_interpolation_sampling_factor = _attributes.AttributeViReal64(1150030) - """Type: float + '''Type: float The new number of points for polynomial interpolation is the sampling factor times the input number of points. For example, if you acquire 1,000 points with the digitizer and set this property to 2.5, calling FetchWaveformMeasurementArray with the ArrayMeasurement.POLYNOMIAL_INTERPOLATION measurement resamples the waveform to 2,500 points. Default: 2.0 @@ -1048,9 +1004,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_interpolation_sampling_factor` - """ + ''' meas_last_acq_histogram_size = _attributes.AttributeViInt32(1150020) - """Type: int + '''Type: int Specifies the size (that is, the number of bins) in the last acquisition histogram. This histogram is used to determine several scalar measurements, most importantly voltage low and voltage high. Default: 256 @@ -1064,11 +1020,11 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_last_acq_histogram_size` - """ + ''' meas_low_ref = _attributes.AttributeViReal64(1250608) meas_mid_ref = _attributes.AttributeViReal64(1250609) meas_other_channel = _attributes.AttributeViStringRepeatedCapability(1150018) - """Type: str or int + '''Type: str or int Specifies the second channel for two-channel measurements, such as ArrayMeasurement.ADD_CHANNELS. If processing steps are registered with this channel, the processing is done before the waveform is used in a two-channel measurement. Default: '0' @@ -1082,11 +1038,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_other_channel` - """ - meas_percentage_method = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.PercentageMethod, 1150045 - ) - """Type: enums.PercentageMethod + ''' + meas_percentage_method = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.PercentageMethod, 1150045) + '''Type: enums.PercentageMethod Specifies the method used to map percentage reference units to voltages for the reference. Possible values are: NISCOPE_VAL_MEAS_LOW_HIGH @@ -1106,9 +1060,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_percentage_method` - """ + ''' meas_polynomial_interpolation_order = _attributes.AttributeViInt32(1150029) - """Type: int + '''Type: int Specifies the polynomial order used for the polynomial interpolation measurement. For example, an order of 1 is linear interpolation whereas an order of 2 specifies parabolic interpolation. Any positive integer is valid. Default: 1 @@ -1122,11 +1076,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_polynomial_interpolation_order` - """ - meas_ref_level_units = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.RefLevelUnits, 1150016 - ) - """Type: enums.RefLevelUnits + ''' + meas_ref_level_units = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.RefLevelUnits, 1150016) + '''Type: enums.RefLevelUnits Specifies the units of the reference levels. NISCOPE_VAL_MEAS_VOLTAGE--Specifies that the reference levels are given in units of volts @@ -1145,11 +1097,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_ref_level_units` - """ - meas_time_histogram_high_time = _attributes.AttributeViReal64TimeDeltaSeconds( - 1150028 - ) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + ''' + meas_time_histogram_high_time = _attributes.AttributeViReal64TimeDeltaSeconds(1150028) + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the highest time value included in the multiple acquisition time histogram. The units are always seconds. Default: 5.0e-4 seconds @@ -1163,9 +1113,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_time_histogram_high_time` - """ + ''' meas_time_histogram_high_volts = _attributes.AttributeViReal64(1150026) - """Type: float + '''Type: float Specifies the highest voltage value included in the multiple-acquisition time histogram. The units are always volts. Default: 10.0 V @@ -1179,11 +1129,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_time_histogram_high_volts` - """ - meas_time_histogram_low_time = _attributes.AttributeViReal64TimeDeltaSeconds( - 1150027 - ) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + ''' + meas_time_histogram_low_time = _attributes.AttributeViReal64TimeDeltaSeconds(1150027) + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the lowest time value included in the multiple-acquisition time histogram. The units are always seconds. Default: -5.0e-4 seconds @@ -1197,9 +1145,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_time_histogram_low_time` - """ + ''' meas_time_histogram_low_volts = _attributes.AttributeViReal64(1150025) - """Type: float + '''Type: float Specifies the lowest voltage value included in the multiple acquisition time histogram. The units are always volts. Default: -10.0 V @@ -1213,9 +1161,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_time_histogram_low_volts` - """ + ''' meas_time_histogram_size = _attributes.AttributeViInt32(1150024) - """Type: int + '''Type: int Determines the multiple acquisition voltage histogram size. The size is set during the first call to a time histogram measurement after clearing the measurement history with clear_waveform_measurement_stats. Default: 256 @@ -1229,9 +1177,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_time_histogram_size` - """ + ''' meas_voltage_histogram_high_volts = _attributes.AttributeViReal64(1150023) - """Type: float + '''Type: float Specifies the highest voltage value included in the multiple acquisition voltage histogram. The units are always volts. Default: 10.0 V @@ -1245,9 +1193,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_voltage_histogram_high_volts` - """ + ''' meas_voltage_histogram_low_volts = _attributes.AttributeViReal64(1150022) - """Type: float + '''Type: float Specifies the lowest voltage value included in the multiple-acquisition voltage histogram. The units are always volts. Default: -10.0 V @@ -1261,9 +1209,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_voltage_histogram_low_volts` - """ + ''' meas_voltage_histogram_size = _attributes.AttributeViInt32(1150021) - """Type: int + '''Type: int Determines the multiple acquisition voltage histogram size. The size is set the first time a voltage histogram measurement is called after clearing the measurement history with the method clear_waveform_measurement_stats. Default: 256 @@ -1277,9 +1225,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.meas_voltage_histogram_size` - """ + ''' min_sample_rate = _attributes.AttributeViReal64(1150009) - """Type: float + '''Type: float Specify the sampling rate for the acquisition in Samples per second. Valid Values: @@ -1287,9 +1235,9 @@ class _SessionBase(object): Note: One or more of the referenced methods are not in the Python API for this driver. - """ + ''' onboard_memory_size = _attributes.AttributeViInt32(1150069) - """Type: int + '''Type: int Returns the total combined amount of onboard memory for all channels in bytes. @@ -1302,14 +1250,14 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.onboard_memory_size` - """ + ''' output_clock_source = _attributes.AttributeViString(1150003) - """Type: str + '''Type: str Specifies the output source for the 10 MHz clock to which another digitizer's sample clock can be phased-locked. - """ + ''' pll_lock_status = _attributes.AttributeViBoolean(1151303) - """Type: bool + '''Type: bool If TRUE, the PLL has remained locked to the external reference clock since it was last checked. If FALSE, the PLL has become unlocked from the external reference clock since it was last checked. @@ -1322,19 +1270,19 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.pll_lock_status` - """ + ''' points_done = _attributes.AttributeViReal64(1150082) - """Type: float + '''Type: float Actual number of samples acquired in the record specified by fetch_record_number from the fetch_relative_to and fetch_offset properties. - """ + ''' poll_interval = _attributes.AttributeViInt32(1150100) - """Type: int + '''Type: int Specifies the poll interval in milliseconds to use during RIS acquisitions to check whether the acquisition is complete. - """ + ''' probe_attenuation = _attributes.AttributeViReal64(1250004) - """Type: float + '''Type: float Specifies the probe attenuation for the input channel. For example, for a 10:1 probe, set this property to 10.0. Valid Values: @@ -1349,122 +1297,114 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.probe_attenuation` - """ + ''' ready_for_advance_event_output_terminal = _attributes.AttributeViString(1150112) - """Type: str + '''Type: str Specifies the destination for the Ready for Advance Event. When this event is asserted, the digitizer is ready to receive an advance trigger. Consult your device documentation for a specific list of valid destinations. - """ + ''' ready_for_advance_event_terminal_name = _attributes.AttributeViString(1150146) - """Type: str + '''Type: str Returns the fully qualified name for the Ready for Advance Event terminal. You can use this terminal as the source for a trigger. - """ + ''' ready_for_ref_event_output_terminal = _attributes.AttributeViString(1150111) - """Type: str + '''Type: str Specifies the destination for the Ready for Reference Event. When this event is asserted, the digitizer is ready to receive a reference trigger. Consult your device documentation for a specific list of valid destinations. - """ + ''' ready_for_ref_event_terminal_name = _attributes.AttributeViString(1150147) - """Type: str + '''Type: str Returns the fully qualified name for the Ready for Reference Event terminal. You can use this terminal as the source for a trigger. - """ + ''' ready_for_start_event_output_terminal = _attributes.AttributeViString(1150110) - """Type: str + '''Type: str Specifies the destination for the Ready for Start Event. When this event is asserted, the digitizer is ready to receive a start trigger. Consult your device documentation for a specific list of valid destinations. - """ + ''' ready_for_start_event_terminal_name = _attributes.AttributeViString(1150148) - """Type: str + '''Type: str Returns the fully qualified name for the Ready for Start Event terminal. You can use this terminal as the source for a trigger. - """ + ''' records_done = _attributes.AttributeViInt32(1150083) - """Type: int + '''Type: int Specifies the number of records that have been completely acquired. - """ + ''' record_arm_source = _attributes.AttributeViString(1150065) - """Type: str + '''Type: str Specifies the record arm source. - """ + ''' ref_clk_rate = _attributes.AttributeViReal64(1150090) - """Type: float + '''Type: float If input_clock_source is an external source, this property specifies the frequency of the input, or reference clock, to which the internal sample clock timebase is synchronized. The frequency is in hertz. - """ - ref_trigger_detector_location = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.RefTriggerDetectorLocation, 1150314 - ) - """Type: enums.RefTriggerDetectorLocation + ''' + ref_trigger_detector_location = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.RefTriggerDetectorLocation, 1150314) + '''Type: enums.RefTriggerDetectorLocation Indicates which analog compare circuitry to use on the device. - """ - ref_trigger_minimum_quiet_time = _attributes.AttributeViReal64TimeDeltaSeconds( - 1150315 - ) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + ''' + ref_trigger_minimum_quiet_time = _attributes.AttributeViReal64TimeDeltaSeconds(1150315) + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds The amount of time the trigger circuit must not detect a signal above the trigger level before the trigger is armed. This property is useful for triggering at the beginning and not in the middle of signal bursts. - """ + ''' ref_trigger_terminal_name = _attributes.AttributeViString(1150144) - """Type: str + '''Type: str Returns the fully qualified name for the Reference Trigger terminal. You can use this terminal as the source for another trigger. - """ + ''' ref_trig_tdc_enable = _attributes.AttributeViBoolean(1150096) - """Type: bool + '''Type: bool This property controls whether the TDC is used to compute an accurate trigger. - """ + ''' resolution = _attributes.AttributeViInt32(1150102) - """Type: int + '''Type: int Indicates the bit width of valid data (as opposed to padding bits) in the acquired waveform. Compare to binary_sample_width. - """ + ''' ris_in_auto_setup_enable = _attributes.AttributeViBoolean(1150106) - """Type: bool + '''Type: bool Indicates whether the digitizer should use RIS sample rates when searching for a frequency in autosetup. Valid Values: True (1) - Use RIS sample rates in autosetup False (0) - Do not use RIS sample rates in autosetup - """ - ris_method = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.RISMethod, 1150071 - ) - """Type: enums.RISMethod + ''' + ris_method = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.RISMethod, 1150071) + '''Type: enums.RISMethod Specifies the algorithm for random-interleaved sampling, which is used if the sample rate exceeds the value of max_real_time_sampling_rate. - """ + ''' ris_num_averages = _attributes.AttributeViInt32(1150070) - """Type: int + '''Type: int The number of averages for each bin in an RIS acquisition. The number of averages times the oversampling factor is the minimum number of real-time acquisitions necessary to reconstruct the RIS waveform. Averaging is useful in RIS because the trigger times are not evenly spaced, so adjacent points in the reconstructed waveform not be accurately spaced. By averaging, the errors in both time and voltage are smoothed. - """ + ''' runt_high_threshold = _attributes.AttributeViReal64(1250301) - """Type: float + '''Type: float Specifies the higher of two thresholds, in volts, that bound the vertical range to examine for runt pulses. The runt threshold that causes the oscilloscope to trigger depends on the runt polarity you select. Refer to the runt_polarity property for more information. - """ + ''' runt_low_threshold = _attributes.AttributeViReal64(1250302) - """Type: float + '''Type: float Specifies the lower of two thresholds, in volts, that bound the vertical range to examine for runt pulses. The runt threshold that causes the oscilloscope to trigger depends on the runt polarity you select. Refer to the runt_polarity property for more information. - """ - runt_polarity = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.RuntPolarity, 1250303 - ) - """Type: enums.RuntPolarity + ''' + runt_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.RuntPolarity, 1250303) + '''Type: enums.RuntPolarity Specifies the polarity of pulses that trigger the oscilloscope for runt triggering. @@ -1479,59 +1419,57 @@ class _SessionBase(object): * No portion of the pulse crosses the runt_low_threshold. When set to RuntPolarity.EITHER, the oscilloscope triggers in either case. - """ - runt_time_condition = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.RuntTimeCondition, 1150132 - ) - """Type: enums.RuntTimeCondition + ''' + runt_time_condition = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.RuntTimeCondition, 1150132) + '''Type: enums.RuntTimeCondition Specifies whether runt triggers are time qualified, and if so, how the oscilloscope triggers in relation to the duration range bounded by the runt_time_low_limit and runt_time_high_limit properties. - """ + ''' runt_time_high_limit = _attributes.AttributeViReal64(1150134) - """Type: float + '''Type: float Specifies, in seconds, the high runt threshold time. This property sets the upper bound on the duration of runt pulses that may trigger the oscilloscope. The runt_time_condition property determines how the oscilloscope triggers in relation to the runt time limits. - """ + ''' runt_time_low_limit = _attributes.AttributeViReal64(1150133) - """Type: float + '''Type: float Specifies, in seconds, the low runt threshold time. This property sets the lower bound on the duration of runt pulses that may trigger the oscilloscope. The runt_time_condition property determines how the oscilloscope triggers in relation to the runt time limits. - """ + ''' sample_mode = _attributes.AttributeViInt32(1250106) - """Type: int + '''Type: int Indicates the sample mode the digitizer is currently using. - """ + ''' samp_clk_timebase_div = _attributes.AttributeViInt32(1150089) - """Type: int + '''Type: int If samp_clk_timebase_src is an external source, specifies the ratio between the sample clock timebase rate and the actual sample rate, which can be slower. - """ + ''' sample_clock_timebase_multiplier = _attributes.AttributeViInt32(1150367) - """Type: int + '''Type: int If samp_clk_timebase_src is an external source, this property specifies the ratio between the samp_clk_timebase_rate and the actual sample rate, which can be higher. This property can be used in conjunction with samp_clk_timebase_div. Some devices use multiple ADCs to sample the same channel at an effective sample rate that is greater than the specified clock rate. When providing an external sample clock use this property to indicate when you want a higher sample rate. Valid values for this property vary by device and current configuration. **Related topics:** `Sample Clock `__ - """ + ''' samp_clk_timebase_rate = _attributes.AttributeViReal64(1150088) - """Type: float + '''Type: float If samp_clk_timebase_src is an external source, specifies the frequency in hertz of the external clock used as the timebase source. - """ + ''' samp_clk_timebase_src = _attributes.AttributeViString(1150087) - """Type: str + '''Type: str Specifies the source of the sample clock timebase, which is the timebase used to control waveform sampling. The actual sample rate may be the timebase itself or a divided version of the timebase, depending on the min_sample_rate (for internal sources) or the samp_clk_timebase_div (for external sources). - """ + ''' serial_number = _attributes.AttributeViString(1150104) - """Type: str + '''Type: str Returns the serial number of the device. @@ -1544,9 +1482,9 @@ class _SessionBase(object): To set/get on all instruments, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.serial_number` - """ + ''' accessory_gain = _attributes.AttributeViReal64(1150279) - """Type: float + '''Type: float Returns the calibration gain for the current device configuration. @@ -1565,9 +1503,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.accessory_gain` - """ + ''' accessory_offset = _attributes.AttributeViReal64(1150280) - """Type: float + '''Type: float Returns the calibration offset for the current device configuration. @@ -1586,122 +1524,112 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.accessory_offset` - """ + ''' simulate = _attributes.AttributeViBoolean(1050005) - """Type: bool + '''Type: bool Specifies whether or not to simulate instrument driver I/O operations. If simulation is enabled, instrument driver methods perform range checking and call Ivi_GetAttribute and Ivi_SetAttribute methods, but they do not perform instrument I/O. For output parameters that represent instrument data, the instrument driver methods return calculated values. The default value is False. Use the __init__ method to override this value. - """ + ''' specific_driver_description = _attributes.AttributeViString(1050514) - """Type: str + '''Type: str A string that contains a brief description of the specific driver - """ + ''' specific_driver_revision = _attributes.AttributeViString(1050551) - """Type: str + '''Type: str A string that contains additional version information about this instrument driver. - """ + ''' specific_driver_vendor = _attributes.AttributeViString(1050513) - """Type: str + '''Type: str A string that contains the name of the vendor that supplies this driver. - """ - start_to_ref_trigger_holdoff = _attributes.AttributeViReal64TimeDeltaSeconds( - 1150103 - ) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + ''' + start_to_ref_trigger_holdoff = _attributes.AttributeViReal64TimeDeltaSeconds(1150103) + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds Pass the length of time you want the digitizer to wait after it starts acquiring data until the digitizer enables the trigger system to detect a reference (stop) trigger. Units: Seconds Valid Values: 0.0 - 171.8 - """ + ''' start_trigger_terminal_name = _attributes.AttributeViString(1150145) - """Type: str + '''Type: str Returns the fully qualified name for the Start Trigger terminal. You can use this terminal as the source for another trigger. - """ + ''' supported_instrument_models = _attributes.AttributeViString(1050327) - """Type: str + '''Type: str A string that contains a comma-separated list of the instrument model numbers supported by this driver. - """ + ''' trigger_auto_triggered = _attributes.AttributeViBoolean(1150278) - """Type: bool + '''Type: bool Specifies if the last acquisition was auto triggered. You can use the Auto Triggered property to find out if the last acquisition was triggered. - """ - trigger_coupling = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TriggerCoupling, 1250014 - ) - """Type: enums.TriggerCoupling + ''' + trigger_coupling = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerCoupling, 1250014) + '''Type: enums.TriggerCoupling Specifies how the digitizer couples the trigger source. This property affects instrument operation only when trigger_type is set to TriggerType.EDGE, TriggerType.HYSTERESIS, or TriggerType.WINDOW. - """ + ''' trigger_delay_time = _attributes.AttributeViReal64TimeDeltaSeconds(1250015) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the trigger delay time in seconds. The trigger delay time is the length of time the digitizer waits after it receives the trigger. The event that occurs when the trigger delay elapses is the Reference Event. Valid Values: 0.0 - 171.8 - """ + ''' trigger_holdoff = _attributes.AttributeViReal64TimeDeltaSeconds(1250016) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the length of time (in seconds) the digitizer waits after detecting a trigger before enabling the trigger subsystem to detect another trigger. This property affects instrument operation only when the digitizer requires multiple acquisitions to build a complete waveform. The digitizer requires multiple waveform acquisitions when it uses equivalent-time sampling or when the digitizer is configured for a multi-record acquisition through a call to configure_horizontal_timing. Valid Values: 0.0 - 171.8 - """ + ''' trigger_hysteresis = _attributes.AttributeViReal64(1150006) - """Type: float + '''Type: float Specifies the size of the hysteresis window on either side of the trigger level. The digitizer triggers when the trigger signal passes through the threshold you specify with the Trigger Level parameter, has the slope you specify with the Trigger Slope parameter, and passes through the hysteresis window that you specify with this parameter. - """ + ''' trigger_impedance = _attributes.AttributeViReal64(1150075) - """Type: float + '''Type: float Specifies the input impedance for the external analog trigger channel in Ohms. Valid Values: 50 - 50 ohms 1000000 - 1 mega ohm - """ + ''' trigger_level = _attributes.AttributeViReal64(1250017) - """Type: float + '''Type: float Specifies the voltage threshold for the trigger subsystem. The units are volts. This property affects instrument behavior only when the trigger_type is set to TriggerType.EDGE, TriggerType.HYSTERESIS, or TriggerType.WINDOW. Valid Values: The values of the range and offset parameters in configure_vertical determine the valid range for the trigger level on the channel you use as the Trigger Source. The value you pass for this parameter must meet the following conditions: - """ - trigger_modifier = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TriggerModifier, 1250102 - ) - """Type: enums.TriggerModifier + ''' + trigger_modifier = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerModifier, 1250102) + '''Type: enums.TriggerModifier Configures the device to automatically complete an acquisition if a trigger has not been received. Valid Values: None (1) - Normal triggering Auto Trigger (2) - Auto trigger acquisition if no trigger arrives - """ - trigger_slope = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TriggerSlope, 1250018 - ) - """Type: enums.TriggerSlope + ''' + trigger_slope = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerSlope, 1250018) + '''Type: enums.TriggerSlope Specifies if a rising or a falling edge triggers the digitizer. This property affects instrument operation only when trigger_type is set to TriggerType.EDGE, TriggerType.HYSTERESIS, or TriggerType.WINDOW. - """ + ''' trigger_source = _attributes.AttributeViString(1250013) - """Type: str + '''Type: str Specifies the source the digitizer monitors for the trigger event. - """ - trigger_type = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TriggerType, 1250012 - ) - """Type: enums.TriggerType + ''' + trigger_type = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerType, 1250012) + '''Type: enums.TriggerType Specifies the type of trigger to use. - """ + ''' trigger_window_high_level = _attributes.AttributeViReal64(1150014) - """Type: float + '''Type: float Pass the upper voltage threshold you want the digitizer to use for window triggering. The digitizer triggers when the trigger signal enters or leaves the window you specify with trigger_window_low_level and trigger_window_high_level @@ -1713,9 +1641,9 @@ class _SessionBase(object): Note: One or more of the referenced methods are not in the Python API for this driver. - """ + ''' trigger_window_low_level = _attributes.AttributeViReal64(1150013) - """Type: float + '''Type: float Pass the lower voltage threshold you want the digitizer to use for window triggering. The digitizer triggers when the trigger signal enters or leaves the window you specify with trigger_window_low_level and trigger_window_high_level. @@ -1728,45 +1656,35 @@ class _SessionBase(object): Note: One or more of the referenced methods are not in the Python API for this driver. - """ - trigger_window_mode = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TriggerWindowMode, 1150012 - ) - """Type: enums.TriggerWindowMode + ''' + trigger_window_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerWindowMode, 1150012) + '''Type: enums.TriggerWindowMode Specifies whether you want a trigger to occur when the signal enters or leaves the window specified by trigger_window_low_level, or trigger_window_high_level. - """ - tv_trigger_event = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.VideoTriggerEvent, 1250205 - ) - """Type: enums.VideoTriggerEvent + ''' + tv_trigger_event = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.VideoTriggerEvent, 1250205) + '''Type: enums.VideoTriggerEvent Specifies the condition in the video signal that causes the digitizer to trigger. - """ + ''' tv_trigger_line_number = _attributes.AttributeViInt32(1250206) - """Type: int + '''Type: int Specifies the line on which to trigger, if tv_trigger_event is set to line number. The valid ranges of the property depend on the signal format selected. M-NTSC has a valid range of 1 to 525. B/G-PAL, SECAM, 576i, and 576p have a valid range of 1 to 625. 720p has a valid range of 1 to 750. 1080i and 1080p have a valid range of 1125. - """ - tv_trigger_polarity = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.VideoPolarity, 1250204 - ) - """Type: enums.VideoPolarity + ''' + tv_trigger_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.VideoPolarity, 1250204) + '''Type: enums.VideoPolarity Specifies whether the video signal sync is positive or negative. - """ - tv_trigger_signal_format = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.VideoSignalFormat, 1250201 - ) - """Type: enums.VideoSignalFormat + ''' + tv_trigger_signal_format = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.VideoSignalFormat, 1250201) + '''Type: enums.VideoSignalFormat Specifies the type of video signal, such as NTSC, PAL, or SECAM. - """ + ''' use_spec_initial_x = _attributes.AttributeViBoolean(1150067) - vertical_coupling = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.VerticalCoupling, 1250003 - ) - """Type: enums.VerticalCoupling + vertical_coupling = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.VerticalCoupling, 1250003) + '''Type: enums.VerticalCoupling Specifies how the digitizer couples the input signal for the channel. When input coupling changes, the input stage takes a finite amount of time to settle. @@ -1779,9 +1697,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.vertical_coupling` - """ + ''' vertical_offset = _attributes.AttributeViReal64(1250002) - """Type: float + '''Type: float Specifies the location of the center of the range. The value is with respect to ground and is in volts. For example, to acquire a sine wave that spans between 0.0 and 10.0 V, set this property to 5.0 V. @@ -1796,9 +1714,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.vertical_offset` - """ + ''' vertical_range = _attributes.AttributeViReal64(1250001) - """Type: float + '''Type: float Specifies the absolute value of the input range for a channel in volts. For example, to acquire a sine wave that spans between -5 and +5 V, set this property to 10.0 V. Refer to the NI High-Speed Digitizers Help for a list of supported vertical ranges for each device. If the specified range is not supported by a device, the value is coerced up to the next valid range. @@ -1812,78 +1730,66 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niscope.Session`. Example: :py:attr:`my_session.vertical_range` - """ - width_condition = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.WidthCondition, 1250504 - ) - """Type: enums.WidthCondition + ''' + width_condition = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.WidthCondition, 1250504) + '''Type: enums.WidthCondition Specifies whether the oscilloscope triggers on pulses within or outside the duration range bounded by the width_low_threshold and width_high_threshold properties. - """ + ''' width_high_threshold = _attributes.AttributeViReal64(1250502) - """Type: float + '''Type: float Specifies the high width threshold, in seconds. This properties sets the upper bound on the duration range that triggers the oscilloscope. The width_condition property determines how the oscilloscope triggers in relation to the width thresholds. - """ + ''' width_low_threshold = _attributes.AttributeViReal64(1250501) - """Type: float + '''Type: float Specifies the low width threshold, in seconds. This property sets the lower bound on the duration range that triggers the oscilloscope. The width_condition property determines how the oscilloscope triggers in relation to the width thresholds. - """ - width_polarity = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.WidthPolarity, 1250503 - ) - """Type: enums.WidthPolarity + ''' + width_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.WidthPolarity, 1250503) + '''Type: enums.WidthPolarity Specifies the polarity of pulses that trigger the oscilloscope for width triggering. - """ + ''' - def __init__( - self, repeated_capability_list, vi, library, encoding, freeze_it=False - ): + def __init__(self, repeated_capability_list, vi, library, encoding, freeze_it=False): self._repeated_capability_list = repeated_capability_list - self._repeated_capability = ",".join(repeated_capability_list) + self._repeated_capability = ','.join(repeated_capability_list) self._vi = vi self._library = library self._encoding = encoding # Store the parameter list for later printing in __repr__ param_list = [] - param_list.append( - "repeated_capability_list=" + pp.pformat(repeated_capability_list) - ) + param_list.append("repeated_capability_list=" + pp.pformat(repeated_capability_list)) param_list.append("vi=" + pp.pformat(vi)) param_list.append("library=" + pp.pformat(library)) param_list.append("encoding=" + pp.pformat(encoding)) - self._param_list = ", ".join(param_list) + self._param_list = ', '.join(param_list) # Instantiate any repeated capability objects - self.channels = _RepeatedCapabilities(self, "", repeated_capability_list) - self.instruments = _RepeatedCapabilities(self, "", repeated_capability_list) + self.channels = _RepeatedCapabilities(self, '', repeated_capability_list) + self.instruments = _RepeatedCapabilities(self, '', repeated_capability_list) self._is_frozen = freeze_it def __repr__(self): - return "{0}.{1}({2})".format( - "niscope", self.__class__.__name__, self._param_list - ) + return '{0}.{1}({2})'.format('niscope', self.__class__.__name__, self._param_list) def __setattr__(self, key, value): if self._is_frozen and key not in dir(self): - raise AttributeError( - "'{0}' object has no attribute '{1}'".format(type(self).__name__, key) - ) + raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) object.__setattr__(self, key, value) def _get_error_description(self, error_code): - """_get_error_description + '''_get_error_description Returns the error description. - """ + ''' try: _, error_string = self._get_error() return error_string @@ -1891,21 +1797,21 @@ def _get_error_description(self, error_code): pass try: - """ + ''' It is expected for _get_error to raise when the session is invalid (IVI spec requires GetError to fail). Use _error_message instead. It doesn't require a session. - """ + ''' error_string = self._error_message(error_code) return error_string except errors.Error: return "Failed to retrieve error description." - """ These are code-generated """ + ''' These are code-generated ''' @ivi_synchronized def _actual_meas_wfm_size(self, array_meas_function): - r"""_actual_meas_wfm_size + r'''_actual_meas_wfm_size Returns the total available size of an array measurement acquisition. @@ -1919,32 +1825,19 @@ def _actual_meas_wfm_size(self, array_meas_function): meas_waveform_size (int): Returns the size (in number of samples) of the resulting analysis waveform. - """ + ''' if type(array_meas_function) is not enums.ArrayMeasurement: - raise TypeError( - "Parameter array_meas_function must be of type " - + str(enums.ArrayMeasurement) - ) + raise TypeError('Parameter array_meas_function must be of type ' + str(enums.ArrayMeasurement)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - array_meas_function_ctype = _visatype.ViInt32( - array_meas_function.value - ) # case S130 + array_meas_function_ctype = _visatype.ViInt32(array_meas_function.value) # case S130 meas_waveform_size_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niScope_ActualMeasWfmSize( - vi_ctype, - array_meas_function_ctype, - None - if meas_waveform_size_ctype is None - else (ctypes.pointer(meas_waveform_size_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niScope_ActualMeasWfmSize(vi_ctype, array_meas_function_ctype, None if meas_waveform_size_ctype is None else (ctypes.pointer(meas_waveform_size_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(meas_waveform_size_ctype.value) @ivi_synchronized def _actual_num_wfms(self): - r"""_actual_num_wfms + r'''_actual_num_wfms Helps you to declare appropriately sized waveforms. NI-SCOPE handles the channel list parsing for you. @@ -1965,25 +1858,17 @@ def _actual_num_wfms(self): operating in DDC mode (NI 5620/5621 only), this value is multiplied by two. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 num_wfms_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niScope_ActualNumWfms( - vi_ctype, - channel_list_ctype, - None if num_wfms_ctype is None else (ctypes.pointer(num_wfms_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niScope_ActualNumWfms(vi_ctype, channel_list_ctype, None if num_wfms_ctype is None else (ctypes.pointer(num_wfms_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(num_wfms_ctype.value) @ivi_synchronized def add_waveform_processing(self, meas_function): - r"""add_waveform_processing + r'''add_waveform_processing Adds one measurement to the list of processing steps that are completed before the measurement. The processing is added on a per channel basis, @@ -2011,27 +1896,19 @@ def add_waveform_processing(self, meas_function): measurement `__ to add. - """ + ''' if type(meas_function) is not enums.ArrayMeasurement: - raise TypeError( - "Parameter meas_function must be of type " + str(enums.ArrayMeasurement) - ) + raise TypeError('Parameter meas_function must be of type ' + str(enums.ArrayMeasurement)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 meas_function_ctype = _visatype.ViInt32(meas_function.value) # case S130 - error_code = self._library.niScope_AddWaveformProcessing( - vi_ctype, channel_list_ctype, meas_function_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niScope_AddWaveformProcessing(vi_ctype, channel_list_ctype, meas_function_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def self_cal(self, option=enums.Option.SELF_CALIBRATE_ALL_CHANNELS): - r"""self_cal + r'''self_cal Self-calibrates most NI digitizers, including all SMC-based devices and most Traditional NI-DAQ (Legacy) devices. To verify that your digitizer @@ -2072,27 +1949,19 @@ def self_cal(self, option=enums.Option.SELF_CALIBRATE_ALL_CHANNELS): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - """ + ''' if type(option) is not enums.Option: - raise TypeError("Parameter option must be of type " + str(enums.Option)) + raise TypeError('Parameter option must be of type ' + str(enums.Option)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 option_ctype = _visatype.ViInt32(option.value) # case S130 - error_code = self._library.niScope_CalSelfCalibrate( - vi_ctype, channel_list_ctype, option_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niScope_CalSelfCalibrate(vi_ctype, channel_list_ctype, option_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def clear_waveform_measurement_stats( - self, clearable_measurement_function=enums.ClearableMeasurement.ALL_MEASUREMENTS - ): - r"""clear_waveform_measurement_stats + def clear_waveform_measurement_stats(self, clearable_measurement_function=enums.ClearableMeasurement.ALL_MEASUREMENTS): + r'''clear_waveform_measurement_stats Clears the waveform stats on the channel and measurement you specify. If you want to clear all of the measurements, use @@ -2123,30 +1992,19 @@ def clear_waveform_measurement_stats( measurement `__ to clear the stats for. - """ + ''' if type(clearable_measurement_function) is not enums.ClearableMeasurement: - raise TypeError( - "Parameter clearable_measurement_function must be of type " - + str(enums.ClearableMeasurement) - ) + raise TypeError('Parameter clearable_measurement_function must be of type ' + str(enums.ClearableMeasurement)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - clearable_measurement_function_ctype = _visatype.ViInt32( - clearable_measurement_function.value - ) # case S130 - error_code = self._library.niScope_ClearWaveformMeasurementStats( - vi_ctype, channel_list_ctype, clearable_measurement_function_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + clearable_measurement_function_ctype = _visatype.ViInt32(clearable_measurement_function.value) # case S130 + error_code = self._library.niScope_ClearWaveformMeasurementStats(vi_ctype, channel_list_ctype, clearable_measurement_function_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def clear_waveform_processing(self): - r"""clear_waveform_processing + r'''clear_waveform_processing Clears the list of processing steps assigned to the given channel. The processing is added using the add_waveform_processing method, @@ -2165,22 +2023,16 @@ def clear_waveform_processing(self): To call the method on all channels, you can call it directly on the :py:class:`niscope.Session`. Example: :py:meth:`my_session.clear_waveform_processing` - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - error_code = self._library.niScope_ClearWaveformProcessing( - vi_ctype, channel_list_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + error_code = self._library.niScope_ClearWaveformProcessing(vi_ctype, channel_list_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def configure_chan_characteristics(self, input_impedance, max_input_frequency): - r"""configure_chan_characteristics + r'''configure_chan_characteristics Configures the properties that control the electrical characteristics of the channel—the input impedance and the bandwidth. @@ -2205,27 +2057,18 @@ def configure_chan_characteristics(self, input_impedance, max_input_frequency): value to use the hardware default bandwidth. Pass –1 for this value to achieve full bandwidth. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 input_impedance_ctype = _visatype.ViReal64(input_impedance) # case S150 max_input_frequency_ctype = _visatype.ViReal64(max_input_frequency) # case S150 - error_code = self._library.niScope_ConfigureChanCharacteristics( - vi_ctype, - channel_list_ctype, - input_impedance_ctype, - max_input_frequency_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niScope_ConfigureChanCharacteristics(vi_ctype, channel_list_ctype, input_impedance_ctype, max_input_frequency_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def configure_equalization_filter_coefficients(self, coefficients): - r"""configure_equalization_filter_coefficients + r'''configure_equalization_filter_coefficients Configures the custom coefficients for the equalization FIR filter on the device. This filter is designed to compensate the input signal for @@ -2253,33 +2096,18 @@ def configure_equalization_filter_coefficients(self, coefficients): `equalization_filter_enabled `__ property must be set to TRUE to enable the filter. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - number_of_coefficients_ctype = _visatype.ViInt32( - 0 if coefficients is None else len(coefficients) - ) # case S160 - coefficients_ctype = get_ctypes_pointer_for_buffer( - value=coefficients, library_type=_visatype.ViReal64 - ) # case B550 - error_code = self._library.niScope_ConfigureEqualizationFilterCoefficients( - vi_ctype, - channel_list_ctype, - number_of_coefficients_ctype, - coefficients_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + number_of_coefficients_ctype = _visatype.ViInt32(0 if coefficients is None else len(coefficients)) # case S160 + coefficients_ctype = get_ctypes_pointer_for_buffer(value=coefficients, library_type=_visatype.ViReal64) # case B550 + error_code = self._library.niScope_ConfigureEqualizationFilterCoefficients(vi_ctype, channel_list_ctype, number_of_coefficients_ctype, coefficients_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def configure_vertical( - self, range, coupling, offset=0.0, probe_attenuation=1.0, enabled=True - ): - r"""configure_vertical + def configure_vertical(self, range, coupling, offset=0.0, probe_attenuation=1.0, enabled=True): + r'''configure_vertical Configures the most commonly configured properties of the digitizer vertical subsystem, such as the range, offset, coupling, probe @@ -2312,45 +2140,23 @@ def configure_vertical( enabled (bool): Specifies whether the channel is enabled for acquisition. Refer to channel_enabled for more information. - """ + ''' if type(coupling) is not enums.VerticalCoupling: - raise TypeError( - "Parameter coupling must be of type " + str(enums.VerticalCoupling) - ) + raise TypeError('Parameter coupling must be of type ' + str(enums.VerticalCoupling)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 range_ctype = _visatype.ViReal64(range) # case S150 offset_ctype = _visatype.ViReal64(offset) # case S150 coupling_ctype = _visatype.ViInt32(coupling.value) # case S130 probe_attenuation_ctype = _visatype.ViReal64(probe_attenuation) # case S150 enabled_ctype = _visatype.ViBoolean(enabled) # case S150 - error_code = self._library.niScope_ConfigureVertical( - vi_ctype, - channel_list_ctype, - range_ctype, - offset_ctype, - coupling_ctype, - probe_attenuation_ctype, - enabled_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niScope_ConfigureVertical(vi_ctype, channel_list_ctype, range_ctype, offset_ctype, coupling_ctype, probe_attenuation_ctype, enabled_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def fetch( - self, - num_samples=None, - relative_to=enums.FetchRelativeTo.PRETRIGGER, - offset=0, - record_number=0, - num_records=None, - timeout=hightime.timedelta(seconds=5.0), - ): - """fetch + def fetch(self, num_samples=None, relative_to=enums.FetchRelativeTo.PRETRIGGER, offset=0, record_number=0, num_records=None, timeout=hightime.timedelta(seconds=5.0)): + '''fetch Returns the waveform from a previously initiated acquisition that the digitizer acquires for the specified channel. This method returns @@ -2408,7 +2214,7 @@ def fetch( - **samples** (array of float) floating point array of samples. Length will be of the actual samples acquired - """ + ''' # Set the fetch attributes with _NoChannel(session=self): self._fetch_relative_to = relative_to @@ -2427,33 +2233,15 @@ def fetch( lwfm_i = len(wfm_info) lrcl = len(self._repeated_capability_list) # Should this raise instead? If this asserts, is it the users fault? - assert ( - lwfm_i % lrcl == 0 - ), "Number of waveforms should be evenly divisible by the number of channels: len(wfm_info) == {0}, len(self._repeated_capability_list) == {1}".format( - lwfm_i, lrcl - ) + assert lwfm_i % lrcl == 0, 'Number of waveforms should be evenly divisible by the number of channels: len(wfm_info) == {0}, len(self._repeated_capability_list) == {1}'.format(lwfm_i, lrcl) actual_num_records = int(lwfm_i / lrcl) - waveform_info._populate_channel_and_record_info( - wfm_info, - self._repeated_capability_list, - range(record_number, record_number + actual_num_records), - ) + waveform_info._populate_channel_and_record_info(wfm_info, self._repeated_capability_list, range(record_number, record_number + actual_num_records)) return wfm_info @ivi_synchronized - def fetch_array_measurement( - self, - array_meas_function, - meas_wfm_size=None, - relative_to=enums.FetchRelativeTo.PRETRIGGER, - offset=0, - record_number=0, - num_records=None, - meas_num_samples=None, - timeout=hightime.timedelta(seconds=5.0), - ): - r"""fetch_array_measurement + def fetch_array_measurement(self, array_meas_function, meas_wfm_size=None, relative_to=enums.FetchRelativeTo.PRETRIGGER, offset=0, record_number=0, num_records=None, meas_num_samples=None, timeout=hightime.timedelta(seconds=5.0)): + r'''fetch_array_measurement Obtains a waveform from the digitizer and returns the specified measurement array. This method may return multiple waveforms depending @@ -2522,54 +2310,34 @@ def fetch_array_measurement( - **samples**-floating point array of samples. Length will be of actual samples acquired. - """ + ''' # Set the fetch attributes with _NoChannel(session=self): self._fetch_relative_to = relative_to self._fetch_offset = offset self._fetch_record_number = record_number self._fetch_num_records = -1 if num_records is None else num_records - self._fetch_meas_num_samples = ( - -1 if meas_num_samples is None else meas_num_samples - ) + self._fetch_meas_num_samples = -1 if meas_num_samples is None else meas_num_samples if meas_wfm_size is None: meas_wfm_size = self._actual_meas_wfm_size(array_meas_function) - meas_wfm, wfm_info = self._fetch_array_measurement( - array_meas_function, meas_wfm_size, timeout - ) + meas_wfm, wfm_info = self._fetch_array_measurement(array_meas_function, meas_wfm_size, timeout) record_length = int(len(meas_wfm) / len(wfm_info)) waveform_info._populate_samples_info(wfm_info, meas_wfm, record_length) wfm_info_count = len(wfm_info) channel_count = len(self._repeated_capability_list) - assert ( - wfm_info_count % channel_count == 0 - ), "Number of waveforms should be evenly divisible by the number of channels: len(wfm_info) == {0}, len(self._repeated_capability_list) == {1}".format( - wfm_info_count, channel_count - ) + assert wfm_info_count % channel_count == 0, 'Number of waveforms should be evenly divisible by the number of channels: len(wfm_info) == {0}, len(self._repeated_capability_list) == {1}'.format(wfm_info_count, channel_count) actual_num_records = int(wfm_info_count / channel_count) - waveform_info._populate_channel_and_record_info( - wfm_info, - self._repeated_capability_list, - range(record_number, record_number + actual_num_records), - ) + waveform_info._populate_channel_and_record_info(wfm_info, self._repeated_capability_list, range(record_number, record_number + actual_num_records)) return wfm_info @ivi_synchronized - def fetch_measurement_stats( - self, - scalar_meas_function, - relative_to=enums.FetchRelativeTo.PRETRIGGER, - offset=0, - record_number=0, - num_records=None, - timeout=hightime.timedelta(seconds=5.0), - ): - r"""fetch_measurement_stats + def fetch_measurement_stats(self, scalar_meas_function, relative_to=enums.FetchRelativeTo.PRETRIGGER, offset=0, record_number=0, num_records=None, timeout=hightime.timedelta(seconds=5.0)): + r'''fetch_measurement_stats Obtains a waveform measurement and returns the measurement value. This method may return multiple statistical results depending on the number @@ -2638,7 +2406,7 @@ def fetch_measurement_stats( - **channel** (str): channel name this result was acquired from - **record** (int): record number of this result - """ + ''' # Set the fetch attributes with _NoChannel(session=self): self._fetch_relative_to = relative_to @@ -2646,43 +2414,24 @@ def fetch_measurement_stats( self._fetch_record_number = record_number self._fetch_num_records = -1 if num_records is None else num_records - ( - results, - means, - stdevs, - min_vals, - max_vals, - nums_in_stats, - ) = self._fetch_measurement_stats(scalar_meas_function, timeout) + results, means, stdevs, min_vals, max_vals, nums_in_stats = self._fetch_measurement_stats(scalar_meas_function, timeout) output = [] - for result, mean, stdev, min_val, max_val, num_in_stats in zip( - results, means, stdevs, min_vals, max_vals, nums_in_stats - ): - measurement_stat = measurement_stats.MeasurementStats( - result, mean, stdev, min_val, max_val, num_in_stats - ) + for result, mean, stdev, min_val, max_val, num_in_stats in zip(results, means, stdevs, min_vals, max_vals, nums_in_stats): + measurement_stat = measurement_stats.MeasurementStats(result, mean, stdev, min_val, max_val, num_in_stats) output.append(measurement_stat) results_count = len(results) channel_count = len(self._repeated_capability_list) - assert ( - results_count % channel_count == 0 - ), "Number of results should be evenly divisible by the number of channels: len(results) == {0}, len(self._repeated_capability_list) == {1}".format( - results_count, channel_count - ) + assert results_count % channel_count == 0, 'Number of results should be evenly divisible by the number of channels: len(results) == {0}, len(self._repeated_capability_list) == {1}'.format(results_count, channel_count) actual_num_records = int(results_count / channel_count) - waveform_info._populate_channel_and_record_info( - output, - self._repeated_capability_list, - range(record_number, record_number + actual_num_records), - ) + waveform_info._populate_channel_and_record_info(output, self._repeated_capability_list, range(record_number, record_number + actual_num_records)) return output @ivi_synchronized def get_equalization_filter_coefficients(self): - """get_equalization_filter_coefficients + '''get_equalization_filter_coefficients Retrieves the custom coefficients for the equalization FIR filter on the device. This filter is designed to compensate the input signal for artifacts introduced to the signal outside of the digitizer. Because this filter is a generic FIR filter, any coefficients are valid. Coefficient values should be between +1 and –1. @@ -2696,22 +2445,12 @@ def get_equalization_filter_coefficients(self): To call the method on all channels, you can call it directly on the :py:class:`niscope.Session`. Example: :py:meth:`my_session.get_equalization_filter_coefficients` - """ - return self._get_equalization_filter_coefficients( - self.equalization_num_coefficients - ) + ''' + return self._get_equalization_filter_coefficients(self.equalization_num_coefficients) @ivi_synchronized - def read( - self, - num_samples=None, - relative_to=enums.FetchRelativeTo.PRETRIGGER, - offset=0, - record_number=0, - num_records=None, - timeout=hightime.timedelta(seconds=5.0), - ): - """read + def read(self, num_samples=None, relative_to=enums.FetchRelativeTo.PRETRIGGER, offset=0, record_number=0, num_records=None, timeout=hightime.timedelta(seconds=5.0)): + '''read Initiates an acquisition, waits for it to complete, and retrieves the data. The process is similar to calling _initiate_acquisition, @@ -2772,7 +2511,7 @@ def read( - **samples** (array of float) floating point array of samples. Length will be of the actual samples acquired - """ + ''' # Set the fetch attributes with _NoChannel(session=self): self._fetch_relative_to = relative_to @@ -2791,23 +2530,15 @@ def read( lwfm_i = len(wfm_info) lrcl = len(self._repeated_capability_list) # Should this raise instead? If this asserts, is it the users fault? - assert ( - lwfm_i % lrcl == 0 - ), "Number of waveforms should be evenly divisible by the number of channels: len(wfm_info) == {0}, len(self._repeated_capability_list) == {1}".format( - lwfm_i, lrcl - ) + assert lwfm_i % lrcl == 0, 'Number of waveforms should be evenly divisible by the number of channels: len(wfm_info) == {0}, len(self._repeated_capability_list) == {1}'.format(lwfm_i, lrcl) actual_num_records = int(lwfm_i / lrcl) - waveform_info._populate_channel_and_record_info( - wfm_info, - self._repeated_capability_list, - range(record_number, record_number + actual_num_records), - ) + waveform_info._populate_channel_and_record_info(wfm_info, self._repeated_capability_list, range(record_number, record_number + actual_num_records)) return wfm_info @ivi_synchronized def _fetch(self, num_samples, timeout=hightime.timedelta(seconds=5.0)): - r"""_fetch + r'''_fetch Returns the waveform from a previously initiated acquisition that the digitizer acquires for the specified channel. This method returns @@ -2896,45 +2627,23 @@ def _fetch(self, num_samples, timeout=hightime.timedelta(seconds=5.0)): Call _actual_num_wfms to determine the size of this array. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64( - timeout - ) # case S140 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 num_samples_ctype = _visatype.ViInt32(num_samples) # case S150 - waveform_size = num_samples * self._actual_num_wfms() # case B560 + waveform_size = (num_samples * self._actual_num_wfms()) # case B560 waveform_array = array.array("d", [0] * waveform_size) # case B560 - waveform_ctype = get_ctypes_pointer_for_buffer( - value=waveform_array, library_type=_visatype.ViReal64 - ) # case B560 + waveform_ctype = get_ctypes_pointer_for_buffer(value=waveform_array, library_type=_visatype.ViReal64) # case B560 wfm_info_size = self._actual_num_wfms() # case B560 - wfm_info_ctype = get_ctypes_pointer_for_buffer( - library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size - ) # case B560 - error_code = self._library.niScope_Fetch( - vi_ctype, - channel_list_ctype, - timeout_ctype, - num_samples_ctype, - waveform_ctype, - wfm_info_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return waveform_array, [ - waveform_info.WaveformInfo(wfm_info_ctype[i]) - for i in range(self._actual_num_wfms()) - ] + wfm_info_ctype = get_ctypes_pointer_for_buffer(library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size) # case B560 + error_code = self._library.niScope_Fetch(vi_ctype, channel_list_ctype, timeout_ctype, num_samples_ctype, waveform_ctype, wfm_info_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return waveform_array, [waveform_info.WaveformInfo(wfm_info_ctype[i]) for i in range(self._actual_num_wfms())] @ivi_synchronized - def _fetch_into_numpy( - self, num_samples, waveform, timeout=hightime.timedelta(seconds=5.0) - ): - r"""_fetch + def _fetch_into_numpy(self, num_samples, waveform, timeout=hightime.timedelta(seconds=5.0)): + r'''_fetch Returns the waveform from a previously initiated acquisition that the digitizer acquires for the specified channel. This method returns @@ -3044,57 +2753,29 @@ def _fetch_into_numpy( Call _actual_num_wfms to determine the size of this array. - """ + ''' import numpy if type(waveform) is not numpy.ndarray: - raise TypeError( - "waveform must be {0}, is {1}".format(numpy.ndarray, type(waveform)) - ) + raise TypeError('waveform must be {0}, is {1}'.format(numpy.ndarray, type(waveform))) if numpy.isfortran(waveform) is True: - raise TypeError("waveform must be in C-order") - if waveform.dtype is not numpy.dtype("float64"): - raise TypeError( - "waveform must be numpy.ndarray of dtype=float64, is " - + str(waveform.dtype) - ) + raise TypeError('waveform must be in C-order') + if waveform.dtype is not numpy.dtype('float64'): + raise TypeError('waveform must be numpy.ndarray of dtype=float64, is ' + str(waveform.dtype)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64( - timeout - ) # case S140 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 num_samples_ctype = _visatype.ViInt32(num_samples) # case S150 waveform_ctype = get_ctypes_pointer_for_buffer(value=waveform) # case B510 wfm_info_size = self._actual_num_wfms() # case B560 - wfm_info_ctype = get_ctypes_pointer_for_buffer( - library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size - ) # case B560 - error_code = self._library.niScope_Fetch( - vi_ctype, - channel_list_ctype, - timeout_ctype, - num_samples_ctype, - waveform_ctype, - wfm_info_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return [ - waveform_info.WaveformInfo(wfm_info_ctype[i]) - for i in range(self._actual_num_wfms()) - ] + wfm_info_ctype = get_ctypes_pointer_for_buffer(library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size) # case B560 + error_code = self._library.niScope_Fetch(vi_ctype, channel_list_ctype, timeout_ctype, num_samples_ctype, waveform_ctype, wfm_info_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return [waveform_info.WaveformInfo(wfm_info_ctype[i]) for i in range(self._actual_num_wfms())] @ivi_synchronized - def _fetch_array_measurement( - self, - array_meas_function, - measurement_waveform_size, - timeout=hightime.timedelta(seconds=5.0), - ): - r"""_fetch_array_measurement + def _fetch_array_measurement(self, array_meas_function, measurement_waveform_size, timeout=hightime.timedelta(seconds=5.0)): + r'''_fetch_array_measurement Obtains a waveform from the digitizer and returns the specified measurement array. This method may return multiple waveforms depending @@ -3182,58 +2863,25 @@ def _fetch_array_measurement( Call _actual_num_wfms to determine the size of this array. - """ + ''' if type(array_meas_function) is not enums.ArrayMeasurement: - raise TypeError( - "Parameter array_meas_function must be of type " - + str(enums.ArrayMeasurement) - ) + raise TypeError('Parameter array_meas_function must be of type ' + str(enums.ArrayMeasurement)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64( - timeout - ) # case S140 - array_meas_function_ctype = _visatype.ViInt32( - array_meas_function.value - ) # case S130 - measurement_waveform_size_ctype = _visatype.ViInt32( - measurement_waveform_size - ) # case S150 - meas_wfm_size = measurement_waveform_size * self._actual_num_wfms() # case B560 - meas_wfm_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViReal64, size=meas_wfm_size - ) # case B560 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 + array_meas_function_ctype = _visatype.ViInt32(array_meas_function.value) # case S130 + measurement_waveform_size_ctype = _visatype.ViInt32(measurement_waveform_size) # case S150 + meas_wfm_size = (measurement_waveform_size * self._actual_num_wfms()) # case B560 + meas_wfm_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=meas_wfm_size) # case B560 wfm_info_size = self._actual_num_wfms() # case B560 - wfm_info_ctype = get_ctypes_pointer_for_buffer( - library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size - ) # case B560 - error_code = self._library.niScope_FetchArrayMeasurement( - vi_ctype, - channel_list_ctype, - timeout_ctype, - array_meas_function_ctype, - measurement_waveform_size_ctype, - meas_wfm_ctype, - wfm_info_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return [ - float(meas_wfm_ctype[i]) - for i in range((measurement_waveform_size * self._actual_num_wfms())) - ], [ - waveform_info.WaveformInfo(wfm_info_ctype[i]) - for i in range(self._actual_num_wfms()) - ] + wfm_info_ctype = get_ctypes_pointer_for_buffer(library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size) # case B560 + error_code = self._library.niScope_FetchArrayMeasurement(vi_ctype, channel_list_ctype, timeout_ctype, array_meas_function_ctype, measurement_waveform_size_ctype, meas_wfm_ctype, wfm_info_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return [float(meas_wfm_ctype[i]) for i in range((measurement_waveform_size * self._actual_num_wfms()))], [waveform_info.WaveformInfo(wfm_info_ctype[i]) for i in range(self._actual_num_wfms())] @ivi_synchronized - def _fetch_binary16_into_numpy( - self, num_samples, waveform, timeout=hightime.timedelta(seconds=5.0) - ): - r"""_fetch_binary16 + def _fetch_binary16_into_numpy(self, num_samples, waveform, timeout=hightime.timedelta(seconds=5.0)): + r'''_fetch_binary16 Retrieves data from a previously initiated acquisition and returns binary 16-bit waveforms. This method may return multiple waveforms @@ -3341,54 +2989,29 @@ def _fetch_binary16_into_numpy( Call _actual_num_wfms to determine the size of this array. - """ + ''' import numpy if type(waveform) is not numpy.ndarray: - raise TypeError( - "waveform must be {0}, is {1}".format(numpy.ndarray, type(waveform)) - ) + raise TypeError('waveform must be {0}, is {1}'.format(numpy.ndarray, type(waveform))) if numpy.isfortran(waveform) is True: - raise TypeError("waveform must be in C-order") - if waveform.dtype is not numpy.dtype("int16"): - raise TypeError( - "waveform must be numpy.ndarray of dtype=int16, is " - + str(waveform.dtype) - ) + raise TypeError('waveform must be in C-order') + if waveform.dtype is not numpy.dtype('int16'): + raise TypeError('waveform must be numpy.ndarray of dtype=int16, is ' + str(waveform.dtype)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64( - timeout - ) # case S140 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 num_samples_ctype = _visatype.ViInt32(num_samples) # case S150 waveform_ctype = get_ctypes_pointer_for_buffer(value=waveform) # case B510 wfm_info_size = self._actual_num_wfms() # case B560 - wfm_info_ctype = get_ctypes_pointer_for_buffer( - library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size - ) # case B560 - error_code = self._library.niScope_FetchBinary16( - vi_ctype, - channel_list_ctype, - timeout_ctype, - num_samples_ctype, - waveform_ctype, - wfm_info_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return [ - waveform_info.WaveformInfo(wfm_info_ctype[i]) - for i in range(self._actual_num_wfms()) - ] + wfm_info_ctype = get_ctypes_pointer_for_buffer(library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size) # case B560 + error_code = self._library.niScope_FetchBinary16(vi_ctype, channel_list_ctype, timeout_ctype, num_samples_ctype, waveform_ctype, wfm_info_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return [waveform_info.WaveformInfo(wfm_info_ctype[i]) for i in range(self._actual_num_wfms())] @ivi_synchronized - def _fetch_binary32_into_numpy( - self, num_samples, waveform, timeout=hightime.timedelta(seconds=5.0) - ): - r"""_fetch_binary32 + def _fetch_binary32_into_numpy(self, num_samples, waveform, timeout=hightime.timedelta(seconds=5.0)): + r'''_fetch_binary32 Retrieves data from a previously initiated acquisition and returns binary 32-bit waveforms. This method may return multiple waveforms @@ -3496,54 +3119,29 @@ def _fetch_binary32_into_numpy( Call _actual_num_wfms to determine the size of this array. - """ + ''' import numpy if type(waveform) is not numpy.ndarray: - raise TypeError( - "waveform must be {0}, is {1}".format(numpy.ndarray, type(waveform)) - ) + raise TypeError('waveform must be {0}, is {1}'.format(numpy.ndarray, type(waveform))) if numpy.isfortran(waveform) is True: - raise TypeError("waveform must be in C-order") - if waveform.dtype is not numpy.dtype("int32"): - raise TypeError( - "waveform must be numpy.ndarray of dtype=int32, is " - + str(waveform.dtype) - ) + raise TypeError('waveform must be in C-order') + if waveform.dtype is not numpy.dtype('int32'): + raise TypeError('waveform must be numpy.ndarray of dtype=int32, is ' + str(waveform.dtype)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64( - timeout - ) # case S140 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 num_samples_ctype = _visatype.ViInt32(num_samples) # case S150 waveform_ctype = get_ctypes_pointer_for_buffer(value=waveform) # case B510 wfm_info_size = self._actual_num_wfms() # case B560 - wfm_info_ctype = get_ctypes_pointer_for_buffer( - library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size - ) # case B560 - error_code = self._library.niScope_FetchBinary32( - vi_ctype, - channel_list_ctype, - timeout_ctype, - num_samples_ctype, - waveform_ctype, - wfm_info_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return [ - waveform_info.WaveformInfo(wfm_info_ctype[i]) - for i in range(self._actual_num_wfms()) - ] + wfm_info_ctype = get_ctypes_pointer_for_buffer(library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size) # case B560 + error_code = self._library.niScope_FetchBinary32(vi_ctype, channel_list_ctype, timeout_ctype, num_samples_ctype, waveform_ctype, wfm_info_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return [waveform_info.WaveformInfo(wfm_info_ctype[i]) for i in range(self._actual_num_wfms())] @ivi_synchronized - def _fetch_binary8_into_numpy( - self, num_samples, waveform, timeout=hightime.timedelta(seconds=5.0) - ): - r"""_fetch_binary8 + def _fetch_binary8_into_numpy(self, num_samples, waveform, timeout=hightime.timedelta(seconds=5.0)): + r'''_fetch_binary8 Retrieves data from a previously initiated acquisition and returns binary 8-bit waveforms. This method may return multiple waveforms @@ -3651,60 +3249,29 @@ def _fetch_binary8_into_numpy( Call _actual_num_wfms to determine the size of this array. - """ + ''' import numpy if type(waveform) is not numpy.ndarray: - raise TypeError( - "waveform must be {0}, is {1}".format(numpy.ndarray, type(waveform)) - ) + raise TypeError('waveform must be {0}, is {1}'.format(numpy.ndarray, type(waveform))) if numpy.isfortran(waveform) is True: - raise TypeError("waveform must be in C-order") - if waveform.dtype is not numpy.dtype("int8"): - raise TypeError( - "waveform must be numpy.ndarray of dtype=int8, is " - + str(waveform.dtype) - ) + raise TypeError('waveform must be in C-order') + if waveform.dtype is not numpy.dtype('int8'): + raise TypeError('waveform must be numpy.ndarray of dtype=int8, is ' + str(waveform.dtype)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64( - timeout - ) # case S140 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 num_samples_ctype = _visatype.ViInt32(num_samples) # case S150 waveform_ctype = get_ctypes_pointer_for_buffer(value=waveform) # case B510 wfm_info_size = self._actual_num_wfms() # case B560 - wfm_info_ctype = get_ctypes_pointer_for_buffer( - library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size - ) # case B560 - error_code = self._library.niScope_FetchBinary8( - vi_ctype, - channel_list_ctype, - timeout_ctype, - num_samples_ctype, - waveform_ctype, - wfm_info_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return [ - waveform_info.WaveformInfo(wfm_info_ctype[i]) - for i in range(self._actual_num_wfms()) - ] + wfm_info_ctype = get_ctypes_pointer_for_buffer(library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size) # case B560 + error_code = self._library.niScope_FetchBinary8(vi_ctype, channel_list_ctype, timeout_ctype, num_samples_ctype, waveform_ctype, wfm_info_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return [waveform_info.WaveformInfo(wfm_info_ctype[i]) for i in range(self._actual_num_wfms())] @ivi_synchronized - def fetch_into( - self, - waveform, - relative_to=enums.FetchRelativeTo.PRETRIGGER, - offset=0, - record_number=0, - num_records=None, - timeout=hightime.timedelta(seconds=5.0), - ): - """fetch + def fetch_into(self, waveform, relative_to=enums.FetchRelativeTo.PRETRIGGER, offset=0, record_number=0, num_records=None, timeout=hightime.timedelta(seconds=5.0)): + '''fetch Returns the waveform from a previously initiated acquisition that the digitizer acquires for the specified channel. This method returns @@ -3776,7 +3343,7 @@ def fetch_into( - **samples** (array of float) floating point array of samples. Length will be of the actual samples acquired - """ + ''' import numpy # Set the fetch attributes @@ -3789,27 +3356,15 @@ def fetch_into( num_samples = int(len(waveform) / self._actual_num_wfms()) if waveform.dtype == numpy.float64: - wfm_info = self._fetch_into_numpy( - num_samples=num_samples, waveform=waveform, timeout=timeout - ) + wfm_info = self._fetch_into_numpy(num_samples=num_samples, waveform=waveform, timeout=timeout) elif waveform.dtype == numpy.int8: - wfm_info = self._fetch_binary8_into_numpy( - num_samples=num_samples, waveform=waveform, timeout=timeout - ) + wfm_info = self._fetch_binary8_into_numpy(num_samples=num_samples, waveform=waveform, timeout=timeout) elif waveform.dtype == numpy.int16: - wfm_info = self._fetch_binary16_into_numpy( - num_samples=num_samples, waveform=waveform, timeout=timeout - ) + wfm_info = self._fetch_binary16_into_numpy(num_samples=num_samples, waveform=waveform, timeout=timeout) elif waveform.dtype == numpy.int32: - wfm_info = self._fetch_binary32_into_numpy( - num_samples=num_samples, waveform=waveform, timeout=timeout - ) + wfm_info = self._fetch_binary32_into_numpy(num_samples=num_samples, waveform=waveform, timeout=timeout) else: - raise TypeError( - "Unsupported dtype. Is {0}, expected {1}, {2}, {3}, or {4}".format( - waveform.dtype, numpy.float64, numpy.int8, numpy.int16, numpy.int32 - ) - ) + raise TypeError("Unsupported dtype. Is {0}, expected {1}, {2}, {3}, or {4}".format(waveform.dtype, numpy.float64, numpy.int8, numpy.int16, numpy.int32)) mv = memoryview(waveform) @@ -3817,25 +3372,15 @@ def fetch_into( lwfm_i = len(wfm_info) lrcl = len(self._repeated_capability_list) - assert ( - lwfm_i % lrcl == 0 - ), "Number of waveforms should be evenly divisible by the number of channels: len(wfm_info) == {0}, len(self._repeated_capability_list) == {1}".format( - lwfm_i, lrcl - ) + assert lwfm_i % lrcl == 0, 'Number of waveforms should be evenly divisible by the number of channels: len(wfm_info) == {0}, len(self._repeated_capability_list) == {1}'.format(lwfm_i, lrcl) actual_num_records = int(lwfm_i / lrcl) - waveform_info._populate_channel_and_record_info( - wfm_info, - self._repeated_capability_list, - range(record_number, record_number + actual_num_records), - ) + waveform_info._populate_channel_and_record_info(wfm_info, self._repeated_capability_list, range(record_number, record_number + actual_num_records)) return wfm_info @ivi_synchronized - def _fetch_measurement_stats( - self, scalar_meas_function, timeout=hightime.timedelta(seconds=5.0) - ): - r"""_fetch_measurement_stats + def _fetch_measurement_stats(self, scalar_meas_function, timeout=hightime.timedelta(seconds=5.0)): + r'''_fetch_measurement_stats Obtains a waveform measurement and returns the measurement value. This method may return multiple statistical results depending on the number @@ -3901,73 +3446,32 @@ def _fetch_measurement_stats( num_in_stats (list of int): Returns the number of times _fetch_measurement_stats has been called. - """ + ''' if type(scalar_meas_function) is not enums.ScalarMeasurement: - raise TypeError( - "Parameter scalar_meas_function must be of type " - + str(enums.ScalarMeasurement) - ) + raise TypeError('Parameter scalar_meas_function must be of type ' + str(enums.ScalarMeasurement)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64( - timeout - ) # case S140 - scalar_meas_function_ctype = _visatype.ViInt32( - scalar_meas_function.value - ) # case S130 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 + scalar_meas_function_ctype = _visatype.ViInt32(scalar_meas_function.value) # case S130 result_size = self._actual_num_wfms() # case B560 - result_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViReal64, size=result_size - ) # case B560 + result_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=result_size) # case B560 mean_size = self._actual_num_wfms() # case B560 - mean_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViReal64, size=mean_size - ) # case B560 + mean_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=mean_size) # case B560 stdev_size = self._actual_num_wfms() # case B560 - stdev_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViReal64, size=stdev_size - ) # case B560 + stdev_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=stdev_size) # case B560 min_size = self._actual_num_wfms() # case B560 - min_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViReal64, size=min_size - ) # case B560 + min_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=min_size) # case B560 max_size = self._actual_num_wfms() # case B560 - max_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViReal64, size=max_size - ) # case B560 + max_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=max_size) # case B560 num_in_stats_size = self._actual_num_wfms() # case B560 - num_in_stats_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViInt32, size=num_in_stats_size - ) # case B560 - error_code = self._library.niScope_FetchMeasurementStats( - vi_ctype, - channel_list_ctype, - timeout_ctype, - scalar_meas_function_ctype, - result_ctype, - mean_ctype, - stdev_ctype, - min_ctype, - max_ctype, - num_in_stats_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return ( - [float(result_ctype[i]) for i in range(self._actual_num_wfms())], - [float(mean_ctype[i]) for i in range(self._actual_num_wfms())], - [float(stdev_ctype[i]) for i in range(self._actual_num_wfms())], - [float(min_ctype[i]) for i in range(self._actual_num_wfms())], - [float(max_ctype[i]) for i in range(self._actual_num_wfms())], - [int(num_in_stats_ctype[i]) for i in range(self._actual_num_wfms())], - ) + num_in_stats_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViInt32, size=num_in_stats_size) # case B560 + error_code = self._library.niScope_FetchMeasurementStats(vi_ctype, channel_list_ctype, timeout_ctype, scalar_meas_function_ctype, result_ctype, mean_ctype, stdev_ctype, min_ctype, max_ctype, num_in_stats_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return [float(result_ctype[i]) for i in range(self._actual_num_wfms())], [float(mean_ctype[i]) for i in range(self._actual_num_wfms())], [float(stdev_ctype[i]) for i in range(self._actual_num_wfms())], [float(min_ctype[i]) for i in range(self._actual_num_wfms())], [float(max_ctype[i]) for i in range(self._actual_num_wfms())], [int(num_in_stats_ctype[i]) for i in range(self._actual_num_wfms())] @ivi_synchronized def _get_attribute_vi_boolean(self, attribute_id): - r"""_get_attribute_vi_boolean + r'''_get_attribute_vi_boolean Queries the value of a ViBoolean property. You can use this method to get the values of instrument-specific properties and inherent IVI @@ -3997,27 +3501,18 @@ def _get_attribute_vi_boolean(self, attribute_id): value (bool): Returns the current value of the property; pass the address of a ViBoolean variable. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niScope_GetAttributeViBoolean( - vi_ctype, - channel_list_ctype, - attribute_id_ctype, - None if value_ctype is None else (ctypes.pointer(value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niScope_GetAttributeViBoolean(vi_ctype, channel_list_ctype, attribute_id_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(value_ctype.value) @ivi_synchronized def _get_attribute_vi_int32(self, attribute_id): - r"""_get_attribute_vi_int32 + r'''_get_attribute_vi_int32 Queries the value of a ViInt32 property. You can use this method to get the values of instrument-specific properties and inherent IVI @@ -4046,27 +3541,18 @@ def _get_attribute_vi_int32(self, attribute_id): Returns: value (int): Returns the current value of the property. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niScope_GetAttributeViInt32( - vi_ctype, - channel_list_ctype, - attribute_id_ctype, - None if value_ctype is None else (ctypes.pointer(value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niScope_GetAttributeViInt32(vi_ctype, channel_list_ctype, attribute_id_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(value_ctype.value) @ivi_synchronized def _get_attribute_vi_int64(self, attribute_id): - r"""_get_attribute_vi_int64 + r'''_get_attribute_vi_int64 Queries the value of a ViInt64 property. You can use this method to get the values of instrument-specific properties and inherent IVI @@ -4095,27 +3581,18 @@ def _get_attribute_vi_int64(self, attribute_id): Returns: value (int): Returns the current value of the property. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViInt64() # case S220 - error_code = self._library.niScope_GetAttributeViInt64( - vi_ctype, - channel_list_ctype, - attribute_id_ctype, - None if value_ctype is None else (ctypes.pointer(value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niScope_GetAttributeViInt64(vi_ctype, channel_list_ctype, attribute_id_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(value_ctype.value) @ivi_synchronized def _get_attribute_vi_real64(self, attribute_id): - r"""_get_attribute_vi_real64 + r'''_get_attribute_vi_real64 Queries the value of a ViReal64 property. You can use this method to get the values of instrument-specific properties and inherent IVI @@ -4145,27 +3622,18 @@ def _get_attribute_vi_real64(self, attribute_id): value (float): Returns the current value of the property; pass the address of a ViReal64 variable. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niScope_GetAttributeViReal64( - vi_ctype, - channel_list_ctype, - attribute_id_ctype, - None if value_ctype is None else (ctypes.pointer(value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niScope_GetAttributeViReal64(vi_ctype, channel_list_ctype, attribute_id_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(value_ctype.value) @ivi_synchronized def _get_attribute_vi_string(self, attribute_id): - r"""_get_attribute_vi_string + r'''_get_attribute_vi_string Queries the value of a ViString property. You can use this method to get the values of instrument-specific properties and inherent IVI @@ -4207,41 +3675,23 @@ def _get_attribute_vi_string(self, attribute_id): property; the buffer must be of type ViChar and have at least as many bytes as indicated in the **bufSize**. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 buf_size_ctype = _visatype.ViInt32() # case S170 value_ctype = None # case C050 - error_code = self._library.niScope_GetAttributeViString( - vi_ctype, - channel_list_ctype, - attribute_id_ctype, - buf_size_ctype, - value_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niScope_GetAttributeViString(vi_ctype, channel_list_ctype, attribute_id_ctype, buf_size_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) buf_size_ctype = _visatype.ViInt32(error_code) # case S180 value_ctype = (_visatype.ViChar * buf_size_ctype.value)() # case C060 - error_code = self._library.niScope_GetAttributeViString( - vi_ctype, - channel_list_ctype, - attribute_id_ctype, - buf_size_ctype, - value_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niScope_GetAttributeViString(vi_ctype, channel_list_ctype, attribute_id_ctype, buf_size_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return value_ctype.value.decode(self._encoding) @ivi_synchronized def _get_equalization_filter_coefficients(self, number_of_coefficients): - r"""_get_equalization_filter_coefficients + r'''_get_equalization_filter_coefficients Retrieves the custom coefficients for the equalization FIR filter on the device. This filter is designed to compensate the input signal for @@ -4271,31 +3721,18 @@ def _get_equalization_filter_coefficients(self, number_of_coefficients): `equalization_num_coefficients `__ property. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - number_of_coefficients_ctype = _visatype.ViInt32( - number_of_coefficients - ) # case S210 + channel_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + number_of_coefficients_ctype = _visatype.ViInt32(number_of_coefficients) # case S210 coefficients_size = number_of_coefficients # case B600 - coefficients_ctype = get_ctypes_pointer_for_buffer( - library_type=_visatype.ViReal64, size=coefficients_size - ) # case B600 - error_code = self._library.niScope_GetEqualizationFilterCoefficients( - vi_ctype, channel_ctype, number_of_coefficients_ctype, coefficients_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return [ - float(coefficients_ctype[i]) - for i in range(number_of_coefficients_ctype.value) - ] + coefficients_ctype = get_ctypes_pointer_for_buffer(library_type=_visatype.ViReal64, size=coefficients_size) # case B600 + error_code = self._library.niScope_GetEqualizationFilterCoefficients(vi_ctype, channel_ctype, number_of_coefficients_ctype, coefficients_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return [float(coefficients_ctype[i]) for i in range(number_of_coefficients_ctype.value)] def _get_error(self): - r"""_get_error + r'''_get_error Reads an error code and message from the error queue. National Instruments digitizers do not contain an error queue. Errors are @@ -4330,37 +3767,21 @@ def _get_error(self): If you pass 0 for the **bufferSize**, you can pass VI_NULL for this parameter. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus() # case S220 buffer_size_ctype = _visatype.ViInt32() # case S170 description_ctype = None # case C050 - error_code = self._library.niScope_GetError( - vi_ctype, - None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), - buffer_size_ctype, - description_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=True - ) + error_code = self._library.niScope_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), buffer_size_ctype, description_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 description_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niScope_GetError( - vi_ctype, - None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), - buffer_size_ctype, - description_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) - return int(error_code_ctype.value), description_ctype.value.decode( - self._encoding - ) + error_code = self._library.niScope_GetError(vi_ctype, None if error_code_ctype is None else (ctypes.pointer(error_code_ctype)), buffer_size_ctype, description_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + return int(error_code_ctype.value), description_ctype.value.decode(self._encoding) def lock(self): - """lock + '''lock Obtains a multithread lock on the device session. Before doing so, the software waits until all other execution threads release their locks @@ -4388,27 +3809,25 @@ def lock(self): Returns: lock (context manager): When used in a with statement, niscope.Session.lock acts as a context manager and unlock will be called when the with block is exited - """ + ''' self._lock_session() # We do not call _lock_session() in the context manager so that this function can # act standalone as well and let the client call unlock() explicitly. If they do use the context manager, # that will handle the unlock for them return _Lock(self) def _lock_session(self): - """_lock_session + '''_lock_session Actual call to driver - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_LockSession(vi_ctype, None) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return @ivi_synchronized def _read(self, num_samples, timeout=hightime.timedelta(seconds=5.0)): - r"""_read + r'''_read Initiates an acquisition, waits for it to complete, and retrieves the data. The process is similar to calling _initiate_acquisition, @@ -4496,43 +3915,23 @@ def _read(self, num_samples, timeout=hightime.timedelta(seconds=5.0)): Call _actual_num_wfms to determine the size of this array. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64( - timeout - ) # case S140 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 num_samples_ctype = _visatype.ViInt32(num_samples) # case S150 - waveform_size = num_samples * self._actual_num_wfms() # case B560 + waveform_size = (num_samples * self._actual_num_wfms()) # case B560 waveform_array = array.array("d", [0] * waveform_size) # case B560 - waveform_ctype = get_ctypes_pointer_for_buffer( - value=waveform_array, library_type=_visatype.ViReal64 - ) # case B560 + waveform_ctype = get_ctypes_pointer_for_buffer(value=waveform_array, library_type=_visatype.ViReal64) # case B560 wfm_info_size = self._actual_num_wfms() # case B560 - wfm_info_ctype = get_ctypes_pointer_for_buffer( - library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size - ) # case B560 - error_code = self._library.niScope_Read( - vi_ctype, - channel_list_ctype, - timeout_ctype, - num_samples_ctype, - waveform_ctype, - wfm_info_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return waveform_array, [ - waveform_info.WaveformInfo(wfm_info_ctype[i]) - for i in range(self._actual_num_wfms()) - ] + wfm_info_ctype = get_ctypes_pointer_for_buffer(library_type=waveform_info.struct_niScope_wfmInfo, size=wfm_info_size) # case B560 + error_code = self._library.niScope_Read(vi_ctype, channel_list_ctype, timeout_ctype, num_samples_ctype, waveform_ctype, wfm_info_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return waveform_array, [waveform_info.WaveformInfo(wfm_info_ctype[i]) for i in range(self._actual_num_wfms())] @ivi_synchronized def _set_attribute_vi_boolean(self, attribute_id, value): - r"""_set_attribute_vi_boolean + r'''_set_attribute_vi_boolean Sets the value of a ViBoolean property. This is a low-level method that you can use to set the values of instrument-specific properties and @@ -4574,24 +3973,18 @@ def _set_attribute_vi_boolean(self, attribute_id, value): value (bool): The value that you want to set the property to. Some values might not be valid depending on the current settings of the instrument session. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViBoolean(value) # case S150 - error_code = self._library.niScope_SetAttributeViBoolean( - vi_ctype, channel_list_ctype, attribute_id_ctype, value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niScope_SetAttributeViBoolean(vi_ctype, channel_list_ctype, attribute_id_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_int32(self, attribute_id, value): - r"""_set_attribute_vi_int32 + r'''_set_attribute_vi_int32 Sets the value of a ViInt32 property. This is a low-level method that you can use to set the values of instrument-specific properties and @@ -4633,24 +4026,18 @@ def _set_attribute_vi_int32(self, attribute_id, value): value (int): The value that you want to set the property. Some values might not be valid depending on the current settings of the instrument session. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViInt32(value) # case S150 - error_code = self._library.niScope_SetAttributeViInt32( - vi_ctype, channel_list_ctype, attribute_id_ctype, value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niScope_SetAttributeViInt32(vi_ctype, channel_list_ctype, attribute_id_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_int64(self, attribute_id, value): - r"""_set_attribute_vi_int64 + r'''_set_attribute_vi_int64 Sets the value of a ViInt64 property. This is a low-level method that you can use to set the values of instrument-specific properties and @@ -4692,24 +4079,18 @@ def _set_attribute_vi_int64(self, attribute_id, value): value (int): The value that you want to set the property. Some values might not be valid depending on the current settings of the instrument session. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViInt64(value) # case S150 - error_code = self._library.niScope_SetAttributeViInt64( - vi_ctype, channel_list_ctype, attribute_id_ctype, value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niScope_SetAttributeViInt64(vi_ctype, channel_list_ctype, attribute_id_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_real64(self, attribute_id, value): - r"""_set_attribute_vi_real64 + r'''_set_attribute_vi_real64 Sets the value of a ViReal64 property. This is a low-level method that you can use to set the values of instrument-specific properties and @@ -4751,24 +4132,18 @@ def _set_attribute_vi_real64(self, attribute_id, value): value (float): The value that you want to set the property to. Some values might not be valid depending on the current settings of the instrument session. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViReal64(value) # case S150 - error_code = self._library.niScope_SetAttributeViReal64( - vi_ctype, channel_list_ctype, attribute_id_ctype, value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niScope_SetAttributeViReal64(vi_ctype, channel_list_ctype, attribute_id_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_string(self, attribute_id, value): - r"""_set_attribute_vi_string + r'''_set_attribute_vi_string Sets the value of a ViString property. @@ -4812,39 +4187,29 @@ def _set_attribute_vi_string(self, attribute_id, value): value (str): The value that you want to set the property to. Some values might not be valid depending on the current settings of the instrument session. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_list_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_list_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 - value_ctype = ctypes.create_string_buffer( - value.encode(self._encoding) - ) # case C020 - error_code = self._library.niScope_SetAttributeViString( - vi_ctype, channel_list_ctype, attribute_id_ctype, value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + value_ctype = ctypes.create_string_buffer(value.encode(self._encoding)) # case C020 + error_code = self._library.niScope_SetAttributeViString(vi_ctype, channel_list_ctype, attribute_id_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def unlock(self): - """unlock + '''unlock Releases a lock that you acquired on an device session using lock. Refer to lock for additional information on session locks. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_UnlockSession(vi_ctype, None) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return def _error_message(self, error_code): - r"""_error_message + r'''_error_message Takes the **Error_Code** returned by the instrument driver methods, interprets it, and returns it as a user-readable string. @@ -4855,24 +4220,20 @@ def _error_message(self, error_code): Returns: error_message (str): The error information formatted into a string. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus(error_code) # case S150 error_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niScope_error_message( - vi_ctype, error_code_ctype, error_message_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + error_code = self._library.niScope_error_message(vi_ctype, error_code_ctype, error_message_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return error_message_ctype.value.decode(self._encoding) class Session(_SessionBase): - """An NI-SCOPE session to a National Instruments Digitizer.""" + '''An NI-SCOPE session to a National Instruments Digitizer.''' def __init__(self, resource_name, id_query=False, reset_device=False, options={}): - r"""An NI-SCOPE session to a National Instruments Digitizer. + r'''An NI-SCOPE session to a National Instruments Digitizer. Performs the following initialization actions: @@ -5000,23 +4361,15 @@ def __init__(self, resource_name, id_query=False, reset_device=False, options={} Returns: session (niscope.Session): A session object representing the device. - """ - super(Session, self).__init__( - repeated_capability_list=[], - vi=None, - library=None, - encoding=None, - freeze_it=False, - ) + ''' + super(Session, self).__init__(repeated_capability_list=[], vi=None, library=None, encoding=None, freeze_it=False) options = _converters.convert_init_with_options_dictionary(options) self._library = _library_singleton.get() - self._encoding = "windows-1251" + self._encoding = 'windows-1251' # Call specified init function self._vi = 0 # This must be set before calling _init_with_options(). - self._vi = self._init_with_options( - resource_name, id_query, reset_device, options - ) + self._vi = self._init_with_options(resource_name, id_query, reset_device, options) self.tclk = nitclk.SessionReference(self._vi) @@ -5026,7 +4379,7 @@ def __init__(self, resource_name, id_query=False, reset_device=False, options={} param_list.append("id_query=" + pp.pformat(id_query)) param_list.append("reset_device=" + pp.pformat(reset_device)) param_list.append("options=" + pp.pformat(options)) - self._param_list = ", ".join(param_list) + self._param_list = ', '.join(param_list) self._is_frozen = True @@ -5037,7 +4390,7 @@ def __exit__(self, exc_type, exc_value, traceback): self.close() def initiate(self): - """initiate + '''initiate Initiates a waveform acquisition. @@ -5047,11 +4400,11 @@ def initiate(self): Note: This method will return a Python context manager that will initiate on entering and abort on exit. - """ + ''' return _Acquisition(self) def close(self): - """close + '''close When you are finished using an instrument driver session, you must call this method to perform the following actions: @@ -5062,7 +4415,7 @@ def close(self): Note: This method is not needed when using the session context manager - """ + ''' try: self._close() except errors.DriverError: @@ -5070,25 +4423,23 @@ def close(self): raise self._vi = 0 - """ These are code-generated """ + ''' These are code-generated ''' @ivi_synchronized def abort(self): - r"""abort + r'''abort Aborts an acquisition and returns the digitizer to the Idle state. Call this method if the digitizer times out waiting for a trigger. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_Abort(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def acquisition_status(self): - r"""acquisition_status + r'''acquisition_status Returns status information about the acquisition to the **status** output parameter. @@ -5104,23 +4455,16 @@ def acquisition_status(self): AcquisitionStatus.STATUS_UNKNOWN - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 acquisition_status_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niScope_AcquisitionStatus( - vi_ctype, - None - if acquisition_status_ctype is None - else (ctypes.pointer(acquisition_status_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niScope_AcquisitionStatus(vi_ctype, None if acquisition_status_ctype is None else (ctypes.pointer(acquisition_status_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return enums.AcquisitionStatus(acquisition_status_ctype.value) @ivi_synchronized def auto_setup(self): - r"""auto_setup + r'''auto_setup Automatically configures the instrument. When you call this method, the digitizer senses the input signal and automatically configures many @@ -5188,17 +4532,15 @@ def auto_setup(self): +--------------------+-----------------------------------------------+ | Trigger output | None | +--------------------+-----------------------------------------------+ - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_AutoSetup(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _cal_fetch_date(self, which_one): - r"""_cal_fetch_date + r'''_cal_fetch_date TBD @@ -5213,31 +4555,21 @@ def _cal_fetch_date(self, which_one): day (int): - """ + ''' if type(which_one) is not enums._CalibrationTypes: - raise TypeError( - "Parameter which_one must be of type " + str(enums._CalibrationTypes) - ) + raise TypeError('Parameter which_one must be of type ' + str(enums._CalibrationTypes)) vi_ctype = _visatype.ViSession(self._vi) # case S110 which_one_ctype = _visatype.ViInt32(which_one.value) # case S130 year_ctype = _visatype.ViInt32() # case S220 month_ctype = _visatype.ViInt32() # case S220 day_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niScope_CalFetchDate( - vi_ctype, - which_one_ctype, - None if year_ctype is None else (ctypes.pointer(year_ctype)), - None if month_ctype is None else (ctypes.pointer(month_ctype)), - None if day_ctype is None else (ctypes.pointer(day_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niScope_CalFetchDate(vi_ctype, which_one_ctype, None if year_ctype is None else (ctypes.pointer(year_ctype)), None if month_ctype is None else (ctypes.pointer(month_ctype)), None if day_ctype is None else (ctypes.pointer(day_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(year_ctype.value), int(month_ctype.value), int(day_ctype.value) @ivi_synchronized def _cal_fetch_temperature(self, which_one): - r"""_cal_fetch_temperature + r'''_cal_fetch_temperature TBD @@ -5248,41 +4580,31 @@ def _cal_fetch_temperature(self, which_one): Returns: temperature (float): - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 which_one_ctype = _visatype.ViInt32(which_one) # case S150 temperature_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niScope_CalFetchTemperature( - vi_ctype, - which_one_ctype, - None if temperature_ctype is None else (ctypes.pointer(temperature_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niScope_CalFetchTemperature(vi_ctype, which_one_ctype, None if temperature_ctype is None else (ctypes.pointer(temperature_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(temperature_ctype.value) @ivi_synchronized def commit(self): - r"""commit + r'''commit Commits to hardware all the parameter settings associated with the task. Use this method if you want a parameter change to be immediately reflected in the hardware. This method is not supported for Traditional NI-DAQ (Legacy) devices. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_Commit(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def configure_horizontal_timing( - self, min_sample_rate, min_num_pts, ref_position, num_records, enforce_realtime - ): - r"""configure_horizontal_timing + def configure_horizontal_timing(self, min_sample_rate, min_num_pts, ref_position, num_records, enforce_realtime): + r'''configure_horizontal_timing Configures the common properties of the horizontal subsystem for a multirecord acquisition in terms of minimum sample rate. @@ -5319,29 +4641,20 @@ def configure_horizontal_timing( False—Allow real-time and equivalent-time acquisitions - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 min_sample_rate_ctype = _visatype.ViReal64(min_sample_rate) # case S150 min_num_pts_ctype = _visatype.ViInt32(min_num_pts) # case S150 ref_position_ctype = _visatype.ViReal64(ref_position) # case S150 num_records_ctype = _visatype.ViInt32(num_records) # case S150 enforce_realtime_ctype = _visatype.ViBoolean(enforce_realtime) # case S150 - error_code = self._library.niScope_ConfigureHorizontalTiming( - vi_ctype, - min_sample_rate_ctype, - min_num_pts_ctype, - ref_position_ctype, - num_records_ctype, - enforce_realtime_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niScope_ConfigureHorizontalTiming(vi_ctype, min_sample_rate_ctype, min_num_pts_ctype, ref_position_ctype, num_records_ctype, enforce_realtime_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _configure_ref_levels(self, low=10.0, mid=50.0, high=90.0): - r"""_configure_ref_levels + r'''_configure_ref_levels This method is included for compliance with the IviScope Class Specification. @@ -5391,28 +4704,18 @@ def _configure_ref_levels(self, low=10.0, mid=50.0, high=90.0): Default Value: 90.0 - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 low_ctype = _visatype.ViReal64(low) # case S150 mid_ctype = _visatype.ViReal64(mid) # case S150 high_ctype = _visatype.ViReal64(high) # case S150 - error_code = self._library.niScope_ConfigureRefLevels( - vi_ctype, low_ctype, mid_ctype, high_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niScope_ConfigureRefLevels(vi_ctype, low_ctype, mid_ctype, high_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def configure_trigger_digital( - self, - trigger_source, - slope=enums.TriggerSlope.POSITIVE, - holdoff=hightime.timedelta(seconds=0.0), - delay=hightime.timedelta(seconds=0.0), - ): - r"""configure_trigger_digital + def configure_trigger_digital(self, trigger_source, slope=enums.TriggerSlope.POSITIVE, holdoff=hightime.timedelta(seconds=0.0), delay=hightime.timedelta(seconds=0.0)): + r'''configure_trigger_digital Configures the common properties of a digital trigger. @@ -5460,41 +4763,21 @@ def configure_trigger_digital( acquiring data. Refer to trigger_delay_time for more information. - """ + ''' if type(slope) is not enums.TriggerSlope: - raise TypeError( - "Parameter slope must be of type " + str(enums.TriggerSlope) - ) + raise TypeError('Parameter slope must be of type ' + str(enums.TriggerSlope)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - trigger_source_ctype = ctypes.create_string_buffer( - trigger_source.encode(self._encoding) - ) # case C020 + trigger_source_ctype = ctypes.create_string_buffer(trigger_source.encode(self._encoding)) # case C020 slope_ctype = _visatype.ViInt32(slope.value) # case S130 - holdoff_ctype = _converters.convert_timedelta_to_seconds_real64( - holdoff - ) # case S140 - delay_ctype = _converters.convert_timedelta_to_seconds_real64( - delay - ) # case S140 - error_code = self._library.niScope_ConfigureTriggerDigital( - vi_ctype, trigger_source_ctype, slope_ctype, holdoff_ctype, delay_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + holdoff_ctype = _converters.convert_timedelta_to_seconds_real64(holdoff) # case S140 + delay_ctype = _converters.convert_timedelta_to_seconds_real64(delay) # case S140 + error_code = self._library.niScope_ConfigureTriggerDigital(vi_ctype, trigger_source_ctype, slope_ctype, holdoff_ctype, delay_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def configure_trigger_edge( - self, - trigger_source, - level, - trigger_coupling, - slope=enums.TriggerSlope.POSITIVE, - holdoff=hightime.timedelta(seconds=0.0), - delay=hightime.timedelta(seconds=0.0), - ): - r"""configure_trigger_edge + def configure_trigger_edge(self, trigger_source, level, trigger_coupling, slope=enums.TriggerSlope.POSITIVE, holdoff=hightime.timedelta(seconds=0.0), delay=hightime.timedelta(seconds=0.0)): + r'''configure_trigger_edge Configures common properties for analog edge triggering. @@ -5538,55 +4821,25 @@ def configure_trigger_edge( acquiring data. Refer to trigger_delay_time for more information. - """ + ''' if type(slope) is not enums.TriggerSlope: - raise TypeError( - "Parameter slope must be of type " + str(enums.TriggerSlope) - ) + raise TypeError('Parameter slope must be of type ' + str(enums.TriggerSlope)) if type(trigger_coupling) is not enums.TriggerCoupling: - raise TypeError( - "Parameter trigger_coupling must be of type " - + str(enums.TriggerCoupling) - ) + raise TypeError('Parameter trigger_coupling must be of type ' + str(enums.TriggerCoupling)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - trigger_source_ctype = ctypes.create_string_buffer( - trigger_source.encode(self._encoding) - ) # case C020 + trigger_source_ctype = ctypes.create_string_buffer(trigger_source.encode(self._encoding)) # case C020 level_ctype = _visatype.ViReal64(level) # case S150 slope_ctype = _visatype.ViInt32(slope.value) # case S130 trigger_coupling_ctype = _visatype.ViInt32(trigger_coupling.value) # case S130 - holdoff_ctype = _converters.convert_timedelta_to_seconds_real64( - holdoff - ) # case S140 - delay_ctype = _converters.convert_timedelta_to_seconds_real64( - delay - ) # case S140 - error_code = self._library.niScope_ConfigureTriggerEdge( - vi_ctype, - trigger_source_ctype, - level_ctype, - slope_ctype, - trigger_coupling_ctype, - holdoff_ctype, - delay_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + holdoff_ctype = _converters.convert_timedelta_to_seconds_real64(holdoff) # case S140 + delay_ctype = _converters.convert_timedelta_to_seconds_real64(delay) # case S140 + error_code = self._library.niScope_ConfigureTriggerEdge(vi_ctype, trigger_source_ctype, level_ctype, slope_ctype, trigger_coupling_ctype, holdoff_ctype, delay_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def configure_trigger_hysteresis( - self, - trigger_source, - level, - hysteresis, - trigger_coupling, - slope=enums.TriggerSlope.POSITIVE, - holdoff=hightime.timedelta(seconds=0.0), - delay=hightime.timedelta(seconds=0.0), - ): - r"""configure_trigger_hysteresis + def configure_trigger_hysteresis(self, trigger_source, level, hysteresis, trigger_coupling, slope=enums.TriggerSlope.POSITIVE, holdoff=hightime.timedelta(seconds=0.0), delay=hightime.timedelta(seconds=0.0)): + r'''configure_trigger_hysteresis Configures common properties for analog hysteresis triggering. This kind of trigger specifies an additional value, specified in the @@ -5640,48 +4893,26 @@ def configure_trigger_hysteresis( acquiring data. Refer to trigger_delay_time for more information. - """ + ''' if type(slope) is not enums.TriggerSlope: - raise TypeError( - "Parameter slope must be of type " + str(enums.TriggerSlope) - ) + raise TypeError('Parameter slope must be of type ' + str(enums.TriggerSlope)) if type(trigger_coupling) is not enums.TriggerCoupling: - raise TypeError( - "Parameter trigger_coupling must be of type " - + str(enums.TriggerCoupling) - ) + raise TypeError('Parameter trigger_coupling must be of type ' + str(enums.TriggerCoupling)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - trigger_source_ctype = ctypes.create_string_buffer( - trigger_source.encode(self._encoding) - ) # case C020 + trigger_source_ctype = ctypes.create_string_buffer(trigger_source.encode(self._encoding)) # case C020 level_ctype = _visatype.ViReal64(level) # case S150 hysteresis_ctype = _visatype.ViReal64(hysteresis) # case S150 slope_ctype = _visatype.ViInt32(slope.value) # case S130 trigger_coupling_ctype = _visatype.ViInt32(trigger_coupling.value) # case S130 - holdoff_ctype = _converters.convert_timedelta_to_seconds_real64( - holdoff - ) # case S140 - delay_ctype = _converters.convert_timedelta_to_seconds_real64( - delay - ) # case S140 - error_code = self._library.niScope_ConfigureTriggerHysteresis( - vi_ctype, - trigger_source_ctype, - level_ctype, - hysteresis_ctype, - slope_ctype, - trigger_coupling_ctype, - holdoff_ctype, - delay_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + holdoff_ctype = _converters.convert_timedelta_to_seconds_real64(holdoff) # case S140 + delay_ctype = _converters.convert_timedelta_to_seconds_real64(delay) # case S140 + error_code = self._library.niScope_ConfigureTriggerHysteresis(vi_ctype, trigger_source_ctype, level_ctype, hysteresis_ctype, slope_ctype, trigger_coupling_ctype, holdoff_ctype, delay_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def configure_trigger_immediate(self): - r"""configure_trigger_immediate + r'''configure_trigger_immediate Configures common properties for immediate triggering. Immediate triggering means the digitizer triggers itself. @@ -5689,21 +4920,15 @@ def configure_trigger_immediate(self): When you initiate an acquisition, the digitizer waits for a trigger. You specify the type of trigger that the digitizer waits for with a Configure Trigger method, such as configure_trigger_immediate. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_ConfigureTriggerImmediate(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def configure_trigger_software( - self, - holdoff=hightime.timedelta(seconds=0.0), - delay=hightime.timedelta(seconds=0.0), - ): - r"""configure_trigger_software + def configure_trigger_software(self, holdoff=hightime.timedelta(seconds=0.0), delay=hightime.timedelta(seconds=0.0)): + r'''configure_trigger_software Configures common properties for software triggering. @@ -5736,36 +4961,17 @@ def configure_trigger_software( acquiring data. Refer to trigger_delay_time for more information. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - holdoff_ctype = _converters.convert_timedelta_to_seconds_real64( - holdoff - ) # case S140 - delay_ctype = _converters.convert_timedelta_to_seconds_real64( - delay - ) # case S140 - error_code = self._library.niScope_ConfigureTriggerSoftware( - vi_ctype, holdoff_ctype, delay_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + holdoff_ctype = _converters.convert_timedelta_to_seconds_real64(holdoff) # case S140 + delay_ctype = _converters.convert_timedelta_to_seconds_real64(delay) # case S140 + error_code = self._library.niScope_ConfigureTriggerSoftware(vi_ctype, holdoff_ctype, delay_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def configure_trigger_video( - self, - trigger_source, - signal_format, - event, - polarity, - trigger_coupling, - enable_dc_restore=False, - line_number=1, - holdoff=hightime.timedelta(seconds=0.0), - delay=hightime.timedelta(seconds=0.0), - ): - r"""configure_trigger_video + def configure_trigger_video(self, trigger_source, signal_format, event, polarity, trigger_coupling, enable_dc_restore=False, line_number=1, holdoff=hightime.timedelta(seconds=0.0), delay=hightime.timedelta(seconds=0.0)): + r'''configure_trigger_video Configures the common properties for video triggering, including the signal format, TV event, line number, polarity, and enable DC restore. A @@ -5826,70 +5032,32 @@ def configure_trigger_video( acquiring data. Refer to trigger_delay_time for more information. - """ + ''' if type(signal_format) is not enums.VideoSignalFormat: - raise TypeError( - "Parameter signal_format must be of type " - + str(enums.VideoSignalFormat) - ) + raise TypeError('Parameter signal_format must be of type ' + str(enums.VideoSignalFormat)) if type(event) is not enums.VideoTriggerEvent: - raise TypeError( - "Parameter event must be of type " + str(enums.VideoTriggerEvent) - ) + raise TypeError('Parameter event must be of type ' + str(enums.VideoTriggerEvent)) if type(polarity) is not enums.VideoPolarity: - raise TypeError( - "Parameter polarity must be of type " + str(enums.VideoPolarity) - ) + raise TypeError('Parameter polarity must be of type ' + str(enums.VideoPolarity)) if type(trigger_coupling) is not enums.TriggerCoupling: - raise TypeError( - "Parameter trigger_coupling must be of type " - + str(enums.TriggerCoupling) - ) + raise TypeError('Parameter trigger_coupling must be of type ' + str(enums.TriggerCoupling)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - trigger_source_ctype = ctypes.create_string_buffer( - trigger_source.encode(self._encoding) - ) # case C020 + trigger_source_ctype = ctypes.create_string_buffer(trigger_source.encode(self._encoding)) # case C020 enable_dc_restore_ctype = _visatype.ViBoolean(enable_dc_restore) # case S150 signal_format_ctype = _visatype.ViInt32(signal_format.value) # case S130 event_ctype = _visatype.ViInt32(event.value) # case S130 line_number_ctype = _visatype.ViInt32(line_number) # case S150 polarity_ctype = _visatype.ViInt32(polarity.value) # case S130 trigger_coupling_ctype = _visatype.ViInt32(trigger_coupling.value) # case S130 - holdoff_ctype = _converters.convert_timedelta_to_seconds_real64( - holdoff - ) # case S140 - delay_ctype = _converters.convert_timedelta_to_seconds_real64( - delay - ) # case S140 - error_code = self._library.niScope_ConfigureTriggerVideo( - vi_ctype, - trigger_source_ctype, - enable_dc_restore_ctype, - signal_format_ctype, - event_ctype, - line_number_ctype, - polarity_ctype, - trigger_coupling_ctype, - holdoff_ctype, - delay_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + holdoff_ctype = _converters.convert_timedelta_to_seconds_real64(holdoff) # case S140 + delay_ctype = _converters.convert_timedelta_to_seconds_real64(delay) # case S140 + error_code = self._library.niScope_ConfigureTriggerVideo(vi_ctype, trigger_source_ctype, enable_dc_restore_ctype, signal_format_ctype, event_ctype, line_number_ctype, polarity_ctype, trigger_coupling_ctype, holdoff_ctype, delay_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def configure_trigger_window( - self, - trigger_source, - low_level, - high_level, - window_mode, - trigger_coupling, - holdoff=hightime.timedelta(seconds=0.0), - delay=hightime.timedelta(seconds=0.0), - ): - r"""configure_trigger_window + def configure_trigger_window(self, trigger_source, low_level, high_level, window_mode, trigger_coupling, holdoff=hightime.timedelta(seconds=0.0), delay=hightime.timedelta(seconds=0.0)): + r'''configure_trigger_window Configures common properties for analog window triggering. A window trigger occurs when a signal enters or leaves a window you specify with @@ -5935,62 +5103,38 @@ def configure_trigger_window( acquiring data. Refer to trigger_delay_time for more information. - """ + ''' if type(window_mode) is not enums.TriggerWindowMode: - raise TypeError( - "Parameter window_mode must be of type " + str(enums.TriggerWindowMode) - ) + raise TypeError('Parameter window_mode must be of type ' + str(enums.TriggerWindowMode)) if type(trigger_coupling) is not enums.TriggerCoupling: - raise TypeError( - "Parameter trigger_coupling must be of type " - + str(enums.TriggerCoupling) - ) + raise TypeError('Parameter trigger_coupling must be of type ' + str(enums.TriggerCoupling)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - trigger_source_ctype = ctypes.create_string_buffer( - trigger_source.encode(self._encoding) - ) # case C020 + trigger_source_ctype = ctypes.create_string_buffer(trigger_source.encode(self._encoding)) # case C020 low_level_ctype = _visatype.ViReal64(low_level) # case S150 high_level_ctype = _visatype.ViReal64(high_level) # case S150 window_mode_ctype = _visatype.ViInt32(window_mode.value) # case S130 trigger_coupling_ctype = _visatype.ViInt32(trigger_coupling.value) # case S130 - holdoff_ctype = _converters.convert_timedelta_to_seconds_real64( - holdoff - ) # case S140 - delay_ctype = _converters.convert_timedelta_to_seconds_real64( - delay - ) # case S140 - error_code = self._library.niScope_ConfigureTriggerWindow( - vi_ctype, - trigger_source_ctype, - low_level_ctype, - high_level_ctype, - window_mode_ctype, - trigger_coupling_ctype, - holdoff_ctype, - delay_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + holdoff_ctype = _converters.convert_timedelta_to_seconds_real64(holdoff) # case S140 + delay_ctype = _converters.convert_timedelta_to_seconds_real64(delay) # case S140 + error_code = self._library.niScope_ConfigureTriggerWindow(vi_ctype, trigger_source_ctype, low_level_ctype, high_level_ctype, window_mode_ctype, trigger_coupling_ctype, holdoff_ctype, delay_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def disable(self): - r"""disable + r'''disable Aborts any current operation, opens data channel relays, and releases RTSI and PFI lines. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_Disable(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def export_attribute_configuration_buffer(self): - r"""export_attribute_configuration_buffer + r'''export_attribute_configuration_buffer Exports the property configuration of the session to a configuration buffer. @@ -6015,33 +5159,23 @@ def export_attribute_configuration_buffer(self): configuration (bytes): Specifies the byte array buffer to be populated with the exported property configuration. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 size_in_bytes_ctype = _visatype.ViInt32() # case S170 configuration_ctype = None # case B580 - error_code = self._library.niScope_ExportAttributeConfigurationBuffer( - vi_ctype, size_in_bytes_ctype, configuration_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niScope_ExportAttributeConfigurationBuffer(vi_ctype, size_in_bytes_ctype, configuration_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) size_in_bytes_ctype = _visatype.ViInt32(error_code) # case S180 configuration_size = size_in_bytes_ctype.value # case B590 configuration_array = array.array("b", [0] * configuration_size) # case B590 - configuration_ctype = get_ctypes_pointer_for_buffer( - value=configuration_array, library_type=_visatype.ViInt8 - ) # case B590 - error_code = self._library.niScope_ExportAttributeConfigurationBuffer( - vi_ctype, size_in_bytes_ctype, configuration_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + configuration_ctype = get_ctypes_pointer_for_buffer(value=configuration_array, library_type=_visatype.ViInt8) # case B590 + error_code = self._library.niScope_ExportAttributeConfigurationBuffer(vi_ctype, size_in_bytes_ctype, configuration_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return _converters.convert_to_bytes(configuration_array) @ivi_synchronized def export_attribute_configuration_file(self, file_path): - r"""export_attribute_configuration_file + r'''export_attribute_configuration_file Exports the property configuration of the session to the specified file. @@ -6068,36 +5202,30 @@ def export_attribute_configuration_file(self, file_path): method returns an error. **Default file extension:** .niscopeconfig - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer( - file_path.encode(self._encoding) - ) # case C020 - error_code = self._library.niScope_ExportAttributeConfigurationFile( - vi_ctype, file_path_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 + error_code = self._library.niScope_ExportAttributeConfigurationFile(vi_ctype, file_path_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def get_ext_cal_last_date_and_time(self): - """get_ext_cal_last_date_and_time + '''get_ext_cal_last_date_and_time Returns the date and time of the last external calibration performed. Returns: last_cal_datetime (hightime.timedelta, datetime.timedelta, or float in seconds): Indicates the **date** of the last calibration. A hightime.datetime object is returned, but only contains resolution to the day. - """ + ''' year, month, day = self._cal_fetch_date(enums._CalibrationTypes.EXTERNAL) return hightime.datetime(year, month, day) @ivi_synchronized def get_ext_cal_last_temp(self): - """get_ext_cal_last_temp + '''get_ext_cal_last_temp Returns the onboard temperature, in degrees Celsius, of an oscilloscope at the time of the last successful external calibration. The temperature returned by this node is an onboard temperature read from a sensor on the surface of the oscilloscope. This temperature should not be confused with the environmental temperature of the oscilloscope surroundings. During operation, the onboard temperature is normally higher than the environmental temperature. @@ -6106,27 +5234,27 @@ def get_ext_cal_last_temp(self): Returns: temperature (float): Returns the **temperature** in degrees Celsius during the last calibration. - """ + ''' return self._cal_fetch_temperature(enums._CalibrationTypes.EXTERNAL.value) @ivi_synchronized def get_self_cal_last_date_and_time(self): - """get_self_cal_last_date_and_time + '''get_self_cal_last_date_and_time Returns the date and time of the last self calibration performed. Returns: last_cal_datetime (hightime.timedelta, datetime.timedelta, or float in seconds): Indicates the **date** of the last calibration. A hightime.datetime object is returned, but only contains resolution to the day. - """ + ''' year, month, day = self._cal_fetch_date(enums._CalibrationTypes.SELF) return hightime.datetime(year, month, day) @ivi_synchronized def get_self_cal_last_temp(self): - """get_self_cal_last_temp + '''get_self_cal_last_temp Returns the onboard temperature, in degrees Celsius, of an oscilloscope at the time of the last successful self calibration. The temperature returned by this node is an onboard temperature read from a sensor on the surface of the oscilloscope. This temperature should not be confused with the environmental temperature of the oscilloscope surroundings. During operation, the onboard temperature is normally higher than the environmental temperature. @@ -6135,13 +5263,13 @@ def get_self_cal_last_temp(self): Returns: temperature (float): Returns the **temperature** in degrees Celsius during the last calibration. - """ + ''' return self._cal_fetch_temperature(enums._CalibrationTypes.SELF.value) @ivi_synchronized def import_attribute_configuration_buffer(self, configuration): - r"""import_attribute_configuration_buffer + r'''import_attribute_configuration_buffer Imports a property configuration to the session from the specified configuration buffer. @@ -6166,28 +5294,18 @@ def import_attribute_configuration_buffer(self, configuration): configuration (bytes): Specifies the byte array buffer that contains the property configuration to import. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - size_in_bytes_ctype = _visatype.ViInt32( - 0 if configuration is None else len(configuration) - ) # case S160 - configuration_converted = _converters.convert_to_bytes( - configuration - ) # case B520 - configuration_ctype = get_ctypes_pointer_for_buffer( - value=configuration_converted, library_type=_visatype.ViInt8 - ) # case B520 - error_code = self._library.niScope_ImportAttributeConfigurationBuffer( - vi_ctype, size_in_bytes_ctype, configuration_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + size_in_bytes_ctype = _visatype.ViInt32(0 if configuration is None else len(configuration)) # case S160 + configuration_converted = _converters.convert_to_bytes(configuration) # case B520 + configuration_ctype = get_ctypes_pointer_for_buffer(value=configuration_converted, library_type=_visatype.ViInt8) # case B520 + error_code = self._library.niScope_ImportAttributeConfigurationBuffer(vi_ctype, size_in_bytes_ctype, configuration_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def import_attribute_configuration_file(self, file_path): - r"""import_attribute_configuration_file + r'''import_attribute_configuration_file Imports a property configuration to the session from the specified file. @@ -6214,23 +5332,15 @@ def import_attribute_configuration_file(self, file_path): method returns an error. **Default File Extension:** .niscopeconfig - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - file_path_ctype = ctypes.create_string_buffer( - file_path.encode(self._encoding) - ) # case C020 - error_code = self._library.niScope_ImportAttributeConfigurationFile( - vi_ctype, file_path_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + file_path_ctype = ctypes.create_string_buffer(file_path.encode(self._encoding)) # case C020 + error_code = self._library.niScope_ImportAttributeConfigurationFile(vi_ctype, file_path_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return - def _init_with_options( - self, resource_name, id_query=False, reset_device=False, option_string="" - ): - r"""_init_with_options + def _init_with_options(self, resource_name, id_query=False, reset_device=False, option_string=""): + r'''_init_with_options Performs the following initialization actions: @@ -6354,76 +5464,56 @@ def _init_with_options( vi (int): Returns a session handle that you can use to identify the device in all subsequent NI-SCOPE method calls. - """ - resource_name_ctype = ctypes.create_string_buffer( - resource_name.encode(self._encoding) - ) # case C020 + ''' + resource_name_ctype = ctypes.create_string_buffer(resource_name.encode(self._encoding)) # case C020 id_query_ctype = _visatype.ViBoolean(id_query) # case S150 reset_device_ctype = _visatype.ViBoolean(reset_device) # case S150 - option_string_ctype = ctypes.create_string_buffer( - _converters.convert_init_with_options_dictionary(option_string).encode( - self._encoding - ) - ) # case C040 + option_string_ctype = ctypes.create_string_buffer(_converters.convert_init_with_options_dictionary(option_string).encode(self._encoding)) # case C040 vi_ctype = _visatype.ViSession() # case S220 - error_code = self._library.niScope_InitWithOptions( - resource_name_ctype, - id_query_ctype, - reset_device_ctype, - option_string_ctype, - None if vi_ctype is None else (ctypes.pointer(vi_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niScope_InitWithOptions(resource_name_ctype, id_query_ctype, reset_device_ctype, option_string_ctype, None if vi_ctype is None else (ctypes.pointer(vi_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(vi_ctype.value) @ivi_synchronized def _initiate_acquisition(self): - r"""_initiate_acquisition + r'''_initiate_acquisition Initiates a waveform acquisition. After calling this method, the digitizer leaves the Idle state and waits for a trigger. The digitizer acquires a waveform for each channel you enable with configure_vertical. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_InitiateAcquisition(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def probe_compensation_signal_start(self): - r"""probe_compensation_signal_start + r'''probe_compensation_signal_start Starts the 1 kHz square wave output on PFI 1 for probe compensation. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_ProbeCompensationSignalStart(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def probe_compensation_signal_stop(self): - r"""probe_compensation_signal_stop + r'''probe_compensation_signal_stop Stops the 1 kHz square wave output on PFI 1 for probe compensation. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_ProbeCompensationSignalStop(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def reset_device(self): - r"""reset_device + r'''reset_device Performs a hard reset of the device. Acquisition stops, all routes are released, RTSI and PFI lines are tristated, hardware is configured to @@ -6431,32 +5521,28 @@ def reset_device(self): state. - `Thermal Shutdown `__ - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_ResetDevice(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def reset_with_defaults(self): - r"""reset_with_defaults + r'''reset_with_defaults Performs a software reset of the device, returning it to the default state and applying any initial default settings from the IVI Configuration Store. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_ResetWithDefaults(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def send_software_trigger_edge(self, which_trigger): - r"""send_software_trigger_edge + r'''send_software_trigger_edge Sends the selected trigger to the digitizer. Call this method if you called configure_trigger_software when you want the Reference @@ -6476,23 +5562,17 @@ def send_software_trigger_edge(self, which_trigger): | WhichTrigger.REFERENCE (2L) | WhichTrigger.ADVANCE (3L) - """ + ''' if type(which_trigger) is not enums.WhichTrigger: - raise TypeError( - "Parameter which_trigger must be of type " + str(enums.WhichTrigger) - ) + raise TypeError('Parameter which_trigger must be of type ' + str(enums.WhichTrigger)) vi_ctype = _visatype.ViSession(self._vi) # case S110 which_trigger_ctype = _visatype.ViInt32(which_trigger.value) # case S130 - error_code = self._library.niScope_SendSoftwareTriggerEdge( - vi_ctype, which_trigger_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niScope_SendSoftwareTriggerEdge(vi_ctype, which_trigger_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def _close(self): - r"""_close + r'''_close When you are finished using an instrument driver session, you must call this method to perform the following actions: @@ -6500,17 +5580,15 @@ def _close(self): - Closes the instrument I/O session. - Destroys the IVI session and all of its properties. - Deallocates any memory resources used by the IVI session. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_close(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def self_test(self): - """self_test + '''self_test Runs the instrument self-test routine and returns the test result(s). Refer to the device-specific help topics for an explanation of the message contents. @@ -6527,7 +5605,7 @@ def self_test(self): +----------------+------------------+ | 1 | Self-test failed | +----------------+------------------+ - """ + ''' code, msg = self._self_test() if code: raise errors.SelfTestError(code, msg) @@ -6535,22 +5613,20 @@ def self_test(self): @ivi_synchronized def reset(self): - r"""reset + r'''reset Stops the acquisition, releases routes, and all session properties are reset to their `default states `__. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niScope_reset(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _self_test(self): - r"""_self_test + r'''_self_test Runs the instrument self-test routine and returns the test result(s). @@ -6568,20 +5644,13 @@ def _self_test(self): you must pass a ViChar array at least IVI_MAX_MESSAGE_BUF_SIZE bytes in length. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 self_test_result_ctype = _visatype.ViInt16() # case S220 self_test_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niScope_self_test( - vi_ctype, - None - if self_test_result_ctype is None - else (ctypes.pointer(self_test_result_ctype)), - self_test_message_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return int(self_test_result_ctype.value), self_test_message_ctype.value.decode( - self._encoding - ) + error_code = self._library.niScope_self_test(vi_ctype, None if self_test_result_ctype is None else (ctypes.pointer(self_test_result_ctype)), self_test_message_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return int(self_test_result_ctype.value), self_test_message_ctype.value.decode(self._encoding) + + + diff --git a/generated/niscope/niscope/unit_tests/_matchers.py b/generated/niscope/niscope/unit_tests/_matchers.py index b8169652b..e86b7201f 100644 --- a/generated/niscope/niscope/unit_tests/_matchers.py +++ b/generated/niscope/niscope/unit_tests/_matchers.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # This file was generated -"""Matcher classes used by unit tests in order to set mock expectations. +'''Matcher classes used by unit tests in order to set mock expectations. These work well with our visatype definitions. -""" +''' import ctypes import niscope._visatype as _visatype @@ -21,27 +21,15 @@ def __init__(self, expected_type, expected_value): def __eq__(self, other): if not isinstance(other, self.expected_type): - print( - "{0}: Unexpected type. Expected: {1}. Received: {2}".format( - self.__class__.__name__, self.expected_type, type(other) - ) - ) + print("{0}: Unexpected type. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_type, type(other))) return False if other.value != self.expected_value: - print( - "{0}: Unexpected value. Expected: {1}. Received: {2}".format( - self.__class__.__name__, self.expected_value, other.value - ) - ) + print("{0}: Unexpected value. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_value, other.value)) return False return True def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_type), - pp.pformat(self.expected_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) class _PointerMatcher(object): @@ -50,18 +38,12 @@ def __init__(self, expected_type): def __eq__(self, other): if not isinstance(other, ctypes.POINTER(self.expected_type)): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - ctypes.POINTER(self.expected_type), type(other) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(ctypes.POINTER(self.expected_type), type(other))) return False return True def __repr__(self): - return "{0}({1})".format( - self.__class__.__name__, pp.pformat(self.expected_type) - ) + return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_type)) class _BufferMatcher(object): @@ -88,47 +70,29 @@ def __eq__(self, other): pass # Because of object lifetimes, we may need to mock the other instance and provide lists instead of the actual array - if not isinstance(other, self.expected_type) and not isinstance( - other, list - ): - print( - "Unexpected type. Expected: {0} or {1}. Received: {2}".format( - self.expected_type, list, type(other) - ) - ) + if not isinstance(other, self.expected_type) and not isinstance(other, list): + print("Unexpected type. Expected: {0} or {1}. Received: {2}".format(self.expected_type, list, type(other))) return False if self.expected_size != len(other): - print( - "Unexpected length. Expected: {0}. Received: {1}".format( - self.expected_size, len(other) - ) - ) + print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(other))) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for i in range(0, len(self.expected_value)): if self.expected_value[i] != other[i]: - print( - "Unexpected value at index {0}. Expected: {1}. Received: {2}".format( - i, self.expected_value[i], other[i] - ) - ) + print("Unexpected value at index {0}. Expected: {1}. Received: {2}".format(i, self.expected_value[i], other[i])) return False return True def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self._expected_element_type), - pp.pformat(self._expected_size_or_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self._expected_element_type), pp.pformat(self._expected_size_or_value)) def __str__(self): - ret_str = self.__repr__() + "\n" - ret_str += " expected_type = " + str(self.expected_type) + "\n" - ret_str += " expected_value = " + str(self.expected_value) + "\n" - ret_str += " expected_size = " + str(self.expected_size) + "\n" + ret_str = self.__repr__() + '\n' + ret_str += ' expected_type = ' + str(self.expected_type) + '\n' + ret_str += ' expected_value = ' + str(self.expected_value) + '\n' + ret_str += ' expected_size = ' + str(self.expected_size) + '\n' return ret_str @@ -148,37 +112,21 @@ def __eq__(self, other): pass if not isinstance(other, ctypes.Array): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_type, type(other) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(other))) return False - if ( - len(other) < len(self.expected_string_value) + 1 - ): # +1 for NULL terminating character - print( - "Unexpected length in C string. Expected at least: {0}. Received {1}".format( - len(other), len(self.expected_string_value) + 1 - ) - ) + if len(other) < len(self.expected_string_value) + 1: # +1 for NULL terminating character + print("Unexpected length in C string. Expected at least: {0}. Received {1}".format(len(other), len(self.expected_string_value) + 1)) return False if not isinstance(other[0], bytes): print("Unexpected type. Not a string. Received: {0}".format(type(other[0]))) return False if other.value.decode("ascii") != self.expected_string_value: - print( - "Unexpected value. Expected {0}. Received: {1}".format( - self.expected_string_value, other.value.decode - ) - ) + print("Unexpected value. Expected {0}. Received: {1}".format(self.expected_string_value, other.value.decode)) return False return True def __repr__(self): - return "{0}({1})".format( - self.__class__.__name__, pp.pformat(self.expected_string_value) - ) + return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_string_value)) # Custom Type @@ -191,11 +139,7 @@ def _compare_ctype_structs(expected, actual): expected_val = getattr(expected, field_name) actual_val = getattr(actual, field_name) if expected_val != actual_val: - print( - "Unexpected value field {0}. Expected: {1}. Received: {2}".format( - field_name, expected_val, actual_val - ) - ) + print("Unexpected value field {0}. Expected: {1}. Received: {2}".format(field_name, expected_val, actual_val)) return False return True @@ -207,20 +151,12 @@ def __init__(self, expected_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_type, type(actual) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) return False return _compare_ctype_structs(self.expected_value, actual) def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_type), - pp.pformat(self.expected_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) class CustomTypeBufferMatcher(object): @@ -232,48 +168,30 @@ def __init__(self, expected_element_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print( - "Unexpected array type. Expected: {0}. Received: {1}".format( - self.expected_type, type(actual) - ) - ) + print("Unexpected array type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) return False if self.expected_size != len(actual): - print( - "Unexpected length. Expected: {0}. Received: {1}".format( - self.expected_size, len(actual) - ) - ) + print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(actual))) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for a, e in zip(actual, self.expected_value): if not isinstance(a, self.expected_element_type): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_element_type, type(a) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_element_type, type(a))) return False if not _compare_ctype_structs(e, a): return False return True def __repr__(self): - expected_val_repr = ( - "[" + ", ".join([x.__repr__() for x in self.expected_value]) + "]" - ) - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_element_type), - expected_val_repr, - ) + expected_val_repr = '[' + ', '.join([x.__repr__() for x in self.expected_value]) + ']' + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_element_type), expected_val_repr) def __str__(self): - ret_str = self.__repr__() + "\n" - ret_str += " expected_type = " + str(self.expected_type) + "\n" - ret_str += " expected_size = " + str(self.expected_size) + "\n" + ret_str = self.__repr__() + '\n' + ret_str += ' expected_type = ' + str(self.expected_type) + '\n' + ret_str += ' expected_size = ' + str(self.expected_size) + '\n' return ret_str @@ -282,9 +200,7 @@ def __str__(self): class ViBooleanMatcher(_ScalarMatcher): def __init__(self, expected_value): - _ScalarMatcher.__init__( - self, _visatype.ViBoolean, 1 if expected_value is True else 0 - ) + _ScalarMatcher.__init__(self, _visatype.ViBoolean, 1 if expected_value is True else 0) class ViSessionMatcher(_ScalarMatcher): @@ -396,3 +312,6 @@ def __init__(self, expected_size_or_value): class ViSessionBufferMatcher(_BufferMatcher): def __init__(self, expected_size_or_value): _BufferMatcher.__init__(self, _visatype.ViSession, expected_size_or_value) + + + diff --git a/generated/niscope/niscope/unit_tests/_mock_helper.py b/generated/niscope/niscope/unit_tests/_mock_helper.py index 88608ffe4..e6aa6eced 100644 --- a/generated/niscope/niscope/unit_tests/_mock_helper.py +++ b/generated/niscope/niscope/unit_tests/_mock_helper.py @@ -16,168 +16,168 @@ def __init__(self, function, param=None): class SideEffectsHelper(object): def __init__(self): self._defaults = {} - self._defaults["Abort"] = {} - self._defaults["Abort"]["return"] = 0 - self._defaults["AcquisitionStatus"] = {} - self._defaults["AcquisitionStatus"]["return"] = 0 - self._defaults["AcquisitionStatus"]["acquisitionStatus"] = None - self._defaults["ActualMeasWfmSize"] = {} - self._defaults["ActualMeasWfmSize"]["return"] = 0 - self._defaults["ActualMeasWfmSize"]["measWaveformSize"] = None - self._defaults["ActualNumWfms"] = {} - self._defaults["ActualNumWfms"]["return"] = 0 - self._defaults["ActualNumWfms"]["numWfms"] = None - self._defaults["AddWaveformProcessing"] = {} - self._defaults["AddWaveformProcessing"]["return"] = 0 - self._defaults["AutoSetup"] = {} - self._defaults["AutoSetup"]["return"] = 0 - self._defaults["CalFetchDate"] = {} - self._defaults["CalFetchDate"]["return"] = 0 - self._defaults["CalFetchDate"]["year"] = None - self._defaults["CalFetchDate"]["month"] = None - self._defaults["CalFetchDate"]["day"] = None - self._defaults["CalFetchTemperature"] = {} - self._defaults["CalFetchTemperature"]["return"] = 0 - self._defaults["CalFetchTemperature"]["temperature"] = None - self._defaults["CalSelfCalibrate"] = {} - self._defaults["CalSelfCalibrate"]["return"] = 0 - self._defaults["ClearWaveformMeasurementStats"] = {} - self._defaults["ClearWaveformMeasurementStats"]["return"] = 0 - self._defaults["ClearWaveformProcessing"] = {} - self._defaults["ClearWaveformProcessing"]["return"] = 0 - self._defaults["Commit"] = {} - self._defaults["Commit"]["return"] = 0 - self._defaults["ConfigureChanCharacteristics"] = {} - self._defaults["ConfigureChanCharacteristics"]["return"] = 0 - self._defaults["ConfigureEqualizationFilterCoefficients"] = {} - self._defaults["ConfigureEqualizationFilterCoefficients"]["return"] = 0 - self._defaults["ConfigureHorizontalTiming"] = {} - self._defaults["ConfigureHorizontalTiming"]["return"] = 0 - self._defaults["ConfigureRefLevels"] = {} - self._defaults["ConfigureRefLevels"]["return"] = 0 - self._defaults["ConfigureTriggerDigital"] = {} - self._defaults["ConfigureTriggerDigital"]["return"] = 0 - self._defaults["ConfigureTriggerEdge"] = {} - self._defaults["ConfigureTriggerEdge"]["return"] = 0 - self._defaults["ConfigureTriggerHysteresis"] = {} - self._defaults["ConfigureTriggerHysteresis"]["return"] = 0 - self._defaults["ConfigureTriggerImmediate"] = {} - self._defaults["ConfigureTriggerImmediate"]["return"] = 0 - self._defaults["ConfigureTriggerSoftware"] = {} - self._defaults["ConfigureTriggerSoftware"]["return"] = 0 - self._defaults["ConfigureTriggerVideo"] = {} - self._defaults["ConfigureTriggerVideo"]["return"] = 0 - self._defaults["ConfigureTriggerWindow"] = {} - self._defaults["ConfigureTriggerWindow"]["return"] = 0 - self._defaults["ConfigureVertical"] = {} - self._defaults["ConfigureVertical"]["return"] = 0 - self._defaults["Disable"] = {} - self._defaults["Disable"]["return"] = 0 - self._defaults["ExportAttributeConfigurationBuffer"] = {} - self._defaults["ExportAttributeConfigurationBuffer"]["return"] = 0 - self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] = None - self._defaults["ExportAttributeConfigurationFile"] = {} - self._defaults["ExportAttributeConfigurationFile"]["return"] = 0 - self._defaults["Fetch"] = {} - self._defaults["Fetch"]["return"] = 0 - self._defaults["Fetch"]["waveform"] = None - self._defaults["Fetch"]["wfmInfo"] = None - self._defaults["FetchArrayMeasurement"] = {} - self._defaults["FetchArrayMeasurement"]["return"] = 0 - self._defaults["FetchArrayMeasurement"]["measWfm"] = None - self._defaults["FetchArrayMeasurement"]["wfmInfo"] = None - self._defaults["FetchBinary16"] = {} - self._defaults["FetchBinary16"]["return"] = 0 - self._defaults["FetchBinary16"]["waveform"] = None - self._defaults["FetchBinary16"]["wfmInfo"] = None - self._defaults["FetchBinary32"] = {} - self._defaults["FetchBinary32"]["return"] = 0 - self._defaults["FetchBinary32"]["waveform"] = None - self._defaults["FetchBinary32"]["wfmInfo"] = None - self._defaults["FetchBinary8"] = {} - self._defaults["FetchBinary8"]["return"] = 0 - self._defaults["FetchBinary8"]["waveform"] = None - self._defaults["FetchBinary8"]["wfmInfo"] = None - self._defaults["FetchMeasurementStats"] = {} - self._defaults["FetchMeasurementStats"]["return"] = 0 - self._defaults["FetchMeasurementStats"]["result"] = None - self._defaults["FetchMeasurementStats"]["mean"] = None - self._defaults["FetchMeasurementStats"]["stdev"] = None - self._defaults["FetchMeasurementStats"]["min"] = None - self._defaults["FetchMeasurementStats"]["max"] = None - self._defaults["FetchMeasurementStats"]["numInStats"] = None - self._defaults["GetAttributeViBoolean"] = {} - self._defaults["GetAttributeViBoolean"]["return"] = 0 - self._defaults["GetAttributeViBoolean"]["value"] = None - self._defaults["GetAttributeViInt32"] = {} - self._defaults["GetAttributeViInt32"]["return"] = 0 - self._defaults["GetAttributeViInt32"]["value"] = None - self._defaults["GetAttributeViInt64"] = {} - self._defaults["GetAttributeViInt64"]["return"] = 0 - self._defaults["GetAttributeViInt64"]["value"] = None - self._defaults["GetAttributeViReal64"] = {} - self._defaults["GetAttributeViReal64"]["return"] = 0 - self._defaults["GetAttributeViReal64"]["value"] = None - self._defaults["GetAttributeViString"] = {} - self._defaults["GetAttributeViString"]["return"] = 0 - self._defaults["GetAttributeViString"]["value"] = None - self._defaults["GetEqualizationFilterCoefficients"] = {} - self._defaults["GetEqualizationFilterCoefficients"]["return"] = 0 - self._defaults["GetEqualizationFilterCoefficients"]["coefficients"] = None - self._defaults["GetError"] = {} - self._defaults["GetError"]["return"] = 0 - self._defaults["GetError"]["errorCode"] = None - self._defaults["GetError"]["description"] = None - self._defaults["ImportAttributeConfigurationBuffer"] = {} - self._defaults["ImportAttributeConfigurationBuffer"]["return"] = 0 - self._defaults["ImportAttributeConfigurationFile"] = {} - self._defaults["ImportAttributeConfigurationFile"]["return"] = 0 - self._defaults["InitWithOptions"] = {} - self._defaults["InitWithOptions"]["return"] = 0 - self._defaults["InitWithOptions"]["vi"] = None - self._defaults["InitiateAcquisition"] = {} - self._defaults["InitiateAcquisition"]["return"] = 0 - self._defaults["LockSession"] = {} - self._defaults["LockSession"]["return"] = 0 - self._defaults["LockSession"]["callerHasLock"] = None - self._defaults["ProbeCompensationSignalStart"] = {} - self._defaults["ProbeCompensationSignalStart"]["return"] = 0 - self._defaults["ProbeCompensationSignalStop"] = {} - self._defaults["ProbeCompensationSignalStop"]["return"] = 0 - self._defaults["Read"] = {} - self._defaults["Read"]["return"] = 0 - self._defaults["Read"]["waveform"] = None - self._defaults["Read"]["wfmInfo"] = None - self._defaults["ResetDevice"] = {} - self._defaults["ResetDevice"]["return"] = 0 - self._defaults["ResetWithDefaults"] = {} - self._defaults["ResetWithDefaults"]["return"] = 0 - self._defaults["SendSoftwareTriggerEdge"] = {} - self._defaults["SendSoftwareTriggerEdge"]["return"] = 0 - self._defaults["SetAttributeViBoolean"] = {} - self._defaults["SetAttributeViBoolean"]["return"] = 0 - self._defaults["SetAttributeViInt32"] = {} - self._defaults["SetAttributeViInt32"]["return"] = 0 - self._defaults["SetAttributeViInt64"] = {} - self._defaults["SetAttributeViInt64"]["return"] = 0 - self._defaults["SetAttributeViReal64"] = {} - self._defaults["SetAttributeViReal64"]["return"] = 0 - self._defaults["SetAttributeViString"] = {} - self._defaults["SetAttributeViString"]["return"] = 0 - self._defaults["UnlockSession"] = {} - self._defaults["UnlockSession"]["return"] = 0 - self._defaults["UnlockSession"]["callerHasLock"] = None - self._defaults["close"] = {} - self._defaults["close"]["return"] = 0 - self._defaults["error_message"] = {} - self._defaults["error_message"]["return"] = 0 - self._defaults["error_message"]["errorMessage"] = None - self._defaults["reset"] = {} - self._defaults["reset"]["return"] = 0 - self._defaults["self_test"] = {} - self._defaults["self_test"]["return"] = 0 - self._defaults["self_test"]["selfTestResult"] = None - self._defaults["self_test"]["selfTestMessage"] = None + self._defaults['Abort'] = {} + self._defaults['Abort']['return'] = 0 + self._defaults['AcquisitionStatus'] = {} + self._defaults['AcquisitionStatus']['return'] = 0 + self._defaults['AcquisitionStatus']['acquisitionStatus'] = None + self._defaults['ActualMeasWfmSize'] = {} + self._defaults['ActualMeasWfmSize']['return'] = 0 + self._defaults['ActualMeasWfmSize']['measWaveformSize'] = None + self._defaults['ActualNumWfms'] = {} + self._defaults['ActualNumWfms']['return'] = 0 + self._defaults['ActualNumWfms']['numWfms'] = None + self._defaults['AddWaveformProcessing'] = {} + self._defaults['AddWaveformProcessing']['return'] = 0 + self._defaults['AutoSetup'] = {} + self._defaults['AutoSetup']['return'] = 0 + self._defaults['CalFetchDate'] = {} + self._defaults['CalFetchDate']['return'] = 0 + self._defaults['CalFetchDate']['year'] = None + self._defaults['CalFetchDate']['month'] = None + self._defaults['CalFetchDate']['day'] = None + self._defaults['CalFetchTemperature'] = {} + self._defaults['CalFetchTemperature']['return'] = 0 + self._defaults['CalFetchTemperature']['temperature'] = None + self._defaults['CalSelfCalibrate'] = {} + self._defaults['CalSelfCalibrate']['return'] = 0 + self._defaults['ClearWaveformMeasurementStats'] = {} + self._defaults['ClearWaveformMeasurementStats']['return'] = 0 + self._defaults['ClearWaveformProcessing'] = {} + self._defaults['ClearWaveformProcessing']['return'] = 0 + self._defaults['Commit'] = {} + self._defaults['Commit']['return'] = 0 + self._defaults['ConfigureChanCharacteristics'] = {} + self._defaults['ConfigureChanCharacteristics']['return'] = 0 + self._defaults['ConfigureEqualizationFilterCoefficients'] = {} + self._defaults['ConfigureEqualizationFilterCoefficients']['return'] = 0 + self._defaults['ConfigureHorizontalTiming'] = {} + self._defaults['ConfigureHorizontalTiming']['return'] = 0 + self._defaults['ConfigureRefLevels'] = {} + self._defaults['ConfigureRefLevels']['return'] = 0 + self._defaults['ConfigureTriggerDigital'] = {} + self._defaults['ConfigureTriggerDigital']['return'] = 0 + self._defaults['ConfigureTriggerEdge'] = {} + self._defaults['ConfigureTriggerEdge']['return'] = 0 + self._defaults['ConfigureTriggerHysteresis'] = {} + self._defaults['ConfigureTriggerHysteresis']['return'] = 0 + self._defaults['ConfigureTriggerImmediate'] = {} + self._defaults['ConfigureTriggerImmediate']['return'] = 0 + self._defaults['ConfigureTriggerSoftware'] = {} + self._defaults['ConfigureTriggerSoftware']['return'] = 0 + self._defaults['ConfigureTriggerVideo'] = {} + self._defaults['ConfigureTriggerVideo']['return'] = 0 + self._defaults['ConfigureTriggerWindow'] = {} + self._defaults['ConfigureTriggerWindow']['return'] = 0 + self._defaults['ConfigureVertical'] = {} + self._defaults['ConfigureVertical']['return'] = 0 + self._defaults['Disable'] = {} + self._defaults['Disable']['return'] = 0 + self._defaults['ExportAttributeConfigurationBuffer'] = {} + self._defaults['ExportAttributeConfigurationBuffer']['return'] = 0 + self._defaults['ExportAttributeConfigurationBuffer']['configuration'] = None + self._defaults['ExportAttributeConfigurationFile'] = {} + self._defaults['ExportAttributeConfigurationFile']['return'] = 0 + self._defaults['Fetch'] = {} + self._defaults['Fetch']['return'] = 0 + self._defaults['Fetch']['waveform'] = None + self._defaults['Fetch']['wfmInfo'] = None + self._defaults['FetchArrayMeasurement'] = {} + self._defaults['FetchArrayMeasurement']['return'] = 0 + self._defaults['FetchArrayMeasurement']['measWfm'] = None + self._defaults['FetchArrayMeasurement']['wfmInfo'] = None + self._defaults['FetchBinary16'] = {} + self._defaults['FetchBinary16']['return'] = 0 + self._defaults['FetchBinary16']['waveform'] = None + self._defaults['FetchBinary16']['wfmInfo'] = None + self._defaults['FetchBinary32'] = {} + self._defaults['FetchBinary32']['return'] = 0 + self._defaults['FetchBinary32']['waveform'] = None + self._defaults['FetchBinary32']['wfmInfo'] = None + self._defaults['FetchBinary8'] = {} + self._defaults['FetchBinary8']['return'] = 0 + self._defaults['FetchBinary8']['waveform'] = None + self._defaults['FetchBinary8']['wfmInfo'] = None + self._defaults['FetchMeasurementStats'] = {} + self._defaults['FetchMeasurementStats']['return'] = 0 + self._defaults['FetchMeasurementStats']['result'] = None + self._defaults['FetchMeasurementStats']['mean'] = None + self._defaults['FetchMeasurementStats']['stdev'] = None + self._defaults['FetchMeasurementStats']['min'] = None + self._defaults['FetchMeasurementStats']['max'] = None + self._defaults['FetchMeasurementStats']['numInStats'] = None + self._defaults['GetAttributeViBoolean'] = {} + self._defaults['GetAttributeViBoolean']['return'] = 0 + self._defaults['GetAttributeViBoolean']['value'] = None + self._defaults['GetAttributeViInt32'] = {} + self._defaults['GetAttributeViInt32']['return'] = 0 + self._defaults['GetAttributeViInt32']['value'] = None + self._defaults['GetAttributeViInt64'] = {} + self._defaults['GetAttributeViInt64']['return'] = 0 + self._defaults['GetAttributeViInt64']['value'] = None + self._defaults['GetAttributeViReal64'] = {} + self._defaults['GetAttributeViReal64']['return'] = 0 + self._defaults['GetAttributeViReal64']['value'] = None + self._defaults['GetAttributeViString'] = {} + self._defaults['GetAttributeViString']['return'] = 0 + self._defaults['GetAttributeViString']['value'] = None + self._defaults['GetEqualizationFilterCoefficients'] = {} + self._defaults['GetEqualizationFilterCoefficients']['return'] = 0 + self._defaults['GetEqualizationFilterCoefficients']['coefficients'] = None + self._defaults['GetError'] = {} + self._defaults['GetError']['return'] = 0 + self._defaults['GetError']['errorCode'] = None + self._defaults['GetError']['description'] = None + self._defaults['ImportAttributeConfigurationBuffer'] = {} + self._defaults['ImportAttributeConfigurationBuffer']['return'] = 0 + self._defaults['ImportAttributeConfigurationFile'] = {} + self._defaults['ImportAttributeConfigurationFile']['return'] = 0 + self._defaults['InitWithOptions'] = {} + self._defaults['InitWithOptions']['return'] = 0 + self._defaults['InitWithOptions']['vi'] = None + self._defaults['InitiateAcquisition'] = {} + self._defaults['InitiateAcquisition']['return'] = 0 + self._defaults['LockSession'] = {} + self._defaults['LockSession']['return'] = 0 + self._defaults['LockSession']['callerHasLock'] = None + self._defaults['ProbeCompensationSignalStart'] = {} + self._defaults['ProbeCompensationSignalStart']['return'] = 0 + self._defaults['ProbeCompensationSignalStop'] = {} + self._defaults['ProbeCompensationSignalStop']['return'] = 0 + self._defaults['Read'] = {} + self._defaults['Read']['return'] = 0 + self._defaults['Read']['waveform'] = None + self._defaults['Read']['wfmInfo'] = None + self._defaults['ResetDevice'] = {} + self._defaults['ResetDevice']['return'] = 0 + self._defaults['ResetWithDefaults'] = {} + self._defaults['ResetWithDefaults']['return'] = 0 + self._defaults['SendSoftwareTriggerEdge'] = {} + self._defaults['SendSoftwareTriggerEdge']['return'] = 0 + self._defaults['SetAttributeViBoolean'] = {} + self._defaults['SetAttributeViBoolean']['return'] = 0 + self._defaults['SetAttributeViInt32'] = {} + self._defaults['SetAttributeViInt32']['return'] = 0 + self._defaults['SetAttributeViInt64'] = {} + self._defaults['SetAttributeViInt64']['return'] = 0 + self._defaults['SetAttributeViReal64'] = {} + self._defaults['SetAttributeViReal64']['return'] = 0 + self._defaults['SetAttributeViString'] = {} + self._defaults['SetAttributeViString']['return'] = 0 + self._defaults['UnlockSession'] = {} + self._defaults['UnlockSession']['return'] = 0 + self._defaults['UnlockSession']['callerHasLock'] = None + self._defaults['close'] = {} + self._defaults['close']['return'] = 0 + self._defaults['error_message'] = {} + self._defaults['error_message']['return'] = 0 + self._defaults['error_message']['errorMessage'] = None + self._defaults['reset'] = {} + self._defaults['reset']['return'] = 0 + self._defaults['self_test'] = {} + self._defaults['self_test']['return'] = 0 + self._defaults['self_test']['selfTestResult'] = None + self._defaults['self_test']['selfTestMessage'] = None def __getitem__(self, func): return self._defaults[func] @@ -186,275 +186,192 @@ def __setitem__(self, func, val): self._defaults[func] = val def niScope_Abort(self, vi): # noqa: N802 - if self._defaults["Abort"]["return"] != 0: - return self._defaults["Abort"]["return"] - return self._defaults["Abort"]["return"] + if self._defaults['Abort']['return'] != 0: + return self._defaults['Abort']['return'] + return self._defaults['Abort']['return'] def niScope_AcquisitionStatus(self, vi, acquisition_status): # noqa: N802 - if self._defaults["AcquisitionStatus"]["return"] != 0: - return self._defaults["AcquisitionStatus"]["return"] + if self._defaults['AcquisitionStatus']['return'] != 0: + return self._defaults['AcquisitionStatus']['return'] # acquisition_status - if self._defaults["AcquisitionStatus"]["acquisitionStatus"] is None: - raise MockFunctionCallError( - "niScope_AcquisitionStatus", param="acquisitionStatus" - ) + if self._defaults['AcquisitionStatus']['acquisitionStatus'] is None: + raise MockFunctionCallError("niScope_AcquisitionStatus", param='acquisitionStatus') if acquisition_status is not None: - acquisition_status.contents.value = self._defaults["AcquisitionStatus"][ - "acquisitionStatus" - ] - return self._defaults["AcquisitionStatus"]["return"] - - def niScope_ActualMeasWfmSize( - self, vi, array_meas_function, meas_waveform_size - ): # noqa: N802 - if self._defaults["ActualMeasWfmSize"]["return"] != 0: - return self._defaults["ActualMeasWfmSize"]["return"] + acquisition_status.contents.value = self._defaults['AcquisitionStatus']['acquisitionStatus'] + return self._defaults['AcquisitionStatus']['return'] + + def niScope_ActualMeasWfmSize(self, vi, array_meas_function, meas_waveform_size): # noqa: N802 + if self._defaults['ActualMeasWfmSize']['return'] != 0: + return self._defaults['ActualMeasWfmSize']['return'] # meas_waveform_size - if self._defaults["ActualMeasWfmSize"]["measWaveformSize"] is None: - raise MockFunctionCallError( - "niScope_ActualMeasWfmSize", param="measWaveformSize" - ) + if self._defaults['ActualMeasWfmSize']['measWaveformSize'] is None: + raise MockFunctionCallError("niScope_ActualMeasWfmSize", param='measWaveformSize') if meas_waveform_size is not None: - meas_waveform_size.contents.value = self._defaults["ActualMeasWfmSize"][ - "measWaveformSize" - ] - return self._defaults["ActualMeasWfmSize"]["return"] + meas_waveform_size.contents.value = self._defaults['ActualMeasWfmSize']['measWaveformSize'] + return self._defaults['ActualMeasWfmSize']['return'] def niScope_ActualNumWfms(self, vi, channel_list, num_wfms): # noqa: N802 - if self._defaults["ActualNumWfms"]["return"] != 0: - return self._defaults["ActualNumWfms"]["return"] + if self._defaults['ActualNumWfms']['return'] != 0: + return self._defaults['ActualNumWfms']['return'] # num_wfms - if self._defaults["ActualNumWfms"]["numWfms"] is None: - raise MockFunctionCallError("niScope_ActualNumWfms", param="numWfms") + if self._defaults['ActualNumWfms']['numWfms'] is None: + raise MockFunctionCallError("niScope_ActualNumWfms", param='numWfms') if num_wfms is not None: - num_wfms.contents.value = self._defaults["ActualNumWfms"]["numWfms"] - return self._defaults["ActualNumWfms"]["return"] + num_wfms.contents.value = self._defaults['ActualNumWfms']['numWfms'] + return self._defaults['ActualNumWfms']['return'] - def niScope_AddWaveformProcessing( - self, vi, channel_list, meas_function - ): # noqa: N802 - if self._defaults["AddWaveformProcessing"]["return"] != 0: - return self._defaults["AddWaveformProcessing"]["return"] - return self._defaults["AddWaveformProcessing"]["return"] + def niScope_AddWaveformProcessing(self, vi, channel_list, meas_function): # noqa: N802 + if self._defaults['AddWaveformProcessing']['return'] != 0: + return self._defaults['AddWaveformProcessing']['return'] + return self._defaults['AddWaveformProcessing']['return'] def niScope_AutoSetup(self, vi): # noqa: N802 - if self._defaults["AutoSetup"]["return"] != 0: - return self._defaults["AutoSetup"]["return"] - return self._defaults["AutoSetup"]["return"] + if self._defaults['AutoSetup']['return'] != 0: + return self._defaults['AutoSetup']['return'] + return self._defaults['AutoSetup']['return'] def niScope_CalFetchDate(self, vi, which_one, year, month, day): # noqa: N802 - if self._defaults["CalFetchDate"]["return"] != 0: - return self._defaults["CalFetchDate"]["return"] + if self._defaults['CalFetchDate']['return'] != 0: + return self._defaults['CalFetchDate']['return'] # year - if self._defaults["CalFetchDate"]["year"] is None: - raise MockFunctionCallError("niScope_CalFetchDate", param="year") + if self._defaults['CalFetchDate']['year'] is None: + raise MockFunctionCallError("niScope_CalFetchDate", param='year') if year is not None: - year.contents.value = self._defaults["CalFetchDate"]["year"] + year.contents.value = self._defaults['CalFetchDate']['year'] # month - if self._defaults["CalFetchDate"]["month"] is None: - raise MockFunctionCallError("niScope_CalFetchDate", param="month") + if self._defaults['CalFetchDate']['month'] is None: + raise MockFunctionCallError("niScope_CalFetchDate", param='month') if month is not None: - month.contents.value = self._defaults["CalFetchDate"]["month"] + month.contents.value = self._defaults['CalFetchDate']['month'] # day - if self._defaults["CalFetchDate"]["day"] is None: - raise MockFunctionCallError("niScope_CalFetchDate", param="day") + if self._defaults['CalFetchDate']['day'] is None: + raise MockFunctionCallError("niScope_CalFetchDate", param='day') if day is not None: - day.contents.value = self._defaults["CalFetchDate"]["day"] - return self._defaults["CalFetchDate"]["return"] + day.contents.value = self._defaults['CalFetchDate']['day'] + return self._defaults['CalFetchDate']['return'] def niScope_CalFetchTemperature(self, vi, which_one, temperature): # noqa: N802 - if self._defaults["CalFetchTemperature"]["return"] != 0: - return self._defaults["CalFetchTemperature"]["return"] + if self._defaults['CalFetchTemperature']['return'] != 0: + return self._defaults['CalFetchTemperature']['return'] # temperature - if self._defaults["CalFetchTemperature"]["temperature"] is None: - raise MockFunctionCallError( - "niScope_CalFetchTemperature", param="temperature" - ) + if self._defaults['CalFetchTemperature']['temperature'] is None: + raise MockFunctionCallError("niScope_CalFetchTemperature", param='temperature') if temperature is not None: - temperature.contents.value = self._defaults["CalFetchTemperature"][ - "temperature" - ] - return self._defaults["CalFetchTemperature"]["return"] + temperature.contents.value = self._defaults['CalFetchTemperature']['temperature'] + return self._defaults['CalFetchTemperature']['return'] def niScope_CalSelfCalibrate(self, vi, channel_list, option): # noqa: N802 - if self._defaults["CalSelfCalibrate"]["return"] != 0: - return self._defaults["CalSelfCalibrate"]["return"] - return self._defaults["CalSelfCalibrate"]["return"] + if self._defaults['CalSelfCalibrate']['return'] != 0: + return self._defaults['CalSelfCalibrate']['return'] + return self._defaults['CalSelfCalibrate']['return'] - def niScope_ClearWaveformMeasurementStats( - self, vi, channel_list, clearable_measurement_function - ): # noqa: N802 - if self._defaults["ClearWaveformMeasurementStats"]["return"] != 0: - return self._defaults["ClearWaveformMeasurementStats"]["return"] - return self._defaults["ClearWaveformMeasurementStats"]["return"] + def niScope_ClearWaveformMeasurementStats(self, vi, channel_list, clearable_measurement_function): # noqa: N802 + if self._defaults['ClearWaveformMeasurementStats']['return'] != 0: + return self._defaults['ClearWaveformMeasurementStats']['return'] + return self._defaults['ClearWaveformMeasurementStats']['return'] def niScope_ClearWaveformProcessing(self, vi, channel_list): # noqa: N802 - if self._defaults["ClearWaveformProcessing"]["return"] != 0: - return self._defaults["ClearWaveformProcessing"]["return"] - return self._defaults["ClearWaveformProcessing"]["return"] + if self._defaults['ClearWaveformProcessing']['return'] != 0: + return self._defaults['ClearWaveformProcessing']['return'] + return self._defaults['ClearWaveformProcessing']['return'] def niScope_Commit(self, vi): # noqa: N802 - if self._defaults["Commit"]["return"] != 0: - return self._defaults["Commit"]["return"] - return self._defaults["Commit"]["return"] - - def niScope_ConfigureChanCharacteristics( - self, vi, channel_list, input_impedance, max_input_frequency - ): # noqa: N802 - if self._defaults["ConfigureChanCharacteristics"]["return"] != 0: - return self._defaults["ConfigureChanCharacteristics"]["return"] - return self._defaults["ConfigureChanCharacteristics"]["return"] - - def niScope_ConfigureEqualizationFilterCoefficients( - self, vi, channel_list, number_of_coefficients, coefficients - ): # noqa: N802 - if self._defaults["ConfigureEqualizationFilterCoefficients"]["return"] != 0: - return self._defaults["ConfigureEqualizationFilterCoefficients"]["return"] - return self._defaults["ConfigureEqualizationFilterCoefficients"]["return"] - - def niScope_ConfigureHorizontalTiming( - self, - vi, - min_sample_rate, - min_num_pts, - ref_position, - num_records, - enforce_realtime, - ): # noqa: N802 - if self._defaults["ConfigureHorizontalTiming"]["return"] != 0: - return self._defaults["ConfigureHorizontalTiming"]["return"] - return self._defaults["ConfigureHorizontalTiming"]["return"] + if self._defaults['Commit']['return'] != 0: + return self._defaults['Commit']['return'] + return self._defaults['Commit']['return'] + + def niScope_ConfigureChanCharacteristics(self, vi, channel_list, input_impedance, max_input_frequency): # noqa: N802 + if self._defaults['ConfigureChanCharacteristics']['return'] != 0: + return self._defaults['ConfigureChanCharacteristics']['return'] + return self._defaults['ConfigureChanCharacteristics']['return'] + + def niScope_ConfigureEqualizationFilterCoefficients(self, vi, channel_list, number_of_coefficients, coefficients): # noqa: N802 + if self._defaults['ConfigureEqualizationFilterCoefficients']['return'] != 0: + return self._defaults['ConfigureEqualizationFilterCoefficients']['return'] + return self._defaults['ConfigureEqualizationFilterCoefficients']['return'] + + def niScope_ConfigureHorizontalTiming(self, vi, min_sample_rate, min_num_pts, ref_position, num_records, enforce_realtime): # noqa: N802 + if self._defaults['ConfigureHorizontalTiming']['return'] != 0: + return self._defaults['ConfigureHorizontalTiming']['return'] + return self._defaults['ConfigureHorizontalTiming']['return'] def niScope_ConfigureRefLevels(self, vi, low, mid, high): # noqa: N802 - if self._defaults["ConfigureRefLevels"]["return"] != 0: - return self._defaults["ConfigureRefLevels"]["return"] - return self._defaults["ConfigureRefLevels"]["return"] - - def niScope_ConfigureTriggerDigital( - self, vi, trigger_source, slope, holdoff, delay - ): # noqa: N802 - if self._defaults["ConfigureTriggerDigital"]["return"] != 0: - return self._defaults["ConfigureTriggerDigital"]["return"] - return self._defaults["ConfigureTriggerDigital"]["return"] - - def niScope_ConfigureTriggerEdge( - self, vi, trigger_source, level, slope, trigger_coupling, holdoff, delay - ): # noqa: N802 - if self._defaults["ConfigureTriggerEdge"]["return"] != 0: - return self._defaults["ConfigureTriggerEdge"]["return"] - return self._defaults["ConfigureTriggerEdge"]["return"] - - def niScope_ConfigureTriggerHysteresis( - self, - vi, - trigger_source, - level, - hysteresis, - slope, - trigger_coupling, - holdoff, - delay, - ): # noqa: N802 - if self._defaults["ConfigureTriggerHysteresis"]["return"] != 0: - return self._defaults["ConfigureTriggerHysteresis"]["return"] - return self._defaults["ConfigureTriggerHysteresis"]["return"] + if self._defaults['ConfigureRefLevels']['return'] != 0: + return self._defaults['ConfigureRefLevels']['return'] + return self._defaults['ConfigureRefLevels']['return'] + + def niScope_ConfigureTriggerDigital(self, vi, trigger_source, slope, holdoff, delay): # noqa: N802 + if self._defaults['ConfigureTriggerDigital']['return'] != 0: + return self._defaults['ConfigureTriggerDigital']['return'] + return self._defaults['ConfigureTriggerDigital']['return'] + + def niScope_ConfigureTriggerEdge(self, vi, trigger_source, level, slope, trigger_coupling, holdoff, delay): # noqa: N802 + if self._defaults['ConfigureTriggerEdge']['return'] != 0: + return self._defaults['ConfigureTriggerEdge']['return'] + return self._defaults['ConfigureTriggerEdge']['return'] + + def niScope_ConfigureTriggerHysteresis(self, vi, trigger_source, level, hysteresis, slope, trigger_coupling, holdoff, delay): # noqa: N802 + if self._defaults['ConfigureTriggerHysteresis']['return'] != 0: + return self._defaults['ConfigureTriggerHysteresis']['return'] + return self._defaults['ConfigureTriggerHysteresis']['return'] def niScope_ConfigureTriggerImmediate(self, vi): # noqa: N802 - if self._defaults["ConfigureTriggerImmediate"]["return"] != 0: - return self._defaults["ConfigureTriggerImmediate"]["return"] - return self._defaults["ConfigureTriggerImmediate"]["return"] + if self._defaults['ConfigureTriggerImmediate']['return'] != 0: + return self._defaults['ConfigureTriggerImmediate']['return'] + return self._defaults['ConfigureTriggerImmediate']['return'] def niScope_ConfigureTriggerSoftware(self, vi, holdoff, delay): # noqa: N802 - if self._defaults["ConfigureTriggerSoftware"]["return"] != 0: - return self._defaults["ConfigureTriggerSoftware"]["return"] - return self._defaults["ConfigureTriggerSoftware"]["return"] - - def niScope_ConfigureTriggerVideo( - self, - vi, - trigger_source, - enable_dc_restore, - signal_format, - event, - line_number, - polarity, - trigger_coupling, - holdoff, - delay, - ): # noqa: N802 - if self._defaults["ConfigureTriggerVideo"]["return"] != 0: - return self._defaults["ConfigureTriggerVideo"]["return"] - return self._defaults["ConfigureTriggerVideo"]["return"] - - def niScope_ConfigureTriggerWindow( - self, - vi, - trigger_source, - low_level, - high_level, - window_mode, - trigger_coupling, - holdoff, - delay, - ): # noqa: N802 - if self._defaults["ConfigureTriggerWindow"]["return"] != 0: - return self._defaults["ConfigureTriggerWindow"]["return"] - return self._defaults["ConfigureTriggerWindow"]["return"] - - def niScope_ConfigureVertical( - self, vi, channel_list, range, offset, coupling, probe_attenuation, enabled - ): # noqa: N802 - if self._defaults["ConfigureVertical"]["return"] != 0: - return self._defaults["ConfigureVertical"]["return"] - return self._defaults["ConfigureVertical"]["return"] + if self._defaults['ConfigureTriggerSoftware']['return'] != 0: + return self._defaults['ConfigureTriggerSoftware']['return'] + return self._defaults['ConfigureTriggerSoftware']['return'] + + def niScope_ConfigureTriggerVideo(self, vi, trigger_source, enable_dc_restore, signal_format, event, line_number, polarity, trigger_coupling, holdoff, delay): # noqa: N802 + if self._defaults['ConfigureTriggerVideo']['return'] != 0: + return self._defaults['ConfigureTriggerVideo']['return'] + return self._defaults['ConfigureTriggerVideo']['return'] + + def niScope_ConfigureTriggerWindow(self, vi, trigger_source, low_level, high_level, window_mode, trigger_coupling, holdoff, delay): # noqa: N802 + if self._defaults['ConfigureTriggerWindow']['return'] != 0: + return self._defaults['ConfigureTriggerWindow']['return'] + return self._defaults['ConfigureTriggerWindow']['return'] + + def niScope_ConfigureVertical(self, vi, channel_list, range, offset, coupling, probe_attenuation, enabled): # noqa: N802 + if self._defaults['ConfigureVertical']['return'] != 0: + return self._defaults['ConfigureVertical']['return'] + return self._defaults['ConfigureVertical']['return'] def niScope_Disable(self, vi): # noqa: N802 - if self._defaults["Disable"]["return"] != 0: - return self._defaults["Disable"]["return"] - return self._defaults["Disable"]["return"] - - def niScope_ExportAttributeConfigurationBuffer( - self, vi, size_in_bytes, configuration - ): # noqa: N802 - if self._defaults["ExportAttributeConfigurationBuffer"]["return"] != 0: - return self._defaults["ExportAttributeConfigurationBuffer"]["return"] - if ( - self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] - is None - ): - raise MockFunctionCallError( - "niScope_ExportAttributeConfigurationBuffer", param="configuration" - ) + if self._defaults['Disable']['return'] != 0: + return self._defaults['Disable']['return'] + return self._defaults['Disable']['return'] + + def niScope_ExportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 + if self._defaults['ExportAttributeConfigurationBuffer']['return'] != 0: + return self._defaults['ExportAttributeConfigurationBuffer']['return'] + if self._defaults['ExportAttributeConfigurationBuffer']['configuration'] is None: + raise MockFunctionCallError("niScope_ExportAttributeConfigurationBuffer", param='configuration') if size_in_bytes.value == 0: - return len( - self._defaults["ExportAttributeConfigurationBuffer"]["configuration"] - ) + return len(self._defaults['ExportAttributeConfigurationBuffer']['configuration']) try: configuration_ref = configuration.contents except AttributeError: configuration_ref = configuration - for i in range( - len(self._defaults["ExportAttributeConfigurationBuffer"]["configuration"]) - ): - configuration_ref[i] = self._defaults["ExportAttributeConfigurationBuffer"][ - "configuration" - ][i] - return self._defaults["ExportAttributeConfigurationBuffer"]["return"] + for i in range(len(self._defaults['ExportAttributeConfigurationBuffer']['configuration'])): + configuration_ref[i] = self._defaults['ExportAttributeConfigurationBuffer']['configuration'][i] + return self._defaults['ExportAttributeConfigurationBuffer']['return'] def niScope_ExportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 - if self._defaults["ExportAttributeConfigurationFile"]["return"] != 0: - return self._defaults["ExportAttributeConfigurationFile"]["return"] - return self._defaults["ExportAttributeConfigurationFile"]["return"] - - def niScope_Fetch( - self, vi, channel_list, timeout, num_samples, waveform, wfm_info - ): # noqa: N802 - if self._defaults["Fetch"]["return"] != 0: - return self._defaults["Fetch"]["return"] + if self._defaults['ExportAttributeConfigurationFile']['return'] != 0: + return self._defaults['ExportAttributeConfigurationFile']['return'] + return self._defaults['ExportAttributeConfigurationFile']['return'] + + def niScope_Fetch(self, vi, channel_list, timeout, num_samples, waveform, wfm_info): # noqa: N802 + if self._defaults['Fetch']['return'] != 0: + return self._defaults['Fetch']['return'] # waveform - if self._defaults["Fetch"]["waveform"] is None: - raise MockFunctionCallError("niScope_Fetch", param="waveform") - test_value = self._defaults["Fetch"]["waveform"] + if self._defaults['Fetch']['waveform'] is None: + raise MockFunctionCallError("niScope_Fetch", param='waveform') + test_value = self._defaults['Fetch']['waveform'] try: waveform_ref = waveform.contents except AttributeError: @@ -463,9 +380,9 @@ def niScope_Fetch( for i in range(len(test_value)): waveform_ref[i] = test_value[i] # wfm_info - if self._defaults["Fetch"]["wfmInfo"] is None: - raise MockFunctionCallError("niScope_Fetch", param="wfmInfo") - test_value = self._defaults["Fetch"]["wfmInfo"] + if self._defaults['Fetch']['wfmInfo'] is None: + raise MockFunctionCallError("niScope_Fetch", param='wfmInfo') + test_value = self._defaults['Fetch']['wfmInfo'] try: wfm_info_ref = wfm_info.contents except AttributeError: @@ -473,26 +390,15 @@ def niScope_Fetch( assert len(wfm_info_ref) >= len(test_value) for i in range(len(test_value)): wfm_info_ref[i] = test_value[i] - return self._defaults["Fetch"]["return"] - - def niScope_FetchArrayMeasurement( - self, - vi, - channel_list, - timeout, - array_meas_function, - measurement_waveform_size, - meas_wfm, - wfm_info, - ): # noqa: N802 - if self._defaults["FetchArrayMeasurement"]["return"] != 0: - return self._defaults["FetchArrayMeasurement"]["return"] + return self._defaults['Fetch']['return'] + + def niScope_FetchArrayMeasurement(self, vi, channel_list, timeout, array_meas_function, measurement_waveform_size, meas_wfm, wfm_info): # noqa: N802 + if self._defaults['FetchArrayMeasurement']['return'] != 0: + return self._defaults['FetchArrayMeasurement']['return'] # meas_wfm - if self._defaults["FetchArrayMeasurement"]["measWfm"] is None: - raise MockFunctionCallError( - "niScope_FetchArrayMeasurement", param="measWfm" - ) - test_value = self._defaults["FetchArrayMeasurement"]["measWfm"] + if self._defaults['FetchArrayMeasurement']['measWfm'] is None: + raise MockFunctionCallError("niScope_FetchArrayMeasurement", param='measWfm') + test_value = self._defaults['FetchArrayMeasurement']['measWfm'] try: meas_wfm_ref = meas_wfm.contents except AttributeError: @@ -501,11 +407,9 @@ def niScope_FetchArrayMeasurement( for i in range(len(test_value)): meas_wfm_ref[i] = test_value[i] # wfm_info - if self._defaults["FetchArrayMeasurement"]["wfmInfo"] is None: - raise MockFunctionCallError( - "niScope_FetchArrayMeasurement", param="wfmInfo" - ) - test_value = self._defaults["FetchArrayMeasurement"]["wfmInfo"] + if self._defaults['FetchArrayMeasurement']['wfmInfo'] is None: + raise MockFunctionCallError("niScope_FetchArrayMeasurement", param='wfmInfo') + test_value = self._defaults['FetchArrayMeasurement']['wfmInfo'] try: wfm_info_ref = wfm_info.contents except AttributeError: @@ -513,17 +417,15 @@ def niScope_FetchArrayMeasurement( assert len(wfm_info_ref) >= len(test_value) for i in range(len(test_value)): wfm_info_ref[i] = test_value[i] - return self._defaults["FetchArrayMeasurement"]["return"] + return self._defaults['FetchArrayMeasurement']['return'] - def niScope_FetchBinary16( - self, vi, channel_list, timeout, num_samples, waveform, wfm_info - ): # noqa: N802 - if self._defaults["FetchBinary16"]["return"] != 0: - return self._defaults["FetchBinary16"]["return"] + def niScope_FetchBinary16(self, vi, channel_list, timeout, num_samples, waveform, wfm_info): # noqa: N802 + if self._defaults['FetchBinary16']['return'] != 0: + return self._defaults['FetchBinary16']['return'] # waveform - if self._defaults["FetchBinary16"]["waveform"] is None: - raise MockFunctionCallError("niScope_FetchBinary16", param="waveform") - test_value = self._defaults["FetchBinary16"]["waveform"] + if self._defaults['FetchBinary16']['waveform'] is None: + raise MockFunctionCallError("niScope_FetchBinary16", param='waveform') + test_value = self._defaults['FetchBinary16']['waveform'] try: waveform_ref = waveform.contents except AttributeError: @@ -532,9 +434,9 @@ def niScope_FetchBinary16( for i in range(len(test_value)): waveform_ref[i] = test_value[i] # wfm_info - if self._defaults["FetchBinary16"]["wfmInfo"] is None: - raise MockFunctionCallError("niScope_FetchBinary16", param="wfmInfo") - test_value = self._defaults["FetchBinary16"]["wfmInfo"] + if self._defaults['FetchBinary16']['wfmInfo'] is None: + raise MockFunctionCallError("niScope_FetchBinary16", param='wfmInfo') + test_value = self._defaults['FetchBinary16']['wfmInfo'] try: wfm_info_ref = wfm_info.contents except AttributeError: @@ -542,17 +444,15 @@ def niScope_FetchBinary16( assert len(wfm_info_ref) >= len(test_value) for i in range(len(test_value)): wfm_info_ref[i] = test_value[i] - return self._defaults["FetchBinary16"]["return"] + return self._defaults['FetchBinary16']['return'] - def niScope_FetchBinary32( - self, vi, channel_list, timeout, num_samples, waveform, wfm_info - ): # noqa: N802 - if self._defaults["FetchBinary32"]["return"] != 0: - return self._defaults["FetchBinary32"]["return"] + def niScope_FetchBinary32(self, vi, channel_list, timeout, num_samples, waveform, wfm_info): # noqa: N802 + if self._defaults['FetchBinary32']['return'] != 0: + return self._defaults['FetchBinary32']['return'] # waveform - if self._defaults["FetchBinary32"]["waveform"] is None: - raise MockFunctionCallError("niScope_FetchBinary32", param="waveform") - test_value = self._defaults["FetchBinary32"]["waveform"] + if self._defaults['FetchBinary32']['waveform'] is None: + raise MockFunctionCallError("niScope_FetchBinary32", param='waveform') + test_value = self._defaults['FetchBinary32']['waveform'] try: waveform_ref = waveform.contents except AttributeError: @@ -561,9 +461,9 @@ def niScope_FetchBinary32( for i in range(len(test_value)): waveform_ref[i] = test_value[i] # wfm_info - if self._defaults["FetchBinary32"]["wfmInfo"] is None: - raise MockFunctionCallError("niScope_FetchBinary32", param="wfmInfo") - test_value = self._defaults["FetchBinary32"]["wfmInfo"] + if self._defaults['FetchBinary32']['wfmInfo'] is None: + raise MockFunctionCallError("niScope_FetchBinary32", param='wfmInfo') + test_value = self._defaults['FetchBinary32']['wfmInfo'] try: wfm_info_ref = wfm_info.contents except AttributeError: @@ -571,17 +471,15 @@ def niScope_FetchBinary32( assert len(wfm_info_ref) >= len(test_value) for i in range(len(test_value)): wfm_info_ref[i] = test_value[i] - return self._defaults["FetchBinary32"]["return"] + return self._defaults['FetchBinary32']['return'] - def niScope_FetchBinary8( - self, vi, channel_list, timeout, num_samples, waveform, wfm_info - ): # noqa: N802 - if self._defaults["FetchBinary8"]["return"] != 0: - return self._defaults["FetchBinary8"]["return"] + def niScope_FetchBinary8(self, vi, channel_list, timeout, num_samples, waveform, wfm_info): # noqa: N802 + if self._defaults['FetchBinary8']['return'] != 0: + return self._defaults['FetchBinary8']['return'] # waveform - if self._defaults["FetchBinary8"]["waveform"] is None: - raise MockFunctionCallError("niScope_FetchBinary8", param="waveform") - test_value = self._defaults["FetchBinary8"]["waveform"] + if self._defaults['FetchBinary8']['waveform'] is None: + raise MockFunctionCallError("niScope_FetchBinary8", param='waveform') + test_value = self._defaults['FetchBinary8']['waveform'] try: waveform_ref = waveform.contents except AttributeError: @@ -590,9 +488,9 @@ def niScope_FetchBinary8( for i in range(len(test_value)): waveform_ref[i] = test_value[i] # wfm_info - if self._defaults["FetchBinary8"]["wfmInfo"] is None: - raise MockFunctionCallError("niScope_FetchBinary8", param="wfmInfo") - test_value = self._defaults["FetchBinary8"]["wfmInfo"] + if self._defaults['FetchBinary8']['wfmInfo'] is None: + raise MockFunctionCallError("niScope_FetchBinary8", param='wfmInfo') + test_value = self._defaults['FetchBinary8']['wfmInfo'] try: wfm_info_ref = wfm_info.contents except AttributeError: @@ -600,27 +498,15 @@ def niScope_FetchBinary8( assert len(wfm_info_ref) >= len(test_value) for i in range(len(test_value)): wfm_info_ref[i] = test_value[i] - return self._defaults["FetchBinary8"]["return"] - - def niScope_FetchMeasurementStats( - self, - vi, - channel_list, - timeout, - scalar_meas_function, - result, - mean, - stdev, - min, - max, - num_in_stats, - ): # noqa: N802 - if self._defaults["FetchMeasurementStats"]["return"] != 0: - return self._defaults["FetchMeasurementStats"]["return"] + return self._defaults['FetchBinary8']['return'] + + def niScope_FetchMeasurementStats(self, vi, channel_list, timeout, scalar_meas_function, result, mean, stdev, min, max, num_in_stats): # noqa: N802 + if self._defaults['FetchMeasurementStats']['return'] != 0: + return self._defaults['FetchMeasurementStats']['return'] # result - if self._defaults["FetchMeasurementStats"]["result"] is None: - raise MockFunctionCallError("niScope_FetchMeasurementStats", param="result") - test_value = self._defaults["FetchMeasurementStats"]["result"] + if self._defaults['FetchMeasurementStats']['result'] is None: + raise MockFunctionCallError("niScope_FetchMeasurementStats", param='result') + test_value = self._defaults['FetchMeasurementStats']['result'] try: result_ref = result.contents except AttributeError: @@ -629,9 +515,9 @@ def niScope_FetchMeasurementStats( for i in range(len(test_value)): result_ref[i] = test_value[i] # mean - if self._defaults["FetchMeasurementStats"]["mean"] is None: - raise MockFunctionCallError("niScope_FetchMeasurementStats", param="mean") - test_value = self._defaults["FetchMeasurementStats"]["mean"] + if self._defaults['FetchMeasurementStats']['mean'] is None: + raise MockFunctionCallError("niScope_FetchMeasurementStats", param='mean') + test_value = self._defaults['FetchMeasurementStats']['mean'] try: mean_ref = mean.contents except AttributeError: @@ -640,9 +526,9 @@ def niScope_FetchMeasurementStats( for i in range(len(test_value)): mean_ref[i] = test_value[i] # stdev - if self._defaults["FetchMeasurementStats"]["stdev"] is None: - raise MockFunctionCallError("niScope_FetchMeasurementStats", param="stdev") - test_value = self._defaults["FetchMeasurementStats"]["stdev"] + if self._defaults['FetchMeasurementStats']['stdev'] is None: + raise MockFunctionCallError("niScope_FetchMeasurementStats", param='stdev') + test_value = self._defaults['FetchMeasurementStats']['stdev'] try: stdev_ref = stdev.contents except AttributeError: @@ -651,9 +537,9 @@ def niScope_FetchMeasurementStats( for i in range(len(test_value)): stdev_ref[i] = test_value[i] # min - if self._defaults["FetchMeasurementStats"]["min"] is None: - raise MockFunctionCallError("niScope_FetchMeasurementStats", param="min") - test_value = self._defaults["FetchMeasurementStats"]["min"] + if self._defaults['FetchMeasurementStats']['min'] is None: + raise MockFunctionCallError("niScope_FetchMeasurementStats", param='min') + test_value = self._defaults['FetchMeasurementStats']['min'] try: min_ref = min.contents except AttributeError: @@ -662,9 +548,9 @@ def niScope_FetchMeasurementStats( for i in range(len(test_value)): min_ref[i] = test_value[i] # max - if self._defaults["FetchMeasurementStats"]["max"] is None: - raise MockFunctionCallError("niScope_FetchMeasurementStats", param="max") - test_value = self._defaults["FetchMeasurementStats"]["max"] + if self._defaults['FetchMeasurementStats']['max'] is None: + raise MockFunctionCallError("niScope_FetchMeasurementStats", param='max') + test_value = self._defaults['FetchMeasurementStats']['max'] try: max_ref = max.contents except AttributeError: @@ -673,11 +559,9 @@ def niScope_FetchMeasurementStats( for i in range(len(test_value)): max_ref[i] = test_value[i] # num_in_stats - if self._defaults["FetchMeasurementStats"]["numInStats"] is None: - raise MockFunctionCallError( - "niScope_FetchMeasurementStats", param="numInStats" - ) - test_value = self._defaults["FetchMeasurementStats"]["numInStats"] + if self._defaults['FetchMeasurementStats']['numInStats'] is None: + raise MockFunctionCallError("niScope_FetchMeasurementStats", param='numInStats') + test_value = self._defaults['FetchMeasurementStats']['numInStats'] try: num_in_stats_ref = num_in_stats.contents except AttributeError: @@ -685,79 +569,65 @@ def niScope_FetchMeasurementStats( assert len(num_in_stats_ref) >= len(test_value) for i in range(len(test_value)): num_in_stats_ref[i] = test_value[i] - return self._defaults["FetchMeasurementStats"]["return"] + return self._defaults['FetchMeasurementStats']['return'] - def niScope_GetAttributeViBoolean( - self, vi, channel_list, attribute_id, value - ): # noqa: N802 - if self._defaults["GetAttributeViBoolean"]["return"] != 0: - return self._defaults["GetAttributeViBoolean"]["return"] + def niScope_GetAttributeViBoolean(self, vi, channel_list, attribute_id, value): # noqa: N802 + if self._defaults['GetAttributeViBoolean']['return'] != 0: + return self._defaults['GetAttributeViBoolean']['return'] # value - if self._defaults["GetAttributeViBoolean"]["value"] is None: - raise MockFunctionCallError("niScope_GetAttributeViBoolean", param="value") + if self._defaults['GetAttributeViBoolean']['value'] is None: + raise MockFunctionCallError("niScope_GetAttributeViBoolean", param='value') if value is not None: - value.contents.value = self._defaults["GetAttributeViBoolean"]["value"] - return self._defaults["GetAttributeViBoolean"]["return"] - - def niScope_GetAttributeViInt32( - self, vi, channel_list, attribute_id, value - ): # noqa: N802 - if self._defaults["GetAttributeViInt32"]["return"] != 0: - return self._defaults["GetAttributeViInt32"]["return"] + value.contents.value = self._defaults['GetAttributeViBoolean']['value'] + return self._defaults['GetAttributeViBoolean']['return'] + + def niScope_GetAttributeViInt32(self, vi, channel_list, attribute_id, value): # noqa: N802 + if self._defaults['GetAttributeViInt32']['return'] != 0: + return self._defaults['GetAttributeViInt32']['return'] # value - if self._defaults["GetAttributeViInt32"]["value"] is None: - raise MockFunctionCallError("niScope_GetAttributeViInt32", param="value") + if self._defaults['GetAttributeViInt32']['value'] is None: + raise MockFunctionCallError("niScope_GetAttributeViInt32", param='value') if value is not None: - value.contents.value = self._defaults["GetAttributeViInt32"]["value"] - return self._defaults["GetAttributeViInt32"]["return"] - - def niScope_GetAttributeViInt64( - self, vi, channel_list, attribute_id, value - ): # noqa: N802 - if self._defaults["GetAttributeViInt64"]["return"] != 0: - return self._defaults["GetAttributeViInt64"]["return"] + value.contents.value = self._defaults['GetAttributeViInt32']['value'] + return self._defaults['GetAttributeViInt32']['return'] + + def niScope_GetAttributeViInt64(self, vi, channel_list, attribute_id, value): # noqa: N802 + if self._defaults['GetAttributeViInt64']['return'] != 0: + return self._defaults['GetAttributeViInt64']['return'] # value - if self._defaults["GetAttributeViInt64"]["value"] is None: - raise MockFunctionCallError("niScope_GetAttributeViInt64", param="value") + if self._defaults['GetAttributeViInt64']['value'] is None: + raise MockFunctionCallError("niScope_GetAttributeViInt64", param='value') if value is not None: - value.contents.value = self._defaults["GetAttributeViInt64"]["value"] - return self._defaults["GetAttributeViInt64"]["return"] - - def niScope_GetAttributeViReal64( - self, vi, channel_list, attribute_id, value - ): # noqa: N802 - if self._defaults["GetAttributeViReal64"]["return"] != 0: - return self._defaults["GetAttributeViReal64"]["return"] + value.contents.value = self._defaults['GetAttributeViInt64']['value'] + return self._defaults['GetAttributeViInt64']['return'] + + def niScope_GetAttributeViReal64(self, vi, channel_list, attribute_id, value): # noqa: N802 + if self._defaults['GetAttributeViReal64']['return'] != 0: + return self._defaults['GetAttributeViReal64']['return'] # value - if self._defaults["GetAttributeViReal64"]["value"] is None: - raise MockFunctionCallError("niScope_GetAttributeViReal64", param="value") + if self._defaults['GetAttributeViReal64']['value'] is None: + raise MockFunctionCallError("niScope_GetAttributeViReal64", param='value') if value is not None: - value.contents.value = self._defaults["GetAttributeViReal64"]["value"] - return self._defaults["GetAttributeViReal64"]["return"] - - def niScope_GetAttributeViString( - self, vi, channel_list, attribute_id, buf_size, value - ): # noqa: N802 - if self._defaults["GetAttributeViString"]["return"] != 0: - return self._defaults["GetAttributeViString"]["return"] - if self._defaults["GetAttributeViString"]["value"] is None: - raise MockFunctionCallError("niScope_GetAttributeViString", param="value") + value.contents.value = self._defaults['GetAttributeViReal64']['value'] + return self._defaults['GetAttributeViReal64']['return'] + + def niScope_GetAttributeViString(self, vi, channel_list, attribute_id, buf_size, value): # noqa: N802 + if self._defaults['GetAttributeViString']['return'] != 0: + return self._defaults['GetAttributeViString']['return'] + if self._defaults['GetAttributeViString']['value'] is None: + raise MockFunctionCallError("niScope_GetAttributeViString", param='value') if buf_size.value == 0: - return len(self._defaults["GetAttributeViString"]["value"]) - value.value = self._defaults["GetAttributeViString"]["value"].encode("ascii") - return self._defaults["GetAttributeViString"]["return"] - - def niScope_GetEqualizationFilterCoefficients( - self, vi, channel, number_of_coefficients, coefficients - ): # noqa: N802 - if self._defaults["GetEqualizationFilterCoefficients"]["return"] != 0: - return self._defaults["GetEqualizationFilterCoefficients"]["return"] + return len(self._defaults['GetAttributeViString']['value']) + value.value = self._defaults['GetAttributeViString']['value'].encode('ascii') + return self._defaults['GetAttributeViString']['return'] + + def niScope_GetEqualizationFilterCoefficients(self, vi, channel, number_of_coefficients, coefficients): # noqa: N802 + if self._defaults['GetEqualizationFilterCoefficients']['return'] != 0: + return self._defaults['GetEqualizationFilterCoefficients']['return'] # coefficients - if self._defaults["GetEqualizationFilterCoefficients"]["coefficients"] is None: - raise MockFunctionCallError( - "niScope_GetEqualizationFilterCoefficients", param="coefficients" - ) - test_value = self._defaults["GetEqualizationFilterCoefficients"]["coefficients"] + if self._defaults['GetEqualizationFilterCoefficients']['coefficients'] is None: + raise MockFunctionCallError("niScope_GetEqualizationFilterCoefficients", param='coefficients') + test_value = self._defaults['GetEqualizationFilterCoefficients']['coefficients'] try: coefficients_ref = coefficients.contents except AttributeError: @@ -765,83 +635,75 @@ def niScope_GetEqualizationFilterCoefficients( assert len(coefficients_ref) >= len(test_value) for i in range(len(test_value)): coefficients_ref[i] = test_value[i] - return self._defaults["GetEqualizationFilterCoefficients"]["return"] + return self._defaults['GetEqualizationFilterCoefficients']['return'] def niScope_GetError(self, vi, error_code, buffer_size, description): # noqa: N802 - if self._defaults["GetError"]["return"] != 0: - return self._defaults["GetError"]["return"] + if self._defaults['GetError']['return'] != 0: + return self._defaults['GetError']['return'] # error_code - if self._defaults["GetError"]["errorCode"] is None: - raise MockFunctionCallError("niScope_GetError", param="errorCode") + if self._defaults['GetError']['errorCode'] is None: + raise MockFunctionCallError("niScope_GetError", param='errorCode') if error_code is not None: - error_code.contents.value = self._defaults["GetError"]["errorCode"] - if self._defaults["GetError"]["description"] is None: - raise MockFunctionCallError("niScope_GetError", param="description") + error_code.contents.value = self._defaults['GetError']['errorCode'] + if self._defaults['GetError']['description'] is None: + raise MockFunctionCallError("niScope_GetError", param='description') if buffer_size.value == 0: - return len(self._defaults["GetError"]["description"]) - description.value = self._defaults["GetError"]["description"].encode("ascii") - return self._defaults["GetError"]["return"] + return len(self._defaults['GetError']['description']) + description.value = self._defaults['GetError']['description'].encode('ascii') + return self._defaults['GetError']['return'] - def niScope_ImportAttributeConfigurationBuffer( - self, vi, size_in_bytes, configuration - ): # noqa: N802 - if self._defaults["ImportAttributeConfigurationBuffer"]["return"] != 0: - return self._defaults["ImportAttributeConfigurationBuffer"]["return"] - return self._defaults["ImportAttributeConfigurationBuffer"]["return"] + def niScope_ImportAttributeConfigurationBuffer(self, vi, size_in_bytes, configuration): # noqa: N802 + if self._defaults['ImportAttributeConfigurationBuffer']['return'] != 0: + return self._defaults['ImportAttributeConfigurationBuffer']['return'] + return self._defaults['ImportAttributeConfigurationBuffer']['return'] def niScope_ImportAttributeConfigurationFile(self, vi, file_path): # noqa: N802 - if self._defaults["ImportAttributeConfigurationFile"]["return"] != 0: - return self._defaults["ImportAttributeConfigurationFile"]["return"] - return self._defaults["ImportAttributeConfigurationFile"]["return"] - - def niScope_InitWithOptions( - self, resource_name, id_query, reset_device, option_string, vi - ): # noqa: N802 - if self._defaults["InitWithOptions"]["return"] != 0: - return self._defaults["InitWithOptions"]["return"] + if self._defaults['ImportAttributeConfigurationFile']['return'] != 0: + return self._defaults['ImportAttributeConfigurationFile']['return'] + return self._defaults['ImportAttributeConfigurationFile']['return'] + + def niScope_InitWithOptions(self, resource_name, id_query, reset_device, option_string, vi): # noqa: N802 + if self._defaults['InitWithOptions']['return'] != 0: + return self._defaults['InitWithOptions']['return'] # vi - if self._defaults["InitWithOptions"]["vi"] is None: - raise MockFunctionCallError("niScope_InitWithOptions", param="vi") + if self._defaults['InitWithOptions']['vi'] is None: + raise MockFunctionCallError("niScope_InitWithOptions", param='vi') if vi is not None: - vi.contents.value = self._defaults["InitWithOptions"]["vi"] - return self._defaults["InitWithOptions"]["return"] + vi.contents.value = self._defaults['InitWithOptions']['vi'] + return self._defaults['InitWithOptions']['return'] def niScope_InitiateAcquisition(self, vi): # noqa: N802 - if self._defaults["InitiateAcquisition"]["return"] != 0: - return self._defaults["InitiateAcquisition"]["return"] - return self._defaults["InitiateAcquisition"]["return"] + if self._defaults['InitiateAcquisition']['return'] != 0: + return self._defaults['InitiateAcquisition']['return'] + return self._defaults['InitiateAcquisition']['return'] def niScope_LockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults["LockSession"]["return"] != 0: - return self._defaults["LockSession"]["return"] + if self._defaults['LockSession']['return'] != 0: + return self._defaults['LockSession']['return'] # caller_has_lock - if self._defaults["LockSession"]["callerHasLock"] is None: - raise MockFunctionCallError("niScope_LockSession", param="callerHasLock") + if self._defaults['LockSession']['callerHasLock'] is None: + raise MockFunctionCallError("niScope_LockSession", param='callerHasLock') if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults["LockSession"][ - "callerHasLock" - ] - return self._defaults["LockSession"]["return"] + caller_has_lock.contents.value = self._defaults['LockSession']['callerHasLock'] + return self._defaults['LockSession']['return'] def niScope_ProbeCompensationSignalStart(self, vi): # noqa: N802 - if self._defaults["ProbeCompensationSignalStart"]["return"] != 0: - return self._defaults["ProbeCompensationSignalStart"]["return"] - return self._defaults["ProbeCompensationSignalStart"]["return"] + if self._defaults['ProbeCompensationSignalStart']['return'] != 0: + return self._defaults['ProbeCompensationSignalStart']['return'] + return self._defaults['ProbeCompensationSignalStart']['return'] def niScope_ProbeCompensationSignalStop(self, vi): # noqa: N802 - if self._defaults["ProbeCompensationSignalStop"]["return"] != 0: - return self._defaults["ProbeCompensationSignalStop"]["return"] - return self._defaults["ProbeCompensationSignalStop"]["return"] - - def niScope_Read( - self, vi, channel_list, timeout, num_samples, waveform, wfm_info - ): # noqa: N802 - if self._defaults["Read"]["return"] != 0: - return self._defaults["Read"]["return"] + if self._defaults['ProbeCompensationSignalStop']['return'] != 0: + return self._defaults['ProbeCompensationSignalStop']['return'] + return self._defaults['ProbeCompensationSignalStop']['return'] + + def niScope_Read(self, vi, channel_list, timeout, num_samples, waveform, wfm_info): # noqa: N802 + if self._defaults['Read']['return'] != 0: + return self._defaults['Read']['return'] # waveform - if self._defaults["Read"]["waveform"] is None: - raise MockFunctionCallError("niScope_Read", param="waveform") - test_value = self._defaults["Read"]["waveform"] + if self._defaults['Read']['waveform'] is None: + raise MockFunctionCallError("niScope_Read", param='waveform') + test_value = self._defaults['Read']['waveform'] try: waveform_ref = waveform.contents except AttributeError: @@ -850,9 +712,9 @@ def niScope_Read( for i in range(len(test_value)): waveform_ref[i] = test_value[i] # wfm_info - if self._defaults["Read"]["wfmInfo"] is None: - raise MockFunctionCallError("niScope_Read", param="wfmInfo") - test_value = self._defaults["Read"]["wfmInfo"] + if self._defaults['Read']['wfmInfo'] is None: + raise MockFunctionCallError("niScope_Read", param='wfmInfo') + test_value = self._defaults['Read']['wfmInfo'] try: wfm_info_ref = wfm_info.contents except AttributeError: @@ -860,348 +722,222 @@ def niScope_Read( assert len(wfm_info_ref) >= len(test_value) for i in range(len(test_value)): wfm_info_ref[i] = test_value[i] - return self._defaults["Read"]["return"] + return self._defaults['Read']['return'] def niScope_ResetDevice(self, vi): # noqa: N802 - if self._defaults["ResetDevice"]["return"] != 0: - return self._defaults["ResetDevice"]["return"] - return self._defaults["ResetDevice"]["return"] + if self._defaults['ResetDevice']['return'] != 0: + return self._defaults['ResetDevice']['return'] + return self._defaults['ResetDevice']['return'] def niScope_ResetWithDefaults(self, vi): # noqa: N802 - if self._defaults["ResetWithDefaults"]["return"] != 0: - return self._defaults["ResetWithDefaults"]["return"] - return self._defaults["ResetWithDefaults"]["return"] + if self._defaults['ResetWithDefaults']['return'] != 0: + return self._defaults['ResetWithDefaults']['return'] + return self._defaults['ResetWithDefaults']['return'] def niScope_SendSoftwareTriggerEdge(self, vi, which_trigger): # noqa: N802 - if self._defaults["SendSoftwareTriggerEdge"]["return"] != 0: - return self._defaults["SendSoftwareTriggerEdge"]["return"] - return self._defaults["SendSoftwareTriggerEdge"]["return"] - - def niScope_SetAttributeViBoolean( - self, vi, channel_list, attribute_id, value - ): # noqa: N802 - if self._defaults["SetAttributeViBoolean"]["return"] != 0: - return self._defaults["SetAttributeViBoolean"]["return"] - return self._defaults["SetAttributeViBoolean"]["return"] - - def niScope_SetAttributeViInt32( - self, vi, channel_list, attribute_id, value - ): # noqa: N802 - if self._defaults["SetAttributeViInt32"]["return"] != 0: - return self._defaults["SetAttributeViInt32"]["return"] - return self._defaults["SetAttributeViInt32"]["return"] - - def niScope_SetAttributeViInt64( - self, vi, channel_list, attribute_id, value - ): # noqa: N802 - if self._defaults["SetAttributeViInt64"]["return"] != 0: - return self._defaults["SetAttributeViInt64"]["return"] - return self._defaults["SetAttributeViInt64"]["return"] - - def niScope_SetAttributeViReal64( - self, vi, channel_list, attribute_id, value - ): # noqa: N802 - if self._defaults["SetAttributeViReal64"]["return"] != 0: - return self._defaults["SetAttributeViReal64"]["return"] - return self._defaults["SetAttributeViReal64"]["return"] - - def niScope_SetAttributeViString( - self, vi, channel_list, attribute_id, value - ): # noqa: N802 - if self._defaults["SetAttributeViString"]["return"] != 0: - return self._defaults["SetAttributeViString"]["return"] - return self._defaults["SetAttributeViString"]["return"] + if self._defaults['SendSoftwareTriggerEdge']['return'] != 0: + return self._defaults['SendSoftwareTriggerEdge']['return'] + return self._defaults['SendSoftwareTriggerEdge']['return'] + + def niScope_SetAttributeViBoolean(self, vi, channel_list, attribute_id, value): # noqa: N802 + if self._defaults['SetAttributeViBoolean']['return'] != 0: + return self._defaults['SetAttributeViBoolean']['return'] + return self._defaults['SetAttributeViBoolean']['return'] + + def niScope_SetAttributeViInt32(self, vi, channel_list, attribute_id, value): # noqa: N802 + if self._defaults['SetAttributeViInt32']['return'] != 0: + return self._defaults['SetAttributeViInt32']['return'] + return self._defaults['SetAttributeViInt32']['return'] + + def niScope_SetAttributeViInt64(self, vi, channel_list, attribute_id, value): # noqa: N802 + if self._defaults['SetAttributeViInt64']['return'] != 0: + return self._defaults['SetAttributeViInt64']['return'] + return self._defaults['SetAttributeViInt64']['return'] + + def niScope_SetAttributeViReal64(self, vi, channel_list, attribute_id, value): # noqa: N802 + if self._defaults['SetAttributeViReal64']['return'] != 0: + return self._defaults['SetAttributeViReal64']['return'] + return self._defaults['SetAttributeViReal64']['return'] + + def niScope_SetAttributeViString(self, vi, channel_list, attribute_id, value): # noqa: N802 + if self._defaults['SetAttributeViString']['return'] != 0: + return self._defaults['SetAttributeViString']['return'] + return self._defaults['SetAttributeViString']['return'] def niScope_UnlockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults["UnlockSession"]["return"] != 0: - return self._defaults["UnlockSession"]["return"] + if self._defaults['UnlockSession']['return'] != 0: + return self._defaults['UnlockSession']['return'] # caller_has_lock - if self._defaults["UnlockSession"]["callerHasLock"] is None: - raise MockFunctionCallError("niScope_UnlockSession", param="callerHasLock") + if self._defaults['UnlockSession']['callerHasLock'] is None: + raise MockFunctionCallError("niScope_UnlockSession", param='callerHasLock') if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults["UnlockSession"][ - "callerHasLock" - ] - return self._defaults["UnlockSession"]["return"] + caller_has_lock.contents.value = self._defaults['UnlockSession']['callerHasLock'] + return self._defaults['UnlockSession']['return'] def niScope_close(self, vi): # noqa: N802 - if self._defaults["close"]["return"] != 0: - return self._defaults["close"]["return"] - return self._defaults["close"]["return"] + if self._defaults['close']['return'] != 0: + return self._defaults['close']['return'] + return self._defaults['close']['return'] def niScope_error_message(self, vi, error_code, error_message): # noqa: N802 - if self._defaults["error_message"]["return"] != 0: - return self._defaults["error_message"]["return"] + if self._defaults['error_message']['return'] != 0: + return self._defaults['error_message']['return'] # error_message - if self._defaults["error_message"]["errorMessage"] is None: - raise MockFunctionCallError("niScope_error_message", param="errorMessage") - test_value = self._defaults["error_message"]["errorMessage"] + if self._defaults['error_message']['errorMessage'] is None: + raise MockFunctionCallError("niScope_error_message", param='errorMessage') + test_value = self._defaults['error_message']['errorMessage'] if type(test_value) is str: - test_value = test_value.encode("ascii") + test_value = test_value.encode('ascii') assert len(error_message) >= len(test_value) for i in range(len(test_value)): error_message[i] = test_value[i] - return self._defaults["error_message"]["return"] + return self._defaults['error_message']['return'] def niScope_reset(self, vi): # noqa: N802 - if self._defaults["reset"]["return"] != 0: - return self._defaults["reset"]["return"] - return self._defaults["reset"]["return"] + if self._defaults['reset']['return'] != 0: + return self._defaults['reset']['return'] + return self._defaults['reset']['return'] def niScope_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 - if self._defaults["self_test"]["return"] != 0: - return self._defaults["self_test"]["return"] + if self._defaults['self_test']['return'] != 0: + return self._defaults['self_test']['return'] # self_test_result - if self._defaults["self_test"]["selfTestResult"] is None: - raise MockFunctionCallError("niScope_self_test", param="selfTestResult") + if self._defaults['self_test']['selfTestResult'] is None: + raise MockFunctionCallError("niScope_self_test", param='selfTestResult') if self_test_result is not None: - self_test_result.contents.value = self._defaults["self_test"][ - "selfTestResult" - ] + self_test_result.contents.value = self._defaults['self_test']['selfTestResult'] # self_test_message - if self._defaults["self_test"]["selfTestMessage"] is None: - raise MockFunctionCallError("niScope_self_test", param="selfTestMessage") - test_value = self._defaults["self_test"]["selfTestMessage"] + if self._defaults['self_test']['selfTestMessage'] is None: + raise MockFunctionCallError("niScope_self_test", param='selfTestMessage') + test_value = self._defaults['self_test']['selfTestMessage'] if type(test_value) is str: - test_value = test_value.encode("ascii") + test_value = test_value.encode('ascii') assert len(self_test_message) >= len(test_value) for i in range(len(test_value)): self_test_message[i] = test_value[i] - return self._defaults["self_test"]["return"] + return self._defaults['self_test']['return'] # Helper function to setup Mock object with default side effects and return values def set_side_effects_and_return_values(self, mock_library): mock_library.niScope_Abort.side_effect = MockFunctionCallError("niScope_Abort") mock_library.niScope_Abort.return_value = 0 - mock_library.niScope_AcquisitionStatus.side_effect = MockFunctionCallError( - "niScope_AcquisitionStatus" - ) + mock_library.niScope_AcquisitionStatus.side_effect = MockFunctionCallError("niScope_AcquisitionStatus") mock_library.niScope_AcquisitionStatus.return_value = 0 - mock_library.niScope_ActualMeasWfmSize.side_effect = MockFunctionCallError( - "niScope_ActualMeasWfmSize" - ) + mock_library.niScope_ActualMeasWfmSize.side_effect = MockFunctionCallError("niScope_ActualMeasWfmSize") mock_library.niScope_ActualMeasWfmSize.return_value = 0 - mock_library.niScope_ActualNumWfms.side_effect = MockFunctionCallError( - "niScope_ActualNumWfms" - ) + mock_library.niScope_ActualNumWfms.side_effect = MockFunctionCallError("niScope_ActualNumWfms") mock_library.niScope_ActualNumWfms.return_value = 0 - mock_library.niScope_AddWaveformProcessing.side_effect = MockFunctionCallError( - "niScope_AddWaveformProcessing" - ) + mock_library.niScope_AddWaveformProcessing.side_effect = MockFunctionCallError("niScope_AddWaveformProcessing") mock_library.niScope_AddWaveformProcessing.return_value = 0 - mock_library.niScope_AutoSetup.side_effect = MockFunctionCallError( - "niScope_AutoSetup" - ) + mock_library.niScope_AutoSetup.side_effect = MockFunctionCallError("niScope_AutoSetup") mock_library.niScope_AutoSetup.return_value = 0 - mock_library.niScope_CalFetchDate.side_effect = MockFunctionCallError( - "niScope_CalFetchDate" - ) + mock_library.niScope_CalFetchDate.side_effect = MockFunctionCallError("niScope_CalFetchDate") mock_library.niScope_CalFetchDate.return_value = 0 - mock_library.niScope_CalFetchTemperature.side_effect = MockFunctionCallError( - "niScope_CalFetchTemperature" - ) + mock_library.niScope_CalFetchTemperature.side_effect = MockFunctionCallError("niScope_CalFetchTemperature") mock_library.niScope_CalFetchTemperature.return_value = 0 - mock_library.niScope_CalSelfCalibrate.side_effect = MockFunctionCallError( - "niScope_CalSelfCalibrate" - ) + mock_library.niScope_CalSelfCalibrate.side_effect = MockFunctionCallError("niScope_CalSelfCalibrate") mock_library.niScope_CalSelfCalibrate.return_value = 0 - mock_library.niScope_ClearWaveformMeasurementStats.side_effect = ( - MockFunctionCallError("niScope_ClearWaveformMeasurementStats") - ) + mock_library.niScope_ClearWaveformMeasurementStats.side_effect = MockFunctionCallError("niScope_ClearWaveformMeasurementStats") mock_library.niScope_ClearWaveformMeasurementStats.return_value = 0 - mock_library.niScope_ClearWaveformProcessing.side_effect = ( - MockFunctionCallError("niScope_ClearWaveformProcessing") - ) + mock_library.niScope_ClearWaveformProcessing.side_effect = MockFunctionCallError("niScope_ClearWaveformProcessing") mock_library.niScope_ClearWaveformProcessing.return_value = 0 - mock_library.niScope_Commit.side_effect = MockFunctionCallError( - "niScope_Commit" - ) + mock_library.niScope_Commit.side_effect = MockFunctionCallError("niScope_Commit") mock_library.niScope_Commit.return_value = 0 - mock_library.niScope_ConfigureChanCharacteristics.side_effect = ( - MockFunctionCallError("niScope_ConfigureChanCharacteristics") - ) + mock_library.niScope_ConfigureChanCharacteristics.side_effect = MockFunctionCallError("niScope_ConfigureChanCharacteristics") mock_library.niScope_ConfigureChanCharacteristics.return_value = 0 - mock_library.niScope_ConfigureEqualizationFilterCoefficients.side_effect = ( - MockFunctionCallError("niScope_ConfigureEqualizationFilterCoefficients") - ) + mock_library.niScope_ConfigureEqualizationFilterCoefficients.side_effect = MockFunctionCallError("niScope_ConfigureEqualizationFilterCoefficients") mock_library.niScope_ConfigureEqualizationFilterCoefficients.return_value = 0 - mock_library.niScope_ConfigureHorizontalTiming.side_effect = ( - MockFunctionCallError("niScope_ConfigureHorizontalTiming") - ) + mock_library.niScope_ConfigureHorizontalTiming.side_effect = MockFunctionCallError("niScope_ConfigureHorizontalTiming") mock_library.niScope_ConfigureHorizontalTiming.return_value = 0 - mock_library.niScope_ConfigureRefLevels.side_effect = MockFunctionCallError( - "niScope_ConfigureRefLevels" - ) + mock_library.niScope_ConfigureRefLevels.side_effect = MockFunctionCallError("niScope_ConfigureRefLevels") mock_library.niScope_ConfigureRefLevels.return_value = 0 - mock_library.niScope_ConfigureTriggerDigital.side_effect = ( - MockFunctionCallError("niScope_ConfigureTriggerDigital") - ) + mock_library.niScope_ConfigureTriggerDigital.side_effect = MockFunctionCallError("niScope_ConfigureTriggerDigital") mock_library.niScope_ConfigureTriggerDigital.return_value = 0 - mock_library.niScope_ConfigureTriggerEdge.side_effect = MockFunctionCallError( - "niScope_ConfigureTriggerEdge" - ) + mock_library.niScope_ConfigureTriggerEdge.side_effect = MockFunctionCallError("niScope_ConfigureTriggerEdge") mock_library.niScope_ConfigureTriggerEdge.return_value = 0 - mock_library.niScope_ConfigureTriggerHysteresis.side_effect = ( - MockFunctionCallError("niScope_ConfigureTriggerHysteresis") - ) + mock_library.niScope_ConfigureTriggerHysteresis.side_effect = MockFunctionCallError("niScope_ConfigureTriggerHysteresis") mock_library.niScope_ConfigureTriggerHysteresis.return_value = 0 - mock_library.niScope_ConfigureTriggerImmediate.side_effect = ( - MockFunctionCallError("niScope_ConfigureTriggerImmediate") - ) + mock_library.niScope_ConfigureTriggerImmediate.side_effect = MockFunctionCallError("niScope_ConfigureTriggerImmediate") mock_library.niScope_ConfigureTriggerImmediate.return_value = 0 - mock_library.niScope_ConfigureTriggerSoftware.side_effect = ( - MockFunctionCallError("niScope_ConfigureTriggerSoftware") - ) + mock_library.niScope_ConfigureTriggerSoftware.side_effect = MockFunctionCallError("niScope_ConfigureTriggerSoftware") mock_library.niScope_ConfigureTriggerSoftware.return_value = 0 - mock_library.niScope_ConfigureTriggerVideo.side_effect = MockFunctionCallError( - "niScope_ConfigureTriggerVideo" - ) + mock_library.niScope_ConfigureTriggerVideo.side_effect = MockFunctionCallError("niScope_ConfigureTriggerVideo") mock_library.niScope_ConfigureTriggerVideo.return_value = 0 - mock_library.niScope_ConfigureTriggerWindow.side_effect = MockFunctionCallError( - "niScope_ConfigureTriggerWindow" - ) + mock_library.niScope_ConfigureTriggerWindow.side_effect = MockFunctionCallError("niScope_ConfigureTriggerWindow") mock_library.niScope_ConfigureTriggerWindow.return_value = 0 - mock_library.niScope_ConfigureVertical.side_effect = MockFunctionCallError( - "niScope_ConfigureVertical" - ) + mock_library.niScope_ConfigureVertical.side_effect = MockFunctionCallError("niScope_ConfigureVertical") mock_library.niScope_ConfigureVertical.return_value = 0 - mock_library.niScope_Disable.side_effect = MockFunctionCallError( - "niScope_Disable" - ) + mock_library.niScope_Disable.side_effect = MockFunctionCallError("niScope_Disable") mock_library.niScope_Disable.return_value = 0 - mock_library.niScope_ExportAttributeConfigurationBuffer.side_effect = ( - MockFunctionCallError("niScope_ExportAttributeConfigurationBuffer") - ) + mock_library.niScope_ExportAttributeConfigurationBuffer.side_effect = MockFunctionCallError("niScope_ExportAttributeConfigurationBuffer") mock_library.niScope_ExportAttributeConfigurationBuffer.return_value = 0 - mock_library.niScope_ExportAttributeConfigurationFile.side_effect = ( - MockFunctionCallError("niScope_ExportAttributeConfigurationFile") - ) + mock_library.niScope_ExportAttributeConfigurationFile.side_effect = MockFunctionCallError("niScope_ExportAttributeConfigurationFile") mock_library.niScope_ExportAttributeConfigurationFile.return_value = 0 mock_library.niScope_Fetch.side_effect = MockFunctionCallError("niScope_Fetch") mock_library.niScope_Fetch.return_value = 0 - mock_library.niScope_FetchArrayMeasurement.side_effect = MockFunctionCallError( - "niScope_FetchArrayMeasurement" - ) + mock_library.niScope_FetchArrayMeasurement.side_effect = MockFunctionCallError("niScope_FetchArrayMeasurement") mock_library.niScope_FetchArrayMeasurement.return_value = 0 - mock_library.niScope_FetchBinary16.side_effect = MockFunctionCallError( - "niScope_FetchBinary16" - ) + mock_library.niScope_FetchBinary16.side_effect = MockFunctionCallError("niScope_FetchBinary16") mock_library.niScope_FetchBinary16.return_value = 0 - mock_library.niScope_FetchBinary32.side_effect = MockFunctionCallError( - "niScope_FetchBinary32" - ) + mock_library.niScope_FetchBinary32.side_effect = MockFunctionCallError("niScope_FetchBinary32") mock_library.niScope_FetchBinary32.return_value = 0 - mock_library.niScope_FetchBinary8.side_effect = MockFunctionCallError( - "niScope_FetchBinary8" - ) + mock_library.niScope_FetchBinary8.side_effect = MockFunctionCallError("niScope_FetchBinary8") mock_library.niScope_FetchBinary8.return_value = 0 - mock_library.niScope_FetchMeasurementStats.side_effect = MockFunctionCallError( - "niScope_FetchMeasurementStats" - ) + mock_library.niScope_FetchMeasurementStats.side_effect = MockFunctionCallError("niScope_FetchMeasurementStats") mock_library.niScope_FetchMeasurementStats.return_value = 0 - mock_library.niScope_GetAttributeViBoolean.side_effect = MockFunctionCallError( - "niScope_GetAttributeViBoolean" - ) + mock_library.niScope_GetAttributeViBoolean.side_effect = MockFunctionCallError("niScope_GetAttributeViBoolean") mock_library.niScope_GetAttributeViBoolean.return_value = 0 - mock_library.niScope_GetAttributeViInt32.side_effect = MockFunctionCallError( - "niScope_GetAttributeViInt32" - ) + mock_library.niScope_GetAttributeViInt32.side_effect = MockFunctionCallError("niScope_GetAttributeViInt32") mock_library.niScope_GetAttributeViInt32.return_value = 0 - mock_library.niScope_GetAttributeViInt64.side_effect = MockFunctionCallError( - "niScope_GetAttributeViInt64" - ) + mock_library.niScope_GetAttributeViInt64.side_effect = MockFunctionCallError("niScope_GetAttributeViInt64") mock_library.niScope_GetAttributeViInt64.return_value = 0 - mock_library.niScope_GetAttributeViReal64.side_effect = MockFunctionCallError( - "niScope_GetAttributeViReal64" - ) + mock_library.niScope_GetAttributeViReal64.side_effect = MockFunctionCallError("niScope_GetAttributeViReal64") mock_library.niScope_GetAttributeViReal64.return_value = 0 - mock_library.niScope_GetAttributeViString.side_effect = MockFunctionCallError( - "niScope_GetAttributeViString" - ) + mock_library.niScope_GetAttributeViString.side_effect = MockFunctionCallError("niScope_GetAttributeViString") mock_library.niScope_GetAttributeViString.return_value = 0 - mock_library.niScope_GetEqualizationFilterCoefficients.side_effect = ( - MockFunctionCallError("niScope_GetEqualizationFilterCoefficients") - ) + mock_library.niScope_GetEqualizationFilterCoefficients.side_effect = MockFunctionCallError("niScope_GetEqualizationFilterCoefficients") mock_library.niScope_GetEqualizationFilterCoefficients.return_value = 0 - mock_library.niScope_GetError.side_effect = MockFunctionCallError( - "niScope_GetError" - ) + mock_library.niScope_GetError.side_effect = MockFunctionCallError("niScope_GetError") mock_library.niScope_GetError.return_value = 0 - mock_library.niScope_ImportAttributeConfigurationBuffer.side_effect = ( - MockFunctionCallError("niScope_ImportAttributeConfigurationBuffer") - ) + mock_library.niScope_ImportAttributeConfigurationBuffer.side_effect = MockFunctionCallError("niScope_ImportAttributeConfigurationBuffer") mock_library.niScope_ImportAttributeConfigurationBuffer.return_value = 0 - mock_library.niScope_ImportAttributeConfigurationFile.side_effect = ( - MockFunctionCallError("niScope_ImportAttributeConfigurationFile") - ) + mock_library.niScope_ImportAttributeConfigurationFile.side_effect = MockFunctionCallError("niScope_ImportAttributeConfigurationFile") mock_library.niScope_ImportAttributeConfigurationFile.return_value = 0 - mock_library.niScope_InitWithOptions.side_effect = MockFunctionCallError( - "niScope_InitWithOptions" - ) + mock_library.niScope_InitWithOptions.side_effect = MockFunctionCallError("niScope_InitWithOptions") mock_library.niScope_InitWithOptions.return_value = 0 - mock_library.niScope_InitiateAcquisition.side_effect = MockFunctionCallError( - "niScope_InitiateAcquisition" - ) + mock_library.niScope_InitiateAcquisition.side_effect = MockFunctionCallError("niScope_InitiateAcquisition") mock_library.niScope_InitiateAcquisition.return_value = 0 - mock_library.niScope_LockSession.side_effect = MockFunctionCallError( - "niScope_LockSession" - ) + mock_library.niScope_LockSession.side_effect = MockFunctionCallError("niScope_LockSession") mock_library.niScope_LockSession.return_value = 0 - mock_library.niScope_ProbeCompensationSignalStart.side_effect = ( - MockFunctionCallError("niScope_ProbeCompensationSignalStart") - ) + mock_library.niScope_ProbeCompensationSignalStart.side_effect = MockFunctionCallError("niScope_ProbeCompensationSignalStart") mock_library.niScope_ProbeCompensationSignalStart.return_value = 0 - mock_library.niScope_ProbeCompensationSignalStop.side_effect = ( - MockFunctionCallError("niScope_ProbeCompensationSignalStop") - ) + mock_library.niScope_ProbeCompensationSignalStop.side_effect = MockFunctionCallError("niScope_ProbeCompensationSignalStop") mock_library.niScope_ProbeCompensationSignalStop.return_value = 0 mock_library.niScope_Read.side_effect = MockFunctionCallError("niScope_Read") mock_library.niScope_Read.return_value = 0 - mock_library.niScope_ResetDevice.side_effect = MockFunctionCallError( - "niScope_ResetDevice" - ) + mock_library.niScope_ResetDevice.side_effect = MockFunctionCallError("niScope_ResetDevice") mock_library.niScope_ResetDevice.return_value = 0 - mock_library.niScope_ResetWithDefaults.side_effect = MockFunctionCallError( - "niScope_ResetWithDefaults" - ) + mock_library.niScope_ResetWithDefaults.side_effect = MockFunctionCallError("niScope_ResetWithDefaults") mock_library.niScope_ResetWithDefaults.return_value = 0 - mock_library.niScope_SendSoftwareTriggerEdge.side_effect = ( - MockFunctionCallError("niScope_SendSoftwareTriggerEdge") - ) + mock_library.niScope_SendSoftwareTriggerEdge.side_effect = MockFunctionCallError("niScope_SendSoftwareTriggerEdge") mock_library.niScope_SendSoftwareTriggerEdge.return_value = 0 - mock_library.niScope_SetAttributeViBoolean.side_effect = MockFunctionCallError( - "niScope_SetAttributeViBoolean" - ) + mock_library.niScope_SetAttributeViBoolean.side_effect = MockFunctionCallError("niScope_SetAttributeViBoolean") mock_library.niScope_SetAttributeViBoolean.return_value = 0 - mock_library.niScope_SetAttributeViInt32.side_effect = MockFunctionCallError( - "niScope_SetAttributeViInt32" - ) + mock_library.niScope_SetAttributeViInt32.side_effect = MockFunctionCallError("niScope_SetAttributeViInt32") mock_library.niScope_SetAttributeViInt32.return_value = 0 - mock_library.niScope_SetAttributeViInt64.side_effect = MockFunctionCallError( - "niScope_SetAttributeViInt64" - ) + mock_library.niScope_SetAttributeViInt64.side_effect = MockFunctionCallError("niScope_SetAttributeViInt64") mock_library.niScope_SetAttributeViInt64.return_value = 0 - mock_library.niScope_SetAttributeViReal64.side_effect = MockFunctionCallError( - "niScope_SetAttributeViReal64" - ) + mock_library.niScope_SetAttributeViReal64.side_effect = MockFunctionCallError("niScope_SetAttributeViReal64") mock_library.niScope_SetAttributeViReal64.return_value = 0 - mock_library.niScope_SetAttributeViString.side_effect = MockFunctionCallError( - "niScope_SetAttributeViString" - ) + mock_library.niScope_SetAttributeViString.side_effect = MockFunctionCallError("niScope_SetAttributeViString") mock_library.niScope_SetAttributeViString.return_value = 0 - mock_library.niScope_UnlockSession.side_effect = MockFunctionCallError( - "niScope_UnlockSession" - ) + mock_library.niScope_UnlockSession.side_effect = MockFunctionCallError("niScope_UnlockSession") mock_library.niScope_UnlockSession.return_value = 0 mock_library.niScope_close.side_effect = MockFunctionCallError("niScope_close") mock_library.niScope_close.return_value = 0 - mock_library.niScope_error_message.side_effect = MockFunctionCallError( - "niScope_error_message" - ) + mock_library.niScope_error_message.side_effect = MockFunctionCallError("niScope_error_message") mock_library.niScope_error_message.return_value = 0 mock_library.niScope_reset.side_effect = MockFunctionCallError("niScope_reset") mock_library.niScope_reset.return_value = 0 - mock_library.niScope_self_test.side_effect = MockFunctionCallError( - "niScope_self_test" - ) + mock_library.niScope_self_test.side_effect = MockFunctionCallError("niScope_self_test") mock_library.niScope_self_test.return_value = 0 diff --git a/generated/niscope/niscope/unit_tests/test_niscope.py b/generated/niscope/niscope/unit_tests/test_niscope.py index 5b6f2dbd1..a9c5902b8 100644 --- a/generated/niscope/niscope/unit_tests/test_niscope.py +++ b/generated/niscope/niscope/unit_tests/test_niscope.py @@ -8,13 +8,13 @@ def test_populate_samples_info(): waveform_infos.append(niscope.waveform_info.WaveformInfo()) waveform_infos[-1]._actual_samples = i - sample_data = array.array("d", [0, 1, 2, 3, 4, 5, 6, 7, 8]) + sample_data = array.array('d', [0, 1, 2, 3, 4, 5, 6, 7, 8]) niscope.waveform_info._populate_samples_info(waveform_infos, sample_data, 3) expected = [ - array.array("d", [0]), - array.array("d", [3, 4]), - array.array("d", [6, 7, 8]), + array.array('d', [0]), + array.array('d', [3, 4]), + array.array('d', [6, 7, 8]) ] for i in range(len(waveform_infos)): assert waveform_infos[i]._actual_samples is None @@ -28,9 +28,7 @@ def test_populate_channel_and_record_info(): channels = ["Dev1/4", "Dev2/2"] records = [0, 1, 2] - niscope.waveform_info._populate_channel_and_record_info( - waveform_infos, channels, records - ) + niscope.waveform_info._populate_channel_and_record_info(waveform_infos, channels, records) expected_channels = ["Dev1/4", "Dev2/2"] * len(records) expected_records = [0, 0, 1, 1, 2, 2] diff --git a/generated/niscope/niscope/waveform_info.py b/generated/niscope/niscope/waveform_info.py index 71d1be7b9..00cd610da 100644 --- a/generated/niscope/niscope/waveform_info.py +++ b/generated/niscope/niscope/waveform_info.py @@ -9,28 +9,19 @@ class struct_niScope_wfmInfo(ctypes.Structure): # noqa N801 _pack_ = 8 _fields_ = [ - ("absolute_initial_x", niscope._visatype.ViReal64), - ("relative_initial_x", niscope._visatype.ViReal64), - ("x_increment", niscope._visatype.ViReal64), - ("actual_samples", niscope._visatype.ViInt32), - ("offset", niscope._visatype.ViReal64), - ("gain", niscope._visatype.ViReal64), - ("reserved1", niscope._visatype.ViReal64), - ("reserved2", niscope._visatype.ViReal64), + ('absolute_initial_x', niscope._visatype.ViReal64), + ('relative_initial_x', niscope._visatype.ViReal64), + ('x_increment', niscope._visatype.ViReal64), + ('actual_samples', niscope._visatype.ViInt32), + ('offset', niscope._visatype.ViReal64), + ('gain', niscope._visatype.ViReal64), + ('reserved1', niscope._visatype.ViReal64), + ('reserved2', niscope._visatype.ViReal64), ] - def __init__( - self, - data=None, - absolute_initial_x=0.0, - relative_initial_x=0.0, - x_increment=0.0, - actual_samples=0, - offset=0.0, - gain=0.0, - reserved1=0.0, - reserved2=0.0, - ): + def __init__(self, data=None, absolute_initial_x=0.0, relative_initial_x=0.0, + x_increment=0.0, actual_samples=0, offset=0.0, gain=0.0, + reserved1=0.0, reserved2=0.0): super(ctypes.Structure, self).__init__() if data is not None: self.absolute_initial_x = data.absolute_initial_x @@ -53,17 +44,9 @@ def __init__( class WaveformInfo(object): - def __init__( - self, - data=None, - absolute_initial_x=0.0, - relative_initial_x=0.0, - x_increment=0.0, - offset=0.0, - gain=0.0, - reserved1=0.0, - reserved2=0.0, - ): + def __init__(self, data=None, absolute_initial_x=0.0, relative_initial_x=0.0, + x_increment=0.0, offset=0.0, gain=0.0, + reserved1=0.0, reserved2=0.0): if data is not None: self.absolute_initial_x = data.absolute_initial_x self.relative_initial_x = data.relative_initial_x @@ -92,60 +75,44 @@ def __init__( def __repr__(self): parameter_list = [ - "absolute_initial_x={}".format(self.absolute_initial_x), - "relative_initial_x={}".format(self.relative_initial_x), - "x_increment={}".format(self.x_increment), - "offset={}".format(self.offset), - "gain={}".format(self.gain), + 'absolute_initial_x={}'.format(self.absolute_initial_x), + 'relative_initial_x={}'.format(self.relative_initial_x), + 'x_increment={}'.format(self.x_increment), + 'offset={}'.format(self.offset), + 'gain={}'.format(self.gain) ] - return "{0}({1})".format(self.__class__.__name__, ", ".join(parameter_list)) + return '{0}({1})'.format(self.__class__.__name__, ', '.join(parameter_list)) def __str__(self): # different format lines - row_format_g = "{:<20}: {:,.6g}\n" - row_format_d = "{:<20}: {:,}\n" - row_format_s = "{:<20}: {:}\n" - - string_representation = "" - if ( - self.channel is not None - ): # We explicitly look for not None to differentiate from empty string - string_representation += row_format_s.format("Channel", self.channel) - if ( - self.record is not None - ): # We explicitly look for not None to differentiate from 0 - string_representation += row_format_d.format("Record", self.record) - - string_representation += row_format_g.format( - "Absolute X0", self.absolute_initial_x - ) - string_representation += row_format_g.format( - "Relative X0", self.relative_initial_x - ) - string_representation += row_format_g.format("dt", self.x_increment) - string_representation += row_format_g.format("Offset", self.offset) - string_representation += row_format_g.format("Gain", self.gain) - if ( - self.samples is not None - ): # We explicitly look for not None to differentiate from empty array - string_representation += row_format_g.format( - "Waveform Length", len(self.samples) - ) + row_format_g = '{:<20}: {:,.6g}\n' + row_format_d = '{:<20}: {:,}\n' + row_format_s = '{:<20}: {:}\n' + + string_representation = '' + if self.channel is not None: # We explicitly look for not None to differentiate from empty string + string_representation += row_format_s.format('Channel', self.channel) + if self.record is not None: # We explicitly look for not None to differentiate from 0 + string_representation += row_format_d.format('Record', self.record) + + string_representation += row_format_g.format('Absolute X0', self.absolute_initial_x) + string_representation += row_format_g.format('Relative X0', self.relative_initial_x) + string_representation += row_format_g.format('dt', self.x_increment) + string_representation += row_format_g.format('Offset', self.offset) + string_representation += row_format_g.format('Gain', self.gain) + if self.samples is not None: # We explicitly look for not None to differentiate from empty array + string_representation += row_format_g.format('Waveform Length', len(self.samples)) # Put possible private variable last - if ( - self._actual_samples is not None - ): # We explicitly look for not None to differentiate from 0 - string_representation += row_format_d.format( - "_actual samples", self._actual_samples - ) + if self._actual_samples is not None: # We explicitly look for not None to differentiate from 0 + string_representation += row_format_d.format('_actual samples', self._actual_samples) return string_representation def _populate_samples_info(waveform_infos, sample_data, num_samples_per_waveform): - """Chunk up flat array of sample_data and copy each chunk into individual WaveformInfo instance + '''Chunk up flat array of sample_data and copy each chunk into individual WaveformInfo instance Args: waveform_infos (Iterable of WaveformInfo): WaveformInfo class instances @@ -153,7 +120,7 @@ def _populate_samples_info(waveform_infos, sample_data, num_samples_per_waveform sample_data (Iterable of float): Waveform sample data num_samples_per_waveform (int): Number of samples belonging to each waveform - """ + ''' for i in range(len(waveform_infos)): start = i * num_samples_per_waveform end = start + waveform_infos[i]._actual_samples @@ -164,7 +131,7 @@ def _populate_samples_info(waveform_infos, sample_data, num_samples_per_waveform def _populate_channel_and_record_info(waveform_infos, channels, records): - """Populate the channel and record attributes of WaveformInfo instances + '''Populate the channel and record attributes of WaveformInfo instances Args: waveform_infos (Iterable of WaveformInfo): WaveformInfo class instances @@ -172,7 +139,7 @@ def _populate_channel_and_record_info(waveform_infos, channels, records): channels (Iterable of str): Channel names records (Iterable of int): Record numbers - """ + ''' i = 0 for record in records: for channel in channels: diff --git a/generated/niscope/setup.py b/generated/niscope/setup.py index 8a5f96209..4af2e3aa7 100644 --- a/generated/niscope/setup.py +++ b/generated/niscope/setup.py @@ -15,45 +15,42 @@ def finalize_options(self): def run_tests(self): import pytest - pytest.main(self.test_args) -pypi_name = "niscope" +pypi_name = 'niscope' def read_contents(file_to_read): - with open(file_to_read, "r") as f: + with open(file_to_read, 'r') as f: return f.read() setup( name=pypi_name, zip_safe=True, - version="1.4.2.dev0", - description="NI-SCOPE Python API", - long_description=read_contents("README.rst"), - long_description_content_type="text/x-rst", - author="NI", + version='1.4.2.dev0', + description='NI-SCOPE Python API', + long_description=read_contents('README.rst'), + long_description_content_type='text/x-rst', + author='NI', author_email="opensource@ni.com", url="https://github.com/ni/nimi-python", maintainer="NI", maintainer_email="opensource@ni.com", - keywords=["niscope"], - license="MIT", + keywords=['niscope'], + license='MIT', include_package_data=True, - packages=["niscope"], + packages=['niscope'], install_requires=[ 'enum34;python_version<"3.4"', 'singledispatch;python_version<"3.4"', - "hightime>=0.2.0", - "nitclk", - ], - setup_requires=[ - "pytest-runner", + 'hightime>=0.2.0', + 'nitclk', ], - tests_require=["pytest"], - test_suite="tests", + setup_requires=['pytest-runner', ], + tests_require=['pytest'], + test_suite='tests', classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -68,8 +65,8 @@ def read_contents(file_to_read): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", - "Topic :: System :: Hardware :: Hardware Drivers", + "Topic :: System :: Hardware :: Hardware Drivers" ], - cmdclass={"test": PyTest}, - package_data={pypi_name: ["VERSION"]}, + cmdclass={'test': PyTest}, + package_data={pypi_name: ['VERSION']}, ) diff --git a/generated/nise/nise/__init__.py b/generated/nise/nise/__init__.py index 02110c498..982f424d6 100644 --- a/generated/nise/nise/__init__.py +++ b/generated/nise/nise/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = "1.4.2.dev0" +__version__ = '1.4.2.dev0' from nise.enums import * # noqa: F403,F401,H303 from nise.errors import DriverWarning # noqa: F401 @@ -11,12 +11,12 @@ def get_diagnostic_information(): - """Get diagnostic information about the system state that is suitable for printing or logging + '''Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - """ + ''' import os import pkg_resources import platform @@ -24,80 +24,73 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return struct.calcsize("P") == 8 + return (struct.calcsize("P") == 8) def is_os_64bit(): - return platform.machine().endswith("64") + return platform.machine().endswith('64') def is_venv(): - return "VIRTUAL_ENV" in os.environ + return 'VIRTUAL_ENV' in os.environ info = {} - info["os"] = {} - info["python"] = {} - info["driver"] = {} - info["module"] = {} - if platform.system() == "Windows": + info['os'] = {} + info['python'] = {} + info['driver'] = {} + info['module'] = {} + if platform.system() == 'Windows': try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = "Windows" + os_name = 'Windows' try: - driver_version_key = winreg.OpenKey( - winreg.HKEY_LOCAL_MACHINE, - r"SOFTWARE\National Instruments\Switch Executive\CurrentVersion", - ) + driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\Switch Executive\CurrentVersion") driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = "Unknown" - elif platform.system() == "Linux": - os_name = "Linux" - driver_version = "Unknown" + driver_version = 'Unknown' + elif platform.system() == 'Linux': + os_name = 'Linux' + driver_version = 'Unknown' else: - raise SystemError("Unsupported platform: {}".format(platform.system())) + raise SystemError('Unsupported platform: {}'.format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [ - { - "name": i.key, - "version": i.version, - } - for i in installed_packages - ] - - info["os"]["name"] = os_name - info["os"]["version"] = platform.version() - info["os"]["bits"] = "64" if is_os_64bit() else "32" - info["driver"]["name"] = "NI Switch Executive" - info["driver"]["version"] = driver_version - info["module"]["name"] = "nise" - info["module"]["version"] = "1.4.2.dev0" - info["python"]["version"] = sys.version - info["python"]["bits"] = "64" if is_python_64bit() else "32" - info["python"]["is_venv"] = is_venv() - info["python"]["packages"] = installed_packages_list + installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] + + info['os']['name'] = os_name + info['os']['version'] = platform.version() + info['os']['bits'] = '64' if is_os_64bit() else '32' + info['driver']['name'] = "NI Switch Executive" + info['driver']['version'] = driver_version + info['module']['name'] = 'nise' + info['module']['version'] = "1.4.2.dev0" + info['python']['version'] = sys.version + info['python']['bits'] = '64' if is_python_64bit() else '32' + info['python']['is_venv'] = is_venv() + info['python']['packages'] = installed_packages_list return info def print_diagnostic_information(): - """Print diagnostic information in a format suitable for issue report + '''Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - """ + ''' info = get_diagnostic_information() - row_format = " {:<10} {}" - for type in ["OS", "Driver", "Module", "Python"]: + row_format = ' {:<10} {}' + for type in ['OS', 'Driver', 'Module', 'Python']: typename = type.lower() - print(type + ":") + print(type + ':') for item in info[typename]: - if item != "packages": - print(row_format.format(item.title() + ":", info[typename][item])) - print(" Installed Packages:") - for p in info["python"]["packages"]: - print((" " * 8) + p["name"] + "==" + p["version"]) + if item != 'packages': + print(row_format.format(item.title() + ':', info[typename][item])) + print(' Installed Packages:') + for p in info['python']['packages']: + print((' ' * 8) + p['name'] + '==' + p['version']) return info + + diff --git a/generated/nise/nise/_converters.py b/generated/nise/nise/_converters.py index 577411557..63de67487 100644 --- a/generated/nise/nise/_converters.py +++ b/generated/nise/nise/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - """Base version that should not be called + '''Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,38 +40,36 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - """ - raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) + ''' + raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - """Integer version""" + '''Integer version''' return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - """String version (this is the most complex) + '''String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - """ + ''' # First we deal with a list - rep_cap_list = repeated_capability.split(",") + rep_cap_list = repeated_capability.split(',') if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, "").replace(":", "-") - rc = r.split("-") + r = repeated_capability.strip().replace(prefix, '').replace(':', '-') + rc = r.split('-') if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError( - "Multiple '-' or ':'", repeated_capability - ) + raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) try: start = int(rc[0]) end = int(rc[1]) @@ -87,7 +85,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, "").strip()] + return [repeated_capability.replace(prefix, '').strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -96,7 +94,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - """Iterable version - can handle lists, ranges, and tuples""" + '''Iterable version - can handle lists, ranges, and tuples''' rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -105,22 +103,16 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - """slice version""" - + '''slice version''' def ifnone(a, b): return b if a is None else a - # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range( - ifnone(repeated_capability.start, 0), - repeated_capability.stop, - ifnone(repeated_capability.step, 1), - ) + rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=""): - """Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=''): + '''Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -128,17 +120,15 @@ def convert_repeated_capabilities(repeated_capability, prefix=""): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - """ + ''' # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [ - prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) - ] + return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] def convert_repeated_capabilities_without_prefix(repeated_capability): - """Convert a repeated capabilities object, without any prefix, to a comma delimited list + '''Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -154,8 +144,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - """ - return ",".join(convert_repeated_capabilities(repeated_capability, "")) + ''' + return ','.join(convert_repeated_capabilities(repeated_capability, '')) def _convert_timedelta(value, library_type, scaling): @@ -168,14 +158,7 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [ - _visatype.ViInt64, - _visatype.ViInt32, - _visatype.ViUInt32, - _visatype.ViInt16, - _visatype.ViUInt16, - _visatype.ViInt8, - ]: + if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -212,36 +195,34 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - "rangecheck": "RangeCheck", - "queryinstrstatus": "QueryInstrStatus", - "cache": "Cache", - "simulate": "Simulate", - "recordcoercions": "RecordCoercions", - "interchangecheck": "InterchangeCheck", - "driversetup": "DriverSetup", - "range_check": "RangeCheck", - "query_instr_status": "QueryInstrStatus", - "record_coercions": "RecordCoercions", - "interchange_check": "InterchangeCheck", - "driver_setup": "DriverSetup", + 'rangecheck': 'RangeCheck', + 'queryinstrstatus': 'QueryInstrStatus', + 'cache': 'Cache', + 'simulate': 'Simulate', + 'recordcoercions': 'RecordCoercions', + 'interchangecheck': 'InterchangeCheck', + 'driversetup': 'DriverSetup', + 'range_check': 'RangeCheck', + 'query_instr_status': 'QueryInstrStatus', + 'record_coercions': 'RecordCoercions', + 'interchange_check': 'InterchangeCheck', + 'driver_setup': 'DriverSetup', } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": - value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") - elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": + if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': + value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') + elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': if not isinstance(values[k], dict): - raise TypeError("DriverSetup must be a dictionary") - value = "DriverSetup=" + ( - ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) - ) + raise TypeError('DriverSetup must be a dictionary') + value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) else: - value = k + ("=1" if values[k] is True else "=0") + value = k + ('=1' if values[k] is True else '=0') init_with_options.append(value) - init_with_options_string = ",".join(init_with_options) + init_with_options_string = ','.join(init_with_options) return init_with_options_string @@ -270,11 +251,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(",")] + return [x.strip() for x in comma_separated_string.split(',')] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -286,17 +267,11 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - """ - chained_repeated_capability_items = convert_comma_separated_string_to_list( - chained_repeated_capability - ) - repeated_capability_lists = [ - [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) - ] + ''' + chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) + repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] for item in chained_repeated_capability_items: - repeated_capability_lists = [ - x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) - ] - return [ - ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists - ] + repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] + return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] + + diff --git a/generated/nise/nise/_library.py b/generated/nise/nise/_library.py index b02023386..05af687c9 100644 --- a/generated/nise/nise/_library.py +++ b/generated/nise/nise/_library.py @@ -9,11 +9,11 @@ class Library(object): - """Library + '''Library Wrapper around driver library. Class will setup the correct ctypes information for every function on first call. - """ + ''' def __init__(self, ctypes_library): self._func_lock = threading.Lock() @@ -43,210 +43,103 @@ def _get_library_function(self, name): def niSE_CloseSession(self, vi): # noqa: N802 with self._func_lock: if self.niSE_CloseSession_cfunc is None: - self.niSE_CloseSession_cfunc = self._get_library_function( - "niSE_CloseSession" - ) + self.niSE_CloseSession_cfunc = self._get_library_function('niSE_CloseSession') self.niSE_CloseSession_cfunc.argtypes = [ViSession] # noqa: F405 self.niSE_CloseSession_cfunc.restype = ViStatus # noqa: F405 return self.niSE_CloseSession_cfunc(vi) - def niSE_Connect( - self, vi, connect_spec, multiconnect_mode, wait_for_debounce - ): # noqa: N802 + def niSE_Connect(self, vi, connect_spec, multiconnect_mode, wait_for_debounce): # noqa: N802 with self._func_lock: if self.niSE_Connect_cfunc is None: - self.niSE_Connect_cfunc = self._get_library_function("niSE_Connect") - self.niSE_Connect_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ViBoolean, - ] # noqa: F405 + self.niSE_Connect_cfunc = self._get_library_function('niSE_Connect') + self.niSE_Connect_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ViBoolean] # noqa: F405 self.niSE_Connect_cfunc.restype = ViStatus # noqa: F405 - return self.niSE_Connect_cfunc( - vi, connect_spec, multiconnect_mode, wait_for_debounce - ) - - def niSE_ConnectAndDisconnect( - self, - vi, - connect_spec, - disconnect_spec, - multiconnect_mode, - operation_order, - wait_for_debounce, - ): # noqa: N802 + return self.niSE_Connect_cfunc(vi, connect_spec, multiconnect_mode, wait_for_debounce) + + def niSE_ConnectAndDisconnect(self, vi, connect_spec, disconnect_spec, multiconnect_mode, operation_order, wait_for_debounce): # noqa: N802 with self._func_lock: if self.niSE_ConnectAndDisconnect_cfunc is None: - self.niSE_ConnectAndDisconnect_cfunc = self._get_library_function( - "niSE_ConnectAndDisconnect" - ) - self.niSE_ConnectAndDisconnect_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViInt32, - ViInt32, - ViBoolean, - ] # noqa: F405 + self.niSE_ConnectAndDisconnect_cfunc = self._get_library_function('niSE_ConnectAndDisconnect') + self.niSE_ConnectAndDisconnect_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ViInt32, ViBoolean] # noqa: F405 self.niSE_ConnectAndDisconnect_cfunc.restype = ViStatus # noqa: F405 - return self.niSE_ConnectAndDisconnect_cfunc( - vi, - connect_spec, - disconnect_spec, - multiconnect_mode, - operation_order, - wait_for_debounce, - ) + return self.niSE_ConnectAndDisconnect_cfunc(vi, connect_spec, disconnect_spec, multiconnect_mode, operation_order, wait_for_debounce) def niSE_Disconnect(self, vi, disconnect_spec): # noqa: N802 with self._func_lock: if self.niSE_Disconnect_cfunc is None: - self.niSE_Disconnect_cfunc = self._get_library_function( - "niSE_Disconnect" - ) - self.niSE_Disconnect_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niSE_Disconnect_cfunc = self._get_library_function('niSE_Disconnect') + self.niSE_Disconnect_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 self.niSE_Disconnect_cfunc.restype = ViStatus # noqa: F405 return self.niSE_Disconnect_cfunc(vi, disconnect_spec) def niSE_DisconnectAll(self, vi): # noqa: N802 with self._func_lock: if self.niSE_DisconnectAll_cfunc is None: - self.niSE_DisconnectAll_cfunc = self._get_library_function( - "niSE_DisconnectAll" - ) + self.niSE_DisconnectAll_cfunc = self._get_library_function('niSE_DisconnectAll') self.niSE_DisconnectAll_cfunc.argtypes = [ViSession] # noqa: F405 self.niSE_DisconnectAll_cfunc.restype = ViStatus # noqa: F405 return self.niSE_DisconnectAll_cfunc(vi) - def niSE_ExpandRouteSpec( - self, - vi, - route_spec, - expand_action, - expanded_route_spec, - expanded_route_spec_size, - ): # noqa: N802 + def niSE_ExpandRouteSpec(self, vi, route_spec, expand_action, expanded_route_spec, expanded_route_spec_size): # noqa: N802 with self._func_lock: if self.niSE_ExpandRouteSpec_cfunc is None: - self.niSE_ExpandRouteSpec_cfunc = self._get_library_function( - "niSE_ExpandRouteSpec" - ) - self.niSE_ExpandRouteSpec_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niSE_ExpandRouteSpec_cfunc = self._get_library_function('niSE_ExpandRouteSpec') + self.niSE_ExpandRouteSpec_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32)] # noqa: F405 self.niSE_ExpandRouteSpec_cfunc.restype = ViStatus # noqa: F405 - return self.niSE_ExpandRouteSpec_cfunc( - vi, route_spec, expand_action, expanded_route_spec, expanded_route_spec_size - ) + return self.niSE_ExpandRouteSpec_cfunc(vi, route_spec, expand_action, expanded_route_spec, expanded_route_spec_size) - def niSE_FindRoute( - self, vi, channel1, channel2, route_spec, route_spec_size, path_capability - ): # noqa: N802 + def niSE_FindRoute(self, vi, channel1, channel2, route_spec, route_spec_size, path_capability): # noqa: N802 with self._func_lock: if self.niSE_FindRoute_cfunc is None: - self.niSE_FindRoute_cfunc = self._get_library_function("niSE_FindRoute") - self.niSE_FindRoute_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niSE_FindRoute_cfunc = self._get_library_function('niSE_FindRoute') + self.niSE_FindRoute_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32), ctypes.POINTER(ViInt32)] # noqa: F405 self.niSE_FindRoute_cfunc.restype = ViStatus # noqa: F405 - return self.niSE_FindRoute_cfunc( - vi, channel1, channel2, route_spec, route_spec_size, path_capability - ) + return self.niSE_FindRoute_cfunc(vi, channel1, channel2, route_spec, route_spec_size, path_capability) def niSE_GetAllConnections(self, vi, route_spec, route_spec_size): # noqa: N802 with self._func_lock: if self.niSE_GetAllConnections_cfunc is None: - self.niSE_GetAllConnections_cfunc = self._get_library_function( - "niSE_GetAllConnections" - ) - self.niSE_GetAllConnections_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niSE_GetAllConnections_cfunc = self._get_library_function('niSE_GetAllConnections') + self.niSE_GetAllConnections_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32)] # noqa: F405 self.niSE_GetAllConnections_cfunc.restype = ViStatus # noqa: F405 return self.niSE_GetAllConnections_cfunc(vi, route_spec, route_spec_size) - def niSE_GetError( - self, vi, error_number, error_description, error_description_size - ): # noqa: N802 + def niSE_GetError(self, vi, error_number, error_description, error_description_size): # noqa: N802 with self._func_lock: if self.niSE_GetError_cfunc is None: - self.niSE_GetError_cfunc = self._get_library_function("niSE_GetError") - self.niSE_GetError_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt32), - ctypes.POINTER(ViChar), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niSE_GetError_cfunc = self._get_library_function('niSE_GetError') + self.niSE_GetError_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt32), ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32)] # noqa: F405 self.niSE_GetError_cfunc.restype = ViStatus # noqa: F405 - return self.niSE_GetError_cfunc( - vi, error_number, error_description, error_description_size - ) + return self.niSE_GetError_cfunc(vi, error_number, error_description, error_description_size) def niSE_IsConnected(self, vi, route_spec, is_connected): # noqa: N802 with self._func_lock: if self.niSE_IsConnected_cfunc is None: - self.niSE_IsConnected_cfunc = self._get_library_function( - "niSE_IsConnected" - ) - self.niSE_IsConnected_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niSE_IsConnected_cfunc = self._get_library_function('niSE_IsConnected') + self.niSE_IsConnected_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViBoolean)] # noqa: F405 self.niSE_IsConnected_cfunc.restype = ViStatus # noqa: F405 return self.niSE_IsConnected_cfunc(vi, route_spec, is_connected) def niSE_IsDebounced(self, vi, is_debounced): # noqa: N802 with self._func_lock: if self.niSE_IsDebounced_cfunc is None: - self.niSE_IsDebounced_cfunc = self._get_library_function( - "niSE_IsDebounced" - ) - self.niSE_IsDebounced_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niSE_IsDebounced_cfunc = self._get_library_function('niSE_IsDebounced') + self.niSE_IsDebounced_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niSE_IsDebounced_cfunc.restype = ViStatus # noqa: F405 return self.niSE_IsDebounced_cfunc(vi, is_debounced) def niSE_OpenSession(self, virtual_device_name, option_string, vi): # noqa: N802 with self._func_lock: if self.niSE_OpenSession_cfunc is None: - self.niSE_OpenSession_cfunc = self._get_library_function( - "niSE_OpenSession" - ) - self.niSE_OpenSession_cfunc.argtypes = [ - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ctypes.POINTER(ViSession), - ] # noqa: F405 + self.niSE_OpenSession_cfunc = self._get_library_function('niSE_OpenSession') + self.niSE_OpenSession_cfunc.argtypes = [ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ctypes.POINTER(ViSession)] # noqa: F405 self.niSE_OpenSession_cfunc.restype = ViStatus # noqa: F405 return self.niSE_OpenSession_cfunc(virtual_device_name, option_string, vi) def niSE_WaitForDebounce(self, vi, maximum_time_ms): # noqa: N802 with self._func_lock: if self.niSE_WaitForDebounce_cfunc is None: - self.niSE_WaitForDebounce_cfunc = self._get_library_function( - "niSE_WaitForDebounce" - ) - self.niSE_WaitForDebounce_cfunc.argtypes = [ - ViSession, - ViInt32, - ] # noqa: F405 + self.niSE_WaitForDebounce_cfunc = self._get_library_function('niSE_WaitForDebounce') + self.niSE_WaitForDebounce_cfunc.argtypes = [ViSession, ViInt32] # noqa: F405 self.niSE_WaitForDebounce_cfunc.restype = ViStatus # noqa: F405 return self.niSE_WaitForDebounce_cfunc(vi, maximum_time_ms) diff --git a/generated/nise/nise/_library_singleton.py b/generated/nise/nise/_library_singleton.py index 84c82342a..d96bcb73a 100644 --- a/generated/nise/nise/_library_singleton.py +++ b/generated/nise/nise/_library_singleton.py @@ -12,36 +12,30 @@ _instance = None _instance_lock = threading.Lock() -_library_info = { - "Linux": {"64bit": {"name": "nise", "type": "cdll"}}, - "Windows": { - "32bit": {"name": "nise.dll", "type": "windll"}, - "64bit": {"name": "nise.dll", "type": "cdll"}, - }, -} +_library_info = {'Linux': {'64bit': {'name': 'nise', 'type': 'cdll'}}, + 'Windows': {'32bit': {'name': 'nise.dll', 'type': 'windll'}, + '64bit': {'name': 'nise.dll', 'type': 'cdll'}}} def _get_library_name(): try: - return ctypes.util.find_library( - _library_info[platform.system()][platform.architecture()[0]]["name"] - ) # We find and return full path to the DLL + return ctypes.util.find_library(_library_info[platform.system()][platform.architecture()[0]]['name']) # We find and return full path to the DLL except KeyError: raise errors.UnsupportedConfigurationError def _get_library_type(): try: - return _library_info[platform.system()][platform.architecture()[0]]["type"] + return _library_info[platform.system()][platform.architecture()[0]]['type'] except KeyError: raise errors.UnsupportedConfigurationError def get(): - """get + '''get Returns the library.Library singleton for nise. - """ + ''' global _instance global _instance_lock @@ -49,12 +43,13 @@ def get(): if _instance is None: try: library_type = _get_library_type() - if library_type == "windll": + if library_type == 'windll': ctypes_library = ctypes.WinDLL(_get_library_name()) else: - assert library_type == "cdll" + assert library_type == 'cdll' ctypes_library = ctypes.CDLL(_get_library_name()) except OSError: raise errors.DriverNotInstalledError() _instance = _library.Library(ctypes_library) return _instance + diff --git a/generated/nise/nise/_visatype.py b/generated/nise/nise/_visatype.py index bf96c3cfb..02cc41d1b 100644 --- a/generated/nise/nise/_visatype.py +++ b/generated/nise/nise/_visatype.py @@ -2,9 +2,9 @@ import ctypes -"""Definitions of the VISA types used by the C API of the driver runtime. +'''Definitions of the VISA types used by the C API of the driver runtime. These are aliased directly to ctypes types so can be used directly to call into the library. -""" +''' ViChar = ctypes.c_char @@ -26,3 +26,4 @@ ViAttr = ViUInt32 ViConstString = ViString ViRsrc = ViString + diff --git a/generated/nise/nise/enums.py b/generated/nise/nise/enums.py index a0fc8d4a5..7a377b806 100644 --- a/generated/nise/nise/enums.py +++ b/generated/nise/nise/enums.py @@ -6,75 +6,75 @@ class ExpandAction(Enum): ROUTES = 0 - r""" + r''' Expand to routes - """ + ''' PATHS = 1 - r""" + r''' Expand to paths - """ + ''' class MulticonnectMode(Enum): DEFAULT = -1 - r""" + r''' Default - """ + ''' NO_MULTICONNECT = 0 - r""" + r''' No multiconnect - """ + ''' MULTICONNECT = 1 - r""" + r''' Multiconnect - """ + ''' class OperationOrder(Enum): BEFORE = 1 - r""" + r''' Break before make - """ + ''' AFTER = 2 - r""" + r''' Break after make - """ + ''' class PathCapability(Enum): PATH_NEEDS_HARDWIRE = -2 - r""" + r''' Path needs hardwire - """ + ''' PATH_NEEDS_CONFIG_CHANNEL = -1 - r""" + r''' Path needs config channel - """ + ''' PATH_AVAILABLE = 1 - r""" + r''' Path available - """ + ''' PATH_EXISTS = 2 - r""" + r''' Path exists - """ + ''' PATH_UNSUPPORTED = 3 - r""" + r''' Path Unsupported - """ + ''' RESOURCE_IN_USE = 4 - r""" + r''' Resource in use - """ + ''' EXCLUSION_CONFLICT = 5 - r""" + r''' Exclusion conflict - """ + ''' CHANNEL_NOT_AVAILABLE = 6 - r""" + r''' Channel not available - """ + ''' CHANNELS_HARDWIRED = 7 - r""" + r''' Channels hardwired - """ + ''' diff --git a/generated/nise/nise/errors.py b/generated/nise/nise/errors.py index f7b97bfb1..47d194146 100644 --- a/generated/nise/nise/errors.py +++ b/generated/nise/nise/errors.py @@ -7,92 +7,77 @@ def _is_success(code): - return code == 0 + return (code == 0) def _is_error(code): - return code < 0 + return (code < 0) def _is_warning(code): - return code > 0 + return (code > 0) class Error(Exception): - """Base error class for NI Switch Executive""" + '''Base error class for NI Switch Executive''' def __init__(self, message): super(Error, self).__init__(message) class DriverError(Error): - """An error originating from the NI Switch Executive driver""" + '''An error originating from the NI Switch Executive driver''' def __init__(self, code, description): - assert _is_error(code), "Should not raise Error if code is not fatal." + assert (_is_error(code)), "Should not raise Error if code is not fatal." self.code = code self.description = description super(DriverError, self).__init__(str(self.code) + ": " + self.description) class DriverWarning(Warning): - """A warning originating from the NI Switch Executive driver""" + '''A warning originating from the NI Switch Executive driver''' def __init__(self, code, description): - assert _is_warning(code), "Should not create Warning if code is not positive." - super(DriverWarning, self).__init__( - "Warning {0} occurred.\n\n{1}".format(code, description) - ) + assert (_is_warning(code)), "Should not create Warning if code is not positive." + super(DriverWarning, self).__init__('Warning {0} occurred.\n\n{1}'.format(code, description)) class UnsupportedConfigurationError(Error): - """An error due to using this module in an usupported platform.""" + '''An error due to using this module in an usupported platform.''' def __init__(self): - super(UnsupportedConfigurationError, self).__init__( - "System configuration is unsupported: " - + platform.architecture()[0] - + " " - + platform.system() - ) + super(UnsupportedConfigurationError, self).__init__('System configuration is unsupported: ' + platform.architecture()[0] + ' ' + platform.system()) class DriverNotInstalledError(Error): - """An error due to using this module without the driver runtime installed.""" + '''An error due to using this module without the driver runtime installed.''' def __init__(self): - super(DriverNotInstalledError, self).__init__( - "The NI Switch Executive runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it." - ) + super(DriverNotInstalledError, self).__init__('The NI Switch Executive runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it.') class DriverTooOldError(Error): - """An error due to using this module with an older version of the driver runtime.""" + '''An error due to using this module with an older version of the driver runtime.''' def __init__(self): - super(DriverTooOldError, self).__init__( - "A function was not found in the NI Switch Executive runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it." - ) + super(DriverTooOldError, self).__init__('A function was not found in the NI Switch Executive runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it.') class InvalidRepeatedCapabilityError(Error): - """An error due to an invalid character in a repeated capability""" + '''An error due to an invalid character in a repeated capability''' def __init__(self, invalid_character, invalid_string): - super(InvalidRepeatedCapabilityError, self).__init__( - "An invalid character ({0}) was found in repeated capability string ({1})".format( - invalid_character, invalid_string - ) - ) + super(InvalidRepeatedCapabilityError, self).__init__('An invalid character ({0}) was found in repeated capability string ({1})'.format(invalid_character, invalid_string)) def handle_error(session, code, ignore_warnings, is_error_handling): - """handle_error + '''handle_error Helper function for handling errors returned by nise.Library. It calls back into the session to get the corresponding error description and raises if necessary. - """ + ''' if _is_success(code) or (_is_warning(code) and ignore_warnings): return @@ -100,7 +85,7 @@ def handle_error(session, code, ignore_warnings, is_error_handling): if is_error_handling: # The caller is in the midst of error handling and an error occurred. # Don't try to get the description or we'll start recursing until the stack overflows. - description = "" + description = '' else: description = session._get_error_description(code) @@ -109,3 +94,5 @@ def handle_error(session, code, ignore_warnings, is_error_handling): assert _is_warning(code) warnings.warn(DriverWarning(code, description)) + + diff --git a/generated/nise/nise/session.py b/generated/nise/nise/session.py index b03d186b1..90c1d5828 100644 --- a/generated/nise/nise/session.py +++ b/generated/nise/nise/session.py @@ -13,24 +13,22 @@ # Used for __repr__ import pprint - pp = pprint.PrettyPrinter(indent=4) # Helper functions for creating ctypes needed for calling into the driver DLL def get_ctypes_pointer_for_buffer(value=None, library_type=None, size=None): if isinstance(value, array.array): - assert library_type is not None, "library_type is required for array.array" + assert library_type is not None, 'library_type is required for array.array' addr, _ = value.buffer_info() return ctypes.cast(addr, ctypes.POINTER(library_type)) elif str(type(value)).find("'numpy.ndarray'") != -1: import numpy - return numpy.ctypeslib.as_ctypes(value) elif isinstance(value, bytes): return ctypes.cast(value, ctypes.POINTER(library_type)) elif isinstance(value, list): - assert library_type is not None, "library_type is required for list" + assert library_type is not None, 'library_type is required for list' return (library_type * len(value))(*value) else: if library_type is not None and size is not None: @@ -52,47 +50,41 @@ def get_ctypes_and_array(value, array_type): class _SessionBase(object): - """Base class for all NI Switch Executive sessions.""" + '''Base class for all NI Switch Executive sessions.''' # This is needed during __init__. Without it, __setattr__ raises an exception _is_frozen = False - def __init__( - self, repeated_capability_list, vi, library, encoding, freeze_it=False - ): + def __init__(self, repeated_capability_list, vi, library, encoding, freeze_it=False): self._repeated_capability_list = repeated_capability_list - self._repeated_capability = ",".join(repeated_capability_list) + self._repeated_capability = ','.join(repeated_capability_list) self._vi = vi self._library = library self._encoding = encoding # Store the parameter list for later printing in __repr__ param_list = [] - param_list.append( - "repeated_capability_list=" + pp.pformat(repeated_capability_list) - ) + param_list.append("repeated_capability_list=" + pp.pformat(repeated_capability_list)) param_list.append("vi=" + pp.pformat(vi)) param_list.append("library=" + pp.pformat(library)) param_list.append("encoding=" + pp.pformat(encoding)) - self._param_list = ", ".join(param_list) + self._param_list = ', '.join(param_list) self._is_frozen = freeze_it def __repr__(self): - return "{0}.{1}({2})".format("nise", self.__class__.__name__, self._param_list) + return '{0}.{1}({2})'.format('nise', self.__class__.__name__, self._param_list) def __setattr__(self, key, value): if self._is_frozen and key not in dir(self): - raise AttributeError( - "'{0}' object has no attribute '{1}'".format(type(self).__name__, key) - ) + raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) object.__setattr__(self, key, value) def _get_error_description(self, error_code): - """_get_error_description + '''_get_error_description Returns the error description. - """ + ''' try: _, error_string = self._get_error() return error_string @@ -100,20 +92,20 @@ def _get_error_description(self, error_code): pass try: - """ + ''' It is expected for _get_error to raise when the session is invalid (IVI spec requires GetError to fail). Use _error_message instead. It doesn't require a session. - """ + ''' error_string = self._error_message(error_code) return error_string except errors.Error: return "Failed to retrieve error description." - """ These are code-generated """ + ''' These are code-generated ''' def _get_error(self, error_description_size=[1024]): - r"""_get_error + r'''_get_error Get error information of the first error that occurred. If a valid pointer is passed to errorDescription or errorNumber, GetError will @@ -169,36 +161,21 @@ def _get_error(self, error_description_size=[1024]): specification string. Allocate a buffer of the appropriate size and then re-call the method to obtain the entire buffer. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_number_ctype = _visatype.ViInt32() # case S220 - error_description_ctype = ( - _visatype.ViChar * error_description_size[0] - )() # case C080 - error_description_size_ctype = get_ctypes_pointer_for_buffer( - value=error_description_size, library_type=_visatype.ViInt32 - ) # case B550 - error_code = self._library.niSE_GetError( - vi_ctype, - None - if error_number_ctype is None - else (ctypes.pointer(error_number_ctype)), - error_description_ctype, - error_description_size_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) - return int(error_number_ctype.value), error_description_ctype.value.decode( - self._encoding - ) + error_description_ctype = (_visatype.ViChar * error_description_size[0])() # case C080 + error_description_size_ctype = get_ctypes_pointer_for_buffer(value=error_description_size, library_type=_visatype.ViInt32) # case B550 + error_code = self._library.niSE_GetError(vi_ctype, None if error_number_ctype is None else (ctypes.pointer(error_number_ctype)), error_description_ctype, error_description_size_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) + return int(error_number_ctype.value), error_description_ctype.value.decode(self._encoding) class Session(_SessionBase): - """An NI Switch Executive session""" + '''An NI Switch Executive session''' def __init__(self, virtual_device_name, options={}): - r"""An NI Switch Executive session + r'''An NI Switch Executive session Opens a session to a specified NI Switch Executive virtual device. Opens communications with all of the IVI switches associated with the @@ -250,17 +227,11 @@ def __init__(self, virtual_device_name, options={}): Returns: session (nise.Session): A session object representing the device. - """ - super(Session, self).__init__( - repeated_capability_list=[], - vi=None, - library=None, - encoding=None, - freeze_it=False, - ) + ''' + super(Session, self).__init__(repeated_capability_list=[], vi=None, library=None, encoding=None, freeze_it=False) options = _converters.convert_init_with_options_dictionary(options) self._library = _library_singleton.get() - self._encoding = "windows-1251" + self._encoding = 'windows-1251' # Call specified init function self._vi = 0 # This must be set before calling _open_session(). @@ -270,7 +241,7 @@ def __init__(self, virtual_device_name, options={}): param_list = [] param_list.append("virtual_device_name=" + pp.pformat(virtual_device_name)) param_list.append("options=" + pp.pformat(options)) - self._param_list = ", ".join(param_list) + self._param_list = ', '.join(param_list) self._is_frozen = True @@ -281,7 +252,7 @@ def __exit__(self, exc_type, exc_value, traceback): self.close() def close(self): - """close + '''close Reduces the reference count of open sessions by one. If the reference count goes to 0, the method deallocates any memory resources the @@ -291,7 +262,7 @@ def close(self): Note: This method is not needed when using the session context manager - """ + ''' try: self._close_session() except errors.DriverError: @@ -299,31 +270,24 @@ def close(self): raise self._vi = 0 - """ These are code-generated """ + ''' These are code-generated ''' def _close_session(self): - r"""_close_session + r'''_close_session Reduces the reference count of open sessions by one. If the reference count goes to 0, the method deallocates any memory resources the driver uses and closes any open IVI switch sessions. After calling the close method, you should not use the NI Switch Executive virtual device again until you call __init__. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSE_CloseSession(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return - def connect( - self, - connect_spec, - multiconnect_mode=enums.MulticonnectMode.DEFAULT, - wait_for_debounce=True, - ): - r"""connect + def connect(self, connect_spec, multiconnect_mode=enums.MulticonnectMode.DEFAULT, wait_for_debounce=True): + r'''connect Connects the routes specified by the connection specification. When connecting, it may allow for multiconnection based on the @@ -371,40 +335,19 @@ def connect( operation after completing the first. The order of connect and disconnect operation is set by the Operation Order input. - """ + ''' if type(multiconnect_mode) is not enums.MulticonnectMode: - raise TypeError( - "Parameter multiconnect_mode must be of type " - + str(enums.MulticonnectMode) - ) + raise TypeError('Parameter multiconnect_mode must be of type ' + str(enums.MulticonnectMode)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - connect_spec_ctype = ctypes.create_string_buffer( - connect_spec.encode(self._encoding) - ) # case C020 - multiconnect_mode_ctype = _visatype.ViInt32( - multiconnect_mode.value - ) # case S130 + connect_spec_ctype = ctypes.create_string_buffer(connect_spec.encode(self._encoding)) # case C020 + multiconnect_mode_ctype = _visatype.ViInt32(multiconnect_mode.value) # case S130 wait_for_debounce_ctype = _visatype.ViBoolean(wait_for_debounce) # case S150 - error_code = self._library.niSE_Connect( - vi_ctype, - connect_spec_ctype, - multiconnect_mode_ctype, - wait_for_debounce_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niSE_Connect(vi_ctype, connect_spec_ctype, multiconnect_mode_ctype, wait_for_debounce_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return - def connect_and_disconnect( - self, - connect_spec, - disconnect_spec, - multiconnect_mode=enums.MulticonnectMode.DEFAULT, - operation_order=enums.OperationOrder.AFTER, - wait_for_debounce=True, - ): - r"""connect_and_disconnect + def connect_and_disconnect(self, connect_spec, disconnect_spec, multiconnect_mode=enums.MulticonnectMode.DEFAULT, operation_order=enums.OperationOrder.AFTER, wait_for_debounce=True): + r'''connect_and_disconnect Connects routes and disconnects routes in a similar fashion to connect and disconnect except that the operations happen in @@ -483,43 +426,23 @@ def connect_and_disconnect( operation after completing the first. The order of connect and disconnect operation is set by the Operation Order input. - """ + ''' if type(multiconnect_mode) is not enums.MulticonnectMode: - raise TypeError( - "Parameter multiconnect_mode must be of type " - + str(enums.MulticonnectMode) - ) + raise TypeError('Parameter multiconnect_mode must be of type ' + str(enums.MulticonnectMode)) if type(operation_order) is not enums.OperationOrder: - raise TypeError( - "Parameter operation_order must be of type " + str(enums.OperationOrder) - ) + raise TypeError('Parameter operation_order must be of type ' + str(enums.OperationOrder)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - connect_spec_ctype = ctypes.create_string_buffer( - connect_spec.encode(self._encoding) - ) # case C020 - disconnect_spec_ctype = ctypes.create_string_buffer( - disconnect_spec.encode(self._encoding) - ) # case C020 - multiconnect_mode_ctype = _visatype.ViInt32( - multiconnect_mode.value - ) # case S130 + connect_spec_ctype = ctypes.create_string_buffer(connect_spec.encode(self._encoding)) # case C020 + disconnect_spec_ctype = ctypes.create_string_buffer(disconnect_spec.encode(self._encoding)) # case C020 + multiconnect_mode_ctype = _visatype.ViInt32(multiconnect_mode.value) # case S130 operation_order_ctype = _visatype.ViInt32(operation_order.value) # case S130 wait_for_debounce_ctype = _visatype.ViBoolean(wait_for_debounce) # case S150 - error_code = self._library.niSE_ConnectAndDisconnect( - vi_ctype, - connect_spec_ctype, - disconnect_spec_ctype, - multiconnect_mode_ctype, - operation_order_ctype, - wait_for_debounce_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niSE_ConnectAndDisconnect(vi_ctype, connect_spec_ctype, disconnect_spec_ctype, multiconnect_mode_ctype, operation_order_ctype, wait_for_debounce_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def disconnect(self, disconnect_spec): - r"""disconnect + r'''disconnect Disconnects the routes specified in the Disconnection Specification. If any of the specified routes were originally connected in a @@ -540,39 +463,28 @@ def disconnect(self, disconnect_spec): [A->Switch1/r0->B] Refer to Route Specification Strings in the NI Switch Executive Help for more information. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - disconnect_spec_ctype = ctypes.create_string_buffer( - disconnect_spec.encode(self._encoding) - ) # case C020 + disconnect_spec_ctype = ctypes.create_string_buffer(disconnect_spec.encode(self._encoding)) # case C020 error_code = self._library.niSE_Disconnect(vi_ctype, disconnect_spec_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def disconnect_all(self): - r"""disconnect_all + r'''disconnect_all Disconnects all connections on every IVI switch device managed by the NISE session reference passed to this method. disconnect_all ignores all multiconnect modes. Calling disconnect_all resets all of the switch states for the system. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSE_DisconnectAll(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return - def expand_route_spec( - self, - route_spec, - expand_action=enums.ExpandAction.ROUTES, - expanded_route_spec_size=[1024], - ): - r"""expand_route_spec + def expand_route_spec(self, route_spec, expand_action=enums.ExpandAction.ROUTES, expanded_route_spec_size=[1024]): + r'''expand_route_spec Expands a route spec string to yield more information about the routes and route groups within the spec. The route specification string @@ -625,36 +537,20 @@ def expand_route_spec( Allocate a buffer of the appropriate size and then re-call the method to obtain the entire buffer. - """ + ''' if type(expand_action) is not enums.ExpandAction: - raise TypeError( - "Parameter expand_action must be of type " + str(enums.ExpandAction) - ) + raise TypeError('Parameter expand_action must be of type ' + str(enums.ExpandAction)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - route_spec_ctype = ctypes.create_string_buffer( - route_spec.encode(self._encoding) - ) # case C020 + route_spec_ctype = ctypes.create_string_buffer(route_spec.encode(self._encoding)) # case C020 expand_action_ctype = _visatype.ViInt32(expand_action.value) # case S130 - expanded_route_spec_ctype = ( - _visatype.ViChar * expanded_route_spec_size[0] - )() # case C080 - expanded_route_spec_size_ctype = get_ctypes_pointer_for_buffer( - value=expanded_route_spec_size, library_type=_visatype.ViInt32 - ) # case B550 - error_code = self._library.niSE_ExpandRouteSpec( - vi_ctype, - route_spec_ctype, - expand_action_ctype, - expanded_route_spec_ctype, - expanded_route_spec_size_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + expanded_route_spec_ctype = (_visatype.ViChar * expanded_route_spec_size[0])() # case C080 + expanded_route_spec_size_ctype = get_ctypes_pointer_for_buffer(value=expanded_route_spec_size, library_type=_visatype.ViInt32) # case B550 + error_code = self._library.niSE_ExpandRouteSpec(vi_ctype, route_spec_ctype, expand_action_ctype, expanded_route_spec_ctype, expanded_route_spec_size_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return expanded_route_spec_ctype.value.decode(self._encoding) def find_route(self, channel1, channel2, route_spec_size=[1024]): - r"""find_route + r'''find_route Finds an existing or potential route between channel 1 and channel 2. The returned route specification contains the route specification and @@ -723,38 +619,19 @@ def find_route(self, channel1, channel2, route_spec_size=[1024]): Channels Hardwired (7) The two channels reside on the same hardwire. An implicit path already exists. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel1_ctype = ctypes.create_string_buffer( - channel1.encode(self._encoding) - ) # case C020 - channel2_ctype = ctypes.create_string_buffer( - channel2.encode(self._encoding) - ) # case C020 + channel1_ctype = ctypes.create_string_buffer(channel1.encode(self._encoding)) # case C020 + channel2_ctype = ctypes.create_string_buffer(channel2.encode(self._encoding)) # case C020 route_spec_ctype = (_visatype.ViChar * route_spec_size[0])() # case C080 - route_spec_size_ctype = get_ctypes_pointer_for_buffer( - value=route_spec_size, library_type=_visatype.ViInt32 - ) # case B550 + route_spec_size_ctype = get_ctypes_pointer_for_buffer(value=route_spec_size, library_type=_visatype.ViInt32) # case B550 path_capability_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niSE_FindRoute( - vi_ctype, - channel1_ctype, - channel2_ctype, - route_spec_ctype, - route_spec_size_ctype, - None - if path_capability_ctype is None - else (ctypes.pointer(path_capability_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return route_spec_ctype.value.decode(self._encoding), enums.PathCapability( - path_capability_ctype.value - ) + error_code = self._library.niSE_FindRoute(vi_ctype, channel1_ctype, channel2_ctype, route_spec_ctype, route_spec_size_ctype, None if path_capability_ctype is None else (ctypes.pointer(path_capability_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return route_spec_ctype.value.decode(self._encoding), enums.PathCapability(path_capability_ctype.value) def get_all_connections(self, route_spec_size=[1024]): - r"""get_all_connections + r'''get_all_connections Returns the top-level connected routes and route groups. The route specification string returned from get_all_connections can be passed @@ -792,22 +669,16 @@ def get_all_connections(self, route_spec_size=[1024]): Allocate a buffer of the appropriate size and then re-call the method to obtain the entire buffer. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 route_spec_ctype = (_visatype.ViChar * route_spec_size[0])() # case C080 - route_spec_size_ctype = get_ctypes_pointer_for_buffer( - value=route_spec_size, library_type=_visatype.ViInt32 - ) # case B550 - error_code = self._library.niSE_GetAllConnections( - vi_ctype, route_spec_ctype, route_spec_size_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + route_spec_size_ctype = get_ctypes_pointer_for_buffer(value=route_spec_size, library_type=_visatype.ViInt32) # case B550 + error_code = self._library.niSE_GetAllConnections(vi_ctype, route_spec_ctype, route_spec_size_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return route_spec_ctype.value.decode(self._encoding) def is_connected(self, route_spec): - r"""is_connected + r'''is_connected Checks whether the specified routes and routes groups are connected. It returns true if connected. @@ -827,26 +698,16 @@ def is_connected(self, route_spec): is_connected (bool): Returns TRUE if the routes and routes groups are connected or FALSE if they are not. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - route_spec_ctype = ctypes.create_string_buffer( - route_spec.encode(self._encoding) - ) # case C020 + route_spec_ctype = ctypes.create_string_buffer(route_spec.encode(self._encoding)) # case C020 is_connected_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niSE_IsConnected( - vi_ctype, - route_spec_ctype, - None - if is_connected_ctype is None - else (ctypes.pointer(is_connected_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niSE_IsConnected(vi_ctype, route_spec_ctype, None if is_connected_ctype is None else (ctypes.pointer(is_connected_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(is_connected_ctype.value) def is_debounced(self): - r"""is_debounced + r'''is_debounced Checks to see if the switching system is debounced or not. This method does not wait for debouncing to occur. It returns true if the system is @@ -857,22 +718,15 @@ def is_debounced(self): is_debounced (bool): Returns TRUE if the system is fully debounced or FALSE if it is still settling. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 is_debounced_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niSE_IsDebounced( - vi_ctype, - None - if is_debounced_ctype is None - else (ctypes.pointer(is_debounced_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niSE_IsDebounced(vi_ctype, None if is_debounced_ctype is None else (ctypes.pointer(is_debounced_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(is_debounced_ctype.value) def _open_session(self, virtual_device_name, option_string=""): - r"""_open_session + r'''_open_session Opens a session to a specified NI Switch Executive virtual device. Opens communications with all of the IVI switches associated with the @@ -901,28 +755,16 @@ def _open_session(self, virtual_device_name, option_string=""): Returns: vi (int): The session referencing this NI Switch Executive virtual device session. - """ - virtual_device_name_ctype = ctypes.create_string_buffer( - virtual_device_name.encode(self._encoding) - ) # case C020 - option_string_ctype = ctypes.create_string_buffer( - _converters.convert_init_with_options_dictionary(option_string).encode( - self._encoding - ) - ) # case C040 + ''' + virtual_device_name_ctype = ctypes.create_string_buffer(virtual_device_name.encode(self._encoding)) # case C020 + option_string_ctype = ctypes.create_string_buffer(_converters.convert_init_with_options_dictionary(option_string).encode(self._encoding)) # case C040 vi_ctype = _visatype.ViSession() # case S220 - error_code = self._library.niSE_OpenSession( - virtual_device_name_ctype, - option_string_ctype, - None if vi_ctype is None else (ctypes.pointer(vi_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niSE_OpenSession(virtual_device_name_ctype, option_string_ctype, None if vi_ctype is None else (ctypes.pointer(vi_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(vi_ctype.value) def wait_for_debounce(self, maximum_time_ms=hightime.timedelta(milliseconds=-1)): - r"""wait_for_debounce + r'''wait_for_debounce Waits for all of the switches in the NI Switch Executive virtual device to debounce. This method does not return until either the switching @@ -940,13 +782,12 @@ def wait_for_debounce(self, maximum_time_ms=hightime.timedelta(milliseconds=-1)) if the system is not debounced at that time. A value of -1 means to block for an infinite period of time until the system is debounced. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_time_ms_ctype = _converters.convert_timedelta_to_milliseconds_int32( - maximum_time_ms - ) # case S140 + maximum_time_ms_ctype = _converters.convert_timedelta_to_milliseconds_int32(maximum_time_ms) # case S140 error_code = self._library.niSE_WaitForDebounce(vi_ctype, maximum_time_ms_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return + + + diff --git a/generated/nise/nise/unit_tests/_matchers.py b/generated/nise/nise/unit_tests/_matchers.py index e1eb551e9..80750d519 100644 --- a/generated/nise/nise/unit_tests/_matchers.py +++ b/generated/nise/nise/unit_tests/_matchers.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # This file was generated -"""Matcher classes used by unit tests in order to set mock expectations. +'''Matcher classes used by unit tests in order to set mock expectations. These work well with our visatype definitions. -""" +''' import ctypes import nise._visatype as _visatype @@ -21,27 +21,15 @@ def __init__(self, expected_type, expected_value): def __eq__(self, other): if not isinstance(other, self.expected_type): - print( - "{0}: Unexpected type. Expected: {1}. Received: {2}".format( - self.__class__.__name__, self.expected_type, type(other) - ) - ) + print("{0}: Unexpected type. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_type, type(other))) return False if other.value != self.expected_value: - print( - "{0}: Unexpected value. Expected: {1}. Received: {2}".format( - self.__class__.__name__, self.expected_value, other.value - ) - ) + print("{0}: Unexpected value. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_value, other.value)) return False return True def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_type), - pp.pformat(self.expected_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) class _PointerMatcher(object): @@ -50,18 +38,12 @@ def __init__(self, expected_type): def __eq__(self, other): if not isinstance(other, ctypes.POINTER(self.expected_type)): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - ctypes.POINTER(self.expected_type), type(other) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(ctypes.POINTER(self.expected_type), type(other))) return False return True def __repr__(self): - return "{0}({1})".format( - self.__class__.__name__, pp.pformat(self.expected_type) - ) + return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_type)) class _BufferMatcher(object): @@ -88,47 +70,29 @@ def __eq__(self, other): pass # Because of object lifetimes, we may need to mock the other instance and provide lists instead of the actual array - if not isinstance(other, self.expected_type) and not isinstance( - other, list - ): - print( - "Unexpected type. Expected: {0} or {1}. Received: {2}".format( - self.expected_type, list, type(other) - ) - ) + if not isinstance(other, self.expected_type) and not isinstance(other, list): + print("Unexpected type. Expected: {0} or {1}. Received: {2}".format(self.expected_type, list, type(other))) return False if self.expected_size != len(other): - print( - "Unexpected length. Expected: {0}. Received: {1}".format( - self.expected_size, len(other) - ) - ) + print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(other))) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for i in range(0, len(self.expected_value)): if self.expected_value[i] != other[i]: - print( - "Unexpected value at index {0}. Expected: {1}. Received: {2}".format( - i, self.expected_value[i], other[i] - ) - ) + print("Unexpected value at index {0}. Expected: {1}. Received: {2}".format(i, self.expected_value[i], other[i])) return False return True def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self._expected_element_type), - pp.pformat(self._expected_size_or_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self._expected_element_type), pp.pformat(self._expected_size_or_value)) def __str__(self): - ret_str = self.__repr__() + "\n" - ret_str += " expected_type = " + str(self.expected_type) + "\n" - ret_str += " expected_value = " + str(self.expected_value) + "\n" - ret_str += " expected_size = " + str(self.expected_size) + "\n" + ret_str = self.__repr__() + '\n' + ret_str += ' expected_type = ' + str(self.expected_type) + '\n' + ret_str += ' expected_value = ' + str(self.expected_value) + '\n' + ret_str += ' expected_size = ' + str(self.expected_size) + '\n' return ret_str @@ -148,37 +112,21 @@ def __eq__(self, other): pass if not isinstance(other, ctypes.Array): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_type, type(other) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(other))) return False - if ( - len(other) < len(self.expected_string_value) + 1 - ): # +1 for NULL terminating character - print( - "Unexpected length in C string. Expected at least: {0}. Received {1}".format( - len(other), len(self.expected_string_value) + 1 - ) - ) + if len(other) < len(self.expected_string_value) + 1: # +1 for NULL terminating character + print("Unexpected length in C string. Expected at least: {0}. Received {1}".format(len(other), len(self.expected_string_value) + 1)) return False if not isinstance(other[0], bytes): print("Unexpected type. Not a string. Received: {0}".format(type(other[0]))) return False if other.value.decode("ascii") != self.expected_string_value: - print( - "Unexpected value. Expected {0}. Received: {1}".format( - self.expected_string_value, other.value.decode - ) - ) + print("Unexpected value. Expected {0}. Received: {1}".format(self.expected_string_value, other.value.decode)) return False return True def __repr__(self): - return "{0}({1})".format( - self.__class__.__name__, pp.pformat(self.expected_string_value) - ) + return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_string_value)) # Custom Type @@ -191,11 +139,7 @@ def _compare_ctype_structs(expected, actual): expected_val = getattr(expected, field_name) actual_val = getattr(actual, field_name) if expected_val != actual_val: - print( - "Unexpected value field {0}. Expected: {1}. Received: {2}".format( - field_name, expected_val, actual_val - ) - ) + print("Unexpected value field {0}. Expected: {1}. Received: {2}".format(field_name, expected_val, actual_val)) return False return True @@ -207,20 +151,12 @@ def __init__(self, expected_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_type, type(actual) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) return False return _compare_ctype_structs(self.expected_value, actual) def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_type), - pp.pformat(self.expected_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) class CustomTypeBufferMatcher(object): @@ -232,48 +168,30 @@ def __init__(self, expected_element_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print( - "Unexpected array type. Expected: {0}. Received: {1}".format( - self.expected_type, type(actual) - ) - ) + print("Unexpected array type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) return False if self.expected_size != len(actual): - print( - "Unexpected length. Expected: {0}. Received: {1}".format( - self.expected_size, len(actual) - ) - ) + print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(actual))) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for a, e in zip(actual, self.expected_value): if not isinstance(a, self.expected_element_type): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_element_type, type(a) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_element_type, type(a))) return False if not _compare_ctype_structs(e, a): return False return True def __repr__(self): - expected_val_repr = ( - "[" + ", ".join([x.__repr__() for x in self.expected_value]) + "]" - ) - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_element_type), - expected_val_repr, - ) + expected_val_repr = '[' + ', '.join([x.__repr__() for x in self.expected_value]) + ']' + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_element_type), expected_val_repr) def __str__(self): - ret_str = self.__repr__() + "\n" - ret_str += " expected_type = " + str(self.expected_type) + "\n" - ret_str += " expected_size = " + str(self.expected_size) + "\n" + ret_str = self.__repr__() + '\n' + ret_str += ' expected_type = ' + str(self.expected_type) + '\n' + ret_str += ' expected_size = ' + str(self.expected_size) + '\n' return ret_str @@ -282,9 +200,7 @@ def __str__(self): class ViBooleanMatcher(_ScalarMatcher): def __init__(self, expected_value): - _ScalarMatcher.__init__( - self, _visatype.ViBoolean, 1 if expected_value is True else 0 - ) + _ScalarMatcher.__init__(self, _visatype.ViBoolean, 1 if expected_value is True else 0) class ViSessionMatcher(_ScalarMatcher): @@ -396,3 +312,6 @@ def __init__(self, expected_size_or_value): class ViSessionBufferMatcher(_BufferMatcher): def __init__(self, expected_size_or_value): _BufferMatcher.__init__(self, _visatype.ViSession, expected_size_or_value) + + + diff --git a/generated/nise/nise/unit_tests/_mock_helper.py b/generated/nise/nise/unit_tests/_mock_helper.py index 619596438..79e48528e 100644 --- a/generated/nise/nise/unit_tests/_mock_helper.py +++ b/generated/nise/nise/unit_tests/_mock_helper.py @@ -16,41 +16,41 @@ def __init__(self, function, param=None): class SideEffectsHelper(object): def __init__(self): self._defaults = {} - self._defaults["CloseSession"] = {} - self._defaults["CloseSession"]["return"] = 0 - self._defaults["Connect"] = {} - self._defaults["Connect"]["return"] = 0 - self._defaults["ConnectAndDisconnect"] = {} - self._defaults["ConnectAndDisconnect"]["return"] = 0 - self._defaults["Disconnect"] = {} - self._defaults["Disconnect"]["return"] = 0 - self._defaults["DisconnectAll"] = {} - self._defaults["DisconnectAll"]["return"] = 0 - self._defaults["ExpandRouteSpec"] = {} - self._defaults["ExpandRouteSpec"]["return"] = 0 - self._defaults["ExpandRouteSpec"]["expandedRouteSpec"] = None - self._defaults["FindRoute"] = {} - self._defaults["FindRoute"]["return"] = 0 - self._defaults["FindRoute"]["routeSpec"] = None - self._defaults["FindRoute"]["pathCapability"] = None - self._defaults["GetAllConnections"] = {} - self._defaults["GetAllConnections"]["return"] = 0 - self._defaults["GetAllConnections"]["routeSpec"] = None - self._defaults["GetError"] = {} - self._defaults["GetError"]["return"] = 0 - self._defaults["GetError"]["errorNumber"] = None - self._defaults["GetError"]["errorDescription"] = None - self._defaults["IsConnected"] = {} - self._defaults["IsConnected"]["return"] = 0 - self._defaults["IsConnected"]["isConnected"] = None - self._defaults["IsDebounced"] = {} - self._defaults["IsDebounced"]["return"] = 0 - self._defaults["IsDebounced"]["isDebounced"] = None - self._defaults["OpenSession"] = {} - self._defaults["OpenSession"]["return"] = 0 - self._defaults["OpenSession"]["vi"] = None - self._defaults["WaitForDebounce"] = {} - self._defaults["WaitForDebounce"]["return"] = 0 + self._defaults['CloseSession'] = {} + self._defaults['CloseSession']['return'] = 0 + self._defaults['Connect'] = {} + self._defaults['Connect']['return'] = 0 + self._defaults['ConnectAndDisconnect'] = {} + self._defaults['ConnectAndDisconnect']['return'] = 0 + self._defaults['Disconnect'] = {} + self._defaults['Disconnect']['return'] = 0 + self._defaults['DisconnectAll'] = {} + self._defaults['DisconnectAll']['return'] = 0 + self._defaults['ExpandRouteSpec'] = {} + self._defaults['ExpandRouteSpec']['return'] = 0 + self._defaults['ExpandRouteSpec']['expandedRouteSpec'] = None + self._defaults['FindRoute'] = {} + self._defaults['FindRoute']['return'] = 0 + self._defaults['FindRoute']['routeSpec'] = None + self._defaults['FindRoute']['pathCapability'] = None + self._defaults['GetAllConnections'] = {} + self._defaults['GetAllConnections']['return'] = 0 + self._defaults['GetAllConnections']['routeSpec'] = None + self._defaults['GetError'] = {} + self._defaults['GetError']['return'] = 0 + self._defaults['GetError']['errorNumber'] = None + self._defaults['GetError']['errorDescription'] = None + self._defaults['IsConnected'] = {} + self._defaults['IsConnected']['return'] = 0 + self._defaults['IsConnected']['isConnected'] = None + self._defaults['IsDebounced'] = {} + self._defaults['IsDebounced']['return'] = 0 + self._defaults['IsDebounced']['isDebounced'] = None + self._defaults['OpenSession'] = {} + self._defaults['OpenSession']['return'] = 0 + self._defaults['OpenSession']['vi'] = None + self._defaults['WaitForDebounce'] = {} + self._defaults['WaitForDebounce']['return'] = 0 def __getitem__(self, func): return self._defaults[func] @@ -59,203 +59,156 @@ def __setitem__(self, func, val): self._defaults[func] = val def niSE_CloseSession(self, vi): # noqa: N802 - if self._defaults["CloseSession"]["return"] != 0: - return self._defaults["CloseSession"]["return"] - return self._defaults["CloseSession"]["return"] + if self._defaults['CloseSession']['return'] != 0: + return self._defaults['CloseSession']['return'] + return self._defaults['CloseSession']['return'] - def niSE_Connect( - self, vi, connect_spec, multiconnect_mode, wait_for_debounce - ): # noqa: N802 - if self._defaults["Connect"]["return"] != 0: - return self._defaults["Connect"]["return"] - return self._defaults["Connect"]["return"] + def niSE_Connect(self, vi, connect_spec, multiconnect_mode, wait_for_debounce): # noqa: N802 + if self._defaults['Connect']['return'] != 0: + return self._defaults['Connect']['return'] + return self._defaults['Connect']['return'] - def niSE_ConnectAndDisconnect( - self, - vi, - connect_spec, - disconnect_spec, - multiconnect_mode, - operation_order, - wait_for_debounce, - ): # noqa: N802 - if self._defaults["ConnectAndDisconnect"]["return"] != 0: - return self._defaults["ConnectAndDisconnect"]["return"] - return self._defaults["ConnectAndDisconnect"]["return"] + def niSE_ConnectAndDisconnect(self, vi, connect_spec, disconnect_spec, multiconnect_mode, operation_order, wait_for_debounce): # noqa: N802 + if self._defaults['ConnectAndDisconnect']['return'] != 0: + return self._defaults['ConnectAndDisconnect']['return'] + return self._defaults['ConnectAndDisconnect']['return'] def niSE_Disconnect(self, vi, disconnect_spec): # noqa: N802 - if self._defaults["Disconnect"]["return"] != 0: - return self._defaults["Disconnect"]["return"] - return self._defaults["Disconnect"]["return"] + if self._defaults['Disconnect']['return'] != 0: + return self._defaults['Disconnect']['return'] + return self._defaults['Disconnect']['return'] def niSE_DisconnectAll(self, vi): # noqa: N802 - if self._defaults["DisconnectAll"]["return"] != 0: - return self._defaults["DisconnectAll"]["return"] - return self._defaults["DisconnectAll"]["return"] + if self._defaults['DisconnectAll']['return'] != 0: + return self._defaults['DisconnectAll']['return'] + return self._defaults['DisconnectAll']['return'] - def niSE_ExpandRouteSpec( - self, - vi, - route_spec, - expand_action, - expanded_route_spec, - expanded_route_spec_size, - ): # noqa: N802 - if self._defaults["ExpandRouteSpec"]["return"] != 0: - return self._defaults["ExpandRouteSpec"]["return"] + def niSE_ExpandRouteSpec(self, vi, route_spec, expand_action, expanded_route_spec, expanded_route_spec_size): # noqa: N802 + if self._defaults['ExpandRouteSpec']['return'] != 0: + return self._defaults['ExpandRouteSpec']['return'] # expanded_route_spec - if self._defaults["ExpandRouteSpec"]["expandedRouteSpec"] is None: - raise MockFunctionCallError( - "niSE_ExpandRouteSpec", param="expandedRouteSpec" - ) - test_value = self._defaults["ExpandRouteSpec"]["expandedRouteSpec"] + if self._defaults['ExpandRouteSpec']['expandedRouteSpec'] is None: + raise MockFunctionCallError("niSE_ExpandRouteSpec", param='expandedRouteSpec') + test_value = self._defaults['ExpandRouteSpec']['expandedRouteSpec'] if type(test_value) is str: - test_value = test_value.encode("ascii") + test_value = test_value.encode('ascii') assert len(expanded_route_spec) >= len(test_value) for i in range(len(test_value)): expanded_route_spec[i] = test_value[i] - return self._defaults["ExpandRouteSpec"]["return"] + return self._defaults['ExpandRouteSpec']['return'] - def niSE_FindRoute( - self, vi, channel1, channel2, route_spec, route_spec_size, path_capability - ): # noqa: N802 - if self._defaults["FindRoute"]["return"] != 0: - return self._defaults["FindRoute"]["return"] + def niSE_FindRoute(self, vi, channel1, channel2, route_spec, route_spec_size, path_capability): # noqa: N802 + if self._defaults['FindRoute']['return'] != 0: + return self._defaults['FindRoute']['return'] # route_spec - if self._defaults["FindRoute"]["routeSpec"] is None: - raise MockFunctionCallError("niSE_FindRoute", param="routeSpec") - test_value = self._defaults["FindRoute"]["routeSpec"] + if self._defaults['FindRoute']['routeSpec'] is None: + raise MockFunctionCallError("niSE_FindRoute", param='routeSpec') + test_value = self._defaults['FindRoute']['routeSpec'] if type(test_value) is str: - test_value = test_value.encode("ascii") + test_value = test_value.encode('ascii') assert len(route_spec) >= len(test_value) for i in range(len(test_value)): route_spec[i] = test_value[i] # path_capability - if self._defaults["FindRoute"]["pathCapability"] is None: - raise MockFunctionCallError("niSE_FindRoute", param="pathCapability") + if self._defaults['FindRoute']['pathCapability'] is None: + raise MockFunctionCallError("niSE_FindRoute", param='pathCapability') if path_capability is not None: - path_capability.contents.value = self._defaults["FindRoute"][ - "pathCapability" - ] - return self._defaults["FindRoute"]["return"] + path_capability.contents.value = self._defaults['FindRoute']['pathCapability'] + return self._defaults['FindRoute']['return'] def niSE_GetAllConnections(self, vi, route_spec, route_spec_size): # noqa: N802 - if self._defaults["GetAllConnections"]["return"] != 0: - return self._defaults["GetAllConnections"]["return"] + if self._defaults['GetAllConnections']['return'] != 0: + return self._defaults['GetAllConnections']['return'] # route_spec - if self._defaults["GetAllConnections"]["routeSpec"] is None: - raise MockFunctionCallError("niSE_GetAllConnections", param="routeSpec") - test_value = self._defaults["GetAllConnections"]["routeSpec"] + if self._defaults['GetAllConnections']['routeSpec'] is None: + raise MockFunctionCallError("niSE_GetAllConnections", param='routeSpec') + test_value = self._defaults['GetAllConnections']['routeSpec'] if type(test_value) is str: - test_value = test_value.encode("ascii") + test_value = test_value.encode('ascii') assert len(route_spec) >= len(test_value) for i in range(len(test_value)): route_spec[i] = test_value[i] - return self._defaults["GetAllConnections"]["return"] + return self._defaults['GetAllConnections']['return'] - def niSE_GetError( - self, vi, error_number, error_description, error_description_size - ): # noqa: N802 - if self._defaults["GetError"]["return"] != 0: - return self._defaults["GetError"]["return"] + def niSE_GetError(self, vi, error_number, error_description, error_description_size): # noqa: N802 + if self._defaults['GetError']['return'] != 0: + return self._defaults['GetError']['return'] # error_number - if self._defaults["GetError"]["errorNumber"] is None: - raise MockFunctionCallError("niSE_GetError", param="errorNumber") + if self._defaults['GetError']['errorNumber'] is None: + raise MockFunctionCallError("niSE_GetError", param='errorNumber') if error_number is not None: - error_number.contents.value = self._defaults["GetError"]["errorNumber"] + error_number.contents.value = self._defaults['GetError']['errorNumber'] # error_description - if self._defaults["GetError"]["errorDescription"] is None: - raise MockFunctionCallError("niSE_GetError", param="errorDescription") - test_value = self._defaults["GetError"]["errorDescription"] + if self._defaults['GetError']['errorDescription'] is None: + raise MockFunctionCallError("niSE_GetError", param='errorDescription') + test_value = self._defaults['GetError']['errorDescription'] if type(test_value) is str: - test_value = test_value.encode("ascii") + test_value = test_value.encode('ascii') assert len(error_description) >= len(test_value) for i in range(len(test_value)): error_description[i] = test_value[i] - return self._defaults["GetError"]["return"] + return self._defaults['GetError']['return'] def niSE_IsConnected(self, vi, route_spec, is_connected): # noqa: N802 - if self._defaults["IsConnected"]["return"] != 0: - return self._defaults["IsConnected"]["return"] + if self._defaults['IsConnected']['return'] != 0: + return self._defaults['IsConnected']['return'] # is_connected - if self._defaults["IsConnected"]["isConnected"] is None: - raise MockFunctionCallError("niSE_IsConnected", param="isConnected") + if self._defaults['IsConnected']['isConnected'] is None: + raise MockFunctionCallError("niSE_IsConnected", param='isConnected') if is_connected is not None: - is_connected.contents.value = self._defaults["IsConnected"]["isConnected"] - return self._defaults["IsConnected"]["return"] + is_connected.contents.value = self._defaults['IsConnected']['isConnected'] + return self._defaults['IsConnected']['return'] def niSE_IsDebounced(self, vi, is_debounced): # noqa: N802 - if self._defaults["IsDebounced"]["return"] != 0: - return self._defaults["IsDebounced"]["return"] + if self._defaults['IsDebounced']['return'] != 0: + return self._defaults['IsDebounced']['return'] # is_debounced - if self._defaults["IsDebounced"]["isDebounced"] is None: - raise MockFunctionCallError("niSE_IsDebounced", param="isDebounced") + if self._defaults['IsDebounced']['isDebounced'] is None: + raise MockFunctionCallError("niSE_IsDebounced", param='isDebounced') if is_debounced is not None: - is_debounced.contents.value = self._defaults["IsDebounced"]["isDebounced"] - return self._defaults["IsDebounced"]["return"] + is_debounced.contents.value = self._defaults['IsDebounced']['isDebounced'] + return self._defaults['IsDebounced']['return'] def niSE_OpenSession(self, virtual_device_name, option_string, vi): # noqa: N802 - if self._defaults["OpenSession"]["return"] != 0: - return self._defaults["OpenSession"]["return"] + if self._defaults['OpenSession']['return'] != 0: + return self._defaults['OpenSession']['return'] # vi - if self._defaults["OpenSession"]["vi"] is None: - raise MockFunctionCallError("niSE_OpenSession", param="vi") + if self._defaults['OpenSession']['vi'] is None: + raise MockFunctionCallError("niSE_OpenSession", param='vi') if vi is not None: - vi.contents.value = self._defaults["OpenSession"]["vi"] - return self._defaults["OpenSession"]["return"] + vi.contents.value = self._defaults['OpenSession']['vi'] + return self._defaults['OpenSession']['return'] def niSE_WaitForDebounce(self, vi, maximum_time_ms): # noqa: N802 - if self._defaults["WaitForDebounce"]["return"] != 0: - return self._defaults["WaitForDebounce"]["return"] - return self._defaults["WaitForDebounce"]["return"] + if self._defaults['WaitForDebounce']['return'] != 0: + return self._defaults['WaitForDebounce']['return'] + return self._defaults['WaitForDebounce']['return'] # Helper function to setup Mock object with default side effects and return values def set_side_effects_and_return_values(self, mock_library): - mock_library.niSE_CloseSession.side_effect = MockFunctionCallError( - "niSE_CloseSession" - ) + mock_library.niSE_CloseSession.side_effect = MockFunctionCallError("niSE_CloseSession") mock_library.niSE_CloseSession.return_value = 0 mock_library.niSE_Connect.side_effect = MockFunctionCallError("niSE_Connect") mock_library.niSE_Connect.return_value = 0 - mock_library.niSE_ConnectAndDisconnect.side_effect = MockFunctionCallError( - "niSE_ConnectAndDisconnect" - ) + mock_library.niSE_ConnectAndDisconnect.side_effect = MockFunctionCallError("niSE_ConnectAndDisconnect") mock_library.niSE_ConnectAndDisconnect.return_value = 0 - mock_library.niSE_Disconnect.side_effect = MockFunctionCallError( - "niSE_Disconnect" - ) + mock_library.niSE_Disconnect.side_effect = MockFunctionCallError("niSE_Disconnect") mock_library.niSE_Disconnect.return_value = 0 - mock_library.niSE_DisconnectAll.side_effect = MockFunctionCallError( - "niSE_DisconnectAll" - ) + mock_library.niSE_DisconnectAll.side_effect = MockFunctionCallError("niSE_DisconnectAll") mock_library.niSE_DisconnectAll.return_value = 0 - mock_library.niSE_ExpandRouteSpec.side_effect = MockFunctionCallError( - "niSE_ExpandRouteSpec" - ) + mock_library.niSE_ExpandRouteSpec.side_effect = MockFunctionCallError("niSE_ExpandRouteSpec") mock_library.niSE_ExpandRouteSpec.return_value = 0 - mock_library.niSE_FindRoute.side_effect = MockFunctionCallError( - "niSE_FindRoute" - ) + mock_library.niSE_FindRoute.side_effect = MockFunctionCallError("niSE_FindRoute") mock_library.niSE_FindRoute.return_value = 0 - mock_library.niSE_GetAllConnections.side_effect = MockFunctionCallError( - "niSE_GetAllConnections" - ) + mock_library.niSE_GetAllConnections.side_effect = MockFunctionCallError("niSE_GetAllConnections") mock_library.niSE_GetAllConnections.return_value = 0 mock_library.niSE_GetError.side_effect = MockFunctionCallError("niSE_GetError") mock_library.niSE_GetError.return_value = 0 - mock_library.niSE_IsConnected.side_effect = MockFunctionCallError( - "niSE_IsConnected" - ) + mock_library.niSE_IsConnected.side_effect = MockFunctionCallError("niSE_IsConnected") mock_library.niSE_IsConnected.return_value = 0 - mock_library.niSE_IsDebounced.side_effect = MockFunctionCallError( - "niSE_IsDebounced" - ) + mock_library.niSE_IsDebounced.side_effect = MockFunctionCallError("niSE_IsDebounced") mock_library.niSE_IsDebounced.return_value = 0 - mock_library.niSE_OpenSession.side_effect = MockFunctionCallError( - "niSE_OpenSession" - ) + mock_library.niSE_OpenSession.side_effect = MockFunctionCallError("niSE_OpenSession") mock_library.niSE_OpenSession.return_value = 0 - mock_library.niSE_WaitForDebounce.side_effect = MockFunctionCallError( - "niSE_WaitForDebounce" - ) + mock_library.niSE_WaitForDebounce.side_effect = MockFunctionCallError("niSE_WaitForDebounce") mock_library.niSE_WaitForDebounce.return_value = 0 diff --git a/generated/nise/setup.py b/generated/nise/setup.py index ded73f4ba..3a5d2e322 100644 --- a/generated/nise/setup.py +++ b/generated/nise/setup.py @@ -15,44 +15,41 @@ def finalize_options(self): def run_tests(self): import pytest - pytest.main(self.test_args) -pypi_name = "nise" +pypi_name = 'nise' def read_contents(file_to_read): - with open(file_to_read, "r") as f: + with open(file_to_read, 'r') as f: return f.read() setup( name=pypi_name, zip_safe=True, - version="1.4.2.dev0", - description="NI Switch Executive Python API", - long_description=read_contents("README.rst"), - long_description_content_type="text/x-rst", - author="NI", + version='1.4.2.dev0', + description='NI Switch Executive Python API', + long_description=read_contents('README.rst'), + long_description_content_type='text/x-rst', + author='NI', author_email="opensource@ni.com", url="https://github.com/ni/nimi-python", maintainer="NI", maintainer_email="opensource@ni.com", - keywords=["nise"], - license="MIT", + keywords=['nise'], + license='MIT', include_package_data=True, - packages=["nise"], + packages=['nise'], install_requires=[ 'enum34;python_version<"3.4"', 'singledispatch;python_version<"3.4"', - "hightime>=0.2.0", - ], - setup_requires=[ - "pytest-runner", + 'hightime>=0.2.0', ], - tests_require=["pytest"], - test_suite="tests", + setup_requires=['pytest-runner', ], + tests_require=['pytest'], + test_suite='tests', classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -67,8 +64,8 @@ def read_contents(file_to_read): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", - "Topic :: System :: Hardware :: Hardware Drivers", + "Topic :: System :: Hardware :: Hardware Drivers" ], - cmdclass={"test": PyTest}, - package_data={pypi_name: ["VERSION"]}, + cmdclass={'test': PyTest}, + package_data={pypi_name: ['VERSION']}, ) diff --git a/generated/niswitch/niswitch/__init__.py b/generated/niswitch/niswitch/__init__.py index 200a683a6..a3318b471 100644 --- a/generated/niswitch/niswitch/__init__.py +++ b/generated/niswitch/niswitch/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = "1.4.2.dev0" +__version__ = '1.4.2.dev0' from niswitch.enums import * # noqa: F403,F401,H303 from niswitch.errors import DriverWarning # noqa: F401 @@ -11,12 +11,12 @@ def get_diagnostic_information(): - """Get diagnostic information about the system state that is suitable for printing or logging + '''Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - """ + ''' import os import pkg_resources import platform @@ -24,80 +24,73 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return struct.calcsize("P") == 8 + return (struct.calcsize("P") == 8) def is_os_64bit(): - return platform.machine().endswith("64") + return platform.machine().endswith('64') def is_venv(): - return "VIRTUAL_ENV" in os.environ + return 'VIRTUAL_ENV' in os.environ info = {} - info["os"] = {} - info["python"] = {} - info["driver"] = {} - info["module"] = {} - if platform.system() == "Windows": + info['os'] = {} + info['python'] = {} + info['driver'] = {} + info['module'] = {} + if platform.system() == 'Windows': try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = "Windows" + os_name = 'Windows' try: - driver_version_key = winreg.OpenKey( - winreg.HKEY_LOCAL_MACHINE, - r"SOFTWARE\National Instruments\NI-SWITCH\CurrentVersion", - ) + driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-SWITCH\CurrentVersion") driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = "Unknown" - elif platform.system() == "Linux": - os_name = "Linux" - driver_version = "Unknown" + driver_version = 'Unknown' + elif platform.system() == 'Linux': + os_name = 'Linux' + driver_version = 'Unknown' else: - raise SystemError("Unsupported platform: {}".format(platform.system())) + raise SystemError('Unsupported platform: {}'.format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [ - { - "name": i.key, - "version": i.version, - } - for i in installed_packages - ] - - info["os"]["name"] = os_name - info["os"]["version"] = platform.version() - info["os"]["bits"] = "64" if is_os_64bit() else "32" - info["driver"]["name"] = "NI-SWITCH" - info["driver"]["version"] = driver_version - info["module"]["name"] = "niswitch" - info["module"]["version"] = "1.4.2.dev0" - info["python"]["version"] = sys.version - info["python"]["bits"] = "64" if is_python_64bit() else "32" - info["python"]["is_venv"] = is_venv() - info["python"]["packages"] = installed_packages_list + installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] + + info['os']['name'] = os_name + info['os']['version'] = platform.version() + info['os']['bits'] = '64' if is_os_64bit() else '32' + info['driver']['name'] = "NI-SWITCH" + info['driver']['version'] = driver_version + info['module']['name'] = 'niswitch' + info['module']['version'] = "1.4.2.dev0" + info['python']['version'] = sys.version + info['python']['bits'] = '64' if is_python_64bit() else '32' + info['python']['is_venv'] = is_venv() + info['python']['packages'] = installed_packages_list return info def print_diagnostic_information(): - """Print diagnostic information in a format suitable for issue report + '''Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - """ + ''' info = get_diagnostic_information() - row_format = " {:<10} {}" - for type in ["OS", "Driver", "Module", "Python"]: + row_format = ' {:<10} {}' + for type in ['OS', 'Driver', 'Module', 'Python']: typename = type.lower() - print(type + ":") + print(type + ':') for item in info[typename]: - if item != "packages": - print(row_format.format(item.title() + ":", info[typename][item])) - print(" Installed Packages:") - for p in info["python"]["packages"]: - print((" " * 8) + p["name"] + "==" + p["version"]) + if item != 'packages': + print(row_format.format(item.title() + ':', info[typename][item])) + print(' Installed Packages:') + for p in info['python']['packages']: + print((' ' * 8) + p['name'] + '==' + p['version']) return info + + diff --git a/generated/niswitch/niswitch/_attributes.py b/generated/niswitch/niswitch/_attributes.py index c003081d8..ea564a33e 100644 --- a/generated/niswitch/niswitch/_attributes.py +++ b/generated/niswitch/niswitch/_attributes.py @@ -6,13 +6,14 @@ class Attribute(object): - """Base class for all typed attributes.""" + '''Base class for all typed attributes.''' def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -21,19 +22,16 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): + def __get__(self, session, session_type): - return hightime.timedelta( - milliseconds=session._get_attribute_vi_int32(self._attribute_id) - ) + return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_int32( - self._attribute_id, - _converters.convert_timedelta_to_milliseconds_int32(value).value, - ) + session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) class AttributeViInt64(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -42,6 +40,7 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -50,19 +49,16 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): + def __get__(self, session, session_type): - return hightime.timedelta( - seconds=session._get_attribute_vi_real64(self._attribute_id) - ) + return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_real64( - self._attribute_id, - _converters.convert_timedelta_to_seconds_real64(value).value, - ) + session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) class AttributeViString(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -71,17 +67,16 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string( - self._attribute_id, - _converters.convert_repeated_capabilities_without_prefix(value), - ) + session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) class AttributeViBoolean(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -90,36 +85,31 @@ def __set__(self, session, value): class AttributeEnum(object): + def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type( - self._underlying_attribute.__get__(session, session_type) - ) + return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError( - "must be " - + str(self._attribute_type.__name__) - + " not " - + str(type(value).__name__) - ) + raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): + def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from niswitch.session import SessionReference - return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session( - self._attribute_id, _converters.convert_to_nitclk_session_number(value) - ) + session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) + + + diff --git a/generated/niswitch/niswitch/_converters.py b/generated/niswitch/niswitch/_converters.py index a336125ed..02af41b77 100644 --- a/generated/niswitch/niswitch/_converters.py +++ b/generated/niswitch/niswitch/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - """Base version that should not be called + '''Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,38 +40,36 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - """ - raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) + ''' + raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - """Integer version""" + '''Integer version''' return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - """String version (this is the most complex) + '''String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - """ + ''' # First we deal with a list - rep_cap_list = repeated_capability.split(",") + rep_cap_list = repeated_capability.split(',') if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, "").replace(":", "-") - rc = r.split("-") + r = repeated_capability.strip().replace(prefix, '').replace(':', '-') + rc = r.split('-') if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError( - "Multiple '-' or ':'", repeated_capability - ) + raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) try: start = int(rc[0]) end = int(rc[1]) @@ -87,7 +85,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, "").strip()] + return [repeated_capability.replace(prefix, '').strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -96,7 +94,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - """Iterable version - can handle lists, ranges, and tuples""" + '''Iterable version - can handle lists, ranges, and tuples''' rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -105,22 +103,16 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - """slice version""" - + '''slice version''' def ifnone(a, b): return b if a is None else a - # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range( - ifnone(repeated_capability.start, 0), - repeated_capability.stop, - ifnone(repeated_capability.step, 1), - ) + rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=""): - """Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=''): + '''Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -128,17 +120,15 @@ def convert_repeated_capabilities(repeated_capability, prefix=""): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - """ + ''' # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [ - prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) - ] + return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] def convert_repeated_capabilities_without_prefix(repeated_capability): - """Convert a repeated capabilities object, without any prefix, to a comma delimited list + '''Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -154,8 +144,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - """ - return ",".join(convert_repeated_capabilities(repeated_capability, "")) + ''' + return ','.join(convert_repeated_capabilities(repeated_capability, '')) def _convert_timedelta(value, library_type, scaling): @@ -168,14 +158,7 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [ - _visatype.ViInt64, - _visatype.ViInt32, - _visatype.ViUInt32, - _visatype.ViInt16, - _visatype.ViUInt16, - _visatype.ViInt8, - ]: + if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -212,36 +195,34 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - "rangecheck": "RangeCheck", - "queryinstrstatus": "QueryInstrStatus", - "cache": "Cache", - "simulate": "Simulate", - "recordcoercions": "RecordCoercions", - "interchangecheck": "InterchangeCheck", - "driversetup": "DriverSetup", - "range_check": "RangeCheck", - "query_instr_status": "QueryInstrStatus", - "record_coercions": "RecordCoercions", - "interchange_check": "InterchangeCheck", - "driver_setup": "DriverSetup", + 'rangecheck': 'RangeCheck', + 'queryinstrstatus': 'QueryInstrStatus', + 'cache': 'Cache', + 'simulate': 'Simulate', + 'recordcoercions': 'RecordCoercions', + 'interchangecheck': 'InterchangeCheck', + 'driversetup': 'DriverSetup', + 'range_check': 'RangeCheck', + 'query_instr_status': 'QueryInstrStatus', + 'record_coercions': 'RecordCoercions', + 'interchange_check': 'InterchangeCheck', + 'driver_setup': 'DriverSetup', } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": - value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") - elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": + if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': + value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') + elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': if not isinstance(values[k], dict): - raise TypeError("DriverSetup must be a dictionary") - value = "DriverSetup=" + ( - ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) - ) + raise TypeError('DriverSetup must be a dictionary') + value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) else: - value = k + ("=1" if values[k] is True else "=0") + value = k + ('=1' if values[k] is True else '=0') init_with_options.append(value) - init_with_options_string = ",".join(init_with_options) + init_with_options_string = ','.join(init_with_options) return init_with_options_string @@ -270,11 +251,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(",")] + return [x.strip() for x in comma_separated_string.split(',')] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -286,17 +267,11 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - """ - chained_repeated_capability_items = convert_comma_separated_string_to_list( - chained_repeated_capability - ) - repeated_capability_lists = [ - [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) - ] + ''' + chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) + repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] for item in chained_repeated_capability_items: - repeated_capability_lists = [ - x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) - ] - return [ - ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists - ] + repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] + return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] + + diff --git a/generated/niswitch/niswitch/_library.py b/generated/niswitch/niswitch/_library.py index 0e796b1c2..3af994c65 100644 --- a/generated/niswitch/niswitch/_library.py +++ b/generated/niswitch/niswitch/_library.py @@ -9,11 +9,11 @@ class Library(object): - """Library + '''Library Wrapper around driver library. Class will setup the correct ctypes information for every function on first call. - """ + ''' def __init__(self, ctypes_library): self._func_lock = threading.Lock() @@ -69,36 +69,23 @@ def _get_library_function(self, name): def niSwitch_AbortScan(self, vi): # noqa: N802 with self._func_lock: if self.niSwitch_AbortScan_cfunc is None: - self.niSwitch_AbortScan_cfunc = self._get_library_function( - "niSwitch_AbortScan" - ) + self.niSwitch_AbortScan_cfunc = self._get_library_function('niSwitch_AbortScan') self.niSwitch_AbortScan_cfunc.argtypes = [ViSession] # noqa: F405 self.niSwitch_AbortScan_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_AbortScan_cfunc(vi) - def niSwitch_CanConnect( - self, vi, channel1, channel2, path_capability - ): # noqa: N802 + def niSwitch_CanConnect(self, vi, channel1, channel2, path_capability): # noqa: N802 with self._func_lock: if self.niSwitch_CanConnect_cfunc is None: - self.niSwitch_CanConnect_cfunc = self._get_library_function( - "niSwitch_CanConnect" - ) - self.niSwitch_CanConnect_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niSwitch_CanConnect_cfunc = self._get_library_function('niSwitch_CanConnect') + self.niSwitch_CanConnect_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32)] # noqa: F405 self.niSwitch_CanConnect_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_CanConnect_cfunc(vi, channel1, channel2, path_capability) def niSwitch_Commit(self, vi): # noqa: N802 with self._func_lock: if self.niSwitch_Commit_cfunc is None: - self.niSwitch_Commit_cfunc = self._get_library_function( - "niSwitch_Commit" - ) + self.niSwitch_Commit_cfunc = self._get_library_function('niSwitch_Commit') self.niSwitch_Commit_cfunc.argtypes = [ViSession] # noqa: F405 self.niSwitch_Commit_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_Commit_cfunc(vi) @@ -106,36 +93,23 @@ def niSwitch_Commit(self, vi): # noqa: N802 def niSwitch_Connect(self, vi, channel1, channel2): # noqa: N802 with self._func_lock: if self.niSwitch_Connect_cfunc is None: - self.niSwitch_Connect_cfunc = self._get_library_function( - "niSwitch_Connect" - ) - self.niSwitch_Connect_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niSwitch_Connect_cfunc = self._get_library_function('niSwitch_Connect') + self.niSwitch_Connect_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar)] # noqa: F405 self.niSwitch_Connect_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_Connect_cfunc(vi, channel1, channel2) def niSwitch_ConnectMultiple(self, vi, connection_list): # noqa: N802 with self._func_lock: if self.niSwitch_ConnectMultiple_cfunc is None: - self.niSwitch_ConnectMultiple_cfunc = self._get_library_function( - "niSwitch_ConnectMultiple" - ) - self.niSwitch_ConnectMultiple_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niSwitch_ConnectMultiple_cfunc = self._get_library_function('niSwitch_ConnectMultiple') + self.niSwitch_ConnectMultiple_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 self.niSwitch_ConnectMultiple_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_ConnectMultiple_cfunc(vi, connection_list) def niSwitch_Disable(self, vi): # noqa: N802 with self._func_lock: if self.niSwitch_Disable_cfunc is None: - self.niSwitch_Disable_cfunc = self._get_library_function( - "niSwitch_Disable" - ) + self.niSwitch_Disable_cfunc = self._get_library_function('niSwitch_Disable') self.niSwitch_Disable_cfunc.argtypes = [ViSession] # noqa: F405 self.niSwitch_Disable_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_Disable_cfunc(vi) @@ -143,23 +117,15 @@ def niSwitch_Disable(self, vi): # noqa: N802 def niSwitch_Disconnect(self, vi, channel1, channel2): # noqa: N802 with self._func_lock: if self.niSwitch_Disconnect_cfunc is None: - self.niSwitch_Disconnect_cfunc = self._get_library_function( - "niSwitch_Disconnect" - ) - self.niSwitch_Disconnect_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niSwitch_Disconnect_cfunc = self._get_library_function('niSwitch_Disconnect') + self.niSwitch_Disconnect_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar)] # noqa: F405 self.niSwitch_Disconnect_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_Disconnect_cfunc(vi, channel1, channel2) def niSwitch_DisconnectAll(self, vi): # noqa: N802 with self._func_lock: if self.niSwitch_DisconnectAll_cfunc is None: - self.niSwitch_DisconnectAll_cfunc = self._get_library_function( - "niSwitch_DisconnectAll" - ) + self.niSwitch_DisconnectAll_cfunc = self._get_library_function('niSwitch_DisconnectAll') self.niSwitch_DisconnectAll_cfunc.argtypes = [ViSession] # noqa: F405 self.niSwitch_DisconnectAll_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_DisconnectAll_cfunc(vi) @@ -167,222 +133,103 @@ def niSwitch_DisconnectAll(self, vi): # noqa: N802 def niSwitch_DisconnectMultiple(self, vi, disconnection_list): # noqa: N802 with self._func_lock: if self.niSwitch_DisconnectMultiple_cfunc is None: - self.niSwitch_DisconnectMultiple_cfunc = self._get_library_function( - "niSwitch_DisconnectMultiple" - ) - self.niSwitch_DisconnectMultiple_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niSwitch_DisconnectMultiple_cfunc = self._get_library_function('niSwitch_DisconnectMultiple') + self.niSwitch_DisconnectMultiple_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 self.niSwitch_DisconnectMultiple_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_DisconnectMultiple_cfunc(vi, disconnection_list) - def niSwitch_GetAttributeViBoolean( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niSwitch_GetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niSwitch_GetAttributeViBoolean_cfunc is None: - self.niSwitch_GetAttributeViBoolean_cfunc = self._get_library_function( - "niSwitch_GetAttributeViBoolean" - ) - self.niSwitch_GetAttributeViBoolean_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 - self.niSwitch_GetAttributeViBoolean_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niSwitch_GetAttributeViBoolean_cfunc( - vi, channel_name, attribute_id, attribute_value - ) - - def niSwitch_GetAttributeViInt32( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + self.niSwitch_GetAttributeViBoolean_cfunc = self._get_library_function('niSwitch_GetAttributeViBoolean') + self.niSwitch_GetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViBoolean)] # noqa: F405 + self.niSwitch_GetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 + return self.niSwitch_GetAttributeViBoolean_cfunc(vi, channel_name, attribute_id, attribute_value) + + def niSwitch_GetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niSwitch_GetAttributeViInt32_cfunc is None: - self.niSwitch_GetAttributeViInt32_cfunc = self._get_library_function( - "niSwitch_GetAttributeViInt32" - ) - self.niSwitch_GetAttributeViInt32_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niSwitch_GetAttributeViInt32_cfunc = self._get_library_function('niSwitch_GetAttributeViInt32') + self.niSwitch_GetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViInt32)] # noqa: F405 self.niSwitch_GetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niSwitch_GetAttributeViInt32_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niSwitch_GetAttributeViInt32_cfunc(vi, channel_name, attribute_id, attribute_value) - def niSwitch_GetAttributeViReal64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niSwitch_GetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niSwitch_GetAttributeViReal64_cfunc is None: - self.niSwitch_GetAttributeViReal64_cfunc = self._get_library_function( - "niSwitch_GetAttributeViReal64" - ) - self.niSwitch_GetAttributeViReal64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViReal64), - ] # noqa: F405 - self.niSwitch_GetAttributeViReal64_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niSwitch_GetAttributeViReal64_cfunc( - vi, channel_name, attribute_id, attribute_value - ) - - def niSwitch_GetAttributeViString( - self, vi, channel_name, attribute_id, array_size, attribute_value - ): # noqa: N802 + self.niSwitch_GetAttributeViReal64_cfunc = self._get_library_function('niSwitch_GetAttributeViReal64') + self.niSwitch_GetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViReal64)] # noqa: F405 + self.niSwitch_GetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 + return self.niSwitch_GetAttributeViReal64_cfunc(vi, channel_name, attribute_id, attribute_value) + + def niSwitch_GetAttributeViString(self, vi, channel_name, attribute_id, array_size, attribute_value): # noqa: N802 with self._func_lock: if self.niSwitch_GetAttributeViString_cfunc is None: - self.niSwitch_GetAttributeViString_cfunc = self._get_library_function( - "niSwitch_GetAttributeViString" - ) - self.niSwitch_GetAttributeViString_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niSwitch_GetAttributeViString_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niSwitch_GetAttributeViString_cfunc( - vi, channel_name, attribute_id, array_size, attribute_value - ) - - def niSwitch_GetChannelName( - self, vi, index, buffer_size, channel_name_buffer - ): # noqa: N802 + self.niSwitch_GetAttributeViString_cfunc = self._get_library_function('niSwitch_GetAttributeViString') + self.niSwitch_GetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 + self.niSwitch_GetAttributeViString_cfunc.restype = ViStatus # noqa: F405 + return self.niSwitch_GetAttributeViString_cfunc(vi, channel_name, attribute_id, array_size, attribute_value) + + def niSwitch_GetChannelName(self, vi, index, buffer_size, channel_name_buffer): # noqa: N802 with self._func_lock: if self.niSwitch_GetChannelName_cfunc is None: - self.niSwitch_GetChannelName_cfunc = self._get_library_function( - "niSwitch_GetChannelName" - ) - self.niSwitch_GetChannelName_cfunc.argtypes = [ - ViSession, - ViInt32, - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niSwitch_GetChannelName_cfunc = self._get_library_function('niSwitch_GetChannelName') + self.niSwitch_GetChannelName_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niSwitch_GetChannelName_cfunc.restype = ViStatus # noqa: F405 - return self.niSwitch_GetChannelName_cfunc( - vi, index, buffer_size, channel_name_buffer - ) + return self.niSwitch_GetChannelName_cfunc(vi, index, buffer_size, channel_name_buffer) def niSwitch_GetError(self, vi, code, buffer_size, description): # noqa: N802 with self._func_lock: if self.niSwitch_GetError_cfunc is None: - self.niSwitch_GetError_cfunc = self._get_library_function( - "niSwitch_GetError" - ) - self.niSwitch_GetError_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViStatus), - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niSwitch_GetError_cfunc = self._get_library_function('niSwitch_GetError') + self.niSwitch_GetError_cfunc.argtypes = [ViSession, ctypes.POINTER(ViStatus), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niSwitch_GetError_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_GetError_cfunc(vi, code, buffer_size, description) def niSwitch_GetPath(self, vi, channel1, channel2, buffer_size, path): # noqa: N802 with self._func_lock: if self.niSwitch_GetPath_cfunc is None: - self.niSwitch_GetPath_cfunc = self._get_library_function( - "niSwitch_GetPath" - ) - self.niSwitch_GetPath_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niSwitch_GetPath_cfunc = self._get_library_function('niSwitch_GetPath') + self.niSwitch_GetPath_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niSwitch_GetPath_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_GetPath_cfunc(vi, channel1, channel2, buffer_size, path) def niSwitch_GetRelayCount(self, vi, relay_name, relay_count): # noqa: N802 with self._func_lock: if self.niSwitch_GetRelayCount_cfunc is None: - self.niSwitch_GetRelayCount_cfunc = self._get_library_function( - "niSwitch_GetRelayCount" - ) - self.niSwitch_GetRelayCount_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niSwitch_GetRelayCount_cfunc = self._get_library_function('niSwitch_GetRelayCount') + self.niSwitch_GetRelayCount_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32)] # noqa: F405 self.niSwitch_GetRelayCount_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_GetRelayCount_cfunc(vi, relay_name, relay_count) - def niSwitch_GetRelayName( - self, vi, index, relay_name_buffer_size, relay_name_buffer - ): # noqa: N802 + def niSwitch_GetRelayName(self, vi, index, relay_name_buffer_size, relay_name_buffer): # noqa: N802 with self._func_lock: if self.niSwitch_GetRelayName_cfunc is None: - self.niSwitch_GetRelayName_cfunc = self._get_library_function( - "niSwitch_GetRelayName" - ) - self.niSwitch_GetRelayName_cfunc.argtypes = [ - ViSession, - ViInt32, - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niSwitch_GetRelayName_cfunc = self._get_library_function('niSwitch_GetRelayName') + self.niSwitch_GetRelayName_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niSwitch_GetRelayName_cfunc.restype = ViStatus # noqa: F405 - return self.niSwitch_GetRelayName_cfunc( - vi, index, relay_name_buffer_size, relay_name_buffer - ) + return self.niSwitch_GetRelayName_cfunc(vi, index, relay_name_buffer_size, relay_name_buffer) def niSwitch_GetRelayPosition(self, vi, relay_name, relay_position): # noqa: N802 with self._func_lock: if self.niSwitch_GetRelayPosition_cfunc is None: - self.niSwitch_GetRelayPosition_cfunc = self._get_library_function( - "niSwitch_GetRelayPosition" - ) - self.niSwitch_GetRelayPosition_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ctypes.POINTER(ViInt32), - ] # noqa: F405 + self.niSwitch_GetRelayPosition_cfunc = self._get_library_function('niSwitch_GetRelayPosition') + self.niSwitch_GetRelayPosition_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ctypes.POINTER(ViInt32)] # noqa: F405 self.niSwitch_GetRelayPosition_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_GetRelayPosition_cfunc(vi, relay_name, relay_position) - def niSwitch_InitWithTopology( - self, resource_name, topology, simulate, reset_device, vi - ): # noqa: N802 + def niSwitch_InitWithTopology(self, resource_name, topology, simulate, reset_device, vi): # noqa: N802 with self._func_lock: if self.niSwitch_InitWithTopology_cfunc is None: - self.niSwitch_InitWithTopology_cfunc = self._get_library_function( - "niSwitch_InitWithTopology" - ) - self.niSwitch_InitWithTopology_cfunc.argtypes = [ - ctypes.POINTER(ViChar), - ctypes.POINTER(ViChar), - ViBoolean, - ViBoolean, - ctypes.POINTER(ViSession), - ] # noqa: F405 + self.niSwitch_InitWithTopology_cfunc = self._get_library_function('niSwitch_InitWithTopology') + self.niSwitch_InitWithTopology_cfunc.argtypes = [ctypes.POINTER(ViChar), ctypes.POINTER(ViChar), ViBoolean, ViBoolean, ctypes.POINTER(ViSession)] # noqa: F405 self.niSwitch_InitWithTopology_cfunc.restype = ViStatus # noqa: F405 - return self.niSwitch_InitWithTopology_cfunc( - resource_name, topology, simulate, reset_device, vi - ) + return self.niSwitch_InitWithTopology_cfunc(resource_name, topology, simulate, reset_device, vi) def niSwitch_InitiateScan(self, vi): # noqa: N802 with self._func_lock: if self.niSwitch_InitiateScan_cfunc is None: - self.niSwitch_InitiateScan_cfunc = self._get_library_function( - "niSwitch_InitiateScan" - ) + self.niSwitch_InitiateScan_cfunc = self._get_library_function('niSwitch_InitiateScan') self.niSwitch_InitiateScan_cfunc.argtypes = [ViSession] # noqa: F405 self.niSwitch_InitiateScan_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_InitiateScan_cfunc(vi) @@ -390,232 +237,119 @@ def niSwitch_InitiateScan(self, vi): # noqa: N802 def niSwitch_LockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niSwitch_LockSession_cfunc is None: - self.niSwitch_LockSession_cfunc = self._get_library_function( - "niSwitch_LockSession" - ) - self.niSwitch_LockSession_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niSwitch_LockSession_cfunc = self._get_library_function('niSwitch_LockSession') + self.niSwitch_LockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niSwitch_LockSession_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_LockSession_cfunc(vi, caller_has_lock) def niSwitch_RelayControl(self, vi, relay_name, relay_action): # noqa: N802 with self._func_lock: if self.niSwitch_RelayControl_cfunc is None: - self.niSwitch_RelayControl_cfunc = self._get_library_function( - "niSwitch_RelayControl" - ) - self.niSwitch_RelayControl_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViInt32, - ] # noqa: F405 + self.niSwitch_RelayControl_cfunc = self._get_library_function('niSwitch_RelayControl') + self.niSwitch_RelayControl_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViInt32] # noqa: F405 self.niSwitch_RelayControl_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_RelayControl_cfunc(vi, relay_name, relay_action) def niSwitch_ResetWithDefaults(self, vi): # noqa: N802 with self._func_lock: if self.niSwitch_ResetWithDefaults_cfunc is None: - self.niSwitch_ResetWithDefaults_cfunc = self._get_library_function( - "niSwitch_ResetWithDefaults" - ) - self.niSwitch_ResetWithDefaults_cfunc.argtypes = [ - ViSession - ] # noqa: F405 + self.niSwitch_ResetWithDefaults_cfunc = self._get_library_function('niSwitch_ResetWithDefaults') + self.niSwitch_ResetWithDefaults_cfunc.argtypes = [ViSession] # noqa: F405 self.niSwitch_ResetWithDefaults_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_ResetWithDefaults_cfunc(vi) - def niSwitch_RouteScanAdvancedOutput( - self, vi, scan_advanced_output_connector, scan_advanced_output_bus_line, invert - ): # noqa: N802 + def niSwitch_RouteScanAdvancedOutput(self, vi, scan_advanced_output_connector, scan_advanced_output_bus_line, invert): # noqa: N802 with self._func_lock: if self.niSwitch_RouteScanAdvancedOutput_cfunc is None: - self.niSwitch_RouteScanAdvancedOutput_cfunc = ( - self._get_library_function("niSwitch_RouteScanAdvancedOutput") - ) - self.niSwitch_RouteScanAdvancedOutput_cfunc.argtypes = [ - ViSession, - ViInt32, - ViInt32, - ViBoolean, - ] # noqa: F405 - self.niSwitch_RouteScanAdvancedOutput_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niSwitch_RouteScanAdvancedOutput_cfunc( - vi, scan_advanced_output_connector, scan_advanced_output_bus_line, invert - ) - - def niSwitch_RouteTriggerInput( - self, vi, trigger_input_connector, trigger_input_bus_line, invert - ): # noqa: N802 + self.niSwitch_RouteScanAdvancedOutput_cfunc = self._get_library_function('niSwitch_RouteScanAdvancedOutput') + self.niSwitch_RouteScanAdvancedOutput_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ViBoolean] # noqa: F405 + self.niSwitch_RouteScanAdvancedOutput_cfunc.restype = ViStatus # noqa: F405 + return self.niSwitch_RouteScanAdvancedOutput_cfunc(vi, scan_advanced_output_connector, scan_advanced_output_bus_line, invert) + + def niSwitch_RouteTriggerInput(self, vi, trigger_input_connector, trigger_input_bus_line, invert): # noqa: N802 with self._func_lock: if self.niSwitch_RouteTriggerInput_cfunc is None: - self.niSwitch_RouteTriggerInput_cfunc = self._get_library_function( - "niSwitch_RouteTriggerInput" - ) - self.niSwitch_RouteTriggerInput_cfunc.argtypes = [ - ViSession, - ViInt32, - ViInt32, - ViBoolean, - ] # noqa: F405 + self.niSwitch_RouteTriggerInput_cfunc = self._get_library_function('niSwitch_RouteTriggerInput') + self.niSwitch_RouteTriggerInput_cfunc.argtypes = [ViSession, ViInt32, ViInt32, ViBoolean] # noqa: F405 self.niSwitch_RouteTriggerInput_cfunc.restype = ViStatus # noqa: F405 - return self.niSwitch_RouteTriggerInput_cfunc( - vi, trigger_input_connector, trigger_input_bus_line, invert - ) + return self.niSwitch_RouteTriggerInput_cfunc(vi, trigger_input_connector, trigger_input_bus_line, invert) def niSwitch_SendSoftwareTrigger(self, vi): # noqa: N802 with self._func_lock: if self.niSwitch_SendSoftwareTrigger_cfunc is None: - self.niSwitch_SendSoftwareTrigger_cfunc = self._get_library_function( - "niSwitch_SendSoftwareTrigger" - ) - self.niSwitch_SendSoftwareTrigger_cfunc.argtypes = [ - ViSession - ] # noqa: F405 + self.niSwitch_SendSoftwareTrigger_cfunc = self._get_library_function('niSwitch_SendSoftwareTrigger') + self.niSwitch_SendSoftwareTrigger_cfunc.argtypes = [ViSession] # noqa: F405 self.niSwitch_SendSoftwareTrigger_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_SendSoftwareTrigger_cfunc(vi) - def niSwitch_SetAttributeViBoolean( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niSwitch_SetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niSwitch_SetAttributeViBoolean_cfunc is None: - self.niSwitch_SetAttributeViBoolean_cfunc = self._get_library_function( - "niSwitch_SetAttributeViBoolean" - ) - self.niSwitch_SetAttributeViBoolean_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViBoolean, - ] # noqa: F405 - self.niSwitch_SetAttributeViBoolean_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niSwitch_SetAttributeViBoolean_cfunc( - vi, channel_name, attribute_id, attribute_value - ) - - def niSwitch_SetAttributeViInt32( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + self.niSwitch_SetAttributeViBoolean_cfunc = self._get_library_function('niSwitch_SetAttributeViBoolean') + self.niSwitch_SetAttributeViBoolean_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViBoolean] # noqa: F405 + self.niSwitch_SetAttributeViBoolean_cfunc.restype = ViStatus # noqa: F405 + return self.niSwitch_SetAttributeViBoolean_cfunc(vi, channel_name, attribute_id, attribute_value) + + def niSwitch_SetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niSwitch_SetAttributeViInt32_cfunc is None: - self.niSwitch_SetAttributeViInt32_cfunc = self._get_library_function( - "niSwitch_SetAttributeViInt32" - ) - self.niSwitch_SetAttributeViInt32_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViInt32, - ] # noqa: F405 + self.niSwitch_SetAttributeViInt32_cfunc = self._get_library_function('niSwitch_SetAttributeViInt32') + self.niSwitch_SetAttributeViInt32_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32] # noqa: F405 self.niSwitch_SetAttributeViInt32_cfunc.restype = ViStatus # noqa: F405 - return self.niSwitch_SetAttributeViInt32_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + return self.niSwitch_SetAttributeViInt32_cfunc(vi, channel_name, attribute_id, attribute_value) - def niSwitch_SetAttributeViReal64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + def niSwitch_SetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niSwitch_SetAttributeViReal64_cfunc is None: - self.niSwitch_SetAttributeViReal64_cfunc = self._get_library_function( - "niSwitch_SetAttributeViReal64" - ) - self.niSwitch_SetAttributeViReal64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViReal64, - ] # noqa: F405 - self.niSwitch_SetAttributeViReal64_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niSwitch_SetAttributeViReal64_cfunc( - vi, channel_name, attribute_id, attribute_value - ) - - def niSwitch_SetAttributeViString( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 + self.niSwitch_SetAttributeViReal64_cfunc = self._get_library_function('niSwitch_SetAttributeViReal64') + self.niSwitch_SetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViReal64] # noqa: F405 + self.niSwitch_SetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 + return self.niSwitch_SetAttributeViReal64_cfunc(vi, channel_name, attribute_id, attribute_value) + + def niSwitch_SetAttributeViString(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 with self._func_lock: if self.niSwitch_SetAttributeViString_cfunc is None: - self.niSwitch_SetAttributeViString_cfunc = self._get_library_function( - "niSwitch_SetAttributeViString" - ) - self.niSwitch_SetAttributeViString_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViChar), - ] # noqa: F405 - self.niSwitch_SetAttributeViString_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niSwitch_SetAttributeViString_cfunc( - vi, channel_name, attribute_id, attribute_value - ) + self.niSwitch_SetAttributeViString_cfunc = self._get_library_function('niSwitch_SetAttributeViString') + self.niSwitch_SetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViChar)] # noqa: F405 + self.niSwitch_SetAttributeViString_cfunc.restype = ViStatus # noqa: F405 + return self.niSwitch_SetAttributeViString_cfunc(vi, channel_name, attribute_id, attribute_value) def niSwitch_SetPath(self, vi, path_list): # noqa: N802 with self._func_lock: if self.niSwitch_SetPath_cfunc is None: - self.niSwitch_SetPath_cfunc = self._get_library_function( - "niSwitch_SetPath" - ) - self.niSwitch_SetPath_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niSwitch_SetPath_cfunc = self._get_library_function('niSwitch_SetPath') + self.niSwitch_SetPath_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar)] # noqa: F405 self.niSwitch_SetPath_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_SetPath_cfunc(vi, path_list) def niSwitch_UnlockSession(self, vi, caller_has_lock): # noqa: N802 with self._func_lock: if self.niSwitch_UnlockSession_cfunc is None: - self.niSwitch_UnlockSession_cfunc = self._get_library_function( - "niSwitch_UnlockSession" - ) - self.niSwitch_UnlockSession_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niSwitch_UnlockSession_cfunc = self._get_library_function('niSwitch_UnlockSession') + self.niSwitch_UnlockSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViBoolean)] # noqa: F405 self.niSwitch_UnlockSession_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_UnlockSession_cfunc(vi, caller_has_lock) def niSwitch_WaitForDebounce(self, vi, maximum_time_ms): # noqa: N802 with self._func_lock: if self.niSwitch_WaitForDebounce_cfunc is None: - self.niSwitch_WaitForDebounce_cfunc = self._get_library_function( - "niSwitch_WaitForDebounce" - ) - self.niSwitch_WaitForDebounce_cfunc.argtypes = [ - ViSession, - ViInt32, - ] # noqa: F405 + self.niSwitch_WaitForDebounce_cfunc = self._get_library_function('niSwitch_WaitForDebounce') + self.niSwitch_WaitForDebounce_cfunc.argtypes = [ViSession, ViInt32] # noqa: F405 self.niSwitch_WaitForDebounce_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_WaitForDebounce_cfunc(vi, maximum_time_ms) def niSwitch_WaitForScanComplete(self, vi, maximum_time_ms): # noqa: N802 with self._func_lock: if self.niSwitch_WaitForScanComplete_cfunc is None: - self.niSwitch_WaitForScanComplete_cfunc = self._get_library_function( - "niSwitch_WaitForScanComplete" - ) - self.niSwitch_WaitForScanComplete_cfunc.argtypes = [ - ViSession, - ViInt32, - ] # noqa: F405 + self.niSwitch_WaitForScanComplete_cfunc = self._get_library_function('niSwitch_WaitForScanComplete') + self.niSwitch_WaitForScanComplete_cfunc.argtypes = [ViSession, ViInt32] # noqa: F405 self.niSwitch_WaitForScanComplete_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_WaitForScanComplete_cfunc(vi, maximum_time_ms) def niSwitch_close(self, vi): # noqa: N802 with self._func_lock: if self.niSwitch_close_cfunc is None: - self.niSwitch_close_cfunc = self._get_library_function("niSwitch_close") + self.niSwitch_close_cfunc = self._get_library_function('niSwitch_close') self.niSwitch_close_cfunc.argtypes = [ViSession] # noqa: F405 self.niSwitch_close_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_close_cfunc(vi) @@ -623,21 +357,15 @@ def niSwitch_close(self, vi): # noqa: N802 def niSwitch_error_message(self, vi, error_code, error_message): # noqa: N802 with self._func_lock: if self.niSwitch_error_message_cfunc is None: - self.niSwitch_error_message_cfunc = self._get_library_function( - "niSwitch_error_message" - ) - self.niSwitch_error_message_cfunc.argtypes = [ - ViSession, - ViStatus, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niSwitch_error_message_cfunc = self._get_library_function('niSwitch_error_message') + self.niSwitch_error_message_cfunc.argtypes = [ViSession, ViStatus, ctypes.POINTER(ViChar)] # noqa: F405 self.niSwitch_error_message_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_error_message_cfunc(vi, error_code, error_message) def niSwitch_reset(self, vi): # noqa: N802 with self._func_lock: if self.niSwitch_reset_cfunc is None: - self.niSwitch_reset_cfunc = self._get_library_function("niSwitch_reset") + self.niSwitch_reset_cfunc = self._get_library_function('niSwitch_reset') self.niSwitch_reset_cfunc.argtypes = [ViSession] # noqa: F405 self.niSwitch_reset_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_reset_cfunc(vi) @@ -645,13 +373,7 @@ def niSwitch_reset(self, vi): # noqa: N802 def niSwitch_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 with self._func_lock: if self.niSwitch_self_test_cfunc is None: - self.niSwitch_self_test_cfunc = self._get_library_function( - "niSwitch_self_test" - ) - self.niSwitch_self_test_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViInt16), - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niSwitch_self_test_cfunc = self._get_library_function('niSwitch_self_test') + self.niSwitch_self_test_cfunc.argtypes = [ViSession, ctypes.POINTER(ViInt16), ctypes.POINTER(ViChar)] # noqa: F405 self.niSwitch_self_test_cfunc.restype = ViStatus # noqa: F405 return self.niSwitch_self_test_cfunc(vi, self_test_result, self_test_message) diff --git a/generated/niswitch/niswitch/_library_singleton.py b/generated/niswitch/niswitch/_library_singleton.py index 8ed94dea1..5ddab9ad9 100644 --- a/generated/niswitch/niswitch/_library_singleton.py +++ b/generated/niswitch/niswitch/_library_singleton.py @@ -12,36 +12,30 @@ _instance = None _instance_lock = threading.Lock() -_library_info = { - "Linux": {"64bit": {"name": "niswitch", "type": "cdll"}}, - "Windows": { - "32bit": {"name": "niswitch_32.dll", "type": "windll"}, - "64bit": {"name": "niswitch_64.dll", "type": "cdll"}, - }, -} +_library_info = {'Linux': {'64bit': {'name': 'niswitch', 'type': 'cdll'}}, + 'Windows': {'32bit': {'name': 'niswitch_32.dll', 'type': 'windll'}, + '64bit': {'name': 'niswitch_64.dll', 'type': 'cdll'}}} def _get_library_name(): try: - return ctypes.util.find_library( - _library_info[platform.system()][platform.architecture()[0]]["name"] - ) # We find and return full path to the DLL + return ctypes.util.find_library(_library_info[platform.system()][platform.architecture()[0]]['name']) # We find and return full path to the DLL except KeyError: raise errors.UnsupportedConfigurationError def _get_library_type(): try: - return _library_info[platform.system()][platform.architecture()[0]]["type"] + return _library_info[platform.system()][platform.architecture()[0]]['type'] except KeyError: raise errors.UnsupportedConfigurationError def get(): - """get + '''get Returns the library.Library singleton for niswitch. - """ + ''' global _instance global _instance_lock @@ -49,12 +43,13 @@ def get(): if _instance is None: try: library_type = _get_library_type() - if library_type == "windll": + if library_type == 'windll': ctypes_library = ctypes.WinDLL(_get_library_name()) else: - assert library_type == "cdll" + assert library_type == 'cdll' ctypes_library = ctypes.CDLL(_get_library_name()) except OSError: raise errors.DriverNotInstalledError() _instance = _library.Library(ctypes_library) return _instance + diff --git a/generated/niswitch/niswitch/_visatype.py b/generated/niswitch/niswitch/_visatype.py index bf96c3cfb..02cc41d1b 100644 --- a/generated/niswitch/niswitch/_visatype.py +++ b/generated/niswitch/niswitch/_visatype.py @@ -2,9 +2,9 @@ import ctypes -"""Definitions of the VISA types used by the C API of the driver runtime. +'''Definitions of the VISA types used by the C API of the driver runtime. These are aliased directly to ctypes types so can be used directly to call into the library. -""" +''' ViChar = ctypes.c_char @@ -26,3 +26,4 @@ ViAttr = ViUInt32 ViConstString = ViString ViRsrc = ViString + diff --git a/generated/niswitch/niswitch/enums.py b/generated/niswitch/niswitch/enums.py index 0390f3e67..a5ade1e6d 100644 --- a/generated/niswitch/niswitch/enums.py +++ b/generated/niswitch/niswitch/enums.py @@ -6,7 +6,7 @@ class HandshakingInitiation(Enum): MEASUREMENT_DEVICE = 0 - r""" + r''' The `niSwitch Initiate Scan `__ VI does not return until the switch hardware is waiting for a trigger input. This @@ -18,9 +18,9 @@ class HandshakingInitiation(Enum): first take a measurement, send MC, then wait for scanner advanced output signal. Thus, the first MC of the measurement device initiates handshaking. - """ + ''' SWITCH = 1 - r""" + r''' The `niSwitch Initiate Scan `__ VI returns immediately after beginning scan list execution. It is assumed that the @@ -28,445 +28,445 @@ class HandshakingInitiation(Enum): scanner advanced signal. The measurement should be configured to first wait for a trigger, then take a measurement. Thus, the first scanner advanced output signal of the switch module initiates handshaking. - """ + ''' class PathCapability(Enum): PATH_AVAILABLE = 1 - r""" + r''' Path Available - """ + ''' PATH_EXISTS = 2 - r""" + r''' Path Exists - """ + ''' PATH_UNSUPPORTED = 3 - r""" + r''' Path Unsupported - """ + ''' RESOURCE_IN_USE = 4 - r""" + r''' Resource in use - """ + ''' SOURCE_CONFLICT = 5 - r""" + r''' Source conflict - """ + ''' CHANNEL_NOT_AVAILABLE = 6 - r""" + r''' Channel not available - """ + ''' class RelayAction(Enum): OPEN = 20 - r""" + r''' Open Relay - """ + ''' CLOSE = 21 - r""" + r''' Close Relay - """ + ''' class RelayPosition(Enum): OPEN = 10 - r""" + r''' Open - """ + ''' CLOSED = 11 - r""" + r''' Closed - """ + ''' class ScanAdvancedOutput(Enum): NONE = 0 - r""" + r''' The switch device does not produce a Scan Advanced Output trigger. - """ + ''' EXTERNAL = 2 - r""" + r''' External Trigger. The switch device produces the Scan Advanced Output trigger on the external trigger output. - """ + ''' TTL0 = 111 - r""" + r''' The switch device produces the Scan Advanced Output on the PXI TRIG0 line. - """ + ''' TTL1 = 112 - r""" + r''' The switch device produces the Scan Advanced Output on the PXI TRIG1 line. - """ + ''' TTL2 = 113 - r""" + r''' The switch device produces the Scan Advanced Output on the PXI TRIG2 line. - """ + ''' TTL3 = 114 - r""" + r''' The switch device produces the Scan Advanced Output on the PXI TRIG3 line. - """ + ''' TTL4 = 115 - r""" + r''' The switch device produces the Scan Advanced Output on the PXI TRIG4 line. - """ + ''' TTL5 = 116 - r""" + r''' The switch device produces the Scan Advanced Output on the PXI TRIG5 line. - """ + ''' TTL6 = 117 - r""" + r''' The switch device produces the Scan Advanced Output on the PXI TRIG6 line. - """ + ''' TTL7 = 118 - r""" + r''' The switch device produces the Scan Advanced Output on the PXI TRIG7 line. - """ + ''' PXI_STAR = 125 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the PXI Star trigger bus before processing the next entry in the scan list. - """ + ''' REARCONNECTOR = 1000 - r""" + r''' The switch device produces the Scan Advanced Output trigger on the rear connector. - """ + ''' FRONTCONNECTOR = 1001 - r""" + r''' The switch device produces the Scan Advanced Output trigger on the front connector. - """ + ''' REARCONNECTOR_MODULE1 = 1021 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the rear connector module 1. - """ + ''' REARCONNECTOR_MODULE2 = 1022 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the rear connector module 2. - """ + ''' REARCONNECTOR_MODULE3 = 1023 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the rear connector module 3. - """ + ''' REARCONNECTOR_MODULE4 = 1024 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the rear connector module 4. - """ + ''' REARCONNECTOR_MODULE5 = 1025 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the rear connector module 5. - """ + ''' REARCONNECTOR_MODULE6 = 1026 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the rear connector module 6. - """ + ''' REARCONNECTOR_MODULE7 = 1027 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the rear connector module 7. - """ + ''' REARCONNECTOR_MODULE8 = 1028 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the rear connector module 8. - """ + ''' REARCONNECTOR_MODULE9 = 1029 - r""" + r''' The switch module produces the Scan Advanced Ouptut Trigger on the rear connector module 9. - """ + ''' REARCONNECTOR_MODULE10 = 1030 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the rear connector module 10. - """ + ''' REARCONNECTOR_MODULE11 = 1031 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the rear connector module 11. - """ + ''' REARCONNECTOR_MODULE12 = 1032 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the rear connector module 12. - """ + ''' FRONTCONNECTOR_MODULE1 = 1041 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the front connector module 1. - """ + ''' FRONTCONNECTOR_MODULE2 = 1042 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the front connector module 2. - """ + ''' FRONTCONNECTOR_MODULE3 = 1043 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the front connector module 3. - """ + ''' FRONTCONNECTOR_MODULE4 = 1044 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the front connector module 4. - """ + ''' FRONTCONNECTOR_MODULE5 = 1045 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the front connector module 5. - """ + ''' FRONTCONNECTOR_MODULE6 = 1046 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the front connector module 6. - """ + ''' FRONTCONNECTOR_MODULE7 = 1047 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the front connector module 7. - """ + ''' FRONTCONNECTOR_MODULE8 = 1048 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the front connector module 8. - """ + ''' FRONTCONNECTOR_MODULE9 = 1049 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the front connector module 9. - """ + ''' FRONTCONNECTOR_MODULE10 = 1050 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the front connector module 10. - """ + ''' FRONTCONNECTOR_MODULE11 = 1051 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the front connector module 11. - """ + ''' FRONTCONNECTOR_MODULE12 = 1052 - r""" + r''' The switch module produces the Scan Advanced Output Trigger on the front connector module 12. - """ + ''' class ScanAdvancedPolarity(Enum): RISING = 0 - r""" + r''' The trigger occurs on the rising edge of the signal. - """ + ''' FALLING = 1 - r""" + r''' The trigger occurs on the falling edge of the signal. - """ + ''' class ScanMode(Enum): NONE = 0 - r""" + r''' No implicit action on connections when scanning. - """ + ''' BREAK_BEFORE_MAKE = 1 - r""" + r''' When scanning, the switch device breaks existing connections before making new connections. - """ + ''' BREAK_AFTER_MAKE = 2 - r""" + r''' When scanning, the switch device breaks existing connections after making new connections. - """ + ''' class TriggerInput(Enum): IMMEDIATE = 1 - r""" + r''' Immediate Trigger. The switch device does not wait for a trigger before processing the next entry in the scan list. - """ + ''' EXTERNAL = 2 - r""" + r''' External Trigger. The switch device waits until it receives a trigger from an external source through the external trigger input before processing the next entry in the scan list. - """ + ''' SOFTWARE_TRIG = 3 - r""" + r''' The switch device waits until you call the send_software_trigger method before processing the next entry in the scan list. - """ + ''' TTL0 = 111 - r""" + r''' The switch device waits until it receives a trigger on the PXI TRIG0 line before processing the next entry in the scan list. - """ + ''' TTL1 = 112 - r""" + r''' The switch device waits until it receives a trigger on the PXI TRIG1 line before processing the next entry in the scan list. - """ + ''' TTL2 = 113 - r""" + r''' The switch device waits until it receives a trigger on the PXI TRIG2 line before processing the next entry in the scan list. - """ + ''' TTL3 = 114 - r""" + r''' The switch device waits until it receives a trigger on the PXI TRIG3 line before processing the next entry in the scan list. - """ + ''' TTL4 = 115 - r""" + r''' The switch device waits until it receives a trigger on the PXI TRIG4 line before processing the next entry in the scan list. - """ + ''' TTL5 = 116 - r""" + r''' The switch device waits until it receives a trigger on the PXI TRIG5 line before processing the next entry in the scan list. - """ + ''' TTL6 = 117 - r""" + r''' The switch device waits until it receives a trigger on the PXI TRIG6 line before processing the next entry in the scan list. - """ + ''' TTL7 = 118 - r""" + r''' The switch device waits until it receives a trigger on the PXI TRIG7 line before processing the next entry in the scan list. - """ + ''' PXI_STAR = 125 - r""" + r''' The switch device waits until it receives a trigger on the PXI STAR trigger bus before processing the next entry in the scan list. - """ + ''' REARCONNECTOR = 1000 - r""" + r''' The switch device waits until it receives a trigger on the rear connector. - """ + ''' FRONTCONNECTOR = 1001 - r""" + r''' The switch device waits until it receives a trigger on the front connector. - """ + ''' REARCONNECTOR_MODULE1 = 1021 - r""" + r''' The switch module waits until it receives a trigger on the rear connector module 1. - """ + ''' REARCONNECTOR_MODULE2 = 1022 - r""" + r''' The switch module waits until it receives a trigger on the rear connector module 2. - """ + ''' REARCONNECTOR_MODULE3 = 1023 - r""" + r''' The switch module waits until it receives a trigger on the rear connector module 3. - """ + ''' REARCONNECTOR_MODULE4 = 1024 - r""" + r''' The switch module waits until it receives a trigger on the rear connector module 4. - """ + ''' REARCONNECTOR_MODULE5 = 1025 - r""" + r''' The switch module waits until it receives a trigger on the rear connector module 5. - """ + ''' REARCONNECTOR_MODULE6 = 1026 - r""" + r''' The switch module waits until it receives a trigger on the rear connector module 6. - """ + ''' REARCONNECTOR_MODULE7 = 1027 - r""" + r''' The switch module waits until it receives a trigger on the rear connector module 7. - """ + ''' REARCONNECTOR_MODULE8 = 1028 - r""" + r''' The switch module waits until it receives a trigger on the rear connector module 8. - """ + ''' REARCONNECTOR_MODULE9 = 1029 - r""" + r''' The switch module waits until it receives a trigger on the rear connector module 9. - """ + ''' REARCONNECTOR_MODULE10 = 1030 - r""" + r''' The switch module waits until it receives a trigger on the rear connector module 10. - """ + ''' REARCONNECTOR_MODULE11 = 1031 - r""" + r''' The switch module waits until it receives a trigger on the rear connector module 11. - """ + ''' REARCONNECTOR_MODULE12 = 1032 - r""" + r''' The switch module waits until it receives a trigger on the rear connector module 12. - """ + ''' FRONTCONNECTOR_MODULE1 = 1041 - r""" + r''' The switch module waits until it receives a trigger on the front connector module 1. - """ + ''' FRONTCONNECTOR_MODULE2 = 1042 - r""" + r''' The switch module waits until it receives a trigger on the front connector module 2. - """ + ''' FRONTCONNECTOR_MODULE3 = 1043 - r""" + r''' The switch module waits until it receives a trigger on the front connector module 3. - """ + ''' FRONTCONNECTOR_MODULE4 = 1044 - r""" + r''' The switch module waits until it receives a trigger on the front connector module 4. - """ + ''' FRONTCONNECTOR_MODULE5 = 1045 - r""" + r''' The switch module waits until it receives a trigger on the front connector module 5. - """ + ''' FRONTCONNECTOR_MODULE6 = 1046 - r""" + r''' The switch module waits until it receives a trigger on the front connector module 6. - """ + ''' FRONTCONNECTOR_MODULE7 = 1047 - r""" + r''' The switch module waits until it receives a trigger on the front connector module 7. - """ + ''' FRONTCONNECTOR_MODULE8 = 1048 - r""" + r''' The switch module waits until it receives a trigger on the front connector module 8. - """ + ''' FRONTCONNECTOR_MODULE9 = 1049 - r""" + r''' The switch module waits until it receives a trigger on the front connector module 9. - """ + ''' FRONTCONNECTOR_MODULE10 = 1050 - r""" + r''' The switch module waits until it receives a trigger on the front connector module 10. - """ + ''' FRONTCONNECTOR_MODULE11 = 1051 - r""" + r''' The switch module waits until it receives a trigger on the front connector module 11. - """ + ''' FRONTCONNECTOR_MODULE12 = 1052 - r""" + r''' The switch module waits until it receives a trigger on the front connector module 12. - """ + ''' class TriggerInputPolarity(Enum): RISING = 0 - r""" + r''' The trigger occurs on the rising edge of the signal. - """ + ''' FALLING = 1 - r""" + r''' The trigger occurs on the falling edge of the signal. - """ + ''' diff --git a/generated/niswitch/niswitch/errors.py b/generated/niswitch/niswitch/errors.py index 8ea126b9f..4e7c4b0b3 100644 --- a/generated/niswitch/niswitch/errors.py +++ b/generated/niswitch/niswitch/errors.py @@ -7,103 +7,86 @@ def _is_success(code): - return code == 0 + return (code == 0) def _is_error(code): - return code < 0 + return (code < 0) def _is_warning(code): - return code > 0 + return (code > 0) class Error(Exception): - """Base error class for NI-SWITCH""" + '''Base error class for NI-SWITCH''' def __init__(self, message): super(Error, self).__init__(message) class DriverError(Error): - """An error originating from the NI-SWITCH driver""" + '''An error originating from the NI-SWITCH driver''' def __init__(self, code, description): - assert _is_error(code), "Should not raise Error if code is not fatal." + assert (_is_error(code)), "Should not raise Error if code is not fatal." self.code = code self.description = description super(DriverError, self).__init__(str(self.code) + ": " + self.description) class DriverWarning(Warning): - """A warning originating from the NI-SWITCH driver""" + '''A warning originating from the NI-SWITCH driver''' def __init__(self, code, description): - assert _is_warning(code), "Should not create Warning if code is not positive." - super(DriverWarning, self).__init__( - "Warning {0} occurred.\n\n{1}".format(code, description) - ) + assert (_is_warning(code)), "Should not create Warning if code is not positive." + super(DriverWarning, self).__init__('Warning {0} occurred.\n\n{1}'.format(code, description)) class UnsupportedConfigurationError(Error): - """An error due to using this module in an usupported platform.""" + '''An error due to using this module in an usupported platform.''' def __init__(self): - super(UnsupportedConfigurationError, self).__init__( - "System configuration is unsupported: " - + platform.architecture()[0] - + " " - + platform.system() - ) + super(UnsupportedConfigurationError, self).__init__('System configuration is unsupported: ' + platform.architecture()[0] + ' ' + platform.system()) class DriverNotInstalledError(Error): - """An error due to using this module without the driver runtime installed.""" + '''An error due to using this module without the driver runtime installed.''' def __init__(self): - super(DriverNotInstalledError, self).__init__( - "The NI-SWITCH runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it." - ) + super(DriverNotInstalledError, self).__init__('The NI-SWITCH runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it.') class DriverTooOldError(Error): - """An error due to using this module with an older version of the driver runtime.""" + '''An error due to using this module with an older version of the driver runtime.''' def __init__(self): - super(DriverTooOldError, self).__init__( - "A function was not found in the NI-SWITCH runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it." - ) + super(DriverTooOldError, self).__init__('A function was not found in the NI-SWITCH runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it.') class InvalidRepeatedCapabilityError(Error): - """An error due to an invalid character in a repeated capability""" + '''An error due to an invalid character in a repeated capability''' def __init__(self, invalid_character, invalid_string): - super(InvalidRepeatedCapabilityError, self).__init__( - "An invalid character ({0}) was found in repeated capability string ({1})".format( - invalid_character, invalid_string - ) - ) + super(InvalidRepeatedCapabilityError, self).__init__('An invalid character ({0}) was found in repeated capability string ({1})'.format(invalid_character, invalid_string)) class SelfTestError(Error): - """An error due to a failed self-test""" + '''An error due to a failed self-test''' def __init__(self, code, msg): self.code = code self.message = msg - super(SelfTestError, self).__init__( - "Self-test failed with code {0}: {1}".format(code, msg) - ) + super(SelfTestError, self).__init__('Self-test failed with code {0}: {1}'.format(code, msg)) def handle_error(session, code, ignore_warnings, is_error_handling): - """handle_error + '''handle_error Helper function for handling errors returned by niswitch.Library. It calls back into the session to get the corresponding error description and raises if necessary. - """ + ''' if _is_success(code) or (_is_warning(code) and ignore_warnings): return @@ -111,7 +94,7 @@ def handle_error(session, code, ignore_warnings, is_error_handling): if is_error_handling: # The caller is in the midst of error handling and an error occurred. # Don't try to get the description or we'll start recursing until the stack overflows. - description = "" + description = '' else: description = session._get_error_description(code) @@ -120,3 +103,5 @@ def handle_error(session, code, ignore_warnings, is_error_handling): assert _is_warning(code) warnings.warn(DriverWarning(code, description)) + + diff --git a/generated/niswitch/niswitch/session.py b/generated/niswitch/niswitch/session.py index d07e08f51..099ead958 100644 --- a/generated/niswitch/niswitch/session.py +++ b/generated/niswitch/niswitch/session.py @@ -2,7 +2,6 @@ # This file was generated import array # noqa: F401 import ctypes - # Used by @ivi_synchronized from functools import wraps @@ -17,24 +16,22 @@ # Used for __repr__ import pprint - pp = pprint.PrettyPrinter(indent=4) # Helper functions for creating ctypes needed for calling into the driver DLL def get_ctypes_pointer_for_buffer(value=None, library_type=None, size=None): if isinstance(value, array.array): - assert library_type is not None, "library_type is required for array.array" + assert library_type is not None, 'library_type is required for array.array' addr, _ = value.buffer_info() return ctypes.cast(addr, ctypes.POINTER(library_type)) elif str(type(value)).find("'numpy.ndarray'") != -1: import numpy - return numpy.ctypeslib.as_ctypes(value) elif isinstance(value, bytes): return ctypes.cast(value, ctypes.POINTER(library_type)) elif isinstance(value, list): - assert library_type is not None, "library_type is required for list" + assert library_type is not None, 'library_type is required for list' return (library_type * len(value))(*value) else: if library_type is not None and size is not None: @@ -74,7 +71,6 @@ def aux(*xs, **kws): session = xs[0] # parameter 0 is 'self' which is the session object with session.lock(): return f(*xs, **kws) - return aux @@ -95,34 +91,16 @@ def __init__(self, session, prefix, current_repeated_capability_list): self._session = session self._prefix = prefix # We need at least one element. If we get an empty list, make the one element an empty string - self._current_repeated_capability_list = ( - current_repeated_capability_list - if len(current_repeated_capability_list) > 0 - else [""] - ) + self._current_repeated_capability_list = current_repeated_capability_list if len(current_repeated_capability_list) > 0 else [''] # Now we know there is at lease one entry, so we look if it is an empty string or not - self._separator = ( - "/" if len(self._current_repeated_capability_list[0]) > 0 else "" - ) + self._separator = '/' if len(self._current_repeated_capability_list[0]) > 0 else '' def __getitem__(self, repeated_capability): - """Set/get properties or call methods with a repeated capability (i.e. channels)""" - rep_caps_list = _converters.convert_repeated_capabilities( - repeated_capability, self._prefix - ) - complete_rep_cap_list = [ - current_rep_cap + self._separator + rep_cap - for current_rep_cap in self._current_repeated_capability_list - for rep_cap in rep_caps_list - ] - - return _SessionBase( - vi=self._session._vi, - repeated_capability_list=complete_rep_cap_list, - library=self._session._library, - encoding=self._session._encoding, - freeze_it=True, - ) + '''Set/get properties or call methods with a repeated capability (i.e. channels)''' + rep_caps_list = _converters.convert_repeated_capabilities(repeated_capability, self._prefix) + complete_rep_cap_list = [current_rep_cap + self._separator + rep_cap for current_rep_cap in self._current_repeated_capability_list for rep_cap in rep_caps_list] + + return _SessionBase(vi=self._session._vi, repeated_capability_list=complete_rep_cap_list, library=self._session._library, encoding=self._session._encoding, freeze_it=True) # This is a very simple context manager we can use when we need to set/get attributes @@ -134,20 +112,20 @@ def __init__(self, session): def __enter__(self): self._repeated_capability_cache = self._session._repeated_capability - self._session._repeated_capability = "" + self._session._repeated_capability = '' def __exit__(self, exc_type, exc_value, traceback): self._session._repeated_capability = self._repeated_capability_cache class _SessionBase(object): - """Base class for all NI-SWITCH sessions.""" + '''Base class for all NI-SWITCH sessions.''' # This is needed during __init__. Without it, __setattr__ raises an exception _is_frozen = False analog_bus_sharing_enable = _attributes.AttributeViBoolean(1150018) - """Type: bool + '''Type: bool Enables or disables sharing of an analog bus line so that multiple NI SwitchBlock devices may connect to it simultaneously. To enable multiple NI SwitchBlock devices to share an analog bus line, set this property to True for each device on the channel that corresponds with the shared analog bus line. The default value for all devices is False, which disables sharing of the analog bus. Refer to the Using the Analog Bus on an NI SwitchBlock Carrier topic in the NI Switches Help for more information about sharing the analog bus. @@ -161,9 +139,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.analog_bus_sharing_enable` - """ + ''' bandwidth = _attributes.AttributeViReal64(1250005) - """Type: float + '''Type: float This channel-based property returns the bandwidth for the channel. The units are hertz. @@ -177,14 +155,14 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.bandwidth` - """ + ''' channel_count = _attributes.AttributeViInt32(1050203) - """Type: int + '''Type: int Indicates the number of channels that the specific instrument driver supports. - """ + ''' characteristic_impedance = _attributes.AttributeViReal64(1250016) - """Type: float + '''Type: float This channel-based property returns the characteristic impedance for the channel. The units are ohms. @@ -198,21 +176,21 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.characteristic_impedance` - """ + ''' continuous_scan = _attributes.AttributeViBoolean(1250026) - """Type: bool + '''Type: bool When a switch device is scanning, the swich can either stop scanning when the end of the scan (False) or continue scanning from the top of the scan list again (True). Notice that if you set the scan to continuous (True), the Wait For Scan Complete operation will always time out and you must call Abort to stop the scan. - """ + ''' digital_filter_enable = _attributes.AttributeViBoolean(1150016) - """Type: bool + '''Type: bool This property specifies whether to apply the pulse width filter to the Trigger Input. Enabling the Digital Filter (True) prevents the switch module from being triggered by pulses that are less than 150 ns on PXI trigger lines 0–7. When Digital Filter is disabled (False), it is possible for the switch module to be triggered by noise on the PXI trigger lines. If the device triggering the switch is capable of sending pulses greater than 150 ns, you should not disable the Digital Filter. - """ + ''' driver_setup = _attributes.AttributeViString(1050007) - """Type: str + '''Type: str This property indicates the Driver Setup string that the user specified when initializing the driver. Some cases exist where the end-user must specify instrument driver options at initialization time. An example of this is specifying a particular instrument model from among a family of instruments that the driver supports. This is useful when using simulation. The end-user can specify driver-specific options through the DriverSetup keyword in the optionsString parameter to the InitWithOptions method, or through the IVI Configuration Utility. @@ -220,34 +198,32 @@ class _SessionBase(object): Note: One or more of the referenced methods are not in the Python API for this driver. - """ - handshaking_initiation = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.HandshakingInitiation, 1150013 - ) + ''' + handshaking_initiation = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.HandshakingInitiation, 1150013) instrument_firmware_revision = _attributes.AttributeViString(1050510) - """Type: str + '''Type: str A string that contains the firmware revision information for the instrument you are currently using. - """ + ''' instrument_manufacturer = _attributes.AttributeViString(1050511) - """Type: str + '''Type: str A string that contains the name of the instrument manufacturer you are currently using. - """ + ''' instrument_model = _attributes.AttributeViString(1050512) - """Type: str + '''Type: str A string that contains the model number or name of the instrument that you are currently using. - """ + ''' io_resource_descriptor = _attributes.AttributeViString(1050304) - """Type: str + '''Type: str Indicates the resource descriptor the driver uses to identify the physical device. If you initialize the driver with a logical name, this property contains the resource descriptor that corresponds to the entry in the IVI Configuration utility. If you initialize the instrument driver with the resource descriptor, this property contains that value. - """ + ''' is_configuration_channel = _attributes.AttributeViBoolean(1250003) - """Type: bool + '''Type: bool This channel-based property specifies whether to reserve the channel for internal path creation. A channel that is available for internal path creation is called a configuration channel. The driver may use configuration channels to create paths between two channels you specify in the connect method. Configuration channels are not available for external connections. Set this property to True to mark the channel as a configuration channel. Set this property to False to mark the channel as available for external connections. @@ -262,19 +238,19 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.is_configuration_channel` - """ + ''' is_debounced = _attributes.AttributeViBoolean(1250002) - """Type: bool + '''Type: bool This property indicates whether the entire switch device has settled since the last switching command. A value of True indicates that all signals going through the switch device are valid. - """ + ''' is_scanning = _attributes.AttributeViBoolean(1250024) - """Type: bool + '''Type: bool If True, the switch module is currently scanning through the scan list (i.e. it is not in the Idle state). If False, the switch module is not currently scanning through the scan list (i.e. it is in the Idle state). - """ + ''' is_source_channel = _attributes.AttributeViBoolean(1250001) - """Type: bool + '''Type: bool This channel-based property specifies whether you want to identify the channel as a source channel. Typically, you set this property to True when you attach the channel to a power supply, a method generator, or an active measurement point on the unit under test, and you do not want to connect the channel to another source. The driver prevents source channels from connecting to each other. The connect method returns the NISWITCH_ERROR_ATTEMPT_TO_CONNECT_SOURCES when you attempt to connect two channels that you identify as source channels. @@ -287,23 +263,23 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.is_source_channel` - """ + ''' is_waiting_for_trig = _attributes.AttributeViBoolean(1150004) - """Type: bool + '''Type: bool In a scan list, a semi-colon (;) is used to indicate that at that point in the scan list, the scan engine should pause until a trigger is received from the trigger input. If that trigger is user generated through either a hardware pulse or the Send SW Trigger operation, it is necessary for the user to know when the scan engine has reached such a state. - """ + ''' logical_name = _attributes.AttributeViString(1050305) - """Type: str + '''Type: str A string containing the logical name you specified when opening the current IVI session. You may pass a logical name to the init or InitWithOptions methods. The IVI Configuration utility must contain an entry for the logical name. The logical name entry refers to a virtual instrument section in the IVI Configuration file. The virtual instrument section specifies a physical device and initial user options. Note: One or more of the referenced methods are not in the Python API for this driver. - """ + ''' max_ac_voltage = _attributes.AttributeViReal64(1250007) - """Type: float + '''Type: float This channel-based property returns the maximum AC voltage the channel can switch. The units are volts RMS. @@ -317,9 +293,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.max_ac_voltage` - """ + ''' max_carry_ac_current = _attributes.AttributeViReal64(1250011) - """Type: float + '''Type: float This channel-based property returns the maximum AC current the channel can carry. The units are amperes RMS. @@ -333,9 +309,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.max_carry_ac_current` - """ + ''' max_carry_ac_power = _attributes.AttributeViReal64(1250015) - """Type: float + '''Type: float This channel-based property returns the maximum AC power the channel can carry. The units are volt-amperes. @@ -349,9 +325,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.max_carry_ac_power` - """ + ''' max_carry_dc_current = _attributes.AttributeViReal64(1250010) - """Type: float + '''Type: float This channel-based property returns the maximum DC current the channel can carry. The units are amperes. @@ -365,9 +341,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.max_carry_dc_current` - """ + ''' max_carry_dc_power = _attributes.AttributeViReal64(1250014) - """Type: float + '''Type: float This channel-based property returns the maximum DC power the channel can carry. The units are watts. @@ -381,9 +357,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.max_carry_dc_power` - """ + ''' max_dc_voltage = _attributes.AttributeViReal64(1250006) - """Type: float + '''Type: float This channel-based property returns the maximum DC voltage the channel can switch. The units are volts. @@ -397,9 +373,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.max_dc_voltage` - """ + ''' max_switching_ac_current = _attributes.AttributeViReal64(1250009) - """Type: float + '''Type: float This channel-based property returns the maximum AC current the channel can switch. The units are amperes RMS. @@ -413,9 +389,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.max_switching_ac_current` - """ + ''' max_switching_ac_power = _attributes.AttributeViReal64(1250013) - """Type: float + '''Type: float This channel-based property returns the maximum AC power the channel can switch. The units are volt-amperes. @@ -429,9 +405,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.max_switching_ac_power` - """ + ''' max_switching_dc_current = _attributes.AttributeViReal64(1250008) - """Type: float + '''Type: float This channel-based property returns the maximum DC current the channel can switch. The units are amperes. @@ -445,9 +421,9 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.max_switching_dc_current` - """ + ''' max_switching_dc_power = _attributes.AttributeViReal64(1250012) - """Type: float + '''Type: float This channel-based property returns the maximum DC power the channel can switch. The units are watts. @@ -461,50 +437,46 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.max_switching_dc_power` - """ + ''' number_of_relays = _attributes.AttributeViInt32(1150014) - """Type: int + '''Type: int This property returns the number of relays. - """ + ''' num_of_columns = _attributes.AttributeViInt32(1250019) - """Type: int + '''Type: int This property returns the number of channels on the column of a matrix or scanner. If the switch device is a scanner, this value is the number of input channels. The wire_mode property affects the number of available columns. For example, if your device has 8 input lines and you use the four-wire mode, then the number of columns you have available is 2. - """ + ''' num_of_rows = _attributes.AttributeViInt32(1250018) - """Type: int + '''Type: int This property returns the number of channels on the row of a matrix or scanner. If the switch device is a scanner, this value is the number of output channels. The wire_mode property affects the number of available rows. For example, if your device has 8 input lines and you use the two-wire mode, then the number of columns you have available is 4. - """ + ''' power_down_latching_relays_after_debounce = _attributes.AttributeViBoolean(1150017) - """Type: bool + '''Type: bool This property specifies whether to power down latching relays after calling Wait For Debounce. When Power Down Latching Relays After Debounce is enabled (True), a call to Wait For Debounce ensures that the relays are settled and the latching relays are powered down. - """ - scan_advanced_output = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.ScanAdvancedOutput, 1250023 - ) - """Type: enums.ScanAdvancedOutput + ''' + scan_advanced_output = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ScanAdvancedOutput, 1250023) + '''Type: enums.ScanAdvancedOutput This property specifies the method you want to use to notify another instrument that all signals going through the switch device have settled following the processing of one entry in the scan list. - """ - scan_advanced_polarity = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.ScanAdvancedPolarity, 1150011 - ) + ''' + scan_advanced_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ScanAdvancedPolarity, 1150011) scan_delay = _attributes.AttributeViReal64TimeDeltaSeconds(1250025) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds This property specifies the minimum amount of time the switch device waits before it asserts the scan advanced output trigger after opening or closing the switch. The switch device always waits for debounce before asserting the trigger. The units are seconds. the greater value of the settling time and the value you specify as the scan delay. Note: NI PXI-2501/2503/2565/2590/2591 Users--the actual delay will always be - """ + ''' scan_list = _attributes.AttributeViString(1250020) - """Type: str + '''Type: str This property contains a scan list, which is a string that specifies channel connections and trigger conditions. The initiate method makes or breaks connections and waits for triggers according to the instructions in the scan list. The scan list is comprised of channel names that you separate with special characters. These special characters determine the operations the scanner performs on the channels when it executes this scan list. @@ -517,11 +489,9 @@ class _SessionBase(object): To tell the switch device to wait for a trigger event, use the following character as a separator between paths: ; (semi-colon) Example: 'CH1->CH2;CH3->CH4' tells the switch to make the path from channel CH1 to channel CH2, wait for a trigger, and then make the path from CH3 to CH4. - """ - scan_mode = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.ScanMode, 1250021 - ) - """Type: enums.ScanMode + ''' + scan_mode = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.ScanMode, 1250021) + '''Type: enums.ScanMode This property specifies what happens to existing connections that conflict with the connections you make in a scan list. For example, if CH1 is already connected to CH2 and the scan list instructs the switch device to connect CH1 to CH3, this property specifies what happens to the connection between CH1 and CH2. If the value of this property is ScanMode.NONE, the switch device takes no action on existing paths. If the value is ScanMode.BREAK_BEFORE_MAKE, the switch device breaks conflicting paths before making new ones. If the value is ScanMode.BREAK_AFTER_MAKE, the switch device breaks conflicting paths after making new ones. @@ -529,14 +499,14 @@ class _SessionBase(object): Note: One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed. - """ + ''' serial_number = _attributes.AttributeViString(1150015) - """Type: str + '''Type: str This read-only property returns the serial number for the switch device controlled by this instrument driver. If the device does not return a serial number, the driver returns the IVI_ERROR_ATTRIBUTE_NOT_SUPPORTED error. - """ + ''' settling_time = _attributes.AttributeViReal64TimeDeltaSeconds(1250004) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds This channel-based property returns the maximum length of time from after you make a connection until the signal flowing through the channel settles. The units are seconds. the greater value of the settling time and the value you specify as the scan delay. @@ -552,57 +522,53 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.settling_time` - """ + ''' simulate = _attributes.AttributeViBoolean(1050005) - """Type: bool + '''Type: bool Specifies whether or not to simulate instrument driver I/O operations. If simulation is enabled, instrument driver methods perform range checking and call Ivi_GetAttribute and Ivi_SetAttribute methods, but they do not perform instrument I/O. For output parameters that represent instrument data, the instrument driver methods return calculated values. The default value is False. Use the InitWithOptions method to override this value. Note: One or more of the referenced methods are not in the Python API for this driver. - """ + ''' specific_driver_description = _attributes.AttributeViString(1050514) - """Type: str + '''Type: str A string that contains a brief description of the specific driver. - """ + ''' specific_driver_revision = _attributes.AttributeViString(1050551) - """Type: str + '''Type: str A string that contains additional version information about this instrument driver. - """ + ''' specific_driver_vendor = _attributes.AttributeViString(1050513) - """Type: str + '''Type: str A string that contains the name of the vendor that supplies this driver. - """ + ''' supported_instrument_models = _attributes.AttributeViString(1050327) - """Type: str + '''Type: str Contains a comma-separated list of supported instrument models. - """ + ''' temperature = _attributes.AttributeViReal64(1150019) - """Type: float + '''Type: float This property returns the temperature as read by the Switch module. The units are degrees Celsius. - """ - trigger_input = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TriggerInput, 1250022 - ) - """Type: enums.TriggerInput + ''' + trigger_input = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerInput, 1250022) + '''Type: enums.TriggerInput This property specifies the source of the trigger for which the switch device can wait when processing a scan list. The switch device waits for a trigger when it encounters a semi-colon in a scan list. When the trigger occurs, the switch device advances to the next entry in the scan list. - """ - trigger_input_polarity = _attributes.AttributeEnum( - _attributes.AttributeViInt32, enums.TriggerInputPolarity, 1150010 - ) - """Type: enums.TriggerInputPolarity + ''' + trigger_input_polarity = _attributes.AttributeEnum(_attributes.AttributeViInt32, enums.TriggerInputPolarity, 1150010) + '''Type: enums.TriggerInputPolarity Determines the behavior of the trigger Input. - """ + ''' wire_mode = _attributes.AttributeViInt32(1250017) - """Type: int + '''Type: int This property returns the wire mode of the switch device. This property affects the values of the num_of_rows and num_of_columns properties. The actual number of input and output lines on the switch device is fixed, but the number of channels depends on how many lines constitute each channel. @@ -616,49 +582,41 @@ class _SessionBase(object): To set/get on all channels, you can call the property directly on the :py:class:`niswitch.Session`. Example: :py:attr:`my_session.wire_mode` - """ + ''' - def __init__( - self, repeated_capability_list, vi, library, encoding, freeze_it=False - ): + def __init__(self, repeated_capability_list, vi, library, encoding, freeze_it=False): self._repeated_capability_list = repeated_capability_list - self._repeated_capability = ",".join(repeated_capability_list) + self._repeated_capability = ','.join(repeated_capability_list) self._vi = vi self._library = library self._encoding = encoding # Store the parameter list for later printing in __repr__ param_list = [] - param_list.append( - "repeated_capability_list=" + pp.pformat(repeated_capability_list) - ) + param_list.append("repeated_capability_list=" + pp.pformat(repeated_capability_list)) param_list.append("vi=" + pp.pformat(vi)) param_list.append("library=" + pp.pformat(library)) param_list.append("encoding=" + pp.pformat(encoding)) - self._param_list = ", ".join(param_list) + self._param_list = ', '.join(param_list) # Instantiate any repeated capability objects - self.channels = _RepeatedCapabilities(self, "", repeated_capability_list) + self.channels = _RepeatedCapabilities(self, '', repeated_capability_list) self._is_frozen = freeze_it def __repr__(self): - return "{0}.{1}({2})".format( - "niswitch", self.__class__.__name__, self._param_list - ) + return '{0}.{1}({2})'.format('niswitch', self.__class__.__name__, self._param_list) def __setattr__(self, key, value): if self._is_frozen and key not in dir(self): - raise AttributeError( - "'{0}' object has no attribute '{1}'".format(type(self).__name__, key) - ) + raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) object.__setattr__(self, key, value) def _get_error_description(self, error_code): - """_get_error_description + '''_get_error_description Returns the error description. - """ + ''' try: _, error_string = self._get_error() return error_string @@ -666,21 +624,21 @@ def _get_error_description(self, error_code): pass try: - """ + ''' It is expected for _get_error to raise when the session is invalid (IVI spec requires GetError to fail). Use _error_message instead. It doesn't require a session. - """ + ''' error_string = self._error_message(error_code) return error_string except errors.Error: return "Failed to retrieve error description." - """ These are code-generated """ + ''' These are code-generated ''' @ivi_synchronized def _get_attribute_vi_boolean(self, attribute_id): - r"""_get_attribute_vi_boolean + r'''_get_attribute_vi_boolean This method queries the value of a ViBoolean property. You can use this method to get the values of instrument specific properties and @@ -728,29 +686,18 @@ def _get_attribute_vi_boolean(self, attribute_id): list of the constants by pressing on this control. Select a value by double-clicking on it or by selecting it and then pressing . - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niSwitch_GetAttributeViBoolean( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - None - if attribute_value_ctype is None - else (ctypes.pointer(attribute_value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niSwitch_GetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_int32(self, attribute_id): - r"""_get_attribute_vi_int32 + r'''_get_attribute_vi_int32 This method queries the value of a ViInt32 property. You can use this method to get the values of instrument specific properties and @@ -798,29 +745,18 @@ def _get_attribute_vi_int32(self, attribute_id): list of the constants by pressing on this control. Select a value by double-clicking on it or by selecting it and then pressing . - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niSwitch_GetAttributeViInt32( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - None - if attribute_value_ctype is None - else (ctypes.pointer(attribute_value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niSwitch_GetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_real64(self, attribute_id): - r"""_get_attribute_vi_real64 + r'''_get_attribute_vi_real64 This method queries the value of a ViReal64 property. You can use this method to get the values of instrument specific properties and @@ -868,29 +804,18 @@ def _get_attribute_vi_real64(self, attribute_id): list of the constants by pressing on this control. Select a value by double-clicking on it or by selecting it and then pressing . - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niSwitch_GetAttributeViReal64( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - None - if attribute_value_ctype is None - else (ctypes.pointer(attribute_value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niSwitch_GetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_id_ctype, None if attribute_value_ctype is None else (ctypes.pointer(attribute_value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(attribute_value_ctype.value) @ivi_synchronized def _get_attribute_vi_string(self, attribute_id): - r"""_get_attribute_vi_string + r'''_get_attribute_vi_string This method queries the value of a ViString property. You can use this method to get the values of instrument specific properties and @@ -959,42 +884,22 @@ def _get_attribute_vi_string(self, attribute_id): constants by pressing on this control. Select a value by double-clicking on it or by selecting it and then pressing . - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 array_size_ctype = _visatype.ViInt32() # case S170 attribute_value_ctype = None # case C050 - error_code = self._library.niSwitch_GetAttributeViString( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - array_size_ctype, - attribute_value_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niSwitch_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, array_size_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) array_size_ctype = _visatype.ViInt32(error_code) # case S180 - attribute_value_ctype = ( - _visatype.ViChar * array_size_ctype.value - )() # case C060 - error_code = self._library.niSwitch_GetAttributeViString( - vi_ctype, - channel_name_ctype, - attribute_id_ctype, - array_size_ctype, - attribute_value_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + attribute_value_ctype = (_visatype.ViChar * array_size_ctype.value)() # case C060 + error_code = self._library.niSwitch_GetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, array_size_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return attribute_value_ctype.value.decode(self._encoding) def _get_error(self): - r"""_get_error + r'''_get_error This method retrieves and then clears the IVI error information for the session or the current execution thread. One exception exists: If @@ -1030,35 +935,21 @@ def _get_error(self): places "123" into the buffer and returns 7. If you pass 0 for the Buffer Size, you can pass VI_NULL for this parameter. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 code_ctype = _visatype.ViStatus() # case S220 buffer_size_ctype = _visatype.ViInt32() # case S170 description_ctype = None # case C050 - error_code = self._library.niSwitch_GetError( - vi_ctype, - None if code_ctype is None else (ctypes.pointer(code_ctype)), - buffer_size_ctype, - description_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=True - ) + error_code = self._library.niSwitch_GetError(vi_ctype, None if code_ctype is None else (ctypes.pointer(code_ctype)), buffer_size_ctype, description_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 description_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niSwitch_GetError( - vi_ctype, - None if code_ctype is None else (ctypes.pointer(code_ctype)), - buffer_size_ctype, - description_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + error_code = self._library.niSwitch_GetError(vi_ctype, None if code_ctype is None else (ctypes.pointer(code_ctype)), buffer_size_ctype, description_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return int(code_ctype.value), description_ctype.value.decode(self._encoding) def lock(self): - """lock + '''lock Obtains a multithread lock on the device session. Before doing so, the software waits until all other execution threads release their locks @@ -1086,27 +977,25 @@ def lock(self): Returns: lock (context manager): When used in a with statement, niswitch.Session.lock acts as a context manager and unlock will be called when the with block is exited - """ + ''' self._lock_session() # We do not call _lock_session() in the context manager so that this function can # act standalone as well and let the client call unlock() explicitly. If they do use the context manager, # that will handle the unlock for them return _Lock(self) def _lock_session(self): - """_lock_session + '''_lock_session Actual call to driver - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSwitch_LockSession(vi_ctype, None) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return @ivi_synchronized def _set_attribute_vi_boolean(self, attribute_id, attribute_value): - r"""_set_attribute_vi_boolean + r'''_set_attribute_vi_boolean This method sets the value of a ViBoolean property. This is a low-level method that you can use to set the values of @@ -1166,24 +1055,18 @@ def _set_attribute_vi_boolean(self, attribute_id, attribute_value): then pressing . Note: Some of the values might not be valid depending on the current settings of the instrument session. Default Value: none - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViBoolean(attribute_value) # case S150 - error_code = self._library.niSwitch_SetAttributeViBoolean( - vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niSwitch_SetAttributeViBoolean(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_int32(self, attribute_id, attribute_value): - r"""_set_attribute_vi_int32 + r'''_set_attribute_vi_int32 This method sets the value of a ViInt32 property. This is a low-level method that you can use to set the values of instrument-specific @@ -1243,24 +1126,18 @@ def _set_attribute_vi_int32(self, attribute_id, attribute_value): then pressing . Note: Some of the values might not be valid depending on the current settings of the instrument session. Default Value: none - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViInt32(attribute_value) # case S150 - error_code = self._library.niSwitch_SetAttributeViInt32( - vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niSwitch_SetAttributeViInt32(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_real64(self, attribute_id, attribute_value): - r"""_set_attribute_vi_real64 + r'''_set_attribute_vi_real64 This method sets the value of a ViReal64 property. This is a low-level method that you can use to set the values of @@ -1320,24 +1197,18 @@ def _set_attribute_vi_real64(self, attribute_id, attribute_value): then pressing . Note: Some of the values might not be valid depending on the current settings of the instrument session. Default Value: none - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 attribute_value_ctype = _visatype.ViReal64(attribute_value) # case S150 - error_code = self._library.niSwitch_SetAttributeViReal64( - vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niSwitch_SetAttributeViReal64(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _set_attribute_vi_string(self, attribute_id, attribute_value): - r"""_set_attribute_vi_string + r'''_set_attribute_vi_string This method sets the value of a ViString property. This is a low-level method that you can use to set the values of @@ -1397,39 +1268,29 @@ def _set_attribute_vi_string(self, attribute_id, attribute_value): then pressing . Note: Some of the values might not be valid depending on the current settings of the instrument session. Default Value: none - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 - attribute_value_ctype = ctypes.create_string_buffer( - attribute_value.encode(self._encoding) - ) # case C020 - error_code = self._library.niSwitch_SetAttributeViString( - vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + attribute_value_ctype = ctypes.create_string_buffer(attribute_value.encode(self._encoding)) # case C020 + error_code = self._library.niSwitch_SetAttributeViString(vi_ctype, channel_name_ctype, attribute_id_ctype, attribute_value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def unlock(self): - """unlock + '''unlock Releases a lock that you acquired on an device session using lock. Refer to lock for additional information on session locks. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSwitch_UnlockSession(vi_ctype, None) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return def _error_message(self, error_code): - r"""_error_message + r'''_error_message Converts an error code returned by NI-SWITCH into a user-readable string. Generally this information is supplied in error out of any @@ -1445,30 +1306,20 @@ def _error_message(self, error_code): error_message (str): The error information formatted into a string. You must pass a ViChar array with at least 256 bytes. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code_ctype = _visatype.ViStatus(error_code) # case S150 error_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niSwitch_error_message( - vi_ctype, error_code_ctype, error_message_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + error_code = self._library.niSwitch_error_message(vi_ctype, error_code_ctype, error_message_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return error_message_ctype.value.decode(self._encoding) class Session(_SessionBase): - """An NI-SWITCH session to a National Instruments Switch Module""" + '''An NI-SWITCH session to a National Instruments Switch Module''' - def __init__( - self, - resource_name, - topology="Configured Topology", - simulate=False, - reset_device=False, - ): - r"""An NI-SWITCH session to a National Instruments Switch Module + def __init__(self, resource_name, topology="Configured Topology", simulate=False, reset_device=False): + r'''An NI-SWITCH session to a National Instruments Switch Module Returns a session handle used to identify the switch in all subsequent instrument driver calls and sets the topology of the switch. @@ -1701,22 +1552,14 @@ def __init__( Returns: session (niswitch.Session): A session object representing the device. - """ - super(Session, self).__init__( - repeated_capability_list=[], - vi=None, - library=None, - encoding=None, - freeze_it=False, - ) + ''' + super(Session, self).__init__(repeated_capability_list=[], vi=None, library=None, encoding=None, freeze_it=False) self._library = _library_singleton.get() - self._encoding = "windows-1251" + self._encoding = 'windows-1251' # Call specified init function self._vi = 0 # This must be set before calling _init_with_topology(). - self._vi = self._init_with_topology( - resource_name, topology, simulate, reset_device - ) + self._vi = self._init_with_topology(resource_name, topology, simulate, reset_device) # Store the parameter list for later printing in __repr__ param_list = [] @@ -1724,7 +1567,7 @@ def __init__( param_list.append("topology=" + pp.pformat(topology)) param_list.append("simulate=" + pp.pformat(simulate)) param_list.append("reset_device=" + pp.pformat(reset_device)) - self._param_list = ", ".join(param_list) + self._param_list = ', '.join(param_list) self._is_frozen = True @@ -1735,7 +1578,7 @@ def __exit__(self, exc_type, exc_value, traceback): self.close() def initiate(self): - """initiate + '''initiate Commits the configured scan list and trigger settings to hardware and initiates the scan. If niSwitch Commit was called earlier, niSwitch @@ -1748,11 +1591,11 @@ def initiate(self): Note: This method will return a Python context manager that will initiate on entering and abort on exit. - """ + ''' return _Scan(self) def close(self): - """close + '''close Terminates the NI-SWITCH session and all of its properties and deallocates any memory resources the driver uses. Notes: (1) You must @@ -1765,7 +1608,7 @@ def close(self): Note: This method is not needed when using the session context manager - """ + ''' try: self._close() except errors.DriverError: @@ -1773,26 +1616,24 @@ def close(self): raise self._vi = 0 - """ These are code-generated """ + ''' These are code-generated ''' @ivi_synchronized def abort(self): - r"""abort + r'''abort Aborts the scan in progress. Initiate a scan with initiate. If the switch module is not scanning, NISWITCH_ERROR_NO_SCAN_IN_PROGRESS error is returned. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSwitch_AbortScan(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def can_connect(self, channel1, channel2): - r"""can_connect + r'''can_connect Verifies that a path between channel 1 and channel 2 can be created. If a path is possible in the switch module, the availability of that path @@ -1838,47 +1679,32 @@ def can_connect(self, channel1, channel2): create a path between the two channels because one of the channels is a configuration channel and thus unavailable for external connections. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel1_ctype = ctypes.create_string_buffer( - channel1.encode(self._encoding) - ) # case C020 - channel2_ctype = ctypes.create_string_buffer( - channel2.encode(self._encoding) - ) # case C020 + channel1_ctype = ctypes.create_string_buffer(channel1.encode(self._encoding)) # case C020 + channel2_ctype = ctypes.create_string_buffer(channel2.encode(self._encoding)) # case C020 path_capability_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niSwitch_CanConnect( - vi_ctype, - channel1_ctype, - channel2_ctype, - None - if path_capability_ctype is None - else (ctypes.pointer(path_capability_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niSwitch_CanConnect(vi_ctype, channel1_ctype, channel2_ctype, None if path_capability_ctype is None else (ctypes.pointer(path_capability_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return enums.PathCapability(path_capability_ctype.value) @ivi_synchronized def commit(self): - r"""commit + r'''commit Downloads the configured scan list and trigger settings to hardware. Calling commit optional as it is implicitly called during initiate. Use commit to arm triggers in a given order or to control when expensive hardware operations are performed. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSwitch_Commit(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def connect(self, channel1, channel2): - r"""connect + r'''connect Creates a path between channel 1 and channel 2. The driver calculates and uses the shortest path between the two channels. Refer to Immediate @@ -1910,25 +1736,17 @@ def connect(self, channel1, channel2): valid channel names for the switch module. Examples of valid channel names: ch0, com0, ab0, r1, c2, cjtemp Default value: None - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel1_ctype = ctypes.create_string_buffer( - channel1.encode(self._encoding) - ) # case C020 - channel2_ctype = ctypes.create_string_buffer( - channel2.encode(self._encoding) - ) # case C020 - error_code = self._library.niSwitch_Connect( - vi_ctype, channel1_ctype, channel2_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + channel1_ctype = ctypes.create_string_buffer(channel1.encode(self._encoding)) # case C020 + channel2_ctype = ctypes.create_string_buffer(channel2.encode(self._encoding)) # case C020 + error_code = self._library.niSwitch_Connect(vi_ctype, channel1_ctype, channel2_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def connect_multiple(self, connection_list): - r"""connect_multiple + r'''connect_multiple Creates the connections between channels specified in Connection List. Specify connections with two endpoints only or the explicit path between @@ -1960,37 +1778,29 @@ def connect_multiple(self, connection_list): of a valid connection list: c0 -> r1, [c2 -> r2 -> c3] In this example, r2 is a configuration channel. Default value: None - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - connection_list_ctype = ctypes.create_string_buffer( - connection_list.encode(self._encoding) - ) # case C020 - error_code = self._library.niSwitch_ConnectMultiple( - vi_ctype, connection_list_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + connection_list_ctype = ctypes.create_string_buffer(connection_list.encode(self._encoding)) # case C020 + error_code = self._library.niSwitch_ConnectMultiple(vi_ctype, connection_list_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def disable(self): - r"""disable + r'''disable Places the switch module in a quiescent state where it has minimal or no impact on the system to which it is connected. All channels are disconnected and any scan in progress is aborted. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSwitch_Disable(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def disconnect(self, channel1, channel2): - r"""disconnect + r'''disconnect This method destroys the path between two channels that you create with the connect or set_path method. If a path is @@ -2008,39 +1818,29 @@ def disconnect(self, channel1, channel2): valid channel names for the switch module. Examples of valid channel names: ch0, com0, ab0, r1, c2, cjtemp Default value: None - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel1_ctype = ctypes.create_string_buffer( - channel1.encode(self._encoding) - ) # case C020 - channel2_ctype = ctypes.create_string_buffer( - channel2.encode(self._encoding) - ) # case C020 - error_code = self._library.niSwitch_Disconnect( - vi_ctype, channel1_ctype, channel2_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + channel1_ctype = ctypes.create_string_buffer(channel1.encode(self._encoding)) # case C020 + channel2_ctype = ctypes.create_string_buffer(channel2.encode(self._encoding)) # case C020 + error_code = self._library.niSwitch_Disconnect(vi_ctype, channel1_ctype, channel2_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def disconnect_all(self): - r"""disconnect_all + r'''disconnect_all Breaks all existing paths. If the switch module cannot break all paths, NISWITCH_WARN_PATH_REMAINS warning is returned. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSwitch_DisconnectAll(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def disconnect_multiple(self, disconnection_list): - r"""disconnect_multiple + r'''disconnect_multiple Breaks the connections between channels specified in Disconnection List. If no connections exist between channels, NI-SWITCH returns an error. In @@ -2057,22 +1857,16 @@ def disconnect_multiple(self, disconnection_list): r2 -> c3] In this example, r2 is a configuration channel. Default value: None - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - disconnection_list_ctype = ctypes.create_string_buffer( - disconnection_list.encode(self._encoding) - ) # case C020 - error_code = self._library.niSwitch_DisconnectMultiple( - vi_ctype, disconnection_list_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + disconnection_list_ctype = ctypes.create_string_buffer(disconnection_list.encode(self._encoding)) # case C020 + error_code = self._library.niSwitch_DisconnectMultiple(vi_ctype, disconnection_list_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def get_channel_name(self, index): - r"""get_channel_name + r'''get_channel_name Returns the channel string that is in the channel table at the specified index. Use get_channel_name in a For Loop to get a complete list @@ -2088,32 +1882,22 @@ def get_channel_name(self, index): channel_name_buffer (str): Returns the channel name that is in the channel table at the index you specify. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 index_ctype = _visatype.ViInt32(index) # case S150 buffer_size_ctype = _visatype.ViInt32() # case S170 channel_name_buffer_ctype = None # case C050 - error_code = self._library.niSwitch_GetChannelName( - vi_ctype, index_ctype, buffer_size_ctype, channel_name_buffer_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niSwitch_GetChannelName(vi_ctype, index_ctype, buffer_size_ctype, channel_name_buffer_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - channel_name_buffer_ctype = ( - _visatype.ViChar * buffer_size_ctype.value - )() # case C060 - error_code = self._library.niSwitch_GetChannelName( - vi_ctype, index_ctype, buffer_size_ctype, channel_name_buffer_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + channel_name_buffer_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 + error_code = self._library.niSwitch_GetChannelName(vi_ctype, index_ctype, buffer_size_ctype, channel_name_buffer_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return channel_name_buffer_ctype.value.decode(self._encoding) @ivi_synchronized def get_path(self, channel1, channel2): - r"""get_path + r'''get_path Returns a string that identifies the explicit path created with connect. Pass this string to set_path to establish @@ -2145,35 +1929,23 @@ def get_path(self, channel1, channel2): All other channels in the path are configuration channels. Examples of returned paths: ch0->com0, com0->ab0 - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - channel1_ctype = ctypes.create_string_buffer( - channel1.encode(self._encoding) - ) # case C020 - channel2_ctype = ctypes.create_string_buffer( - channel2.encode(self._encoding) - ) # case C020 + channel1_ctype = ctypes.create_string_buffer(channel1.encode(self._encoding)) # case C020 + channel2_ctype = ctypes.create_string_buffer(channel2.encode(self._encoding)) # case C020 buffer_size_ctype = _visatype.ViInt32() # case S170 path_ctype = None # case C050 - error_code = self._library.niSwitch_GetPath( - vi_ctype, channel1_ctype, channel2_ctype, buffer_size_ctype, path_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niSwitch_GetPath(vi_ctype, channel1_ctype, channel2_ctype, buffer_size_ctype, path_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 path_ctype = (_visatype.ViChar * buffer_size_ctype.value)() # case C060 - error_code = self._library.niSwitch_GetPath( - vi_ctype, channel1_ctype, channel2_ctype, buffer_size_ctype, path_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niSwitch_GetPath(vi_ctype, channel1_ctype, channel2_ctype, buffer_size_ctype, path_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return path_ctype.value.decode(self._encoding) @ivi_synchronized def get_relay_count(self, relay_name): - r"""get_relay_count + r'''get_relay_count Returns the number of times the relay has changed from Closed to Open. Relay count is useful for tracking relay lifetime and usage. Call @@ -2190,25 +1962,17 @@ def get_relay_count(self, relay_name): Returns: relay_count (int): The number of relay cycles. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - relay_name_ctype = ctypes.create_string_buffer( - relay_name.encode(self._encoding) - ) # case C020 + relay_name_ctype = ctypes.create_string_buffer(relay_name.encode(self._encoding)) # case C020 relay_count_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niSwitch_GetRelayCount( - vi_ctype, - relay_name_ctype, - None if relay_count_ctype is None else (ctypes.pointer(relay_count_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niSwitch_GetRelayCount(vi_ctype, relay_name_ctype, None if relay_count_ctype is None else (ctypes.pointer(relay_count_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(relay_count_ctype.value) @ivi_synchronized def get_relay_name(self, index): - r"""get_relay_name + r'''get_relay_name Returns the relay name string that is in the relay list at the specified index. Use get_relay_name in a For Loop to get a complete list @@ -2223,32 +1987,22 @@ def get_relay_name(self, index): Returns: relay_name_buffer (str): Returns the relay name for the index you specify. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 index_ctype = _visatype.ViInt32(index) # case S150 relay_name_buffer_size_ctype = _visatype.ViInt32() # case S170 relay_name_buffer_ctype = None # case C050 - error_code = self._library.niSwitch_GetRelayName( - vi_ctype, index_ctype, relay_name_buffer_size_ctype, relay_name_buffer_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niSwitch_GetRelayName(vi_ctype, index_ctype, relay_name_buffer_size_ctype, relay_name_buffer_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) relay_name_buffer_size_ctype = _visatype.ViInt32(error_code) # case S180 - relay_name_buffer_ctype = ( - _visatype.ViChar * relay_name_buffer_size_ctype.value - )() # case C060 - error_code = self._library.niSwitch_GetRelayName( - vi_ctype, index_ctype, relay_name_buffer_size_ctype, relay_name_buffer_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + relay_name_buffer_ctype = (_visatype.ViChar * relay_name_buffer_size_ctype.value)() # case C060 + error_code = self._library.niSwitch_GetRelayName(vi_ctype, index_ctype, relay_name_buffer_size_ctype, relay_name_buffer_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return relay_name_buffer_ctype.value.decode(self._encoding) @ivi_synchronized def get_relay_position(self, relay_name): - r"""get_relay_position + r'''get_relay_position Returns the relay position for the relay specified in the Relay Name parameter. @@ -2263,32 +2017,16 @@ def get_relay_position(self, relay_name): relay_position (enums.RelayPosition): Indicates whether the relay is open or closed. RelayPosition.OPEN 10 RelayPosition.CLOSED 11 - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - relay_name_ctype = ctypes.create_string_buffer( - relay_name.encode(self._encoding) - ) # case C020 + relay_name_ctype = ctypes.create_string_buffer(relay_name.encode(self._encoding)) # case C020 relay_position_ctype = _visatype.ViInt32() # case S220 - error_code = self._library.niSwitch_GetRelayPosition( - vi_ctype, - relay_name_ctype, - None - if relay_position_ctype is None - else (ctypes.pointer(relay_position_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niSwitch_GetRelayPosition(vi_ctype, relay_name_ctype, None if relay_position_ctype is None else (ctypes.pointer(relay_position_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return enums.RelayPosition(relay_position_ctype.value) - def _init_with_topology( - self, - resource_name, - topology="Configured Topology", - simulate=False, - reset_device=False, - ): - r"""_init_with_topology + def _init_with_topology(self, resource_name, topology="Configured Topology", simulate=False, reset_device=False): + r'''_init_with_topology Returns a session handle used to identify the switch in all subsequent instrument driver calls and sets the topology of the switch. @@ -2526,31 +2264,19 @@ def _init_with_topology( Note: One or more of the referenced methods are not in the Python API for this driver. - """ - resource_name_ctype = ctypes.create_string_buffer( - resource_name.encode(self._encoding) - ) # case C020 - topology_ctype = ctypes.create_string_buffer( - topology.encode(self._encoding) - ) # case C020 + ''' + resource_name_ctype = ctypes.create_string_buffer(resource_name.encode(self._encoding)) # case C020 + topology_ctype = ctypes.create_string_buffer(topology.encode(self._encoding)) # case C020 simulate_ctype = _visatype.ViBoolean(simulate) # case S150 reset_device_ctype = _visatype.ViBoolean(reset_device) # case S150 vi_ctype = _visatype.ViSession() # case S220 - error_code = self._library.niSwitch_InitWithTopology( - resource_name_ctype, - topology_ctype, - simulate_ctype, - reset_device_ctype, - None if vi_ctype is None else (ctypes.pointer(vi_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niSwitch_InitWithTopology(resource_name_ctype, topology_ctype, simulate_ctype, reset_device_ctype, None if vi_ctype is None else (ctypes.pointer(vi_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(vi_ctype.value) @ivi_synchronized def _initiate_scan(self): - r"""_initiate_scan + r'''_initiate_scan Commits the configured scan list and trigger settings to hardware and initiates the scan. If niSwitch Commit was called earlier, niSwitch @@ -2560,17 +2286,15 @@ def _initiate_scan(self): methods return NISWITCH_ERROR_SCAN_IN_PROGRESS. To stop the scanning operation, To stop the scanning operation, call abort. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSwitch_InitiateScan(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def relay_control(self, relay_name, relay_action): - r"""relay_control + r'''relay_control Controls individual relays of the switch. When controlling individual relays, the protection offered by setting the usage of source channels @@ -2588,48 +2312,33 @@ def relay_control(self, relay_name, relay_action): Close Defined values: RelayAction.OPEN RelayAction.CLOSE (Default Value) - """ + ''' if type(relay_action) is not enums.RelayAction: - raise TypeError( - "Parameter relay_action must be of type " + str(enums.RelayAction) - ) + raise TypeError('Parameter relay_action must be of type ' + str(enums.RelayAction)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - relay_name_ctype = ctypes.create_string_buffer( - relay_name.encode(self._encoding) - ) # case C020 + relay_name_ctype = ctypes.create_string_buffer(relay_name.encode(self._encoding)) # case C020 relay_action_ctype = _visatype.ViInt32(relay_action.value) # case S130 - error_code = self._library.niSwitch_RelayControl( - vi_ctype, relay_name_ctype, relay_action_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niSwitch_RelayControl(vi_ctype, relay_name_ctype, relay_action_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def reset_with_defaults(self): - r"""reset_with_defaults + r'''reset_with_defaults Resets the switch module and applies initial user specified settings from the logical name used to initialize the session. If the session was created without a logical name, this method is equivalent to reset. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSwitch_ResetWithDefaults(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def route_scan_advanced_output( - self, - scan_advanced_output_connector, - scan_advanced_output_bus_line, - invert=False, - ): - r"""route_scan_advanced_output + def route_scan_advanced_output(self, scan_advanced_output_connector, scan_advanced_output_bus_line, invert=False): + r'''route_scan_advanced_output Routes the scan advanced output trigger from a trigger bus line (TTLx) to the front or rear connector. @@ -2655,41 +2364,22 @@ def route_scan_advanced_output( invert (bool): If True, inverts the input trigger signal from falling to rising or vice versa. Default value: False - """ + ''' if type(scan_advanced_output_connector) is not enums.ScanAdvancedOutput: - raise TypeError( - "Parameter scan_advanced_output_connector must be of type " - + str(enums.ScanAdvancedOutput) - ) + raise TypeError('Parameter scan_advanced_output_connector must be of type ' + str(enums.ScanAdvancedOutput)) if type(scan_advanced_output_bus_line) is not enums.ScanAdvancedOutput: - raise TypeError( - "Parameter scan_advanced_output_bus_line must be of type " - + str(enums.ScanAdvancedOutput) - ) + raise TypeError('Parameter scan_advanced_output_bus_line must be of type ' + str(enums.ScanAdvancedOutput)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - scan_advanced_output_connector_ctype = _visatype.ViInt32( - scan_advanced_output_connector.value - ) # case S130 - scan_advanced_output_bus_line_ctype = _visatype.ViInt32( - scan_advanced_output_bus_line.value - ) # case S130 + scan_advanced_output_connector_ctype = _visatype.ViInt32(scan_advanced_output_connector.value) # case S130 + scan_advanced_output_bus_line_ctype = _visatype.ViInt32(scan_advanced_output_bus_line.value) # case S130 invert_ctype = _visatype.ViBoolean(invert) # case S150 - error_code = self._library.niSwitch_RouteScanAdvancedOutput( - vi_ctype, - scan_advanced_output_connector_ctype, - scan_advanced_output_bus_line_ctype, - invert_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niSwitch_RouteScanAdvancedOutput(vi_ctype, scan_advanced_output_connector_ctype, scan_advanced_output_bus_line_ctype, invert_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def route_trigger_input( - self, trigger_input_connector, trigger_input_bus_line, invert=False - ): - r"""route_trigger_input + def route_trigger_input(self, trigger_input_connector, trigger_input_bus_line, invert=False): + r'''route_trigger_input Routes the input trigger from the front or rear connector to a trigger bus line (TTLx). To disconnect the route, call this method again and @@ -2716,39 +2406,22 @@ def route_trigger_input( invert (bool): If True, inverts the input trigger signal from falling to rising or vice versa. Default value: False - """ + ''' if type(trigger_input_connector) is not enums.TriggerInput: - raise TypeError( - "Parameter trigger_input_connector must be of type " - + str(enums.TriggerInput) - ) + raise TypeError('Parameter trigger_input_connector must be of type ' + str(enums.TriggerInput)) if type(trigger_input_bus_line) is not enums.TriggerInput: - raise TypeError( - "Parameter trigger_input_bus_line must be of type " - + str(enums.TriggerInput) - ) + raise TypeError('Parameter trigger_input_bus_line must be of type ' + str(enums.TriggerInput)) vi_ctype = _visatype.ViSession(self._vi) # case S110 - trigger_input_connector_ctype = _visatype.ViInt32( - trigger_input_connector.value - ) # case S130 - trigger_input_bus_line_ctype = _visatype.ViInt32( - trigger_input_bus_line.value - ) # case S130 + trigger_input_connector_ctype = _visatype.ViInt32(trigger_input_connector.value) # case S130 + trigger_input_bus_line_ctype = _visatype.ViInt32(trigger_input_bus_line.value) # case S130 invert_ctype = _visatype.ViBoolean(invert) # case S150 - error_code = self._library.niSwitch_RouteTriggerInput( - vi_ctype, - trigger_input_connector_ctype, - trigger_input_bus_line_ctype, - invert_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niSwitch_RouteTriggerInput(vi_ctype, trigger_input_connector_ctype, trigger_input_bus_line_ctype, invert_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def send_software_trigger(self): - r"""send_software_trigger + r'''send_software_trigger Sends a software trigger to the switch module specified in the NI-SWITCH session. When the trigger input is set to TriggerInput.SOFTWARE_TRIG @@ -2759,17 +2432,15 @@ def send_software_trigger(self): Note: One or more of the referenced methods are not in the Python API for this driver. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSwitch_SendSoftwareTrigger(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def set_path(self, path_list): - r"""set_path + r'''set_path Connects two channels by specifying an explicit path in the path list parameter. set_path is particularly useful where path @@ -2784,20 +2455,16 @@ def set_path(self, path_list): configuration channel. Default value: None Obtain the path list for a previously created path with get_path. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - path_list_ctype = ctypes.create_string_buffer( - path_list.encode(self._encoding) - ) # case C020 + path_list_ctype = ctypes.create_string_buffer(path_list.encode(self._encoding)) # case C020 error_code = self._library.niSwitch_SetPath(vi_ctype, path_list_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def wait_for_debounce(self, maximum_time_ms=hightime.timedelta(milliseconds=5000)): - r"""wait_for_debounce + r'''wait_for_debounce Pauses until all created paths have settled. If the time you specify with the Maximum Time (ms) parameter elapsed before the switch paths @@ -2810,24 +2477,16 @@ def wait_for_debounce(self, maximum_time_ms=hightime.timedelta(milliseconds=5000 before all relays active or deactivate, a timeout error is returned. Default Value:5000 ms - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_time_ms_ctype = _converters.convert_timedelta_to_milliseconds_int32( - maximum_time_ms - ) # case S140 - error_code = self._library.niSwitch_WaitForDebounce( - vi_ctype, maximum_time_ms_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + maximum_time_ms_ctype = _converters.convert_timedelta_to_milliseconds_int32(maximum_time_ms) # case S140 + error_code = self._library.niSwitch_WaitForDebounce(vi_ctype, maximum_time_ms_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized - def wait_for_scan_complete( - self, maximum_time_ms=hightime.timedelta(milliseconds=5000) - ): - r"""wait_for_scan_complete + def wait_for_scan_complete(self, maximum_time_ms=hightime.timedelta(milliseconds=5000)): + r'''wait_for_scan_complete Pauses until the switch module stops scanning or the maximum time has elapsed and returns a timeout error. If the time you specify with the @@ -2841,21 +2500,15 @@ def wait_for_scan_complete( NISWITCH_ERROR_MAX_TIME_EXCEEDED error is returned. Default Value:5000 ms - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 - maximum_time_ms_ctype = _converters.convert_timedelta_to_milliseconds_int32( - maximum_time_ms - ) # case S140 - error_code = self._library.niSwitch_WaitForScanComplete( - vi_ctype, maximum_time_ms_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + maximum_time_ms_ctype = _converters.convert_timedelta_to_milliseconds_int32(maximum_time_ms) # case S140 + error_code = self._library.niSwitch_WaitForScanComplete(vi_ctype, maximum_time_ms_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def _close(self): - r"""_close + r'''_close Terminates the NI-SWITCH session and all of its properties and deallocates any memory resources the driver uses. Notes: (1) You must @@ -2865,17 +2518,15 @@ def _close(self): Note: One or more of the referenced methods are not in the Python API for this driver. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSwitch_close(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def self_test(self): - """self_test + '''self_test Verifies that the driver can communicate with the switch module. @@ -2891,7 +2542,7 @@ def self_test(self): +----------------+------------------+ | 1 | Self-test failed | +----------------+------------------+ - """ + ''' code, msg = self._self_test() if code: raise errors.SelfTestError(code, msg) @@ -2899,22 +2550,20 @@ def self_test(self): @ivi_synchronized def reset(self): - r"""reset + r'''reset Disconnects all created paths and returns the switch module to the state at initialization. Configuration channel and source channel settings remain unchanged. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 error_code = self._library.niSwitch_reset(vi_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return @ivi_synchronized def _self_test(self): - r"""_self_test + r'''_self_test Verifies that the driver can communicate with the switch module. @@ -2924,20 +2573,13 @@ def _self_test(self): self_test_message (str): Self-test response string from the switch device. You must pass a ViChar array with at least 256 bytes. - """ + ''' vi_ctype = _visatype.ViSession(self._vi) # case S110 self_test_result_ctype = _visatype.ViInt16() # case S220 self_test_message_ctype = (_visatype.ViChar * 256)() # case C070 - error_code = self._library.niSwitch_self_test( - vi_ctype, - None - if self_test_result_ctype is None - else (ctypes.pointer(self_test_result_ctype)), - self_test_message_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) - return int(self_test_result_ctype.value), self_test_message_ctype.value.decode( - self._encoding - ) + error_code = self._library.niSwitch_self_test(vi_ctype, None if self_test_result_ctype is None else (ctypes.pointer(self_test_result_ctype)), self_test_message_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) + return int(self_test_result_ctype.value), self_test_message_ctype.value.decode(self._encoding) + + + diff --git a/generated/niswitch/niswitch/unit_tests/_matchers.py b/generated/niswitch/niswitch/unit_tests/_matchers.py index 2c3d190ca..b06336fe7 100644 --- a/generated/niswitch/niswitch/unit_tests/_matchers.py +++ b/generated/niswitch/niswitch/unit_tests/_matchers.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # This file was generated -"""Matcher classes used by unit tests in order to set mock expectations. +'''Matcher classes used by unit tests in order to set mock expectations. These work well with our visatype definitions. -""" +''' import ctypes import niswitch._visatype as _visatype @@ -21,27 +21,15 @@ def __init__(self, expected_type, expected_value): def __eq__(self, other): if not isinstance(other, self.expected_type): - print( - "{0}: Unexpected type. Expected: {1}. Received: {2}".format( - self.__class__.__name__, self.expected_type, type(other) - ) - ) + print("{0}: Unexpected type. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_type, type(other))) return False if other.value != self.expected_value: - print( - "{0}: Unexpected value. Expected: {1}. Received: {2}".format( - self.__class__.__name__, self.expected_value, other.value - ) - ) + print("{0}: Unexpected value. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_value, other.value)) return False return True def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_type), - pp.pformat(self.expected_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) class _PointerMatcher(object): @@ -50,18 +38,12 @@ def __init__(self, expected_type): def __eq__(self, other): if not isinstance(other, ctypes.POINTER(self.expected_type)): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - ctypes.POINTER(self.expected_type), type(other) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(ctypes.POINTER(self.expected_type), type(other))) return False return True def __repr__(self): - return "{0}({1})".format( - self.__class__.__name__, pp.pformat(self.expected_type) - ) + return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_type)) class _BufferMatcher(object): @@ -88,47 +70,29 @@ def __eq__(self, other): pass # Because of object lifetimes, we may need to mock the other instance and provide lists instead of the actual array - if not isinstance(other, self.expected_type) and not isinstance( - other, list - ): - print( - "Unexpected type. Expected: {0} or {1}. Received: {2}".format( - self.expected_type, list, type(other) - ) - ) + if not isinstance(other, self.expected_type) and not isinstance(other, list): + print("Unexpected type. Expected: {0} or {1}. Received: {2}".format(self.expected_type, list, type(other))) return False if self.expected_size != len(other): - print( - "Unexpected length. Expected: {0}. Received: {1}".format( - self.expected_size, len(other) - ) - ) + print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(other))) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for i in range(0, len(self.expected_value)): if self.expected_value[i] != other[i]: - print( - "Unexpected value at index {0}. Expected: {1}. Received: {2}".format( - i, self.expected_value[i], other[i] - ) - ) + print("Unexpected value at index {0}. Expected: {1}. Received: {2}".format(i, self.expected_value[i], other[i])) return False return True def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self._expected_element_type), - pp.pformat(self._expected_size_or_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self._expected_element_type), pp.pformat(self._expected_size_or_value)) def __str__(self): - ret_str = self.__repr__() + "\n" - ret_str += " expected_type = " + str(self.expected_type) + "\n" - ret_str += " expected_value = " + str(self.expected_value) + "\n" - ret_str += " expected_size = " + str(self.expected_size) + "\n" + ret_str = self.__repr__() + '\n' + ret_str += ' expected_type = ' + str(self.expected_type) + '\n' + ret_str += ' expected_value = ' + str(self.expected_value) + '\n' + ret_str += ' expected_size = ' + str(self.expected_size) + '\n' return ret_str @@ -148,37 +112,21 @@ def __eq__(self, other): pass if not isinstance(other, ctypes.Array): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_type, type(other) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(other))) return False - if ( - len(other) < len(self.expected_string_value) + 1 - ): # +1 for NULL terminating character - print( - "Unexpected length in C string. Expected at least: {0}. Received {1}".format( - len(other), len(self.expected_string_value) + 1 - ) - ) + if len(other) < len(self.expected_string_value) + 1: # +1 for NULL terminating character + print("Unexpected length in C string. Expected at least: {0}. Received {1}".format(len(other), len(self.expected_string_value) + 1)) return False if not isinstance(other[0], bytes): print("Unexpected type. Not a string. Received: {0}".format(type(other[0]))) return False if other.value.decode("ascii") != self.expected_string_value: - print( - "Unexpected value. Expected {0}. Received: {1}".format( - self.expected_string_value, other.value.decode - ) - ) + print("Unexpected value. Expected {0}. Received: {1}".format(self.expected_string_value, other.value.decode)) return False return True def __repr__(self): - return "{0}({1})".format( - self.__class__.__name__, pp.pformat(self.expected_string_value) - ) + return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_string_value)) # Custom Type @@ -191,11 +139,7 @@ def _compare_ctype_structs(expected, actual): expected_val = getattr(expected, field_name) actual_val = getattr(actual, field_name) if expected_val != actual_val: - print( - "Unexpected value field {0}. Expected: {1}. Received: {2}".format( - field_name, expected_val, actual_val - ) - ) + print("Unexpected value field {0}. Expected: {1}. Received: {2}".format(field_name, expected_val, actual_val)) return False return True @@ -207,20 +151,12 @@ def __init__(self, expected_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_type, type(actual) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) return False return _compare_ctype_structs(self.expected_value, actual) def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_type), - pp.pformat(self.expected_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) class CustomTypeBufferMatcher(object): @@ -232,48 +168,30 @@ def __init__(self, expected_element_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print( - "Unexpected array type. Expected: {0}. Received: {1}".format( - self.expected_type, type(actual) - ) - ) + print("Unexpected array type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) return False if self.expected_size != len(actual): - print( - "Unexpected length. Expected: {0}. Received: {1}".format( - self.expected_size, len(actual) - ) - ) + print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(actual))) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for a, e in zip(actual, self.expected_value): if not isinstance(a, self.expected_element_type): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_element_type, type(a) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_element_type, type(a))) return False if not _compare_ctype_structs(e, a): return False return True def __repr__(self): - expected_val_repr = ( - "[" + ", ".join([x.__repr__() for x in self.expected_value]) + "]" - ) - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_element_type), - expected_val_repr, - ) + expected_val_repr = '[' + ', '.join([x.__repr__() for x in self.expected_value]) + ']' + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_element_type), expected_val_repr) def __str__(self): - ret_str = self.__repr__() + "\n" - ret_str += " expected_type = " + str(self.expected_type) + "\n" - ret_str += " expected_size = " + str(self.expected_size) + "\n" + ret_str = self.__repr__() + '\n' + ret_str += ' expected_type = ' + str(self.expected_type) + '\n' + ret_str += ' expected_size = ' + str(self.expected_size) + '\n' return ret_str @@ -282,9 +200,7 @@ def __str__(self): class ViBooleanMatcher(_ScalarMatcher): def __init__(self, expected_value): - _ScalarMatcher.__init__( - self, _visatype.ViBoolean, 1 if expected_value is True else 0 - ) + _ScalarMatcher.__init__(self, _visatype.ViBoolean, 1 if expected_value is True else 0) class ViSessionMatcher(_ScalarMatcher): @@ -396,3 +312,6 @@ def __init__(self, expected_size_or_value): class ViSessionBufferMatcher(_BufferMatcher): def __init__(self, expected_size_or_value): _BufferMatcher.__init__(self, _visatype.ViSession, expected_size_or_value) + + + diff --git a/generated/niswitch/niswitch/unit_tests/_mock_helper.py b/generated/niswitch/niswitch/unit_tests/_mock_helper.py index d509168f0..c7b4221b5 100644 --- a/generated/niswitch/niswitch/unit_tests/_mock_helper.py +++ b/generated/niswitch/niswitch/unit_tests/_mock_helper.py @@ -16,102 +16,102 @@ def __init__(self, function, param=None): class SideEffectsHelper(object): def __init__(self): self._defaults = {} - self._defaults["AbortScan"] = {} - self._defaults["AbortScan"]["return"] = 0 - self._defaults["CanConnect"] = {} - self._defaults["CanConnect"]["return"] = 0 - self._defaults["CanConnect"]["pathCapability"] = None - self._defaults["Commit"] = {} - self._defaults["Commit"]["return"] = 0 - self._defaults["Connect"] = {} - self._defaults["Connect"]["return"] = 0 - self._defaults["ConnectMultiple"] = {} - self._defaults["ConnectMultiple"]["return"] = 0 - self._defaults["Disable"] = {} - self._defaults["Disable"]["return"] = 0 - self._defaults["Disconnect"] = {} - self._defaults["Disconnect"]["return"] = 0 - self._defaults["DisconnectAll"] = {} - self._defaults["DisconnectAll"]["return"] = 0 - self._defaults["DisconnectMultiple"] = {} - self._defaults["DisconnectMultiple"]["return"] = 0 - self._defaults["GetAttributeViBoolean"] = {} - self._defaults["GetAttributeViBoolean"]["return"] = 0 - self._defaults["GetAttributeViBoolean"]["attributeValue"] = None - self._defaults["GetAttributeViInt32"] = {} - self._defaults["GetAttributeViInt32"]["return"] = 0 - self._defaults["GetAttributeViInt32"]["attributeValue"] = None - self._defaults["GetAttributeViReal64"] = {} - self._defaults["GetAttributeViReal64"]["return"] = 0 - self._defaults["GetAttributeViReal64"]["attributeValue"] = None - self._defaults["GetAttributeViString"] = {} - self._defaults["GetAttributeViString"]["return"] = 0 - self._defaults["GetAttributeViString"]["attributeValue"] = None - self._defaults["GetChannelName"] = {} - self._defaults["GetChannelName"]["return"] = 0 - self._defaults["GetChannelName"]["channelNameBuffer"] = None - self._defaults["GetError"] = {} - self._defaults["GetError"]["return"] = 0 - self._defaults["GetError"]["code"] = None - self._defaults["GetError"]["description"] = None - self._defaults["GetPath"] = {} - self._defaults["GetPath"]["return"] = 0 - self._defaults["GetPath"]["path"] = None - self._defaults["GetRelayCount"] = {} - self._defaults["GetRelayCount"]["return"] = 0 - self._defaults["GetRelayCount"]["relayCount"] = None - self._defaults["GetRelayName"] = {} - self._defaults["GetRelayName"]["return"] = 0 - self._defaults["GetRelayName"]["relayNameBuffer"] = None - self._defaults["GetRelayPosition"] = {} - self._defaults["GetRelayPosition"]["return"] = 0 - self._defaults["GetRelayPosition"]["relayPosition"] = None - self._defaults["InitWithTopology"] = {} - self._defaults["InitWithTopology"]["return"] = 0 - self._defaults["InitWithTopology"]["vi"] = None - self._defaults["InitiateScan"] = {} - self._defaults["InitiateScan"]["return"] = 0 - self._defaults["LockSession"] = {} - self._defaults["LockSession"]["return"] = 0 - self._defaults["LockSession"]["callerHasLock"] = None - self._defaults["RelayControl"] = {} - self._defaults["RelayControl"]["return"] = 0 - self._defaults["ResetWithDefaults"] = {} - self._defaults["ResetWithDefaults"]["return"] = 0 - self._defaults["RouteScanAdvancedOutput"] = {} - self._defaults["RouteScanAdvancedOutput"]["return"] = 0 - self._defaults["RouteTriggerInput"] = {} - self._defaults["RouteTriggerInput"]["return"] = 0 - self._defaults["SendSoftwareTrigger"] = {} - self._defaults["SendSoftwareTrigger"]["return"] = 0 - self._defaults["SetAttributeViBoolean"] = {} - self._defaults["SetAttributeViBoolean"]["return"] = 0 - self._defaults["SetAttributeViInt32"] = {} - self._defaults["SetAttributeViInt32"]["return"] = 0 - self._defaults["SetAttributeViReal64"] = {} - self._defaults["SetAttributeViReal64"]["return"] = 0 - self._defaults["SetAttributeViString"] = {} - self._defaults["SetAttributeViString"]["return"] = 0 - self._defaults["SetPath"] = {} - self._defaults["SetPath"]["return"] = 0 - self._defaults["UnlockSession"] = {} - self._defaults["UnlockSession"]["return"] = 0 - self._defaults["UnlockSession"]["callerHasLock"] = None - self._defaults["WaitForDebounce"] = {} - self._defaults["WaitForDebounce"]["return"] = 0 - self._defaults["WaitForScanComplete"] = {} - self._defaults["WaitForScanComplete"]["return"] = 0 - self._defaults["close"] = {} - self._defaults["close"]["return"] = 0 - self._defaults["error_message"] = {} - self._defaults["error_message"]["return"] = 0 - self._defaults["error_message"]["errorMessage"] = None - self._defaults["reset"] = {} - self._defaults["reset"]["return"] = 0 - self._defaults["self_test"] = {} - self._defaults["self_test"]["return"] = 0 - self._defaults["self_test"]["selfTestResult"] = None - self._defaults["self_test"]["selfTestMessage"] = None + self._defaults['AbortScan'] = {} + self._defaults['AbortScan']['return'] = 0 + self._defaults['CanConnect'] = {} + self._defaults['CanConnect']['return'] = 0 + self._defaults['CanConnect']['pathCapability'] = None + self._defaults['Commit'] = {} + self._defaults['Commit']['return'] = 0 + self._defaults['Connect'] = {} + self._defaults['Connect']['return'] = 0 + self._defaults['ConnectMultiple'] = {} + self._defaults['ConnectMultiple']['return'] = 0 + self._defaults['Disable'] = {} + self._defaults['Disable']['return'] = 0 + self._defaults['Disconnect'] = {} + self._defaults['Disconnect']['return'] = 0 + self._defaults['DisconnectAll'] = {} + self._defaults['DisconnectAll']['return'] = 0 + self._defaults['DisconnectMultiple'] = {} + self._defaults['DisconnectMultiple']['return'] = 0 + self._defaults['GetAttributeViBoolean'] = {} + self._defaults['GetAttributeViBoolean']['return'] = 0 + self._defaults['GetAttributeViBoolean']['attributeValue'] = None + self._defaults['GetAttributeViInt32'] = {} + self._defaults['GetAttributeViInt32']['return'] = 0 + self._defaults['GetAttributeViInt32']['attributeValue'] = None + self._defaults['GetAttributeViReal64'] = {} + self._defaults['GetAttributeViReal64']['return'] = 0 + self._defaults['GetAttributeViReal64']['attributeValue'] = None + self._defaults['GetAttributeViString'] = {} + self._defaults['GetAttributeViString']['return'] = 0 + self._defaults['GetAttributeViString']['attributeValue'] = None + self._defaults['GetChannelName'] = {} + self._defaults['GetChannelName']['return'] = 0 + self._defaults['GetChannelName']['channelNameBuffer'] = None + self._defaults['GetError'] = {} + self._defaults['GetError']['return'] = 0 + self._defaults['GetError']['code'] = None + self._defaults['GetError']['description'] = None + self._defaults['GetPath'] = {} + self._defaults['GetPath']['return'] = 0 + self._defaults['GetPath']['path'] = None + self._defaults['GetRelayCount'] = {} + self._defaults['GetRelayCount']['return'] = 0 + self._defaults['GetRelayCount']['relayCount'] = None + self._defaults['GetRelayName'] = {} + self._defaults['GetRelayName']['return'] = 0 + self._defaults['GetRelayName']['relayNameBuffer'] = None + self._defaults['GetRelayPosition'] = {} + self._defaults['GetRelayPosition']['return'] = 0 + self._defaults['GetRelayPosition']['relayPosition'] = None + self._defaults['InitWithTopology'] = {} + self._defaults['InitWithTopology']['return'] = 0 + self._defaults['InitWithTopology']['vi'] = None + self._defaults['InitiateScan'] = {} + self._defaults['InitiateScan']['return'] = 0 + self._defaults['LockSession'] = {} + self._defaults['LockSession']['return'] = 0 + self._defaults['LockSession']['callerHasLock'] = None + self._defaults['RelayControl'] = {} + self._defaults['RelayControl']['return'] = 0 + self._defaults['ResetWithDefaults'] = {} + self._defaults['ResetWithDefaults']['return'] = 0 + self._defaults['RouteScanAdvancedOutput'] = {} + self._defaults['RouteScanAdvancedOutput']['return'] = 0 + self._defaults['RouteTriggerInput'] = {} + self._defaults['RouteTriggerInput']['return'] = 0 + self._defaults['SendSoftwareTrigger'] = {} + self._defaults['SendSoftwareTrigger']['return'] = 0 + self._defaults['SetAttributeViBoolean'] = {} + self._defaults['SetAttributeViBoolean']['return'] = 0 + self._defaults['SetAttributeViInt32'] = {} + self._defaults['SetAttributeViInt32']['return'] = 0 + self._defaults['SetAttributeViReal64'] = {} + self._defaults['SetAttributeViReal64']['return'] = 0 + self._defaults['SetAttributeViString'] = {} + self._defaults['SetAttributeViString']['return'] = 0 + self._defaults['SetPath'] = {} + self._defaults['SetPath']['return'] = 0 + self._defaults['UnlockSession'] = {} + self._defaults['UnlockSession']['return'] = 0 + self._defaults['UnlockSession']['callerHasLock'] = None + self._defaults['WaitForDebounce'] = {} + self._defaults['WaitForDebounce']['return'] = 0 + self._defaults['WaitForScanComplete'] = {} + self._defaults['WaitForScanComplete']['return'] = 0 + self._defaults['close'] = {} + self._defaults['close']['return'] = 0 + self._defaults['error_message'] = {} + self._defaults['error_message']['return'] = 0 + self._defaults['error_message']['errorMessage'] = None + self._defaults['reset'] = {} + self._defaults['reset']['return'] = 0 + self._defaults['self_test'] = {} + self._defaults['self_test']['return'] = 0 + self._defaults['self_test']['selfTestResult'] = None + self._defaults['self_test']['selfTestMessage'] = None def __getitem__(self, func): return self._defaults[func] @@ -120,517 +120,375 @@ def __setitem__(self, func, val): self._defaults[func] = val def niSwitch_AbortScan(self, vi): # noqa: N802 - if self._defaults["AbortScan"]["return"] != 0: - return self._defaults["AbortScan"]["return"] - return self._defaults["AbortScan"]["return"] - - def niSwitch_CanConnect( - self, vi, channel1, channel2, path_capability - ): # noqa: N802 - if self._defaults["CanConnect"]["return"] != 0: - return self._defaults["CanConnect"]["return"] + if self._defaults['AbortScan']['return'] != 0: + return self._defaults['AbortScan']['return'] + return self._defaults['AbortScan']['return'] + + def niSwitch_CanConnect(self, vi, channel1, channel2, path_capability): # noqa: N802 + if self._defaults['CanConnect']['return'] != 0: + return self._defaults['CanConnect']['return'] # path_capability - if self._defaults["CanConnect"]["pathCapability"] is None: - raise MockFunctionCallError("niSwitch_CanConnect", param="pathCapability") + if self._defaults['CanConnect']['pathCapability'] is None: + raise MockFunctionCallError("niSwitch_CanConnect", param='pathCapability') if path_capability is not None: - path_capability.contents.value = self._defaults["CanConnect"][ - "pathCapability" - ] - return self._defaults["CanConnect"]["return"] + path_capability.contents.value = self._defaults['CanConnect']['pathCapability'] + return self._defaults['CanConnect']['return'] def niSwitch_Commit(self, vi): # noqa: N802 - if self._defaults["Commit"]["return"] != 0: - return self._defaults["Commit"]["return"] - return self._defaults["Commit"]["return"] + if self._defaults['Commit']['return'] != 0: + return self._defaults['Commit']['return'] + return self._defaults['Commit']['return'] def niSwitch_Connect(self, vi, channel1, channel2): # noqa: N802 - if self._defaults["Connect"]["return"] != 0: - return self._defaults["Connect"]["return"] - return self._defaults["Connect"]["return"] + if self._defaults['Connect']['return'] != 0: + return self._defaults['Connect']['return'] + return self._defaults['Connect']['return'] def niSwitch_ConnectMultiple(self, vi, connection_list): # noqa: N802 - if self._defaults["ConnectMultiple"]["return"] != 0: - return self._defaults["ConnectMultiple"]["return"] - return self._defaults["ConnectMultiple"]["return"] + if self._defaults['ConnectMultiple']['return'] != 0: + return self._defaults['ConnectMultiple']['return'] + return self._defaults['ConnectMultiple']['return'] def niSwitch_Disable(self, vi): # noqa: N802 - if self._defaults["Disable"]["return"] != 0: - return self._defaults["Disable"]["return"] - return self._defaults["Disable"]["return"] + if self._defaults['Disable']['return'] != 0: + return self._defaults['Disable']['return'] + return self._defaults['Disable']['return'] def niSwitch_Disconnect(self, vi, channel1, channel2): # noqa: N802 - if self._defaults["Disconnect"]["return"] != 0: - return self._defaults["Disconnect"]["return"] - return self._defaults["Disconnect"]["return"] + if self._defaults['Disconnect']['return'] != 0: + return self._defaults['Disconnect']['return'] + return self._defaults['Disconnect']['return'] def niSwitch_DisconnectAll(self, vi): # noqa: N802 - if self._defaults["DisconnectAll"]["return"] != 0: - return self._defaults["DisconnectAll"]["return"] - return self._defaults["DisconnectAll"]["return"] + if self._defaults['DisconnectAll']['return'] != 0: + return self._defaults['DisconnectAll']['return'] + return self._defaults['DisconnectAll']['return'] def niSwitch_DisconnectMultiple(self, vi, disconnection_list): # noqa: N802 - if self._defaults["DisconnectMultiple"]["return"] != 0: - return self._defaults["DisconnectMultiple"]["return"] - return self._defaults["DisconnectMultiple"]["return"] - - def niSwitch_GetAttributeViBoolean( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["GetAttributeViBoolean"]["return"] != 0: - return self._defaults["GetAttributeViBoolean"]["return"] + if self._defaults['DisconnectMultiple']['return'] != 0: + return self._defaults['DisconnectMultiple']['return'] + return self._defaults['DisconnectMultiple']['return'] + + def niSwitch_GetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['GetAttributeViBoolean']['return'] != 0: + return self._defaults['GetAttributeViBoolean']['return'] # attribute_value - if self._defaults["GetAttributeViBoolean"]["attributeValue"] is None: - raise MockFunctionCallError( - "niSwitch_GetAttributeViBoolean", param="attributeValue" - ) + if self._defaults['GetAttributeViBoolean']['attributeValue'] is None: + raise MockFunctionCallError("niSwitch_GetAttributeViBoolean", param='attributeValue') if attribute_value is not None: - attribute_value.contents.value = self._defaults["GetAttributeViBoolean"][ - "attributeValue" - ] - return self._defaults["GetAttributeViBoolean"]["return"] - - def niSwitch_GetAttributeViInt32( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["GetAttributeViInt32"]["return"] != 0: - return self._defaults["GetAttributeViInt32"]["return"] + attribute_value.contents.value = self._defaults['GetAttributeViBoolean']['attributeValue'] + return self._defaults['GetAttributeViBoolean']['return'] + + def niSwitch_GetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['GetAttributeViInt32']['return'] != 0: + return self._defaults['GetAttributeViInt32']['return'] # attribute_value - if self._defaults["GetAttributeViInt32"]["attributeValue"] is None: - raise MockFunctionCallError( - "niSwitch_GetAttributeViInt32", param="attributeValue" - ) + if self._defaults['GetAttributeViInt32']['attributeValue'] is None: + raise MockFunctionCallError("niSwitch_GetAttributeViInt32", param='attributeValue') if attribute_value is not None: - attribute_value.contents.value = self._defaults["GetAttributeViInt32"][ - "attributeValue" - ] - return self._defaults["GetAttributeViInt32"]["return"] - - def niSwitch_GetAttributeViReal64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["GetAttributeViReal64"]["return"] != 0: - return self._defaults["GetAttributeViReal64"]["return"] + attribute_value.contents.value = self._defaults['GetAttributeViInt32']['attributeValue'] + return self._defaults['GetAttributeViInt32']['return'] + + def niSwitch_GetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['GetAttributeViReal64']['return'] != 0: + return self._defaults['GetAttributeViReal64']['return'] # attribute_value - if self._defaults["GetAttributeViReal64"]["attributeValue"] is None: - raise MockFunctionCallError( - "niSwitch_GetAttributeViReal64", param="attributeValue" - ) + if self._defaults['GetAttributeViReal64']['attributeValue'] is None: + raise MockFunctionCallError("niSwitch_GetAttributeViReal64", param='attributeValue') if attribute_value is not None: - attribute_value.contents.value = self._defaults["GetAttributeViReal64"][ - "attributeValue" - ] - return self._defaults["GetAttributeViReal64"]["return"] - - def niSwitch_GetAttributeViString( - self, vi, channel_name, attribute_id, array_size, attribute_value - ): # noqa: N802 - if self._defaults["GetAttributeViString"]["return"] != 0: - return self._defaults["GetAttributeViString"]["return"] - if self._defaults["GetAttributeViString"]["attributeValue"] is None: - raise MockFunctionCallError( - "niSwitch_GetAttributeViString", param="attributeValue" - ) + attribute_value.contents.value = self._defaults['GetAttributeViReal64']['attributeValue'] + return self._defaults['GetAttributeViReal64']['return'] + + def niSwitch_GetAttributeViString(self, vi, channel_name, attribute_id, array_size, attribute_value): # noqa: N802 + if self._defaults['GetAttributeViString']['return'] != 0: + return self._defaults['GetAttributeViString']['return'] + if self._defaults['GetAttributeViString']['attributeValue'] is None: + raise MockFunctionCallError("niSwitch_GetAttributeViString", param='attributeValue') if array_size.value == 0: - return len(self._defaults["GetAttributeViString"]["attributeValue"]) - attribute_value.value = self._defaults["GetAttributeViString"][ - "attributeValue" - ].encode("ascii") - return self._defaults["GetAttributeViString"]["return"] - - def niSwitch_GetChannelName( - self, vi, index, buffer_size, channel_name_buffer - ): # noqa: N802 - if self._defaults["GetChannelName"]["return"] != 0: - return self._defaults["GetChannelName"]["return"] - if self._defaults["GetChannelName"]["channelNameBuffer"] is None: - raise MockFunctionCallError( - "niSwitch_GetChannelName", param="channelNameBuffer" - ) + return len(self._defaults['GetAttributeViString']['attributeValue']) + attribute_value.value = self._defaults['GetAttributeViString']['attributeValue'].encode('ascii') + return self._defaults['GetAttributeViString']['return'] + + def niSwitch_GetChannelName(self, vi, index, buffer_size, channel_name_buffer): # noqa: N802 + if self._defaults['GetChannelName']['return'] != 0: + return self._defaults['GetChannelName']['return'] + if self._defaults['GetChannelName']['channelNameBuffer'] is None: + raise MockFunctionCallError("niSwitch_GetChannelName", param='channelNameBuffer') if buffer_size.value == 0: - return len(self._defaults["GetChannelName"]["channelNameBuffer"]) - channel_name_buffer.value = self._defaults["GetChannelName"][ - "channelNameBuffer" - ].encode("ascii") - return self._defaults["GetChannelName"]["return"] + return len(self._defaults['GetChannelName']['channelNameBuffer']) + channel_name_buffer.value = self._defaults['GetChannelName']['channelNameBuffer'].encode('ascii') + return self._defaults['GetChannelName']['return'] def niSwitch_GetError(self, vi, code, buffer_size, description): # noqa: N802 - if self._defaults["GetError"]["return"] != 0: - return self._defaults["GetError"]["return"] + if self._defaults['GetError']['return'] != 0: + return self._defaults['GetError']['return'] # code - if self._defaults["GetError"]["code"] is None: - raise MockFunctionCallError("niSwitch_GetError", param="code") + if self._defaults['GetError']['code'] is None: + raise MockFunctionCallError("niSwitch_GetError", param='code') if code is not None: - code.contents.value = self._defaults["GetError"]["code"] - if self._defaults["GetError"]["description"] is None: - raise MockFunctionCallError("niSwitch_GetError", param="description") + code.contents.value = self._defaults['GetError']['code'] + if self._defaults['GetError']['description'] is None: + raise MockFunctionCallError("niSwitch_GetError", param='description') if buffer_size.value == 0: - return len(self._defaults["GetError"]["description"]) - description.value = self._defaults["GetError"]["description"].encode("ascii") - return self._defaults["GetError"]["return"] + return len(self._defaults['GetError']['description']) + description.value = self._defaults['GetError']['description'].encode('ascii') + return self._defaults['GetError']['return'] def niSwitch_GetPath(self, vi, channel1, channel2, buffer_size, path): # noqa: N802 - if self._defaults["GetPath"]["return"] != 0: - return self._defaults["GetPath"]["return"] - if self._defaults["GetPath"]["path"] is None: - raise MockFunctionCallError("niSwitch_GetPath", param="path") + if self._defaults['GetPath']['return'] != 0: + return self._defaults['GetPath']['return'] + if self._defaults['GetPath']['path'] is None: + raise MockFunctionCallError("niSwitch_GetPath", param='path') if buffer_size.value == 0: - return len(self._defaults["GetPath"]["path"]) - path.value = self._defaults["GetPath"]["path"].encode("ascii") - return self._defaults["GetPath"]["return"] + return len(self._defaults['GetPath']['path']) + path.value = self._defaults['GetPath']['path'].encode('ascii') + return self._defaults['GetPath']['return'] def niSwitch_GetRelayCount(self, vi, relay_name, relay_count): # noqa: N802 - if self._defaults["GetRelayCount"]["return"] != 0: - return self._defaults["GetRelayCount"]["return"] + if self._defaults['GetRelayCount']['return'] != 0: + return self._defaults['GetRelayCount']['return'] # relay_count - if self._defaults["GetRelayCount"]["relayCount"] is None: - raise MockFunctionCallError("niSwitch_GetRelayCount", param="relayCount") + if self._defaults['GetRelayCount']['relayCount'] is None: + raise MockFunctionCallError("niSwitch_GetRelayCount", param='relayCount') if relay_count is not None: - relay_count.contents.value = self._defaults["GetRelayCount"]["relayCount"] - return self._defaults["GetRelayCount"]["return"] - - def niSwitch_GetRelayName( - self, vi, index, relay_name_buffer_size, relay_name_buffer - ): # noqa: N802 - if self._defaults["GetRelayName"]["return"] != 0: - return self._defaults["GetRelayName"]["return"] - if self._defaults["GetRelayName"]["relayNameBuffer"] is None: - raise MockFunctionCallError( - "niSwitch_GetRelayName", param="relayNameBuffer" - ) + relay_count.contents.value = self._defaults['GetRelayCount']['relayCount'] + return self._defaults['GetRelayCount']['return'] + + def niSwitch_GetRelayName(self, vi, index, relay_name_buffer_size, relay_name_buffer): # noqa: N802 + if self._defaults['GetRelayName']['return'] != 0: + return self._defaults['GetRelayName']['return'] + if self._defaults['GetRelayName']['relayNameBuffer'] is None: + raise MockFunctionCallError("niSwitch_GetRelayName", param='relayNameBuffer') if relay_name_buffer_size.value == 0: - return len(self._defaults["GetRelayName"]["relayNameBuffer"]) - relay_name_buffer.value = self._defaults["GetRelayName"][ - "relayNameBuffer" - ].encode("ascii") - return self._defaults["GetRelayName"]["return"] + return len(self._defaults['GetRelayName']['relayNameBuffer']) + relay_name_buffer.value = self._defaults['GetRelayName']['relayNameBuffer'].encode('ascii') + return self._defaults['GetRelayName']['return'] def niSwitch_GetRelayPosition(self, vi, relay_name, relay_position): # noqa: N802 - if self._defaults["GetRelayPosition"]["return"] != 0: - return self._defaults["GetRelayPosition"]["return"] + if self._defaults['GetRelayPosition']['return'] != 0: + return self._defaults['GetRelayPosition']['return'] # relay_position - if self._defaults["GetRelayPosition"]["relayPosition"] is None: - raise MockFunctionCallError( - "niSwitch_GetRelayPosition", param="relayPosition" - ) + if self._defaults['GetRelayPosition']['relayPosition'] is None: + raise MockFunctionCallError("niSwitch_GetRelayPosition", param='relayPosition') if relay_position is not None: - relay_position.contents.value = self._defaults["GetRelayPosition"][ - "relayPosition" - ] - return self._defaults["GetRelayPosition"]["return"] - - def niSwitch_InitWithTopology( - self, resource_name, topology, simulate, reset_device, vi - ): # noqa: N802 - if self._defaults["InitWithTopology"]["return"] != 0: - return self._defaults["InitWithTopology"]["return"] + relay_position.contents.value = self._defaults['GetRelayPosition']['relayPosition'] + return self._defaults['GetRelayPosition']['return'] + + def niSwitch_InitWithTopology(self, resource_name, topology, simulate, reset_device, vi): # noqa: N802 + if self._defaults['InitWithTopology']['return'] != 0: + return self._defaults['InitWithTopology']['return'] # vi - if self._defaults["InitWithTopology"]["vi"] is None: - raise MockFunctionCallError("niSwitch_InitWithTopology", param="vi") + if self._defaults['InitWithTopology']['vi'] is None: + raise MockFunctionCallError("niSwitch_InitWithTopology", param='vi') if vi is not None: - vi.contents.value = self._defaults["InitWithTopology"]["vi"] - return self._defaults["InitWithTopology"]["return"] + vi.contents.value = self._defaults['InitWithTopology']['vi'] + return self._defaults['InitWithTopology']['return'] def niSwitch_InitiateScan(self, vi): # noqa: N802 - if self._defaults["InitiateScan"]["return"] != 0: - return self._defaults["InitiateScan"]["return"] - return self._defaults["InitiateScan"]["return"] + if self._defaults['InitiateScan']['return'] != 0: + return self._defaults['InitiateScan']['return'] + return self._defaults['InitiateScan']['return'] def niSwitch_LockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults["LockSession"]["return"] != 0: - return self._defaults["LockSession"]["return"] + if self._defaults['LockSession']['return'] != 0: + return self._defaults['LockSession']['return'] # caller_has_lock - if self._defaults["LockSession"]["callerHasLock"] is None: - raise MockFunctionCallError("niSwitch_LockSession", param="callerHasLock") + if self._defaults['LockSession']['callerHasLock'] is None: + raise MockFunctionCallError("niSwitch_LockSession", param='callerHasLock') if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults["LockSession"][ - "callerHasLock" - ] - return self._defaults["LockSession"]["return"] + caller_has_lock.contents.value = self._defaults['LockSession']['callerHasLock'] + return self._defaults['LockSession']['return'] def niSwitch_RelayControl(self, vi, relay_name, relay_action): # noqa: N802 - if self._defaults["RelayControl"]["return"] != 0: - return self._defaults["RelayControl"]["return"] - return self._defaults["RelayControl"]["return"] + if self._defaults['RelayControl']['return'] != 0: + return self._defaults['RelayControl']['return'] + return self._defaults['RelayControl']['return'] def niSwitch_ResetWithDefaults(self, vi): # noqa: N802 - if self._defaults["ResetWithDefaults"]["return"] != 0: - return self._defaults["ResetWithDefaults"]["return"] - return self._defaults["ResetWithDefaults"]["return"] - - def niSwitch_RouteScanAdvancedOutput( - self, vi, scan_advanced_output_connector, scan_advanced_output_bus_line, invert - ): # noqa: N802 - if self._defaults["RouteScanAdvancedOutput"]["return"] != 0: - return self._defaults["RouteScanAdvancedOutput"]["return"] - return self._defaults["RouteScanAdvancedOutput"]["return"] - - def niSwitch_RouteTriggerInput( - self, vi, trigger_input_connector, trigger_input_bus_line, invert - ): # noqa: N802 - if self._defaults["RouteTriggerInput"]["return"] != 0: - return self._defaults["RouteTriggerInput"]["return"] - return self._defaults["RouteTriggerInput"]["return"] + if self._defaults['ResetWithDefaults']['return'] != 0: + return self._defaults['ResetWithDefaults']['return'] + return self._defaults['ResetWithDefaults']['return'] + + def niSwitch_RouteScanAdvancedOutput(self, vi, scan_advanced_output_connector, scan_advanced_output_bus_line, invert): # noqa: N802 + if self._defaults['RouteScanAdvancedOutput']['return'] != 0: + return self._defaults['RouteScanAdvancedOutput']['return'] + return self._defaults['RouteScanAdvancedOutput']['return'] + + def niSwitch_RouteTriggerInput(self, vi, trigger_input_connector, trigger_input_bus_line, invert): # noqa: N802 + if self._defaults['RouteTriggerInput']['return'] != 0: + return self._defaults['RouteTriggerInput']['return'] + return self._defaults['RouteTriggerInput']['return'] def niSwitch_SendSoftwareTrigger(self, vi): # noqa: N802 - if self._defaults["SendSoftwareTrigger"]["return"] != 0: - return self._defaults["SendSoftwareTrigger"]["return"] - return self._defaults["SendSoftwareTrigger"]["return"] - - def niSwitch_SetAttributeViBoolean( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["SetAttributeViBoolean"]["return"] != 0: - return self._defaults["SetAttributeViBoolean"]["return"] - return self._defaults["SetAttributeViBoolean"]["return"] - - def niSwitch_SetAttributeViInt32( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["SetAttributeViInt32"]["return"] != 0: - return self._defaults["SetAttributeViInt32"]["return"] - return self._defaults["SetAttributeViInt32"]["return"] - - def niSwitch_SetAttributeViReal64( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["SetAttributeViReal64"]["return"] != 0: - return self._defaults["SetAttributeViReal64"]["return"] - return self._defaults["SetAttributeViReal64"]["return"] - - def niSwitch_SetAttributeViString( - self, vi, channel_name, attribute_id, attribute_value - ): # noqa: N802 - if self._defaults["SetAttributeViString"]["return"] != 0: - return self._defaults["SetAttributeViString"]["return"] - return self._defaults["SetAttributeViString"]["return"] + if self._defaults['SendSoftwareTrigger']['return'] != 0: + return self._defaults['SendSoftwareTrigger']['return'] + return self._defaults['SendSoftwareTrigger']['return'] + + def niSwitch_SetAttributeViBoolean(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['SetAttributeViBoolean']['return'] != 0: + return self._defaults['SetAttributeViBoolean']['return'] + return self._defaults['SetAttributeViBoolean']['return'] + + def niSwitch_SetAttributeViInt32(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['SetAttributeViInt32']['return'] != 0: + return self._defaults['SetAttributeViInt32']['return'] + return self._defaults['SetAttributeViInt32']['return'] + + def niSwitch_SetAttributeViReal64(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['SetAttributeViReal64']['return'] != 0: + return self._defaults['SetAttributeViReal64']['return'] + return self._defaults['SetAttributeViReal64']['return'] + + def niSwitch_SetAttributeViString(self, vi, channel_name, attribute_id, attribute_value): # noqa: N802 + if self._defaults['SetAttributeViString']['return'] != 0: + return self._defaults['SetAttributeViString']['return'] + return self._defaults['SetAttributeViString']['return'] def niSwitch_SetPath(self, vi, path_list): # noqa: N802 - if self._defaults["SetPath"]["return"] != 0: - return self._defaults["SetPath"]["return"] - return self._defaults["SetPath"]["return"] + if self._defaults['SetPath']['return'] != 0: + return self._defaults['SetPath']['return'] + return self._defaults['SetPath']['return'] def niSwitch_UnlockSession(self, vi, caller_has_lock): # noqa: N802 - if self._defaults["UnlockSession"]["return"] != 0: - return self._defaults["UnlockSession"]["return"] + if self._defaults['UnlockSession']['return'] != 0: + return self._defaults['UnlockSession']['return'] # caller_has_lock - if self._defaults["UnlockSession"]["callerHasLock"] is None: - raise MockFunctionCallError("niSwitch_UnlockSession", param="callerHasLock") + if self._defaults['UnlockSession']['callerHasLock'] is None: + raise MockFunctionCallError("niSwitch_UnlockSession", param='callerHasLock') if caller_has_lock is not None: - caller_has_lock.contents.value = self._defaults["UnlockSession"][ - "callerHasLock" - ] - return self._defaults["UnlockSession"]["return"] + caller_has_lock.contents.value = self._defaults['UnlockSession']['callerHasLock'] + return self._defaults['UnlockSession']['return'] def niSwitch_WaitForDebounce(self, vi, maximum_time_ms): # noqa: N802 - if self._defaults["WaitForDebounce"]["return"] != 0: - return self._defaults["WaitForDebounce"]["return"] - return self._defaults["WaitForDebounce"]["return"] + if self._defaults['WaitForDebounce']['return'] != 0: + return self._defaults['WaitForDebounce']['return'] + return self._defaults['WaitForDebounce']['return'] def niSwitch_WaitForScanComplete(self, vi, maximum_time_ms): # noqa: N802 - if self._defaults["WaitForScanComplete"]["return"] != 0: - return self._defaults["WaitForScanComplete"]["return"] - return self._defaults["WaitForScanComplete"]["return"] + if self._defaults['WaitForScanComplete']['return'] != 0: + return self._defaults['WaitForScanComplete']['return'] + return self._defaults['WaitForScanComplete']['return'] def niSwitch_close(self, vi): # noqa: N802 - if self._defaults["close"]["return"] != 0: - return self._defaults["close"]["return"] - return self._defaults["close"]["return"] + if self._defaults['close']['return'] != 0: + return self._defaults['close']['return'] + return self._defaults['close']['return'] def niSwitch_error_message(self, vi, error_code, error_message): # noqa: N802 - if self._defaults["error_message"]["return"] != 0: - return self._defaults["error_message"]["return"] + if self._defaults['error_message']['return'] != 0: + return self._defaults['error_message']['return'] # error_message - if self._defaults["error_message"]["errorMessage"] is None: - raise MockFunctionCallError("niSwitch_error_message", param="errorMessage") - test_value = self._defaults["error_message"]["errorMessage"] + if self._defaults['error_message']['errorMessage'] is None: + raise MockFunctionCallError("niSwitch_error_message", param='errorMessage') + test_value = self._defaults['error_message']['errorMessage'] if type(test_value) is str: - test_value = test_value.encode("ascii") + test_value = test_value.encode('ascii') assert len(error_message) >= len(test_value) for i in range(len(test_value)): error_message[i] = test_value[i] - return self._defaults["error_message"]["return"] + return self._defaults['error_message']['return'] def niSwitch_reset(self, vi): # noqa: N802 - if self._defaults["reset"]["return"] != 0: - return self._defaults["reset"]["return"] - return self._defaults["reset"]["return"] + if self._defaults['reset']['return'] != 0: + return self._defaults['reset']['return'] + return self._defaults['reset']['return'] def niSwitch_self_test(self, vi, self_test_result, self_test_message): # noqa: N802 - if self._defaults["self_test"]["return"] != 0: - return self._defaults["self_test"]["return"] + if self._defaults['self_test']['return'] != 0: + return self._defaults['self_test']['return'] # self_test_result - if self._defaults["self_test"]["selfTestResult"] is None: - raise MockFunctionCallError("niSwitch_self_test", param="selfTestResult") + if self._defaults['self_test']['selfTestResult'] is None: + raise MockFunctionCallError("niSwitch_self_test", param='selfTestResult') if self_test_result is not None: - self_test_result.contents.value = self._defaults["self_test"][ - "selfTestResult" - ] + self_test_result.contents.value = self._defaults['self_test']['selfTestResult'] # self_test_message - if self._defaults["self_test"]["selfTestMessage"] is None: - raise MockFunctionCallError("niSwitch_self_test", param="selfTestMessage") - test_value = self._defaults["self_test"]["selfTestMessage"] + if self._defaults['self_test']['selfTestMessage'] is None: + raise MockFunctionCallError("niSwitch_self_test", param='selfTestMessage') + test_value = self._defaults['self_test']['selfTestMessage'] if type(test_value) is str: - test_value = test_value.encode("ascii") + test_value = test_value.encode('ascii') assert len(self_test_message) >= len(test_value) for i in range(len(test_value)): self_test_message[i] = test_value[i] - return self._defaults["self_test"]["return"] + return self._defaults['self_test']['return'] # Helper function to setup Mock object with default side effects and return values def set_side_effects_and_return_values(self, mock_library): - mock_library.niSwitch_AbortScan.side_effect = MockFunctionCallError( - "niSwitch_AbortScan" - ) + mock_library.niSwitch_AbortScan.side_effect = MockFunctionCallError("niSwitch_AbortScan") mock_library.niSwitch_AbortScan.return_value = 0 - mock_library.niSwitch_CanConnect.side_effect = MockFunctionCallError( - "niSwitch_CanConnect" - ) + mock_library.niSwitch_CanConnect.side_effect = MockFunctionCallError("niSwitch_CanConnect") mock_library.niSwitch_CanConnect.return_value = 0 - mock_library.niSwitch_Commit.side_effect = MockFunctionCallError( - "niSwitch_Commit" - ) + mock_library.niSwitch_Commit.side_effect = MockFunctionCallError("niSwitch_Commit") mock_library.niSwitch_Commit.return_value = 0 - mock_library.niSwitch_Connect.side_effect = MockFunctionCallError( - "niSwitch_Connect" - ) + mock_library.niSwitch_Connect.side_effect = MockFunctionCallError("niSwitch_Connect") mock_library.niSwitch_Connect.return_value = 0 - mock_library.niSwitch_ConnectMultiple.side_effect = MockFunctionCallError( - "niSwitch_ConnectMultiple" - ) + mock_library.niSwitch_ConnectMultiple.side_effect = MockFunctionCallError("niSwitch_ConnectMultiple") mock_library.niSwitch_ConnectMultiple.return_value = 0 - mock_library.niSwitch_Disable.side_effect = MockFunctionCallError( - "niSwitch_Disable" - ) + mock_library.niSwitch_Disable.side_effect = MockFunctionCallError("niSwitch_Disable") mock_library.niSwitch_Disable.return_value = 0 - mock_library.niSwitch_Disconnect.side_effect = MockFunctionCallError( - "niSwitch_Disconnect" - ) + mock_library.niSwitch_Disconnect.side_effect = MockFunctionCallError("niSwitch_Disconnect") mock_library.niSwitch_Disconnect.return_value = 0 - mock_library.niSwitch_DisconnectAll.side_effect = MockFunctionCallError( - "niSwitch_DisconnectAll" - ) + mock_library.niSwitch_DisconnectAll.side_effect = MockFunctionCallError("niSwitch_DisconnectAll") mock_library.niSwitch_DisconnectAll.return_value = 0 - mock_library.niSwitch_DisconnectMultiple.side_effect = MockFunctionCallError( - "niSwitch_DisconnectMultiple" - ) + mock_library.niSwitch_DisconnectMultiple.side_effect = MockFunctionCallError("niSwitch_DisconnectMultiple") mock_library.niSwitch_DisconnectMultiple.return_value = 0 - mock_library.niSwitch_GetAttributeViBoolean.side_effect = MockFunctionCallError( - "niSwitch_GetAttributeViBoolean" - ) + mock_library.niSwitch_GetAttributeViBoolean.side_effect = MockFunctionCallError("niSwitch_GetAttributeViBoolean") mock_library.niSwitch_GetAttributeViBoolean.return_value = 0 - mock_library.niSwitch_GetAttributeViInt32.side_effect = MockFunctionCallError( - "niSwitch_GetAttributeViInt32" - ) + mock_library.niSwitch_GetAttributeViInt32.side_effect = MockFunctionCallError("niSwitch_GetAttributeViInt32") mock_library.niSwitch_GetAttributeViInt32.return_value = 0 - mock_library.niSwitch_GetAttributeViReal64.side_effect = MockFunctionCallError( - "niSwitch_GetAttributeViReal64" - ) + mock_library.niSwitch_GetAttributeViReal64.side_effect = MockFunctionCallError("niSwitch_GetAttributeViReal64") mock_library.niSwitch_GetAttributeViReal64.return_value = 0 - mock_library.niSwitch_GetAttributeViString.side_effect = MockFunctionCallError( - "niSwitch_GetAttributeViString" - ) + mock_library.niSwitch_GetAttributeViString.side_effect = MockFunctionCallError("niSwitch_GetAttributeViString") mock_library.niSwitch_GetAttributeViString.return_value = 0 - mock_library.niSwitch_GetChannelName.side_effect = MockFunctionCallError( - "niSwitch_GetChannelName" - ) + mock_library.niSwitch_GetChannelName.side_effect = MockFunctionCallError("niSwitch_GetChannelName") mock_library.niSwitch_GetChannelName.return_value = 0 - mock_library.niSwitch_GetError.side_effect = MockFunctionCallError( - "niSwitch_GetError" - ) + mock_library.niSwitch_GetError.side_effect = MockFunctionCallError("niSwitch_GetError") mock_library.niSwitch_GetError.return_value = 0 - mock_library.niSwitch_GetPath.side_effect = MockFunctionCallError( - "niSwitch_GetPath" - ) + mock_library.niSwitch_GetPath.side_effect = MockFunctionCallError("niSwitch_GetPath") mock_library.niSwitch_GetPath.return_value = 0 - mock_library.niSwitch_GetRelayCount.side_effect = MockFunctionCallError( - "niSwitch_GetRelayCount" - ) + mock_library.niSwitch_GetRelayCount.side_effect = MockFunctionCallError("niSwitch_GetRelayCount") mock_library.niSwitch_GetRelayCount.return_value = 0 - mock_library.niSwitch_GetRelayName.side_effect = MockFunctionCallError( - "niSwitch_GetRelayName" - ) + mock_library.niSwitch_GetRelayName.side_effect = MockFunctionCallError("niSwitch_GetRelayName") mock_library.niSwitch_GetRelayName.return_value = 0 - mock_library.niSwitch_GetRelayPosition.side_effect = MockFunctionCallError( - "niSwitch_GetRelayPosition" - ) + mock_library.niSwitch_GetRelayPosition.side_effect = MockFunctionCallError("niSwitch_GetRelayPosition") mock_library.niSwitch_GetRelayPosition.return_value = 0 - mock_library.niSwitch_InitWithTopology.side_effect = MockFunctionCallError( - "niSwitch_InitWithTopology" - ) + mock_library.niSwitch_InitWithTopology.side_effect = MockFunctionCallError("niSwitch_InitWithTopology") mock_library.niSwitch_InitWithTopology.return_value = 0 - mock_library.niSwitch_InitiateScan.side_effect = MockFunctionCallError( - "niSwitch_InitiateScan" - ) + mock_library.niSwitch_InitiateScan.side_effect = MockFunctionCallError("niSwitch_InitiateScan") mock_library.niSwitch_InitiateScan.return_value = 0 - mock_library.niSwitch_LockSession.side_effect = MockFunctionCallError( - "niSwitch_LockSession" - ) + mock_library.niSwitch_LockSession.side_effect = MockFunctionCallError("niSwitch_LockSession") mock_library.niSwitch_LockSession.return_value = 0 - mock_library.niSwitch_RelayControl.side_effect = MockFunctionCallError( - "niSwitch_RelayControl" - ) + mock_library.niSwitch_RelayControl.side_effect = MockFunctionCallError("niSwitch_RelayControl") mock_library.niSwitch_RelayControl.return_value = 0 - mock_library.niSwitch_ResetWithDefaults.side_effect = MockFunctionCallError( - "niSwitch_ResetWithDefaults" - ) + mock_library.niSwitch_ResetWithDefaults.side_effect = MockFunctionCallError("niSwitch_ResetWithDefaults") mock_library.niSwitch_ResetWithDefaults.return_value = 0 - mock_library.niSwitch_RouteScanAdvancedOutput.side_effect = ( - MockFunctionCallError("niSwitch_RouteScanAdvancedOutput") - ) + mock_library.niSwitch_RouteScanAdvancedOutput.side_effect = MockFunctionCallError("niSwitch_RouteScanAdvancedOutput") mock_library.niSwitch_RouteScanAdvancedOutput.return_value = 0 - mock_library.niSwitch_RouteTriggerInput.side_effect = MockFunctionCallError( - "niSwitch_RouteTriggerInput" - ) + mock_library.niSwitch_RouteTriggerInput.side_effect = MockFunctionCallError("niSwitch_RouteTriggerInput") mock_library.niSwitch_RouteTriggerInput.return_value = 0 - mock_library.niSwitch_SendSoftwareTrigger.side_effect = MockFunctionCallError( - "niSwitch_SendSoftwareTrigger" - ) + mock_library.niSwitch_SendSoftwareTrigger.side_effect = MockFunctionCallError("niSwitch_SendSoftwareTrigger") mock_library.niSwitch_SendSoftwareTrigger.return_value = 0 - mock_library.niSwitch_SetAttributeViBoolean.side_effect = MockFunctionCallError( - "niSwitch_SetAttributeViBoolean" - ) + mock_library.niSwitch_SetAttributeViBoolean.side_effect = MockFunctionCallError("niSwitch_SetAttributeViBoolean") mock_library.niSwitch_SetAttributeViBoolean.return_value = 0 - mock_library.niSwitch_SetAttributeViInt32.side_effect = MockFunctionCallError( - "niSwitch_SetAttributeViInt32" - ) + mock_library.niSwitch_SetAttributeViInt32.side_effect = MockFunctionCallError("niSwitch_SetAttributeViInt32") mock_library.niSwitch_SetAttributeViInt32.return_value = 0 - mock_library.niSwitch_SetAttributeViReal64.side_effect = MockFunctionCallError( - "niSwitch_SetAttributeViReal64" - ) + mock_library.niSwitch_SetAttributeViReal64.side_effect = MockFunctionCallError("niSwitch_SetAttributeViReal64") mock_library.niSwitch_SetAttributeViReal64.return_value = 0 - mock_library.niSwitch_SetAttributeViString.side_effect = MockFunctionCallError( - "niSwitch_SetAttributeViString" - ) + mock_library.niSwitch_SetAttributeViString.side_effect = MockFunctionCallError("niSwitch_SetAttributeViString") mock_library.niSwitch_SetAttributeViString.return_value = 0 - mock_library.niSwitch_SetPath.side_effect = MockFunctionCallError( - "niSwitch_SetPath" - ) + mock_library.niSwitch_SetPath.side_effect = MockFunctionCallError("niSwitch_SetPath") mock_library.niSwitch_SetPath.return_value = 0 - mock_library.niSwitch_UnlockSession.side_effect = MockFunctionCallError( - "niSwitch_UnlockSession" - ) + mock_library.niSwitch_UnlockSession.side_effect = MockFunctionCallError("niSwitch_UnlockSession") mock_library.niSwitch_UnlockSession.return_value = 0 - mock_library.niSwitch_WaitForDebounce.side_effect = MockFunctionCallError( - "niSwitch_WaitForDebounce" - ) + mock_library.niSwitch_WaitForDebounce.side_effect = MockFunctionCallError("niSwitch_WaitForDebounce") mock_library.niSwitch_WaitForDebounce.return_value = 0 - mock_library.niSwitch_WaitForScanComplete.side_effect = MockFunctionCallError( - "niSwitch_WaitForScanComplete" - ) + mock_library.niSwitch_WaitForScanComplete.side_effect = MockFunctionCallError("niSwitch_WaitForScanComplete") mock_library.niSwitch_WaitForScanComplete.return_value = 0 - mock_library.niSwitch_close.side_effect = MockFunctionCallError( - "niSwitch_close" - ) + mock_library.niSwitch_close.side_effect = MockFunctionCallError("niSwitch_close") mock_library.niSwitch_close.return_value = 0 - mock_library.niSwitch_error_message.side_effect = MockFunctionCallError( - "niSwitch_error_message" - ) + mock_library.niSwitch_error_message.side_effect = MockFunctionCallError("niSwitch_error_message") mock_library.niSwitch_error_message.return_value = 0 - mock_library.niSwitch_reset.side_effect = MockFunctionCallError( - "niSwitch_reset" - ) + mock_library.niSwitch_reset.side_effect = MockFunctionCallError("niSwitch_reset") mock_library.niSwitch_reset.return_value = 0 - mock_library.niSwitch_self_test.side_effect = MockFunctionCallError( - "niSwitch_self_test" - ) + mock_library.niSwitch_self_test.side_effect = MockFunctionCallError("niSwitch_self_test") mock_library.niSwitch_self_test.return_value = 0 diff --git a/generated/niswitch/setup.py b/generated/niswitch/setup.py index d715e2560..b544e8856 100644 --- a/generated/niswitch/setup.py +++ b/generated/niswitch/setup.py @@ -15,44 +15,41 @@ def finalize_options(self): def run_tests(self): import pytest - pytest.main(self.test_args) -pypi_name = "niswitch" +pypi_name = 'niswitch' def read_contents(file_to_read): - with open(file_to_read, "r") as f: + with open(file_to_read, 'r') as f: return f.read() setup( name=pypi_name, zip_safe=True, - version="1.4.2.dev0", - description="NI-SWITCH Python API", - long_description=read_contents("README.rst"), - long_description_content_type="text/x-rst", - author="NI", + version='1.4.2.dev0', + description='NI-SWITCH Python API', + long_description=read_contents('README.rst'), + long_description_content_type='text/x-rst', + author='NI', author_email="opensource@ni.com", url="https://github.com/ni/nimi-python", maintainer="NI", maintainer_email="opensource@ni.com", - keywords=["niswitch"], - license="MIT", + keywords=['niswitch'], + license='MIT', include_package_data=True, - packages=["niswitch"], + packages=['niswitch'], install_requires=[ 'enum34;python_version<"3.4"', 'singledispatch;python_version<"3.4"', - "hightime>=0.2.0", - ], - setup_requires=[ - "pytest-runner", + 'hightime>=0.2.0', ], - tests_require=["pytest"], - test_suite="tests", + setup_requires=['pytest-runner', ], + tests_require=['pytest'], + test_suite='tests', classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -67,8 +64,8 @@ def read_contents(file_to_read): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", - "Topic :: System :: Hardware :: Hardware Drivers", + "Topic :: System :: Hardware :: Hardware Drivers" ], - cmdclass={"test": PyTest}, - package_data={pypi_name: ["VERSION"]}, + cmdclass={'test': PyTest}, + package_data={pypi_name: ['VERSION']}, ) diff --git a/generated/nitclk/nitclk/__init__.py b/generated/nitclk/nitclk/__init__.py index fbf2200ef..f17a5e9c1 100644 --- a/generated/nitclk/nitclk/__init__.py +++ b/generated/nitclk/nitclk/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = "1.4.2.dev0" +__version__ = '1.4.2.dev0' from nitclk.errors import DriverWarning # noqa: F401 from nitclk.errors import Error # noqa: F401 @@ -20,12 +20,12 @@ def get_diagnostic_information(): - """Get diagnostic information about the system state that is suitable for printing or logging + '''Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - """ + ''' import os import pkg_resources import platform @@ -33,80 +33,73 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return struct.calcsize("P") == 8 + return (struct.calcsize("P") == 8) def is_os_64bit(): - return platform.machine().endswith("64") + return platform.machine().endswith('64') def is_venv(): - return "VIRTUAL_ENV" in os.environ + return 'VIRTUAL_ENV' in os.environ info = {} - info["os"] = {} - info["python"] = {} - info["driver"] = {} - info["module"] = {} - if platform.system() == "Windows": + info['os'] = {} + info['python'] = {} + info['driver'] = {} + info['module'] = {} + if platform.system() == 'Windows': try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = "Windows" + os_name = 'Windows' try: - driver_version_key = winreg.OpenKey( - winreg.HKEY_LOCAL_MACHINE, - r"SOFTWARE\National Instruments\NI-TClk\CurrentVersion", - ) + driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-TClk\CurrentVersion") driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = "Unknown" - elif platform.system() == "Linux": - os_name = "Linux" - driver_version = "Unknown" + driver_version = 'Unknown' + elif platform.system() == 'Linux': + os_name = 'Linux' + driver_version = 'Unknown' else: - raise SystemError("Unsupported platform: {}".format(platform.system())) + raise SystemError('Unsupported platform: {}'.format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [ - { - "name": i.key, - "version": i.version, - } - for i in installed_packages - ] - - info["os"]["name"] = os_name - info["os"]["version"] = platform.version() - info["os"]["bits"] = "64" if is_os_64bit() else "32" - info["driver"]["name"] = "NI-TClk" - info["driver"]["version"] = driver_version - info["module"]["name"] = "nitclk" - info["module"]["version"] = "1.4.2.dev0" - info["python"]["version"] = sys.version - info["python"]["bits"] = "64" if is_python_64bit() else "32" - info["python"]["is_venv"] = is_venv() - info["python"]["packages"] = installed_packages_list + installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] + + info['os']['name'] = os_name + info['os']['version'] = platform.version() + info['os']['bits'] = '64' if is_os_64bit() else '32' + info['driver']['name'] = "NI-TClk" + info['driver']['version'] = driver_version + info['module']['name'] = 'nitclk' + info['module']['version'] = "1.4.2.dev0" + info['python']['version'] = sys.version + info['python']['bits'] = '64' if is_python_64bit() else '32' + info['python']['is_venv'] = is_venv() + info['python']['packages'] = installed_packages_list return info def print_diagnostic_information(): - """Print diagnostic information in a format suitable for issue report + '''Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - """ + ''' info = get_diagnostic_information() - row_format = " {:<10} {}" - for type in ["OS", "Driver", "Module", "Python"]: + row_format = ' {:<10} {}' + for type in ['OS', 'Driver', 'Module', 'Python']: typename = type.lower() - print(type + ":") + print(type + ':') for item in info[typename]: - if item != "packages": - print(row_format.format(item.title() + ":", info[typename][item])) - print(" Installed Packages:") - for p in info["python"]["packages"]: - print((" " * 8) + p["name"] + "==" + p["version"]) + if item != 'packages': + print(row_format.format(item.title() + ':', info[typename][item])) + print(' Installed Packages:') + for p in info['python']['packages']: + print((' ' * 8) + p['name'] + '==' + p['version']) return info + + diff --git a/generated/nitclk/nitclk/_attributes.py b/generated/nitclk/nitclk/_attributes.py index 33ac0b907..73c7c66fe 100644 --- a/generated/nitclk/nitclk/_attributes.py +++ b/generated/nitclk/nitclk/_attributes.py @@ -6,13 +6,14 @@ class Attribute(object): - """Base class for all typed attributes.""" + '''Base class for all typed attributes.''' def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -21,19 +22,16 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): + def __get__(self, session, session_type): - return hightime.timedelta( - milliseconds=session._get_attribute_vi_int32(self._attribute_id) - ) + return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_int32( - self._attribute_id, - _converters.convert_timedelta_to_milliseconds_int32(value).value, - ) + session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) class AttributeViInt64(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -42,6 +40,7 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -50,19 +49,16 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): + def __get__(self, session, session_type): - return hightime.timedelta( - seconds=session._get_attribute_vi_real64(self._attribute_id) - ) + return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_real64( - self._attribute_id, - _converters.convert_timedelta_to_seconds_real64(value).value, - ) + session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) class AttributeViString(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -71,17 +67,16 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string( - self._attribute_id, - _converters.convert_repeated_capabilities_without_prefix(value), - ) + session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) class AttributeViBoolean(Attribute): + def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -90,36 +85,31 @@ def __set__(self, session, value): class AttributeEnum(object): + def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type( - self._underlying_attribute.__get__(session, session_type) - ) + return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError( - "must be " - + str(self._attribute_type.__name__) - + " not " - + str(type(value).__name__) - ) + raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): + def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from nitclk.session import SessionReference - return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session( - self._attribute_id, _converters.convert_to_nitclk_session_number(value) - ) + session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) + + + diff --git a/generated/nitclk/nitclk/_converters.py b/generated/nitclk/nitclk/_converters.py index 9d5ae352f..45f76e0d2 100644 --- a/generated/nitclk/nitclk/_converters.py +++ b/generated/nitclk/nitclk/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - """Base version that should not be called + '''Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,38 +40,36 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - """ - raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) + ''' + raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - """Integer version""" + '''Integer version''' return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - """String version (this is the most complex) + '''String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - """ + ''' # First we deal with a list - rep_cap_list = repeated_capability.split(",") + rep_cap_list = repeated_capability.split(',') if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, "").replace(":", "-") - rc = r.split("-") + r = repeated_capability.strip().replace(prefix, '').replace(':', '-') + rc = r.split('-') if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError( - "Multiple '-' or ':'", repeated_capability - ) + raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) try: start = int(rc[0]) end = int(rc[1]) @@ -87,7 +85,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, "").strip()] + return [repeated_capability.replace(prefix, '').strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -96,7 +94,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - """Iterable version - can handle lists, ranges, and tuples""" + '''Iterable version - can handle lists, ranges, and tuples''' rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -105,22 +103,16 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - """slice version""" - + '''slice version''' def ifnone(a, b): return b if a is None else a - # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range( - ifnone(repeated_capability.start, 0), - repeated_capability.stop, - ifnone(repeated_capability.step, 1), - ) + rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=""): - """Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=''): + '''Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -128,17 +120,15 @@ def convert_repeated_capabilities(repeated_capability, prefix=""): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - """ + ''' # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [ - prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) - ] + return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] def convert_repeated_capabilities_without_prefix(repeated_capability): - """Convert a repeated capabilities object, without any prefix, to a comma delimited list + '''Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -154,8 +144,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - """ - return ",".join(convert_repeated_capabilities(repeated_capability, "")) + ''' + return ','.join(convert_repeated_capabilities(repeated_capability, '')) def _convert_timedelta(value, library_type, scaling): @@ -168,14 +158,7 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [ - _visatype.ViInt64, - _visatype.ViInt32, - _visatype.ViUInt32, - _visatype.ViInt16, - _visatype.ViUInt16, - _visatype.ViInt8, - ]: + if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -212,36 +195,34 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - "rangecheck": "RangeCheck", - "queryinstrstatus": "QueryInstrStatus", - "cache": "Cache", - "simulate": "Simulate", - "recordcoercions": "RecordCoercions", - "interchangecheck": "InterchangeCheck", - "driversetup": "DriverSetup", - "range_check": "RangeCheck", - "query_instr_status": "QueryInstrStatus", - "record_coercions": "RecordCoercions", - "interchange_check": "InterchangeCheck", - "driver_setup": "DriverSetup", + 'rangecheck': 'RangeCheck', + 'queryinstrstatus': 'QueryInstrStatus', + 'cache': 'Cache', + 'simulate': 'Simulate', + 'recordcoercions': 'RecordCoercions', + 'interchangecheck': 'InterchangeCheck', + 'driversetup': 'DriverSetup', + 'range_check': 'RangeCheck', + 'query_instr_status': 'QueryInstrStatus', + 'record_coercions': 'RecordCoercions', + 'interchange_check': 'InterchangeCheck', + 'driver_setup': 'DriverSetup', } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": - value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") - elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": + if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': + value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') + elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': if not isinstance(values[k], dict): - raise TypeError("DriverSetup must be a dictionary") - value = "DriverSetup=" + ( - ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) - ) + raise TypeError('DriverSetup must be a dictionary') + value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) else: - value = k + ("=1" if values[k] is True else "=0") + value = k + ('=1' if values[k] is True else '=0') init_with_options.append(value) - init_with_options_string = ",".join(init_with_options) + init_with_options_string = ','.join(init_with_options) return init_with_options_string @@ -270,11 +251,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(",")] + return [x.strip() for x in comma_separated_string.split(',')] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -286,30 +267,22 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - """ - chained_repeated_capability_items = convert_comma_separated_string_to_list( - chained_repeated_capability - ) - repeated_capability_lists = [ - [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) - ] + ''' + chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) + repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] for item in chained_repeated_capability_items: - repeated_capability_lists = [ - x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) - ] - return [ - ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists - ] + repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] + return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] # nitclk specific converters def convert_to_nitclk_session_number(item): - """Convert from supported objects to NI-TClk Session Num + '''Convert from supported objects to NI-TClk Session Num Supported objects are: - class with .tclk object of type nitclk.SessionReference - nitclk.SessionReference - """ + ''' try: return item.tclk._get_tclk_session_reference() except AttributeError: @@ -320,9 +293,11 @@ def convert_to_nitclk_session_number(item): except AttributeError: pass - raise TypeError("Unsupported type for nitclk session: {}".format(type(item))) + raise TypeError('Unsupported type for nitclk session: {}'.format(type(item))) def convert_to_nitclk_session_number_list(item_list): - """Converts a list of items to nitclk session nums""" + '''Converts a list of items to nitclk session nums''' return [convert_to_nitclk_session_number(i) for i in item_list] + + diff --git a/generated/nitclk/nitclk/_library.py b/generated/nitclk/nitclk/_library.py index 0c1c69df1..f8e44eae6 100644 --- a/generated/nitclk/nitclk/_library.py +++ b/generated/nitclk/nitclk/_library.py @@ -9,11 +9,11 @@ class Library(object): - """Library + '''Library Wrapper around driver library. Class will setup the correct ctypes information for every function on first call. - """ + ''' def __init__(self, ctypes_library): self._func_lock = threading.Lock() @@ -42,270 +42,122 @@ def _get_library_function(self, name): raise errors.DriverTooOldError() from e return function - def niTClk_ConfigureForHomogeneousTriggers( - self, session_count, sessions - ): # noqa: N802 + def niTClk_ConfigureForHomogeneousTriggers(self, session_count, sessions): # noqa: N802 with self._func_lock: if self.niTClk_ConfigureForHomogeneousTriggers_cfunc is None: - self.niTClk_ConfigureForHomogeneousTriggers_cfunc = ( - self._get_library_function("niTClk_ConfigureForHomogeneousTriggers") - ) - self.niTClk_ConfigureForHomogeneousTriggers_cfunc.argtypes = [ - ViUInt32, - ctypes.POINTER(ViSession), - ] # noqa: F405 - self.niTClk_ConfigureForHomogeneousTriggers_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niTClk_ConfigureForHomogeneousTriggers_cfunc( - session_count, sessions - ) + self.niTClk_ConfigureForHomogeneousTriggers_cfunc = self._get_library_function('niTClk_ConfigureForHomogeneousTriggers') + self.niTClk_ConfigureForHomogeneousTriggers_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession)] # noqa: F405 + self.niTClk_ConfigureForHomogeneousTriggers_cfunc.restype = ViStatus # noqa: F405 + return self.niTClk_ConfigureForHomogeneousTriggers_cfunc(session_count, sessions) - def niTClk_FinishSyncPulseSenderSynchronize( - self, session_count, sessions, min_time - ): # noqa: N802 + def niTClk_FinishSyncPulseSenderSynchronize(self, session_count, sessions, min_time): # noqa: N802 with self._func_lock: if self.niTClk_FinishSyncPulseSenderSynchronize_cfunc is None: - self.niTClk_FinishSyncPulseSenderSynchronize_cfunc = ( - self._get_library_function( - "niTClk_FinishSyncPulseSenderSynchronize" - ) - ) - self.niTClk_FinishSyncPulseSenderSynchronize_cfunc.argtypes = [ - ViUInt32, - ctypes.POINTER(ViSession), - ViReal64, - ] # noqa: F405 - self.niTClk_FinishSyncPulseSenderSynchronize_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niTClk_FinishSyncPulseSenderSynchronize_cfunc( - session_count, sessions, min_time - ) + self.niTClk_FinishSyncPulseSenderSynchronize_cfunc = self._get_library_function('niTClk_FinishSyncPulseSenderSynchronize') + self.niTClk_FinishSyncPulseSenderSynchronize_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession), ViReal64] # noqa: F405 + self.niTClk_FinishSyncPulseSenderSynchronize_cfunc.restype = ViStatus # noqa: F405 + return self.niTClk_FinishSyncPulseSenderSynchronize_cfunc(session_count, sessions, min_time) - def niTClk_GetAttributeViReal64( - self, session, channel_name, attribute_id, value - ): # noqa: N802 + def niTClk_GetAttributeViReal64(self, session, channel_name, attribute_id, value): # noqa: N802 with self._func_lock: if self.niTClk_GetAttributeViReal64_cfunc is None: - self.niTClk_GetAttributeViReal64_cfunc = self._get_library_function( - "niTClk_GetAttributeViReal64" - ) - self.niTClk_GetAttributeViReal64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViReal64), - ] # noqa: F405 + self.niTClk_GetAttributeViReal64_cfunc = self._get_library_function('niTClk_GetAttributeViReal64') + self.niTClk_GetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViReal64)] # noqa: F405 self.niTClk_GetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niTClk_GetAttributeViReal64_cfunc( - session, channel_name, attribute_id, value - ) + return self.niTClk_GetAttributeViReal64_cfunc(session, channel_name, attribute_id, value) - def niTClk_GetAttributeViSession( - self, session, channel_name, attribute_id, value - ): # noqa: N802 + def niTClk_GetAttributeViSession(self, session, channel_name, attribute_id, value): # noqa: N802 with self._func_lock: if self.niTClk_GetAttributeViSession_cfunc is None: - self.niTClk_GetAttributeViSession_cfunc = self._get_library_function( - "niTClk_GetAttributeViSession" - ) - self.niTClk_GetAttributeViSession_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViSession), - ] # noqa: F405 + self.niTClk_GetAttributeViSession_cfunc = self._get_library_function('niTClk_GetAttributeViSession') + self.niTClk_GetAttributeViSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViSession)] # noqa: F405 self.niTClk_GetAttributeViSession_cfunc.restype = ViStatus # noqa: F405 - return self.niTClk_GetAttributeViSession_cfunc( - session, channel_name, attribute_id, value - ) + return self.niTClk_GetAttributeViSession_cfunc(session, channel_name, attribute_id, value) - def niTClk_GetAttributeViString( - self, session, channel_name, attribute_id, buf_size, value - ): # noqa: N802 + def niTClk_GetAttributeViString(self, session, channel_name, attribute_id, buf_size, value): # noqa: N802 with self._func_lock: if self.niTClk_GetAttributeViString_cfunc is None: - self.niTClk_GetAttributeViString_cfunc = self._get_library_function( - "niTClk_GetAttributeViString" - ) - self.niTClk_GetAttributeViString_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViInt32, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niTClk_GetAttributeViString_cfunc = self._get_library_function('niTClk_GetAttributeViString') + self.niTClk_GetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViInt32, ctypes.POINTER(ViChar)] # noqa: F405 self.niTClk_GetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niTClk_GetAttributeViString_cfunc( - session, channel_name, attribute_id, buf_size, value - ) + return self.niTClk_GetAttributeViString_cfunc(session, channel_name, attribute_id, buf_size, value) - def niTClk_GetExtendedErrorInfo( - self, error_string, error_string_size - ): # noqa: N802 + def niTClk_GetExtendedErrorInfo(self, error_string, error_string_size): # noqa: N802 with self._func_lock: if self.niTClk_GetExtendedErrorInfo_cfunc is None: - self.niTClk_GetExtendedErrorInfo_cfunc = self._get_library_function( - "niTClk_GetExtendedErrorInfo" - ) - self.niTClk_GetExtendedErrorInfo_cfunc.argtypes = [ - ctypes.POINTER(ViChar), - ViUInt32, - ] # noqa: F405 + self.niTClk_GetExtendedErrorInfo_cfunc = self._get_library_function('niTClk_GetExtendedErrorInfo') + self.niTClk_GetExtendedErrorInfo_cfunc.argtypes = [ctypes.POINTER(ViChar), ViUInt32] # noqa: F405 self.niTClk_GetExtendedErrorInfo_cfunc.restype = ViStatus # noqa: F405 return self.niTClk_GetExtendedErrorInfo_cfunc(error_string, error_string_size) def niTClk_Initiate(self, session_count, sessions): # noqa: N802 with self._func_lock: if self.niTClk_Initiate_cfunc is None: - self.niTClk_Initiate_cfunc = self._get_library_function( - "niTClk_Initiate" - ) - self.niTClk_Initiate_cfunc.argtypes = [ - ViUInt32, - ctypes.POINTER(ViSession), - ] # noqa: F405 + self.niTClk_Initiate_cfunc = self._get_library_function('niTClk_Initiate') + self.niTClk_Initiate_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession)] # noqa: F405 self.niTClk_Initiate_cfunc.restype = ViStatus # noqa: F405 return self.niTClk_Initiate_cfunc(session_count, sessions) def niTClk_IsDone(self, session_count, sessions, done): # noqa: N802 with self._func_lock: if self.niTClk_IsDone_cfunc is None: - self.niTClk_IsDone_cfunc = self._get_library_function("niTClk_IsDone") - self.niTClk_IsDone_cfunc.argtypes = [ - ViUInt32, - ctypes.POINTER(ViSession), - ctypes.POINTER(ViBoolean), - ] # noqa: F405 + self.niTClk_IsDone_cfunc = self._get_library_function('niTClk_IsDone') + self.niTClk_IsDone_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession), ctypes.POINTER(ViBoolean)] # noqa: F405 self.niTClk_IsDone_cfunc.restype = ViStatus # noqa: F405 return self.niTClk_IsDone_cfunc(session_count, sessions, done) - def niTClk_SetAttributeViReal64( - self, session, channel_name, attribute_id, value - ): # noqa: N802 + def niTClk_SetAttributeViReal64(self, session, channel_name, attribute_id, value): # noqa: N802 with self._func_lock: if self.niTClk_SetAttributeViReal64_cfunc is None: - self.niTClk_SetAttributeViReal64_cfunc = self._get_library_function( - "niTClk_SetAttributeViReal64" - ) - self.niTClk_SetAttributeViReal64_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViReal64, - ] # noqa: F405 + self.niTClk_SetAttributeViReal64_cfunc = self._get_library_function('niTClk_SetAttributeViReal64') + self.niTClk_SetAttributeViReal64_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViReal64] # noqa: F405 self.niTClk_SetAttributeViReal64_cfunc.restype = ViStatus # noqa: F405 - return self.niTClk_SetAttributeViReal64_cfunc( - session, channel_name, attribute_id, value - ) + return self.niTClk_SetAttributeViReal64_cfunc(session, channel_name, attribute_id, value) - def niTClk_SetAttributeViSession( - self, session, channel_name, attribute_id, value - ): # noqa: N802 + def niTClk_SetAttributeViSession(self, session, channel_name, attribute_id, value): # noqa: N802 with self._func_lock: if self.niTClk_SetAttributeViSession_cfunc is None: - self.niTClk_SetAttributeViSession_cfunc = self._get_library_function( - "niTClk_SetAttributeViSession" - ) - self.niTClk_SetAttributeViSession_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ViSession, - ] # noqa: F405 + self.niTClk_SetAttributeViSession_cfunc = self._get_library_function('niTClk_SetAttributeViSession') + self.niTClk_SetAttributeViSession_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ViSession] # noqa: F405 self.niTClk_SetAttributeViSession_cfunc.restype = ViStatus # noqa: F405 - return self.niTClk_SetAttributeViSession_cfunc( - session, channel_name, attribute_id, value - ) + return self.niTClk_SetAttributeViSession_cfunc(session, channel_name, attribute_id, value) - def niTClk_SetAttributeViString( - self, session, channel_name, attribute_id, value - ): # noqa: N802 + def niTClk_SetAttributeViString(self, session, channel_name, attribute_id, value): # noqa: N802 with self._func_lock: if self.niTClk_SetAttributeViString_cfunc is None: - self.niTClk_SetAttributeViString_cfunc = self._get_library_function( - "niTClk_SetAttributeViString" - ) - self.niTClk_SetAttributeViString_cfunc.argtypes = [ - ViSession, - ctypes.POINTER(ViChar), - ViAttr, - ctypes.POINTER(ViChar), - ] # noqa: F405 + self.niTClk_SetAttributeViString_cfunc = self._get_library_function('niTClk_SetAttributeViString') + self.niTClk_SetAttributeViString_cfunc.argtypes = [ViSession, ctypes.POINTER(ViChar), ViAttr, ctypes.POINTER(ViChar)] # noqa: F405 self.niTClk_SetAttributeViString_cfunc.restype = ViStatus # noqa: F405 - return self.niTClk_SetAttributeViString_cfunc( - session, channel_name, attribute_id, value - ) + return self.niTClk_SetAttributeViString_cfunc(session, channel_name, attribute_id, value) - def niTClk_SetupForSyncPulseSenderSynchronize( - self, session_count, sessions, min_time - ): # noqa: N802 + def niTClk_SetupForSyncPulseSenderSynchronize(self, session_count, sessions, min_time): # noqa: N802 with self._func_lock: if self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc is None: - self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc = ( - self._get_library_function( - "niTClk_SetupForSyncPulseSenderSynchronize" - ) - ) - self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc.argtypes = [ - ViUInt32, - ctypes.POINTER(ViSession), - ViReal64, - ] # noqa: F405 - self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc( - session_count, sessions, min_time - ) + self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc = self._get_library_function('niTClk_SetupForSyncPulseSenderSynchronize') + self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession), ViReal64] # noqa: F405 + self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc.restype = ViStatus # noqa: F405 + return self.niTClk_SetupForSyncPulseSenderSynchronize_cfunc(session_count, sessions, min_time) - def niTClk_Synchronize( - self, session_count, sessions, min_tclk_period - ): # noqa: N802 + def niTClk_Synchronize(self, session_count, sessions, min_tclk_period): # noqa: N802 with self._func_lock: if self.niTClk_Synchronize_cfunc is None: - self.niTClk_Synchronize_cfunc = self._get_library_function( - "niTClk_Synchronize" - ) - self.niTClk_Synchronize_cfunc.argtypes = [ - ViUInt32, - ctypes.POINTER(ViSession), - ViReal64, - ] # noqa: F405 + self.niTClk_Synchronize_cfunc = self._get_library_function('niTClk_Synchronize') + self.niTClk_Synchronize_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession), ViReal64] # noqa: F405 self.niTClk_Synchronize_cfunc.restype = ViStatus # noqa: F405 return self.niTClk_Synchronize_cfunc(session_count, sessions, min_tclk_period) - def niTClk_SynchronizeToSyncPulseSender( - self, session_count, sessions, min_time - ): # noqa: N802 + def niTClk_SynchronizeToSyncPulseSender(self, session_count, sessions, min_time): # noqa: N802 with self._func_lock: if self.niTClk_SynchronizeToSyncPulseSender_cfunc is None: - self.niTClk_SynchronizeToSyncPulseSender_cfunc = ( - self._get_library_function("niTClk_SynchronizeToSyncPulseSender") - ) - self.niTClk_SynchronizeToSyncPulseSender_cfunc.argtypes = [ - ViUInt32, - ctypes.POINTER(ViSession), - ViReal64, - ] # noqa: F405 - self.niTClk_SynchronizeToSyncPulseSender_cfunc.restype = ( - ViStatus # noqa: F405 - ) - return self.niTClk_SynchronizeToSyncPulseSender_cfunc( - session_count, sessions, min_time - ) + self.niTClk_SynchronizeToSyncPulseSender_cfunc = self._get_library_function('niTClk_SynchronizeToSyncPulseSender') + self.niTClk_SynchronizeToSyncPulseSender_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession), ViReal64] # noqa: F405 + self.niTClk_SynchronizeToSyncPulseSender_cfunc.restype = ViStatus # noqa: F405 + return self.niTClk_SynchronizeToSyncPulseSender_cfunc(session_count, sessions, min_time) def niTClk_WaitUntilDone(self, session_count, sessions, timeout): # noqa: N802 with self._func_lock: if self.niTClk_WaitUntilDone_cfunc is None: - self.niTClk_WaitUntilDone_cfunc = self._get_library_function( - "niTClk_WaitUntilDone" - ) - self.niTClk_WaitUntilDone_cfunc.argtypes = [ - ViUInt32, - ctypes.POINTER(ViSession), - ViReal64, - ] # noqa: F405 + self.niTClk_WaitUntilDone_cfunc = self._get_library_function('niTClk_WaitUntilDone') + self.niTClk_WaitUntilDone_cfunc.argtypes = [ViUInt32, ctypes.POINTER(ViSession), ViReal64] # noqa: F405 self.niTClk_WaitUntilDone_cfunc.restype = ViStatus # noqa: F405 return self.niTClk_WaitUntilDone_cfunc(session_count, sessions, timeout) diff --git a/generated/nitclk/nitclk/_library_singleton.py b/generated/nitclk/nitclk/_library_singleton.py index a866829a2..124ff8afc 100644 --- a/generated/nitclk/nitclk/_library_singleton.py +++ b/generated/nitclk/nitclk/_library_singleton.py @@ -12,36 +12,30 @@ _instance = None _instance_lock = threading.Lock() -_library_info = { - "Linux": {"64bit": {"name": "nitclk", "type": "cdll"}}, - "Windows": { - "32bit": {"name": "niTClk.dll", "type": "windll"}, - "64bit": {"name": "niTClk_64.dll", "type": "cdll"}, - }, -} +_library_info = {'Linux': {'64bit': {'name': 'nitclk', 'type': 'cdll'}}, + 'Windows': {'32bit': {'name': 'niTClk.dll', 'type': 'windll'}, + '64bit': {'name': 'niTClk_64.dll', 'type': 'cdll'}}} def _get_library_name(): try: - return ctypes.util.find_library( - _library_info[platform.system()][platform.architecture()[0]]["name"] - ) # We find and return full path to the DLL + return ctypes.util.find_library(_library_info[platform.system()][platform.architecture()[0]]['name']) # We find and return full path to the DLL except KeyError: raise errors.UnsupportedConfigurationError def _get_library_type(): try: - return _library_info[platform.system()][platform.architecture()[0]]["type"] + return _library_info[platform.system()][platform.architecture()[0]]['type'] except KeyError: raise errors.UnsupportedConfigurationError def get(): - """get + '''get Returns the library.Library singleton for nitclk. - """ + ''' global _instance global _instance_lock @@ -49,12 +43,13 @@ def get(): if _instance is None: try: library_type = _get_library_type() - if library_type == "windll": + if library_type == 'windll': ctypes_library = ctypes.WinDLL(_get_library_name()) else: - assert library_type == "cdll" + assert library_type == 'cdll' ctypes_library = ctypes.CDLL(_get_library_name()) except OSError: raise errors.DriverNotInstalledError() _instance = _library.Library(ctypes_library) return _instance + diff --git a/generated/nitclk/nitclk/_visatype.py b/generated/nitclk/nitclk/_visatype.py index bf96c3cfb..02cc41d1b 100644 --- a/generated/nitclk/nitclk/_visatype.py +++ b/generated/nitclk/nitclk/_visatype.py @@ -2,9 +2,9 @@ import ctypes -"""Definitions of the VISA types used by the C API of the driver runtime. +'''Definitions of the VISA types used by the C API of the driver runtime. These are aliased directly to ctypes types so can be used directly to call into the library. -""" +''' ViChar = ctypes.c_char @@ -26,3 +26,4 @@ ViAttr = ViUInt32 ViConstString = ViString ViRsrc = ViString + diff --git a/generated/nitclk/nitclk/errors.py b/generated/nitclk/nitclk/errors.py index 6eac3f779..a66db325d 100644 --- a/generated/nitclk/nitclk/errors.py +++ b/generated/nitclk/nitclk/errors.py @@ -7,81 +7,70 @@ def _is_success(code): - return code == 0 + return (code == 0) def _is_error(code): - return code < 0 + return (code < 0) def _is_warning(code): - return code > 0 + return (code > 0) class Error(Exception): - """Base error class for NI-TClk""" + '''Base error class for NI-TClk''' def __init__(self, message): super(Error, self).__init__(message) class DriverError(Error): - """An error originating from the NI-TClk driver""" + '''An error originating from the NI-TClk driver''' def __init__(self, code, description): - assert _is_error(code), "Should not raise Error if code is not fatal." + assert (_is_error(code)), "Should not raise Error if code is not fatal." self.code = code self.description = description super(DriverError, self).__init__(str(self.code) + ": " + self.description) class DriverWarning(Warning): - """A warning originating from the NI-TClk driver""" + '''A warning originating from the NI-TClk driver''' def __init__(self, code, description): - assert _is_warning(code), "Should not create Warning if code is not positive." - super(DriverWarning, self).__init__( - "Warning {0} occurred.\n\n{1}".format(code, description) - ) + assert (_is_warning(code)), "Should not create Warning if code is not positive." + super(DriverWarning, self).__init__('Warning {0} occurred.\n\n{1}'.format(code, description)) class UnsupportedConfigurationError(Error): - """An error due to using this module in an usupported platform.""" + '''An error due to using this module in an usupported platform.''' def __init__(self): - super(UnsupportedConfigurationError, self).__init__( - "System configuration is unsupported: " - + platform.architecture()[0] - + " " - + platform.system() - ) + super(UnsupportedConfigurationError, self).__init__('System configuration is unsupported: ' + platform.architecture()[0] + ' ' + platform.system()) class DriverNotInstalledError(Error): - """An error due to using this module without the driver runtime installed.""" + '''An error due to using this module without the driver runtime installed.''' def __init__(self): - super(DriverNotInstalledError, self).__init__( - "The NI-TClk runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it." - ) + super(DriverNotInstalledError, self).__init__('The NI-TClk runtime could not be loaded. Make sure it is installed and its bitness matches that of your Python interpreter. Please visit http://www.ni.com/downloads/drivers/ to download and install it.') class DriverTooOldError(Error): - """An error due to using this module with an older version of the driver runtime.""" + '''An error due to using this module with an older version of the driver runtime.''' def __init__(self): - super(DriverTooOldError, self).__init__( - "A function was not found in the NI-TClk runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it." - ) + super(DriverTooOldError, self).__init__('A function was not found in the NI-TClk runtime. Please visit http://www.ni.com/downloads/drivers/ to download a newer version and install it.') def handle_error(session, code, ignore_warnings, is_error_handling): - """handle_error + '''handle_error Helper function for handling errors returned by nitclk.Library. It calls back into the session to get the corresponding error description and raises if necessary. - """ + ''' if _is_success(code) or (_is_warning(code) and ignore_warnings): return @@ -89,7 +78,7 @@ def handle_error(session, code, ignore_warnings, is_error_handling): if is_error_handling: # The caller is in the midst of error handling and an error occurred. # Don't try to get the description or we'll start recursing until the stack overflows. - description = "" + description = '' else: description = session._get_error_description(code) @@ -98,3 +87,5 @@ def handle_error(session, code, ignore_warnings, is_error_handling): assert _is_warning(code) warnings.warn(DriverWarning(code, description)) + + diff --git a/generated/nitclk/nitclk/session.py b/generated/nitclk/nitclk/session.py index a76a77a8e..1e868347e 100644 --- a/generated/nitclk/nitclk/session.py +++ b/generated/nitclk/nitclk/session.py @@ -13,7 +13,6 @@ # Used for __repr__ and __str__ import pprint - pp = pprint.PrettyPrinter(indent=4) _session_instance = None @@ -23,15 +22,14 @@ # Helper functions for creating ctypes needed for calling into the driver DLL def get_ctypes_pointer_for_buffer(value=None, library_type=None, size=None): if isinstance(value, array.array): - assert library_type is not None, "library_type is required for array.array" + assert library_type is not None, 'library_type is required for array.array' addr, _ = value.buffer_info() return ctypes.cast(addr, ctypes.POINTER(library_type)) elif str(type(value)).find("'numpy.ndarray'") != -1: import numpy - return numpy.ctypeslib.as_ctypes(value) elif isinstance(value, list): - assert library_type is not None, "library_type is required for list" + assert library_type is not None, 'library_type is required for list' return (library_type * len(value))(*value) else: if library_type is not None and size is not None: @@ -41,16 +39,16 @@ def get_ctypes_pointer_for_buffer(value=None, library_type=None, size=None): class SessionReference(object): - """Properties container for NI-TClk attributes. + '''Properties container for NI-TClk attributes. Note: Constructing this class is an advanced use case and should not be needed in most circumstances. - """ + ''' # This is needed during __init__. Without it, __setattr__ raises an exception _is_frozen = False exported_sync_pulse_output_terminal = _attributes.AttributeViString(2) - """Type: str + '''Type: str Specifies the destination of the Sync Pulse. This property is most often used when synchronizing a multichassis system. Values @@ -62,9 +60,9 @@ class SessionReference(object): - NI PXI-5421 supports 'PFI0', 'PFI1', 'PFI4', and 'PFI5' - NI PXI-6551/6552 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3' Default Value is empty string - """ + ''' exported_tclk_output_terminal = _attributes.AttributeViString(9) - """Type: str + '''Type: str Specifies the destination of the device's TClk signal. Values @@ -76,21 +74,21 @@ class SessionReference(object): - NI PXI-5421 supports 'PFI0', 'PFI1', 'PFI4', and 'PFI5' - NI PXI-6551/6552 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3' Default Value is empty string - """ + ''' pause_trigger_master_session = _attributes.AttributeSessionReference(6) - """Type: instrument-specific session or an instance of nitclk.SessionReference + '''Type: instrument-specific session or an instance of nitclk.SessionReference Specifies the pause trigger master session. For external triggers, the session that originally receives the trigger. For None (no trigger configured) or software triggers, the session that originally generates the trigger. - """ + ''' ref_trigger_master_session = _attributes.AttributeSessionReference(4) - """Type: instrument-specific session or an instance of nitclk.SessionReference + '''Type: instrument-specific session or an instance of nitclk.SessionReference Specifies the reference trigger master session. For external triggers, the session that originally receives the trigger. For None (no trigger configured) or software triggers, the session that originally generates the trigger. - """ + ''' sample_clock_delay = _attributes.AttributeViReal64TimeDeltaSeconds(11) - """Type: hightime.timedelta, datetime.timedelta, or float in seconds + '''Type: hightime.timedelta, datetime.timedelta, or float in seconds Specifies the sample clock delay. Specifies the delay, in seconds, to apply to the session sample clock relative to the other synchronized sessions. During synchronization, NI-TClk aligns the sample clocks on the synchronized devices. If you want to delay the sample clocks, set this property before calling synchronize. @@ -100,32 +98,32 @@ class SessionReference(object): Default Value is 0 Note: Sample clock delay is supported for generation sessions only; it is - """ + ''' sequencer_flag_master_session = _attributes.AttributeSessionReference(16) - """Type: instrument-specific session or an instance of nitclk.SessionReference + '''Type: instrument-specific session or an instance of nitclk.SessionReference Specifies the sequencer flag master session. For external triggers, the session that originally receives the trigger. For None (no trigger configured) or software triggers, the session that originally generates the trigger. - """ + ''' start_trigger_master_session = _attributes.AttributeSessionReference(3) - """Type: instrument-specific session or an instance of nitclk.SessionReference + '''Type: instrument-specific session or an instance of nitclk.SessionReference Specifies the start trigger master session. For external triggers, the session that originally receives the trigger. For None (no trigger configured) or software triggers, the session that originally generates the trigger. - """ + ''' sync_pulse_clock_source = _attributes.AttributeViString(10) - """Type: str + '''Type: str Specifies the Sync Pulse Clock source. This property is typically used to synchronize PCI devices when you want to control RTSI 7 yourself. Make sure that a 10 MHz clock is driven onto RTSI 7. Values PCI Devices - 'RTSI_7' and 'None' PXI Devices - 'PXI_CLK10' and 'None' Default Value - 'None' directs synchronize to create the necessary routes. For PCI, one of the synchronized devices drives a 10 MHz clock on RTSI 7 unless that line is already being driven. - """ + ''' sync_pulse_sender_sync_pulse_source = _attributes.AttributeViString(13) - """Type: str + '''Type: str Specifies the external sync pulse source for the Sync Pulse Sender. You can use this source to synchronize the Sync Pulse Sender with an external non-TClk source. Values @@ -137,9 +135,9 @@ class SessionReference(object): - NI PXI-5421 supports 'PFI0', 'PFI1', 'PFI4', and 'PFI5' - NI PXI-6551/6552 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3' Default Value is empty string - """ + ''' sync_pulse_source = _attributes.AttributeViString(1) - """Type: str + '''Type: str Specifies the Sync Pulse source. This property is most often used when synchronizing a multichassis system. Values @@ -151,51 +149,47 @@ class SessionReference(object): - NI PXI-5421 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3' - NI PXI-6551/6552 supports 'PFI0', 'PFI1', 'PFI2', and 'PFI3' Default Value - Empty string. This default value directs synchronize to set this property when all the synchronized devices are in one PXI chassis. To synchronize a multichassis system, you must set this property before calling synchronize. - """ + ''' tclk_actual_period = _attributes.AttributeViReal64(8) - """Type: float + '''Type: float Indicates the computed TClk period that will be used during the acquisition. - """ + ''' - def __init__(self, session_number, encoding="windows-1251"): + def __init__(self, session_number, encoding='windows-1251'): self._session_number = session_number self._library = _library_singleton.get() self._encoding = encoding # We need a self._repeated_capability string for passing down to function calls on _Library class. We just need to set it to empty string. - self._repeated_capability = "" + self._repeated_capability = '' # Store the parameter list for later printing in __repr__ param_list = [] param_list.append("session_number=" + pp.pformat(session_number)) param_list.append("encoding=" + pp.pformat(encoding)) - self._param_list = ", ".join(param_list) + self._param_list = ', '.join(param_list) self._is_frozen = True def __repr__(self): - return "{0}.{1}({2})".format( - "nitclk", self.__class__.__name__, self._param_list - ) + return '{0}.{1}({2})'.format('nitclk', self.__class__.__name__, self._param_list) def __setattr__(self, key, value): if self._is_frozen and key not in dir(self): - raise AttributeError( - "'{0}' object has no attribute '{1}'".format(type(self).__name__, key) - ) + raise AttributeError("'{0}' object has no attribute '{1}'".format(type(self).__name__, key)) object.__setattr__(self, key, value) def _get_error_description(self, error_code): - """_get_error_description + '''_get_error_description Returns the error description. - """ + ''' try: - """ + ''' It is expected for _get_error to raise when the session is invalid (IVI spec requires GetError to fail). Use _error_message instead. It doesn't require a session. - """ + ''' error_string = self._get_extended_error_info() return error_string except errors.Error: @@ -205,7 +199,7 @@ def _get_tclk_session_reference(self): return self._session_number def _get_attribute_vi_real64(self, attribute_id): - r"""_get_attribute_vi_real64 + r'''_get_attribute_vi_real64 Gets the value of an NI-TClk ViReal64 property. @@ -228,26 +222,17 @@ def _get_attribute_vi_real64(self, attribute_id): Returns: value (float): The value that you are getting - """ + ''' session_ctype = _visatype.ViSession(self._session_number) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViReal64() # case S220 - error_code = self._library.niTClk_GetAttributeViReal64( - session_ctype, - channel_name_ctype, - attribute_id_ctype, - None if value_ctype is None else (ctypes.pointer(value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niTClk_GetAttributeViReal64(session_ctype, channel_name_ctype, attribute_id_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return float(value_ctype.value) def _get_attribute_vi_session(self, attribute_id): - r"""_get_attribute_vi_session + r'''_get_attribute_vi_session Gets the value of an NI-TClk ViSession property. @@ -272,26 +257,17 @@ def _get_attribute_vi_session(self, attribute_id): Returns: value (int): The value that you are getting - """ + ''' session_ctype = _visatype.ViSession(self._session_number) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViSession() # case S220 - error_code = self._library.niTClk_GetAttributeViSession( - session_ctype, - channel_name_ctype, - attribute_id_ctype, - None if value_ctype is None else (ctypes.pointer(value_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niTClk_GetAttributeViSession(session_ctype, channel_name_ctype, attribute_id_ctype, None if value_ctype is None else (ctypes.pointer(value_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return int(value_ctype.value) def _get_attribute_vi_string(self, attribute_id): - r"""_get_attribute_vi_string + r'''_get_attribute_vi_string This method queries the value of an NI-TClk ViString property. You must provide a ViChar array to serve as a buffer for the value. You pass @@ -326,40 +302,22 @@ def _get_attribute_vi_string(self, attribute_id): Returns: value (str): The value that you are getting - """ + ''' session_ctype = _visatype.ViSession(self._session_number) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 buf_size_ctype = _visatype.ViInt32() # case S170 value_ctype = None # case C050 - error_code = self._library.niTClk_GetAttributeViString( - session_ctype, - channel_name_ctype, - attribute_id_ctype, - buf_size_ctype, - value_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=False - ) + error_code = self._library.niTClk_GetAttributeViString(session_ctype, channel_name_ctype, attribute_id_ctype, buf_size_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=False) buf_size_ctype = _visatype.ViInt32(error_code) # case S180 value_ctype = (_visatype.ViChar * buf_size_ctype.value)() # case C060 - error_code = self._library.niTClk_GetAttributeViString( - session_ctype, - channel_name_ctype, - attribute_id_ctype, - buf_size_ctype, - value_ctype, - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niTClk_GetAttributeViString(session_ctype, channel_name_ctype, attribute_id_ctype, buf_size_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return value_ctype.value.decode(self._encoding) def _get_extended_error_info(self): - r"""_get_extended_error_info + r'''_get_extended_error_info Reports extended error information for the most recent NI-TClk method that returned an error. To establish the method that returned an @@ -373,29 +331,19 @@ def _get_extended_error_info(self): value of _get_extended_error_info is the size that you should use for _get_extended_error_info to return the full error string. - """ + ''' error_string_ctype = None # case C050 error_string_size_ctype = _visatype.ViUInt32() # case S170 - error_code = self._library.niTClk_GetExtendedErrorInfo( - error_string_ctype, error_string_size_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=True - ) + error_code = self._library.niTClk_GetExtendedErrorInfo(error_string_ctype, error_string_size_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True) error_string_size_ctype = _visatype.ViUInt32(error_code) # case S180 - error_string_ctype = ( - _visatype.ViChar * error_string_size_ctype.value - )() # case C060 - error_code = self._library.niTClk_GetExtendedErrorInfo( - error_string_ctype, error_string_size_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + error_string_ctype = (_visatype.ViChar * error_string_size_ctype.value)() # case C060 + error_code = self._library.niTClk_GetExtendedErrorInfo(error_string_ctype, error_string_size_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return error_string_ctype.value.decode(self._encoding) def _set_attribute_vi_real64(self, attribute_id, value): - r"""_set_attribute_vi_real64 + r'''_set_attribute_vi_real64 Sets the value of an NI-TClk VIReal64 property. _set_attribute_vi_real64 is a low-level method that you can use to @@ -420,23 +368,17 @@ def _set_attribute_vi_real64(self, attribute_id, value): value (float): The value for the property - """ + ''' session_ctype = _visatype.ViSession(self._session_number) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViReal64(value) # case S150 - error_code = self._library.niTClk_SetAttributeViReal64( - session_ctype, channel_name_ctype, attribute_id_ctype, value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niTClk_SetAttributeViReal64(session_ctype, channel_name_ctype, attribute_id_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def _set_attribute_vi_session(self, attribute_id, value): - r"""_set_attribute_vi_session + r'''_set_attribute_vi_session Sets the value of an NI-TClk ViSession property. _set_attribute_vi_session is a low-level method that you can use @@ -463,23 +405,17 @@ def _set_attribute_vi_session(self, attribute_id, value): value (int): The value for the property - """ + ''' session_ctype = _visatype.ViSession(self._session_number) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 value_ctype = _visatype.ViSession(value) # case S150 - error_code = self._library.niTClk_SetAttributeViSession( - session_ctype, channel_name_ctype, attribute_id_ctype, value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niTClk_SetAttributeViSession(session_ctype, channel_name_ctype, attribute_id_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def _set_attribute_vi_string(self, attribute_id, value): - r"""_set_attribute_vi_string + r'''_set_attribute_vi_string Sets the value of an NI-TClk VIString property. _set_attribute_vi_string is a low-level method that you can use to @@ -506,64 +442,55 @@ def _set_attribute_vi_string(self, attribute_id, value): value (str): Pass the value for the property - """ + ''' session_ctype = _visatype.ViSession(self._session_number) # case S110 - channel_name_ctype = ctypes.create_string_buffer( - self._repeated_capability.encode(self._encoding) - ) # case C010 + channel_name_ctype = ctypes.create_string_buffer(self._repeated_capability.encode(self._encoding)) # case C010 attribute_id_ctype = _visatype.ViAttr(attribute_id) # case S150 - value_ctype = ctypes.create_string_buffer( - value.encode(self._encoding) - ) # case C020 - error_code = self._library.niTClk_SetAttributeViString( - session_ctype, channel_name_ctype, attribute_id_ctype, value_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + value_ctype = ctypes.create_string_buffer(value.encode(self._encoding)) # case C020 + error_code = self._library.niTClk_SetAttributeViString(session_ctype, channel_name_ctype, attribute_id_ctype, value_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return class _Session(object): - """Private class + '''Private class This class allows reusing function templates that are used in all other drivers. If we don't do this, we would need new template(s) that the only difference is in the indentation. - """ + ''' def __init__(self): self._library = _library_singleton.get() - self._encoding = "windows-1251" + self._encoding = 'windows-1251' # Instantiate any repeated capability objects # Store the parameter list for later printing in __repr__ param_list = [] - self._param_list = ", ".join(param_list) + self._param_list = ', '.join(param_list) self._is_frozen = True def _get_error_description(self, error_code): - """_get_error_description + '''_get_error_description Returns the error description. - """ + ''' try: - """ + ''' It is expected for _get_error to raise when the session is invalid (IVI spec requires GetError to fail). Use _error_message instead. It doesn't require a session. - """ + ''' error_string = self._get_extended_error_info() return error_string except errors.Error: return "Failed to retrieve error description." - """ These are code-generated """ - + ''' These are code-generated ''' def configure_for_homogeneous_triggers(self, sessions): - r"""configure_for_homogeneous_triggers + r'''configure_for_homogeneous_triggers Configures the properties commonly required for the TClk synchronization of device sessions with homogeneous triggers in a single PXI chassis or @@ -671,28 +598,16 @@ def configure_for_homogeneous_triggers(self, sessions): Args: sessions (list of instrument-specific sessions or nitclk.SessionReference instances): sessions is an array of sessions that are being synchronized. - """ - session_count_ctype = _visatype.ViUInt32( - 0 if sessions is None else len(sessions) - ) # case S160 - sessions_converted = _converters.convert_to_nitclk_session_number_list( - sessions - ) # case B520 - sessions_ctype = get_ctypes_pointer_for_buffer( - value=sessions_converted, library_type=_visatype.ViSession - ) # case B520 - error_code = self._library.niTClk_ConfigureForHomogeneousTriggers( - session_count_ctype, sessions_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + ''' + session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 + sessions_converted = _converters.convert_to_nitclk_session_number_list(sessions) # case B520 + sessions_ctype = get_ctypes_pointer_for_buffer(value=sessions_converted, library_type=_visatype.ViSession) # case B520 + error_code = self._library.niTClk_ConfigureForHomogeneousTriggers(session_count_ctype, sessions_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return - def finish_sync_pulse_sender_synchronize( - self, sessions, min_time=hightime.timedelta(seconds=0.0) - ): - r"""finish_sync_pulse_sender_synchronize + def finish_sync_pulse_sender_synchronize(self, sessions, min_time=hightime.timedelta(seconds=0.0)): + r'''finish_sync_pulse_sender_synchronize Finishes synchronizing the Sync Pulse Sender. @@ -706,29 +621,17 @@ def finish_sync_pulse_sender_synchronize( synchronization, adjust this value to account for propagation delays through the various devices and cables. - """ - session_count_ctype = _visatype.ViUInt32( - 0 if sessions is None else len(sessions) - ) # case S160 - sessions_converted = _converters.convert_to_nitclk_session_number_list( - sessions - ) # case B520 - sessions_ctype = get_ctypes_pointer_for_buffer( - value=sessions_converted, library_type=_visatype.ViSession - ) # case B520 - min_time_ctype = _converters.convert_timedelta_to_seconds_real64( - min_time - ) # case S140 - error_code = self._library.niTClk_FinishSyncPulseSenderSynchronize( - session_count_ctype, sessions_ctype, min_time_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + ''' + session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 + sessions_converted = _converters.convert_to_nitclk_session_number_list(sessions) # case B520 + sessions_ctype = get_ctypes_pointer_for_buffer(value=sessions_converted, library_type=_visatype.ViSession) # case B520 + min_time_ctype = _converters.convert_timedelta_to_seconds_real64(min_time) # case S140 + error_code = self._library.niTClk_FinishSyncPulseSenderSynchronize(session_count_ctype, sessions_ctype, min_time_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def _get_extended_error_info(self): - r"""_get_extended_error_info + r'''_get_extended_error_info Reports extended error information for the most recent NI-TClk method that returned an error. To establish the method that returned an @@ -742,29 +645,19 @@ def _get_extended_error_info(self): value of _get_extended_error_info is the size that you should use for _get_extended_error_info to return the full error string. - """ + ''' error_string_ctype = None # case C050 error_string_size_ctype = _visatype.ViUInt32() # case S170 - error_code = self._library.niTClk_GetExtendedErrorInfo( - error_string_ctype, error_string_size_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=True, is_error_handling=True - ) + error_code = self._library.niTClk_GetExtendedErrorInfo(error_string_ctype, error_string_size_ctype) + errors.handle_error(self, error_code, ignore_warnings=True, is_error_handling=True) error_string_size_ctype = _visatype.ViUInt32(error_code) # case S180 - error_string_ctype = ( - _visatype.ViChar * error_string_size_ctype.value - )() # case C060 - error_code = self._library.niTClk_GetExtendedErrorInfo( - error_string_ctype, error_string_size_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=True - ) + error_string_ctype = (_visatype.ViChar * error_string_size_ctype.value)() # case C060 + error_code = self._library.niTClk_GetExtendedErrorInfo(error_string_ctype, error_string_size_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=True) return error_string_ctype.value.decode(self._encoding) def initiate(self, sessions): - r"""initiate + r'''initiate Initiates the acquisition or generation sessions specified, taking into consideration any special requirements needed for synchronization. For @@ -775,24 +668,16 @@ def initiate(self, sessions): Args: sessions (list of instrument-specific sessions or nitclk.SessionReference instances): sessions is an array of sessions that are being synchronized. - """ - session_count_ctype = _visatype.ViUInt32( - 0 if sessions is None else len(sessions) - ) # case S160 - sessions_converted = _converters.convert_to_nitclk_session_number_list( - sessions - ) # case B520 - sessions_ctype = get_ctypes_pointer_for_buffer( - value=sessions_converted, library_type=_visatype.ViSession - ) # case B520 + ''' + session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 + sessions_converted = _converters.convert_to_nitclk_session_number_list(sessions) # case B520 + sessions_ctype = get_ctypes_pointer_for_buffer(value=sessions_converted, library_type=_visatype.ViSession) # case B520 error_code = self._library.niTClk_Initiate(session_count_ctype, sessions_ctype) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def is_done(self, sessions): - r"""is_done + r'''is_done Monitors the progress of the acquisitions and/or generations corresponding to sessions. @@ -806,31 +691,17 @@ def is_done(self, sessions): session has completed without any errors or when any one of the sessions reports an error. - """ - session_count_ctype = _visatype.ViUInt32( - 0 if sessions is None else len(sessions) - ) # case S160 - sessions_converted = _converters.convert_to_nitclk_session_number_list( - sessions - ) # case B520 - sessions_ctype = get_ctypes_pointer_for_buffer( - value=sessions_converted, library_type=_visatype.ViSession - ) # case B520 + ''' + session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 + sessions_converted = _converters.convert_to_nitclk_session_number_list(sessions) # case B520 + sessions_ctype = get_ctypes_pointer_for_buffer(value=sessions_converted, library_type=_visatype.ViSession) # case B520 done_ctype = _visatype.ViBoolean() # case S220 - error_code = self._library.niTClk_IsDone( - session_count_ctype, - sessions_ctype, - None if done_ctype is None else (ctypes.pointer(done_ctype)), - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + error_code = self._library.niTClk_IsDone(session_count_ctype, sessions_ctype, None if done_ctype is None else (ctypes.pointer(done_ctype))) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return bool(done_ctype.value) - def setup_for_sync_pulse_sender_synchronize( - self, sessions, min_time=hightime.timedelta(seconds=0.0) - ): - r"""setup_for_sync_pulse_sender_synchronize + def setup_for_sync_pulse_sender_synchronize(self, sessions, min_time=hightime.timedelta(seconds=0.0)): + r'''setup_for_sync_pulse_sender_synchronize Configures the TClks on all the devices and prepares the Sync Pulse Sender for synchronization @@ -844,29 +715,17 @@ def setup_for_sync_pulse_sender_synchronize( synchronization, adjust this value to account for propagation delays through the various devices and cables. - """ - session_count_ctype = _visatype.ViUInt32( - 0 if sessions is None else len(sessions) - ) # case S160 - sessions_converted = _converters.convert_to_nitclk_session_number_list( - sessions - ) # case B520 - sessions_ctype = get_ctypes_pointer_for_buffer( - value=sessions_converted, library_type=_visatype.ViSession - ) # case B520 - min_time_ctype = _converters.convert_timedelta_to_seconds_real64( - min_time - ) # case S140 - error_code = self._library.niTClk_SetupForSyncPulseSenderSynchronize( - session_count_ctype, sessions_ctype, min_time_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + ''' + session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 + sessions_converted = _converters.convert_to_nitclk_session_number_list(sessions) # case B520 + sessions_ctype = get_ctypes_pointer_for_buffer(value=sessions_converted, library_type=_visatype.ViSession) # case B520 + min_time_ctype = _converters.convert_timedelta_to_seconds_real64(min_time) # case S140 + error_code = self._library.niTClk_SetupForSyncPulseSenderSynchronize(session_count_ctype, sessions_ctype, min_time_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def synchronize(self, sessions, min_tclk_period=hightime.timedelta(seconds=0.0)): - r"""synchronize + r'''synchronize Synchronizes the TClk signals on the given sessions. After synchronize executes, TClk signals from all sessions are @@ -885,31 +744,17 @@ def synchronize(self, sessions, min_tclk_period=hightime.timedelta(seconds=0.0)) synchronization, adjust this value to account for propagation delays through the various devices and cables. - """ - session_count_ctype = _visatype.ViUInt32( - 0 if sessions is None else len(sessions) - ) # case S160 - sessions_converted = _converters.convert_to_nitclk_session_number_list( - sessions - ) # case B520 - sessions_ctype = get_ctypes_pointer_for_buffer( - value=sessions_converted, library_type=_visatype.ViSession - ) # case B520 - min_tclk_period_ctype = _converters.convert_timedelta_to_seconds_real64( - min_tclk_period - ) # case S140 - error_code = self._library.niTClk_Synchronize( - session_count_ctype, sessions_ctype, min_tclk_period_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + ''' + session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 + sessions_converted = _converters.convert_to_nitclk_session_number_list(sessions) # case B520 + sessions_ctype = get_ctypes_pointer_for_buffer(value=sessions_converted, library_type=_visatype.ViSession) # case B520 + min_tclk_period_ctype = _converters.convert_timedelta_to_seconds_real64(min_tclk_period) # case S140 + error_code = self._library.niTClk_Synchronize(session_count_ctype, sessions_ctype, min_tclk_period_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return - def synchronize_to_sync_pulse_sender( - self, sessions, min_time=hightime.timedelta(seconds=0.0) - ): - r"""synchronize_to_sync_pulse_sender + def synchronize_to_sync_pulse_sender(self, sessions, min_time=hightime.timedelta(seconds=0.0)): + r'''synchronize_to_sync_pulse_sender Synchronizes the other devices to the Sync Pulse Sender. @@ -923,29 +768,17 @@ def synchronize_to_sync_pulse_sender( synchronization, adjust this value to account for propagation delays through the various devices and cables. - """ - session_count_ctype = _visatype.ViUInt32( - 0 if sessions is None else len(sessions) - ) # case S160 - sessions_converted = _converters.convert_to_nitclk_session_number_list( - sessions - ) # case B520 - sessions_ctype = get_ctypes_pointer_for_buffer( - value=sessions_converted, library_type=_visatype.ViSession - ) # case B520 - min_time_ctype = _converters.convert_timedelta_to_seconds_real64( - min_time - ) # case S140 - error_code = self._library.niTClk_SynchronizeToSyncPulseSender( - session_count_ctype, sessions_ctype, min_time_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + ''' + session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 + sessions_converted = _converters.convert_to_nitclk_session_number_list(sessions) # case B520 + sessions_ctype = get_ctypes_pointer_for_buffer(value=sessions_converted, library_type=_visatype.ViSession) # case B520 + min_time_ctype = _converters.convert_timedelta_to_seconds_real64(min_time) # case S140 + error_code = self._library.niTClk_SynchronizeToSyncPulseSender(session_count_ctype, sessions_ctype, min_time_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def wait_until_done(self, sessions, timeout=hightime.timedelta(seconds=0.0)): - r"""wait_until_done + r'''wait_until_done Call this method to pause execution of your program until the acquisitions and/or generations corresponding to sessions are done or @@ -963,30 +796,18 @@ def wait_until_done(self, sessions, timeout=hightime.timedelta(seconds=0.0)): sessions to complete. If timeout is exceeded, wait_until_done returns an error. - """ - session_count_ctype = _visatype.ViUInt32( - 0 if sessions is None else len(sessions) - ) # case S160 - sessions_converted = _converters.convert_to_nitclk_session_number_list( - sessions - ) # case B520 - sessions_ctype = get_ctypes_pointer_for_buffer( - value=sessions_converted, library_type=_visatype.ViSession - ) # case B520 - timeout_ctype = _converters.convert_timedelta_to_seconds_real64( - timeout - ) # case S140 - error_code = self._library.niTClk_WaitUntilDone( - session_count_ctype, sessions_ctype, timeout_ctype - ) - errors.handle_error( - self, error_code, ignore_warnings=False, is_error_handling=False - ) + ''' + session_count_ctype = _visatype.ViUInt32(0 if sessions is None else len(sessions)) # case S160 + sessions_converted = _converters.convert_to_nitclk_session_number_list(sessions) # case B520 + sessions_ctype = get_ctypes_pointer_for_buffer(value=sessions_converted, library_type=_visatype.ViSession) # case B520 + timeout_ctype = _converters.convert_timedelta_to_seconds_real64(timeout) # case S140 + error_code = self._library.niTClk_WaitUntilDone(session_count_ctype, sessions_ctype, timeout_ctype) + errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False) return def configure_for_homogeneous_triggers(sessions): - """configure_for_homogeneous_triggers + '''configure_for_homogeneous_triggers Configures the properties commonly required for the TClk synchronization of device sessions with homogeneous triggers in a single PXI chassis or @@ -1094,12 +915,12 @@ def configure_for_homogeneous_triggers(sessions): Args: sessions (list of instrument-specific sessions or nitclk.SessionReference instances): sessions is an array of sessions that are being synchronized. - """ + ''' return _Session().configure_for_homogeneous_triggers(sessions) def finish_sync_pulse_sender_synchronize(sessions, min_time): - """finish_sync_pulse_sender_synchronize + '''finish_sync_pulse_sender_synchronize Finishes synchronizing the Sync Pulse Sender. @@ -1113,12 +934,12 @@ def finish_sync_pulse_sender_synchronize(sessions, min_time): synchronization, adjust this value to account for propagation delays through the various devices and cables. - """ + ''' return _Session().finish_sync_pulse_sender_synchronize(sessions, min_time) def initiate(sessions): - """initiate + '''initiate Initiates the acquisition or generation sessions specified, taking into consideration any special requirements needed for synchronization. For @@ -1129,12 +950,12 @@ def initiate(sessions): Args: sessions (list of instrument-specific sessions or nitclk.SessionReference instances): sessions is an array of sessions that are being synchronized. - """ + ''' return _Session().initiate(sessions) def is_done(sessions): - """is_done + '''is_done Monitors the progress of the acquisitions and/or generations corresponding to sessions. @@ -1148,12 +969,12 @@ def is_done(sessions): session has completed without any errors or when any one of the sessions reports an error. - """ + ''' return _Session().is_done(sessions) def setup_for_sync_pulse_sender_synchronize(sessions, min_time): - """setup_for_sync_pulse_sender_synchronize + '''setup_for_sync_pulse_sender_synchronize Configures the TClks on all the devices and prepares the Sync Pulse Sender for synchronization @@ -1167,12 +988,12 @@ def setup_for_sync_pulse_sender_synchronize(sessions, min_time): synchronization, adjust this value to account for propagation delays through the various devices and cables. - """ + ''' return _Session().setup_for_sync_pulse_sender_synchronize(sessions, min_time) def synchronize(sessions, min_tclk_period): - """synchronize + '''synchronize Synchronizes the TClk signals on the given sessions. After synchronize executes, TClk signals from all sessions are @@ -1191,12 +1012,12 @@ def synchronize(sessions, min_tclk_period): synchronization, adjust this value to account for propagation delays through the various devices and cables. - """ + ''' return _Session().synchronize(sessions, min_tclk_period) def synchronize_to_sync_pulse_sender(sessions, min_time): - """synchronize_to_sync_pulse_sender + '''synchronize_to_sync_pulse_sender Synchronizes the other devices to the Sync Pulse Sender. @@ -1210,12 +1031,12 @@ def synchronize_to_sync_pulse_sender(sessions, min_time): synchronization, adjust this value to account for propagation delays through the various devices and cables. - """ + ''' return _Session().synchronize_to_sync_pulse_sender(sessions, min_time) def wait_until_done(sessions, timeout): - """wait_until_done + '''wait_until_done Call this method to pause execution of your program until the acquisitions and/or generations corresponding to sessions are done or @@ -1233,5 +1054,8 @@ def wait_until_done(sessions, timeout): sessions to complete. If timeout is exceeded, wait_until_done returns an error. - """ + ''' return _Session().wait_until_done(sessions, timeout) + + + diff --git a/generated/nitclk/nitclk/unit_tests/_matchers.py b/generated/nitclk/nitclk/unit_tests/_matchers.py index 34fcb63b5..70f09f8d3 100644 --- a/generated/nitclk/nitclk/unit_tests/_matchers.py +++ b/generated/nitclk/nitclk/unit_tests/_matchers.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- # This file was generated -"""Matcher classes used by unit tests in order to set mock expectations. +'''Matcher classes used by unit tests in order to set mock expectations. These work well with our visatype definitions. -""" +''' import ctypes import nitclk._visatype as _visatype @@ -21,27 +21,15 @@ def __init__(self, expected_type, expected_value): def __eq__(self, other): if not isinstance(other, self.expected_type): - print( - "{0}: Unexpected type. Expected: {1}. Received: {2}".format( - self.__class__.__name__, self.expected_type, type(other) - ) - ) + print("{0}: Unexpected type. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_type, type(other))) return False if other.value != self.expected_value: - print( - "{0}: Unexpected value. Expected: {1}. Received: {2}".format( - self.__class__.__name__, self.expected_value, other.value - ) - ) + print("{0}: Unexpected value. Expected: {1}. Received: {2}".format(self.__class__.__name__, self.expected_value, other.value)) return False return True def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_type), - pp.pformat(self.expected_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) class _PointerMatcher(object): @@ -50,18 +38,12 @@ def __init__(self, expected_type): def __eq__(self, other): if not isinstance(other, ctypes.POINTER(self.expected_type)): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - ctypes.POINTER(self.expected_type), type(other) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(ctypes.POINTER(self.expected_type), type(other))) return False return True def __repr__(self): - return "{0}({1})".format( - self.__class__.__name__, pp.pformat(self.expected_type) - ) + return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_type)) class _BufferMatcher(object): @@ -88,47 +70,29 @@ def __eq__(self, other): pass # Because of object lifetimes, we may need to mock the other instance and provide lists instead of the actual array - if not isinstance(other, self.expected_type) and not isinstance( - other, list - ): - print( - "Unexpected type. Expected: {0} or {1}. Received: {2}".format( - self.expected_type, list, type(other) - ) - ) + if not isinstance(other, self.expected_type) and not isinstance(other, list): + print("Unexpected type. Expected: {0} or {1}. Received: {2}".format(self.expected_type, list, type(other))) return False if self.expected_size != len(other): - print( - "Unexpected length. Expected: {0}. Received: {1}".format( - self.expected_size, len(other) - ) - ) + print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(other))) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for i in range(0, len(self.expected_value)): if self.expected_value[i] != other[i]: - print( - "Unexpected value at index {0}. Expected: {1}. Received: {2}".format( - i, self.expected_value[i], other[i] - ) - ) + print("Unexpected value at index {0}. Expected: {1}. Received: {2}".format(i, self.expected_value[i], other[i])) return False return True def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self._expected_element_type), - pp.pformat(self._expected_size_or_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self._expected_element_type), pp.pformat(self._expected_size_or_value)) def __str__(self): - ret_str = self.__repr__() + "\n" - ret_str += " expected_type = " + str(self.expected_type) + "\n" - ret_str += " expected_value = " + str(self.expected_value) + "\n" - ret_str += " expected_size = " + str(self.expected_size) + "\n" + ret_str = self.__repr__() + '\n' + ret_str += ' expected_type = ' + str(self.expected_type) + '\n' + ret_str += ' expected_value = ' + str(self.expected_value) + '\n' + ret_str += ' expected_size = ' + str(self.expected_size) + '\n' return ret_str @@ -148,37 +112,21 @@ def __eq__(self, other): pass if not isinstance(other, ctypes.Array): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_type, type(other) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(other))) return False - if ( - len(other) < len(self.expected_string_value) + 1 - ): # +1 for NULL terminating character - print( - "Unexpected length in C string. Expected at least: {0}. Received {1}".format( - len(other), len(self.expected_string_value) + 1 - ) - ) + if len(other) < len(self.expected_string_value) + 1: # +1 for NULL terminating character + print("Unexpected length in C string. Expected at least: {0}. Received {1}".format(len(other), len(self.expected_string_value) + 1)) return False if not isinstance(other[0], bytes): print("Unexpected type. Not a string. Received: {0}".format(type(other[0]))) return False if other.value.decode("ascii") != self.expected_string_value: - print( - "Unexpected value. Expected {0}. Received: {1}".format( - self.expected_string_value, other.value.decode - ) - ) + print("Unexpected value. Expected {0}. Received: {1}".format(self.expected_string_value, other.value.decode)) return False return True def __repr__(self): - return "{0}({1})".format( - self.__class__.__name__, pp.pformat(self.expected_string_value) - ) + return '{0}({1})'.format(self.__class__.__name__, pp.pformat(self.expected_string_value)) # Custom Type @@ -191,11 +139,7 @@ def _compare_ctype_structs(expected, actual): expected_val = getattr(expected, field_name) actual_val = getattr(actual, field_name) if expected_val != actual_val: - print( - "Unexpected value field {0}. Expected: {1}. Received: {2}".format( - field_name, expected_val, actual_val - ) - ) + print("Unexpected value field {0}. Expected: {1}. Received: {2}".format(field_name, expected_val, actual_val)) return False return True @@ -207,20 +151,12 @@ def __init__(self, expected_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_type, type(actual) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) return False return _compare_ctype_structs(self.expected_value, actual) def __repr__(self): - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_type), - pp.pformat(self.expected_value), - ) + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_type), pp.pformat(self.expected_value)) class CustomTypeBufferMatcher(object): @@ -232,48 +168,30 @@ def __init__(self, expected_element_type, expected_value): def __eq__(self, actual): if not isinstance(actual, self.expected_type): - print( - "Unexpected array type. Expected: {0}. Received: {1}".format( - self.expected_type, type(actual) - ) - ) + print("Unexpected array type. Expected: {0}. Received: {1}".format(self.expected_type, type(actual))) return False if self.expected_size != len(actual): - print( - "Unexpected length. Expected: {0}. Received: {1}".format( - self.expected_size, len(actual) - ) - ) + print("Unexpected length. Expected: {0}. Received: {1}".format(self.expected_size, len(actual))) return False if self.expected_value is not None: # Can't compare the objects directly because they're different types (one is list, another is ctypes array). # Go element by element, which allows for reporting the first index where different values were found. for a, e in zip(actual, self.expected_value): if not isinstance(a, self.expected_element_type): - print( - "Unexpected type. Expected: {0}. Received: {1}".format( - self.expected_element_type, type(a) - ) - ) + print("Unexpected type. Expected: {0}. Received: {1}".format(self.expected_element_type, type(a))) return False if not _compare_ctype_structs(e, a): return False return True def __repr__(self): - expected_val_repr = ( - "[" + ", ".join([x.__repr__() for x in self.expected_value]) + "]" - ) - return "{0}({1}, {2})".format( - self.__class__.__name__, - pp.pformat(self.expected_element_type), - expected_val_repr, - ) + expected_val_repr = '[' + ', '.join([x.__repr__() for x in self.expected_value]) + ']' + return '{0}({1}, {2})'.format(self.__class__.__name__, pp.pformat(self.expected_element_type), expected_val_repr) def __str__(self): - ret_str = self.__repr__() + "\n" - ret_str += " expected_type = " + str(self.expected_type) + "\n" - ret_str += " expected_size = " + str(self.expected_size) + "\n" + ret_str = self.__repr__() + '\n' + ret_str += ' expected_type = ' + str(self.expected_type) + '\n' + ret_str += ' expected_size = ' + str(self.expected_size) + '\n' return ret_str @@ -282,9 +200,7 @@ def __str__(self): class ViBooleanMatcher(_ScalarMatcher): def __init__(self, expected_value): - _ScalarMatcher.__init__( - self, _visatype.ViBoolean, 1 if expected_value is True else 0 - ) + _ScalarMatcher.__init__(self, _visatype.ViBoolean, 1 if expected_value is True else 0) class ViSessionMatcher(_ScalarMatcher): @@ -396,3 +312,6 @@ def __init__(self, expected_size_or_value): class ViSessionBufferMatcher(_BufferMatcher): def __init__(self, expected_size_or_value): _BufferMatcher.__init__(self, _visatype.ViSession, expected_size_or_value) + + + diff --git a/generated/nitclk/nitclk/unit_tests/_mock_helper.py b/generated/nitclk/nitclk/unit_tests/_mock_helper.py index 3973b3f11..754c1a98e 100644 --- a/generated/nitclk/nitclk/unit_tests/_mock_helper.py +++ b/generated/nitclk/nitclk/unit_tests/_mock_helper.py @@ -16,41 +16,41 @@ def __init__(self, function, param=None): class SideEffectsHelper(object): def __init__(self): self._defaults = {} - self._defaults["ConfigureForHomogeneousTriggers"] = {} - self._defaults["ConfigureForHomogeneousTriggers"]["return"] = 0 - self._defaults["FinishSyncPulseSenderSynchronize"] = {} - self._defaults["FinishSyncPulseSenderSynchronize"]["return"] = 0 - self._defaults["GetAttributeViReal64"] = {} - self._defaults["GetAttributeViReal64"]["return"] = 0 - self._defaults["GetAttributeViReal64"]["value"] = None - self._defaults["GetAttributeViSession"] = {} - self._defaults["GetAttributeViSession"]["return"] = 0 - self._defaults["GetAttributeViSession"]["value"] = None - self._defaults["GetAttributeViString"] = {} - self._defaults["GetAttributeViString"]["return"] = 0 - self._defaults["GetAttributeViString"]["value"] = None - self._defaults["GetExtendedErrorInfo"] = {} - self._defaults["GetExtendedErrorInfo"]["return"] = 0 - self._defaults["GetExtendedErrorInfo"]["errorString"] = None - self._defaults["Initiate"] = {} - self._defaults["Initiate"]["return"] = 0 - self._defaults["IsDone"] = {} - self._defaults["IsDone"]["return"] = 0 - self._defaults["IsDone"]["done"] = None - self._defaults["SetAttributeViReal64"] = {} - self._defaults["SetAttributeViReal64"]["return"] = 0 - self._defaults["SetAttributeViSession"] = {} - self._defaults["SetAttributeViSession"]["return"] = 0 - self._defaults["SetAttributeViString"] = {} - self._defaults["SetAttributeViString"]["return"] = 0 - self._defaults["SetupForSyncPulseSenderSynchronize"] = {} - self._defaults["SetupForSyncPulseSenderSynchronize"]["return"] = 0 - self._defaults["Synchronize"] = {} - self._defaults["Synchronize"]["return"] = 0 - self._defaults["SynchronizeToSyncPulseSender"] = {} - self._defaults["SynchronizeToSyncPulseSender"]["return"] = 0 - self._defaults["WaitUntilDone"] = {} - self._defaults["WaitUntilDone"]["return"] = 0 + self._defaults['ConfigureForHomogeneousTriggers'] = {} + self._defaults['ConfigureForHomogeneousTriggers']['return'] = 0 + self._defaults['FinishSyncPulseSenderSynchronize'] = {} + self._defaults['FinishSyncPulseSenderSynchronize']['return'] = 0 + self._defaults['GetAttributeViReal64'] = {} + self._defaults['GetAttributeViReal64']['return'] = 0 + self._defaults['GetAttributeViReal64']['value'] = None + self._defaults['GetAttributeViSession'] = {} + self._defaults['GetAttributeViSession']['return'] = 0 + self._defaults['GetAttributeViSession']['value'] = None + self._defaults['GetAttributeViString'] = {} + self._defaults['GetAttributeViString']['return'] = 0 + self._defaults['GetAttributeViString']['value'] = None + self._defaults['GetExtendedErrorInfo'] = {} + self._defaults['GetExtendedErrorInfo']['return'] = 0 + self._defaults['GetExtendedErrorInfo']['errorString'] = None + self._defaults['Initiate'] = {} + self._defaults['Initiate']['return'] = 0 + self._defaults['IsDone'] = {} + self._defaults['IsDone']['return'] = 0 + self._defaults['IsDone']['done'] = None + self._defaults['SetAttributeViReal64'] = {} + self._defaults['SetAttributeViReal64']['return'] = 0 + self._defaults['SetAttributeViSession'] = {} + self._defaults['SetAttributeViSession']['return'] = 0 + self._defaults['SetAttributeViString'] = {} + self._defaults['SetAttributeViString']['return'] = 0 + self._defaults['SetupForSyncPulseSenderSynchronize'] = {} + self._defaults['SetupForSyncPulseSenderSynchronize']['return'] = 0 + self._defaults['Synchronize'] = {} + self._defaults['Synchronize']['return'] = 0 + self._defaults['SynchronizeToSyncPulseSender'] = {} + self._defaults['SynchronizeToSyncPulseSender']['return'] = 0 + self._defaults['WaitUntilDone'] = {} + self._defaults['WaitUntilDone']['return'] = 0 def __getitem__(self, func): return self._defaults[func] @@ -58,191 +58,135 @@ def __getitem__(self, func): def __setitem__(self, func, val): self._defaults[func] = val - def niTClk_ConfigureForHomogeneousTriggers( - self, session_count, sessions - ): # noqa: N802 - if self._defaults["ConfigureForHomogeneousTriggers"]["return"] != 0: - return self._defaults["ConfigureForHomogeneousTriggers"]["return"] - return self._defaults["ConfigureForHomogeneousTriggers"]["return"] - - def niTClk_FinishSyncPulseSenderSynchronize( - self, session_count, sessions, min_time - ): # noqa: N802 - if self._defaults["FinishSyncPulseSenderSynchronize"]["return"] != 0: - return self._defaults["FinishSyncPulseSenderSynchronize"]["return"] - return self._defaults["FinishSyncPulseSenderSynchronize"]["return"] - - def niTClk_GetAttributeViReal64( - self, session, channel_name, attribute_id, value - ): # noqa: N802 - if self._defaults["GetAttributeViReal64"]["return"] != 0: - return self._defaults["GetAttributeViReal64"]["return"] + def niTClk_ConfigureForHomogeneousTriggers(self, session_count, sessions): # noqa: N802 + if self._defaults['ConfigureForHomogeneousTriggers']['return'] != 0: + return self._defaults['ConfigureForHomogeneousTriggers']['return'] + return self._defaults['ConfigureForHomogeneousTriggers']['return'] + + def niTClk_FinishSyncPulseSenderSynchronize(self, session_count, sessions, min_time): # noqa: N802 + if self._defaults['FinishSyncPulseSenderSynchronize']['return'] != 0: + return self._defaults['FinishSyncPulseSenderSynchronize']['return'] + return self._defaults['FinishSyncPulseSenderSynchronize']['return'] + + def niTClk_GetAttributeViReal64(self, session, channel_name, attribute_id, value): # noqa: N802 + if self._defaults['GetAttributeViReal64']['return'] != 0: + return self._defaults['GetAttributeViReal64']['return'] # value - if self._defaults["GetAttributeViReal64"]["value"] is None: - raise MockFunctionCallError("niTClk_GetAttributeViReal64", param="value") + if self._defaults['GetAttributeViReal64']['value'] is None: + raise MockFunctionCallError("niTClk_GetAttributeViReal64", param='value') if value is not None: - value.contents.value = self._defaults["GetAttributeViReal64"]["value"] - return self._defaults["GetAttributeViReal64"]["return"] - - def niTClk_GetAttributeViSession( - self, session, channel_name, attribute_id, value - ): # noqa: N802 - if self._defaults["GetAttributeViSession"]["return"] != 0: - return self._defaults["GetAttributeViSession"]["return"] + value.contents.value = self._defaults['GetAttributeViReal64']['value'] + return self._defaults['GetAttributeViReal64']['return'] + + def niTClk_GetAttributeViSession(self, session, channel_name, attribute_id, value): # noqa: N802 + if self._defaults['GetAttributeViSession']['return'] != 0: + return self._defaults['GetAttributeViSession']['return'] # value - if self._defaults["GetAttributeViSession"]["value"] is None: - raise MockFunctionCallError("niTClk_GetAttributeViSession", param="value") + if self._defaults['GetAttributeViSession']['value'] is None: + raise MockFunctionCallError("niTClk_GetAttributeViSession", param='value') if value is not None: - value.contents.value = self._defaults["GetAttributeViSession"]["value"] - return self._defaults["GetAttributeViSession"]["return"] - - def niTClk_GetAttributeViString( - self, session, channel_name, attribute_id, buf_size, value - ): # noqa: N802 - if self._defaults["GetAttributeViString"]["return"] != 0: - return self._defaults["GetAttributeViString"]["return"] - if self._defaults["GetAttributeViString"]["value"] is None: - raise MockFunctionCallError("niTClk_GetAttributeViString", param="value") + value.contents.value = self._defaults['GetAttributeViSession']['value'] + return self._defaults['GetAttributeViSession']['return'] + + def niTClk_GetAttributeViString(self, session, channel_name, attribute_id, buf_size, value): # noqa: N802 + if self._defaults['GetAttributeViString']['return'] != 0: + return self._defaults['GetAttributeViString']['return'] + if self._defaults['GetAttributeViString']['value'] is None: + raise MockFunctionCallError("niTClk_GetAttributeViString", param='value') if buf_size.value == 0: - return len(self._defaults["GetAttributeViString"]["value"]) - value.value = self._defaults["GetAttributeViString"]["value"].encode("ascii") - return self._defaults["GetAttributeViString"]["return"] - - def niTClk_GetExtendedErrorInfo( - self, error_string, error_string_size - ): # noqa: N802 - if self._defaults["GetExtendedErrorInfo"]["return"] != 0: - return self._defaults["GetExtendedErrorInfo"]["return"] - if self._defaults["GetExtendedErrorInfo"]["errorString"] is None: - raise MockFunctionCallError( - "niTClk_GetExtendedErrorInfo", param="errorString" - ) + return len(self._defaults['GetAttributeViString']['value']) + value.value = self._defaults['GetAttributeViString']['value'].encode('ascii') + return self._defaults['GetAttributeViString']['return'] + + def niTClk_GetExtendedErrorInfo(self, error_string, error_string_size): # noqa: N802 + if self._defaults['GetExtendedErrorInfo']['return'] != 0: + return self._defaults['GetExtendedErrorInfo']['return'] + if self._defaults['GetExtendedErrorInfo']['errorString'] is None: + raise MockFunctionCallError("niTClk_GetExtendedErrorInfo", param='errorString') if error_string_size.value == 0: - return len(self._defaults["GetExtendedErrorInfo"]["errorString"]) - error_string.value = self._defaults["GetExtendedErrorInfo"][ - "errorString" - ].encode("ascii") - return self._defaults["GetExtendedErrorInfo"]["return"] + return len(self._defaults['GetExtendedErrorInfo']['errorString']) + error_string.value = self._defaults['GetExtendedErrorInfo']['errorString'].encode('ascii') + return self._defaults['GetExtendedErrorInfo']['return'] def niTClk_Initiate(self, session_count, sessions): # noqa: N802 - if self._defaults["Initiate"]["return"] != 0: - return self._defaults["Initiate"]["return"] - return self._defaults["Initiate"]["return"] + if self._defaults['Initiate']['return'] != 0: + return self._defaults['Initiate']['return'] + return self._defaults['Initiate']['return'] def niTClk_IsDone(self, session_count, sessions, done): # noqa: N802 - if self._defaults["IsDone"]["return"] != 0: - return self._defaults["IsDone"]["return"] + if self._defaults['IsDone']['return'] != 0: + return self._defaults['IsDone']['return'] # done - if self._defaults["IsDone"]["done"] is None: - raise MockFunctionCallError("niTClk_IsDone", param="done") + if self._defaults['IsDone']['done'] is None: + raise MockFunctionCallError("niTClk_IsDone", param='done') if done is not None: - done.contents.value = self._defaults["IsDone"]["done"] - return self._defaults["IsDone"]["return"] - - def niTClk_SetAttributeViReal64( - self, session, channel_name, attribute_id, value - ): # noqa: N802 - if self._defaults["SetAttributeViReal64"]["return"] != 0: - return self._defaults["SetAttributeViReal64"]["return"] - return self._defaults["SetAttributeViReal64"]["return"] - - def niTClk_SetAttributeViSession( - self, session, channel_name, attribute_id, value - ): # noqa: N802 - if self._defaults["SetAttributeViSession"]["return"] != 0: - return self._defaults["SetAttributeViSession"]["return"] - return self._defaults["SetAttributeViSession"]["return"] - - def niTClk_SetAttributeViString( - self, session, channel_name, attribute_id, value - ): # noqa: N802 - if self._defaults["SetAttributeViString"]["return"] != 0: - return self._defaults["SetAttributeViString"]["return"] - return self._defaults["SetAttributeViString"]["return"] - - def niTClk_SetupForSyncPulseSenderSynchronize( - self, session_count, sessions, min_time - ): # noqa: N802 - if self._defaults["SetupForSyncPulseSenderSynchronize"]["return"] != 0: - return self._defaults["SetupForSyncPulseSenderSynchronize"]["return"] - return self._defaults["SetupForSyncPulseSenderSynchronize"]["return"] - - def niTClk_Synchronize( - self, session_count, sessions, min_tclk_period - ): # noqa: N802 - if self._defaults["Synchronize"]["return"] != 0: - return self._defaults["Synchronize"]["return"] - return self._defaults["Synchronize"]["return"] - - def niTClk_SynchronizeToSyncPulseSender( - self, session_count, sessions, min_time - ): # noqa: N802 - if self._defaults["SynchronizeToSyncPulseSender"]["return"] != 0: - return self._defaults["SynchronizeToSyncPulseSender"]["return"] - return self._defaults["SynchronizeToSyncPulseSender"]["return"] + done.contents.value = self._defaults['IsDone']['done'] + return self._defaults['IsDone']['return'] + + def niTClk_SetAttributeViReal64(self, session, channel_name, attribute_id, value): # noqa: N802 + if self._defaults['SetAttributeViReal64']['return'] != 0: + return self._defaults['SetAttributeViReal64']['return'] + return self._defaults['SetAttributeViReal64']['return'] + + def niTClk_SetAttributeViSession(self, session, channel_name, attribute_id, value): # noqa: N802 + if self._defaults['SetAttributeViSession']['return'] != 0: + return self._defaults['SetAttributeViSession']['return'] + return self._defaults['SetAttributeViSession']['return'] + + def niTClk_SetAttributeViString(self, session, channel_name, attribute_id, value): # noqa: N802 + if self._defaults['SetAttributeViString']['return'] != 0: + return self._defaults['SetAttributeViString']['return'] + return self._defaults['SetAttributeViString']['return'] + + def niTClk_SetupForSyncPulseSenderSynchronize(self, session_count, sessions, min_time): # noqa: N802 + if self._defaults['SetupForSyncPulseSenderSynchronize']['return'] != 0: + return self._defaults['SetupForSyncPulseSenderSynchronize']['return'] + return self._defaults['SetupForSyncPulseSenderSynchronize']['return'] + + def niTClk_Synchronize(self, session_count, sessions, min_tclk_period): # noqa: N802 + if self._defaults['Synchronize']['return'] != 0: + return self._defaults['Synchronize']['return'] + return self._defaults['Synchronize']['return'] + + def niTClk_SynchronizeToSyncPulseSender(self, session_count, sessions, min_time): # noqa: N802 + if self._defaults['SynchronizeToSyncPulseSender']['return'] != 0: + return self._defaults['SynchronizeToSyncPulseSender']['return'] + return self._defaults['SynchronizeToSyncPulseSender']['return'] def niTClk_WaitUntilDone(self, session_count, sessions, timeout): # noqa: N802 - if self._defaults["WaitUntilDone"]["return"] != 0: - return self._defaults["WaitUntilDone"]["return"] - return self._defaults["WaitUntilDone"]["return"] + if self._defaults['WaitUntilDone']['return'] != 0: + return self._defaults['WaitUntilDone']['return'] + return self._defaults['WaitUntilDone']['return'] # Helper function to setup Mock object with default side effects and return values def set_side_effects_and_return_values(self, mock_library): - mock_library.niTClk_ConfigureForHomogeneousTriggers.side_effect = ( - MockFunctionCallError("niTClk_ConfigureForHomogeneousTriggers") - ) + mock_library.niTClk_ConfigureForHomogeneousTriggers.side_effect = MockFunctionCallError("niTClk_ConfigureForHomogeneousTriggers") mock_library.niTClk_ConfigureForHomogeneousTriggers.return_value = 0 - mock_library.niTClk_FinishSyncPulseSenderSynchronize.side_effect = ( - MockFunctionCallError("niTClk_FinishSyncPulseSenderSynchronize") - ) + mock_library.niTClk_FinishSyncPulseSenderSynchronize.side_effect = MockFunctionCallError("niTClk_FinishSyncPulseSenderSynchronize") mock_library.niTClk_FinishSyncPulseSenderSynchronize.return_value = 0 - mock_library.niTClk_GetAttributeViReal64.side_effect = MockFunctionCallError( - "niTClk_GetAttributeViReal64" - ) + mock_library.niTClk_GetAttributeViReal64.side_effect = MockFunctionCallError("niTClk_GetAttributeViReal64") mock_library.niTClk_GetAttributeViReal64.return_value = 0 - mock_library.niTClk_GetAttributeViSession.side_effect = MockFunctionCallError( - "niTClk_GetAttributeViSession" - ) + mock_library.niTClk_GetAttributeViSession.side_effect = MockFunctionCallError("niTClk_GetAttributeViSession") mock_library.niTClk_GetAttributeViSession.return_value = 0 - mock_library.niTClk_GetAttributeViString.side_effect = MockFunctionCallError( - "niTClk_GetAttributeViString" - ) + mock_library.niTClk_GetAttributeViString.side_effect = MockFunctionCallError("niTClk_GetAttributeViString") mock_library.niTClk_GetAttributeViString.return_value = 0 - mock_library.niTClk_GetExtendedErrorInfo.side_effect = MockFunctionCallError( - "niTClk_GetExtendedErrorInfo" - ) + mock_library.niTClk_GetExtendedErrorInfo.side_effect = MockFunctionCallError("niTClk_GetExtendedErrorInfo") mock_library.niTClk_GetExtendedErrorInfo.return_value = 0 - mock_library.niTClk_Initiate.side_effect = MockFunctionCallError( - "niTClk_Initiate" - ) + mock_library.niTClk_Initiate.side_effect = MockFunctionCallError("niTClk_Initiate") mock_library.niTClk_Initiate.return_value = 0 mock_library.niTClk_IsDone.side_effect = MockFunctionCallError("niTClk_IsDone") mock_library.niTClk_IsDone.return_value = 0 - mock_library.niTClk_SetAttributeViReal64.side_effect = MockFunctionCallError( - "niTClk_SetAttributeViReal64" - ) + mock_library.niTClk_SetAttributeViReal64.side_effect = MockFunctionCallError("niTClk_SetAttributeViReal64") mock_library.niTClk_SetAttributeViReal64.return_value = 0 - mock_library.niTClk_SetAttributeViSession.side_effect = MockFunctionCallError( - "niTClk_SetAttributeViSession" - ) + mock_library.niTClk_SetAttributeViSession.side_effect = MockFunctionCallError("niTClk_SetAttributeViSession") mock_library.niTClk_SetAttributeViSession.return_value = 0 - mock_library.niTClk_SetAttributeViString.side_effect = MockFunctionCallError( - "niTClk_SetAttributeViString" - ) + mock_library.niTClk_SetAttributeViString.side_effect = MockFunctionCallError("niTClk_SetAttributeViString") mock_library.niTClk_SetAttributeViString.return_value = 0 - mock_library.niTClk_SetupForSyncPulseSenderSynchronize.side_effect = ( - MockFunctionCallError("niTClk_SetupForSyncPulseSenderSynchronize") - ) + mock_library.niTClk_SetupForSyncPulseSenderSynchronize.side_effect = MockFunctionCallError("niTClk_SetupForSyncPulseSenderSynchronize") mock_library.niTClk_SetupForSyncPulseSenderSynchronize.return_value = 0 - mock_library.niTClk_Synchronize.side_effect = MockFunctionCallError( - "niTClk_Synchronize" - ) + mock_library.niTClk_Synchronize.side_effect = MockFunctionCallError("niTClk_Synchronize") mock_library.niTClk_Synchronize.return_value = 0 - mock_library.niTClk_SynchronizeToSyncPulseSender.side_effect = ( - MockFunctionCallError("niTClk_SynchronizeToSyncPulseSender") - ) + mock_library.niTClk_SynchronizeToSyncPulseSender.side_effect = MockFunctionCallError("niTClk_SynchronizeToSyncPulseSender") mock_library.niTClk_SynchronizeToSyncPulseSender.return_value = 0 - mock_library.niTClk_WaitUntilDone.side_effect = MockFunctionCallError( - "niTClk_WaitUntilDone" - ) + mock_library.niTClk_WaitUntilDone.side_effect = MockFunctionCallError("niTClk_WaitUntilDone") mock_library.niTClk_WaitUntilDone.return_value = 0 diff --git a/generated/nitclk/nitclk/unit_tests/test_nitclk.py b/generated/nitclk/nitclk/unit_tests/test_nitclk.py index 6ff70e222..43fd96140 100644 --- a/generated/nitclk/nitclk/unit_tests/test_nitclk.py +++ b/generated/nitclk/nitclk/unit_tests/test_nitclk.py @@ -9,38 +9,28 @@ SESSION_NUM_FOR_TEST = 42 single_session = [SESSION_NUM_FOR_TEST] single_session_reference = [nitclk.SessionReference(x) for x in single_session] -multiple_sessions = [ - SESSION_NUM_FOR_TEST, - SESSION_NUM_FOR_TEST * 10, - SESSION_NUM_FOR_TEST * 100, - SESSION_NUM_FOR_TEST + 1, -] +multiple_sessions = [SESSION_NUM_FOR_TEST, SESSION_NUM_FOR_TEST * 10, SESSION_NUM_FOR_TEST * 100, SESSION_NUM_FOR_TEST + 1] multiple_session_references = [nitclk.SessionReference(x) for x in multiple_sessions] class NitclkSupportingDriverSession(object): - """Session objects for drivers that support NI-TClk are expected to have a property of type nitclk.SessionReference called tclk + '''Session objects for drivers that support NI-TClk are expected to have a property of type nitclk.SessionReference called tclk This is why we're creating this fake driver class and adding the tclk property. - """ - + ''' def __init__(self, session_number): self.tclk = nitclk.SessionReference(session_number) class TestNitclkApi(object): def setup_method(self, method): - self.patched_library_patcher = patch("nitclk._library.Library", autospec=True) + self.patched_library_patcher = patch('nitclk._library.Library', autospec=True) self.patched_library = self.patched_library_patcher.start() - self.patched_library_singleton_get = patch( - "nitclk.session._library_singleton.get", return_value=self.patched_library - ) + self.patched_library_singleton_get = patch('nitclk.session._library_singleton.get', return_value=self.patched_library) self.patched_library_singleton_get.start() self.side_effects_helper = _mock_helper.SideEffectsHelper() - self.side_effects_helper.set_side_effects_and_return_values( - self.patched_library - ) + self.side_effects_helper.set_side_effects_and_return_values(self.patched_library) def teardown_method(self, method): self.patched_library_singleton_get.stop() @@ -49,148 +39,83 @@ def teardown_method(self, method): # API Tests def test_initialize_one_session(self): - self.patched_library.niTClk_Initiate.side_effect = ( - self.side_effects_helper.niTClk_Initiate - ) + self.patched_library.niTClk_Initiate.side_effect = self.side_effects_helper.niTClk_Initiate nitclk.initiate(single_session_reference) - self.patched_library.niTClk_Initiate.assert_called_once_with( - _matchers.ViUInt32Matcher(len(single_session)), - _matchers.ViSessionBufferMatcher(single_session), - ) + self.patched_library.niTClk_Initiate.assert_called_once_with(_matchers.ViUInt32Matcher(len(single_session)), _matchers.ViSessionBufferMatcher(single_session)) return def test_initialize_multiple_sessions(self): - self.patched_library.niTClk_Initiate.side_effect = ( - self.side_effects_helper.niTClk_Initiate - ) + self.patched_library.niTClk_Initiate.side_effect = self.side_effects_helper.niTClk_Initiate nitclk.initiate(multiple_session_references) - self.patched_library.niTClk_Initiate.assert_called_once_with( - _matchers.ViUInt32Matcher(len(multiple_sessions)), - _matchers.ViSessionBufferMatcher(multiple_sessions), - ) + self.patched_library.niTClk_Initiate.assert_called_once_with(_matchers.ViUInt32Matcher(len(multiple_sessions)), _matchers.ViSessionBufferMatcher(multiple_sessions)) return def test_configure_for_homogeneous_triggers(self): - self.patched_library.niTClk_ConfigureForHomogeneousTriggers.side_effect = ( - self.side_effects_helper.niTClk_ConfigureForHomogeneousTriggers - ) + self.patched_library.niTClk_ConfigureForHomogeneousTriggers.side_effect = self.side_effects_helper.niTClk_ConfigureForHomogeneousTriggers nitclk.configure_for_homogeneous_triggers(multiple_session_references) - self.patched_library.niTClk_ConfigureForHomogeneousTriggers.assert_called_once_with( - _matchers.ViUInt32Matcher(len(multiple_sessions)), - _matchers.ViSessionBufferMatcher(multiple_sessions), - ) + self.patched_library.niTClk_ConfigureForHomogeneousTriggers.assert_called_once_with(_matchers.ViUInt32Matcher(len(multiple_sessions)), _matchers.ViSessionBufferMatcher(multiple_sessions)) return def test_finish_sync_pulse_sender_synchronize(self): min_time = 0.042 - self.patched_library.niTClk_FinishSyncPulseSenderSynchronize.side_effect = ( - self.side_effects_helper.niTClk_FinishSyncPulseSenderSynchronize - ) - nitclk.finish_sync_pulse_sender_synchronize( - multiple_session_references, min_time - ) - self.patched_library.niTClk_FinishSyncPulseSenderSynchronize.assert_called_once_with( - _matchers.ViUInt32Matcher(len(multiple_sessions)), - _matchers.ViSessionBufferMatcher(multiple_sessions), - _matchers.ViReal64Matcher(min_time), - ) + self.patched_library.niTClk_FinishSyncPulseSenderSynchronize.side_effect = self.side_effects_helper.niTClk_FinishSyncPulseSenderSynchronize + nitclk.finish_sync_pulse_sender_synchronize(multiple_session_references, min_time) + self.patched_library.niTClk_FinishSyncPulseSenderSynchronize.assert_called_once_with(_matchers.ViUInt32Matcher(len(multiple_sessions)), _matchers.ViSessionBufferMatcher(multiple_sessions), _matchers.ViReal64Matcher(min_time)) return def test_is_done(self): expected_result = True - self.side_effects_helper["IsDone"]["done"] = expected_result + self.side_effects_helper['IsDone']['done'] = expected_result - self.patched_library.niTClk_IsDone.side_effect = ( - self.side_effects_helper.niTClk_IsDone - ) + self.patched_library.niTClk_IsDone.side_effect = self.side_effects_helper.niTClk_IsDone actual_result = nitclk.is_done(multiple_session_references) assert actual_result == expected_result - self.patched_library.niTClk_IsDone.assert_called_once_with( - _matchers.ViUInt32Matcher(len(multiple_sessions)), - _matchers.ViSessionBufferMatcher(multiple_sessions), - _matchers.ViBooleanPointerMatcher(), - ) + self.patched_library.niTClk_IsDone.assert_called_once_with(_matchers.ViUInt32Matcher(len(multiple_sessions)), _matchers.ViSessionBufferMatcher(multiple_sessions), _matchers.ViBooleanPointerMatcher()) return def test_setup_for_sync_pulse_sender_synchronize(self): min_time = 0.042 - self.patched_library.niTClk_SetupForSyncPulseSenderSynchronize.side_effect = ( - self.side_effects_helper.niTClk_SetupForSyncPulseSenderSynchronize - ) - nitclk.setup_for_sync_pulse_sender_synchronize( - multiple_session_references, min_time - ) - self.patched_library.niTClk_SetupForSyncPulseSenderSynchronize.assert_called_once_with( - _matchers.ViUInt32Matcher(len(multiple_sessions)), - _matchers.ViSessionBufferMatcher(multiple_sessions), - _matchers.ViReal64Matcher(min_time), - ) + self.patched_library.niTClk_SetupForSyncPulseSenderSynchronize.side_effect = self.side_effects_helper.niTClk_SetupForSyncPulseSenderSynchronize + nitclk.setup_for_sync_pulse_sender_synchronize(multiple_session_references, min_time) + self.patched_library.niTClk_SetupForSyncPulseSenderSynchronize.assert_called_once_with(_matchers.ViUInt32Matcher(len(multiple_sessions)), _matchers.ViSessionBufferMatcher(multiple_sessions), _matchers.ViReal64Matcher(min_time)) return def test_synchronize(self): min_time = 0.042 - self.patched_library.niTClk_Synchronize.side_effect = ( - self.side_effects_helper.niTClk_Synchronize - ) + self.patched_library.niTClk_Synchronize.side_effect = self.side_effects_helper.niTClk_Synchronize nitclk.synchronize(multiple_session_references, min_time) - self.patched_library.niTClk_Synchronize.assert_called_once_with( - _matchers.ViUInt32Matcher(len(multiple_sessions)), - _matchers.ViSessionBufferMatcher(multiple_sessions), - _matchers.ViReal64Matcher(min_time), - ) + self.patched_library.niTClk_Synchronize.assert_called_once_with(_matchers.ViUInt32Matcher(len(multiple_sessions)), _matchers.ViSessionBufferMatcher(multiple_sessions), _matchers.ViReal64Matcher(min_time)) return def test_synchronize_timedelta(self): min_time = hightime.timedelta(seconds=0.042) - self.patched_library.niTClk_Synchronize.side_effect = ( - self.side_effects_helper.niTClk_Synchronize - ) + self.patched_library.niTClk_Synchronize.side_effect = self.side_effects_helper.niTClk_Synchronize nitclk.synchronize(multiple_session_references, min_time) - self.patched_library.niTClk_Synchronize.assert_called_once_with( - _matchers.ViUInt32Matcher(len(multiple_sessions)), - _matchers.ViSessionBufferMatcher(multiple_sessions), - _matchers.ViReal64Matcher(min_time.total_seconds()), - ) + self.patched_library.niTClk_Synchronize.assert_called_once_with(_matchers.ViUInt32Matcher(len(multiple_sessions)), _matchers.ViSessionBufferMatcher(multiple_sessions), _matchers.ViReal64Matcher(min_time.total_seconds())) return def test_synchronize_to_sync_pulse_sender(self): min_time = 0.042 - self.patched_library.niTClk_SynchronizeToSyncPulseSender.side_effect = ( - self.side_effects_helper.niTClk_SynchronizeToSyncPulseSender - ) + self.patched_library.niTClk_SynchronizeToSyncPulseSender.side_effect = self.side_effects_helper.niTClk_SynchronizeToSyncPulseSender nitclk.synchronize_to_sync_pulse_sender(multiple_session_references, min_time) - self.patched_library.niTClk_SynchronizeToSyncPulseSender.assert_called_once_with( - _matchers.ViUInt32Matcher(len(multiple_sessions)), - _matchers.ViSessionBufferMatcher(multiple_sessions), - _matchers.ViReal64Matcher(min_time), - ) + self.patched_library.niTClk_SynchronizeToSyncPulseSender.assert_called_once_with(_matchers.ViUInt32Matcher(len(multiple_sessions)), _matchers.ViSessionBufferMatcher(multiple_sessions), _matchers.ViReal64Matcher(min_time)) return def test_wait_until_done(self): min_time = 4.2 - self.patched_library.niTClk_WaitUntilDone.side_effect = ( - self.side_effects_helper.niTClk_WaitUntilDone - ) + self.patched_library.niTClk_WaitUntilDone.side_effect = self.side_effects_helper.niTClk_WaitUntilDone nitclk.wait_until_done(multiple_session_references, min_time) - self.patched_library.niTClk_WaitUntilDone.assert_called_once_with( - _matchers.ViUInt32Matcher(len(multiple_sessions)), - _matchers.ViSessionBufferMatcher(multiple_sessions), - _matchers.ViReal64Matcher(min_time), - ) + self.patched_library.niTClk_WaitUntilDone.assert_called_once_with(_matchers.ViUInt32Matcher(len(multiple_sessions)), _matchers.ViSessionBufferMatcher(multiple_sessions), _matchers.ViReal64Matcher(min_time)) return # API error handling def test_api_error(self): - error_string = "Error" - self.patched_library.niTClk_Synchronize.side_effect = ( - self.side_effects_helper.niTClk_Synchronize - ) - self.side_effects_helper["Synchronize"]["return"] = -1 - self.patched_library.niTClk_GetExtendedErrorInfo.side_effect = ( - self.side_effects_helper.niTClk_GetExtendedErrorInfo - ) - self.side_effects_helper["GetExtendedErrorInfo"]["errorString"] = error_string + error_string = 'Error' + self.patched_library.niTClk_Synchronize.side_effect = self.side_effects_helper.niTClk_Synchronize + self.side_effects_helper['Synchronize']['return'] = -1 + self.patched_library.niTClk_GetExtendedErrorInfo.side_effect = self.side_effects_helper.niTClk_GetExtendedErrorInfo + self.side_effects_helper['GetExtendedErrorInfo']['errorString'] = error_string try: nitclk.synchronize(multiple_session_references, 0.42) except nitclk.Error as e: @@ -198,35 +123,25 @@ def test_api_error(self): assert e.description == error_string def test_api_get_error_description_fails(self): - self.patched_library.niTClk_Synchronize.side_effect = ( - self.side_effects_helper.niTClk_Synchronize - ) - self.side_effects_helper["Synchronize"]["return"] = -1 - self.patched_library.niTClk_GetExtendedErrorInfo.side_effect = ( - self.side_effects_helper.niTClk_GetExtendedErrorInfo - ) - self.side_effects_helper["GetExtendedErrorInfo"]["return"] = -2 + self.patched_library.niTClk_Synchronize.side_effect = self.side_effects_helper.niTClk_Synchronize + self.side_effects_helper['Synchronize']['return'] = -1 + self.patched_library.niTClk_GetExtendedErrorInfo.side_effect = self.side_effects_helper.niTClk_GetExtendedErrorInfo + self.side_effects_helper['GetExtendedErrorInfo']['return'] = -2 try: nitclk.synchronize(multiple_session_references, 0.42) except nitclk.Error as e: - assert ( - e.code == -1 - ) # we want the original error code from getting the attribute. + assert e.code == -1 # we want the original error code from getting the attribute. assert e.description == "Failed to retrieve error description." # SessionReference error handling def test_session_reference_error(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - error_string = "Error" - self.patched_library.niTClk_GetAttributeViReal64.side_effect = ( - self.side_effects_helper.niTClk_GetAttributeViReal64 - ) - self.side_effects_helper["GetAttributeViReal64"]["return"] = -1 - self.patched_library.niTClk_GetExtendedErrorInfo.side_effect = ( - self.side_effects_helper.niTClk_GetExtendedErrorInfo - ) - self.side_effects_helper["GetExtendedErrorInfo"]["errorString"] = error_string + error_string = 'Error' + self.patched_library.niTClk_GetAttributeViReal64.side_effect = self.side_effects_helper.niTClk_GetAttributeViReal64 + self.side_effects_helper['GetAttributeViReal64']['return'] = -1 + self.patched_library.niTClk_GetExtendedErrorInfo.side_effect = self.side_effects_helper.niTClk_GetExtendedErrorInfo + self.side_effects_helper['GetExtendedErrorInfo']['errorString'] = error_string try: test = session.sample_clock_delay print(test) # Get rid of flake8 F841 @@ -237,158 +152,90 @@ def test_session_reference_error(self): def test_session_reference_get_error_description_fails(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_GetAttributeViReal64.side_effect = ( - self.side_effects_helper.niTClk_GetAttributeViReal64 - ) - self.side_effects_helper["GetAttributeViReal64"]["return"] = -1 - self.patched_library.niTClk_GetExtendedErrorInfo.side_effect = ( - self.side_effects_helper.niTClk_GetExtendedErrorInfo - ) - self.side_effects_helper["GetExtendedErrorInfo"]["return"] = -2 + self.patched_library.niTClk_GetAttributeViReal64.side_effect = self.side_effects_helper.niTClk_GetAttributeViReal64 + self.side_effects_helper['GetAttributeViReal64']['return'] = -1 + self.patched_library.niTClk_GetExtendedErrorInfo.side_effect = self.side_effects_helper.niTClk_GetExtendedErrorInfo + self.side_effects_helper['GetExtendedErrorInfo']['return'] = -2 try: test = session.sample_clock_delay print(test) # Get rid of flake8 F841 assert False except nitclk.Error as e: - assert ( - e.code == -1 - ) # we want the original error code from getting the attribute. + assert e.code == -1 # we want the original error code from getting the attribute. assert e.description == "Failed to retrieve error description." # Session Reference def test_set_vi_real64(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_SetAttributeViReal64.side_effect = ( - self.side_effects_helper.niTClk_SetAttributeViReal64 - ) + self.patched_library.niTClk_SetAttributeViReal64.side_effect = self.side_effects_helper.niTClk_SetAttributeViReal64 attribute_id = 8 test_number = 4.2 session.tclk_actual_period = test_number - self.patched_library.niTClk_SetAttributeViReal64.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViReal64Matcher(test_number), - ) + self.patched_library.niTClk_SetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64Matcher(test_number)) def test_get_vi_real64(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_GetAttributeViReal64.side_effect = ( - self.side_effects_helper.niTClk_GetAttributeViReal64 - ) + self.patched_library.niTClk_GetAttributeViReal64.side_effect = self.side_effects_helper.niTClk_GetAttributeViReal64 attribute_id = 8 test_number = 4.2 - self.side_effects_helper["GetAttributeViReal64"]["value"] = test_number + self.side_effects_helper['GetAttributeViReal64']['value'] = test_number attr_val = session.tclk_actual_period - assert attr_val == test_number - self.patched_library.niTClk_GetAttributeViReal64.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViReal64PointerMatcher(), - ) + assert(attr_val == test_number) + self.patched_library.niTClk_GetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64PointerMatcher()) def test_set_timedelta_as_vi_real64(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_SetAttributeViReal64.side_effect = ( - self.side_effects_helper.niTClk_SetAttributeViReal64 - ) + self.patched_library.niTClk_SetAttributeViReal64.side_effect = self.side_effects_helper.niTClk_SetAttributeViReal64 attribute_id = 11 test_number = 4.2 session.sample_clock_delay = test_number - self.patched_library.niTClk_SetAttributeViReal64.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViReal64Matcher(test_number), - ) + self.patched_library.niTClk_SetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64Matcher(test_number)) def test_set_timedelta_as_timedelta(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_SetAttributeViReal64.side_effect = ( - self.side_effects_helper.niTClk_SetAttributeViReal64 - ) + self.patched_library.niTClk_SetAttributeViReal64.side_effect = self.side_effects_helper.niTClk_SetAttributeViReal64 attribute_id = 11 test_number = 4.2 session.sample_clock_delay = hightime.timedelta(seconds=test_number) - self.patched_library.niTClk_SetAttributeViReal64.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViReal64Matcher(test_number), - ) + self.patched_library.niTClk_SetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64Matcher(test_number)) def test_get_timedelta(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_GetAttributeViReal64.side_effect = ( - self.side_effects_helper.niTClk_GetAttributeViReal64 - ) + self.patched_library.niTClk_GetAttributeViReal64.side_effect = self.side_effects_helper.niTClk_GetAttributeViReal64 attribute_id = 11 test_number = 4.2 - self.side_effects_helper["GetAttributeViReal64"]["value"] = test_number + self.side_effects_helper['GetAttributeViReal64']['value'] = test_number attr_timedelta = session.sample_clock_delay - assert attr_timedelta.total_seconds() == test_number - self.patched_library.niTClk_GetAttributeViReal64.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViReal64PointerMatcher(), - ) + assert(attr_timedelta.total_seconds() == test_number) + self.patched_library.niTClk_GetAttributeViReal64.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViReal64PointerMatcher()) def test_set_vi_string(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_SetAttributeViString.side_effect = ( - self.side_effects_helper.niTClk_SetAttributeViString - ) + self.patched_library.niTClk_SetAttributeViString.side_effect = self.side_effects_helper.niTClk_SetAttributeViString attribute_id = 13 test_string = "The answer to the ultimate question is 42" session.sync_pulse_sender_sync_pulse_source = test_string - self.patched_library.niTClk_SetAttributeViString.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViStringMatcher(test_string), - ) + self.patched_library.niTClk_SetAttributeViString.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViStringMatcher(test_string)) def test_get_vi_string(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_GetAttributeViString.side_effect = ( - self.side_effects_helper.niTClk_GetAttributeViString - ) + self.patched_library.niTClk_GetAttributeViString.side_effect = self.side_effects_helper.niTClk_GetAttributeViString attribute_id = 13 test_string = "The answer to the ultimate question is 42" - self.side_effects_helper["GetAttributeViString"]["value"] = test_string + self.side_effects_helper['GetAttributeViString']['value'] = test_string attr_string = session.sync_pulse_sender_sync_pulse_source - assert attr_string == test_string + assert(attr_string == test_string) from unittest.mock import call - - calls = [ - call( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViInt32Matcher(0), - None, - ), - call( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViInt32Matcher(len(test_string)), - _matchers.ViCharBufferMatcher(len(test_string)), - ), - ] + calls = [call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt32Matcher(0), None), call(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViInt32Matcher(len(test_string)), _matchers.ViCharBufferMatcher(len(test_string)))] self.patched_library.niTClk_GetAttributeViString.assert_has_calls(calls) assert self.patched_library.niTClk_GetAttributeViString.call_count == 2 # All ViInt32 attributes are really sessions references def test_set_vi_session_with_int(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_SetAttributeViSession.side_effect = ( - self.side_effects_helper.niTClk_SetAttributeViSession - ) + self.patched_library.niTClk_SetAttributeViSession.side_effect = self.side_effects_helper.niTClk_SetAttributeViSession other_session_number = 43 # We do not support using just the number try: @@ -399,54 +246,33 @@ def test_set_vi_session_with_int(self): def test_set_vi_session_with_session_reference(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_SetAttributeViSession.side_effect = ( - self.side_effects_helper.niTClk_SetAttributeViSession - ) + self.patched_library.niTClk_SetAttributeViSession.side_effect = self.side_effects_helper.niTClk_SetAttributeViSession attribute_id = 3 other_session_number = 43 other_session_reference = nitclk.SessionReference(other_session_number) session.start_trigger_master_session = other_session_reference - self.patched_library.niTClk_SetAttributeViSession.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViSessionMatcher(other_session_number), - ) + self.patched_library.niTClk_SetAttributeViSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViSessionMatcher(other_session_number)) def test_set_vi_session_with_session(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_SetAttributeViSession.side_effect = ( - self.side_effects_helper.niTClk_SetAttributeViSession - ) + self.patched_library.niTClk_SetAttributeViSession.side_effect = self.side_effects_helper.niTClk_SetAttributeViSession attribute_id = 3 other_session_number = 43 other_session = NitclkSupportingDriverSession(other_session_number) session.start_trigger_master_session = other_session - self.patched_library.niTClk_SetAttributeViSession.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViSessionMatcher(other_session_number), - ) + self.patched_library.niTClk_SetAttributeViSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViSessionMatcher(other_session_number)) def test_get_tclk_session_reference(self): session = nitclk.SessionReference(SESSION_NUM_FOR_TEST) - self.patched_library.niTClk_GetAttributeViSession.side_effect = ( - self.side_effects_helper.niTClk_GetAttributeViSession - ) + self.patched_library.niTClk_GetAttributeViSession.side_effect = self.side_effects_helper.niTClk_GetAttributeViSession attribute_id = 3 other_session_number = 43 - self.side_effects_helper["GetAttributeViSession"][ - "value" - ] = other_session_number + self.side_effects_helper['GetAttributeViSession']['value'] = other_session_number attr_session_reference = session.start_trigger_master_session assert type(attr_session_reference) is nitclk.SessionReference - assert ( - attr_session_reference._get_tclk_session_reference() == other_session_number - ) - self.patched_library.niTClk_GetAttributeViSession.assert_called_once_with( - _matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), - _matchers.ViStringMatcher(""), - _matchers.ViAttrMatcher(attribute_id), - _matchers.ViSessionPointerMatcher(), - ) + assert(attr_session_reference._get_tclk_session_reference() == other_session_number) + self.patched_library.niTClk_GetAttributeViSession.assert_called_once_with(_matchers.ViSessionMatcher(SESSION_NUM_FOR_TEST), _matchers.ViStringMatcher(''), _matchers.ViAttrMatcher(attribute_id), _matchers.ViSessionPointerMatcher()) + + + + diff --git a/generated/nitclk/setup.py b/generated/nitclk/setup.py index b638526ed..d73d4e363 100644 --- a/generated/nitclk/setup.py +++ b/generated/nitclk/setup.py @@ -15,44 +15,41 @@ def finalize_options(self): def run_tests(self): import pytest - pytest.main(self.test_args) -pypi_name = "nitclk" +pypi_name = 'nitclk' def read_contents(file_to_read): - with open(file_to_read, "r") as f: + with open(file_to_read, 'r') as f: return f.read() setup( name=pypi_name, zip_safe=True, - version="1.4.2.dev0", - description="NI-TClk Python API", - long_description=read_contents("README.rst"), - long_description_content_type="text/x-rst", - author="NI", + version='1.4.2.dev0', + description='NI-TClk Python API', + long_description=read_contents('README.rst'), + long_description_content_type='text/x-rst', + author='NI', author_email="opensource@ni.com", url="https://github.com/ni/nimi-python", maintainer="NI", maintainer_email="opensource@ni.com", - keywords=["nitclk"], - license="MIT", + keywords=['nitclk'], + license='MIT', include_package_data=True, - packages=["nitclk"], + packages=['nitclk'], install_requires=[ 'enum34;python_version<"3.4"', 'singledispatch;python_version<"3.4"', - "hightime>=0.2.0", - ], - setup_requires=[ - "pytest-runner", + 'hightime>=0.2.0', ], - tests_require=["pytest"], - test_suite="tests", + setup_requires=['pytest-runner', ], + tests_require=['pytest'], + test_suite='tests', classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -67,8 +64,8 @@ def read_contents(file_to_read): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", - "Topic :: System :: Hardware :: Hardware Drivers", + "Topic :: System :: Hardware :: Hardware Drivers" ], - cmdclass={"test": PyTest}, - package_data={pypi_name: ["VERSION"]}, + cmdclass={'test': PyTest}, + package_data={pypi_name: ['VERSION']}, ) From ddb9ff4ef5df2a8f35342a8456725a9791994b73 Mon Sep 17 00:00:00 2001 From: Marcos Kirsch Date: Wed, 13 Apr 2022 15:23:05 -0500 Subject: [PATCH 6/6] Update codegenerated files --- generated/nidcpower/nidcpower/__init__.py | 93 +++++++------ generated/nidcpower/nidcpower/_attributes.py | 54 +++++--- generated/nidcpower/nidcpower/_converters.py | 125 ++++++++++------- generated/nidigital/nidigital/__init__.py | 93 +++++++------ generated/nidigital/nidigital/_attributes.py | 54 +++++--- generated/nidigital/nidigital/_converters.py | 125 ++++++++++------- generated/nidmm/nidmm/__init__.py | 93 +++++++------ generated/nidmm/nidmm/_attributes.py | 54 +++++--- generated/nidmm/nidmm/_converters.py | 125 ++++++++++------- generated/nifake/nifake/__init__.py | 93 +++++++------ generated/nifake/nifake/_attributes.py | 54 +++++--- generated/nifake/nifake/_converters.py | 125 ++++++++++------- generated/nifgen/nifgen/__init__.py | 93 +++++++------ generated/nifgen/nifgen/_attributes.py | 54 +++++--- generated/nifgen/nifgen/_converters.py | 125 ++++++++++------- generated/nimodinst/nimodinst/__init__.py | 93 +++++++------ generated/nimodinst/nimodinst/_converters.py | 125 ++++++++++------- generated/niscope/niscope/__init__.py | 93 +++++++------ generated/niscope/niscope/_attributes.py | 54 +++++--- generated/niscope/niscope/_converters.py | 125 ++++++++++------- generated/nise/nise/__init__.py | 93 +++++++------ generated/nise/nise/_converters.py | 125 ++++++++++------- generated/niswitch/niswitch/__init__.py | 93 +++++++------ generated/niswitch/niswitch/_attributes.py | 54 +++++--- generated/niswitch/niswitch/_converters.py | 125 ++++++++++------- generated/nitclk/nitclk/__init__.py | 93 +++++++------ generated/nitclk/nitclk/_attributes.py | 54 +++++--- generated/nitclk/nitclk/_converters.py | 133 +++++++++++-------- 28 files changed, 1510 insertions(+), 1110 deletions(-) diff --git a/generated/nidcpower/nidcpower/__init__.py b/generated/nidcpower/nidcpower/__init__.py index b4c976047..6204442ad 100644 --- a/generated/nidcpower/nidcpower/__init__.py +++ b/generated/nidcpower/nidcpower/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = '1.4.2.dev0' +__version__ = "1.4.2.dev0" from nidcpower.enums import * # noqa: F403,F401,H303 from nidcpower.errors import DriverWarning # noqa: F401 @@ -11,12 +11,12 @@ def get_diagnostic_information(): - '''Get diagnostic information about the system state that is suitable for printing or logging + """Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - ''' + """ import os import pkg_resources import platform @@ -24,73 +24,80 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return (struct.calcsize("P") == 8) + return struct.calcsize("P") == 8 def is_os_64bit(): - return platform.machine().endswith('64') + return platform.machine().endswith("64") def is_venv(): - return 'VIRTUAL_ENV' in os.environ + return "VIRTUAL_ENV" in os.environ info = {} - info['os'] = {} - info['python'] = {} - info['driver'] = {} - info['module'] = {} - if platform.system() == 'Windows': + info["os"] = {} + info["python"] = {} + info["driver"] = {} + info["module"] = {} + if platform.system() == "Windows": try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = 'Windows' + os_name = "Windows" try: - driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-DCPower\CurrentVersion") + driver_version_key = winreg.OpenKey( + winreg.HKEY_LOCAL_MACHINE, + r"SOFTWARE\National Instruments\NI-DCPower\CurrentVersion", + ) driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = 'Unknown' - elif platform.system() == 'Linux': - os_name = 'Linux' - driver_version = 'Unknown' + driver_version = "Unknown" + elif platform.system() == "Linux": + os_name = "Linux" + driver_version = "Unknown" else: - raise SystemError('Unsupported platform: {}'.format(platform.system())) + raise SystemError("Unsupported platform: {}".format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] - - info['os']['name'] = os_name - info['os']['version'] = platform.version() - info['os']['bits'] = '64' if is_os_64bit() else '32' - info['driver']['name'] = "NI-DCPower" - info['driver']['version'] = driver_version - info['module']['name'] = 'nidcpower' - info['module']['version'] = "1.4.2.dev0" - info['python']['version'] = sys.version - info['python']['bits'] = '64' if is_python_64bit() else '32' - info['python']['is_venv'] = is_venv() - info['python']['packages'] = installed_packages_list + installed_packages_list = [ + { + "name": i.key, + "version": i.version, + } + for i in installed_packages + ] + + info["os"]["name"] = os_name + info["os"]["version"] = platform.version() + info["os"]["bits"] = "64" if is_os_64bit() else "32" + info["driver"]["name"] = "NI-DCPower" + info["driver"]["version"] = driver_version + info["module"]["name"] = "nidcpower" + info["module"]["version"] = "1.4.2.dev0" + info["python"]["version"] = sys.version + info["python"]["bits"] = "64" if is_python_64bit() else "32" + info["python"]["is_venv"] = is_venv() + info["python"]["packages"] = installed_packages_list return info def print_diagnostic_information(): - '''Print diagnostic information in a format suitable for issue report + """Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - ''' + """ info = get_diagnostic_information() - row_format = ' {:<10} {}' - for type in ['OS', 'Driver', 'Module', 'Python']: + row_format = " {:<10} {}" + for type in ["OS", "Driver", "Module", "Python"]: typename = type.lower() - print(type + ':') + print(type + ":") for item in info[typename]: - if item != 'packages': - print(row_format.format(item.title() + ':', info[typename][item])) - print(' Installed Packages:') - for p in info['python']['packages']: - print((' ' * 8) + p['name'] + '==' + p['version']) + if item != "packages": + print(row_format.format(item.title() + ":", info[typename][item])) + print(" Installed Packages:") + for p in info["python"]["packages"]: + print((" " * 8) + p["name"] + "==" + p["version"]) return info - - diff --git a/generated/nidcpower/nidcpower/_attributes.py b/generated/nidcpower/nidcpower/_attributes.py index 1ca78bd23..f7cb3fcda 100644 --- a/generated/nidcpower/nidcpower/_attributes.py +++ b/generated/nidcpower/nidcpower/_attributes.py @@ -6,14 +6,13 @@ class Attribute(object): - '''Base class for all typed attributes.''' + """Base class for all typed attributes.""" def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -22,16 +21,19 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) + return hightime.timedelta( + milliseconds=session._get_attribute_vi_int32(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) + session._set_attribute_vi_int32( + self._attribute_id, + _converters.convert_timedelta_to_milliseconds_int32(value).value, + ) class AttributeViInt64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -40,7 +42,6 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -49,16 +50,19 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) + return hightime.timedelta( + seconds=session._get_attribute_vi_real64(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) + session._set_attribute_vi_real64( + self._attribute_id, + _converters.convert_timedelta_to_seconds_real64(value).value, + ) class AttributeViString(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -67,16 +71,17 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) + session._set_attribute_vi_string( + self._attribute_id, + _converters.convert_repeated_capabilities_without_prefix(value), + ) class AttributeViBoolean(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -85,31 +90,36 @@ def __set__(self, session, value): class AttributeEnum(object): - def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) + return self._attribute_type( + self._underlying_attribute.__get__(session, session_type) + ) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) + raise TypeError( + "must be " + + str(self._attribute_type.__name__) + + " not " + + str(type(value).__name__) + ) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): - def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from nidcpower.session import SessionReference + return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) - - - + session._set_attribute_vi_session( + self._attribute_id, _converters.convert_to_nitclk_session_number(value) + ) diff --git a/generated/nidcpower/nidcpower/_converters.py b/generated/nidcpower/nidcpower/_converters.py index 3da843692..f4c70b5c3 100644 --- a/generated/nidcpower/nidcpower/_converters.py +++ b/generated/nidcpower/nidcpower/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - '''Base version that should not be called + """Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,36 +40,38 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - ''' - raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + """ + raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - '''Integer version''' + """Integer version""" return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - '''String version (this is the most complex) + """String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - ''' + """ # First we deal with a list - rep_cap_list = repeated_capability.split(',') + rep_cap_list = repeated_capability.split(",") if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, '').replace(':', '-') - rc = r.split('-') + r = repeated_capability.strip().replace(prefix, "").replace(":", "-") + rc = r.split("-") if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + raise errors.InvalidRepeatedCapabilityError( + "Multiple '-' or ':'", repeated_capability + ) try: start = int(rc[0]) end = int(rc[1]) @@ -85,7 +87,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, '').strip()] + return [repeated_capability.replace(prefix, "").strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -94,7 +96,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - '''Iterable version - can handle lists, ranges, and tuples''' + """Iterable version - can handle lists, ranges, and tuples""" rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -103,16 +105,22 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - '''slice version''' + """slice version""" + def ifnone(a, b): return b if a is None else a + # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) + rng = range( + ifnone(repeated_capability.start, 0), + repeated_capability.stop, + ifnone(repeated_capability.step, 1), + ) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=''): - '''Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=""): + """Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -120,15 +128,17 @@ def convert_repeated_capabilities(repeated_capability, prefix=''): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - ''' + """ # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] + return [ + prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) + ] def convert_repeated_capabilities_without_prefix(repeated_capability): - '''Convert a repeated capabilities object, without any prefix, to a comma delimited list + """Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -144,8 +154,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - ''' - return ','.join(convert_repeated_capabilities(repeated_capability, '')) + """ + return ",".join(convert_repeated_capabilities(repeated_capability, "")) def _convert_timedelta(value, library_type, scaling): @@ -158,7 +168,14 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: + if library_type in [ + _visatype.ViInt64, + _visatype.ViInt32, + _visatype.ViUInt32, + _visatype.ViInt16, + _visatype.ViUInt16, + _visatype.ViInt8, + ]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -195,34 +212,36 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - 'rangecheck': 'RangeCheck', - 'queryinstrstatus': 'QueryInstrStatus', - 'cache': 'Cache', - 'simulate': 'Simulate', - 'recordcoercions': 'RecordCoercions', - 'interchangecheck': 'InterchangeCheck', - 'driversetup': 'DriverSetup', - 'range_check': 'RangeCheck', - 'query_instr_status': 'QueryInstrStatus', - 'record_coercions': 'RecordCoercions', - 'interchange_check': 'InterchangeCheck', - 'driver_setup': 'DriverSetup', + "rangecheck": "RangeCheck", + "queryinstrstatus": "QueryInstrStatus", + "cache": "Cache", + "simulate": "Simulate", + "recordcoercions": "RecordCoercions", + "interchangecheck": "InterchangeCheck", + "driversetup": "DriverSetup", + "range_check": "RangeCheck", + "query_instr_status": "QueryInstrStatus", + "record_coercions": "RecordCoercions", + "interchange_check": "InterchangeCheck", + "driver_setup": "DriverSetup", } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': - value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') - elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': + if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": + value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") + elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": if not isinstance(values[k], dict): - raise TypeError('DriverSetup must be a dictionary') - value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) + raise TypeError("DriverSetup must be a dictionary") + value = "DriverSetup=" + ( + ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) + ) else: - value = k + ('=1' if values[k] is True else '=0') + value = k + ("=1" if values[k] is True else "=0") init_with_options.append(value) - init_with_options_string = ','.join(init_with_options) + init_with_options_string = ",".join(init_with_options) return init_with_options_string @@ -251,11 +270,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(',')] + return [x.strip() for x in comma_separated_string.split(",")] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -267,11 +286,17 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - ''' - chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) - repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] + """ + chained_repeated_capability_items = convert_comma_separated_string_to_list( + chained_repeated_capability + ) + repeated_capability_lists = [ + [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) + ] for item in chained_repeated_capability_items: - repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] - return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] - - + repeated_capability_lists = [ + x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) + ] + return [ + ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists + ] diff --git a/generated/nidigital/nidigital/__init__.py b/generated/nidigital/nidigital/__init__.py index 815b17ddc..b7576a221 100644 --- a/generated/nidigital/nidigital/__init__.py +++ b/generated/nidigital/nidigital/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = '1.4.2.dev0' +__version__ = "1.4.2.dev0" from nidigital.enums import * # noqa: F403,F401,H303 from nidigital.errors import DriverWarning # noqa: F401 @@ -13,12 +13,12 @@ def get_diagnostic_information(): - '''Get diagnostic information about the system state that is suitable for printing or logging + """Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - ''' + """ import os import pkg_resources import platform @@ -26,73 +26,80 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return (struct.calcsize("P") == 8) + return struct.calcsize("P") == 8 def is_os_64bit(): - return platform.machine().endswith('64') + return platform.machine().endswith("64") def is_venv(): - return 'VIRTUAL_ENV' in os.environ + return "VIRTUAL_ENV" in os.environ info = {} - info['os'] = {} - info['python'] = {} - info['driver'] = {} - info['module'] = {} - if platform.system() == 'Windows': + info["os"] = {} + info["python"] = {} + info["driver"] = {} + info["module"] = {} + if platform.system() == "Windows": try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = 'Windows' + os_name = "Windows" try: - driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-Digital Pattern Driver\CurrentVersion") + driver_version_key = winreg.OpenKey( + winreg.HKEY_LOCAL_MACHINE, + r"SOFTWARE\National Instruments\NI-Digital Pattern Driver\CurrentVersion", + ) driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = 'Unknown' - elif platform.system() == 'Linux': - os_name = 'Linux' - driver_version = 'Unknown' + driver_version = "Unknown" + elif platform.system() == "Linux": + os_name = "Linux" + driver_version = "Unknown" else: - raise SystemError('Unsupported platform: {}'.format(platform.system())) + raise SystemError("Unsupported platform: {}".format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] - - info['os']['name'] = os_name - info['os']['version'] = platform.version() - info['os']['bits'] = '64' if is_os_64bit() else '32' - info['driver']['name'] = "NI-Digital Pattern Driver" - info['driver']['version'] = driver_version - info['module']['name'] = 'nidigital' - info['module']['version'] = "1.4.2.dev0" - info['python']['version'] = sys.version - info['python']['bits'] = '64' if is_python_64bit() else '32' - info['python']['is_venv'] = is_venv() - info['python']['packages'] = installed_packages_list + installed_packages_list = [ + { + "name": i.key, + "version": i.version, + } + for i in installed_packages + ] + + info["os"]["name"] = os_name + info["os"]["version"] = platform.version() + info["os"]["bits"] = "64" if is_os_64bit() else "32" + info["driver"]["name"] = "NI-Digital Pattern Driver" + info["driver"]["version"] = driver_version + info["module"]["name"] = "nidigital" + info["module"]["version"] = "1.4.2.dev0" + info["python"]["version"] = sys.version + info["python"]["bits"] = "64" if is_python_64bit() else "32" + info["python"]["is_venv"] = is_venv() + info["python"]["packages"] = installed_packages_list return info def print_diagnostic_information(): - '''Print diagnostic information in a format suitable for issue report + """Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - ''' + """ info = get_diagnostic_information() - row_format = ' {:<10} {}' - for type in ['OS', 'Driver', 'Module', 'Python']: + row_format = " {:<10} {}" + for type in ["OS", "Driver", "Module", "Python"]: typename = type.lower() - print(type + ':') + print(type + ":") for item in info[typename]: - if item != 'packages': - print(row_format.format(item.title() + ':', info[typename][item])) - print(' Installed Packages:') - for p in info['python']['packages']: - print((' ' * 8) + p['name'] + '==' + p['version']) + if item != "packages": + print(row_format.format(item.title() + ":", info[typename][item])) + print(" Installed Packages:") + for p in info["python"]["packages"]: + print((" " * 8) + p["name"] + "==" + p["version"]) return info - - diff --git a/generated/nidigital/nidigital/_attributes.py b/generated/nidigital/nidigital/_attributes.py index 277b4b001..5a20ca61f 100644 --- a/generated/nidigital/nidigital/_attributes.py +++ b/generated/nidigital/nidigital/_attributes.py @@ -6,14 +6,13 @@ class Attribute(object): - '''Base class for all typed attributes.''' + """Base class for all typed attributes.""" def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -22,16 +21,19 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) + return hightime.timedelta( + milliseconds=session._get_attribute_vi_int32(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) + session._set_attribute_vi_int32( + self._attribute_id, + _converters.convert_timedelta_to_milliseconds_int32(value).value, + ) class AttributeViInt64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -40,7 +42,6 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -49,16 +50,19 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) + return hightime.timedelta( + seconds=session._get_attribute_vi_real64(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) + session._set_attribute_vi_real64( + self._attribute_id, + _converters.convert_timedelta_to_seconds_real64(value).value, + ) class AttributeViString(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -67,16 +71,17 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) + session._set_attribute_vi_string( + self._attribute_id, + _converters.convert_repeated_capabilities_without_prefix(value), + ) class AttributeViBoolean(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -85,31 +90,36 @@ def __set__(self, session, value): class AttributeEnum(object): - def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) + return self._attribute_type( + self._underlying_attribute.__get__(session, session_type) + ) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) + raise TypeError( + "must be " + + str(self._attribute_type.__name__) + + " not " + + str(type(value).__name__) + ) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): - def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from nidigital.session import SessionReference + return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) - - - + session._set_attribute_vi_session( + self._attribute_id, _converters.convert_to_nitclk_session_number(value) + ) diff --git a/generated/nidigital/nidigital/_converters.py b/generated/nidigital/nidigital/_converters.py index b36b311d8..a6c2c8434 100644 --- a/generated/nidigital/nidigital/_converters.py +++ b/generated/nidigital/nidigital/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - '''Base version that should not be called + """Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,36 +40,38 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - ''' - raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + """ + raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - '''Integer version''' + """Integer version""" return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - '''String version (this is the most complex) + """String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - ''' + """ # First we deal with a list - rep_cap_list = repeated_capability.split(',') + rep_cap_list = repeated_capability.split(",") if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, '').replace(':', '-') - rc = r.split('-') + r = repeated_capability.strip().replace(prefix, "").replace(":", "-") + rc = r.split("-") if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + raise errors.InvalidRepeatedCapabilityError( + "Multiple '-' or ':'", repeated_capability + ) try: start = int(rc[0]) end = int(rc[1]) @@ -85,7 +87,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, '').strip()] + return [repeated_capability.replace(prefix, "").strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -94,7 +96,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - '''Iterable version - can handle lists, ranges, and tuples''' + """Iterable version - can handle lists, ranges, and tuples""" rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -103,16 +105,22 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - '''slice version''' + """slice version""" + def ifnone(a, b): return b if a is None else a + # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) + rng = range( + ifnone(repeated_capability.start, 0), + repeated_capability.stop, + ifnone(repeated_capability.step, 1), + ) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=''): - '''Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=""): + """Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -120,15 +128,17 @@ def convert_repeated_capabilities(repeated_capability, prefix=''): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - ''' + """ # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] + return [ + prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) + ] def convert_repeated_capabilities_without_prefix(repeated_capability): - '''Convert a repeated capabilities object, without any prefix, to a comma delimited list + """Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -144,8 +154,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - ''' - return ','.join(convert_repeated_capabilities(repeated_capability, '')) + """ + return ",".join(convert_repeated_capabilities(repeated_capability, "")) def _convert_timedelta(value, library_type, scaling): @@ -158,7 +168,14 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: + if library_type in [ + _visatype.ViInt64, + _visatype.ViInt32, + _visatype.ViUInt32, + _visatype.ViInt16, + _visatype.ViUInt16, + _visatype.ViInt8, + ]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -195,34 +212,36 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - 'rangecheck': 'RangeCheck', - 'queryinstrstatus': 'QueryInstrStatus', - 'cache': 'Cache', - 'simulate': 'Simulate', - 'recordcoercions': 'RecordCoercions', - 'interchangecheck': 'InterchangeCheck', - 'driversetup': 'DriverSetup', - 'range_check': 'RangeCheck', - 'query_instr_status': 'QueryInstrStatus', - 'record_coercions': 'RecordCoercions', - 'interchange_check': 'InterchangeCheck', - 'driver_setup': 'DriverSetup', + "rangecheck": "RangeCheck", + "queryinstrstatus": "QueryInstrStatus", + "cache": "Cache", + "simulate": "Simulate", + "recordcoercions": "RecordCoercions", + "interchangecheck": "InterchangeCheck", + "driversetup": "DriverSetup", + "range_check": "RangeCheck", + "query_instr_status": "QueryInstrStatus", + "record_coercions": "RecordCoercions", + "interchange_check": "InterchangeCheck", + "driver_setup": "DriverSetup", } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': - value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') - elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': + if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": + value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") + elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": if not isinstance(values[k], dict): - raise TypeError('DriverSetup must be a dictionary') - value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) + raise TypeError("DriverSetup must be a dictionary") + value = "DriverSetup=" + ( + ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) + ) else: - value = k + ('=1' if values[k] is True else '=0') + value = k + ("=1" if values[k] is True else "=0") init_with_options.append(value) - init_with_options_string = ','.join(init_with_options) + init_with_options_string = ",".join(init_with_options) return init_with_options_string @@ -251,11 +270,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(',')] + return [x.strip() for x in comma_separated_string.split(",")] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -267,11 +286,17 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - ''' - chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) - repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] + """ + chained_repeated_capability_items = convert_comma_separated_string_to_list( + chained_repeated_capability + ) + repeated_capability_lists = [ + [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) + ] for item in chained_repeated_capability_items: - repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] - return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] - - + repeated_capability_lists = [ + x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) + ] + return [ + ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists + ] diff --git a/generated/nidmm/nidmm/__init__.py b/generated/nidmm/nidmm/__init__.py index 6df35e03c..33492769b 100644 --- a/generated/nidmm/nidmm/__init__.py +++ b/generated/nidmm/nidmm/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = '1.4.2.dev0' +__version__ = "1.4.2.dev0" from nidmm.enums import * # noqa: F403,F401,H303 from nidmm.errors import DriverWarning # noqa: F401 @@ -11,12 +11,12 @@ def get_diagnostic_information(): - '''Get diagnostic information about the system state that is suitable for printing or logging + """Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - ''' + """ import os import pkg_resources import platform @@ -24,73 +24,80 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return (struct.calcsize("P") == 8) + return struct.calcsize("P") == 8 def is_os_64bit(): - return platform.machine().endswith('64') + return platform.machine().endswith("64") def is_venv(): - return 'VIRTUAL_ENV' in os.environ + return "VIRTUAL_ENV" in os.environ info = {} - info['os'] = {} - info['python'] = {} - info['driver'] = {} - info['module'] = {} - if platform.system() == 'Windows': + info["os"] = {} + info["python"] = {} + info["driver"] = {} + info["module"] = {} + if platform.system() == "Windows": try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = 'Windows' + os_name = "Windows" try: - driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-DMM\CurrentVersion") + driver_version_key = winreg.OpenKey( + winreg.HKEY_LOCAL_MACHINE, + r"SOFTWARE\National Instruments\NI-DMM\CurrentVersion", + ) driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = 'Unknown' - elif platform.system() == 'Linux': - os_name = 'Linux' - driver_version = 'Unknown' + driver_version = "Unknown" + elif platform.system() == "Linux": + os_name = "Linux" + driver_version = "Unknown" else: - raise SystemError('Unsupported platform: {}'.format(platform.system())) + raise SystemError("Unsupported platform: {}".format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] - - info['os']['name'] = os_name - info['os']['version'] = platform.version() - info['os']['bits'] = '64' if is_os_64bit() else '32' - info['driver']['name'] = "NI-DMM" - info['driver']['version'] = driver_version - info['module']['name'] = 'nidmm' - info['module']['version'] = "1.4.2.dev0" - info['python']['version'] = sys.version - info['python']['bits'] = '64' if is_python_64bit() else '32' - info['python']['is_venv'] = is_venv() - info['python']['packages'] = installed_packages_list + installed_packages_list = [ + { + "name": i.key, + "version": i.version, + } + for i in installed_packages + ] + + info["os"]["name"] = os_name + info["os"]["version"] = platform.version() + info["os"]["bits"] = "64" if is_os_64bit() else "32" + info["driver"]["name"] = "NI-DMM" + info["driver"]["version"] = driver_version + info["module"]["name"] = "nidmm" + info["module"]["version"] = "1.4.2.dev0" + info["python"]["version"] = sys.version + info["python"]["bits"] = "64" if is_python_64bit() else "32" + info["python"]["is_venv"] = is_venv() + info["python"]["packages"] = installed_packages_list return info def print_diagnostic_information(): - '''Print diagnostic information in a format suitable for issue report + """Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - ''' + """ info = get_diagnostic_information() - row_format = ' {:<10} {}' - for type in ['OS', 'Driver', 'Module', 'Python']: + row_format = " {:<10} {}" + for type in ["OS", "Driver", "Module", "Python"]: typename = type.lower() - print(type + ':') + print(type + ":") for item in info[typename]: - if item != 'packages': - print(row_format.format(item.title() + ':', info[typename][item])) - print(' Installed Packages:') - for p in info['python']['packages']: - print((' ' * 8) + p['name'] + '==' + p['version']) + if item != "packages": + print(row_format.format(item.title() + ":", info[typename][item])) + print(" Installed Packages:") + for p in info["python"]["packages"]: + print((" " * 8) + p["name"] + "==" + p["version"]) return info - - diff --git a/generated/nidmm/nidmm/_attributes.py b/generated/nidmm/nidmm/_attributes.py index c4df48ab4..c282889a3 100644 --- a/generated/nidmm/nidmm/_attributes.py +++ b/generated/nidmm/nidmm/_attributes.py @@ -6,14 +6,13 @@ class Attribute(object): - '''Base class for all typed attributes.''' + """Base class for all typed attributes.""" def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -22,16 +21,19 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) + return hightime.timedelta( + milliseconds=session._get_attribute_vi_int32(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) + session._set_attribute_vi_int32( + self._attribute_id, + _converters.convert_timedelta_to_milliseconds_int32(value).value, + ) class AttributeViInt64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -40,7 +42,6 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -49,16 +50,19 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) + return hightime.timedelta( + seconds=session._get_attribute_vi_real64(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) + session._set_attribute_vi_real64( + self._attribute_id, + _converters.convert_timedelta_to_seconds_real64(value).value, + ) class AttributeViString(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -67,16 +71,17 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) + session._set_attribute_vi_string( + self._attribute_id, + _converters.convert_repeated_capabilities_without_prefix(value), + ) class AttributeViBoolean(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -85,31 +90,36 @@ def __set__(self, session, value): class AttributeEnum(object): - def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) + return self._attribute_type( + self._underlying_attribute.__get__(session, session_type) + ) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) + raise TypeError( + "must be " + + str(self._attribute_type.__name__) + + " not " + + str(type(value).__name__) + ) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): - def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from nidmm.session import SessionReference + return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) - - - + session._set_attribute_vi_session( + self._attribute_id, _converters.convert_to_nitclk_session_number(value) + ) diff --git a/generated/nidmm/nidmm/_converters.py b/generated/nidmm/nidmm/_converters.py index 5248b0b4b..a9c4436af 100644 --- a/generated/nidmm/nidmm/_converters.py +++ b/generated/nidmm/nidmm/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - '''Base version that should not be called + """Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,36 +40,38 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - ''' - raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + """ + raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - '''Integer version''' + """Integer version""" return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - '''String version (this is the most complex) + """String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - ''' + """ # First we deal with a list - rep_cap_list = repeated_capability.split(',') + rep_cap_list = repeated_capability.split(",") if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, '').replace(':', '-') - rc = r.split('-') + r = repeated_capability.strip().replace(prefix, "").replace(":", "-") + rc = r.split("-") if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + raise errors.InvalidRepeatedCapabilityError( + "Multiple '-' or ':'", repeated_capability + ) try: start = int(rc[0]) end = int(rc[1]) @@ -85,7 +87,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, '').strip()] + return [repeated_capability.replace(prefix, "").strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -94,7 +96,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - '''Iterable version - can handle lists, ranges, and tuples''' + """Iterable version - can handle lists, ranges, and tuples""" rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -103,16 +105,22 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - '''slice version''' + """slice version""" + def ifnone(a, b): return b if a is None else a + # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) + rng = range( + ifnone(repeated_capability.start, 0), + repeated_capability.stop, + ifnone(repeated_capability.step, 1), + ) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=''): - '''Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=""): + """Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -120,15 +128,17 @@ def convert_repeated_capabilities(repeated_capability, prefix=''): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - ''' + """ # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] + return [ + prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) + ] def convert_repeated_capabilities_without_prefix(repeated_capability): - '''Convert a repeated capabilities object, without any prefix, to a comma delimited list + """Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -144,8 +154,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - ''' - return ','.join(convert_repeated_capabilities(repeated_capability, '')) + """ + return ",".join(convert_repeated_capabilities(repeated_capability, "")) def _convert_timedelta(value, library_type, scaling): @@ -158,7 +168,14 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: + if library_type in [ + _visatype.ViInt64, + _visatype.ViInt32, + _visatype.ViUInt32, + _visatype.ViInt16, + _visatype.ViUInt16, + _visatype.ViInt8, + ]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -195,34 +212,36 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - 'rangecheck': 'RangeCheck', - 'queryinstrstatus': 'QueryInstrStatus', - 'cache': 'Cache', - 'simulate': 'Simulate', - 'recordcoercions': 'RecordCoercions', - 'interchangecheck': 'InterchangeCheck', - 'driversetup': 'DriverSetup', - 'range_check': 'RangeCheck', - 'query_instr_status': 'QueryInstrStatus', - 'record_coercions': 'RecordCoercions', - 'interchange_check': 'InterchangeCheck', - 'driver_setup': 'DriverSetup', + "rangecheck": "RangeCheck", + "queryinstrstatus": "QueryInstrStatus", + "cache": "Cache", + "simulate": "Simulate", + "recordcoercions": "RecordCoercions", + "interchangecheck": "InterchangeCheck", + "driversetup": "DriverSetup", + "range_check": "RangeCheck", + "query_instr_status": "QueryInstrStatus", + "record_coercions": "RecordCoercions", + "interchange_check": "InterchangeCheck", + "driver_setup": "DriverSetup", } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': - value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') - elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': + if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": + value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") + elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": if not isinstance(values[k], dict): - raise TypeError('DriverSetup must be a dictionary') - value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) + raise TypeError("DriverSetup must be a dictionary") + value = "DriverSetup=" + ( + ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) + ) else: - value = k + ('=1' if values[k] is True else '=0') + value = k + ("=1" if values[k] is True else "=0") init_with_options.append(value) - init_with_options_string = ','.join(init_with_options) + init_with_options_string = ",".join(init_with_options) return init_with_options_string @@ -251,11 +270,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(',')] + return [x.strip() for x in comma_separated_string.split(",")] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -267,11 +286,17 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - ''' - chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) - repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] + """ + chained_repeated_capability_items = convert_comma_separated_string_to_list( + chained_repeated_capability + ) + repeated_capability_lists = [ + [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) + ] for item in chained_repeated_capability_items: - repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] - return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] - - + repeated_capability_lists = [ + x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) + ] + return [ + ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists + ] diff --git a/generated/nifake/nifake/__init__.py b/generated/nifake/nifake/__init__.py index ae0e67e8e..646bbfef1 100644 --- a/generated/nifake/nifake/__init__.py +++ b/generated/nifake/nifake/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = '1.4.2.dev0' +__version__ = "1.4.2.dev0" from nifake.enums import * # noqa: F403,F401,H303 from nifake.errors import DriverWarning # noqa: F401 @@ -15,12 +15,12 @@ def get_diagnostic_information(): - '''Get diagnostic information about the system state that is suitable for printing or logging + """Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - ''' + """ import os import pkg_resources import platform @@ -28,73 +28,80 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return (struct.calcsize("P") == 8) + return struct.calcsize("P") == 8 def is_os_64bit(): - return platform.machine().endswith('64') + return platform.machine().endswith("64") def is_venv(): - return 'VIRTUAL_ENV' in os.environ + return "VIRTUAL_ENV" in os.environ info = {} - info['os'] = {} - info['python'] = {} - info['driver'] = {} - info['module'] = {} - if platform.system() == 'Windows': + info["os"] = {} + info["python"] = {} + info["driver"] = {} + info["module"] = {} + if platform.system() == "Windows": try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = 'Windows' + os_name = "Windows" try: - driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-FAKE\CurrentVersion") + driver_version_key = winreg.OpenKey( + winreg.HKEY_LOCAL_MACHINE, + r"SOFTWARE\National Instruments\NI-FAKE\CurrentVersion", + ) driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = 'Unknown' - elif platform.system() == 'Linux': - os_name = 'Linux' - driver_version = 'Unknown' + driver_version = "Unknown" + elif platform.system() == "Linux": + os_name = "Linux" + driver_version = "Unknown" else: - raise SystemError('Unsupported platform: {}'.format(platform.system())) + raise SystemError("Unsupported platform: {}".format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] - - info['os']['name'] = os_name - info['os']['version'] = platform.version() - info['os']['bits'] = '64' if is_os_64bit() else '32' - info['driver']['name'] = "NI-FAKE" - info['driver']['version'] = driver_version - info['module']['name'] = 'nifake' - info['module']['version'] = "1.4.2.dev0" - info['python']['version'] = sys.version - info['python']['bits'] = '64' if is_python_64bit() else '32' - info['python']['is_venv'] = is_venv() - info['python']['packages'] = installed_packages_list + installed_packages_list = [ + { + "name": i.key, + "version": i.version, + } + for i in installed_packages + ] + + info["os"]["name"] = os_name + info["os"]["version"] = platform.version() + info["os"]["bits"] = "64" if is_os_64bit() else "32" + info["driver"]["name"] = "NI-FAKE" + info["driver"]["version"] = driver_version + info["module"]["name"] = "nifake" + info["module"]["version"] = "1.4.2.dev0" + info["python"]["version"] = sys.version + info["python"]["bits"] = "64" if is_python_64bit() else "32" + info["python"]["is_venv"] = is_venv() + info["python"]["packages"] = installed_packages_list return info def print_diagnostic_information(): - '''Print diagnostic information in a format suitable for issue report + """Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - ''' + """ info = get_diagnostic_information() - row_format = ' {:<10} {}' - for type in ['OS', 'Driver', 'Module', 'Python']: + row_format = " {:<10} {}" + for type in ["OS", "Driver", "Module", "Python"]: typename = type.lower() - print(type + ':') + print(type + ":") for item in info[typename]: - if item != 'packages': - print(row_format.format(item.title() + ':', info[typename][item])) - print(' Installed Packages:') - for p in info['python']['packages']: - print((' ' * 8) + p['name'] + '==' + p['version']) + if item != "packages": + print(row_format.format(item.title() + ":", info[typename][item])) + print(" Installed Packages:") + for p in info["python"]["packages"]: + print((" " * 8) + p["name"] + "==" + p["version"]) return info - - diff --git a/generated/nifake/nifake/_attributes.py b/generated/nifake/nifake/_attributes.py index 1b8c55874..00744f460 100644 --- a/generated/nifake/nifake/_attributes.py +++ b/generated/nifake/nifake/_attributes.py @@ -6,14 +6,13 @@ class Attribute(object): - '''Base class for all typed attributes.''' + """Base class for all typed attributes.""" def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -22,16 +21,19 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) + return hightime.timedelta( + milliseconds=session._get_attribute_vi_int32(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) + session._set_attribute_vi_int32( + self._attribute_id, + _converters.convert_timedelta_to_milliseconds_int32(value).value, + ) class AttributeViInt64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -40,7 +42,6 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -49,16 +50,19 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) + return hightime.timedelta( + seconds=session._get_attribute_vi_real64(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) + session._set_attribute_vi_real64( + self._attribute_id, + _converters.convert_timedelta_to_seconds_real64(value).value, + ) class AttributeViString(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -67,16 +71,17 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) + session._set_attribute_vi_string( + self._attribute_id, + _converters.convert_repeated_capabilities_without_prefix(value), + ) class AttributeViBoolean(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -85,31 +90,36 @@ def __set__(self, session, value): class AttributeEnum(object): - def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) + return self._attribute_type( + self._underlying_attribute.__get__(session, session_type) + ) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) + raise TypeError( + "must be " + + str(self._attribute_type.__name__) + + " not " + + str(type(value).__name__) + ) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): - def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from nifake.session import SessionReference + return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) - - - + session._set_attribute_vi_session( + self._attribute_id, _converters.convert_to_nitclk_session_number(value) + ) diff --git a/generated/nifake/nifake/_converters.py b/generated/nifake/nifake/_converters.py index 608ae5753..8b81598c1 100644 --- a/generated/nifake/nifake/_converters.py +++ b/generated/nifake/nifake/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - '''Base version that should not be called + """Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,36 +40,38 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - ''' - raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + """ + raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - '''Integer version''' + """Integer version""" return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - '''String version (this is the most complex) + """String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - ''' + """ # First we deal with a list - rep_cap_list = repeated_capability.split(',') + rep_cap_list = repeated_capability.split(",") if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, '').replace(':', '-') - rc = r.split('-') + r = repeated_capability.strip().replace(prefix, "").replace(":", "-") + rc = r.split("-") if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + raise errors.InvalidRepeatedCapabilityError( + "Multiple '-' or ':'", repeated_capability + ) try: start = int(rc[0]) end = int(rc[1]) @@ -85,7 +87,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, '').strip()] + return [repeated_capability.replace(prefix, "").strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -94,7 +96,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - '''Iterable version - can handle lists, ranges, and tuples''' + """Iterable version - can handle lists, ranges, and tuples""" rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -103,16 +105,22 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - '''slice version''' + """slice version""" + def ifnone(a, b): return b if a is None else a + # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) + rng = range( + ifnone(repeated_capability.start, 0), + repeated_capability.stop, + ifnone(repeated_capability.step, 1), + ) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=''): - '''Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=""): + """Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -120,15 +128,17 @@ def convert_repeated_capabilities(repeated_capability, prefix=''): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - ''' + """ # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] + return [ + prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) + ] def convert_repeated_capabilities_without_prefix(repeated_capability): - '''Convert a repeated capabilities object, without any prefix, to a comma delimited list + """Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -144,8 +154,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - ''' - return ','.join(convert_repeated_capabilities(repeated_capability, '')) + """ + return ",".join(convert_repeated_capabilities(repeated_capability, "")) def _convert_timedelta(value, library_type, scaling): @@ -158,7 +168,14 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: + if library_type in [ + _visatype.ViInt64, + _visatype.ViInt32, + _visatype.ViUInt32, + _visatype.ViInt16, + _visatype.ViUInt16, + _visatype.ViInt8, + ]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -195,34 +212,36 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - 'rangecheck': 'RangeCheck', - 'queryinstrstatus': 'QueryInstrStatus', - 'cache': 'Cache', - 'simulate': 'Simulate', - 'recordcoercions': 'RecordCoercions', - 'interchangecheck': 'InterchangeCheck', - 'driversetup': 'DriverSetup', - 'range_check': 'RangeCheck', - 'query_instr_status': 'QueryInstrStatus', - 'record_coercions': 'RecordCoercions', - 'interchange_check': 'InterchangeCheck', - 'driver_setup': 'DriverSetup', + "rangecheck": "RangeCheck", + "queryinstrstatus": "QueryInstrStatus", + "cache": "Cache", + "simulate": "Simulate", + "recordcoercions": "RecordCoercions", + "interchangecheck": "InterchangeCheck", + "driversetup": "DriverSetup", + "range_check": "RangeCheck", + "query_instr_status": "QueryInstrStatus", + "record_coercions": "RecordCoercions", + "interchange_check": "InterchangeCheck", + "driver_setup": "DriverSetup", } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': - value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') - elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': + if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": + value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") + elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": if not isinstance(values[k], dict): - raise TypeError('DriverSetup must be a dictionary') - value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) + raise TypeError("DriverSetup must be a dictionary") + value = "DriverSetup=" + ( + ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) + ) else: - value = k + ('=1' if values[k] is True else '=0') + value = k + ("=1" if values[k] is True else "=0") init_with_options.append(value) - init_with_options_string = ','.join(init_with_options) + init_with_options_string = ",".join(init_with_options) return init_with_options_string @@ -251,11 +270,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(',')] + return [x.strip() for x in comma_separated_string.split(",")] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -267,16 +286,22 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - ''' - chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) - repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] + """ + chained_repeated_capability_items = convert_comma_separated_string_to_list( + chained_repeated_capability + ) + repeated_capability_lists = [ + [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) + ] for item in chained_repeated_capability_items: - repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] - return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] + repeated_capability_lists = [ + x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) + ] + return [ + ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists + ] # nifake specific converter(s) - used only for testing def convert_double_each_element(numbers): return [x * 2 for x in numbers] - - diff --git a/generated/nifgen/nifgen/__init__.py b/generated/nifgen/nifgen/__init__.py index 072fbdf5b..061ff0f45 100644 --- a/generated/nifgen/nifgen/__init__.py +++ b/generated/nifgen/nifgen/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = '1.4.2.dev0' +__version__ = "1.4.2.dev0" from nifgen.enums import * # noqa: F403,F401,H303 from nifgen.errors import DriverWarning # noqa: F401 @@ -11,12 +11,12 @@ def get_diagnostic_information(): - '''Get diagnostic information about the system state that is suitable for printing or logging + """Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - ''' + """ import os import pkg_resources import platform @@ -24,73 +24,80 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return (struct.calcsize("P") == 8) + return struct.calcsize("P") == 8 def is_os_64bit(): - return platform.machine().endswith('64') + return platform.machine().endswith("64") def is_venv(): - return 'VIRTUAL_ENV' in os.environ + return "VIRTUAL_ENV" in os.environ info = {} - info['os'] = {} - info['python'] = {} - info['driver'] = {} - info['module'] = {} - if platform.system() == 'Windows': + info["os"] = {} + info["python"] = {} + info["driver"] = {} + info["module"] = {} + if platform.system() == "Windows": try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = 'Windows' + os_name = "Windows" try: - driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-FGEN\CurrentVersion") + driver_version_key = winreg.OpenKey( + winreg.HKEY_LOCAL_MACHINE, + r"SOFTWARE\National Instruments\NI-FGEN\CurrentVersion", + ) driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = 'Unknown' - elif platform.system() == 'Linux': - os_name = 'Linux' - driver_version = 'Unknown' + driver_version = "Unknown" + elif platform.system() == "Linux": + os_name = "Linux" + driver_version = "Unknown" else: - raise SystemError('Unsupported platform: {}'.format(platform.system())) + raise SystemError("Unsupported platform: {}".format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] - - info['os']['name'] = os_name - info['os']['version'] = platform.version() - info['os']['bits'] = '64' if is_os_64bit() else '32' - info['driver']['name'] = "NI-FGEN" - info['driver']['version'] = driver_version - info['module']['name'] = 'nifgen' - info['module']['version'] = "1.4.2.dev0" - info['python']['version'] = sys.version - info['python']['bits'] = '64' if is_python_64bit() else '32' - info['python']['is_venv'] = is_venv() - info['python']['packages'] = installed_packages_list + installed_packages_list = [ + { + "name": i.key, + "version": i.version, + } + for i in installed_packages + ] + + info["os"]["name"] = os_name + info["os"]["version"] = platform.version() + info["os"]["bits"] = "64" if is_os_64bit() else "32" + info["driver"]["name"] = "NI-FGEN" + info["driver"]["version"] = driver_version + info["module"]["name"] = "nifgen" + info["module"]["version"] = "1.4.2.dev0" + info["python"]["version"] = sys.version + info["python"]["bits"] = "64" if is_python_64bit() else "32" + info["python"]["is_venv"] = is_venv() + info["python"]["packages"] = installed_packages_list return info def print_diagnostic_information(): - '''Print diagnostic information in a format suitable for issue report + """Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - ''' + """ info = get_diagnostic_information() - row_format = ' {:<10} {}' - for type in ['OS', 'Driver', 'Module', 'Python']: + row_format = " {:<10} {}" + for type in ["OS", "Driver", "Module", "Python"]: typename = type.lower() - print(type + ':') + print(type + ":") for item in info[typename]: - if item != 'packages': - print(row_format.format(item.title() + ':', info[typename][item])) - print(' Installed Packages:') - for p in info['python']['packages']: - print((' ' * 8) + p['name'] + '==' + p['version']) + if item != "packages": + print(row_format.format(item.title() + ":", info[typename][item])) + print(" Installed Packages:") + for p in info["python"]["packages"]: + print((" " * 8) + p["name"] + "==" + p["version"]) return info - - diff --git a/generated/nifgen/nifgen/_attributes.py b/generated/nifgen/nifgen/_attributes.py index 13fb143f1..acb2517c0 100644 --- a/generated/nifgen/nifgen/_attributes.py +++ b/generated/nifgen/nifgen/_attributes.py @@ -6,14 +6,13 @@ class Attribute(object): - '''Base class for all typed attributes.''' + """Base class for all typed attributes.""" def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -22,16 +21,19 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) + return hightime.timedelta( + milliseconds=session._get_attribute_vi_int32(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) + session._set_attribute_vi_int32( + self._attribute_id, + _converters.convert_timedelta_to_milliseconds_int32(value).value, + ) class AttributeViInt64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -40,7 +42,6 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -49,16 +50,19 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) + return hightime.timedelta( + seconds=session._get_attribute_vi_real64(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) + session._set_attribute_vi_real64( + self._attribute_id, + _converters.convert_timedelta_to_seconds_real64(value).value, + ) class AttributeViString(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -67,16 +71,17 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) + session._set_attribute_vi_string( + self._attribute_id, + _converters.convert_repeated_capabilities_without_prefix(value), + ) class AttributeViBoolean(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -85,31 +90,36 @@ def __set__(self, session, value): class AttributeEnum(object): - def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) + return self._attribute_type( + self._underlying_attribute.__get__(session, session_type) + ) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) + raise TypeError( + "must be " + + str(self._attribute_type.__name__) + + " not " + + str(type(value).__name__) + ) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): - def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from nifgen.session import SessionReference + return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) - - - + session._set_attribute_vi_session( + self._attribute_id, _converters.convert_to_nitclk_session_number(value) + ) diff --git a/generated/nifgen/nifgen/_converters.py b/generated/nifgen/nifgen/_converters.py index a20b22b28..77a87d2cd 100644 --- a/generated/nifgen/nifgen/_converters.py +++ b/generated/nifgen/nifgen/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - '''Base version that should not be called + """Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,36 +40,38 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - ''' - raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + """ + raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - '''Integer version''' + """Integer version""" return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - '''String version (this is the most complex) + """String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - ''' + """ # First we deal with a list - rep_cap_list = repeated_capability.split(',') + rep_cap_list = repeated_capability.split(",") if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, '').replace(':', '-') - rc = r.split('-') + r = repeated_capability.strip().replace(prefix, "").replace(":", "-") + rc = r.split("-") if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + raise errors.InvalidRepeatedCapabilityError( + "Multiple '-' or ':'", repeated_capability + ) try: start = int(rc[0]) end = int(rc[1]) @@ -85,7 +87,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, '').strip()] + return [repeated_capability.replace(prefix, "").strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -94,7 +96,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - '''Iterable version - can handle lists, ranges, and tuples''' + """Iterable version - can handle lists, ranges, and tuples""" rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -103,16 +105,22 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - '''slice version''' + """slice version""" + def ifnone(a, b): return b if a is None else a + # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) + rng = range( + ifnone(repeated_capability.start, 0), + repeated_capability.stop, + ifnone(repeated_capability.step, 1), + ) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=''): - '''Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=""): + """Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -120,15 +128,17 @@ def convert_repeated_capabilities(repeated_capability, prefix=''): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - ''' + """ # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] + return [ + prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) + ] def convert_repeated_capabilities_without_prefix(repeated_capability): - '''Convert a repeated capabilities object, without any prefix, to a comma delimited list + """Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -144,8 +154,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - ''' - return ','.join(convert_repeated_capabilities(repeated_capability, '')) + """ + return ",".join(convert_repeated_capabilities(repeated_capability, "")) def _convert_timedelta(value, library_type, scaling): @@ -158,7 +168,14 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: + if library_type in [ + _visatype.ViInt64, + _visatype.ViInt32, + _visatype.ViUInt32, + _visatype.ViInt16, + _visatype.ViUInt16, + _visatype.ViInt8, + ]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -195,34 +212,36 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - 'rangecheck': 'RangeCheck', - 'queryinstrstatus': 'QueryInstrStatus', - 'cache': 'Cache', - 'simulate': 'Simulate', - 'recordcoercions': 'RecordCoercions', - 'interchangecheck': 'InterchangeCheck', - 'driversetup': 'DriverSetup', - 'range_check': 'RangeCheck', - 'query_instr_status': 'QueryInstrStatus', - 'record_coercions': 'RecordCoercions', - 'interchange_check': 'InterchangeCheck', - 'driver_setup': 'DriverSetup', + "rangecheck": "RangeCheck", + "queryinstrstatus": "QueryInstrStatus", + "cache": "Cache", + "simulate": "Simulate", + "recordcoercions": "RecordCoercions", + "interchangecheck": "InterchangeCheck", + "driversetup": "DriverSetup", + "range_check": "RangeCheck", + "query_instr_status": "QueryInstrStatus", + "record_coercions": "RecordCoercions", + "interchange_check": "InterchangeCheck", + "driver_setup": "DriverSetup", } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': - value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') - elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': + if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": + value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") + elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": if not isinstance(values[k], dict): - raise TypeError('DriverSetup must be a dictionary') - value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) + raise TypeError("DriverSetup must be a dictionary") + value = "DriverSetup=" + ( + ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) + ) else: - value = k + ('=1' if values[k] is True else '=0') + value = k + ("=1" if values[k] is True else "=0") init_with_options.append(value) - init_with_options_string = ','.join(init_with_options) + init_with_options_string = ",".join(init_with_options) return init_with_options_string @@ -251,11 +270,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(',')] + return [x.strip() for x in comma_separated_string.split(",")] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -267,11 +286,17 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - ''' - chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) - repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] + """ + chained_repeated_capability_items = convert_comma_separated_string_to_list( + chained_repeated_capability + ) + repeated_capability_lists = [ + [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) + ] for item in chained_repeated_capability_items: - repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] - return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] - - + repeated_capability_lists = [ + x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) + ] + return [ + ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists + ] diff --git a/generated/nimodinst/nimodinst/__init__.py b/generated/nimodinst/nimodinst/__init__.py index 2419dd9ac..649a9858b 100644 --- a/generated/nimodinst/nimodinst/__init__.py +++ b/generated/nimodinst/nimodinst/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = '1.4.2.dev0' +__version__ = "1.4.2.dev0" from nimodinst.errors import DriverWarning # noqa: F401 from nimodinst.errors import Error # noqa: F401 @@ -10,12 +10,12 @@ def get_diagnostic_information(): - '''Get diagnostic information about the system state that is suitable for printing or logging + """Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - ''' + """ import os import pkg_resources import platform @@ -23,73 +23,80 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return (struct.calcsize("P") == 8) + return struct.calcsize("P") == 8 def is_os_64bit(): - return platform.machine().endswith('64') + return platform.machine().endswith("64") def is_venv(): - return 'VIRTUAL_ENV' in os.environ + return "VIRTUAL_ENV" in os.environ info = {} - info['os'] = {} - info['python'] = {} - info['driver'] = {} - info['module'] = {} - if platform.system() == 'Windows': + info["os"] = {} + info["python"] = {} + info["driver"] = {} + info["module"] = {} + if platform.system() == "Windows": try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = 'Windows' + os_name = "Windows" try: - driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-ModInst\CurrentVersion") + driver_version_key = winreg.OpenKey( + winreg.HKEY_LOCAL_MACHINE, + r"SOFTWARE\National Instruments\NI-ModInst\CurrentVersion", + ) driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = 'Unknown' - elif platform.system() == 'Linux': - os_name = 'Linux' - driver_version = 'Unknown' + driver_version = "Unknown" + elif platform.system() == "Linux": + os_name = "Linux" + driver_version = "Unknown" else: - raise SystemError('Unsupported platform: {}'.format(platform.system())) + raise SystemError("Unsupported platform: {}".format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] - - info['os']['name'] = os_name - info['os']['version'] = platform.version() - info['os']['bits'] = '64' if is_os_64bit() else '32' - info['driver']['name'] = "NI-ModInst" - info['driver']['version'] = driver_version - info['module']['name'] = 'nimodinst' - info['module']['version'] = "1.4.2.dev0" - info['python']['version'] = sys.version - info['python']['bits'] = '64' if is_python_64bit() else '32' - info['python']['is_venv'] = is_venv() - info['python']['packages'] = installed_packages_list + installed_packages_list = [ + { + "name": i.key, + "version": i.version, + } + for i in installed_packages + ] + + info["os"]["name"] = os_name + info["os"]["version"] = platform.version() + info["os"]["bits"] = "64" if is_os_64bit() else "32" + info["driver"]["name"] = "NI-ModInst" + info["driver"]["version"] = driver_version + info["module"]["name"] = "nimodinst" + info["module"]["version"] = "1.4.2.dev0" + info["python"]["version"] = sys.version + info["python"]["bits"] = "64" if is_python_64bit() else "32" + info["python"]["is_venv"] = is_venv() + info["python"]["packages"] = installed_packages_list return info def print_diagnostic_information(): - '''Print diagnostic information in a format suitable for issue report + """Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - ''' + """ info = get_diagnostic_information() - row_format = ' {:<10} {}' - for type in ['OS', 'Driver', 'Module', 'Python']: + row_format = " {:<10} {}" + for type in ["OS", "Driver", "Module", "Python"]: typename = type.lower() - print(type + ':') + print(type + ":") for item in info[typename]: - if item != 'packages': - print(row_format.format(item.title() + ':', info[typename][item])) - print(' Installed Packages:') - for p in info['python']['packages']: - print((' ' * 8) + p['name'] + '==' + p['version']) + if item != "packages": + print(row_format.format(item.title() + ":", info[typename][item])) + print(" Installed Packages:") + for p in info["python"]["packages"]: + print((" " * 8) + p["name"] + "==" + p["version"]) return info - - diff --git a/generated/nimodinst/nimodinst/_converters.py b/generated/nimodinst/nimodinst/_converters.py index 8851ba799..f58b2d776 100644 --- a/generated/nimodinst/nimodinst/_converters.py +++ b/generated/nimodinst/nimodinst/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - '''Base version that should not be called + """Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,36 +40,38 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - ''' - raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + """ + raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - '''Integer version''' + """Integer version""" return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - '''String version (this is the most complex) + """String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - ''' + """ # First we deal with a list - rep_cap_list = repeated_capability.split(',') + rep_cap_list = repeated_capability.split(",") if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, '').replace(':', '-') - rc = r.split('-') + r = repeated_capability.strip().replace(prefix, "").replace(":", "-") + rc = r.split("-") if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + raise errors.InvalidRepeatedCapabilityError( + "Multiple '-' or ':'", repeated_capability + ) try: start = int(rc[0]) end = int(rc[1]) @@ -85,7 +87,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, '').strip()] + return [repeated_capability.replace(prefix, "").strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -94,7 +96,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - '''Iterable version - can handle lists, ranges, and tuples''' + """Iterable version - can handle lists, ranges, and tuples""" rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -103,16 +105,22 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - '''slice version''' + """slice version""" + def ifnone(a, b): return b if a is None else a + # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) + rng = range( + ifnone(repeated_capability.start, 0), + repeated_capability.stop, + ifnone(repeated_capability.step, 1), + ) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=''): - '''Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=""): + """Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -120,15 +128,17 @@ def convert_repeated_capabilities(repeated_capability, prefix=''): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - ''' + """ # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] + return [ + prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) + ] def convert_repeated_capabilities_without_prefix(repeated_capability): - '''Convert a repeated capabilities object, without any prefix, to a comma delimited list + """Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -144,8 +154,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - ''' - return ','.join(convert_repeated_capabilities(repeated_capability, '')) + """ + return ",".join(convert_repeated_capabilities(repeated_capability, "")) def _convert_timedelta(value, library_type, scaling): @@ -158,7 +168,14 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: + if library_type in [ + _visatype.ViInt64, + _visatype.ViInt32, + _visatype.ViUInt32, + _visatype.ViInt16, + _visatype.ViUInt16, + _visatype.ViInt8, + ]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -195,34 +212,36 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - 'rangecheck': 'RangeCheck', - 'queryinstrstatus': 'QueryInstrStatus', - 'cache': 'Cache', - 'simulate': 'Simulate', - 'recordcoercions': 'RecordCoercions', - 'interchangecheck': 'InterchangeCheck', - 'driversetup': 'DriverSetup', - 'range_check': 'RangeCheck', - 'query_instr_status': 'QueryInstrStatus', - 'record_coercions': 'RecordCoercions', - 'interchange_check': 'InterchangeCheck', - 'driver_setup': 'DriverSetup', + "rangecheck": "RangeCheck", + "queryinstrstatus": "QueryInstrStatus", + "cache": "Cache", + "simulate": "Simulate", + "recordcoercions": "RecordCoercions", + "interchangecheck": "InterchangeCheck", + "driversetup": "DriverSetup", + "range_check": "RangeCheck", + "query_instr_status": "QueryInstrStatus", + "record_coercions": "RecordCoercions", + "interchange_check": "InterchangeCheck", + "driver_setup": "DriverSetup", } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': - value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') - elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': + if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": + value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") + elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": if not isinstance(values[k], dict): - raise TypeError('DriverSetup must be a dictionary') - value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) + raise TypeError("DriverSetup must be a dictionary") + value = "DriverSetup=" + ( + ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) + ) else: - value = k + ('=1' if values[k] is True else '=0') + value = k + ("=1" if values[k] is True else "=0") init_with_options.append(value) - init_with_options_string = ','.join(init_with_options) + init_with_options_string = ",".join(init_with_options) return init_with_options_string @@ -251,11 +270,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(',')] + return [x.strip() for x in comma_separated_string.split(",")] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -267,11 +286,17 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - ''' - chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) - repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] + """ + chained_repeated_capability_items = convert_comma_separated_string_to_list( + chained_repeated_capability + ) + repeated_capability_lists = [ + [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) + ] for item in chained_repeated_capability_items: - repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] - return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] - - + repeated_capability_lists = [ + x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) + ] + return [ + ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists + ] diff --git a/generated/niscope/niscope/__init__.py b/generated/niscope/niscope/__init__.py index cb3b1a12e..bcc8677f0 100644 --- a/generated/niscope/niscope/__init__.py +++ b/generated/niscope/niscope/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = '1.4.2.dev0' +__version__ = "1.4.2.dev0" from niscope.enums import * # noqa: F403,F401,H303 from niscope.errors import DriverWarning # noqa: F401 @@ -17,12 +17,12 @@ def get_diagnostic_information(): - '''Get diagnostic information about the system state that is suitable for printing or logging + """Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - ''' + """ import os import pkg_resources import platform @@ -30,73 +30,80 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return (struct.calcsize("P") == 8) + return struct.calcsize("P") == 8 def is_os_64bit(): - return platform.machine().endswith('64') + return platform.machine().endswith("64") def is_venv(): - return 'VIRTUAL_ENV' in os.environ + return "VIRTUAL_ENV" in os.environ info = {} - info['os'] = {} - info['python'] = {} - info['driver'] = {} - info['module'] = {} - if platform.system() == 'Windows': + info["os"] = {} + info["python"] = {} + info["driver"] = {} + info["module"] = {} + if platform.system() == "Windows": try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = 'Windows' + os_name = "Windows" try: - driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-SCOPE\CurrentVersion") + driver_version_key = winreg.OpenKey( + winreg.HKEY_LOCAL_MACHINE, + r"SOFTWARE\National Instruments\NI-SCOPE\CurrentVersion", + ) driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = 'Unknown' - elif platform.system() == 'Linux': - os_name = 'Linux' - driver_version = 'Unknown' + driver_version = "Unknown" + elif platform.system() == "Linux": + os_name = "Linux" + driver_version = "Unknown" else: - raise SystemError('Unsupported platform: {}'.format(platform.system())) + raise SystemError("Unsupported platform: {}".format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] - - info['os']['name'] = os_name - info['os']['version'] = platform.version() - info['os']['bits'] = '64' if is_os_64bit() else '32' - info['driver']['name'] = "NI-SCOPE" - info['driver']['version'] = driver_version - info['module']['name'] = 'niscope' - info['module']['version'] = "1.4.2.dev0" - info['python']['version'] = sys.version - info['python']['bits'] = '64' if is_python_64bit() else '32' - info['python']['is_venv'] = is_venv() - info['python']['packages'] = installed_packages_list + installed_packages_list = [ + { + "name": i.key, + "version": i.version, + } + for i in installed_packages + ] + + info["os"]["name"] = os_name + info["os"]["version"] = platform.version() + info["os"]["bits"] = "64" if is_os_64bit() else "32" + info["driver"]["name"] = "NI-SCOPE" + info["driver"]["version"] = driver_version + info["module"]["name"] = "niscope" + info["module"]["version"] = "1.4.2.dev0" + info["python"]["version"] = sys.version + info["python"]["bits"] = "64" if is_python_64bit() else "32" + info["python"]["is_venv"] = is_venv() + info["python"]["packages"] = installed_packages_list return info def print_diagnostic_information(): - '''Print diagnostic information in a format suitable for issue report + """Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - ''' + """ info = get_diagnostic_information() - row_format = ' {:<10} {}' - for type in ['OS', 'Driver', 'Module', 'Python']: + row_format = " {:<10} {}" + for type in ["OS", "Driver", "Module", "Python"]: typename = type.lower() - print(type + ':') + print(type + ":") for item in info[typename]: - if item != 'packages': - print(row_format.format(item.title() + ':', info[typename][item])) - print(' Installed Packages:') - for p in info['python']['packages']: - print((' ' * 8) + p['name'] + '==' + p['version']) + if item != "packages": + print(row_format.format(item.title() + ":", info[typename][item])) + print(" Installed Packages:") + for p in info["python"]["packages"]: + print((" " * 8) + p["name"] + "==" + p["version"]) return info - - diff --git a/generated/niscope/niscope/_attributes.py b/generated/niscope/niscope/_attributes.py index 4647d930d..d1522c6ef 100644 --- a/generated/niscope/niscope/_attributes.py +++ b/generated/niscope/niscope/_attributes.py @@ -6,14 +6,13 @@ class Attribute(object): - '''Base class for all typed attributes.''' + """Base class for all typed attributes.""" def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -22,16 +21,19 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) + return hightime.timedelta( + milliseconds=session._get_attribute_vi_int32(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) + session._set_attribute_vi_int32( + self._attribute_id, + _converters.convert_timedelta_to_milliseconds_int32(value).value, + ) class AttributeViInt64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -40,7 +42,6 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -49,16 +50,19 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) + return hightime.timedelta( + seconds=session._get_attribute_vi_real64(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) + session._set_attribute_vi_real64( + self._attribute_id, + _converters.convert_timedelta_to_seconds_real64(value).value, + ) class AttributeViString(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -67,16 +71,17 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) + session._set_attribute_vi_string( + self._attribute_id, + _converters.convert_repeated_capabilities_without_prefix(value), + ) class AttributeViBoolean(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -85,31 +90,36 @@ def __set__(self, session, value): class AttributeEnum(object): - def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) + return self._attribute_type( + self._underlying_attribute.__get__(session, session_type) + ) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) + raise TypeError( + "must be " + + str(self._attribute_type.__name__) + + " not " + + str(type(value).__name__) + ) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): - def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from niscope.session import SessionReference + return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) - - - + session._set_attribute_vi_session( + self._attribute_id, _converters.convert_to_nitclk_session_number(value) + ) diff --git a/generated/niscope/niscope/_converters.py b/generated/niscope/niscope/_converters.py index 223d8e26b..8839d84e2 100644 --- a/generated/niscope/niscope/_converters.py +++ b/generated/niscope/niscope/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - '''Base version that should not be called + """Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,36 +40,38 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - ''' - raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + """ + raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - '''Integer version''' + """Integer version""" return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - '''String version (this is the most complex) + """String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - ''' + """ # First we deal with a list - rep_cap_list = repeated_capability.split(',') + rep_cap_list = repeated_capability.split(",") if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, '').replace(':', '-') - rc = r.split('-') + r = repeated_capability.strip().replace(prefix, "").replace(":", "-") + rc = r.split("-") if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + raise errors.InvalidRepeatedCapabilityError( + "Multiple '-' or ':'", repeated_capability + ) try: start = int(rc[0]) end = int(rc[1]) @@ -85,7 +87,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, '').strip()] + return [repeated_capability.replace(prefix, "").strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -94,7 +96,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - '''Iterable version - can handle lists, ranges, and tuples''' + """Iterable version - can handle lists, ranges, and tuples""" rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -103,16 +105,22 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - '''slice version''' + """slice version""" + def ifnone(a, b): return b if a is None else a + # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) + rng = range( + ifnone(repeated_capability.start, 0), + repeated_capability.stop, + ifnone(repeated_capability.step, 1), + ) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=''): - '''Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=""): + """Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -120,15 +128,17 @@ def convert_repeated_capabilities(repeated_capability, prefix=''): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - ''' + """ # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] + return [ + prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) + ] def convert_repeated_capabilities_without_prefix(repeated_capability): - '''Convert a repeated capabilities object, without any prefix, to a comma delimited list + """Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -144,8 +154,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - ''' - return ','.join(convert_repeated_capabilities(repeated_capability, '')) + """ + return ",".join(convert_repeated_capabilities(repeated_capability, "")) def _convert_timedelta(value, library_type, scaling): @@ -158,7 +168,14 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: + if library_type in [ + _visatype.ViInt64, + _visatype.ViInt32, + _visatype.ViUInt32, + _visatype.ViInt16, + _visatype.ViUInt16, + _visatype.ViInt8, + ]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -195,34 +212,36 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - 'rangecheck': 'RangeCheck', - 'queryinstrstatus': 'QueryInstrStatus', - 'cache': 'Cache', - 'simulate': 'Simulate', - 'recordcoercions': 'RecordCoercions', - 'interchangecheck': 'InterchangeCheck', - 'driversetup': 'DriverSetup', - 'range_check': 'RangeCheck', - 'query_instr_status': 'QueryInstrStatus', - 'record_coercions': 'RecordCoercions', - 'interchange_check': 'InterchangeCheck', - 'driver_setup': 'DriverSetup', + "rangecheck": "RangeCheck", + "queryinstrstatus": "QueryInstrStatus", + "cache": "Cache", + "simulate": "Simulate", + "recordcoercions": "RecordCoercions", + "interchangecheck": "InterchangeCheck", + "driversetup": "DriverSetup", + "range_check": "RangeCheck", + "query_instr_status": "QueryInstrStatus", + "record_coercions": "RecordCoercions", + "interchange_check": "InterchangeCheck", + "driver_setup": "DriverSetup", } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': - value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') - elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': + if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": + value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") + elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": if not isinstance(values[k], dict): - raise TypeError('DriverSetup must be a dictionary') - value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) + raise TypeError("DriverSetup must be a dictionary") + value = "DriverSetup=" + ( + ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) + ) else: - value = k + ('=1' if values[k] is True else '=0') + value = k + ("=1" if values[k] is True else "=0") init_with_options.append(value) - init_with_options_string = ','.join(init_with_options) + init_with_options_string = ",".join(init_with_options) return init_with_options_string @@ -251,11 +270,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(',')] + return [x.strip() for x in comma_separated_string.split(",")] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -267,11 +286,17 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - ''' - chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) - repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] + """ + chained_repeated_capability_items = convert_comma_separated_string_to_list( + chained_repeated_capability + ) + repeated_capability_lists = [ + [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) + ] for item in chained_repeated_capability_items: - repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] - return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] - - + repeated_capability_lists = [ + x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) + ] + return [ + ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists + ] diff --git a/generated/nise/nise/__init__.py b/generated/nise/nise/__init__.py index 982f424d6..02110c498 100644 --- a/generated/nise/nise/__init__.py +++ b/generated/nise/nise/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = '1.4.2.dev0' +__version__ = "1.4.2.dev0" from nise.enums import * # noqa: F403,F401,H303 from nise.errors import DriverWarning # noqa: F401 @@ -11,12 +11,12 @@ def get_diagnostic_information(): - '''Get diagnostic information about the system state that is suitable for printing or logging + """Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - ''' + """ import os import pkg_resources import platform @@ -24,73 +24,80 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return (struct.calcsize("P") == 8) + return struct.calcsize("P") == 8 def is_os_64bit(): - return platform.machine().endswith('64') + return platform.machine().endswith("64") def is_venv(): - return 'VIRTUAL_ENV' in os.environ + return "VIRTUAL_ENV" in os.environ info = {} - info['os'] = {} - info['python'] = {} - info['driver'] = {} - info['module'] = {} - if platform.system() == 'Windows': + info["os"] = {} + info["python"] = {} + info["driver"] = {} + info["module"] = {} + if platform.system() == "Windows": try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = 'Windows' + os_name = "Windows" try: - driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\Switch Executive\CurrentVersion") + driver_version_key = winreg.OpenKey( + winreg.HKEY_LOCAL_MACHINE, + r"SOFTWARE\National Instruments\Switch Executive\CurrentVersion", + ) driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = 'Unknown' - elif platform.system() == 'Linux': - os_name = 'Linux' - driver_version = 'Unknown' + driver_version = "Unknown" + elif platform.system() == "Linux": + os_name = "Linux" + driver_version = "Unknown" else: - raise SystemError('Unsupported platform: {}'.format(platform.system())) + raise SystemError("Unsupported platform: {}".format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] - - info['os']['name'] = os_name - info['os']['version'] = platform.version() - info['os']['bits'] = '64' if is_os_64bit() else '32' - info['driver']['name'] = "NI Switch Executive" - info['driver']['version'] = driver_version - info['module']['name'] = 'nise' - info['module']['version'] = "1.4.2.dev0" - info['python']['version'] = sys.version - info['python']['bits'] = '64' if is_python_64bit() else '32' - info['python']['is_venv'] = is_venv() - info['python']['packages'] = installed_packages_list + installed_packages_list = [ + { + "name": i.key, + "version": i.version, + } + for i in installed_packages + ] + + info["os"]["name"] = os_name + info["os"]["version"] = platform.version() + info["os"]["bits"] = "64" if is_os_64bit() else "32" + info["driver"]["name"] = "NI Switch Executive" + info["driver"]["version"] = driver_version + info["module"]["name"] = "nise" + info["module"]["version"] = "1.4.2.dev0" + info["python"]["version"] = sys.version + info["python"]["bits"] = "64" if is_python_64bit() else "32" + info["python"]["is_venv"] = is_venv() + info["python"]["packages"] = installed_packages_list return info def print_diagnostic_information(): - '''Print diagnostic information in a format suitable for issue report + """Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - ''' + """ info = get_diagnostic_information() - row_format = ' {:<10} {}' - for type in ['OS', 'Driver', 'Module', 'Python']: + row_format = " {:<10} {}" + for type in ["OS", "Driver", "Module", "Python"]: typename = type.lower() - print(type + ':') + print(type + ":") for item in info[typename]: - if item != 'packages': - print(row_format.format(item.title() + ':', info[typename][item])) - print(' Installed Packages:') - for p in info['python']['packages']: - print((' ' * 8) + p['name'] + '==' + p['version']) + if item != "packages": + print(row_format.format(item.title() + ":", info[typename][item])) + print(" Installed Packages:") + for p in info["python"]["packages"]: + print((" " * 8) + p["name"] + "==" + p["version"]) return info - - diff --git a/generated/nise/nise/_converters.py b/generated/nise/nise/_converters.py index 63de67487..577411557 100644 --- a/generated/nise/nise/_converters.py +++ b/generated/nise/nise/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - '''Base version that should not be called + """Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,36 +40,38 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - ''' - raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + """ + raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - '''Integer version''' + """Integer version""" return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - '''String version (this is the most complex) + """String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - ''' + """ # First we deal with a list - rep_cap_list = repeated_capability.split(',') + rep_cap_list = repeated_capability.split(",") if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, '').replace(':', '-') - rc = r.split('-') + r = repeated_capability.strip().replace(prefix, "").replace(":", "-") + rc = r.split("-") if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + raise errors.InvalidRepeatedCapabilityError( + "Multiple '-' or ':'", repeated_capability + ) try: start = int(rc[0]) end = int(rc[1]) @@ -85,7 +87,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, '').strip()] + return [repeated_capability.replace(prefix, "").strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -94,7 +96,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - '''Iterable version - can handle lists, ranges, and tuples''' + """Iterable version - can handle lists, ranges, and tuples""" rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -103,16 +105,22 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - '''slice version''' + """slice version""" + def ifnone(a, b): return b if a is None else a + # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) + rng = range( + ifnone(repeated_capability.start, 0), + repeated_capability.stop, + ifnone(repeated_capability.step, 1), + ) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=''): - '''Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=""): + """Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -120,15 +128,17 @@ def convert_repeated_capabilities(repeated_capability, prefix=''): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - ''' + """ # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] + return [ + prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) + ] def convert_repeated_capabilities_without_prefix(repeated_capability): - '''Convert a repeated capabilities object, without any prefix, to a comma delimited list + """Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -144,8 +154,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - ''' - return ','.join(convert_repeated_capabilities(repeated_capability, '')) + """ + return ",".join(convert_repeated_capabilities(repeated_capability, "")) def _convert_timedelta(value, library_type, scaling): @@ -158,7 +168,14 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: + if library_type in [ + _visatype.ViInt64, + _visatype.ViInt32, + _visatype.ViUInt32, + _visatype.ViInt16, + _visatype.ViUInt16, + _visatype.ViInt8, + ]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -195,34 +212,36 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - 'rangecheck': 'RangeCheck', - 'queryinstrstatus': 'QueryInstrStatus', - 'cache': 'Cache', - 'simulate': 'Simulate', - 'recordcoercions': 'RecordCoercions', - 'interchangecheck': 'InterchangeCheck', - 'driversetup': 'DriverSetup', - 'range_check': 'RangeCheck', - 'query_instr_status': 'QueryInstrStatus', - 'record_coercions': 'RecordCoercions', - 'interchange_check': 'InterchangeCheck', - 'driver_setup': 'DriverSetup', + "rangecheck": "RangeCheck", + "queryinstrstatus": "QueryInstrStatus", + "cache": "Cache", + "simulate": "Simulate", + "recordcoercions": "RecordCoercions", + "interchangecheck": "InterchangeCheck", + "driversetup": "DriverSetup", + "range_check": "RangeCheck", + "query_instr_status": "QueryInstrStatus", + "record_coercions": "RecordCoercions", + "interchange_check": "InterchangeCheck", + "driver_setup": "DriverSetup", } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': - value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') - elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': + if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": + value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") + elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": if not isinstance(values[k], dict): - raise TypeError('DriverSetup must be a dictionary') - value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) + raise TypeError("DriverSetup must be a dictionary") + value = "DriverSetup=" + ( + ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) + ) else: - value = k + ('=1' if values[k] is True else '=0') + value = k + ("=1" if values[k] is True else "=0") init_with_options.append(value) - init_with_options_string = ','.join(init_with_options) + init_with_options_string = ",".join(init_with_options) return init_with_options_string @@ -251,11 +270,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(',')] + return [x.strip() for x in comma_separated_string.split(",")] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -267,11 +286,17 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - ''' - chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) - repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] + """ + chained_repeated_capability_items = convert_comma_separated_string_to_list( + chained_repeated_capability + ) + repeated_capability_lists = [ + [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) + ] for item in chained_repeated_capability_items: - repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] - return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] - - + repeated_capability_lists = [ + x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) + ] + return [ + ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists + ] diff --git a/generated/niswitch/niswitch/__init__.py b/generated/niswitch/niswitch/__init__.py index a3318b471..200a683a6 100644 --- a/generated/niswitch/niswitch/__init__.py +++ b/generated/niswitch/niswitch/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = '1.4.2.dev0' +__version__ = "1.4.2.dev0" from niswitch.enums import * # noqa: F403,F401,H303 from niswitch.errors import DriverWarning # noqa: F401 @@ -11,12 +11,12 @@ def get_diagnostic_information(): - '''Get diagnostic information about the system state that is suitable for printing or logging + """Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - ''' + """ import os import pkg_resources import platform @@ -24,73 +24,80 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return (struct.calcsize("P") == 8) + return struct.calcsize("P") == 8 def is_os_64bit(): - return platform.machine().endswith('64') + return platform.machine().endswith("64") def is_venv(): - return 'VIRTUAL_ENV' in os.environ + return "VIRTUAL_ENV" in os.environ info = {} - info['os'] = {} - info['python'] = {} - info['driver'] = {} - info['module'] = {} - if platform.system() == 'Windows': + info["os"] = {} + info["python"] = {} + info["driver"] = {} + info["module"] = {} + if platform.system() == "Windows": try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = 'Windows' + os_name = "Windows" try: - driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-SWITCH\CurrentVersion") + driver_version_key = winreg.OpenKey( + winreg.HKEY_LOCAL_MACHINE, + r"SOFTWARE\National Instruments\NI-SWITCH\CurrentVersion", + ) driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = 'Unknown' - elif platform.system() == 'Linux': - os_name = 'Linux' - driver_version = 'Unknown' + driver_version = "Unknown" + elif platform.system() == "Linux": + os_name = "Linux" + driver_version = "Unknown" else: - raise SystemError('Unsupported platform: {}'.format(platform.system())) + raise SystemError("Unsupported platform: {}".format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] - - info['os']['name'] = os_name - info['os']['version'] = platform.version() - info['os']['bits'] = '64' if is_os_64bit() else '32' - info['driver']['name'] = "NI-SWITCH" - info['driver']['version'] = driver_version - info['module']['name'] = 'niswitch' - info['module']['version'] = "1.4.2.dev0" - info['python']['version'] = sys.version - info['python']['bits'] = '64' if is_python_64bit() else '32' - info['python']['is_venv'] = is_venv() - info['python']['packages'] = installed_packages_list + installed_packages_list = [ + { + "name": i.key, + "version": i.version, + } + for i in installed_packages + ] + + info["os"]["name"] = os_name + info["os"]["version"] = platform.version() + info["os"]["bits"] = "64" if is_os_64bit() else "32" + info["driver"]["name"] = "NI-SWITCH" + info["driver"]["version"] = driver_version + info["module"]["name"] = "niswitch" + info["module"]["version"] = "1.4.2.dev0" + info["python"]["version"] = sys.version + info["python"]["bits"] = "64" if is_python_64bit() else "32" + info["python"]["is_venv"] = is_venv() + info["python"]["packages"] = installed_packages_list return info def print_diagnostic_information(): - '''Print diagnostic information in a format suitable for issue report + """Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - ''' + """ info = get_diagnostic_information() - row_format = ' {:<10} {}' - for type in ['OS', 'Driver', 'Module', 'Python']: + row_format = " {:<10} {}" + for type in ["OS", "Driver", "Module", "Python"]: typename = type.lower() - print(type + ':') + print(type + ":") for item in info[typename]: - if item != 'packages': - print(row_format.format(item.title() + ':', info[typename][item])) - print(' Installed Packages:') - for p in info['python']['packages']: - print((' ' * 8) + p['name'] + '==' + p['version']) + if item != "packages": + print(row_format.format(item.title() + ":", info[typename][item])) + print(" Installed Packages:") + for p in info["python"]["packages"]: + print((" " * 8) + p["name"] + "==" + p["version"]) return info - - diff --git a/generated/niswitch/niswitch/_attributes.py b/generated/niswitch/niswitch/_attributes.py index ea564a33e..c003081d8 100644 --- a/generated/niswitch/niswitch/_attributes.py +++ b/generated/niswitch/niswitch/_attributes.py @@ -6,14 +6,13 @@ class Attribute(object): - '''Base class for all typed attributes.''' + """Base class for all typed attributes.""" def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -22,16 +21,19 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) + return hightime.timedelta( + milliseconds=session._get_attribute_vi_int32(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) + session._set_attribute_vi_int32( + self._attribute_id, + _converters.convert_timedelta_to_milliseconds_int32(value).value, + ) class AttributeViInt64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -40,7 +42,6 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -49,16 +50,19 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) + return hightime.timedelta( + seconds=session._get_attribute_vi_real64(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) + session._set_attribute_vi_real64( + self._attribute_id, + _converters.convert_timedelta_to_seconds_real64(value).value, + ) class AttributeViString(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -67,16 +71,17 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) + session._set_attribute_vi_string( + self._attribute_id, + _converters.convert_repeated_capabilities_without_prefix(value), + ) class AttributeViBoolean(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -85,31 +90,36 @@ def __set__(self, session, value): class AttributeEnum(object): - def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) + return self._attribute_type( + self._underlying_attribute.__get__(session, session_type) + ) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) + raise TypeError( + "must be " + + str(self._attribute_type.__name__) + + " not " + + str(type(value).__name__) + ) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): - def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from niswitch.session import SessionReference + return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) - - - + session._set_attribute_vi_session( + self._attribute_id, _converters.convert_to_nitclk_session_number(value) + ) diff --git a/generated/niswitch/niswitch/_converters.py b/generated/niswitch/niswitch/_converters.py index 02af41b77..a336125ed 100644 --- a/generated/niswitch/niswitch/_converters.py +++ b/generated/niswitch/niswitch/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - '''Base version that should not be called + """Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,36 +40,38 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - ''' - raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + """ + raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - '''Integer version''' + """Integer version""" return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - '''String version (this is the most complex) + """String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - ''' + """ # First we deal with a list - rep_cap_list = repeated_capability.split(',') + rep_cap_list = repeated_capability.split(",") if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, '').replace(':', '-') - rc = r.split('-') + r = repeated_capability.strip().replace(prefix, "").replace(":", "-") + rc = r.split("-") if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + raise errors.InvalidRepeatedCapabilityError( + "Multiple '-' or ':'", repeated_capability + ) try: start = int(rc[0]) end = int(rc[1]) @@ -85,7 +87,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, '').strip()] + return [repeated_capability.replace(prefix, "").strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -94,7 +96,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - '''Iterable version - can handle lists, ranges, and tuples''' + """Iterable version - can handle lists, ranges, and tuples""" rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -103,16 +105,22 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - '''slice version''' + """slice version""" + def ifnone(a, b): return b if a is None else a + # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) + rng = range( + ifnone(repeated_capability.start, 0), + repeated_capability.stop, + ifnone(repeated_capability.step, 1), + ) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=''): - '''Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=""): + """Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -120,15 +128,17 @@ def convert_repeated_capabilities(repeated_capability, prefix=''): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - ''' + """ # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] + return [ + prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) + ] def convert_repeated_capabilities_without_prefix(repeated_capability): - '''Convert a repeated capabilities object, without any prefix, to a comma delimited list + """Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -144,8 +154,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - ''' - return ','.join(convert_repeated_capabilities(repeated_capability, '')) + """ + return ",".join(convert_repeated_capabilities(repeated_capability, "")) def _convert_timedelta(value, library_type, scaling): @@ -158,7 +168,14 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: + if library_type in [ + _visatype.ViInt64, + _visatype.ViInt32, + _visatype.ViUInt32, + _visatype.ViInt16, + _visatype.ViUInt16, + _visatype.ViInt8, + ]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -195,34 +212,36 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - 'rangecheck': 'RangeCheck', - 'queryinstrstatus': 'QueryInstrStatus', - 'cache': 'Cache', - 'simulate': 'Simulate', - 'recordcoercions': 'RecordCoercions', - 'interchangecheck': 'InterchangeCheck', - 'driversetup': 'DriverSetup', - 'range_check': 'RangeCheck', - 'query_instr_status': 'QueryInstrStatus', - 'record_coercions': 'RecordCoercions', - 'interchange_check': 'InterchangeCheck', - 'driver_setup': 'DriverSetup', + "rangecheck": "RangeCheck", + "queryinstrstatus": "QueryInstrStatus", + "cache": "Cache", + "simulate": "Simulate", + "recordcoercions": "RecordCoercions", + "interchangecheck": "InterchangeCheck", + "driversetup": "DriverSetup", + "range_check": "RangeCheck", + "query_instr_status": "QueryInstrStatus", + "record_coercions": "RecordCoercions", + "interchange_check": "InterchangeCheck", + "driver_setup": "DriverSetup", } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': - value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') - elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': + if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": + value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") + elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": if not isinstance(values[k], dict): - raise TypeError('DriverSetup must be a dictionary') - value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) + raise TypeError("DriverSetup must be a dictionary") + value = "DriverSetup=" + ( + ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) + ) else: - value = k + ('=1' if values[k] is True else '=0') + value = k + ("=1" if values[k] is True else "=0") init_with_options.append(value) - init_with_options_string = ','.join(init_with_options) + init_with_options_string = ",".join(init_with_options) return init_with_options_string @@ -251,11 +270,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(',')] + return [x.strip() for x in comma_separated_string.split(",")] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -267,11 +286,17 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - ''' - chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) - repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] + """ + chained_repeated_capability_items = convert_comma_separated_string_to_list( + chained_repeated_capability + ) + repeated_capability_lists = [ + [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) + ] for item in chained_repeated_capability_items: - repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] - return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] - - + repeated_capability_lists = [ + x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) + ] + return [ + ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists + ] diff --git a/generated/nitclk/nitclk/__init__.py b/generated/nitclk/nitclk/__init__.py index f17a5e9c1..fbf2200ef 100644 --- a/generated/nitclk/nitclk/__init__.py +++ b/generated/nitclk/nitclk/__init__.py @@ -2,7 +2,7 @@ # This file was generated -__version__ = '1.4.2.dev0' +__version__ = "1.4.2.dev0" from nitclk.errors import DriverWarning # noqa: F401 from nitclk.errors import Error # noqa: F401 @@ -20,12 +20,12 @@ def get_diagnostic_information(): - '''Get diagnostic information about the system state that is suitable for printing or logging + """Get diagnostic information about the system state that is suitable for printing or logging returns: dict note: Python bitness may be incorrect when running in a virtual environment - ''' + """ import os import pkg_resources import platform @@ -33,73 +33,80 @@ def get_diagnostic_information(): import sys def is_python_64bit(): - return (struct.calcsize("P") == 8) + return struct.calcsize("P") == 8 def is_os_64bit(): - return platform.machine().endswith('64') + return platform.machine().endswith("64") def is_venv(): - return 'VIRTUAL_ENV' in os.environ + return "VIRTUAL_ENV" in os.environ info = {} - info['os'] = {} - info['python'] = {} - info['driver'] = {} - info['module'] = {} - if platform.system() == 'Windows': + info["os"] = {} + info["python"] = {} + info["driver"] = {} + info["module"] = {} + if platform.system() == "Windows": try: import winreg as winreg except ImportError: import _winreg as winreg - os_name = 'Windows' + os_name = "Windows" try: - driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\NI-TClk\CurrentVersion") + driver_version_key = winreg.OpenKey( + winreg.HKEY_LOCAL_MACHINE, + r"SOFTWARE\National Instruments\NI-TClk\CurrentVersion", + ) driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] except WindowsError: - driver_version = 'Unknown' - elif platform.system() == 'Linux': - os_name = 'Linux' - driver_version = 'Unknown' + driver_version = "Unknown" + elif platform.system() == "Linux": + os_name = "Linux" + driver_version = "Unknown" else: - raise SystemError('Unsupported platform: {}'.format(platform.system())) + raise SystemError("Unsupported platform: {}".format(platform.system())) installed_packages = pkg_resources.working_set - installed_packages_list = [{'name': i.key, 'version': i.version, } for i in installed_packages] - - info['os']['name'] = os_name - info['os']['version'] = platform.version() - info['os']['bits'] = '64' if is_os_64bit() else '32' - info['driver']['name'] = "NI-TClk" - info['driver']['version'] = driver_version - info['module']['name'] = 'nitclk' - info['module']['version'] = "1.4.2.dev0" - info['python']['version'] = sys.version - info['python']['bits'] = '64' if is_python_64bit() else '32' - info['python']['is_venv'] = is_venv() - info['python']['packages'] = installed_packages_list + installed_packages_list = [ + { + "name": i.key, + "version": i.version, + } + for i in installed_packages + ] + + info["os"]["name"] = os_name + info["os"]["version"] = platform.version() + info["os"]["bits"] = "64" if is_os_64bit() else "32" + info["driver"]["name"] = "NI-TClk" + info["driver"]["version"] = driver_version + info["module"]["name"] = "nitclk" + info["module"]["version"] = "1.4.2.dev0" + info["python"]["version"] = sys.version + info["python"]["bits"] = "64" if is_python_64bit() else "32" + info["python"]["is_venv"] = is_venv() + info["python"]["packages"] = installed_packages_list return info def print_diagnostic_information(): - '''Print diagnostic information in a format suitable for issue report + """Print diagnostic information in a format suitable for issue report note: Python bitness may be incorrect when running in a virtual environment - ''' + """ info = get_diagnostic_information() - row_format = ' {:<10} {}' - for type in ['OS', 'Driver', 'Module', 'Python']: + row_format = " {:<10} {}" + for type in ["OS", "Driver", "Module", "Python"]: typename = type.lower() - print(type + ':') + print(type + ":") for item in info[typename]: - if item != 'packages': - print(row_format.format(item.title() + ':', info[typename][item])) - print(' Installed Packages:') - for p in info['python']['packages']: - print((' ' * 8) + p['name'] + '==' + p['version']) + if item != "packages": + print(row_format.format(item.title() + ":", info[typename][item])) + print(" Installed Packages:") + for p in info["python"]["packages"]: + print((" " * 8) + p["name"] + "==" + p["version"]) return info - - diff --git a/generated/nitclk/nitclk/_attributes.py b/generated/nitclk/nitclk/_attributes.py index 73c7c66fe..33ac0b907 100644 --- a/generated/nitclk/nitclk/_attributes.py +++ b/generated/nitclk/nitclk/_attributes.py @@ -6,14 +6,13 @@ class Attribute(object): - '''Base class for all typed attributes.''' + """Base class for all typed attributes.""" def __init__(self, attribute_id): self._attribute_id = attribute_id class AttributeViInt32(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int32(self._attribute_id) @@ -22,16 +21,19 @@ def __set__(self, session, value): class AttributeViInt32TimeDeltaMilliseconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(milliseconds=session._get_attribute_vi_int32(self._attribute_id)) + return hightime.timedelta( + milliseconds=session._get_attribute_vi_int32(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_int32(self._attribute_id, _converters.convert_timedelta_to_milliseconds_int32(value).value) + session._set_attribute_vi_int32( + self._attribute_id, + _converters.convert_timedelta_to_milliseconds_int32(value).value, + ) class AttributeViInt64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_int64(self._attribute_id) @@ -40,7 +42,6 @@ def __set__(self, session, value): class AttributeViReal64(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_real64(self._attribute_id) @@ -49,16 +50,19 @@ def __set__(self, session, value): class AttributeViReal64TimeDeltaSeconds(Attribute): - def __get__(self, session, session_type): - return hightime.timedelta(seconds=session._get_attribute_vi_real64(self._attribute_id)) + return hightime.timedelta( + seconds=session._get_attribute_vi_real64(self._attribute_id) + ) def __set__(self, session, value): - session._set_attribute_vi_real64(self._attribute_id, _converters.convert_timedelta_to_seconds_real64(value).value) + session._set_attribute_vi_real64( + self._attribute_id, + _converters.convert_timedelta_to_seconds_real64(value).value, + ) class AttributeViString(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) @@ -67,16 +71,17 @@ def __set__(self, session, value): class AttributeViStringRepeatedCapability(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_string(self._attribute_id) def __set__(self, session, value): - session._set_attribute_vi_string(self._attribute_id, _converters.convert_repeated_capabilities_without_prefix(value)) + session._set_attribute_vi_string( + self._attribute_id, + _converters.convert_repeated_capabilities_without_prefix(value), + ) class AttributeViBoolean(Attribute): - def __get__(self, session, session_type): return session._get_attribute_vi_boolean(self._attribute_id) @@ -85,31 +90,36 @@ def __set__(self, session, value): class AttributeEnum(object): - def __init__(self, underlying_attribute_meta_class, enum_meta_class, attribute_id): self._underlying_attribute = underlying_attribute_meta_class(attribute_id) self._attribute_type = enum_meta_class self._attribute_id = attribute_id def __get__(self, session, session_type): - return self._attribute_type(self._underlying_attribute.__get__(session, session_type)) + return self._attribute_type( + self._underlying_attribute.__get__(session, session_type) + ) def __set__(self, session, value): if type(value) is not self._attribute_type: - raise TypeError('must be ' + str(self._attribute_type.__name__) + ' not ' + str(type(value).__name__)) + raise TypeError( + "must be " + + str(self._attribute_type.__name__) + + " not " + + str(type(value).__name__) + ) return self._underlying_attribute.__set__(session, value.value) # nitclk specific attribute type class AttributeSessionReference(Attribute): - def __get__(self, session, session_type): # Import here to avoid a circular dependency when initial import happens from nitclk.session import SessionReference + return SessionReference(session._get_attribute_vi_session(self._attribute_id)) def __set__(self, session, value): - session._set_attribute_vi_session(self._attribute_id, _converters.convert_to_nitclk_session_number(value)) - - - + session._set_attribute_vi_session( + self._attribute_id, _converters.convert_to_nitclk_session_number(value) + ) diff --git a/generated/nitclk/nitclk/_converters.py b/generated/nitclk/nitclk/_converters.py index 45f76e0d2..9d5ae352f 100644 --- a/generated/nitclk/nitclk/_converters.py +++ b/generated/nitclk/nitclk/_converters.py @@ -13,7 +13,7 @@ @singledispatch def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - '''Base version that should not be called + """Base version that should not be called Overall purpose is to convert the repeated capabilities to a list of strings with prefix from what ever form @@ -40,36 +40,38 @@ def _convert_repeated_capabilities(arg, prefix): # noqa: F811 - ('0-1', 4) --> ['0', '1', '4'] - (slice(0, 1), '2', [4, '5-6'], '7-9', '11:14', '16, 17') --> ['0', '2', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '16', '17'] - ''' - raise errors.InvalidRepeatedCapabilityError('Invalid type', type(arg)) + """ + raise errors.InvalidRepeatedCapabilityError("Invalid type", type(arg)) @_convert_repeated_capabilities.register(numbers.Integral) # noqa: F811 def _(repeated_capability, prefix): - '''Integer version''' + """Integer version""" return [str(repeated_capability)] # This parsing function duplicate the parsing in the driver, so if changes to the allowed format are made there, they will need to be replicated here. @_convert_repeated_capabilities.register(str) # noqa: F811 def _(repeated_capability, prefix): - '''String version (this is the most complex) + """String version (this is the most complex) We need to deal with a range ('0-3' or '0:3'), a list ('0,1,2,3') and a single item - ''' + """ # First we deal with a list - rep_cap_list = repeated_capability.split(',') + rep_cap_list = repeated_capability.split(",") if len(rep_cap_list) > 1: # We have a list so call ourselves again to let the iterable instance handle it return _convert_repeated_capabilities(rep_cap_list, prefix) # Now we deal with ranges # We remove any prefix and change ':' to '-' - r = repeated_capability.strip().replace(prefix, '').replace(':', '-') - rc = r.split('-') + r = repeated_capability.strip().replace(prefix, "").replace(":", "-") + rc = r.split("-") if len(rc) > 1: if len(rc) > 2: - raise errors.InvalidRepeatedCapabilityError("Multiple '-' or ':'", repeated_capability) + raise errors.InvalidRepeatedCapabilityError( + "Multiple '-' or ':'", repeated_capability + ) try: start = int(rc[0]) end = int(rc[1]) @@ -85,7 +87,7 @@ def _(repeated_capability, prefix): return _convert_repeated_capabilities(rng, prefix) # If we made it here, it must be a simple item so we remove any prefix and return - return [repeated_capability.replace(prefix, '').strip()] + return [repeated_capability.replace(prefix, "").strip()] # We cannot use collections.abc.Iterable here because strings are also iterable and then this @@ -94,7 +96,7 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(range) # noqa: F811 @_convert_repeated_capabilities.register(tuple) # noqa: F811 def _(repeated_capability, prefix): - '''Iterable version - can handle lists, ranges, and tuples''' + """Iterable version - can handle lists, ranges, and tuples""" rep_cap_list = [] for r in repeated_capability: rep_cap_list += _convert_repeated_capabilities(r, prefix) @@ -103,16 +105,22 @@ def _(repeated_capability, prefix): @_convert_repeated_capabilities.register(slice) # noqa: F811 def _(repeated_capability, prefix): - '''slice version''' + """slice version""" + def ifnone(a, b): return b if a is None else a + # Turn the slice into a list and call ourselves again to let the iterable instance handle it - rng = range(ifnone(repeated_capability.start, 0), repeated_capability.stop, ifnone(repeated_capability.step, 1)) + rng = range( + ifnone(repeated_capability.start, 0), + repeated_capability.stop, + ifnone(repeated_capability.step, 1), + ) return _convert_repeated_capabilities(rng, prefix) -def convert_repeated_capabilities(repeated_capability, prefix=''): - '''Convert a repeated capabilities object to a comma delimited list +def convert_repeated_capabilities(repeated_capability, prefix=""): + """Convert a repeated capabilities object to a comma delimited list Args: repeated_capability (str, list, tuple, slice, None) - @@ -120,15 +128,17 @@ def convert_repeated_capabilities(repeated_capability, prefix=''): Returns: rep_cap_list (list of str) - list of each repeated capability item with ranges expanded and prefix added - ''' + """ # We need to explicitly handle None here. Everything else we can pass on to the singledispatch functions if repeated_capability is None: return [] - return [prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix)] + return [ + prefix + r for r in _convert_repeated_capabilities(repeated_capability, prefix) + ] def convert_repeated_capabilities_without_prefix(repeated_capability): - '''Convert a repeated capabilities object, without any prefix, to a comma delimited list + """Convert a repeated capabilities object, without any prefix, to a comma delimited list Args: repeated_capability - Supported types: @@ -144,8 +154,8 @@ def convert_repeated_capabilities_without_prefix(repeated_capability): Returns: rep_cap (str) - comma delimited string of each repeated capability item with ranges expanded - ''' - return ','.join(convert_repeated_capabilities(repeated_capability, '')) + """ + return ",".join(convert_repeated_capabilities(repeated_capability, "")) def _convert_timedelta(value, library_type, scaling): @@ -158,7 +168,14 @@ def _convert_timedelta(value, library_type, scaling): scaled_value = float(value) * scaling # ctype integer types don't convert to int from float so we need to - if library_type in [_visatype.ViInt64, _visatype.ViInt32, _visatype.ViUInt32, _visatype.ViInt16, _visatype.ViUInt16, _visatype.ViInt8]: + if library_type in [ + _visatype.ViInt64, + _visatype.ViInt32, + _visatype.ViUInt32, + _visatype.ViInt16, + _visatype.ViUInt16, + _visatype.ViInt8, + ]: scaled_value = int(scaled_value) return library_type(scaled_value) @@ -195,34 +212,36 @@ def convert_init_with_options_dictionary(values): init_with_options_string = values else: good_keys = { - 'rangecheck': 'RangeCheck', - 'queryinstrstatus': 'QueryInstrStatus', - 'cache': 'Cache', - 'simulate': 'Simulate', - 'recordcoercions': 'RecordCoercions', - 'interchangecheck': 'InterchangeCheck', - 'driversetup': 'DriverSetup', - 'range_check': 'RangeCheck', - 'query_instr_status': 'QueryInstrStatus', - 'record_coercions': 'RecordCoercions', - 'interchange_check': 'InterchangeCheck', - 'driver_setup': 'DriverSetup', + "rangecheck": "RangeCheck", + "queryinstrstatus": "QueryInstrStatus", + "cache": "Cache", + "simulate": "Simulate", + "recordcoercions": "RecordCoercions", + "interchangecheck": "InterchangeCheck", + "driversetup": "DriverSetup", + "range_check": "RangeCheck", + "query_instr_status": "QueryInstrStatus", + "record_coercions": "RecordCoercions", + "interchange_check": "InterchangeCheck", + "driver_setup": "DriverSetup", } init_with_options = [] for k in sorted(values.keys()): value = None - if k.lower() in good_keys and not good_keys[k.lower()] == 'DriverSetup': - value = good_keys[k.lower()] + ('=1' if values[k] is True else '=0') - elif k.lower() in good_keys and good_keys[k.lower()] == 'DriverSetup': + if k.lower() in good_keys and not good_keys[k.lower()] == "DriverSetup": + value = good_keys[k.lower()] + ("=1" if values[k] is True else "=0") + elif k.lower() in good_keys and good_keys[k.lower()] == "DriverSetup": if not isinstance(values[k], dict): - raise TypeError('DriverSetup must be a dictionary') - value = 'DriverSetup=' + (';'.join([key + ':' + values[k][key] for key in sorted(values[k])])) + raise TypeError("DriverSetup must be a dictionary") + value = "DriverSetup=" + ( + ";".join([key + ":" + values[k][key] for key in sorted(values[k])]) + ) else: - value = k + ('=1' if values[k] is True else '=0') + value = k + ("=1" if values[k] is True else "=0") init_with_options.append(value) - init_with_options_string = ','.join(init_with_options) + init_with_options_string = ",".join(init_with_options) return init_with_options_string @@ -251,11 +270,11 @@ def convert_to_bytes(value): # noqa: F811 def convert_comma_separated_string_to_list(comma_separated_string): - return [x.strip() for x in comma_separated_string.split(',')] + return [x.strip() for x in comma_separated_string.split(",")] def convert_chained_repeated_capability_to_parts(chained_repeated_capability): - '''Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. + """Convert a chained repeated capabilities string to a list of comma-delimited repeated capabilities string. Converter assumes that the input contains the full cartesian product of its parts. e.g. If chained_repeated_capability is 'site0/PinA,site0/PinB,site1/PinA,site1/PinB', @@ -267,22 +286,30 @@ def convert_chained_repeated_capability_to_parts(chained_repeated_capability): Returns: rep_cap_list (list of str) - list of comma-delimited repeated capabilities string - ''' - chained_repeated_capability_items = convert_comma_separated_string_to_list(chained_repeated_capability) - repeated_capability_lists = [[] for _ in range(chained_repeated_capability_items[0].count('/') + 1)] + """ + chained_repeated_capability_items = convert_comma_separated_string_to_list( + chained_repeated_capability + ) + repeated_capability_lists = [ + [] for _ in range(chained_repeated_capability_items[0].count("/") + 1) + ] for item in chained_repeated_capability_items: - repeated_capability_lists = [x + [y] for x, y in zip(repeated_capability_lists, item.split('/'))] - return [','.join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists] + repeated_capability_lists = [ + x + [y] for x, y in zip(repeated_capability_lists, item.split("/")) + ] + return [ + ",".join(collections.OrderedDict.fromkeys(x)) for x in repeated_capability_lists + ] # nitclk specific converters def convert_to_nitclk_session_number(item): - '''Convert from supported objects to NI-TClk Session Num + """Convert from supported objects to NI-TClk Session Num Supported objects are: - class with .tclk object of type nitclk.SessionReference - nitclk.SessionReference - ''' + """ try: return item.tclk._get_tclk_session_reference() except AttributeError: @@ -293,11 +320,9 @@ def convert_to_nitclk_session_number(item): except AttributeError: pass - raise TypeError('Unsupported type for nitclk session: {}'.format(type(item))) + raise TypeError("Unsupported type for nitclk session: {}".format(type(item))) def convert_to_nitclk_session_number_list(item_list): - '''Converts a list of items to nitclk session nums''' + """Converts a list of items to nitclk session nums""" return [convert_to_nitclk_session_number(i) for i in item_list] - -