[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 43/72] scripts/qmp-shell: rename one and two-letter variables
From: |
John Snow |
Subject: |
[PULL 43/72] scripts/qmp-shell: rename one and two-letter variables |
Date: |
Fri, 18 Jun 2021 19:04:26 -0400 |
A bit of churn and housekeeping for pylint, flake8 et al.
Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 20210607200649.1840382-14-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
---
scripts/qmp/qmp-shell | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell
index 8d84467b53..afb4b0c544 100755
--- a/scripts/qmp/qmp-shell
+++ b/scripts/qmp/qmp-shell
@@ -176,8 +176,8 @@ class QMPShell(qmp.QEMUMonitorProtocol):
pass
# Try once again as FuzzyJSON:
try:
- st = ast.parse(val, mode='eval')
- return ast.literal_eval(FuzzyJSON().visit(st))
+ tree = ast.parse(val, mode='eval')
+ return ast.literal_eval(FuzzyJSON().visit(tree))
except SyntaxError:
pass
except ValueError:
@@ -195,14 +195,14 @@ class QMPShell(qmp.QEMUMonitorProtocol):
value = self.__parse_value(val)
optpath = key.split('.')
curpath = []
- for p in optpath[:-1]:
- curpath.append(p)
- d = parent.get(p, {})
- if type(d) is not dict:
+ for path in optpath[:-1]:
+ curpath.append(path)
+ obj = parent.get(path, {})
+ if type(obj) is not dict:
msg = 'Cannot use "{:s}" as both leaf and non-leaf key'
raise QMPShellError(msg.format('.'.join(curpath)))
- parent[p] = d
- parent = d
+ parent[path] = obj
+ parent = obj
if optpath[-1] in parent:
if type(parent[optpath[-1]]) is dict:
msg = 'Cannot use "{:s}" as both leaf and non-leaf key'
@@ -267,8 +267,8 @@ class QMPShell(qmp.QEMUMonitorProtocol):
def _execute_cmd(self, cmdline):
try:
qmpcmd = self.__build_cmd(cmdline)
- except Exception as e:
- print('Error while parsing command line: %s' % e)
+ except Exception as err:
+ print('Error while parsing command line: %s' % err)
print('command format: <command-name> ', end=' ')
print('[arg-name1=arg1] ... [arg-nameN=argN]')
return True
@@ -313,8 +313,8 @@ class QMPShell(qmp.QEMUMonitorProtocol):
print()
return False
if cmdline == '':
- for ev in self.get_events():
- print(ev)
+ for event in self.get_events():
+ print(event)
self.clear_events()
return True
else:
--
2.31.1
- [PULL 36/72] scripts/qmp-shell: remove shadowed variable from _print(), (continued)
- [PULL 36/72] scripts/qmp-shell: remove shadowed variable from _print(), John Snow, 2021/06/18
- [PULL 19/72] python/qmp: add fuse command to 'qom' tools, John Snow, 2021/06/18
- [PULL 37/72] scripts/qmp-shell: use @classmethod where appropriate, John Snow, 2021/06/18
- [PULL 10/72] scripts/qom-fuse: Apply pylint rules, John Snow, 2021/06/18
- [PULL 21/72] scripts/qemu-ga-client: apply (most) flake8 rules, John Snow, 2021/06/18
- [PULL 29/72] python/qemu-ga-client: add entry point, John Snow, 2021/06/18
- [PULL 33/72] scripts/qmp-shell: fix show_banner signature, John Snow, 2021/06/18
- [PULL 48/72] scripts/qmp-shell: Add pretty attribute to HMP shell, John Snow, 2021/06/18
- [PULL 44/72] scripts/qmp-shell: fix shell history exception handling, John Snow, 2021/06/18
- [PULL 46/72] scripts/qmp-shell: use isinstance() instead of type(), John Snow, 2021/06/18
- [PULL 43/72] scripts/qmp-shell: rename one and two-letter variables,
John Snow <=
- [PULL 49/72] scripts/qmp-shell: Make verbose a public attribute, John Snow, 2021/06/18
- [PULL 31/72] scripts/qmp-shell: apply isort rules, John Snow, 2021/06/18
- [PULL 39/72] scripts/qmp-shell: declare verbose in __init__, John Snow, 2021/06/18
- [PULL 40/72] scripts/qmp-shell: use triple-double-quote docstring style, John Snow, 2021/06/18
- [PULL 41/72] scripts/qmp-shell: ignore visit_Name name, John Snow, 2021/06/18
- [PULL 42/72] scripts/qmp-shell: make QMPCompleter returns explicit, John Snow, 2021/06/18
- [PULL 50/72] scripts/qmp-shell: move get_prompt() to prompt property, John Snow, 2021/06/18
- [PULL 23/72] scripts/qemu-ga-client: replace deprecated optparse with argparse, John Snow, 2021/06/18
- [PULL 25/72] scripts/qemu-ga-client: apply (most) pylint rules, John Snow, 2021/06/18
- [PULL 24/72] scripts/qemu-ga-client: add module docstring, John Snow, 2021/06/18