From patchwork Wed Mar 20 16:38:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 87422 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 291D9385802A for ; Wed, 20 Mar 2024 16:40:36 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by sourceware.org (Postfix) with ESMTPS id 130FC3858285 for ; Wed, 20 Mar 2024 16:40:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 130FC3858285 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 130FC3858285 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::d31 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710952811; cv=none; b=SffPuwLnWqKei4FNU2PctQBvh2qLKGJwX0xPMwYnFsV8/3goKenGwOMWopSlyEaKLmdJjq92K8ZdyTrCoyM9ks4HgjvHkQQGwlJmO4OQnkQQRHH+N5rD1rrLuSwGzbrN5SfJPP2EQDG0qAYau2g0h7MtwVWRNdFbQLVKr2plKqs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710952811; c=relaxed/simple; bh=M+opyf43ctfTfhv8eGIqD4Nx7LtEN3meWOCwdWHLkoE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=DfDpxsLK1UeyUL3cLgTeiVoXploFv4Di8OS+iXv3F7n1z+QKYr1+elo6eSBpszjFJiheogNhvwwUa9K6QoBaO9lDnYRQV65GZECLT5OX+Q4uaukIv429XDU+iJQprwyMnWEaPNSaDOEBKDzOqlgnSgWLenuTJ8zMMN15PMpIevQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-io1-xd31.google.com with SMTP id ca18e2360f4ac-7c7ee7fa1d8so210142539f.1 for ; Wed, 20 Mar 2024 09:40:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1710952808; x=1711557608; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=10TJMsDoyR3uGbIVWl+dMp905w3NOoOxbyTJrCgpOcA=; b=lftLCrcTIYBE2Y4Ss7LWDLL3oCcRpkqj3wrZyZvxJ6/WB4cWAXBb8mKYXQgnAmWraG jy4mA/SQ1UL0lv4CBJpoTk8Ro3k3Gx7BwoSRLhvu75epfSvsSYRQI8RyRNIlcCOPcvNb cOR1GszNOw12OX07b1B41IkBxkL0fEhIoT8QxNtsI2Ek6VdIjPnHP3c+P154YJ3+phDb hr/irfQAszL+RWWUdR3xSkI6qeGcyM80Qk6gSf5f+RdAsVKJA49+px5xYh3KkXjmhM0H sBTb5d72FhXfU79hzRBmZLxuoT2W1rmmnN2GJTQdSv6VTXIOUTmSLikmaV3TAdDmxDGi 0WiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710952808; x=1711557608; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=10TJMsDoyR3uGbIVWl+dMp905w3NOoOxbyTJrCgpOcA=; b=iAMV9FXrvh6tdrLR9QgEz0CyOblyE8SkdiJVT0JCkrPONrcGx29Zr7TvQcEoAYBkgB XWzsPFgXwydjOJXD9XQzAOtePc+gw55RQ0s3w8CL+3ypbkRrMtSK7scEjmgTa/NkImgQ hZVlcaxgcMsWZJuvIT4+7+ZT29TnbscwLhYvwBEDIQZrEU4gqrHhu8tag2IR75Fxgi11 f1qALpK2wtuUBj3NdUFa5DAtUyknbi9vnLfvDqPJO+UUfX6I9c9BujPjSzxkuZdcseRL v298VEuwpQ3VZjOtfQduAvfyHbPAQ4jo2K/qvttheJ9gsfWT4VXVCj4iGQvAWEkgRcsR fHLg== X-Gm-Message-State: AOJu0YwVAsD0EuG7bFoLj4+ipNUxpv9zq4mR6MLMpmnvvpk07TewYP9W 2AhuStpgiLhiGjzJbbTA/ZVaqsdCPd6keJPaIl7ruj/lQNudYOgZQF4c5G51xYEv+aHyfy0w5uo = X-Google-Smtp-Source: AGHT+IEt+NRsUVQI0R6so2IMLNGxrkfl6LcuwkJgwj1TD7j/DOx7yQkw/8E/ckvTZpY7M8w9GxhAfg== X-Received: by 2002:a5d:8408:0:b0:7cb:fce8:1df4 with SMTP id i8-20020a5d8408000000b007cbfce81df4mr16494489ion.6.1710952808306; Wed, 20 Mar 2024 09:40:08 -0700 (PDT) Received: from localhost.localdomain (97-122-82-115.hlrn.qwest.net. [97.122.82.115]) by smtp.gmail.com with ESMTPSA id q17-20020a5ea611000000b007cc7e4061bbsm1586269ioi.33.2024.03.20.09.40.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 09:40:08 -0700 (PDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 1/2] Prepare gdb for isort Date: Wed, 20 Mar 2024 10:38:42 -0600 Message-ID: <20240320163957.3349962-2-tromey@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240320163957.3349962-1-tromey@adacore.com> References: <20240320163957.3349962-1-tromey@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org This patch prepares gdb for isort: it adds a couple of isort marker comments where needed, and it adds an isort clause to setup.cfg. --- gdb/python/lib/gdb/__init__.py | 1 + gdb/python/lib/gdb/dap/__init__.py | 2 ++ gdb/setup.cfg | 3 +++ 3 files changed, 6 insertions(+) diff --git a/gdb/python/lib/gdb/__init__.py b/gdb/python/lib/gdb/__init__.py index e7d21fe8d27..5b96605240e 100644 --- a/gdb/python/lib/gdb/__init__.py +++ b/gdb/python/lib/gdb/__init__.py @@ -27,6 +27,7 @@ else: from imp import reload # Note that two indicators are needed here to silence flake8. +# isort: split from _gdb import * # noqa: F401,F403 # Historically, gdb.events was always available, so ensure it's diff --git a/gdb/python/lib/gdb/dap/__init__.py b/gdb/python/lib/gdb/dap/__init__.py index f947314880c..81d435e742f 100644 --- a/gdb/python/lib/gdb/dap/__init__.py +++ b/gdb/python/lib/gdb/dap/__init__.py @@ -16,6 +16,7 @@ import os # This must come before other DAP imports. +# isort: split from . import startup # Load modules that define commands. These imports intentionally @@ -36,6 +37,7 @@ from . import scopes # noqa: F401 from . import sources # noqa: F401 from . import threads # noqa: F401 +# isort: split from .server import Server diff --git a/gdb/setup.cfg b/gdb/setup.cfg index 2e83eb5cf56..d33058ea7f0 100644 --- a/gdb/setup.cfg +++ b/gdb/setup.cfg @@ -7,3 +7,6 @@ # E701: Multiple statements on one line (colon) # W503: line break before binary operator ignore = E203,E501,E701,W503 + +[isort] +profile = black From patchwork Wed Mar 20 16:38:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 87423 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E0397385803B for ; Wed, 20 Mar 2024 16:41:07 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by sourceware.org (Postfix) with ESMTPS id 2C2B13858D1E for ; Wed, 20 Mar 2024 16:40:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2C2B13858D1E Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2C2B13858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::d33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710952816; cv=none; b=vfx8uU0SPx+bl1NKZwr6sl51o9Ne7ZlAdPF+O0imZ8nVsEqlTfVweuWILavYeOT8252OCd13Q0mCaitIxPKywxyCyfzatzsmQdnyo67+a2HlVOh6TPW/kfnLCBWojx2uc4sRgMPxrD6TZjG0ayf1s0Hwi18yzfBbgroKgY68uQg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710952816; c=relaxed/simple; bh=7e7OwwiTO3dCs9wesnnQdwniQE96k8Rm5LSkXXhRDFQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vV6qGGUODtFS1kyDVJipWS7+oRfjgKt4bbr9c+ZkqR8hxR+vV29Dw4/fZVK4WANDiyhZ2HjRZ2EzHbNN8vu6JNS2s45xewC73VTI4TwYQNxcAGh9EGDPJdrCC2vucH3WbO+Us6Bp+QmdSVvT1DZnpEJRWqA5sFCuhaAoBCAy+R4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-io1-xd33.google.com with SMTP id ca18e2360f4ac-7c8b95f7f73so2744639f.1 for ; Wed, 20 Mar 2024 09:40:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1710952809; x=1711557609; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Fd69HsXv7KwrH34HdYa9HKRa6Yrj0irqO2eeE4h8Gsw=; b=BojHxpBYGMzpXxkvtS3Jt5xAIk9Q9zWZSFP53n0dVtOYbEqdIikNw4O4Z0ncPbDlRw maq9v9Me/Bne6UltIezlDOm7IKxYOZLIrV/nditJNjADp4gGcUQYmeKM/1yeAq3KDqJx TFGrMWKtsJAXa2yano1wBHskQC8PdB5OCLISxkcXvK5bHO9aaXm63pAA+qnnacWUR51K fSHqKqHQtDcYhq3+QUzBLPpRNFb80V9TEVLZVPId+zCoRCdE0cRrS022bHpRs51IMkuE i52adKxnLJP2YlnNlZLWJnEIVG3j91uA5KCXErZq707KnoZANP0+PZw92GuUxy5G3cyP oCfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710952809; x=1711557609; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Fd69HsXv7KwrH34HdYa9HKRa6Yrj0irqO2eeE4h8Gsw=; b=MJAVt+jsTVKDE6CqrQhL8jDWH5EgujvwRU1EC84NgHpePqQ6MWULi30ZHqmRw+9eWO 8Y4+bIfaWu0yaZV+1h9g1mF5EknE9/2/x4wIHn6GjB7kPy8ysKPyMInpSfNytOTOkUv2 g36Y7TEV5qo2Cpuv7XCoE4k4aPAOApTHi7r32r9o7rE5X1gAbm4JtWEYFq1lUdrJBANg 4Rp8Uf6NhssJIixBPliT9gP4ybBKRPiXSTkwNVy7NgvJrSgqH1VSjgFADEqkHk7O4i5c NftJL29vTRl5x2lKIjws1rR4+8isVQe1P8OryqE7VAAPjsB1VEbtQ+CLbbq9khuWeTms +UNA== X-Gm-Message-State: AOJu0YylAIJThq2xJGqUQjXnNdcVXmX8Jr9hyL6MRRajbw6NXMp3UD9a ENAnlNUN+51TadmjqV05Ij7LXIQ7moFiLJjKyAtjrmSy3lFwQf3hc2lMmP7i8bjrx2jjt5Lp/mU = X-Google-Smtp-Source: AGHT+IG+Oh2O2ayEhi5PYbq8156Fad0SRV4/ZNlOmCpUVNnYj/k0yqz+h/DJCq9FMN6vTi3csPwqvQ== X-Received: by 2002:a6b:c8d4:0:b0:7c8:b744:3699 with SMTP id y203-20020a6bc8d4000000b007c8b7443699mr196671iof.0.1710952808781; Wed, 20 Mar 2024 09:40:08 -0700 (PDT) Received: from localhost.localdomain (97-122-82-115.hlrn.qwest.net. [97.122.82.115]) by smtp.gmail.com with ESMTPSA id q17-20020a5ea611000000b007cc7e4061bbsm1586269ioi.33.2024.03.20.09.40.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 09:40:08 -0700 (PDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 2/2] Run isort Date: Wed, 20 Mar 2024 10:38:43 -0600 Message-ID: <20240320163957.3349962-3-tromey@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240320163957.3349962-1-tromey@adacore.com> References: <20240320163957.3349962-1-tromey@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org This patch is the result of running 'isort .' in the gdb directory. --- gdb/python/lib/gdb/__init__.py | 12 ++++---- gdb/python/lib/gdb/command/frame_filters.py | 1 + gdb/python/lib/gdb/command/missing_debug.py | 3 +- gdb/python/lib/gdb/command/pretty_printers.py | 3 +- gdb/python/lib/gdb/command/type_printers.py | 1 + gdb/python/lib/gdb/command/unwinders.py | 3 +- gdb/python/lib/gdb/command/xmethods.py | 3 +- gdb/python/lib/gdb/dap/__init__.py | 29 ++++++++++--------- gdb/python/lib/gdb/dap/breakpoint.py | 9 +++--- gdb/python/lib/gdb/dap/bt.py | 5 ++-- gdb/python/lib/gdb/dap/disassemble.py | 2 +- gdb/python/lib/gdb/dap/evaluate.py | 10 +++---- gdb/python/lib/gdb/dap/events.py | 3 +- gdb/python/lib/gdb/dap/frames.py | 3 +- gdb/python/lib/gdb/dap/io.py | 2 +- gdb/python/lib/gdb/dap/launch.py | 8 ++--- gdb/python/lib/gdb/dap/locations.py | 4 +-- gdb/python/lib/gdb/dap/memory.py | 3 +- gdb/python/lib/gdb/dap/scopes.py | 3 +- gdb/python/lib/gdb/dap/server.py | 12 ++++---- gdb/python/lib/gdb/dap/sources.py | 5 ++-- gdb/python/lib/gdb/dap/startup.py | 6 ++-- gdb/python/lib/gdb/dap/state.py | 2 +- gdb/python/lib/gdb/dap/varref.py | 7 +++-- gdb/python/lib/gdb/disassembler.py | 3 +- gdb/python/lib/gdb/frames.py | 7 +++-- gdb/python/lib/gdb/function/caller_is.py | 3 +- gdb/python/lib/gdb/function/strfns.py | 3 +- gdb/python/lib/gdb/missing_debug.py | 5 ++-- gdb/python/lib/gdb/printing.py | 5 ++-- gdb/python/lib/gdb/prompt.py | 3 +- gdb/python/lib/gdb/styling.py | 4 +-- gdb/python/lib/gdb/xmethod.py | 3 +- gdb/python/python-config.py | 4 +-- gdb/syscalls/arm-linux.py | 2 +- gdb/system-gdbinit/elinos.py | 3 +- gdb/testsuite/analyze-racy-logs.py | 2 +- gdb/testsuite/gdb.ada/pp-rec-component.py | 1 + gdb/testsuite/gdb.base/pc-not-saved.py | 2 +- gdb/testsuite/gdb.dap/stack-format.py | 2 +- gdb/testsuite/gdb.dap/type_check.py | 1 + .../gdb.perf/gmonster-null-lookup.py | 4 +-- .../gdb.perf/gmonster-pervasive-typedef.py | 4 +-- gdb/testsuite/gdb.perf/gmonster-print-cerr.py | 4 +-- .../gdb.perf/gmonster-ptype-string.py | 4 +-- gdb/testsuite/gdb.perf/gmonster-runto-main.py | 4 +-- .../gdb.perf/gmonster-select-file.py | 4 +-- .../gdb.perf/lib/perftest/measure.py | 4 +-- .../gdb.perf/lib/perftest/perftest.py | 14 +++++---- gdb/testsuite/gdb.perf/solib.py | 3 +- ...ded-pretty-printers-in-newobjfile-event.py | 3 +- gdb/testsuite/gdb.python/py-bad-printers.py | 1 + gdb/testsuite/gdb.python/py-disasm.py | 4 +-- gdb/testsuite/gdb.python/py-event-load.py | 1 - gdb/testsuite/gdb.python/py-frame-args.py | 1 + .../gdb.python/py-framefilter-addr.py | 5 ++-- .../gdb.python/py-framefilter-gdb.py | 3 +- .../py-framefilter-invalidarg-gdb.py | 3 +- .../gdb.python/py-framefilter-invalidarg.py | 5 ++-- gdb/testsuite/gdb.python/py-framefilter.py | 5 ++-- gdb/testsuite/gdb.python/py-inferior-leak.py | 3 +- .../py-mi-var-info-path-expression.py | 1 + gdb/testsuite/gdb.python/py-missing-debug.py | 5 ++-- gdb/testsuite/gdb.python/py-nested-maps.py | 1 + gdb/testsuite/gdb.python/py-pp-integral.py | 1 + gdb/testsuite/gdb.python/py-pp-maint.py | 3 +- gdb/testsuite/gdb.python/py-pp-re-notag.py | 1 + .../gdb.python/py-pp-registration.py | 3 +- gdb/testsuite/gdb.python/py-prettyprint.py | 1 + gdb/testsuite/gdb.python/py-send-packet.py | 1 + gdb/testsuite/gdb.python/py-unwind-maint.py | 1 + gdb/testsuite/gdb.python/py-unwind.py | 3 +- gdb/testsuite/gdb.python/py-xmethods.py | 6 ++-- gdb/testsuite/gdb.rust/pp.py | 1 + gdb/testsuite/print-ts.py | 4 +-- 75 files changed, 163 insertions(+), 140 deletions(-) diff --git a/gdb/python/lib/gdb/__init__.py b/gdb/python/lib/gdb/__init__.py index 5b96605240e..3589117d411 100644 --- a/gdb/python/lib/gdb/__init__.py +++ b/gdb/python/lib/gdb/__init__.py @@ -13,11 +13,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import os import signal +import sys import threading import traceback -import os -import sys from contextlib import contextmanager # Python 3 moved "reload" @@ -27,11 +27,13 @@ else: from imp import reload # Note that two indicators are needed here to silence flake8. -# isort: split from _gdb import * # noqa: F401,F403 +# isort: split + # Historically, gdb.events was always available, so ensure it's # still available without an explicit import. +# isort: split import _gdbevents as events sys.modules["gdb.events"] = events @@ -63,8 +65,8 @@ class _GdbFile(object): write(s, stream=self.stream) # noqa: F405 -sys.stdout = _GdbFile(STDOUT) # noqa: F405 -sys.stderr = _GdbFile(STDERR) # noqa: F405 +sys.stdout = _GdbFile(STDOUT) # noqa: F405 +sys.stderr = _GdbFile(STDERR) # noqa: F405 # Default prompt hook does nothing. prompt_hook = None diff --git a/gdb/python/lib/gdb/command/frame_filters.py b/gdb/python/lib/gdb/command/frame_filters.py index d774e194fba..4e1b3208d0e 100644 --- a/gdb/python/lib/gdb/command/frame_filters.py +++ b/gdb/python/lib/gdb/command/frame_filters.py @@ -17,6 +17,7 @@ """GDB commands for working with frame-filters.""" import sys + import gdb import gdb.frames diff --git a/gdb/python/lib/gdb/command/missing_debug.py b/gdb/python/lib/gdb/command/missing_debug.py index 9a55e1822f5..313b88cf8c3 100644 --- a/gdb/python/lib/gdb/command/missing_debug.py +++ b/gdb/python/lib/gdb/command/missing_debug.py @@ -15,9 +15,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import gdb import re +import gdb + def validate_regexp(exp, idstring): """Compile exp into a compiler regular expression object. diff --git a/gdb/python/lib/gdb/command/pretty_printers.py b/gdb/python/lib/gdb/command/pretty_printers.py index 6a938ed8fcd..cb9b9f35f9f 100644 --- a/gdb/python/lib/gdb/command/pretty_printers.py +++ b/gdb/python/lib/gdb/command/pretty_printers.py @@ -17,9 +17,10 @@ """GDB commands for working with pretty-printers.""" import copy -import gdb import re +import gdb + def parse_printer_regexps(arg): """Internal utility to parse a pretty-printer command argv. diff --git a/gdb/python/lib/gdb/command/type_printers.py b/gdb/python/lib/gdb/command/type_printers.py index 339f5aac6a2..a2be226850d 100644 --- a/gdb/python/lib/gdb/command/type_printers.py +++ b/gdb/python/lib/gdb/command/type_printers.py @@ -15,6 +15,7 @@ # along with this program. If not, see . import copy + import gdb """GDB commands for working with type-printers.""" diff --git a/gdb/python/lib/gdb/command/unwinders.py b/gdb/python/lib/gdb/command/unwinders.py index 886287f8794..b863b333aa0 100644 --- a/gdb/python/lib/gdb/command/unwinders.py +++ b/gdb/python/lib/gdb/command/unwinders.py @@ -14,9 +14,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import gdb import re +import gdb + def validate_regexp(exp, idstring): try: diff --git a/gdb/python/lib/gdb/command/xmethods.py b/gdb/python/lib/gdb/command/xmethods.py index fe310b7787e..f7862271858 100644 --- a/gdb/python/lib/gdb/command/xmethods.py +++ b/gdb/python/lib/gdb/command/xmethods.py @@ -14,9 +14,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import gdb import re +import gdb + """GDB commands for working with xmethods.""" diff --git a/gdb/python/lib/gdb/dap/__init__.py b/gdb/python/lib/gdb/dap/__init__.py index 81d435e742f..51b95468a70 100644 --- a/gdb/python/lib/gdb/dap/__init__.py +++ b/gdb/python/lib/gdb/dap/__init__.py @@ -16,26 +16,27 @@ import os # This must come before other DAP imports. -# isort: split from . import startup +# isort: split + # 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 . 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 # isort: split from .server import Server diff --git a/gdb/python/lib/gdb/dap/breakpoint.py b/gdb/python/lib/gdb/dap/breakpoint.py index b4fb1127c2d..b2e74277ebd 100644 --- a/gdb/python/lib/gdb/dap/breakpoint.py +++ b/gdb/python/lib/gdb/dap/breakpoint.py @@ -13,21 +13,20 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import gdb import os import re - from contextlib import contextmanager # These are deprecated in 3.9, but required in older versions. from typing import Optional, Sequence -from .server import request, capability, send_event +import gdb + +from .server import capability, request, send_event from .sources import make_source -from .startup import in_gdb_thread, log_stack, parse_and_eval, LogLevel, DAPException +from .startup import DAPException, LogLevel, in_gdb_thread, log_stack, parse_and_eval from .typecheck import type_check - # True when suppressing new breakpoint events. _suppress_bp = False diff --git a/gdb/python/lib/gdb/dap/bt.py b/gdb/python/lib/gdb/dap/bt.py index d65ce5fcc2a..e0c2e2a1751 100644 --- a/gdb/python/lib/gdb/dap/bt.py +++ b/gdb/python/lib/gdb/dap/bt.py @@ -13,16 +13,17 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import gdb import os # This is deprecated in 3.9, but required in older versions. from typing import Optional +import gdb + from .frames import dap_frame_generator from .modules import module_id from .scopes import symbol_value -from .server import request, capability +from .server import capability, request from .sources import make_source from .startup import in_gdb_thread from .state import set_thread diff --git a/gdb/python/lib/gdb/dap/disassemble.py b/gdb/python/lib/gdb/dap/disassemble.py index a7825289899..65bf3d4457b 100644 --- a/gdb/python/lib/gdb/dap/disassemble.py +++ b/gdb/python/lib/gdb/dap/disassemble.py @@ -15,7 +15,7 @@ import gdb -from .server import request, capability +from .server import capability, request @request("disassemble") diff --git a/gdb/python/lib/gdb/dap/evaluate.py b/gdb/python/lib/gdb/dap/evaluate.py index 62519a55521..34843f423d8 100644 --- a/gdb/python/lib/gdb/dap/evaluate.py +++ b/gdb/python/lib/gdb/dap/evaluate.py @@ -13,15 +13,15 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import gdb - # This is deprecated in 3.9, but required in older versions. from typing import Optional +import gdb + from .frames import select_frame -from .server import capability, request, client_bool_capability -from .startup import in_gdb_thread, parse_and_eval, DAPException -from .varref import find_variable, VariableReference, apply_format +from .server import capability, client_bool_capability, request +from .startup import DAPException, in_gdb_thread, parse_and_eval +from .varref import VariableReference, apply_format, find_variable class EvaluateResult(VariableReference): diff --git a/gdb/python/lib/gdb/dap/events.py b/gdb/python/lib/gdb/dap/events.py index 928f23fd3ff..276d3145b9a 100644 --- a/gdb/python/lib/gdb/dap/events.py +++ b/gdb/python/lib/gdb/dap/events.py @@ -15,11 +15,10 @@ import gdb +from .modules import is_module, make_module from .scopes import set_finish_value from .server import send_event from .startup import exec_and_log, in_gdb_thread, log -from .modules import is_module, make_module - # True when the inferior is thought to be running, False otherwise. # This may be accessed from any thread, which can be racy. However, diff --git a/gdb/python/lib/gdb/dap/frames.py b/gdb/python/lib/gdb/dap/frames.py index 161c84b025b..07a4e3ea793 100644 --- a/gdb/python/lib/gdb/dap/frames.py +++ b/gdb/python/lib/gdb/dap/frames.py @@ -13,14 +13,13 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import gdb import itertools +import gdb from gdb.frames import frame_iterator from .startup import in_gdb_thread - # A list of all the frames we've reported. A frame's index in the # list is its ID. We don't use a hash here because frames are not # hashable. diff --git a/gdb/python/lib/gdb/dap/io.py b/gdb/python/lib/gdb/dap/io.py index bbf822d60bf..03031a72393 100644 --- a/gdb/python/lib/gdb/dap/io.py +++ b/gdb/python/lib/gdb/dap/io.py @@ -15,7 +15,7 @@ import json -from .startup import start_thread, log, log_stack, LogLevel +from .startup import LogLevel, log, log_stack, start_thread def read_json(stream): diff --git a/gdb/python/lib/gdb/dap/launch.py b/gdb/python/lib/gdb/dap/launch.py index 6783d999621..2674e02eac3 100644 --- a/gdb/python/lib/gdb/dap/launch.py +++ b/gdb/python/lib/gdb/dap/launch.py @@ -13,14 +13,14 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import gdb - # These are deprecated in 3.9, but required in older versions. from typing import Mapping, Optional, Sequence +import gdb + from .events import exec_and_expect_stop, expect_process, expect_stop -from .server import request, capability -from .startup import exec_and_log, DAPException +from .server import capability, request +from .startup import DAPException, exec_and_log # Any parameters here are necessarily extensions -- DAP requires this diff --git a/gdb/python/lib/gdb/dap/locations.py b/gdb/python/lib/gdb/dap/locations.py index 098091b4b42..92e68f5e235 100644 --- a/gdb/python/lib/gdb/dap/locations.py +++ b/gdb/python/lib/gdb/dap/locations.py @@ -13,11 +13,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import gdb - # This is deprecated in 3.9, but required in older versions. from typing import Optional +import gdb + from .server import capability, request from .sources import decode_source diff --git a/gdb/python/lib/gdb/dap/memory.py b/gdb/python/lib/gdb/dap/memory.py index 19a61d63499..dd62b0e7ba6 100644 --- a/gdb/python/lib/gdb/dap/memory.py +++ b/gdb/python/lib/gdb/dap/memory.py @@ -14,9 +14,10 @@ # along with this program. If not, see . import base64 + import gdb -from .server import request, capability +from .server import capability, request @request("readMemory") diff --git a/gdb/python/lib/gdb/dap/scopes.py b/gdb/python/lib/gdb/dap/scopes.py index be2c382b40b..8cd860141d6 100644 --- a/gdb/python/lib/gdb/dap/scopes.py +++ b/gdb/python/lib/gdb/dap/scopes.py @@ -16,11 +16,10 @@ import gdb from .frames import frame_for_id -from .startup import in_gdb_thread from .server import request +from .startup import in_gdb_thread from .varref import BaseReference - # Map DAP frame IDs to scopes. This ensures that scopes are re-used. frame_to_scope = {} diff --git a/gdb/python/lib/gdb/dap/server.py b/gdb/python/lib/gdb/dap/server.py index 70646f4d75c..7eb87177710 100644 --- a/gdb/python/lib/gdb/dap/server.py +++ b/gdb/python/lib/gdb/dap/server.py @@ -14,29 +14,29 @@ # along with this program. If not, see . import functools -import gdb import heapq import inspect import json import threading from contextlib import contextmanager -from .io import start_json_writer, read_json +import gdb + +from .io import read_json, start_json_writer from .startup import ( - exec_and_log, DAPException, DAPQueue, + LogLevel, + exec_and_log, in_dap_thread, in_gdb_thread, - start_thread, log, log_stack, - LogLevel, + start_thread, thread_log, ) from .typecheck import type_check - # Map capability names to values. _capabilities = {} diff --git a/gdb/python/lib/gdb/dap/sources.py b/gdb/python/lib/gdb/dap/sources.py index c9b77208145..ee3464db679 100644 --- a/gdb/python/lib/gdb/dap/sources.py +++ b/gdb/python/lib/gdb/dap/sources.py @@ -17,9 +17,8 @@ import os import gdb -from .server import request, capability -from .startup import in_gdb_thread, DAPException - +from .server import capability, request +from .startup import DAPException, in_gdb_thread # The next available source reference ID. Must be greater than 0. _next_source = 1 diff --git a/gdb/python/lib/gdb/dap/startup.py b/gdb/python/lib/gdb/dap/startup.py index aaf1e8cd657..58591c00b97 100644 --- a/gdb/python/lib/gdb/dap/startup.py +++ b/gdb/python/lib/gdb/dap/startup.py @@ -16,14 +16,14 @@ # Do not import other gdbdap modules here -- this module must come # first. import functools -import gdb import queue +import sys import threading import traceback -import sys - from enum import IntEnum, auto +import gdb + # Adapt to different Queue types. This is exported for use in other # modules as well. if sys.version_info[0] == 3 and sys.version_info[1] <= 6: diff --git a/gdb/python/lib/gdb/dap/state.py b/gdb/python/lib/gdb/dap/state.py index 9cb703157de..57ae355f45e 100644 --- a/gdb/python/lib/gdb/dap/state.py +++ b/gdb/python/lib/gdb/dap/state.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from .startup import in_gdb_thread, exec_and_log, log +from .startup import exec_and_log, in_gdb_thread, log @in_gdb_thread diff --git a/gdb/python/lib/gdb/dap/varref.py b/gdb/python/lib/gdb/dap/varref.py index e413e4e8043..57e84a1676e 100644 --- a/gdb/python/lib/gdb/dap/varref.py +++ b/gdb/python/lib/gdb/dap/varref.py @@ -13,13 +13,14 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import gdb -from .startup import in_gdb_thread, DAPException -from .server import client_bool_capability from abc import ABC, abstractmethod from collections import defaultdict from contextlib import contextmanager +import gdb + +from .server import client_bool_capability +from .startup import DAPException, in_gdb_thread # A list of all the variable references created during this pause. all_variables = [] diff --git a/gdb/python/lib/gdb/disassembler.py b/gdb/python/lib/gdb/disassembler.py index af7dcc5f6a8..72d311b117f 100644 --- a/gdb/python/lib/gdb/disassembler.py +++ b/gdb/python/lib/gdb/disassembler.py @@ -15,7 +15,6 @@ """Disassembler related module.""" -import gdb import _gdb.disassembler # Re-export everything from the _gdb.disassembler module, which is @@ -23,6 +22,8 @@ import _gdb.disassembler # here to silence flake8. from _gdb.disassembler import * # noqa: F401,F403 +import gdb + # Module global dictionary of gdb.disassembler.Disassembler objects. # The keys of this dictionary are bfd architecture names, or the # special value None. diff --git a/gdb/python/lib/gdb/frames.py b/gdb/python/lib/gdb/frames.py index 44f3217b8f8..a3be80c72a0 100644 --- a/gdb/python/lib/gdb/frames.py +++ b/gdb/python/lib/gdb/frames.py @@ -16,11 +16,12 @@ """Internal functions for working with frame-filters.""" +import collections +import itertools + import gdb +from gdb.FrameDecorator import DAPFrameDecorator, FrameDecorator from gdb.FrameIterator import FrameIterator -from gdb.FrameDecorator import FrameDecorator, DAPFrameDecorator -import itertools -import collections def get_priority(filter_item): diff --git a/gdb/python/lib/gdb/function/caller_is.py b/gdb/python/lib/gdb/function/caller_is.py index eb87c23740b..bacd8c0ef8b 100644 --- a/gdb/python/lib/gdb/function/caller_is.py +++ b/gdb/python/lib/gdb/function/caller_is.py @@ -14,9 +14,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import gdb import re +import gdb + class CallerIs(gdb.Function): """Check the calling function's name. diff --git a/gdb/python/lib/gdb/function/strfns.py b/gdb/python/lib/gdb/function/strfns.py index 42e5b9cd35b..90c9ceab867 100644 --- a/gdb/python/lib/gdb/function/strfns.py +++ b/gdb/python/lib/gdb/function/strfns.py @@ -16,9 +16,10 @@ """$_memeq, $_strlen, $_streq, $_regex""" -import gdb import re +import gdb + class _MemEq(gdb.Function): """$_memeq - compare bytes of memory. diff --git a/gdb/python/lib/gdb/missing_debug.py b/gdb/python/lib/gdb/missing_debug.py index 3093a9ffe4c..6d57462c185 100644 --- a/gdb/python/lib/gdb/missing_debug.py +++ b/gdb/python/lib/gdb/missing_debug.py @@ -17,9 +17,10 @@ MissingDebugHandler base class, and register_handler function. """ -import gdb import sys +import gdb + if sys.version_info >= (3, 7): # Functions str.isascii() and str.isalnum are available starting Python # 3.7. @@ -32,7 +33,7 @@ if sys.version_info >= (3, 7): else: # Fall back to curses.ascii.isascii() and curses.ascii.isalnum() for # earlier versions. - from curses.ascii import isascii, isalnum + from curses.ascii import isalnum, isascii def _validate_name(name): diff --git a/gdb/python/lib/gdb/printing.py b/gdb/python/lib/gdb/printing.py index d7933e9df76..55ba43585ec 100644 --- a/gdb/python/lib/gdb/printing.py +++ b/gdb/python/lib/gdb/printing.py @@ -16,11 +16,12 @@ """Utilities for working with pretty-printers.""" -import gdb -import gdb.types import itertools import re +import gdb +import gdb.types + class PrettyPrinter(object): """A basic pretty-printer. diff --git a/gdb/python/lib/gdb/prompt.py b/gdb/python/lib/gdb/prompt.py index 02185b353df..4ad38e4567a 100644 --- a/gdb/python/lib/gdb/prompt.py +++ b/gdb/python/lib/gdb/prompt.py @@ -16,9 +16,10 @@ """ Extended prompt library functions.""" -import gdb import os +import gdb + def _prompt_pwd(ignore): "The current working directory." diff --git a/gdb/python/lib/gdb/styling.py b/gdb/python/lib/gdb/styling.py index 8e5d64f15d9..1c5394e479b 100644 --- a/gdb/python/lib/gdb/styling.py +++ b/gdb/python/lib/gdb/styling.py @@ -19,9 +19,9 @@ import gdb try: - from pygments import formatters, lexers, highlight - from pygments.token import Error, Comment, Text + from pygments import formatters, highlight, lexers from pygments.filters import TokenMergeFilter + from pygments.token import Comment, Error, Text _formatter = None diff --git a/gdb/python/lib/gdb/xmethod.py b/gdb/python/lib/gdb/xmethod.py index ea7b15c4dac..c98402d271f 100644 --- a/gdb/python/lib/gdb/xmethod.py +++ b/gdb/python/lib/gdb/xmethod.py @@ -16,9 +16,10 @@ """Utilities for defining xmethods""" -import gdb import re +import gdb + class XMethod(object): """Base class (or a template) for an xmethod description. diff --git a/gdb/python/python-config.py b/gdb/python/python-config.py index e89e0fd40bb..061eae1ac64 100644 --- a/gdb/python/python-config.py +++ b/gdb/python/python-config.py @@ -1,9 +1,9 @@ # Program to fetch python compilation parameters. # Copied from python-config of the 2.7 release. -import sys -import os import getopt +import os +import sys import sysconfig valid_opts = ["prefix", "exec-prefix", "includes", "libs", "cflags", "ldflags", "help"] diff --git a/gdb/syscalls/arm-linux.py b/gdb/syscalls/arm-linux.py index 8213f5ce33d..a3f64d0a825 100644 --- a/gdb/syscalls/arm-linux.py +++ b/gdb/syscalls/arm-linux.py @@ -5,8 +5,8 @@ # notice and this notice are preserved. This file is offered as-is, # without any warranty. -import sys import re +import sys import time infname = sys.argv[1] diff --git a/gdb/system-gdbinit/elinos.py b/gdb/system-gdbinit/elinos.py index bd9d4630438..da82687a76f 100644 --- a/gdb/system-gdbinit/elinos.py +++ b/gdb/system-gdbinit/elinos.py @@ -15,8 +15,9 @@ """Configure GDB using the ELinOS environment.""" -import os import glob +import os + import gdb diff --git a/gdb/testsuite/analyze-racy-logs.py b/gdb/testsuite/analyze-racy-logs.py index bd548e23a31..152490e7686 100755 --- a/gdb/testsuite/analyze-racy-logs.py +++ b/gdb/testsuite/analyze-racy-logs.py @@ -29,9 +29,9 @@ # This program is invoked when the user runs "make check" and # specifies the RACY_ITER environment variable. -import sys import os import re +import sys # The (global) dictionary that stores the associations between a *.sum # file and its results. The data inside it will be stored as: diff --git a/gdb/testsuite/gdb.ada/pp-rec-component.py b/gdb/testsuite/gdb.ada/pp-rec-component.py index 339e4a362a3..3d398125e06 100644 --- a/gdb/testsuite/gdb.ada/pp-rec-component.py +++ b/gdb/testsuite/gdb.ada/pp-rec-component.py @@ -14,6 +14,7 @@ # along with this program. If not, see . from time import asctime, gmtime + import gdb # silence pyflakes diff --git a/gdb/testsuite/gdb.base/pc-not-saved.py b/gdb/testsuite/gdb.base/pc-not-saved.py index 2e19da80b3f..8090858895e 100644 --- a/gdb/testsuite/gdb.base/pc-not-saved.py +++ b/gdb/testsuite/gdb.base/pc-not-saved.py @@ -14,7 +14,7 @@ # along with this program. If not, see . import gdb -from gdb.unwinder import Unwinder, FrameId +from gdb.unwinder import FrameId, Unwinder # Cached FrameId. See set_break_bt_here_frame_id for details. break_bt_here_frame_id = None diff --git a/gdb/testsuite/gdb.dap/stack-format.py b/gdb/testsuite/gdb.dap/stack-format.py index 12c6cc473e5..b7799f41dac 100644 --- a/gdb/testsuite/gdb.dap/stack-format.py +++ b/gdb/testsuite/gdb.dap/stack-format.py @@ -14,9 +14,9 @@ # along with this program. If not, see . -import gdb import itertools +import gdb from gdb.FrameDecorator import DAPFrameDecorator diff --git a/gdb/testsuite/gdb.dap/type_check.py b/gdb/testsuite/gdb.dap/type_check.py index 513995b5571..81b106a595f 100644 --- a/gdb/testsuite/gdb.dap/type_check.py +++ b/gdb/testsuite/gdb.dap/type_check.py @@ -16,6 +16,7 @@ # Test the type checker. import typing + from gdb.dap.typecheck import type_check diff --git a/gdb/testsuite/gdb.perf/gmonster-null-lookup.py b/gdb/testsuite/gdb.perf/gmonster-null-lookup.py index b6cbcf3e825..0d5ba768843 100644 --- a/gdb/testsuite/gdb.perf/gmonster-null-lookup.py +++ b/gdb/testsuite/gdb.perf/gmonster-null-lookup.py @@ -17,9 +17,7 @@ # Efficient handling of this case is important, and not just for typos. # Sometimes the debug info for the needed object isn't present. -from perftest import perftest -from perftest import measure -from perftest import utils +from perftest import measure, perftest, utils class NullLookup(perftest.TestCaseWithBasicMeasurements): diff --git a/gdb/testsuite/gdb.perf/gmonster-pervasive-typedef.py b/gdb/testsuite/gdb.perf/gmonster-pervasive-typedef.py index 048cf7af2d0..3e239f5292b 100644 --- a/gdb/testsuite/gdb.perf/gmonster-pervasive-typedef.py +++ b/gdb/testsuite/gdb.perf/gmonster-pervasive-typedef.py @@ -17,9 +17,7 @@ # typedef used pervasively. This exercises the perf regression introduced by # the original patch to pr 16253. -from perftest import perftest -from perftest import measure -from perftest import utils +from perftest import measure, perftest, utils class PervasiveTypedef(perftest.TestCaseWithBasicMeasurements): diff --git a/gdb/testsuite/gdb.perf/gmonster-print-cerr.py b/gdb/testsuite/gdb.perf/gmonster-print-cerr.py index 97f454b25fb..4f57b860bdd 100644 --- a/gdb/testsuite/gdb.perf/gmonster-print-cerr.py +++ b/gdb/testsuite/gdb.perf/gmonster-print-cerr.py @@ -25,9 +25,7 @@ # is that here we do not pre-expand the symtab: we don't want include # GDB's slowness in searching expanded symtabs first to color these results. -from perftest import perftest -from perftest import measure -from perftest import utils +from perftest import measure, perftest, utils class PrintCerr(perftest.TestCaseWithBasicMeasurements): diff --git a/gdb/testsuite/gdb.perf/gmonster-ptype-string.py b/gdb/testsuite/gdb.perf/gmonster-ptype-string.py index 7ecc221378a..0c000ef5bb3 100644 --- a/gdb/testsuite/gdb.perf/gmonster-ptype-string.py +++ b/gdb/testsuite/gdb.perf/gmonster-ptype-string.py @@ -19,9 +19,7 @@ # these before it searches the index (there is work-in-progress to fix this), # this test helps measure the issue. -from perftest import perftest -from perftest import measure -from perftest import utils +from perftest import measure, perftest, utils class GmonsterPtypeString(perftest.TestCaseWithBasicMeasurements): diff --git a/gdb/testsuite/gdb.perf/gmonster-runto-main.py b/gdb/testsuite/gdb.perf/gmonster-runto-main.py index e69036763a6..a183d68d012 100644 --- a/gdb/testsuite/gdb.perf/gmonster-runto-main.py +++ b/gdb/testsuite/gdb.perf/gmonster-runto-main.py @@ -15,9 +15,7 @@ # Measure performance of running to main. -from perftest import perftest -from perftest import measure -from perftest import utils +from perftest import measure, perftest, utils class GmonsterRuntoMain(perftest.TestCaseWithBasicMeasurements): diff --git a/gdb/testsuite/gdb.perf/gmonster-select-file.py b/gdb/testsuite/gdb.perf/gmonster-select-file.py index 211211236fb..4708458384e 100644 --- a/gdb/testsuite/gdb.perf/gmonster-select-file.py +++ b/gdb/testsuite/gdb.perf/gmonster-select-file.py @@ -15,9 +15,7 @@ # Measure performance of selecting a file to debug. -from perftest import perftest -from perftest import measure -from perftest import utils +from perftest import measure, perftest, utils class GmonsterSelectFile(perftest.TestCaseWithBasicMeasurements): diff --git a/gdb/testsuite/gdb.perf/lib/perftest/measure.py b/gdb/testsuite/gdb.perf/lib/perftest/measure.py index 942b1c4774d..00a1a9ada2b 100644 --- a/gdb/testsuite/gdb.perf/lib/perftest/measure.py +++ b/gdb/testsuite/gdb.perf/lib/perftest/measure.py @@ -13,10 +13,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import time -import os import gc +import os import sys +import time # time.perf_counter() and time.process_time() were added in Python # 3.3, time.clock() was removed in Python 3.8. diff --git a/gdb/testsuite/gdb.perf/lib/perftest/perftest.py b/gdb/testsuite/gdb.perf/lib/perftest/perftest.py index caaae13c5b6..40ed9cc0d68 100644 --- a/gdb/testsuite/gdb.perf/lib/perftest/perftest.py +++ b/gdb/testsuite/gdb.perf/lib/perftest/perftest.py @@ -15,13 +15,15 @@ from __future__ import absolute_import -import perftest.testresult as testresult import perftest.reporter as reporter -from perftest.measure import Measure -from perftest.measure import MeasurementPerfCounter -from perftest.measure import MeasurementProcessTime -from perftest.measure import MeasurementWallTime -from perftest.measure import MeasurementVmSize +import perftest.testresult as testresult +from perftest.measure import ( + Measure, + MeasurementPerfCounter, + MeasurementProcessTime, + MeasurementVmSize, + MeasurementWallTime, +) class TestCase(object): diff --git a/gdb/testsuite/gdb.perf/solib.py b/gdb/testsuite/gdb.perf/solib.py index 0dd1d7429be..470009667e8 100644 --- a/gdb/testsuite/gdb.perf/solib.py +++ b/gdb/testsuite/gdb.perf/solib.py @@ -16,8 +16,7 @@ # This test case is to test the speed of GDB when it is handling the # shared libraries of inferior are loaded and unloaded. -from perftest import perftest -from perftest import measure +from perftest import measure, perftest class SolibLoadUnload1(perftest.TestCaseWithBasicMeasurements): diff --git a/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.py b/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.py index 97dc3758079..d63c0877199 100644 --- a/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.py +++ b/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.py @@ -18,9 +18,10 @@ # registered when a custom event handler for the new_objfile event # is called. -import gdb import os +import gdb + def new_objfile_handler(event): assert isinstance(event, gdb.NewObjFileEvent) diff --git a/gdb/testsuite/gdb.python/py-bad-printers.py b/gdb/testsuite/gdb.python/py-bad-printers.py index 068c00140a3..ac9c35e6a90 100644 --- a/gdb/testsuite/gdb.python/py-bad-printers.py +++ b/gdb/testsuite/gdb.python/py-bad-printers.py @@ -19,6 +19,7 @@ # Test a printer with a bad children iterator. import re + import gdb.printing diff --git a/gdb/testsuite/gdb.python/py-disasm.py b/gdb/testsuite/gdb.python/py-disasm.py index 281ce6b8c2a..c09eae811ee 100644 --- a/gdb/testsuite/gdb.python/py-disasm.py +++ b/gdb/testsuite/gdb.python/py-disasm.py @@ -13,11 +13,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import gdb -import gdb.disassembler import struct import sys +import gdb +import gdb.disassembler from gdb.disassembler import Disassembler, DisassemblerResult # A global, holds the program-counter address at which we should diff --git a/gdb/testsuite/gdb.python/py-event-load.py b/gdb/testsuite/gdb.python/py-event-load.py index 0c9e736a0bb..cffd5c0a15d 100644 --- a/gdb/testsuite/gdb.python/py-event-load.py +++ b/gdb/testsuite/gdb.python/py-event-load.py @@ -17,7 +17,6 @@ import gdb - freed_objfile = None diff --git a/gdb/testsuite/gdb.python/py-frame-args.py b/gdb/testsuite/gdb.python/py-frame-args.py index abf89ac20f9..04ab1ac4672 100644 --- a/gdb/testsuite/gdb.python/py-frame-args.py +++ b/gdb/testsuite/gdb.python/py-frame-args.py @@ -14,6 +14,7 @@ # along with this program. If not, see . import re + import gdb diff --git a/gdb/testsuite/gdb.python/py-framefilter-addr.py b/gdb/testsuite/gdb.python/py-framefilter-addr.py index 7c64440b59c..c22d91c10ba 100644 --- a/gdb/testsuite/gdb.python/py-framefilter-addr.py +++ b/gdb/testsuite/gdb.python/py-framefilter-addr.py @@ -13,10 +13,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import gdb +import copy import itertools + +import gdb from gdb.FrameDecorator import FrameDecorator -import copy # A FrameDecorator that just returns gdb.Frame.pc () from 'function'. diff --git a/gdb/testsuite/gdb.python/py-framefilter-gdb.py b/gdb/testsuite/gdb.python/py-framefilter-gdb.py index 2b786913243..ada7ad72e4c 100644 --- a/gdb/testsuite/gdb.python/py-framefilter-gdb.py +++ b/gdb/testsuite/gdb.python/py-framefilter-gdb.py @@ -13,10 +13,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import itertools + # This file is part of the GDB testsuite. It tests Python-based # frame-filters. import gdb -import itertools from gdb.FrameDecorator import FrameDecorator diff --git a/gdb/testsuite/gdb.python/py-framefilter-invalidarg-gdb.py b/gdb/testsuite/gdb.python/py-framefilter-invalidarg-gdb.py index 60e81fc2f88..fbe0c0d4a94 100644 --- a/gdb/testsuite/gdb.python/py-framefilter-invalidarg-gdb.py +++ b/gdb/testsuite/gdb.python/py-framefilter-invalidarg-gdb.py @@ -13,10 +13,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import itertools + # This file is part of the GDB testsuite. It tests Python-based # frame-filters. import gdb -import itertools from gdb.FrameDecorator import FrameDecorator diff --git a/gdb/testsuite/gdb.python/py-framefilter-invalidarg.py b/gdb/testsuite/gdb.python/py-framefilter-invalidarg.py index 0793a2875d8..cb25cd9902c 100644 --- a/gdb/testsuite/gdb.python/py-framefilter-invalidarg.py +++ b/gdb/testsuite/gdb.python/py-framefilter-invalidarg.py @@ -13,12 +13,13 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import copy +import itertools + # This file is part of the GDB testsuite. It tests Python-based # frame-filters. import gdb -import itertools from gdb.FrameDecorator import FrameDecorator -import copy class Reverse_Function(FrameDecorator): diff --git a/gdb/testsuite/gdb.python/py-framefilter.py b/gdb/testsuite/gdb.python/py-framefilter.py index 720fbf920d0..fb679f18b4f 100644 --- a/gdb/testsuite/gdb.python/py-framefilter.py +++ b/gdb/testsuite/gdb.python/py-framefilter.py @@ -13,12 +13,13 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import copy +import itertools + # This file is part of the GDB testsuite. It tests Python-based # frame-filters. import gdb -import itertools from gdb.FrameDecorator import FrameDecorator -import copy class Reverse_Function(FrameDecorator): diff --git a/gdb/testsuite/gdb.python/py-inferior-leak.py b/gdb/testsuite/gdb.python/py-inferior-leak.py index c3e88015e99..ae3629a76a0 100644 --- a/gdb/testsuite/gdb.python/py-inferior-leak.py +++ b/gdb/testsuite/gdb.python/py-inferior-leak.py @@ -13,9 +13,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import re import tracemalloc + import gdb -import re # A global variable in which we store a reference to the gdb.Inferior # object sent to us in the new_inferior event. diff --git a/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.py b/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.py index 21843e0d7ab..889188fb403 100644 --- a/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.py +++ b/gdb/testsuite/gdb.python/py-mi-var-info-path-expression.py @@ -14,6 +14,7 @@ # along with this program. If not, see . import sys + import gdb import gdb.types diff --git a/gdb/testsuite/gdb.python/py-missing-debug.py b/gdb/testsuite/gdb.python/py-missing-debug.py index 502180336ab..c1bafdd6c26 100644 --- a/gdb/testsuite/gdb.python/py-missing-debug.py +++ b/gdb/testsuite/gdb.python/py-missing-debug.py @@ -13,10 +13,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import os +from enum import Enum + import gdb from gdb.missing_debug import MissingDebugHandler -from enum import Enum -import os # A global log that is filled in by instances of the LOG_HANDLER class # when they are called. diff --git a/gdb/testsuite/gdb.python/py-nested-maps.py b/gdb/testsuite/gdb.python/py-nested-maps.py index e949941df82..ac04bbff597 100644 --- a/gdb/testsuite/gdb.python/py-nested-maps.py +++ b/gdb/testsuite/gdb.python/py-nested-maps.py @@ -17,6 +17,7 @@ # nested map like structures. import re + import gdb diff --git a/gdb/testsuite/gdb.python/py-pp-integral.py b/gdb/testsuite/gdb.python/py-pp-integral.py index 4c981d62564..089ca5ba69b 100644 --- a/gdb/testsuite/gdb.python/py-pp-integral.py +++ b/gdb/testsuite/gdb.python/py-pp-integral.py @@ -14,6 +14,7 @@ # along with this program. If not, see . from time import asctime, gmtime + import gdb # silence pyflakes diff --git a/gdb/testsuite/gdb.python/py-pp-maint.py b/gdb/testsuite/gdb.python/py-pp-maint.py index 598c5441cb8..91c193fb8ca 100644 --- a/gdb/testsuite/gdb.python/py-pp-maint.py +++ b/gdb/testsuite/gdb.python/py-pp-maint.py @@ -17,8 +17,9 @@ # printers. import re -import gdb.types + import gdb.printing +import gdb.types def lookup_function_lookup_test(val): diff --git a/gdb/testsuite/gdb.python/py-pp-re-notag.py b/gdb/testsuite/gdb.python/py-pp-re-notag.py index 9cc889f819f..6aefad13d85 100644 --- a/gdb/testsuite/gdb.python/py-pp-re-notag.py +++ b/gdb/testsuite/gdb.python/py-pp-re-notag.py @@ -14,6 +14,7 @@ # along with this program. If not, see . from time import asctime, gmtime + import gdb # silence pyflakes diff --git a/gdb/testsuite/gdb.python/py-pp-registration.py b/gdb/testsuite/gdb.python/py-pp-registration.py index c87f75dc56f..1b7eff8ceba 100644 --- a/gdb/testsuite/gdb.python/py-pp-registration.py +++ b/gdb/testsuite/gdb.python/py-pp-registration.py @@ -17,8 +17,9 @@ # printer registration. import re -import gdb.types + import gdb.printing +import gdb.types def lookup_function_lookup_test(val): diff --git a/gdb/testsuite/gdb.python/py-prettyprint.py b/gdb/testsuite/gdb.python/py-prettyprint.py index 79c06dd774f..e4ac3e1e510 100644 --- a/gdb/testsuite/gdb.python/py-prettyprint.py +++ b/gdb/testsuite/gdb.python/py-prettyprint.py @@ -17,6 +17,7 @@ # printers. import re + import gdb diff --git a/gdb/testsuite/gdb.python/py-send-packet.py b/gdb/testsuite/gdb.python/py-send-packet.py index 93b0a79f3c5..402b0397bc7 100644 --- a/gdb/testsuite/gdb.python/py-send-packet.py +++ b/gdb/testsuite/gdb.python/py-send-packet.py @@ -14,6 +14,7 @@ # along with this program. If not, see . import xml.etree.ElementTree as ET + import gdb diff --git a/gdb/testsuite/gdb.python/py-unwind-maint.py b/gdb/testsuite/gdb.python/py-unwind-maint.py index f87263d85fe..1d049a999f4 100644 --- a/gdb/testsuite/gdb.python/py-unwind-maint.py +++ b/gdb/testsuite/gdb.python/py-unwind-maint.py @@ -16,6 +16,7 @@ # This file is part of the GDB testsuite. It tests python unwinders. import re + import gdb.types from gdb.unwinder import Unwinder, register_unwinder diff --git a/gdb/testsuite/gdb.python/py-unwind.py b/gdb/testsuite/gdb.python/py-unwind.py index 6073e585169..62bfb09f443 100644 --- a/gdb/testsuite/gdb.python/py-unwind.py +++ b/gdb/testsuite/gdb.python/py-unwind.py @@ -14,8 +14,7 @@ # along with this program. If not, see . import gdb -from gdb.unwinder import Unwinder, FrameId - +from gdb.unwinder import FrameId, Unwinder # These are set to test whether invalid register names cause an error. add_saved_register_errors = {} diff --git a/gdb/testsuite/gdb.python/py-xmethods.py b/gdb/testsuite/gdb.python/py-xmethods.py index 54bd10b1cbd..a2b8d578c66 100644 --- a/gdb/testsuite/gdb.python/py-xmethods.py +++ b/gdb/testsuite/gdb.python/py-xmethods.py @@ -16,12 +16,10 @@ # This file is part of the GDB testsuite. It test the xmethods support # in the Python extension language. -import gdb import re -from gdb.xmethod import XMethod -from gdb.xmethod import XMethodMatcher, XMethodWorker -from gdb.xmethod import SimpleXMethodMatcher +import gdb +from gdb.xmethod import SimpleXMethodMatcher, XMethod, XMethodMatcher, XMethodWorker def A_plus_A(obj, opr): diff --git a/gdb/testsuite/gdb.rust/pp.py b/gdb/testsuite/gdb.rust/pp.py index 356737bd794..fbc0868f83a 100644 --- a/gdb/testsuite/gdb.rust/pp.py +++ b/gdb/testsuite/gdb.rust/pp.py @@ -17,6 +17,7 @@ # printers. import re + import gdb diff --git a/gdb/testsuite/print-ts.py b/gdb/testsuite/print-ts.py index 086c293eeac..0a832ba7b93 100755 --- a/gdb/testsuite/print-ts.py +++ b/gdb/testsuite/print-ts.py @@ -30,10 +30,10 @@ # FORMAT must be a string compatible with "strftime". If nothing is # provided, we choose a reasonable format. -import fileinput import datetime -import sys +import fileinput import os +import sys if len(sys.argv) > 1: fmt = sys.argv[1]