From 0c3c39804596c42ba53aab14245a0ff25d062c14 Mon Sep 17 00:00:00 2001 From: Daniel Montanari Date: Thu, 18 Jun 2026 12:50:20 +1000 Subject: [PATCH 1/9] remove black from tox and workflows --- .github/workflows/test.yml | 3 --- tox.ini | 7 +------ 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2a6b247..2080534 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,9 +32,6 @@ jobs: - name: Run tests with tox run: | tox -e py - - name: Check formatting - run: | - tox -e black - name: Run mypy with tox run: | tox -e mypy diff --git a/tox.ini b/tox.ini index 8b3d4bd..5091b44 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py312,py313,black,mypy +envlist = py312,py313,mypy isolated_build = True [testenv] @@ -13,11 +13,6 @@ deps = build commands = python -m build . -[testenv:black] -basepython = python3 -skip_install = true -deps = black==22.3.0 -commands = black --check src test scripts {posargs} [pytest] # https://docs.pytest.org/en/stable/deprecations.html#junit-family-default-value-change-to-xunit2 From 6c8c007e9568ba25f77840876953355427ce2dc3 Mon Sep 17 00:00:00 2001 From: Daniel Montanari Date: Thu, 18 Jun 2026 13:02:03 +1000 Subject: [PATCH 2/9] Add pre-commit action --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2080534..a920c0b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,3 +35,5 @@ jobs: - name: Run mypy with tox run: | tox -e mypy + - name: pre-commit + uses: pre-commit/action@v3.0.1 From 5bf087d14c9813bf89924a6dac71acaf42d72aaf Mon Sep 17 00:00:00 2001 From: Daniel Montanari Date: Thu, 18 Jun 2026 13:27:19 +1000 Subject: [PATCH 3/9] Revert changes --- .github/workflows/test.yml | 5 +++-- tox.ini | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a920c0b..2a6b247 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,8 +32,9 @@ jobs: - name: Run tests with tox run: | tox -e py + - name: Check formatting + run: | + tox -e black - name: Run mypy with tox run: | tox -e mypy - - name: pre-commit - uses: pre-commit/action@v3.0.1 diff --git a/tox.ini b/tox.ini index 5091b44..8b3d4bd 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py312,py313,mypy +envlist = py312,py313,black,mypy isolated_build = True [testenv] @@ -13,6 +13,11 @@ deps = build commands = python -m build . +[testenv:black] +basepython = python3 +skip_install = true +deps = black==22.3.0 +commands = black --check src test scripts {posargs} [pytest] # https://docs.pytest.org/en/stable/deprecations.html#junit-family-default-value-change-to-xunit2 From 139aaf97f5fbafd89f8467c1b827cd4cc6b1f0ad Mon Sep 17 00:00:00 2001 From: Daniel Montanari Date: Thu, 18 Jun 2026 13:29:45 +1000 Subject: [PATCH 4/9] bump black to new version --- .pre-commit-config.yaml | 2 +- tox.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b313588..584f633 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,6 +4,6 @@ repos: hooks: - id: check-yaml - repo: https://github.com/psf/black - rev: 22.3.0 + rev: 26.5.1 hooks: - id: black diff --git a/tox.ini b/tox.ini index 8b3d4bd..85014fc 100644 --- a/tox.ini +++ b/tox.ini @@ -16,7 +16,7 @@ commands = [testenv:black] basepython = python3 skip_install = true -deps = black==22.3.0 +deps = black==26.5.1 commands = black --check src test scripts {posargs} [pytest] From 4a5d4cb93824141754ee48a106e0881b987e3c80 Mon Sep 17 00:00:00 2001 From: Daniel Montanari Date: Thu, 18 Jun 2026 13:44:31 +1000 Subject: [PATCH 5/9] make tox black run on the same files as pre-commit --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 85014fc..698127d 100644 --- a/tox.ini +++ b/tox.ini @@ -17,7 +17,7 @@ commands = basepython = python3 skip_install = true deps = black==26.5.1 -commands = black --check src test scripts {posargs} +commands = black --check . {posargs} [pytest] # https://docs.pytest.org/en/stable/deprecations.html#junit-family-default-value-change-to-xunit2 From dee1f81b51e64591cff3b0cffea4f56975b9c91d Mon Sep 17 00:00:00 2001 From: Daniel Montanari Date: Thu, 18 Jun 2026 13:47:46 +1000 Subject: [PATCH 6/9] Reformat codebase with new version of black --- examples/function_generator.py | 1 + examples/jig_driver.py | 1 + examples/programmable_power_supply.py | 1 + examples/test_script.py | 1 + src/fixate/config/__init__.py | 1 + src/fixate/core/checks.py | 1 + src/fixate/core/ui.py | 1 + src/fixate/drivers/_ftdi.py | 2 +- src/fixate/drivers/daq/daqmx.py | 2 +- src/fixate/drivers/dcload/__init__.py | 2 +- src/fixate/drivers/dcload/helper.py | 3 +-- src/fixate/drivers/dmm/__init__.py | 1 + src/fixate/drivers/dso/agilent_mso_x.py | 1 - src/fixate/drivers/funcgen/__init__.py | 1 + src/fixate/drivers/handlers.py | 1 + src/fixate/drivers/lcr/__init__.py | 1 + src/fixate/drivers/pps/bk_178x.py | 6 +++--- src/fixate/main.py | 1 - src/fixate/reporting/csv.py | 1 + src/fixate/ui_cmdline/kbhit.py | 4 ++-- test/core/test_config_util.py | 1 - test/drivers/test_ftdi.py | 1 - test/drivers/test_keysight_DSOX1102G.py | 4 +--- test/drivers/test_rigol_dl3021.py | 10 ++++++---- test/manual/test_serial_numbers.py | 1 + 25 files changed, 29 insertions(+), 21 deletions(-) diff --git a/examples/function_generator.py b/examples/function_generator.py index b660f04..a57e24d 100644 --- a/examples/function_generator.py +++ b/examples/function_generator.py @@ -1,6 +1,7 @@ """ Examples on how to use the function generator driver """ + import time from fixate.core.common import TestClass, TestList diff --git a/examples/jig_driver.py b/examples/jig_driver.py index 6d56cdf..977318a 100644 --- a/examples/jig_driver.py +++ b/examples/jig_driver.py @@ -2,6 +2,7 @@ This file is just a test playground that shows how the update jig classes will fit together. """ + from __future__ import annotations from dataclasses import dataclass, field from fixate import ( diff --git a/examples/programmable_power_supply.py b/examples/programmable_power_supply.py index da112be..7f263e9 100644 --- a/examples/programmable_power_supply.py +++ b/examples/programmable_power_supply.py @@ -1,6 +1,7 @@ """ Examples on how to use the programmable power supply driver works """ + import time from fixate.core.common import TestClass, TestList diff --git a/examples/test_script.py b/examples/test_script.py index 185283c..330b033 100644 --- a/examples/test_script.py +++ b/examples/test_script.py @@ -1,6 +1,7 @@ """ This is a test script that shows basic use case for the fixate library """ + from fixate.core.common import TestClass, TestList from fixate.core.checks import * from fixate.core.ui import * diff --git a/src/fixate/config/__init__.py b/src/fixate/config/__init__.py index 98b0cfe..7a66238 100644 --- a/src/fixate/config/__init__.py +++ b/src/fixate/config/__init__.py @@ -4,6 +4,7 @@ Drivers are hard coded into the config to prevent issues arising from auto discovery Must ensure driver imports are infallible to prevent program crash on start """ + from fixate.config.helper import ( load_dict_config, load_yaml_config, diff --git a/src/fixate/core/checks.py b/src/fixate/core/checks.py index a4eb09a..fef2f85 100644 --- a/src/fixate/core/checks.py +++ b/src/fixate/core/checks.py @@ -2,6 +2,7 @@ This module is used to allow for tests to test values against criteria. It should implement necessary logging functions and report success or failure. """ + from dataclasses import dataclass, field from typing import Any, Callable, Iterable, Optional import logging diff --git a/src/fixate/core/ui.py b/src/fixate/core/ui.py index 602f38c..53729dd 100644 --- a/src/fixate/core/ui.py +++ b/src/fixate/core/ui.py @@ -1,6 +1,7 @@ """ This module details user input api """ + import time from queue import Queue, Empty from pubsub import pub diff --git a/src/fixate/drivers/_ftdi.py b/src/fixate/drivers/_ftdi.py index e4da10d..4f305e8 100644 --- a/src/fixate/drivers/_ftdi.py +++ b/src/fixate/drivers/_ftdi.py @@ -1,4 +1,4 @@ -""" Private wrapper for ftdi driver. DLL on Windows, .so shared library on *nix. +"""Private wrapper for ftdi driver. DLL on Windows, .so shared library on *nix. This is wrapped privately so it can be ommitted from the documentation build. """ diff --git a/src/fixate/drivers/daq/daqmx.py b/src/fixate/drivers/daq/daqmx.py index ade5d72..80026fe 100644 --- a/src/fixate/drivers/daq/daqmx.py +++ b/src/fixate/drivers/daq/daqmx.py @@ -15,6 +15,7 @@ C:\Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev\include\NIDAQmx.h """ + from collections import namedtuple from fixate.core.common import ExcThread from queue import Queue, Empty @@ -22,7 +23,6 @@ from ctypes import byref, c_char_p import numpy - # Basic Functions from PyDAQmx import ( DAQmxResetDevice, diff --git a/src/fixate/drivers/dcload/__init__.py b/src/fixate/drivers/dcload/__init__.py index ce74425..2407d8f 100644 --- a/src/fixate/drivers/dcload/__init__.py +++ b/src/fixate/drivers/dcload/__init__.py @@ -1,6 +1,6 @@ """ DC ELectronic Load driver -========================= +========================= Use `DCLoad.open()` to connect to a DC electronic load. Functions are dictated by the abstract superclass ``DCLoad`` in helper.py diff --git a/src/fixate/drivers/dcload/helper.py b/src/fixate/drivers/dcload/helper.py index 42bdcb0..673efd4 100644 --- a/src/fixate/drivers/dcload/helper.py +++ b/src/fixate/drivers/dcload/helper.py @@ -21,8 +21,7 @@ class DCLoad(DriverProtocol, Protocol): REGEX_ID: str - def __init__(self, instrument) -> None: - ... + def __init__(self, instrument) -> None: ... def reset(self) -> None: """Reset the instrument to a known state.""" diff --git a/src/fixate/drivers/dmm/__init__.py b/src/fixate/drivers/dmm/__init__.py index 72f47d6..9a81b16 100644 --- a/src/fixate/drivers/dmm/__init__.py +++ b/src/fixate/drivers/dmm/__init__.py @@ -10,6 +10,7 @@ dmm.measure(*mode, **mode_params) dmm.reset() """ + import pyvisa import fixate.drivers diff --git a/src/fixate/drivers/dso/agilent_mso_x.py b/src/fixate/drivers/dso/agilent_mso_x.py index 87e8a96..25ee4ff 100644 --- a/src/fixate/drivers/dso/agilent_mso_x.py +++ b/src/fixate/drivers/dso/agilent_mso_x.py @@ -3,7 +3,6 @@ from fixate.drivers.dso.helper import DSO import time - # Example IDN Strings # KEYSIGHT TECHNOLOGIES,DSOX1202G,CN60074190,02.10.2019111333 # KEYSIGHT TECHNOLOGIES,DSO-X 1102G,CN57096441,01.20.2019061038 diff --git a/src/fixate/drivers/funcgen/__init__.py b/src/fixate/drivers/funcgen/__init__.py index 8e87468..de5d9c5 100644 --- a/src/fixate/drivers/funcgen/__init__.py +++ b/src/fixate/drivers/funcgen/__init__.py @@ -22,6 +22,7 @@ output_ch3 output_ch4 """ + import pyvisa import fixate.drivers diff --git a/src/fixate/drivers/handlers.py b/src/fixate/drivers/handlers.py index 0cc6402..df6faf2 100644 --- a/src/fixate/drivers/handlers.py +++ b/src/fixate/drivers/handlers.py @@ -2,6 +2,7 @@ This module implements concrete AddressHandler type, that can be used to implement IO for the fixate.core.switching module. """ + from __future__ import annotations from typing import Sequence, Optional diff --git a/src/fixate/drivers/lcr/__init__.py b/src/fixate/drivers/lcr/__init__.py index f33328a..e3a8138 100644 --- a/src/fixate/drivers/lcr/__init__.py +++ b/src/fixate/drivers/lcr/__init__.py @@ -5,6 +5,7 @@ Functions are dictated by the metaclass in helper.py """ + import pyvisa import fixate.drivers diff --git a/src/fixate/drivers/pps/bk_178x.py b/src/fixate/drivers/pps/bk_178x.py index a81100d..26b2a78 100644 --- a/src/fixate/drivers/pps/bk_178x.py +++ b/src/fixate/drivers/pps/bk_178x.py @@ -146,9 +146,9 @@ def _packet_encode(self, command, *data_tuples): packet[2] = command packet_index = 3 for data, num_bytes in data_tuples: - packet[ - packet_index : packet_index + num_bytes - ] = self._little_endian_encode(data)[0:num_bytes] + packet[packet_index : packet_index + num_bytes] = ( + self._little_endian_encode(data)[0:num_bytes] + ) packet_index += num_bytes if packet_index >= self.PACKET_LENGTH: raise ValueError("Too many bytes to pack into packet") diff --git a/src/fixate/main.py b/src/fixate/main.py index a38310a..bcb7daf 100644 --- a/src/fixate/main.py +++ b/src/fixate/main.py @@ -15,7 +15,6 @@ from fixate.ui_cmdline import register_cmd_line, unregister_cmd_line import fixate.sequencer - logger = logging.getLogger(__name__) diff --git a/src/fixate/reporting/csv.py b/src/fixate/reporting/csv.py index bb49330..3e0f537 100644 --- a/src/fixate/reporting/csv.py +++ b/src/fixate/reporting/csv.py @@ -84,6 +84,7 @@ Test End