On Tue, Sep 22, 2020 at 05:00:45PM -0400, John Snow wrote:
Annotations do not change runtime behavior.
This commit *only* adds annotations.
Signed-off-by: John Snow <jsnow@redhat.com>
---
scripts/qapi/mypy.ini | 5 -----
scripts/qapi/source.py | 31 ++++++++++++++++++-------------
2 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/scripts/qapi/mypy.ini b/scripts/qapi/mypy.ini
index 9da1dccef4..43c8bd1973 100644
--- a/scripts/qapi/mypy.ini
+++ b/scripts/qapi/mypy.ini
@@ -39,11 +39,6 @@ disallow_untyped_defs = False
disallow_incomplete_defs = False
check_untyped_defs = False
-[mypy-qapi.source]
-disallow_untyped_defs = False
-disallow_incomplete_defs = False
-check_untyped_defs = False
-
This is what I meant in my comment in the previous patch. It looks
like a mix of commit grannurality styles. Not a blocker though.
[mypy-qapi.types]
disallow_untyped_defs = False
disallow_incomplete_defs = False
diff --git a/scripts/qapi/source.py b/scripts/qapi/source.py
index e97b9a8e15..1cc6a5b82d 100644
--- a/scripts/qapi/source.py
+++ b/scripts/qapi/source.py
@@ -11,37 +11,42 @@
import copy
import sys
+from typing import List, Optional, TypeVar
class QAPISchemaPragma:
- def __init__(self):
+ def __init__(self) -> None:
I don't follow the reason for typing this...
# Are documentation comments required?
self.doc_required = False
# Whitelist of commands allowed to return a non-dictionary
- self.returns_whitelist = []
+ self.returns_whitelist: List[str] = []
# Whitelist of entities allowed to violate case conventions
- self.name_case_whitelist = []
+ self.name_case_whitelist: List[str] = []
class QAPISourceInfo:
- def __init__(self, fname, line, parent):
+ T = TypeVar('T', bound='QAPISourceInfo')
+
+ def __init__(self: T, fname: str, line: int, parent: Optional[T]):
And not this... to tune my review approach, should I assume that this
series intends to add complete type hints or not?