mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-06 21:43:59 +08:00
Mark stub-only private symbols as @type_check_only in third-party stubs (#14545)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from _typeshed import Incomplete
|
||||
from logging import Logger
|
||||
from typing import TypedDict
|
||||
from typing import TypedDict, type_check_only
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
import requests
|
||||
@@ -11,6 +11,7 @@ from . import OAuth1
|
||||
# should be dict[str, str] but could look different
|
||||
_ParsedToken: TypeAlias = dict[str, Incomplete]
|
||||
|
||||
@type_check_only
|
||||
class _TokenDict(TypedDict, total=False):
|
||||
oauth_token: Incomplete # oauthlib.oauth1.Client.resource_owner_key
|
||||
oauth_token_secret: Incomplete # oauthlib.oauth1.Client.resource_token_secret
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from _typeshed import Incomplete
|
||||
from logging import Logger
|
||||
from typing import Any, Literal, Protocol, TypedDict, overload
|
||||
from typing import Any, Literal, Protocol, TypedDict, overload, type_check_only
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
import requests
|
||||
@@ -9,15 +9,19 @@ from requests.cookies import RequestsCookieJar
|
||||
|
||||
_Token: TypeAlias = dict[str, Incomplete] # oauthlib.oauth2.Client.token
|
||||
|
||||
@type_check_only
|
||||
class _AccessTokenResponseHook(Protocol):
|
||||
def __call__(self, response: requests.Response, /) -> requests.Response: ...
|
||||
|
||||
@type_check_only
|
||||
class _RefreshTokenResponseHook(Protocol):
|
||||
def __call__(self, response: requests.Response, /) -> requests.Response: ...
|
||||
|
||||
@type_check_only
|
||||
class _ProtectedRequestHook(Protocol):
|
||||
def __call__(self, url, headers, data, /) -> tuple[Incomplete, Incomplete, Incomplete]: ...
|
||||
|
||||
@type_check_only
|
||||
class _ComplianceHooks(TypedDict):
|
||||
access_token_response: set[_AccessTokenResponseHook]
|
||||
refresh_token_response: set[_RefreshTokenResponseHook]
|
||||
|
||||
Reference in New Issue
Block a user