summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Lord <davidism@gmail.com>2020-04-14 16:26:19 -0700
committerDavid Lord <davidism@gmail.com>2020-04-14 16:32:09 -0700
commit7104e55812bb4a75ccbe5efcf55ad2dc692a849f (patch)
tree6f1f1e8bc15db72b8ea8f8502816f7a6aa276bd8 /src
parent228b7b1b2f26e98b82ae43aee1576cf5aa1322ea (diff)
downloaditsdangerous-7104e55812bb4a75ccbe5efcf55ad2dc692a849f.tar.gz
apply pyupgrade
Diffstat (limited to 'src')
-rw-r--r--src/itsdangerous/_json.py2
-rw-r--r--src/itsdangerous/exc.py2
-rw-r--r--src/itsdangerous/serializer.py2
-rw-r--r--src/itsdangerous/signer.py4
-rw-r--r--src/itsdangerous/timed.py2
-rw-r--r--src/itsdangerous/url_safe.py6
6 files changed, 9 insertions, 9 deletions
diff --git a/src/itsdangerous/_json.py b/src/itsdangerous/_json.py
index 426b36e..470636f 100644
--- a/src/itsdangerous/_json.py
+++ b/src/itsdangerous/_json.py
@@ -4,7 +4,7 @@ except ImportError:
import json
-class _CompactJSON(object):
+class _CompactJSON:
"""Wrapper around json module that strips whitespace."""
@staticmethod
diff --git a/src/itsdangerous/exc.py b/src/itsdangerous/exc.py
index 9a34cb7..3e94a6a 100644
--- a/src/itsdangerous/exc.py
+++ b/src/itsdangerous/exc.py
@@ -8,7 +8,7 @@ class BadData(Exception):
message = None
def __init__(self, message):
- super(BadData, self).__init__(self, message)
+ super().__init__(self, message)
self.message = message
def __str__(self):
diff --git a/src/itsdangerous/serializer.py b/src/itsdangerous/serializer.py
index bb10f3b..73aec64 100644
--- a/src/itsdangerous/serializer.py
+++ b/src/itsdangerous/serializer.py
@@ -12,7 +12,7 @@ def is_text_serializer(serializer):
return isinstance(serializer.dumps({}), str)
-class Serializer(object):
+class Serializer:
"""This class provides a serialization interface on top of the
signer. It provides a similar API to json/pickle and other modules
but is structured differently internally. If you want to change the
diff --git a/src/itsdangerous/signer.py b/src/itsdangerous/signer.py
index ef8d473..c67402b 100644
--- a/src/itsdangerous/signer.py
+++ b/src/itsdangerous/signer.py
@@ -8,7 +8,7 @@ from .encoding import want_bytes
from .exc import BadSignature
-class SigningAlgorithm(object):
+class SigningAlgorithm:
"""Subclasses must implement :meth:`get_signature` to provide
signature generation functionality.
"""
@@ -51,7 +51,7 @@ class HMACAlgorithm(SigningAlgorithm):
return mac.digest()
-class Signer(object):
+class Signer:
"""This class can sign and unsign bytes, validating the signature
provided.
diff --git a/src/itsdangerous/timed.py b/src/itsdangerous/timed.py
index 2b4df96..e0f83bd 100644
--- a/src/itsdangerous/timed.py
+++ b/src/itsdangerous/timed.py
@@ -86,7 +86,7 @@ class TimestampSigner(Signer):
age = self.get_timestamp() - timestamp
if age > max_age:
raise SignatureExpired(
- "Signature age %s > %s seconds" % (age, max_age),
+ f"Signature age {age} > {max_age} seconds",
payload=value,
date_signed=self.timestamp_to_datetime(timestamp),
)
diff --git a/src/itsdangerous/url_safe.py b/src/itsdangerous/url_safe.py
index fcaa011..f3c73c0 100644
--- a/src/itsdangerous/url_safe.py
+++ b/src/itsdangerous/url_safe.py
@@ -8,7 +8,7 @@ from .serializer import Serializer
from .timed import TimedSerializer
-class URLSafeSerializerMixin(object):
+class URLSafeSerializerMixin:
"""Mixed in with a regular serializer it will attempt to zlib
compress the string to make it shorter if necessary. It will also
base64 encode the string so that it can safely be placed in a URL.
@@ -36,10 +36,10 @@ class URLSafeSerializerMixin(object):
"Could not zlib decompress the payload before decoding the payload",
original_error=e,
)
- return super(URLSafeSerializerMixin, self).load_payload(json, *args, **kwargs)
+ return super().load_payload(json, *args, **kwargs)
def dump_payload(self, obj):
- json = super(URLSafeSerializerMixin, self).dump_payload(obj)
+ json = super().dump_payload(obj)
is_compressed = False
compressed = zlib.compress(json)
if len(compressed) < (len(json) - 1):