Skip to content

Commit a5d7637

Browse files
jnsnowphilmd
authored andcommitted
python/qmp.py: Define common types
Define some common types that we'll need to annotate a lot of other functions going forward. Signed-off-by: John Snow <[email protected]> Reviewed-by: Kevin Wolf <[email protected]> Message-Id: <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
1 parent 04f0e36 commit a5d7637

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

python/qemu/qmp.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,31 @@
1212
import socket
1313
import logging
1414
from typing import (
15+
Any,
16+
Dict,
1517
Optional,
1618
TextIO,
1719
Type,
20+
Tuple,
21+
Union,
1822
)
1923
from types import TracebackType
2024

2125

26+
# QMPMessage is a QMP Message of any kind.
27+
# e.g. {'yee': 'haw'}
28+
#
29+
# QMPReturnValue is the inner value of return values only.
30+
# {'return': {}} is the QMPMessage,
31+
# {} is the QMPReturnValue.
32+
QMPMessage = Dict[str, Any]
33+
QMPReturnValue = Dict[str, Any]
34+
35+
InternetAddrT = Tuple[str, str]
36+
UnixAddrT = str
37+
SocketAddrT = Union[InternetAddrT, UnixAddrT]
38+
39+
2240
class QMPError(Exception):
2341
"""
2442
QMP base exception

0 commit comments

Comments
 (0)