@@ -24,6 +24,8 @@
import shutil
import socket
import tempfile
+from typing import Optional, Type
+from types import TracebackType
from . import qmp
@@ -124,9 +126,11 @@ def __init__(self, binary, args=None, wrapper=None, name=None,
def __enter__(self):
return self
- def __exit__(self, exc_type, exc_val, exc_tb):
+ def __exit__(self,
+ exc_type: Optional[Type[BaseException]],
+ exc_val: Optional[BaseException],
+ exc_tb: Optional[TracebackType]) -> None:
self.shutdown()
- return False
def add_monitor_null(self):
"""
@@ -14,7 +14,9 @@
from typing import (
Optional,
TextIO,
+ Type,
)
+from types import TracebackType
class QMPError(Exception):
@@ -146,10 +148,14 @@ def __enter__(self):
# Implement context manager enter function.
return self
- def __exit__(self, exc_type, exc_value, exc_traceback):
+ def __exit__(self,
+ # pylint: disable=duplicate-code
+ # see https://github.com/PyCQA/pylint/issues/3619
+ exc_type: Optional[Type[BaseException]],
+ exc_val: Optional[BaseException],
+ exc_tb: Optional[TracebackType]) -> None:
# Implement context manager exit function.
self.close()
- return False
def connect(self, negotiate=True):
"""