From 0cade170178ebf57f9bdc3053147bab452a8fca0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 03:22:11 +0000 Subject: [PATCH 1/4] python-deps(deps-dev): update ruff requirement Updates the requirements on [ruff](https://github.com/astral-sh/ruff) to permit the latest version. Updates `ruff` to 0.8.0 - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/0.7.4...0.8.0) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:development dependency-group: python-dependencies ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 20916016..c2f8b629 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -158,7 +158,7 @@ pytest-env = "^1.1.3" pytest-github-report = "^0.0.1" pytest-html = "^4.1.1" pytest-order = "^1.2.1" -ruff = "0.7.4" +ruff = "0.8.0" [tool.poetry.scripts] list-visa-resources = "tm_devices:print_available_visa_devices" From 105a4bc25e33533ab08e9824bfb90f50c3885123 Mon Sep 17 00:00:00 2001 From: Tektronix Bot Date: Mon, 25 Nov 2024 03:24:38 +0000 Subject: [PATCH 2/4] chore: Update dependencies. --- .pre-commit-config.yaml | 2 +- docs/requirements.txt | 2 +- tests/requirements.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2185182c..260213d7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -133,7 +133,7 @@ repos: always_run: true args: [audit, --json, --ignore-code=CVE-2019-8341] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: cafecb2f683a620516412e109877570ca7648cbd # frozen: v0.7.4 + rev: 0710b94280408eef12748cde4782972942370ad2 # frozen: v0.8.0 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/docs/requirements.txt b/docs/requirements.txt index c5b6a360..8d807f51 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -57,5 +57,5 @@ typing-extensions==4.12.2 ; python_version >= "3.8" and python_version < "4.0" urllib3==2.2.3 ; python_version >= "3.8" and python_version < "4.0" watchdog==4.0.2 ; python_version >= "3.8" and python_version < "4.0" wcmatch==10.0 ; python_version >= "3.8" and python_version < "4.0" -wheel==0.45.0 ; python_version >= "3.8" and python_version < "3.9" +wheel==0.45.1 ; python_version >= "3.8" and python_version < "3.9" zipp==3.20.2 ; python_version >= "3.8" and python_version < "3.10" diff --git a/tests/requirements.txt b/tests/requirements.txt index 698f4bf6..28063f87 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -38,7 +38,7 @@ pytest-order==1.3.0 ; python_version >= "3.8" and python_version < "4.0" python-dateutil==2.9.0.post0 ; python_version >= "3.8" and python_version < "4.0" pytz==2024.2 ; python_version >= "3.8" and python_version < "4.0" requests==2.32.3 ; python_version >= "3.8" and python_version < "4.0" -ruff==0.7.4 ; python_version >= "3.8" and python_version < "4.0" +ruff==0.8.0 ; python_version >= "3.8" and python_version < "4.0" setuptools==75.3.0 ; python_version >= "3.8" and python_version < "4.0" six==1.16.0 ; python_version >= "3.8" and python_version < "4.0" soupsieve==2.6 ; python_version >= "3.8" and python_version < "4.0" From b183b028536722f4c0163632512e8a3c84a31098 Mon Sep 17 00:00:00 2001 From: "Felt, Nicholas" Date: Mon, 25 Nov 2024 08:43:03 -0800 Subject: [PATCH 3/4] chore: Run ruff lint/format and update code to pass checks --- src/tm_devices/__init__.py | 8 +- src/tm_devices/commands/__init__.py | 30 ++++---- .../driver_mixins/device_control/__init__.py | 2 +- .../device_control/pi_control.py | 7 +- .../shared_implementations/__init__.py | 2 +- src/tm_devices/drivers/__init__.py | 76 +++++++++---------- src/tm_devices/helpers/__init__.py | 36 ++++----- src/tm_devices/helpers/functions.py | 11 ++- 8 files changed, 86 insertions(+), 86 deletions(-) diff --git a/src/tm_devices/__init__.py b/src/tm_devices/__init__.py index 82f8e70d..04b3e38c 100644 --- a/src/tm_devices/__init__.py +++ b/src/tm_devices/__init__.py @@ -28,12 +28,12 @@ __all__ = [ - "configure_logging", + "PYVISA_PY_BACKEND", + "SYSTEM_DEFAULT_VISA_BACKEND", "DeviceManager", "LoggingLevels", + "SupportedModels", + "configure_logging", "print_available_visa_devices", - "PYVISA_PY_BACKEND", "register_additional_usbtmc_mapping", - "SupportedModels", - "SYSTEM_DEFAULT_VISA_BACKEND", ] diff --git a/src/tm_devices/commands/__init__.py b/src/tm_devices/commands/__init__.py index 53242290..cb1092f1 100644 --- a/src/tm_devices/commands/__init__.py +++ b/src/tm_devices/commands/__init__.py @@ -89,27 +89,27 @@ "AFG3KCommandConstants", "AFG3KCommands", "AFG3KMixin", - "AWG5200CommandConstants", - "AWG5200Commands", - "AWG5200Mixin", "AWG5KCCommandConstants", "AWG5KCCommands", "AWG5KCMixin", "AWG5KCommandConstants", "AWG5KCommands", "AWG5KMixin", - "AWG70KACommandConstants", - "AWG70KACommands", - "AWG70KAMixin", - "AWG70KBCommandConstants", - "AWG70KBCommands", - "AWG70KBMixin", "AWG7KCCommandConstants", "AWG7KCCommands", "AWG7KCMixin", "AWG7KCommandConstants", "AWG7KCommands", "AWG7KMixin", + "AWG70KACommandConstants", + "AWG70KACommands", + "AWG70KAMixin", + "AWG70KBCommandConstants", + "AWG70KBCommands", + "AWG70KBMixin", + "AWG5200CommandConstants", + "AWG5200Commands", + "AWG5200Mixin", "DAQ6510CommandConstants", "DAQ6510Commands", "DAQ6510Mixin", @@ -137,6 +137,12 @@ "DPO5KCommandConstants", "DPO5KCommands", "DPO5KMixin", + "DPO7KCCommandConstants", + "DPO7KCCommands", + "DPO7KCMixin", + "DPO7KCommandConstants", + "DPO7KCommands", + "DPO7KMixin", "DPO70KCCommandConstants", "DPO70KCCommands", "DPO70KCMixin", @@ -149,12 +155,6 @@ "DPO70KSXCommandConstants", "DPO70KSXCommands", "DPO70KSXMixin", - "DPO7KCCommandConstants", - "DPO7KCCommands", - "DPO7KCMixin", - "DPO7KCommandConstants", - "DPO7KCommands", - "DPO7KMixin", "DSA70KCCommandConstants", "DSA70KCCommands", "DSA70KCMixin", diff --git a/src/tm_devices/driver_mixins/device_control/__init__.py b/src/tm_devices/driver_mixins/device_control/__init__.py index 924f4025..c46d2e25 100644 --- a/src/tm_devices/driver_mixins/device_control/__init__.py +++ b/src/tm_devices/driver_mixins/device_control/__init__.py @@ -4,4 +4,4 @@ from .rest_api_control import RESTAPIControl from .tsp_control import TSPControl -__all__ = ["PIControl", "TSPControl", "RESTAPIControl"] +__all__ = ["PIControl", "RESTAPIControl", "TSPControl"] diff --git a/src/tm_devices/driver_mixins/device_control/pi_control.py b/src/tm_devices/driver_mixins/device_control/pi_control.py index b743ad65..63412104 100644 --- a/src/tm_devices/driver_mixins/device_control/pi_control.py +++ b/src/tm_devices/driver_mixins/device_control/pi_control.py @@ -305,11 +305,8 @@ def poll_query( # noqa: PLR0913 # pylint: disable=too-many-locals <= float(wanted_val) + tolerance ) str_comparison = isinstance(wanted_val, str) and queried_value == wanted_val - if ( - not invert_range - and (float_comparison or str_comparison) - or invert_range - and not (float_comparison or str_comparison) + if (not invert_range and (float_comparison or str_comparison)) or ( + invert_range and not (float_comparison or str_comparison) ): return time.sleep(sleep_time) diff --git a/src/tm_devices/driver_mixins/shared_implementations/__init__.py b/src/tm_devices/driver_mixins/shared_implementations/__init__.py index 8efa2640..9ba2421f 100644 --- a/src/tm_devices/driver_mixins/shared_implementations/__init__.py +++ b/src/tm_devices/driver_mixins/shared_implementations/__init__.py @@ -8,6 +8,6 @@ "CommonPISystemErrorCheckMixin", "CommonTSPErrorCheckMixin", "IEEE4882Commands", - "TSPIEEE4882Commands", "LegacyTSPIEEE4882Commands", + "TSPIEEE4882Commands", ] diff --git a/src/tm_devices/drivers/__init__.py b/src/tm_devices/drivers/__init__.py index 8f31730f..35ff6238 100644 --- a/src/tm_devices/drivers/__init__.py +++ b/src/tm_devices/drivers/__init__.py @@ -105,12 +105,10 @@ __all__ = [ - "SupportedModels", "AFG3K", "AFG3KB", "AFG3KC", "AFG31K", - "AWG5200", "AWG5K", "AWG5KB", "AWG5KC", @@ -119,7 +117,15 @@ "AWG7KC", "AWG70KA", "AWG70KB", + "AWG5200", "DAQ6510", + "DMM6500", + "DMM7510", + "DMM7512", + "DPO2K", + "DPO2KB", + "DPO4K", + "DPO4KB", "DPO5K", "DPO5KB", "DPO7K", @@ -133,35 +139,35 @@ "DSA70KC", "DSA70KD", "LPD6", - "MSO2", - "MSO4", - "MSO4B", - "MSO5", - "MSO5B", - "MSO5LP", - "MSO6", - "MSO6B", - "MSO2K", - "MSO2KB", - "DPO2K", - "DPO2KB", "MDO3", "MDO3K", "MDO4K", "MDO4KB", "MDO4KC", + "MSO2", + "MSO2K", + "MSO2KB", + "MSO4", + "MSO4B", "MSO4K", "MSO4KB", - "DPO4K", - "DPO4KB", + "MSO5", + "MSO5B", "MSO5K", "MSO5KB", + "MSO5LP", + "MSO6", + "MSO6B", "MSO70K", "MSO70KC", "MSO70KDX", - "TekScopePC", - "TSOVu", - "TMT4", + "PSU2200", + "PSU2220", + "PSU2230", + "PSU2231", + "PSU2231A", + "PSU2280", + "PSU2281", "SMU2400", "SMU2401", "SMU2410", @@ -170,39 +176,33 @@ "SMU2461", "SMU2470", "SMU2601A", - "SMU2602A", - "SMU2604A", - "SMU2611A", - "SMU2612A", - "SMU2614A", - "SMU2634A", - "SMU2635A", - "SMU2636A", "SMU2601B", - "SMU2601BPulse", + "SMU2602A", "SMU2602B", + "SMU2604A", "SMU2604B", "SMU2606B", + "SMU2611A", "SMU2611B", + "SMU2612A", "SMU2612B", + "SMU2614A", "SMU2614B", + "SMU2634A", "SMU2634B", + "SMU2635A", "SMU2635B", + "SMU2636A", "SMU2636B", "SMU2651A", "SMU2657A", "SMU6430", "SMU6514", "SMU6517B", - "PSU2200", - "PSU2220", - "PSU2230", - "PSU2231", - "PSU2231A", - "PSU2280", - "PSU2281", - "DMM6500", - "DMM7510", - "DMM7512", "SS3706A", + "TMT4", + "SMU2601BPulse", + "SupportedModels", + "TSOVu", + "TekScopePC", ] diff --git a/src/tm_devices/helpers/__init__.py b/src/tm_devices/helpers/__init__.py index e733ae69..e9fd4d6d 100644 --- a/src/tm_devices/helpers/__init__.py +++ b/src/tm_devices/helpers/__init__.py @@ -43,9 +43,27 @@ from tm_devices.helpers.verification_functions import raise_error, raise_failure, verify_values __all__ = [ + "PACKAGE_NAME", + "PYVISA_PY_BACKEND", + "SYSTEM_DEFAULT_VISA_BACKEND", + "USB_MODEL_ID_LOOKUP", + "VALID_DEVICE_CONNECTION_TYPES", + "VISA_RESOURCE_EXPRESSION_REGEX", "AliasDict", "ConfigFileType", "ConnectionTypes", + "DMConfigOptions", + "DeviceConfigEntry", + "DeviceTypes", + "LoadImpedanceAFG", + "LoggingLevels", + "ReadOnlyCachedProperty", + "SASSetWaveformFileTypes", + "SerialConfig", + "Singleton", + "SupportedModels", + "SupportedRequestTypes", + "USBTMCConfiguration", "check_for_update", "check_network_connection", "check_port_connection", @@ -53,32 +71,14 @@ "configure_logging", "create_visa_connection", "detect_visa_resource_expression", - "DeviceConfigEntry", - "DeviceTypes", - "DMConfigOptions", "get_model_series", "get_version", "get_visa_backend", - "LoggingLevels", - "PACKAGE_NAME", "ping_address", - "PYVISA_PY_BACKEND", "raise_error", "raise_failure", "register_additional_usbtmc_mapping", "sanitize_enum", - "SerialConfig", - "Singleton", - "SupportedModels", - "SupportedRequestTypes", - "SYSTEM_DEFAULT_VISA_BACKEND", - "USB_MODEL_ID_LOOKUP", - "USBTMCConfiguration", - "VALID_DEVICE_CONNECTION_TYPES", "validate_address", "verify_values", - "VISA_RESOURCE_EXPRESSION_REGEX", - "ReadOnlyCachedProperty", - "SASSetWaveformFileTypes", - "LoadImpedanceAFG", ] diff --git a/src/tm_devices/helpers/functions.py b/src/tm_devices/helpers/functions.py index 36cfc3ed..869b839b 100644 --- a/src/tm_devices/helpers/functions.py +++ b/src/tm_devices/helpers/functions.py @@ -527,10 +527,13 @@ def get_visa_backend(visa_lib_path: str) -> str: raise KeyError # noqa: TRY301 except KeyError: found_visa = False - for visa_type in visa_backends: - for visa_implementation in visa_backends[visa_type]: - if visa_lib_path in visa_implementation: - vendor = visa_backends[visa_type][visa_implementation]["Vendor"] + for visa_type, visa_implementation_dict in visa_backends.items(): + for ( + visa_implementation_name, + visa_implementation_details, + ) in visa_implementation_dict.items(): + if visa_lib_path in visa_implementation_name: + vendor = visa_implementation_details["Vendor"] visa_name = "NI-VISA" if "National Instruments" in vendor else f"{vendor} VISA" found_visa = True elif visa_lib_path.endswith("yaml") and visa_type == "sim": From 349d92bcbaca0c5e9d9d41c17bef49e3bd3410f1 Mon Sep 17 00:00:00 2001 From: "Felt, Nicholas" Date: Mon, 25 Nov 2024 09:28:58 -0800 Subject: [PATCH 4/4] docs: Fix bug affecting inheritance diagrams that share a page --- .../mkdocstrings/python/readthedocs/class.html.jinja | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/_templates/mkdocstrings/python/readthedocs/class.html.jinja b/docs/_templates/mkdocstrings/python/readthedocs/class.html.jinja index fd445451..42b2c314 100644 --- a/docs/_templates/mkdocstrings/python/readthedocs/class.html.jinja +++ b/docs/_templates/mkdocstrings/python/readthedocs/class.html.jinja @@ -34,8 +34,9 @@ click {{ base.path }} href "" "{{ base.path }}" {% endfor %} -