Skip to content
Snippets Groups Projects
Commit eac8aabc authored by John Snow's avatar John Snow
Browse files

python/qmp: return generic type from context manager


__enter__ can be invoked from a subclass, so it needs a more flexible
type.

Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
Message-id: 20210607200649.1840382-31-jsnow@redhat.com
Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
parent 6e24a7ed
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,7 @@
TextIO,
Tuple,
Type,
TypeVar,
Union,
cast,
)
......@@ -220,7 +221,9 @@ def __get_events(self, wait: Union[bool, float] = False) -> None:
if ret is None:
raise QMPConnectError("Error while reading from socket")
def __enter__(self) -> 'QEMUMonitorProtocol':
T = TypeVar('T')
def __enter__(self: T) -> T:
# Implement context manager enter function.
return self
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment