[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH RFC 15/32] python//qmp.py: Define common types
From: |
John Snow |
Subject: |
[PATCH RFC 15/32] python//qmp.py: Define common types |
Date: |
Thu, 14 May 2020 01:53:46 -0400 |
Define some common types that we'll need to annotate a lot of other
functions going forward.
Signed-off-by: John Snow <address@hidden>
---
python/qemu/lib/qmp.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/python/qemu/lib/qmp.py b/python/qemu/lib/qmp.py
index a634c4e26c..911da59888 100644
--- a/python/qemu/lib/qmp.py
+++ b/python/qemu/lib/qmp.py
@@ -12,13 +12,31 @@
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
--
2.21.1
- [PATCH RFC 09/32] python/qemu: add pylint to Pipfile, (continued)
- [PATCH RFC 09/32] python/qemu: add pylint to Pipfile, John Snow, 2020/05/14
- [PATCH RFC 08/32] python/qemu: Add Pipfile, John Snow, 2020/05/14
- [PATCH RFC 11/32] python/qemu/lib: remove Python2 style super() calls, John Snow, 2020/05/14
- [PATCH RFC 14/32] python//qmp.py: use True/False for non/blocking modes, John Snow, 2020/05/14
- [PATCH RFC 16/32] python//qmp.py: re-absorb MonitorResponseError, John Snow, 2020/05/14
- [PATCH RFC 15/32] python//qmp.py: Define common types,
John Snow <=
- [PATCH RFC 17/32] python//qmp.py: Do not return None from cmd_obj, John Snow, 2020/05/14
- [PATCH RFC 18/32] python//qmp.py: add casts to JSON deserialization, John Snow, 2020/05/14
- [PATCH RFC 20/32] python//qmp.py: assert sockfile is not None, John Snow, 2020/05/14
- [PATCH RFC 21/32] python//machine.py: remove logging configuration, John Snow, 2020/05/14