Skip to content

Commit

Permalink
Merge pull request #24 from tcfranks/main
Browse files Browse the repository at this point in the history
Add Missing Type Annotations
  • Loading branch information
tekktrik authored Sep 21, 2022
2 parents 0682b46 + c1e5e49 commit f6fdb48
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions adafruit_bitbangio.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
"""

try:
from typing import Optional, List
from typing import List, Optional, Type
from typing_extensions import Literal
from types import TracebackType
from circuitpython_typing import WriteableBuffer, ReadableBuffer
from microcontroller import Pin
except ImportError:
Expand Down Expand Up @@ -67,10 +68,15 @@ def _check_lock(self) -> Literal[True]:
raise RuntimeError("First call try_lock()")
return True

def __enter__(self):
def __enter__(self) -> "_BitBangIO":
return self

def __exit__(self, exc_type, exc_value, traceback) -> None:
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_value: Optional[BaseException],
traceback: Optional[TracebackType],
) -> None:
self.deinit()

# pylint: disable=no-self-use
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# SPDX-License-Identifier: Unlicense

Adafruit-Blinka
typing-extensions
typing-extensions~=4.0

0 comments on commit f6fdb48

Please sign in to comment.