[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 44/47] qapi/types.py: remove one-letter variables
From: |
John Snow |
Subject: |
[PATCH v3 44/47] qapi/types.py: remove one-letter variables |
Date: |
Thu, 24 Sep 2020 20:28:57 -0400 |
"John, if pylint told you to jump off a bridge, would you?"
Hey, if it looked like fun, I might.
Now that this file is clean, enable pylint checks on this file.
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
---
scripts/qapi/pylintrc | 1 -
scripts/qapi/types.py | 29 +++++++++++++++--------------
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/scripts/qapi/pylintrc b/scripts/qapi/pylintrc
index de132d03cf..cebaf600f9 100644
--- a/scripts/qapi/pylintrc
+++ b/scripts/qapi/pylintrc
@@ -7,7 +7,6 @@ ignore-patterns=doc.py,
expr.py,
parser.py,
schema.py,
- types.py,
visit.py,
diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py
index b65188bac3..20b75c3505 100644
--- a/scripts/qapi/types.py
+++ b/scripts/qapi/types.py
@@ -48,14 +48,14 @@ def gen_enum_lookup(name: str,
.array = (const char *const[]) {
''',
c_name=c_name(name))
- for m in members:
- ret += gen_if(m.ifcond)
- index = c_enum_const(name, m.name, prefix)
+ for member in members:
+ ret += gen_if(member.ifcond)
+ index = c_enum_const(name, member.name, prefix)
ret += mcgen('''
[%(index)s] = "%(name)s",
''',
- index=index, name=m.name)
- ret += gen_endif(m.ifcond)
+ index=index, name=member.name)
+ ret += gen_endif(member.ifcond)
ret += mcgen('''
},
@@ -78,13 +78,13 @@ def gen_enum(name: str,
''',
c_name=c_name(name))
- for m in enum_members:
- ret += gen_if(m.ifcond)
+ for member in enum_members:
+ ret += gen_if(member.ifcond)
ret += mcgen('''
%(c_enum)s,
''',
- c_enum=c_enum_const(name, m.name, prefix))
- ret += gen_endif(m.ifcond)
+ c_enum=c_enum_const(name, member.name, prefix))
+ ret += gen_endif(member.ifcond)
ret += mcgen('''
} %(c_name)s;
@@ -147,11 +147,12 @@ def gen_object(name: str, ifcond: List[str],
objects_seen.add(name)
ret = ''
- if variants:
- for v in variants.variants:
- if isinstance(v.type, QAPISchemaObjectType):
- ret += gen_object(v.type.name, v.type.ifcond, v.type.base,
- v.type.local_members, v.type.variants)
+ for variant in variants.variants if variants else ():
+ obj = variant.type
+ if not isinstance(obj, QAPISchemaObjectType):
+ continue
+ ret += gen_object(obj.name, obj.ifcond, obj.base,
+ obj.local_members, obj.variants)
ret += mcgen('''
--
2.26.2
- [PATCH v3 37/47] qapi/introspect.py: assert obj is a dict when features are given, (continued)
- [PATCH v3 37/47] qapi/introspect.py: assert obj is a dict when features are given, John Snow, 2020/09/24
- [PATCH v3 45/47] qapi/visit.py: assert tag_member contains a QAPISchemaEnumType, John Snow, 2020/09/24
- [PATCH v3 31/47] qapi/gen.py: Fix edge-case of _is_user_module, John Snow, 2020/09/24
- [PATCH v3 39/47] qapi/introspect.py: add _gen_features helper, John Snow, 2020/09/24
- [PATCH v3 47/47] qapi/visit.py: add type hint annotations, John Snow, 2020/09/24
- [PATCH v3 42/47] qapi/introspect.py: create a typed 'Node' data structure, John Snow, 2020/09/24
- [PATCH v3 40/47] qapi/introspect.py: Unify return type of _make_tree(), John Snow, 2020/09/24
- [PATCH v3 32/47] qapi/gen.py: add type hint annotations, John Snow, 2020/09/24
- [PATCH v3 38/47] qapi/instrospect.py: add preliminary type hint annotations, John Snow, 2020/09/24
- [PATCH v3 44/47] qapi/types.py: remove one-letter variables,
John Snow <=
- [PATCH v3 46/47] qapi/visit.py: remove unused parameters from gen_visit_object, John Snow, 2020/09/24
- Re: [PATCH v3 00/47] qapi: static typing conversion, pt1, John Snow, 2020/09/28