[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v6 03/10] qemu.py: Use iteritems rather than key
From: |
Cleber Rosa |
Subject: |
Re: [Qemu-devel] [PATCH v6 03/10] qemu.py: Use iteritems rather than keys() |
Date: |
Thu, 24 Aug 2017 18:56:43 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
On 08/18/2017 10:26 AM, Lukáš Doktor wrote:
> Let's avoid creating an in-memory list of keys and query for each value
> and use `iteritems` which is an iterator of key-value pairs.
>
> Signed-off-by: Lukáš Doktor <address@hidden>
> Reviewed-by: Eduardo Habkost <address@hidden>
> Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> scripts/qemu.py | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/qemu.py b/scripts/qemu.py
> index 5d09de4..db21407 100644
> --- a/scripts/qemu.py
> +++ b/scripts/qemu.py
> @@ -186,11 +186,11 @@ class QEMUMachine(object):
> def qmp(self, cmd, conv_keys=True, **args):
> '''Invoke a QMP command and return the response dict'''
> qmp_args = dict()
> - for key in args.keys():
> + for key, value in args.iteritems():
> if conv_keys:
> - qmp_args[key.translate(self.underscore_to_dash)] = args[key]
> + qmp_args[key.translate(self.underscore_to_dash)] = value
> else:
> - qmp_args[key] = args[key]
> + qmp_args[key] = value
>
> return self._qmp.cmd(cmd, args=qmp_args)
>
>
Yep, I could tell this was coming while reading patch 01.
Reviewed-by: Cleber Rosa <address@hidden>
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v6 00/10] qemu.py: Pylint/style fixes, Lukáš Doktor, 2017/08/18
- [Qemu-devel] [PATCH v6 01/10] qemu.py: Pylint/style fixes, Lukáš Doktor, 2017/08/18
- [Qemu-devel] [PATCH v6 02/10] qemu|qtest: Avoid dangerous arguments, Lukáš Doktor, 2017/08/18
- [Qemu-devel] [PATCH v6 03/10] qemu.py: Use iteritems rather than keys(), Lukáš Doktor, 2017/08/18
- Re: [Qemu-devel] [PATCH v6 03/10] qemu.py: Use iteritems rather than keys(),
Cleber Rosa <=
- [Qemu-devel] [PATCH v6 04/10] qemu.py: Simplify QMP key-conversion, Lukáš Doktor, 2017/08/18
- [Qemu-devel] [PATCH v6 05/10] qemu.py: Use custom exceptions rather than Exception, Lukáš Doktor, 2017/08/18
- [Qemu-devel] [PATCH v6 06/10] qmp.py: Couple of pylint/style fixes, Lukáš Doktor, 2017/08/18
- [Qemu-devel] [PATCH v6 07/10] qmp.py: Use object-based class for QEMUMonitorProtocol, Lukáš Doktor, 2017/08/18
- [Qemu-devel] [PATCH v6 08/10] qmp.py: Avoid "has_key" usage, Lukáš Doktor, 2017/08/18
- [Qemu-devel] [PATCH v6 09/10] qmp.py: Avoid overriding a builtin object, Lukáš Doktor, 2017/08/18
- [Qemu-devel] [PATCH v6 10/10] qtest.py: Few pylint/style fixes, Lukáš Doktor, 2017/08/18
- Re: [Qemu-devel] [PATCH v6 00/10] qemu.py: Pylint/style fixes, John Snow, 2017/08/21