Skip to content

Commit 26380ee

Browse files
authored
[oauthlib] Use Incomplete instead of Any (#15547)
1 parent d28d112 commit 26380ee

File tree

8 files changed

+68
-40
lines changed

8 files changed

+68
-40
lines changed

stubs/oauthlib/oauthlib/common.pyi

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,36 @@ class Request:
6767
decoded_body: list[tuple[str, str]] | None
6868
oauth_params: list[str]
6969
validator_log: dict[str, Any] # value type depends on the key
70+
access_token: Incomplete | None
71+
client: Incomplete | None
72+
client_id: Incomplete | None
73+
client_secret: Incomplete | None
74+
code: Incomplete | None
75+
code_challenge: Incomplete | None
76+
code_challenge_method: Incomplete | None
77+
code_verifier: Incomplete | None
78+
extra_credentials: Incomplete | None
79+
grant_type: Incomplete | None
80+
redirect_uri: Incomplete | None
81+
refresh_token: Incomplete | None
82+
request_token: Incomplete | None
83+
response_type: Incomplete | None
84+
scope: Incomplete | None
85+
scopes: Incomplete | None
86+
state: Incomplete | None
87+
token: Incomplete | None
88+
user: Incomplete | None
89+
token_type_hint: Incomplete | None
90+
response_mode: Incomplete | None
91+
nonce: Incomplete | None
92+
display: Incomplete | None
93+
prompt: Incomplete | None
94+
claims: Incomplete | None
95+
max_age: Incomplete | None
96+
ui_locales: Incomplete | None
97+
id_token_hint: Incomplete | None
98+
login_hint: Incomplete | None
99+
acr_values: Incomplete | None
70100
def __init__(
71101
self,
72102
uri: str,

stubs/oauthlib/oauthlib/oauth1/rfc5849/__init__.pyi

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from _typeshed import Incomplete
22
from collections.abc import Callable, Mapping
33
from logging import Logger
4-
from typing import Any, Final
4+
from typing import Final
55

66
from oauthlib.common import _HTTPMethod
77

@@ -25,20 +25,20 @@ class Client:
2525
SIGNATURE_METHODS: dict[str, Callable[[str, Incomplete], str]]
2626
@classmethod
2727
def register_signature_method(cls, method_name, method_callback) -> None: ...
28-
client_key: Any
29-
client_secret: Any
30-
resource_owner_key: Any
31-
resource_owner_secret: Any
32-
signature_method: Any
33-
signature_type: Any
34-
callback_uri: Any
35-
rsa_key: Any
36-
verifier: Any
37-
realm: Any
38-
encoding: Any
39-
decoding: Any
40-
nonce: Any
41-
timestamp: Any
28+
client_key: Incomplete
29+
client_secret: Incomplete
30+
resource_owner_key: Incomplete
31+
resource_owner_secret: Incomplete
32+
signature_method: Incomplete
33+
signature_type: Incomplete
34+
callback_uri: Incomplete
35+
rsa_key: Incomplete
36+
verifier: Incomplete
37+
realm: Incomplete
38+
encoding: Incomplete
39+
decoding: Incomplete
40+
nonce: Incomplete
41+
timestamp: Incomplete
4242
def __init__(
4343
self,
4444
client_key: str,
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from typing import Any
1+
from _typeshed import Incomplete
22

33
class BaseEndpoint:
4-
request_validator: Any
5-
token_generator: Any
4+
request_validator: Incomplete
5+
token_generator: Incomplete
66
def __init__(self, request_validator, token_generator=None) -> None: ...

stubs/oauthlib/oauthlib/oauth1/rfc5849/errors.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
from typing import Any
1+
from _typeshed import Incomplete
22

33
class OAuth1Error(Exception):
4-
error: Any
4+
error: Incomplete
55
description: str
6-
uri: Any
7-
status_code: Any
6+
uri: Incomplete
7+
status_code: Incomplete
88
def __init__(self, description=None, uri=None, status_code: int = 400, request=None) -> None: ...
99
def in_uri(self, uri): ...
1010
@property
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from _typeshed import Incomplete
2-
3-
def prepare_headers(params, headers: Incomplete | None = ..., realm: Incomplete | None = ...): ...
1+
def prepare_headers(params, headers=None, realm=None): ...
42
def prepare_form_encoded_body(oauth_params, body): ...
53
def prepare_request_uri_query(oauth_params, uri): ...

stubs/oauthlib/oauthlib/oauth1/rfc5849/utils.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
from collections.abc import Callable, Iterable
2-
from typing import Any, Final, TypeVar
2+
from typing import Final, TypeVar
33

44
_T = TypeVar("_T")
55

66
UNICODE_ASCII_CHARACTER_SET: Final[str]
77

88
def filter_params(
9-
target: Callable[[dict[str, Any] | Iterable[tuple[str, Any]], _T], object],
9+
target: Callable[[dict[str, object] | Iterable[tuple[str, object]], _T], object],
1010
) -> Callable[[list[str], _T], object]: ...
1111
def filter_oauth_params(
12-
params: dict[str, Any] | Iterable[tuple[str, Any]],
13-
) -> list[str]: ... # we don't care about second (Any) part
12+
params: dict[str, object] | Iterable[tuple[str, object]],
13+
) -> list[str]: ... # we don't care about second (object) part
1414
def escape(u: str) -> str: ...
1515
def unescape(u: str) -> str: ...
1616
def parse_keqv_list(l: list[str]) -> dict[str, str]: ...

stubs/oauthlib/oauthlib/oauth2/rfc6749/errors.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from _typeshed import Incomplete
2-
from typing import Any, NoReturn
2+
from typing import NoReturn
33

44
from oauthlib.common import Request
55

@@ -11,7 +11,7 @@ class OAuth2Error(Exception):
1111
state: str | None
1212
redirect_uri: str | None
1313
client_id: str | None
14-
scopes: Any
14+
scopes: Incomplete | None
1515
response_type: str | None
1616
response_mode: str | None
1717
grant_type: str | None
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any
1+
from _typeshed import Incomplete
22

33
signals_available: bool
44

@@ -7,14 +7,14 @@ class Namespace:
77

88
class _FakeSignal:
99
name: str
10-
__doc__: Any
10+
__doc__: str | None
1111
def __init__(self, name: str, doc: str | None = None) -> None: ...
12-
send: Any
13-
connect: Any
14-
disconnect: Any
15-
has_receivers_for: Any
16-
receivers_for: Any
17-
temporarily_connected_to: Any
18-
connected_to: Any
12+
send: Incomplete
13+
connect: Incomplete
14+
disconnect: Incomplete
15+
has_receivers_for: Incomplete
16+
receivers_for: Incomplete
17+
temporarily_connected_to: Incomplete
18+
connected_to: Incomplete
1919

2020
scope_changed: _FakeSignal

0 commit comments

Comments
 (0)