From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Joel Stanley" <joel@jms.id.au>, "Yi Liu" <yi.l.liu@intel.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Helge Deller" <deller@gmx.de>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Andrew Jeffery" <andrew@codeconstruct.com.au>,
"Fabiano Rosas" <farosas@suse.de>,
"Alexander Bulekov" <alxndr@bu.edu>,
"Darren Kenny" <darren.kenny@oracle.com>,
"Leif Lindholm" <leif.lindholm@oss.qualcomm.com>,
"Cédric Le Goater" <clg@kaod.org>,
"Ed Maste" <emaste@freebsd.org>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Warner Losh" <imp@bsdimp.com>, "Kevin Wolf" <kwolf@redhat.com>,
"Tyrone Ting" <kfting@nuvoton.com>,
"Eric Blake" <eblake@redhat.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Yoshinori Sato" <ysato@users.sourceforge.jp>,
"Troy Lee" <leetroy@gmail.com>,
"Halil Pasic" <pasic@linux.ibm.com>,
"Akihiko Odaki" <odaki@rsg.ci.i.u-tokyo.ac.jp>,
"Michael Roth" <michael.roth@amd.com>,
"Laurent Vivier" <laurent@vivier.eu>,
"Ani Sinha" <anisinha@redhat.com>,
"Weiwei Li" <liwei1518@gmail.com>, "John Snow" <jsnow@redhat.com>,
"Eric Farman" <farman@linux.ibm.com>,
"Steven Lee" <steven_lee@aspeedtech.com>,
"Brian Cain" <brian.cain@oss.qualcomm.com>,
"Li-Wen Hsu" <lwhsu@freebsd.org>,
"Jamin Lin" <jamin_lin@aspeedtech.com>,
qemu-s390x@nongnu.org,
"Vladimir Sementsov-Ogievskiy" <vsementsov@yandex-team.ru>,
qemu-block@nongnu.org, "Bernhard Beschow" <shentey@gmail.com>,
"Clément Mathieu--Drif" <clement.mathieu--drif@eviden.com>,
"Maksim Davydov" <davydov-max@yandex-team.ru>,
"Niek Linnenbank" <nieklinnenbank@gmail.com>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Paul Durrant" <paul@xen.org>,
"Manos Pitsidianakis" <manos.pitsidianakis@linaro.org>,
"Jagannathan Raman" <jag.raman@oracle.com>,
"Igor Mitsyanko" <i.mitsyanko@gmail.com>,
"Max Filippov" <jcmvbkbc@gmail.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Anton Johansson" <anjo@rev.ng>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Cleber Rosa" <crosa@redhat.com>,
"Eric Auger" <eric.auger@redhat.com>,
"Yanan Wang" <wangyanan55@huawei.com>,
qemu-arm@nongnu.org, "Hao Wu" <wuhaotsh@google.com>,
"Mads Ynddal" <mads@ynddal.dk>,
"Sriram Yagnaraman" <sriram.yagnaraman@ericsson.com>,
qemu-riscv@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Michael Rolnik" <mrolnik@gmail.com>,
"Zhao Liu" <zhao1.liu@intel.com>,
"Alessandro Di Federico" <ale@rev.ng>,
"Thomas Huth" <thuth@redhat.com>,
"Antony Pavlov" <antonynpavlov@gmail.com>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Hanna Reitz" <hreitz@redhat.com>,
"Ilya Leoshkevich" <iii@linux.ibm.com>,
"Marcelo Tosatti" <mtosatti@redhat.com>,
"Nina Schoetterl-Glausch" <nsg@linux.ibm.com>,
"Daniel Henrique Barboza" <danielhb413@gmail.com>,
"Qiuhao Li" <Qiuhao.Li@outlook.com>,
"Hyman Huang" <yong.huang@smartx.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Magnus Damm" <magnus.damm@gmail.com>,
qemu-rust@nongnu.org, "Bandan Das" <bsd@redhat.com>,
"Strahinja Jankovic" <strahinja.p.jankovic@gmail.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
kvm@vger.kernel.org, "Fam Zheng" <fam@euphon.net>,
"Jia Liu" <proljc@gmail.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Alistair Francis" <alistair@alistair23.me>,
"Subbaraya Sundeep" <sundeep.lkml@gmail.com>,
"Kyle Evans" <kevans@freebsd.org>,
"Song Gao" <gaosong@loongson.cn>,
"Alexandre Iooss" <erdnaxe@crans.org>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Liu Zhiwei" <zhiwei_liu@linux.alibaba.com>,
"Peter Xu" <peterx@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"BALATON Zoltan" <balaton@eik.bme.hu>,
"Elena Ufimtseva" <elena.ufimtseva@oracle.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Frédéric Barrat" <fbarrat@linux.ibm.com>,
qemu-ppc@nongnu.org, "Radoslaw Biernacki" <rad@semihalf.com>,
"Beniamino Galvani" <b.galvani@gmail.com>,
"David Hildenbrand" <david@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"David Woodhouse" <dwmw2@infradead.org>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Ahmed Karaman" <ahmedkhaledkaraman@gmail.com>,
"Huacai Chen" <chenhuacai@kernel.org>,
"Mahmoud Mandour" <ma.mandourr@gmail.com>,
"Harsh Prateek Bora" <harshpb@linux.ibm.com>
Subject: [PATCH v2 08/12] python: further 3.9+ syntax upgrades
Date: Thu, 12 Jun 2025 16:54:46 -0400 [thread overview]
Message-ID: <20250612205451.1177751-9-jsnow@redhat.com> (raw)
In-Reply-To: <20250612205451.1177751-1-jsnow@redhat.com>
pyupgrade does not catch absolutely everything - there are still a few
deprecated type aliases we need to shift away from using.
Signed-off-by: John Snow <jsnow@redhat.com>
---
docs/sphinx/compat.py | 8 ++------
docs/sphinx/qapi_domain.py | 6 +++---
python/qemu/machine/console_socket.py | 4 ++--
python/qemu/qmp/events.py | 9 +++++++--
python/qemu/qmp/protocol.py | 3 +--
python/qemu/utils/qemu_ga_client.py | 4 ++--
tests/qemu-iotests/fat16.py | 3 ++-
tests/qemu-iotests/iotests.py | 8 ++++++--
8 files changed, 25 insertions(+), 20 deletions(-)
diff --git a/docs/sphinx/compat.py b/docs/sphinx/compat.py
index 2a93687cb3e..1eb1a49d976 100644
--- a/docs/sphinx/compat.py
+++ b/docs/sphinx/compat.py
@@ -2,13 +2,9 @@
Sphinx cross-version compatibility goop
"""
+from collections.abc import Callable
import re
-from typing import (
- TYPE_CHECKING,
- Any,
- Callable,
- Optional,
-)
+from typing import TYPE_CHECKING, Any, Optional
from docutils import nodes
from docutils.nodes import Element, Node, Text
diff --git a/docs/sphinx/qapi_domain.py b/docs/sphinx/qapi_domain.py
index cb6104922b5..7673eaed6d5 100644
--- a/docs/sphinx/qapi_domain.py
+++ b/docs/sphinx/qapi_domain.py
@@ -39,8 +39,8 @@
if TYPE_CHECKING:
- from collections.abc import Iterable
- from typing import AbstractSet, Any
+ from collections.abc import Iterable, Set
+ from typing import Any
from docutils.nodes import Element, Node
from sphinx.addnodes import desc_signature, pending_xref
@@ -825,7 +825,7 @@ def clear_doc(self, docname: str) -> None:
del self.objects[fullname]
def merge_domaindata(
- self, docnames: AbstractSet[str], otherdata: dict[str, Any]
+ self, docnames: Set[str], otherdata: dict[str, Any]
) -> None:
for fullname, obj in otherdata["objects"].items():
if obj.docname in docnames:
diff --git a/python/qemu/machine/console_socket.py b/python/qemu/machine/console_socket.py
index 0754f340310..bcd27017fc9 100644
--- a/python/qemu/machine/console_socket.py
+++ b/python/qemu/machine/console_socket.py
@@ -17,7 +17,7 @@
import socket
import threading
import time
-from typing import Deque, Optional
+from typing import Optional
class ConsoleSocket(socket.socket):
@@ -43,7 +43,7 @@ def __init__(self,
self._recv_timeout_sec = 300.0
self._sleep_time = 0.5
- self._buffer: Deque[int] = deque()
+ self._buffer: deque[int] = deque()
if address is not None:
socket.socket.__init__(self, socket.AF_UNIX, socket.SOCK_STREAM)
self.connect(address)
diff --git a/python/qemu/qmp/events.py b/python/qemu/qmp/events.py
index e444d9334ec..33a9317e4d4 100644
--- a/python/qemu/qmp/events.py
+++ b/python/qemu/qmp/events.py
@@ -448,10 +448,15 @@ def accept(self, event) -> bool:
"""
import asyncio
-from collections.abc import AsyncIterator, Iterable, Iterator
+from collections.abc import (
+ AsyncIterator,
+ Callable,
+ Iterable,
+ Iterator,
+)
from contextlib import contextmanager
import logging
-from typing import Callable, Optional, Union
+from typing import Optional, Union
from .error import QMPError
from .message import Message
diff --git a/python/qemu/qmp/protocol.py b/python/qemu/qmp/protocol.py
index 4ec9564c4b3..683df61f55e 100644
--- a/python/qemu/qmp/protocol.py
+++ b/python/qemu/qmp/protocol.py
@@ -15,7 +15,7 @@
import asyncio
from asyncio import StreamReader, StreamWriter
-from collections.abc import AsyncGenerator, Awaitable
+from collections.abc import AsyncGenerator, Awaitable, Callable
from contextlib import asynccontextmanager
from enum import Enum
from functools import wraps
@@ -25,7 +25,6 @@
from ssl import SSLContext
from typing import (
Any,
- Callable,
Generic,
Optional,
TypeVar,
diff --git a/python/qemu/utils/qemu_ga_client.py b/python/qemu/utils/qemu_ga_client.py
index a653c234c4b..d15848667b1 100644
--- a/python/qemu/utils/qemu_ga_client.py
+++ b/python/qemu/utils/qemu_ga_client.py
@@ -39,11 +39,11 @@
import argparse
import asyncio
import base64
-from collections.abc import Sequence
+from collections.abc import Callable, Sequence
import os
import random
import sys
-from typing import Any, Callable, Optional
+from typing import Any, Optional
from qemu.qmp import ConnectError, SocketAddrT
from qemu.qmp.legacy import QEMUMonitorProtocol
diff --git a/tests/qemu-iotests/fat16.py b/tests/qemu-iotests/fat16.py
index 88c3d56c662..ec4bc980725 100644
--- a/tests/qemu-iotests/fat16.py
+++ b/tests/qemu-iotests/fat16.py
@@ -15,8 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+from collections.abc import Callable
import string
-from typing import Callable, Optional, Protocol
+from typing import Optional, Protocol
SECTOR_SIZE = 512
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 104a61058fa..b69895cd117 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -20,7 +20,12 @@
import atexit
import bz2
from collections import OrderedDict
-from collections.abc import Iterable, Iterator, Sequence
+from collections.abc import (
+ Callable,
+ Iterable,
+ Iterator,
+ Sequence,
+)
from contextlib import contextmanager
import faulthandler
import json
@@ -35,7 +40,6 @@
import time
from typing import (
Any,
- Callable,
Optional,
TextIO,
TypeVar,
--
2.48.1
next prev parent reply other threads:[~2025-06-12 21:00 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-12 20:54 [PATCH v2 00/12] Python: Fix 'make check-dev' and modernize to 3.9+ John Snow
2025-06-12 20:54 ` [PATCH v2 01/12] python: convert packages to PEP517/pyproject.toml John Snow
2025-06-13 8:36 ` Thomas Huth
2025-06-12 20:54 ` [PATCH v2 02/12] python: update pylint ignores John Snow
2025-06-13 10:18 ` Thomas Huth
2025-06-16 12:05 ` Akihiko Odaki
2025-06-12 20:54 ` [PATCH v2 03/12] python: sync changes from external qemu.qmp package John Snow
2025-06-16 12:12 ` Akihiko Odaki
2025-06-12 20:54 ` [PATCH v2 04/12] python: update shebangs to standard, using /usr/bin/env John Snow
2025-06-13 10:39 ` Thomas Huth
2025-06-16 12:12 ` Akihiko Odaki
2025-06-12 20:54 ` [PATCH v2 05/12] python: fix illegal escape sequences John Snow
2025-06-13 10:41 ` Thomas Huth
2025-06-16 12:13 ` Akihiko Odaki
2025-06-12 20:54 ` [PATCH v2 06/12] python: upgrade to python3.9+ syntax John Snow
2025-06-17 9:15 ` Mads Ynddal
2025-06-24 7:34 ` Markus Armbruster
[not found] ` <CAFn=p-YPN6MWZiETi7XWkyYVPpe7uew49CwjEdAsMmW=ZPOx5A@mail.gmail.com>
2025-06-26 4:54 ` Markus Armbruster
2025-06-12 20:54 ` [PATCH v2 07/12] fixup John Snow
2025-06-12 20:54 ` John Snow [this message]
2025-06-12 20:54 ` [PATCH v2 09/12] python: update mkvenv to type-check under different python versions John Snow
2025-06-12 20:54 ` [PATCH v2 10/12] python: remove version restriction for mypy John Snow
2025-06-12 20:54 ` [PATCH v2 11/12] scripts/codeconverter: remove unused code John Snow
2025-06-12 20:54 ` [PATCH v2 12/12] scripts/codeconverter: remove * imports John Snow
2025-06-16 8:53 ` [PATCH v2 00/12] Python: Fix 'make check-dev' and modernize to 3.9+ Akihiko Odaki
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=20250612205451.1177751-9-jsnow@redhat.com \
--to=jsnow@redhat.com \
--cc=Qiuhao.Li@outlook.com \
--cc=ahmedkhaledkaraman@gmail.com \
--cc=ale@rev.ng \
--cc=alex.bennee@linaro.org \
--cc=alistair@alistair23.me \
--cc=alxndr@bu.edu \
--cc=andrew@codeconstruct.com.au \
--cc=anisinha@redhat.com \
--cc=anjo@rev.ng \
--cc=antonynpavlov@gmail.com \
--cc=armbru@redhat.com \
--cc=aurelien@aurel32.net \
--cc=b.galvani@gmail.com \
--cc=balaton@eik.bme.hu \
--cc=berrange@redhat.com \
--cc=borntraeger@linux.ibm.com \
--cc=brian.cain@oss.qualcomm.com \
--cc=bsd@redhat.com \
--cc=chenhuacai@kernel.org \
--cc=clement.mathieu--drif@eviden.com \
--cc=clg@kaod.org \
--cc=crosa@redhat.com \
--cc=danielhb413@gmail.com \
--cc=darren.kenny@oracle.com \
--cc=david@redhat.com \
--cc=davydov-max@yandex-team.ru \
--cc=deller@gmx.de \
--cc=dwmw2@infradead.org \
--cc=eblake@redhat.com \
--cc=edgar.iglesias@gmail.com \
--cc=eduardo@habkost.net \
--cc=elena.ufimtseva@oracle.com \
--cc=emaste@freebsd.org \
--cc=erdnaxe@crans.org \
--cc=eric.auger@redhat.com \
--cc=fam@euphon.net \
--cc=farman@linux.ibm.com \
--cc=farosas@suse.de \
--cc=fbarrat@linux.ibm.com \
--cc=gaosong@loongson.cn \
--cc=harshpb@linux.ibm.com \
--cc=hpoussin@reactos.org \
--cc=hreitz@redhat.com \
--cc=i.mitsyanko@gmail.com \
--cc=iii@linux.ibm.com \
--cc=imp@bsdimp.com \
--cc=jag.raman@oracle.com \
--cc=jamin_lin@aspeedtech.com \
--cc=jasowang@redhat.com \
--cc=jcmvbkbc@gmail.com \
--cc=jiaxun.yang@flygoat.com \
--cc=joel@jms.id.au \
--cc=kevans@freebsd.org \
--cc=kfting@nuvoton.com \
--cc=kraxel@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kwolf@redhat.com \
--cc=laurent@vivier.eu \
--cc=leetroy@gmail.com \
--cc=leif.lindholm@oss.qualcomm.com \
--cc=liwei1518@gmail.com \
--cc=lwhsu@freebsd.org \
--cc=ma.mandourr@gmail.com \
--cc=mads@ynddal.dk \
--cc=magnus.damm@gmail.com \
--cc=manos.pitsidianakis@linaro.org \
--cc=marcandre.lureau@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=michael.roth@amd.com \
--cc=mrolnik@gmail.com \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=nieklinnenbank@gmail.com \
--cc=npiggin@gmail.com \
--cc=nsg@linux.ibm.com \
--cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
--cc=palmer@dabbelt.com \
--cc=pasic@linux.ibm.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=pierrick.bouvier@linaro.org \
--cc=proljc@gmail.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=qemu-rust@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=rad@semihalf.com \
--cc=richard.henderson@linaro.org \
--cc=shentey@gmail.com \
--cc=sriram.yagnaraman@ericsson.com \
--cc=stefanha@redhat.com \
--cc=steven_lee@aspeedtech.com \
--cc=strahinja.p.jankovic@gmail.com \
--cc=sundeep.lkml@gmail.com \
--cc=thuth@redhat.com \
--cc=vsementsov@yandex-team.ru \
--cc=wangyanan55@huawei.com \
--cc=wuhaotsh@google.com \
--cc=yi.l.liu@intel.com \
--cc=yong.huang@smartx.com \
--cc=ysato@users.sourceforge.jp \
--cc=zhao1.liu@intel.com \
--cc=zhiwei_liu@linux.alibaba.com \
/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 NNTP newsgroup(s).