[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 08/16] qapi/expr.py: add type hint annotations
From: |
Markus Armbruster |
Subject: |
Re: [PATCH v3 08/16] qapi/expr.py: add type hint annotations |
Date: |
Thu, 25 Feb 2021 13:08:41 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
John Snow <jsnow@redhat.com> writes:
> On 2/24/21 10:27 AM, Markus Armbruster wrote:
>> John Snow <jsnow@redhat.com> writes:
>>
>>> Annotations do not change runtime behavior.
>>> This commit *only* adds annotations.
>>>
>>> Signed-off-by: John Snow <jsnow@redhat.com>
>>> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
>>> Reviewed-by: Cleber Rosa <crosa@redhat.com>
>>> ---
>>> scripts/qapi/expr.py | 71 ++++++++++++++++++++++++++++---------------
>>> scripts/qapi/mypy.ini | 5 ---
>>> 2 files changed, 46 insertions(+), 30 deletions(-)
>>>
>>> diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
>>> index f45d6be1f4c..df6c64950fa 100644
>>> --- a/scripts/qapi/expr.py
>>> +++ b/scripts/qapi/expr.py
>>> @@ -15,7 +15,14 @@
>>> # See the COPYING file in the top-level directory.
>>>
>>> import re
>>> -from typing import MutableMapping, Optional, cast
>>> +from typing import (
>>> + Iterable,
>>> + List,
>>> + MutableMapping,
>>> + Optional,
>>> + Union,
>>> + cast,
>>> +)
>>>
>>> from .common import c_name
>>> from .error import QAPISemError
>>> @@ -23,9 +30,10 @@
>>> from .source import QAPISourceInfo
>>>
>>>
>>> -# Expressions in their raw form are JSON-like structures with arbitrary
>>> forms.
>>> -# Minimally, their top-level form must be a mapping of strings to values.
>>> -Expression = MutableMapping[str, object]
>>> +# Arbitrary form for a JSON-like object.
>>> +_JSObject = MutableMapping[str, object]
>>> +# Expressions in their raw form are (just) JSON-like objects.
>>> +Expression = _JSObject
>>
>> Wat?
>>
>
> Please read the "RFCs/notes" section of the cover letter. I wrote it for
> *you*!
You mean I'm supposed to remember the cover letter by the time I get to
PATCH 08? Dang! This is no country for old men...
- Re: [PATCH v3 07/16] qapi/expr.py: Add casts in a few select cases, (continued)
- [PATCH v3 09/16] qapi/expr.py: Consolidate check_if_str calls in check_if, John Snow, 2021/02/22
- [PATCH v3 10/16] qapi/expr.py: Remove single-letter variable, John Snow, 2021/02/22
- [PATCH v3 11/16] qapi/expr.py: enable pylint checks, John Snow, 2021/02/22
- [PATCH v3 12/16] qapi/expr.py: Add docstrings, John Snow, 2021/02/22
- [PATCH v3 08/16] qapi/expr.py: add type hint annotations, John Snow, 2021/02/22
- Re: [PATCH v3 08/16] qapi/expr.py: add type hint annotations, Markus Armbruster, 2021/02/25
- [PATCH v3 13/16] qapi/expr.py: Modify check_keys to accept any Collection, John Snow, 2021/02/22
- [PATCH v3 16/16] qapi/expr.py: Use an expression checker dispatch table, John Snow, 2021/02/22
- [PATCH v3 14/16] qapi/expr.py: Use tuples instead of lists for static data, John Snow, 2021/02/22
- [PATCH v3 15/16] qapi/expr.py: move related checks inside check_xxx functions, John Snow, 2021/02/22