]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
qmp.py: Avoid "has_key" usage
authorLukáš Doktor <ldoktor@redhat.com>
Fri, 18 Aug 2017 14:26:11 +0000 (16:26 +0200)
committerEduardo Habkost <ehabkost@redhat.com>
Fri, 15 Sep 2017 23:12:00 +0000 (20:12 -0300)
The "has_key" is deprecated in favor of "__in__" operator.

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-9-ldoktor@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
scripts/qmp/qmp.py

index 95ff5cc39a5b65c0ff4947fdc87920d6d589db7c..f2f5a9b296f7c644f2c8ee429432b482e352ce80 100644 (file)
@@ -197,7 +197,7 @@ class QEMUMonitorProtocol(object):
         Build and send a QMP command to the monitor, report errors if any
         """
         ret = self.cmd(cmd, kwds)
-        if ret.has_key('error'):
+        if "error" in ret:
             raise Exception(ret['error']['desc'])
         return ret['return']