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