qapi: Use re.fullmatch() where appropriate
authorMarkus Armbruster <armbru@redhat.com>
Tue, 31 Aug 2021 12:38:06 +0000 (14:38 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Fri, 3 Sep 2021 15:09:10 +0000 (17:09 +0200)
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210831123809.1107782-10-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
scripts/qapi/expr.py

index 019f4c97aaf0c59f5f240e942d05305b3631fbe8..9e2aa1d43a008f137cbebe8fa737c84d199f9e77 100644 (file)
@@ -275,7 +275,7 @@ def check_if(expr: _JSONObject, info: QAPISourceInfo, source: str) -> None:
 
     def _check_if(cond: Union[str, object]) -> None:
         if isinstance(cond, str):
-            if not re.match(r'^[A-Z][A-Z0-9_]*$', cond):
+            if not re.fullmatch(r'[A-Z][A-Z0-9_]*', cond):
                 raise QAPISemError(
                     info,
                     "'if' condition '%s' of %s is not a valid identifier"