summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Ruhlov <anton@paxful.com>2020-04-10 15:12:40 +0300
committerAnton Ruhlov <anton@paxful.com>2020-04-10 15:12:40 +0300
commit1a1df2280f000b1f2f05b5304150ef7826cc9d24 (patch)
treee72a18080a4b7f404ed1117d7eaf502eaaf27e1d
parent809428d597b57215c1bb996ff5f9ca7f57f3aaad (diff)
downloadoauthlib-1a1df2280f000b1f2f05b5304150ef7826cc9d24.tar.gz
Sorted oauthlib imports per isort 4.3.21
-rw-r--r--Makefile3
-rw-r--r--oauthlib/common.py7
-rw-r--r--oauthlib/oauth1/__init__.py21
-rw-r--r--oauthlib/oauth1/rfc5849/__init__.py12
-rw-r--r--oauthlib/oauth1/rfc5849/endpoints/__init__.py6
-rw-r--r--oauthlib/oauth1/rfc5849/endpoints/authorization.py3
-rw-r--r--oauthlib/oauth1/rfc5849/endpoints/base.py8
-rw-r--r--oauthlib/oauth1/rfc5849/endpoints/pre_configured.py6
-rw-r--r--oauthlib/oauth1/rfc5849/parameters.py4
-rw-r--r--oauthlib/oauth1/rfc5849/request_validator.py2
-rw-r--r--oauthlib/oauth1/rfc5849/signature.py3
-rw-r--r--oauthlib/oauth1/rfc5849/utils.py3
-rw-r--r--oauthlib/oauth2/__init__.py48
-rw-r--r--oauthlib/oauth2/rfc6749/__init__.py9
-rw-r--r--oauthlib/oauth2/rfc6749/clients/__init__.py8
-rw-r--r--oauthlib/oauth2/rfc6749/clients/backend_application.py2
-rw-r--r--oauthlib/oauth2/rfc6749/clients/base.py12
-rw-r--r--oauthlib/oauth2/rfc6749/clients/legacy_application.py2
-rw-r--r--oauthlib/oauth2/rfc6749/clients/service_application.py2
-rw-r--r--oauthlib/oauth2/rfc6749/clients/web_application.py7
-rw-r--r--oauthlib/oauth2/rfc6749/endpoints/__init__.py11
-rw-r--r--oauthlib/oauth2/rfc6749/endpoints/base.py9
-rw-r--r--oauthlib/oauth2/rfc6749/endpoints/introspect.py2
-rw-r--r--oauthlib/oauth2/rfc6749/endpoints/metadata.py7
-rw-r--r--oauthlib/oauth2/rfc6749/endpoints/pre_configured.py9
-rw-r--r--oauthlib/oauth2/rfc6749/endpoints/revocation.py2
-rw-r--r--oauthlib/oauth2/rfc6749/grant_types/__init__.py6
-rw-r--r--oauthlib/oauth2/rfc6749/grant_types/base.py2
-rw-r--r--oauthlib/oauth2/rfc6749/grant_types/client_credentials.py1
-rw-r--r--oauthlib/oauth2/rfc6749/grant_types/refresh_token.py1
-rw-r--r--oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py1
-rw-r--r--oauthlib/oauth2/rfc6749/parameters.py9
-rw-r--r--oauthlib/oauth2/rfc6749/tokens.py5
-rw-r--r--oauthlib/oauth2/rfc6749/utils.py3
-rw-r--r--oauthlib/openid/__init__.py3
-rw-r--r--oauthlib/openid/connect/core/endpoints/pre_configured.py23
-rw-r--r--oauthlib/openid/connect/core/endpoints/userinfo.py8
-rw-r--r--oauthlib/openid/connect/core/grant_types/__init__.py9
-rw-r--r--oauthlib/openid/connect/core/grant_types/authorization_code.py4
-rw-r--r--oauthlib/openid/connect/core/grant_types/base.py8
-rw-r--r--oauthlib/openid/connect/core/grant_types/dispatchers.py1
-rw-r--r--oauthlib/openid/connect/core/grant_types/hybrid.py6
-rw-r--r--oauthlib/openid/connect/core/grant_types/implicit.py8
-rw-r--r--oauthlib/openid/connect/core/request_validator.py4
44 files changed, 161 insertions, 149 deletions
diff --git a/Makefile b/Makefile
index aff928b..b1fbb39 100644
--- a/Makefile
+++ b/Makefile
@@ -37,6 +37,9 @@ clean-build:
format fmt:
isort --recursive oauthlib tests
+lint:
+ isort --recursive --check-only --diff oauthlib tests
+
test:
tox
diff --git a/oauthlib/common.py b/oauthlib/common.py
index e7131df..e8ac1ae 100644
--- a/oauthlib/common.py
+++ b/oauthlib/common.py
@@ -12,10 +12,11 @@ import logging
import re
import time
import urllib.parse as urlparse
+from urllib.parse import (
+ quote as _quote, unquote as _unquote, urlencode as _urlencode,
+)
+
from . import get_debug
-from urllib.parse import quote as _quote
-from urllib.parse import unquote as _unquote
-from urllib.parse import urlencode as _urlencode
try:
from secrets import randbits
diff --git a/oauthlib/oauth1/__init__.py b/oauthlib/oauth1/__init__.py
index e6d8a80..f011c2c 100644
--- a/oauthlib/oauth1/__init__.py
+++ b/oauthlib/oauth1/__init__.py
@@ -6,12 +6,17 @@ oauthlib.oauth1
This module is a wrapper for the most recent implementation of OAuth 1.0 Client
and Server classes.
"""
-from .rfc5849 import Client
-from .rfc5849 import SIGNATURE_HMAC, SIGNATURE_HMAC_SHA1, SIGNATURE_HMAC_SHA256, SIGNATURE_RSA, SIGNATURE_PLAINTEXT
-from .rfc5849 import SIGNATURE_TYPE_AUTH_HEADER, SIGNATURE_TYPE_QUERY
-from .rfc5849 import SIGNATURE_TYPE_BODY
+from .rfc5849 import (
+ SIGNATURE_HMAC, SIGNATURE_HMAC_SHA1, SIGNATURE_HMAC_SHA256,
+ SIGNATURE_PLAINTEXT, SIGNATURE_RSA, SIGNATURE_TYPE_AUTH_HEADER,
+ SIGNATURE_TYPE_BODY, SIGNATURE_TYPE_QUERY, Client,
+)
+from .rfc5849.endpoints import (
+ AccessTokenEndpoint, AuthorizationEndpoint, RequestTokenEndpoint,
+ ResourceEndpoint, SignatureOnlyEndpoint, WebApplicationServer,
+)
+from .rfc5849.errors import (
+ InsecureTransportError, InvalidClientError, InvalidRequestError,
+ InvalidSignatureMethodError, OAuth1Error,
+)
from .rfc5849.request_validator import RequestValidator
-from .rfc5849.endpoints import RequestTokenEndpoint, AuthorizationEndpoint
-from .rfc5849.endpoints import AccessTokenEndpoint, ResourceEndpoint
-from .rfc5849.endpoints import SignatureOnlyEndpoint, WebApplicationServer
-from .rfc5849.errors import InsecureTransportError, InvalidClientError, InvalidRequestError, InvalidSignatureMethodError, OAuth1Error
diff --git a/oauthlib/oauth1/rfc5849/__init__.py b/oauthlib/oauth1/rfc5849/__init__.py
index b629fc1..c639667 100644
--- a/oauthlib/oauth1/rfc5849/__init__.py
+++ b/oauthlib/oauth1/rfc5849/__init__.py
@@ -9,14 +9,18 @@ for signing and checking OAuth 1.0 RFC 5849 requests.
import base64
import hashlib
import logging
-log = logging.getLogger(__name__)
-
import urllib.parse as urlparse
-from oauthlib.common import Request, urlencode, generate_nonce
-from oauthlib.common import generate_timestamp, to_unicode
+from oauthlib.common import (
+ Request, generate_nonce, generate_timestamp, to_unicode, urlencode,
+)
+
from . import parameters, signature
+log = logging.getLogger(__name__)
+
+
+
SIGNATURE_HMAC_SHA1 = "HMAC-SHA1"
SIGNATURE_HMAC_SHA256 = "HMAC-SHA256"
SIGNATURE_HMAC = SIGNATURE_HMAC_SHA1
diff --git a/oauthlib/oauth1/rfc5849/endpoints/__init__.py b/oauthlib/oauth1/rfc5849/endpoints/__init__.py
index 78ade72..a3a7eb3 100644
--- a/oauthlib/oauth1/rfc5849/endpoints/__init__.py
+++ b/oauthlib/oauth1/rfc5849/endpoints/__init__.py
@@ -1,7 +1,7 @@
+from .access_token import AccessTokenEndpoint
+from .authorization import AuthorizationEndpoint
from .base import BaseEndpoint
+from .pre_configured import WebApplicationServer
from .request_token import RequestTokenEndpoint
-from .authorization import AuthorizationEndpoint
-from .access_token import AccessTokenEndpoint
from .resource import ResourceEndpoint
from .signature_only import SignatureOnlyEndpoint
-from .pre_configured import WebApplicationServer
diff --git a/oauthlib/oauth1/rfc5849/endpoints/authorization.py b/oauthlib/oauth1/rfc5849/endpoints/authorization.py
index 7d0353b..80a3902 100644
--- a/oauthlib/oauth1/rfc5849/endpoints/authorization.py
+++ b/oauthlib/oauth1/rfc5849/endpoints/authorization.py
@@ -6,11 +6,12 @@ oauthlib.oauth1.rfc5849.endpoints.authorization
This module is an implementation of various logic needed
for signing and checking OAuth 1.0 RFC 5849 requests.
"""
+from urllib.parse import urlencode
+
from oauthlib.common import Request, add_params_to_uri
from .. import errors
from .base import BaseEndpoint
-from urllib.parse import urlencode
class AuthorizationEndpoint(BaseEndpoint):
diff --git a/oauthlib/oauth1/rfc5849/endpoints/base.py b/oauthlib/oauth1/rfc5849/endpoints/base.py
index f9a8f57..8103606 100644
--- a/oauthlib/oauth1/rfc5849/endpoints/base.py
+++ b/oauthlib/oauth1/rfc5849/endpoints/base.py
@@ -10,9 +10,11 @@ import time
from oauthlib.common import CaseInsensitiveDict, Request, generate_token
-from .. import (CONTENT_TYPE_FORM_URLENCODED, SIGNATURE_HMAC_SHA1, SIGNATURE_HMAC_SHA256, SIGNATURE_RSA,
- SIGNATURE_TYPE_AUTH_HEADER, SIGNATURE_TYPE_BODY,
- SIGNATURE_TYPE_QUERY, errors, signature, utils)
+from .. import (
+ CONTENT_TYPE_FORM_URLENCODED, SIGNATURE_HMAC_SHA1, SIGNATURE_HMAC_SHA256,
+ SIGNATURE_RSA, SIGNATURE_TYPE_AUTH_HEADER, SIGNATURE_TYPE_BODY,
+ SIGNATURE_TYPE_QUERY, errors, signature, utils,
+)
class BaseEndpoint:
diff --git a/oauthlib/oauth1/rfc5849/endpoints/pre_configured.py b/oauthlib/oauth1/rfc5849/endpoints/pre_configured.py
index b14a6d8..23e3cfc 100644
--- a/oauthlib/oauth1/rfc5849/endpoints/pre_configured.py
+++ b/oauthlib/oauth1/rfc5849/endpoints/pre_configured.py
@@ -1,5 +1,7 @@
-from . import (AccessTokenEndpoint, AuthorizationEndpoint,
- RequestTokenEndpoint, ResourceEndpoint)
+from . import (
+ AccessTokenEndpoint, AuthorizationEndpoint, RequestTokenEndpoint,
+ ResourceEndpoint,
+)
class WebApplicationServer(RequestTokenEndpoint, AuthorizationEndpoint,
diff --git a/oauthlib/oauth1/rfc5849/parameters.py b/oauthlib/oauth1/rfc5849/parameters.py
index 778a46d..a9fe23c 100644
--- a/oauthlib/oauth1/rfc5849/parameters.py
+++ b/oauthlib/oauth1/rfc5849/parameters.py
@@ -7,12 +7,12 @@ This module contains methods related to `section 3.5`_ of the OAuth 1.0a spec.
.. _`section 3.5`: https://tools.ietf.org/html/rfc5849#section-3.5
"""
+from urllib.parse import urlparse, urlunparse
+
from oauthlib.common import extract_params, urlencode
from . import utils
-from urllib.parse import urlparse, urlunparse
-
# TODO: do we need filter_params now that oauth_params are handled by Request?
# We can easily pass in just oauth protocol params.
diff --git a/oauthlib/oauth1/rfc5849/request_validator.py b/oauthlib/oauth1/rfc5849/request_validator.py
index 657bfe3..750902f 100644
--- a/oauthlib/oauth1/rfc5849/request_validator.py
+++ b/oauthlib/oauth1/rfc5849/request_validator.py
@@ -6,8 +6,6 @@ oauthlib.oauth1.rfc5849
This module is an implementation of various logic needed
for signing and checking OAuth 1.0 RFC 5849 requests.
"""
-import sys
-
from . import SIGNATURE_METHODS, utils
diff --git a/oauthlib/oauth1/rfc5849/signature.py b/oauthlib/oauth1/rfc5849/signature.py
index fdc359e..b11720e 100644
--- a/oauthlib/oauth1/rfc5849/signature.py
+++ b/oauthlib/oauth1/rfc5849/signature.py
@@ -25,13 +25,12 @@ import binascii
import hashlib
import hmac
import logging
+import urllib.parse as urlparse
from oauthlib.common import extract_params, safe_string_equals, urldecode
-import urllib.parse as urlparse
from . import utils
-
log = logging.getLogger(__name__)
diff --git a/oauthlib/oauth1/rfc5849/utils.py b/oauthlib/oauth1/rfc5849/utils.py
index 28e006a..4d22a3e 100644
--- a/oauthlib/oauth1/rfc5849/utils.py
+++ b/oauthlib/oauth1/rfc5849/utils.py
@@ -6,10 +6,9 @@ oauthlib.utils
This module contains utility methods used by various parts of the OAuth
spec.
"""
-from oauthlib.common import quote, unquote
-
import urllib.request as urllib2
+from oauthlib.common import quote, unquote
UNICODE_ASCII_CHARACTER_SET = ('abcdefghijklmnopqrstuvwxyz'
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
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):
diff --git a/oauthlib/openid/__init__.py b/oauthlib/openid/__init__.py
index fb1ac8d..8a34e59 100644
--- a/oauthlib/openid/__init__.py
+++ b/oauthlib/openid/__init__.py
@@ -4,6 +4,5 @@ oauthlib.openid
~~~~~~~~~~~~~~
"""
-from .connect.core.endpoints import Server
-from .connect.core.endpoints import UserInfoEndpoint
+from .connect.core.endpoints import Server, UserInfoEndpoint
from .connect.core.request_validator import RequestValidator
diff --git a/oauthlib/openid/connect/core/endpoints/pre_configured.py b/oauthlib/openid/connect/core/endpoints/pre_configured.py
index ca8199d..03ac8f6 100644
--- a/oauthlib/openid/connect/core/endpoints/pre_configured.py
+++ b/oauthlib/openid/connect/core/endpoints/pre_configured.py
@@ -7,29 +7,20 @@ This module is an implementation of various endpoints needed
for providing OpenID Connect servers.
"""
from oauthlib.oauth2.rfc6749.endpoints import (
- AuthorizationEndpoint,
- IntrospectEndpoint,
- ResourceEndpoint,
- RevocationEndpoint,
- TokenEndpoint
+ AuthorizationEndpoint, IntrospectEndpoint, ResourceEndpoint,
+ RevocationEndpoint, TokenEndpoint,
)
from oauthlib.oauth2.rfc6749.grant_types import (
AuthorizationCodeGrant as OAuth2AuthorizationCodeGrant,
- ImplicitGrant as OAuth2ImplicitGrant,
- ClientCredentialsGrant,
- RefreshTokenGrant,
- ResourceOwnerPasswordCredentialsGrant
+ ClientCredentialsGrant, ImplicitGrant as OAuth2ImplicitGrant,
+ RefreshTokenGrant, ResourceOwnerPasswordCredentialsGrant,
)
from oauthlib.oauth2.rfc6749.tokens import BearerToken
-from ..grant_types import (
- AuthorizationCodeGrant,
- ImplicitGrant,
- HybridGrant,
-)
+
+from ..grant_types import AuthorizationCodeGrant, HybridGrant, ImplicitGrant
from ..grant_types.dispatchers import (
- AuthorizationCodeGrantDispatcher,
+ AuthorizationCodeGrantDispatcher, AuthorizationTokenGrantDispatcher,
ImplicitTokenGrantDispatcher,
- AuthorizationTokenGrantDispatcher
)
from ..tokens import JWTToken
from .userinfo import UserInfoEndpoint
diff --git a/oauthlib/openid/connect/core/endpoints/userinfo.py b/oauthlib/openid/connect/core/endpoints/userinfo.py
index dc73373..1c29cc5 100644
--- a/oauthlib/openid/connect/core/endpoints/userinfo.py
+++ b/oauthlib/openid/connect/core/endpoints/userinfo.py
@@ -8,11 +8,11 @@ import json
import logging
from oauthlib.common import Request
-from oauthlib.oauth2.rfc6749.endpoints.base import BaseEndpoint
-from oauthlib.oauth2.rfc6749.endpoints.base import catch_errors_and_unavailability
-from oauthlib.oauth2.rfc6749.tokens import BearerToken
from oauthlib.oauth2.rfc6749 import errors
-
+from oauthlib.oauth2.rfc6749.endpoints.base import (
+ BaseEndpoint, catch_errors_and_unavailability,
+)
+from oauthlib.oauth2.rfc6749.tokens import BearerToken
log = logging.getLogger(__name__)
diff --git a/oauthlib/openid/connect/core/grant_types/__init__.py b/oauthlib/openid/connect/core/grant_types/__init__.py
index 4e7b474..b126218 100644
--- a/oauthlib/openid/connect/core/grant_types/__init__.py
+++ b/oauthlib/openid/connect/core/grant_types/__init__.py
@@ -4,12 +4,11 @@ oauthlib.openid.connect.core.grant_types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from .authorization_code import AuthorizationCodeGrant
-from .implicit import ImplicitGrant
from .base import GrantTypeBase
-from .hybrid import HybridGrant
-from .exceptions import OIDCNoPrompt
from .dispatchers import (
- AuthorizationCodeGrantDispatcher,
+ AuthorizationCodeGrantDispatcher, AuthorizationTokenGrantDispatcher,
ImplicitTokenGrantDispatcher,
- AuthorizationTokenGrantDispatcher
)
+from .exceptions import OIDCNoPrompt
+from .hybrid import HybridGrant
+from .implicit import ImplicitGrant
diff --git a/oauthlib/openid/connect/core/grant_types/authorization_code.py b/oauthlib/openid/connect/core/grant_types/authorization_code.py
index d07d138..d38b028 100644
--- a/oauthlib/openid/connect/core/grant_types/authorization_code.py
+++ b/oauthlib/openid/connect/core/grant_types/authorization_code.py
@@ -5,7 +5,9 @@ oauthlib.openid.connect.core.grant_types
"""
import logging
-from oauthlib.oauth2.rfc6749.grant_types.authorization_code import AuthorizationCodeGrant as OAuth2AuthorizationCodeGrant
+from oauthlib.oauth2.rfc6749.grant_types.authorization_code import (
+ AuthorizationCodeGrant as OAuth2AuthorizationCodeGrant,
+)
from .base import GrantTypeBase
diff --git a/oauthlib/openid/connect/core/grant_types/base.py b/oauthlib/openid/connect/core/grant_types/base.py
index cd27237..d0a4812 100644
--- a/oauthlib/openid/connect/core/grant_types/base.py
+++ b/oauthlib/openid/connect/core/grant_types/base.py
@@ -1,12 +1,14 @@
-from .exceptions import OIDCNoPrompt
-
import base64
import hashlib
import logging
import time
from json import loads
-from oauthlib.oauth2.rfc6749.errors import ConsentRequired, InvalidRequestError, LoginRequired
+from oauthlib.oauth2.rfc6749.errors import (
+ ConsentRequired, InvalidRequestError, LoginRequired,
+)
+
+from .exceptions import OIDCNoPrompt
log = logging.getLogger(__name__)
diff --git a/oauthlib/openid/connect/core/grant_types/dispatchers.py b/oauthlib/openid/connect/core/grant_types/dispatchers.py
index 6dcc0cb..2734c38 100644
--- a/oauthlib/openid/connect/core/grant_types/dispatchers.py
+++ b/oauthlib/openid/connect/core/grant_types/dispatchers.py
@@ -1,4 +1,5 @@
import logging
+
log = logging.getLogger(__name__)
diff --git a/oauthlib/openid/connect/core/grant_types/hybrid.py b/oauthlib/openid/connect/core/grant_types/hybrid.py
index caf8547..a8dd564 100644
--- a/oauthlib/openid/connect/core/grant_types/hybrid.py
+++ b/oauthlib/openid/connect/core/grant_types/hybrid.py
@@ -5,11 +5,13 @@ oauthlib.openid.connect.core.grant_types
"""
import logging
-from oauthlib.oauth2.rfc6749.grant_types.authorization_code import AuthorizationCodeGrant as OAuth2AuthorizationCodeGrant
from oauthlib.oauth2.rfc6749.errors import InvalidRequestError
+from oauthlib.oauth2.rfc6749.grant_types.authorization_code import (
+ AuthorizationCodeGrant as OAuth2AuthorizationCodeGrant,
+)
-from .base import GrantTypeBase
from ..request_validator import RequestValidator
+from .base import GrantTypeBase
log = logging.getLogger(__name__)
diff --git a/oauthlib/openid/connect/core/grant_types/implicit.py b/oauthlib/openid/connect/core/grant_types/implicit.py
index 62f63f9..3ab7d5d 100644
--- a/oauthlib/openid/connect/core/grant_types/implicit.py
+++ b/oauthlib/openid/connect/core/grant_types/implicit.py
@@ -5,10 +5,12 @@ oauthlib.openid.connect.core.grant_types
"""
import logging
-from .base import GrantTypeBase
-
-from oauthlib.oauth2.rfc6749.grant_types.implicit import ImplicitGrant as OAuth2ImplicitGrant
from oauthlib.oauth2.rfc6749.errors import InvalidRequestError
+from oauthlib.oauth2.rfc6749.grant_types.implicit import (
+ ImplicitGrant as OAuth2ImplicitGrant,
+)
+
+from .base import GrantTypeBase
log = logging.getLogger(__name__)
diff --git a/oauthlib/openid/connect/core/request_validator.py b/oauthlib/openid/connect/core/request_validator.py
index ebc07dc..7f44d69 100644
--- a/oauthlib/openid/connect/core/request_validator.py
+++ b/oauthlib/openid/connect/core/request_validator.py
@@ -5,7 +5,9 @@ oauthlib.openid.connect.core.request_validator
"""
import logging
-from oauthlib.oauth2.rfc6749.request_validator import RequestValidator as OAuth2RequestValidator
+from oauthlib.oauth2.rfc6749.request_validator import (
+ RequestValidator as OAuth2RequestValidator,
+)
log = logging.getLogger(__name__)