Python pull request

Fixes for the tests that broke during vacation, plus a simple syntax fix
 for a python script.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE+ber27ys35W+dsvQfe+BBqr8OQ4FAmHcwD8ACgkQfe+BBqr8
 OQ5tKhAAtpZRBJ2oy1/MkjfxhGwfNYDQnQc09E1yYK2Qg+EOKNq12bxm7jjum6sl
 qQecdOpBbG3mq2OdiqMMVE1XKguAySmU97N/C8FayyTGQx/I8wtboYZ28b5et9D7
 QyCF7S/twYYPGW7UD+OQQH7VzBjlRmWMFraseUCUYwVC029MBxwt4iom3EBtQsea
 12XrepA6TgyI11yzDfiESt6L1pSXeZU52l9+hAfD9Dwxx4C5YBTBhOOxK0+3xl/p
 C9jImiTBGKYdEXK7gwd6LRCOEevuvWFFfW9jRJAf0an/6EYrRCSGWKU5VfDmSvLk
 8Cu/V7qq55XnAhvEHe+f8n15NgJ+EXpZ7NnnqPW8KJDBotGhy1jqjqfrJAoRBr8M
 +0pLAIuokiyEeH9259zkSGBPZQ9mhvTree/WyfOi4B+sLC8AUYuFsmeOd/rc0tuV
 /ebBLQQXGtq5D4i6wU3Mjj9GsrEROfPGyFbdYy3zLyXeERTcmPTUyhhy8GnnO3XW
 Qmx/U79HnF1iO/5ySiVWVfcAoaF0t+fxezHAVdbVvJC7MAB7wOkXH7unbJjM5qqh
 dxsOruNxzLQl3P7+zGepUqPWqw/fjqdMKGIhCMjDB4q/zPytPV9mRAAb7XYwGXah
 JnyCEIQmFkVsvJ9rr3gaEXiFcDCxxzZ3NFYjufjl5wDKbVQ7xK0=
 =N2+z
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/jsnow-gitlab/tags/python-pull-request' into staging

Python pull request

Fixes for the tests that broke during vacation, plus a simple syntax fix
for a python script.

# gpg: Signature made Mon 10 Jan 2022 23:24:47 GMT
# gpg:                using RSA key F9B7ABDBBCACDF95BE76CBD07DEF8106AAFC390E
# gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>" [full]
# Primary key fingerprint: FAEB 9711 A12C F475 812F  18F2 88A9 064D 1835 61EB
#      Subkey fingerprint: F9B7 ABDB BCAC DF95 BE76  CBD0 7DEF 8106 AAFC 390E

* remotes/jsnow-gitlab/tags/python-pull-request:
  simplebench: Fix Python syntax error (reported by LGTM)
  python: update type hints for mypy 0.930
  Python/aqmp: fix type definitions for mypy 0.920
  python/aqmp: use absolute import statement

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2022-01-11 14:20:42 +00:00
commit 7bb1272f40
4 changed files with 7 additions and 9 deletions

View File

@ -35,7 +35,8 @@ from pygments import token as Token
import urwid
import urwid_readline
from ..qmp import QEMUMonitorProtocol, QMPBadPortError
from qemu.qmp import QEMUMonitorProtocol, QMPBadPortError
from .error import ProtocolError
from .message import DeserializationError, Message, UnexpectedTypeError
from .protocol import ConnectError, Runstate

View File

@ -43,8 +43,8 @@ from .util import (
T = TypeVar('T')
_U = TypeVar('_U')
_TaskFN = Callable[[], Awaitable[None]] # aka ``async def func() -> None``
_FutureT = TypeVar('_FutureT', bound=Optional['asyncio.Future[Any]'])
class Runstate(Enum):
@ -591,7 +591,8 @@ class AsyncProtocol(Generic[T]):
"""
Fully reset this object to a clean state and return to `IDLE`.
"""
def _paranoid_task_erase(task: _FutureT) -> Optional[_FutureT]:
def _paranoid_task_erase(task: Optional['asyncio.Future[_U]']
) -> Optional['asyncio.Future[_U]']:
# Help to erase a task, ENSURING it is fully quiesced first.
assert (task is None) or task.done()
return None if (task and task.done()) else task

View File

@ -30,10 +30,6 @@ from typing import (
from . import QEMUMonitorProtocol, QMPError
# The following is needed only for a type alias.
Subparsers = argparse._SubParsersAction # pylint: disable=protected-access
class ObjectPropertyInfo:
"""
Represents the return type from e.g. qom-list.
@ -89,7 +85,7 @@ class QOMCommand:
self.qmp.connect()
@classmethod
def register(cls, subparsers: Subparsers) -> None:
def register(cls, subparsers: Any) -> None:
"""
Register this command with the argument parser.

View File

@ -25,7 +25,7 @@ from bench_block_job import bench_block_copy, drv_file, drv_nbd
def bench_func(env, case):
""" Handle one "cell" of benchmarking table. """
return bench_block_copy(env['qemu_binary'], env['cmd'], {}
return bench_block_copy(env['qemu_binary'], env['cmd'], {},
case['source'], case['target'])