aboutsummaryrefslogtreecommitdiff
path: root/scripts/qmp
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2021-06-07 16:06:23 -0400
committerJohn Snow <jsnow@redhat.com>2021-06-18 16:10:07 -0400
commit90bd8eb8dcdc94da964786ddedd90c30eb54ada7 (patch)
treec3e98596cdc5954fe45d2ac9e5bb8fa7c1540d55 /scripts/qmp
parent73f699c903d429dfcd3b43232155cd515a854e80 (diff)
scripts/qmp-shell: use isinstance() instead of type()
A bit more idiomatic, and quiets some linter warnings. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-17-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'scripts/qmp')
-rwxr-xr-xscripts/qmp/qmp-shell4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell
index bf7a49dfc1..970f43dd00 100755
--- a/scripts/qmp/qmp-shell
+++ b/scripts/qmp/qmp-shell
@@ -195,13 +195,13 @@ class QMPShell(qmp.QEMUMonitorProtocol):
for path in optpath[:-1]:
curpath.append(path)
obj = parent.get(path, {})
- if type(obj) is not dict:
+ if not isinstance(obj, dict):
msg = 'Cannot use "{:s}" as both leaf and non-leaf key'
raise QMPShellError(msg.format('.'.join(curpath)))
parent[path] = obj
parent = obj
if optpath[-1] in parent:
- if type(parent[optpath[-1]]) is dict:
+ if isinstance(parent[optpath[-1]], dict):
msg = 'Cannot use "{:s}" as both leaf and non-leaf key'
raise QMPShellError(msg.format('.'.join(curpath)))
raise QMPShellError(f'Cannot set "{key}" multiple times')