qapi/commands: assert arg_type is not None
commitec9697ab3fe2174a865d0ac2bbc572cbd5981d94
authorJohn Snow <jsnow@redhat.com>
Mon, 1 Feb 2021 19:37:32 +0000 (1 14:37 -0500)
committerMarkus Armbruster <armbru@redhat.com>
Mon, 8 Feb 2021 13:15:58 +0000 (8 14:15 +0100)
treea825be1b98575e3616c2b2a769ed3a48566917c2
parent6f0e9c26dbae9ac18b89d359791008fe3432ca91
qapi/commands: assert arg_type is not None

When boxed is True, expr.py asserts that we must have
arguments. Ultimately, this should mean that if boxed is True that
arg_type should be defined. Mypy cannot infer this, and does not support
'stateful' type inference, e.g.:

```
if x:
    assert y is not None

...

if x:
    y.etc()
```

does not work, because mypy does not statefully remember the conditional
assertion in the second block. Help mypy out by creating a new local
that it can track more easily.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210201193747.2169670-2-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
scripts/qapi/commands.py