diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2018-06-08 09:29:46 -0300 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2018-06-08 14:39:24 -0300 |
commit | d7a4228ebb0150e4c97a19077f3fac81d843e2c3 (patch) | |
tree | 020374f95228a5fbde5ed53ed03482b285d392e9 /scripts/qmp | |
parent | d24d523c14f5f519e04ea49bbe066323bb795879 (diff) | |
download | qemu-d7a4228ebb0150e4c97a19077f3fac81d843e2c3.zip qemu-d7a4228ebb0150e4c97a19077f3fac81d843e2c3.tar.gz qemu-d7a4228ebb0150e4c97a19077f3fac81d843e2c3.tar.bz2 |
python: futurize -f lib2to3.fixes.fix_has_key
Change "dict.has_key(key)" to "key in dict"
This is necessary for Python 3 compatibility.
Done using:
$ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \
sort -u | grep -v README.sh4)
$ futurize -w -f lib2to3.fixes.fix_has_key $py
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20180608122952.2009-5-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'scripts/qmp')
-rwxr-xr-x | scripts/qmp/qmp | 4 | ||||
-rwxr-xr-x | scripts/qmp/qmp-shell | 2 | ||||
-rwxr-xr-x | scripts/qmp/qom-fuse | 2 | ||||
-rwxr-xr-x | scripts/qmp/qom-get | 2 | ||||
-rwxr-xr-x | scripts/qmp/qom-list | 2 | ||||
-rwxr-xr-x | scripts/qmp/qom-set | 2 | ||||
-rwxr-xr-x | scripts/qmp/qom-tree | 2 |
7 files changed, 8 insertions, 8 deletions
diff --git a/scripts/qmp/qmp b/scripts/qmp/qmp index 4d2be4e..33a0d6b 100755 --- a/scripts/qmp/qmp +++ b/scripts/qmp/qmp @@ -36,7 +36,7 @@ def main(args): path = None # Use QMP_PATH if it's set - if os.environ.has_key('QMP_PATH'): + if 'QMP_PATH' in os.environ: path = os.environ['QMP_PATH'] while len(args): @@ -80,7 +80,7 @@ def main(args): def do_command(srv, cmd, **kwds): rsp = srv.cmd(cmd, kwds) - if rsp.has_key('error'): + if 'error' in rsp: raise Exception(rsp['error']['desc']) return rsp['return'] diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell index 38c99d8..26418da 100755 --- a/scripts/qmp/qmp-shell +++ b/scripts/qmp/qmp-shell @@ -134,7 +134,7 @@ class QMPShell(qmp.QEMUMonitorProtocol): def _fill_completion(self): cmds = self.cmd('query-commands') - if cmds.has_key('error'): + if 'error' in cmds: return for cmd in cmds['return']: self._completer.append(cmd['name']) diff --git a/scripts/qmp/qom-fuse b/scripts/qmp/qom-fuse index b75aa72..b00cb0a 100755 --- a/scripts/qmp/qom-fuse +++ b/scripts/qmp/qom-fuse @@ -29,7 +29,7 @@ class QOMFS(Fuse): self.ino_count = 1 def get_ino(self, path): - if self.ino_map.has_key(path): + if path in self.ino_map: return self.ino_map[path] self.ino_map[path] = self.ino_count self.ino_count += 1 diff --git a/scripts/qmp/qom-get b/scripts/qmp/qom-get index 6313f27..a3f5d76 100755 --- a/scripts/qmp/qom-get +++ b/scripts/qmp/qom-get @@ -45,7 +45,7 @@ if len(args) > 0: args = args[2:] if not socket_path: - if os.environ.has_key('QMP_SOCKET'): + if 'QMP_SOCKET' in os.environ: socket_path = os.environ['QMP_SOCKET'] else: usage_error("no QMP socket path or address given"); diff --git a/scripts/qmp/qom-list b/scripts/qmp/qom-list index 80b0a3d..2ba25e1 100755 --- a/scripts/qmp/qom-list +++ b/scripts/qmp/qom-list @@ -45,7 +45,7 @@ if len(args) > 0: args = args[2:] if not socket_path: - if os.environ.has_key('QMP_SOCKET'): + if 'QMP_SOCKET' in os.environ: socket_path = os.environ['QMP_SOCKET'] else: usage_error("no QMP socket path or address given"); diff --git a/scripts/qmp/qom-set b/scripts/qmp/qom-set index cbffb65..0352668 100755 --- a/scripts/qmp/qom-set +++ b/scripts/qmp/qom-set @@ -46,7 +46,7 @@ if len(args) > 0: args = args[2:] if not socket_path: - if os.environ.has_key('QMP_SOCKET'): + if 'QMP_SOCKET' in os.environ: socket_path = os.environ['QMP_SOCKET'] else: usage_error("no QMP socket path or address given"); diff --git a/scripts/qmp/qom-tree b/scripts/qmp/qom-tree index ad4be23..32e708a 100755 --- a/scripts/qmp/qom-tree +++ b/scripts/qmp/qom-tree @@ -47,7 +47,7 @@ if len(args) > 0: args = args[2:] if not socket_path: - if os.environ.has_key('QMP_SOCKET'): + if 'QMP_SOCKET' in os.environ: socket_path = os.environ['QMP_SOCKET'] else: usage_error("no QMP socket path or address given"); |