qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 19/25] qapi/schema.py: Convert several methods to classmethods


From: John Snow
Subject: [PATCH 19/25] qapi/schema.py: Convert several methods to classmethods
Date: Tue, 22 Sep 2020 18:44:55 -0400

If they don't use self and nothing that extends them needs self either,
they can be classmethods.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 scripts/qapi/schema.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index 61238c0686..2d23ce04eb 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -1096,7 +1096,8 @@ def _def_predefineds(self) -> None:
         self._def_entity(QAPISchemaEnumType('QType', None, None, None, None,
                                             qtype_values, 'QTYPE'))
 
-    def _make_features(self,
+    @classmethod
+    def _make_features(cls,
                        features: Optional[List[Dict[str, Any]]],
                        info: QAPISourceInfo) -> List[QAPISchemaFeature]:
         if features is None:
@@ -1104,7 +1105,8 @@ def _make_features(self,
         return [QAPISchemaFeature(f['name'], info, f.get('if'))
                 for f in features]
 
-    def _make_enum_members(self,
+    @classmethod
+    def _make_enum_members(cls,
                            values: List[Dict[str, Any]],
                            info: Optional[QAPISourceInfo],
                            ) -> List[QAPISchemaEnumMember]:
@@ -1213,7 +1215,8 @@ def _def_struct_type(self,
             self._make_members(data, info),
             None))
 
-    def _make_variant(self,
+    @classmethod
+    def _make_variant(cls,
                       case: str,
                       typ: str,
                       ifcond: Optional[List[str]],
-- 
2.26.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]