Message ID | 20181208111606.8505-18-marcandre.lureau@redhat.com |
---|---|
State | New |
Headers | show |
Series | Hi, | expand |
Marc-André Lureau <marcandre.lureau@redhat.com> writes: > The function only receives the dictionary form of enum expressions > now, so we can make it shorter. > > Suggested-by: Markus Armbruster <armbru@redhat.com> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> > --- > scripts/qapi/common.py | 11 +---------- > 1 file changed, 1 insertion(+), 10 deletions(-) > > diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py > index fd622313cb..44020779dd 100644 > --- a/scripts/qapi/common.py > +++ b/scripts/qapi/common.py > @@ -1714,16 +1714,7 @@ class QAPISchema(object): > qtype_values, 'QTYPE')) > > def _make_enum_members(self, values): > - enum = [] > - for v in values: > - if isinstance(v, dict): > - name = v['name'] > - ifcond = v.get('if') > - else: > - name = v > - ifcond = None > - enum.append(QAPISchemaMember(name, ifcond)) > - return enum > + return [QAPISchemaMember(v['name'], v.get('if')) for v in values] > > def _make_implicit_enum_type(self, name, info, ifcond, values): > # See also QAPISchemaObjectTypeMember._pretty_owner() We may want to squash this one into PATCH 08 as mentioned in that patch's review. In case we don't: Reviewed-by: Markus Armbruster <armbru@redhat.com>
Hi On Tue, Dec 11, 2018 at 4:06 PM Markus Armbruster <armbru@redhat.com> wrote: > > Marc-André Lureau <marcandre.lureau@redhat.com> writes: > > > The function only receives the dictionary form of enum expressions > > now, so we can make it shorter. > > > > Suggested-by: Markus Armbruster <armbru@redhat.com> > > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> > > --- > > scripts/qapi/common.py | 11 +---------- > > 1 file changed, 1 insertion(+), 10 deletions(-) > > > > diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py > > index fd622313cb..44020779dd 100644 > > --- a/scripts/qapi/common.py > > +++ b/scripts/qapi/common.py > > @@ -1714,16 +1714,7 @@ class QAPISchema(object): > > qtype_values, 'QTYPE')) > > > > def _make_enum_members(self, values): > > - enum = [] > > - for v in values: > > - if isinstance(v, dict): > > - name = v['name'] > > - ifcond = v.get('if') > > - else: > > - name = v > > - ifcond = None > > - enum.append(QAPISchemaMember(name, ifcond)) > > - return enum > > + return [QAPISchemaMember(v['name'], v.get('if')) for v in values] > > > > def _make_implicit_enum_type(self, name, info, ifcond, values): > > # See also QAPISchemaObjectTypeMember._pretty_owner() > > We may want to squash this one into PATCH 08 as mentioned in that > patch's review. > > In case we don't: > Reviewed-by: Markus Armbruster <armbru@redhat.com> > Feel free to squash on commit, thanks
diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index fd622313cb..44020779dd 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -1714,16 +1714,7 @@ class QAPISchema(object): qtype_values, 'QTYPE')) def _make_enum_members(self, values): - enum = [] - for v in values: - if isinstance(v, dict): - name = v['name'] - ifcond = v.get('if') - else: - name = v - ifcond = None - enum.append(QAPISchemaMember(name, ifcond)) - return enum + return [QAPISchemaMember(v['name'], v.get('if')) for v in values] def _make_implicit_enum_type(self, name, info, ifcond, values): # See also QAPISchemaObjectTypeMember._pretty_owner()
The function only receives the dictionary form of enum expressions now, so we can make it shorter. Suggested-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> --- scripts/qapi/common.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)