diff options
author | Lukáš Doktor <ldoktor@redhat.com> | 2017-08-18 16:26:06 +0200 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2017-09-15 20:12:00 -0300 |
commit | 7f33ca7878e3414f779a5d89f04c68c0438c3dc7 (patch) | |
tree | 27e429bbff6ad02958ff1faa19277f8e0bb706da /scripts/qemu.py | |
parent | 2782fc517d6720dbec24b4dfa08aa4606c72c76d (diff) | |
download | qemu-7f33ca7878e3414f779a5d89f04c68c0438c3dc7.zip qemu-7f33ca7878e3414f779a5d89f04c68c0438c3dc7.tar.gz qemu-7f33ca7878e3414f779a5d89f04c68c0438c3dc7.tar.bz2 |
qemu.py: Use iteritems rather than keys()
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 <ldoktor@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20170818142613.32394-4-ldoktor@redhat.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'scripts/qemu.py')
-rw-r--r-- | scripts/qemu.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/qemu.py b/scripts/qemu.py index afd98a2..d8c169b 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -200,11 +200,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) |