All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 0/4] Python patches
@ 2022-01-10 23:25 John Snow
  2022-01-10 23:25 ` [PULL 1/4] python/aqmp: use absolute import statement John Snow
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: John Snow @ 2022-01-10 23:25 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Peter Maydell, Thomas Huth,
	Vladimir Sementsov-Ogievskiy, Daniel Berrange, Eduardo Habkost,
	qemu-block, John Snow, Markus Armbruster,
	Wainer dos Santos Moschetta, Philippe Mathieu-Daudé,
	Willian Rampazzo, Eduardo Habkost, Hanna Reitz, Cleber Rosa,
	Alex Bennée

The following changes since commit de3f5223fa4cf8bfc5e3fe1fd495ddf468edcdf7:

  Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-7.0-pull-request' into staging (2022-01-10 14:43:03 +0000)

are available in the Git repository at:

  https://gitlab.com/jsnow/qemu.git tags/python-pull-request

for you to fetch changes up to 9ebfc5a583d8aa94bf1bc37c1f71559187fd809c:

  simplebench: Fix Python syntax error (reported by LGTM) (2022-01-10 18:23:10 -0500)

----------------------------------------------------------------
Python pull request

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

----------------------------------------------------------------

John Snow (3):
  python/aqmp: use absolute import statement
  Python/aqmp: fix type definitions for mypy 0.920
  python: update type hints for mypy 0.930

Stefan Weil (1):
  simplebench: Fix Python syntax error (reported by LGTM)

 python/qemu/aqmp/aqmp_tui.py         | 3 ++-
 python/qemu/aqmp/protocol.py         | 5 +++--
 python/qemu/qmp/qom_common.py        | 6 +-----
 scripts/simplebench/bench-example.py | 2 +-
 4 files changed, 7 insertions(+), 9 deletions(-)

-- 
2.31.1




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PULL 1/4] python/aqmp: use absolute import statement
  2022-01-10 23:25 [PULL 0/4] Python patches John Snow
@ 2022-01-10 23:25 ` John Snow
  2022-01-10 23:25 ` [PULL 2/4] Python/aqmp: fix type definitions for mypy 0.920 John Snow
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: John Snow @ 2022-01-10 23:25 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Peter Maydell, Thomas Huth,
	Vladimir Sementsov-Ogievskiy, Daniel Berrange, Eduardo Habkost,
	qemu-block, John Snow, Markus Armbruster,
	Wainer dos Santos Moschetta, Philippe Mathieu-Daudé,
	Willian Rampazzo, Eduardo Habkost, Hanna Reitz, Cleber Rosa,
	Alex Bennée, Beraldo Leal

pylint's dependency astroid appears to have bugs in 2.9.1 and 2.9.2 (Dec
31 and Jan 3) that appear to erroneously expect the qemu namespace to
have an __init__.py file. astroid 2.9.3 (Jan 9) avoids that problem, but
appears to not understand a relative import within a namespace package.

Update the relative import - it was worth changing anyway, because these
packages will eventually be packaged and distributed separately.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Beraldo Leal <bleal@redhat.com>
Message-id: 20220110191349.1841027-2-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
---
 python/qemu/aqmp/aqmp_tui.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/python/qemu/aqmp/aqmp_tui.py b/python/qemu/aqmp/aqmp_tui.py
index a2929f771c..f1e926dd75 100644
--- a/python/qemu/aqmp/aqmp_tui.py
+++ b/python/qemu/aqmp/aqmp_tui.py
@@ -35,7 +35,8 @@
 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
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PULL 2/4] Python/aqmp: fix type definitions for mypy 0.920
  2022-01-10 23:25 [PULL 0/4] Python patches John Snow
  2022-01-10 23:25 ` [PULL 1/4] python/aqmp: use absolute import statement John Snow
@ 2022-01-10 23:25 ` John Snow
  2022-01-10 23:25 ` [PULL 3/4] python: update type hints for mypy 0.930 John Snow
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: John Snow @ 2022-01-10 23:25 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Peter Maydell, Thomas Huth,
	Vladimir Sementsov-Ogievskiy, Daniel Berrange, Eduardo Habkost,
	qemu-block, John Snow, Markus Armbruster,
	Wainer dos Santos Moschetta, Philippe Mathieu-Daudé,
	Willian Rampazzo, Eduardo Habkost, Hanna Reitz, Cleber Rosa,
	Alex Bennée

0.920 (Released 2021-12-15) is not entirely happy with the
way that I was defining _FutureT:

qemu/aqmp/protocol.py:601: error: Item "object" of the upper bound
"Optional[Future[Any]]" of type variable "_FutureT" has no attribute
"done"

Update it with something a little mechanically simpler that works better
across a wider array of mypy versions.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 20220110191349.1841027-3-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
---
 python/qemu/aqmp/protocol.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/python/qemu/aqmp/protocol.py b/python/qemu/aqmp/protocol.py
index 5190b33b13..c4fbe35a0e 100644
--- a/python/qemu/aqmp/protocol.py
+++ b/python/qemu/aqmp/protocol.py
@@ -43,8 +43,8 @@
 
 
 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 @@ def _cleanup(self) -> None:
         """
         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
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PULL 3/4] python: update type hints for mypy 0.930
  2022-01-10 23:25 [PULL 0/4] Python patches John Snow
  2022-01-10 23:25 ` [PULL 1/4] python/aqmp: use absolute import statement John Snow
  2022-01-10 23:25 ` [PULL 2/4] Python/aqmp: fix type definitions for mypy 0.920 John Snow
@ 2022-01-10 23:25 ` John Snow
  2022-01-10 23:25 ` [PULL 4/4] simplebench: Fix Python syntax error (reported by LGTM) John Snow
  2022-01-12  9:20 ` [PULL 0/4] Python patches Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: John Snow @ 2022-01-10 23:25 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Peter Maydell, Thomas Huth,
	Vladimir Sementsov-Ogievskiy, Daniel Berrange, Eduardo Habkost,
	qemu-block, John Snow, Markus Armbruster,
	Wainer dos Santos Moschetta, Philippe Mathieu-Daudé,
	Willian Rampazzo, Eduardo Habkost, Hanna Reitz, Cleber Rosa,
	Alex Bennée, Beraldo Leal

Mypy 0.930, released Dec 22, changes the way argparse objects are
considered. Crafting a definition that works under Python 3.6 and an
older mypy alongside newer versions simultaneously is ... difficult,
so... eh. Stub it out with an 'Any' definition to get the CI moving
again.

Oh well.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Beraldo Leal <bleal@redhat.com>
Message-id: 20220110191349.1841027-4-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
---
 python/qemu/qmp/qom_common.py | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/python/qemu/qmp/qom_common.py b/python/qemu/qmp/qom_common.py
index a59ae1a2a1..2e4c741f77 100644
--- a/python/qemu/qmp/qom_common.py
+++ b/python/qemu/qmp/qom_common.py
@@ -30,10 +30,6 @@
 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 @@ def __init__(self, args: argparse.Namespace):
         self.qmp.connect()
 
     @classmethod
-    def register(cls, subparsers: Subparsers) -> None:
+    def register(cls, subparsers: Any) -> None:
         """
         Register this command with the argument parser.
 
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PULL 4/4] simplebench: Fix Python syntax error (reported by LGTM)
  2022-01-10 23:25 [PULL 0/4] Python patches John Snow
                   ` (2 preceding siblings ...)
  2022-01-10 23:25 ` [PULL 3/4] python: update type hints for mypy 0.930 John Snow
@ 2022-01-10 23:25 ` John Snow
  2022-01-12  9:20 ` [PULL 0/4] Python patches Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: John Snow @ 2022-01-10 23:25 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Peter Maydell, Thomas Huth,
	Vladimir Sementsov-Ogievskiy, Daniel Berrange, Eduardo Habkost,
	qemu-block, John Snow, Markus Armbruster,
	Wainer dos Santos Moschetta, Philippe Mathieu-Daudé,
	Willian Rampazzo, Eduardo Habkost, Hanna Reitz, Cleber Rosa,
	Stefan Weil, Alex Bennée

From: Stefan Weil <sw@weilnetz.de>

Fixes: b2fcb0c5754c2554b8406376e99a75e9e0a6b7bd
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 20220107153019.504124-1-sw@weilnetz.de
Signed-off-by: John Snow <jsnow@redhat.com>
---
 scripts/simplebench/bench-example.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/simplebench/bench-example.py b/scripts/simplebench/bench-example.py
index 4864435f39..fc370691e0 100644
--- a/scripts/simplebench/bench-example.py
+++ b/scripts/simplebench/bench-example.py
@@ -25,7 +25,7 @@
 
 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'])
 
 
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PULL 0/4] Python patches
  2022-01-10 23:25 [PULL 0/4] Python patches John Snow
                   ` (3 preceding siblings ...)
  2022-01-10 23:25 ` [PULL 4/4] simplebench: Fix Python syntax error (reported by LGTM) John Snow
@ 2022-01-12  9:20 ` Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2022-01-12  9:20 UTC (permalink / raw)
  To: John Snow
  Cc: Kevin Wolf, Eduardo Habkost, Thomas Huth,
	Vladimir Sementsov-Ogievskiy, Daniel Berrange, Eduardo Habkost,
	qemu-block, Markus Armbruster, Wainer dos Santos Moschetta,
	qemu-devel, Willian Rampazzo, Hanna Reitz, Cleber Rosa,
	Alex Bennée, Philippe Mathieu-Daudé

On Mon, 10 Jan 2022 at 23:25, John Snow <jsnow@redhat.com> wrote:
>
> The following changes since commit de3f5223fa4cf8bfc5e3fe1fd495ddf468edcdf7:
>
>   Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-7.0-pull-request' into staging (2022-01-10 14:43:03 +0000)
>
> are available in the Git repository at:
>
>   https://gitlab.com/jsnow/qemu.git tags/python-pull-request
>
> for you to fetch changes up to 9ebfc5a583d8aa94bf1bc37c1f71559187fd809c:
>
>   simplebench: Fix Python syntax error (reported by LGTM) (2022-01-10 18:23:10 -0500)
>
> ----------------------------------------------------------------
> Python pull request
>
> Fixes for the tests that broke during vacation, plus a simple syntax fix
> for a python script.


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/7.0
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-01-12  9:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-10 23:25 [PULL 0/4] Python patches John Snow
2022-01-10 23:25 ` [PULL 1/4] python/aqmp: use absolute import statement John Snow
2022-01-10 23:25 ` [PULL 2/4] Python/aqmp: fix type definitions for mypy 0.920 John Snow
2022-01-10 23:25 ` [PULL 3/4] python: update type hints for mypy 0.930 John Snow
2022-01-10 23:25 ` [PULL 4/4] simplebench: Fix Python syntax error (reported by LGTM) John Snow
2022-01-12  9:20 ` [PULL 0/4] Python patches Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.