From 86a0231e0a087d4b909f76223cc55d5bbb673930 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Thu, 28 Nov 2019 06:34:29 -0800 Subject: [PATCH] Refs #23919 -- Replaced super(...) with super() in metaclasses. --- django/forms/forms.py | 2 +- django/forms/models.py | 2 +- django/forms/widgets.py | 2 +- tests/model_regress/tests.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/django/forms/forms.py b/django/forms/forms.py index 48b237611f..a601467e18 100644 --- a/django/forms/forms.py +++ b/django/forms/forms.py @@ -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 = {} diff --git a/django/forms/models.py b/django/forms/models.py index 8b8be56b3b..d72c62f7f0 100644 --- a/django/forms/models.py +++ b/django/forms/models.py @@ -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 diff --git a/django/forms/widgets.py b/django/forms/widgets.py index b1d885b2a3..6fe220bea7 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -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) diff --git a/tests/model_regress/tests.py b/tests/model_regress/tests.py index 28eed87008..ba496d1f26 100644 --- a/tests/model_regress/tests.py +++ b/tests/model_regress/tests.py @@ -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):