diff mbox series

[v2,34/72] scripts/qmp-shell: use @classmethod where appropriate

Message ID 20201104003602.1293560-35-jsnow@redhat.com
State New
Headers show
Series [v2,01/72] python/qmp: Add qom script rewrites | expand

Commit Message

John Snow Nov. 4, 2020, 12:35 a.m. UTC
Methods with no self-use should belong to the class.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 scripts/qmp/qmp-shell | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell
index 6767a01eaaed..69359ec8ad7f 100755
--- a/scripts/qmp/qmp-shell
+++ b/scripts/qmp/qmp-shell
@@ -101,7 +101,8 @@  class FuzzyJSON(ast.NodeTransformer):
     '''This extension of ast.NodeTransformer filters literal "true/false/null"
     values in an AST and replaces them by proper "True/False/None" values that
     Python can properly evaluate.'''
-    def visit_Name(self, node):
+    @classmethod
+    def visit_Name(cls, node):
         if node.id == 'true':
             node.id = 'True'
         if node.id == 'false':
@@ -124,7 +125,8 @@  class QMPShell(qmp.QEMUMonitorProtocol):
         self._histfile = os.path.join(os.path.expanduser('~'),
                                       '.qmp-shell_history')
 
-    def __get_address(self, arg):
+    @classmethod
+    def __get_address(cls, arg):
         """
         Figure out if the argument is in the port:host form, if it's not it's
         probably a file path.
@@ -171,7 +173,8 @@  class QMPShell(qmp.QEMUMonitorProtocol):
         except Exception as e:
             print("Failed to save history file '%s'; %s" % (self._histfile, e))
 
-    def __parse_value(self, val):
+    @classmethod
+    def __parse_value(cls, val):
         try:
             return int(val)
         except ValueError: