Skip to content

Commit f6fdb48

Browse files
authored
Merge pull request #24 from tcfranks/main
Add Missing Type Annotations
2 parents 0682b46 + c1e5e49 commit f6fdb48

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

adafruit_bitbangio.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
"""
2525

2626
try:
27-
from typing import Optional, List
27+
from typing import List, Optional, Type
2828
from typing_extensions import Literal
29+
from types import TracebackType
2930
from circuitpython_typing import WriteableBuffer, ReadableBuffer
3031
from microcontroller import Pin
3132
except ImportError:
@@ -67,10 +68,15 @@ def _check_lock(self) -> Literal[True]:
6768
raise RuntimeError("First call try_lock()")
6869
return True
6970

70-
def __enter__(self):
71+
def __enter__(self) -> "_BitBangIO":
7172
return self
7273

73-
def __exit__(self, exc_type, exc_value, traceback) -> None:
74+
def __exit__(
75+
self,
76+
exc_type: Optional[Type[BaseException]],
77+
exc_value: Optional[BaseException],
78+
traceback: Optional[TracebackType],
79+
) -> None:
7480
self.deinit()
7581

7682
# pylint: disable=no-self-use

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# SPDX-License-Identifier: Unlicense
44

55
Adafruit-Blinka
6-
typing-extensions
6+
typing-extensions~=4.0

0 commit comments

Comments
 (0)