Skip to content

Commit 1a1df22

Browse files
author
Anton Ruhlov
committed
Sorted oauthlib imports per isort 4.3.21
1 parent 809428d commit 1a1df22

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+161
-149
lines changed

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ clean-build:
3737
format fmt:
3838
isort --recursive oauthlib tests
3939

40+
lint:
41+
isort --recursive --check-only --diff oauthlib tests
42+
4043
test:
4144
tox
4245

oauthlib/common.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
import re
1313
import time
1414
import urllib.parse as urlparse
15+
from urllib.parse import (
16+
quote as _quote, unquote as _unquote, urlencode as _urlencode,
17+
)
18+
1519
from . import get_debug
16-
from urllib.parse import quote as _quote
17-
from urllib.parse import unquote as _unquote
18-
from urllib.parse import urlencode as _urlencode
1920

2021
try:
2122
from secrets import randbits

oauthlib/oauth1/__init__.py

+13-8
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@
66
This module is a wrapper for the most recent implementation of OAuth 1.0 Client
77
and Server classes.
88
"""
9-
from .rfc5849 import Client
10-
from .rfc5849 import SIGNATURE_HMAC, SIGNATURE_HMAC_SHA1, SIGNATURE_HMAC_SHA256, SIGNATURE_RSA, SIGNATURE_PLAINTEXT
11-
from .rfc5849 import SIGNATURE_TYPE_AUTH_HEADER, SIGNATURE_TYPE_QUERY
12-
from .rfc5849 import SIGNATURE_TYPE_BODY
9+
from .rfc5849 import (
10+
SIGNATURE_HMAC, SIGNATURE_HMAC_SHA1, SIGNATURE_HMAC_SHA256,
11+
SIGNATURE_PLAINTEXT, SIGNATURE_RSA, SIGNATURE_TYPE_AUTH_HEADER,
12+
SIGNATURE_TYPE_BODY, SIGNATURE_TYPE_QUERY, Client,
13+
)
14+
from .rfc5849.endpoints import (
15+
AccessTokenEndpoint, AuthorizationEndpoint, RequestTokenEndpoint,
16+
ResourceEndpoint, SignatureOnlyEndpoint, WebApplicationServer,
17+
)
18+
from .rfc5849.errors import (
19+
InsecureTransportError, InvalidClientError, InvalidRequestError,
20+
InvalidSignatureMethodError, OAuth1Error,
21+
)
1322
from .rfc5849.request_validator import RequestValidator
14-
from .rfc5849.endpoints import RequestTokenEndpoint, AuthorizationEndpoint
15-
from .rfc5849.endpoints import AccessTokenEndpoint, ResourceEndpoint
16-
from .rfc5849.endpoints import SignatureOnlyEndpoint, WebApplicationServer
17-
from .rfc5849.errors import InsecureTransportError, InvalidClientError, InvalidRequestError, InvalidSignatureMethodError, OAuth1Error

oauthlib/oauth1/rfc5849/__init__.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@
99
import base64
1010
import hashlib
1111
import logging
12-
log = logging.getLogger(__name__)
13-
1412
import urllib.parse as urlparse
1513

16-
from oauthlib.common import Request, urlencode, generate_nonce
17-
from oauthlib.common import generate_timestamp, to_unicode
14+
from oauthlib.common import (
15+
Request, generate_nonce, generate_timestamp, to_unicode, urlencode,
16+
)
17+
1818
from . import parameters, signature
1919

20+
log = logging.getLogger(__name__)
21+
22+
23+
2024
SIGNATURE_HMAC_SHA1 = "HMAC-SHA1"
2125
SIGNATURE_HMAC_SHA256 = "HMAC-SHA256"
2226
SIGNATURE_HMAC = SIGNATURE_HMAC_SHA1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
from .access_token import AccessTokenEndpoint
2+
from .authorization import AuthorizationEndpoint
13
from .base import BaseEndpoint
4+
from .pre_configured import WebApplicationServer
25
from .request_token import RequestTokenEndpoint
3-
from .authorization import AuthorizationEndpoint
4-
from .access_token import AccessTokenEndpoint
56
from .resource import ResourceEndpoint
67
from .signature_only import SignatureOnlyEndpoint
7-
from .pre_configured import WebApplicationServer

oauthlib/oauth1/rfc5849/endpoints/authorization.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
This module is an implementation of various logic needed
77
for signing and checking OAuth 1.0 RFC 5849 requests.
88
"""
9+
from urllib.parse import urlencode
10+
911
from oauthlib.common import Request, add_params_to_uri
1012

1113
from .. import errors
1214
from .base import BaseEndpoint
13-
from urllib.parse import urlencode
1415

1516

1617
class AuthorizationEndpoint(BaseEndpoint):

oauthlib/oauth1/rfc5849/endpoints/base.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010

1111
from oauthlib.common import CaseInsensitiveDict, Request, generate_token
1212

13-
from .. import (CONTENT_TYPE_FORM_URLENCODED, SIGNATURE_HMAC_SHA1, SIGNATURE_HMAC_SHA256, SIGNATURE_RSA,
14-
SIGNATURE_TYPE_AUTH_HEADER, SIGNATURE_TYPE_BODY,
15-
SIGNATURE_TYPE_QUERY, errors, signature, utils)
13+
from .. import (
14+
CONTENT_TYPE_FORM_URLENCODED, SIGNATURE_HMAC_SHA1, SIGNATURE_HMAC_SHA256,
15+
SIGNATURE_RSA, SIGNATURE_TYPE_AUTH_HEADER, SIGNATURE_TYPE_BODY,
16+
SIGNATURE_TYPE_QUERY, errors, signature, utils,
17+
)
1618

1719

1820
class BaseEndpoint:

oauthlib/oauth1/rfc5849/endpoints/pre_configured.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
from . import (AccessTokenEndpoint, AuthorizationEndpoint,
2-
RequestTokenEndpoint, ResourceEndpoint)
1+
from . import (
2+
AccessTokenEndpoint, AuthorizationEndpoint, RequestTokenEndpoint,
3+
ResourceEndpoint,
4+
)
35

46

57
class WebApplicationServer(RequestTokenEndpoint, AuthorizationEndpoint,

oauthlib/oauth1/rfc5849/parameters.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
88
.. _`section 3.5`: https://tools.ietf.org/html/rfc5849#section-3.5
99
"""
10+
from urllib.parse import urlparse, urlunparse
11+
1012
from oauthlib.common import extract_params, urlencode
1113

1214
from . import utils
1315

14-
from urllib.parse import urlparse, urlunparse
15-
1616

1717
# TODO: do we need filter_params now that oauth_params are handled by Request?
1818
# We can easily pass in just oauth protocol params.

oauthlib/oauth1/rfc5849/request_validator.py

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
This module is an implementation of various logic needed
77
for signing and checking OAuth 1.0 RFC 5849 requests.
88
"""
9-
import sys
10-
119
from . import SIGNATURE_METHODS, utils
1210

1311

oauthlib/oauth1/rfc5849/signature.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,12 @@
2525
import hashlib
2626
import hmac
2727
import logging
28+
import urllib.parse as urlparse
2829

2930
from oauthlib.common import extract_params, safe_string_equals, urldecode
30-
import urllib.parse as urlparse
3131

3232
from . import utils
3333

34-
3534
log = logging.getLogger(__name__)
3635

3736

oauthlib/oauth1/rfc5849/utils.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
This module contains utility methods used by various parts of the OAuth
77
spec.
88
"""
9-
from oauthlib.common import quote, unquote
10-
119
import urllib.request as urllib2
1210

11+
from oauthlib.common import quote, unquote
1312

1413
UNICODE_ASCII_CHARACTER_SET = ('abcdefghijklmnopqrstuvwxyz'
1514
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

oauthlib/oauth2/__init__.py

+25-23
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,31 @@
66
This module is a wrapper for the most recent implementation of OAuth 2.0 Client
77
and Server classes.
88
"""
9-
from .rfc6749.clients import Client
10-
from .rfc6749.clients import WebApplicationClient
11-
from .rfc6749.clients import MobileApplicationClient
12-
from .rfc6749.clients import LegacyApplicationClient
13-
from .rfc6749.clients import BackendApplicationClient
14-
from .rfc6749.clients import ServiceApplicationClient
15-
from .rfc6749.endpoints import AuthorizationEndpoint
16-
from .rfc6749.endpoints import IntrospectEndpoint
17-
from .rfc6749.endpoints import MetadataEndpoint
18-
from .rfc6749.endpoints import TokenEndpoint
19-
from .rfc6749.endpoints import ResourceEndpoint
20-
from .rfc6749.endpoints import RevocationEndpoint
21-
from .rfc6749.endpoints import Server
22-
from .rfc6749.endpoints import WebApplicationServer
23-
from .rfc6749.endpoints import MobileApplicationServer
24-
from .rfc6749.endpoints import LegacyApplicationServer
25-
from .rfc6749.endpoints import BackendApplicationServer
26-
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
27-
from .rfc6749.grant_types import AuthorizationCodeGrant
28-
from .rfc6749.grant_types import ImplicitGrant
29-
from .rfc6749.grant_types import ResourceOwnerPasswordCredentialsGrant
30-
from .rfc6749.grant_types import ClientCredentialsGrant
31-
from .rfc6749.grant_types import RefreshTokenGrant
9+
from .rfc6749.clients import (
10+
BackendApplicationClient, Client, LegacyApplicationClient,
11+
MobileApplicationClient, ServiceApplicationClient, WebApplicationClient,
12+
)
13+
from .rfc6749.endpoints import (
14+
AuthorizationEndpoint, BackendApplicationServer, IntrospectEndpoint,
15+
LegacyApplicationServer, MetadataEndpoint, MobileApplicationServer,
16+
ResourceEndpoint, RevocationEndpoint, Server, TokenEndpoint,
17+
WebApplicationServer,
18+
)
19+
from .rfc6749.errors import (
20+
AccessDeniedError, FatalClientError, InsecureTransportError,
21+
InvalidClientError, InvalidClientIdError, InvalidGrantError,
22+
InvalidRedirectURIError, InvalidRequestError, InvalidRequestFatalError,
23+
InvalidScopeError, MismatchingRedirectURIError, MismatchingStateError,
24+
MissingClientIdError, MissingCodeError, MissingRedirectURIError,
25+
MissingResponseTypeError, MissingTokenError, MissingTokenTypeError,
26+
OAuth2Error, ServerError, TemporarilyUnavailableError, TokenExpiredError,
27+
UnauthorizedClientError, UnsupportedGrantTypeError,
28+
UnsupportedResponseTypeError, UnsupportedTokenTypeError,
29+
)
30+
from .rfc6749.grant_types import (
31+
AuthorizationCodeGrant, ClientCredentialsGrant, ImplicitGrant,
32+
RefreshTokenGrant, ResourceOwnerPasswordCredentialsGrant,
33+
)
3234
from .rfc6749.request_validator import RequestValidator
3335
from .rfc6749.tokens import BearerToken, OAuth2Token
3436
from .rfc6749.utils import is_secure_transport

oauthlib/oauth2/rfc6749/__init__.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
import functools
1010
import logging
1111

12-
from .endpoints.base import BaseEndpoint
13-
from .endpoints.base import catch_errors_and_unavailability
14-
from .errors import TemporarilyUnavailableError, ServerError
15-
from .errors import FatalClientError, OAuth2Error
16-
12+
from .endpoints.base import BaseEndpoint, catch_errors_and_unavailability
13+
from .errors import (
14+
FatalClientError, OAuth2Error, ServerError, TemporarilyUnavailableError,
15+
)
1716

1817
log = logging.getLogger(__name__)

oauthlib/oauth2/rfc6749/clients/__init__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
This module is an implementation of various logic needed
77
for consuming OAuth 2.0 RFC6749.
88
"""
9-
from .base import Client, AUTH_HEADER, URI_QUERY, BODY
10-
from .web_application import WebApplicationClient
11-
from .mobile_application import MobileApplicationClient
12-
from .legacy_application import LegacyApplicationClient
139
from .backend_application import BackendApplicationClient
10+
from .base import AUTH_HEADER, BODY, URI_QUERY, Client
11+
from .legacy_application import LegacyApplicationClient
12+
from .mobile_application import MobileApplicationClient
1413
from .service_application import ServiceApplicationClient
14+
from .web_application import WebApplicationClient

oauthlib/oauth2/rfc6749/clients/backend_application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
This module is an implementation of various logic needed
77
for consuming and providing OAuth 2.0 RFC6749.
88
"""
9-
from ..parameters import parse_token_response, prepare_token_request
9+
from ..parameters import prepare_token_request
1010
from .base import Client
1111

1212

oauthlib/oauth2/rfc6749/clients/base.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111

1212
from oauthlib.common import generate_token
1313
from oauthlib.oauth2.rfc6749 import tokens
14-
from oauthlib.oauth2.rfc6749.errors import (InsecureTransportError,
15-
TokenExpiredError)
16-
from oauthlib.oauth2.rfc6749.parameters import (parse_token_response,
17-
prepare_token_request,
18-
prepare_token_revocation_request)
14+
from oauthlib.oauth2.rfc6749.errors import (
15+
InsecureTransportError, TokenExpiredError,
16+
)
17+
from oauthlib.oauth2.rfc6749.parameters import (
18+
parse_token_response, prepare_token_request,
19+
prepare_token_revocation_request,
20+
)
1921
from oauthlib.oauth2.rfc6749.utils import is_secure_transport
2022

2123
AUTH_HEADER = 'auth_header'

oauthlib/oauth2/rfc6749/clients/legacy_application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
This module is an implementation of various logic needed
77
for consuming and providing OAuth 2.0 RFC6749.
88
"""
9-
from ..parameters import parse_token_response, prepare_token_request
9+
from ..parameters import prepare_token_request
1010
from .base import Client
1111

1212

oauthlib/oauth2/rfc6749/clients/service_application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from oauthlib.common import to_unicode
1212

13-
from ..parameters import parse_token_response, prepare_token_request
13+
from ..parameters import prepare_token_request
1414
from .base import Client
1515

1616

oauthlib/oauth2/rfc6749/clients/web_application.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
"""
99
import warnings
1010

11-
from ..parameters import (parse_authorization_code_response,
12-
parse_token_response, prepare_grant_uri,
13-
prepare_token_request)
11+
from ..parameters import (
12+
parse_authorization_code_response, prepare_grant_uri,
13+
prepare_token_request,
14+
)
1415
from .base import Client
1516

1617

oauthlib/oauth2/rfc6749/endpoints/__init__.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99
from .authorization import AuthorizationEndpoint
1010
from .introspect import IntrospectEndpoint
1111
from .metadata import MetadataEndpoint
12-
from .token import TokenEndpoint
12+
from .pre_configured import (
13+
BackendApplicationServer, LegacyApplicationServer, MobileApplicationServer,
14+
Server, WebApplicationServer,
15+
)
1316
from .resource import ResourceEndpoint
1417
from .revocation import RevocationEndpoint
15-
from .pre_configured import Server
16-
from .pre_configured import WebApplicationServer
17-
from .pre_configured import MobileApplicationServer
18-
from .pre_configured import LegacyApplicationServer
19-
from .pre_configured import BackendApplicationServer
18+
from .token import TokenEndpoint

oauthlib/oauth2/rfc6749/endpoints/base.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99
import functools
1010
import logging
1111

12-
from ..errors import (FatalClientError, OAuth2Error, ServerError,
13-
TemporarilyUnavailableError, InvalidRequestError,
14-
InvalidClientError, UnsupportedTokenTypeError)
15-
16-
from oauthlib.common import CaseInsensitiveDict, urldecode
12+
from ..errors import (
13+
FatalClientError, InvalidClientError, InvalidRequestError, OAuth2Error,
14+
ServerError, TemporarilyUnavailableError, UnsupportedTokenTypeError,
15+
)
1716

1817
log = logging.getLogger(__name__)
1918

oauthlib/oauth2/rfc6749/endpoints/introspect.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from oauthlib.common import Request
1414

15-
from ..errors import OAuth2Error, UnsupportedTokenTypeError
15+
from ..errors import OAuth2Error
1616
from .base import BaseEndpoint, catch_errors_and_unavailability
1717

1818
log = logging.getLogger(__name__)

oauthlib/oauth2/rfc6749/endpoints/metadata.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@
1111
import json
1212
import logging
1313

14-
from .base import BaseEndpoint, catch_errors_and_unavailability
14+
from .. import grant_types
1515
from .authorization import AuthorizationEndpoint
16+
from .base import BaseEndpoint, catch_errors_and_unavailability
1617
from .introspect import IntrospectEndpoint
17-
from .token import TokenEndpoint
1818
from .revocation import RevocationEndpoint
19-
from .. import grant_types
20-
19+
from .token import TokenEndpoint
2120

2221
log = logging.getLogger(__name__)
2322

oauthlib/oauth2/rfc6749/endpoints/pre_configured.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
This module is an implementation of various endpoints needed
77
for providing OAuth 2.0 RFC6749 servers.
88
"""
9-
from ..grant_types import (AuthorizationCodeGrant,
10-
ClientCredentialsGrant,
11-
ImplicitGrant,
12-
RefreshTokenGrant,
13-
ResourceOwnerPasswordCredentialsGrant)
9+
from ..grant_types import (
10+
AuthorizationCodeGrant, ClientCredentialsGrant, ImplicitGrant,
11+
RefreshTokenGrant, ResourceOwnerPasswordCredentialsGrant,
12+
)
1413
from ..tokens import BearerToken
1514
from .authorization import AuthorizationEndpoint
1615
from .introspect import IntrospectEndpoint

0 commit comments

Comments
 (0)