Refs #23919 -- Replaced super(ClassName, self) with super().

This commit is contained in:
chillaranand 2017-01-21 18:43:44 +05:30 committed by Tim Graham
parent dc165ec8e5
commit d6eaf7c018
339 changed files with 1221 additions and 1296 deletions

View file

@ -114,7 +114,7 @@ class Team:
class TeamField(models.CharField):
def __init__(self):
super(TeamField, self).__init__(max_length=100)
super().__init__(max_length=100)
def get_db_prep_save(self, value, connection):
return str(value.title)
@ -131,7 +131,7 @@ class TeamField(models.CharField):
return self.value_from_object(obj).to_string()
def deconstruct(self):
name, path, args, kwargs = super(TeamField, self).deconstruct()
name, path, args, kwargs = super().deconstruct()
del kwargs['max_length']
return name, path, args, kwargs

View file

@ -277,7 +277,7 @@ class ModifyingSaveData(models.Model):
(#4459).
"""
self.data = 666
super(ModifyingSaveData, self).save(*args, **kwargs)
super().save(*args, **kwargs)
# Tests for serialization of models using inheritance.
# Regression for #7202, #7350

View file

@ -86,7 +86,7 @@ class JsonSerializerTestCase(SerializersTestBase, TestCase):
def default(self, o):
if isinstance(o, decimal.Decimal):
return str(o)
return super(CustomJSONEncoder, self).default(o)
return super().default(o)
s = serializers.json.Serializer()
json_data = s.serialize(

View file

@ -47,7 +47,7 @@ class NoYamlSerializerTestCase(SimpleTestCase):
@classmethod
def setUpClass(cls):
"""Removes imported yaml and stubs importlib.import_module"""
super(NoYamlSerializerTestCase, cls).setUpClass()
super().setUpClass()
cls._import_module_mock = YamlImportModuleMock()
importlib.import_module = cls._import_module_mock.import_module
@ -58,7 +58,7 @@ class NoYamlSerializerTestCase(SimpleTestCase):
@classmethod
def tearDownClass(cls):
"""Puts yaml back if necessary"""
super(NoYamlSerializerTestCase, cls).tearDownClass()
super().tearDownClass()
importlib.import_module = cls._import_module_mock._import_module