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 <js...@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


Reply via email to