summaryrefslogtreecommitdiff
path: root/kombu/serialization.py
diff options
context:
space:
mode:
authorOmer Katz <omer.drow@gmail.com>2020-07-13 16:58:06 +0300
committerOmer Katz <omer.drow@gmail.com>2020-07-13 16:58:06 +0300
commit7a6e7cc45b9afe799770313a66c4211d1986ff30 (patch)
tree189c7fa2e7ca9835e14975093c12b7e5d3d8213b /kombu/serialization.py
parent016f4accb634ebc3eb8fc66741f23552e5966ea7 (diff)
downloadkombu-7a6e7cc45b9afe799770313a66c4211d1986ff30.tar.gz
pyupgrade
Diffstat (limited to 'kombu/serialization.py')
-rw-r--r--kombu/serialization.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/kombu/serialization.py b/kombu/serialization.py
index 8469a89f..ee833839 100644
--- a/kombu/serialization.py
+++ b/kombu/serialization.py
@@ -1,5 +1,4 @@
"""Serialization utilities."""
-from __future__ import absolute_import, unicode_literals
import codecs
import os
@@ -60,10 +59,10 @@ def pickle_loads(s, load=pickle_load):
def parenthesize_alias(first, second):
- return '%s (%s)' % (first, second) if first else second
+ return f'{first} ({second})' if first else second
-class SerializerRegistry(object):
+class SerializerRegistry:
"""The registry keeps track of serialization methods."""
def __init__(self):
@@ -137,7 +136,7 @@ class SerializerRegistry(object):
self.name_to_type.pop(name, None)
except KeyError:
raise SerializerNotInstalled(
- 'No encoder/decoder installed for {0}'.format(name))
+ f'No encoder/decoder installed for {name}')
def _set_default_serializer(self, name):
"""Set the default serialization method used by this library.
@@ -156,7 +155,7 @@ class SerializerRegistry(object):
self._default_encode) = self._encoders[name]
except KeyError:
raise SerializerNotInstalled(
- 'No encoder installed for {0}'.format(name))
+ f'No encoder installed for {name}')
def dumps(self, data, serializer=None):
"""Encode data.
@@ -193,7 +192,7 @@ class SerializerRegistry(object):
return raw_encode(data)
if serializer and not self._encoders.get(serializer):
raise SerializerNotInstalled(
- 'No encoder installed for {0}'.format(serializer))
+ f'No encoder installed for {serializer}')
# If a raw string was sent, assume binary encoding
# (it's likely either ASCII or a raw binary file, and a character
@@ -269,7 +268,7 @@ class SerializerRegistry(object):
def _for_untrusted_content(self, ctype, why):
return ContentDisallowed(
- 'Refusing to deserialize {0} content of type {1}'.format(
+ 'Refusing to deserialize {} content of type {}'.format(
why,
parenthesize_alias(self.type_to_name.get(ctype, ctype), ctype),
),