Skip to content

Commit 84ddaa1

Browse files
committed
add type hints to __exit()__
1 parent be521a8 commit 84ddaa1

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

adafruit_minimqtt/adafruit_minimqtt.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@
3333
from random import randint
3434

3535
try:
36-
from typing import List, Optional, Tuple, Union
36+
from typing import List, Optional, Tuple, Type, Union
37+
except ImportError:
38+
pass
39+
40+
try:
41+
from types import TracebackType
3742
except ImportError:
3843
pass
3944

@@ -343,7 +348,12 @@ def _get_connect_socket(self, host: str, port: int, *, timeout: int = 1):
343348
def __enter__(self):
344349
return self
345350

346-
def __exit__(self, exception_type, exception_value, traceback) -> None:
351+
def __exit__(
352+
self,
353+
exception_type: Optional[Type[BaseException]],
354+
exception_value: Optional[BaseException],
355+
traceback: Optional[TracebackType],
356+
) -> None:
347357
self.deinit()
348358

349359
def deinit(self) -> None:

0 commit comments

Comments
 (0)