Skip to content

Commit

Permalink
mark top-level names as exported
Browse files Browse the repository at this point in the history
  • Loading branch information
davidism committed May 18, 2021
1 parent 56823cd commit d2250ed
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Version 2.0.1

Unreleased

- Mark top-level names as exported so type checking understands
imports in user projects. :pr:`240`


Version 2.0.0
-------------
Expand Down
36 changes: 18 additions & 18 deletions src/itsdangerous/__init__.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
from ._json import deprecated_json as json
from .encoding import base64_decode
from .encoding import base64_encode
from .encoding import want_bytes
from .exc import BadData
from .exc import BadHeader
from .exc import BadPayload
from .exc import BadSignature
from .exc import BadTimeSignature
from .exc import SignatureExpired
from ._json import json
from .encoding import base64_decode as base64_decode
from .encoding import base64_encode as base64_encode
from .encoding import want_bytes as want_bytes
from .exc import BadData as BadData
from .exc import BadHeader as BadHeader
from .exc import BadPayload as BadPayload
from .exc import BadSignature as BadSignature
from .exc import BadTimeSignature as BadTimeSignature
from .exc import SignatureExpired as SignatureExpired
from .jws import JSONWebSignatureSerializer
from .jws import TimedJSONWebSignatureSerializer
from .serializer import Serializer
from .signer import HMACAlgorithm
from .signer import NoneAlgorithm
from .signer import Signer
from .timed import TimedSerializer
from .timed import TimestampSigner
from .url_safe import URLSafeSerializer
from .url_safe import URLSafeTimedSerializer
from .serializer import Serializer as Serializer
from .signer import HMACAlgorithm as HMACAlgorithm
from .signer import NoneAlgorithm as NoneAlgorithm
from .signer import Signer as Signer
from .timed import TimedSerializer as TimedSerializer
from .timed import TimestampSigner as TimestampSigner
from .url_safe import URLSafeSerializer as URLSafeSerializer
from .url_safe import URLSafeTimedSerializer as URLSafeTimedSerializer

__version__ = "2.0.1.dev0"
10 changes: 5 additions & 5 deletions src/itsdangerous/_json.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import json
import json as _json
import typing as _t
from types import ModuleType

Expand All @@ -8,13 +8,13 @@ class _CompactJSON:

@staticmethod
def loads(payload: _t.Union[str, bytes]) -> _t.Any:
return json.loads(payload)
return _json.loads(payload)

@staticmethod
def dumps(obj: _t.Any, **kwargs: _t.Any) -> str:
kwargs.setdefault("ensure_ascii", False)
kwargs.setdefault("separators", (",", ":"))
return json.dumps(obj, **kwargs)
return _json.dumps(obj, **kwargs)


class DeprecatedJSON(ModuleType):
Expand All @@ -28,7 +28,7 @@ def __getattribute__(self, item: str) -> _t.Any:
DeprecationWarning,
stacklevel=2,
)
return getattr(json, item)
return getattr(_json, item)


deprecated_json = DeprecatedJSON("json")
json = DeprecatedJSON("json")

0 comments on commit d2250ed

Please sign in to comment.