[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 33/36] qapi/types.py: remove one-letter variables
From: |
John Snow |
Subject: |
[PATCH v6 33/36] qapi/types.py: remove one-letter variables |
Date: |
Fri, 9 Oct 2020 12:15:55 -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 8badcb11cda..b3c4cf46dbf 100644
--- a/scripts/qapi/pylintrc
+++ b/scripts/qapi/pylintrc
@@ -6,7 +6,6 @@ ignore-patterns=error.py,
expr.py,
parser.py,
schema.py,
- types.py,
visit.py,
diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py
index 766822feb3a..2b4916cdaa1 100644
--- a/scripts/qapi/types.py
+++ b/scripts/qapi/types.py
@@ -49,14 +49,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 memb in members:
+ ret += gen_if(memb.ifcond)
+ index = c_enum_const(name, memb.name, prefix)
ret += mcgen('''
[%(index)s] = "%(name)s",
''',
- index=index, name=m.name)
- ret += gen_endif(m.ifcond)
+ index=index, name=memb.name)
+ ret += gen_endif(memb.ifcond)
ret += mcgen('''
},
@@ -79,13 +79,13 @@ def gen_enum(name: str,
''',
c_name=c_name(name))
- for m in enum_members:
- ret += gen_if(m.ifcond)
+ for memb in enum_members:
+ ret += gen_if(memb.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, memb.name, prefix))
+ ret += gen_endif(memb.ifcond)
ret += mcgen('''
} %(c_name)s;
@@ -148,11 +148,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 var in variants.variants if variants else ():
+ obj = var.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 v6 26/36] qapi/gen.py: Fix edge-case of _is_user_module, (continued)
- [PATCH v6 22/36] qapi/commands.py: add type hint annotations, John Snow, 2020/10/09
- [PATCH v6 25/36] qapi/source.py: delint with pylint, John Snow, 2020/10/09
- [PATCH v6 21/36] qapi/commands.py: Don't re-bind to variable of different type, John Snow, 2020/10/09
- [PATCH v6 28/36] qapi/gen.py: Enable checking with mypy, John Snow, 2020/10/09
- [PATCH v6 27/36] qapi/gen.py: add type hint annotations, John Snow, 2020/10/09
- [PATCH v6 30/36] qapi/gen.py: update write() to be more idiomatic, John Snow, 2020/10/09
- [PATCH v6 33/36] qapi/types.py: remove one-letter variables,
John Snow <=
- [PATCH v6 29/36] qapi/gen.py: Remove unused parameter, John Snow, 2020/10/09
- [PATCH v6 35/36] qapi/visit.py: remove unused parameters from gen_visit_object, John Snow, 2020/10/09
- [PATCH v6 34/36] qapi/visit.py: assert tag_member contains a QAPISchemaEnumType, John Snow, 2020/10/09
- [PATCH v6 32/36] qapi/types.py: add type hint annotations, John Snow, 2020/10/09
- [PATCH v6 36/36] qapi/visit.py: add type hint annotations, John Snow, 2020/10/09
- [PATCH v6 31/36] qapi/gen.py: delint with pylint, John Snow, 2020/10/09
- Re: [PATCH v6 00/36] qapi: static typing conversion, pt1, Markus Armbruster, 2020/10/10