qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] qapi/parser: Fix type hints
@ 2023-05-11 11:17 Markus Armbruster
  2023-05-16  0:30 ` Richard Henderson
  0 siblings, 1 reply; 7+ messages in thread
From: Markus Armbruster @ 2023-05-11 11:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: michael.roth, jsnow

Fixes: 3e32dca3f0d1 (qapi: Rewrite parsing of doc comment section symbols and tags)
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 scripts/qapi/parser.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
index 4923a59d60..9315412ab2 100644
--- a/scripts/qapi/parser.py
+++ b/scripts/qapi/parser.py
@@ -563,11 +563,11 @@ def end_comment(self) -> None:
         self._switch_section(QAPIDoc.NullSection(self._parser))
 
     @staticmethod
-    def _match_at_name_colon(string: str) -> re.Match:
+    def _match_at_name_colon(string: str) -> Optional[re.Match[str]]:
         return re.match(r'@([^:]*): *', string)
 
     @staticmethod
-    def _match_section_tag(string: str) -> re.Match:
+    def _match_section_tag(string: str) -> Optional[re.Match[str]]:
         return re.match(r'(Returns|Since|Notes?|Examples?|TODO): *', string)
 
     def _append_body_line(self, line: str) -> None:
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] qapi/parser: Fix type hints
  2023-05-11 11:17 [PATCH] qapi/parser: Fix type hints Markus Armbruster
@ 2023-05-16  0:30 ` Richard Henderson
  2023-05-16  5:22   ` Markus Armbruster
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Henderson @ 2023-05-16  0:30 UTC (permalink / raw)
  To: Markus Armbruster, qemu-devel; +Cc: michael.roth, jsnow

On 5/11/23 04:17, Markus Armbruster wrote:
> Fixes: 3e32dca3f0d1 (qapi: Rewrite parsing of doc comment section symbols and tags)
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>   scripts/qapi/parser.py | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
> index 4923a59d60..9315412ab2 100644
> --- a/scripts/qapi/parser.py
> +++ b/scripts/qapi/parser.py
> @@ -563,11 +563,11 @@ def end_comment(self) -> None:
>           self._switch_section(QAPIDoc.NullSection(self._parser))
>   
>       @staticmethod
> -    def _match_at_name_colon(string: str) -> re.Match:
> +    def _match_at_name_colon(string: str) -> Optional[re.Match[str]]:
>           return re.match(r'@([^:]*): *', string)
>   
>       @staticmethod
> -    def _match_section_tag(string: str) -> re.Match:
> +    def _match_section_tag(string: str) -> Optional[re.Match[str]]:
>           return re.match(r'(Returns|Since|Notes?|Examples?|TODO): *', string)
>   
>       def _append_body_line(self, line: str) -> None:

Doesn't work:

https://gitlab.com/qemu-project/qemu/-/jobs/4289613692#L574

   File "/builds/qemu-project/qemu/scripts/qapi/parser.py", line 566, in QAPIDoc
     def _match_at_name_colon(string: str) -> Optional[re.Match[str]]:
TypeError: 'type' object is not subscriptable


r~


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] qapi/parser: Fix type hints
  2023-05-16  0:30 ` Richard Henderson
@ 2023-05-16  5:22   ` Markus Armbruster
  2023-05-16 13:29     ` Richard Henderson
  2023-05-17 17:14     ` Paolo Bonzini
  0 siblings, 2 replies; 7+ messages in thread
From: Markus Armbruster @ 2023-05-16  5:22 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel, michael.roth, jsnow

Richard Henderson <richard.henderson@linaro.org> writes:

> On 5/11/23 04:17, Markus Armbruster wrote:
>> Fixes: 3e32dca3f0d1 (qapi: Rewrite parsing of doc comment section symbols and tags)
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>>   scripts/qapi/parser.py | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>> diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
>> index 4923a59d60..9315412ab2 100644
>> --- a/scripts/qapi/parser.py
>> +++ b/scripts/qapi/parser.py
>> @@ -563,11 +563,11 @@ def end_comment(self) -> None:
>>           self._switch_section(QAPIDoc.NullSection(self._parser))
>>         @staticmethod
>> -    def _match_at_name_colon(string: str) -> re.Match:
>> +    def _match_at_name_colon(string: str) -> Optional[re.Match[str]]:
>>           return re.match(r'@([^:]*): *', string)
>>         @staticmethod
>> -    def _match_section_tag(string: str) -> re.Match:
>> +    def _match_section_tag(string: str) -> Optional[re.Match[str]]:
>>           return re.match(r'(Returns|Since|Notes?|Examples?|TODO): *', string)
>>         def _append_body_line(self, line: str) -> None:
>
> Doesn't work:
>
> https://gitlab.com/qemu-project/qemu/-/jobs/4289613692#L574
>
>   File "/builds/qemu-project/qemu/scripts/qapi/parser.py", line 566, in QAPIDoc
>     def _match_at_name_colon(string: str) -> Optional[re.Match[str]]:
> TypeError: 'type' object is not subscriptable

Life's too short for wrestling with such pigs.  Unless John has better
ideas, I'll *remove* these return type annotations.  Maybe these pigs
will behave after John's Python venv work lands.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] qapi/parser: Fix type hints
  2023-05-16  5:22   ` Markus Armbruster
@ 2023-05-16 13:29     ` Richard Henderson
  2023-05-17  6:19       ` Markus Armbruster
  2023-05-17 17:14     ` Paolo Bonzini
  1 sibling, 1 reply; 7+ messages in thread
From: Richard Henderson @ 2023-05-16 13:29 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel, michael.roth, jsnow

On 5/15/23 22:22, Markus Armbruster wrote:
>> https://gitlab.com/qemu-project/qemu/-/jobs/4289613692#L574
>>
>>    File "/builds/qemu-project/qemu/scripts/qapi/parser.py", line 566, in QAPIDoc
>>      def _match_at_name_colon(string: str) -> Optional[re.Match[str]]:
>> TypeError: 'type' object is not subscriptable
> 
> Life's too short for wrestling with such pigs.  Unless John has better
> ideas, I'll *remove* these return type annotations.  Maybe these pigs
> will behave after John's Python venv work lands.
> 

That is exactly the idea that I had as well.

r~


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] qapi/parser: Fix type hints
  2023-05-16 13:29     ` Richard Henderson
@ 2023-05-17  6:19       ` Markus Armbruster
  0 siblings, 0 replies; 7+ messages in thread
From: Markus Armbruster @ 2023-05-17  6:19 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel, michael.roth, jsnow, Igor Mammedov

Richard Henderson <richard.henderson@linaro.org> writes:

> On 5/15/23 22:22, Markus Armbruster wrote:
>>> https://gitlab.com/qemu-project/qemu/-/jobs/4289613692#L574
>>>
>>>    File "/builds/qemu-project/qemu/scripts/qapi/parser.py", line 566, in QAPIDoc
>>>      def _match_at_name_colon(string: str) -> Optional[re.Match[str]]:
>>> TypeError: 'type' object is not subscriptable
>> 
>> Life's too short for wrestling with such pigs.  Unless John has better
>> ideas, I'll *remove* these return type annotations.  Maybe these pigs
>> will behave after John's Python venv work lands.
>
> That is exactly the idea that I had as well.
>
> r~

Sent:

Subject: [PATCH] qapi/parser: Drop two bad type hints for now
Message-Id: <20230517061600.1782455-1-armbru@redhat.com>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] qapi/parser: Fix type hints
  2023-05-16  5:22   ` Markus Armbruster
  2023-05-16 13:29     ` Richard Henderson
@ 2023-05-17 17:14     ` Paolo Bonzini
  2023-05-22  7:51       ` Markus Armbruster
  1 sibling, 1 reply; 7+ messages in thread
From: Paolo Bonzini @ 2023-05-17 17:14 UTC (permalink / raw)
  To: Markus Armbruster, Richard Henderson; +Cc: qemu-devel, michael.roth, jsnow

On 5/16/23 07:22, Markus Armbruster wrote:
>>    File "/builds/qemu-project/qemu/scripts/qapi/parser.py", line 566, in QAPIDoc
>>      def _match_at_name_colon(string: str) -> Optional[re.Match[str]]:
>> TypeError: 'type' object is not subscriptable
> Life's too short for wrestling with such pigs.  Unless John has better
> ideas, I'll*remove*  these return type annotations.  Maybe these pigs
> will behave after John's Python venv work lands.

re.Match[str] is new in 3.9.  However, typing.Match[str] should work.

Paolo



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] qapi/parser: Fix type hints
  2023-05-17 17:14     ` Paolo Bonzini
@ 2023-05-22  7:51       ` Markus Armbruster
  0 siblings, 0 replies; 7+ messages in thread
From: Markus Armbruster @ 2023-05-22  7:51 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Richard Henderson, qemu-devel, michael.roth, jsnow

Paolo Bonzini <pbonzini@redhat.com> writes:

> On 5/16/23 07:22, Markus Armbruster wrote:
>>>    File "/builds/qemu-project/qemu/scripts/qapi/parser.py", line 566, in QAPIDoc
>>>      def _match_at_name_colon(string: str) -> Optional[re.Match[str]]:
>>> TypeError: 'type' object is not subscriptable
>>
>> Life's too short for wrestling with such pigs.  Unless John has better
>> ideas, I'll *remove*  these return type annotations.  Maybe these pigs
>> will behave after John's Python venv work lands.
>
> re.Match[str] is new in 3.9.  However, typing.Match[str] should work.

We'll try that after John's venv work is in.  Thank you!



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-05-22  7:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-11 11:17 [PATCH] qapi/parser: Fix type hints Markus Armbruster
2023-05-16  0:30 ` Richard Henderson
2023-05-16  5:22   ` Markus Armbruster
2023-05-16 13:29     ` Richard Henderson
2023-05-17  6:19       ` Markus Armbruster
2023-05-17 17:14     ` Paolo Bonzini
2023-05-22  7:51       ` Markus Armbruster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).