Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed isort imports #820

Merged
merged 1 commit into from Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions oauthlib/common.py
Expand Up @@ -18,11 +18,9 @@
from . import get_debug

try:
from secrets import randbits
from secrets import SystemRandom
from secrets import SystemRandom, randbits
except ImportError:
from random import getrandbits as randbits
from random import SystemRandom
from random import SystemRandom, getrandbits as randbits

UNICODE_ASCII_CHARACTER_SET = ('abcdefghijklmnopqrstuvwxyz'
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
Expand Down
35 changes: 15 additions & 20 deletions oauthlib/oauth1/__init__.py
Expand Up @@ -5,24 +5,19 @@
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_HMAC_SHA512,
SIGNATURE_RSA,
SIGNATURE_RSA_SHA1,
SIGNATURE_RSA_SHA256,
SIGNATURE_RSA_SHA512,
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_HMAC_SHA512, SIGNATURE_PLAINTEXT, SIGNATURE_RSA,
SIGNATURE_RSA_SHA1, SIGNATURE_RSA_SHA256, SIGNATURE_RSA_SHA512,
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)
11 changes: 5 additions & 6 deletions oauthlib/oauth1/rfc5849/endpoints/base.py
Expand Up @@ -11,12 +11,11 @@
from oauthlib.common import CaseInsensitiveDict, Request, generate_token

from .. import (
CONTENT_TYPE_FORM_URLENCODED,
SIGNATURE_HMAC_SHA1, SIGNATURE_HMAC_SHA256, SIGNATURE_HMAC_SHA512,
SIGNATURE_RSA_SHA1, SIGNATURE_RSA_SHA256, SIGNATURE_RSA_SHA512,
SIGNATURE_PLAINTEXT,
SIGNATURE_TYPE_AUTH_HEADER, SIGNATURE_TYPE_BODY,
SIGNATURE_TYPE_QUERY, errors, signature, utils)
CONTENT_TYPE_FORM_URLENCODED, SIGNATURE_HMAC_SHA1, SIGNATURE_HMAC_SHA256,
SIGNATURE_HMAC_SHA512, SIGNATURE_PLAINTEXT, SIGNATURE_RSA_SHA1,
SIGNATURE_RSA_SHA256, SIGNATURE_RSA_SHA512, SIGNATURE_TYPE_AUTH_HEADER,
SIGNATURE_TYPE_BODY, SIGNATURE_TYPE_QUERY, errors, signature, utils,
)


class BaseEndpoint:
Expand Down
3 changes: 1 addition & 2 deletions oauthlib/oauth1/rfc5849/signature.py
Expand Up @@ -38,14 +38,13 @@
import hashlib
import hmac
import logging
import urllib.parse as urlparse
import warnings

from oauthlib.common import extract_params, safe_string_equals, urldecode
import urllib.parse as urlparse

from . import utils


log = logging.getLogger(__name__)


Expand Down
8 changes: 4 additions & 4 deletions oauthlib/oauth2/rfc6749/clients/base.py
Expand Up @@ -6,12 +6,12 @@
This module is an implementation of various logic needed
for consuming OAuth 2.0 RFC6749.
"""
import base64
import hashlib
import re
import secrets
import time
import warnings
import secrets
import re
import hashlib
import base64

from oauthlib.common import generate_token
from oauthlib.oauth2.rfc6749 import tokens
Expand Down
3 changes: 1 addition & 2 deletions oauthlib/oauth2/rfc8628/clients/device.py
Expand Up @@ -5,12 +5,11 @@
This module is an implementation of various logic needed
for consuming and providing OAuth 2.0 Device Authorization RFC8628.
"""

from oauthlib.common import add_params_to_uri
from oauthlib.oauth2 import BackendApplicationClient, Client
from oauthlib.oauth2.rfc6749.errors import InsecureTransportError
from oauthlib.oauth2.rfc6749.parameters import prepare_token_request
from oauthlib.oauth2.rfc6749.utils import is_secure_transport, list_to_scope
from oauthlib.common import add_params_to_uri


class DeviceClient(Client):
Expand Down
1 change: 0 additions & 1 deletion oauthlib/openid/connect/core/grant_types/base.py
Expand Up @@ -8,7 +8,6 @@
ConsentRequired, InvalidRequestError, LoginRequired,
)


log = logging.getLogger(__name__)


Expand Down
4 changes: 3 additions & 1 deletion oauthlib/openid/connect/core/tokens.py
Expand Up @@ -4,7 +4,9 @@

This module contains methods for adding JWT tokens to requests.
"""
from oauthlib.oauth2.rfc6749.tokens import TokenBase, random_token_generator, get_token_from_header
from oauthlib.oauth2.rfc6749.tokens import (
TokenBase, get_token_from_header, random_token_generator,
)


class JWTToken(TokenBase):
Expand Down
27 changes: 8 additions & 19 deletions tests/oauth1/rfc5849/test_signatures.py
@@ -1,26 +1,15 @@
# -*- coding: utf-8 -*-
from oauthlib.oauth1.rfc5849.signature import (
collect_parameters,
signature_base_string,
base_string_uri,
normalize_parameters,
sign_hmac_sha1_with_client,
sign_hmac_sha256_with_client,
sign_hmac_sha512_with_client,
sign_rsa_sha1_with_client,
sign_rsa_sha256_with_client,
sign_rsa_sha512_with_client,
sign_plaintext_with_client,
verify_hmac_sha1,
verify_hmac_sha256,
verify_hmac_sha512,
verify_rsa_sha1,
verify_rsa_sha256,
verify_rsa_sha512,
verify_plaintext
base_string_uri, collect_parameters, normalize_parameters,
sign_hmac_sha1_with_client, sign_hmac_sha256_with_client,
sign_hmac_sha512_with_client, sign_plaintext_with_client,
sign_rsa_sha1_with_client, sign_rsa_sha256_with_client,
sign_rsa_sha512_with_client, signature_base_string, verify_hmac_sha1,
verify_hmac_sha256, verify_hmac_sha512, verify_plaintext, verify_rsa_sha1,
verify_rsa_sha256, verify_rsa_sha512,
)
from tests.unittest import TestCase

from tests.unittest import TestCase

# ################################################################

Expand Down
3 changes: 2 additions & 1 deletion tests/oauth2/rfc6749/endpoints/test_metadata.py
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
import json

from oauthlib.oauth2 import MetadataEndpoint, Server, TokenEndpoint

import json
from tests.unittest import TestCase


Expand Down