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

Import collection ABC's from correct module #384

Merged
merged 2 commits into from
Nov 25, 2018
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions jwt/api_jws.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import binascii
import json
import warnings
from collections import Mapping
try:
# import required by mypy to perform type checking, not used for normal execution
from typing import Callable, Dict, List, Optional, Union # NOQA
Expand All @@ -11,7 +10,7 @@
from .algorithms import (
Algorithm, get_default_algorithms, has_crypto, requires_cryptography # NOQA
)
from .compat import binary_type, string_types, text_type
from .compat import Mapping, binary_type, string_types, text_type
from .exceptions import (
DecodeError, InvalidAlgorithmError, InvalidSignatureError,
InvalidTokenError
Expand Down
7 changes: 1 addition & 6 deletions jwt/api_jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
import warnings
from calendar import timegm
from datetime import datetime, timedelta
try:
# Importing ABCs from collections will be removed in PY3.8
from collections.abc import Iterable, Mapping
except ImportError:
from collections import Iterable, Mapping
try:
# import required by mypy to perform type checking, not used for normal execution
from typing import Callable, Dict, List, Optional, Union # NOQA
Expand All @@ -15,7 +10,7 @@

from .api_jws import PyJWS
from .algorithms import Algorithm, get_default_algorithms # NOQA
from .compat import string_types
from .compat import Iterable, Mapping, string_types
from .exceptions import (
DecodeError, ExpiredSignatureError, ImmatureSignatureError,
InvalidAudienceError, InvalidIssuedAtError,
Expand Down
5 changes: 5 additions & 0 deletions jwt/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@

string_types = (text_type, binary_type)

try:
# Importing ABCs from collections will be removed in PY3.8
from collections.abc import Iterable, Mapping
except ImportError:
from collections import Iterable, Mapping

try:
constant_time_compare = hmac.compare_digest
Expand Down