diff mbox series

[for-4.0,v7,11/27] qapi: pass long form enum to make_enum_members

Message ID 20181208111606.8505-12-marcandre.lureau@redhat.com
State New
Headers show
Series Hi, | expand

Commit Message

Marc-André Lureau Dec. 8, 2018, 11:15 a.m. UTC
This will allow to get rid of short form handling in a following
patch.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Suggested-by: Markus Armbruster <armbru@redhat.com>
---
 scripts/qapi/common.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Markus Armbruster Dec. 10, 2018, 5:04 p.m. UTC | #1
Marc-André Lureau <marcandre.lureau@redhat.com> writes:

> This will allow to get rid of short form handling in a following
> patch.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Suggested-by: Markus Armbruster <armbru@redhat.com>
> ---
>  scripts/qapi/common.py | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
> index fdc0fd69ef..557b413950 100644
> --- a/scripts/qapi/common.py
> +++ b/scripts/qapi/common.py
> @@ -1663,9 +1663,10 @@ class QAPISchema(object):
>          self.the_empty_object_type = QAPISchemaObjectType(
>              'q_empty', None, None, None, None, [], None)
>          self._def_entity(self.the_empty_object_type)
> -        qtype_values = self._make_enum_members(['none', 'qnull', 'qnum',
> -                                                'qstring', 'qdict', 'qlist',
> -                                                'qbool'])
> +
> +        qtypes = ['none', 'qnull', 'qnum', 'qstring', 'qdict', 'qlist', 'qbool']

Long line.

> +        qtype_values = self._make_enum_members([{'name': n} for n in qtypes])
> +
>          self._def_entity(QAPISchemaEnumType('QType', None, None, None,
>                                              qtype_values, 'QTYPE'))

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>
diff mbox series

Patch

diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
index fdc0fd69ef..557b413950 100644
--- a/scripts/qapi/common.py
+++ b/scripts/qapi/common.py
@@ -1663,9 +1663,10 @@  class QAPISchema(object):
         self.the_empty_object_type = QAPISchemaObjectType(
             'q_empty', None, None, None, None, [], None)
         self._def_entity(self.the_empty_object_type)
-        qtype_values = self._make_enum_members(['none', 'qnull', 'qnum',
-                                                'qstring', 'qdict', 'qlist',
-                                                'qbool'])
+
+        qtypes = ['none', 'qnull', 'qnum', 'qstring', 'qdict', 'qlist', 'qbool']
+        qtype_values = self._make_enum_members([{'name': n} for n in qtypes])
+
         self._def_entity(QAPISchemaEnumType('QType', None, None, None,
                                             qtype_values, 'QTYPE'))