python: update for mypy 0.950
authorJohn Snow <jsnow@redhat.com>
Thu, 26 May 2022 00:09:13 +0000 (20:09 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 6 Jun 2022 07:26:54 +0000 (09:26 +0200)
typeshed (included in mypy) recently updated to improve the typing for
WriteTransport objects. I was working around this, but now there's a
version where I shouldn't work around it.

Unfortunately this creates some minor ugliness if I want to support both
pre- and post-0.950 versions. For now, for my sanity, just disable the
unused-ignores warning.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20220526000921.1581503-2-jsnow@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
python/qemu/qmp/util.py
python/setup.cfg

index eaa5fc7d5f9ccf84bd2d2855d3824eff509b29eb..ca6225e9cda04b6f48084c4b4689a912820e573a 100644 (file)
@@ -40,7 +40,9 @@ async def flush(writer: asyncio.StreamWriter) -> None:
     drain. The flow control limits are restored after the call is
     completed.
     """
-    transport = cast(asyncio.WriteTransport, writer.transport)
+    transport = cast(  # type: ignore[redundant-cast]
+        asyncio.WriteTransport, writer.transport
+    )
 
     # https://github.com/python/typeshed/issues/5779
     low, high = transport.get_write_buffer_limits()  # type: ignore
index e877ea564753106529ef981410c8d51667b89e55..c2c61c7519046ce7bb7055485f03d62e525dca04 100644 (file)
@@ -79,6 +79,7 @@ strict = True
 python_version = 3.6
 warn_unused_configs = True
 namespace_packages = True
+warn_unused_ignores = False
 
 [mypy-qemu.utils.qom_fuse]
 # fusepy has no type stubs: