summaryrefslogtreecommitdiff
path: root/django
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 /django
parenta5563963397aeee30c32e3c1dab31bfe453ca89f (diff)
Refs #23919 -- Stopped inheriting from object to define new style classes.
Diffstat (limited to 'django')
-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
171 files changed, 283 insertions, 285 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
"""