summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-10-26 18:27:42 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2013-10-26 18:27:42 -0700
commitb35ff0d9208c426cc0f67c65d724972974734f57 (patch)
tree90d724e0b7a367d485712d79bfd4027717c8c08b
parent3351e94ffa37d3824a49b687125ee4a430b69bbe (diff)
downloaddjango-b35ff0d9208c426cc0f67c65d724972974734f57.tar.gz
Fixed all the E203 violations
-rw-r--r--django/contrib/admin/templatetags/admin_list.py2
-rw-r--r--django/contrib/admindocs/utils.py18
-rw-r--r--django/contrib/admindocs/views.py20
-rw-r--r--django/contrib/gis/admin/options.py66
-rw-r--r--django/contrib/gis/admin/widgets.py2
-rw-r--r--django/contrib/gis/db/backends/oracle/operations.py36
-rw-r--r--django/contrib/gis/db/backends/postgis/introspection.py4
-rw-r--r--django/contrib/gis/db/backends/postgis/operations.py64
-rw-r--r--django/contrib/gis/db/backends/spatialite/introspection.py14
-rw-r--r--django/contrib/gis/db/backends/spatialite/operations.py36
-rw-r--r--django/contrib/gis/db/backends/utils.py16
-rw-r--r--django/contrib/gis/db/models/fields.py6
-rw-r--r--django/contrib/gis/db/models/query.py104
-rw-r--r--django/contrib/gis/db/models/sql/query.py4
-rw-r--r--django/contrib/gis/feeds.py4
-rw-r--r--django/contrib/gis/forms/fields.py8
-rw-r--r--django/contrib/gis/gdal/driver.py10
-rw-r--r--django/contrib/gis/gdal/geometries.py28
-rw-r--r--django/contrib/gis/gdal/geomtype.py26
-rw-r--r--django/contrib/gis/gdal/tests/test_driver.py8
-rw-r--r--django/contrib/gis/geoip/base.py4
-rw-r--r--django/contrib/gis/geoip/tests.py4
-rw-r--r--django/contrib/gis/geos/geometry.py16
-rw-r--r--django/contrib/gis/geos/tests/test_geos.py2
-rw-r--r--django/contrib/gis/management/commands/ogrinspect.py6
-rw-r--r--django/contrib/gis/maps/google/gmap.py26
-rw-r--r--django/contrib/gis/measure.py118
-rw-r--r--django/contrib/gis/sitemaps/kml.py4
-rw-r--r--django/contrib/gis/sitemaps/views.py2
-rw-r--r--django/contrib/gis/tests/geo3d/tests.py12
-rw-r--r--django/contrib/gis/tests/geoapp/feeds.py14
-rw-r--r--django/contrib/gis/tests/geoapp/sitemaps.py6
-rw-r--r--django/contrib/gis/tests/geoapp/test_regress.py8
-rw-r--r--django/contrib/gis/tests/geoapp/tests.py10
-rw-r--r--django/contrib/gis/tests/geoapp/urls.py4
-rw-r--r--django/contrib/gis/tests/geogapp/tests.py6
-rw-r--r--django/contrib/gis/tests/layermap/models.py26
-rw-r--r--django/contrib/gis/tests/layermap/tests.py12
-rw-r--r--django/contrib/gis/tests/test_spatialrefsys.py36
-rw-r--r--django/contrib/gis/utils/layermapping.py44
-rw-r--r--django/contrib/gis/utils/srs.py8
-rw-r--r--django/contrib/sites/management.py2
-rw-r--r--django/core/serializers/__init__.py12
-rw-r--r--django/core/serializers/xml_serializer.py14
-rw-r--r--django/core/urlresolvers.py2
-rw-r--r--django/forms/formsets.py4
-rw-r--r--django/test/html.py2
-rw-r--r--django/utils/translation/trans_real.py2
-rw-r--r--django/views/debug.py6
-rw-r--r--django/views/static.py6
-rw-r--r--docs/_ext/literals_to_xrefs.py2
-rw-r--r--setup.cfg2
-rw-r--r--tests/admin_views/admin.py8
-rw-r--r--tests/aggregation_regress/tests.py16
-rw-r--r--tests/cache/tests.py52
-rw-r--r--tests/forms_tests/tests/test_forms.py10
-rw-r--r--tests/model_forms/tests.py6
-rw-r--r--tests/serializers/tests.py2
-rw-r--r--tests/template_tests/filters.py52
-rw-r--r--tests/template_tests/templatetags/custom.py20
-rw-r--r--tests/template_tests/tests.py12
-rw-r--r--tests/test_client/views.py4
-rw-r--r--tests/test_utils/tests.py2
63 files changed, 541 insertions, 541 deletions
diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py
index f58c5745ea..7d5a616cef 100644
--- a/django/contrib/admin/templatetags/admin_list.py
+++ b/django/contrib/admin/templatetags/admin_list.py
@@ -398,7 +398,7 @@ def admin_list_filter(cl, spec):
tpl = get_template(spec.template)
return tpl.render(Context({
'title': spec.title,
- 'choices' : list(spec.choices(cl)),
+ 'choices': list(spec.choices(cl)),
'spec': spec,
}))
diff --git a/django/contrib/admindocs/utils.py b/django/contrib/admindocs/utils.py
index cdb1064412..f75bf499df 100644
--- a/django/contrib/admindocs/utils.py
+++ b/django/contrib/admindocs/utils.py
@@ -60,10 +60,10 @@ def parse_rst(text, default_reference_context, thing_being_parsed=None):
Convert the string from reST to an XHTML fragment.
"""
overrides = {
- 'doctitle_xform' : True,
- 'inital_header_level' : 3,
- "default_reference_context" : default_reference_context,
- "link_base" : reverse('django-admindocs-docroot').rstrip('/')
+ 'doctitle_xform': True,
+ 'inital_header_level': 3,
+ "default_reference_context": default_reference_context,
+ "link_base": reverse('django-admindocs-docroot').rstrip('/')
}
if thing_being_parsed:
thing_being_parsed = force_bytes("<%s>" % thing_being_parsed)
@@ -85,11 +85,11 @@ def parse_rst(text, default_reference_context, thing_being_parsed=None):
# reST roles
#
ROLES = {
- 'model' : '%s/models/%s/',
- 'view' : '%s/views/%s/',
- 'template' : '%s/templates/%s/',
- 'filter' : '%s/filters/#%s',
- 'tag' : '%s/tags/#%s',
+ 'model': '%s/models/%s/',
+ 'view': '%s/views/%s/',
+ 'template': '%s/templates/%s/',
+ 'filter': '%s/filters/#%s',
+ 'tag': '%s/tags/#%s',
}
def create_reference_role(rolename, urlbase):
diff --git a/django/contrib/admindocs/views.py b/django/contrib/admindocs/views.py
index 3c888fdb8e..405f6b2a74 100644
--- a/django/contrib/admindocs/views.py
+++ b/django/contrib/admindocs/views.py
@@ -229,12 +229,12 @@ def model_detail(request, app_label, model_name):
fields.append({
'name': "%s.all" % field.name,
"data_type": 'List',
- 'verbose': utils.parse_rst(_("all %s") % verbose , 'model', _('model:') + opts.model_name),
+ 'verbose': utils.parse_rst(_("all %s") % verbose, 'model', _('model:') + opts.model_name),
})
fields.append({
- 'name' : "%s.count" % field.name,
- 'data_type' : 'Integer',
- 'verbose' : utils.parse_rst(_("number of %s") % verbose , 'model', _('model:') + opts.model_name),
+ 'name': "%s.count" % field.name,
+ 'data_type': 'Integer',
+ 'verbose': utils.parse_rst(_("number of %s") % verbose, 'model', _('model:') + opts.model_name),
})
# Gather model methods.
@@ -260,14 +260,14 @@ def model_detail(request, app_label, model_name):
verbose = _("related `%(app_label)s.%(object_name)s` objects") % {'app_label': rel.opts.app_label, 'object_name': rel.opts.object_name}
accessor = rel.get_accessor_name()
fields.append({
- 'name' : "%s.all" % accessor,
- 'data_type' : 'List',
- 'verbose' : utils.parse_rst(_("all %s") % verbose , 'model', _('model:') + opts.model_name),
+ 'name': "%s.all" % accessor,
+ 'data_type': 'List',
+ 'verbose': utils.parse_rst(_("all %s") % verbose, 'model', _('model:') + opts.model_name),
})
fields.append({
- 'name' : "%s.count" % accessor,
- 'data_type' : 'Integer',
- 'verbose' : utils.parse_rst(_("number of %s") % verbose , 'model', _('model:') + opts.model_name),
+ 'name': "%s.count" % accessor,
+ 'data_type': 'Integer',
+ 'verbose': utils.parse_rst(_("number of %s") % verbose, 'model', _('model:') + opts.model_name),
})
return render_to_response('admin_doc/model_detail.html', {
'root_path': urlresolvers.reverse('admin:index'),
diff --git a/django/contrib/gis/admin/options.py b/django/contrib/gis/admin/options.py
index c73c4224eb..6ec6a23ffd 100644
--- a/django/contrib/gis/admin/options.py
+++ b/django/contrib/gis/admin/options.py
@@ -86,39 +86,39 @@ class GeoModelAdmin(ModelAdmin):
wms_options = ["%s: '%s'" % pair for pair in self.wms_options.items()]
wms_options = ', %s' % ', '.join(wms_options)
- params = {'default_lon' : self.default_lon,
- 'default_lat' : self.default_lat,
- 'default_zoom' : self.default_zoom,
- 'display_wkt' : self.debug or self.display_wkt,
- 'geom_type' : OGRGeomType(db_field.geom_type),
- 'field_name' : db_field.name,
- 'is_collection' : is_collection,
- 'scrollable' : self.scrollable,
- 'layerswitcher' : self.layerswitcher,
- 'collection_type' : collection_type,
- 'is_generic' : db_field.geom_type == 'GEOMETRY',
- 'is_linestring' : db_field.geom_type in ('LINESTRING', 'MULTILINESTRING'),
- 'is_polygon' : db_field.geom_type in ('POLYGON', 'MULTIPOLYGON'),
- 'is_point' : db_field.geom_type in ('POINT', 'MULTIPOINT'),
- 'num_zoom' : self.num_zoom,
- 'max_zoom' : self.max_zoom,
- 'min_zoom' : self.min_zoom,
- 'units' : self.units, # likely should get from object
- 'max_resolution' : self.max_resolution,
- 'max_extent' : self.max_extent,
- 'modifiable' : self.modifiable,
- 'mouse_position' : self.mouse_position,
- 'scale_text' : self.scale_text,
- 'map_width' : self.map_width,
- 'map_height' : self.map_height,
- 'point_zoom' : self.point_zoom,
- 'srid' : self.map_srid,
- 'display_srid' : self.display_srid,
- 'wms_url' : self.wms_url,
- 'wms_layer' : self.wms_layer,
- 'wms_name' : self.wms_name,
- 'wms_options' : wms_options,
- 'debug' : self.debug,
+ params = {'default_lon': self.default_lon,
+ 'default_lat': self.default_lat,
+ 'default_zoom': self.default_zoom,
+ 'display_wkt': self.debug or self.display_wkt,
+ 'geom_type': OGRGeomType(db_field.geom_type),
+ 'field_name': db_field.name,
+ 'is_collection': is_collection,
+ 'scrollable': self.scrollable,
+ 'layerswitcher': self.layerswitcher,
+ 'collection_type': collection_type,
+ 'is_generic': db_field.geom_type == 'GEOMETRY',
+ 'is_linestring': db_field.geom_type in ('LINESTRING', 'MULTILINESTRING'),
+ 'is_polygon': db_field.geom_type in ('POLYGON', 'MULTIPOLYGON'),
+ 'is_point': db_field.geom_type in ('POINT', 'MULTIPOINT'),
+ 'num_zoom': self.num_zoom,
+ 'max_zoom': self.max_zoom,
+ 'min_zoom': self.min_zoom,
+ 'units': self.units, # likely should get from object
+ 'max_resolution': self.max_resolution,
+ 'max_extent': self.max_extent,
+ 'modifiable': self.modifiable,
+ 'mouse_position': self.mouse_position,
+ 'scale_text': self.scale_text,
+ 'map_width': self.map_width,
+ 'map_height': self.map_height,
+ 'point_zoom': self.point_zoom,
+ 'srid': self.map_srid,
+ 'display_srid': self.display_srid,
+ 'wms_url': self.wms_url,
+ 'wms_layer': self.wms_layer,
+ 'wms_name': self.wms_name,
+ 'wms_options': wms_options,
+ 'debug': self.debug,
}
return OLMap
diff --git a/django/contrib/gis/admin/widgets.py b/django/contrib/gis/admin/widgets.py
index 8533bdc044..b098b7e7a2 100644
--- a/django/contrib/gis/admin/widgets.py
+++ b/django/contrib/gis/admin/widgets.py
@@ -10,7 +10,7 @@ from django.contrib.gis.geos import GEOSGeometry, GEOSException
# Creating a template context that contains Django settings
# values needed by admin map templates.
-geo_context = Context({'LANGUAGE_BIDI' : translation.get_language_bidi()})
+geo_context = Context({'LANGUAGE_BIDI': translation.get_language_bidi()})
logger = logging.getLogger('django.contrib.gis')
diff --git a/django/contrib/gis/db/backends/oracle/operations.py b/django/contrib/gis/db/backends/oracle/operations.py
index 9eed8632e8..5fced474c8 100644
--- a/django/contrib/gis/db/backends/oracle/operations.py
+++ b/django/contrib/gis/db/backends/oracle/operations.py
@@ -109,33 +109,33 @@ class OracleOperations(DatabaseOperations, BaseSpatialOperations):
select = 'SDO_UTIL.TO_WKTGEOMETRY(%s)'
distance_functions = {
- 'distance_gt' : (SDODistance('>'), dtypes),
- 'distance_gte' : (SDODistance('>='), dtypes),
- 'distance_lt' : (SDODistance('<'), dtypes),
- 'distance_lte' : (SDODistance('<='), dtypes),
- 'dwithin' : (SDODWithin(), dtypes),
+ 'distance_gt': (SDODistance('>'), dtypes),
+ 'distance_gte': (SDODistance('>='), dtypes),
+ 'distance_lt': (SDODistance('<'), dtypes),
+ 'distance_lte': (SDODistance('<='), dtypes),
+ 'dwithin': (SDODWithin(), dtypes),
}
geometry_functions = {
- 'contains' : SDOOperation('SDO_CONTAINS'),
- 'coveredby' : SDOOperation('SDO_COVEREDBY'),
- 'covers' : SDOOperation('SDO_COVERS'),
- 'disjoint' : SDOGeomRelate('DISJOINT'),
- 'intersects' : SDOOperation('SDO_OVERLAPBDYINTERSECT'), # TODO: Is this really the same as ST_Intersects()?
- 'equals' : SDOOperation('SDO_EQUAL'),
- 'exact' : SDOOperation('SDO_EQUAL'),
- 'overlaps' : SDOOperation('SDO_OVERLAPS'),
- 'same_as' : SDOOperation('SDO_EQUAL'),
- 'relate' : (SDORelate, six.string_types), # Oracle uses a different syntax, e.g., 'mask=inside+touch'
- 'touches' : SDOOperation('SDO_TOUCH'),
- 'within' : SDOOperation('SDO_INSIDE'),
+ 'contains': SDOOperation('SDO_CONTAINS'),
+ 'coveredby': SDOOperation('SDO_COVEREDBY'),
+ 'covers': SDOOperation('SDO_COVERS'),
+ 'disjoint': SDOGeomRelate('DISJOINT'),
+ 'intersects': SDOOperation('SDO_OVERLAPBDYINTERSECT'), # TODO: Is this really the same as ST_Intersects()?
+ 'equals': SDOOperation('SDO_EQUAL'),
+ 'exact': SDOOperation('SDO_EQUAL'),
+ 'overlaps': SDOOperation('SDO_OVERLAPS'),
+ 'same_as': SDOOperation('SDO_EQUAL'),
+ 'relate': (SDORelate, six.string_types), # Oracle uses a different syntax, e.g., 'mask=inside+touch'
+ 'touches': SDOOperation('SDO_TOUCH'),
+ 'within': SDOOperation('SDO_INSIDE'),
}
geometry_functions.update(distance_functions)
gis_terms = set(['isnull'])
gis_terms.update(geometry_functions)
- truncate_params = {'relate' : None}
+ truncate_params = {'relate': None}
def convert_extent(self, clob):
if clob:
diff --git a/django/contrib/gis/db/backends/postgis/introspection.py b/django/contrib/gis/db/backends/postgis/introspection.py
index 3189fa4553..d9e1dd350e 100644
--- a/django/contrib/gis/db/backends/postgis/introspection.py
+++ b/django/contrib/gis/db/backends/postgis/introspection.py
@@ -32,14 +32,14 @@ class PostGISIntrospection(DatabaseIntrospection):
try:
cursor.execute(oid_sql, ('geometry',))
GEOM_TYPE = cursor.fetchone()[0]
- postgis_types = {GEOM_TYPE : 'GeometryField'}
+ postgis_types = {GEOM_TYPE: 'GeometryField'}
if self.connection.ops.geography:
cursor.execute(oid_sql, ('geography',))
GEOG_TYPE = cursor.fetchone()[0]
# The value for the geography type is actually a tuple
# to pass in the `geography=True` keyword to the field
# definition.
- postgis_types[GEOG_TYPE] = ('GeometryField', {'geography' : True})
+ postgis_types[GEOG_TYPE] = ('GeometryField', {'geography': True})
finally:
cursor.close()
diff --git a/django/contrib/gis/db/backends/postgis/operations.py b/django/contrib/gis/db/backends/postgis/operations.py
index 867402c92d..92e5323d36 100644
--- a/django/contrib/gis/db/backends/postgis/operations.py
+++ b/django/contrib/gis/db/backends/postgis/operations.py
@@ -84,56 +84,56 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations):
self.geometry_operators = {
# The "&<" operator returns true if A's bounding box overlaps or
# is to the left of B's bounding box.
- 'overlaps_left' : PostGISOperator('&<'),
+ 'overlaps_left': PostGISOperator('&<'),
# The "&>" operator returns true if A's bounding box overlaps or
# is to the right of B's bounding box.
- 'overlaps_right' : PostGISOperator('&>'),
+ 'overlaps_right': PostGISOperator('&>'),
# The "<<" operator returns true if A's bounding box is strictly
# to the left of B's bounding box.
- 'left' : PostGISOperator('<<'),
+ 'left': PostGISOperator('<<'),
# The ">>" operator returns true if A's bounding box is strictly
# to the right of B's bounding box.
- 'right' : PostGISOperator('>>'),
+ 'right': PostGISOperator('>>'),
# The "&<|" operator returns true if A's bounding box overlaps or
# is below B's bounding box.
- 'overlaps_below' : PostGISOperator('&<|'),
+ 'overlaps_below': PostGISOperator('&<|'),
# The "|&>" operator returns true if A's bounding box overlaps or
# is above B's bounding box.
- 'overlaps_above' : PostGISOperator('|&>'),
+ 'overlaps_above': PostGISOperator('|&>'),
# The "<<|" operator returns true if A's bounding box is strictly
# below B's bounding box.
- 'strictly_below' : PostGISOperator('<<|'),
+ 'strictly_below': PostGISOperator('<<|'),
# The "|>>" operator returns true if A's bounding box is strictly
# above B's bounding box.
- 'strictly_above' : PostGISOperator('|>>'),
+ 'strictly_above': PostGISOperator('|>>'),
# The "~=" operator is the "same as" operator. It tests actual
# geometric equality of two features. So if A and B are the same feature,
# vertex-by-vertex, the operator returns true.
- 'same_as' : PostGISOperator('~='),
- 'exact' : PostGISOperator('~='),
+ 'same_as': PostGISOperator('~='),
+ 'exact': PostGISOperator('~='),
# The "@" operator returns true if A's bounding box is completely contained
# by B's bounding box.
- 'contained' : PostGISOperator('@'),
+ 'contained': PostGISOperator('@'),
# The "~" operator returns true if A's bounding box completely contains
# by B's bounding box.
- 'bbcontains' : PostGISOperator('~'),
+ 'bbcontains': PostGISOperator('~'),
# The "&&" operator returns true if A's bounding box overlaps
# B's bounding box.
- 'bboverlaps' : PostGISOperator('&&'),
+ 'bboverlaps': PostGISOperator('&&'),
}
self.geometry_functions = {
- 'equals' : PostGISFunction(prefix, 'Equals'),
- 'disjoint' : PostGISFunction(prefix, 'Disjoint'),
- 'touches' : PostGISFunction(prefix, 'Touches'),
- 'crosses' : PostGISFunction(prefix, 'Crosses'),
- 'within' : PostGISFunction(prefix, 'Within'),
- 'overlaps' : PostGISFunction(prefix, 'Overlaps'),
- 'contains' : PostGISFunction(prefix, 'Contains'),
- 'intersects' : PostGISFunction(prefix, 'Intersects'),
- 'relate' : (PostGISRelate, six.string_types),
- 'coveredby' : PostGISFunction(prefix, 'CoveredBy'),
- 'covers' : PostGISFunction(prefix, 'Covers'),
+ 'equals': PostGISFunction(prefix, 'Equals'),
+ 'disjoint': PostGISFunction(prefix, 'Disjoint'),
+ 'touches': PostGISFunction(prefix, 'Touches'),
+ 'crosses': PostGISFunction(prefix, 'Crosses'),
+ 'within': PostGISFunction(prefix, 'Within'),
+ 'overlaps': PostGISFunction(prefix, 'Overlaps'),
+ 'contains': PostGISFunction(prefix, 'Contains'),
+ 'intersects': PostGISFunction(prefix, 'Intersects'),
+ 'relate': (PostGISRelate, six.string_types),
+ 'coveredby': PostGISFunction(prefix, 'CoveredBy'),
+ 'covers': PostGISFunction(prefix, 'Covers'),
}
# Valid distance types and substitutions
@@ -141,16 +141,16 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations):
def get_dist_ops(operator):
"Returns operations for both regular and spherical distances."
- return {'cartesian' : PostGISDistance(prefix, operator),
- 'sphere' : PostGISSphereDistance(prefix, operator),
- 'spheroid' : PostGISSpheroidDistance(prefix, operator),
+ return {'cartesian': PostGISDistance(prefix, operator),
+ 'sphere': PostGISSphereDistance(prefix, operator),
+ 'spheroid': PostGISSpheroidDistance(prefix, operator),
}
self.distance_functions = {
- 'distance_gt' : (get_dist_ops('>'), dtypes),
- 'distance_gte' : (get_dist_ops('>='), dtypes),
- 'distance_lt' : (get_dist_ops('<'), dtypes),
- 'distance_lte' : (get_dist_ops('<='), dtypes),
- 'dwithin' : (PostGISFunctionParam(prefix, 'DWithin'), dtypes)
+ 'distance_gt': (get_dist_ops('>'), dtypes),
+ 'distance_gte': (get_dist_ops('>='), dtypes),
+ 'distance_lt': (get_dist_ops('<'), dtypes),
+ 'distance_lte': (get_dist_ops('<='), dtypes),
+ 'dwithin': (PostGISFunctionParam(prefix, 'DWithin'), dtypes)
}
# Adding the distance functions to the geometries lookup.
diff --git a/django/contrib/gis/db/backends/spatialite/introspection.py b/django/contrib/gis/db/backends/spatialite/introspection.py
index 90ed83fa08..c841d1ae6a 100644
--- a/django/contrib/gis/db/backends/spatialite/introspection.py
+++ b/django/contrib/gis/db/backends/spatialite/introspection.py
@@ -9,13 +9,13 @@ class GeoFlexibleFieldLookupDict(FlexibleFieldLookupDict):
"""
base_data_types_reverse = FlexibleFieldLookupDict.base_data_types_reverse.copy()
base_data_types_reverse.update(
- {'point' : 'GeometryField',
- 'linestring' : 'GeometryField',
- 'polygon' : 'GeometryField',
- 'multipoint' : 'GeometryField',
- 'multilinestring' : 'GeometryField',
- 'multipolygon' : 'GeometryField',
- 'geometrycollection' : 'GeometryField',
+ {'point': 'GeometryField',
+ 'linestring': 'GeometryField',
+ 'polygon': 'GeometryField',
+ 'multipoint': 'GeometryField',
+ 'multilinestring': 'GeometryField',
+ 'multipolygon': 'GeometryField',
+ 'geometrycollection': 'GeometryField',
})
class SpatiaLiteIntrospection(DatabaseIntrospection):
diff --git a/django/contrib/gis/db/backends/spatialite/operations.py b/django/contrib/gis/db/backends/spatialite/operations.py
index 6fada2e336..4954ba5210 100644
--- a/django/contrib/gis/db/backends/spatialite/operations.py
+++ b/django/contrib/gis/db/backends/spatialite/operations.py
@@ -86,31 +86,31 @@ class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations):
select = 'AsText(%s)'
geometry_functions = {
- 'equals' : SpatiaLiteFunction('Equals'),
- 'disjoint' : SpatiaLiteFunction('Disjoint'),
- 'touches' : SpatiaLiteFunction('Touches'),
- 'crosses' : SpatiaLiteFunction('Crosses'),
- 'within' : SpatiaLiteFunction('Within'),
- 'overlaps' : SpatiaLiteFunction('Overlaps'),
- 'contains' : SpatiaLiteFunction('Contains'),
- 'intersects' : SpatiaLiteFunction('Intersects'),
- 'relate' : (SpatiaLiteRelate, six.string_types),
+ 'equals': SpatiaLiteFunction('Equals'),
+ 'disjoint': SpatiaLiteFunction('Disjoint'),
+ 'touches': SpatiaLiteFunction('Touches'),
+ 'crosses': SpatiaLiteFunction('Crosses'),
+ 'within': SpatiaLiteFunction('Within'),
+ 'overlaps': SpatiaLiteFunction('Overlaps'),
+ 'contains': SpatiaLiteFunction('Contains'),
+ 'intersects': SpatiaLiteFunction('Intersects'),
+ 'relate': (SpatiaLiteRelate, six.string_types),
# Returns true if B's bounding box completely contains A's bounding box.
- 'contained' : SpatiaLiteFunction('MbrWithin'),
+ 'contained': SpatiaLiteFunction('MbrWithin'),
# Returns true if A's bounding box completely contains B's bounding box.
- 'bbcontains' : SpatiaLiteFunction('MbrContains'),
+ 'bbcontains': SpatiaLiteFunction('MbrContains'),
# Returns true if A's bounding box overlaps B's bounding box.
- 'bboverlaps' : SpatiaLiteFunction('MbrOverlaps'),
+ 'bboverlaps': SpatiaLiteFunction('MbrOverlaps'),
# These are implemented here as synonyms for Equals
- 'same_as' : SpatiaLiteFunction('Equals'),
- 'exact' : SpatiaLiteFunction('Equals'),
+ 'same_as': SpatiaLiteFunction('Equals'),
+ 'exact': SpatiaLiteFunction('Equals'),
}
distance_functions = {
- 'distance_gt' : (get_dist_ops('>'), dtypes),
- 'distance_gte' : (get_dist_ops('>='), dtypes),
- 'distance_lt' : (get_dist_ops('<'), dtypes),
- 'distance_lte' : (get_dist_ops('<='), dtypes),
+ 'distance_gt': (get_dist_ops('>'), dtypes),
+ 'distance_gte': (get_dist_ops('>='), dtypes),
+ 'distance_lt': (get_dist_ops('<'), dtypes),
+ 'distance_lte': (get_dist_ops('<='), dtypes),
}
geometry_functions.update(distance_functions)
diff --git a/django/contrib/gis/db/backends/utils.py b/django/contrib/gis/db/backends/utils.py
index 2612810659..53f1e1b6a4 100644
--- a/django/contrib/gis/db/backends/utils.py
+++ b/django/contrib/gis/db/backends/utils.py
@@ -19,11 +19,11 @@ class SpatialOperation(object):
return self.sql_template % self.params(geo_col, geometry), []
def params(self, geo_col, geometry):
- params = {'function' : self.function,
- 'geo_col' : geo_col,
- 'geometry' : geometry,
- 'operator' : self.operator,
- 'result' : self.result,
+ params = {'function': self.function,
+ 'geo_col': geo_col,
+ 'geometry': geometry,
+ 'operator': self.operator,
+ 'result': self.result,
}
params.update(self.extra)
return params
@@ -36,9 +36,9 @@ class SpatialFunction(SpatialOperation):
def __init__(self, func, result='', operator='', **kwargs):
# Getting the function prefix.
- default = {'function' : func,
- 'operator' : operator,
- 'result' : result
+ default = {'function': func,
+ 'operator': operator,
+ 'result': result
}
kwargs.update(default)
super(SpatialFunction, self).__init__(**kwargs)
diff --git a/django/contrib/gis/db/models/fields.py b/django/contrib/gis/db/models/fields.py
index d29705986f..e137ddffb5 100644
--- a/django/contrib/gis/db/models/fields.py
+++ b/django/contrib/gis/db/models/fields.py
@@ -203,9 +203,9 @@ class GeometryField(Field):
return connection.ops.geo_db_type(self)
def formfield(self, **kwargs):
- defaults = {'form_class' : self.form_class,
- 'geom_type' : self.geom_type,
- 'srid' : self.srid,
+ defaults = {'form_class': self.form_class,
+ 'geom_type': self.geom_type,
+ 'srid': self.srid,
}
defaults.update(kwargs)
if (self.dim > 2 and not 'widget' in kwargs and
diff --git a/django/contrib/gis/db/models/query.py b/django/contrib/gis/db/models/query.py
index f418fc8f00..2d13cbecc0 100644
--- a/django/contrib/gis/db/models/query.py
+++ b/django/contrib/gis/db/models/query.py
@@ -41,9 +41,9 @@ class GeoQuerySet(QuerySet):
# Peforming setup here rather than in `_spatial_attribute` so that
# we can get the units for `AreaField`.
procedure_args, geo_field = self._spatial_setup('area', field_name=kwargs.get('field_name', None))
- s = {'procedure_args' : procedure_args,
- 'geo_field' : geo_field,
- 'setup' : False,
+ s = {'procedure_args': procedure_args,
+ 'geo_field': geo_field,
+ 'setup': False,
}
connection = connections[self.db]
backend = connection.ops
@@ -170,9 +170,9 @@ class GeoQuerySet(QuerySet):
options = 1
elif bbox:
options = 2
- s = {'desc' : 'GeoJSON',
- 'procedure_args' : {'precision' : precision, 'options' : options},
- 'procedure_fmt' : '%(geo_col)s,%(precision)s,%(options)s',
+ s = {'desc': 'GeoJSON',
+ 'procedure_args': {'precision': precision, 'options': options},
+ 'procedure_fmt': '%(geo_col)s,%(precision)s,%(options)s',
}
return self._spatial_attribute('geojson', s, **kwargs)
@@ -184,7 +184,7 @@ class GeoQuerySet(QuerySet):
The `precision` keyword may be used to custom the number of
_characters_ used in the output GeoHash, the default is 20.
"""
- s = {'desc' : 'GeoHash',
+ s = {'desc': 'GeoHash',
'procedure_args': {'precision': precision},
'procedure_fmt': '%(geo_col)s,%(precision)s',
}
@@ -196,7 +196,7 @@ class GeoQuerySet(QuerySet):
on each element of the GeoQuerySet.
"""
backend = connections[self.db].ops
- s = {'desc' : 'GML', 'procedure_args' : {'precision' : precision}}
+ s = {'desc': 'GML', 'procedure_args': {'precision': precision}}
if backend.postgis:
# PostGIS AsGML() aggregate function parameter order depends on the
# version -- uggh.
@@ -204,7 +204,7 @@ class GeoQuerySet(QuerySet):
s['procedure_fmt'] = '%(version)s,%(geo_col)s,%(precision)s'
else:
s['procedure_fmt'] = '%(geo_col)s,%(precision)s,%(version)s'
- s['procedure_args'] = {'precision' : precision, 'version' : version}
+ s['procedure_args'] = {'precision': precision, 'version': version}
return self._spatial_attribute('gml', s, **kwargs)
@@ -221,9 +221,9 @@ class GeoQuerySet(QuerySet):
Returns KML representation of the geometry field in a `kml`
attribute on each element of this GeoQuerySet.
"""
- s = {'desc' : 'KML',
- 'procedure_fmt' : '%(geo_col)s,%(precision)s',
- 'procedure_args' : {'precision' : kwargs.pop('precision', 8)},
+ s = {'desc': 'KML',
+ 'procedure_fmt': '%(geo_col)s,%(precision)s',
+ 'procedure_args': {'precision': kwargs.pop('precision', 8)},
}
return self._spatial_attribute('kml', s, **kwargs)
@@ -300,14 +300,14 @@ class GeoQuerySet(QuerySet):
if connections[self.db].ops.spatialite:
if z != 0.0:
raise NotImplementedError('SpatiaLite does not support 3D scaling.')
- s = {'procedure_fmt' : '%(geo_col)s,%(x)s,%(y)s',
- 'procedure_args' : {'x' : x, 'y' : y},
- 'select_field' : GeomField(),
+ s = {'procedure_fmt': '%(geo_col)s,%(x)s,%(y)s',
+ 'procedure_args': {'x': x, 'y': y},
+ 'select_field': GeomField(),
}
else:
- s = {'procedure_fmt' : '%(geo_col)s,%(x)s,%(y)s,%(z)s',
- 'procedure_args' : {'x' : x, 'y' : y, 'z' : z},
- 'select_field' : GeomField(),
+ s = {'procedure_fmt': '%(geo_col)s,%(x)s,%(y)s,%(z)s',
+ 'procedure_args': {'x': x, 'y': y, 'z': z},
+ 'select_field': GeomField(),
}
return self._spatial_attribute('scale', s, **kwargs)
@@ -327,22 +327,22 @@ class GeoQuerySet(QuerySet):
if nargs == 1:
size = args[0]
procedure_fmt = '%(geo_col)s,%(size)s'
- procedure_args = {'size' : size}
+ procedure_args = {'size': size}
elif nargs == 2:
xsize, ysize = args
procedure_fmt = '%(geo_col)s,%(xsize)s,%(ysize)s'
- procedure_args = {'xsize' : xsize, 'ysize' : ysize}
+ procedure_args = {'xsize': xsize, 'ysize': ysize}
elif nargs == 4:
xsize, ysize, xorigin, yorigin = args
procedure_fmt = '%(geo_col)s,%(xorigin)s,%(yorigin)s,%(xsize)s,%(ysize)s'
- procedure_args = {'xsize' : xsize, 'ysize' : ysize,
- 'xorigin' : xorigin, 'yorigin' : yorigin}
+ procedure_args = {'xsize': xsize, 'ysize': ysize,
+ 'xorigin': xorigin, 'yorigin': yorigin}
else:
raise ValueError('Must provide 1, 2, or 4 arguments to `snap_to_grid`.')
- s = {'procedure_fmt' : procedure_fmt,
- 'procedure_args' : procedure_args,
- 'select_field' : GeomField(),
+ s = {'procedure_fmt': procedure_fmt,
+ 'procedure_args': procedure_args,
+ 'select_field': GeomField(),
}
return self._spatial_attribute('snap_to_grid', s, **kwargs)
@@ -362,10 +362,10 @@ class GeoQuerySet(QuerySet):
relative = int(bool(relative))
if not isinstance(precision, six.integer_types):
raise TypeError('SVG precision keyword argument must be an integer.')
- s = {'desc' : 'SVG',
- 'procedure_fmt' : '%(geo_col)s,%(rel)s,%(precision)s',
- 'procedure_args' : {'rel' : relative,
- 'precision' : precision,
+ s = {'desc': 'SVG',
+ 'procedure_fmt': '%(geo_col)s,%(rel)s,%(precision)s',
+ 'procedure_args': {'rel': relative,
+ 'precision': precision,
}
}
return self._spatial_attribute('svg', s, **kwargs)
@@ -385,14 +385,14 @@ class GeoQuerySet(QuerySet):
if connections[self.db].ops.spatialite:
if z != 0.0:
raise NotImplementedError('SpatiaLite does not support 3D translation.')
- s = {'procedure_fmt' : '%(geo_col)s,%(x)s,%(y)s',
- 'procedure_args' : {'x' : x, 'y' : y},
- 'select_field' : GeomField(),
+ s = {'procedure_fmt': '%(geo_col)s,%(x)s,%(y)s',
+ 'procedure_args': {'x': x, 'y': y},
+ 'select_field': GeomField(),
}
else:
- s = {'procedure_fmt' : '%(geo_col)s,%(x)s,%(y)s,%(z)s',
- 'procedure_args' : {'x' : x, 'y' : y, 'z' : z},
- 'select_field' : GeomField(),
+ s = {'procedure_fmt': '%(geo_col)s,%(x)s,%(y)s,%(z)s',
+ 'procedure_args': {'x': x, 'y': y, 'z': z},
+ 'select_field': GeomField(),
}
return self._spatial_attribute('translate', s, **kwargs)
@@ -455,7 +455,7 @@ class GeoQuerySet(QuerySet):
(desc, connection.ops.name))
# Initializing the procedure arguments.
- procedure_args = {'function' : func}
+ procedure_args = {'function': func}
# Is there a geographic field in the model to perform this
# operation on?
@@ -580,7 +580,7 @@ class GeoQuerySet(QuerySet):
# Finally, setting the extra selection attribute with
# the format string expanded with the stored procedure
# arguments.
- return self.extra(select={model_att : fmt % settings['procedure_args']},
+ return self.extra(select={model_att: fmt % settings['procedure_args']},
select_params=settings['select_params'])
def _distance_attribute(self, func, geom=None, tolerance=0.05, spheroid=False, **kwargs):
@@ -695,29 +695,29 @@ class GeoQuerySet(QuerySet):
if spheroid:
# Call to distance_spheroid() requires spheroid param as well.
procedure_fmt += ",'%(spheroid)s'"
- procedure_args.update({'function' : backend.distance_spheroid, 'spheroid' : params[1]})
+ procedure_args.update({'function': backend.distance_spheroid, 'spheroid': params[1]})
else:
- procedure_args.update({'function' : backend.distance_sphere})
+ procedure_args.update({'function': backend.distance_sphere})
elif length or perimeter:
procedure_fmt = '%(geo_col)s'
if not geography and geodetic and length:
# There's no `length_sphere`, and `length_spheroid` also
# works on 3D geometries.
procedure_fmt += ",'%(spheroid)s'"
- procedure_args.update({'function' : backend.length_spheroid, 'spheroid' : params[1]})
+ procedure_args.update({'function': backend.length_spheroid, 'spheroid': params[1]})
elif geom_3d and backend.postgis:
# Use 3D variants of perimeter and length routines on PostGIS.
if perimeter:
- procedure_args.update({'function' : backend.perimeter3d})
+ procedure_args.update({'function': backend.perimeter3d})
elif length:
- procedure_args.update({'function' : backend.length3d})
+ procedure_args.update({'function': backend.length3d})
# Setting up the settings for `_spatial_attribute`.
- s = {'select_field' : DistanceField(dist_att),
- 'setup' : False,
- 'geo_field' : geo_field,
- 'procedure_args' : procedure_args,
- 'procedure_fmt' : procedure_fmt,
+ s = {'select_field': DistanceField(dist_att),
+ 'setup': False,
+ 'geo_field': geo_field,
+ 'procedure_args': procedure_args,
+ 'procedure_fmt': procedure_fmt,
}
if geom_args:
s['geom_args'] = ('geom',)
@@ -736,7 +736,7 @@ class GeoQuerySet(QuerySet):
s = {'select_field': GeomField()}
if connections[self.db].ops.oracle:
s['procedure_fmt'] = '%(geo_col)s,%(tolerance)s'
- s['procedure_args'] = {'tolerance' : tolerance}
+ s['procedure_args'] = {'tolerance': tolerance}
return self._spatial_attribute(func, s, **kwargs)
def _geomset_attribute(self, func, geom, tolerance=0.05, **kwargs):
@@ -746,10 +746,10 @@ class GeoQuerySet(QuerySet):
for geometry set-like operations (e.g., intersection, difference,
union, sym_difference).
"""
- s = {'geom_args' : ('geom',),
- 'select_field' : GeomField(),
- 'procedure_fmt' : '%(geo_col)s,%(geom)s',
- 'procedure_args' : {'geom' : geom},
+ s = {'geom_args': ('geom',),
+ 'select_field': GeomField(),
+ 'procedure_fmt': '%(geo_col)s,%(geom)s',
+ 'procedure_args': {'geom': geom},
}
if connections[self.db].ops.oracle:
s['procedure_fmt'] += ',%(tolerance)s'
diff --git a/django/contrib/gis/db/models/sql/query.py b/django/contrib/gis/db/models/sql/query.py
index d93bada571..b789174525 100644
--- a/django/contrib/gis/db/models/sql/query.py
+++ b/django/contrib/gis/db/models/sql/query.py
@@ -67,9 +67,9 @@ class GeoQuery(sql.Query):
elif isinstance(field, DistanceField):
# Using the field's distance attribute, can instantiate
# `Distance` with the right context.
- value = Distance(**{field.distance_att : value})
+ value = Distance(**{field.distance_att: value})
elif isinstance(field, AreaField):
- value = Area(**{field.area_att : value})
+ value = Area(**{field.area_att: value})
elif isinstance(field, (GeomField, GeometryField)) and value:
value = Geometry(value)
elif field is not None:
diff --git a/django/contrib/gis/feeds.py b/django/contrib/gis/feeds.py
index 14976717ad..1482064fe2 100644
--- a/django/contrib/gis/feeds.py
+++ b/django/contrib/gis/feeds.py
@@ -133,7 +133,7 @@ class Feed(BaseFeed):
feed_type = GeoRSSFeed
def feed_extra_kwargs(self, obj):
- return {'geometry' : self.__get_dynamic_attr('geometry', obj)}
+ return {'geometry': self.__get_dynamic_attr('geometry', obj)}
def item_extra_kwargs(self, item):
- return {'geometry' : self.__get_dynamic_attr('item_geometry', item)}
+ return {'geometry': self.__get_dynamic_attr('item_geometry', item)}
diff --git a/django/contrib/gis/forms/fields.py b/django/contrib/gis/forms/fields.py
index 2e75689010..2445e54715 100644
--- a/django/contrib/gis/forms/fields.py
+++ b/django/contrib/gis/forms/fields.py
@@ -19,10 +19,10 @@ class GeometryField(forms.Field):
geom_type = 'GEOMETRY'
default_error_messages = {
- 'required' : _('No geometry value provided.'),
- 'invalid_geom' : _('Invalid geometry value.'),
- 'invalid_geom_type' : _('Invalid geometry type.'),
- 'transform_error' : _('An error occurred when transforming the geometry '
+ 'required': _('No geometry value provided.'),
+ 'invalid_geom': _('Invalid geometry value.'),
+ 'invalid_geom_type': _('Invalid geometry type.'),
+ 'transform_error': _('An error occurred when transforming the geometry '
'to the SRID of the geometry form field.'),
}
diff --git a/django/contrib/gis/gdal/driver.py b/django/contrib/gis/gdal/driver.py
index cf5bb8bb58..015785b8d1 100644
--- a/django/contrib/gis/gdal/driver.py
+++ b/django/contrib/gis/gdal/driver.py
@@ -15,11 +15,11 @@ class Driver(GDALBase):
"Wraps an OGR Data Source Driver."
# Case-insensitive aliases for OGR Drivers.
- _alias = {'esri' : 'ESRI Shapefile',
- 'shp' : 'ESRI Shapefile',
- 'shape' : 'ESRI Shapefile',
- 'tiger' : 'TIGER',
- 'tiger/line' : 'TIGER',
+ _alias = {'esri': 'ESRI Shapefile',
+ 'shp': 'ESRI Shapefile',
+ 'shape': 'ESRI Shapefile',
+ 'tiger': 'TIGER',
+ 'tiger/line': 'TIGER',
}
def __init__(self, dr_input):
diff --git a/django/contrib/gis/gdal/geometries.py b/django/contrib/gis/gdal/geometries.py
index a6613b0db4..74a4e94450 100644
--- a/django/contrib/gis/gdal/geometries.py
+++ b/django/contrib/gis/gdal/geometries.py
@@ -711,19 +711,19 @@ class MultiPolygon(GeometryCollection):
pass
# Class mapping dictionary (using the OGRwkbGeometryType as the key)
-GEO_CLASSES = {1 : Point,
- 2 : LineString,
- 3 : Polygon,
- 4 : MultiPoint,
- 5 : MultiLineString,
- 6 : MultiPolygon,
- 7 : GeometryCollection,
+GEO_CLASSES = {1: Point,
+ 2: LineString,
+ 3: Polygon,
+ 4: MultiPoint,
+ 5: MultiLineString,
+ 6: MultiPolygon,
+ 7: GeometryCollection,
101: LinearRing,
- 1 + OGRGeomType.wkb25bit : Point,
- 2 + OGRGeomType.wkb25bit : LineString,
- 3 + OGRGeomType.wkb25bit : Polygon,
- 4 + OGRGeomType.wkb25bit : MultiPoint,
- 5 + OGRGeomType.wkb25bit : MultiLineString,
- 6 + OGRGeomType.wkb25bit : MultiPolygon,
- 7 + OGRGeomType.wkb25bit : GeometryCollection,
+ 1 + OGRGeomType.wkb25bit: Point,
+ 2 + OGRGeomType.wkb25bit: LineString,
+ 3 + OGRGeomType.wkb25bit: Polygon,
+ 4 + OGRGeomType.wkb25bit: MultiPoint,
+ 5 + OGRGeomType.wkb25bit: MultiLineString,
+ 6 + OGRGeomType.wkb25bit: MultiPolygon,
+ 7 + OGRGeomType.wkb25bit: GeometryCollection,
}
diff --git a/django/contrib/gis/gdal/geomtype.py b/django/contrib/gis/gdal/geomtype.py
index 1b1547c341..e943a03ee8 100644
--- a/django/contrib/gis/gdal/geomtype.py
+++ b/django/contrib/gis/gdal/geomtype.py
@@ -9,23 +9,23 @@ class OGRGeomType(object):
wkb25bit = -2147483648
# Dictionary of acceptable OGRwkbGeometryType s and their string names.
- _types = {0 : 'Unknown',
- 1 : 'Point',
- 2 : 'LineString',
- 3 : 'Polygon',
- 4 : 'MultiPoint',
- 5 : 'MultiLineString',
- 6 : 'MultiPolygon',
- 7 : 'GeometryCollection',
- 100 : 'None',
- 101 : 'LinearRing',
+ _types = {0: 'Unknown',
+ 1: 'Point',
+ 2: 'LineString',
+ 3: 'Polygon',
+ 4: 'MultiPoint',
+ 5: 'MultiLineString',
+ 6: 'MultiPolygon',
+ 7: 'GeometryCollection',
+ 100: 'None',
+ 101: 'LinearRing',
1 + wkb25bit: 'Point25D',
2 + wkb25bit: 'LineString25D',
3 + wkb25bit: 'Polygon25D',
4 + wkb25bit: 'MultiPoint25D',
- 5 + wkb25bit : 'MultiLineString25D',
- 6 + wkb25bit : 'MultiPolygon25D',
- 7 + wkb25bit : 'GeometryCollection25D',
+ 5 + wkb25bit: 'MultiLineString25D',
+ 6 + wkb25bit: 'MultiPolygon25D',
+ 7 + wkb25bit: 'GeometryCollection25D',
}
# Reverse type dictionary, keyed by lower-case of the name.
_str_types = dict((v.lower(), k) for k, v in _types.items())
diff --git a/django/contrib/gis/gdal/tests/test_driver.py b/django/contrib/gis/gdal/tests/test_driver.py
index af0ecf5dc8..89c65afeb9 100644
--- a/django/contrib/gis/gdal/tests/test_driver.py
+++ b/django/contrib/gis/gdal/tests/test_driver.py
@@ -12,10 +12,10 @@ valid_drivers = ('ESRI Shapefile', 'MapInfo File', 'TIGER', 'S57', 'DGN',
invalid_drivers = ('Foo baz', 'clucka', 'ESRI Shp')
-aliases = {'eSrI' : 'ESRI Shapefile',
- 'TigER/linE' : 'TIGER',
- 'SHAPE' : 'ESRI Shapefile',
- 'sHp' : 'ESRI Shapefile',
+aliases = {'eSrI': 'ESRI Shapefile',
+ 'TigER/linE': 'TIGER',
+ 'SHAPE': 'ESRI Shapefile',
+ 'sHp': 'ESRI Shapefile',
}
diff --git a/django/contrib/gis/geoip/base.py b/django/contrib/gis/geoip/base.py
index 0fb2614b0c..c4188d8819 100644
--- a/django/contrib/gis/geoip/base.py
+++ b/django/contrib/gis/geoip/base.py
@@ -195,8 +195,8 @@ class GeoIP(object):
'24.124.1.80' and 'djangoproject.com' are valid parameters.
"""
# Returning the country code and name
- return {'country_code' : self.country_code(query),
- 'country_name' : self.country_name(query),
+ return {'country_code': self.country_code(query),
+ 'country_name': self.country_name(query),
}
#### Coordinate retrieval routines ####
diff --git a/django/contrib/gis/geoip/tests.py b/django/contrib/gis/geoip/tests.py
index c49ffb5bf1..4e7a990d50 100644
--- a/django/contrib/gis/geoip/tests.py
+++ b/django/contrib/gis/geoip/tests.py
@@ -80,7 +80,7 @@ class GeoIPTest(unittest.TestCase):
self.assertEqual('US', func(query))
for func in (g.country_name, g.country_name_by_addr, g.country_name_by_name):
self.assertEqual('United States', func(query))
- self.assertEqual({'country_code' : 'US', 'country_name' : 'United States'},
+ self.assertEqual({'country_code': 'US', 'country_name': 'United States'},
g.country(query))
@skipUnless(HAS_GEOS, "Geos is required")
@@ -96,7 +96,7 @@ class GeoIPTest(unittest.TestCase):
self.assertEqual('US', func(query))
for func in (g.country_name, g.country_name_by_addr, g.country_name_by_name):
self.assertEqual('United States', func(query))
- self.assertEqual({'country_code' : 'US', 'country_name' : 'United States'},
+ self.assertEqual({'country_code': 'US', 'country_name': 'United States'},
g.country(query))
# City information dictionary.
diff --git a/django/contrib/gis/geos/geometry.py b/django/contrib/gis/geos/geometry.py
index 7965fffa79..073415abea 100644
--- a/django/contrib/gis/geos/geometry.py
+++ b/django/contrib/gis/geos/geometry.py
@@ -707,14 +707,14 @@ from django.contrib.gis.geos.linestring import LineString, LinearRing
from django.contrib.gis.geos.point import Point
from django.contrib.gis.geos.polygon import Polygon
from django.contrib.gis.geos.collections import GeometryCollection, MultiPoint, MultiLineString, MultiPolygon
-GEOS_CLASSES = {0 : Point,
- 1 : LineString,
- 2 : LinearRing,
- 3 : Polygon,
- 4 : MultiPoint,
- 5 : MultiLineString,
- 6 : MultiPolygon,
- 7 : GeometryCollection,
+GEOS_CLASSES = {0: Point,
+ 1: LineString,
+ 2: LinearRing,
+ 3: Polygon,
+ 4: MultiPoint,
+ 5: MultiLineString,
+ 6: MultiPolygon,
+ 7: GeometryCollection,
}
# If supported, import the PreparedGeometry class.
diff --git a/django/contrib/gis/geos/tests/test_geos.py b/django/contrib/gis/geos/tests/test_geos.py
index 8e1552539f..9c24f614df 100644
--- a/django/contrib/gis/geos/tests/test_geos.py
+++ b/django/contrib/gis/geos/tests/test_geos.py
@@ -239,7 +239,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
# an invalid type.
for g in (p, ls):
self.assertNotEqual(g, None)
- self.assertNotEqual(g, {'foo' : 'bar'})
+ self.assertNotEqual(g, {'foo': 'bar'})
self.assertNotEqual(g, False)
def test_points(self):
diff --git a/django/contrib/gis/management/commands/ogrinspect.py b/django/contrib/gis/management/commands/ogrinspect.py
index af2d585f28..1c6482e3b5 100644
--- a/django/contrib/gis/management/commands/ogrinspect.py
+++ b/django/contrib/gis/management/commands/ogrinspect.py
@@ -103,9 +103,9 @@ class Command(LabelCommand):
if show_mapping:
# Constructing the keyword arguments for `mapping`, and
# calling it on the data source.
- kwargs = {'geom_name' : options['geom_name'],
- 'layer_key' : options['layer_key'],
- 'multi_geom' : options['multi_geom'],
+ kwargs = {'geom_name': options['geom_name'],
+ 'layer_key': options['layer_key'],
+ 'multi_geom': options['multi_geom'],
}
mapping_dict = mapping(ds, **kwargs)
# This extra legwork is so that the dictionary definition comes
diff --git a/django/contrib/gis/maps/google/gmap.py b/django/contrib/gis/maps/google/gmap.py
index 89b625378d..590b9999af 100644
--- a/django/contrib/gis/maps/google/gmap.py
+++ b/django/contrib/gis/maps/google/gmap.py
@@ -98,16 +98,16 @@ class GoogleMap(object):
"""
Generates the JavaScript necessary for displaying this Google Map.
"""
- params = {'calc_zoom' : self.calc_zoom,
- 'center' : self.center,
- 'dom_id' : self.dom_id,
- 'js_module' : self.js_module,
- 'kml_urls' : self.kml_urls,
- 'zoom' : self.zoom,
- 'polygons' : self.polygons,
- 'polylines' : self.polylines,
+ params = {'calc_zoom': self.calc_zoom,
+ 'center': self.center,
+ 'dom_id': self.dom_id,
+ 'js_module': self.js_module,
+ 'kml_urls': self.kml_urls,
+ 'zoom': self.zoom,
+ 'polygons': self.polygons,
+ 'polylines': self.polylines,
'icons': self.icons,
- 'markers' : self.markers,
+ 'markers': self.markers,
}
params.update(self.extra_context)
return render_to_string(self.template, params)
@@ -211,10 +211,10 @@ class GoogleMapSet(GoogleMap):
Generates the JavaScript for the collection of Google Maps in
this set.
"""
- params = {'js_module' : self.js_module,
- 'dom_ids' : self.dom_ids,
- 'load_map_js' : self.load_map_js(),
- 'icons' : self.icons,
+ params = {'js_module': self.js_module,
+ 'dom_ids': self.dom_ids,
+ 'load_map_js': self.load_map_js(),
+ 'icons': self.icons,
}
params.update(self.extra_context)
return render_to_string(self.template, params)
diff --git a/django/contrib/gis/measure.py b/django/contrib/gis/measure.py
index a63e4eef9d..82d75e0cef 100644
--- a/django/contrib/gis/measure.py
+++ b/django/contrib/gis/measure.py
@@ -221,77 +221,77 @@ class MeasureBase(object):
class Distance(MeasureBase):
STANDARD_UNIT = "m"
UNITS = {
- 'chain' : 20.1168,
- 'chain_benoit' : 20.116782,
- 'chain_sears' : 20.1167645,
- 'british_chain_benoit' : 20.1167824944,
- 'british_chain_sears' : 20.1167651216,
- 'british_chain_sears_truncated' : 20.116756,
- 'cm' : 0.01,
- 'british_ft' : 0.304799471539,
- 'british_yd' : 0.914398414616,
- 'clarke_ft' : 0.3047972654,
- 'clarke_link' : 0.201166195164,
- 'fathom' : 1.8288,
+ 'chain': 20.1168,
+ 'chain_benoit': 20.116782,
+ 'chain_sears': 20.1167645,
+ 'british_chain_benoit': 20.1167824944,
+ 'british_chain_sears': 20.1167651216,
+ 'british_chain_sears_truncated': 20.116756,
+ 'cm': 0.01,
+ 'british_ft': 0.304799471539,
+ 'british_yd': 0.914398414616,
+ 'clarke_ft': 0.3047972654,
+ 'clarke_link': 0.201166195164,
+ 'fathom': 1.8288,
'ft': 0.3048,
- 'german_m' : 1.0000135965,
- 'gold_coast_ft' : 0.304799710181508,
- 'indian_yd' : 0.914398530744,
- 'inch' : 0.0254,
+ 'german_m': 1.0000135965,
+ 'gold_coast_ft': 0.304799710181508,
+ 'indian_yd': 0.914398530744,
+ 'inch': 0.0254,
'km': 1000.0,
- 'link' : 0.201168,
- 'link_benoit' : 0.20116782,
- 'link_sears' : 0.20116765,
+ 'link': 0.201168,
+ 'link_benoit': 0.20116782,
+ 'link_sears': 0.20116765,
'm': 1.0,
'mi': 1609.344,
- 'mm' : 0.001,
+ 'mm': 0.001,
'nm': 1852.0,
- 'nm_uk' : 1853.184,
- 'rod' : 5.0292,
- 'sears_yd' : 0.91439841,
- 'survey_ft' : 0.304800609601,
- 'um' : 0.000001,
+ 'nm_uk': 1853.184,
+ 'rod': 5.0292,
+ 'sears_yd': 0.91439841,
+ 'survey_ft': 0.304800609601,
+ 'um': 0.000001,
'yd': 0.9144,
}
# Unit aliases for `UNIT` terms encountered in Spatial Reference WKT.
ALIAS = {
- 'centimeter' : 'cm',
- 'foot' : 'ft',
- 'inches' : 'inch',
- 'kilometer' : 'km',
- 'kilometre' : 'km',
- 'meter' : 'm',
- 'metre' : 'm',
- 'micrometer' : 'um',
- 'micrometre' : 'um',
- 'millimeter' : 'mm',
- 'millimetre' : 'mm',
- 'mile' : 'mi',
- 'yard' : 'yd',
- 'British chain (Benoit 1895 B)' : 'british_chain_benoit',
- 'British chain (Sears 1922)' : 'british_chain_sears',
- 'British chain (Sears 1922 truncated)' : 'british_chain_sears_truncated',
- 'British foot (Sears 1922)' : 'british_ft',
- 'British foot' : 'british_ft',
- 'British yard (Sears 1922)' : 'british_yd',
- 'British yard' : 'british_yd',
- "Clarke's Foot" : 'clarke_ft',
- "Clarke's link" : 'clarke_link',
- 'Chain (Benoit)' : 'chain_benoit',
- 'Chain (Sears)' : 'chain_sears',
- 'Foot (International)' : 'ft',
- 'German legal metre' : 'german_m',
- 'Gold Coast foot' : 'gold_coast_ft',
- 'Indian yard' : 'indian_yd',
+ 'centimeter': 'cm',
+ 'foot': 'ft',
+ 'inches': 'inch',
+ 'kilometer': 'km',
+ 'kilometre': 'km',
+ 'meter': 'm',
+ 'metre': 'm',
+ 'micrometer': 'um',
+ 'micrometre': 'um',
+ 'millimeter': 'mm',
+ 'millimetre': 'mm',
+ 'mile': 'mi',
+ 'yard': 'yd',
+ 'British chain (Benoit 1895 B)': 'british_chain_benoit',
+ 'British chain (Sears 1922)': 'british_chain_sears',
+ 'British chain (Sears 1922 truncated)': 'british_chain_sears_truncated',
+ 'British foot (Sears 1922)': 'british_ft',
+ 'British foot': 'british_ft',
+ 'British yard (Sears 1922)': 'british_yd',
+ 'British yard': 'british_yd',
+ "Clarke's Foot": 'clarke_ft',
+ "Clarke's link": 'clarke_link',
+ 'Chain (Benoit)': 'chain_benoit',
+ 'Chain (Sears)': 'chain_sears',
+ 'Foot (International)': 'ft',
+ 'German legal metre': 'german_m',
+ 'Gold Coast foot': 'gold_coast_ft',
+ 'Indian yard': 'indian_yd',
'Link (Benoit)': 'link_benoit',
'Link (Sears)': 'link_sears',
- 'Nautical Mile' : 'nm',
- 'Nautical Mile (UK)' : 'nm_uk',
- 'US survey foot' : 'survey_ft',
- 'U.S. Foot' : 'survey_ft',
- 'Yard (Indian)' : 'indian_yd',
- 'Yard (Sears)' : 'sears_yd'
+ 'Nautical Mile': 'nm',
+ 'Nautical Mile (UK)': 'nm_uk',
+ 'US survey foot': 'survey_ft',
+ 'U.S. Foot': 'survey_ft',
+ 'Yard (Indian)': 'indian_yd',
+ 'Yard (Sears)': 'sears_yd'
}
LALIAS = dict((k.lower(), v) for k, v in ALIAS.items())
diff --git a/django/contrib/gis/sitemaps/kml.py b/django/contrib/gis/sitemaps/kml.py
index 1f3a567025..68e2ffd7d9 100644
--- a/django/contrib/gis/sitemaps/kml.py
+++ b/django/contrib/gis/sitemaps/kml.py
@@ -55,8 +55,8 @@ class KMLSitemap(Sitemap):
def location(self, obj):
return urlresolvers.reverse('django.contrib.gis.sitemaps.views.%s' % self.geo_format,
- kwargs={'label' : obj[0],
- 'model' : obj[1],
+ kwargs={'label': obj[0],
+ 'model': obj[1],
'field_name': obj[2],
}
)
diff --git a/django/contrib/gis/sitemaps/views.py b/django/contrib/gis/sitemaps/views.py
index e184f4c6b6..dac63658e6 100644
--- a/django/contrib/gis/sitemaps/views.py
+++ b/django/contrib/gis/sitemaps/views.py
@@ -106,7 +106,7 @@ def kml(request, label, model, field_name=None, compress=False, using=DEFAULT_DB
render = render_to_kmz
else:
render = render_to_kml
- return render('gis/kml/placemarks.kml', {'places' : placemarks})
+ return render('gis/kml/placemarks.kml', {'places': placemarks})
def kmz(request, label, model, field_name=None, using=DEFAULT_DB_ALIAS):
"""
diff --git a/django/contrib/gis/tests/geo3d/tests.py b/django/contrib/gis/tests/geo3d/tests.py
index f9a8eb5760..c294ca1790 100644
--- a/django/contrib/gis/tests/geo3d/tests.py
+++ b/django/contrib/gis/tests/geo3d/tests.py
@@ -46,10 +46,10 @@ city_dict = dict((name, coords) for name, coords in city_data)
interstate_data = (
('I-45',
'LINESTRING(-95.3708481 29.7765870 11.339,-95.3694580 29.7787980 4.536,-95.3690305 29.7797359 9.762,-95.3691886 29.7812450 12.448,-95.3696447 29.7850144 10.457,-95.3702511 29.7868518 9.418,-95.3706724 29.7881286 14.858,-95.3711632 29.7896157 15.386,-95.3714525 29.7936267 13.168,-95.3717848 29.7955007 15.104,-95.3717719 29.7969804 16.516,-95.3717305 29.7982117 13.923,-95.3717254 29.8000778 14.385,-95.3719875 29.8013539 15.160,-95.3720575 29.8026785 15.544,-95.3721321 29.8040912 14.975,-95.3722074 29.8050998 15.688,-95.3722779 29.8060430 16.099,-95.3733818 29.8076750 15.197,-95.3741563 29.8103686 17.268,-95.3749458 29.8129927 19.857,-95.3763564 29.8144557 15.435)',
- (11.339, 4.536, 9.762, 12.448, 10.457, 9.418, 14.858,
- 15.386, 13.168, 15.104, 16.516, 13.923, 14.385, 15.16 ,
- 15.544, 14.975, 15.688, 16.099, 15.197, 17.268, 19.857,
- 15.435),
+ (11.339, 4.536, 9.762, 12.448, 10.457, 9.418, 14.858,
+ 15.386, 13.168, 15.104, 16.516, 13.923, 14.385, 15.16,
+ 15.544, 14.975, 15.688, 16.099, 15.197, 17.268, 19.857,
+ 15.435),
),
)
@@ -131,8 +131,8 @@ class Geo3DTest(TestCase):
"""
Testing LayerMapping on 3D models.
"""
- point_mapping = {'point' : 'POINT'}
- mpoint_mapping = {'mpoint' : 'MULTIPOINT'}
+ point_mapping = {'point': 'POINT'}
+ mpoint_mapping = {'mpoint': 'MULTIPOINT'}
# The VRT is 3D, but should still be able to map sans the Z.
lm = LayerMapping(Point2D, vrt_file, point_mapping, transform=False)
diff --git a/django/contrib/gis/tests/geoapp/feeds.py b/django/contrib/gis/tests/geoapp/feeds.py
index 9ec959ecce..a59593061f 100644
--- a/django/contrib/gis/tests/geoapp/feeds.py
+++ b/django/contrib/gis/tests/geoapp/feeds.py
@@ -56,11 +56,11 @@ class TestW3CGeo3(TestGeoRSS1):
# The feed dictionary to use for URLs.
feed_dict = {
- 'rss1' : TestGeoRSS1,
- 'rss2' : TestGeoRSS2,
- 'atom1' : TestGeoAtom1,
- 'atom2' : TestGeoAtom2,
- 'w3cgeo1' : TestW3CGeo1,
- 'w3cgeo2' : TestW3CGeo2,
- 'w3cgeo3' : TestW3CGeo3,
+ 'rss1': TestGeoRSS1,
+ 'rss2': TestGeoRSS2,
+ 'atom1': TestGeoAtom1,
+ 'atom2': TestGeoAtom2,
+ 'w3cgeo1': TestW3CGeo1,
+ 'w3cgeo2': TestW3CGeo2,
+ 'w3cgeo3': TestW3CGeo3,
}
diff --git a/django/contrib/gis/tests/geoapp/sitemaps.py b/django/contrib/gis/tests/geoapp/sitemaps.py
index 55bf7c764c..68490ace2f 100644
--- a/django/contrib/gis/tests/geoapp/sitemaps.py
+++ b/django/contrib/gis/tests/geoapp/sitemaps.py
@@ -4,7 +4,7 @@ from .feeds import feed_dict
from .models import City, Country
-sitemaps = {'kml' : KMLSitemap([City, Country]),
- 'kmz' : KMZSitemap([City, Country]),
- 'georss' : GeoRSSSitemap(feed_dict),
+sitemaps = {'kml': KMLSitemap([City, Country]),
+ 'kmz': KMZSitemap([City, Country]),
+ 'georss': GeoRSSSitemap(feed_dict),
}
diff --git a/django/contrib/gis/tests/geoapp/test_regress.py b/django/contrib/gis/tests/geoapp/test_regress.py
index 37c6a33732..3bd74b00d1 100644
--- a/django/contrib/gis/tests/geoapp/test_regress.py
+++ b/django/contrib/gis/tests/geoapp/test_regress.py
@@ -33,11 +33,11 @@ class GeoRegressionTests(TestCase):
def test_kmz(self):
"Testing `render_to_kmz` with non-ASCII data. See #11624."
name = "Åland Islands"
- places = [{'name' : name,
- 'description' : name,
- 'kml' : '<Point><coordinates>5.0,23.0</coordinates></Point>'
+ places = [{'name': name,
+ 'description': name,
+ 'kml': '<Point><coordinates>5.0,23.0</coordinates></Point>'
}]
- render_to_kmz('gis/kml/placemarks.kml', {'places' : places})
+ render_to_kmz('gis/kml/placemarks.kml', {'places': places})
@no_spatialite
@no_mysql
diff --git a/django/contrib/gis/tests/geoapp/tests.py b/django/contrib/gis/tests/geoapp/tests.py
index a3f673d5f0..4b20c4b2c8 100644
--- a/django/contrib/gis/tests/geoapp/tests.py
+++ b/django/contrib/gis/tests/geoapp/tests.py
@@ -534,7 +534,7 @@ class GeoQuerySetTest(TestCase):
def test_gml(self):
"Testing GML output from the database using GeoQuerySet.gml()."
- if mysql or (spatialite and not connection.ops.gml) :
+ if mysql or (spatialite and not connection.ops.gml):
self.assertRaises(NotImplementedError, Country.objects.all().gml, field_name='mpoly')
return
@@ -635,15 +635,15 @@ class GeoQuerySetTest(TestCase):
# Reference values.
if oracle:
# SELECT SDO_UTIL.TO_WKTGEOMETRY(SDO_GEOM.SDO_POINTONSURFACE(GEOAPP_COUNTRY.MPOLY, 0.05)) FROM GEOAPP_COUNTRY;
- ref = {'New Zealand' : fromstr('POINT (174.616364 -36.100861)', srid=4326),
- 'Texas' : fromstr('POINT (-103.002434 36.500397)', srid=4326),
+ ref = {'New Zealand': fromstr('POINT (174.616364 -36.100861)', srid=4326),
+ 'Texas': fromstr('POINT (-103.002434 36.500397)', srid=4326),
}
elif postgis or spatialite:
# Using GEOSGeometry to compute the reference point on surface values
# -- since PostGIS also uses GEOS these should be the same.
- ref = {'New Zealand' : Country.objects.get(name='New Zealand').mpoly.point_on_surface,
- 'Texas' : Country.objects.get(name='Texas').mpoly.point_on_surface
+ ref = {'New Zealand': Country.objects.get(name='New Zealand').mpoly.point_on_surface,
+ 'Texas': Country.objects.get(name='Texas').mpoly.point_on_surface
}
for c in Country.objects.point_on_surface():
diff --git a/django/contrib/gis/tests/geoapp/urls.py b/django/contrib/gis/tests/geoapp/urls.py
index 70db62d71b..6aba9e525a 100644
--- a/django/contrib/gis/tests/geoapp/urls.py
+++ b/django/contrib/gis/tests/geoapp/urls.py
@@ -11,8 +11,8 @@ urlpatterns = patterns('',
)
urlpatterns += patterns('django.contrib.gis.sitemaps.views',
- (r'^sitemap.xml$', 'index', {'sitemaps' : sitemaps}),
- (r'^sitemaps/(?P<section>\w+)\.xml$', 'sitemap', {'sitemaps' : sitemaps}),
+ (r'^sitemap.xml$', 'index', {'sitemaps': sitemaps}),
+ (r'^sitemaps/(?P<section>\w+)\.xml$', 'sitemap', {'sitemaps': sitemaps}),
(r'^sitemaps/kml/(?P<label>\w+)/(?P<model>\w+)/(?P<field_name>\w+)\.kml$', 'kml'),
(r'^sitemaps/kml/(?P<label>\w+)/(?P<model>\w+)/(?P<field_name>\w+)\.kmz$', 'kmz'),
)
diff --git a/django/contrib/gis/tests/geogapp/tests.py b/django/contrib/gis/tests/geogapp/tests.py
index cd79b601c9..83c73dfd4d 100644
--- a/django/contrib/gis/tests/geogapp/tests.py
+++ b/django/contrib/gis/tests/geogapp/tests.py
@@ -69,9 +69,9 @@ class GeographyTest(TestCase):
# Getting the shapefile and mapping dictionary.
shp_path = os.path.realpath(os.path.join(os.path.dirname(upath(__file__)), '..', 'data'))
co_shp = os.path.join(shp_path, 'counties', 'counties.shp')
- co_mapping = {'name' : 'Name',
- 'state' : 'State',
- 'mpoly' : 'MULTIPOLYGON',
+ co_mapping = {'name': 'Name',
+ 'state': 'State',
+ 'mpoly': 'MULTIPOLYGON',
}
# Reference county names, number of polygons, and state names.
diff --git a/django/contrib/gis/tests/layermap/models.py b/django/contrib/gis/tests/layermap/models.py
index fe8326dac5..24048aa796 100644
--- a/django/contrib/gis/tests/layermap/models.py
+++ b/django/contrib/gis/tests/layermap/models.py
@@ -48,23 +48,23 @@ class Invalid(models.Model):
point = models.PointField()
# Mapping dictionaries for the models above.
-co_mapping = {'name' : 'Name',
- 'state' : {'name' : 'State'}, # ForeignKey's use another mapping dictionary for the _related_ Model (State in this case).
- 'mpoly' : 'MULTIPOLYGON', # Will convert POLYGON features into MULTIPOLYGONS.
+co_mapping = {'name': 'Name',
+ 'state': {'name': 'State'}, # ForeignKey's use another mapping dictionary for the _related_ Model (State in this case).
+ 'mpoly': 'MULTIPOLYGON', # Will convert POLYGON features into MULTIPOLYGONS.
}
-cofeat_mapping = {'name' : 'Name',
- 'poly' : 'POLYGON',
+cofeat_mapping = {'name': 'Name',
+ 'poly': 'POLYGON',
}
-city_mapping = {'name' : 'Name',
- 'population' : 'Population',
- 'density' : 'Density',
- 'dt' : 'Created',
- 'point' : 'POINT',
+city_mapping = {'name': 'Name',
+ 'population': 'Population',
+ 'density': 'Density',
+ 'dt': 'Created',
+ 'point': 'POINT',
}
-inter_mapping = {'name' : 'Name',
- 'length' : 'Length',
- 'path' : 'LINESTRING',
+inter_mapping = {'name': 'Name',
+ 'length': 'Length',
+ 'path': 'LINESTRING',
}
diff --git a/django/contrib/gis/tests/layermap/tests.py b/django/contrib/gis/tests/layermap/tests.py
index e32ab8c22d..d352e96bd2 100644
--- a/django/contrib/gis/tests/layermap/tests.py
+++ b/django/contrib/gis/tests/layermap/tests.py
@@ -166,7 +166,7 @@ class LayerMapTest(TestCase):
bad_fk_map1 = copy(co_mapping)
bad_fk_map1['state'] = 'name'
bad_fk_map2 = copy(co_mapping)
- bad_fk_map2['state'] = {'nombre' : 'State'}
+ bad_fk_map2['state'] = {'nombre': 'State'}
self.assertRaises(TypeError, LayerMapping, County, co_shp, bad_fk_map1, transform=False)
self.assertRaises(LayerMapError, LayerMapping, County, co_shp, bad_fk_map2, transform=False)
@@ -262,11 +262,11 @@ class LayerMapTest(TestCase):
def test_model_inheritance(self):
"Tests LayerMapping on inherited models. See #12093."
- icity_mapping = {'name' : 'Name',
- 'population' : 'Population',
- 'density' : 'Density',
- 'point' : 'POINT',
- 'dt' : 'Created',
+ icity_mapping = {'name': 'Name',
+ 'population': 'Population',
+ 'density': 'Density',
+ 'point': 'POINT',
+ 'dt': 'Created',
}
# Parent model has geometry field.
diff --git a/django/contrib/gis/tests/test_spatialrefsys.py b/django/contrib/gis/tests/test_spatialrefsys.py
index 8baa894418..281ec16672 100644
--- a/django/contrib/gis/tests/test_spatialrefsys.py
+++ b/django/contrib/gis/tests/test_spatialrefsys.py
@@ -6,29 +6,29 @@ from django.contrib.gis.tests.utils import (no_mysql, oracle, postgis,
from django.utils import six
-test_srs = ({'srid' : 4326,
- 'auth_name' : ('EPSG', True),
- 'auth_srid' : 4326,
+test_srs = ({'srid': 4326,
+ 'auth_name': ('EPSG', True),
+ 'auth_srid': 4326,
# Only the beginning, because there are differences depending on installed libs
- 'srtext' : 'GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84"',
+ 'srtext': 'GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84"',
# +ellps=WGS84 has been removed in the 4326 proj string in proj-4.8
- 'proj4_re' : r'\+proj=longlat (\+ellps=WGS84 )?\+datum=WGS84 \+no_defs ',
- 'spheroid' : 'WGS 84', 'name' : 'WGS 84',
- 'geographic' : True, 'projected' : False, 'spatialite' : True,
- 'ellipsoid' : (6378137.0, 6356752.3, 298.257223563), # From proj's "cs2cs -le" and Wikipedia (semi-minor only)
- 'eprec' : (1, 1, 9),
+ 'proj4_re': r'\+proj=longlat (\+ellps=WGS84 )?\+datum=WGS84 \+no_defs ',
+ 'spheroid': 'WGS 84', 'name': 'WGS 84',
+ 'geographic': True, 'projected': False, 'spatialite': True,
+ 'ellipsoid': (6378137.0, 6356752.3, 298.257223563), # From proj's "cs2cs -le" and Wikipedia (semi-minor only)
+ 'eprec': (1, 1, 9),
},
- {'srid' : 32140,
- 'auth_name' : ('EPSG', False),
- 'auth_srid' : 32140,
- 'srtext' : 'PROJCS["NAD83 / Texas South Central",GEOGCS["NAD83",DATUM["North_American_Datum_1983",SPHEROID["GRS 1980"',
- 'proj4_re' : r'\+proj=lcc \+lat_1=30.28333333333333 \+lat_2=28.38333333333333 \+lat_0=27.83333333333333 '
+ {'srid': 32140,
+ 'auth_name': ('EPSG', False),
+ 'auth_srid': 32140,
+ 'srtext': 'PROJCS["NAD83 / Texas South Central",GEOGCS["NAD83",DATUM["North_American_Datum_1983",SPHEROID["GRS 1980"',
+ 'proj4_re': r'\+proj=lcc \+lat_1=30.28333333333333 \+lat_2=28.38333333333333 \+lat_0=27.83333333333333 '
r'\+lon_0=-99 \+x_0=600000 \+y_0=4000000 (\+ellps=GRS80 )?'
r'(\+datum=NAD83 |\+towgs84=0,0,0,0,0,0,0 )?\+units=m \+no_defs ',
- 'spheroid' : 'GRS 1980', 'name' : 'NAD83 / Texas South Central',
- 'geographic' : False, 'projected' : True, 'spatialite' : False,
- 'ellipsoid' : (6378137.0, 6356752.31414, 298.257222101), # From proj's "cs2cs -le" and Wikipedia (semi-minor only)
- 'eprec' : (1, 5, 10),
+ 'spheroid': 'GRS 1980', 'name': 'NAD83 / Texas South Central',
+ 'geographic': False, 'projected': True, 'spatialite': False,
+ 'ellipsoid': (6378137.0, 6356752.31414, 298.257222101), # From proj's "cs2cs -le" and Wikipedia (semi-minor only)
+ 'eprec': (1, 5, 10),
},
)
diff --git a/django/contrib/gis/utils/layermapping.py b/django/contrib/gis/utils/layermapping.py
index 2ce525aa8c..f46511c6c3 100644
--- a/django/contrib/gis/utils/layermapping.py
+++ b/django/contrib/gis/utils/layermapping.py
@@ -40,32 +40,32 @@ class LayerMapping(object):
"A class that maps OGR Layers to GeoDjango Models."
# Acceptable 'base' types for a multi-geometry type.
- MULTI_TYPES = {1 : OGRGeomType('MultiPoint'),
- 2 : OGRGeomType('MultiLineString'),
- 3 : OGRGeomType('MultiPolygon'),
- OGRGeomType('Point25D').num : OGRGeomType('MultiPoint25D'),
- OGRGeomType('LineString25D').num : OGRGeomType('MultiLineString25D'),
- OGRGeomType('Polygon25D').num : OGRGeomType('MultiPolygon25D'),
+ MULTI_TYPES = {1: OGRGeomType('MultiPoint'),
+ 2: OGRGeomType('MultiLineString'),
+ 3: OGRGeomType('MultiPolygon'),
+ OGRGeomType('Point25D').num: OGRGeomType('MultiPoint25D'),
+ OGRGeomType('LineString25D').num: OGRGeomType('MultiLineString25D'),
+ OGRGeomType('Polygon25D').num: OGRGeomType('MultiPolygon25D'),
}
# Acceptable Django field types and corresponding acceptable OGR
# counterparts.
FIELD_TYPES = {
- models.AutoField : OFTInteger,
- models.IntegerField : (OFTInteger, OFTReal, OFTString),
- models.FloatField : (OFTInteger, OFTReal),
- models.DateField : OFTDate,
- models.DateTimeField : OFTDateTime,
- models.EmailField : OFTString,
- models.TimeField : OFTTime,
- models.DecimalField : (OFTInteger, OFTReal),
- models.CharField : OFTString,
- models.SlugField : OFTString,
- models.TextField : OFTString,
- models.URLField : OFTString,
- models.BigIntegerField : (OFTInteger, OFTReal, OFTString),
- models.SmallIntegerField : (OFTInteger, OFTReal, OFTString),
- models.PositiveSmallIntegerField : (OFTInteger, OFTReal, OFTString),
+ models.AutoField: OFTInteger,
+ models.IntegerField: (OFTInteger, OFTReal, OFTString),
+ models.FloatField: (OFTInteger, OFTReal),
+ models.DateField: OFTDate,
+ models.DateTimeField: OFTDateTime,
+ models.EmailField: OFTString,
+ models.TimeField: OFTTime,
+ models.DecimalField: (OFTInteger, OFTReal),
+ models.CharField: OFTString,
+ models.SlugField: OFTString,
+ models.TextField: OFTString,
+ models.URLField: OFTString,
+ models.BigIntegerField: (OFTInteger, OFTReal, OFTString),
+ models.SmallIntegerField: (OFTInteger, OFTReal, OFTString),
+ models.PositiveSmallIntegerField: (OFTInteger, OFTReal, OFTString),
}
def __init__(self, model, data, mapping, layer=0,
@@ -322,7 +322,7 @@ class LayerMapping(object):
of the feature kwargs.
"""
if isinstance(self.unique, six.string_types):
- return {self.unique : kwargs[self.unique]}
+ return {self.unique: kwargs[self.unique]}
else:
return dict((fld, kwargs[fld]) for fld in self.unique)
diff --git a/django/contrib/gis/utils/srs.py b/django/contrib/gis/utils/srs.py
index 974ffdf77c..7b02219ac3 100644
--- a/django/contrib/gis/utils/srs.py
+++ b/django/contrib/gis/utils/srs.py
@@ -56,10 +56,10 @@ def add_srs_entry(srs, auth_name='EPSG', auth_srid=None, ref_sys_name=None,
# Initializing the keyword arguments dictionary for both PostGIS
# and SpatiaLite.
- kwargs = {'srid' : srs.srid,
- 'auth_name' : auth_name,
- 'auth_srid' : auth_srid or srs.srid,
- 'proj4text' : srs.proj4,
+ kwargs = {'srid': srs.srid,
+ 'auth_name': auth_name,
+ 'auth_srid': auth_srid or srs.srid,
+ 'proj4text': srs.proj4,
}
# Backend-specific fields for the SpatialRefSys model.
diff --git a/django/contrib/sites/management.py b/django/contrib/sites/management.py
index d9e3a2126c..a4a0090dab 100644
--- a/django/contrib/sites/management.py
+++ b/django/contrib/sites/management.py
@@ -11,7 +11,7 @@ from django.core.management.color import no_style
def create_default_site(app, created_models, verbosity, db, **kwargs):
# Only create the default sites in databases where Django created the table
- if Site in created_models and router.allow_migrate(db, Site) :
+ if Site in created_models and router.allow_migrate(db, Site):
# The default settings set SITE_ID = 1, and some tests in Django's test
# suite rely on this value. However, if database sequences are reused
# (e.g. in the test suite after flush/syncdb), it isn't guaranteed that
diff --git a/django/core/serializers/__init__.py b/django/core/serializers/__init__.py
index bac73378b8..d8e573a730 100644
--- a/django/core/serializers/__init__.py
+++ b/django/core/serializers/__init__.py
@@ -10,8 +10,8 @@ Usage::
To add your own serializers, use the SERIALIZATION_MODULES setting::
SERIALIZATION_MODULES = {
- "csv" : "path.to.csv.serializer",
- "txt" : "path.to.txt.serializer",
+ "csv": "path.to.csv.serializer",
+ "txt": "path.to.txt.serializer",
}
"""
@@ -24,10 +24,10 @@ from django.core.serializers.base import SerializerDoesNotExist
# Built-in serializers
BUILTIN_SERIALIZERS = {
- "xml" : "django.core.serializers.xml_serializer",
- "python" : "django.core.serializers.python",
- "json" : "django.core.serializers.json",
- "yaml" : "django.core.serializers.pyyaml",
+ "xml": "django.core.serializers.xml_serializer",
+ "python": "django.core.serializers.python",
+ "json": "django.core.serializers.json",
+ "yaml": "django.core.serializers.pyyaml",
}
_serializers = {}
diff --git a/django/core/serializers/xml_serializer.py b/django/core/serializers/xml_serializer.py
index c160730405..b1b7357f6b 100644
--- a/django/core/serializers/xml_serializer.py
+++ b/django/core/serializers/xml_serializer.py
@@ -28,7 +28,7 @@ class Serializer(base.Serializer):
"""
self.xml = SimplerXMLGenerator(self.stream, self.options.get("encoding", settings.DEFAULT_CHARSET))
self.xml.startDocument()
- self.xml.startElement("django-objects", {"version" : "1.0"})
+ self.xml.startElement("django-objects", {"version": "1.0"})
def end_serialization(self):
"""
@@ -68,8 +68,8 @@ class Serializer(base.Serializer):
"""
self.indent(2)
self.xml.startElement("field", {
- "name" : field.name,
- "type" : field.get_internal_type()
+ "name": field.name,
+ "type": field.get_internal_type()
})
# Get a "string version" of the object's data.
@@ -125,7 +125,7 @@ class Serializer(base.Serializer):
else:
def handle_m2m(value):
self.xml.addQuickElement("object", attrs={
- 'pk' : smart_text(value._get_pk_val())
+ 'pk': smart_text(value._get_pk_val())
})
for relobj in getattr(obj, field.name).iterator():
handle_m2m(relobj)
@@ -138,9 +138,9 @@ class Serializer(base.Serializer):
"""
self.indent(2)
self.xml.startElement("field", {
- "name" : field.name,
- "rel" : field.rel.__class__.__name__,
- "to" : smart_text(field.rel.to._meta),
+ "name": field.name,
+ "rel": field.rel.__class__.__name__,
+ "to": smart_text(field.rel.to._meta),
})
class Deserializer(base.Deserializer):
diff --git a/django/core/urlresolvers.py b/django/core/urlresolvers.py
index e3f1e3ecb5..d20f27e73f 100644
--- a/django/core/urlresolvers.py
+++ b/django/core/urlresolvers.py
@@ -331,7 +331,7 @@ class RegexURLResolver(LocaleRegexProvider):
return ResolverMatch(sub_match.func, sub_match.args, sub_match_dict, sub_match.url_name, self.app_name or sub_match.app_name, [self.namespace] + sub_match.namespaces)
tried.append([pattern])
raise Resolver404({'tried': tried, 'path': new_path})
- raise Resolver404({'path' : path})
+ raise Resolver404({'path': path})
@property
def urlconf_module(self):
diff --git a/django/forms/formsets.py b/django/forms/formsets.py
index b00f5f78ff..81e2e8781a 100644
--- a/django/forms/formsets.py
+++ b/django/forms/formsets.py
@@ -423,8 +423,8 @@ def formset_factory(form, formset=BaseFormSet, extra=1, can_order=False,
attrs = {'form': form, 'extra': extra,
'can_order': can_order, 'can_delete': can_delete,
'min_num': min_num, 'max_num': max_num,
- 'absolute_max': absolute_max, 'validate_min' : validate_min,
- 'validate_max' : validate_max}
+ 'absolute_max': absolute_max, 'validate_min': validate_min,
+ 'validate_max': validate_max}
return type(form.__name__ + str('FormSet'), (formset,), attrs)
def all_valid(formsets):
diff --git a/django/test/html.py b/django/test/html.py
index 35e9be9570..cca4a48491 100644
--- a/django/test/html.py
+++ b/django/test/html.py
@@ -149,7 +149,7 @@ class RootElement(Element):
class Parser(HTMLParser):
- SELF_CLOSING_TAGS = ('br' , 'hr', 'input', 'img', 'meta', 'spacer',
+ SELF_CLOSING_TAGS = ('br', 'hr', 'input', 'img', 'meta', 'spacer',
'link', 'frame', 'base', 'col')
def __init__(self):
diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py
index 58ea64447d..b79af80dd1 100644
--- a/django/utils/translation/trans_real.py
+++ b/django/utils/translation/trans_real.py
@@ -665,7 +665,7 @@ def parse_accept_lang_header(lang_string):
if pieces[-1]:
return []
for i in range(0, len(pieces) - 1, 3):
- first, lang, priority = pieces[i : i + 3]
+ first, lang, priority = pieces[i:i + 3]
if first:
return []
if priority:
diff --git a/django/views/debug.py b/django/views/debug.py
index 6db63b782e..3d0a8c05f8 100644
--- a/django/views/debug.py
+++ b/django/views/debug.py
@@ -303,7 +303,7 @@ class ExceptionReporter(object):
'sys_version_info': '%d.%d.%d' % sys.version_info[0:3],
'server_time': datetime.datetime.now(),
'django_version_info': get_version(),
- 'sys_path' : sys.path,
+ 'sys_path': sys.path,
'template_info': self.template_info,
'template_does_not_exist': self.template_does_not_exist,
'loader_debug_info': self.loader_debug_info,
@@ -592,7 +592,7 @@ TECHNICAL_500_TEMPLATE = """
for (var i = 0; i < arguments.length; i++) {
var e = document.getElementById(arguments[i]);
if (e) {
- e.style.display = e.style.display == 'none' ? 'block' : 'none';
+ e.style.display = e.style.display == 'none' ? 'block': 'none';
}
}
return false;
@@ -608,7 +608,7 @@ TECHNICAL_500_TEMPLATE = """
function switchPastebinFriendly(link) {
s1 = "Switch to copy-and-paste view";
s2 = "Switch back to interactive view";
- link.innerHTML = link.innerHTML == s1 ? s2 : s1;
+ link.innerHTML = link.innerHTML == s1 ? s2: s1;
toggle('browserTraceback', 'pastebinTraceback');
return false;
}
diff --git a/django/views/static.py b/django/views/static.py
index 8884b7aa0e..e55f6a1234 100644
--- a/django/views/static.py
+++ b/django/views/static.py
@@ -23,7 +23,7 @@ def serve(request, path, document_root=None, show_indexes=False):
To use, put a URL pattern such as::
- (r'^(?P<path>.*)$', 'django.views.static.serve', {'document_root' : '/path/to/my/files/'})
+ (r'^(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/path/to/my/files/'})
in your URLconf. You must provide the ``document_root`` param. You may
also set ``show_indexes`` to ``True`` if you'd like to serve a basic index
@@ -108,8 +108,8 @@ def directory_index(path, fullpath):
f += '/'
files.append(f)
c = Context({
- 'directory' : path + '/',
- 'file_list' : files,
+ 'directory': path + '/',
+ 'file_list': files,
})
return HttpResponse(t.render(c))
diff --git a/docs/_ext/literals_to_xrefs.py b/docs/_ext/literals_to_xrefs.py
index d1131fc375..6c12ea43f3 100644
--- a/docs/_ext/literals_to_xrefs.py
+++ b/docs/_ext/literals_to_xrefs.py
@@ -19,7 +19,7 @@ ROLES = (
'func',
'lookup',
'meth',
- 'mod' ,
+ 'mod',
"djadminopt",
"ref",
"setting",
diff --git a/setup.cfg b/setup.cfg
index aec0585bc3..9577ecc88a 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -4,7 +4,7 @@ install-script = scripts/rpm-install.sh
[flake8]
exclude=./django/utils/dictconfig.py,./django/contrib/comments/*,./django/utils/unittest.py,./tests/comment_tests/*,./django/test/_doctest.py,./django/utils/six.py
-ignore=E124,E125,E127,E128,E226,E241,E251,E302,E501,E203,E261,F401,F403,W601
+ignore=E124,E125,E127,E128,E226,E241,E251,E302,E501,E261,F401,F403,W601
[metadata]
license-file = LICENSE
diff --git a/tests/admin_views/admin.py b/tests/admin_views/admin.py
index af197498ce..7dd6c91e71 100644
--- a/tests/admin_views/admin.py
+++ b/tests/admin_views/admin.py
@@ -45,7 +45,7 @@ callable_year.admin_order_field = 'date'
class ArticleInline(admin.TabularInline):
model = Article
prepopulated_fields = {
- 'title' : ('content',)
+ 'title': ('content',)
}
fieldsets = (
('Some fields', {
@@ -382,7 +382,7 @@ class SubPostInline(admin.TabularInline):
model = PrePopulatedSubPost
prepopulated_fields = {
- 'subslug' : ('subtitle',)
+ 'subslug': ('subtitle',)
}
def get_readonly_fields(self, request, obj=None):
@@ -399,7 +399,7 @@ class SubPostInline(admin.TabularInline):
class PrePopulatedPostAdmin(admin.ModelAdmin):
list_display = ['title', 'slug']
prepopulated_fields = {
- 'slug' : ('title',)
+ 'slug': ('title',)
}
inlines = [SubPostInline]
@@ -569,7 +569,7 @@ class AlbumAdmin(admin.ModelAdmin):
class PrePopulatedPostLargeSlugAdmin(admin.ModelAdmin):
prepopulated_fields = {
- 'slug' : ('title',)
+ 'slug': ('title',)
}
diff --git a/tests/aggregation_regress/tests.py b/tests/aggregation_regress/tests.py
index 2bc907662e..8e192bd082 100644
--- a/tests/aggregation_regress/tests.py
+++ b/tests/aggregation_regress/tests.py
@@ -113,7 +113,7 @@ class AggregationTests(TestCase):
# Aggregate overrides extra selected column
self.assertEqual(
- Book.objects.extra(select={'price_per_page' : 'price / pages'}).aggregate(Sum('pages')),
+ Book.objects.extra(select={'price_per_page': 'price / pages'}).aggregate(Sum('pages')),
{'pages__sum': 3703}
)
@@ -136,7 +136,7 @@ class AggregationTests(TestCase):
self.assertTrue(obj.manufacture_cost == 11.545 or obj.manufacture_cost == Decimal('11.545'))
# Order of the annotate/extra in the query doesn't matter
- obj = Book.objects.extra(select={'manufacture_cost' : 'price * .5'}).annotate(mean_auth_age=Avg('authors__age')).get(pk=2)
+ obj = Book.objects.extra(select={'manufacture_cost': 'price * .5'}).annotate(mean_auth_age=Avg('authors__age')).get(pk=2)
self.assertObjectAttrs(obj,
contact_id=3,
id=2,
@@ -153,7 +153,7 @@ class AggregationTests(TestCase):
self.assertTrue(obj.manufacture_cost == 11.545 or obj.manufacture_cost == Decimal('11.545'))
# Values queries can be combined with annotate and extra
- obj = Book.objects.annotate(mean_auth_age=Avg('authors__age')).extra(select={'manufacture_cost' : 'price * .5'}).values().get(pk=2)
+ obj = Book.objects.annotate(mean_auth_age=Avg('authors__age')).extra(select={'manufacture_cost': 'price * .5'}).values().get(pk=2)
manufacture_cost = obj['manufacture_cost']
self.assertTrue(manufacture_cost == 11.545 or manufacture_cost == Decimal('11.545'))
del obj['manufacture_cost']
@@ -172,7 +172,7 @@ class AggregationTests(TestCase):
# The order of the (empty) values, annotate and extra clauses doesn't
# matter
- obj = Book.objects.values().annotate(mean_auth_age=Avg('authors__age')).extra(select={'manufacture_cost' : 'price * .5'}).get(pk=2)
+ obj = Book.objects.values().annotate(mean_auth_age=Avg('authors__age')).extra(select={'manufacture_cost': 'price * .5'}).get(pk=2)
manufacture_cost = obj['manufacture_cost']
self.assertTrue(manufacture_cost == 11.545 or manufacture_cost == Decimal('11.545'))
del obj['manufacture_cost']
@@ -191,12 +191,12 @@ class AggregationTests(TestCase):
# If the annotation precedes the values clause, it won't be included
# unless it is explicitly named
- obj = Book.objects.annotate(mean_auth_age=Avg('authors__age')).extra(select={'price_per_page' : 'price / pages'}).values('name').get(pk=1)
+ obj = Book.objects.annotate(mean_auth_age=Avg('authors__age')).extra(select={'price_per_page': 'price / pages'}).values('name').get(pk=1)
self.assertEqual(obj, {
"name": 'The Definitive Guide to Django: Web Development Done Right',
})
- obj = Book.objects.annotate(mean_auth_age=Avg('authors__age')).extra(select={'price_per_page' : 'price / pages'}).values('name', 'mean_auth_age').get(pk=1)
+ obj = Book.objects.annotate(mean_auth_age=Avg('authors__age')).extra(select={'price_per_page': 'price / pages'}).values('name', 'mean_auth_age').get(pk=1)
self.assertEqual(obj, {
'mean_auth_age': 34.5,
'name': 'The Definitive Guide to Django: Web Development Done Right',
@@ -214,7 +214,7 @@ class AggregationTests(TestCase):
# The annotations are added to values output if values() precedes
# annotate()
- obj = Book.objects.values('name').annotate(mean_auth_age=Avg('authors__age')).extra(select={'price_per_page' : 'price / pages'}).get(pk=1)
+ obj = Book.objects.values('name').annotate(mean_auth_age=Avg('authors__age')).extra(select={'price_per_page': 'price / pages'}).get(pk=1)
self.assertEqual(obj, {
'mean_auth_age': 34.5,
'name': 'The Definitive Guide to Django: Web Development Done Right',
@@ -575,7 +575,7 @@ class AggregationTests(TestCase):
# Regression for #10290 - extra selects with parameters can be used for
# grouping.
- qs = Book.objects.annotate(mean_auth_age=Avg('authors__age')).extra(select={'sheets' : '(pages + %s) / %s'}, select_params=[1, 2]).order_by('sheets').values('sheets')
+ qs = Book.objects.annotate(mean_auth_age=Avg('authors__age')).extra(select={'sheets': '(pages + %s) / %s'}, select_params=[1, 2]).order_by('sheets').values('sheets')
self.assertQuerysetEqual(
qs, [
150,
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index 02e7e54db1..0c6ae91553 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -119,13 +119,13 @@ class DummyCacheTests(unittest.TestCase):
def test_data_types(self):
"All data types are ignored equally by the dummy cache"
stuff = {
- 'string' : 'this is a string',
- 'int' : 42,
- 'list' : [1, 2, 3, 4],
- 'tuple' : (1, 2, 3, 4),
- 'dict' : {'A': 1, 'B' : 2},
- 'function' : f,
- 'class' : C,
+ 'string': 'this is a string',
+ 'int': 42,
+ 'list': [1, 2, 3, 4],
+ 'tuple': (1, 2, 3, 4),
+ 'dict': {'A': 1, 'B': 2},
+ 'function': f,
+ 'class': C,
}
self.cache.set("stuff", stuff)
self.assertEqual(self.cache.get("stuff"), None)
@@ -149,7 +149,7 @@ class DummyCacheTests(unittest.TestCase):
'ascii': 'ascii_value',
'unicode_ascii': 'Iñtërnâtiônàlizætiøn1',
'Iñtërnâtiônàlizætiøn': 'Iñtërnâtiônàlizætiøn2',
- 'ascii2': {'x' : 1}
+ 'ascii2': {'x': 1}
}
for (key, value) in stuff.items():
self.cache.set(key, value)
@@ -231,8 +231,8 @@ class BaseCacheTests(object):
self.cache.set('b', 'b')
self.cache.set('c', 'c')
self.cache.set('d', 'd')
- self.assertEqual(self.cache.get_many(['a', 'c', 'd']), {'a' : 'a', 'c' : 'c', 'd' : 'd'})
- self.assertEqual(self.cache.get_many(['a', 'b', 'e']), {'a' : 'a', 'b' : 'b'})
+ self.assertEqual(self.cache.get_many(['a', 'c', 'd']), {'a': 'a', 'c': 'c', 'd': 'd'})
+ self.assertEqual(self.cache.get_many(['a', 'b', 'e']), {'a': 'a', 'b': 'b'})
def test_delete(self):
# Cache keys can be deleted
@@ -282,13 +282,13 @@ class BaseCacheTests(object):
def test_data_types(self):
# Many different data types can be cached
stuff = {
- 'string' : 'this is a string',
- 'int' : 42,
- 'list' : [1, 2, 3, 4],
- 'tuple' : (1, 2, 3, 4),
- 'dict' : {'A': 1, 'B' : 2},
- 'function' : f,
- 'class' : C,
+ 'string': 'this is a string',
+ 'int': 42,
+ 'list': [1, 2, 3, 4],
+ 'tuple': (1, 2, 3, 4),
+ 'dict': {'A': 1, 'B': 2},
+ 'function': f,
+ 'class': C,
}
self.cache.set("stuff", stuff)
self.assertEqual(self.cache.get("stuff"), stuff)
@@ -353,7 +353,7 @@ class BaseCacheTests(object):
'ascii': 'ascii_value',
'unicode_ascii': 'Iñtërnâtiônàlizætiøn1',
'Iñtërnâtiônàlizætiøn': 'Iñtërnâtiônàlizætiøn2',
- 'ascii2': {'x' : 1}
+ 'ascii2': {'x': 1}
}
# Test `set`
for (key, value) in stuff.items():
@@ -1221,16 +1221,16 @@ class CacheUtils(TestCase):
def test_patch_cache_control(self):
tests = (
# Initial Cache-Control, kwargs to patch_cache_control, expected Cache-Control parts
- (None, {'private' : True}, set(['private'])),
+ (None, {'private': True}, set(['private'])),
# Test whether private/public attributes are mutually exclusive
- ('private', {'private' : True}, set(['private'])),
- ('private', {'public' : True}, set(['public'])),
- ('public', {'public' : True}, set(['public'])),
- ('public', {'private' : True}, set(['private'])),
- ('must-revalidate,max-age=60,private', {'public' : True}, set(['must-revalidate', 'max-age=60', 'public'])),
- ('must-revalidate,max-age=60,public', {'private' : True}, set(['must-revalidate', 'max-age=60', 'private'])),
- ('must-revalidate,max-age=60', {'public' : True}, set(['must-revalidate', 'max-age=60', 'public'])),
+ ('private', {'private': True}, set(['private'])),
+ ('private', {'public': True}, set(['public'])),
+ ('public', {'public': True}, set(['public'])),
+ ('public', {'private': True}, set(['private'])),
+ ('must-revalidate,max-age=60,private', {'public': True}, set(['must-revalidate', 'max-age=60', 'public'])),
+ ('must-revalidate,max-age=60,public', {'private': True}, set(['must-revalidate', 'max-age=60', 'private'])),
+ ('must-revalidate,max-age=60', {'public': True}, set(['must-revalidate', 'max-age=60', 'public'])),
)
cc_delim_re = re.compile(r'\s*,\s*')
diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py
index 0f1b8882f3..aecf8f32d5 100644
--- a/tests/forms_tests/tests/test_forms.py
+++ b/tests/forms_tests/tests/test_forms.py
@@ -1793,17 +1793,17 @@ class FormsTestCase(TestCase):
class NameForm(Form):
name = NameField(validators=[bad_names])
- form = NameForm(data={'name' : ['bad', 'value']})
+ form = NameForm(data={'name': ['bad', 'value']})
form.full_clean()
self.assertFalse(form.is_valid())
self.assertEqual(form.errors, {'name': ['bad value not allowed']})
- form = NameForm(data={'name' : ['should be overly', 'long for the field names']})
+ form = NameForm(data={'name': ['should be overly', 'long for the field names']})
self.assertFalse(form.is_valid())
self.assertEqual(form.errors, {'name': ['Ensure this value has at most 10 characters (it has 16).',
'Ensure this value has at most 10 characters (it has 24).']})
- form = NameForm(data={'name' : ['fname', 'lname']})
+ form = NameForm(data={'name': ['fname', 'lname']})
self.assertTrue(form.is_valid())
- self.assertEqual(form.cleaned_data, {'name' : 'fname lname'})
+ self.assertEqual(form.cleaned_data, {'name': 'fname lname'})
def test_multivalue_deep_copy(self):
"""
@@ -1912,7 +1912,7 @@ class FormsTestCase(TestCase):
form = JSONForm(data={'json': '{}'})
form.full_clean()
- self.assertEqual(form.cleaned_data, {'json' : {}})
+ self.assertEqual(form.cleaned_data, {'json': {}})
def test_boundfield_label_tag(self):
class SomeForm(Form):
diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py
index 0db4ad7567..2da852d11e 100644
--- a/tests/model_forms/tests.py
+++ b/tests/model_forms/tests.py
@@ -1751,7 +1751,7 @@ class OldFormForXTests(TestCase):
self.assertHTMLEqual(six.text_type(CustomFieldForExclusionForm()),
'''<tr><th><label for="id_name">Name:</label></th><td><input id="id_name" type="text" name="name" maxlength="10" /></td></tr>''')
- def test_iterable_model_m2m(self) :
+ def test_iterable_model_m2m(self):
colour = Colour.objects.create(name='Blue')
form = ColourfulItemForm()
self.maxDiff = 1024
@@ -1763,7 +1763,7 @@ class OldFormForXTests(TestCase):
</select> <span class="helptext"> Hold down "Control", or "Command" on a Mac, to select more than one.</span></p>"""
% {'blue_pk': colour.pk})
- def test_custom_error_messages(self) :
+ def test_custom_error_messages(self):
data = {'name1': '@#$!!**@#$', 'name2': '@#$!!**@#$'}
errors = CustomErrorMessageForm(data).errors
self.assertHTMLEqual(
@@ -1775,7 +1775,7 @@ class OldFormForXTests(TestCase):
'<ul class="errorlist"><li>Model custom error message.</li></ul>'
)
- def test_model_clean_error_messages(self) :
+ def test_model_clean_error_messages(self):
data = {'name1': 'FORBIDDEN_VALUE', 'name2': 'ABC'}
errors = CustomErrorMessageForm(data).errors
self.assertHTMLEqual(
diff --git a/tests/serializers/tests.py b/tests/serializers/tests.py
index f76ba6e7ed..71f5c1802e 100644
--- a/tests/serializers/tests.py
+++ b/tests/serializers/tests.py
@@ -28,7 +28,7 @@ from .models import (Category, Author, Article, AuthorProfile, Actor, Movie,
@override_settings(
SERIALIZATION_MODULES = {
- "json2" : "django.core.serializers.json",
+ "json2": "django.core.serializers.json",
}
)
class SerializerRegistrationTests(TestCase):
diff --git a/tests/template_tests/filters.py b/tests/template_tests/filters.py
index 9441a8c678..36a519fd90 100644
--- a/tests/template_tests/filters.py
+++ b/tests/template_tests/filters.py
@@ -38,16 +38,16 @@ def get_filter_tests():
# NOTE: \xa0 avoids wrapping between value and unit
return {
# Default compare with datetime.now()
- 'filter-timesince01' : ('{{ a|timesince }}', {'a': datetime.now() + timedelta(minutes=-1, seconds = -10)}, '1\xa0minute'),
- 'filter-timesince02' : ('{{ a|timesince }}', {'a': datetime.now() - timedelta(days=1, minutes = 1)}, '1\xa0day'),
- 'filter-timesince03' : ('{{ a|timesince }}', {'a': datetime.now() - timedelta(hours=1, minutes=25, seconds = 10)}, '1\xa0hour, 25\xa0minutes'),
+ 'filter-timesince01': ('{{ a|timesince }}', {'a': datetime.now() + timedelta(minutes=-1, seconds = -10)}, '1\xa0minute'),
+ 'filter-timesince02': ('{{ a|timesince }}', {'a': datetime.now() - timedelta(days=1, minutes = 1)}, '1\xa0day'),
+ 'filter-timesince03': ('{{ a|timesince }}', {'a': datetime.now() - timedelta(hours=1, minutes=25, seconds = 10)}, '1\xa0hour, 25\xa0minutes'),
# Compare to a given parameter
- 'filter-timesince04' : ('{{ a|timesince:b }}', {'a': now - timedelta(days=2), 'b': now - timedelta(days=1)}, '1\xa0day'),
- 'filter-timesince05' : ('{{ a|timesince:b }}', {'a': now - timedelta(days=2, minutes=1), 'b': now - timedelta(days=2)}, '1\xa0minute'),
+ 'filter-timesince04': ('{{ a|timesince:b }}', {'a': now - timedelta(days=2), 'b': now - timedelta(days=1)}, '1\xa0day'),
+ 'filter-timesince05': ('{{ a|timesince:b }}', {'a': now - timedelta(days=2, minutes=1), 'b': now - timedelta(days=2)}, '1\xa0minute'),
# Check that timezone is respected
- 'filter-timesince06' : ('{{ a|timesince:b }}', {'a': now_tz - timedelta(hours=8), 'b': now_tz}, '8\xa0hours'),
+ 'filter-timesince06': ('{{ a|timesince:b }}', {'a': now_tz - timedelta(hours=8), 'b': now_tz}, '8\xa0hours'),
# Regression for #7443
'filter-timesince07': ('{{ earlier|timesince }}', {'earlier': now - timedelta(days=7)}, '1\xa0week'),
@@ -57,25 +57,25 @@ def get_filter_tests():
# Ensures that differing timezones are calculated correctly
# Tests trying to compare a timezone-aware 'now' to now aren't supported on no-tz-support systems (e.g Windows).
- 'filter-timesince11' : ('{{ a|timesince }}', {'a': now}, '0\xa0minutes'),
- 'filter-timesince12' : ('{{ a|timesince }}', {'a': now_tz}, '0\xa0minutes') if TZ_SUPPORT else ('', {}, ''),
- 'filter-timesince13' : ('{{ a|timesince }}', {'a': now_tz_i}, '0\xa0minutes') if TZ_SUPPORT else ('', {}, ''),
- 'filter-timesince14' : ('{{ a|timesince:b }}', {'a': now_tz, 'b': now_tz_i}, '0\xa0minutes'),
- 'filter-timesince15' : ('{{ a|timesince:b }}', {'a': now, 'b': now_tz_i}, ''),
- 'filter-timesince16' : ('{{ a|timesince:b }}', {'a': now_tz_i, 'b': now}, ''),
+ 'filter-timesince11': ('{{ a|timesince }}', {'a': now}, '0\xa0minutes'),
+ 'filter-timesince12': ('{{ a|timesince }}', {'a': now_tz}, '0\xa0minutes') if TZ_SUPPORT else ('', {}, ''),
+ 'filter-timesince13': ('{{ a|timesince }}', {'a': now_tz_i}, '0\xa0minutes') if TZ_SUPPORT else ('', {}, ''),
+ 'filter-timesince14': ('{{ a|timesince:b }}', {'a': now_tz, 'b': now_tz_i}, '0\xa0minutes'),
+ 'filter-timesince15': ('{{ a|timesince:b }}', {'a': now, 'b': now_tz_i}, ''),
+ 'filter-timesince16': ('{{ a|timesince:b }}', {'a': now_tz_i, 'b': now}, ''),
# Regression for #9065 (two date objects).
- 'filter-timesince17' : ('{{ a|timesince:b }}', {'a': today, 'b': today}, '0\xa0minutes'),
- 'filter-timesince18' : ('{{ a|timesince:b }}', {'a': today, 'b': today + timedelta(hours=24)}, '1\xa0day'),
+ 'filter-timesince17': ('{{ a|timesince:b }}', {'a': today, 'b': today}, '0\xa0minutes'),
+ 'filter-timesince18': ('{{ a|timesince:b }}', {'a': today, 'b': today + timedelta(hours=24)}, '1\xa0day'),
# Default compare with datetime.now()
- 'filter-timeuntil01' : ('{{ a|timeuntil }}', {'a': datetime.now() + timedelta(minutes=2, seconds=10)}, '2\xa0minutes'),
- 'filter-timeuntil02' : ('{{ a|timeuntil }}', {'a': (datetime.now() + timedelta(days=1, seconds=10))}, '1\xa0day'),
- 'filter-timeuntil03' : ('{{ a|timeuntil }}', {'a': (datetime.now() + timedelta(hours=8, minutes=10, seconds = 10))}, '8\xa0hours, 10\xa0minutes'),
+ 'filter-timeuntil01': ('{{ a|timeuntil }}', {'a': datetime.now() + timedelta(minutes=2, seconds=10)}, '2\xa0minutes'),
+ 'filter-timeuntil02': ('{{ a|timeuntil }}', {'a': (datetime.now() + timedelta(days=1, seconds=10))}, '1\xa0day'),
+ 'filter-timeuntil03': ('{{ a|timeuntil }}', {'a': (datetime.now() + timedelta(hours=8, minutes=10, seconds = 10))}, '8\xa0hours, 10\xa0minutes'),
# Compare to a given parameter
- 'filter-timeuntil04' : ('{{ a|timeuntil:b }}', {'a': now - timedelta(days=1), 'b': now - timedelta(days=2)}, '1\xa0day'),
- 'filter-timeuntil05' : ('{{ a|timeuntil:b }}', {'a': now - timedelta(days=2), 'b': now - timedelta(days=2, minutes=1)}, '1\xa0minute'),
+ 'filter-timeuntil04': ('{{ a|timeuntil:b }}', {'a': now - timedelta(days=1), 'b': now - timedelta(days=2)}, '1\xa0day'),
+ 'filter-timeuntil05': ('{{ a|timeuntil:b }}', {'a': now - timedelta(days=2), 'b': now - timedelta(days=2, minutes=1)}, '1\xa0minute'),
# Regression for #7443
'filter-timeuntil06': ('{{ earlier|timeuntil }}', {'earlier': now - timedelta(days=7)}, '0\xa0minutes'),
@@ -85,13 +85,13 @@ def get_filter_tests():
# Ensures that differing timezones are calculated correctly
# Tests trying to compare a timezone-aware 'now' to now aren't supported on no-tz-support systems (e.g Windows).
- 'filter-timeuntil10' : ('{{ a|timeuntil }}', {'a': now_tz}, '0\xa0minutes') if TZ_SUPPORT else ('', {}, ''),
- 'filter-timeuntil11' : ('{{ a|timeuntil }}', {'a': now_tz_i}, '0\xa0minutes') if TZ_SUPPORT else ('', {}, ''),
- 'filter-timeuntil12' : ('{{ a|timeuntil:b }}', {'a': now_tz_i, 'b': now_tz}, '0\xa0minutes'),
+ 'filter-timeuntil10': ('{{ a|timeuntil }}', {'a': now_tz}, '0\xa0minutes') if TZ_SUPPORT else ('', {}, ''),
+ 'filter-timeuntil11': ('{{ a|timeuntil }}', {'a': now_tz_i}, '0\xa0minutes') if TZ_SUPPORT else ('', {}, ''),
+ 'filter-timeuntil12': ('{{ a|timeuntil:b }}', {'a': now_tz_i, 'b': now_tz}, '0\xa0minutes'),
# Regression for #9065 (two date objects).
- 'filter-timeuntil13' : ('{{ a|timeuntil:b }}', {'a': today, 'b': today}, '0\xa0minutes'),
- 'filter-timeuntil14' : ('{{ a|timeuntil:b }}', {'a': today, 'b': today - timedelta(hours=24)}, '1\xa0day'),
+ 'filter-timeuntil13': ('{{ a|timeuntil:b }}', {'a': today, 'b': today}, '0\xa0minutes'),
+ 'filter-timeuntil14': ('{{ a|timeuntil:b }}', {'a': today, 'b': today - timedelta(hours=24)}, '1\xa0day'),
'filter-addslash01': ("{% autoescape off %}{{ a|addslashes }} {{ b|addslashes }}{% endautoescape %}", {"a": "<a>'", "b": mark_safe("<a>'")}, r"<a>\' <a>\'"),
'filter-addslash02': ("{{ a|addslashes }} {{ b|addslashes }}", {"a": "<a>'", "b": mark_safe("<a>'")}, r"&lt;a&gt;\&#39; <a>\'"),
@@ -135,8 +135,8 @@ def get_filter_tests():
". a&lt;b. . a<b."),
# Test the title filter
- 'filter-title1' : ('{{ a|title }}', {'a' : 'JOE\'S CRAB SHACK'}, 'Joe&#39;s Crab Shack'),
- 'filter-title2' : ('{{ a|title }}', {'a' : '555 WEST 53RD STREET'}, '555 West 53rd Street'),
+ 'filter-title1': ('{{ a|title }}', {'a': 'JOE\'S CRAB SHACK'}, 'Joe&#39;s Crab Shack'),
+ 'filter-title2': ('{{ a|title }}', {'a': '555 WEST 53RD STREET'}, '555 West 53rd Street'),
'filter-truncatewords01': ('{% autoescape off %}{{ a|truncatewords:"2" }} {{ b|truncatewords:"2"}}{% endautoescape %}',
{"a": "alpha & bravo", "b": mark_safe("alpha &amp; bravo")}, "alpha & ... alpha &amp; ..."),
diff --git a/tests/template_tests/templatetags/custom.py b/tests/template_tests/templatetags/custom.py
index cdcabd8ffe..9d328f8d54 100644
--- a/tests/template_tests/templatetags/custom.py
+++ b/tests/template_tests/templatetags/custom.py
@@ -107,61 +107,61 @@ register.simple_tag(lambda x: x - 1, name='minusone')
@register.inclusion_tag('inclusion.html')
def inclusion_no_params():
"""Expected inclusion_no_params __doc__"""
- return {"result" : "inclusion_no_params - Expected result"}
+ return {"result": "inclusion_no_params - Expected result"}
inclusion_no_params.anything = "Expected inclusion_no_params __dict__"
@register.inclusion_tag(get_template('inclusion.html'))
def inclusion_no_params_from_template():
"""Expected inclusion_no_params_from_template __doc__"""
- return {"result" : "inclusion_no_params_from_template - Expected result"}
+ return {"result": "inclusion_no_params_from_template - Expected result"}
inclusion_no_params_from_template.anything = "Expected inclusion_no_params_from_template __dict__"
@register.inclusion_tag('inclusion.html')
def inclusion_one_param(arg):
"""Expected inclusion_one_param __doc__"""
- return {"result" : "inclusion_one_param - Expected result: %s" % arg}
+ return {"result": "inclusion_one_param - Expected result: %s" % arg}
inclusion_one_param.anything = "Expected inclusion_one_param __dict__"
@register.inclusion_tag(get_template('inclusion.html'))
def inclusion_one_param_from_template(arg):
"""Expected inclusion_one_param_from_template __doc__"""
- return {"result" : "inclusion_one_param_from_template - Expected result: %s" % arg}
+ return {"result": "inclusion_one_param_from_template - Expected result: %s" % arg}
inclusion_one_param_from_template.anything = "Expected inclusion_one_param_from_template __dict__"
@register.inclusion_tag('inclusion.html', takes_context=False)
def inclusion_explicit_no_context(arg):
"""Expected inclusion_explicit_no_context __doc__"""
- return {"result" : "inclusion_explicit_no_context - Expected result: %s" % arg}
+ return {"result": "inclusion_explicit_no_context - Expected result: %s" % arg}
inclusion_explicit_no_context.anything = "Expected inclusion_explicit_no_context __dict__"
@register.inclusion_tag(get_template('inclusion.html'), takes_context=False)
def inclusion_explicit_no_context_from_template(arg):
"""Expected inclusion_explicit_no_context_from_template __doc__"""
- return {"result" : "inclusion_explicit_no_context_from_template - Expected result: %s" % arg}
+ return {"result": "inclusion_explicit_no_context_from_template - Expected result: %s" % arg}
inclusion_explicit_no_context_from_template.anything = "Expected inclusion_explicit_no_context_from_template __dict__"
@register.inclusion_tag('inclusion.html', takes_context=True)
def inclusion_no_params_with_context(context):
"""Expected inclusion_no_params_with_context __doc__"""
- return {"result" : "inclusion_no_params_with_context - Expected result (context value: %s)" % context['value']}
+ return {"result": "inclusion_no_params_with_context - Expected result (context value: %s)" % context['value']}
inclusion_no_params_with_context.anything = "Expected inclusion_no_params_with_context __dict__"
@register.inclusion_tag(get_template('inclusion.html'), takes_context=True)
def inclusion_no_params_with_context_from_template(context):
"""Expected inclusion_no_params_with_context_from_template __doc__"""
- return {"result" : "inclusion_no_params_with_context_from_template - Expected result (context value: %s)" % context['value']}
+ return {"result": "inclusion_no_params_with_context_from_template - Expected result (context value: %s)" % context['value']}
inclusion_no_params_with_context_from_template.anything = "Expected inclusion_no_params_with_context_from_template __dict__"
@register.inclusion_tag('inclusion.html', takes_context=True)
def inclusion_params_and_context(context, arg):
"""Expected inclusion_params_and_context __doc__"""
- return {"result" : "inclusion_params_and_context - Expected result (context value: %s): %s" % (context['value'], arg)}
+ return {"result": "inclusion_params_and_context - Expected result (context value: %s): %s" % (context['value'], arg)}
inclusion_params_and_context.anything = "Expected inclusion_params_and_context __dict__"
@register.inclusion_tag(get_template('inclusion.html'), takes_context=True)
def inclusion_params_and_context_from_template(context, arg):
"""Expected inclusion_params_and_context_from_template __doc__"""
- return {"result" : "inclusion_params_and_context_from_template - Expected result (context value: %s): %s" % (context['value'], arg)}
+ return {"result": "inclusion_params_and_context_from_template - Expected result (context value: %s): %s" % (context['value'], arg)}
inclusion_params_and_context_from_template.anything = "Expected inclusion_params_and_context_from_template __dict__"
@register.inclusion_tag('inclusion.html')
diff --git a/tests/template_tests/tests.py b/tests/template_tests/tests.py
index 2b845a0456..c617bc07d4 100644
--- a/tests/template_tests/tests.py
+++ b/tests/template_tests/tests.py
@@ -668,7 +668,7 @@ class TemplateTests(TransRealMixin, TestCase):
'basic-syntax02': ("{{ headline }}", {'headline': 'Success'}, "Success"),
# More than one replacement variable is allowed in a template
- 'basic-syntax03': ("{{ first }} --- {{ second }}", {"first" : 1, "second" : 2}, "1 --- 2"),
+ 'basic-syntax03': ("{{ first }} --- {{ second }}", {"first": 1, "second": 2}, "1 --- 2"),
# Fail silently when a variable is not found in the current context
'basic-syntax04': ("as{{ missing }}df", {}, ("asdf", "asINVALIDdf")),
@@ -899,8 +899,8 @@ class TemplateTests(TransRealMixin, TestCase):
'cycle17': ("{% cycle 'a' 'b' 'c' as abc silent %}{% cycle abc %}{% cycle abc %}{% cycle abc %}{% cycle abc %}", {}, ""),
'cycle18': ("{% cycle 'a' 'b' 'c' as foo invalid_flag %}", {}, template.TemplateSyntaxError),
'cycle19': ("{% cycle 'a' 'b' as silent %}{% cycle silent %}", {}, "ab"),
- 'cycle20': ("{% cycle one two as foo %} &amp; {% cycle foo %}", {'one' : 'A & B', 'two' : 'C & D'}, "A & B &amp; C & D"),
- 'cycle21': ("{% filter force_escape %}{% cycle one two as foo %} & {% cycle foo %}{% endfilter %}", {'one' : 'A & B', 'two' : 'C & D'}, "A &amp; B &amp; C &amp; D"),
+ 'cycle20': ("{% cycle one two as foo %} &amp; {% cycle foo %}", {'one': 'A & B', 'two': 'C & D'}, "A & B &amp; C & D"),
+ 'cycle21': ("{% filter force_escape %}{% cycle one two as foo %} & {% cycle foo %}{% endfilter %}", {'one': 'A & B', 'two': 'C & D'}, "A &amp; B &amp; C &amp; D"),
'cycle22': ("{% for x in values %}{% cycle 'a' 'b' 'c' as abc silent %}{{ x }}{% endfor %}", {'values': [1, 2, 3, 4]}, "1234"),
'cycle23': ("{% for x in values %}{% cycle 'a' 'b' 'c' as abc silent %}{{ abc }}{{ x }}{% endfor %}", {'values': [1, 2, 3, 4]}, "a1b2c3a4"),
'included-cycle': ('{{ abc }}', {'abc': 'xxx'}, 'xxx'),
@@ -1398,9 +1398,9 @@ class TemplateTests(TransRealMixin, TestCase):
'spaceless01': ("{% spaceless %} <b> <i> text </i> </b> {% endspaceless %}", {}, "<b><i> text </i></b>"),
'spaceless02': ("{% spaceless %} <b> \n <i> text </i> \n </b> {% endspaceless %}", {}, "<b><i> text </i></b>"),
'spaceless03': ("{% spaceless %}<b><i>text</i></b>{% endspaceless %}", {}, "<b><i>text</i></b>"),
- 'spaceless04': ("{% spaceless %}<b> <i>{{ text }}</i> </b>{% endspaceless %}", {'text' : 'This & that'}, "<b><i>This &amp; that</i></b>"),
- 'spaceless05': ("{% autoescape off %}{% spaceless %}<b> <i>{{ text }}</i> </b>{% endspaceless %}{% endautoescape %}", {'text' : 'This & that'}, "<b><i>This & that</i></b>"),
- 'spaceless06': ("{% spaceless %}<b> <i>{{ text|safe }}</i> </b>{% endspaceless %}", {'text' : 'This & that'}, "<b><i>This & that</i></b>"),
+ 'spaceless04': ("{% spaceless %}<b> <i>{{ text }}</i> </b>{% endspaceless %}", {'text': 'This & that'}, "<b><i>This &amp; that</i></b>"),
+ 'spaceless05': ("{% autoescape off %}{% spaceless %}<b> <i>{{ text }}</i> </b>{% endspaceless %}{% endautoescape %}", {'text': 'This & that'}, "<b><i>This & that</i></b>"),
+ 'spaceless06': ("{% spaceless %}<b> <i>{{ text|safe }}</i> </b>{% endspaceless %}", {'text': 'This & that'}, "<b><i>This & that</i></b>"),
# simple translation of a string delimited by '
'i18n01': ("{% load i18n %}{% trans 'xxxyyyxxx' %}", {}, "xxxyyyxxx"),
diff --git a/tests/test_client/views.py b/tests/test_client/views.py
index ce76865ade..1861e3a591 100644
--- a/tests/test_client/views.py
+++ b/tests/test_client/views.py
@@ -191,7 +191,7 @@ def _permission_protected_view(request):
"A simple view that is permission protected."
t = Template('This is a permission protected test. '
'Username is {{ user.username }}. '
- 'Permissions are {{ user.get_all_permissions }}.' ,
+ 'Permissions are {{ user.get_all_permissions }}.',
name='Permissions Template')
c = Context({'user': request.user})
return HttpResponse(t.render(c))
@@ -211,7 +211,7 @@ class _ViewManager(object):
def permission_protected_view(self, request):
t = Template('This is a permission protected test using a method. '
'Username is {{ user.username }}. '
- 'Permissions are {{ user.get_all_permissions }}.' ,
+ 'Permissions are {{ user.get_all_permissions }}.',
name='Permissions Template')
c = Context({'user': request.user})
return HttpResponse(t.render(c))
diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py
index af2eef6747..666fde2fa6 100644
--- a/tests/test_utils/tests.py
+++ b/tests/test_utils/tests.py
@@ -322,7 +322,7 @@ class HTMLEqualTests(TestCase):
self.assertEqual(dom.children[0], "<p>foo</p> '</scr'+'ipt>' <span>bar</span>")
def test_self_closing_tags(self):
- self_closing_tags = ('br' , 'hr', 'input', 'img', 'meta', 'spacer',
+ self_closing_tags = ('br', 'hr', 'input', 'img', 'meta', 'spacer',
'link', 'frame', 'base', 'col')
for tag in self_closing_tags:
dom = parse_html('<p>Hello <%s> world</p>' % tag)