Skip to content

Add Missing Type Annotations #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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