Refs #23919 -- Stopped inheriting from object to define new style classes.
This commit is contained in:
parent
a556396339
commit
cecc079168
|
@ -8,7 +8,7 @@ from django.utils.module_loading import module_has_submodule
|
||||||
MODELS_MODULE_NAME = 'models'
|
MODELS_MODULE_NAME = 'models'
|
||||||
|
|
||||||
|
|
||||||
class AppConfig(object):
|
class AppConfig:
|
||||||
"""
|
"""
|
||||||
Class representing a Django application and its configuration.
|
Class representing a Django application and its configuration.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -10,7 +10,7 @@ from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured
|
||||||
from .config import AppConfig
|
from .config import AppConfig
|
||||||
|
|
||||||
|
|
||||||
class Apps(object):
|
class Apps:
|
||||||
"""
|
"""
|
||||||
A registry that stores the configuration of installed applications.
|
A registry that stores the configuration of installed applications.
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ class LazySettings(LazyObject):
|
||||||
return self._wrapped is not empty
|
return self._wrapped is not empty
|
||||||
|
|
||||||
|
|
||||||
class Settings(object):
|
class Settings:
|
||||||
def __init__(self, settings_module):
|
def __init__(self, settings_module):
|
||||||
# update this dict from global settings (but only for ALL_CAPS settings)
|
# update this dict from global settings (but only for ALL_CAPS settings)
|
||||||
for setting in dir(global_settings):
|
for setting in dir(global_settings):
|
||||||
|
@ -150,7 +150,7 @@ class Settings(object):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class UserSettingsHolder(object):
|
class UserSettingsHolder:
|
||||||
"""
|
"""
|
||||||
Holder for user configured settings.
|
Holder for user configured settings.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -62,7 +62,7 @@ def check_dependencies(**kwargs):
|
||||||
return errors
|
return errors
|
||||||
|
|
||||||
|
|
||||||
class BaseModelAdminChecks(object):
|
class BaseModelAdminChecks:
|
||||||
|
|
||||||
def check(self, admin_obj, **kwargs):
|
def check(self, admin_obj, **kwargs):
|
||||||
errors = []
|
errors = []
|
||||||
|
|
|
@ -18,7 +18,7 @@ from django.utils.encoding import force_text
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
|
||||||
class ListFilter(object):
|
class ListFilter:
|
||||||
title = None # Human-readable title to appear in the right sidebar.
|
title = None # Human-readable title to appear in the right sidebar.
|
||||||
template = 'admin/filter.html'
|
template = 'admin/filter.html'
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ class ActionForm(forms.Form):
|
||||||
checkbox = forms.CheckboxInput({'class': 'action-select'}, lambda value: False)
|
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):
|
def __init__(self, form, fieldsets, prepopulated_fields, readonly_fields=None, model_admin=None):
|
||||||
self.form, self.fieldsets = form, fieldsets
|
self.form, self.fieldsets = form, fieldsets
|
||||||
self.prepopulated_fields = [{
|
self.prepopulated_fields = [{
|
||||||
|
@ -68,7 +68,7 @@ class AdminForm(object):
|
||||||
return media
|
return media
|
||||||
|
|
||||||
|
|
||||||
class Fieldset(object):
|
class Fieldset:
|
||||||
def __init__(self, form, name=None, readonly_fields=(), fields=(), classes=(),
|
def __init__(self, form, name=None, readonly_fields=(), fields=(), classes=(),
|
||||||
description=None, model_admin=None):
|
description=None, model_admin=None):
|
||||||
self.form = form
|
self.form = form
|
||||||
|
@ -95,7 +95,7 @@ class Fieldset(object):
|
||||||
yield Fieldline(self.form, field, self.readonly_fields, model_admin=self.model_admin)
|
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):
|
def __init__(self, form, field, readonly_fields=None, model_admin=None):
|
||||||
self.form = form # A django.forms.Form instance
|
self.form = form # A django.forms.Form instance
|
||||||
if not hasattr(field, "__iter__") or isinstance(field, str):
|
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):
|
def __init__(self, form, field, is_first):
|
||||||
self.field = form[field] # A django.forms.BoundField instance
|
self.field = form[field] # A django.forms.BoundField instance
|
||||||
self.is_first = is_first # Whether this field is first on the line
|
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())
|
return mark_safe(self.field.errors.as_ul())
|
||||||
|
|
||||||
|
|
||||||
class AdminReadonlyField(object):
|
class AdminReadonlyField:
|
||||||
def __init__(self, form, field, is_first, model_admin=None):
|
def __init__(self, form, field, is_first, model_admin=None):
|
||||||
# Make self.field look a little bit like a field. This means that
|
# 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.
|
# {{ field.name }} must be a useful class name to identify the field.
|
||||||
|
@ -223,7 +223,7 @@ class AdminReadonlyField(object):
|
||||||
return conditional_escape(result_repr)
|
return conditional_escape(result_repr)
|
||||||
|
|
||||||
|
|
||||||
class InlineAdminFormSet(object):
|
class InlineAdminFormSet:
|
||||||
"""
|
"""
|
||||||
A wrapper around an inline formset for use in the admin system.
|
A wrapper around an inline formset for use in the admin system.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -26,7 +26,7 @@ class NotRegistered(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class AdminSite(object):
|
class AdminSite:
|
||||||
"""
|
"""
|
||||||
An AdminSite object encapsulates an instance of the Django admin application, ready
|
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
|
to be hooked in to your URLconf. Models are registered with the AdminSite using the
|
||||||
|
|
|
@ -34,7 +34,7 @@ IGNORED_PARAMS = (
|
||||||
ALL_VAR, ORDER_VAR, ORDER_TYPE_VAR, SEARCH_VAR, IS_POPUP_VAR, TO_FIELD_VAR)
|
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,
|
def __init__(self, request, model, list_display, list_display_links,
|
||||||
list_filter, date_hierarchy, search_fields, list_select_related,
|
list_filter, date_hierarchy, search_fields, list_select_related,
|
||||||
list_per_page, list_max_show_all, list_editable, model_admin):
|
list_per_page, list_max_show_all, list_editable, model_admin):
|
||||||
|
|
|
@ -4,7 +4,7 @@ from django.contrib.auth.models import Permission
|
||||||
UserModel = get_user_model()
|
UserModel = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
class ModelBackend(object):
|
class ModelBackend:
|
||||||
"""
|
"""
|
||||||
Authenticates against settings.AUTH_USER_MODEL.
|
Authenticates against settings.AUTH_USER_MODEL.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# the template system can understand.
|
# the template system can understand.
|
||||||
|
|
||||||
|
|
||||||
class PermLookupDict(object):
|
class PermLookupDict:
|
||||||
def __init__(self, user, app_label):
|
def __init__(self, user, app_label):
|
||||||
self.user, self.app_label = user, app_label
|
self.user, self.app_label = user, app_label
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class PermLookupDict(object):
|
||||||
return type(self).__bool__(self)
|
return type(self).__bool__(self)
|
||||||
|
|
||||||
|
|
||||||
class PermWrapper(object):
|
class PermWrapper:
|
||||||
def __init__(self, user):
|
def __init__(self, user):
|
||||||
self.user = user
|
self.user = user
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ def mask_hash(hash, show=6, char="*"):
|
||||||
return masked
|
return masked
|
||||||
|
|
||||||
|
|
||||||
class BasePasswordHasher(object):
|
class BasePasswordHasher:
|
||||||
"""
|
"""
|
||||||
Abstract base class for password hashers
|
Abstract base class for password hashers
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ from django.core.exceptions import ImproperlyConfigured, PermissionDenied
|
||||||
from django.utils.encoding import force_text
|
from django.utils.encoding import force_text
|
||||||
|
|
||||||
|
|
||||||
class AccessMixin(object):
|
class AccessMixin:
|
||||||
"""
|
"""
|
||||||
Abstract CBV mixin that gives access mixins the same customizable
|
Abstract CBV mixin that gives access mixins the same customizable
|
||||||
functionality.
|
functionality.
|
||||||
|
|
|
@ -372,7 +372,7 @@ class User(AbstractUser):
|
||||||
swappable = 'AUTH_USER_MODEL'
|
swappable = 'AUTH_USER_MODEL'
|
||||||
|
|
||||||
|
|
||||||
class AnonymousUser(object):
|
class AnonymousUser:
|
||||||
id = None
|
id = None
|
||||||
pk = None
|
pk = None
|
||||||
username = ''
|
username = ''
|
||||||
|
|
|
@ -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)
|
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.
|
Validate whether the password is of a minimum length.
|
||||||
"""
|
"""
|
||||||
|
@ -117,7 +117,7 @@ class MinimumLengthValidator(object):
|
||||||
) % {'min_length': self.min_length}
|
) % {'min_length': self.min_length}
|
||||||
|
|
||||||
|
|
||||||
class UserAttributeSimilarityValidator(object):
|
class UserAttributeSimilarityValidator:
|
||||||
"""
|
"""
|
||||||
Validate whether the password is sufficiently different from the user's
|
Validate whether the password is sufficiently different from the user's
|
||||||
attributes.
|
attributes.
|
||||||
|
@ -159,7 +159,7 @@ class UserAttributeSimilarityValidator(object):
|
||||||
return _("Your password can't be too similar to your other personal information.")
|
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.
|
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.")
|
return _("Your password can't be a commonly used password.")
|
||||||
|
|
||||||
|
|
||||||
class NumericPasswordValidator(object):
|
class NumericPasswordValidator:
|
||||||
"""
|
"""
|
||||||
Validate whether the password is alphanumeric.
|
Validate whether the password is alphanumeric.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -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
|
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
|
Strategy object used to generate and check tokens for the password
|
||||||
reset mechanism.
|
reset mechanism.
|
||||||
|
|
|
@ -31,7 +31,7 @@ from django.views.generic.edit import FormView
|
||||||
UserModel = get_user_model()
|
UserModel = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
class SuccessURLAllowedHostsMixin(object):
|
class SuccessURLAllowedHostsMixin:
|
||||||
success_url_allowed_hosts = set()
|
success_url_allowed_hosts = set()
|
||||||
|
|
||||||
def get_success_url_allowed_hosts(self):
|
def get_success_url_allowed_hosts(self):
|
||||||
|
@ -352,7 +352,7 @@ def password_reset_complete(request,
|
||||||
# prompts for a new password
|
# prompts for a new password
|
||||||
# - PasswordResetCompleteView shows a success message for the above
|
# - PasswordResetCompleteView shows a success message for the above
|
||||||
|
|
||||||
class PasswordContextMixin(object):
|
class PasswordContextMixin:
|
||||||
extra_context = None
|
extra_context = None
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
|
|
|
@ -15,7 +15,7 @@ from django.utils.encoding import force_text
|
||||||
from django.utils.functional import cached_property
|
from django.utils.functional import cached_property
|
||||||
|
|
||||||
|
|
||||||
class GenericForeignKey(object):
|
class GenericForeignKey:
|
||||||
"""
|
"""
|
||||||
Provide a generic many-to-one relation through the ``content_type`` and
|
Provide a generic many-to-one relation through the ``content_type`` and
|
||||||
``object_id`` fields.
|
``object_id`` fields.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class WKTAdapter(object):
|
class WKTAdapter:
|
||||||
"""
|
"""
|
||||||
This provides an adaptor for Geometries sent to the
|
This provides an adaptor for Geometries sent to the
|
||||||
MySQL and Oracle database backends.
|
MySQL and Oracle database backends.
|
||||||
|
|
|
@ -3,7 +3,7 @@ import re
|
||||||
from django.contrib.gis.db.models import aggregates
|
from django.contrib.gis.db.models import aggregates
|
||||||
|
|
||||||
|
|
||||||
class BaseSpatialFeatures(object):
|
class BaseSpatialFeatures:
|
||||||
gis_enabled = True
|
gis_enabled = True
|
||||||
|
|
||||||
# Does the database contain a SpatialRefSys model to store SRID information?
|
# Does the database contain a SpatialRefSys model to store SRID information?
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from django.contrib.gis import gdal
|
from django.contrib.gis import gdal
|
||||||
|
|
||||||
|
|
||||||
class SpatialRefSysMixin(object):
|
class SpatialRefSysMixin:
|
||||||
"""
|
"""
|
||||||
The SpatialRefSysMixin is a class used by the database-dependent
|
The SpatialRefSysMixin is a class used by the database-dependent
|
||||||
SpatialRefSys objects to reduce redundant code.
|
SpatialRefSys objects to reduce redundant code.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class BaseSpatialOperations(object):
|
class BaseSpatialOperations:
|
||||||
"""
|
"""
|
||||||
This module holds the base `BaseSpatialBackend` object, which is
|
This module holds the base `BaseSpatialBackend` object, which is
|
||||||
instantiated by each spatial database backend with the features
|
instantiated by each spatial database backend with the features
|
||||||
|
|
|
@ -8,7 +8,7 @@ from django.contrib.gis.db.backends.postgis.pgraster import to_pgraster
|
||||||
from django.contrib.gis.geometry.backend import Geometry
|
from django.contrib.gis.geometry.backend import Geometry
|
||||||
|
|
||||||
|
|
||||||
class PostGISAdapter(object):
|
class PostGISAdapter:
|
||||||
def __init__(self, obj, geography=False):
|
def __init__(self, obj, geography=False):
|
||||||
"""
|
"""
|
||||||
Initialize on the spatial object.
|
Initialize on the spatial object.
|
||||||
|
|
|
@ -4,7 +4,7 @@ backends.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class SpatialOperator(object):
|
class SpatialOperator:
|
||||||
"""
|
"""
|
||||||
Class encapsulating the behavior specific to a GIS operation (used by lookups).
|
Class encapsulating the behavior specific to a GIS operation (used by lookups).
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -48,7 +48,7 @@ def get_srid_info(srid, connection):
|
||||||
return _srid_cache[alias][srid]
|
return _srid_cache[alias][srid]
|
||||||
|
|
||||||
|
|
||||||
class GeoSelectFormatMixin(object):
|
class GeoSelectFormatMixin:
|
||||||
def select_format(self, compiler, sql, params):
|
def select_format(self, compiler, sql, params):
|
||||||
"""
|
"""
|
||||||
Returns the selection format string, depending on the requirements
|
Returns the selection format string, depending on the requirements
|
||||||
|
|
|
@ -100,7 +100,7 @@ class GeoFuncWithGeoParam(GeoFunc):
|
||||||
super(GeoFuncWithGeoParam, self).__init__(expression, GeomValue(geom), *expressions, **extra)
|
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
|
By default, Decimal values are converted to str by the SQLite backend, which
|
||||||
is not acceptable by the GIS functions expecting numeric values.
|
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)
|
return super(SQLiteDecimalToFloatMixin, self).as_sql(compiler, connection)
|
||||||
|
|
||||||
|
|
||||||
class OracleToleranceMixin(object):
|
class OracleToleranceMixin:
|
||||||
tolerance = 0.05
|
tolerance = 0.05
|
||||||
|
|
||||||
def as_oracle(self, compiler, connection):
|
def as_oracle(self, compiler, connection):
|
||||||
|
@ -230,7 +230,7 @@ class Difference(OracleToleranceMixin, GeoFuncWithGeoParam):
|
||||||
arity = 2
|
arity = 2
|
||||||
|
|
||||||
|
|
||||||
class DistanceResultMixin(object):
|
class DistanceResultMixin:
|
||||||
def source_is_geography(self):
|
def source_is_geography(self):
|
||||||
return self.get_source_fields()[0].geography and self.srid == 4326
|
return self.get_source_fields()[0].geography and self.srid == 4326
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ from django.contrib.gis.geometry.backend import Geometry
|
||||||
from django.contrib.gis.measure import Area, Distance
|
from django.contrib.gis.measure import Area, Distance
|
||||||
|
|
||||||
|
|
||||||
class BaseField(object):
|
class BaseField:
|
||||||
empty_strings_allowed = True
|
empty_strings_allowed = True
|
||||||
|
|
||||||
def get_db_converters(self, connection):
|
def get_db_converters(self, connection):
|
||||||
|
|
|
@ -2,7 +2,7 @@ from django.contrib.syndication.views import Feed as BaseFeed
|
||||||
from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed
|
from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed
|
||||||
|
|
||||||
|
|
||||||
class GeoFeedMixin(object):
|
class GeoFeedMixin:
|
||||||
"""
|
"""
|
||||||
This mixin provides the necessary routines for SyndicationFeed subclasses
|
This mixin provides the necessary routines for SyndicationFeed subclasses
|
||||||
to produce simple GeoRSS or W3C Geo elements.
|
to produce simple GeoRSS or W3C Geo elements.
|
||||||
|
|
|
@ -27,7 +27,7 @@ class OGREnvelope(Structure):
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class Envelope(object):
|
class Envelope:
|
||||||
"""
|
"""
|
||||||
The Envelope object is a C structure that contains the minimum and
|
The Envelope object is a C structure that contains the minimum and
|
||||||
maximum X, Y coordinates for a rectangle bounding box. The naming
|
maximum X, Y coordinates for a rectangle bounding box. The naming
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from django.contrib.gis.gdal.error import GDALException
|
from django.contrib.gis.gdal.error import GDALException
|
||||||
|
|
||||||
|
|
||||||
class OGRGeomType(object):
|
class OGRGeomType:
|
||||||
"Encapsulates OGR Geometry Types."
|
"Encapsulates OGR Geometry Types."
|
||||||
|
|
||||||
wkb25bit = -2147483648
|
wkb25bit = -2147483648
|
||||||
|
|
|
@ -21,7 +21,7 @@ class GeoIP2Exception(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class GeoIP2(object):
|
class GeoIP2:
|
||||||
# The flags for GeoIP memory caching.
|
# The flags for GeoIP memory caching.
|
||||||
# Try MODE_MMAP_EXT, MODE_MMAP, MODE_FILE in that order.
|
# Try MODE_MMAP_EXT, MODE_MMAP, MODE_FILE in that order.
|
||||||
MODE_AUTO = 0
|
MODE_AUTO = 0
|
||||||
|
|
|
@ -656,7 +656,7 @@ class GEOSGeometry(GEOSBase, ListMixin):
|
||||||
return GEOSGeometry(capi.geom_clone(self.ptr), srid=self.srid)
|
return GEOSGeometry(capi.geom_clone(self.ptr), srid=self.srid)
|
||||||
|
|
||||||
|
|
||||||
class LinearGeometryMixin(object):
|
class LinearGeometryMixin:
|
||||||
"""
|
"""
|
||||||
Used for LineString and MultiLineString.
|
Used for LineString and MultiLineString.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -139,7 +139,7 @@ def get_pointer_arr(n):
|
||||||
lgeos = SimpleLazyObject(load_geos)
|
lgeos = SimpleLazyObject(load_geos)
|
||||||
|
|
||||||
|
|
||||||
class GEOSFuncFactory(object):
|
class GEOSFuncFactory:
|
||||||
"""
|
"""
|
||||||
Lazy loading of GEOS functions.
|
Lazy loading of GEOS functions.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -12,7 +12,7 @@ from functools import total_ordering
|
||||||
|
|
||||||
|
|
||||||
@total_ordering
|
@total_ordering
|
||||||
class ListMixin(object):
|
class ListMixin:
|
||||||
"""
|
"""
|
||||||
A base class which provides complete list interface.
|
A base class which provides complete list interface.
|
||||||
Derived classes must call ListMixin's __init__() function
|
Derived classes must call ListMixin's __init__() function
|
||||||
|
|
|
@ -28,7 +28,7 @@ class GEOSContext(threading.local):
|
||||||
thread_context = GEOSContext()
|
thread_context = GEOSContext()
|
||||||
|
|
||||||
|
|
||||||
class GEOSFunc(object):
|
class GEOSFunc:
|
||||||
"""
|
"""
|
||||||
Class that serves as a wrapper for GEOS C Functions, and will
|
Class that serves as a wrapper for GEOS C Functions, and will
|
||||||
use thread-safe function variants when available.
|
use thread-safe function variants when available.
|
||||||
|
|
|
@ -49,7 +49,7 @@ def pretty_name(obj):
|
||||||
|
|
||||||
|
|
||||||
@total_ordering
|
@total_ordering
|
||||||
class MeasureBase(object):
|
class MeasureBase:
|
||||||
STANDARD_UNIT = None
|
STANDARD_UNIT = None
|
||||||
ALIAS = {}
|
ALIAS = {}
|
||||||
UNITS = {}
|
UNITS = {}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from ctypes import c_void_p
|
from ctypes import c_void_p
|
||||||
|
|
||||||
|
|
||||||
class CPointerBase(object):
|
class CPointerBase:
|
||||||
"""
|
"""
|
||||||
Base class for objects that have a pointer access property
|
Base class for objects that have a pointer access property
|
||||||
that controls access to the underlying C pointer.
|
that controls access to the underlying C pointer.
|
||||||
|
|
|
@ -65,6 +65,6 @@ class Serializer(JSONSerializer):
|
||||||
super(Serializer, self).handle_field(obj, field)
|
super(Serializer, self).handle_field(obj, field)
|
||||||
|
|
||||||
|
|
||||||
class Deserializer(object):
|
class Deserializer:
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
raise SerializerDoesNotExist("geojson is a serialization-only serializer")
|
raise SerializerDoesNotExist("geojson is a serialization-only serializer")
|
||||||
|
|
|
@ -45,7 +45,7 @@ class MissingForeignKey(LayerMapError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class LayerMapping(object):
|
class LayerMapping:
|
||||||
"A class that maps OGR Layers to GeoDjango Models."
|
"A class that maps OGR Layers to GeoDjango Models."
|
||||||
|
|
||||||
# Acceptable 'base' types for a multi-geometry type.
|
# Acceptable 'base' types for a multi-geometry type.
|
||||||
|
|
|
@ -5,7 +5,7 @@ from django.utils.encoding import force_text
|
||||||
LEVEL_TAGS = utils.get_level_tags()
|
LEVEL_TAGS = utils.get_level_tags()
|
||||||
|
|
||||||
|
|
||||||
class Message(object):
|
class Message:
|
||||||
"""
|
"""
|
||||||
Represents an actual message that can be stored in any of the supported
|
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
|
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)
|
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.
|
This is the base backend for temporary message storage.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
|
||||||
|
|
||||||
class SuccessMessageMixin(object):
|
class SuccessMessageMixin:
|
||||||
"""
|
"""
|
||||||
Adds a success message on successful form submission.
|
Adds a success message on successful form submission.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -264,7 +264,7 @@ class IndexTransform(Transform):
|
||||||
return self.base_field
|
return self.base_field
|
||||||
|
|
||||||
|
|
||||||
class IndexTransformFactory(object):
|
class IndexTransformFactory:
|
||||||
|
|
||||||
def __init__(self, index, base_field):
|
def __init__(self, index, base_field):
|
||||||
self.index = index
|
self.index = index
|
||||||
|
@ -286,7 +286,7 @@ class SliceTransform(Transform):
|
||||||
return '%s[%s:%s]' % (lhs, self.start, self.end), params
|
return '%s[%s:%s]' % (lhs, self.start, self.end), params
|
||||||
|
|
||||||
|
|
||||||
class SliceTransformFactory(object):
|
class SliceTransformFactory:
|
||||||
|
|
||||||
def __init__(self, start, end):
|
def __init__(self, start, end):
|
||||||
self.start = start
|
self.start = start
|
||||||
|
|
|
@ -88,7 +88,7 @@ class KeyTransform(Transform):
|
||||||
return "(%s -> '%s')" % (lhs, self.key_name), params
|
return "(%s -> '%s')" % (lhs, self.key_name), params
|
||||||
|
|
||||||
|
|
||||||
class KeyTransformFactory(object):
|
class KeyTransformFactory:
|
||||||
|
|
||||||
def __init__(self, key_name):
|
def __init__(self, key_name):
|
||||||
self.key_name = key_name
|
self.key_name = key_name
|
||||||
|
|
|
@ -118,7 +118,7 @@ class KeyTextTransform(KeyTransform):
|
||||||
_output_field = TextField()
|
_output_field = TextField()
|
||||||
|
|
||||||
|
|
||||||
class KeyTransformTextLookupMixin(object):
|
class KeyTransformTextLookupMixin:
|
||||||
"""
|
"""
|
||||||
Mixin for combining with a lookup expecting a text lhs from a JSONField
|
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
|
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)
|
KeyTransform.register_lookup(KeyTransformIRegex)
|
||||||
|
|
||||||
|
|
||||||
class KeyTransformFactory(object):
|
class KeyTransformFactory:
|
||||||
|
|
||||||
def __init__(self, key_name):
|
def __init__(self, key_name):
|
||||||
self.key_name = key_name
|
self.key_name = key_name
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
class AttributeSetter(object):
|
class AttributeSetter:
|
||||||
def __init__(self, name, value):
|
def __init__(self, name, value):
|
||||||
setattr(self, name, value)
|
setattr(self, name, value)
|
||||||
|
|
|
@ -33,7 +33,7 @@ class SearchQueryField(Field):
|
||||||
return 'tsquery'
|
return 'tsquery'
|
||||||
|
|
||||||
|
|
||||||
class SearchVectorCombinable(object):
|
class SearchVectorCombinable:
|
||||||
ADD = '||'
|
ADD = '||'
|
||||||
|
|
||||||
def _combine(self, other, connector, reversed, node=None):
|
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)
|
super(CombinedSearchVector, self).__init__(lhs, connector, rhs, output_field)
|
||||||
|
|
||||||
|
|
||||||
class SearchQueryCombinable(object):
|
class SearchQueryCombinable:
|
||||||
BITAND = '&&'
|
BITAND = '&&'
|
||||||
BITOR = '||'
|
BITOR = '||'
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ class ArrayMinLengthValidator(MinLengthValidator):
|
||||||
|
|
||||||
|
|
||||||
@deconstructible
|
@deconstructible
|
||||||
class KeysValidator(object):
|
class KeysValidator:
|
||||||
"""A validator designed for HStore to require/restrict keys."""
|
"""A validator designed for HStore to require/restrict keys."""
|
||||||
|
|
||||||
messages = {
|
messages = {
|
||||||
|
|
|
@ -33,7 +33,7 @@ class UpdateError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class SessionBase(object):
|
class SessionBase:
|
||||||
"""
|
"""
|
||||||
Base class for all Session classes.
|
Base class for all Session classes.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -3,7 +3,7 @@ import pickle
|
||||||
from django.core.signing import JSONSerializer as BaseJSONSerializer
|
from django.core.signing import JSONSerializer as BaseJSONSerializer
|
||||||
|
|
||||||
|
|
||||||
class PickleSerializer(object):
|
class PickleSerializer:
|
||||||
"""
|
"""
|
||||||
Simple wrapper around pickle to be used in signing.dumps and
|
Simple wrapper around pickle to be used in signing.dumps and
|
||||||
signing.loads.
|
signing.loads.
|
||||||
|
|
|
@ -50,7 +50,7 @@ def _get_sitemap_full_url(sitemap_url):
|
||||||
return 'http://%s%s' % (current_site.domain, 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
|
# This limit is defined by Google. See the index documentation at
|
||||||
# http://www.sitemaps.org/protocol.html#index.
|
# http://www.sitemaps.org/protocol.html#index.
|
||||||
limit = 50000
|
limit = 50000
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class RequestSite(object):
|
class RequestSite:
|
||||||
"""
|
"""
|
||||||
A class that shares the primary interface of Site (i.e., it has
|
A class that shares the primary interface of Site (i.e., it has
|
||||||
``domain`` and ``name`` attributes) but gets its data from a Django
|
``domain`` and ``name`` attributes) but gets its data from a Django
|
||||||
|
|
|
@ -17,7 +17,7 @@ from django.utils.module_loading import import_string
|
||||||
searched_locations = []
|
searched_locations = []
|
||||||
|
|
||||||
|
|
||||||
class BaseFinder(object):
|
class BaseFinder:
|
||||||
"""
|
"""
|
||||||
A base file finder to be used for custom staticfiles finder classes.
|
A base file finder to be used for custom staticfiles finder classes.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -47,7 +47,7 @@ class StaticFilesStorage(FileSystemStorage):
|
||||||
return super(StaticFilesStorage, self).path(name)
|
return super(StaticFilesStorage, self).path(name)
|
||||||
|
|
||||||
|
|
||||||
class HashedFilesMixin(object):
|
class HashedFilesMixin:
|
||||||
default_template = """url("%s")"""
|
default_template = """url("%s")"""
|
||||||
max_post_process_passes = 5
|
max_post_process_passes = 5
|
||||||
patterns = (
|
patterns = (
|
||||||
|
@ -434,7 +434,7 @@ class ManifestFilesMixin(HashedFilesMixin):
|
||||||
return urlunsplit(unparsed_name)
|
return urlunsplit(unparsed_name)
|
||||||
|
|
||||||
|
|
||||||
class _MappingCache(object):
|
class _MappingCache:
|
||||||
"""
|
"""
|
||||||
A small dict-like wrapper for a given cache backend instance.
|
A small dict-like wrapper for a given cache backend instance.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -26,7 +26,7 @@ class FeedDoesNotExist(ObjectDoesNotExist):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Feed(object):
|
class Feed:
|
||||||
feed_type = feedgenerator.DefaultFeed
|
feed_type = feedgenerator.DefaultFeed
|
||||||
title_template = None
|
title_template = None
|
||||||
description_template = None
|
description_template = None
|
||||||
|
|
|
@ -55,7 +55,7 @@ def _create_cache(backend, **kwargs):
|
||||||
return backend_cls(location, params)
|
return backend_cls(location, params)
|
||||||
|
|
||||||
|
|
||||||
class CacheHandler(object):
|
class CacheHandler:
|
||||||
"""
|
"""
|
||||||
A Cache Handler to manage access to Cache instances.
|
A Cache Handler to manage access to Cache instances.
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ class CacheHandler(object):
|
||||||
caches = CacheHandler()
|
caches = CacheHandler()
|
||||||
|
|
||||||
|
|
||||||
class DefaultCacheProxy(object):
|
class DefaultCacheProxy:
|
||||||
"""
|
"""
|
||||||
Proxy access to the default Cache object's attributes.
|
Proxy access to the default Cache object's attributes.
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ def get_key_func(key_func):
|
||||||
return default_key_func
|
return default_key_func
|
||||||
|
|
||||||
|
|
||||||
class BaseCache(object):
|
class BaseCache:
|
||||||
def __init__(self, params):
|
def __init__(self, params):
|
||||||
timeout = params.get('timeout', params.get('TIMEOUT', 300))
|
timeout = params.get('timeout', params.get('TIMEOUT', 300))
|
||||||
if timeout is not None:
|
if timeout is not None:
|
||||||
|
|
|
@ -10,7 +10,7 @@ from django.utils import timezone
|
||||||
from django.utils.encoding import force_bytes
|
from django.utils.encoding import force_bytes
|
||||||
|
|
||||||
|
|
||||||
class Options(object):
|
class Options:
|
||||||
"""A class that will quack like a Django model _meta class.
|
"""A class that will quack like a Django model _meta class.
|
||||||
|
|
||||||
This allows cache operations to be controlled by the router
|
This allows cache operations to be controlled by the router
|
||||||
|
@ -33,7 +33,7 @@ class BaseDatabaseCache(BaseCache):
|
||||||
BaseCache.__init__(self, params)
|
BaseCache.__init__(self, params)
|
||||||
self._table = table
|
self._table = table
|
||||||
|
|
||||||
class CacheEntry(object):
|
class CacheEntry:
|
||||||
_meta = Options(table)
|
_meta = Options(table)
|
||||||
self.cache_model_class = CacheEntry
|
self.cache_model_class = CacheEntry
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ ERROR = 40
|
||||||
CRITICAL = 50
|
CRITICAL = 50
|
||||||
|
|
||||||
|
|
||||||
class CheckMessage(object):
|
class CheckMessage:
|
||||||
|
|
||||||
def __init__(self, level, msg, hint=None, obj=None, id=None):
|
def __init__(self, level, msg, hint=None, obj=None, id=None):
|
||||||
assert isinstance(level, int), "The first argument should be level."
|
assert isinstance(level, int), "The first argument should be level."
|
||||||
|
|
|
@ -3,7 +3,7 @@ from itertools import chain
|
||||||
from django.utils.itercompat import is_iterable
|
from django.utils.itercompat import is_iterable
|
||||||
|
|
||||||
|
|
||||||
class Tags(object):
|
class Tags:
|
||||||
"""
|
"""
|
||||||
Built-in tags for internal checks.
|
Built-in tags for internal checks.
|
||||||
"""
|
"""
|
||||||
|
@ -18,7 +18,7 @@ class Tags(object):
|
||||||
urls = 'urls'
|
urls = 'urls'
|
||||||
|
|
||||||
|
|
||||||
class CheckRegistry(object):
|
class CheckRegistry:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.registered_checks = []
|
self.registered_checks = []
|
||||||
|
|
|
@ -20,7 +20,7 @@ from django.utils.text import get_valid_filename
|
||||||
__all__ = ('Storage', 'FileSystemStorage', 'DefaultStorage', 'default_storage')
|
__all__ = ('Storage', 'FileSystemStorage', 'DefaultStorage', 'default_storage')
|
||||||
|
|
||||||
|
|
||||||
class Storage(object):
|
class Storage:
|
||||||
"""
|
"""
|
||||||
A base storage class, providing some default behaviors that all other
|
A base storage class, providing some default behaviors that all other
|
||||||
storage systems can inherit or override, as necessary.
|
storage systems can inherit or override, as necessary.
|
||||||
|
|
|
@ -58,7 +58,7 @@ class StopFutureHandlers(UploadFileException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class FileUploadHandler(object):
|
class FileUploadHandler:
|
||||||
"""
|
"""
|
||||||
Base class for streaming upload handlers.
|
Base class for streaming upload handlers.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class FileProxyMixin(object):
|
class FileProxyMixin:
|
||||||
"""
|
"""
|
||||||
A mixin class used to forward file methods to an underlaying file
|
A mixin class used to forward file methods to an underlaying file
|
||||||
object. The internal file object has to be called "file"::
|
object. The internal file object has to be called "file"::
|
||||||
|
|
|
@ -12,7 +12,7 @@ from .exception import convert_exception_to_response, get_exception_response
|
||||||
logger = logging.getLogger('django.request')
|
logger = logging.getLogger('django.request')
|
||||||
|
|
||||||
|
|
||||||
class BaseHandler(object):
|
class BaseHandler:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._request_middleware = None
|
self._request_middleware = None
|
||||||
|
|
|
@ -19,7 +19,7 @@ ISO_8859_1, UTF_8 = str('iso-8859-1'), str('utf-8')
|
||||||
_slashes_re = re.compile(br'/+')
|
_slashes_re = re.compile(br'/+')
|
||||||
|
|
||||||
|
|
||||||
class LimitedStream(object):
|
class LimitedStream:
|
||||||
'''
|
'''
|
||||||
LimitedStream wraps another stream in order to not allow reading from it
|
LimitedStream wraps another stream in order to not allow reading from it
|
||||||
past specified amount of bytes.
|
past specified amount of bytes.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Base email backend class."""
|
"""Base email backend class."""
|
||||||
|
|
||||||
|
|
||||||
class BaseEmailBackend(object):
|
class BaseEmailBackend:
|
||||||
"""
|
"""
|
||||||
Base class for email backend implementations.
|
Base class for email backend implementations.
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,7 @@ class SafeMIMEMultipart(MIMEMixin, MIMEMultipart):
|
||||||
MIMEMultipart.__setitem__(self, name, val)
|
MIMEMultipart.__setitem__(self, name, val)
|
||||||
|
|
||||||
|
|
||||||
class EmailMessage(object):
|
class EmailMessage:
|
||||||
"""
|
"""
|
||||||
A container for email information.
|
A container for email information.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -7,7 +7,7 @@ import socket
|
||||||
|
|
||||||
# Cache the hostname, but do it lazily: socket.getfqdn() can take a couple of
|
# Cache the hostname, but do it lazily: socket.getfqdn() can take a couple of
|
||||||
# seconds, which slows down the restart of the server.
|
# seconds, which slows down the restart of the server.
|
||||||
class CachedDnsName(object):
|
class CachedDnsName:
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.get_fqdn()
|
return self.get_fqdn()
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ def call_command(command_name, *args, **options):
|
||||||
return command.execute(*args, **defaults)
|
return command.execute(*args, **defaults)
|
||||||
|
|
||||||
|
|
||||||
class ManagementUtility(object):
|
class ManagementUtility:
|
||||||
"""
|
"""
|
||||||
Encapsulates the logic of the django-admin and manage.py utilities.
|
Encapsulates the logic of the django-admin and manage.py utilities.
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ def handle_default_options(options):
|
||||||
sys.path.insert(0, options.pythonpath)
|
sys.path.insert(0, options.pythonpath)
|
||||||
|
|
||||||
|
|
||||||
class OutputWrapper(object):
|
class OutputWrapper:
|
||||||
"""
|
"""
|
||||||
Wrapper around stdout/stderr
|
Wrapper around stdout/stderr
|
||||||
"""
|
"""
|
||||||
|
@ -107,7 +107,7 @@ class OutputWrapper(object):
|
||||||
self._out.write(force_str(style_func(msg)))
|
self._out.write(force_str(style_func(msg)))
|
||||||
|
|
||||||
|
|
||||||
class BaseCommand(object):
|
class BaseCommand:
|
||||||
"""
|
"""
|
||||||
The base class from which all management commands ultimately
|
The base class from which all management commands ultimately
|
||||||
derive.
|
derive.
|
||||||
|
|
|
@ -24,7 +24,7 @@ def supports_color():
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class Style(object):
|
class Style:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ def check_programs(*programs):
|
||||||
|
|
||||||
|
|
||||||
@total_ordering
|
@total_ordering
|
||||||
class TranslatableFile(object):
|
class TranslatableFile:
|
||||||
def __init__(self, dirpath, file_name, locale_dir):
|
def __init__(self, dirpath, file_name, locale_dir):
|
||||||
self.file = file_name
|
self.file = file_name
|
||||||
self.dirpath = dirpath
|
self.dirpath = dirpath
|
||||||
|
@ -59,7 +59,7 @@ class TranslatableFile(object):
|
||||||
return os.path.join(self.dirpath, self.file)
|
return os.path.join(self.dirpath, self.file)
|
||||||
|
|
||||||
|
|
||||||
class BuildFile(object):
|
class BuildFile:
|
||||||
"""
|
"""
|
||||||
Represents the state of a translatable file during the build process.
|
Represents the state of a translatable file during the build process.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -22,7 +22,7 @@ class EmptyPage(InvalidPage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Paginator(object):
|
class Paginator:
|
||||||
|
|
||||||
def __init__(self, object_list, per_page, orphans=0,
|
def __init__(self, object_list, per_page, orphans=0,
|
||||||
allow_empty_first_page=True):
|
allow_empty_first_page=True):
|
||||||
|
|
|
@ -33,7 +33,7 @@ BUILTIN_SERIALIZERS = {
|
||||||
_serializers = {}
|
_serializers = {}
|
||||||
|
|
||||||
|
|
||||||
class BadSerializer(object):
|
class BadSerializer:
|
||||||
"""
|
"""
|
||||||
Stub serializer to hold exception raised during registration
|
Stub serializer to hold exception raised during registration
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ def register_serializer(format, serializer_module, serializers=None):
|
||||||
except ImportError as exc:
|
except ImportError as exc:
|
||||||
bad_serializer = BadSerializer(exc)
|
bad_serializer = BadSerializer(exc)
|
||||||
|
|
||||||
module = type('BadSerializerModule', (object,), {
|
module = type('BadSerializerModule', (), {
|
||||||
'Deserializer': bad_serializer,
|
'Deserializer': bad_serializer,
|
||||||
'Serializer': bad_serializer,
|
'Serializer': bad_serializer,
|
||||||
})
|
})
|
||||||
|
|
|
@ -28,7 +28,7 @@ class DeserializationError(Exception):
|
||||||
return cls("%s: (%s:pk=%s) field_value was '%s'" % (original_exc, model, fk, field_value))
|
return cls("%s: (%s:pk=%s) field_value was '%s'" % (original_exc, model, fk, field_value))
|
||||||
|
|
||||||
|
|
||||||
class ProgressBar(object):
|
class ProgressBar:
|
||||||
progress_width = 75
|
progress_width = 75
|
||||||
|
|
||||||
def __init__(self, output, total_count):
|
def __init__(self, output, total_count):
|
||||||
|
@ -51,7 +51,7 @@ class ProgressBar(object):
|
||||||
self.output.flush()
|
self.output.flush()
|
||||||
|
|
||||||
|
|
||||||
class Serializer(object):
|
class Serializer:
|
||||||
"""
|
"""
|
||||||
Abstract serializer base class.
|
Abstract serializer base class.
|
||||||
"""
|
"""
|
||||||
|
@ -182,7 +182,7 @@ class Deserializer:
|
||||||
raise NotImplementedError('subclasses of Deserializer must provide a __next__() method')
|
raise NotImplementedError('subclasses of Deserializer must provide a __next__() method')
|
||||||
|
|
||||||
|
|
||||||
class DeserializedObject(object):
|
class DeserializedObject:
|
||||||
"""
|
"""
|
||||||
A deserialized model.
|
A deserialized model.
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ def is_broken_pipe_error():
|
||||||
return issubclass(exc_type, socket.error) and exc_value.args[0] == 32
|
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"""
|
"""BaseHTTPServer that implements the Python WSGI protocol"""
|
||||||
|
|
||||||
request_queue_size = 10
|
request_queue_size = 10
|
||||||
|
@ -84,14 +84,14 @@ class WSGIServer(simple_server.WSGIServer, object):
|
||||||
|
|
||||||
|
|
||||||
# Inheriting from object required on Python 2.
|
# Inheriting from object required on Python 2.
|
||||||
class ServerHandler(simple_server.ServerHandler, object):
|
class ServerHandler(simple_server.ServerHandler):
|
||||||
def handle_error(self):
|
def handle_error(self):
|
||||||
# Ignore broken pipe errors, otherwise pass on
|
# Ignore broken pipe errors, otherwise pass on
|
||||||
if not is_broken_pipe_error():
|
if not is_broken_pipe_error():
|
||||||
super(ServerHandler, self).handle_error()
|
super(ServerHandler, self).handle_error()
|
||||||
|
|
||||||
|
|
||||||
class WSGIRequestHandler(simple_server.WSGIRequestHandler, object):
|
class WSGIRequestHandler(simple_server.WSGIRequestHandler):
|
||||||
def address_string(self):
|
def address_string(self):
|
||||||
# Short-circuit parent method to not call socket.getfqdn
|
# Short-circuit parent method to not call socket.getfqdn
|
||||||
return self.client_address[0]
|
return self.client_address[0]
|
||||||
|
|
|
@ -82,7 +82,7 @@ def get_cookie_signer(salt='django.core.signing.get_cookie_signer'):
|
||||||
return Signer(b'django.http.cookies' + key, salt=salt)
|
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
|
Simple wrapper around json to be used in signing.dumps and
|
||||||
signing.loads.
|
signing.loads.
|
||||||
|
@ -147,7 +147,7 @@ def loads(s, key=None, salt='django.core.signing', serializer=JSONSerializer, ma
|
||||||
return serializer().loads(data)
|
return serializer().loads(data)
|
||||||
|
|
||||||
|
|
||||||
class Signer(object):
|
class Signer:
|
||||||
|
|
||||||
def __init__(self, key=None, sep=':', salt=None):
|
def __init__(self, key=None, sep=':', salt=None):
|
||||||
# Use of native strings in all versions of Python
|
# Use of native strings in all versions of Python
|
||||||
|
|
|
@ -26,7 +26,7 @@ def _lazy_re_compile(regex, flags=0):
|
||||||
|
|
||||||
|
|
||||||
@deconstructible
|
@deconstructible
|
||||||
class RegexValidator(object):
|
class RegexValidator:
|
||||||
regex = ''
|
regex = ''
|
||||||
message = _('Enter a valid value.')
|
message = _('Enter a valid value.')
|
||||||
code = 'invalid'
|
code = 'invalid'
|
||||||
|
@ -162,7 +162,7 @@ def validate_integer(value):
|
||||||
|
|
||||||
|
|
||||||
@deconstructible
|
@deconstructible
|
||||||
class EmailValidator(object):
|
class EmailValidator:
|
||||||
message = _('Enter a valid email address.')
|
message = _('Enter a valid email address.')
|
||||||
code = 'invalid'
|
code = 'invalid'
|
||||||
user_regex = _lazy_re_compile(
|
user_regex = _lazy_re_compile(
|
||||||
|
@ -305,7 +305,7 @@ validate_comma_separated_integer_list = int_list_validator(
|
||||||
|
|
||||||
|
|
||||||
@deconstructible
|
@deconstructible
|
||||||
class BaseValidator(object):
|
class BaseValidator:
|
||||||
message = _('Ensure this value is %(limit_value)s (it is %(show_value)s).')
|
message = _('Ensure this value is %(limit_value)s (it is %(show_value)s).')
|
||||||
code = 'limit_value'
|
code = 'limit_value'
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ class MaxLengthValidator(BaseValidator):
|
||||||
|
|
||||||
|
|
||||||
@deconstructible
|
@deconstructible
|
||||||
class DecimalValidator(object):
|
class DecimalValidator:
|
||||||
"""
|
"""
|
||||||
Validate that the input does not exceed the maximum number of digits
|
Validate that the input does not exceed the maximum number of digits
|
||||||
expected, otherwise raise ValidationError.
|
expected, otherwise raise ValidationError.
|
||||||
|
@ -453,7 +453,7 @@ class DecimalValidator(object):
|
||||||
|
|
||||||
|
|
||||||
@deconstructible
|
@deconstructible
|
||||||
class FileExtensionValidator(object):
|
class FileExtensionValidator:
|
||||||
message = _(
|
message = _(
|
||||||
"File extension '%(extension)s' is not allowed. "
|
"File extension '%(extension)s' is not allowed. "
|
||||||
"Allowed extensions are: '%(allowed_extensions)s'."
|
"Allowed extensions are: '%(allowed_extensions)s'."
|
||||||
|
|
|
@ -23,7 +23,7 @@ router = ConnectionRouter()
|
||||||
# that the database backends care about.
|
# that the database backends care about.
|
||||||
# We load all these up for backwards compatibility, you should use
|
# We load all these up for backwards compatibility, you should use
|
||||||
# connections['default'] instead.
|
# connections['default'] instead.
|
||||||
class DefaultConnectionProxy(object):
|
class DefaultConnectionProxy:
|
||||||
"""
|
"""
|
||||||
Proxy for accessing the default DatabaseWrapper object's attributes. If you
|
Proxy for accessing the default DatabaseWrapper object's attributes. If you
|
||||||
need to access the DatabaseWrapper object itself, use
|
need to access the DatabaseWrapper object itself, use
|
||||||
|
|
|
@ -21,7 +21,7 @@ from django.utils.functional import cached_property
|
||||||
NO_DB_ALIAS = '__no_db__'
|
NO_DB_ALIAS = '__no_db__'
|
||||||
|
|
||||||
|
|
||||||
class BaseDatabaseWrapper(object):
|
class BaseDatabaseWrapper:
|
||||||
"""
|
"""
|
||||||
Represents a database connection.
|
Represents a database connection.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class BaseDatabaseClient(object):
|
class BaseDatabaseClient:
|
||||||
"""
|
"""
|
||||||
This class encapsulates all backend-specific methods for opening a
|
This class encapsulates all backend-specific methods for opening a
|
||||||
client shell.
|
client shell.
|
||||||
|
|
|
@ -11,7 +11,7 @@ from django.db import router
|
||||||
TEST_DATABASE_PREFIX = 'test_'
|
TEST_DATABASE_PREFIX = 'test_'
|
||||||
|
|
||||||
|
|
||||||
class BaseDatabaseCreation(object):
|
class BaseDatabaseCreation:
|
||||||
"""
|
"""
|
||||||
This class encapsulates all backend-specific differences that pertain to
|
This class encapsulates all backend-specific differences that pertain to
|
||||||
creation and destruction of the test database.
|
creation and destruction of the test database.
|
||||||
|
|
|
@ -3,7 +3,7 @@ from django.db.utils import ProgrammingError
|
||||||
from django.utils.functional import cached_property
|
from django.utils.functional import cached_property
|
||||||
|
|
||||||
|
|
||||||
class BaseDatabaseFeatures(object):
|
class BaseDatabaseFeatures:
|
||||||
gis_enabled = False
|
gis_enabled = False
|
||||||
allows_group_by_pk = False
|
allows_group_by_pk = False
|
||||||
allows_group_by_selected_pks = False
|
allows_group_by_selected_pks = False
|
||||||
|
|
|
@ -7,7 +7,7 @@ TableInfo = namedtuple('TableInfo', ['name', 'type'])
|
||||||
FieldInfo = namedtuple('FieldInfo', 'name type_code display_size internal_size precision scale null_ok default')
|
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
|
This class encapsulates all backend-specific introspection utilities
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -10,7 +10,7 @@ from django.utils.dateparse import parse_duration
|
||||||
from django.utils.encoding import force_text
|
from django.utils.encoding import force_text
|
||||||
|
|
||||||
|
|
||||||
class BaseDatabaseOperations(object):
|
class BaseDatabaseOperations:
|
||||||
"""
|
"""
|
||||||
This class encapsulates all backend-specific differences, such as the way
|
This class encapsulates all backend-specific differences, such as the way
|
||||||
a backend performs ordering or calculates the ID of a recently-inserted
|
a backend performs ordering or calculates the ID of a recently-inserted
|
||||||
|
|
|
@ -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
|
This class (and its subclasses) are responsible for emitting schema-changing
|
||||||
statements to the databases - model creation/removal/alteration, field
|
statements to the databases - model creation/removal/alteration, field
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class BaseDatabaseValidation(object):
|
class BaseDatabaseValidation:
|
||||||
"""
|
"""
|
||||||
This class encapsulates all backend-specific validation.
|
This class encapsulates all backend-specific validation.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -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
|
# standard backend_utils.CursorDebugWrapper can be used. Also, using sql_mode
|
||||||
# TRADITIONAL will automatically cause most warnings to be treated as errors.
|
# 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
|
A thin wrapper around MySQLdb's normal cursor class so that we can catch
|
||||||
particular exception instances and reraise them with the right types.
|
particular exception instances and reraise them with the right types.
|
||||||
|
|
|
@ -59,7 +59,7 @@ from .schema import DatabaseSchemaEditor # NOQA isort:skip
|
||||||
from .utils import Oracle_datetime # NOQA isort:skip
|
from .utils import Oracle_datetime # NOQA isort:skip
|
||||||
|
|
||||||
|
|
||||||
class _UninitializedOperatorsDescriptor(object):
|
class _UninitializedOperatorsDescriptor:
|
||||||
|
|
||||||
def __get__(self, instance, cls=None):
|
def __get__(self, instance, cls=None):
|
||||||
# If connection.operators is looked up before a connection has been
|
# If connection.operators is looked up before a connection has been
|
||||||
|
@ -306,7 +306,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class OracleParam(object):
|
class OracleParam:
|
||||||
"""
|
"""
|
||||||
Wrapper object for formatting parameters for Oracle. If the string
|
Wrapper object for formatting parameters for Oracle. If the string
|
||||||
representation of the value is large enough (greater than 4000 characters)
|
representation of the value is large enough (greater than 4000 characters)
|
||||||
|
@ -351,7 +351,7 @@ class OracleParam(object):
|
||||||
self.input_size = None
|
self.input_size = None
|
||||||
|
|
||||||
|
|
||||||
class VariableWrapper(object):
|
class VariableWrapper:
|
||||||
"""
|
"""
|
||||||
An adapter class for cursor variables that prevents the wrapped object
|
An adapter class for cursor variables that prevents the wrapped object
|
||||||
from being converted into a string when used to instantiate an OracleParam.
|
from being converted into a string when used to instantiate an OracleParam.
|
||||||
|
@ -375,7 +375,7 @@ class VariableWrapper(object):
|
||||||
setattr(self.var, key, value)
|
setattr(self.var, key, value)
|
||||||
|
|
||||||
|
|
||||||
class FormatStylePlaceholderCursor(object):
|
class FormatStylePlaceholderCursor:
|
||||||
"""
|
"""
|
||||||
Django uses "format" (e.g. '%s') style placeholders, but Oracle uses ":var"
|
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
|
style. This fixes it -- but note that if you want to use a literal "%s" in
|
||||||
|
|
|
@ -3,7 +3,7 @@ import datetime
|
||||||
from .base import Database
|
from .base import Database
|
||||||
|
|
||||||
|
|
||||||
class InsertIdVar(object):
|
class InsertIdVar:
|
||||||
"""
|
"""
|
||||||
A late-binding cursor variable that can be passed to Cursor.execute
|
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
|
as a parameter, in order to receive the id of the row created by an
|
||||||
|
|
|
@ -18,7 +18,7 @@ def get_field_size(name):
|
||||||
# This light wrapper "fakes" a dictionary interface, because some SQLite data
|
# 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
|
# types include variables in them -- e.g. "varchar(30)" -- and can't be matched
|
||||||
# as a simple dictionary lookup.
|
# as a simple dictionary lookup.
|
||||||
class FlexibleFieldLookupDict(object):
|
class FlexibleFieldLookupDict:
|
||||||
# Maps SQL types to Django Field types. Some of the SQL types have multiple
|
# 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
|
# entries here because SQLite allows for anything and doesn't normalize the
|
||||||
# field type; it uses whatever was given.
|
# field type; it uses whatever was given.
|
||||||
|
|
|
@ -11,7 +11,7 @@ from django.utils.timezone import utc
|
||||||
logger = logging.getLogger('django.db.backends')
|
logger = logging.getLogger('django.db.backends')
|
||||||
|
|
||||||
|
|
||||||
class CursorWrapper(object):
|
class CursorWrapper:
|
||||||
def __init__(self, cursor, db):
|
def __init__(self, cursor, db):
|
||||||
self.cursor = cursor
|
self.cursor = cursor
|
||||||
self.db = db
|
self.db = db
|
||||||
|
|
|
@ -16,7 +16,7 @@ from django.db.migrations.utils import (
|
||||||
from .topological_sort import stable_topological_sort
|
from .topological_sort import stable_topological_sort
|
||||||
|
|
||||||
|
|
||||||
class MigrationAutodetector(object):
|
class MigrationAutodetector:
|
||||||
"""
|
"""
|
||||||
Takes a pair of ProjectStates, and compares them to see what the
|
Takes a pair of ProjectStates, and compares them to see what the
|
||||||
first would need doing to make it match the second (the second
|
first would need doing to make it match the second (the second
|
||||||
|
|
|
@ -7,7 +7,7 @@ from .recorder import MigrationRecorder
|
||||||
from .state import ProjectState
|
from .state import ProjectState
|
||||||
|
|
||||||
|
|
||||||
class MigrationExecutor(object):
|
class MigrationExecutor:
|
||||||
"""
|
"""
|
||||||
End-to-end migration execution - loads migrations, and runs them
|
End-to-end migration execution - loads migrations, and runs them
|
||||||
up or down to a specified set of targets.
|
up or down to a specified set of targets.
|
||||||
|
|
|
@ -18,7 +18,7 @@ RECURSION_DEPTH_WARNING = (
|
||||||
|
|
||||||
|
|
||||||
@total_ordering
|
@total_ordering
|
||||||
class Node(object):
|
class Node:
|
||||||
"""
|
"""
|
||||||
A single node in the migration graph. Contains direct links to adjacent
|
A single node in the migration graph. Contains direct links to adjacent
|
||||||
nodes in either direction.
|
nodes in either direction.
|
||||||
|
@ -100,7 +100,7 @@ class DummyNode(Node):
|
||||||
raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
|
raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
|
||||||
|
|
||||||
|
|
||||||
class MigrationGraph(object):
|
class MigrationGraph:
|
||||||
"""
|
"""
|
||||||
Represents the digraph of all migrations in a project.
|
Represents the digraph of all migrations in a project.
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ from .exceptions import (
|
||||||
MIGRATIONS_MODULE_NAME = 'migrations'
|
MIGRATIONS_MODULE_NAME = 'migrations'
|
||||||
|
|
||||||
|
|
||||||
class MigrationLoader(object):
|
class MigrationLoader:
|
||||||
"""
|
"""
|
||||||
Loads migration files from disk, and their status from the database.
|
Loads migration files from disk, and their status from the database.
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ from django.db.transaction import atomic
|
||||||
from .exceptions import IrreversibleError
|
from .exceptions import IrreversibleError
|
||||||
|
|
||||||
|
|
||||||
class Migration(object):
|
class Migration:
|
||||||
"""
|
"""
|
||||||
The base class for all migrations.
|
The base class for all migrations.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from django.db import router
|
from django.db import router
|
||||||
|
|
||||||
|
|
||||||
class Operation(object):
|
class Operation:
|
||||||
"""
|
"""
|
||||||
Base class for migration operations.
|
Base class for migration operations.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class MigrationOptimizer(object):
|
class MigrationOptimizer:
|
||||||
"""
|
"""
|
||||||
Powers the optimization process, where you provide a list of Operations
|
Powers the optimization process, where you provide a list of Operations
|
||||||
and you are returned a list of equal or shorter length - operations
|
and you are returned a list of equal or shorter length - operations
|
||||||
|
|
|
@ -9,7 +9,7 @@ from django.utils import datetime_safe, timezone
|
||||||
from .loader import MigrationLoader
|
from .loader import MigrationLoader
|
||||||
|
|
||||||
|
|
||||||
class MigrationQuestioner(object):
|
class MigrationQuestioner:
|
||||||
"""
|
"""
|
||||||
Gives the autodetector responses to questions it might have.
|
Gives the autodetector responses to questions it might have.
|
||||||
This base class has a built-in noninteractive mode, but the
|
This base class has a built-in noninteractive mode, but the
|
||||||
|
|
|
@ -6,7 +6,7 @@ from django.utils.timezone import now
|
||||||
from .exceptions import MigrationSchemaMissing
|
from .exceptions import MigrationSchemaMissing
|
||||||
|
|
||||||
|
|
||||||
class MigrationRecorder(object):
|
class MigrationRecorder:
|
||||||
"""
|
"""
|
||||||
Deals with storing migration records in the database.
|
Deals with storing migration records in the database.
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ except ImportError:
|
||||||
enum = None
|
enum = None
|
||||||
|
|
||||||
|
|
||||||
class BaseSerializer(object):
|
class BaseSerializer:
|
||||||
def __init__(self, value):
|
def __init__(self, value):
|
||||||
self.value = value
|
self.value = value
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue