qemu-devel
[Top][All Lists]
Advanced

[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: John Snow
Subject: Re: [PATCH v3 08/16] qapi/expr.py: add type hint annotations
Date: Wed, 24 Feb 2021 17:30:09 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0

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*!

--js




reply via email to

[Prev in Thread] Current Thread [Next in Thread]