From 0b6200e763f39884ef1113f6fa0b017510d1f7b4 Mon Sep 17 00:00:00 2001 From: zariiii9003 <52598363+zariiii9003@users.noreply.github.com> Date: Tue, 3 Mar 2026 21:32:11 +0100 Subject: [PATCH] update black and ruff --- can/interfaces/robotell.py | 2 +- can/interfaces/slcan.py | 2 +- can/interfaces/systec/structures.py | 2 +- can/interfaces/udp_multicast/bus.py | 2 +- can/io/sqlite.py | 6 ++---- can/util.py | 4 +--- pyproject.toml | 6 +++--- test/listener_test.py | 1 + test/test_cyclic_socketcan.py | 1 + test/test_neovi.py | 1 + test/test_socketcan.py | 1 + test/test_socketcan_loopback.py | 1 + tox.ini | 5 ++++- 13 files changed, 19 insertions(+), 15 deletions(-) diff --git a/can/interfaces/robotell.py b/can/interfaces/robotell.py index b24543856..d34e524ab 100644 --- a/can/interfaces/robotell.py +++ b/can/interfaces/robotell.py @@ -74,7 +74,7 @@ def __init__( if not channel: # if None or empty raise TypeError("Must specify a serial port.") if "@" in channel: - (channel, ttyBaudrate) = channel.split("@") + channel, ttyBaudrate = channel.split("@") self.serialPortOrig = serial.serial_for_url( channel, baudrate=ttyBaudrate, rtscts=rtscts ) diff --git a/can/interfaces/slcan.py b/can/interfaces/slcan.py index a6430d4e2..4618ed1c1 100644 --- a/can/interfaces/slcan.py +++ b/can/interfaces/slcan.py @@ -132,7 +132,7 @@ def __init__( if not channel: # if None or empty raise ValueError("Must specify a serial port.") if "@" in channel: - (channel, baudrate) = channel.split("@") + channel, baudrate = channel.split("@") tty_baudrate = int(baudrate) with error_check(exception_type=CanInitializationError): diff --git a/can/interfaces/systec/structures.py b/can/interfaces/systec/structures.py index a50ac4c26..5687308ad 100644 --- a/can/interfaces/systec/structures.py +++ b/can/interfaces/systec/structures.py @@ -74,7 +74,7 @@ def __eq__(self, other): def id(self): return self.m_dwID - @id.setter + @id.setter # noqa: A003 def id(self, value): self.m_dwID = value diff --git a/can/interfaces/udp_multicast/bus.py b/can/interfaces/udp_multicast/bus.py index 87a0800fa..01f67bd8e 100644 --- a/can/interfaces/udp_multicast/bus.py +++ b/can/interfaces/udp_multicast/bus.py @@ -397,7 +397,7 @@ def recv( timestamp = seconds + nanoseconds * 1.0e-9 else: # fetch data & source address - (raw_message_data, sender_address) = self._socket.recvfrom( + raw_message_data, sender_address = self._socket.recvfrom( self.max_buffer ) diff --git a/can/io/sqlite.py b/can/io/sqlite.py index 5f4885adb..a21ec4438 100644 --- a/can/io/sqlite.py +++ b/can/io/sqlite.py @@ -178,8 +178,7 @@ def _create_db(file: StringPathLike, table_name: str) -> sqlite3.Connection: conn = sqlite3.connect(file) # create table structure - conn.cursor().execute( - f"""CREATE TABLE IF NOT EXISTS {table_name} + conn.cursor().execute(f"""CREATE TABLE IF NOT EXISTS {table_name} ( ts REAL, arbitration_id INTEGER, @@ -188,8 +187,7 @@ def _create_db(file: StringPathLike, table_name: str) -> sqlite3.Connection: error INTEGER, dlc INTEGER, data BLOB - )""" - ) + )""") conn.commit() return conn diff --git a/can/util.py b/can/util.py index 4cbeec60e..42ae8dc5f 100644 --- a/can/util.py +++ b/can/util.py @@ -177,9 +177,7 @@ def load_config( [ given_config, can.rc, - lambda _context: load_environment_config( # pylint: disable=unnecessary-lambda - _context - ), + load_environment_config, lambda _context: load_environment_config(), lambda _context: load_file_config(path, _context), lambda _context: load_file_config(path), diff --git a/pyproject.toml b/pyproject.toml index ddaf61ef5..9eb4a41cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -90,15 +90,15 @@ docs = [ ] lint = [ "pylint==4.0.*", - "ruff==0.14.*", - "black==25.12.*", + "ruff==0.15.*", + "black==26.1.*", "mypy==1.19.*", ] test = [ "pytest==9.0.*", "pytest-timeout==2.4.*", "pytest-modern==0.7.*;platform_system!='Windows'", - "coveralls==4.0.*", + "coveralls==4.1.*", "pytest-cov==7.0.*", "coverage==7.13.*", "hypothesis==6.*", diff --git a/test/listener_test.py b/test/listener_test.py index bbcbed56e..77fd0d2e0 100644 --- a/test/listener_test.py +++ b/test/listener_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python """ """ + import asyncio import logging import os diff --git a/test/test_cyclic_socketcan.py b/test/test_cyclic_socketcan.py index f19ce95b9..86f1c82dd 100644 --- a/test/test_cyclic_socketcan.py +++ b/test/test_cyclic_socketcan.py @@ -3,6 +3,7 @@ """ This module tests multiple message cyclic send tasks. """ + import time import unittest diff --git a/test/test_neovi.py b/test/test_neovi.py index 8c816bef2..cc6ddc297 100644 --- a/test/test_neovi.py +++ b/test/test_neovi.py @@ -1,6 +1,7 @@ #!/usr/bin/env python """ """ + import pickle import unittest diff --git a/test/test_socketcan.py b/test/test_socketcan.py index 534ee2a61..9d042f425 100644 --- a/test/test_socketcan.py +++ b/test/test_socketcan.py @@ -3,6 +3,7 @@ """ Test functions in `can.interfaces.socketcan.socketcan`. """ + import ctypes import struct import sys diff --git a/test/test_socketcan_loopback.py b/test/test_socketcan_loopback.py index 2934eb9ea..ae045448d 100644 --- a/test/test_socketcan_loopback.py +++ b/test/test_socketcan_loopback.py @@ -6,6 +6,7 @@ for a good explanation of why this might be needed: https://www.kernel.org/doc/html/v4.17/networking/can.html#socketcan-local-loopback1 """ + import unittest import can diff --git a/tox.ini b/tox.ini index 4e96291ed..e635ec000 100644 --- a/tox.ini +++ b/tox.ini @@ -25,8 +25,11 @@ commands = [testenv:py314] extras = canalystii - serial + mf4 + multicast pywin32 + serial + # still no windows-curses for py314 [testenv:{py313t,py314t,pypy310,pypy311}] extras =