From: John Snow <js...@redhat.com>

Mypy cannot understand that this match can never be None, so help it
along.

Signed-off-by: John Snow <js...@redhat.com>
Message-Id: <20210201193747.2169670-4-js...@redhat.com>
Reviewed-by: Markus Armbruster <arm...@redhat.com>
Signed-off-by: Markus Armbruster <arm...@redhat.com>
---
 scripts/qapi/main.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/qapi/main.py b/scripts/qapi/main.py
index 42517210b8..703e7ed1ed 100644
--- a/scripts/qapi/main.py
+++ b/scripts/qapi/main.py
@@ -23,6 +23,8 @@ from .visit import gen_visit
 
 def invalid_prefix_char(prefix: str) -> Optional[str]:
     match = re.match(r'([A-Za-z_.-][A-Za-z0-9_.-]*)?', prefix)
+    # match cannot be None, but mypy cannot infer that.
+    assert match is not None
     if match.end() != len(prefix):
         return prefix[match.end()]
     return None
-- 
2.26.2


Reply via email to