Skip to content

Commit 2f9598c

Browse files
authored
Merge pull request #285 from ap--/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2 parents 65d7146 + 7169414 commit 2f9598c

File tree

4 files changed

+19
-20
lines changed

4 files changed

+19
-20
lines changed

.pre-commit-config.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,42 @@ default_language_version:
44
python: python3.10
55
repos:
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v5.0.0
7+
rev: v6.0.0
88
hooks:
99
- id: trailing-whitespace
1010
- id: end-of-file-fixer
1111
- id: check-yaml
1212
- id: check-added-large-files
13-
- repo: https://github.com/psf/black
14-
rev: '25.1.0'
13+
- repo: https://github.com/psf/black-pre-commit-mirror
14+
rev: '25.9.0'
1515
hooks:
1616
- id: black
1717
language_version: python3
1818
- repo: https://github.com/pycqa/isort
19-
rev: 6.0.1
19+
rev: 7.0.0
2020
hooks:
2121
- id: isort
2222
- repo: https://github.com/PyCQA/flake8
23-
rev: '7.1.2'
23+
rev: '7.3.0'
2424
hooks:
2525
- id: flake8
2626
additional_dependencies:
27-
- flake8-typing-imports==1.16.0
27+
- flake8-typing-imports==1.17.0
2828
language_version: python3
2929
exclude: "^(build|docs|tests|setup.py)"
3030
- repo: https://github.com/pre-commit/mirrors-mypy
31-
rev: 'v1.15.0'
31+
rev: 'v1.18.2'
3232
hooks:
3333
- id: mypy
34-
additional_dependencies: [numpy<1.25, pyusb>=1.0]
34+
additional_dependencies: [numpy>=2.0, pyusb>=1.0]
3535
exclude: "^(build|docs|tests|dev|setup.py)"
3636
- repo: https://github.com/asottile/pyupgrade
37-
rev: v3.19.1
37+
rev: v3.21.0
3838
hooks:
3939
- id: pyupgrade
4040
args: [--py39-plus]
4141
- repo: https://github.com/MarcoGorelli/cython-lint
42-
rev: v0.16.6
42+
rev: v0.18.1
4343
hooks:
4444
- id: cython-lint
4545
- id: double-quote-cython-strings

src/seabreeze/pyseabreeze/api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ def _seabreeze_device_factory(
5050
-------
5151
dev : SeaBreezeDevice
5252
"""
53-
global _seabreeze_device_instance_registry
5453
if not isinstance(device, (USBTransportHandle, IPv4TransportHandle)):
5554
raise TypeError(
5655
f"needs to be instance of USBTransportHandle or IPv4TransportHandle and not '{type(device)}'"

src/seabreeze/pyseabreeze/features/spectrometer.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def get_wavelengths(self) -> NDArray[np.float64]:
147147
coeffs.append(
148148
float(self._eeprom_cls._func_eeprom_read_slot(self.protocol, i))
149149
)
150-
return sum(wl * (indices**i) for i, wl in enumerate(coeffs)) # type: ignore
150+
return sum(wl * (indices**i) for i, wl in enumerate(coeffs))
151151

152152
def get_intensities(self) -> NDArray[np.float64]:
153153
tmp = self._get_spectrum_raw()
@@ -425,11 +425,11 @@ def get_wavelengths(self) -> NDArray[np.float64]:
425425
coeffs.append(struct.unpack("<f", data)[0])
426426
# and generate the wavelength array
427427
indices = numpy.arange(self._spectrum_length, dtype=numpy.float64)
428-
return sum(wl * (indices**i) for i, wl in enumerate(coeffs)) # type: ignore
428+
return sum(wl * (indices**i) for i, wl in enumerate(coeffs))
429429

430430
def get_intensities(self) -> NDArray[np.float64]:
431431
tmp = self._get_spectrum_raw()
432-
arr = struct.unpack("<" + "H" * self._spectrum_length, tmp) # type: ignore
432+
arr = struct.unpack("<" + "H" * self._spectrum_length, tmp)
433433
return numpy.array(arr, dtype=numpy.float64)
434434

435435
def _get_spectrum_raw(self) -> NDArray[np.uint8]:
@@ -489,7 +489,7 @@ def get_wavelengths(self) -> NDArray[np.float64]:
489489
SeaBreezeEEPromFeatureOOI._func_eeprom_read_slot(self.protocol, i)
490490
)
491491
)
492-
return sum(wl * (indices**i) for i, wl in enumerate(coeffs)) # type: ignore
492+
return sum(wl * (indices**i) for i, wl in enumerate(coeffs))
493493

494494
def get_intensities(self) -> NDArray[np.float64]:
495495
tmp = self._get_spectrum_raw()
@@ -643,7 +643,7 @@ def get_wavelengths(self) -> NDArray[np.float64]:
643643
coeffs = struct.unpack("<" + "f" * num_coeffs, data)[1:]
644644
# and generate the wavelength array
645645
indices = numpy.arange(self._spectrum_length, dtype=numpy.float64)
646-
return sum(wl * (indices**i) for i, wl in enumerate(coeffs)) # type: ignore
646+
return sum(wl * (indices**i) for i, wl in enumerate(coeffs))
647647

648648

649649
class SeaBreezeSpectrometerFeatureOBP2(SeaBreezeSpectrometerFeatureOBP):
@@ -684,7 +684,7 @@ def get_wavelengths(self) -> NDArray[np.float64]:
684684
coeffs = struct.unpack("<" + "f" * num_coeffs, data)[1:]
685685
# and generate the wavelength array
686686
indices = numpy.arange(self._spectrum_length, dtype=numpy.float64)
687-
return sum(wl * (indices**i) for i, wl in enumerate(coeffs)) # type: ignore
687+
return sum(wl * (indices**i) for i, wl in enumerate(coeffs))
688688

689689

690690
class SeaBreezeSpectrometerFeatureSR4(SeaBreezeSpectrometerFeatureOBP2):
@@ -737,7 +737,7 @@ def get_wavelengths(self) -> NDArray[np.float64]:
737737
coeffs = struct.unpack("<" + "f" * num_coeffs, data)[1:]
738738
# and generate the wavelength array
739739
indices = numpy.arange(self._spectrum_length, dtype=numpy.float64)
740-
return sum(wl * (indices**i) for i, wl in enumerate(coeffs)) # type: ignore
740+
return sum(wl * (indices**i) for i, wl in enumerate(coeffs))
741741

742742

743743
class SeaBreezeSpectrometerFeatureHR4(SeaBreezeSpectrometerFeatureOBP2):

src/seabreeze/pyseabreeze/transport.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def list_devices(cls, **kwargs: Any) -> Iterable[USBTransportHandle]:
253253
unique pyusb devices for each available spectrometer
254254
"""
255255
# check if a specific pyusb backend is requested
256-
_pyusb_backend = kwargs.get("pyusb_backend", None)
256+
_pyusb_backend: str | None = kwargs.get("pyusb_backend", None)
257257
# get all matching devices
258258
try:
259259
pyusb_devices = usb.core.find(
@@ -340,7 +340,7 @@ def shutdown(cls, **_kwargs: Any) -> None:
340340
_pyusb_backend_instances: dict[str, usb.backend.IBackend] = {}
341341

342342

343-
def get_pyusb_backend_from_name(name: str) -> usb.backend.IBackend:
343+
def get_pyusb_backend_from_name(name: str | None) -> usb.backend.IBackend:
344344
"""internal: allow requesting a specific pyusb backend for testing"""
345345
if name is None:
346346
# default is pick first that works: ('libusb1', 'libusb0', 'openusb')

0 commit comments

Comments
 (0)