From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 3/9] Ignore unsed import in dap/__init__.py
Date: Tue, 19 Mar 2024 11:33:31 -0600 [thread overview]
Message-ID: <20240319-more-flake8-v1-3-893549dbed75@adacore.com> (raw)
In-Reply-To: <20240319-more-flake8-v1-0-893549dbed75@adacore.com>
flake8 warns about dap/__init__.py because it has a number of unused
imports. Most of these are intentional: the import is done to ensure
that the a DAP request is registered with the server object.
This patch applies a "noqa" comment to these imports, and also removes
one import that is truly unnecessary.
---
gdb/python/lib/gdb/dap/__init__.py | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/gdb/python/lib/gdb/dap/__init__.py b/gdb/python/lib/gdb/dap/__init__.py
index 86da9b8ef3c..f947314880c 100644
--- a/gdb/python/lib/gdb/dap/__init__.py
+++ b/gdb/python/lib/gdb/dap/__init__.py
@@ -14,25 +14,27 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
-import gdb
# This must come before other DAP imports.
from . import startup
-# Load modules that define commands.
-from . import breakpoint
-from . import bt
-from . import disassemble
-from . import evaluate
-from . import launch
-from . import locations
-from . import memory
-from . import modules
-from . import next
-from . import pause
-from . import scopes
-from . import sources
-from . import threads
+# Load modules that define commands. These imports intentionally
+# ignore the unused import warning, as these modules are being loaded
+# for their side effects -- namely, registering DAP commands with the
+# server object. "F401" is the flake8 "imported but unused" code.
+from . import breakpoint # noqa: F401
+from . import bt # noqa: F401
+from . import disassemble # noqa: F401
+from . import evaluate # noqa: F401
+from . import launch # noqa: F401
+from . import locations # noqa: F401
+from . import memory # noqa: F401
+from . import modules # noqa: F401
+from . import next # noqa: F401
+from . import pause # noqa: F401
+from . import scopes # noqa: F401
+from . import sources # noqa: F401
+from . import threads # noqa: F401
from .server import Server
--
2.43.0
next prev parent reply other threads:[~2024-03-19 17:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-19 17:33 [PATCH 0/9] Make gdb/python flake-clean Tom Tromey
2024-03-19 17:33 ` [PATCH 1/9] Remove .flake8 Tom Tromey
2024-03-19 17:33 ` [PATCH 2/9] Fix flake8 errors in dap/server.py Tom Tromey
2024-03-19 17:33 ` Tom Tromey [this message]
2024-03-20 15:35 ` [PATCH 3/9] Ignore unsed import in dap/__init__.py Tom Tromey
2024-03-19 17:33 ` [PATCH 4/9] Remove unused import from gdb/__init__.py Tom Tromey
2024-03-19 17:33 ` [PATCH 5/9] Remove bare "except" from disassembler.py Tom Tromey
2024-03-19 17:33 ` [PATCH 6/9] Suppress star import errors Tom Tromey
2024-03-19 17:33 ` [PATCH 7/9] Specify ImportError in styling.py Tom Tromey
2024-03-19 17:33 ` [PATCH 8/9] Suppress some "undefined" warnings from flake8 Tom Tromey
2024-03-20 18:58 ` Simon Marchi
2024-03-20 20:30 ` Tom Tromey
2024-03-20 20:32 ` Tom Tromey
2024-03-19 17:33 ` [PATCH 9/9] Do not use bare "except" Tom Tromey
2024-03-20 19:01 ` [PATCH 0/9] Make gdb/python flake-clean Simon Marchi
2024-04-02 17:01 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240319-more-flake8-v1-3-893549dbed75@adacore.com \
--to=tromey@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).