From ed458f66f72612ee795ed594b94fcfe9e3ab4335 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Wed, 10 Jan 2024 18:27:20 +0200 Subject: [PATCH] PyLint --- .idea/dictionaries/pavel.xml | 1 + pycyphal/dsdl/_import_hook.py | 2 +- pycyphal/dsdl/_support_wrappers.py | 2 +- pycyphal/transport/can/media/socketcan/_socketcan.py | 1 + pycyphal/transport/can/media/socketcand/_socketcand.py | 3 ++- tests/transport/can/media/_socketcand.py | 5 +++-- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.idea/dictionaries/pavel.xml b/.idea/dictionaries/pavel.xml index 9c9bf973..6c9b8d23 100644 --- a/.idea/dictionaries/pavel.xml +++ b/.idea/dictionaries/pavel.xml @@ -259,6 +259,7 @@ slcan sockaddr socketcan + socketcand socketcanfd sphinxarg sssss diff --git a/pycyphal/dsdl/_import_hook.py b/pycyphal/dsdl/_import_hook.py index aff673c7..dc7ffe70 100644 --- a/pycyphal/dsdl/_import_hook.py +++ b/pycyphal/dsdl/_import_hook.py @@ -25,7 +25,7 @@ def root_namespace_from_module_name(module_name: str) -> str: """ - Tranlates python module name to DSDL root namespace. + Translates python module name to DSDL root namespace. This handles special case where root namespace is a python keyword by removing trailing underscore. """ if module_name.endswith("_") and keyword.iskeyword(module_name[-1]): diff --git a/pycyphal/dsdl/_support_wrappers.py b/pycyphal/dsdl/_support_wrappers.py index cb098b0d..1b1db830 100644 --- a/pycyphal/dsdl/_support_wrappers.py +++ b/pycyphal/dsdl/_support_wrappers.py @@ -6,7 +6,7 @@ autogenerated code unless explicitly requested by the application. """ -from typing import TypeVar, Type, Sequence, cast, Any, Iterable, Optional, Dict +from typing import TypeVar, Type, Sequence, Any, Iterable, Optional, Dict import pydsdl diff --git a/pycyphal/transport/can/media/socketcan/_socketcan.py b/pycyphal/transport/can/media/socketcan/_socketcan.py index 6ecdf2ba..d8aaa175 100644 --- a/pycyphal/transport/can/media/socketcan/_socketcan.py +++ b/pycyphal/transport/can/media/socketcan/_socketcan.py @@ -1,6 +1,7 @@ # Copyright (c) 2019 OpenCyphal # This software is distributed under the terms of the MIT License. # Author: Pavel Kirienko +# pylint: disable=duplicate-code import enum import time diff --git a/pycyphal/transport/can/media/socketcand/_socketcand.py b/pycyphal/transport/can/media/socketcand/_socketcand.py index 8c302732..56a1315d 100644 --- a/pycyphal/transport/can/media/socketcand/_socketcand.py +++ b/pycyphal/transport/can/media/socketcand/_socketcand.py @@ -157,7 +157,8 @@ def _transmit_thread_worker(self) -> None: tx.loop.call_soon_threadsafe(partial(tx.future.set_exception, ex)) except Exception as ex: _logger.critical( - "Unhandled exception in transmit thread, transmission thread stopped and transmission is no longer possible: %s", + "Unhandled exception in transmit thread, " + "transmission thread stopped and transmission is no longer possible: %s", ex, exc_info=True, ) diff --git a/tests/transport/can/media/_socketcand.py b/tests/transport/can/media/_socketcand.py index 0fc22206..6a268662 100644 --- a/tests/transport/can/media/_socketcand.py +++ b/tests/transport/can/media/_socketcand.py @@ -1,5 +1,6 @@ # Copyright (c) 2023 OpenCyphal # This software is distributed under the terms of the MIT License. +# pylint: disable=protected-access,duplicate-code import sys import typing @@ -9,7 +10,7 @@ import pytest from pycyphal.transport import Timestamp -from pycyphal.transport.can.media import Envelope, DataFrame, FrameFormat, FilterConfiguration +from pycyphal.transport.can.media import Envelope, DataFrame, FrameFormat from pycyphal.transport.can.media.socketcand import SocketcandMedia if sys.platform != "linux": # pragma: no cover @@ -23,7 +24,7 @@ def _start_socketcand() -> typing.Generator[None, None, None]: # starting a socketcand daemon in background cmd = ["socketcand", "-i", "vcan0", "-l", "lo", "-p", "29536"] - socketcand = subprocess.Popen( + socketcand = subprocess.Popen( # pylint: disable=consider-using-with cmd, encoding="utf8", stdout=subprocess.PIPE,