diff options
author | Anton Ruhlov <anton@paxful.com> | 2020-04-10 15:12:40 +0300 |
---|---|---|
committer | Anton Ruhlov <anton@paxful.com> | 2020-04-10 15:12:40 +0300 |
commit | 1a1df2280f000b1f2f05b5304150ef7826cc9d24 (patch) | |
tree | e72a18080a4b7f404ed1117d7eaf502eaaf27e1d /oauthlib/oauth2 | |
parent | 809428d597b57215c1bb996ff5f9ca7f57f3aaad (diff) | |
download | oauthlib-1a1df2280f000b1f2f05b5304150ef7826cc9d24.tar.gz |
Sorted oauthlib imports per isort 4.3.21
Diffstat (limited to 'oauthlib/oauth2')
22 files changed, 78 insertions, 80 deletions
diff --git a/oauthlib/oauth2/__init__.py b/oauthlib/oauth2/__init__.py index 9186800..047d8e0 100644 --- a/oauthlib/oauth2/__init__.py +++ b/oauthlib/oauth2/__init__.py @@ -6,29 +6,31 @@ oauthlib.oauth2 This module is a wrapper for the most recent implementation of OAuth 2.0 Client and Server classes. """ -from .rfc6749.clients import Client -from .rfc6749.clients import WebApplicationClient -from .rfc6749.clients import MobileApplicationClient -from .rfc6749.clients import LegacyApplicationClient -from .rfc6749.clients import BackendApplicationClient -from .rfc6749.clients import ServiceApplicationClient -from .rfc6749.endpoints import AuthorizationEndpoint -from .rfc6749.endpoints import IntrospectEndpoint -from .rfc6749.endpoints import MetadataEndpoint -from .rfc6749.endpoints import TokenEndpoint -from .rfc6749.endpoints import ResourceEndpoint -from .rfc6749.endpoints import RevocationEndpoint -from .rfc6749.endpoints import Server -from .rfc6749.endpoints import WebApplicationServer -from .rfc6749.endpoints import MobileApplicationServer -from .rfc6749.endpoints import LegacyApplicationServer -from .rfc6749.endpoints import BackendApplicationServer -from .rfc6749.errors import AccessDeniedError, OAuth2Error, FatalClientError, InsecureTransportError, InvalidClientError, InvalidClientIdError, InvalidGrantError, InvalidRedirectURIError, InvalidRequestError, InvalidRequestFatalError, InvalidScopeError, MismatchingRedirectURIError, MismatchingStateError, MissingClientIdError, MissingCodeError, MissingRedirectURIError, MissingResponseTypeError, MissingTokenError, MissingTokenTypeError, ServerError, TemporarilyUnavailableError, TokenExpiredError, UnauthorizedClientError, UnsupportedGrantTypeError, UnsupportedResponseTypeError, UnsupportedTokenTypeError -from .rfc6749.grant_types import AuthorizationCodeGrant -from .rfc6749.grant_types import ImplicitGrant -from .rfc6749.grant_types import ResourceOwnerPasswordCredentialsGrant -from .rfc6749.grant_types import ClientCredentialsGrant -from .rfc6749.grant_types import RefreshTokenGrant +from .rfc6749.clients import ( + BackendApplicationClient, Client, LegacyApplicationClient, + MobileApplicationClient, ServiceApplicationClient, WebApplicationClient, +) +from .rfc6749.endpoints import ( + AuthorizationEndpoint, BackendApplicationServer, IntrospectEndpoint, + LegacyApplicationServer, MetadataEndpoint, MobileApplicationServer, + ResourceEndpoint, RevocationEndpoint, Server, TokenEndpoint, + WebApplicationServer, +) +from .rfc6749.errors import ( + AccessDeniedError, FatalClientError, InsecureTransportError, + InvalidClientError, InvalidClientIdError, InvalidGrantError, + InvalidRedirectURIError, InvalidRequestError, InvalidRequestFatalError, + InvalidScopeError, MismatchingRedirectURIError, MismatchingStateError, + MissingClientIdError, MissingCodeError, MissingRedirectURIError, + MissingResponseTypeError, MissingTokenError, MissingTokenTypeError, + OAuth2Error, ServerError, TemporarilyUnavailableError, TokenExpiredError, + UnauthorizedClientError, UnsupportedGrantTypeError, + UnsupportedResponseTypeError, UnsupportedTokenTypeError, +) +from .rfc6749.grant_types import ( + AuthorizationCodeGrant, ClientCredentialsGrant, ImplicitGrant, + RefreshTokenGrant, ResourceOwnerPasswordCredentialsGrant, +) from .rfc6749.request_validator import RequestValidator from .rfc6749.tokens import BearerToken, OAuth2Token from .rfc6749.utils import is_secure_transport diff --git a/oauthlib/oauth2/rfc6749/__init__.py b/oauthlib/oauth2/rfc6749/__init__.py index 1c11234..1823e9e 100644 --- a/oauthlib/oauth2/rfc6749/__init__.py +++ b/oauthlib/oauth2/rfc6749/__init__.py @@ -9,10 +9,9 @@ for consuming and providing OAuth 2.0 RFC6749. import functools import logging -from .endpoints.base import BaseEndpoint -from .endpoints.base import catch_errors_and_unavailability -from .errors import TemporarilyUnavailableError, ServerError -from .errors import FatalClientError, OAuth2Error - +from .endpoints.base import BaseEndpoint, catch_errors_and_unavailability +from .errors import ( + FatalClientError, OAuth2Error, ServerError, TemporarilyUnavailableError, +) log = logging.getLogger(__name__) diff --git a/oauthlib/oauth2/rfc6749/clients/__init__.py b/oauthlib/oauth2/rfc6749/clients/__init__.py index 6fef738..8fc6c95 100644 --- a/oauthlib/oauth2/rfc6749/clients/__init__.py +++ b/oauthlib/oauth2/rfc6749/clients/__init__.py @@ -6,9 +6,9 @@ oauthlib.oauth2.rfc6749 This module is an implementation of various logic needed for consuming OAuth 2.0 RFC6749. """ -from .base import Client, AUTH_HEADER, URI_QUERY, BODY -from .web_application import WebApplicationClient -from .mobile_application import MobileApplicationClient -from .legacy_application import LegacyApplicationClient from .backend_application import BackendApplicationClient +from .base import AUTH_HEADER, BODY, URI_QUERY, Client +from .legacy_application import LegacyApplicationClient +from .mobile_application import MobileApplicationClient from .service_application import ServiceApplicationClient +from .web_application import WebApplicationClient diff --git a/oauthlib/oauth2/rfc6749/clients/backend_application.py b/oauthlib/oauth2/rfc6749/clients/backend_application.py index 5ffe6ae..0e2a829 100644 --- a/oauthlib/oauth2/rfc6749/clients/backend_application.py +++ b/oauthlib/oauth2/rfc6749/clients/backend_application.py @@ -6,7 +6,7 @@ oauthlib.oauth2.rfc6749 This module is an implementation of various logic needed for consuming and providing OAuth 2.0 RFC6749. """ -from ..parameters import parse_token_response, prepare_token_request +from ..parameters import prepare_token_request from .base import Client diff --git a/oauthlib/oauth2/rfc6749/clients/base.py b/oauthlib/oauth2/rfc6749/clients/base.py index 04dabe6..4147140 100644 --- a/oauthlib/oauth2/rfc6749/clients/base.py +++ b/oauthlib/oauth2/rfc6749/clients/base.py @@ -11,11 +11,13 @@ import warnings from oauthlib.common import generate_token from oauthlib.oauth2.rfc6749 import tokens -from oauthlib.oauth2.rfc6749.errors import (InsecureTransportError, - TokenExpiredError) -from oauthlib.oauth2.rfc6749.parameters import (parse_token_response, - prepare_token_request, - prepare_token_revocation_request) +from oauthlib.oauth2.rfc6749.errors import ( + InsecureTransportError, TokenExpiredError, +) +from oauthlib.oauth2.rfc6749.parameters import ( + parse_token_response, prepare_token_request, + prepare_token_revocation_request, +) from oauthlib.oauth2.rfc6749.utils import is_secure_transport AUTH_HEADER = 'auth_header' diff --git a/oauthlib/oauth2/rfc6749/clients/legacy_application.py b/oauthlib/oauth2/rfc6749/clients/legacy_application.py index 1bb0e14..51ba28c 100644 --- a/oauthlib/oauth2/rfc6749/clients/legacy_application.py +++ b/oauthlib/oauth2/rfc6749/clients/legacy_application.py @@ -6,7 +6,7 @@ oauthlib.oauth2.rfc6749 This module is an implementation of various logic needed for consuming and providing OAuth 2.0 RFC6749. """ -from ..parameters import parse_token_response, prepare_token_request +from ..parameters import prepare_token_request from .base import Client diff --git a/oauthlib/oauth2/rfc6749/clients/service_application.py b/oauthlib/oauth2/rfc6749/clients/service_application.py index 09fc7ba..79ac48d 100644 --- a/oauthlib/oauth2/rfc6749/clients/service_application.py +++ b/oauthlib/oauth2/rfc6749/clients/service_application.py @@ -10,7 +10,7 @@ import time from oauthlib.common import to_unicode -from ..parameters import parse_token_response, prepare_token_request +from ..parameters import prepare_token_request from .base import Client diff --git a/oauthlib/oauth2/rfc6749/clients/web_application.py b/oauthlib/oauth2/rfc6749/clients/web_application.py index aedc9d1..14026e3 100644 --- a/oauthlib/oauth2/rfc6749/clients/web_application.py +++ b/oauthlib/oauth2/rfc6749/clients/web_application.py @@ -8,9 +8,10 @@ for consuming and providing OAuth 2.0 RFC6749. """ import warnings -from ..parameters import (parse_authorization_code_response, - parse_token_response, prepare_grant_uri, - prepare_token_request) +from ..parameters import ( + parse_authorization_code_response, prepare_grant_uri, + prepare_token_request, +) from .base import Client diff --git a/oauthlib/oauth2/rfc6749/endpoints/__init__.py b/oauthlib/oauth2/rfc6749/endpoints/__init__.py index 49e7ee9..851853f 100644 --- a/oauthlib/oauth2/rfc6749/endpoints/__init__.py +++ b/oauthlib/oauth2/rfc6749/endpoints/__init__.py @@ -9,11 +9,10 @@ for consuming and providing OAuth 2.0 RFC6749. from .authorization import AuthorizationEndpoint from .introspect import IntrospectEndpoint from .metadata import MetadataEndpoint -from .token import TokenEndpoint +from .pre_configured import ( + BackendApplicationServer, LegacyApplicationServer, MobileApplicationServer, + Server, WebApplicationServer, +) from .resource import ResourceEndpoint from .revocation import RevocationEndpoint -from .pre_configured import Server -from .pre_configured import WebApplicationServer -from .pre_configured import MobileApplicationServer -from .pre_configured import LegacyApplicationServer -from .pre_configured import BackendApplicationServer +from .token import TokenEndpoint diff --git a/oauthlib/oauth2/rfc6749/endpoints/base.py b/oauthlib/oauth2/rfc6749/endpoints/base.py index 5169517..e59d401 100644 --- a/oauthlib/oauth2/rfc6749/endpoints/base.py +++ b/oauthlib/oauth2/rfc6749/endpoints/base.py @@ -9,11 +9,10 @@ for consuming and providing OAuth 2.0 RFC6749. import functools import logging -from ..errors import (FatalClientError, OAuth2Error, ServerError, - TemporarilyUnavailableError, InvalidRequestError, - InvalidClientError, UnsupportedTokenTypeError) - -from oauthlib.common import CaseInsensitiveDict, urldecode +from ..errors import ( + FatalClientError, InvalidClientError, InvalidRequestError, OAuth2Error, + ServerError, TemporarilyUnavailableError, UnsupportedTokenTypeError, +) log = logging.getLogger(__name__) diff --git a/oauthlib/oauth2/rfc6749/endpoints/introspect.py b/oauthlib/oauth2/rfc6749/endpoints/introspect.py index bad8950..1199031 100644 --- a/oauthlib/oauth2/rfc6749/endpoints/introspect.py +++ b/oauthlib/oauth2/rfc6749/endpoints/introspect.py @@ -12,7 +12,7 @@ import logging from oauthlib.common import Request -from ..errors import OAuth2Error, UnsupportedTokenTypeError +from ..errors import OAuth2Error from .base import BaseEndpoint, catch_errors_and_unavailability log = logging.getLogger(__name__) diff --git a/oauthlib/oauth2/rfc6749/endpoints/metadata.py b/oauthlib/oauth2/rfc6749/endpoints/metadata.py index 6bc078d..815f4b0 100644 --- a/oauthlib/oauth2/rfc6749/endpoints/metadata.py +++ b/oauthlib/oauth2/rfc6749/endpoints/metadata.py @@ -11,13 +11,12 @@ import copy import json import logging -from .base import BaseEndpoint, catch_errors_and_unavailability +from .. import grant_types from .authorization import AuthorizationEndpoint +from .base import BaseEndpoint, catch_errors_and_unavailability from .introspect import IntrospectEndpoint -from .token import TokenEndpoint from .revocation import RevocationEndpoint -from .. import grant_types - +from .token import TokenEndpoint log = logging.getLogger(__name__) diff --git a/oauthlib/oauth2/rfc6749/endpoints/pre_configured.py b/oauthlib/oauth2/rfc6749/endpoints/pre_configured.py index 7b17dc4..0130f9e 100644 --- a/oauthlib/oauth2/rfc6749/endpoints/pre_configured.py +++ b/oauthlib/oauth2/rfc6749/endpoints/pre_configured.py @@ -6,11 +6,10 @@ oauthlib.oauth2.rfc6749.endpoints.pre_configured This module is an implementation of various endpoints needed for providing OAuth 2.0 RFC6749 servers. """ -from ..grant_types import (AuthorizationCodeGrant, - ClientCredentialsGrant, - ImplicitGrant, - RefreshTokenGrant, - ResourceOwnerPasswordCredentialsGrant) +from ..grant_types import ( + AuthorizationCodeGrant, ClientCredentialsGrant, ImplicitGrant, + RefreshTokenGrant, ResourceOwnerPasswordCredentialsGrant, +) from ..tokens import BearerToken from .authorization import AuthorizationEndpoint from .introspect import IntrospectEndpoint diff --git a/oauthlib/oauth2/rfc6749/endpoints/revocation.py b/oauthlib/oauth2/rfc6749/endpoints/revocation.py index ed245f3..0eb25d3 100644 --- a/oauthlib/oauth2/rfc6749/endpoints/revocation.py +++ b/oauthlib/oauth2/rfc6749/endpoints/revocation.py @@ -11,7 +11,7 @@ import logging from oauthlib.common import Request -from ..errors import OAuth2Error, UnsupportedTokenTypeError +from ..errors import OAuth2Error from .base import BaseEndpoint, catch_errors_and_unavailability log = logging.getLogger(__name__) diff --git a/oauthlib/oauth2/rfc6749/grant_types/__init__.py b/oauthlib/oauth2/rfc6749/grant_types/__init__.py index 30c90d7..195cd09 100644 --- a/oauthlib/oauth2/rfc6749/grant_types/__init__.py +++ b/oauthlib/oauth2/rfc6749/grant_types/__init__.py @@ -4,7 +4,9 @@ oauthlib.oauth2.rfc6749.grant_types ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ """ from .authorization_code import AuthorizationCodeGrant -from .implicit import ImplicitGrant -from .resource_owner_password_credentials import ResourceOwnerPasswordCredentialsGrant from .client_credentials import ClientCredentialsGrant +from .implicit import ImplicitGrant from .refresh_token import RefreshTokenGrant +from .resource_owner_password_credentials import ( + ResourceOwnerPasswordCredentialsGrant, +) diff --git a/oauthlib/oauth2/rfc6749/grant_types/base.py b/oauthlib/oauth2/rfc6749/grant_types/base.py index 66e1fd1..51ba81b 100644 --- a/oauthlib/oauth2/rfc6749/grant_types/base.py +++ b/oauthlib/oauth2/rfc6749/grant_types/base.py @@ -7,8 +7,8 @@ import logging from itertools import chain from oauthlib.common import add_params_to_uri -from oauthlib.uri_validate import is_absolute_uri from oauthlib.oauth2.rfc6749 import errors, utils +from oauthlib.uri_validate import is_absolute_uri from ..request_validator import RequestValidator diff --git a/oauthlib/oauth2/rfc6749/grant_types/client_credentials.py b/oauthlib/oauth2/rfc6749/grant_types/client_credentials.py index 05f13af..d2c0ea4 100644 --- a/oauthlib/oauth2/rfc6749/grant_types/client_credentials.py +++ b/oauthlib/oauth2/rfc6749/grant_types/client_credentials.py @@ -7,7 +7,6 @@ import json import logging from .. import errors -from ..request_validator import RequestValidator from .base import GrantTypeBase log = logging.getLogger(__name__) diff --git a/oauthlib/oauth2/rfc6749/grant_types/refresh_token.py b/oauthlib/oauth2/rfc6749/grant_types/refresh_token.py index e7405d2..cc0ad0d 100644 --- a/oauthlib/oauth2/rfc6749/grant_types/refresh_token.py +++ b/oauthlib/oauth2/rfc6749/grant_types/refresh_token.py @@ -7,7 +7,6 @@ import json import logging from .. import errors, utils -from ..request_validator import RequestValidator from .base import GrantTypeBase log = logging.getLogger(__name__) diff --git a/oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py b/oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py index 9c8ee1d..b65b3e7 100644 --- a/oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py +++ b/oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py @@ -7,7 +7,6 @@ import json import logging from .. import errors -from ..request_validator import RequestValidator from .base import GrantTypeBase log = logging.getLogger(__name__) diff --git a/oauthlib/oauth2/rfc6749/parameters.py b/oauthlib/oauth2/rfc6749/parameters.py index 54c8d24..b5d5f41 100644 --- a/oauthlib/oauth2/rfc6749/parameters.py +++ b/oauthlib/oauth2/rfc6749/parameters.py @@ -10,14 +10,15 @@ This module contains methods related to `Section 4`_ of the OAuth 2 RFC. import json import os import time +import urllib.parse as urlparse from oauthlib.common import add_params_to_qs, add_params_to_uri from oauthlib.signals import scope_changed -import urllib.parse as urlparse -from .errors import (InsecureTransportError, MismatchingStateError, - MissingCodeError, MissingTokenError, - MissingTokenTypeError, raise_from_error) +from .errors import ( + InsecureTransportError, MismatchingStateError, MissingCodeError, + MissingTokenError, MissingTokenTypeError, raise_from_error, +) from .tokens import OAuth2Token from .utils import is_secure_transport, list_to_scope, scope_to_list diff --git a/oauthlib/oauth2/rfc6749/tokens.py b/oauthlib/oauth2/rfc6749/tokens.py index 6f6b1f6..6284248 100644 --- a/oauthlib/oauth2/rfc6749/tokens.py +++ b/oauthlib/oauth2/rfc6749/tokens.py @@ -9,17 +9,16 @@ This module contains methods for adding two types of access tokens to requests. """ import hashlib import hmac -from binascii import b2a_base64 import warnings +from binascii import b2a_base64 +from urllib.parse import urlparse from oauthlib import common from oauthlib.common import add_params_to_qs, add_params_to_uri -from urllib.parse import urlparse from . import utils - class OAuth2Token(dict): def __init__(self, params, old_scope=None): diff --git a/oauthlib/oauth2/rfc6749/utils.py b/oauthlib/oauth2/rfc6749/utils.py index 3117d4b..f7f2ab4 100644 --- a/oauthlib/oauth2/rfc6749/utils.py +++ b/oauthlib/oauth2/rfc6749/utils.py @@ -7,10 +7,9 @@ This module contains utility methods used by various parts of the OAuth 2 spec. """ import datetime import os +from urllib.parse import quote, urlparse from oauthlib.common import urldecode -from urllib.parse import quote -from urllib.parse import urlparse def list_to_scope(scope): |