Refs #23919 -- Replaced super(...) with super() in metaclasses.
This commit is contained in:
parent
46a0edc3ba
commit
86a0231e0a
|
@ -30,7 +30,7 @@ class DeclarativeFieldsMetaclass(MediaDefiningClass):
|
|||
attrs.pop(key)
|
||||
attrs['declared_fields'] = dict(current_fields)
|
||||
|
||||
new_class = super(DeclarativeFieldsMetaclass, mcs).__new__(mcs, name, bases, attrs)
|
||||
new_class = super().__new__(mcs, name, bases, attrs)
|
||||
|
||||
# Walk through the MRO.
|
||||
declared_fields = {}
|
||||
|
|
|
@ -214,7 +214,7 @@ class ModelFormMetaclass(DeclarativeFieldsMetaclass):
|
|||
|
||||
formfield_callback = attrs.pop('formfield_callback', base_formfield_callback)
|
||||
|
||||
new_class = super(ModelFormMetaclass, mcs).__new__(mcs, name, bases, attrs)
|
||||
new_class = super().__new__(mcs, name, bases, attrs)
|
||||
|
||||
if bases == (BaseModelForm,):
|
||||
return new_class
|
||||
|
|
|
@ -183,7 +183,7 @@ class MediaDefiningClass(type):
|
|||
Metaclass for classes that can have media definitions.
|
||||
"""
|
||||
def __new__(mcs, name, bases, attrs):
|
||||
new_class = super(MediaDefiningClass, mcs).__new__(mcs, name, bases, attrs)
|
||||
new_class = super().__new__(mcs, name, bases, attrs)
|
||||
|
||||
if 'media' not in attrs:
|
||||
new_class.media = media_property(new_class)
|
||||
|
|
|
@ -226,7 +226,7 @@ class ModelTests(TestCase):
|
|||
"""
|
||||
class HorseBase(models.base.ModelBase):
|
||||
def __init__(cls, name, bases, attrs):
|
||||
super(HorseBase, cls).__init__(name, bases, attrs)
|
||||
super().__init__(name, bases, attrs)
|
||||
cls.horns = (1 if 'magic' in attrs else 0)
|
||||
|
||||
class Horse(models.Model, metaclass=HorseBase):
|
||||
|
|
Loading…
Reference in New Issue