Skip to content

Commit a445222

Browse files
authored
Merge pull request #7 from ktkinsey37/typing
typed dunder init func, imported dependencies for typing
2 parents 488e44f + 2043684 commit a445222

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

adafruit_oauth2.py

+13-8
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
https://github.com/adafruit/circuitpython/releases
2323
2424
"""
25+
try:
26+
from typing import Optional, List
27+
import adafruit_requests
28+
except ImportError:
29+
pass
2530

2631
# imports
2732
import time
@@ -41,7 +46,7 @@ class OAuth2: # pylint: disable=too-many-arguments, too-many-instance-attribute
4146
"""Implements OAuth2.0 authorization to access Google APIs via
4247
the OAuth 2.0 limited-input device application flow.
4348
https://developers.google.com/identity/protocols/oauth2/limited-input-device
44-
:param requests: An adafruit_requests object.
49+
:param adafruit_requests.Session requests: An adafruit_requests object.
4550
:param str client_id: The client ID for your application.
4651
:param str client_secret: The client secret obtained from the API Console.
4752
:param list scopes: Scopes that identify the resources used by the application.
@@ -52,13 +57,13 @@ class OAuth2: # pylint: disable=too-many-arguments, too-many-instance-attribute
5257

5358
def __init__(
5459
self,
55-
requests,
56-
client_id,
57-
client_secret,
58-
scopes,
59-
access_token=None,
60-
refresh_token=None,
61-
):
60+
requests: adafruit_requests.Session,
61+
client_id: str,
62+
client_secret: str,
63+
scopes: List[str],
64+
access_token: Optional[str] = None,
65+
refresh_token: Optional[str] = None,
66+
) -> None:
6267
self._requests = requests
6368
self._client_id = client_id
6469
self._client_secret = client_secret

0 commit comments

Comments
 (0)