[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
- [PATCH 12/25] qapi/schema.py: remove 'and' from non-bool rvalue expressions, (continued)
- [PATCH 12/25] qapi/schema.py: remove 'and' from non-bool rvalue expressions, John Snow, 2020/09/22
- [PATCH 11/25] qapi/schema.py: Constrain type of QAPISchemaObjectType members field, John Snow, 2020/09/22
- [PATCH 08/25] qapi/schema.py: Allow alternate_type to assert, John Snow, 2020/09/22
- [PATCH 13/25] qapi/schema.py: Test type of self.ret_type instead of local temp, John Snow, 2020/09/22
- [PATCH 16/25] qapi/schema.py: enable checking, John Snow, 2020/09/22
- [PATCH 24/25] qapi/schema.py: Add module docstring, John Snow, 2020/09/22
- [PATCH 20/25] qapi/schema.py: Replace one-letter variable names, John Snow, 2020/09/22
- [PATCH 18/25] qapi/schema.py: Add pylint warning suppressions, John Snow, 2020/09/22
- [PATCH 25/25] qapi/schema.py: Use python3 style super(), John Snow, 2020/09/22
- [PATCH 23/25] qapi/schema.py: enable pylint checks, John Snow, 2020/09/22
- [PATCH 19/25] qapi/schema.py: Convert several methods to classmethods,
John Snow <=
- [PATCH 15/25] qapi/schema.py: add type hint annotations, John Snow, 2020/09/22
- [PATCH 22/25] qapi/schema.py: Ignore unused argument for check(), John Snow, 2020/09/22
- [PATCH 17/25] qapi: Disable similarity checks in pylint entirely, John Snow, 2020/09/22