From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56198) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dt0BO-0004yd-R7 for qemu-devel@nongnu.org; Fri, 15 Sep 2017 19:38:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dt0BN-0001Dl-TB for qemu-devel@nongnu.org; Fri, 15 Sep 2017 19:38:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52992) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dt0BN-0001DX-Ni for qemu-devel@nongnu.org; Fri, 15 Sep 2017 19:38:01 -0400 From: Eduardo Habkost Date: Fri, 15 Sep 2017 20:37:27 -0300 Message-Id: <20170915233739.26860-4-ehabkost@redhat.com> In-Reply-To: <20170915233739.26860-1-ehabkost@redhat.com> References: <20170915233739.26860-1-ehabkost@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 03/15] qemu.py: Use iteritems rather than keys() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , qemu-devel@nongnu.org Cc: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= , Stefan Hajnoczi , Amador Pahim From: Luk=C3=A1=C5=A1 Doktor 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=C3=A1=C5=A1 Doktor Reviewed-by: Eduardo Habkost Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20170818142613.32394-4-ldoktor@redhat.com> Reviewed-by: Cleber Rosa Signed-off-by: Eduardo Habkost --- scripts/qemu.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index afd98a290e..d8c169b31e 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -200,11 +200,11 @@ class QEMUMachine(object): def qmp(self, cmd, conv_keys=3DTrue, **args): '''Invoke a QMP command and return the response dict''' qmp_args =3D dict() - for key in args.keys(): + for key, value in args.iteritems(): if conv_keys: - qmp_args[key.translate(self.underscore_to_dash)] =3D arg= s[key] + qmp_args[key.translate(self.underscore_to_dash)] =3D val= ue else: - qmp_args[key] =3D args[key] + qmp_args[key] =3D value =20 return self._qmp.cmd(cmd, args=3Dqmp_args) =20 --=20 2.13.5