iotests: touch up log function signature
commit1cd0dbfc12019fcd5f0529094a939a1557dfc2df
authorJohn Snow <jsnow@redhat.com>
Tue, 31 Mar 2020 00:00:08 +0000 (30 20:00 -0400)
committerMax Reitz <mreitz@redhat.com>
Tue, 5 May 2020 11:17:36 +0000 (5 13:17 +0200)
tree5b446f918682dba96f5b8461e20aa00db9d5807b
parent229fc0742a727c1733dd4d0c405c4c590f8dc627
iotests: touch up log function signature

Representing nested, recursive data structures in mypy is notoriously
difficult; the best we can reliably do right now is denote the leaf
types as "Any" while describing the general shape of the data.

Regardless, this fully annotates the log() function.

Typing notes:

TypeVar is a Type variable that can optionally be constrained by a
sequence of possible types. This variable is bound to a specific type
per-invocation, like a Generic.

log() behaves as log<Msg>() now, where the incoming type informs the
signature it expects for any filter arguments passed in. If Msg is a
str, then filter should take and return a str.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200331000014.11581-9-jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
tests/qemu-iotests/iotests.py