]> www.infradead.org Git - users/hch/misc.git/commitdiff
tools: ynl: remove unused imports
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>
Tue, 9 Sep 2025 21:07:51 +0000 (23:07 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 11 Sep 2025 01:08:59 +0000 (18:08 -0700)
These imports are not used according to Ruff, and can be safely removed.

This is linked to Ruff error F401 [1]:

  Unused imports add a performance overhead at runtime, and risk
  creating import cycles. They also increase the cognitive load of
  reading the code.

There is one exception with 'YnlDocGenerator' which is added in __all__:
it is used by ynl_gen_rst.py.

Link: https://docs.astral.sh/ruff/rules/unused-import/
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
Reviewed-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
Link: https://patch.msgid.link/20250909-net-next-ynl-ruff-v1-5-238c2bccdd99@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/net/ynl/pyynl/ethtool.py
tools/net/ynl/pyynl/lib/__init__.py
tools/net/ynl/pyynl/lib/ynl.py
tools/net/ynl/pyynl/ynl_gen_c.py

index c1cd088c050cd52ee379ed4682fff856b9b3b3be..9b523cbb3568cc2a62109ff7f8373e95fd16db42 100755 (executable)
@@ -2,7 +2,6 @@
 # SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
 
 import argparse
-import json
 import pathlib
 import pprint
 import sys
index 5f266ebe45266e4d8b577f6d0dcc91db6e710179..ec9ea00071be90ce025dbee91c1c778a9170359f 100644 (file)
@@ -8,4 +8,4 @@ from .doc_generator import YnlDocGenerator
 
 __all__ = ["SpecAttr", "SpecAttrSet", "SpecEnumEntry", "SpecEnumSet",
            "SpecFamily", "SpecOperation", "SpecSubMessage", "SpecSubMessageFormat",
-           "YnlFamily", "Netlink", "NlError"]
+           "YnlFamily", "Netlink", "NlError", "YnlDocGenerator"]
index 15ddb0b1adb63f5853bf58579687d160a9c46860..da307fd1e9b0f5c54f39412d6b572557e83dbf86 100644 (file)
@@ -9,7 +9,6 @@ import socket
 import struct
 from struct import Struct
 import sys
-import yaml
 import ipaddress
 import uuid
 import queue
index 8e95c5bb139921f38f374d2c652844c7f4e96a9b..5113cf1787f608125e23fa9033d9db81caf51f49 100755 (executable)
@@ -2,7 +2,6 @@
 # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
 
 import argparse
-import collections
 import filecmp
 import pathlib
 import os
@@ -14,7 +13,7 @@ import yaml
 
 sys.path.append(pathlib.Path(__file__).resolve().parent.as_posix())
 from lib import SpecFamily, SpecAttrSet, SpecAttr, SpecOperation, SpecEnumSet, SpecEnumEntry
-from lib import SpecSubMessage, SpecSubMessageFormat
+from lib import SpecSubMessage
 
 
 def c_upper(name):