Commit a5d76376 authored by John Snow's avatar John Snow Committed by Philippe Mathieu-Daudé
Browse files

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: default avatarJohn Snow <jsnow@redhat.com>
Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
Message-Id: <20200710052220.3306-2-jsnow@redhat.com>
Signed-off-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
parent 04f0e36e
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -12,13 +12,31 @@ import errno
import socket
import logging
from typing import (
    Any,
    Dict,
    Optional,
    TextIO,
    Type,
    Tuple,
    Union,
)
from types import TracebackType


# QMPMessage is a QMP Message of any kind.
# e.g. {'yee': 'haw'}
#
# QMPReturnValue is the inner value of return values only.
# {'return': {}} is the QMPMessage,
# {} is the QMPReturnValue.
QMPMessage = Dict[str, Any]
QMPReturnValue = Dict[str, Any]

InternetAddrT = Tuple[str, str]
UnixAddrT = str
SocketAddrT = Union[InternetAddrT, UnixAddrT]


class QMPError(Exception):
    """
    QMP base exception