mirror of
https://github.com/qemu/qemu.git
synced 2025-08-16 06:43:21 +00:00
scripts/qmp-shell: use @classmethod where appropriate
Methods with no self-use should belong to the class. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210607200649.1840382-8-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
This commit is contained in:
parent
9669c8289c
commit
c4a1447fc1
@ -97,7 +97,8 @@ class FuzzyJSON(ast.NodeTransformer):
|
|||||||
'''This extension of ast.NodeTransformer filters literal "true/false/null"
|
'''This extension of ast.NodeTransformer filters literal "true/false/null"
|
||||||
values in an AST and replaces them by proper "True/False/None" values that
|
values in an AST and replaces them by proper "True/False/None" values that
|
||||||
Python can properly evaluate.'''
|
Python can properly evaluate.'''
|
||||||
def visit_Name(self, node):
|
@classmethod
|
||||||
|
def visit_Name(cls, node):
|
||||||
if node.id == 'true':
|
if node.id == 'true':
|
||||||
node.id = 'True'
|
node.id = 'True'
|
||||||
if node.id == 'false':
|
if node.id == 'false':
|
||||||
@ -152,7 +153,8 @@ class QMPShell(qmp.QEMUMonitorProtocol):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Failed to save history file '%s'; %s" % (self._histfile, e))
|
print("Failed to save history file '%s'; %s" % (self._histfile, e))
|
||||||
|
|
||||||
def __parse_value(self, val):
|
@classmethod
|
||||||
|
def __parse_value(cls, val):
|
||||||
try:
|
try:
|
||||||
return int(val)
|
return int(val)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
Loading…
Reference in New Issue
Block a user