From 846dd9b9ce75a1a50a0f2deffd0f6630ffba5207 Mon Sep 17 00:00:00 2001 From: donBarbos Date: Mon, 7 Apr 2025 16:02:14 +0400 Subject: [PATCH 1/4] Bump `auth0-python` to 4.9.* --- stubs/auth0-python/METADATA.toml | 4 ++-- .../authentication/async_token_verifier.pyi | 8 +++----- .../auth0/authentication/base.pyi | 17 +++++++++-------- .../auth0/authentication/get_token.pyi | 8 ++++++++ .../auth0/authentication/token_verifier.pyi | 6 +++--- .../auth0/authentication/users.pyi | 6 +++--- stubs/auth0-python/auth0/exceptions.pyi | 10 +++++----- stubs/auth0-python/auth0/management/users.pyi | 2 ++ stubs/auth0-python/auth0/rest.pyi | 19 ++++++++++--------- stubs/auth0-python/auth0/rest_async.pyi | 13 +++++++------ 10 files changed, 52 insertions(+), 41 deletions(-) diff --git a/stubs/auth0-python/METADATA.toml b/stubs/auth0-python/METADATA.toml index 86faedcae1e1..bd6685643edb 100644 --- a/stubs/auth0-python/METADATA.toml +++ b/stubs/auth0-python/METADATA.toml @@ -1,3 +1,3 @@ -version = "4.8.*" +version = "4.9.*" upstream_repository = "https://github.com/auth0/auth0-python" -requires = ["cryptography", "types-requests"] +requires = ["cryptography", "types-requests", "aiohttp"] diff --git a/stubs/auth0-python/auth0/authentication/async_token_verifier.pyi b/stubs/auth0-python/auth0/authentication/async_token_verifier.pyi index a65856b039d0..3880c4a6c7e2 100644 --- a/stubs/auth0-python/auth0/authentication/async_token_verifier.pyi +++ b/stubs/auth0-python/auth0/authentication/async_token_verifier.pyi @@ -1,5 +1,3 @@ -from _typeshed import Incomplete - from .. import TokenValidationError as TokenValidationError from ..rest_async import AsyncRestClient as AsyncRestClient from .token_verifier import ( @@ -18,9 +16,9 @@ class AsyncJwksFetcher(JwksFetcher): async def get_key(self, key_id: str): ... class AsyncTokenVerifier(TokenVerifier): - iss: Incomplete - aud: Incomplete - leeway: Incomplete + iss: str + aud: str + leeway: int def __init__( self, signature_verifier: AsyncAsymmetricSignatureVerifier, issuer: str, audience: str, leeway: int = 0 ) -> None: ... diff --git a/stubs/auth0-python/auth0/authentication/base.pyi b/stubs/auth0-python/auth0/authentication/base.pyi index e67c3c414e00..30c6021462cf 100644 --- a/stubs/auth0-python/auth0/authentication/base.pyi +++ b/stubs/auth0-python/auth0/authentication/base.pyi @@ -1,20 +1,21 @@ from _typeshed import Incomplete +from typing import Final from auth0.rest import RestClient as RestClient, RestClientOptions as RestClientOptions from auth0.types import RequestData as RequestData from .client_authentication import add_client_authentication as add_client_authentication -UNKNOWN_ERROR: str +UNKNOWN_ERROR: Final[str] class AuthenticationBase: - domain: Incomplete - client_id: Incomplete - client_secret: Incomplete - client_assertion_signing_key: Incomplete - client_assertion_signing_alg: Incomplete - protocol: Incomplete - client: Incomplete + domain: str + client_id: str + client_secret: str | None + client_assertion_signing_key: str | None + client_assertion_signing_alg: str | None + protocol: str + client: RestClient def __init__( self, domain: str, diff --git a/stubs/auth0-python/auth0/authentication/get_token.pyi b/stubs/auth0-python/auth0/authentication/get_token.pyi index 64457306c40f..02590cf34a17 100644 --- a/stubs/auth0-python/auth0/authentication/get_token.pyi +++ b/stubs/auth0-python/auth0/authentication/get_token.pyi @@ -19,3 +19,11 @@ class GetToken(AuthenticationBase): def refresh_token(self, refresh_token: str, scope: str = "", grant_type: str = "refresh_token"): ... def passwordless_login(self, username: str, otp: str, realm: str, scope: str, audience: str): ... def backchannel_login(self, auth_req_id: str, grant_type: str = "urn:openid:params:grant-type:ciba"): ... + def access_token_for_connection( + self, + subject_token_type: str, + subject_token: str, + requested_token_type: str, + connection: str | None = None, + grant_type: str = ..., + ): ... diff --git a/stubs/auth0-python/auth0/authentication/token_verifier.pyi b/stubs/auth0-python/auth0/authentication/token_verifier.pyi index c8c38ca3b0db..171e55501f9b 100644 --- a/stubs/auth0-python/auth0/authentication/token_verifier.pyi +++ b/stubs/auth0-python/auth0/authentication/token_verifier.pyi @@ -20,9 +20,9 @@ class AsymmetricSignatureVerifier(SignatureVerifier): def __init__(self, jwks_url: str, algorithm: str = "RS256", cache_ttl: int = ...) -> None: ... class TokenVerifier: - iss: Incomplete - aud: Incomplete - leeway: Incomplete + iss: str + aud: str + leeway: int def __init__(self, signature_verifier: SignatureVerifier, issuer: str, audience: str, leeway: int = 0) -> None: ... def verify( self, token: str, nonce: str | None = None, max_age: int | None = None, organization: str | None = None diff --git a/stubs/auth0-python/auth0/authentication/users.pyi b/stubs/auth0-python/auth0/authentication/users.pyi index c5a15db5221b..c986cbc2fcae 100644 --- a/stubs/auth0-python/auth0/authentication/users.pyi +++ b/stubs/auth0-python/auth0/authentication/users.pyi @@ -4,8 +4,8 @@ from auth0.rest import RestClient as RestClient, RestClientOptions as RestClient from auth0.types import TimeoutType as TimeoutType class Users: - domain: Incomplete - protocol: Incomplete - client: Incomplete + domain: str + protocol: str + client: RestClient def __init__(self, domain: str, telemetry: bool = True, timeout: TimeoutType = 5.0, protocol: str = "https") -> None: ... def userinfo(self, access_token: str) -> dict[str, Incomplete]: ... diff --git a/stubs/auth0-python/auth0/exceptions.pyi b/stubs/auth0-python/auth0/exceptions.pyi index f500aad795bc..22a62ca6d727 100644 --- a/stubs/auth0-python/auth0/exceptions.pyi +++ b/stubs/auth0-python/auth0/exceptions.pyi @@ -1,14 +1,14 @@ from _typeshed import Incomplete class Auth0Error(Exception): - status_code: Incomplete - error_code: Incomplete - message: Incomplete - content: Incomplete + status_code: int + error_code: str + message: str + content: Incomplete | None def __init__(self, status_code: int, error_code: str, message: str, content: Incomplete | None = None) -> None: ... class RateLimitError(Auth0Error): - reset_at: Incomplete + reset_at: int def __init__(self, error_code: str, message: str, reset_at: int) -> None: ... class TokenValidationError(Exception): ... diff --git a/stubs/auth0-python/auth0/management/users.pyi b/stubs/auth0-python/auth0/management/users.pyi index 6ba1283d69cf..e2e159b5755f 100644 --- a/stubs/auth0-python/auth0/management/users.pyi +++ b/stubs/auth0-python/auth0/management/users.pyi @@ -115,3 +115,5 @@ class Users: async def delete_authentication_methods_async(self, user_id: str): ... def delete_authentication_method_by_id(self, user_id: str, authentication_method_id: str): ... async def delete_authentication_method_by_id_async(self, user_id: str, authentication_method_id: str): ... + def list_tokensets(self, id: str, page: int = 0, per_page: int = 25, include_totals: bool = True): ... + def delete_tokenset_by_id(self, user_id: str, tokenset_id: str): ... diff --git a/stubs/auth0-python/auth0/rest.pyi b/stubs/auth0-python/auth0/rest.pyi index 131dd1d75fa1..5b12d48e7713 100644 --- a/stubs/auth0-python/auth0/rest.pyi +++ b/stubs/auth0-python/auth0/rest.pyi @@ -1,25 +1,26 @@ from _typeshed import Incomplete from collections.abc import Mapping +from typing import Final import requests from auth0.exceptions import Auth0Error as Auth0Error, RateLimitError as RateLimitError from auth0.rest_async import RequestsResponse as RequestsResponse from auth0.types import RequestData as RequestData, TimeoutType as TimeoutType -UNKNOWN_ERROR: str +UNKNOWN_ERROR: Final[str] class RestClientOptions: - telemetry: Incomplete - timeout: Incomplete - retries: Incomplete + telemetry: bool + timeout: TimeoutType + retries: int def __init__(self, telemetry: bool = True, timeout: TimeoutType = 5.0, retries: int = 3) -> None: ... class RestClient: - options: Incomplete - jwt: Incomplete - base_headers: Incomplete - telemetry: Incomplete - timeout: Incomplete + options: RestClientOptions + jwt: str | None + base_headers: dict[str, str] + telemetry: bool + timeout: TimeoutType def __init__( self, jwt: str | None, telemetry: bool = True, timeout: TimeoutType = 5.0, options: RestClientOptions | None = None ) -> None: ... diff --git a/stubs/auth0-python/auth0/rest_async.pyi b/stubs/auth0-python/auth0/rest_async.pyi index 7bc59c471611..f5b8855f02b0 100644 --- a/stubs/auth0-python/auth0/rest_async.pyi +++ b/stubs/auth0-python/auth0/rest_async.pyi @@ -1,5 +1,7 @@ from _typeshed import Incomplete +from collections.abc import MutableMapping +import aiohttp from auth0.exceptions import RateLimitError as RateLimitError from auth0.types import RequestData as RequestData @@ -13,8 +15,7 @@ from .rest import ( class AsyncRestClient(RestClient): timeout: Incomplete - def __init__(self, *args, **kwargs) -> None: ... - def set_session(self, session) -> None: ... + def set_session(self, session: aiohttp.ClientSession) -> None: ... async def get(self, url: str, params: dict[str, Incomplete] | None = None, headers: dict[str, str] | None = None): ... async def post(self, url: str, data: RequestData | None = None, headers: dict[str, str] | None = None): ... async def file_post(self, *args, **kwargs): ... @@ -23,7 +24,7 @@ class AsyncRestClient(RestClient): async def delete(self, url: str, params: dict[str, Incomplete] | None = None, data: RequestData | None = None): ... class RequestsResponse: - status_code: Incomplete - headers: Incomplete - text: Incomplete - def __init__(self, response, text: str) -> None: ... + status_code: int + headers: MutableMapping[str, str] + text: str + def __init__(self, response: aiohttp.ClientResponse, text: str) -> None: ... From 9bcb772ea42439cd962a78ec6376c3e8aaa581d4 Mon Sep 17 00:00:00 2001 From: donBarbos Date: Mon, 7 Apr 2025 16:13:29 +0400 Subject: [PATCH 2/4] Revert "Adding aiohttp" --- stubs/auth0-python/METADATA.toml | 2 +- stubs/auth0-python/auth0/rest_async.pyi | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/stubs/auth0-python/METADATA.toml b/stubs/auth0-python/METADATA.toml index bd6685643edb..8ef32734a656 100644 --- a/stubs/auth0-python/METADATA.toml +++ b/stubs/auth0-python/METADATA.toml @@ -1,3 +1,3 @@ version = "4.9.*" upstream_repository = "https://github.com/auth0/auth0-python" -requires = ["cryptography", "types-requests", "aiohttp"] +requires = ["cryptography", "types-requests"] diff --git a/stubs/auth0-python/auth0/rest_async.pyi b/stubs/auth0-python/auth0/rest_async.pyi index f5b8855f02b0..f5dc4ad433ea 100644 --- a/stubs/auth0-python/auth0/rest_async.pyi +++ b/stubs/auth0-python/auth0/rest_async.pyi @@ -1,7 +1,6 @@ from _typeshed import Incomplete from collections.abc import MutableMapping -import aiohttp from auth0.exceptions import RateLimitError as RateLimitError from auth0.types import RequestData as RequestData @@ -15,7 +14,7 @@ from .rest import ( class AsyncRestClient(RestClient): timeout: Incomplete - def set_session(self, session: aiohttp.ClientSession) -> None: ... + def set_session(self, session) -> None: ... async def get(self, url: str, params: dict[str, Incomplete] | None = None, headers: dict[str, str] | None = None): ... async def post(self, url: str, data: RequestData | None = None, headers: dict[str, str] | None = None): ... async def file_post(self, *args, **kwargs): ... @@ -27,4 +26,4 @@ class RequestsResponse: status_code: int headers: MutableMapping[str, str] text: str - def __init__(self, response: aiohttp.ClientResponse, text: str) -> None: ... + def __init__(self, response, text: str) -> None: ... From eaf44ae04678eda82e0efbb574b85971b9ab7672 Mon Sep 17 00:00:00 2001 From: donBarbos Date: Fri, 11 Apr 2025 19:18:30 +0400 Subject: [PATCH 3/4] Use CIMultiDictProxy --- stubs/auth0-python/auth0/rest_async.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stubs/auth0-python/auth0/rest_async.pyi b/stubs/auth0-python/auth0/rest_async.pyi index f5dc4ad433ea..801cf2fd333b 100644 --- a/stubs/auth0-python/auth0/rest_async.pyi +++ b/stubs/auth0-python/auth0/rest_async.pyi @@ -1,8 +1,8 @@ from _typeshed import Incomplete -from collections.abc import MutableMapping from auth0.exceptions import RateLimitError as RateLimitError from auth0.types import RequestData as RequestData +from multidict import CIMultiDictProxy from .rest import ( EmptyResponse as EmptyResponse, @@ -24,6 +24,6 @@ class AsyncRestClient(RestClient): class RequestsResponse: status_code: int - headers: MutableMapping[str, str] + headers: CIMultiDictProxy[str] text: str def __init__(self, response, text: str) -> None: ... From 54e48e4957d347be591cdb040980bceebe44c22a Mon Sep 17 00:00:00 2001 From: donBarbos Date: Fri, 11 Apr 2025 20:16:22 +0400 Subject: [PATCH 4/4] Revert --- stubs/auth0-python/auth0/rest_async.pyi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stubs/auth0-python/auth0/rest_async.pyi b/stubs/auth0-python/auth0/rest_async.pyi index 801cf2fd333b..fec31cd6c515 100644 --- a/stubs/auth0-python/auth0/rest_async.pyi +++ b/stubs/auth0-python/auth0/rest_async.pyi @@ -2,7 +2,6 @@ from _typeshed import Incomplete from auth0.exceptions import RateLimitError as RateLimitError from auth0.types import RequestData as RequestData -from multidict import CIMultiDictProxy from .rest import ( EmptyResponse as EmptyResponse, @@ -24,6 +23,6 @@ class AsyncRestClient(RestClient): class RequestsResponse: status_code: int - headers: CIMultiDictProxy[str] + headers: Incomplete text: str def __init__(self, response, text: str) -> None: ...