From: Simon Marchi Date: Wed, 29 Oct 2025 17:49:22 +0000 (-0400) Subject: gdb/testsuite: address "unused not at top of file" warnings in Python files X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dacf41a62952ae56df91744a932ff793687f4b5f;p=thirdparty%2Fbinutils-gdb.git gdb/testsuite: address "unused not at top of file" warnings in Python files Address flake8 warnings like this one: gdb/testsuite/gdb.python/py-typeprint.py:60:1: E402 module level import not at top of file Change-Id: I6ab7880ec5b55b6a5c85cb01d0f85172d44b4ee1 Approved-By: Tom Tromey --- diff --git a/gdb/testsuite/gdb.python/py-color-leak.py b/gdb/testsuite/gdb.python/py-color-leak.py index d903ee344e5..852458fbc14 100644 --- a/gdb/testsuite/gdb.python/py-color-leak.py +++ b/gdb/testsuite/gdb.python/py-color-leak.py @@ -21,7 +21,7 @@ import gdb # src/gdb/testsuite/gdb.python/__pycache__/gdb_leak_detector.cpython-.pyc. sys.dont_write_bytecode = True -import gdb_leak_detector +import gdb_leak_detector # noqa: E402 class color_leak_detector(gdb_leak_detector.gdb_leak_detector): diff --git a/gdb/testsuite/gdb.python/py-inferior-leak.py b/gdb/testsuite/gdb.python/py-inferior-leak.py index 4ee4dc232eb..375e909ef57 100644 --- a/gdb/testsuite/gdb.python/py-inferior-leak.py +++ b/gdb/testsuite/gdb.python/py-inferior-leak.py @@ -13,6 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import re import sys import gdb @@ -21,9 +22,8 @@ import gdb # src/gdb/testsuite/gdb.python/__pycache__/gdb_leak_detector.cpython-.pyc. sys.dont_write_bytecode = True -import re -import gdb_leak_detector +import gdb_leak_detector # noqa: E402 class inferior_leak_detector(gdb_leak_detector.gdb_leak_detector): diff --git a/gdb/testsuite/gdb.python/py-read-memory-leak.py b/gdb/testsuite/gdb.python/py-read-memory-leak.py index a58ebfc09f7..6bab0d73302 100644 --- a/gdb/testsuite/gdb.python/py-read-memory-leak.py +++ b/gdb/testsuite/gdb.python/py-read-memory-leak.py @@ -21,7 +21,7 @@ import gdb # src/gdb/testsuite/gdb.python/__pycache__/gdb_leak_detector.cpython-.pyc. sys.dont_write_bytecode = True -import gdb_leak_detector +import gdb_leak_detector # noqa: E402 class read_leak_detector(gdb_leak_detector.gdb_leak_detector): diff --git a/gdb/testsuite/gdb.python/py-typeprint.py b/gdb/testsuite/gdb.python/py-typeprint.py index dc13210610a..208b36835e5 100644 --- a/gdb/testsuite/gdb.python/py-typeprint.py +++ b/gdb/testsuite/gdb.python/py-typeprint.py @@ -14,6 +14,7 @@ # along with this program. If not, see . import gdb +import gdb.types class StringRecognizer(object): @@ -57,6 +58,4 @@ class OtherTypePrinter(object): return OtherRecognizer() -import gdb.types - gdb.types.register_type_printer(gdb.objfiles()[0], OtherTypePrinter())