From nobody Fri Apr 4 03:24:01 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1740424465; cv=none; d=zohomail.com; s=zohoarc; b=inibKtYJrsIl9HG1GBu5XgkenLEnbE0EgRlxeASuGr0o8tN5vM82nagOs5Bu5nMZYGYDeJ0l2nrGKncvxSSyHDvJPUhwQgY3MOHBQbG4vMxRtUqKe3LZZ3azvSCaU/jXM5tTlUNVDkNUn5MbDuk7E9P7Utk5P4Twh7feI0H0ah8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1740424465; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TxYBL+4hRhBbfgtlH9JJpjWGYvnqfoEPb6Z9IpA7Lv8=; b=BnGQAhsNyQkrZ/mdTaSSuW1syanjnH3lw6pW2NOvbf/7fanqvdjlA2ubQTlazSDRQTeaF4kcMmpMb160rGauRWTwDaomBQGxBFB57W4WbFIfRXrVpJHrMDXk6xxsr8eBKjLv7CBLRkA+Jg6L2gZeJmwv/sIM7Q3YXOtNCX0D/TU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1740424465856840.3861126360342; Mon, 24 Feb 2025 11:14:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tmdtC-00013p-Uh; Mon, 24 Feb 2025 14:13:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tmdsD-0000bw-Hr for qemu-devel@nongnu.org; Mon, 24 Feb 2025 14:12:17 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tmdsB-0005vZ-IS for qemu-devel@nongnu.org; Mon, 24 Feb 2025 14:12:13 -0500 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-687-few2OpEgPCaWd4HZ0f7XTQ-1; Mon, 24 Feb 2025 14:12:01 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 70F4018EB2CE; Mon, 24 Feb 2025 19:12:00 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.119]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8B32D180087D; Mon, 24 Feb 2025 19:11:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740424326; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TxYBL+4hRhBbfgtlH9JJpjWGYvnqfoEPb6Z9IpA7Lv8=; b=cwB7amPK+gmbjLDQqg083Mezw7mxdSiX6n+UWe0IdIYpEu4BdHFu/JTuuPzmdgXkJbN1rp hDkCRW71svtsKyFA5RHPHabyZAv3nMI229GIlAoj+E7RxDDOLCWsWCYWZ/TYhviW8/2KpT G/NU7vPYH3bTnCjd9xkeE80UKKB3n+M= X-MC-Unique: few2OpEgPCaWd4HZ0f7XTQ-1 X-Mimecast-MFC-AGG-ID: few2OpEgPCaWd4HZ0f7XTQ_1740424320 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cleber Rosa , Paolo Bonzini , John Snow Subject: [RFC 1/2] python: be more selective in hiding mypy subclassing warning Date: Mon, 24 Feb 2025 19:11:51 +0000 Message-ID: <20250224191152.2123003-2-berrange@redhat.com> In-Reply-To: <20250224191152.2123003-1-berrange@redhat.com> References: <20250224191152.2123003-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.442, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1740424467800019100 Use an annotation inline to the file instead of in setup.cfg This has the added advantage that the mypy checks now pass when using 'mypy /path/to/python/qemu' as well as 'mypy -p qemu'. Signed-off-by: Daniel P. Berrang=C3=A9 --- python/qemu/qmp/qmp_tui.py | 12 ++++++------ python/qemu/utils/qom_fuse.py | 2 +- python/setup.cfg | 8 -------- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/python/qemu/qmp/qmp_tui.py b/python/qemu/qmp/qmp_tui.py index 2d9ebbd20b..8720d70e60 100644 --- a/python/qemu/qmp/qmp_tui.py +++ b/python/qemu/qmp/qmp_tui.py @@ -401,7 +401,7 @@ def run(self, debug: bool =3D False) -> None: raise err =20 =20 -class StatusBar(urwid.Text): +class StatusBar(urwid.Text): # type: ignore """ A simple statusbar modelled using the Text widget. The status can be set using the set_text function. All text set is aligned to right. @@ -412,7 +412,7 @@ def __init__(self, text: str =3D ''): super().__init__(text, align=3D'right') =20 =20 -class Editor(urwid_readline.ReadlineEdit): +class Editor(urwid_readline.ReadlineEdit): # type: ignore """ A simple editor modelled using the urwid_readline.ReadlineEdit widget. Mimcs GNU readline shortcuts and provides history support. @@ -485,7 +485,7 @@ def keypress(self, size: Tuple[int, int], key: str) -> = Optional[str]: return None =20 =20 -class EditorWidget(urwid.Filler): +class EditorWidget(urwid.Filler): # type: ignore """ Wrapper around the editor widget. =20 @@ -498,7 +498,7 @@ def __init__(self, parent: App) -> None: super().__init__(Editor(parent), valign=3D'top') =20 =20 -class HistoryBox(urwid.ListBox): +class HistoryBox(urwid.ListBox): # type: ignore """ This widget is modelled using the ListBox widget, contains the list of all messages both QMP messages and log messages to be shown in the TUI. @@ -535,7 +535,7 @@ def mouse_event(self, size: Tuple[int, int], _event: st= r, button: float, super().keypress(size, 'down') =20 =20 -class HistoryWindow(urwid.Frame): +class HistoryWindow(urwid.Frame): # type: ignore """ This window composes the HistoryBox and EditorWidget in a horizontal s= plit. By default the first focus is given to the history box. @@ -572,7 +572,7 @@ def cb_add_to_history(self, msg: str, level: Optional[s= tr] =3D None) -> None: self.history.add_to_history(formatted) =20 =20 -class Window(urwid.Frame): +class Window(urwid.Frame): # type: ignore """ This window is the top most widget of the TUI and will contain other windows. Each child of this widget is responsible for displaying a spe= cific diff --git a/python/qemu/utils/qom_fuse.py b/python/qemu/utils/qom_fuse.py index cf7e344bd5..0a1e02af87 100644 --- a/python/qemu/utils/qom_fuse.py +++ b/python/qemu/utils/qom_fuse.py @@ -56,7 +56,7 @@ fuse.fuse_python_api =3D (0, 2) =20 =20 -class QOMFuse(QOMCommand, Operations): +class QOMFuse(QOMCommand, Operations): # type: ignore """ QOMFuse implements both fuse.Operations and QOMCommand. =20 diff --git a/python/setup.cfg b/python/setup.cfg index cf5af7e664..8dcd4c946e 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -83,14 +83,6 @@ warn_unused_configs =3D True namespace_packages =3D True warn_unused_ignores =3D False =20 -[mypy-qemu.utils.qom_fuse] -# fusepy has no type stubs: -allow_subclassing_any =3D True - -[mypy-qemu.qmp.qmp_tui] -# urwid and urwid_readline have no type stubs: -allow_subclassing_any =3D True - # The following missing import directives are because these libraries do n= ot # provide type stubs. Allow them on an as-needed basis for mypy. [mypy-fuse] --=20 2.47.1