From 8ee96b0cbf369dee5772bd8a6b32c4c30eb20210 Mon Sep 17 00:00:00 2001 From: Georgi Valkov Date: Sun, 18 Feb 2024 17:01:42 +0100 Subject: [PATCH] Minor ruff lint fixes --- docs/conf.py | 3 ++- evdev/device.py | 4 ++-- pyproject.toml | 3 +++ requirements-dev.txt | 11 +++++------ tests/test_ecodes.py | 6 +++--- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index d1dc3fd..875ff1d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- -import sys, os +import os +import sys import sphinx_rtd_theme # Check if readthedocs is building us diff --git a/evdev/device.py b/evdev/device.py index 0d2d1d9..cde168e 100644 --- a/evdev/device.py +++ b/evdev/device.py @@ -159,8 +159,8 @@ def __del__(self): def _capabilities(self, absinfo=True): res = {} - for etype, ecodes in self._rawcapabilities.items(): - for code in ecodes: + for etype, _ecodes in self._rawcapabilities.items(): + for code in _ecodes: l = res.setdefault(etype, []) if isinstance(code, tuple): if absinfo: diff --git a/pyproject.toml b/pyproject.toml index 911b8e8..e1115d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,3 +34,6 @@ packages = ["evdev"] [tool.ruff] line-length = 120 + +[tool.ruff.lint] +ignore = ["E265", "E241", "F403", "F401", "E401", "E731"] \ No newline at end of file diff --git a/requirements-dev.txt b/requirements-dev.txt index d8aecc7..ef9693e 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,7 +1,6 @@ -pytest ~= 7.1.0 -Sphinx ~= 4.4.0 -sphinx-copybutton ~= 0.5.0 -bump2version -sphinx_rtd_theme -twine +pytest +Sphinx +sphinx-copybutton ~= 0.5.2 +sphinx-rtd-theme ruff +bump-my-version ~= 0.17.4 \ No newline at end of file diff --git a/tests/test_ecodes.py b/tests/test_ecodes.py index 8f4cbbb..c810b4f 100644 --- a/tests/test_ecodes.py +++ b/tests/test_ecodes.py @@ -6,9 +6,9 @@ prefixes = "KEY ABS REL SW MSC LED BTN REP SND ID EV BUS SYN FF_STATUS FF" -def to_tuples(l): +def to_tuples(val): t = lambda x: tuple(x) if isinstance(x, list) else x - return map(t, l) + return map(t, val) def test_equality(): @@ -28,4 +28,4 @@ def test_access(): def test_overlap(): vals_ff = set(to_tuples(ecodes.FF.values())) vals_ff_status = set(to_tuples(ecodes.FF_STATUS.values())) - assert bool(vals_ff & vals_ff_status) == False + assert bool(vals_ff & vals_ff_status) is False