diff --git a/django/contrib/gis/db/models/fields.py b/django/contrib/gis/db/models/fields.py index af6d3da972..df26b8b9f8 100644 --- a/django/contrib/gis/db/models/fields.py +++ b/django/contrib/gis/db/models/fields.py @@ -163,7 +163,7 @@ class GeometryField(GeoSelectFormatMixin, Field): self._get_srid_info(connection) return self._units_name - ### Routines specific to GeometryField ### + # ### Routines specific to GeometryField ### def geodetic(self, connection): """ Returns true if this field's SRID corresponds with a coordinate @@ -236,7 +236,7 @@ class GeometryField(GeoSelectFormatMixin, Field): else: return gsrid - ### Routines overloaded from Field ### + # ### Routines overloaded from Field ### def contribute_to_class(self, cls, name, **kwargs): super(GeometryField, self).contribute_to_class(cls, name, **kwargs) diff --git a/django/contrib/gis/db/models/query.py b/django/contrib/gis/db/models/query.py index 998acff79c..f287c778da 100644 --- a/django/contrib/gis/db/models/query.py +++ b/django/contrib/gis/db/models/query.py @@ -21,7 +21,7 @@ from django.utils.deprecation import RemovedInDjango20Warning class GeoQuerySet(QuerySet): "The Geographic QuerySet." - ### GeoQuerySet Methods ### + # ### GeoQuerySet Methods ### def area(self, tolerance=0.05, **kwargs): """ Returns the area of the geographic field in an `area` attribute on @@ -426,7 +426,7 @@ class GeoQuerySet(QuerySet): ) return self._spatial_aggregate(aggregates.Union, **kwargs) - ### Private API -- Abstracted DRY routines. ### + # ### Private API -- Abstracted DRY routines. ### def _spatial_setup(self, att, desc=None, field_name=None, geo_field_type=None): """ Performs set up for executing the spatial function. diff --git a/django/contrib/gis/feeds.py b/django/contrib/gis/feeds.py index 006b0298f4..fc66beec45 100644 --- a/django/contrib/gis/feeds.py +++ b/django/contrib/gis/feeds.py @@ -81,7 +81,7 @@ class GeoFeedMixin(object): raise ValueError('Geometry type "%s" not supported.' % geom.geom_type) -### SyndicationFeed subclasses ### +# ### SyndicationFeed subclasses ### class GeoRSSFeed(Rss201rev2Feed, GeoFeedMixin): def rss_attributes(self): attrs = super(GeoRSSFeed, self).rss_attributes() @@ -127,7 +127,7 @@ class W3CGeoFeed(Rss201rev2Feed, GeoFeedMixin): self.add_georss_element(handler, self.feed, w3c_geo=True) -### Feed subclass ### +# ### Feed subclass ### class Feed(BaseFeed): """ This is a subclass of the `Feed` from `django.contrib.syndication`. diff --git a/django/contrib/gis/gdal/datasource.py b/django/contrib/gis/gdal/datasource.py index d574839cf4..d73950f860 100644 --- a/django/contrib/gis/gdal/datasource.py +++ b/django/contrib/gis/gdal/datasource.py @@ -52,7 +52,6 @@ from django.utils.six.moves import range class DataSource(GDALBase): "Wraps an OGR Data Source object." - #### Python 'magic' routines #### def __init__(self, ds_input, ds_driver=False, write=False, encoding='utf-8'): # The write flag. if write: diff --git a/django/contrib/gis/gdal/error.py b/django/contrib/gis/gdal/error.py index e7269beca1..4dc0b71678 100644 --- a/django/contrib/gis/gdal/error.py +++ b/django/contrib/gis/gdal/error.py @@ -5,7 +5,7 @@ """ -#### GDAL & SRS Exceptions #### +# #### GDAL & SRS Exceptions #### class GDALException(Exception): pass @@ -27,7 +27,7 @@ class OGRIndexError(GDALException, KeyError): """ silent_variable_failure = True -#### GDAL/OGR error checking codes and routine #### +# #### GDAL/OGR error checking codes and routine #### # OGR Error Codes OGRERR_DICT = { diff --git a/django/contrib/gis/gdal/feature.py b/django/contrib/gis/gdal/feature.py index ce46ae5209..7e9d5a6986 100644 --- a/django/contrib/gis/gdal/feature.py +++ b/django/contrib/gis/gdal/feature.py @@ -18,7 +18,6 @@ class Feature(GDALBase): from a Layer object. """ - #### Python 'magic' routines #### def __init__(self, feat, layer): """ Initializes Feature from a pointer and its Layer object. @@ -65,7 +64,7 @@ class Feature(GDALBase): "Does equivalence testing on the features." return bool(capi.feature_equal(self.ptr, other._ptr)) - #### Feature Properties #### + # #### Feature Properties #### @property def encoding(self): return self._layer._ds.encoding @@ -104,7 +103,7 @@ class Feature(GDALBase): "Returns the OGR Geometry Type for this Feture." return OGRGeomType(capi.get_fd_geom_type(self._layer._ldefn)) - #### Feature Methods #### + # #### Feature Methods #### def get(self, field): """ Returns the value of the field, instead of an instance of the Field diff --git a/django/contrib/gis/gdal/field.py b/django/contrib/gis/gdal/field.py index 599ee60bf3..8da4256bf4 100644 --- a/django/contrib/gis/gdal/field.py +++ b/django/contrib/gis/gdal/field.py @@ -17,7 +17,6 @@ class Field(GDALBase): from a Feature object. """ - #### Python 'magic' routines #### def __init__(self, feat, index): """ Initializes on the feature object and the integer index of @@ -45,7 +44,7 @@ class Field(GDALBase): "Returns the string representation of the Field." return str(self.value).strip() - #### Field Methods #### + # #### Field Methods #### def as_double(self): "Retrieves the Field's value as a double (float)." return capi.get_field_as_double(self._feat.ptr, self._index) @@ -70,7 +69,7 @@ class Field(GDALBase): else: raise GDALException('Unable to retrieve date & time information from the field.') - #### Field Properties #### + # #### Field Properties #### @property def name(self): "Returns the name of this Field." @@ -104,7 +103,7 @@ class Field(GDALBase): return capi.get_field_width(self.ptr) -### The Field sub-classes for each OGR Field type. ### +# ### The Field sub-classes for each OGR Field type. ### class OFTInteger(Field): _double = False diff --git a/django/contrib/gis/gdal/geometries.py b/django/contrib/gis/gdal/geometries.py index e9abfbf439..3889cc8c73 100644 --- a/django/contrib/gis/gdal/geometries.py +++ b/django/contrib/gis/gdal/geometries.py @@ -148,7 +148,7 @@ class OGRGeometry(GDALBase): return OGRGeometry('POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))' % ( x0, y0, x0, y1, x1, y1, x1, y0, x0, y0)) - ### Geometry set-like operations ### + # ### Geometry set-like operations ### # g = g1 | g2 def __or__(self, other): "Returns the union of the two geometries." @@ -184,7 +184,7 @@ class OGRGeometry(GDALBase): "WKT is used for the string representation." return self.wkt - #### Geometry Properties #### + # #### Geometry Properties #### @property def dimension(self): "Returns 0 for points, 1 for lines, and 2 for surfaces." @@ -248,7 +248,7 @@ class OGRGeometry(GDALBase): "Returns the envelope as a 4-tuple, instead of as an Envelope object." return self.envelope.tuple - #### SpatialReference-related Properties #### + # #### SpatialReference-related Properties #### # The SRS property def _get_srs(self): @@ -291,7 +291,7 @@ class OGRGeometry(GDALBase): srid = property(_get_srid, _set_srid) - #### Output Methods #### + # #### Output Methods #### @property def geos(self): "Returns a GEOSGeometry object from this OGRGeometry." @@ -354,7 +354,7 @@ class OGRGeometry(GDALBase): else: return self.wkt - #### Geometry Methods #### + # #### Geometry Methods #### def clone(self): "Clones this OGR Geometry." return OGRGeometry(capi.clone_geom(self.ptr), self.srs) @@ -399,7 +399,7 @@ class OGRGeometry(GDALBase): "For backwards-compatibility." self.transform(srs) - #### Topology Methods #### + # #### Topology Methods #### def _topology(self, func, other): """A generalized function for topology operations, takes a GDAL function and the other geometry to perform the operation on.""" @@ -442,7 +442,7 @@ class OGRGeometry(GDALBase): "Returns True if this geometry overlaps the other." return self._topology(capi.ogr_overlaps, other) - #### Geometry-generation Methods #### + # #### Geometry-generation Methods #### def _geomgen(self, gen_func, other=None): "A helper routine for the OGR routines that generate geometries." if isinstance(other, OGRGeometry): diff --git a/django/contrib/gis/gdal/layer.py b/django/contrib/gis/gdal/layer.py index 640d2ad938..82b0d8dd5d 100644 --- a/django/contrib/gis/gdal/layer.py +++ b/django/contrib/gis/gdal/layer.py @@ -25,7 +25,6 @@ from django.utils.six.moves import range class Layer(GDALBase): "A class that wraps an OGR Layer, needs to be instantiated from a DataSource object." - #### Python 'magic' routines #### def __init__(self, layer_ptr, ds): """ Initializes on an OGR C pointer to the Layer and the `DataSource` object @@ -94,7 +93,7 @@ class Layer(GDALBase): # Should have returned a Feature, raise an OGRIndexError. raise OGRIndexError('Invalid feature id: %s.' % feat_id) - #### Layer properties #### + # #### Layer properties #### @property def extent(self): "Returns the extent (an Envelope) of this layer." @@ -188,7 +187,7 @@ class Layer(GDALBase): spatial_filter = property(_get_spatial_filter, _set_spatial_filter) - #### Layer Methods #### + # #### Layer Methods #### def get_fields(self, field_name): """ Returns a list containing the given field name for every Feature diff --git a/django/contrib/gis/gdal/libgdal.py b/django/contrib/gis/gdal/libgdal.py index 4f8224c19f..f2f62b727d 100644 --- a/django/contrib/gis/gdal/libgdal.py +++ b/django/contrib/gis/gdal/libgdal.py @@ -66,7 +66,7 @@ def std_call(func): else: return lgdal[func] -#### Version-information functions. #### +# #### Version-information functions. #### # Returns GDAL library version information with the given key. _version_info = std_call('GDALVersionInfo') diff --git a/django/contrib/gis/gdal/prototypes/ds.py b/django/contrib/gis/gdal/prototypes/ds.py index 2f79f7316e..c24e4b79a2 100644 --- a/django/contrib/gis/gdal/prototypes/ds.py +++ b/django/contrib/gis/gdal/prototypes/ds.py @@ -14,7 +14,7 @@ from django.contrib.gis.gdal.prototypes.generation import ( c_int_p = POINTER(c_int) # shortcut type -### Driver Routines ### +# Driver Routines register_all = void_output(lgdal.OGRRegisterAll, [], errcheck=False) cleanup_all = void_output(lgdal.OGRCleanupAll, [], errcheck=False) get_driver = voidptr_output(lgdal.OGRGetDriver, [c_int]) @@ -22,7 +22,7 @@ get_driver_by_name = voidptr_output(lgdal.OGRGetDriverByName, [c_char_p], errche get_driver_count = int_output(lgdal.OGRGetDriverCount, []) get_driver_name = const_string_output(lgdal.OGR_Dr_GetName, [c_void_p], decoding='ascii') -### DataSource ### +# DataSource open_ds = voidptr_output(lgdal.OGROpen, [c_char_p, c_int, POINTER(c_void_p)]) destroy_ds = void_output(lgdal.OGR_DS_Destroy, [c_void_p], errcheck=False) release_ds = void_output(lgdal.OGRReleaseDataSource, [c_void_p]) @@ -31,7 +31,7 @@ get_layer = voidptr_output(lgdal.OGR_DS_GetLayer, [c_void_p, c_int]) get_layer_by_name = voidptr_output(lgdal.OGR_DS_GetLayerByName, [c_void_p, c_char_p]) get_layer_count = int_output(lgdal.OGR_DS_GetLayerCount, [c_void_p]) -### Layer Routines ### +# Layer Routines get_extent = void_output(lgdal.OGR_L_GetExtent, [c_void_p, POINTER(OGREnvelope), c_int]) get_feature = voidptr_output(lgdal.OGR_L_GetFeature, [c_void_p, c_long]) get_feature_count = int_output(lgdal.OGR_L_GetFeatureCount, [c_void_p, c_int]) @@ -46,14 +46,14 @@ set_spatial_filter_rect = void_output(lgdal.OGR_L_SetSpatialFilterRect, [c_void_p, c_double, c_double, c_double, c_double], errcheck=False ) -### Feature Definition Routines ### +# Feature Definition Routines get_fd_geom_type = int_output(lgdal.OGR_FD_GetGeomType, [c_void_p]) get_fd_name = const_string_output(lgdal.OGR_FD_GetName, [c_void_p]) get_feat_name = const_string_output(lgdal.OGR_FD_GetName, [c_void_p]) get_field_count = int_output(lgdal.OGR_FD_GetFieldCount, [c_void_p]) get_field_defn = voidptr_output(lgdal.OGR_FD_GetFieldDefn, [c_void_p, c_int]) -### Feature Routines ### +# Feature Routines clone_feature = voidptr_output(lgdal.OGR_F_Clone, [c_void_p]) destroy_feature = void_output(lgdal.OGR_F_Destroy, [c_void_p], errcheck=False) feature_equal = int_output(lgdal.OGR_F_Equal, [c_void_p, c_void_p]) @@ -69,7 +69,7 @@ get_field_as_integer = int_output(lgdal.OGR_F_GetFieldAsInteger, [c_void_p, c_in get_field_as_string = const_string_output(lgdal.OGR_F_GetFieldAsString, [c_void_p, c_int]) get_field_index = int_output(lgdal.OGR_F_GetFieldIndex, [c_void_p, c_char_p]) -### Field Routines ### +# Field Routines get_field_name = const_string_output(lgdal.OGR_Fld_GetNameRef, [c_void_p]) get_field_precision = int_output(lgdal.OGR_Fld_GetPrecision, [c_void_p]) get_field_type = int_output(lgdal.OGR_Fld_GetType, [c_void_p]) diff --git a/django/contrib/gis/gdal/prototypes/errcheck.py b/django/contrib/gis/gdal/prototypes/errcheck.py index edc40529ed..a721087654 100644 --- a/django/contrib/gis/gdal/prototypes/errcheck.py +++ b/django/contrib/gis/gdal/prototypes/errcheck.py @@ -23,7 +23,7 @@ def ptr_byref(args, offset=-1): return args[offset]._obj -### String checking Routines ### +# ### String checking Routines ### def check_const_string(result, func, cargs, offset=None, cpl=False): """ Similar functionality to `check_string`, but does not free the pointer. @@ -64,17 +64,17 @@ def check_string(result, func, cargs, offset=-1, str_result=False): lgdal.VSIFree(ptr) return s -### DataSource, Layer error-checking ### +# ### DataSource, Layer error-checking ### -### Envelope checking ### +# ### Envelope checking ### def check_envelope(result, func, cargs, offset=-1): "Checks a function that returns an OGR Envelope by reference." env = ptr_byref(cargs, offset) return env -### Geometry error-checking routines ### +# ### Geometry error-checking routines ### def check_geom(result, func, cargs): "Checks a function that returns a geometry." # OGR_G_Clone may return an integer, even though the @@ -93,7 +93,7 @@ def check_geom_offset(result, func, cargs, offset=-1): return check_geom(geom, func, cargs) -### Spatial Reference error-checking routines ### +# ### Spatial Reference error-checking routines ### def check_srs(result, func, cargs): if isinstance(result, six.integer_types): result = c_void_p(result) @@ -102,7 +102,7 @@ def check_srs(result, func, cargs): return result -### Other error-checking routines ### +# ### Other error-checking routines ### def check_arg_errcode(result, func, cargs, cpl=False): """ The error code is returned in the last argument, by reference. diff --git a/django/contrib/gis/gdal/prototypes/geom.py b/django/contrib/gis/gdal/prototypes/geom.py index 6d6412c546..2bcc5a021c 100644 --- a/django/contrib/gis/gdal/prototypes/geom.py +++ b/django/contrib/gis/gdal/prototypes/geom.py @@ -9,7 +9,7 @@ from django.contrib.gis.gdal.prototypes.generation import ( ) -### Generation routines specific to this module ### +# ### Generation routines specific to this module ### def env_func(f, argtypes): "For getting OGREnvelopes." f.argtypes = argtypes @@ -29,7 +29,7 @@ def topology_func(f): f.errchck = bool return f -### OGR_G ctypes function prototypes ### +# ### OGR_G ctypes function prototypes ### # GeoJSON routines. from_json = geom_output(lgdal.OGR_G_CreateGeometryFromJson, [c_char_p]) diff --git a/django/contrib/gis/gdal/prototypes/raster.py b/django/contrib/gis/gdal/prototypes/raster.py index 5e07c76955..08ec9df961 100644 --- a/django/contrib/gis/gdal/prototypes/raster.py +++ b/django/contrib/gis/gdal/prototypes/raster.py @@ -20,14 +20,14 @@ void_output = partial(void_output, cpl=True) const_string_output = partial(const_string_output, cpl=True) double_output = partial(double_output, cpl=True) -### Raster Driver Routines ### +# Raster Driver Routines register_all = void_output(lgdal.GDALAllRegister, []) get_driver = voidptr_output(lgdal.GDALGetDriver, [c_int]) get_driver_by_name = voidptr_output(lgdal.GDALGetDriverByName, [c_char_p], errcheck=False) get_driver_count = int_output(lgdal.GDALGetDriverCount, []) get_driver_description = const_string_output(lgdal.GDALGetDescription, [c_void_p]) -### Raster Data Source Routines ### +# Raster Data Source Routines create_ds = voidptr_output(lgdal.GDALCreate, [c_void_p, c_char_p, c_int, c_int, c_int, c_int]) open_ds = voidptr_output(lgdal.GDALOpen, [c_char_p, c_int]) close_ds = void_output(lgdal.GDALClose, [c_void_p]) @@ -45,7 +45,7 @@ set_ds_projection_ref = void_output(lgdal.GDALSetProjection, [c_void_p, c_char_p get_ds_geotransform = void_output(lgdal.GDALGetGeoTransform, [c_void_p, POINTER(c_double * 6)], errcheck=False) set_ds_geotransform = void_output(lgdal.GDALSetGeoTransform, [c_void_p, POINTER(c_double * 6)]) -### Raster Band Routines ### +# Raster Band Routines band_io = void_output(lgdal.GDALRasterIO, [c_void_p, c_int, c_int, c_int, c_int, c_int, c_void_p, c_int, c_int, c_int, c_int, c_int]) get_band_xsize = int_output(lgdal.GDALGetRasterBandXSize, [c_void_p]) @@ -59,7 +59,7 @@ set_band_nodata_value = void_output(lgdal.GDALSetRasterNoDataValue, [c_void_p, c get_band_minimum = double_output(lgdal.GDALGetRasterMinimum, [c_void_p, POINTER(c_int)]) get_band_maximum = double_output(lgdal.GDALGetRasterMaximum, [c_void_p, POINTER(c_int)]) -### Reprojection routine ### +# Reprojection routine reproject_image = void_output(lgdal.GDALReprojectImage, [c_void_p, c_char_p, c_void_p, c_char_p, c_int, c_double, c_double, c_void_p, c_void_p, c_void_p]) diff --git a/django/contrib/gis/gdal/prototypes/srs.py b/django/contrib/gis/gdal/prototypes/srs.py index 7ab22024ed..96b5130a2c 100644 --- a/django/contrib/gis/gdal/prototypes/srs.py +++ b/django/contrib/gis/gdal/prototypes/srs.py @@ -7,7 +7,7 @@ from django.contrib.gis.gdal.prototypes.generation import ( ) -## Shortcut generation for routines with known parameters. +# Shortcut generation for routines with known parameters. def srs_double(f): """ Creates a function prototype for the OSR routines that take diff --git a/django/contrib/gis/gdal/srs.py b/django/contrib/gis/gdal/srs.py index 265ea000c2..8540fcaa15 100644 --- a/django/contrib/gis/gdal/srs.py +++ b/django/contrib/gis/gdal/srs.py @@ -42,7 +42,6 @@ class SpatialReference(GDALBase): systems (projections and datums) and to transform between them." """ - #### Python 'magic' routines #### def __init__(self, srs_input='', srs_type='user'): """ Creates a GDAL OSR Spatial Reference object from the given input. @@ -132,7 +131,7 @@ class SpatialReference(GDALBase): "The string representation uses 'pretty' WKT." return self.pretty_wkt - #### SpatialReference Methods #### + # #### SpatialReference Methods #### def attr_value(self, target, index=0): """ The attribute value for the given target node (e.g. 'PROJCS'). The index @@ -173,7 +172,7 @@ class SpatialReference(GDALBase): "Checks to see if the given spatial reference is valid." capi.srs_validate(self.ptr) - #### Name & SRID properties #### + # #### Name & SRID properties #### @property def name(self): "Returns the name of this Spatial Reference." @@ -194,7 +193,7 @@ class SpatialReference(GDALBase): except (TypeError, ValueError): return None - #### Unit Properties #### + # #### Unit Properties #### @property def linear_name(self): "Returns the name of the linear units." @@ -235,7 +234,7 @@ class SpatialReference(GDALBase): name = force_text(name) return (units, name) - #### Spheroid/Ellipsoid Properties #### + # #### Spheroid/Ellipsoid Properties #### @property def ellipsoid(self): """ @@ -259,7 +258,7 @@ class SpatialReference(GDALBase): "Returns the Inverse Flattening for this Spatial Reference." return capi.invflattening(self.ptr, byref(c_int())) - #### Boolean Properties #### + # #### Boolean Properties #### @property def geographic(self): """ @@ -281,7 +280,7 @@ class SpatialReference(GDALBase): """ return bool(capi.isprojected(self.ptr)) - #### Import Routines ##### + # #### Import Routines ##### def import_epsg(self, epsg): "Imports the Spatial Reference from the EPSG code (an integer)." capi.from_epsg(self.ptr, epsg) @@ -302,7 +301,7 @@ class SpatialReference(GDALBase): "Imports the Spatial Reference from an XML string." capi.from_xml(self.ptr, xml) - #### Export Properties #### + # #### Export Properties #### @property def wkt(self): "Returns the WKT representation of this Spatial Reference." diff --git a/django/contrib/gis/gdal/tests/test_geom.py b/django/contrib/gis/gdal/tests/test_geom.py index 5696223554..33b70b4df3 100644 --- a/django/contrib/gis/gdal/tests/test_geom.py +++ b/django/contrib/gis/gdal/tests/test_geom.py @@ -198,7 +198,7 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin): prev = OGRGeometry('POINT(0 0)') for rr in self.geometries.linearrings: lr = OGRGeometry(rr.wkt) - #self.assertEqual(101, lr.geom_type.num) + # self.assertEqual(101, lr.geom_type.num) self.assertEqual('LINEARRING', lr.geom_name) self.assertEqual(rr.n_p, len(lr)) self.assertEqual(lr, OGRGeometry(rr.wkt)) diff --git a/django/contrib/gis/geoip/base.py b/django/contrib/gis/geoip/base.py index a2787af471..0b160ffea3 100644 --- a/django/contrib/gis/geoip/base.py +++ b/django/contrib/gis/geoip/base.py @@ -18,7 +18,6 @@ free_regex = re.compile(r'^GEO-\d{3}FREE') lite_regex = re.compile(r'^GEO-\d{3}LITE') -#### GeoIP classes #### class GeoIPException(Exception): pass @@ -201,7 +200,7 @@ class GeoIP(object): 'country_name': self.country_name(query), } - #### Coordinate retrieval routines #### + # #### Coordinate retrieval routines #### def coords(self, query, ordering=('longitude', 'latitude')): cdict = self.city(query) if cdict is None: @@ -226,7 +225,7 @@ class GeoIP(object): else: return None - #### GeoIP Database Information Routines #### + # #### GeoIP Database Information Routines #### @property def country_info(self): "Returns information about the GeoIP country database." @@ -253,7 +252,7 @@ class GeoIP(object): info += 'GeoIP Library:\n\t%s\n' % GeoIP_lib_version() return info + 'Country:\n\t%s\nCity:\n\t%s' % (self.country_info, self.city_info) - #### Methods for compatibility w/the GeoIP-Python API. #### + # #### Methods for compatibility w/the GeoIP-Python API. #### @classmethod def open(cls, full_path, cache): return GeoIP(full_path, cache) diff --git a/django/contrib/gis/geoip/prototypes.py b/django/contrib/gis/geoip/prototypes.py index 6b47313cfe..257e0ffacd 100644 --- a/django/contrib/gis/geoip/prototypes.py +++ b/django/contrib/gis/geoip/prototypes.py @@ -3,7 +3,7 @@ from ctypes import POINTER, Structure, c_char_p, c_float, c_int, string_at from django.contrib.gis.geoip.libgeoip import free, lgeoip -#### GeoIP C Structure definitions #### +# #### GeoIP C Structure definitions #### class GeoIPRecord(Structure): _fields_ = [('country_code', c_char_p), @@ -37,7 +37,7 @@ class GeoIPTag(Structure): RECTYPE = POINTER(GeoIPRecord) DBTYPE = POINTER(GeoIPTag) -#### ctypes function prototypes #### +# #### ctypes function prototypes #### # GeoIP_lib_version appeared in version 1.4.7. if hasattr(lgeoip, 'GeoIP_lib_version'): diff --git a/django/contrib/gis/geos/collections.py b/django/contrib/gis/geos/collections.py index 84b872602d..0b787f9d53 100644 --- a/django/contrib/gis/geos/collections.py +++ b/django/contrib/gis/geos/collections.py @@ -50,7 +50,7 @@ class GeometryCollection(GEOSGeometry): "Returns the number of geometries in this Collection." return self.num_geom - ### Methods for compatibility with ListMixin ### + # ### Methods for compatibility with ListMixin ### def _create_collection(self, length, items): # Creating the geometry pointer array. geoms = get_pointer_arr(length) diff --git a/django/contrib/gis/geos/coordseq.py b/django/contrib/gis/geos/coordseq.py index 8185ab43cc..de3583e499 100644 --- a/django/contrib/gis/geos/coordseq.py +++ b/django/contrib/gis/geos/coordseq.py @@ -17,7 +17,6 @@ class GEOSCoordSeq(GEOSBase): ptr_type = CS_PTR - #### Python 'magic' routines #### def __init__(self, ptr, z=False): "Initializes from a GEOS pointer." if not isinstance(ptr, CS_PTR): @@ -69,7 +68,7 @@ class GEOSCoordSeq(GEOSBase): if set_3d: self.setZ(index, value[2]) - #### Internal Routines #### + # #### Internal Routines #### def _checkindex(self, index): "Checks the given index." sz = self.size @@ -81,7 +80,7 @@ class GEOSCoordSeq(GEOSBase): if dim < 0 or dim > 2: raise GEOSException('invalid ordinate dimension "%d"' % dim) - #### Ordinate getting and setting routines #### + # #### Ordinate getting and setting routines #### def getOrdinate(self, dimension, index): "Returns the value for the given dimension and index." self._checkindex(index) @@ -118,7 +117,7 @@ class GEOSCoordSeq(GEOSBase): "Set Z with the value at the given index." self.setOrdinate(2, index, value) - ### Dimensions ### + # ### Dimensions ### @property def size(self): "Returns the size of this coordinate sequence." @@ -137,7 +136,7 @@ class GEOSCoordSeq(GEOSBase): """ return self._z - ### Other Methods ### + # ### Other Methods ### def clone(self): "Clones this coordinate sequence." return GEOSCoordSeq(capi.cs_clone(self.ptr), self.hasz) diff --git a/django/contrib/gis/geos/geometry.py b/django/contrib/gis/geos/geometry.py index 5b478857ec..98ccda1057 100644 --- a/django/contrib/gis/geos/geometry.py +++ b/django/contrib/gis/geos/geometry.py @@ -30,7 +30,6 @@ class GEOSGeometry(GEOSBase, ListMixin): ptr_type = GEOM_PTR - #### Python 'magic' routines #### def __init__(self, geo_input, srid=None): """ The base constructor for GEOS geometry objects, and may take the @@ -162,7 +161,7 @@ class GEOSGeometry(GEOSBase, ListMixin): "The not equals operator." return not (self == other) - ### Geometry set-like operations ### + # ### Geometry set-like operations ### # Thanks to Sean Gillies for inspiration: # http://lists.gispython.org/pipermail/community/2007-July/001034.html # g = g1 | g2 @@ -185,7 +184,7 @@ class GEOSGeometry(GEOSBase, ListMixin): "Return the symmetric difference of this Geometry and the other." return self.sym_difference(other) - #### Coordinate Sequence Routines #### + # #### Coordinate Sequence Routines #### @property def has_cs(self): "Returns True if this Geometry has a coordinate sequence, False if not." @@ -208,7 +207,7 @@ class GEOSGeometry(GEOSBase, ListMixin): if self.has_cs: return self._cs.clone() - #### Geometry Info #### + # #### Geometry Info #### @property def geom_type(self): "Returns a string representing the Geometry type, e.g. 'Polygon'" @@ -243,7 +242,7 @@ class GEOSGeometry(GEOSBase, ListMixin): "Converts this Geometry to normal form (or canonical form)." return capi.geos_normalize(self.ptr) - #### Unary predicates #### + # #### Unary predicates #### @property def empty(self): """ @@ -279,7 +278,7 @@ class GEOSGeometry(GEOSBase, ListMixin): """ return capi.geos_isvalidreason(self.ptr).decode() - #### Binary predicates. #### + # #### Binary predicates. #### def contains(self, other): "Returns true if other.within(this) returns true." return capi.geos_contains(self.ptr, other.ptr) @@ -347,7 +346,7 @@ class GEOSGeometry(GEOSBase, ListMixin): """ return capi.geos_within(self.ptr, other.ptr) - #### SRID Routines #### + # #### SRID Routines #### def get_srid(self): "Gets the SRID for the geometry, returns None if no SRID is set." s = capi.geos_get_srid(self.ptr) @@ -361,7 +360,7 @@ class GEOSGeometry(GEOSBase, ListMixin): capi.geos_set_srid(self.ptr, srid) srid = property(get_srid, set_srid) - #### Output Routines #### + # #### Output Routines #### @property def ewkt(self): """ @@ -441,7 +440,7 @@ class GEOSGeometry(GEOSBase, ListMixin): """ return PreparedGeometry(self) - #### GDAL-specific output routines #### + # #### GDAL-specific output routines #### @property def ogr(self): "Returns the OGR Geometry for this Geometry." @@ -512,7 +511,7 @@ class GEOSGeometry(GEOSBase, ListMixin): else: raise GEOSException('Transformed WKB was invalid.') - #### Topology Routines #### + # #### Topology Routines #### def _topology(self, gptr): "Helper routine to return Geometry from the given pointer." return GEOSGeometry(gptr, srid=self.srid) @@ -626,7 +625,7 @@ class GEOSGeometry(GEOSBase, ListMixin): "Returns a Geometry representing all the points in this Geometry and other." return self._topology(capi.geos_union(self.ptr, other.ptr)) - #### Other Routines #### + # #### Other Routines #### @property def area(self): "Returns the area of the Geometry." diff --git a/django/contrib/gis/geos/libgeos.py b/django/contrib/gis/geos/libgeos.py index fa5fa21a25..66c61f3a82 100644 --- a/django/contrib/gis/geos/libgeos.py +++ b/django/contrib/gis/geos/libgeos.py @@ -87,7 +87,7 @@ def error_h(fmt, lst): logger.error('GEOS_ERROR: %s\n' % err_msg) error_h = ERRORFUNC(error_h) -#### GEOS Geometry C data structures, and utility functions. #### +# #### GEOS Geometry C data structures, and utility functions. #### # Opaque GEOS geometry structures, used for GEOM_PTR and CS_PTR diff --git a/django/contrib/gis/geos/linestring.py b/django/contrib/gis/geos/linestring.py index 62802c1efd..7b2cc540ba 100644 --- a/django/contrib/gis/geos/linestring.py +++ b/django/contrib/gis/geos/linestring.py @@ -11,7 +11,6 @@ class LineString(GEOSGeometry): _init_func = capi.create_linestring _minlength = 2 - #### Python 'magic' routines #### def __init__(self, *args, **kwargs): """ Initializes on the given sequence -- may take lists, tuples, NumPy arrays @@ -116,7 +115,7 @@ class LineString(GEOSGeometry): if dim not in (2, 3): raise TypeError('Dimension mismatch.') - #### Sequence Properties #### + # #### Sequence Properties #### @property def tuple(self): "Returns a tuple version of the geometry from the coordinate sequence." diff --git a/django/contrib/gis/geos/mutable_list.py b/django/contrib/gis/geos/mutable_list.py index 805351f252..6b60465431 100644 --- a/django/contrib/gis/geos/mutable_list.py +++ b/django/contrib/gis/geos/mutable_list.py @@ -63,7 +63,7 @@ class ListMixin(object): _maxlength = None _IndexError = IndexError - ### Python initialization and special list interface methods ### + # ### Python initialization and special list interface methods ### def __init__(self, *args, **kwargs): if not hasattr(self, '_get_single_internal'): @@ -117,7 +117,7 @@ class ListMixin(object): for i in range(len(self)): yield self[i] - ### Special methods for arithmetic operations ### + # ### Special methods for arithmetic operations ### def __add__(self, other): 'add another list-like object' return self.__class__(list(self) + list(other)) @@ -175,8 +175,8 @@ class ListMixin(object): return False return len(self) < olen - ### Public list interface Methods ### - ## Non-mutating ## + # ### Public list interface Methods ### + # ## Non-mutating ## def count(self, val): "Standard list count method" count = 0 @@ -192,7 +192,7 @@ class ListMixin(object): return i raise ValueError('%s not found in object' % str(val)) - ## Mutating ## + # ## Mutating ## def append(self, val): "Standard list append method" self[len(self):] = [val] @@ -235,7 +235,7 @@ class ListMixin(object): temp.sort(reverse=reverse) self[:] = temp - ### Private routines ### + # ### Private routines ### def _rebuild(self, newLen, newItems): if newLen < self._minlength: raise ValueError('Must have at least %d items' % self._minlength) diff --git a/django/contrib/gis/geos/point.py b/django/contrib/gis/geos/point.py index 0b58098fed..e53a4569bf 100644 --- a/django/contrib/gis/geos/point.py +++ b/django/contrib/gis/geos/point.py @@ -129,7 +129,7 @@ class Point(GEOSGeometry): y = property(get_y, set_y) z = property(get_z, set_z) - ### Tuple setting and retrieval routines. ### + # ### Tuple setting and retrieval routines. ### def get_coords(self): "Returns a tuple of the point." return self._cs.tuple diff --git a/django/contrib/gis/geos/polygon.py b/django/contrib/gis/geos/polygon.py index c8059348cd..fdf7515bed 100644 --- a/django/contrib/gis/geos/polygon.py +++ b/django/contrib/gis/geos/polygon.py @@ -67,7 +67,7 @@ class Polygon(GEOSGeometry): (x0, y0, x0, y1, x1, y1, x1, y0, x0, y0)) return Polygon(((x0, y0), (x0, y1), (x1, y1), (x1, y0), (x0, y0))) - ### These routines are needed for list-like operation w/ListMixin ### + # ### These routines are needed for list-like operation w/ListMixin ### def _create_polygon(self, length, items): # Instantiate LinearRing objects if necessary, but don't clone them yet # _construct_ring will throw a TypeError if a parameter isn't a valid ring @@ -144,7 +144,7 @@ class Polygon(GEOSGeometry): _set_single = GEOSGeometry._set_single_rebuild _assign_extended_slice = GEOSGeometry._assign_extended_slice_rebuild - #### Polygon Properties #### + # #### Polygon Properties #### @property def num_interior_rings(self): "Returns the number of interior rings." diff --git a/django/contrib/gis/geos/prototypes/coordseq.py b/django/contrib/gis/geos/prototypes/coordseq.py index 3e5204e5fe..1cdc4ccdcc 100644 --- a/django/contrib/gis/geos/prototypes/coordseq.py +++ b/django/contrib/gis/geos/prototypes/coordseq.py @@ -7,7 +7,7 @@ from django.contrib.gis.geos.prototypes.errcheck import ( from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc -## Error-checking routines specific to coordinate sequences. ## +# ## Error-checking routines specific to coordinate sequences. ## def check_cs_ptr(result, func, cargs): "Error checking on routines that return Geometries." if not result: @@ -33,7 +33,7 @@ def check_cs_get(result, func, cargs): return last_arg_byref(cargs) -## Coordinate sequence prototype generation functions. ## +# ## Coordinate sequence prototype generation functions. ## def cs_int(func): "For coordinate sequence routines that return an integer." func.argtypes = [CS_PTR, POINTER(c_uint)] @@ -69,7 +69,7 @@ def cs_output(func, argtypes): func.errcheck = check_cs_ptr return func -## Coordinate Sequence ctypes prototypes ## +# ## Coordinate Sequence ctypes prototypes ## # Coordinate Sequence constructors & cloning. cs_clone = cs_output(GEOSFunc('GEOSCoordSeq_clone'), [CS_PTR]) diff --git a/django/contrib/gis/geos/prototypes/errcheck.py b/django/contrib/gis/geos/prototypes/errcheck.py index dd037a5632..b97440ab01 100644 --- a/django/contrib/gis/geos/prototypes/errcheck.py +++ b/django/contrib/gis/geos/prototypes/errcheck.py @@ -13,7 +13,6 @@ free.argtypes = [c_void_p] free.restype = None -### ctypes error checking routines ### def last_arg_byref(args): "Returns the last C argument's value by reference." return args[-1]._obj.value diff --git a/django/contrib/gis/geos/prototypes/geom.py b/django/contrib/gis/geos/prototypes/geom.py index b8320471e9..da2452c169 100644 --- a/django/contrib/gis/geos/prototypes/geom.py +++ b/django/contrib/gis/geos/prototypes/geom.py @@ -21,7 +21,7 @@ class geos_char_p(c_char_p): pass -### ctypes generation functions ### +# ### ctypes generation functions ### def bin_constructor(func): "Generates a prototype for binary construction (HEX, WKB) GEOS routines." func.argtypes = [c_char_p, c_size_t] @@ -71,7 +71,7 @@ def string_from_geom(func): func.errcheck = check_string return func -### ctypes prototypes ### +# ### ctypes prototypes ### # Deprecated creation routines from WKB, HEX, WKT from_hex = bin_constructor(GEOSFunc('GEOSGeomFromHEX_buf')) diff --git a/django/contrib/gis/geos/prototypes/io.py b/django/contrib/gis/geos/prototypes/io.py index 55fd6d2f17..168d472311 100644 --- a/django/contrib/gis/geos/prototypes/io.py +++ b/django/contrib/gis/geos/prototypes/io.py @@ -12,7 +12,7 @@ from django.utils import six from django.utils.encoding import force_bytes -### The WKB/WKT Reader/Writer structures and pointers ### +# ### The WKB/WKT Reader/Writer structures and pointers ### class WKTReader_st(Structure): pass @@ -33,7 +33,7 @@ WKT_WRITE_PTR = POINTER(WKTWriter_st) WKB_READ_PTR = POINTER(WKBReader_st) WKB_WRITE_PTR = POINTER(WKBReader_st) -### WKTReader routines ### +# WKTReader routines wkt_reader_create = GEOSFunc('GEOSWKTReader_create') wkt_reader_create.restype = WKT_READ_PTR @@ -45,7 +45,7 @@ wkt_reader_read.argtypes = [WKT_READ_PTR, c_char_p] wkt_reader_read.restype = GEOM_PTR wkt_reader_read.errcheck = check_geom -### WKTWriter routines ### +# WKTWriter routines wkt_writer_create = GEOSFunc('GEOSWKTWriter_create') wkt_writer_create.restype = WKT_WRITE_PTR @@ -69,7 +69,7 @@ except AttributeError: wkt_writer_get_outdim = lambda ptr: 2 wkt_writer_set_outdim = lambda ptr, dim: None -### WKBReader routines ### +# WKBReader routines wkb_reader_create = GEOSFunc('GEOSWKBReader_create') wkb_reader_create.restype = WKB_READ_PTR @@ -91,7 +91,7 @@ def wkb_read_func(func): wkb_reader_read = wkb_read_func(GEOSFunc('GEOSWKBReader_read')) wkb_reader_read_hex = wkb_read_func(GEOSFunc('GEOSWKBReader_readHEX')) -### WKBWriter routines ### +# WKBWriter routines wkb_writer_create = GEOSFunc('GEOSWKBWriter_create') wkb_writer_create.restype = WKB_WRITE_PTR @@ -129,7 +129,7 @@ wkb_writer_get_include_srid = wkb_writer_get(GEOSFunc('GEOSWKBWriter_getIncludeS wkb_writer_set_include_srid = wkb_writer_set(GEOSFunc('GEOSWKBWriter_setIncludeSRID'), argtype=c_char) -### Base I/O Class ### +# ### Base I/O Class ### class IOBase(GEOSBase): "Base class for GEOS I/O objects." def __init__(self): @@ -141,7 +141,7 @@ class IOBase(GEOSBase): if self._ptr: self._destructor(self._ptr) -### Base WKB/WKT Reading and Writing objects ### +# ### Base WKB/WKT Reading and Writing objects ### # Non-public WKB/WKT reader classes for internal use because @@ -174,7 +174,7 @@ class _WKBReader(IOBase): raise TypeError -### WKB/WKT Writer Classes ### +# ### WKB/WKT Writer Classes ### class WKTWriter(IOBase): _constructor = wkt_writer_create _destructor = wkt_writer_destroy @@ -208,7 +208,7 @@ class WKBWriter(IOBase): "Returns the HEXEWKB representation of the given geometry." return wkb_writer_write_hex(self.ptr, geom.ptr, byref(c_size_t())) - ### WKBWriter Properties ### + # ### WKBWriter Properties ### # Property for getting/setting the byteorder. def _get_byteorder(self): diff --git a/django/contrib/gis/geos/prototypes/misc.py b/django/contrib/gis/geos/prototypes/misc.py index 9dba880f18..0a8b388618 100644 --- a/django/contrib/gis/geos/prototypes/misc.py +++ b/django/contrib/gis/geos/prototypes/misc.py @@ -13,7 +13,7 @@ from django.utils.six.moves import range __all__ = ['geos_area', 'geos_distance', 'geos_length', 'geos_isvalidreason'] -### ctypes generator function ### +# ### ctypes generator function ### def dbl_from_geom(func, num_geom=1): """ Argument is a Geometry, return type is double that is passed @@ -26,7 +26,7 @@ def dbl_from_geom(func, num_geom=1): func.errcheck = check_dbl return func -### ctypes prototypes ### +# ### ctypes prototypes ### # Area, distance, and length prototypes. geos_area = dbl_from_geom(GEOSFunc('GEOSArea')) diff --git a/django/contrib/gis/geos/prototypes/predicates.py b/django/contrib/gis/geos/prototypes/predicates.py index 0146784d03..6ef979422c 100644 --- a/django/contrib/gis/geos/prototypes/predicates.py +++ b/django/contrib/gis/geos/prototypes/predicates.py @@ -9,7 +9,7 @@ from django.contrib.gis.geos.prototypes.errcheck import check_predicate from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc -## Binary & unary predicate functions ## +# ## Binary & unary predicate functions ## def binary_predicate(func, *args): "For GEOS binary predicate functions." argtypes = [GEOM_PTR, GEOM_PTR] @@ -28,14 +28,14 @@ def unary_predicate(func): func.errcheck = check_predicate return func -## Unary Predicates ## +# ## Unary Predicates ## geos_hasz = unary_predicate(GEOSFunc('GEOSHasZ')) geos_isempty = unary_predicate(GEOSFunc('GEOSisEmpty')) geos_isring = unary_predicate(GEOSFunc('GEOSisRing')) geos_issimple = unary_predicate(GEOSFunc('GEOSisSimple')) geos_isvalid = unary_predicate(GEOSFunc('GEOSisValid')) -## Binary Predicates ## +# ## Binary Predicates ## geos_contains = binary_predicate(GEOSFunc('GEOSContains')) geos_crosses = binary_predicate(GEOSFunc('GEOSCrosses')) geos_disjoint = binary_predicate(GEOSFunc('GEOSDisjoint')) diff --git a/django/contrib/gis/geos/prototypes/topology.py b/django/contrib/gis/geos/prototypes/topology.py index 0e318409ee..5729256d9d 100644 --- a/django/contrib/gis/geos/prototypes/topology.py +++ b/django/contrib/gis/geos/prototypes/topology.py @@ -30,7 +30,7 @@ def topology(func, *args, **kwargs): func.errcheck = kwargs.get('errcheck', check_geom) return func -### Topology Routines ### +# Topology Routines geos_boundary = topology(GEOSFunc('GEOSBoundary')) geos_buffer = topology(GEOSFunc('GEOSBuffer'), c_double, c_int) geos_centroid = topology(GEOSFunc('GEOSGetCentroid')) diff --git a/django/contrib/gis/geos/tests/test_geos.py b/django/contrib/gis/geos/tests/test_geos.py index 4158faeaa7..7c9c1e829e 100644 --- a/django/contrib/gis/geos/tests/test_geos.py +++ b/django/contrib/gis/geos/tests/test_geos.py @@ -464,7 +464,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin): def test_memory_hijinks(self): "Testing Geometry __del__() on rings and polygons." - #### Memory issues with rings and polygons + # #### Memory issues with rings and poly # These tests are needed to ensure sanity with writable geometries. @@ -659,7 +659,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin): def test_mutable_geometries(self): "Testing the mutability of Polygons and Geometry Collections." - ### Testing the mutability of Polygons ### + # ### Testing the mutability of Polygons ### for p in self.geometries.polygons: poly = fromstr(p.wkt) @@ -679,7 +679,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin): self.assertEqual(poly.exterior_ring, new_shell) self.assertEqual(poly[0], new_shell) - ### Testing the mutability of Geometry Collections + # ### Testing the mutability of Geometry Collections for tg in self.geometries.multipoints: mp = fromstr(tg.wkt) for i in range(len(mp)): @@ -717,11 +717,11 @@ class GEOSTest(unittest.TestCase, TestDataMixin): # Extreme (!!) __setitem__ -- no longer works, have to detect # in the first object that __setitem__ is called in the subsequent # objects -- maybe mpoly[0, 0, 0] = (3.14, 2.71)? - #mpoly[0][0][0] = (3.14, 2.71) - #self.assertEqual((3.14, 2.71), mpoly[0][0][0]) + # mpoly[0][0][0] = (3.14, 2.71) + # self.assertEqual((3.14, 2.71), mpoly[0][0][0]) # Doing it more slowly.. - #self.assertEqual((3.14, 2.71), mpoly[0].shell[0]) - #del mpoly + # self.assertEqual((3.14, 2.71), mpoly[0].shell[0]) + # del mpoly def test_threed(self): "Testing three-dimensional geometries." diff --git a/django/contrib/gis/tests/geoapp/tests.py b/django/contrib/gis/tests/geoapp/tests.py index 9b45492715..23a7437231 100644 --- a/django/contrib/gis/tests/geoapp/tests.py +++ b/django/contrib/gis/tests/geoapp/tests.py @@ -39,7 +39,7 @@ class GeoModelTest(TestCase): def test_proxy(self): "Testing Lazy-Geometry support (using the GeometryProxy)." - ## Testing on a Point + # Testing on a Point pnt = Point(0, 0) nullcity = City(name='NullCity', point=pnt) nullcity.save() @@ -76,7 +76,7 @@ class GeoModelTest(TestCase): self.assertEqual(Point(23, 5), City.objects.get(name='NullCity').point) nullcity.delete() - ## Testing on a Polygon + # Testing on a Polygon shell = LinearRing((0, 0), (0, 100), (100, 100), (100, 0), (0, 0)) inner = LinearRing((40, 40), (40, 60), (60, 60), (60, 40), (40, 40)) diff --git a/django/contrib/gis/utils/layermapping.py b/django/contrib/gis/utils/layermapping.py index 30e773d69d..c9badc7522 100644 --- a/django/contrib/gis/utils/layermapping.py +++ b/django/contrib/gis/utils/layermapping.py @@ -147,7 +147,7 @@ class LayerMapping(object): else: raise LayerMapError('Unrecognized transaction mode: %s' % transaction_mode) - #### Checking routines used during initialization #### + # #### Checking routines used during initialization #### def check_fid_range(self, fid_range): "This checks the `fid_range` keyword." if fid_range: @@ -334,7 +334,7 @@ class LayerMapping(object): else: return {fld: kwargs[fld] for fld in self.unique} - #### Verification routines used in constructing model keyword arguments. #### + # #### Verification routines used in constructing model keyword arguments. #### def verify_ogr_field(self, ogr_field, model_field): """ Verifies if the OGR Field contents are acceptable to the Django @@ -444,7 +444,7 @@ class LayerMapping(object): # Returning the WKT of the geometry. return g.wkt - #### Other model methods #### + # #### Other model methods #### def coord_transform(self): "Returns the coordinate transformation object." SpatialRefSys = self.spatial_backend.spatial_ref_sys() diff --git a/django/db/backends/base/base.py b/django/db/backends/base/base.py index 460fceab71..ad6b4f3df1 100644 --- a/django/db/backends/base/base.py +++ b/django/db/backends/base/base.py @@ -83,7 +83,7 @@ class BaseDatabaseWrapper(object): "will be returned.".format(self.queries_log.maxlen)) return list(self.queries_log) - ##### Backend-specific methods for creating connections and cursors ##### + # ##### Backend-specific methods for creating connections and cursors ##### def get_connection_params(self): """Returns a dict of parameters suitable for get_new_connection.""" @@ -101,7 +101,7 @@ class BaseDatabaseWrapper(object): """Creates a cursor. Assumes that a connection is established.""" raise NotImplementedError('subclasses of BaseDatabaseWrapper may require a create_cursor() method') - ##### Backend-specific methods for creating connections ##### + # ##### Backend-specific methods for creating connections ##### def connect(self): """Connects to the database. Assumes that the connection is closed.""" @@ -129,7 +129,7 @@ class BaseDatabaseWrapper(object): with self.wrap_database_errors: self.connect() - ##### Backend-specific wrappers for PEP-249 connection methods ##### + # ##### Backend-specific wrappers for PEP-249 connection methods ##### def _cursor(self): self.ensure_connection() @@ -151,7 +151,7 @@ class BaseDatabaseWrapper(object): with self.wrap_database_errors: return self.connection.close() - ##### Generic wrappers for PEP-249 connection methods ##### + # ##### Generic wrappers for PEP-249 connection methods ##### def cursor(self): """ @@ -203,7 +203,7 @@ class BaseDatabaseWrapper(object): else: self.connection = None - ##### Backend-specific savepoint management methods ##### + # ##### Backend-specific savepoint management methods ##### def _savepoint(self, sid): with self.cursor() as cursor: @@ -221,7 +221,7 @@ class BaseDatabaseWrapper(object): # Savepoints cannot be created outside a transaction return self.features.uses_savepoints and not self.get_autocommit() - ##### Generic savepoint management methods ##### + # ##### Generic savepoint management methods ##### def savepoint(self): """ @@ -269,7 +269,7 @@ class BaseDatabaseWrapper(object): """ self.savepoint_state = 0 - ##### Backend-specific transaction management methods ##### + # ##### Backend-specific transaction management methods ##### def _set_autocommit(self, autocommit): """ @@ -277,7 +277,7 @@ class BaseDatabaseWrapper(object): """ raise NotImplementedError('subclasses of BaseDatabaseWrapper may require a _set_autocommit() method') - ##### Generic transaction management methods ##### + # ##### Generic transaction management methods ##### def get_autocommit(self): """ @@ -327,7 +327,7 @@ class BaseDatabaseWrapper(object): "An error occurred in the current transaction. You can't " "execute queries until the end of the 'atomic' block.") - ##### Foreign key constraints checks handling ##### + # ##### Foreign key constraints checks handling ##### @contextmanager def constraint_checks_disabled(self): @@ -364,7 +364,7 @@ class BaseDatabaseWrapper(object): """ pass - ##### Connection termination handling ##### + # ##### Connection termination handling ##### def is_usable(self): """ @@ -403,7 +403,7 @@ class BaseDatabaseWrapper(object): self.close() return - ##### Thread safety handling ##### + # ##### Thread safety handling ##### def validate_thread_sharing(self): """ @@ -420,7 +420,7 @@ class BaseDatabaseWrapper(object): "thread id %s." % (self.alias, self._thread_ident, thread.get_ident())) - ##### Miscellaneous ##### + # ##### Miscellaneous ##### def prepare_database(self): """ diff --git a/django/template/__init__.py b/django/template/__init__.py index 3d26bcc945..b2566decad 100644 --- a/django/template/__init__.py +++ b/django/template/__init__.py @@ -39,7 +39,7 @@ Shared: """ -### Multiple Template Engines +# Multiple Template Engines from .engine import Engine @@ -51,7 +51,7 @@ engines = EngineHandler() __all__ = ('Engine', 'engines') -### Django Template Language +# Django Template Language # Public exceptions from .base import (TemplateDoesNotExist, TemplateSyntaxError, # NOQA diff --git a/docs/_ext/applyxrefs.py b/docs/_ext/applyxrefs.py index 2dbebde0a3..ecc67bc877 100644 --- a/docs/_ext/applyxrefs.py +++ b/docs/_ext/applyxrefs.py @@ -34,7 +34,7 @@ def has_target(fn): print("Can't open or read %s. Not touching it." % fn) return (True, None) - #print fn, len(lines) + # print fn, len(lines) if len(lines) < 1: print("Not touching empty file %s." % fn) return (True, None) @@ -56,7 +56,7 @@ def main(argv=None): files.extend((dirpath, f) for f in filenames) files.sort() files = [os.path.join(p, fn) for p, fn in files if fn.endswith('.txt')] - #print files + # print files for fn in files: if fn in DONT_TOUCH: diff --git a/docs/conf.py b/docs/conf.py index 6a7a5a6af9..8805f75740 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -56,7 +56,7 @@ spelling_word_list_filename = 'spelling_wordlist' source_suffix = '.txt' # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'contents' @@ -91,14 +91,14 @@ django_next_version = '1.9' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +# language = None # Location for .po/.mo translation files used when language is set locale_dirs = ['locale/'] # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. today_fmt = '%B %d, %Y' @@ -107,7 +107,7 @@ today_fmt = '%B %d, %Y' exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. add_function_parentheses = True @@ -145,31 +145,31 @@ html_theme = "djangodocs" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. html_theme_path = ["_theme"] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -#html_title = None +# html_title = None # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +# html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +# html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -#html_static_path = ["_static"] +# html_static_path = ["_static"] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. @@ -183,40 +183,40 @@ html_use_smartypants = True html_translator_class = "djangodocs.DjangoHTMLTranslator" # Content template for the index page. -#html_index = '' +# html_index = '' # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. html_additional_pages = {} # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'Djangodoc' @@ -241,7 +241,7 @@ latex_elements = { # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, document class [howto/manual]). -#latex_documents = [] +# latex_documents = [] latex_documents = [ ('contents', 'django.tex', 'Django Documentation', 'Django Software Foundation', 'manual'), @@ -249,23 +249,23 @@ latex_documents = [ # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +# latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_domain_indices = True +# latex_domain_indices = True # -- Options for manual page output -------------------------------------------- @@ -296,7 +296,7 @@ epub_publisher = 'Django Software Foundation' epub_copyright = copyright # The basename for the epub file. It defaults to the project name. -#epub_basename = 'Django' +# epub_basename = 'Django' # The HTML theme for the epub output. Since the default themes are not optimized # for small screen space, using the same theme for HTML and epub output is @@ -306,55 +306,55 @@ epub_theme = 'djangodocs-epub' # The language of the text. It defaults to the language option # or en if the language is not set. -#epub_language = '' +# epub_language = '' # The scheme of the identifier. Typical schemes are ISBN or URL. -#epub_scheme = '' +# epub_scheme = '' # The unique identifier of the text. This can be an ISBN number # or the project homepage. -#epub_identifier = '' +# epub_identifier = '' # A unique identification for the text. -#epub_uid = '' +# epub_uid = '' # A tuple containing the cover image and cover page html template filenames. epub_cover = ('', 'epub-cover.html') # A sequence of (type, uri, title) tuples for the guide element of content.opf. -#epub_guide = () +# epub_guide = () # HTML files that should be inserted before the pages created by sphinx. # The format is a list of tuples containing the path and title. -#epub_pre_files = [] +# epub_pre_files = [] # HTML files shat should be inserted after the pages created by sphinx. # The format is a list of tuples containing the path and title. -#epub_post_files = [] +# epub_post_files = [] # A list of files that should not be packed into the epub file. -#epub_exclude_files = [] +# epub_exclude_files = [] # The depth of the table of contents in toc.ncx. -#epub_tocdepth = 3 +# epub_tocdepth = 3 # Allow duplicate toc entries. -#epub_tocdup = True +# epub_tocdup = True # Choose between 'default' and 'includehidden'. -#epub_tocscope = 'default' +# epub_tocscope = 'default' # Fix unsupported image types using the PIL. -#epub_fix_images = False +# epub_fix_images = False # Scale large images. -#epub_max_image_width = 0 +# epub_max_image_width = 0 # How to display URL addresses: 'footnote', 'no', or 'inline'. -#epub_show_urls = 'inline' +# epub_show_urls = 'inline' # If false, no index is generated. -#epub_use_index = True +# epub_use_index = True # -- ticket options ------------------------------------------------------------ ticket_url = 'https://code.djangoproject.com/ticket/%s' diff --git a/setup.cfg b/setup.cfg index a29bd9e153..44540586eb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,7 +4,7 @@ install-script = scripts/rpm-install.sh [flake8] exclude=build,.git,./django/utils/lru_cache.py,./django/utils/six.py,./django/conf/app_template/*,./django/dispatch/weakref_backports.py,./tests/.env,./xmlrunner -ignore=E123,E128,E265,E501,W601 +ignore=E123,E128,E501,W601 max-line-length = 119 [isort] diff --git a/tests/backends/tests.py b/tests/backends/tests.py index a9f8f26618..8762d263b9 100644 --- a/tests/backends/tests.py +++ b/tests/backends/tests.py @@ -467,7 +467,7 @@ class EscapingChecks(TestCase): @unittest.skipUnless(connection.vendor == 'sqlite', "This is an sqlite-specific issue") def test_sqlite_parameter_escaping(self): - #13648: '%s' escaping support for sqlite3 + # '%s' escaping support for sqlite3 #13648 cursor = connection.cursor() cursor.execute("select strftime('%s', date('now'))") response = cursor.fetchall()[0][0] @@ -505,7 +505,7 @@ class BackendTestCase(TransactionTestCase): cursor.execute(query, args) def test_cursor_executemany(self): - #4896: Test cursor.executemany + # Test cursor.executemany #4896 args = [(i, i ** 2) for i in range(-5, 6)] self.create_squares_with_executemany(args) self.assertEqual(models.Square.objects.count(), 11) @@ -514,13 +514,13 @@ class BackendTestCase(TransactionTestCase): self.assertEqual(square.square, i ** 2) def test_cursor_executemany_with_empty_params_list(self): - #4765: executemany with params=[] does nothing + # Test executemany with params=[] does nothing #4765 args = [] self.create_squares_with_executemany(args) self.assertEqual(models.Square.objects.count(), 0) def test_cursor_executemany_with_iterator(self): - #10320: executemany accepts iterators + # Test executemany accepts iterators #10320 args = iter((i, i ** 2) for i in range(-3, 2)) self.create_squares_with_executemany(args) self.assertEqual(models.Square.objects.count(), 5) @@ -533,14 +533,14 @@ class BackendTestCase(TransactionTestCase): @skipUnlessDBFeature('supports_paramstyle_pyformat') def test_cursor_execute_with_pyformat(self): - #10070: Support pyformat style passing of parameters + # Support pyformat style passing of parameters #10070 args = {'root': 3, 'square': 9} self.create_squares(args, 'pyformat', multiple=False) self.assertEqual(models.Square.objects.count(), 1) @skipUnlessDBFeature('supports_paramstyle_pyformat') def test_cursor_executemany_with_pyformat(self): - #10070: Support pyformat style passing of parameters + # Support pyformat style passing of parameters #10070 args = [{'root': i, 'square': i ** 2} for i in range(-5, 6)] self.create_squares(args, 'pyformat', multiple=True) self.assertEqual(models.Square.objects.count(), 11) @@ -561,7 +561,7 @@ class BackendTestCase(TransactionTestCase): self.assertEqual(models.Square.objects.count(), 9) def test_unicode_fetches(self): - #6254: fetchone, fetchmany, fetchall return strings as unicode objects + # fetchone, fetchmany, fetchall return strings as unicode objects #6254 qn = connection.ops.quote_name models.Person(first_name="John", last_name="Doe").save() models.Person(first_name="Jane", last_name="Doe").save() diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py index bea1c50b7e..da371dc74b 100644 --- a/tests/httpwrappers/tests.py +++ b/tests/httpwrappers/tests.py @@ -346,7 +346,7 @@ class HttpResponseTests(unittest.TestCase): # test odd inputs r = HttpResponse() r.content = ['1', '2', 3, '\u079e'] - #'\xde\x9e' == unichr(1950).encode('utf-8') + # '\xde\x9e' == unichr(1950).encode('utf-8') self.assertEqual(r.content, b'123\xde\x9e') # .content can safely be accessed multiple times. diff --git a/tests/introspection/tests.py b/tests/introspection/tests.py index 1280c13fe0..df0072ad92 100644 --- a/tests/introspection/tests.py +++ b/tests/introspection/tests.py @@ -30,7 +30,7 @@ class IntrospectionTests(TransactionTestCase): "django_table_names() returned a non-Django table") def test_django_table_names_retval_type(self): - #15216 - Table name is a list + # Table name is a list #15216 tl = connection.introspection.django_table_names(only_existing=True) self.assertIs(type(tl), list) tl = connection.introspection.django_table_names(only_existing=False) diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py index d69936636b..95defa61f8 100644 --- a/tests/migrations/test_commands.py +++ b/tests/migrations/test_commands.py @@ -360,7 +360,7 @@ class MakeMigrationsTests(MigrationTestBase): self.assertIn('\\u201c\\xd0j\\xe1\\xf1g\\xf3\\u201d', content) # title.default def test_failing_migration(self): - #21280 - If a migration fails to serialize, it shouldn't generate an empty file. + # If a migration fails to serialize, it shouldn't generate an empty file. #21280 apps.register_model('migrations', UnserializableModel) with six.assertRaisesRegex(self, ValueError, r'Cannot serialize'): diff --git a/tests/model_fields/models.py b/tests/model_fields/models.py index ee2f807146..40499b0f8c 100644 --- a/tests/model_fields/models.py +++ b/tests/model_fields/models.py @@ -168,7 +168,7 @@ class VerboseNameField(models.Model): field10 = models.FilePathField("verbose field10") field11 = models.FloatField("verbose field11") # Don't want to depend on Pillow in this test - #field_image = models.ImageField("verbose field") + # field_image = models.ImageField("verbose field") field12 = models.IntegerField("verbose field12") field13 = models.GenericIPAddressField("verbose field13", protocol="ipv4") field14 = models.NullBooleanField("verbose field14") diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py index 82fc0925d0..f1cf77a6a6 100644 --- a/tests/model_forms/tests.py +++ b/tests/model_forms/tests.py @@ -961,10 +961,10 @@ class ModelToDictTests(TestCase): with self.assertNumQueries(0): d = model_to_dict(art) - #Ensure all many-to-many categories appear in model_to_dict + # Ensure all many-to-many categories appear in model_to_dict for c in categories: self.assertIn(c.pk, d['categories']) - #Ensure many-to-many relation appears as a list + # Ensure many-to-many relation appears as a list self.assertIsInstance(d['categories'], list) diff --git a/tests/model_regress/models.py b/tests/model_regress/models.py index b899baf6ea..d4c769af55 100644 --- a/tests/model_regress/models.py +++ b/tests/model_regress/models.py @@ -28,7 +28,7 @@ class Article(models.Model): class Movie(models.Model): - #5218: Test models with non-default primary keys / AutoFields + # Test models with non-default primary keys / AutoFields #5218 movie_id = models.AutoField(primary_key=True) name = models.CharField(max_length=60) @@ -72,7 +72,7 @@ class NonAutoPK(models.Model): name = models.CharField(max_length=10, primary_key=True) -#18432: Chained foreign keys with to_field produce incorrect query +# Chained foreign keys with to_field produce incorrect query #18432 class Model1(models.Model): pkey = models.IntegerField(unique=True, db_index=True) diff --git a/tests/prefetch_related/models.py b/tests/prefetch_related/models.py index 9961fd15ae..bfc0ae0217 100644 --- a/tests/prefetch_related/models.py +++ b/tests/prefetch_related/models.py @@ -6,7 +6,7 @@ from django.db import models from django.utils.encoding import python_2_unicode_compatible -## Basic tests +# Basic tests @python_2_unicode_compatible class Author(models.Model): @@ -88,7 +88,7 @@ class BookReview(models.Model): notes = models.TextField(null=True, blank=True) -## Models for default manager tests +# Models for default manager tests class Qualification(models.Model): name = models.CharField(max_length=10) @@ -124,7 +124,7 @@ class Department(models.Model): ordering = ['id'] -## GenericRelation/GenericForeignKey tests +# GenericRelation/GenericForeignKey tests @python_2_unicode_compatible class TaggedItem(models.Model): @@ -172,7 +172,7 @@ class Comment(models.Model): ordering = ['id'] -## Models for lookup ordering tests +# Models for lookup ordering tests class House(models.Model): name = models.CharField(max_length=50) @@ -209,7 +209,7 @@ class Person(models.Model): ordering = ['id'] -## Models for nullable FK tests +# Models for nullable FK tests @python_2_unicode_compatible class Employee(models.Model): @@ -224,7 +224,7 @@ class Employee(models.Model): ordering = ['id'] -## Ticket #19607 +# Ticket #19607 @python_2_unicode_compatible class LessonEntry(models.Model): @@ -244,7 +244,7 @@ class WordEntry(models.Model): return "%s (%s)" % (self.name, self.id) -## Ticket #21410: Regression when related_name="+" +# Ticket #21410: Regression when related_name="+" @python_2_unicode_compatible class Author2(models.Model): diff --git a/tests/serializers_regress/tests.py b/tests/serializers_regress/tests.py index 1bd8469641..3653ffcf41 100644 --- a/tests/serializers_regress/tests.py +++ b/tests/serializers_regress/tests.py @@ -240,7 +240,7 @@ test_data = [ (data_obj, 81, IntegerData, -123456789), (data_obj, 82, IntegerData, 0), (data_obj, 83, IntegerData, None), - #(XX, ImageData + # (XX, ImageData (data_obj, 95, GenericIPAddressData, "fe80:1424:2223:6cff:fe8a:2e8a:2151:abcd"), (data_obj, 96, GenericIPAddressData, None), (data_obj, 100, NullBooleanData, True), diff --git a/tests/syndication_tests/tests.py b/tests/syndication_tests/tests.py index 6e08d719d4..1b03d3b192 100644 --- a/tests/syndication_tests/tests.py +++ b/tests/syndication_tests/tests.py @@ -93,7 +93,6 @@ class SyndicationFeedTest(FeedTestCase): 'link': 'http://example.com/blog/', 'language': 'en', 'lastBuildDate': last_build_date, - #'atom:link': '', 'ttl': '600', 'copyright': 'Copyright (c) 2007, Sally Smith', }) diff --git a/tests/urlpatterns_reverse/no_urls.py b/tests/urlpatterns_reverse/no_urls.py index 1cd34c78f7..e69de29bb2 100644 --- a/tests/urlpatterns_reverse/no_urls.py +++ b/tests/urlpatterns_reverse/no_urls.py @@ -1 +0,0 @@ -#from django.conf.urls import patterns, url, include