summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Charette <charettes@users.noreply.github.com>2017-01-19 02:39:46 -0500
committerClaude Paroz <claude@2xlibre.net>2017-01-19 08:39:46 +0100
commitcecc079168e8669138728d31611ff3a1e7eb3a9f (patch)
tree2415083d44f84c6f206930fc689a8c0e50a98caa
parenta5563963397aeee30c32e3c1dab31bfe453ca89f (diff)
downloaddjango-cecc079168e8669138728d31611ff3a1e7eb3a9f.tar.gz
Refs #23919 -- Stopped inheriting from object to define new style classes.
-rw-r--r--django/apps/config.py2
-rw-r--r--django/apps/registry.py2
-rw-r--r--django/conf/__init__.py4
-rw-r--r--django/contrib/admin/checks.py2
-rw-r--r--django/contrib/admin/filters.py2
-rw-r--r--django/contrib/admin/helpers.py12
-rw-r--r--django/contrib/admin/sites.py2
-rw-r--r--django/contrib/admin/views/main.py2
-rw-r--r--django/contrib/auth/backends.py2
-rw-r--r--django/contrib/auth/context_processors.py4
-rw-r--r--django/contrib/auth/hashers.py2
-rw-r--r--django/contrib/auth/mixins.py2
-rw-r--r--django/contrib/auth/models.py2
-rw-r--r--django/contrib/auth/password_validation.py8
-rw-r--r--django/contrib/auth/tokens.py2
-rw-r--r--django/contrib/auth/views.py4
-rw-r--r--django/contrib/contenttypes/fields.py2
-rw-r--r--django/contrib/gis/db/backends/base/adapter.py2
-rw-r--r--django/contrib/gis/db/backends/base/features.py2
-rw-r--r--django/contrib/gis/db/backends/base/models.py2
-rw-r--r--django/contrib/gis/db/backends/base/operations.py2
-rw-r--r--django/contrib/gis/db/backends/postgis/adapter.py2
-rw-r--r--django/contrib/gis/db/backends/utils.py2
-rw-r--r--django/contrib/gis/db/models/fields.py2
-rw-r--r--django/contrib/gis/db/models/functions.py6
-rw-r--r--django/contrib/gis/db/models/sql/conversion.py2
-rw-r--r--django/contrib/gis/feeds.py2
-rw-r--r--django/contrib/gis/gdal/envelope.py2
-rw-r--r--django/contrib/gis/gdal/geomtype.py2
-rw-r--r--django/contrib/gis/geoip2/base.py2
-rw-r--r--django/contrib/gis/geos/geometry.py2
-rw-r--r--django/contrib/gis/geos/libgeos.py2
-rw-r--r--django/contrib/gis/geos/mutable_list.py2
-rw-r--r--django/contrib/gis/geos/prototypes/threadsafe.py2
-rw-r--r--django/contrib/gis/measure.py2
-rw-r--r--django/contrib/gis/ptr.py2
-rw-r--r--django/contrib/gis/serializers/geojson.py2
-rw-r--r--django/contrib/gis/utils/layermapping.py2
-rw-r--r--django/contrib/messages/storage/base.py4
-rw-r--r--django/contrib/messages/views.py2
-rw-r--r--django/contrib/postgres/fields/array.py4
-rw-r--r--django/contrib/postgres/fields/hstore.py2
-rw-r--r--django/contrib/postgres/fields/jsonb.py4
-rw-r--r--django/contrib/postgres/fields/utils.py2
-rw-r--r--django/contrib/postgres/search.py4
-rw-r--r--django/contrib/postgres/validators.py2
-rw-r--r--django/contrib/sessions/backends/base.py2
-rw-r--r--django/contrib/sessions/serializers.py2
-rw-r--r--django/contrib/sitemaps/__init__.py2
-rw-r--r--django/contrib/sites/requests.py2
-rw-r--r--django/contrib/staticfiles/finders.py2
-rw-r--r--django/contrib/staticfiles/storage.py4
-rw-r--r--django/contrib/syndication/views.py2
-rw-r--r--django/core/cache/__init__.py4
-rw-r--r--django/core/cache/backends/base.py2
-rw-r--r--django/core/cache/backends/db.py4
-rw-r--r--django/core/checks/messages.py2
-rw-r--r--django/core/checks/registry.py4
-rw-r--r--django/core/files/storage.py2
-rw-r--r--django/core/files/uploadhandler.py2
-rw-r--r--django/core/files/utils.py2
-rw-r--r--django/core/handlers/base.py2
-rw-r--r--django/core/handlers/wsgi.py2
-rw-r--r--django/core/mail/backends/base.py2
-rw-r--r--django/core/mail/message.py2
-rw-r--r--django/core/mail/utils.py2
-rw-r--r--django/core/management/__init__.py2
-rw-r--r--django/core/management/base.py4
-rw-r--r--django/core/management/color.py2
-rw-r--r--django/core/management/commands/makemessages.py4
-rw-r--r--django/core/paginator.py2
-rw-r--r--django/core/serializers/__init__.py4
-rw-r--r--django/core/serializers/base.py6
-rw-r--r--django/core/servers/basehttp.py6
-rw-r--r--django/core/signing.py4
-rw-r--r--django/core/validators.py10
-rw-r--r--django/db/__init__.py2
-rw-r--r--django/db/backends/base/base.py2
-rw-r--r--django/db/backends/base/client.py2
-rw-r--r--django/db/backends/base/creation.py2
-rw-r--r--django/db/backends/base/features.py2
-rw-r--r--django/db/backends/base/introspection.py2
-rw-r--r--django/db/backends/base/operations.py2
-rw-r--r--django/db/backends/base/schema.py2
-rw-r--r--django/db/backends/base/validation.py2
-rw-r--r--django/db/backends/mysql/base.py2
-rw-r--r--django/db/backends/oracle/base.py8
-rw-r--r--django/db/backends/oracle/utils.py2
-rw-r--r--django/db/backends/sqlite3/introspection.py2
-rw-r--r--django/db/backends/utils.py2
-rw-r--r--django/db/migrations/autodetector.py2
-rw-r--r--django/db/migrations/executor.py2
-rw-r--r--django/db/migrations/graph.py4
-rw-r--r--django/db/migrations/loader.py2
-rw-r--r--django/db/migrations/migration.py2
-rw-r--r--django/db/migrations/operations/base.py2
-rw-r--r--django/db/migrations/optimizer.py2
-rw-r--r--django/db/migrations/questioner.py2
-rw-r--r--django/db/migrations/recorder.py2
-rw-r--r--django/db/migrations/serializer.py2
-rw-r--r--django/db/migrations/state.py4
-rw-r--r--django/db/migrations/utils.py2
-rw-r--r--django/db/migrations/writer.py4
-rw-r--r--django/db/models/base.py4
-rw-r--r--django/db/models/deletion.py2
-rw-r--r--django/db/models/expressions.py4
-rw-r--r--django/db/models/fields/__init__.py6
-rw-r--r--django/db/models/fields/files.py2
-rw-r--r--django/db/models/fields/related.py2
-rw-r--r--django/db/models/fields/related_descriptors.py6
-rw-r--r--django/db/models/fields/related_lookups.py4
-rw-r--r--django/db/models/fields/reverse_related.py2
-rw-r--r--django/db/models/functions/datetime.py2
-rw-r--r--django/db/models/indexes.py2
-rw-r--r--django/db/models/lookups.py8
-rw-r--r--django/db/models/manager.py4
-rw-r--r--django/db/models/options.py2
-rw-r--r--django/db/models/query.py10
-rw-r--r--django/db/models/query_utils.py6
-rw-r--r--django/db/models/sql/compiler.py2
-rw-r--r--django/db/models/sql/datastructures.py6
-rw-r--r--django/db/models/sql/query.py6
-rw-r--r--django/db/models/sql/where.py6
-rw-r--r--django/db/utils.py6
-rw-r--r--django/dispatch/dispatcher.py2
-rw-r--r--django/forms/boundfield.py4
-rw-r--r--django/forms/fields.py4
-rw-r--r--django/forms/forms.py2
-rw-r--r--django/forms/formsets.py2
-rw-r--r--django/forms/models.py10
-rw-r--r--django/forms/renderers.py4
-rw-r--r--django/forms/widgets.py2
-rw-r--r--django/http/multipartparser.py4
-rw-r--r--django/http/request.py2
-rw-r--r--django/template/backends/base.py2
-rw-r--r--django/template/backends/django.py2
-rw-r--r--django/template/backends/jinja2.py4
-rw-r--r--django/template/base.py16
-rw-r--r--django/template/context.py2
-rw-r--r--django/template/engine.py2
-rw-r--r--django/template/library.py2
-rw-r--r--django/template/loader_tags.py2
-rw-r--r--django/template/loaders/base.py2
-rw-r--r--django/template/smartif.py4
-rw-r--r--django/template/utils.py2
-rw-r--r--django/templatetags/tz.py6
-rw-r--r--django/test/client.py4
-rw-r--r--django/test/html.py2
-rw-r--r--django/test/runner.py6
-rw-r--r--django/test/testcases.py8
-rw-r--r--django/test/utils.py10
-rw-r--r--django/urls/resolvers.py6
-rw-r--r--django/utils/archive.py4
-rw-r--r--django/utils/baseconv.py2
-rw-r--r--django/utils/datastructures.py2
-rw-r--r--django/utils/dateformat.py2
-rw-r--r--django/utils/decorators.py4
-rw-r--r--django/utils/deprecation.py4
-rw-r--r--django/utils/feedgenerator.py4
-rw-r--r--django/utils/functional.py6
-rw-r--r--django/utils/jslex.py4
-rw-r--r--django/utils/safestring.py2
-rw-r--r--django/utils/six.py8
-rw-r--r--django/utils/synch.py2
-rw-r--r--django/utils/text.py2
-rw-r--r--django/utils/translation/__init__.py2
-rw-r--r--django/utils/tree.py2
-rw-r--r--django/views/debug.py6
-rw-r--r--django/views/generic/base.py6
-rw-r--r--django/views/generic/dates.py10
-rw-r--r--django/views/generic/edit.py2
-rw-r--r--tests/admin_docs/tests.py2
-rw-r--r--tests/admin_inlines/tests.py2
-rw-r--r--tests/admin_ordering/tests.py4
-rw-r--r--tests/admin_utils/tests.py6
-rw-r--r--tests/admin_views/test_multidb.py2
-rw-r--r--tests/admin_views/tests.py2
-rw-r--r--tests/admin_widgets/tests.py2
-rw-r--r--tests/apps/apps.py2
-rw-r--r--tests/apps/tests.py2
-rw-r--r--tests/auth_tests/models/custom_user.py2
-rw-r--r--tests/auth_tests/test_admin_multidb.py2
-rw-r--r--tests/auth_tests/test_auth_backends.py10
-rw-r--r--tests/auth_tests/test_auth_backends_deprecation.py2
-rw-r--r--tests/auth_tests/test_context_processors.py4
-rw-r--r--tests/auth_tests/test_decorators.py2
-rw-r--r--tests/auth_tests/test_forms.py2
-rw-r--r--tests/auth_tests/test_management.py4
-rw-r--r--tests/backends/tests.py4
-rw-r--r--tests/builtin_server/tests.py4
-rw-r--r--tests/cache/closeable_cache.py2
-rw-r--r--tests/cache/liberal_backend.py2
-rw-r--r--tests/cache/tests.py10
-rw-r--r--tests/check_framework/test_multi_db.py2
-rw-r--r--tests/check_framework/tests.py2
-rw-r--r--tests/contenttypes_tests/tests.py2
-rw-r--r--tests/csrf_tests/tests.py2
-rw-r--r--tests/custom_lookups/tests.py4
-rw-r--r--tests/custom_pk/fields.py2
-rw-r--r--tests/decorators/tests.py34
-rw-r--r--tests/defer/tests.py2
-rw-r--r--tests/deprecation/tests.py4
-rw-r--r--tests/dispatch/tests.py2
-rw-r--r--tests/files/tests.py2
-rw-r--r--tests/fixtures/tests.py2
-rw-r--r--tests/flatpages_tests/test_middleware.py2
-rw-r--r--tests/flatpages_tests/test_views.py2
-rw-r--r--tests/foreign_object/models/article.py2
-rw-r--r--tests/forms_tests/field_tests/__init__.py2
-rw-r--r--tests/forms_tests/field_tests/test_base.py2
-rw-r--r--tests/forms_tests/tests/test_error_messages.py2
-rw-r--r--tests/forms_tests/tests/test_renderers.py2
-rw-r--r--tests/forms_tests/widget_tests/test_clearablefileinput.py10
-rw-r--r--tests/generic_inline_admin/tests.py6
-rw-r--r--tests/generic_views/test_dates.py2
-rw-r--r--tests/generic_views/views.py6
-rw-r--r--tests/get_object_or_404/tests.py2
-rw-r--r--tests/gis_tests/gdal_tests/test_envelope.py2
-rw-r--r--tests/gis_tests/geo3d/tests.py2
-rw-r--r--tests/gis_tests/geos_tests/test_geos.py2
-rw-r--r--tests/gis_tests/layermap/tests.py2
-rw-r--r--tests/gis_tests/test_data.py6
-rw-r--r--tests/gis_tests/tests.py2
-rw-r--r--tests/handlers/tests_custom_error_handlers.py2
-rw-r--r--tests/i18n/utils.py4
-rw-r--r--tests/invalid_models_tests/test_models.py2
-rw-r--r--tests/invalid_models_tests/test_ordinary_fields.py4
-rw-r--r--tests/logging_tests/tests.py2
-rw-r--r--tests/mail/tests.py4
-rw-r--r--tests/messages_tests/base.py2
-rw-r--r--tests/messages_tests/test_api.py4
-rw-r--r--tests/middleware_exceptions/middleware.py2
-rw-r--r--tests/middleware_exceptions/tests.py4
-rw-r--r--tests/migrate_signals/tests.py4
-rw-r--r--tests/migrations/models.py2
-rw-r--r--tests/migrations/routers.py4
-rw-r--r--tests/migrations/test_autodetector.py2
-rw-r--r--tests/migrations/test_executor.py4
-rw-r--r--tests/migrations/test_multidb.py8
-rw-r--r--tests/migrations/test_operations.py2
-rw-r--r--tests/migrations/test_writer.py6
-rw-r--r--tests/model_forms/tests.py2
-rw-r--r--tests/model_formsets_regress/tests.py2
-rw-r--r--tests/model_inheritance/models.py2
-rw-r--r--tests/model_inheritance/test_abstract_inheritance.py4
-rw-r--r--tests/modeladmin/test_checks.py12
-rw-r--r--tests/modeladmin/tests.py6
-rw-r--r--tests/multiple_database/routers.py6
-rw-r--r--tests/multiple_database/tests.py14
-rw-r--r--tests/order_with_respect_to/base_tests.py2
-rw-r--r--tests/pagination/tests.py4
-rw-r--r--tests/postgres_tests/models.py2
-rw-r--r--tests/postgres_tests/test_search.py2
-rw-r--r--tests/queries/tests.py4
-rw-r--r--tests/queryset_pickle/models.py4
-rw-r--r--tests/serializers/models/base.py2
-rw-r--r--tests/serializers/test_yaml.py2
-rw-r--r--tests/serializers/tests.py6
-rw-r--r--tests/servers/test_basehttp.py2
-rw-r--r--tests/sessions_tests/tests.py2
-rw-r--r--tests/signals/tests.py4
-rw-r--r--tests/sites_tests/tests.py2
-rw-r--r--tests/staticfiles_tests/cases.py4
-rw-r--r--tests/staticfiles_tests/test_finders.py2
-rw-r--r--tests/staticfiles_tests/test_management.py2
-rw-r--r--tests/staticfiles_tests/test_storage.py2
-rw-r--r--tests/template_tests/filter_tests/test_floatformat.py2
-rw-r--r--tests/template_tests/filter_tests/test_unordered_list.py4
-rw-r--r--tests/template_tests/test_callables.py8
-rw-r--r--tests/template_tests/test_logging.py2
-rw-r--r--tests/template_tests/utils.py6
-rw-r--r--tests/test_client/auth_backends.py2
-rw-r--r--tests/test_client/views.py2
-rw-r--r--tests/test_client_regress/tests.py4
-rw-r--r--tests/test_runner/tests.py2
-rw-r--r--tests/transactions/tests.py2
-rw-r--r--tests/urlpatterns_reverse/method_view_urls.py2
-rw-r--r--tests/urlpatterns_reverse/tests.py2
-rw-r--r--tests/urlpatterns_reverse/utils.py2
-rw-r--r--tests/urlpatterns_reverse/views.py2
-rw-r--r--tests/utils_tests/test_archive.py2
-rw-r--r--tests/utils_tests/test_decorators.py12
-rw-r--r--tests/utils_tests/test_encoding.py2
-rw-r--r--tests/utils_tests/test_functional.py8
-rw-r--r--tests/utils_tests/test_html.py8
-rw-r--r--tests/utils_tests/test_inspect.py2
-rw-r--r--tests/utils_tests/test_lazyobject.py6
-rw-r--r--tests/utils_tests/test_module/__init__.py2
-rw-r--r--tests/utils_tests/test_module_loading.py6
-rw-r--r--tests/utils_tests/test_safestring.py2
-rw-r--r--tests/view_tests/tests/test_debug.py14
-rw-r--r--tests/view_tests/views.py2
-rw-r--r--tests/wsgi/tests.py2
293 files changed, 512 insertions, 514 deletions
diff --git a/django/apps/config.py b/django/apps/config.py
index edb1146afc..024643a645 100644
--- a/django/apps/config.py
+++ b/django/apps/config.py
@@ -8,7 +8,7 @@ from django.utils.module_loading import module_has_submodule
MODELS_MODULE_NAME = 'models'
-class AppConfig(object):
+class AppConfig:
"""
Class representing a Django application and its configuration.
"""
diff --git a/django/apps/registry.py b/django/apps/registry.py
index c67c5ee0ba..870c454067 100644
--- a/django/apps/registry.py
+++ b/django/apps/registry.py
@@ -10,7 +10,7 @@ from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured
from .config import AppConfig
-class Apps(object):
+class Apps:
"""
A registry that stores the configuration of installed applications.
diff --git a/django/conf/__init__.py b/django/conf/__init__.py
index f99236a778..ec6efa8e96 100644
--- a/django/conf/__init__.py
+++ b/django/conf/__init__.py
@@ -97,7 +97,7 @@ class LazySettings(LazyObject):
return self._wrapped is not empty
-class Settings(object):
+class Settings:
def __init__(self, settings_module):
# update this dict from global settings (but only for ALL_CAPS settings)
for setting in dir(global_settings):
@@ -150,7 +150,7 @@ class Settings(object):
}
-class UserSettingsHolder(object):
+class UserSettingsHolder:
"""
Holder for user configured settings.
"""
diff --git a/django/contrib/admin/checks.py b/django/contrib/admin/checks.py
index 33c60a3ab8..354d0a3a9c 100644
--- a/django/contrib/admin/checks.py
+++ b/django/contrib/admin/checks.py
@@ -62,7 +62,7 @@ def check_dependencies(**kwargs):
return errors
-class BaseModelAdminChecks(object):
+class BaseModelAdminChecks:
def check(self, admin_obj, **kwargs):
errors = []
diff --git a/django/contrib/admin/filters.py b/django/contrib/admin/filters.py
index 87839c3130..923caa33e9 100644
--- a/django/contrib/admin/filters.py
+++ b/django/contrib/admin/filters.py
@@ -18,7 +18,7 @@ from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
-class ListFilter(object):
+class ListFilter:
title = None # Human-readable title to appear in the right sidebar.
template = 'admin/filter.html'
diff --git a/django/contrib/admin/helpers.py b/django/contrib/admin/helpers.py
index 628788b3fa..17aac7a85b 100644
--- a/django/contrib/admin/helpers.py
+++ b/django/contrib/admin/helpers.py
@@ -31,7 +31,7 @@ class ActionForm(forms.Form):
checkbox = forms.CheckboxInput({'class': 'action-select'}, lambda value: False)
-class AdminForm(object):
+class AdminForm:
def __init__(self, form, fieldsets, prepopulated_fields, readonly_fields=None, model_admin=None):
self.form, self.fieldsets = form, fieldsets
self.prepopulated_fields = [{
@@ -68,7 +68,7 @@ class AdminForm(object):
return media
-class Fieldset(object):
+class Fieldset:
def __init__(self, form, name=None, readonly_fields=(), fields=(), classes=(),
description=None, model_admin=None):
self.form = form
@@ -95,7 +95,7 @@ class Fieldset(object):
yield Fieldline(self.form, field, self.readonly_fields, model_admin=self.model_admin)
-class Fieldline(object):
+class Fieldline:
def __init__(self, form, field, readonly_fields=None, model_admin=None):
self.form = form # A django.forms.Form instance
if not hasattr(field, "__iter__") or isinstance(field, str):
@@ -126,7 +126,7 @@ class Fieldline(object):
)
-class AdminField(object):
+class AdminField:
def __init__(self, form, field, is_first):
self.field = form[field] # A django.forms.BoundField instance
self.is_first = is_first # Whether this field is first on the line
@@ -155,7 +155,7 @@ class AdminField(object):
return mark_safe(self.field.errors.as_ul())
-class AdminReadonlyField(object):
+class AdminReadonlyField:
def __init__(self, form, field, is_first, model_admin=None):
# Make self.field look a little bit like a field. This means that
# {{ field.name }} must be a useful class name to identify the field.
@@ -223,7 +223,7 @@ class AdminReadonlyField(object):
return conditional_escape(result_repr)
-class InlineAdminFormSet(object):
+class InlineAdminFormSet:
"""
A wrapper around an inline formset for use in the admin system.
"""
diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py
index 14b0da7df4..6adf13fdb8 100644
--- a/django/contrib/admin/sites.py
+++ b/django/contrib/admin/sites.py
@@ -26,7 +26,7 @@ class NotRegistered(Exception):
pass
-class AdminSite(object):
+class AdminSite:
"""
An AdminSite object encapsulates an instance of the Django admin application, ready
to be hooked in to your URLconf. Models are registered with the AdminSite using the
diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py
index 81facb9b82..20bce0c8d6 100644
--- a/django/contrib/admin/views/main.py
+++ b/django/contrib/admin/views/main.py
@@ -34,7 +34,7 @@ IGNORED_PARAMS = (
ALL_VAR, ORDER_VAR, ORDER_TYPE_VAR, SEARCH_VAR, IS_POPUP_VAR, TO_FIELD_VAR)
-class ChangeList(object):
+class ChangeList:
def __init__(self, request, model, list_display, list_display_links,
list_filter, date_hierarchy, search_fields, list_select_related,
list_per_page, list_max_show_all, list_editable, model_admin):
diff --git a/django/contrib/auth/backends.py b/django/contrib/auth/backends.py
index 08a20c61ff..e0fbd21b38 100644
--- a/django/contrib/auth/backends.py
+++ b/django/contrib/auth/backends.py
@@ -4,7 +4,7 @@ from django.contrib.auth.models import Permission
UserModel = get_user_model()
-class ModelBackend(object):
+class ModelBackend:
"""
Authenticates against settings.AUTH_USER_MODEL.
"""
diff --git a/django/contrib/auth/context_processors.py b/django/contrib/auth/context_processors.py
index ce1e42d574..f865fc1b7d 100644
--- a/django/contrib/auth/context_processors.py
+++ b/django/contrib/auth/context_processors.py
@@ -2,7 +2,7 @@
# the template system can understand.
-class PermLookupDict(object):
+class PermLookupDict:
def __init__(self, user, app_label):
self.user, self.app_label = user, app_label
@@ -24,7 +24,7 @@ class PermLookupDict(object):
return type(self).__bool__(self)
-class PermWrapper(object):
+class PermWrapper:
def __init__(self, user):
self.user = user
diff --git a/django/contrib/auth/hashers.py b/django/contrib/auth/hashers.py
index 871519257a..0446cf501f 100644
--- a/django/contrib/auth/hashers.py
+++ b/django/contrib/auth/hashers.py
@@ -162,7 +162,7 @@ def mask_hash(hash, show=6, char="*"):
return masked
-class BasePasswordHasher(object):
+class BasePasswordHasher:
"""
Abstract base class for password hashers
diff --git a/django/contrib/auth/mixins.py b/django/contrib/auth/mixins.py
index c52b573658..e52311670f 100644
--- a/django/contrib/auth/mixins.py
+++ b/django/contrib/auth/mixins.py
@@ -5,7 +5,7 @@ from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.utils.encoding import force_text
-class AccessMixin(object):
+class AccessMixin:
"""
Abstract CBV mixin that gives access mixins the same customizable
functionality.
diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py
index 9eaf7a6e34..bd185b58be 100644
--- a/django/contrib/auth/models.py
+++ b/django/contrib/auth/models.py
@@ -372,7 +372,7 @@ class User(AbstractUser):
swappable = 'AUTH_USER_MODEL'
-class AnonymousUser(object):
+class AnonymousUser:
id = None
pk = None
username = ''
diff --git a/django/contrib/auth/password_validation.py b/django/contrib/auth/password_validation.py
index dee1ebf674..a7319dbd52 100644
--- a/django/contrib/auth/password_validation.py
+++ b/django/contrib/auth/password_validation.py
@@ -90,7 +90,7 @@ def _password_validators_help_text_html(password_validators=None):
password_validators_help_text_html = lazy(_password_validators_help_text_html, str)
-class MinimumLengthValidator(object):
+class MinimumLengthValidator:
"""
Validate whether the password is of a minimum length.
"""
@@ -117,7 +117,7 @@ class MinimumLengthValidator(object):
) % {'min_length': self.min_length}
-class UserAttributeSimilarityValidator(object):
+class UserAttributeSimilarityValidator:
"""
Validate whether the password is sufficiently different from the user's
attributes.
@@ -159,7 +159,7 @@ class UserAttributeSimilarityValidator(object):
return _("Your password can't be too similar to your other personal information.")
-class CommonPasswordValidator(object):
+class CommonPasswordValidator:
"""
Validate whether the password is a common password.
@@ -192,7 +192,7 @@ class CommonPasswordValidator(object):
return _("Your password can't be a commonly used password.")
-class NumericPasswordValidator(object):
+class NumericPasswordValidator:
"""
Validate whether the password is alphanumeric.
"""
diff --git a/django/contrib/auth/tokens.py b/django/contrib/auth/tokens.py
index 18ff42f192..f508327d94 100644
--- a/django/contrib/auth/tokens.py
+++ b/django/contrib/auth/tokens.py
@@ -5,7 +5,7 @@ from django.utils.crypto import constant_time_compare, salted_hmac
from django.utils.http import base36_to_int, int_to_base36
-class PasswordResetTokenGenerator(object):
+class PasswordResetTokenGenerator:
"""
Strategy object used to generate and check tokens for the password
reset mechanism.
diff --git a/django/contrib/auth/views.py b/django/contrib/auth/views.py
index bf95d11a10..cca52a6105 100644
--- a/django/contrib/auth/views.py
+++ b/django/contrib/auth/views.py
@@ -31,7 +31,7 @@ from django.views.generic.edit import FormView
UserModel = get_user_model()
-class SuccessURLAllowedHostsMixin(object):
+class SuccessURLAllowedHostsMixin:
success_url_allowed_hosts = set()
def get_success_url_allowed_hosts(self):
@@ -352,7 +352,7 @@ def password_reset_complete(request,
# prompts for a new password
# - PasswordResetCompleteView shows a success message for the above
-class PasswordContextMixin(object):
+class PasswordContextMixin:
extra_context = None
def get_context_data(self, **kwargs):
diff --git a/django/contrib/contenttypes/fields.py b/django/contrib/contenttypes/fields.py
index d2812e5d2a..efffbfd77a 100644
--- a/django/contrib/contenttypes/fields.py
+++ b/django/contrib/contenttypes/fields.py
@@ -15,7 +15,7 @@ from django.utils.encoding import force_text
from django.utils.functional import cached_property
-class GenericForeignKey(object):
+class GenericForeignKey:
"""
Provide a generic many-to-one relation through the ``content_type`` and
``object_id`` fields.
diff --git a/django/contrib/gis/db/backends/base/adapter.py b/django/contrib/gis/db/backends/base/adapter.py
index 9b12c4320c..b9b05c4472 100644
--- a/django/contrib/gis/db/backends/base/adapter.py
+++ b/django/contrib/gis/db/backends/base/adapter.py
@@ -1,4 +1,4 @@
-class WKTAdapter(object):
+class WKTAdapter:
"""
This provides an adaptor for Geometries sent to the
MySQL and Oracle database backends.
diff --git a/django/contrib/gis/db/backends/base/features.py b/django/contrib/gis/db/backends/base/features.py
index 5ca2881330..85faba2d42 100644
--- a/django/contrib/gis/db/backends/base/features.py
+++ b/django/contrib/gis/db/backends/base/features.py
@@ -3,7 +3,7 @@ import re
from django.contrib.gis.db.models import aggregates
-class BaseSpatialFeatures(object):
+class BaseSpatialFeatures:
gis_enabled = True
# Does the database contain a SpatialRefSys model to store SRID information?
diff --git a/django/contrib/gis/db/backends/base/models.py b/django/contrib/gis/db/backends/base/models.py
index 8388a27f25..89c89a7348 100644
--- a/django/contrib/gis/db/backends/base/models.py
+++ b/django/contrib/gis/db/backends/base/models.py
@@ -1,7 +1,7 @@
from django.contrib.gis import gdal
-class SpatialRefSysMixin(object):
+class SpatialRefSysMixin:
"""
The SpatialRefSysMixin is a class used by the database-dependent
SpatialRefSys objects to reduce redundant code.
diff --git a/django/contrib/gis/db/backends/base/operations.py b/django/contrib/gis/db/backends/base/operations.py
index 436a703e3e..23989da9fc 100644
--- a/django/contrib/gis/db/backends/base/operations.py
+++ b/django/contrib/gis/db/backends/base/operations.py
@@ -1,4 +1,4 @@
-class BaseSpatialOperations(object):
+class BaseSpatialOperations:
"""
This module holds the base `BaseSpatialBackend` object, which is
instantiated by each spatial database backend with the features
diff --git a/django/contrib/gis/db/backends/postgis/adapter.py b/django/contrib/gis/db/backends/postgis/adapter.py
index c94268811b..84ec5bfae9 100644
--- a/django/contrib/gis/db/backends/postgis/adapter.py
+++ b/django/contrib/gis/db/backends/postgis/adapter.py
@@ -8,7 +8,7 @@ from django.contrib.gis.db.backends.postgis.pgraster import to_pgraster
from django.contrib.gis.geometry.backend import Geometry
-class PostGISAdapter(object):
+class PostGISAdapter:
def __init__(self, obj, geography=False):
"""
Initialize on the spatial object.
diff --git a/django/contrib/gis/db/backends/utils.py b/django/contrib/gis/db/backends/utils.py
index 9c3b700852..d479009d4e 100644
--- a/django/contrib/gis/db/backends/utils.py
+++ b/django/contrib/gis/db/backends/utils.py
@@ -4,7 +4,7 @@ backends.
"""
-class SpatialOperator(object):
+class SpatialOperator:
"""
Class encapsulating the behavior specific to a GIS operation (used by lookups).
"""
diff --git a/django/contrib/gis/db/models/fields.py b/django/contrib/gis/db/models/fields.py
index 6435dc4077..101975ed87 100644
--- a/django/contrib/gis/db/models/fields.py
+++ b/django/contrib/gis/db/models/fields.py
@@ -48,7 +48,7 @@ def get_srid_info(srid, connection):
return _srid_cache[alias][srid]
-class GeoSelectFormatMixin(object):
+class GeoSelectFormatMixin:
def select_format(self, compiler, sql, params):
"""
Returns the selection format string, depending on the requirements
diff --git a/django/contrib/gis/db/models/functions.py b/django/contrib/gis/db/models/functions.py
index 77628afa34..0a5c14f7a7 100644
--- a/django/contrib/gis/db/models/functions.py
+++ b/django/contrib/gis/db/models/functions.py
@@ -100,7 +100,7 @@ class GeoFuncWithGeoParam(GeoFunc):
super(GeoFuncWithGeoParam, self).__init__(expression, GeomValue(geom), *expressions, **extra)
-class SQLiteDecimalToFloatMixin(object):
+class SQLiteDecimalToFloatMixin:
"""
By default, Decimal values are converted to str by the SQLite backend, which
is not acceptable by the GIS functions expecting numeric values.
@@ -112,7 +112,7 @@ class SQLiteDecimalToFloatMixin(object):
return super(SQLiteDecimalToFloatMixin, self).as_sql(compiler, connection)
-class OracleToleranceMixin(object):
+class OracleToleranceMixin:
tolerance = 0.05
def as_oracle(self, compiler, connection):
@@ -230,7 +230,7 @@ class Difference(OracleToleranceMixin, GeoFuncWithGeoParam):
arity = 2
-class DistanceResultMixin(object):
+class DistanceResultMixin:
def source_is_geography(self):
return self.get_source_fields()[0].geography and self.srid == 4326
diff --git a/django/contrib/gis/db/models/sql/conversion.py b/django/contrib/gis/db/models/sql/conversion.py
index 054628d481..ed414ca76e 100644
--- a/django/contrib/gis/db/models/sql/conversion.py
+++ b/django/contrib/gis/db/models/sql/conversion.py
@@ -9,7 +9,7 @@ from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.measure import Area, Distance
-class BaseField(object):
+class BaseField:
empty_strings_allowed = True
def get_db_converters(self, connection):
diff --git a/django/contrib/gis/feeds.py b/django/contrib/gis/feeds.py
index 4240968f19..807a313bf4 100644
--- a/django/contrib/gis/feeds.py
+++ b/django/contrib/gis/feeds.py
@@ -2,7 +2,7 @@ from django.contrib.syndication.views import Feed as BaseFeed
from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed
-class GeoFeedMixin(object):
+class GeoFeedMixin:
"""
This mixin provides the necessary routines for SyndicationFeed subclasses
to produce simple GeoRSS or W3C Geo elements.
diff --git a/django/contrib/gis/gdal/envelope.py b/django/contrib/gis/gdal/envelope.py
index 64cac5baa0..e7c7e3dde1 100644
--- a/django/contrib/gis/gdal/envelope.py
+++ b/django/contrib/gis/gdal/envelope.py
@@ -27,7 +27,7 @@ class OGREnvelope(Structure):
]
-class Envelope(object):
+class Envelope:
"""
The Envelope object is a C structure that contains the minimum and
maximum X, Y coordinates for a rectangle bounding box. The naming
diff --git a/django/contrib/gis/gdal/geomtype.py b/django/contrib/gis/gdal/geomtype.py
index 37539c8544..e727d495fb 100644
--- a/django/contrib/gis/gdal/geomtype.py
+++ b/django/contrib/gis/gdal/geomtype.py
@@ -1,7 +1,7 @@
from django.contrib.gis.gdal.error import GDALException
-class OGRGeomType(object):
+class OGRGeomType:
"Encapsulates OGR Geometry Types."
wkb25bit = -2147483648
diff --git a/django/contrib/gis/geoip2/base.py b/django/contrib/gis/geoip2/base.py
index 1d1e2e00dc..5f8abfc008 100644
--- a/django/contrib/gis/geoip2/base.py
+++ b/django/contrib/gis/geoip2/base.py
@@ -21,7 +21,7 @@ class GeoIP2Exception(Exception):
pass
-class GeoIP2(object):
+class GeoIP2:
# The flags for GeoIP memory caching.
# Try MODE_MMAP_EXT, MODE_MMAP, MODE_FILE in that order.
MODE_AUTO = 0
diff --git a/django/contrib/gis/geos/geometry.py b/django/contrib/gis/geos/geometry.py
index e015fdc3d5..2ff4037764 100644
--- a/django/contrib/gis/geos/geometry.py
+++ b/django/contrib/gis/geos/geometry.py
@@ -656,7 +656,7 @@ class GEOSGeometry(GEOSBase, ListMixin):
return GEOSGeometry(capi.geom_clone(self.ptr), srid=self.srid)
-class LinearGeometryMixin(object):
+class LinearGeometryMixin:
"""
Used for LineString and MultiLineString.
"""
diff --git a/django/contrib/gis/geos/libgeos.py b/django/contrib/gis/geos/libgeos.py
index 48532d5c53..faf29de0c1 100644
--- a/django/contrib/gis/geos/libgeos.py
+++ b/django/contrib/gis/geos/libgeos.py
@@ -139,7 +139,7 @@ def get_pointer_arr(n):
lgeos = SimpleLazyObject(load_geos)
-class GEOSFuncFactory(object):
+class GEOSFuncFactory:
"""
Lazy loading of GEOS functions.
"""
diff --git a/django/contrib/gis/geos/mutable_list.py b/django/contrib/gis/geos/mutable_list.py
index 082f3b161a..d6e36db31a 100644
--- a/django/contrib/gis/geos/mutable_list.py
+++ b/django/contrib/gis/geos/mutable_list.py
@@ -12,7 +12,7 @@ from functools import total_ordering
@total_ordering
-class ListMixin(object):
+class ListMixin:
"""
A base class which provides complete list interface.
Derived classes must call ListMixin's __init__() function
diff --git a/django/contrib/gis/geos/prototypes/threadsafe.py b/django/contrib/gis/geos/prototypes/threadsafe.py
index a293671b5f..606b8f5aec 100644
--- a/django/contrib/gis/geos/prototypes/threadsafe.py
+++ b/django/contrib/gis/geos/prototypes/threadsafe.py
@@ -28,7 +28,7 @@ class GEOSContext(threading.local):
thread_context = GEOSContext()
-class GEOSFunc(object):
+class GEOSFunc:
"""
Class that serves as a wrapper for GEOS C Functions, and will
use thread-safe function variants when available.
diff --git a/django/contrib/gis/measure.py b/django/contrib/gis/measure.py
index a9b9e8a75f..bc426b597b 100644
--- a/django/contrib/gis/measure.py
+++ b/django/contrib/gis/measure.py
@@ -49,7 +49,7 @@ def pretty_name(obj):
@total_ordering
-class MeasureBase(object):
+class MeasureBase:
STANDARD_UNIT = None
ALIAS = {}
UNITS = {}
diff --git a/django/contrib/gis/ptr.py b/django/contrib/gis/ptr.py
index 7d6a21a12f..afc83fdd22 100644
--- a/django/contrib/gis/ptr.py
+++ b/django/contrib/gis/ptr.py
@@ -1,7 +1,7 @@
from ctypes import c_void_p
-class CPointerBase(object):
+class CPointerBase:
"""
Base class for objects that have a pointer access property
that controls access to the underlying C pointer.
diff --git a/django/contrib/gis/serializers/geojson.py b/django/contrib/gis/serializers/geojson.py
index 1b50ee30d8..3a4c0c87bf 100644
--- a/django/contrib/gis/serializers/geojson.py
+++ b/django/contrib/gis/serializers/geojson.py
@@ -65,6 +65,6 @@ class Serializer(JSONSerializer):
super(Serializer, self).handle_field(obj, field)
-class Deserializer(object):
+class Deserializer:
def __init__(self, *args, **kwargs):
raise SerializerDoesNotExist("geojson is a serialization-only serializer")
diff --git a/django/contrib/gis/utils/layermapping.py b/django/contrib/gis/utils/layermapping.py
index a10e9bbeb8..9093ae84d6 100644
--- a/django/contrib/gis/utils/layermapping.py
+++ b/django/contrib/gis/utils/layermapping.py
@@ -45,7 +45,7 @@ class MissingForeignKey(LayerMapError):
pass
-class LayerMapping(object):
+class LayerMapping:
"A class that maps OGR Layers to GeoDjango Models."
# Acceptable 'base' types for a multi-geometry type.
diff --git a/django/contrib/messages/storage/base.py b/django/contrib/messages/storage/base.py
index 66cd41684b..28c81599a7 100644
--- a/django/contrib/messages/storage/base.py
+++ b/django/contrib/messages/storage/base.py
@@ -5,7 +5,7 @@ from django.utils.encoding import force_text
LEVEL_TAGS = utils.get_level_tags()
-class Message(object):
+class Message:
"""
Represents an actual message that can be stored in any of the supported
storage classes (typically session- or cookie-based) and rendered in a view
@@ -51,7 +51,7 @@ class Message(object):
return force_text(LEVEL_TAGS.get(self.level, ''), strings_only=True)
-class BaseStorage(object):
+class BaseStorage:
"""
This is the base backend for temporary message storage.
diff --git a/django/contrib/messages/views.py b/django/contrib/messages/views.py
index 3c2ca355ba..adb3f194b9 100644
--- a/django/contrib/messages/views.py
+++ b/django/contrib/messages/views.py
@@ -1,7 +1,7 @@
from django.contrib import messages
-class SuccessMessageMixin(object):
+class SuccessMessageMixin:
"""
Adds a success message on successful form submission.
"""
diff --git a/django/contrib/postgres/fields/array.py b/django/contrib/postgres/fields/array.py
index dc5b9b8d6b..ce4c7b8c3d 100644
--- a/django/contrib/postgres/fields/array.py
+++ b/django/contrib/postgres/fields/array.py
@@ -264,7 +264,7 @@ class IndexTransform(Transform):
return self.base_field
-class IndexTransformFactory(object):
+class IndexTransformFactory:
def __init__(self, index, base_field):
self.index = index
@@ -286,7 +286,7 @@ class SliceTransform(Transform):
return '%s[%s:%s]' % (lhs, self.start, self.end), params
-class SliceTransformFactory(object):
+class SliceTransformFactory:
def __init__(self, start, end):
self.start = start
diff --git a/django/contrib/postgres/fields/hstore.py b/django/contrib/postgres/fields/hstore.py
index fcd212bc4a..5e2e6c3155 100644
--- a/django/contrib/postgres/fields/hstore.py
+++ b/django/contrib/postgres/fields/hstore.py
@@ -88,7 +88,7 @@ class KeyTransform(Transform):
return "(%s -> '%s')" % (lhs, self.key_name), params
-class KeyTransformFactory(object):
+class KeyTransformFactory:
def __init__(self, key_name):
self.key_name = key_name
diff --git a/django/contrib/postgres/fields/jsonb.py b/django/contrib/postgres/fields/jsonb.py
index 0722a05a69..43997050fe 100644
--- a/django/contrib/postgres/fields/jsonb.py
+++ b/django/contrib/postgres/fields/jsonb.py
@@ -118,7 +118,7 @@ class KeyTextTransform(KeyTransform):
_output_field = TextField()
-class KeyTransformTextLookupMixin(object):
+class KeyTransformTextLookupMixin:
"""
Mixin for combining with a lookup expecting a text lhs from a JSONField
key lookup. Make use of the ->> operator instead of casting key values to
@@ -174,7 +174,7 @@ KeyTransform.register_lookup(KeyTransformRegex)
KeyTransform.register_lookup(KeyTransformIRegex)
-class KeyTransformFactory(object):
+class KeyTransformFactory:
def __init__(self, key_name):
self.key_name = key_name
diff --git a/django/contrib/postgres/fields/utils.py b/django/contrib/postgres/fields/utils.py
index 424a78f521..82da93e892 100644
--- a/django/contrib/postgres/fields/utils.py
+++ b/django/contrib/postgres/fields/utils.py
@@ -1,3 +1,3 @@
-class AttributeSetter(object):
+class AttributeSetter:
def __init__(self, name, value):
setattr(self, name, value)
diff --git a/django/contrib/postgres/search.py b/django/contrib/postgres/search.py
index fb2f41b524..bc9bb1052b 100644
--- a/django/contrib/postgres/search.py
+++ b/django/contrib/postgres/search.py
@@ -33,7 +33,7 @@ class SearchQueryField(Field):
return 'tsquery'
-class SearchVectorCombinable(object):
+class SearchVectorCombinable:
ADD = '||'
def _combine(self, other, connector, reversed, node=None):
@@ -92,7 +92,7 @@ class CombinedSearchVector(SearchVectorCombinable, CombinedExpression):
super(CombinedSearchVector, self).__init__(lhs, connector, rhs, output_field)
-class SearchQueryCombinable(object):
+class SearchQueryCombinable:
BITAND = '&&'
BITOR = '||'
diff --git a/django/contrib/postgres/validators.py b/django/contrib/postgres/validators.py
index 756ae73440..a1aef12015 100644
--- a/django/contrib/postgres/validators.py
+++ b/django/contrib/postgres/validators.py
@@ -24,7 +24,7 @@ class ArrayMinLengthValidator(MinLengthValidator):
@deconstructible
-class KeysValidator(object):
+class KeysValidator:
"""A validator designed for HStore to require/restrict keys."""
messages = {
diff --git a/django/contrib/sessions/backends/base.py b/django/contrib/sessions/backends/base.py
index 615eea45d2..009efe94e1 100644
--- a/django/contrib/sessions/backends/base.py
+++ b/django/contrib/sessions/backends/base.py
@@ -33,7 +33,7 @@ class UpdateError(Exception):
pass
-class SessionBase(object):
+class SessionBase:
"""
Base class for all Session classes.
"""
diff --git a/django/contrib/sessions/serializers.py b/django/contrib/sessions/serializers.py
index 1badd17f46..1df6d9c49e 100644
--- a/django/contrib/sessions/serializers.py
+++ b/django/contrib/sessions/serializers.py
@@ -3,7 +3,7 @@ import pickle
from django.core.signing import JSONSerializer as BaseJSONSerializer
-class PickleSerializer(object):
+class PickleSerializer:
"""
Simple wrapper around pickle to be used in signing.dumps and
signing.loads.
diff --git a/django/contrib/sitemaps/__init__.py b/django/contrib/sitemaps/__init__.py
index 6e30a30f09..71d36e6a3c 100644
--- a/django/contrib/sitemaps/__init__.py
+++ b/django/contrib/sitemaps/__init__.py
@@ -50,7 +50,7 @@ def _get_sitemap_full_url(sitemap_url):
return 'http://%s%s' % (current_site.domain, sitemap_url)
-class Sitemap(object):
+class Sitemap:
# This limit is defined by Google. See the index documentation at
# http://www.sitemaps.org/protocol.html#index.
limit = 50000
diff --git a/django/contrib/sites/requests.py b/django/contrib/sites/requests.py
index c5513d8358..cdf57321da 100644
--- a/django/contrib/sites/requests.py
+++ b/django/contrib/sites/requests.py
@@ -1,4 +1,4 @@
-class RequestSite(object):
+class RequestSite:
"""
A class that shares the primary interface of Site (i.e., it has
``domain`` and ``name`` attributes) but gets its data from a Django
diff --git a/django/contrib/staticfiles/finders.py b/django/contrib/staticfiles/finders.py
index 96dd705050..08b25181bc 100644
--- a/django/contrib/staticfiles/finders.py
+++ b/django/contrib/staticfiles/finders.py
@@ -17,7 +17,7 @@ from django.utils.module_loading import import_string
searched_locations = []
-class BaseFinder(object):
+class BaseFinder:
"""
A base file finder to be used for custom staticfiles finder classes.
"""
diff --git a/django/contrib/staticfiles/storage.py b/django/contrib/staticfiles/storage.py
index fe4a7c39f7..46b751b094 100644
--- a/django/contrib/staticfiles/storage.py
+++ b/django/contrib/staticfiles/storage.py
@@ -47,7 +47,7 @@ class StaticFilesStorage(FileSystemStorage):
return super(StaticFilesStorage, self).path(name)
-class HashedFilesMixin(object):
+class HashedFilesMixin:
default_template = """url("%s")"""
max_post_process_passes = 5
patterns = (
@@ -434,7 +434,7 @@ class ManifestFilesMixin(HashedFilesMixin):
return urlunsplit(unparsed_name)
-class _MappingCache(object):
+class _MappingCache:
"""
A small dict-like wrapper for a given cache backend instance.
"""
diff --git a/django/contrib/syndication/views.py b/django/contrib/syndication/views.py
index 2cfe930338..8104d6104b 100644
--- a/django/contrib/syndication/views.py
+++ b/django/contrib/syndication/views.py
@@ -26,7 +26,7 @@ class FeedDoesNotExist(ObjectDoesNotExist):
pass
-class Feed(object):
+class Feed:
feed_type = feedgenerator.DefaultFeed
title_template = None
description_template = None
diff --git a/django/core/cache/__init__.py b/django/core/cache/__init__.py
index 2b253b1077..d51c1cb38e 100644
--- a/django/core/cache/__init__.py
+++ b/django/core/cache/__init__.py
@@ -55,7 +55,7 @@ def _create_cache(backend, **kwargs):
return backend_cls(location, params)
-class CacheHandler(object):
+class CacheHandler:
"""
A Cache Handler to manage access to Cache instances.
@@ -88,7 +88,7 @@ class CacheHandler(object):
caches = CacheHandler()
-class DefaultCacheProxy(object):
+class DefaultCacheProxy:
"""
Proxy access to the default Cache object's attributes.
diff --git a/django/core/cache/backends/base.py b/django/core/cache/backends/base.py
index 856316b400..2d5b0634a1 100644
--- a/django/core/cache/backends/base.py
+++ b/django/core/cache/backends/base.py
@@ -47,7 +47,7 @@ def get_key_func(key_func):
return default_key_func
-class BaseCache(object):
+class BaseCache:
def __init__(self, params):
timeout = params.get('timeout', params.get('TIMEOUT', 300))
if timeout is not None:
diff --git a/django/core/cache/backends/db.py b/django/core/cache/backends/db.py
index 97f307e24d..50d897b621 100644
--- a/django/core/cache/backends/db.py
+++ b/django/core/cache/backends/db.py
@@ -10,7 +10,7 @@ from django.utils import timezone
from django.utils.encoding import force_bytes
-class Options(object):
+class Options:
"""A class that will quack like a Django model _meta class.
This allows cache operations to be controlled by the router
@@ -33,7 +33,7 @@ class BaseDatabaseCache(BaseCache):
BaseCache.__init__(self, params)
self._table = table
- class CacheEntry(object):
+ class CacheEntry:
_meta = Options(table)
self.cache_model_class = CacheEntry
diff --git a/django/core/checks/messages.py b/django/core/checks/messages.py
index 5bb292503f..0c44d35095 100644
--- a/django/core/checks/messages.py
+++ b/django/core/checks/messages.py
@@ -8,7 +8,7 @@ ERROR = 40
CRITICAL = 50
-class CheckMessage(object):
+class CheckMessage:
def __init__(self, level, msg, hint=None, obj=None, id=None):
assert isinstance(level, int), "The first argument should be level."
diff --git a/django/core/checks/registry.py b/django/core/checks/registry.py
index 4a2b358dc8..581783ad0b 100644
--- a/django/core/checks/registry.py
+++ b/django/core/checks/registry.py
@@ -3,7 +3,7 @@ from itertools import chain
from django.utils.itercompat import is_iterable
-class Tags(object):
+class Tags:
"""
Built-in tags for internal checks.
"""
@@ -18,7 +18,7 @@ class Tags(object):
urls = 'urls'
-class CheckRegistry(object):
+class CheckRegistry:
def __init__(self):
self.registered_checks = []
diff --git a/django/core/files/storage.py b/django/core/files/storage.py
index cf17eea339..6f2d6bfd91 100644
--- a/django/core/files/storage.py
+++ b/django/core/files/storage.py
@@ -20,7 +20,7 @@ from django.utils.text import get_valid_filename
__all__ = ('Storage', 'FileSystemStorage', 'DefaultStorage', 'default_storage')
-class Storage(object):
+class Storage:
"""
A base storage class, providing some default behaviors that all other
storage systems can inherit or override, as necessary.
diff --git a/django/core/files/uploadhandler.py b/django/core/files/uploadhandler.py
index 3741f372b2..e8f87845c9 100644
--- a/django/core/files/uploadhandler.py
+++ b/django/core/files/uploadhandler.py
@@ -58,7 +58,7 @@ class StopFutureHandlers(UploadFileException):
pass
-class FileUploadHandler(object):
+class FileUploadHandler:
"""
Base class for streaming upload handlers.
"""
diff --git a/django/core/files/utils.py b/django/core/files/utils.py
index 8e891bf23f..96bfbe46c2 100644
--- a/django/core/files/utils.py
+++ b/django/core/files/utils.py
@@ -1,4 +1,4 @@
-class FileProxyMixin(object):
+class FileProxyMixin:
"""
A mixin class used to forward file methods to an underlaying file
object. The internal file object has to be called "file"::
diff --git a/django/core/handlers/base.py b/django/core/handlers/base.py
index c45023d129..9b79439569 100644
--- a/django/core/handlers/base.py
+++ b/django/core/handlers/base.py
@@ -12,7 +12,7 @@ from .exception import convert_exception_to_response, get_exception_response
logger = logging.getLogger('django.request')
-class BaseHandler(object):
+class BaseHandler:
def __init__(self):
self._request_middleware = None
diff --git a/django/core/handlers/wsgi.py b/django/core/handlers/wsgi.py
index f4d3e6553a..69b5f1c54d 100644
--- a/django/core/handlers/wsgi.py
+++ b/django/core/handlers/wsgi.py
@@ -19,7 +19,7 @@ ISO_8859_1, UTF_8 = str('iso-8859-1'), str('utf-8')
_slashes_re = re.compile(br'/+')
-class LimitedStream(object):
+class LimitedStream:
'''
LimitedStream wraps another stream in order to not allow reading from it
past specified amount of bytes.
diff --git a/django/core/mail/backends/base.py b/django/core/mail/backends/base.py
index 4914f479b9..e0d2e3626b 100644
--- a/django/core/mail/backends/base.py
+++ b/django/core/mail/backends/base.py
@@ -1,7 +1,7 @@
"""Base email backend class."""
-class BaseEmailBackend(object):
+class BaseEmailBackend:
"""
Base class for email backend implementations.
diff --git a/django/core/mail/message.py b/django/core/mail/message.py
index 117f2dddfc..f8fd6c2d25 100644
--- a/django/core/mail/message.py
+++ b/django/core/mail/message.py
@@ -223,7 +223,7 @@ class SafeMIMEMultipart(MIMEMixin, MIMEMultipart):
MIMEMultipart.__setitem__(self, name, val)
-class EmailMessage(object):
+class EmailMessage:
"""
A container for email information.
"""
diff --git a/django/core/mail/utils.py b/django/core/mail/utils.py
index 9295759fad..d18dfe4667 100644
--- a/django/core/mail/utils.py
+++ b/django/core/mail/utils.py
@@ -7,7 +7,7 @@ import socket
# Cache the hostname, but do it lazily: socket.getfqdn() can take a couple of
# seconds, which slows down the restart of the server.
-class CachedDnsName(object):
+class CachedDnsName:
def __str__(self):
return self.get_fqdn()
diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py
index 0200f77e7d..1b59dac686 100644
--- a/django/core/management/__init__.py
+++ b/django/core/management/__init__.py
@@ -129,7 +129,7 @@ def call_command(command_name, *args, **options):
return command.execute(*args, **defaults)
-class ManagementUtility(object):
+class ManagementUtility:
"""
Encapsulates the logic of the django-admin and manage.py utilities.
diff --git a/django/core/management/base.py b/django/core/management/base.py
index 192d529ef0..ae8c6731c9 100644
--- a/django/core/management/base.py
+++ b/django/core/management/base.py
@@ -73,7 +73,7 @@ def handle_default_options(options):
sys.path.insert(0, options.pythonpath)
-class OutputWrapper(object):
+class OutputWrapper:
"""
Wrapper around stdout/stderr
"""
@@ -107,7 +107,7 @@ class OutputWrapper(object):
self._out.write(force_str(style_func(msg)))
-class BaseCommand(object):
+class BaseCommand:
"""
The base class from which all management commands ultimately
derive.
diff --git a/django/core/management/color.py b/django/core/management/color.py
index 76985420cb..4519d29025 100644
--- a/django/core/management/color.py
+++ b/django/core/management/color.py
@@ -24,7 +24,7 @@ def supports_color():
return True
-class Style(object):
+class Style:
pass
diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py
index dc505173b1..830b6efe05 100644
--- a/django/core/management/commands/makemessages.py
+++ b/django/core/management/commands/makemessages.py
@@ -36,7 +36,7 @@ def check_programs(*programs):
@total_ordering
-class TranslatableFile(object):
+class TranslatableFile:
def __init__(self, dirpath, file_name, locale_dir):
self.file = file_name
self.dirpath = dirpath
@@ -59,7 +59,7 @@ class TranslatableFile(object):
return os.path.join(self.dirpath, self.file)
-class BuildFile(object):
+class BuildFile:
"""
Represents the state of a translatable file during the build process.
"""
diff --git a/django/core/paginator.py b/django/core/paginator.py
index 82aad33a15..abc29b3603 100644
--- a/django/core/paginator.py
+++ b/django/core/paginator.py
@@ -22,7 +22,7 @@ class EmptyPage(InvalidPage):
pass
-class Paginator(object):
+class Paginator:
def __init__(self, object_list, per_page, orphans=0,
allow_empty_first_page=True):
diff --git a/django/core/serializers/__init__.py b/django/core/serializers/__init__.py
index 57d149cf0c..3d0ed9a13f 100644
--- a/django/core/serializers/__init__.py
+++ b/django/core/serializers/__init__.py
@@ -33,7 +33,7 @@ BUILTIN_SERIALIZERS = {
_serializers = {}
-class BadSerializer(object):
+class BadSerializer:
"""
Stub serializer to hold exception raised during registration
@@ -71,7 +71,7 @@ def register_serializer(format, serializer_module, serializers=None):
except ImportError as exc:
bad_serializer = BadSerializer(exc)
- module = type('BadSerializerModule', (object,), {
+ module = type('BadSerializerModule', (), {
'Deserializer': bad_serializer,
'Serializer': bad_serializer,
})
diff --git a/django/core/serializers/base.py b/django/core/serializers/base.py
index bd35c0b797..d1a5344064 100644
--- a/django/core/serializers/base.py
+++ b/django/core/serializers/base.py
@@ -28,7 +28,7 @@ class DeserializationError(Exception):
return cls("%s: (%s:pk=%s) field_value was '%s'" % (original_exc, model, fk, field_value))
-class ProgressBar(object):
+class ProgressBar:
progress_width = 75
def __init__(self, output, total_count):
@@ -51,7 +51,7 @@ class ProgressBar(object):
self.output.flush()
-class Serializer(object):
+class Serializer:
"""
Abstract serializer base class.
"""
@@ -182,7 +182,7 @@ class Deserializer:
raise NotImplementedError('subclasses of Deserializer must provide a __next__() method')
-class DeserializedObject(object):
+class DeserializedObject:
"""
A deserialized model.
diff --git a/django/core/servers/basehttp.py b/django/core/servers/basehttp.py
index da55eac58d..0b76b14f04 100644
--- a/django/core/servers/basehttp.py
+++ b/django/core/servers/basehttp.py
@@ -60,7 +60,7 @@ def is_broken_pipe_error():
return issubclass(exc_type, socket.error) and exc_value.args[0] == 32
-class WSGIServer(simple_server.WSGIServer, object):
+class WSGIServer(simple_server.WSGIServer):
"""BaseHTTPServer that implements the Python WSGI protocol"""
request_queue_size = 10
@@ -84,14 +84,14 @@ class WSGIServer(simple_server.WSGIServer, object):
# Inheriting from object required on Python 2.
-class ServerHandler(simple_server.ServerHandler, object):
+class ServerHandler(simple_server.ServerHandler):
def handle_error(self):
# Ignore broken pipe errors, otherwise pass on
if not is_broken_pipe_error():
super(ServerHandler, self).handle_error()
-class WSGIRequestHandler(simple_server.WSGIRequestHandler, object):
+class WSGIRequestHandler(simple_server.WSGIRequestHandler):
def address_string(self):
# Short-circuit parent method to not call socket.getfqdn
return self.client_address[0]
diff --git a/django/core/signing.py b/django/core/signing.py
index f578da6f99..811d23396f 100644
--- a/django/core/signing.py
+++ b/django/core/signing.py
@@ -82,7 +82,7 @@ def get_cookie_signer(salt='django.core.signing.get_cookie_signer'):
return Signer(b'django.http.cookies' + key, salt=salt)
-class JSONSerializer(object):
+class JSONSerializer:
"""
Simple wrapper around json to be used in signing.dumps and
signing.loads.
@@ -147,7 +147,7 @@ def loads(s, key=None, salt='django.core.signing', serializer=JSONSerializer, ma
return serializer().loads(data)
-class Signer(object):
+class Signer:
def __init__(self, key=None, sep=':', salt=None):
# Use of native strings in all versions of Python
diff --git a/django/core/validators.py b/django/core/validators.py
index 1bb2478129..715d81bdba 100644
--- a/django/core/validators.py
+++ b/django/core/validators.py
@@ -26,7 +26,7 @@ def _lazy_re_compile(regex, flags=0):
@deconstructible
-class RegexValidator(object):
+class RegexValidator:
regex = ''
message = _('Enter a valid value.')
code = 'invalid'
@@ -162,7 +162,7 @@ def validate_integer(value):
@deconstructible
-class EmailValidator(object):
+class EmailValidator:
message = _('Enter a valid email address.')
code = 'invalid'
user_regex = _lazy_re_compile(
@@ -305,7 +305,7 @@ validate_comma_separated_integer_list = int_list_validator(
@deconstructible
-class BaseValidator(object):
+class BaseValidator:
message = _('Ensure this value is %(limit_value)s (it is %(show_value)s).')
code = 'limit_value'
@@ -384,7 +384,7 @@ class MaxLengthValidator(BaseValidator):
@deconstructible
-class DecimalValidator(object):
+class DecimalValidator:
"""
Validate that the input does not exceed the maximum number of digits
expected, otherwise raise ValidationError.
@@ -453,7 +453,7 @@ class DecimalValidator(object):
@deconstructible
-class FileExtensionValidator(object):
+class FileExtensionValidator:
message = _(
"File extension '%(extension)s' is not allowed. "
"Allowed extensions are: '%(allowed_extensions)s'."
diff --git a/django/db/__init__.py b/django/db/__init__.py
index a00dc788dc..5708c1c5de 100644
--- a/django/db/__init__.py
+++ b/django/db/__init__.py
@@ -23,7 +23,7 @@ router = ConnectionRouter()
# that the database backends care about.
# We load all these up for backwards compatibility, you should use
# connections['default'] instead.
-class DefaultConnectionProxy(object):
+class DefaultConnectionProxy:
"""
Proxy for accessing the default DatabaseWrapper object's attributes. If you
need to access the DatabaseWrapper object itself, use
diff --git a/django/db/backends/base/base.py b/django/db/backends/base/base.py
index ea976519ec..d255bf3e0f 100644
--- a/django/db/backends/base/base.py
+++ b/django/db/backends/base/base.py
@@ -21,7 +21,7 @@ from django.utils.functional import cached_property
NO_DB_ALIAS = '__no_db__'
-class BaseDatabaseWrapper(object):
+class BaseDatabaseWrapper:
"""
Represents a database connection.
"""
diff --git a/django/db/backends/base/client.py b/django/db/backends/base/client.py
index aced8e7ebd..69e061b4e9 100644
--- a/django/db/backends/base/client.py
+++ b/django/db/backends/base/client.py
@@ -1,4 +1,4 @@
-class BaseDatabaseClient(object):
+class BaseDatabaseClient:
"""
This class encapsulates all backend-specific methods for opening a
client shell.
diff --git a/django/db/backends/base/creation.py b/django/db/backends/base/creation.py
index cf3e6c3347..a291f43f55 100644
--- a/django/db/backends/base/creation.py
+++ b/django/db/backends/base/creation.py
@@ -11,7 +11,7 @@ from django.db import router
TEST_DATABASE_PREFIX = 'test_'
-class BaseDatabaseCreation(object):
+class BaseDatabaseCreation:
"""
This class encapsulates all backend-specific differences that pertain to
creation and destruction of the test database.
diff --git a/django/db/backends/base/features.py b/django/db/backends/base/features.py
index dfcb719eae..8f9fbdcfea 100644
--- a/django/db/backends/base/features.py
+++ b/django/db/backends/base/features.py
@@ -3,7 +3,7 @@ from django.db.utils import ProgrammingError
from django.utils.functional import cached_property
-class BaseDatabaseFeatures(object):
+class BaseDatabaseFeatures:
gis_enabled = False
allows_group_by_pk = False
allows_group_by_selected_pks = False
diff --git a/django/db/backends/base/introspection.py b/django/db/backends/base/introspection.py
index 55fffb993e..07f1312356 100644
--- a/django/db/backends/base/introspection.py
+++ b/django/db/backends/base/introspection.py
@@ -7,7 +7,7 @@ TableInfo = namedtuple('TableInfo', ['name', 'type'])
FieldInfo = namedtuple('FieldInfo', 'name type_code display_size internal_size precision scale null_ok default')
-class BaseDatabaseIntrospection(object):
+class BaseDatabaseIntrospection:
"""
This class encapsulates all backend-specific introspection utilities
"""
diff --git a/django/db/backends/base/operations.py b/django/db/backends/base/operations.py
index 6f1248efc1..22beb0d417 100644
--- a/django/db/backends/base/operations.py
+++ b/django/db/backends/base/operations.py
@@ -10,7 +10,7 @@ from django.utils.dateparse import parse_duration
from django.utils.encoding import force_text
-class BaseDatabaseOperations(object):
+class BaseDatabaseOperations:
"""
This class encapsulates all backend-specific differences, such as the way
a backend performs ordering or calculates the ID of a recently-inserted
diff --git a/django/db/backends/base/schema.py b/django/db/backends/base/schema.py
index 6cb6826a7f..70edc05183 100644
--- a/django/db/backends/base/schema.py
+++ b/django/db/backends/base/schema.py
@@ -19,7 +19,7 @@ def _related_non_m2m_objects(old_field, new_field):
)
-class BaseDatabaseSchemaEditor(object):
+class BaseDatabaseSchemaEditor:
"""
This class (and its subclasses) are responsible for emitting schema-changing
statements to the databases - model creation/removal/alteration, field
diff --git a/django/db/backends/base/validation.py b/django/db/backends/base/validation.py
index 23761b4161..d8a05aceaf 100644
--- a/django/db/backends/base/validation.py
+++ b/django/db/backends/base/validation.py
@@ -1,4 +1,4 @@
-class BaseDatabaseValidation(object):
+class BaseDatabaseValidation:
"""
This class encapsulates all backend-specific validation.
"""
diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py
index f674687ff1..3239ba104f 100644
--- a/django/db/backends/mysql/base.py
+++ b/django/db/backends/mysql/base.py
@@ -69,7 +69,7 @@ server_version_re = re.compile(r'(\d{1,2})\.(\d{1,2})\.(\d{1,2})')
# standard backend_utils.CursorDebugWrapper can be used. Also, using sql_mode
# TRADITIONAL will automatically cause most warnings to be treated as errors.
-class CursorWrapper(object):
+class CursorWrapper:
"""
A thin wrapper around MySQLdb's normal cursor class so that we can catch
particular exception instances and reraise them with the right types.
diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py
index 257dab0b9d..7e3591f60c 100644
--- a/django/db/backends/oracle/base.py
+++ b/django/db/backends/oracle/base.py
@@ -59,7 +59,7 @@ from .schema import DatabaseSchemaEditor # NOQA isort:skip
from .utils import Oracle_datetime # NOQA isort:skip
-class _UninitializedOperatorsDescriptor(object):
+class _UninitializedOperatorsDescriptor:
def __get__(self, instance, cls=None):
# If connection.operators is looked up before a connection has been
@@ -306,7 +306,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
return None
-class OracleParam(object):
+class OracleParam:
"""
Wrapper object for formatting parameters for Oracle. If the string
representation of the value is large enough (greater than 4000 characters)
@@ -351,7 +351,7 @@ class OracleParam(object):
self.input_size = None
-class VariableWrapper(object):
+class VariableWrapper:
"""
An adapter class for cursor variables that prevents the wrapped object
from being converted into a string when used to instantiate an OracleParam.
@@ -375,7 +375,7 @@ class VariableWrapper(object):
setattr(self.var, key, value)
-class FormatStylePlaceholderCursor(object):
+class FormatStylePlaceholderCursor:
"""
Django uses "format" (e.g. '%s') style placeholders, but Oracle uses ":var"
style. This fixes it -- but note that if you want to use a literal "%s" in
diff --git a/django/db/backends/oracle/utils.py b/django/db/backends/oracle/utils.py
index e89a9b70cb..f958655f94 100644
--- a/django/db/backends/oracle/utils.py
+++ b/django/db/backends/oracle/utils.py
@@ -3,7 +3,7 @@ import datetime
from .base import Database
-class InsertIdVar(object):
+class InsertIdVar:
"""
A late-binding cursor variable that can be passed to Cursor.execute
as a parameter, in order to receive the id of the row created by an
diff --git a/django/db/backends/sqlite3/introspection.py b/django/db/backends/sqlite3/introspection.py
index 7d24ca6f26..730793879d 100644
--- a/django/db/backends/sqlite3/introspection.py
+++ b/django/db/backends/sqlite3/introspection.py
@@ -18,7 +18,7 @@ def get_field_size(name):
# This light wrapper "fakes" a dictionary interface, because some SQLite data
# types include variables in them -- e.g. "varchar(30)" -- and can't be matched
# as a simple dictionary lookup.
-class FlexibleFieldLookupDict(object):
+class FlexibleFieldLookupDict:
# Maps SQL types to Django Field types. Some of the SQL types have multiple
# entries here because SQLite allows for anything and doesn't normalize the
# field type; it uses whatever was given.
diff --git a/django/db/backends/utils.py b/django/db/backends/utils.py
index b72840e989..f6cb59a086 100644
--- a/django/db/backends/utils.py
+++ b/django/db/backends/utils.py
@@ -11,7 +11,7 @@ from django.utils.timezone import utc
logger = logging.getLogger('django.db.backends')
-class CursorWrapper(object):
+class CursorWrapper:
def __init__(self, cursor, db):
self.cursor = cursor
self.db = db
diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py
index d2b6f6d497..b8ac6c942b 100644
--- a/django/db/migrations/autodetector.py
+++ b/django/db/migrations/autodetector.py
@@ -16,7 +16,7 @@ from django.db.migrations.utils import (
from .topological_sort import stable_topological_sort
-class MigrationAutodetector(object):
+class MigrationAutodetector:
"""
Takes a pair of ProjectStates, and compares them to see what the
first would need doing to make it match the second (the second
diff --git a/django/db/migrations/executor.py b/django/db/migrations/executor.py
index a590a0aca3..13ae9a68a1 100644
--- a/django/db/migrations/executor.py
+++ b/django/db/migrations/executor.py
@@ -7,7 +7,7 @@ from .recorder import MigrationRecorder
from .state import ProjectState
-class MigrationExecutor(object):
+class MigrationExecutor:
"""
End-to-end migration execution - loads migrations, and runs them
up or down to a specified set of targets.
diff --git a/django/db/migrations/graph.py b/django/db/migrations/graph.py
index 1729aa7b7a..1d144d7d25 100644
--- a/django/db/migrations/graph.py
+++ b/django/db/migrations/graph.py
@@ -18,7 +18,7 @@ RECURSION_DEPTH_WARNING = (
@total_ordering
-class Node(object):
+class Node:
"""
A single node in the migration graph. Contains direct links to adjacent
nodes in either direction.
@@ -100,7 +100,7 @@ class DummyNode(Node):
raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
-class MigrationGraph(object):
+class MigrationGraph:
"""
Represents the digraph of all migrations in a project.
diff --git a/django/db/migrations/loader.py b/django/db/migrations/loader.py
index 492ad145fd..1237a37c26 100644
--- a/django/db/migrations/loader.py
+++ b/django/db/migrations/loader.py
@@ -16,7 +16,7 @@ from .exceptions import (
MIGRATIONS_MODULE_NAME = 'migrations'
-class MigrationLoader(object):
+class MigrationLoader:
"""
Loads migration files from disk, and their status from the database.
diff --git a/django/db/migrations/migration.py b/django/db/migrations/migration.py
index 5b6bb647c9..eb0bfa8b37 100644
--- a/django/db/migrations/migration.py
+++ b/django/db/migrations/migration.py
@@ -3,7 +3,7 @@ from django.db.transaction import atomic
from .exceptions import IrreversibleError
-class Migration(object):
+class Migration:
"""
The base class for all migrations.
diff --git a/django/db/migrations/operations/base.py b/django/db/migrations/operations/base.py
index f5acf9f3a8..8e1f02d7ca 100644
--- a/django/db/migrations/operations/base.py
+++ b/django/db/migrations/operations/base.py
@@ -1,7 +1,7 @@
from django.db import router
-class Operation(object):
+class Operation:
"""
Base class for migration operations.
diff --git a/django/db/migrations/optimizer.py b/django/db/migrations/optimizer.py
index ca7f9db600..9948d5b4bb 100644
--- a/django/db/migrations/optimizer.py
+++ b/django/db/migrations/optimizer.py
@@ -1,4 +1,4 @@
-class MigrationOptimizer(object):
+class MigrationOptimizer:
"""
Powers the optimization process, where you provide a list of Operations
and you are returned a list of equal or shorter length - operations
diff --git a/django/db/migrations/questioner.py b/django/db/migrations/questioner.py
index caae498337..f1bc664828 100644
--- a/django/db/migrations/questioner.py
+++ b/django/db/migrations/questioner.py
@@ -9,7 +9,7 @@ from django.utils import datetime_safe, timezone
from .loader import MigrationLoader
-class MigrationQuestioner(object):
+class MigrationQuestioner:
"""
Gives the autodetector responses to questions it might have.
This base class has a built-in noninteractive mode, but the
diff --git a/django/db/migrations/recorder.py b/django/db/migrations/recorder.py
index 7824228c97..1c4adea1f2 100644
--- a/django/db/migrations/recorder.py
+++ b/django/db/migrations/recorder.py
@@ -6,7 +6,7 @@ from django.utils.timezone import now
from .exceptions import MigrationSchemaMissing
-class MigrationRecorder(object):
+class MigrationRecorder:
"""
Deals with storing migration records in the database.
diff --git a/django/db/migrations/serializer.py b/django/db/migrations/serializer.py
index 4786e7b012..9e5d74afb9 100644
--- a/django/db/migrations/serializer.py
+++ b/django/db/migrations/serializer.py
@@ -24,7 +24,7 @@ except ImportError:
enum = None
-class BaseSerializer(object):
+class BaseSerializer:
def __init__(self, value):
self.value = value
diff --git a/django/db/migrations/state.py b/django/db/migrations/state.py
index 6699b77713..c0eb583374 100644
--- a/django/db/migrations/state.py
+++ b/django/db/migrations/state.py
@@ -80,7 +80,7 @@ def get_related_models_recursive(model):
return seen - {(model._meta.app_label, model._meta.model_name)}
-class ProjectState(object):
+class ProjectState:
"""
Represents the entire project's overall state.
This is the item that is passed around - we do it here rather than at the
@@ -356,7 +356,7 @@ class StateApps(Apps):
pass
-class ModelState(object):
+class ModelState:
"""
Represents a Django Model. We don't use the actual Model class
as it's not designed to have its options changed - instead, we
diff --git a/django/db/migrations/utils.py b/django/db/migrations/utils.py
index b54d7ed120..8939794e59 100644
--- a/django/db/migrations/utils.py
+++ b/django/db/migrations/utils.py
@@ -4,7 +4,7 @@ import re
COMPILED_REGEX_TYPE = type(re.compile(''))
-class RegexObject(object):
+class RegexObject:
def __init__(self, obj):
self.pattern = obj.pattern
self.flags = obj.flags
diff --git a/django/db/migrations/writer.py b/django/db/migrations/writer.py
index ae51a1f0d9..be0fece25e 100644
--- a/django/db/migrations/writer.py
+++ b/django/db/migrations/writer.py
@@ -34,7 +34,7 @@ class SettingsReference(str):
self.setting_name = setting_name
-class OperationWriter(object):
+class OperationWriter:
def __init__(self, operation, indentation=2):
self.operation = operation
self.buff = []
@@ -134,7 +134,7 @@ class OperationWriter(object):
return '\n'.join(self.buff)
-class MigrationWriter(object):
+class MigrationWriter:
"""
Takes a Migration instance and is able to produce the contents
of the migration file from it.
diff --git a/django/db/models/base.py b/django/db/models/base.py
index 4ee7aa0349..8cba12bb6e 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -33,7 +33,7 @@ from django.utils.translation import ugettext_lazy as _
from django.utils.version import get_version
-class Deferred(object):
+class Deferred:
def __repr__(self):
return str('<Deferred field>')
@@ -371,7 +371,7 @@ class ModelBase(type):
return cls._meta.default_manager
-class ModelState(object):
+class ModelState:
"""
A class for storing instance state
"""
diff --git a/django/db/models/deletion.py b/django/db/models/deletion.py
index 0793475e65..b0c61d1799 100644
--- a/django/db/models/deletion.py
+++ b/django/db/models/deletion.py
@@ -60,7 +60,7 @@ def get_candidate_relations_to_delete(opts):
)
-class Collector(object):
+class Collector:
def __init__(self, using):
self.using = using
# Initially, {model: {instances}}, later values become lists.
diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py
index 960435f169..de60a160e0 100644
--- a/django/db/models/expressions.py
+++ b/django/db/models/expressions.py
@@ -8,7 +8,7 @@ from django.db.models.query_utils import Q
from django.utils.functional import cached_property
-class Combinable(object):
+class Combinable:
"""
Provides the ability to combine one or two objects with
some connector. For example F('foo') + F('bar').
@@ -123,7 +123,7 @@ class Combinable(object):
)
-class BaseExpression(object):
+class BaseExpression:
"""
Base class for all query expressions.
"""
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
index 3ac04effc7..26b0bb2378 100644
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -46,7 +46,7 @@ __all__ = [str(x) for x in (
)]
-class Empty(object):
+class Empty:
pass
@@ -1088,7 +1088,7 @@ class CommaSeparatedIntegerField(CharField):
}
-class DateTimeCheckMixin(object):
+class DateTimeCheckMixin:
def check(self, **kwargs):
errors = super(DateTimeCheckMixin, self).check(**kwargs)
@@ -2003,7 +2003,7 @@ class NullBooleanField(Field):
return super(NullBooleanField, self).formfield(**defaults)
-class PositiveIntegerRelDbTypeMixin(object):
+class PositiveIntegerRelDbTypeMixin:
def rel_db_type(self, connection):
"""
diff --git a/django/db/models/fields/files.py b/django/db/models/fields/files.py
index 38dda4c1df..1235f65730 100644
--- a/django/db/models/fields/files.py
+++ b/django/db/models/fields/files.py
@@ -131,7 +131,7 @@ class FieldFile(File):
return {'name': self.name, 'closed': False, '_committed': True, '_file': None}
-class FileDescriptor(object):
+class FileDescriptor:
"""
The descriptor for the file attribute on the model instance. Returns a
FieldFile when accessed so you can do stuff like::
diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py
index b5dd0a2d14..bc447452f3 100644
--- a/django/db/models/fields/related.py
+++ b/django/db/models/fields/related.py
@@ -1023,7 +1023,7 @@ def create_many_to_many_intermediary_model(field, klass):
to = 'to_%s' % to
from_ = 'from_%s' % from_
- meta = type(str('Meta'), (object,), {
+ meta = type(str('Meta'), (), {
'db_table': field._get_m2m_db_table(klass._meta),
'auto_created': klass,
'app_label': klass._meta.app_label,
diff --git a/django/db/models/fields/related_descriptors.py b/django/db/models/fields/related_descriptors.py
index 696dc6f749..dda455800b 100644
--- a/django/db/models/fields/related_descriptors.py
+++ b/django/db/models/fields/related_descriptors.py
@@ -71,7 +71,7 @@ from django.db.models.query import QuerySet
from django.utils.functional import cached_property
-class ForwardManyToOneDescriptor(object):
+class ForwardManyToOneDescriptor:
"""
Accessor to the related object on the forward side of a many-to-one or
one-to-one (via ForwardOneToOneDescriptor subclass) relation.
@@ -275,7 +275,7 @@ class ForwardOneToOneDescriptor(ForwardManyToOneDescriptor):
return super(ForwardOneToOneDescriptor, self).get_object(instance)
-class ReverseOneToOneDescriptor(object):
+class ReverseOneToOneDescriptor:
"""
Accessor to the related object on the reverse side of a one-to-one
relation.
@@ -435,7 +435,7 @@ class ReverseOneToOneDescriptor(object):
setattr(value, self.related.field.get_cache_name(), instance)
-class ReverseManyToOneDescriptor(object):
+class ReverseManyToOneDescriptor:
"""
Accessor to the related objects manager on the reverse side of a
many-to-one relation.
diff --git a/django/db/models/fields/related_lookups.py b/django/db/models/fields/related_lookups.py
index bb3194ecd7..bc80c7cb02 100644
--- a/django/db/models/fields/related_lookups.py
+++ b/django/db/models/fields/related_lookups.py
@@ -4,7 +4,7 @@ from django.db.models.lookups import (
)
-class MultiColSource(object):
+class MultiColSource:
contains_aggregate = False
def __init__(self, alias, targets, sources, field):
@@ -94,7 +94,7 @@ class RelatedIn(In):
return super(RelatedIn, self).as_sql(compiler, connection)
-class RelatedLookupMixin(object):
+class RelatedLookupMixin:
def get_prep_lookup(self):
if not isinstance(self.lhs, MultiColSource) and self.rhs_is_direct_value():
# If we get here, we are dealing with single-column relations.
diff --git a/django/db/models/fields/reverse_related.py b/django/db/models/fields/reverse_related.py
index 1b706ba6ea..4e835e8302 100644
--- a/django/db/models/fields/reverse_related.py
+++ b/django/db/models/fields/reverse_related.py
@@ -16,7 +16,7 @@ from django.utils.functional import cached_property
from . import BLANK_CHOICE_DASH
-class ForeignObjectRel(object):
+class ForeignObjectRel:
"""
Used by ForeignObject to store information about the relation.
diff --git a/django/db/models/functions/datetime.py b/django/db/models/functions/datetime.py
index 269b829e43..8bfd8cafef 100644
--- a/django/db/models/functions/datetime.py
+++ b/django/db/models/functions/datetime.py
@@ -11,7 +11,7 @@ from django.utils import timezone
from django.utils.functional import cached_property
-class TimezoneMixin(object):
+class TimezoneMixin:
tzinfo = None
def get_tzname(self):
diff --git a/django/db/models/indexes.py b/django/db/models/indexes.py
index 27390ccc18..03aa06fa52 100644
--- a/django/db/models/indexes.py
+++ b/django/db/models/indexes.py
@@ -8,7 +8,7 @@ __all__ = [str('Index')]
MAX_NAME_LENGTH = 30
-class Index(object):
+class Index:
suffix = 'idx'
def __init__(self, fields=[], name=None):
diff --git a/django/db/models/lookups.py b/django/db/models/lookups.py
index 4b09143661..1536ecdc63 100644
--- a/django/db/models/lookups.py
+++ b/django/db/models/lookups.py
@@ -12,7 +12,7 @@ from django.db.models.query_utils import RegisterLookupMixin
from django.utils.functional import cached_property
-class Lookup(object):
+class Lookup:
lookup_name = None
prepare_rhs = True
@@ -173,7 +173,7 @@ class BuiltinLookup(Lookup):
return connection.operators[self.lookup_name] % rhs
-class FieldGetDbPrepValueMixin(object):
+class FieldGetDbPrepValueMixin:
"""
Some lookups require Field.get_db_prep_value() to be called on their
inputs.
@@ -284,7 +284,7 @@ class LessThanOrEqual(FieldGetDbPrepValueMixin, BuiltinLookup):
lookup_name = 'lte'
-class IntegerFieldFloatRounding(object):
+class IntegerFieldFloatRounding:
"""
Allow floats to work as query values for IntegerField. Without this, the
decimal portion of the float would always be discarded.
@@ -305,7 +305,7 @@ class IntegerLessThan(IntegerFieldFloatRounding, LessThan):
pass
-class DecimalComparisonLookup(object):
+class DecimalComparisonLookup:
def as_sqlite(self, compiler, connection):
lhs_sql, params = self.process_lhs(compiler, connection)
rhs_sql, rhs_params = self.process_rhs(compiler, connection)
diff --git a/django/db/models/manager.py b/django/db/models/manager.py
index bb3d61b083..2680f69986 100644
--- a/django/db/models/manager.py
+++ b/django/db/models/manager.py
@@ -6,7 +6,7 @@ from django.db import router
from django.db.models.query import QuerySet
-class BaseManager(object):
+class BaseManager:
# Tracks each time a Manager instance is created. Used to retain order.
creation_counter = 0
@@ -168,7 +168,7 @@ class Manager(BaseManager.from_queryset(QuerySet)):
pass
-class ManagerDescriptor(object):
+class ManagerDescriptor:
def __init__(self, manager):
self.manager = manager
diff --git a/django/db/models/options.py b/django/db/models/options.py
index 7594b70fb2..8f5603ada4 100644
--- a/django/db/models/options.py
+++ b/django/db/models/options.py
@@ -66,7 +66,7 @@ def make_immutable_fields_list(name, data):
return ImmutableList(data, warning=IMMUTABLE_WARNING % name)
-class Options(object):
+class Options:
FORWARD_PROPERTIES = {
'fields', 'many_to_many', 'concrete_fields', 'local_concrete_fields',
'_forward_fields_map', 'managers', 'managers_map', 'base_manager',
diff --git a/django/db/models/query.py b/django/db/models/query.py
index 1c20d9cbf6..b536521fa4 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -32,7 +32,7 @@ REPR_OUTPUT_SIZE = 20
EmptyResultSet = sql.EmptyResultSet
-class BaseIterable(object):
+class BaseIterable:
def __init__(self, queryset, chunked_fetch=False):
self.queryset = queryset
self.chunked_fetch = chunked_fetch
@@ -152,7 +152,7 @@ class FlatValuesListIterable(BaseIterable):
yield row[0]
-class QuerySet(object):
+class QuerySet:
"""
Represents a lazy database lookup for a set of objects.
"""
@@ -1180,7 +1180,7 @@ class EmptyQuerySet(metaclass=InstanceCheckMeta):
raise TypeError("EmptyQuerySet can't be instantiated")
-class RawQuerySet(object):
+class RawQuerySet:
"""
Provides an iterator which converts the results of raw SQL queries into
annotated model instances.
@@ -1298,7 +1298,7 @@ class RawQuerySet(object):
return model_fields
-class Prefetch(object):
+class Prefetch:
def __init__(self, lookup, queryset=None, to_attr=None):
# `prefetch_through` is the path we traverse to perform the prefetch.
self.prefetch_through = lookup
@@ -1623,7 +1623,7 @@ def prefetch_one_level(instances, prefetcher, lookup, level):
return all_related_objects, additional_lookups
-class RelatedPopulator(object):
+class RelatedPopulator:
"""
RelatedPopulator is used for select_related() object instantiation.
diff --git a/django/db/models/query_utils.py b/django/db/models/query_utils.py
index 03d133e724..54088b4fbb 100644
--- a/django/db/models/query_utils.py
+++ b/django/db/models/query_utils.py
@@ -34,7 +34,7 @@ def subclasses(cls):
yield item
-class QueryWrapper(object):
+class QueryWrapper:
"""
A type that indicates the contents are an SQL fragment and the associate
parameters. Can be used to pass opaque data to a where-clause, for example.
@@ -90,7 +90,7 @@ class Q(tree.Node):
return clause
-class DeferredAttribute(object):
+class DeferredAttribute:
"""
A wrapper for a deferred-loading field. When the value is read from this
object the first time, the query is executed.
@@ -130,7 +130,7 @@ class DeferredAttribute(object):
return None
-class RegisterLookupMixin(object):
+class RegisterLookupMixin:
@classmethod
def _get_lookup(cls, lookup_name):
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py
index 41733210c4..1be406d704 100644
--- a/django/db/models/sql/compiler.py
+++ b/django/db/models/sql/compiler.py
@@ -15,7 +15,7 @@ from django.db.utils import DatabaseError
FORCE = object()
-class SQLCompiler(object):
+class SQLCompiler:
def __init__(self, query, connection, using):
self.query = query
self.connection = connection
diff --git a/django/db/models/sql/datastructures.py b/django/db/models/sql/datastructures.py
index 02e4f930e1..81b6cabdc6 100644
--- a/django/db/models/sql/datastructures.py
+++ b/django/db/models/sql/datastructures.py
@@ -19,11 +19,11 @@ class MultiJoin(Exception):
self.names_with_path = path_with_names
-class Empty(object):
+class Empty:
pass
-class Join(object):
+class Join:
"""
Used by sql.Query and sql.SQLCompiler to generate JOIN clauses into the
FROM entry. For example, the SQL generated could be
@@ -125,7 +125,7 @@ class Join(object):
return new
-class BaseTable(object):
+class BaseTable:
"""
The BaseTable class is used for base table references in FROM clause. For
example, the SQL "foo" in
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 3acef8faf5..67d5738976 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -43,7 +43,7 @@ def get_field_names_from_opts(opts):
))
-class RawQuery(object):
+class RawQuery:
"""
A single raw SQL query
"""
@@ -111,7 +111,7 @@ class RawQuery(object):
self.cursor.execute(self.sql, params)
-class Query(object):
+class Query:
"""
A single SQL query.
"""
@@ -2049,7 +2049,7 @@ def is_reverse_o2o(field):
return field.is_relation and field.one_to_one and not field.concrete
-class JoinPromoter(object):
+class JoinPromoter:
"""
A class to abstract away join promotion problems for complex filter
conditions.
diff --git a/django/db/models/sql/where.py b/django/db/models/sql/where.py
index bb4e9252b4..7ce7617bfa 100644
--- a/django/db/models/sql/where.py
+++ b/django/db/models/sql/where.py
@@ -172,7 +172,7 @@ class WhereNode(tree.Node):
return any(child.is_summary for child in self.children)
-class NothingNode(object):
+class NothingNode:
"""
A node that matches nothing.
"""
@@ -182,7 +182,7 @@ class NothingNode(object):
raise EmptyResultSet
-class ExtraWhere(object):
+class ExtraWhere:
# The contents are a black box - assume no aggregates are used.
contains_aggregate = False
@@ -195,7 +195,7 @@ class ExtraWhere(object):
return " AND ".join(sqls), list(self.params or ())
-class SubqueryConstraint(object):
+class SubqueryConstraint:
# Even if aggregates would be used in a subquery, the outer query isn't
# interested about those.
contains_aggregate = False
diff --git a/django/db/utils.py b/django/db/utils.py
index a65510ea80..8ca3f860b3 100644
--- a/django/db/utils.py
+++ b/django/db/utils.py
@@ -50,7 +50,7 @@ class NotSupportedError(DatabaseError):
pass
-class DatabaseErrorWrapper(object):
+class DatabaseErrorWrapper:
"""
Context manager and decorator that re-throws backend-specific database
exceptions using Django's common wrappers.
@@ -141,7 +141,7 @@ class ConnectionDoesNotExist(Exception):
pass
-class ConnectionHandler(object):
+class ConnectionHandler:
def __init__(self, databases=None):
"""
databases is an optional dictionary of database definitions (structured
@@ -234,7 +234,7 @@ class ConnectionHandler(object):
connection.close()
-class ConnectionRouter(object):
+class ConnectionRouter:
def __init__(self, routers=None):
"""
If routers is not specified, will default to settings.DATABASE_ROUTERS.
diff --git a/django/dispatch/dispatcher.py b/django/dispatch/dispatcher.py
index 706c9eebbf..09992c5b8c 100644
--- a/django/dispatch/dispatcher.py
+++ b/django/dispatch/dispatcher.py
@@ -17,7 +17,7 @@ NONE_ID = _make_id(None)
NO_RECEIVERS = object()
-class Signal(object):
+class Signal:
"""
Base class for all signals
diff --git a/django/forms/boundfield.py b/django/forms/boundfield.py
index dc40bca508..8bed2a8a52 100644
--- a/django/forms/boundfield.py
+++ b/django/forms/boundfield.py
@@ -15,7 +15,7 @@ __all__ = ('BoundField',)
@html_safe
-class BoundField(object):
+class BoundField:
"A Field plus data"
def __init__(self, form, field, name):
self.form = form
@@ -251,7 +251,7 @@ class BoundField(object):
@html_safe
-class BoundWidget(object):
+class BoundWidget:
"""
A container class used for iterating over widgets. This is useful for
widgets that have choices. For example, the following can be used in a
diff --git a/django/forms/fields.py b/django/forms/fields.py
index 94a7bbbfc2..20521b26ea 100644
--- a/django/forms/fields.py
+++ b/django/forms/fields.py
@@ -44,7 +44,7 @@ __all__ = (
)
-class Field(object):
+class Field:
widget = TextInput # Default widget to use when rendering this type of Field.
hidden_widget = HiddenInput # Default widget to use when rendering this as "hidden".
default_validators = [] # Default set of validators
@@ -755,7 +755,7 @@ class NullBooleanField(BooleanField):
pass
-class CallableChoiceIterator(object):
+class CallableChoiceIterator:
def __init__(self, choices_func):
self.choices_func = choices_func
diff --git a/django/forms/forms.py b/django/forms/forms.py
index de19edb668..7fccdc2b65 100644
--- a/django/forms/forms.py
+++ b/django/forms/forms.py
@@ -58,7 +58,7 @@ class DeclarativeFieldsMetaclass(MediaDefiningClass):
@html_safe
-class BaseForm(object):
+class BaseForm:
# This is the main implementation of all the Form logic. Note that this
# class is different than Form. See the comments by the Form class for more
# information. Any improvements to the form API should be made to *this*
diff --git a/django/forms/formsets.py b/django/forms/formsets.py
index 964a83d4ca..18a8cabefa 100644
--- a/django/forms/formsets.py
+++ b/django/forms/formsets.py
@@ -43,7 +43,7 @@ class ManagementForm(Form):
@html_safe
-class BaseFormSet(object):
+class BaseFormSet:
"""
A collection of instances of the same Form class.
"""
diff --git a/django/forms/models.py b/django/forms/models.py
index 093a7a6078..e5a589bfba 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -184,7 +184,7 @@ def fields_for_model(model, fields=None, exclude=None, widgets=None,
return field_dict
-class ModelFormOptions(object):
+class ModelFormOptions:
def __init__(self, options=None):
self.model = getattr(options, 'model', None)
self.fields = getattr(options, 'fields', None)
@@ -517,10 +517,8 @@ def modelform_factory(model, form=ModelForm, fields=None, exclude=None,
# If parent form class already has an inner Meta, the Meta we're
# creating needs to inherit from the parent's inner meta.
- parent = (object,)
- if hasattr(form, 'Meta'):
- parent = (form.Meta, object)
- Meta = type(str('Meta'), parent, attrs)
+ bases = (form.Meta,) if hasattr(form, 'Meta') else ()
+ Meta = type(str('Meta'), bases, attrs)
if formfield_callback:
Meta.formfield_callback = staticmethod(formfield_callback)
# Give this new form class a reasonable name.
@@ -1099,7 +1097,7 @@ class InlineForeignKeyField(Field):
return False
-class ModelChoiceIterator(object):
+class ModelChoiceIterator:
def __init__(self, field):
self.field = field
self.queryset = field.queryset
diff --git a/django/forms/renderers.py b/django/forms/renderers.py
index 2c31d7adc5..3023d477e4 100644
--- a/django/forms/renderers.py
+++ b/django/forms/renderers.py
@@ -23,7 +23,7 @@ def get_default_renderer():
return renderer_class()
-class BaseRenderer(object):
+class BaseRenderer:
def get_template(self, template_name):
raise NotImplementedError('subclasses must implement get_template()')
@@ -32,7 +32,7 @@ class BaseRenderer(object):
return template.render(context, request=request).strip()
-class EngineMixin(object):
+class EngineMixin:
def get_template(self, template_name):
return self.engine.get_template(template_name)
diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index b04864205c..d8b4d6a4dc 100644
--- a/django/forms/widgets.py
+++ b/django/forms/widgets.py
@@ -35,7 +35,7 @@ MEDIA_TYPES = ('css', 'js')
@html_safe
-class Media(object):
+class Media:
def __init__(self, media=None, **kwargs):
if media:
media_attrs = media.__dict__
diff --git a/django/http/multipartparser.py b/django/http/multipartparser.py
index 4cbb98afdd..ff7e36e321 100644
--- a/django/http/multipartparser.py
+++ b/django/http/multipartparser.py
@@ -41,7 +41,7 @@ FILE = "file"
FIELD = "field"
-class MultiPartParser(object):
+class MultiPartParser:
"""
A rfc2388 multipart/form-data parser.
@@ -646,7 +646,7 @@ def parse_boundary_stream(stream, max_header_size):
return (TYPE, outdict, stream)
-class Parser(object):
+class Parser:
def __init__(self, stream, boundary):
self._stream = stream
self._separator = b'--' + boundary
diff --git a/django/http/request.py b/django/http/request.py
index a930c93b26..4ca2ed25fa 100644
--- a/django/http/request.py
+++ b/django/http/request.py
@@ -36,7 +36,7 @@ class RawPostDataException(Exception):
pass
-class HttpRequest(object):
+class HttpRequest:
"""A basic HTTP request."""
# The encoding used in GET/POST dicts. None means use default setting.
diff --git a/django/template/backends/base.py b/django/template/backends/base.py
index 9f48fbfdca..ad53089f22 100644
--- a/django/template/backends/base.py
+++ b/django/template/backends/base.py
@@ -6,7 +6,7 @@ from django.utils._os import safe_join
from django.utils.functional import cached_property
-class BaseEngine(object):
+class BaseEngine:
# Core methods: engines have to provide their own implementation
# (except for from_string which is optional).
diff --git a/django/template/backends/django.py b/django/template/backends/django.py
index 7ae8141251..33022d8bbb 100644
--- a/django/template/backends/django.py
+++ b/django/template/backends/django.py
@@ -47,7 +47,7 @@ class DjangoTemplates(BaseEngine):
return libraries
-class Template(object):
+class Template:
def __init__(self, template, backend):
self.template = template
diff --git a/django/template/backends/jinja2.py b/django/template/backends/jinja2.py
index 2497df1b84..df2eefa925 100644
--- a/django/template/backends/jinja2.py
+++ b/django/template/backends/jinja2.py
@@ -56,7 +56,7 @@ class Jinja2(BaseEngine):
return [import_string(path) for path in self.context_processors]
-class Template(object):
+class Template:
def __init__(self, template, backend):
self.template = template
@@ -78,7 +78,7 @@ class Template(object):
return self.template.render(context)
-class Origin(object):
+class Origin:
"""
A container to hold debug information as described in the template API
documentation.
diff --git a/django/template/base.py b/django/template/base.py
index 7f18869dbb..ce3cc2c7c0 100644
--- a/django/template/base.py
+++ b/django/template/base.py
@@ -122,7 +122,7 @@ class VariableDoesNotExist(Exception):
return self.msg % tuple(force_text(p, errors='replace') for p in self.params)
-class Origin(object):
+class Origin:
def __init__(self, name, template_name=None, loader=None):
self.name = name
self.template_name = template_name
@@ -148,7 +148,7 @@ class Origin(object):
)
-class Template(object):
+class Template:
def __init__(self, template_string, origin=None, name=None, engine=None):
try:
template_string = force_text(template_string)
@@ -301,7 +301,7 @@ def linebreak_iter(template_source):
yield len(template_source) + 1
-class Token(object):
+class Token:
def __init__(self, token_type, contents, position=None, lineno=None):
"""
A token representing a string from the template.
@@ -346,7 +346,7 @@ class Token(object):
return split
-class Lexer(object):
+class Lexer:
def __init__(self, template_string):
self.template_string = template_string
self.verbatim = False
@@ -423,7 +423,7 @@ class DebugLexer(Lexer):
return result
-class Parser(object):
+class Parser:
def __init__(self, tokens, libraries=None, builtins=None, origin=None):
self.tokens = tokens
self.tags = {}
@@ -624,7 +624,7 @@ filter_raw_string = r"""
filter_re = re.compile(filter_raw_string, re.UNICODE | re.VERBOSE)
-class FilterExpression(object):
+class FilterExpression:
"""
Parses a variable token and its optional filters (all as a single string),
and return a list of tuples of the filter name and arguments.
@@ -741,7 +741,7 @@ class FilterExpression(object):
return self.token
-class Variable(object):
+class Variable:
"""
A template variable, resolvable against a given context. The variable may
be a hard-coded string (if it begins and ends with single or double quote
@@ -898,7 +898,7 @@ class Variable(object):
return current
-class Node(object):
+class Node:
# Set this to True for nodes that must be first in the template (although
# they can be preceded by text nodes.
must_be_first = False
diff --git a/django/template/context.py b/django/template/context.py
index c5a4949e95..dfc4ed69a6 100644
--- a/django/template/context.py
+++ b/django/template/context.py
@@ -24,7 +24,7 @@ class ContextDict(dict):
self.context.pop()
-class BaseContext(object):
+class BaseContext:
def __init__(self, dict_=None):
self._reset_dicts(dict_)
diff --git a/django/template/engine.py b/django/template/engine.py
index d334926c45..026ecb144e 100644
--- a/django/template/engine.py
+++ b/django/template/engine.py
@@ -10,7 +10,7 @@ from .exceptions import TemplateDoesNotExist
from .library import import_library
-class Engine(object):
+class Engine:
default_builtins = [
'django.template.defaulttags',
'django.template.defaultfilters',
diff --git a/django/template/library.py b/django/template/library.py
index b7e3cad532..0b66aad3e9 100644
--- a/django/template/library.py
+++ b/django/template/library.py
@@ -13,7 +13,7 @@ class InvalidTemplateLibrary(Exception):
pass
-class Library(object):
+class Library:
"""
A class for registering template tags and filters. Compiled filter and
template tag functions are stored in the filters and tags attributes.
diff --git a/django/template/loader_tags.py b/django/template/loader_tags.py
index 2c27902238..b4f3f29be6 100644
--- a/django/template/loader_tags.py
+++ b/django/template/loader_tags.py
@@ -18,7 +18,7 @@ BLOCK_CONTEXT_KEY = 'block_context'
logger = logging.getLogger('django.template')
-class BlockContext(object):
+class BlockContext:
def __init__(self):
# Dictionary of FIFO queues.
self.blocks = defaultdict(list)
diff --git a/django/template/loaders/base.py b/django/template/loaders/base.py
index cb1807fd7e..041f9c4750 100644
--- a/django/template/loaders/base.py
+++ b/django/template/loaders/base.py
@@ -1,7 +1,7 @@
from django.template import Template, TemplateDoesNotExist
-class Loader(object):
+class Loader:
def __init__(self, engine):
self.engine = engine
diff --git a/django/template/smartif.py b/django/template/smartif.py
index d0cebadc01..02e005c5ec 100644
--- a/django/template/smartif.py
+++ b/django/template/smartif.py
@@ -8,7 +8,7 @@ Parser and utilities for the smart 'if' tag
# 'bp' = binding power (left = lbp, right = rbp)
-class TokenBase(object):
+class TokenBase:
"""
Base class for operators and literals, mainly for debugging and for throwing
syntax errors.
@@ -147,7 +147,7 @@ class EndToken(TokenBase):
EndToken = EndToken()
-class IfParser(object):
+class IfParser:
error_class = ValueError
def __init__(self, tokens):
diff --git a/django/template/utils.py b/django/template/utils.py
index 6ff2499dcb..852baca566 100644
--- a/django/template/utils.py
+++ b/django/template/utils.py
@@ -14,7 +14,7 @@ class InvalidTemplateEngineError(ImproperlyConfigured):
pass
-class EngineHandler(object):
+class EngineHandler:
def __init__(self, templates=None):
"""
templates is an optional list of template engine definitions
diff --git a/django/templatetags/tz.py b/django/templatetags/tz.py
index 99d391e45d..4769d1e09d 100644
--- a/django/templatetags/tz.py
+++ b/django/templatetags/tz.py
@@ -8,9 +8,9 @@ from django.utils import timezone
register = Library()
-# HACK: datetime is an old-style class, create a new-style equivalent
-# so we can define additional attributes.
-class datetimeobject(datetime, object):
+# HACK: datetime instances cannot be assigned new attributes. Define a subclass
+# in order to define new attributes in do_timezone().
+class datetimeobject(datetime):
pass
diff --git a/django/test/client.py b/django/test/client.py
index 3b31dae9bd..c8c6e96a7f 100644
--- a/django/test/client.py
+++ b/django/test/client.py
@@ -46,7 +46,7 @@ class RedirectCycleError(Exception):
self.redirect_chain = last_response.redirect_chain
-class FakePayload(object):
+class FakePayload:
"""
A wrapper around BytesIO that restricts what can be read since data from
the network can't be seeked and cannot be read outside of its content
@@ -253,7 +253,7 @@ def encode_file(boundary, key, file):
]
-class RequestFactory(object):
+class RequestFactory:
"""
Class that lets you create mock Request objects for use in testing.
diff --git a/django/test/html.py b/django/test/html.py
index 67a2ad65e1..319fd87a0f 100644
--- a/django/test/html.py
+++ b/django/test/html.py
@@ -13,7 +13,7 @@ def normalize_whitespace(string):
return WHITESPACE.sub(' ', string)
-class Element(object):
+class Element:
def __init__(self, name, attributes):
self.name = name
self.attributes = sorted(attributes)
diff --git a/django/test/runner.py b/django/test/runner.py
index 77a309d8e6..090adcec95 100644
--- a/django/test/runner.py
+++ b/django/test/runner.py
@@ -66,7 +66,7 @@ class DebugSQLTextTestResult(unittest.TextTestResult):
self.stream.writeln("%s" % sql_debug)
-class RemoteTestResult(object):
+class RemoteTestResult:
"""
Record information about which tests have succeeded and which have failed.
@@ -230,7 +230,7 @@ failure and get a correct traceback.
self.stop_if_failfast()
-class RemoteTestRunner(object):
+class RemoteTestRunner:
"""
Run tests and record everything but don't display anything.
@@ -389,7 +389,7 @@ class ParallelTestSuite(unittest.TestSuite):
return result
-class DiscoverRunner(object):
+class DiscoverRunner:
"""
A Django test runner that uses unittest2 test discovery.
"""
diff --git a/django/test/testcases.py b/django/test/testcases.py
index dad3fb2df0..02398433d9 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -84,7 +84,7 @@ class _AssertNumQueriesContext(CaptureQueriesContext):
)
-class _AssertTemplateUsedContext(object):
+class _AssertTemplateUsedContext:
def __init__(self, test_case, template_name):
self.test_case = test_case
self.template_name = template_name
@@ -130,7 +130,7 @@ class _AssertTemplateNotUsedContext(_AssertTemplateUsedContext):
return '%s was rendered.' % self.template_name
-class _CursorFailure(object):
+class _CursorFailure:
def __init__(self, cls_name, wrapped):
self.cls_name = cls_name
self.wrapped = wrapped
@@ -1047,7 +1047,7 @@ class TestCase(TransactionTestCase):
)
-class CheckCondition(object):
+class CheckCondition:
"""Descriptor class for deferred condition checking"""
def __init__(self, *conditions):
self.conditions = conditions
@@ -1334,7 +1334,7 @@ class LiveServerTestCase(TransactionTestCase):
super(LiveServerTestCase, cls).tearDownClass()
-class SerializeMixin(object):
+class SerializeMixin:
"""
Mixin to enforce serialization of TestCases that share a common resource.
diff --git a/django/test/utils.py b/django/test/utils.py
index 55428ccf85..7cff683dff 100644
--- a/django/test/utils.py
+++ b/django/test/utils.py
@@ -42,7 +42,7 @@ __all__ = (
TZ_SUPPORT = hasattr(time, 'tzset')
-class Approximate(object):
+class Approximate:
def __init__(self, val, places=7):
self.val = val
self.places = places
@@ -102,7 +102,7 @@ def instrumented_test_render(self, context):
return self.nodelist.render(context)
-class _TestState(object):
+class _TestState:
pass
@@ -322,7 +322,7 @@ def get_runner(settings, test_runner_class=None):
return test_runner
-class TestContextDecorator(object):
+class TestContextDecorator:
"""
A base class that can either be used as a context manager during tests
or as a test function or unittest.TestCase subclass decorator to perform
@@ -613,7 +613,7 @@ def str_prefix(s):
return s % {'_': ''}
-class CaptureQueriesContext(object):
+class CaptureQueriesContext:
"""
Context manager that captures queries executed by the specified connection.
"""
@@ -832,7 +832,7 @@ class override_script_prefix(TestContextDecorator):
set_script_prefix(self.old_prefix)
-class LoggingCaptureMixin(object):
+class LoggingCaptureMixin:
"""
Capture the output from the 'django' logger and store it on the class's
logger_output attribute.
diff --git a/django/urls/resolvers.py b/django/urls/resolvers.py
index 7e344896af..36586feab0 100644
--- a/django/urls/resolvers.py
+++ b/django/urls/resolvers.py
@@ -25,7 +25,7 @@ from .exceptions import NoReverseMatch, Resolver404
from .utils import get_callable
-class ResolverMatch(object):
+class ResolverMatch:
def __init__(self, func, args, kwargs, url_name=None, app_names=None, namespaces=None):
self.func = func
self.args = args
@@ -76,7 +76,7 @@ def get_ns_resolver(ns_pattern, resolver):
return RegexURLResolver(r'^/', [ns_resolver])
-class LocaleRegexDescriptor(object):
+class LocaleRegexDescriptor:
def __get__(self, instance, cls=None):
"""
Return a compiled regular expression based on the active language.
@@ -106,7 +106,7 @@ class LocaleRegexDescriptor(object):
)
-class LocaleRegexProvider(object):
+class LocaleRegexProvider:
"""
A mixin to provide a default regex property which can vary by active
language.
diff --git a/django/utils/archive.py b/django/utils/archive.py
index 456145a520..1dd3f9d660 100644
--- a/django/utils/archive.py
+++ b/django/utils/archive.py
@@ -49,7 +49,7 @@ def extract(path, to_path=''):
archive.extract(to_path)
-class Archive(object):
+class Archive:
"""
The external API class that encapsulates an archive implementation.
"""
@@ -93,7 +93,7 @@ class Archive(object):
self._archive.close()
-class BaseArchive(object):
+class BaseArchive:
"""
Base Archive class. Implementations should inherit this class.
"""
diff --git a/django/utils/baseconv.py b/django/utils/baseconv.py
index 158f0b0d92..28099affae 100644
--- a/django/utils/baseconv.py
+++ b/django/utils/baseconv.py
@@ -45,7 +45,7 @@ BASE62_ALPHABET = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxy
BASE64_ALPHABET = BASE62_ALPHABET + '-_'
-class BaseConverter(object):
+class BaseConverter:
decimal_digits = '0123456789'
def __init__(self, digits, sign='-'):
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py
index bb8166a734..a89af1780b 100644
--- a/django/utils/datastructures.py
+++ b/django/utils/datastructures.py
@@ -2,7 +2,7 @@ import copy
from collections import OrderedDict
-class OrderedSet(object):
+class OrderedSet:
"""
A set which keeps the ordering of the inserted items.
Currently backs onto OrderedDict.
diff --git a/django/utils/dateformat.py b/django/utils/dateformat.py
index ded952df99..f55b97c2ed 100644
--- a/django/utils/dateformat.py
+++ b/django/utils/dateformat.py
@@ -26,7 +26,7 @@ re_formatchars = re.compile(r'(?<!\\)([aAbBcdDeEfFgGhHiIjlLmMnNoOPrsStTUuwWyYzZ]
re_escaped = re.compile(r'\\(.)')
-class Formatter(object):
+class Formatter:
def format(self, formatstr):
pieces = []
for i, piece in enumerate(re_formatchars.split(force_text(formatstr))):
diff --git a/django/utils/decorators.py b/django/utils/decorators.py
index 071028930f..3b2a002e7b 100644
--- a/django/utils/decorators.py
+++ b/django/utils/decorators.py
@@ -169,7 +169,7 @@ def make_middleware_decorator(middleware_class):
if ContextDecorator is None:
# ContextDecorator was introduced in Python 3.2
# See https://docs.python.org/3/library/contextlib.html#contextlib.ContextDecorator
- class ContextDecorator(object):
+ class ContextDecorator:
"""
A base class that enables a context manager to also be used as a decorator.
"""
@@ -181,7 +181,7 @@ if ContextDecorator is None:
return inner
-class classproperty(object):
+class classproperty:
def __init__(self, method=None):
self.fget = method
diff --git a/django/utils/deprecation.py b/django/utils/deprecation.py
index a37f2e3d69..2ef95bc343 100644
--- a/django/utils/deprecation.py
+++ b/django/utils/deprecation.py
@@ -13,7 +13,7 @@ class RemovedInDjango21Warning(DeprecationWarning):
RemovedInNextVersionWarning = RemovedInDjango21Warning
-class warn_about_renamed_method(object):
+class warn_about_renamed_method:
def __init__(self, class_name, old_method_name, new_method_name, deprecation_warning):
self.class_name = class_name
self.old_method_name = old_method_name
@@ -82,7 +82,7 @@ class DeprecationInstanceCheck(type):
return super(DeprecationInstanceCheck, self).__instancecheck__(instance)
-class MiddlewareMixin(object):
+class MiddlewareMixin:
def __init__(self, get_response=None):
self.get_response = get_response
super(MiddlewareMixin, self).__init__()
diff --git a/django/utils/feedgenerator.py b/django/utils/feedgenerator.py
index 33ef20e16b..4772acb1c9 100644
--- a/django/utils/feedgenerator.py
+++ b/django/utils/feedgenerator.py
@@ -79,7 +79,7 @@ def get_tag_uri(url, date):
return 'tag:%s%s:%s/%s' % (bits.hostname, d, bits.path, bits.fragment)
-class SyndicationFeed(object):
+class SyndicationFeed:
"Base class for all syndication feeds. Subclasses should provide write()"
def __init__(self, title, link, description, language=None, author_email=None,
author_name=None, author_link=None, subtitle=None, categories=None,
@@ -209,7 +209,7 @@ class SyndicationFeed(object):
return latest_date or datetime.datetime.utcnow().replace(tzinfo=utc)
-class Enclosure(object):
+class Enclosure:
"Represents an RSS enclosure"
def __init__(self, url, length, mime_type):
"All args are expected to be Python Unicode objects"
diff --git a/django/utils/functional.py b/django/utils/functional.py
index 2eeffa0447..30e484eaa3 100644
--- a/django/utils/functional.py
+++ b/django/utils/functional.py
@@ -12,7 +12,7 @@ def curry(_curried_func, *args, **kwargs):
return _curried
-class cached_property(object):
+class cached_property:
"""
Decorator that converts a method with a single self argument into a
property cached on the instance.
@@ -32,7 +32,7 @@ class cached_property(object):
return res
-class Promise(object):
+class Promise:
"""
This is just a base class for the proxy class created in
the closure of the lazy function. It can be used to recognize
@@ -214,7 +214,7 @@ def new_method_proxy(func):
return inner
-class LazyObject(object):
+class LazyObject:
"""
A wrapper for another class that can be used to delay instantiation of the
wrapped class.
diff --git a/django/utils/jslex.py b/django/utils/jslex.py
index 0958ac030c..98b5d56e9d 100644
--- a/django/utils/jslex.py
+++ b/django/utils/jslex.py
@@ -3,7 +3,7 @@
import re
-class Tok(object):
+class Tok:
"""
A specification for a token class.
"""
@@ -27,7 +27,7 @@ def literals(choices, prefix="", suffix=""):
return "|".join(prefix + re.escape(c) + suffix for c in choices.split())
-class Lexer(object):
+class Lexer:
"""
A generic multi-state regex-based lexer.
"""
diff --git a/django/utils/safestring.py b/django/utils/safestring.py
index 609f8f45ac..fe5ca422c3 100644
--- a/django/utils/safestring.py
+++ b/django/utils/safestring.py
@@ -8,7 +8,7 @@ be interpreted by the HTML engine (e.g. '<') into the appropriate entities.
from django.utils.functional import Promise, curry, wraps
-class SafeData(object):
+class SafeData:
def __html__(self):
"""
Returns the html representation of a string for interoperability.
diff --git a/django/utils/six.py b/django/utils/six.py
index b4038c72fa..95f16f58d9 100644
--- a/django/utils/six.py
+++ b/django/utils/six.py
@@ -55,7 +55,7 @@ else:
MAXSIZE = int((1 << 31) - 1)
else:
# It's possible to have sizeof(long) != sizeof(Py_ssize_t).
- class X(object):
+ class X:
def __len__(self):
return 1 << 31
@@ -81,7 +81,7 @@ def _import_module(name):
return sys.modules[name]
-class _LazyDescr(object):
+class _LazyDescr:
def __init__(self, name):
self.name = name
@@ -159,7 +159,7 @@ class MovedAttribute(_LazyDescr):
return getattr(module, self.attr)
-class _SixMetaPathImporter(object):
+class _SixMetaPathImporter:
"""
A meta path importer to import six.moves and its submodules.
@@ -550,7 +550,7 @@ else:
def create_unbound_method(func, cls):
return types.MethodType(func, None, cls)
- class Iterator(object):
+ class Iterator:
def next(self):
return type(self).__next__(self)
diff --git a/django/utils/synch.py b/django/utils/synch.py
index c8ef2f07bd..d944bfd242 100644
--- a/django/utils/synch.py
+++ b/django/utils/synch.py
@@ -10,7 +10,7 @@ import contextlib
import threading
-class RWLock(object):
+class RWLock:
"""
Classic implementation of reader-writer lock with preference to writers.
diff --git a/django/utils/text.py b/django/utils/text.py
index d716a0b345..20df82c85b 100644
--- a/django/utils/text.py
+++ b/django/utils/text.py
@@ -291,7 +291,7 @@ def compress_string(s):
return zbuf.getvalue()
-class StreamingBuffer(object):
+class StreamingBuffer:
def __init__(self):
self.vals = []
diff --git a/django/utils/translation/__init__.py b/django/utils/translation/__init__.py
index 345015d994..4dc4c16c28 100644
--- a/django/utils/translation/__init__.py
+++ b/django/utils/translation/__init__.py
@@ -38,7 +38,7 @@ class TranslatorCommentWarning(SyntaxWarning):
# replace the functions with their real counterparts (once we do access the
# settings).
-class Trans(object):
+class Trans:
"""
The purpose of this class is to store the actual translation function upon
receiving the first call to that function. After this is done, changes to
diff --git a/django/utils/tree.py b/django/utils/tree.py
index 3eb3529354..2c8ab3fe1c 100644
--- a/django/utils/tree.py
+++ b/django/utils/tree.py
@@ -8,7 +8,7 @@ import copy
from django.utils.encoding import force_str, force_text
-class Node(object):
+class Node:
"""
A single internal node in the tree graph. A Node should be viewed as a
connection (the root) with the children being either leaf nodes or other
diff --git a/django/views/debug.py b/django/views/debug.py
index b457969427..28e0fe6eb2 100644
--- a/django/views/debug.py
+++ b/django/views/debug.py
@@ -23,7 +23,7 @@ HIDDEN_SETTINGS = re.compile('API|TOKEN|KEY|SECRET|PASS|SIGNATURE', flags=re.IGN
CLEANSED_SUBSTITUTE = '********************'
-class CallableSettingWrapper(object):
+class CallableSettingWrapper:
""" Object to wrap callable appearing in settings
* Not to call in the debug page (#21345).
@@ -95,7 +95,7 @@ def get_exception_reporter_filter(request):
return getattr(request, 'exception_reporter_filter', default_filter)
-class ExceptionReporterFilter(object):
+class ExceptionReporterFilter:
"""
Base for all exception reporter filter classes. All overridable hooks
contain lenient default behaviors.
@@ -230,7 +230,7 @@ class SafeExceptionReporterFilter(ExceptionReporterFilter):
return cleansed.items()
-class ExceptionReporter(object):
+class ExceptionReporter:
"""
A class to organize and coordinate reporting on exceptions.
"""
diff --git a/django/views/generic/base.py b/django/views/generic/base.py
index 668aef7760..4d4617c0a8 100644
--- a/django/views/generic/base.py
+++ b/django/views/generic/base.py
@@ -10,7 +10,7 @@ from django.utils.decorators import classonlymethod
logger = logging.getLogger('django.request')
-class ContextMixin(object):
+class ContextMixin:
"""
A default context mixin that passes the keyword arguments received by
get_context_data as the template context.
@@ -22,7 +22,7 @@ class ContextMixin(object):
return kwargs
-class View(object):
+class View:
"""
Intentionally simple parent class for all views. Only implements
dispatch-by-method and simple sanity checking.
@@ -104,7 +104,7 @@ class View(object):
return [m.upper() for m in self.http_method_names if hasattr(self, m)]
-class TemplateResponseMixin(object):
+class TemplateResponseMixin:
"""
A mixin that can be used to render a template.
"""
diff --git a/django/views/generic/dates.py b/django/views/generic/dates.py
index d03140a973..86a49f8bd3 100644
--- a/django/views/generic/dates.py
+++ b/django/views/generic/dates.py
@@ -17,7 +17,7 @@ from django.views.generic.list import (
)
-class YearMixin(object):
+class YearMixin:
"""
Mixin for views manipulating year-based data.
"""
@@ -73,7 +73,7 @@ class YearMixin(object):
return date.replace(month=1, day=1)
-class MonthMixin(object):
+class MonthMixin:
"""
Mixin for views manipulating month-based data.
"""
@@ -132,7 +132,7 @@ class MonthMixin(object):
return date.replace(day=1)
-class DayMixin(object):
+class DayMixin:
"""
Mixin for views manipulating day-based data.
"""
@@ -188,7 +188,7 @@ class DayMixin(object):
return date
-class WeekMixin(object):
+class WeekMixin:
"""
Mixin for views manipulating week-based data.
"""
@@ -258,7 +258,7 @@ class WeekMixin(object):
raise ValueError("unknown week format: %s" % week_format)
-class DateMixin(object):
+class DateMixin:
"""
Mixin class for views manipulating date-based data.
"""
diff --git a/django/views/generic/edit.py b/django/views/generic/edit.py
index 9b5bd38736..258d624812 100644
--- a/django/views/generic/edit.py
+++ b/django/views/generic/edit.py
@@ -248,7 +248,7 @@ class UpdateView(SingleObjectTemplateResponseMixin, BaseUpdateView):
template_name_suffix = '_form'
-class DeletionMixin(object):
+class DeletionMixin:
"""
A mixin providing the ability to delete objects
"""
diff --git a/tests/admin_docs/tests.py b/tests/admin_docs/tests.py
index 2a2f9d25e0..dfe6104a33 100644
--- a/tests/admin_docs/tests.py
+++ b/tests/admin_docs/tests.py
@@ -2,7 +2,7 @@ from django.contrib.auth.models import User
from django.test import TestCase, modify_settings, override_settings
-class TestDataMixin(object):
+class TestDataMixin:
@classmethod
def setUpTestData(cls):
diff --git a/tests/admin_inlines/tests.py b/tests/admin_inlines/tests.py
index 6deba9b1c2..20fa9c0241 100644
--- a/tests/admin_inlines/tests.py
+++ b/tests/admin_inlines/tests.py
@@ -18,7 +18,7 @@ from .models import (
INLINE_CHANGELINK_HTML = 'class="inlinechangelink">Change</a>'
-class TestDataMixin(object):
+class TestDataMixin:
@classmethod
def setUpTestData(cls):
diff --git a/tests/admin_ordering/tests.py b/tests/admin_ordering/tests.py
index 250b59dea8..77597d0fb5 100644
--- a/tests/admin_ordering/tests.py
+++ b/tests/admin_ordering/tests.py
@@ -9,11 +9,11 @@ from .models import (
)
-class MockRequest(object):
+class MockRequest:
pass
-class MockSuperUser(object):
+class MockSuperUser:
def has_perm(self, perm):
return True
diff --git a/tests/admin_utils/tests.py b/tests/admin_utils/tests.py
index 245334df4d..1c14615e71 100644
--- a/tests/admin_utils/tests.py
+++ b/tests/admin_utils/tests.py
@@ -105,7 +105,7 @@ class UtilsTests(SimpleTestCase):
SIMPLE_FUNCTION = 'function'
INSTANCE_ATTRIBUTE = 'attr'
- class MockModelAdmin(object):
+ class MockModelAdmin:
def get_admin_value(self, obj):
return ADMIN_METHOD
@@ -259,7 +259,7 @@ class UtilsTests(SimpleTestCase):
)
self.assertEqual(label_for_field('site_id', Article), 'Site id')
- class MockModelAdmin(object):
+ class MockModelAdmin:
def test_from_model(self, obj):
return "nothing"
test_from_model.short_description = "not Really the Model"
@@ -276,7 +276,7 @@ class UtilsTests(SimpleTestCase):
def test_label_for_property(self):
# NOTE: cannot use @property decorator, because of
# AttributeError: 'property' object has no attribute 'short_description'
- class MockModelAdmin(object):
+ class MockModelAdmin:
def my_property(self):
return "this if from property"
my_property.short_description = 'property short description'
diff --git a/tests/admin_views/test_multidb.py b/tests/admin_views/test_multidb.py
index 102cf35a5d..0273b7aaef 100644
--- a/tests/admin_views/test_multidb.py
+++ b/tests/admin_views/test_multidb.py
@@ -8,7 +8,7 @@ from django.urls import reverse
from .models import Book
-class Router(object):
+class Router:
target_db = None
def db_for_read(self, model, **hints):
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index 81b7e1f6a4..ae3ebdd54d 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -65,7 +65,7 @@ ERROR_MESSAGE = "Please enter the correct username and password \
for a staff account. Note that both fields may be case-sensitive."
-class AdminFieldExtractionMixin(object):
+class AdminFieldExtractionMixin:
"""
Helper methods for extracting data from AdminForm.
"""
diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py
index ae8443565d..b9462498cc 100644
--- a/tests/admin_widgets/tests.py
+++ b/tests/admin_widgets/tests.py
@@ -26,7 +26,7 @@ from .models import (
from .widgetadmin import site as widget_admin_site
-class TestDataMixin(object):
+class TestDataMixin:
@classmethod
def setUpTestData(cls):
diff --git a/tests/apps/apps.py b/tests/apps/apps.py
index 1096c1e4b8..d322b28f2b 100644
--- a/tests/apps/apps.py
+++ b/tests/apps/apps.py
@@ -16,7 +16,7 @@ class BadConfig(AppConfig):
"""This class doesn't supply the mandatory 'name' attribute."""
-class NotAConfig(object):
+class NotAConfig:
name = 'apps'
diff --git a/tests/apps/tests.py b/tests/apps/tests.py
index 9576420b54..e270662436 100644
--- a/tests/apps/tests.py
+++ b/tests/apps/tests.py
@@ -296,7 +296,7 @@ class AppsTests(SimpleTestCase):
self.assertListEqual(model_classes, [LazyA, LazyB, LazyB, LazyC, LazyA])
-class Stub(object):
+class Stub:
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
diff --git a/tests/auth_tests/models/custom_user.py b/tests/auth_tests/models/custom_user.py
index 049ae85e5c..60fcc494c4 100644
--- a/tests/auth_tests/models/custom_user.py
+++ b/tests/auth_tests/models/custom_user.py
@@ -74,7 +74,7 @@ class CustomUser(AbstractBaseUser):
return self.is_admin
-class RemoveGroupsAndPermissions(object):
+class RemoveGroupsAndPermissions:
"""
A context manager to temporarily remove the groups and user_permissions M2M
fields from the AbstractUser class, so they don't clash with the
diff --git a/tests/auth_tests/test_admin_multidb.py b/tests/auth_tests/test_admin_multidb.py
index 9d0d999739..122cb78876 100644
--- a/tests/auth_tests/test_admin_multidb.py
+++ b/tests/auth_tests/test_admin_multidb.py
@@ -7,7 +7,7 @@ from django.test import TestCase, mock, override_settings
from django.urls import reverse
-class Router(object):
+class Router:
target_db = None
def db_for_read(self, model, **hints):
diff --git a/tests/auth_tests/test_auth_backends.py b/tests/auth_tests/test_auth_backends.py
index f06e825698..033df9c682 100644
--- a/tests/auth_tests/test_auth_backends.py
+++ b/tests/auth_tests/test_auth_backends.py
@@ -29,7 +29,7 @@ class CountingMD5PasswordHasher(MD5PasswordHasher):
return super(CountingMD5PasswordHasher, self).encode(*args, **kwargs)
-class BaseModelBackendTest(object):
+class BaseModelBackendTest:
"""
A base class for tests that need to validate the ModelBackend
with different User models. Subclasses should define a class
@@ -319,11 +319,11 @@ class UUIDUserTests(TestCase):
self.assertEqual(UUIDUser.objects.get(pk=self.client.session[SESSION_KEY]), user)
-class TestObj(object):
+class TestObj:
pass
-class SimpleRowlevelBackend(object):
+class SimpleRowlevelBackend:
def has_perm(self, user, perm, obj=None):
if not obj:
return # We only support row level perms
@@ -468,7 +468,7 @@ class InActiveUserBackendTest(TestCase):
self.assertIs(self.user1.has_module_perms("app2"), False)
-class PermissionDeniedBackend(object):
+class PermissionDeniedBackend:
"""
Always raises PermissionDenied in `authenticate`, `has_perm` and `has_module_perms`.
"""
@@ -573,7 +573,7 @@ class ChangedBackendSettingsTest(TestCase):
self.assertTrue(user.is_anonymous)
-class TypeErrorBackend(object):
+class TypeErrorBackend:
"""
Always raises TypeError.
"""
diff --git a/tests/auth_tests/test_auth_backends_deprecation.py b/tests/auth_tests/test_auth_backends_deprecation.py
index 6178936535..fc39d0be22 100644
--- a/tests/auth_tests/test_auth_backends_deprecation.py
+++ b/tests/auth_tests/test_auth_backends_deprecation.py
@@ -4,7 +4,7 @@ from django.contrib.auth import authenticate
from django.test import SimpleTestCase, override_settings
-class NoRequestBackend(object):
+class NoRequestBackend:
def authenticate(self, username=None, password=None):
# Doesn't accept a request parameter.
pass
diff --git a/tests/auth_tests/test_context_processors.py b/tests/auth_tests/test_context_processors.py
index 3857917860..d66b28cb9c 100644
--- a/tests/auth_tests/test_context_processors.py
+++ b/tests/auth_tests/test_context_processors.py
@@ -8,7 +8,7 @@ from django.test import SimpleTestCase, TestCase, override_settings
from .settings import AUTH_MIDDLEWARE, AUTH_TEMPLATES
-class MockUser(object):
+class MockUser:
def has_module_perms(self, perm):
if perm == 'mockapp':
return True
@@ -24,7 +24,7 @@ class PermWrapperTests(SimpleTestCase):
"""
Test some details of the PermWrapper implementation.
"""
- class EQLimiterObject(object):
+ class EQLimiterObject:
"""
This object makes sure __eq__ will not be called endlessly.
"""
diff --git a/tests/auth_tests/test_decorators.py b/tests/auth_tests/test_decorators.py
index dc3482de22..55c422bdc6 100644
--- a/tests/auth_tests/test_decorators.py
+++ b/tests/auth_tests/test_decorators.py
@@ -19,7 +19,7 @@ class LoginRequiredTestCase(AuthViewsTestCase):
"""
login_required is assignable to callable objects.
"""
- class CallableView(object):
+ class CallableView:
def __call__(self, *args, **kwargs):
pass
login_required(CallableView())
diff --git a/tests/auth_tests/test_forms.py b/tests/auth_tests/test_forms.py
index c055b58042..ae6fa313de 100644
--- a/tests/auth_tests/test_forms.py
+++ b/tests/auth_tests/test_forms.py
@@ -27,7 +27,7 @@ from .models.with_integer_username import IntegerUsernameUser
from .settings import AUTH_TEMPLATES
-class TestDataMixin(object):
+class TestDataMixin:
@classmethod
def setUpTestData(cls):
diff --git a/tests/auth_tests/test_management.py b/tests/auth_tests/test_management.py
index 4fd1563f84..12d029ffcd 100644
--- a/tests/auth_tests/test_management.py
+++ b/tests/auth_tests/test_management.py
@@ -62,7 +62,7 @@ def mock_inputs(inputs):
return inner
-class MockTTY(object):
+class MockTTY:
"""
A fake stdin object that pretends to be a TTY to be used in conjunction
with mock_inputs.
@@ -329,7 +329,7 @@ class CreatesuperuserManagementCommandTestCase(TestCase):
If the command is not called from a TTY, it should be skipped and a
message should be displayed (#7423).
"""
- class FakeStdin(object):
+ class FakeStdin:
"""A fake stdin object that has isatty() return False."""
def isatty(self):
return False
diff --git a/tests/backends/tests.py b/tests/backends/tests.py
index 89afb20760..662cdc4140 100644
--- a/tests/backends/tests.py
+++ b/tests/backends/tests.py
@@ -234,7 +234,7 @@ class PostgreSQLTests(TestCase):
"""Test PostgreSQL version detection"""
# Helper mocks
- class CursorMock(object):
+ class CursorMock:
"Very simple mock of DB-API cursor"
def execute(self, arg):
pass
@@ -248,7 +248,7 @@ class PostgreSQLTests(TestCase):
def __exit__(self, type, value, traceback):
pass
- class OlderConnectionMock(object):
+ class OlderConnectionMock:
"Mock of psycopg2 (< 2.0.12) connection"
def cursor(self):
return CursorMock()
diff --git a/tests/builtin_server/tests.py b/tests/builtin_server/tests.py
index 2784571b0c..6e234c1ba4 100644
--- a/tests/builtin_server/tests.py
+++ b/tests/builtin_server/tests.py
@@ -9,7 +9,7 @@ from wsgiref import simple_server
MAX_SOCKET_CHUNK_SIZE = 32 * 1024 * 1024 # 32 MB
-class ServerHandler(simple_server.ServerHandler, object):
+class ServerHandler(simple_server.ServerHandler):
error_status = str("500 INTERNAL SERVER ERROR")
def write(self, data):
@@ -38,7 +38,7 @@ class ServerHandler(simple_server.ServerHandler, object):
return ['\n'.join(traceback.format_exception(*sys.exc_info()))]
-class DummyHandler(object):
+class DummyHandler:
def log_request(self, *args, **kwargs):
pass
diff --git a/tests/cache/closeable_cache.py b/tests/cache/closeable_cache.py
index 1ac868dde9..a9e99a62cd 100644
--- a/tests/cache/closeable_cache.py
+++ b/tests/cache/closeable_cache.py
@@ -1,7 +1,7 @@
from django.core.cache.backends.locmem import LocMemCache
-class CloseHookMixin(object):
+class CloseHookMixin:
closed = False
def close(self, **kwargs):
diff --git a/tests/cache/liberal_backend.py b/tests/cache/liberal_backend.py
index 339066b0ff..93dc39a0d7 100644
--- a/tests/cache/liberal_backend.py
+++ b/tests/cache/liberal_backend.py
@@ -1,7 +1,7 @@
from django.core.cache.backends.locmem import LocMemCache
-class LiberalKeyValidationMixin(object):
+class LiberalKeyValidationMixin:
def validate_key(self, key):
pass
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index dd886cd11b..bfceff9b02 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -56,12 +56,12 @@ class C:
return 24
-class Unpicklable(object):
+class Unpicklable:
def __getstate__(self):
raise pickle.PickleError()
-class UnpicklableType(object):
+class UnpicklableType:
# Unpicklable using the default pickling protocol on Python 2.
__slots__ = 'a',
@@ -251,7 +251,7 @@ def caches_setting_for_tests(base=None, exclude=None, **params):
return setting
-class BaseCacheTests(object):
+class BaseCacheTests:
# A common set of tests to apply to all cache backends
def setUp(self):
@@ -1010,7 +1010,7 @@ class DBCacheWithTimeZoneTests(DBCacheTests):
pass
-class DBCacheRouter(object):
+class DBCacheRouter:
"""A router that puts the cache table on the 'other' database."""
def db_for_read(self, model, **hints):
@@ -1061,7 +1061,7 @@ class CreateCacheTableForDBCacheTests(TestCase):
verbosity=0, interactive=False)
-class PicklingSideEffect(object):
+class PicklingSideEffect:
def __init__(self, cache):
self.cache = cache
diff --git a/tests/check_framework/test_multi_db.py b/tests/check_framework/test_multi_db.py
index f273d397e2..700553f47b 100644
--- a/tests/check_framework/test_multi_db.py
+++ b/tests/check_framework/test_multi_db.py
@@ -3,7 +3,7 @@ from django.test import TestCase, mock
from django.test.utils import isolate_apps, override_settings
-class TestRouter(object):
+class TestRouter:
"""
Routes to the 'other' database if the model name starts with 'Other'.
"""
diff --git a/tests/check_framework/tests.py b/tests/check_framework/tests.py
index 30e1353dc0..46e4095a38 100644
--- a/tests/check_framework/tests.py
+++ b/tests/check_framework/tests.py
@@ -17,7 +17,7 @@ from django.utils.encoding import force_text
from .models import SimpleModel, my_check
-class DummyObj(object):
+class DummyObj:
def __repr__(self):
return "obj"
diff --git a/tests/contenttypes_tests/tests.py b/tests/contenttypes_tests/tests.py
index c91c265eaf..0ae2ddbb64 100644
--- a/tests/contenttypes_tests/tests.py
+++ b/tests/contenttypes_tests/tests.py
@@ -432,7 +432,7 @@ class UpdateContentTypesTests(TestCase):
self.assertEqual(ContentType.objects.count(), self.before_count + 1)
-class TestRouter(object):
+class TestRouter:
def db_for_read(self, model, **hints):
return 'other'
diff --git a/tests/csrf_tests/tests.py b/tests/csrf_tests/tests.py
index 49247b7af8..f68b0f037b 100644
--- a/tests/csrf_tests/tests.py
+++ b/tests/csrf_tests/tests.py
@@ -35,7 +35,7 @@ class TestingHttpRequest(HttpRequest):
return getattr(self, '_is_secure_override', False)
-class CsrfViewMiddlewareTestMixin(object):
+class CsrfViewMiddlewareTestMixin:
"""
Shared methods and tests for session-based and cookie-based tokens.
"""
diff --git a/tests/custom_lookups/tests.py b/tests/custom_lookups/tests.py
index e66a280e16..7b8cca6646 100644
--- a/tests/custom_lookups/tests.py
+++ b/tests/custom_lookups/tests.py
@@ -134,7 +134,7 @@ class Exactly(models.lookups.Exact):
return connection.operators['exact'] % rhs
-class SQLFuncMixin(object):
+class SQLFuncMixin:
def as_sql(self, compiler, connection):
return '%s()', [self.name]
@@ -155,7 +155,7 @@ class SQLFuncTransform(SQLFuncMixin, models.Transform):
self.name = name
-class SQLFuncFactory(object):
+class SQLFuncFactory:
def __init__(self, key, name):
self.key = key
diff --git a/tests/custom_pk/fields.py b/tests/custom_pk/fields.py
index fa61a72a0d..2be2288ed8 100644
--- a/tests/custom_pk/fields.py
+++ b/tests/custom_pk/fields.py
@@ -4,7 +4,7 @@ import string
from django.db import models
-class MyWrapper(object):
+class MyWrapper:
def __init__(self, value):
self.value = value
diff --git a/tests/decorators/tests.py b/tests/decorators/tests.py
index 851c2b8daa..c2116a05ce 100644
--- a/tests/decorators/tests.py
+++ b/tests/decorators/tests.py
@@ -109,10 +109,10 @@ class DecoratorsTest(TestCase):
callback = user_passes_test(test1)(callback)
callback = user_passes_test(test2)(callback)
- class DummyUser(object):
+ class DummyUser:
pass
- class DummyRequest(object):
+ class DummyRequest:
pass
request = DummyRequest()
@@ -184,7 +184,7 @@ def myattr2_dec(func):
myattr2_dec_m = method_decorator(myattr2_dec)
-class ClsDec(object):
+class ClsDec:
def __init__(self, myattr):
self.myattr = myattr
@@ -200,7 +200,7 @@ class MethodDecoratorTests(SimpleTestCase):
Tests for method_decorator
"""
def test_preserve_signature(self):
- class Test(object):
+ class Test:
@simple_dec_m
def say(self, arg):
return arg
@@ -218,7 +218,7 @@ class MethodDecoratorTests(SimpleTestCase):
self.assertIs(getattr(func, 'myattr2', False), True)
# Decorate using method_decorator() on the method.
- class TestPlain(object):
+ class TestPlain:
@myattr_dec_m
@myattr2_dec_m
def method(self):
@@ -229,7 +229,7 @@ class MethodDecoratorTests(SimpleTestCase):
# The decorators applied to the methods are applied before the ones
# applied to the class.
@method_decorator(myattr_dec_m, "method")
- class TestMethodAndClass(object):
+ class TestMethodAndClass:
@method_decorator(myattr2_dec_m)
def method(self):
"A method"
@@ -239,7 +239,7 @@ class MethodDecoratorTests(SimpleTestCase):
decorators = (myattr_dec_m, myattr2_dec_m)
@method_decorator(decorators, "method")
- class TestIterable(object):
+ class TestIterable:
def method(self):
"A method"
pass
@@ -259,14 +259,14 @@ class MethodDecoratorTests(SimpleTestCase):
# The rest of the exception message differs between Python 2 and 3.
with self.assertRaisesMessage(TypeError, "'set' object"):
@method_decorator(decorators, "method")
- class TestIterable(object):
+ class TestIterable:
def method(self):
"A method"
pass
# Test for argumented decorator
def test_argumented(self):
- class Test(object):
+ class Test:
@method_decorator(ClsDec(False))
def method(self):
return True
@@ -283,7 +283,7 @@ class MethodDecoratorTests(SimpleTestCase):
method_dec = method_decorator(original_dec)
- class bound_wrapper(object):
+ class bound_wrapper:
def __init__(self, wrapped):
self.wrapped = wrapped
self.__name__ = wrapped.__name__
@@ -294,7 +294,7 @@ class MethodDecoratorTests(SimpleTestCase):
def __get__(self, instance, cls=None):
return self
- class descriptor_wrapper(object):
+ class descriptor_wrapper:
def __init__(self, wrapped):
self.wrapped = wrapped
self.__name__ = wrapped.__name__
@@ -302,7 +302,7 @@ class MethodDecoratorTests(SimpleTestCase):
def __get__(self, instance, cls=None):
return bound_wrapper(self.wrapped.__get__(instance, cls))
- class Test(object):
+ class Test:
@method_dec
@descriptor_wrapper
def method(self, arg):
@@ -320,7 +320,7 @@ class MethodDecoratorTests(SimpleTestCase):
return _wrapper
@method_decorator(deco, name="method")
- class Test(object):
+ class Test:
def method(self):
return False
@@ -349,11 +349,11 @@ class MethodDecoratorTests(SimpleTestCase):
decorators = (add_exclamation_mark, add_question_mark)
@method_decorator(decorators, name="method")
- class TestFirst(object):
+ class TestFirst:
def method(self):
return "hello world"
- class TestSecond(object):
+ class TestSecond:
@method_decorator(decorators)
def method(self):
return "hello world"
@@ -371,7 +371,7 @@ class MethodDecoratorTests(SimpleTestCase):
)
with self.assertRaisesMessage(TypeError, msg):
@method_decorator(lambda: None, name="prop")
- class Test(object):
+ class Test:
prop = 1
@classmethod
@@ -388,7 +388,7 @@ class MethodDecoratorTests(SimpleTestCase):
)
with self.assertRaisesMessage(ValueError, msg):
@method_decorator(lambda: None, name="non_existing_method")
- class Test(object):
+ class Test:
@classmethod
def __module__(cls):
return "tests"
diff --git a/tests/defer/tests.py b/tests/defer/tests.py
index 0eea9545dd..6badd7056e 100644
--- a/tests/defer/tests.py
+++ b/tests/defer/tests.py
@@ -6,7 +6,7 @@ from .models import (
)
-class AssertionMixin(object):
+class AssertionMixin:
def assert_delayed(self, obj, num):
"""
Instances with deferred fields look the same as normal instances when
diff --git a/tests/deprecation/tests.py b/tests/deprecation/tests.py
index 5c2361f7a0..220010d909 100644
--- a/tests/deprecation/tests.py
+++ b/tests/deprecation/tests.py
@@ -140,11 +140,11 @@ class RenameMethodsTests(SimpleTestCase):
def new(self):
pass
- class RenamedMixin(object):
+ class RenamedMixin:
def new(self):
super(RenamedMixin, self).new()
- class DeprecatedMixin(object):
+ class DeprecatedMixin:
def old(self):
super(DeprecatedMixin, self).old()
diff --git a/tests/dispatch/tests.py b/tests/dispatch/tests.py
index d36dde9720..04fb39454d 100644
--- a/tests/dispatch/tests.py
+++ b/tests/dispatch/tests.py
@@ -29,7 +29,7 @@ def receiver_1_arg(val, **kwargs):
return val
-class Callable(object):
+class Callable:
def __call__(self, val, **kwargs):
return val
diff --git a/tests/files/tests.py b/tests/files/tests.py
index 50db4b7436..4515b1cab1 100644
--- a/tests/files/tests.py
+++ b/tests/files/tests.py
@@ -209,7 +209,7 @@ class DimensionClosingBug(unittest.TestCase):
# get_image_dimensions will call our catching_open instead of the
# regular builtin one.
- class FileWrapper(object):
+ class FileWrapper:
_closed = []
def __init__(self, f):
diff --git a/tests/fixtures/tests.py b/tests/fixtures/tests.py
index 51d8eef51b..ca60dd70e8 100644
--- a/tests/fixtures/tests.py
+++ b/tests/fixtures/tests.py
@@ -47,7 +47,7 @@ class SubclassTestCaseFixtureLoadingTests(TestCaseFixtureLoadingTests):
self.assertEqual(Article.objects.count(), 0)
-class DumpDataAssertMixin(object):
+class DumpDataAssertMixin:
def _dumpdata_assert(self, args, output, format='json', filename=None,
natural_foreign_keys=False, natural_primary_keys=False,
diff --git a/tests/flatpages_tests/test_middleware.py b/tests/flatpages_tests/test_middleware.py
index dd1d9e02f7..b7ca196db1 100644
--- a/tests/flatpages_tests/test_middleware.py
+++ b/tests/flatpages_tests/test_middleware.py
@@ -7,7 +7,7 @@ from django.test import TestCase, modify_settings, override_settings
from .settings import FLATPAGES_TEMPLATES
-class TestDataMixin(object):
+class TestDataMixin:
@classmethod
def setUpTestData(cls):
diff --git a/tests/flatpages_tests/test_views.py b/tests/flatpages_tests/test_views.py
index a5104ce620..42d3e2e8cc 100644
--- a/tests/flatpages_tests/test_views.py
+++ b/tests/flatpages_tests/test_views.py
@@ -7,7 +7,7 @@ from django.test import TestCase, modify_settings, override_settings
from .settings import FLATPAGES_TEMPLATES
-class TestDataMixin(object):
+class TestDataMixin:
@classmethod
def setUpTestData(cls):
diff --git a/tests/foreign_object/models/article.py b/tests/foreign_object/models/article.py
index e5c0c1f673..940ec003fb 100644
--- a/tests/foreign_object/models/article.py
+++ b/tests/foreign_object/models/article.py
@@ -15,7 +15,7 @@ class ArticleTranslationDescriptor(ForwardManyToOneDescriptor):
setattr(value, self.field.related.get_cache_name(), instance)
-class ColConstraint(object):
+class ColConstraint:
# Anything with as_sql() method works in get_extra_restriction().
def __init__(self, alias, col, value):
self.alias, self.col, self.value = alias, col, value
diff --git a/tests/forms_tests/field_tests/__init__.py b/tests/forms_tests/field_tests/__init__.py
index b984c6fb40..4aae30282b 100644
--- a/tests/forms_tests/field_tests/__init__.py
+++ b/tests/forms_tests/field_tests/__init__.py
@@ -1,7 +1,7 @@
from django import forms
-class FormFieldAssertionsMixin(object):
+class FormFieldAssertionsMixin:
def assertWidgetRendersTo(self, field, to):
class Form(forms.Form):
diff --git a/tests/forms_tests/field_tests/test_base.py b/tests/forms_tests/field_tests/test_base.py
index 67c3003393..721c0a935a 100644
--- a/tests/forms_tests/field_tests/test_base.py
+++ b/tests/forms_tests/field_tests/test_base.py
@@ -9,7 +9,7 @@ class BasicFieldsTests(SimpleTestCase):
self.assertFalse(Field(required=False).widget.is_required)
def test_cooperative_multiple_inheritance(self):
- class A(object):
+ class A:
def __init__(self):
self.class_a_var = True
super(A, self).__init__()
diff --git a/tests/forms_tests/tests/test_error_messages.py b/tests/forms_tests/tests/test_error_messages.py
index 10c7a92f7d..40b085f55b 100644
--- a/tests/forms_tests/tests/test_error_messages.py
+++ b/tests/forms_tests/tests/test_error_messages.py
@@ -13,7 +13,7 @@ from django.utils.safestring import mark_safe
from ..models import ChoiceModel
-class AssertFormErrorsMixin(object):
+class AssertFormErrorsMixin:
def assertFormErrors(self, expected, the_callable, *args, **kwargs):
with self.assertRaises(ValidationError) as cm:
the_callable(*args, **kwargs)
diff --git a/tests/forms_tests/tests/test_renderers.py b/tests/forms_tests/tests/test_renderers.py
index 2ce6be66af..df9c9cf367 100644
--- a/tests/forms_tests/tests/test_renderers.py
+++ b/tests/forms_tests/tests/test_renderers.py
@@ -13,7 +13,7 @@ except ImportError:
jinja2 = None
-class SharedTests(object):
+class SharedTests:
expected_widget_dir = 'templates'
def test_installed_apps_template_found(self):
diff --git a/tests/forms_tests/widget_tests/test_clearablefileinput.py b/tests/forms_tests/widget_tests/test_clearablefileinput.py
index dd7f04d0ac..eea7054541 100644
--- a/tests/forms_tests/widget_tests/test_clearablefileinput.py
+++ b/tests/forms_tests/widget_tests/test_clearablefileinput.py
@@ -4,7 +4,7 @@ from django.forms import ClearableFileInput
from .base import WidgetTest
-class FakeFieldFile(object):
+class FakeFieldFile:
"""
Quacks like a FieldFile (has a .url and unicode representation), but
doesn't require us to care about storages etc.
@@ -37,7 +37,7 @@ class ClearableFileInputTest(WidgetTest):
A ClearableFileInput should escape name, filename, and URL
when rendering HTML (#15182).
"""
- class StrangeFieldFile(object):
+ class StrangeFieldFile:
url = "something?chapter=1&sect=2&copy=3&lang=en"
def __str__(self):
@@ -107,7 +107,7 @@ class ClearableFileInputTest(WidgetTest):
A ClearableFileInput should not mask exceptions produced while
checking that it has a value.
"""
- class FailingURLFieldFile(object):
+ class FailingURLFieldFile:
@property
def url(self):
raise ValueError('Canary')
@@ -119,7 +119,7 @@ class ClearableFileInputTest(WidgetTest):
self.widget.render('myfile', FailingURLFieldFile())
def test_url_as_property(self):
- class URLFieldFile(object):
+ class URLFieldFile:
@property
def url(self):
return 'https://www.python.org/'
@@ -131,7 +131,7 @@ class ClearableFileInputTest(WidgetTest):
self.assertInHTML('<a href="https://www.python.org/">value</a>', html)
def test_return_false_if_url_does_not_exists(self):
- class NoURLFieldFile(object):
+ class NoURLFieldFile:
def __str__(self):
return 'value'
diff --git a/tests/generic_inline_admin/tests.py b/tests/generic_inline_admin/tests.py
index 203d9d7f3e..26a53f9985 100644
--- a/tests/generic_inline_admin/tests.py
+++ b/tests/generic_inline_admin/tests.py
@@ -15,7 +15,7 @@ from .admin import MediaInline, MediaPermanentInline, site as admin_site
from .models import Category, Episode, EpisodePermanent, Media, PhoneNumber
-class TestDataMixin(object):
+class TestDataMixin:
@classmethod
def setUpTestData(cls):
@@ -386,11 +386,11 @@ class NoInlineDeletionTest(SimpleTestCase):
self.assertFalse(formset.can_delete)
-class MockRequest(object):
+class MockRequest:
pass
-class MockSuperUser(object):
+class MockSuperUser:
def has_perm(self, perm):
return True
diff --git a/tests/generic_views/test_dates.py b/tests/generic_views/test_dates.py
index d18c818989..bf462b44fb 100644
--- a/tests/generic_views/test_dates.py
+++ b/tests/generic_views/test_dates.py
@@ -17,7 +17,7 @@ def _make_books(n, base_date):
pubdate=base_date - datetime.timedelta(days=i))
-class TestDataMixin(object):
+class TestDataMixin:
@classmethod
def setUpTestData(cls):
diff --git a/tests/generic_views/views.py b/tests/generic_views/views.py
index b466f3a324..05d5ec2f00 100644
--- a/tests/generic_views/views.py
+++ b/tests/generic_views/views.py
@@ -189,7 +189,7 @@ class SpecializedAuthorDelete(generic.DeleteView):
success_url = reverse_lazy('authors_list')
-class BookConfig(object):
+class BookConfig:
queryset = Book.objects.all()
date_field = 'pubdate'
@@ -266,7 +266,7 @@ class CustomSingleObjectView(generic.detail.SingleObjectMixin, generic.View):
object = Book(name="dummy")
-class BookSigningConfig(object):
+class BookSigningConfig:
model = BookSigning
date_field = 'event_date'
# use the same templates as for books
@@ -303,7 +303,7 @@ class BookSigningDetail(BookSigningConfig, generic.DateDetailView):
context_object_name = 'book'
-class NonModel(object):
+class NonModel:
id = "non_model_1"
_meta = None
diff --git a/tests/get_object_or_404/tests.py b/tests/get_object_or_404/tests.py
index b5a233568d..fa3c0cb324 100644
--- a/tests/get_object_or_404/tests.py
+++ b/tests/get_object_or_404/tests.py
@@ -83,7 +83,7 @@ class GetObjectOr404Tests(TestCase):
with self.assertRaisesMessage(ValueError, msg):
get_object_or_404(str("Article"), title__icontains="Run")
- class CustomClass(object):
+ class CustomClass:
pass
msg = "First argument to get_object_or_404() must be a Model, Manager, or QuerySet, not 'CustomClass'."
diff --git a/tests/gis_tests/gdal_tests/test_envelope.py b/tests/gis_tests/gdal_tests/test_envelope.py
index 8ea06ff426..b6cf4ab4f3 100644
--- a/tests/gis_tests/gdal_tests/test_envelope.py
+++ b/tests/gis_tests/gdal_tests/test_envelope.py
@@ -7,7 +7,7 @@ if HAS_GDAL:
from django.contrib.gis.gdal import Envelope, GDALException
-class TestPoint(object):
+class TestPoint:
def __init__(self, x, y):
self.x = x
self.y = y
diff --git a/tests/gis_tests/geo3d/tests.py b/tests/gis_tests/geo3d/tests.py
index e32611934a..72be664014 100644
--- a/tests/gis_tests/geo3d/tests.py
+++ b/tests/gis_tests/geo3d/tests.py
@@ -66,7 +66,7 @@ bbox_data = (
)
-class Geo3DLoadingHelper(object):
+class Geo3DLoadingHelper:
def _load_interstate_data(self):
# Interstate (2D / 3D and Geographic/Projected variants)
for name, line, exp_z in interstate_data:
diff --git a/tests/gis_tests/geos_tests/test_geos.py b/tests/gis_tests/geos_tests/test_geos.py
index f7024e790e..8626c4f200 100644
--- a/tests/gis_tests/geos_tests/test_geos.py
+++ b/tests/gis_tests/geos_tests/test_geos.py
@@ -89,7 +89,7 @@ class GEOSTest(SimpleTestCase, TestDataMixin):
with self.assertRaises(GEOSException):
GEOSGeometry(memoryview(b'0'))
- class NotAGeometry(object):
+ class NotAGeometry:
pass
# Some other object
diff --git a/tests/gis_tests/layermap/tests.py b/tests/gis_tests/layermap/tests.py
index 0f59132b0d..ce4b0c90d5 100644
--- a/tests/gis_tests/layermap/tests.py
+++ b/tests/gis_tests/layermap/tests.py
@@ -318,7 +318,7 @@ class LayerMapTest(TestCase):
self.assertEqual(City.objects.all()[0].name, "Zürich")
-class OtherRouter(object):
+class OtherRouter:
def db_for_read(self, model, **hints):
return 'other'
diff --git a/tests/gis_tests/test_data.py b/tests/gis_tests/test_data.py
index 9e31b5a599..23df42c007 100644
--- a/tests/gis_tests/test_data.py
+++ b/tests/gis_tests/test_data.py
@@ -31,7 +31,7 @@ def get_ds_file(name, ext):
)
-class TestObj(object):
+class TestObj:
"""
Base testing object, turns keyword args into attributes.
"""
@@ -76,7 +76,7 @@ class TestGeom(TestObj):
super(TestGeom, self).__init__(**kwargs)
-class TestGeomSet(object):
+class TestGeomSet:
"""
Each attribute of this object is a list of `TestGeom` instances.
"""
@@ -85,7 +85,7 @@ class TestGeomSet(object):
setattr(self, key, [TestGeom(**strconvert(kw)) for kw in value])
-class TestDataMixin(object):
+class TestDataMixin:
"""
Mixin used for GEOS/GDAL test cases that defines a `geometries`
property, which returns and/or loads the reference geometry data.
diff --git a/tests/gis_tests/tests.py b/tests/gis_tests/tests.py
index 59b8fcf7b5..6b689cf9b0 100644
--- a/tests/gis_tests/tests.py
+++ b/tests/gis_tests/tests.py
@@ -23,7 +23,7 @@ except ImproperlyConfigured as e:
if HAS_POSTGRES:
- class FakeConnection(object):
+ class FakeConnection:
def __init__(self):
self.settings_dict = {
'NAME': 'test',
diff --git a/tests/handlers/tests_custom_error_handlers.py b/tests/handlers/tests_custom_error_handlers.py
index 04f58fbe2a..3821783f79 100644
--- a/tests/handlers/tests_custom_error_handlers.py
+++ b/tests/handlers/tests_custom_error_handlers.py
@@ -4,7 +4,7 @@ from django.template.response import TemplateResponse
from django.test import SimpleTestCase, modify_settings, override_settings
-class MiddlewareAccessingContent(object):
+class MiddlewareAccessingContent:
def __init__(self, get_response):
self.get_response = get_response
diff --git a/tests/i18n/utils.py b/tests/i18n/utils.py
index c198afbc43..b2267cd3eb 100644
--- a/tests/i18n/utils.py
+++ b/tests/i18n/utils.py
@@ -12,7 +12,7 @@ def copytree(src, dst):
shutil.copytree(src, dst, ignore=shutil.ignore_patterns('*.pyc', '__pycache__'))
-class POFileAssertionMixin(object):
+class POFileAssertionMixin:
def _assertPoKeyword(self, keyword, expected_value, haystack, use_quotes=True):
q = '"'
@@ -30,7 +30,7 @@ class POFileAssertionMixin(object):
return self._assertPoKeyword('msgid', msgid, haystack, use_quotes=use_quotes)
-class RunInTmpDirMixin(object):
+class RunInTmpDirMixin:
"""
Allow i18n tests that need to generate .po/.mo files to run in an isolated
temporary filesystem tree created by tempfile.mkdtemp() that contains a
diff --git a/tests/invalid_models_tests/test_models.py b/tests/invalid_models_tests/test_models.py
index 7bb9497690..d35f9aa063 100644
--- a/tests/invalid_models_tests/test_models.py
+++ b/tests/invalid_models_tests/test_models.py
@@ -910,7 +910,7 @@ class OtherModelTests(SimpleTestCase):
class Meta:
app_label = 'invalid_models_tests'
- class DummyClass(object):
+ class DummyClass:
def __call__(self, **kwargs):
pass
diff --git a/tests/invalid_models_tests/test_ordinary_fields.py b/tests/invalid_models_tests/test_ordinary_fields.py
index 61f93e8578..f1f1f07766 100644
--- a/tests/invalid_models_tests/test_ordinary_fields.py
+++ b/tests/invalid_models_tests/test_ordinary_fields.py
@@ -155,7 +155,7 @@ class CharFieldTests(TestCase):
self.assertEqual(errors, expected)
def test_iterable_of_iterable_choices(self):
- class ThingItem(object):
+ class ThingItem:
def __init__(self, value, display):
self.value = value
self.display = display
@@ -166,7 +166,7 @@ class CharFieldTests(TestCase):
def __len__(self):
return 2
- class Things(object):
+ class Things:
def __iter__(self):
return (x for x in [ThingItem(1, 2), ThingItem(3, 4)])
diff --git a/tests/logging_tests/tests.py b/tests/logging_tests/tests.py
index a91bcd66bf..6033cac289 100644
--- a/tests/logging_tests/tests.py
+++ b/tests/logging_tests/tests.py
@@ -64,7 +64,7 @@ class LoggingFiltersTest(SimpleTestCase):
self.assertIs(filter_.filter("record is not used"), False)
-class SetupDefaultLoggingMixin(object):
+class SetupDefaultLoggingMixin:
@classmethod
def setUpClass(cls):
diff --git a/tests/mail/tests.py b/tests/mail/tests.py
index 77ea87fe7d..8ba4d64423 100644
--- a/tests/mail/tests.py
+++ b/tests/mail/tests.py
@@ -30,7 +30,7 @@ from django.utils.encoding import force_bytes, force_text
from django.utils.translation import ugettext_lazy
-class HeadersCheckMixin(object):
+class HeadersCheckMixin:
def assertMessageHasHeaders(self, message, headers):
"""
@@ -708,7 +708,7 @@ class PythonGlobalState(SimpleTestCase):
self.assertIn(str('Content-Transfer-Encoding: base64'), txt.as_string())
-class BaseEmailBackendTests(HeadersCheckMixin, object):
+class BaseEmailBackendTests(HeadersCheckMixin):
email_backend = None
def setUp(self):
diff --git a/tests/messages_tests/base.py b/tests/messages_tests/base.py
index 889bcc043a..8082d468fe 100644
--- a/tests/messages_tests/base.py
+++ b/tests/messages_tests/base.py
@@ -36,7 +36,7 @@ class override_settings_tags(override_settings):
base.LEVEL_TAGS = self.old_level_tags
-class BaseTests(object):
+class BaseTests:
storage_class = default_storage
levels = {
'debug': constants.DEBUG,
diff --git a/tests/messages_tests/test_api.py b/tests/messages_tests/test_api.py
index 8baff57c70..3de6b81b7b 100644
--- a/tests/messages_tests/test_api.py
+++ b/tests/messages_tests/test_api.py
@@ -2,7 +2,7 @@ from django.contrib import messages
from django.test import RequestFactory, SimpleTestCase
-class DummyStorage(object):
+class DummyStorage:
"""
dummy message-store to test the api methods
"""
@@ -44,7 +44,7 @@ class ApiTests(SimpleTestCase):
self.assertEqual(self.storage.store, [])
-class CustomRequest(object):
+class CustomRequest:
def __init__(self, request):
self._request = request
diff --git a/tests/middleware_exceptions/middleware.py b/tests/middleware_exceptions/middleware.py
index e704b9f2b5..49e5d43189 100644
--- a/tests/middleware_exceptions/middleware.py
+++ b/tests/middleware_exceptions/middleware.py
@@ -5,7 +5,7 @@ from django.template.response import TemplateResponse
log = []
-class BaseMiddleware(object):
+class BaseMiddleware:
def __init__(self, get_response):
self.get_response = get_response
diff --git a/tests/middleware_exceptions/tests.py b/tests/middleware_exceptions/tests.py
index 230d062c88..0c39f09f91 100644
--- a/tests/middleware_exceptions/tests.py
+++ b/tests/middleware_exceptions/tests.py
@@ -104,7 +104,7 @@ class RootUrlconfTests(SimpleTestCase):
self.client.get("/middleware_exceptions/view/")
-class MyMiddleware(object):
+class MyMiddleware:
def __init__(self, get_response=None):
raise MiddlewareNotUsed
@@ -113,7 +113,7 @@ class MyMiddleware(object):
pass
-class MyMiddlewareWithExceptionMessage(object):
+class MyMiddlewareWithExceptionMessage:
def __init__(self, get_response=None):
raise MiddlewareNotUsed('spam eggs')
diff --git a/tests/migrate_signals/tests.py b/tests/migrate_signals/tests.py
index 97f449e805..563be2a82d 100644
--- a/tests/migrate_signals/tests.py
+++ b/tests/migrate_signals/tests.py
@@ -13,7 +13,7 @@ MIGRATE_VERBOSITY = 1
MIGRATE_INTERACTIVE = False
-class Receiver(object):
+class Receiver:
def __init__(self, signal):
self.call_counter = 0
self.call_args = None
@@ -24,7 +24,7 @@ class Receiver(object):
self.call_args = kwargs
-class OneTimeReceiver(object):
+class OneTimeReceiver:
"""
Special receiver for handle the fact that test runner calls migrate for
several databases and several times for some of them.
diff --git a/tests/migrations/models.py b/tests/migrations/models.py
index 9a34edf349..51679e56bb 100644
--- a/tests/migrations/models.py
+++ b/tests/migrations/models.py
@@ -23,7 +23,7 @@ class UnicodeModel(models.Model):
return self.title
-class Unserializable(object):
+class Unserializable:
"""
An object that migration doesn't know how to serialize.
"""
diff --git a/tests/migrations/routers.py b/tests/migrations/routers.py
index 9857363937..21dfc561bd 100644
--- a/tests/migrations/routers.py
+++ b/tests/migrations/routers.py
@@ -1,8 +1,8 @@
-class EmptyRouter(object):
+class EmptyRouter:
pass
-class TestRouter(object):
+class TestRouter:
def allow_migrate(self, db, app_label, model_name=None, **hints):
"""
The Tribble model should be the only one to appear in the 'other' db.
diff --git a/tests/migrations/test_autodetector.py b/tests/migrations/test_autodetector.py
index e30aeb5d19..df35181d92 100644
--- a/tests/migrations/test_autodetector.py
+++ b/tests/migrations/test_autodetector.py
@@ -17,7 +17,7 @@ from django.test.utils import isolate_lru_cache
from .models import FoodManager, FoodQuerySet
-class DeconstructibleObject(object):
+class DeconstructibleObject:
"""
A custom deconstructible object.
"""
diff --git a/tests/migrations/test_executor.py b/tests/migrations/test_executor.py
index 60e7ec9771..d6cc802149 100644
--- a/tests/migrations/test_executor.py
+++ b/tests/migrations/test_executor.py
@@ -642,13 +642,13 @@ class ExecutorTests(MigrationTestBase):
)
-class FakeLoader(object):
+class FakeLoader:
def __init__(self, graph, applied):
self.graph = graph
self.applied_migrations = applied
-class FakeMigration(object):
+class FakeMigration:
"""Really all we need is any object with a debug-useful repr."""
def __init__(self, name):
self.name = name
diff --git a/tests/migrations/test_multidb.py b/tests/migrations/test_multidb.py
index c6ca4a844e..16cd8f33d1 100644
--- a/tests/migrations/test_multidb.py
+++ b/tests/migrations/test_multidb.py
@@ -12,7 +12,7 @@ except ImportError:
sqlparse = None
-class AgnosticRouter(object):
+class AgnosticRouter:
"""
A router that doesn't have an opinion regarding migrating.
"""
@@ -20,7 +20,7 @@ class AgnosticRouter(object):
return None
-class MigrateNothingRouter(object):
+class MigrateNothingRouter:
"""
A router that doesn't allow migrating.
"""
@@ -28,7 +28,7 @@ class MigrateNothingRouter(object):
return False
-class MigrateEverythingRouter(object):
+class MigrateEverythingRouter:
"""
A router that always allows migrating.
"""
@@ -36,7 +36,7 @@ class MigrateEverythingRouter(object):
return True
-class MigrateWhenFooRouter(object):
+class MigrateWhenFooRouter:
"""
A router that allows migrating depending on a hint.
"""
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py
index f962f9cf8c..7943b59a44 100644
--- a/tests/migrations/test_operations.py
+++ b/tests/migrations/test_operations.py
@@ -18,7 +18,7 @@ except ImportError:
sqlparse = None
-class Mixin(object):
+class Mixin:
pass
diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py
index fb16b441d1..ff5e22ac5e 100644
--- a/tests/migrations/test_writer.py
+++ b/tests/migrations/test_writer.py
@@ -485,7 +485,7 @@ class WriterTests(SimpleTestCase):
"""
Neither py2 or py3 can serialize a reference in a local scope.
"""
- class TestModel2(object):
+ class TestModel2:
def upload_to(self):
return "somewhere dynamic"
thing = models.FileField(upload_to=upload_to)
@@ -496,7 +496,7 @@ class WriterTests(SimpleTestCase):
"""
Make sure user is seeing which module/function is the issue
"""
- class TestModel2(object):
+ class TestModel2:
def upload_to(self):
return "somewhere dynamic"
thing = models.FileField(upload_to=upload_to)
@@ -671,7 +671,7 @@ class WriterTests(SimpleTestCase):
# Yes, it doesn't make sense to use a class as a default for a
# CharField. It does make sense for custom fields though, for example
# an enumfield that takes the enum class as an argument.
- class DeconstructibleInstances(object):
+ class DeconstructibleInstances:
def deconstruct(self):
return ('DeconstructibleInstances', [], {})
diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py
index adb90d6d14..da28fcc7d6 100644
--- a/tests/model_forms/tests.py
+++ b/tests/model_forms/tests.py
@@ -2721,7 +2721,7 @@ class ModelFormInheritanceTests(SimpleTestCase):
model = Writer
fields = '__all__'
- class Mixin(object):
+ class Mixin:
age = None
class Form(forms.Form):
diff --git a/tests/model_formsets_regress/tests.py b/tests/model_formsets_regress/tests.py
index 5bad8a741a..64d933f90c 100644
--- a/tests/model_formsets_regress/tests.py
+++ b/tests/model_formsets_regress/tests.py
@@ -312,7 +312,7 @@ class UserSiteForm(forms.ModelForm):
localized_fields = ('data',)
-class Callback(object):
+class Callback:
def __init__(self):
self.log = []
diff --git a/tests/model_inheritance/models.py b/tests/model_inheritance/models.py
index 44bf752d00..62003f032e 100644
--- a/tests/model_inheritance/models.py
+++ b/tests/model_inheritance/models.py
@@ -157,7 +157,7 @@ class NamedURL(models.Model):
abstract = True
-class Mixin(object):
+class Mixin:
def __init__(self):
self.other_attr = 1
super(Mixin, self).__init__()
diff --git a/tests/model_inheritance/test_abstract_inheritance.py b/tests/model_inheritance/test_abstract_inheritance.py
index 6f0b89128b..d74cae7a3b 100644
--- a/tests/model_inheritance/test_abstract_inheritance.py
+++ b/tests/model_inheritance/test_abstract_inheritance.py
@@ -301,10 +301,10 @@ class AbstractInheritanceTests(TestCase):
class Meta:
abstract = True
- class Mixin(object):
+ class Mixin:
age = None
- class Mixin2(object):
+ class Mixin2:
age = 2
class DescendantMixin(Mixin):
diff --git a/tests/modeladmin/test_checks.py b/tests/modeladmin/test_checks.py
index 93b35ecf56..c90ed64958 100644
--- a/tests/modeladmin/test_checks.py
+++ b/tests/modeladmin/test_checks.py
@@ -198,7 +198,7 @@ class FieldsCheckTests(CheckTestCase):
class FormCheckTests(CheckTestCase):
def test_invalid_type(self):
- class FakeForm(object):
+ class FakeForm:
pass
class TestModelAdmin(ModelAdmin):
@@ -578,7 +578,7 @@ class ListFilterTests(CheckTestCase):
)
def test_not_filter(self):
- class RandomClass(object):
+ class RandomClass:
pass
class TestModelAdmin(ModelAdmin):
@@ -590,7 +590,7 @@ class ListFilterTests(CheckTestCase):
'admin.E113')
def test_not_filter_again(self):
- class RandomClass(object):
+ class RandomClass:
pass
class TestModelAdmin(ModelAdmin):
@@ -869,7 +869,7 @@ class InlinesCheckTests(CheckTestCase):
)
def test_not_model_admin(self):
- class ValidationTestInline(object):
+ class ValidationTestInline:
pass
class TestModelAdmin(ModelAdmin):
@@ -894,7 +894,7 @@ class InlinesCheckTests(CheckTestCase):
'admin.E105')
def test_invalid_model_type(self):
- class SomethingBad(object):
+ class SomethingBad:
pass
class ValidationTestInline(TabularInline):
@@ -1034,7 +1034,7 @@ class MinNumCheckTests(CheckTestCase):
class FormsetCheckTests(CheckTestCase):
def test_invalid_type(self):
- class FakeFormSet(object):
+ class FakeFormSet:
pass
class ValidationTestInline(TabularInline):
diff --git a/tests/modeladmin/tests.py b/tests/modeladmin/tests.py
index 12ca86ff1a..1cded986fa 100644
--- a/tests/modeladmin/tests.py
+++ b/tests/modeladmin/tests.py
@@ -14,11 +14,11 @@ from django.test import SimpleTestCase, TestCase
from .models import Band, Concert
-class MockRequest(object):
+class MockRequest:
pass
-class MockSuperUser(object):
+class MockSuperUser:
def has_perm(self, perm):
return True
@@ -589,7 +589,7 @@ class ModelAdminTests(TestCase):
class ModelAdminPermissionTests(SimpleTestCase):
- class MockUser(object):
+ class MockUser:
def has_module_perms(self, app_label):
if app_label == "modeladmin":
return True
diff --git a/tests/multiple_database/routers.py b/tests/multiple_database/routers.py
index e51c82b858..cb12a907c9 100644
--- a/tests/multiple_database/routers.py
+++ b/tests/multiple_database/routers.py
@@ -1,7 +1,7 @@
from django.db import DEFAULT_DB_ALIAS
-class TestRouter(object):
+class TestRouter:
"""
Vaguely behave like primary/replica, but the databases aren't assumed to
propagate changes.
@@ -22,7 +22,7 @@ class TestRouter(object):
return True
-class AuthRouter(object):
+class AuthRouter:
"""
Control all database operations on models in the contrib.auth application.
"""
@@ -54,7 +54,7 @@ class AuthRouter(object):
return None
-class WriteRouter(object):
+class WriteRouter:
# A router that only expresses an opinion on writes
def db_for_write(self, model, **hints):
return 'writer'
diff --git a/tests/multiple_database/tests.py b/tests/multiple_database/tests.py
index 3487894fd9..ec04a37e2f 100644
--- a/tests/multiple_database/tests.py
+++ b/tests/multiple_database/tests.py
@@ -1529,7 +1529,7 @@ class AuthTestCase(TestCase):
self.assertIn('"email": "alice@example.com"', command_output)
-class AntiPetRouter(object):
+class AntiPetRouter:
# A router that only expresses an opinion on migrate,
# passing pets to the 'other' database
@@ -1590,7 +1590,7 @@ class PickleQuerySetTestCase(TestCase):
self.assertEqual(qs.db, pickle.loads(pickle.dumps(qs)).db)
-class DatabaseReceiver(object):
+class DatabaseReceiver:
"""
Used in the tests for the database argument in signals (#13552)
"""
@@ -1598,7 +1598,7 @@ class DatabaseReceiver(object):
self._database = kwargs['using']
-class WriteToOtherRouter(object):
+class WriteToOtherRouter:
"""
A router that sends all writes to the other database.
"""
@@ -1698,7 +1698,7 @@ class SignalTests(TestCase):
self.assertEqual(receiver._database, "other")
-class AttributeErrorRouter(object):
+class AttributeErrorRouter:
"A router to test the exception handling of ConnectionRouter"
def db_for_read(self, model, **hints):
raise AttributeError
@@ -1751,7 +1751,7 @@ class RouterAttributeErrorTestCase(TestCase):
b.authors.set([p])
-class ModelMetaRouter(object):
+class ModelMetaRouter:
"A router to ensure model arguments are real model classes"
def db_for_write(self, model, **hints):
if not hasattr(model, '_meta'):
@@ -1785,7 +1785,7 @@ class RouterModelArgumentTestCase(TestCase):
person.delete()
-class SyncOnlyDefaultDatabaseRouter(object):
+class SyncOnlyDefaultDatabaseRouter:
def allow_migrate(self, db, app_label, **hints):
return db == DEFAULT_DB_ALIAS
@@ -1828,7 +1828,7 @@ class RouterUsed(Exception):
class RouteForWriteTestCase(TestCase):
multi_db = True
- class WriteCheckRouter(object):
+ class WriteCheckRouter:
def db_for_write(self, model, **hints):
raise RouterUsed(mode=RouterUsed.WRITE, model=model, hints=hints)
diff --git a/tests/order_with_respect_to/base_tests.py b/tests/order_with_respect_to/base_tests.py
index ad8925bf88..3ca7ada800 100644
--- a/tests/order_with_respect_to/base_tests.py
+++ b/tests/order_with_respect_to/base_tests.py
@@ -5,7 +5,7 @@ reference any models directly. Subclasses should inherit django.test.TestCase.
from operator import attrgetter
-class BaseOrderWithRespectToTests(object):
+class BaseOrderWithRespectToTests:
# Hook to allow subclasses to run these tests with alternate models.
Answer = None
Post = None
diff --git a/tests/pagination/tests.py b/tests/pagination/tests.py
index 2e2e2d37db..4aaaa3c3de 100644
--- a/tests/pagination/tests.py
+++ b/tests/pagination/tests.py
@@ -124,7 +124,7 @@ class PaginationTests(unittest.TestCase):
self.assertEqual(paginator.validate_number(1), 1)
def test_paginate_misc_classes(self):
- class CountContainer(object):
+ class CountContainer:
def count(self):
return 42
# Paginator can be passed other objects with a count() method.
@@ -134,7 +134,7 @@ class PaginationTests(unittest.TestCase):
self.assertEqual([1, 2, 3, 4, 5], list(paginator.page_range))
# Paginator can be passed other objects that implement __len__.
- class LenContainer(object):
+ class LenContainer:
def __len__(self):
return 42
paginator = Paginator(LenContainer(), 10)
diff --git a/tests/postgres_tests/models.py b/tests/postgres_tests/models.py
index 2a0d69b21a..a77fc4b152 100644
--- a/tests/postgres_tests/models.py
+++ b/tests/postgres_tests/models.py
@@ -8,7 +8,7 @@ from .fields import (
)
-class Tag(object):
+class Tag:
def __init__(self, tag_id):
self.tag_id = tag_id
diff --git a/tests/postgres_tests/test_search.py b/tests/postgres_tests/test_search.py
index 0bf2df50f1..2108beb181 100644
--- a/tests/postgres_tests/test_search.py
+++ b/tests/postgres_tests/test_search.py
@@ -15,7 +15,7 @@ from . import PostgreSQLTestCase
from .models import Character, Line, Scene
-class GrailTestData(object):
+class GrailTestData:
@classmethod
def setUpTestData(cls):
diff --git a/tests/queries/tests.py b/tests/queries/tests.py
index 1f9094e49f..4107dada0e 100644
--- a/tests/queries/tests.py
+++ b/tests/queries/tests.py
@@ -2862,11 +2862,11 @@ class ProxyQueryCleanupTest(TestCase):
class WhereNodeTest(TestCase):
- class DummyNode(object):
+ class DummyNode:
def as_sql(self, compiler, connection):
return 'dummy', []
- class MockCompiler(object):
+ class MockCompiler:
def compile(self, node):
return node.as_sql(self, connection)
diff --git a/tests/queryset_pickle/models.py b/tests/queryset_pickle/models.py
index 4faad0175b..dbd570a30b 100644
--- a/tests/queryset_pickle/models.py
+++ b/tests/queryset_pickle/models.py
@@ -8,7 +8,7 @@ def standalone_number():
return 1
-class Numbers(object):
+class Numbers:
@staticmethod
def get_static_number():
return 2
@@ -47,7 +47,7 @@ class Happening(models.Model):
number2 = models.IntegerField(blank=True, default=Numbers.get_static_number)
-class Container(object):
+class Container:
# To test pickling we need a class that isn't defined on module, but
# is still available from app-cache. So, the Container class moves
# SomeModel outside of module level
diff --git a/tests/serializers/models/base.py b/tests/serializers/models/base.py
index 9421578478..78d832140f 100644
--- a/tests/serializers/models/base.py
+++ b/tests/serializers/models/base.py
@@ -100,7 +100,7 @@ class Score(models.Model):
score = models.FloatField()
-class Team(object):
+class Team:
def __init__(self, title):
self.title = title
diff --git a/tests/serializers/test_yaml.py b/tests/serializers/test_yaml.py
index 542c28fb2e..5a9fa5e873 100644
--- a/tests/serializers/test_yaml.py
+++ b/tests/serializers/test_yaml.py
@@ -18,7 +18,7 @@ except ImportError:
YAML_IMPORT_ERROR_MESSAGE = r'No module named yaml'
-class YamlImportModuleMock(object):
+class YamlImportModuleMock:
"""Provides a wrapped import_module function to simulate yaml ImportError
In order to run tests that verify the behavior of the YAML serializer
diff --git a/tests/serializers/tests.py b/tests/serializers/tests.py
index 5c30d66082..5750c146a2 100644
--- a/tests/serializers/tests.py
+++ b/tests/serializers/tests.py
@@ -88,7 +88,7 @@ class SerializerRegistrationTests(SimpleTestCase):
serializers.get_deserializer("nonsense")
-class SerializersTestBase(object):
+class SerializersTestBase:
serializer_name = None # Set by subclasses to the serialization format name
@staticmethod
@@ -349,7 +349,7 @@ class SerializersTestBase(object):
class SerializerAPITests(SimpleTestCase):
def test_stream_class(self):
- class File(object):
+ class File:
def __init__(self):
self.lines = []
@@ -369,7 +369,7 @@ class SerializerAPITests(SimpleTestCase):
self.assertEqual(data, '[{"model": "serializers.score", "pk": 1, "fields": {"score": 3.4}}]')
-class SerializersTransactionTestBase(object):
+class SerializersTransactionTestBase:
available_apps = ['serializers']
diff --git a/tests/servers/test_basehttp.py b/tests/servers/test_basehttp.py
index cd9bcd2e86..cf0f8ac41b 100644
--- a/tests/servers/test_basehttp.py
+++ b/tests/servers/test_basehttp.py
@@ -8,7 +8,7 @@ from django.test.client import RequestFactory
from django.test.utils import patch_logger
-class Stub(object):
+class Stub:
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
diff --git a/tests/sessions_tests/tests.py b/tests/sessions_tests/tests.py
index 29de5782d9..d4a486b90e 100644
--- a/tests/sessions_tests/tests.py
+++ b/tests/sessions_tests/tests.py
@@ -38,7 +38,7 @@ from django.utils.encoding import force_text
from .models import SessionStore as CustomDatabaseSession
-class SessionTestsMixin(object):
+class SessionTestsMixin:
# This does not inherit from TestCase to avoid any tests being run with this
# class, which wouldn't work, and to allow different TestCase subclasses to
# be used.
diff --git a/tests/signals/tests.py b/tests/signals/tests.py
index 88572ad44f..0c1c885dc4 100644
--- a/tests/signals/tests.py
+++ b/tests/signals/tests.py
@@ -122,7 +122,7 @@ class SignalTests(BaseSignalTest):
)
# #8285: signals can be any callable
- class PostDeleteHandler(object):
+ class PostDeleteHandler:
def __init__(self, data):
self.data = data
@@ -247,7 +247,7 @@ class SignalTests(BaseSignalTest):
dispatching.
"""
- class Handler(object):
+ class Handler:
def __init__(self, param):
self.param = param
self._run = False
diff --git a/tests/sites_tests/tests.py b/tests/sites_tests/tests.py
index 0179500f14..9e2d7ad4fc 100644
--- a/tests/sites_tests/tests.py
+++ b/tests/sites_tests/tests.py
@@ -226,7 +226,7 @@ class SitesFrameworkTests(TestCase):
RequestSite(request).delete()
-class JustOtherRouter(object):
+class JustOtherRouter:
def allow_migrate(self, db, app_label, **hints):
return db == 'other'
diff --git a/tests/staticfiles_tests/cases.py b/tests/staticfiles_tests/cases.py
index 069402c6f6..537fbac6a0 100644
--- a/tests/staticfiles_tests/cases.py
+++ b/tests/staticfiles_tests/cases.py
@@ -12,7 +12,7 @@ from django.utils.encoding import force_text
from .settings import TEST_SETTINGS
-class BaseStaticFilesMixin(object):
+class BaseStaticFilesMixin:
"""
Test case with a couple utility assertions.
"""
@@ -89,7 +89,7 @@ class CollectionTestCase(BaseStaticFilesMixin, SimpleTestCase):
return f.read()
-class TestDefaults(object):
+class TestDefaults:
"""
A few standard test cases.
"""
diff --git a/tests/staticfiles_tests/test_finders.py b/tests/staticfiles_tests/test_finders.py
index 0f5cf5bea2..7df8c50a0d 100644
--- a/tests/staticfiles_tests/test_finders.py
+++ b/tests/staticfiles_tests/test_finders.py
@@ -9,7 +9,7 @@ from .cases import StaticFilesTestCase
from .settings import TEST_ROOT
-class TestFinders(object):
+class TestFinders:
"""
Base finder test mixin.
diff --git a/tests/staticfiles_tests/test_management.py b/tests/staticfiles_tests/test_management.py
index 310c152d06..f0160c60d8 100644
--- a/tests/staticfiles_tests/test_management.py
+++ b/tests/staticfiles_tests/test_management.py
@@ -25,7 +25,7 @@ from .settings import TEST_ROOT, TEST_SETTINGS
from .storage import DummyStorage
-class TestNoFilesCreated(object):
+class TestNoFilesCreated:
def test_no_files_created(self):
"""
diff --git a/tests/staticfiles_tests/test_storage.py b/tests/staticfiles_tests/test_storage.py
index e299feea78..c72100ccb1 100644
--- a/tests/staticfiles_tests/test_storage.py
+++ b/tests/staticfiles_tests/test_storage.py
@@ -23,7 +23,7 @@ def hashed_file_path(test, path):
return fullpath.replace(settings.STATIC_URL, '')
-class TestHashedFiles(object):
+class TestHashedFiles:
hashed_file_path = hashed_file_path
def setUp(self):
diff --git a/tests/template_tests/filter_tests/test_floatformat.py b/tests/template_tests/filter_tests/test_floatformat.py
index 8474238f21..e0f7666ff0 100644
--- a/tests/template_tests/filter_tests/test_floatformat.py
+++ b/tests/template_tests/filter_tests/test_floatformat.py
@@ -72,7 +72,7 @@ class FunctionTests(SimpleTestCase):
self.assertEqual(floatformat(nan), str(nan))
def test_float_dunder_method(self):
- class FloatWrapper(object):
+ class FloatWrapper:
def __init__(self, value):
self.value = value
diff --git a/tests/template_tests/filter_tests/test_unordered_list.py b/tests/template_tests/filter_tests/test_unordered_list.py
index 659b1acc2b..b4d624345b 100644
--- a/tests/template_tests/filter_tests/test_unordered_list.py
+++ b/tests/template_tests/filter_tests/test_unordered_list.py
@@ -87,7 +87,7 @@ class FunctionTests(SimpleTestCase):
)
def test_ulitem(self):
- class ULItem(object):
+ class ULItem:
def __init__(self, title):
self.title = title
@@ -113,7 +113,7 @@ class FunctionTests(SimpleTestCase):
)
def test_ulitem_autoescape_off(self):
- class ULItem(object):
+ class ULItem:
def __init__(self, title):
self.title = title
diff --git a/tests/template_tests/test_callables.py b/tests/template_tests/test_callables.py
index 4cfb49db5c..6a361e8409 100644
--- a/tests/template_tests/test_callables.py
+++ b/tests/template_tests/test_callables.py
@@ -12,7 +12,7 @@ class CallableVariablesTests(TestCase):
def test_callable(self):
- class Doodad(object):
+ class Doodad:
def __init__(self, value):
self.num_calls = 0
self.value = value
@@ -41,7 +41,7 @@ class CallableVariablesTests(TestCase):
def test_alters_data(self):
- class Doodad(object):
+ class Doodad:
alters_data = True
def __init__(self, value):
@@ -68,7 +68,7 @@ class CallableVariablesTests(TestCase):
def test_do_not_call(self):
- class Doodad(object):
+ class Doodad:
do_not_call_in_templates = True
def __init__(self, value):
@@ -100,7 +100,7 @@ class CallableVariablesTests(TestCase):
# ``alters_data`` attribute will not make any difference in the
# template system's behavior.
- class Doodad(object):
+ class Doodad:
do_not_call_in_templates = True
alters_data = True
diff --git a/tests/template_tests/test_logging.py b/tests/template_tests/test_logging.py
index 9dd8046408..e03809d864 100644
--- a/tests/template_tests/test_logging.py
+++ b/tests/template_tests/test_logging.py
@@ -31,7 +31,7 @@ class VariableResolveLoggingTests(BaseTemplateLoggingTestCase):
loglevel = logging.DEBUG
def test_log_on_variable_does_not_exist_silent(self):
- class TestObject(object):
+ class TestObject:
class SilentDoesNotExist(Exception):
silent_variable_failure = True
diff --git a/tests/template_tests/utils.py b/tests/template_tests/utils.py
index 187d259f36..8ee66a6523 100644
--- a/tests/template_tests/utils.py
+++ b/tests/template_tests/utils.py
@@ -142,7 +142,7 @@ class OtherClass:
return 'OtherClass.method'
-class TestObj(object):
+class TestObj:
def is_true(self):
return True
@@ -153,12 +153,12 @@ class TestObj(object):
raise ShouldNotExecuteException()
-class SilentGetItemClass(object):
+class SilentGetItemClass:
def __getitem__(self, key):
raise SomeException
-class SilentAttrClass(object):
+class SilentAttrClass:
def b(self):
raise SomeException
b = property(b)
diff --git a/tests/test_client/auth_backends.py b/tests/test_client/auth_backends.py
index 1bb1d96eeb..97a2763aaa 100644
--- a/tests/test_client/auth_backends.py
+++ b/tests/test_client/auth_backends.py
@@ -5,5 +5,5 @@ class TestClientBackend(ModelBackend):
pass
-class BackendWithoutGetUserMethod(object):
+class BackendWithoutGetUserMethod:
pass
diff --git a/tests/test_client/views.py b/tests/test_client/views.py
index e9a28449ec..bc6a59f760 100644
--- a/tests/test_client/views.py
+++ b/tests/test_client/views.py
@@ -248,7 +248,7 @@ permission_protected_view_exception = (
)
-class _ViewManager(object):
+class _ViewManager:
@method_decorator(login_required)
def login_protected_view(self, request):
t = Template('This is a login protected test using a method. '
diff --git a/tests/test_client_regress/tests.py b/tests/test_client_regress/tests.py
index 0436ae9968..16b344e0ae 100644
--- a/tests/test_client_regress/tests.py
+++ b/tests/test_client_regress/tests.py
@@ -24,7 +24,7 @@ from .models import CustomUser
from .views import CustomTestException
-class TestDataMixin(object):
+class TestDataMixin:
@classmethod
def setUpTestData(cls):
@@ -1298,7 +1298,7 @@ class UnicodePayloadTests(SimpleTestCase):
self.assertEqual(response.content, json.encode('koi8-r'))
-class DummyFile(object):
+class DummyFile:
def __init__(self, filename):
self.name = filename
diff --git a/tests/test_runner/tests.py b/tests/test_runner/tests.py
index 670bc6683c..51810fe7bc 100644
--- a/tests/test_runner/tests.py
+++ b/tests/test_runner/tests.py
@@ -129,7 +129,7 @@ class DependencyOrderingTests(unittest.TestCase):
dependency_ordered(raw, dependencies=dependencies)
-class MockTestRunner(object):
+class MockTestRunner:
def __init__(self, *args, **kwargs):
pass
diff --git a/tests/transactions/tests.py b/tests/transactions/tests.py
index 12d2eb299d..033619c0c8 100644
--- a/tests/transactions/tests.py
+++ b/tests/transactions/tests.py
@@ -413,7 +413,7 @@ class AtomicMiscTests(TransactionTestCase):
def test_wrap_callable_instance(self):
"""#20028 -- Atomic must support wrapping callable instances."""
- class Callable(object):
+ class Callable:
def __call__(self):
pass
diff --git a/tests/urlpatterns_reverse/method_view_urls.py b/tests/urlpatterns_reverse/method_view_urls.py
index c28958e6a9..e91966b4ac 100644
--- a/tests/urlpatterns_reverse/method_view_urls.py
+++ b/tests/urlpatterns_reverse/method_view_urls.py
@@ -1,7 +1,7 @@
from django.conf.urls import url
-class ViewContainer(object):
+class ViewContainer:
def method_view(self, request):
pass
diff --git a/tests/urlpatterns_reverse/tests.py b/tests/urlpatterns_reverse/tests.py
index 62d199c030..efb30dc2ff 100644
--- a/tests/urlpatterns_reverse/tests.py
+++ b/tests/urlpatterns_reverse/tests.py
@@ -518,7 +518,7 @@ class ReverseShortcutTests(SimpleTestCase):
def test_redirect_to_object(self):
# We don't really need a model; just something with a get_absolute_url
- class FakeObj(object):
+ class FakeObj:
def get_absolute_url(self):
return "/hi-there/"
diff --git a/tests/urlpatterns_reverse/utils.py b/tests/urlpatterns_reverse/utils.py
index 22664480d1..8c96d8ca72 100644
--- a/tests/urlpatterns_reverse/utils.py
+++ b/tests/urlpatterns_reverse/utils.py
@@ -3,7 +3,7 @@ from django.conf.urls import url
from . import views
-class URLObject(object):
+class URLObject:
urlpatterns = [
url(r'^inner/$', views.empty_view, name='urlobject-view'),
url(r'^inner/(?P<arg1>[0-9]+)/(?P<arg2>[0-9]+)/$', views.empty_view, name='urlobject-view'),
diff --git a/tests/urlpatterns_reverse/views.py b/tests/urlpatterns_reverse/views.py
index e8765367be..584c70a6e5 100644
--- a/tests/urlpatterns_reverse/views.py
+++ b/tests/urlpatterns_reverse/views.py
@@ -35,7 +35,7 @@ def pass_resolver_match_view(request, *args, **kwargs):
uncallable = None # neither a callable nor a string
-class ViewClass(object):
+class ViewClass:
def __call__(self, request, *args, **kwargs):
return HttpResponse('')
diff --git a/tests/utils_tests/test_archive.py b/tests/utils_tests/test_archive.py
index b207a1290a..f50e18d75c 100644
--- a/tests/utils_tests/test_archive.py
+++ b/tests/utils_tests/test_archive.py
@@ -11,7 +11,7 @@ from django.utils.archive import Archive, extract
TEST_DIR = os.path.join(os.path.dirname(upath(__file__)), 'archives')
-class ArchiveTester(object):
+class ArchiveTester:
archive = None
def setUp(self):
diff --git a/tests/utils_tests/test_decorators.py b/tests/utils_tests/test_decorators.py
index a4d080e2d7..fe5db876ef 100644
--- a/tests/utils_tests/test_decorators.py
+++ b/tests/utils_tests/test_decorators.py
@@ -5,7 +5,7 @@ from django.test import RequestFactory, SimpleTestCase
from django.utils.decorators import classproperty, decorator_from_middleware
-class ProcessViewMiddleware(object):
+class ProcessViewMiddleware:
def process_view(self, request, view_func, view_args, view_kwargs):
pass
@@ -18,7 +18,7 @@ def process_view(request):
return HttpResponse()
-class ClassProcessView(object):
+class ClassProcessView:
def __call__(self, request):
return HttpResponse()
@@ -26,7 +26,7 @@ class ClassProcessView(object):
class_process_view = process_view_dec(ClassProcessView())
-class FullMiddleware(object):
+class FullMiddleware:
def process_request(self, request):
request.process_request_reached = True
@@ -112,7 +112,7 @@ class DecoratorFromMiddlewareTests(SimpleTestCase):
class ClassPropertyTest(SimpleTestCase):
def test_getter(self):
- class Foo(object):
+ class Foo:
foo_attr = 123
def __init__(self):
@@ -122,7 +122,7 @@ class ClassPropertyTest(SimpleTestCase):
def foo(cls):
return cls.foo_attr
- class Bar(object):
+ class Bar:
bar = classproperty()
@bar.getter
@@ -135,7 +135,7 @@ class ClassPropertyTest(SimpleTestCase):
self.assertEqual(Bar().bar, 123)
def test_override_getter(self):
- class Foo(object):
+ class Foo:
@classproperty
def foo(cls):
return 123
diff --git a/tests/utils_tests/test_encoding.py b/tests/utils_tests/test_encoding.py
index faf30a59c0..ca9343674d 100644
--- a/tests/utils_tests/test_encoding.py
+++ b/tests/utils_tests/test_encoding.py
@@ -14,7 +14,7 @@ class TestEncodingUtils(unittest.TestCase):
"""
Broken __unicode__/__str__ actually raises an error.
"""
- class MyString(object):
+ class MyString:
def __str__(self):
return b'\xc3\xb6\xc3\xa4\xc3\xbc'
diff --git a/tests/utils_tests/test_functional.py b/tests/utils_tests/test_functional.py
index f53e212f93..befbcf931c 100644
--- a/tests/utils_tests/test_functional.py
+++ b/tests/utils_tests/test_functional.py
@@ -11,7 +11,7 @@ class FunctionalTestCase(unittest.TestCase):
def test_lazy_base_class(self):
"""lazy also finds base class methods in the proxy object"""
- class Base(object):
+ class Base:
def base_method(self):
pass
@@ -23,7 +23,7 @@ class FunctionalTestCase(unittest.TestCase):
def test_lazy_base_class_override(self):
"""lazy finds the correct (overridden) method implementation"""
- class Base(object):
+ class Base:
def method(self):
return 'Base'
@@ -36,7 +36,7 @@ class FunctionalTestCase(unittest.TestCase):
def test_lazy_object_to_string(self):
- class Klazz(object):
+ class Klazz:
def __str__(self):
return "Î am ā Ǩlâzz."
@@ -51,7 +51,7 @@ class FunctionalTestCase(unittest.TestCase):
"""
cached_property caches its value and that it behaves like a property
"""
- class A(object):
+ class A:
@cached_property
def value(self):
diff --git a/tests/utils_tests/test_html.py b/tests/utils_tests/test_html.py
index 8f887fd011..5ffccdae83 100644
--- a/tests/utils_tests/test_html.py
+++ b/tests/utils_tests/test_html.py
@@ -167,7 +167,7 @@ class TestUtilsHtml(SimpleTestCase):
def test_html_safe(self):
@html.html_safe
- class HtmlClass(object):
+ class HtmlClass:
def __str__(self):
return "<h1>I'm a html class!</h1>"
@@ -177,7 +177,7 @@ class TestUtilsHtml(SimpleTestCase):
self.assertEqual(force_text(html_obj), html_obj.__html__())
def test_html_safe_subclass(self):
- class BaseClass(object):
+ class BaseClass:
def __html__(self):
# defines __html__ on its own
return 'some html content'
@@ -198,7 +198,7 @@ class TestUtilsHtml(SimpleTestCase):
msg = "can't apply @html_safe to HtmlClass because it defines __html__()."
with self.assertRaisesMessage(ValueError, msg):
@html.html_safe
- class HtmlClass(object):
+ class HtmlClass:
def __html__(self):
return "<h1>I'm a html class!</h1>"
@@ -206,5 +206,5 @@ class TestUtilsHtml(SimpleTestCase):
msg = "can't apply @html_safe to HtmlClass because it doesn't define __str__()."
with self.assertRaisesMessage(ValueError, msg):
@html.html_safe
- class HtmlClass(object):
+ class HtmlClass:
pass
diff --git a/tests/utils_tests/test_inspect.py b/tests/utils_tests/test_inspect.py
index e9a2cd086f..7464a9226d 100644
--- a/tests/utils_tests/test_inspect.py
+++ b/tests/utils_tests/test_inspect.py
@@ -3,7 +3,7 @@ import unittest
from django.utils import inspect
-class Person(object):
+class Person:
def no_arguments(self):
return None
diff --git a/tests/utils_tests/test_lazyobject.py b/tests/utils_tests/test_lazyobject.py
index 513123ea00..11bf163747 100644
--- a/tests/utils_tests/test_lazyobject.py
+++ b/tests/utils_tests/test_lazyobject.py
@@ -9,7 +9,7 @@ from django.utils.functional import LazyObject, SimpleLazyObject, empty
from .models import Category, CategoryInfo
-class Foo(object):
+class Foo:
"""
A simple class with just one attribute.
"""
@@ -167,7 +167,7 @@ class LazyObjectTestCase(TestCase):
# Tests whether an object's custom `__iter__` method is being
# used when iterating over it.
- class IterObject(object):
+ class IterObject:
def __init__(self, values):
self.values = values
@@ -356,7 +356,7 @@ class SimpleLazyObjectTestCase(LazyObjectTestCase):
self.assertEqual(len(lazy_set), 4)
-class BaseBaz(object):
+class BaseBaz:
"""
A base class with a funky __reduce__ method, meant to simulate the
__reduce__ method of Model, which sets self._django_version.
diff --git a/tests/utils_tests/test_module/__init__.py b/tests/utils_tests/test_module/__init__.py
index 29ee11b722..d8a5fe2ed9 100644
--- a/tests/utils_tests/test_module/__init__.py
+++ b/tests/utils_tests/test_module/__init__.py
@@ -1,4 +1,4 @@
-class SiteMock(object):
+class SiteMock:
_registry = {}
diff --git a/tests/utils_tests/test_module_loading.py b/tests/utils_tests/test_module_loading.py
index 2a524a2cf2..e979b3e7ba 100644
--- a/tests/utils_tests/test_module_loading.py
+++ b/tests/utils_tests/test_module_loading.py
@@ -179,7 +179,7 @@ class AutodiscoverModulesTestCase(SimpleTestCase):
self.assertEqual(site._registry, {'lorem': 'ipsum'})
-class ProxyFinder(object):
+class ProxyFinder:
def __init__(self):
self._cache = {}
@@ -208,7 +208,7 @@ class ProxyFinder(object):
fd.close()
-class TestFinder(object):
+class TestFinder:
def __init__(self, *args, **kwargs):
self.importer = zipimporter(*args, **kwargs)
@@ -219,7 +219,7 @@ class TestFinder(object):
return TestLoader(importer)
-class TestLoader(object):
+class TestLoader:
def __init__(self, importer):
self.importer = importer
diff --git a/tests/utils_tests/test_safestring.py b/tests/utils_tests/test_safestring.py
index 9e99b6e20b..d1ef28944e 100644
--- a/tests/utils_tests/test_safestring.py
+++ b/tests/utils_tests/test_safestring.py
@@ -44,7 +44,7 @@ class SafeStringTest(SimpleTestCase):
self.assertRenderEqual('{{ s }}', 'a&b', s=mark_safe(s))
def test_mark_safe_object_implementing_dunder_str(self):
- class Obj(object):
+ class Obj:
def __str__(self):
return '<obj>'
diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py
index 7a9cea826b..a3938ce848 100644
--- a/tests/view_tests/tests/test_debug.py
+++ b/tests/view_tests/tests/test_debug.py
@@ -32,7 +32,7 @@ from ..views import (
PY36 = sys.version_info >= (3, 6)
-class User(object):
+class User:
def __str__(self):
return 'jacob'
@@ -45,7 +45,7 @@ class CallableSettingWrapperTests(SimpleTestCase):
""" Unittests for CallableSettingWrapper
"""
def test_repr(self):
- class WrappedCallable(object):
+ class WrappedCallable:
def __repr__(self):
return "repr from the wrapped callable"
@@ -422,7 +422,7 @@ class ExceptionReporterTests(SimpleTestCase):
def test_unprintable_values_handling(self):
"Unprintable values should not make the output generation choke."
try:
- class OomOutput(object):
+ class OomOutput:
def __repr__(self):
raise MemoryError('OOM')
oomvalue = OomOutput() # NOQA
@@ -438,7 +438,7 @@ class ExceptionReporterTests(SimpleTestCase):
large = 256 * 1024
repr_of_str_adds = len(repr(''))
try:
- class LargeOutput(object):
+ class LargeOutput:
def __repr__(self):
return repr('A' * large)
largevalue = LargeOutput() # NOQA
@@ -535,7 +535,7 @@ class ExceptionReporterTests(SimpleTestCase):
The error page can be rendered if the current user can't be retrieved
(such as when the database is unavailable).
"""
- class ExceptionUser(object):
+ class ExceptionUser:
def __str__(self):
raise Exception()
@@ -654,7 +654,7 @@ class PlainTextReportTests(SimpleTestCase):
self.assertIn("http://evil.com/", text)
-class ExceptionReportTestMixin(object):
+class ExceptionReportTestMixin:
# Mixin used in the ExceptionReporterFilterTests and
# AjaxResponseExceptionReporterFilter tests below
@@ -951,7 +951,7 @@ class ExceptionReporterFilterTests(ExceptionReportTestMixin, LoggingCaptureMixin
Callable settings which forbid to set attributes should not break
the debug page (#23070).
"""
- class CallableSettingWithSlots(object):
+ class CallableSettingWithSlots:
__slots__ = []
def __call__(self):
diff --git a/tests/view_tests/views.py b/tests/view_tests/views.py
index 5c63111405..2e47037470 100644
--- a/tests/view_tests/views.py
+++ b/tests/view_tests/views.py
@@ -241,7 +241,7 @@ def custom_exception_reporter_filter_view(request):
return technical_500_response(request, *exc_info)
-class Klass(object):
+class Klass:
@sensitive_variables('sauce')
def method(self, request):
diff --git a/tests/wsgi/tests.py b/tests/wsgi/tests.py
index 68e8d4a86d..13c5536520 100644
--- a/tests/wsgi/tests.py
+++ b/tests/wsgi/tests.py
@@ -49,7 +49,7 @@ class WSGITest(SimpleTestCase):
"""
FileResponse uses wsgi.file_wrapper.
"""
- class FileWrapper(object):
+ class FileWrapper:
def __init__(self, filelike, blksize=8192):
filelike.close()
application = get_wsgi_application()