summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/datastructures.py19
-rw-r--r--django/utils/decorators.py2
-rw-r--r--django/utils/deprecation.py6
-rw-r--r--django/utils/functional.py2
-rw-r--r--django/utils/jslex.py2
-rw-r--r--django/utils/log.py4
-rw-r--r--django/utils/safestring.py4
-rw-r--r--django/utils/six.py6
-rw-r--r--django/utils/text.py2
9 files changed, 23 insertions, 24 deletions
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py
index a61a445ab0..8e64328a2c 100644
--- a/django/utils/datastructures.py
+++ b/django/utils/datastructures.py
@@ -63,11 +63,10 @@ class MultiValueDict(dict):
single name-value pairs.
"""
def __init__(self, key_to_list_mapping=()):
- super(MultiValueDict, self).__init__(key_to_list_mapping)
+ super().__init__(key_to_list_mapping)
def __repr__(self):
- return "<%s: %s>" % (self.__class__.__name__,
- super(MultiValueDict, self).__repr__())
+ return "<%s: %s>" % (self.__class__.__name__, super().__repr__())
def __getitem__(self, key):
"""
@@ -75,7 +74,7 @@ class MultiValueDict(dict):
raises KeyError if not found.
"""
try:
- list_ = super(MultiValueDict, self).__getitem__(key)
+ list_ = super().__getitem__(key)
except KeyError:
raise MultiValueDictKeyError(repr(key))
try:
@@ -84,7 +83,7 @@ class MultiValueDict(dict):
return []
def __setitem__(self, key, value):
- super(MultiValueDict, self).__setitem__(key, [value])
+ super().__setitem__(key, [value])
def __copy__(self):
return self.__class__([
@@ -134,7 +133,7 @@ class MultiValueDict(dict):
return a new copy of values.
"""
try:
- values = super(MultiValueDict, self).__getitem__(key)
+ values = super().__getitem__(key)
except KeyError:
if default is None:
return []
@@ -152,7 +151,7 @@ class MultiValueDict(dict):
return self._getlist(key, default, force_list=True)
def setlist(self, key, list_):
- super(MultiValueDict, self).__setitem__(key, list_)
+ super().__setitem__(key, list_)
def setdefault(self, key, default=None):
if key not in self:
@@ -184,7 +183,7 @@ class MultiValueDict(dict):
def lists(self):
"""Yields (key, list) pairs."""
- return iter(super(MultiValueDict, self).items())
+ return iter(super().items())
def values(self):
"""Yield the last value on every key list."""
@@ -278,7 +277,7 @@ class DictWrapper(dict):
quoted before being used.
"""
def __init__(self, data, func, prefix):
- super(DictWrapper, self).__init__(data)
+ super().__init__(data)
self.func = func
self.prefix = prefix
@@ -293,7 +292,7 @@ class DictWrapper(dict):
key = key[len(self.prefix):]
else:
use_func = False
- value = super(DictWrapper, self).__getitem__(key)
+ value = super().__getitem__(key)
if use_func:
return self.func(value)
return value
diff --git a/django/utils/decorators.py b/django/utils/decorators.py
index 7621d2fabd..87a20cf23b 100644
--- a/django/utils/decorators.py
+++ b/django/utils/decorators.py
@@ -9,7 +9,7 @@ class classonlymethod(classmethod):
def __get__(self, instance, cls=None):
if instance is not None:
raise AttributeError("This method is available only on the class, not on instances.")
- return super(classonlymethod, self).__get__(instance, cls)
+ return super().__get__(instance, cls)
def method_decorator(decorator, name=''):
diff --git a/django/utils/deprecation.py b/django/utils/deprecation.py
index 2ef95bc343..cb8b001583 100644
--- a/django/utils/deprecation.py
+++ b/django/utils/deprecation.py
@@ -45,7 +45,7 @@ class RenameMethodsBase(type):
renamed_methods = ()
def __new__(cls, name, bases, attrs):
- new_class = super(RenameMethodsBase, cls).__new__(cls, name, bases, attrs)
+ new_class = super().__new__(cls, name, bases, attrs)
for base in inspect.getmro(new_class):
class_name = base.__name__
@@ -79,13 +79,13 @@ class DeprecationInstanceCheck(type):
"`%s` is deprecated, use `%s` instead." % (self.__name__, self.alternative),
self.deprecation_warning, 2
)
- return super(DeprecationInstanceCheck, self).__instancecheck__(instance)
+ return super().__instancecheck__(instance)
class MiddlewareMixin:
def __init__(self, get_response=None):
self.get_response = get_response
- super(MiddlewareMixin, self).__init__()
+ super().__init__()
def __call__(self, request):
response = None
diff --git a/django/utils/functional.py b/django/utils/functional.py
index 30e484eaa3..6b4126764c 100644
--- a/django/utils/functional.py
+++ b/django/utils/functional.py
@@ -348,7 +348,7 @@ class SimpleLazyObject(LazyObject):
value.
"""
self.__dict__['_setupfunc'] = func
- super(SimpleLazyObject, self).__init__()
+ super().__init__()
def _setup(self):
self._wrapped = self._setupfunc()
diff --git a/django/utils/jslex.py b/django/utils/jslex.py
index 98b5d56e9d..7738ce468a 100644
--- a/django/utils/jslex.py
+++ b/django/utils/jslex.py
@@ -179,7 +179,7 @@ class JsLexer(Lexer):
}
def __init__(self):
- super(JsLexer, self).__init__(self.states, 'reg')
+ super().__init__(self.states, 'reg')
def prepare_js_for_gettext(js):
diff --git a/django/utils/log.py b/django/utils/log.py
index 77e2f59250..495b846a62 100644
--- a/django/utils/log.py
+++ b/django/utils/log.py
@@ -159,7 +159,7 @@ class RequireDebugTrue(logging.Filter):
class ServerFormatter(logging.Formatter):
def __init__(self, *args, **kwargs):
self.style = color_style()
- super(ServerFormatter, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
def format(self, record):
msg = record.msg
@@ -187,7 +187,7 @@ class ServerFormatter(logging.Formatter):
record.server_time = self.formatTime(record, self.datefmt)
record.msg = msg
- return super(ServerFormatter, self).format(record)
+ return super().format(record)
def uses_server_time(self):
return self._fmt.find('%(server_time)') >= 0
diff --git a/django/utils/safestring.py b/django/utils/safestring.py
index 2dfbd01cfe..9b83a947d5 100644
--- a/django/utils/safestring.py
+++ b/django/utils/safestring.py
@@ -28,7 +28,7 @@ class SafeBytes(bytes, SafeData):
Concatenating a safe byte string with another safe byte string or safe
unicode string is safe. Otherwise, the result is no longer safe.
"""
- t = super(SafeBytes, self).__add__(rhs)
+ t = super().__add__(rhs)
if isinstance(rhs, SafeText):
return SafeText(t)
elif isinstance(rhs, SafeBytes):
@@ -61,7 +61,7 @@ class SafeText(str, SafeData):
Concatenating a safe unicode string with another safe byte string or
safe unicode string is safe. Otherwise, the result is no longer safe.
"""
- t = super(SafeText, self).__add__(rhs)
+ t = super().__add__(rhs)
if isinstance(rhs, SafeData):
return SafeText(t)
return t
diff --git a/django/utils/six.py b/django/utils/six.py
index 95f16f58d9..975fbfcf4f 100644
--- a/django/utils/six.py
+++ b/django/utils/six.py
@@ -101,7 +101,7 @@ class _LazyDescr:
class MovedModule(_LazyDescr):
def __init__(self, name, old, new=None):
- super(MovedModule, self).__init__(name)
+ super().__init__(name)
if PY3:
if new is None:
new = name
@@ -122,7 +122,7 @@ class MovedModule(_LazyDescr):
class _LazyModule(types.ModuleType):
def __init__(self, name):
- super(_LazyModule, self).__init__(name)
+ super().__init__(name)
self.__doc__ = self.__class__.__doc__
def __dir__(self):
@@ -137,7 +137,7 @@ class _LazyModule(types.ModuleType):
class MovedAttribute(_LazyDescr):
def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None):
- super(MovedAttribute, self).__init__(name)
+ super().__init__(name)
if PY3:
if new_mod is None:
new_mod = name
diff --git a/django/utils/text.py b/django/utils/text.py
index 26a8b859ef..70f6b60777 100644
--- a/django/utils/text.py
+++ b/django/utils/text.py
@@ -64,7 +64,7 @@ class Truncator(SimpleLazyObject):
An object used to truncate text, either by characters or words.
"""
def __init__(self, text):
- super(Truncator, self).__init__(lambda: force_text(text))
+ super().__init__(lambda: force_text(text))
def add_truncation_text(self, text, truncate=None):
if truncate is None: