[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 01/16] python/qmp.py: Define common types
From: |
John Snow |
Subject: |
[PATCH v2 01/16] python/qmp.py: Define common types |
Date: |
Tue, 2 Jun 2020 17:45:13 -0400 |
Define some common types that we'll need to annotate a lot of other
functions going forward.
Signed-off-by: John Snow <jsnow@redhat.com>
---
python/qemu/qmp.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/python/qemu/qmp.py b/python/qemu/qmp.py
index e64b6b5faa7..8388c7b6030 100644
--- a/python/qemu/qmp.py
+++ b/python/qemu/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.3
- [PATCH v2 00/16] python: add mypy support to python/qemu, John Snow, 2020/06/02
- [PATCH v2 02/16] iotests.py: use qemu.qmp type aliases, John Snow, 2020/06/02
- [PATCH v2 01/16] python/qmp.py: Define common types,
John Snow <=
- [PATCH v2 03/16] python/qmp.py: re-absorb MonitorResponseError, John Snow, 2020/06/02
- [PATCH v2 04/16] python/qmp.py: Do not return None from cmd_obj, John Snow, 2020/06/02
- [PATCH v2 05/16] python/qmp.py: add casts to JSON deserialization, John Snow, 2020/06/02
- [PATCH v2 06/16] python/qmp.py: add QMPProtocolError, John Snow, 2020/06/02
- [PATCH v2 07/16] python/machine.py: Fix monitor address typing, John Snow, 2020/06/02
- [PATCH v2 09/16] python/machine.py: Don't modify state in _base_args(), John Snow, 2020/06/02
- [PATCH v2 08/16] python/machine.py: reorder __init__, John Snow, 2020/06/02
- [PATCH v2 10/16] python/machine.py: Handle None events in event_wait, John Snow, 2020/06/02