Fixed E265 comment style

This commit is contained in:
Collin Anderson 2015-02-05 13:25:34 -05:00 committed by Tim Graham
parent eb45a29565
commit db77915c9f
53 changed files with 196 additions and 208 deletions

View File

@ -163,7 +163,7 @@ class GeometryField(GeoSelectFormatMixin, Field):
self._get_srid_info(connection) self._get_srid_info(connection)
return self._units_name return self._units_name
### Routines specific to GeometryField ### # ### Routines specific to GeometryField ###
def geodetic(self, connection): def geodetic(self, connection):
""" """
Returns true if this field's SRID corresponds with a coordinate Returns true if this field's SRID corresponds with a coordinate
@ -236,7 +236,7 @@ class GeometryField(GeoSelectFormatMixin, Field):
else: else:
return gsrid return gsrid
### Routines overloaded from Field ### # ### Routines overloaded from Field ###
def contribute_to_class(self, cls, name, **kwargs): def contribute_to_class(self, cls, name, **kwargs):
super(GeometryField, self).contribute_to_class(cls, name, **kwargs) super(GeometryField, self).contribute_to_class(cls, name, **kwargs)

View File

@ -21,7 +21,7 @@ from django.utils.deprecation import RemovedInDjango20Warning
class GeoQuerySet(QuerySet): class GeoQuerySet(QuerySet):
"The Geographic QuerySet." "The Geographic QuerySet."
### GeoQuerySet Methods ### # ### GeoQuerySet Methods ###
def area(self, tolerance=0.05, **kwargs): def area(self, tolerance=0.05, **kwargs):
""" """
Returns the area of the geographic field in an `area` attribute on 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) 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): def _spatial_setup(self, att, desc=None, field_name=None, geo_field_type=None):
""" """
Performs set up for executing the spatial function. Performs set up for executing the spatial function.

View File

@ -81,7 +81,7 @@ class GeoFeedMixin(object):
raise ValueError('Geometry type "%s" not supported.' % geom.geom_type) raise ValueError('Geometry type "%s" not supported.' % geom.geom_type)
### SyndicationFeed subclasses ### # ### SyndicationFeed subclasses ###
class GeoRSSFeed(Rss201rev2Feed, GeoFeedMixin): class GeoRSSFeed(Rss201rev2Feed, GeoFeedMixin):
def rss_attributes(self): def rss_attributes(self):
attrs = super(GeoRSSFeed, self).rss_attributes() attrs = super(GeoRSSFeed, self).rss_attributes()
@ -127,7 +127,7 @@ class W3CGeoFeed(Rss201rev2Feed, GeoFeedMixin):
self.add_georss_element(handler, self.feed, w3c_geo=True) self.add_georss_element(handler, self.feed, w3c_geo=True)
### Feed subclass ### # ### Feed subclass ###
class Feed(BaseFeed): class Feed(BaseFeed):
""" """
This is a subclass of the `Feed` from `django.contrib.syndication`. This is a subclass of the `Feed` from `django.contrib.syndication`.

View File

@ -52,7 +52,6 @@ from django.utils.six.moves import range
class DataSource(GDALBase): class DataSource(GDALBase):
"Wraps an OGR Data Source object." "Wraps an OGR Data Source object."
#### Python 'magic' routines ####
def __init__(self, ds_input, ds_driver=False, write=False, encoding='utf-8'): def __init__(self, ds_input, ds_driver=False, write=False, encoding='utf-8'):
# The write flag. # The write flag.
if write: if write:

View File

@ -5,7 +5,7 @@
""" """
#### GDAL & SRS Exceptions #### # #### GDAL & SRS Exceptions ####
class GDALException(Exception): class GDALException(Exception):
pass pass
@ -27,7 +27,7 @@ class OGRIndexError(GDALException, KeyError):
""" """
silent_variable_failure = True silent_variable_failure = True
#### GDAL/OGR error checking codes and routine #### # #### GDAL/OGR error checking codes and routine ####
# OGR Error Codes # OGR Error Codes
OGRERR_DICT = { OGRERR_DICT = {

View File

@ -18,7 +18,6 @@ class Feature(GDALBase):
from a Layer object. from a Layer object.
""" """
#### Python 'magic' routines ####
def __init__(self, feat, layer): def __init__(self, feat, layer):
""" """
Initializes Feature from a pointer and its Layer object. Initializes Feature from a pointer and its Layer object.
@ -65,7 +64,7 @@ class Feature(GDALBase):
"Does equivalence testing on the features." "Does equivalence testing on the features."
return bool(capi.feature_equal(self.ptr, other._ptr)) return bool(capi.feature_equal(self.ptr, other._ptr))
#### Feature Properties #### # #### Feature Properties ####
@property @property
def encoding(self): def encoding(self):
return self._layer._ds.encoding return self._layer._ds.encoding
@ -104,7 +103,7 @@ class Feature(GDALBase):
"Returns the OGR Geometry Type for this Feture." "Returns the OGR Geometry Type for this Feture."
return OGRGeomType(capi.get_fd_geom_type(self._layer._ldefn)) return OGRGeomType(capi.get_fd_geom_type(self._layer._ldefn))
#### Feature Methods #### # #### Feature Methods ####
def get(self, field): def get(self, field):
""" """
Returns the value of the field, instead of an instance of the Field Returns the value of the field, instead of an instance of the Field

View File

@ -17,7 +17,6 @@ class Field(GDALBase):
from a Feature object. from a Feature object.
""" """
#### Python 'magic' routines ####
def __init__(self, feat, index): def __init__(self, feat, index):
""" """
Initializes on the feature object and the integer index of Initializes on the feature object and the integer index of
@ -45,7 +44,7 @@ class Field(GDALBase):
"Returns the string representation of the Field." "Returns the string representation of the Field."
return str(self.value).strip() return str(self.value).strip()
#### Field Methods #### # #### Field Methods ####
def as_double(self): def as_double(self):
"Retrieves the Field's value as a double (float)." "Retrieves the Field's value as a double (float)."
return capi.get_field_as_double(self._feat.ptr, self._index) return capi.get_field_as_double(self._feat.ptr, self._index)
@ -70,7 +69,7 @@ class Field(GDALBase):
else: else:
raise GDALException('Unable to retrieve date & time information from the field.') raise GDALException('Unable to retrieve date & time information from the field.')
#### Field Properties #### # #### Field Properties ####
@property @property
def name(self): def name(self):
"Returns the name of this Field." "Returns the name of this Field."
@ -104,7 +103,7 @@ class Field(GDALBase):
return capi.get_field_width(self.ptr) 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): class OFTInteger(Field):
_double = False _double = False

View File

@ -148,7 +148,7 @@ class OGRGeometry(GDALBase):
return OGRGeometry('POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))' % ( return OGRGeometry('POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))' % (
x0, y0, x0, y1, x1, y1, x1, y0, x0, y0)) x0, y0, x0, y1, x1, y1, x1, y0, x0, y0))
### Geometry set-like operations ### # ### Geometry set-like operations ###
# g = g1 | g2 # g = g1 | g2
def __or__(self, other): def __or__(self, other):
"Returns the union of the two geometries." "Returns the union of the two geometries."
@ -184,7 +184,7 @@ class OGRGeometry(GDALBase):
"WKT is used for the string representation." "WKT is used for the string representation."
return self.wkt return self.wkt
#### Geometry Properties #### # #### Geometry Properties ####
@property @property
def dimension(self): def dimension(self):
"Returns 0 for points, 1 for lines, and 2 for surfaces." "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." "Returns the envelope as a 4-tuple, instead of as an Envelope object."
return self.envelope.tuple return self.envelope.tuple
#### SpatialReference-related Properties #### # #### SpatialReference-related Properties ####
# The SRS property # The SRS property
def _get_srs(self): def _get_srs(self):
@ -291,7 +291,7 @@ class OGRGeometry(GDALBase):
srid = property(_get_srid, _set_srid) srid = property(_get_srid, _set_srid)
#### Output Methods #### # #### Output Methods ####
@property @property
def geos(self): def geos(self):
"Returns a GEOSGeometry object from this OGRGeometry." "Returns a GEOSGeometry object from this OGRGeometry."
@ -354,7 +354,7 @@ class OGRGeometry(GDALBase):
else: else:
return self.wkt return self.wkt
#### Geometry Methods #### # #### Geometry Methods ####
def clone(self): def clone(self):
"Clones this OGR Geometry." "Clones this OGR Geometry."
return OGRGeometry(capi.clone_geom(self.ptr), self.srs) return OGRGeometry(capi.clone_geom(self.ptr), self.srs)
@ -399,7 +399,7 @@ class OGRGeometry(GDALBase):
"For backwards-compatibility." "For backwards-compatibility."
self.transform(srs) self.transform(srs)
#### Topology Methods #### # #### Topology Methods ####
def _topology(self, func, other): def _topology(self, func, other):
"""A generalized function for topology operations, takes a GDAL function and """A generalized function for topology operations, takes a GDAL function and
the other geometry to perform the operation on.""" the other geometry to perform the operation on."""
@ -442,7 +442,7 @@ class OGRGeometry(GDALBase):
"Returns True if this geometry overlaps the other." "Returns True if this geometry overlaps the other."
return self._topology(capi.ogr_overlaps, other) return self._topology(capi.ogr_overlaps, other)
#### Geometry-generation Methods #### # #### Geometry-generation Methods ####
def _geomgen(self, gen_func, other=None): def _geomgen(self, gen_func, other=None):
"A helper routine for the OGR routines that generate geometries." "A helper routine for the OGR routines that generate geometries."
if isinstance(other, OGRGeometry): if isinstance(other, OGRGeometry):

View File

@ -25,7 +25,6 @@ from django.utils.six.moves import range
class Layer(GDALBase): class Layer(GDALBase):
"A class that wraps an OGR Layer, needs to be instantiated from a DataSource object." "A class that wraps an OGR Layer, needs to be instantiated from a DataSource object."
#### Python 'magic' routines ####
def __init__(self, layer_ptr, ds): def __init__(self, layer_ptr, ds):
""" """
Initializes on an OGR C pointer to the Layer and the `DataSource` object 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. # Should have returned a Feature, raise an OGRIndexError.
raise OGRIndexError('Invalid feature id: %s.' % feat_id) raise OGRIndexError('Invalid feature id: %s.' % feat_id)
#### Layer properties #### # #### Layer properties ####
@property @property
def extent(self): def extent(self):
"Returns the extent (an Envelope) of this layer." "Returns the extent (an Envelope) of this layer."
@ -188,7 +187,7 @@ class Layer(GDALBase):
spatial_filter = property(_get_spatial_filter, _set_spatial_filter) spatial_filter = property(_get_spatial_filter, _set_spatial_filter)
#### Layer Methods #### # #### Layer Methods ####
def get_fields(self, field_name): def get_fields(self, field_name):
""" """
Returns a list containing the given field name for every Feature Returns a list containing the given field name for every Feature

View File

@ -66,7 +66,7 @@ def std_call(func):
else: else:
return lgdal[func] return lgdal[func]
#### Version-information functions. #### # #### Version-information functions. ####
# Returns GDAL library version information with the given key. # Returns GDAL library version information with the given key.
_version_info = std_call('GDALVersionInfo') _version_info = std_call('GDALVersionInfo')

View File

@ -14,7 +14,7 @@ from django.contrib.gis.gdal.prototypes.generation import (
c_int_p = POINTER(c_int) # shortcut type c_int_p = POINTER(c_int) # shortcut type
### Driver Routines ### # Driver Routines
register_all = void_output(lgdal.OGRRegisterAll, [], errcheck=False) register_all = void_output(lgdal.OGRRegisterAll, [], errcheck=False)
cleanup_all = void_output(lgdal.OGRCleanupAll, [], errcheck=False) cleanup_all = void_output(lgdal.OGRCleanupAll, [], errcheck=False)
get_driver = voidptr_output(lgdal.OGRGetDriver, [c_int]) 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_count = int_output(lgdal.OGRGetDriverCount, [])
get_driver_name = const_string_output(lgdal.OGR_Dr_GetName, [c_void_p], decoding='ascii') 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)]) 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) destroy_ds = void_output(lgdal.OGR_DS_Destroy, [c_void_p], errcheck=False)
release_ds = void_output(lgdal.OGRReleaseDataSource, [c_void_p]) 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_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]) 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_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 = 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]) 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 [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_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_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_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_count = int_output(lgdal.OGR_FD_GetFieldCount, [c_void_p])
get_field_defn = voidptr_output(lgdal.OGR_FD_GetFieldDefn, [c_void_p, c_int]) 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]) clone_feature = voidptr_output(lgdal.OGR_F_Clone, [c_void_p])
destroy_feature = void_output(lgdal.OGR_F_Destroy, [c_void_p], errcheck=False) 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]) 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_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]) 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_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_precision = int_output(lgdal.OGR_Fld_GetPrecision, [c_void_p])
get_field_type = int_output(lgdal.OGR_Fld_GetType, [c_void_p]) get_field_type = int_output(lgdal.OGR_Fld_GetType, [c_void_p])

View File

@ -23,7 +23,7 @@ def ptr_byref(args, offset=-1):
return args[offset]._obj return args[offset]._obj
### String checking Routines ### # ### String checking Routines ###
def check_const_string(result, func, cargs, offset=None, cpl=False): def check_const_string(result, func, cargs, offset=None, cpl=False):
""" """
Similar functionality to `check_string`, but does not free the pointer. 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) lgdal.VSIFree(ptr)
return s return s
### DataSource, Layer error-checking ### # ### DataSource, Layer error-checking ###
### Envelope checking ### # ### Envelope checking ###
def check_envelope(result, func, cargs, offset=-1): def check_envelope(result, func, cargs, offset=-1):
"Checks a function that returns an OGR Envelope by reference." "Checks a function that returns an OGR Envelope by reference."
env = ptr_byref(cargs, offset) env = ptr_byref(cargs, offset)
return env return env
### Geometry error-checking routines ### # ### Geometry error-checking routines ###
def check_geom(result, func, cargs): def check_geom(result, func, cargs):
"Checks a function that returns a geometry." "Checks a function that returns a geometry."
# OGR_G_Clone may return an integer, even though the # 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) return check_geom(geom, func, cargs)
### Spatial Reference error-checking routines ### # ### Spatial Reference error-checking routines ###
def check_srs(result, func, cargs): def check_srs(result, func, cargs):
if isinstance(result, six.integer_types): if isinstance(result, six.integer_types):
result = c_void_p(result) result = c_void_p(result)
@ -102,7 +102,7 @@ def check_srs(result, func, cargs):
return result return result
### Other error-checking routines ### # ### Other error-checking routines ###
def check_arg_errcode(result, func, cargs, cpl=False): def check_arg_errcode(result, func, cargs, cpl=False):
""" """
The error code is returned in the last argument, by reference. The error code is returned in the last argument, by reference.

View File

@ -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): def env_func(f, argtypes):
"For getting OGREnvelopes." "For getting OGREnvelopes."
f.argtypes = argtypes f.argtypes = argtypes
@ -29,7 +29,7 @@ def topology_func(f):
f.errchck = bool f.errchck = bool
return f return f
### OGR_G ctypes function prototypes ### # ### OGR_G ctypes function prototypes ###
# GeoJSON routines. # GeoJSON routines.
from_json = geom_output(lgdal.OGR_G_CreateGeometryFromJson, [c_char_p]) from_json = geom_output(lgdal.OGR_G_CreateGeometryFromJson, [c_char_p])

View File

@ -20,14 +20,14 @@ void_output = partial(void_output, cpl=True)
const_string_output = partial(const_string_output, cpl=True) const_string_output = partial(const_string_output, cpl=True)
double_output = partial(double_output, cpl=True) double_output = partial(double_output, cpl=True)
### Raster Driver Routines ### # Raster Driver Routines
register_all = void_output(lgdal.GDALAllRegister, []) register_all = void_output(lgdal.GDALAllRegister, [])
get_driver = voidptr_output(lgdal.GDALGetDriver, [c_int]) get_driver = voidptr_output(lgdal.GDALGetDriver, [c_int])
get_driver_by_name = voidptr_output(lgdal.GDALGetDriverByName, [c_char_p], errcheck=False) get_driver_by_name = voidptr_output(lgdal.GDALGetDriverByName, [c_char_p], errcheck=False)
get_driver_count = int_output(lgdal.GDALGetDriverCount, []) get_driver_count = int_output(lgdal.GDALGetDriverCount, [])
get_driver_description = const_string_output(lgdal.GDALGetDescription, [c_void_p]) 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]) 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]) open_ds = voidptr_output(lgdal.GDALOpen, [c_char_p, c_int])
close_ds = void_output(lgdal.GDALClose, [c_void_p]) 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) 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)]) 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, 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]) c_void_p, c_int, c_int, c_int, c_int, c_int])
get_band_xsize = int_output(lgdal.GDALGetRasterBandXSize, [c_void_p]) 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_minimum = double_output(lgdal.GDALGetRasterMinimum, [c_void_p, POINTER(c_int)])
get_band_maximum = double_output(lgdal.GDALGetRasterMaximum, [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, 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_int, c_double, c_double,
c_void_p, c_void_p, c_void_p]) c_void_p, c_void_p, c_void_p])

View File

@ -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): def srs_double(f):
""" """
Creates a function prototype for the OSR routines that take Creates a function prototype for the OSR routines that take

View File

@ -42,7 +42,6 @@ class SpatialReference(GDALBase):
systems (projections and datums) and to transform between them." systems (projections and datums) and to transform between them."
""" """
#### Python 'magic' routines ####
def __init__(self, srs_input='', srs_type='user'): def __init__(self, srs_input='', srs_type='user'):
""" """
Creates a GDAL OSR Spatial Reference object from the given input. Creates a GDAL OSR Spatial Reference object from the given input.
@ -132,7 +131,7 @@ class SpatialReference(GDALBase):
"The string representation uses 'pretty' WKT." "The string representation uses 'pretty' WKT."
return self.pretty_wkt return self.pretty_wkt
#### SpatialReference Methods #### # #### SpatialReference Methods ####
def attr_value(self, target, index=0): def attr_value(self, target, index=0):
""" """
The attribute value for the given target node (e.g. 'PROJCS'). The index 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." "Checks to see if the given spatial reference is valid."
capi.srs_validate(self.ptr) capi.srs_validate(self.ptr)
#### Name & SRID properties #### # #### Name & SRID properties ####
@property @property
def name(self): def name(self):
"Returns the name of this Spatial Reference." "Returns the name of this Spatial Reference."
@ -194,7 +193,7 @@ class SpatialReference(GDALBase):
except (TypeError, ValueError): except (TypeError, ValueError):
return None return None
#### Unit Properties #### # #### Unit Properties ####
@property @property
def linear_name(self): def linear_name(self):
"Returns the name of the linear units." "Returns the name of the linear units."
@ -235,7 +234,7 @@ class SpatialReference(GDALBase):
name = force_text(name) name = force_text(name)
return (units, name) return (units, name)
#### Spheroid/Ellipsoid Properties #### # #### Spheroid/Ellipsoid Properties ####
@property @property
def ellipsoid(self): def ellipsoid(self):
""" """
@ -259,7 +258,7 @@ class SpatialReference(GDALBase):
"Returns the Inverse Flattening for this Spatial Reference." "Returns the Inverse Flattening for this Spatial Reference."
return capi.invflattening(self.ptr, byref(c_int())) return capi.invflattening(self.ptr, byref(c_int()))
#### Boolean Properties #### # #### Boolean Properties ####
@property @property
def geographic(self): def geographic(self):
""" """
@ -281,7 +280,7 @@ class SpatialReference(GDALBase):
""" """
return bool(capi.isprojected(self.ptr)) return bool(capi.isprojected(self.ptr))
#### Import Routines ##### # #### Import Routines #####
def import_epsg(self, epsg): def import_epsg(self, epsg):
"Imports the Spatial Reference from the EPSG code (an integer)." "Imports the Spatial Reference from the EPSG code (an integer)."
capi.from_epsg(self.ptr, epsg) capi.from_epsg(self.ptr, epsg)
@ -302,7 +301,7 @@ class SpatialReference(GDALBase):
"Imports the Spatial Reference from an XML string." "Imports the Spatial Reference from an XML string."
capi.from_xml(self.ptr, xml) capi.from_xml(self.ptr, xml)
#### Export Properties #### # #### Export Properties ####
@property @property
def wkt(self): def wkt(self):
"Returns the WKT representation of this Spatial Reference." "Returns the WKT representation of this Spatial Reference."

View File

@ -198,7 +198,7 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin):
prev = OGRGeometry('POINT(0 0)') prev = OGRGeometry('POINT(0 0)')
for rr in self.geometries.linearrings: for rr in self.geometries.linearrings:
lr = OGRGeometry(rr.wkt) 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('LINEARRING', lr.geom_name)
self.assertEqual(rr.n_p, len(lr)) self.assertEqual(rr.n_p, len(lr))
self.assertEqual(lr, OGRGeometry(rr.wkt)) self.assertEqual(lr, OGRGeometry(rr.wkt))

View File

@ -18,7 +18,6 @@ free_regex = re.compile(r'^GEO-\d{3}FREE')
lite_regex = re.compile(r'^GEO-\d{3}LITE') lite_regex = re.compile(r'^GEO-\d{3}LITE')
#### GeoIP classes ####
class GeoIPException(Exception): class GeoIPException(Exception):
pass pass
@ -201,7 +200,7 @@ class GeoIP(object):
'country_name': self.country_name(query), 'country_name': self.country_name(query),
} }
#### Coordinate retrieval routines #### # #### Coordinate retrieval routines ####
def coords(self, query, ordering=('longitude', 'latitude')): def coords(self, query, ordering=('longitude', 'latitude')):
cdict = self.city(query) cdict = self.city(query)
if cdict is None: if cdict is None:
@ -226,7 +225,7 @@ class GeoIP(object):
else: else:
return None return None
#### GeoIP Database Information Routines #### # #### GeoIP Database Information Routines ####
@property @property
def country_info(self): def country_info(self):
"Returns information about the GeoIP country database." "Returns information about the GeoIP country database."
@ -253,7 +252,7 @@ class GeoIP(object):
info += 'GeoIP Library:\n\t%s\n' % GeoIP_lib_version() 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) 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 @classmethod
def open(cls, full_path, cache): def open(cls, full_path, cache):
return GeoIP(full_path, cache) return GeoIP(full_path, cache)

View File

@ -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 from django.contrib.gis.geoip.libgeoip import free, lgeoip
#### GeoIP C Structure definitions #### # #### GeoIP C Structure definitions ####
class GeoIPRecord(Structure): class GeoIPRecord(Structure):
_fields_ = [('country_code', c_char_p), _fields_ = [('country_code', c_char_p),
@ -37,7 +37,7 @@ class GeoIPTag(Structure):
RECTYPE = POINTER(GeoIPRecord) RECTYPE = POINTER(GeoIPRecord)
DBTYPE = POINTER(GeoIPTag) DBTYPE = POINTER(GeoIPTag)
#### ctypes function prototypes #### # #### ctypes function prototypes ####
# GeoIP_lib_version appeared in version 1.4.7. # GeoIP_lib_version appeared in version 1.4.7.
if hasattr(lgeoip, 'GeoIP_lib_version'): if hasattr(lgeoip, 'GeoIP_lib_version'):

View File

@ -50,7 +50,7 @@ class GeometryCollection(GEOSGeometry):
"Returns the number of geometries in this Collection." "Returns the number of geometries in this Collection."
return self.num_geom return self.num_geom
### Methods for compatibility with ListMixin ### # ### Methods for compatibility with ListMixin ###
def _create_collection(self, length, items): def _create_collection(self, length, items):
# Creating the geometry pointer array. # Creating the geometry pointer array.
geoms = get_pointer_arr(length) geoms = get_pointer_arr(length)

View File

@ -17,7 +17,6 @@ class GEOSCoordSeq(GEOSBase):
ptr_type = CS_PTR ptr_type = CS_PTR
#### Python 'magic' routines ####
def __init__(self, ptr, z=False): def __init__(self, ptr, z=False):
"Initializes from a GEOS pointer." "Initializes from a GEOS pointer."
if not isinstance(ptr, CS_PTR): if not isinstance(ptr, CS_PTR):
@ -69,7 +68,7 @@ class GEOSCoordSeq(GEOSBase):
if set_3d: if set_3d:
self.setZ(index, value[2]) self.setZ(index, value[2])
#### Internal Routines #### # #### Internal Routines ####
def _checkindex(self, index): def _checkindex(self, index):
"Checks the given index." "Checks the given index."
sz = self.size sz = self.size
@ -81,7 +80,7 @@ class GEOSCoordSeq(GEOSBase):
if dim < 0 or dim > 2: if dim < 0 or dim > 2:
raise GEOSException('invalid ordinate dimension "%d"' % dim) raise GEOSException('invalid ordinate dimension "%d"' % dim)
#### Ordinate getting and setting routines #### # #### Ordinate getting and setting routines ####
def getOrdinate(self, dimension, index): def getOrdinate(self, dimension, index):
"Returns the value for the given dimension and index." "Returns the value for the given dimension and index."
self._checkindex(index) self._checkindex(index)
@ -118,7 +117,7 @@ class GEOSCoordSeq(GEOSBase):
"Set Z with the value at the given index." "Set Z with the value at the given index."
self.setOrdinate(2, index, value) self.setOrdinate(2, index, value)
### Dimensions ### # ### Dimensions ###
@property @property
def size(self): def size(self):
"Returns the size of this coordinate sequence." "Returns the size of this coordinate sequence."
@ -137,7 +136,7 @@ class GEOSCoordSeq(GEOSBase):
""" """
return self._z return self._z
### Other Methods ### # ### Other Methods ###
def clone(self): def clone(self):
"Clones this coordinate sequence." "Clones this coordinate sequence."
return GEOSCoordSeq(capi.cs_clone(self.ptr), self.hasz) return GEOSCoordSeq(capi.cs_clone(self.ptr), self.hasz)

View File

@ -30,7 +30,6 @@ class GEOSGeometry(GEOSBase, ListMixin):
ptr_type = GEOM_PTR ptr_type = GEOM_PTR
#### Python 'magic' routines ####
def __init__(self, geo_input, srid=None): def __init__(self, geo_input, srid=None):
""" """
The base constructor for GEOS geometry objects, and may take the The base constructor for GEOS geometry objects, and may take the
@ -162,7 +161,7 @@ class GEOSGeometry(GEOSBase, ListMixin):
"The not equals operator." "The not equals operator."
return not (self == other) return not (self == other)
### Geometry set-like operations ### # ### Geometry set-like operations ###
# Thanks to Sean Gillies for inspiration: # Thanks to Sean Gillies for inspiration:
# http://lists.gispython.org/pipermail/community/2007-July/001034.html # http://lists.gispython.org/pipermail/community/2007-July/001034.html
# g = g1 | g2 # g = g1 | g2
@ -185,7 +184,7 @@ class GEOSGeometry(GEOSBase, ListMixin):
"Return the symmetric difference of this Geometry and the other." "Return the symmetric difference of this Geometry and the other."
return self.sym_difference(other) return self.sym_difference(other)
#### Coordinate Sequence Routines #### # #### Coordinate Sequence Routines ####
@property @property
def has_cs(self): def has_cs(self):
"Returns True if this Geometry has a coordinate sequence, False if not." "Returns True if this Geometry has a coordinate sequence, False if not."
@ -208,7 +207,7 @@ class GEOSGeometry(GEOSBase, ListMixin):
if self.has_cs: if self.has_cs:
return self._cs.clone() return self._cs.clone()
#### Geometry Info #### # #### Geometry Info ####
@property @property
def geom_type(self): def geom_type(self):
"Returns a string representing the Geometry type, e.g. 'Polygon'" "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)." "Converts this Geometry to normal form (or canonical form)."
return capi.geos_normalize(self.ptr) return capi.geos_normalize(self.ptr)
#### Unary predicates #### # #### Unary predicates ####
@property @property
def empty(self): def empty(self):
""" """
@ -279,7 +278,7 @@ class GEOSGeometry(GEOSBase, ListMixin):
""" """
return capi.geos_isvalidreason(self.ptr).decode() return capi.geos_isvalidreason(self.ptr).decode()
#### Binary predicates. #### # #### Binary predicates. ####
def contains(self, other): def contains(self, other):
"Returns true if other.within(this) returns true." "Returns true if other.within(this) returns true."
return capi.geos_contains(self.ptr, other.ptr) return capi.geos_contains(self.ptr, other.ptr)
@ -347,7 +346,7 @@ class GEOSGeometry(GEOSBase, ListMixin):
""" """
return capi.geos_within(self.ptr, other.ptr) return capi.geos_within(self.ptr, other.ptr)
#### SRID Routines #### # #### SRID Routines ####
def get_srid(self): def get_srid(self):
"Gets the SRID for the geometry, returns None if no SRID is set." "Gets the SRID for the geometry, returns None if no SRID is set."
s = capi.geos_get_srid(self.ptr) s = capi.geos_get_srid(self.ptr)
@ -361,7 +360,7 @@ class GEOSGeometry(GEOSBase, ListMixin):
capi.geos_set_srid(self.ptr, srid) capi.geos_set_srid(self.ptr, srid)
srid = property(get_srid, set_srid) srid = property(get_srid, set_srid)
#### Output Routines #### # #### Output Routines ####
@property @property
def ewkt(self): def ewkt(self):
""" """
@ -441,7 +440,7 @@ class GEOSGeometry(GEOSBase, ListMixin):
""" """
return PreparedGeometry(self) return PreparedGeometry(self)
#### GDAL-specific output routines #### # #### GDAL-specific output routines ####
@property @property
def ogr(self): def ogr(self):
"Returns the OGR Geometry for this Geometry." "Returns the OGR Geometry for this Geometry."
@ -512,7 +511,7 @@ class GEOSGeometry(GEOSBase, ListMixin):
else: else:
raise GEOSException('Transformed WKB was invalid.') raise GEOSException('Transformed WKB was invalid.')
#### Topology Routines #### # #### Topology Routines ####
def _topology(self, gptr): def _topology(self, gptr):
"Helper routine to return Geometry from the given pointer." "Helper routine to return Geometry from the given pointer."
return GEOSGeometry(gptr, srid=self.srid) 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." "Returns a Geometry representing all the points in this Geometry and other."
return self._topology(capi.geos_union(self.ptr, other.ptr)) return self._topology(capi.geos_union(self.ptr, other.ptr))
#### Other Routines #### # #### Other Routines ####
@property @property
def area(self): def area(self):
"Returns the area of the Geometry." "Returns the area of the Geometry."

View File

@ -87,7 +87,7 @@ def error_h(fmt, lst):
logger.error('GEOS_ERROR: %s\n' % err_msg) logger.error('GEOS_ERROR: %s\n' % err_msg)
error_h = ERRORFUNC(error_h) 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 # Opaque GEOS geometry structures, used for GEOM_PTR and CS_PTR

View File

@ -11,7 +11,6 @@ class LineString(GEOSGeometry):
_init_func = capi.create_linestring _init_func = capi.create_linestring
_minlength = 2 _minlength = 2
#### Python 'magic' routines ####
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
""" """
Initializes on the given sequence -- may take lists, tuples, NumPy arrays Initializes on the given sequence -- may take lists, tuples, NumPy arrays
@ -116,7 +115,7 @@ class LineString(GEOSGeometry):
if dim not in (2, 3): if dim not in (2, 3):
raise TypeError('Dimension mismatch.') raise TypeError('Dimension mismatch.')
#### Sequence Properties #### # #### Sequence Properties ####
@property @property
def tuple(self): def tuple(self):
"Returns a tuple version of the geometry from the coordinate sequence." "Returns a tuple version of the geometry from the coordinate sequence."

View File

@ -63,7 +63,7 @@ class ListMixin(object):
_maxlength = None _maxlength = None
_IndexError = IndexError _IndexError = IndexError
### Python initialization and special list interface methods ### # ### Python initialization and special list interface methods ###
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
if not hasattr(self, '_get_single_internal'): if not hasattr(self, '_get_single_internal'):
@ -117,7 +117,7 @@ class ListMixin(object):
for i in range(len(self)): for i in range(len(self)):
yield self[i] yield self[i]
### Special methods for arithmetic operations ### # ### Special methods for arithmetic operations ###
def __add__(self, other): def __add__(self, other):
'add another list-like object' 'add another list-like object'
return self.__class__(list(self) + list(other)) return self.__class__(list(self) + list(other))
@ -175,8 +175,8 @@ class ListMixin(object):
return False return False
return len(self) < olen return len(self) < olen
### Public list interface Methods ### # ### Public list interface Methods ###
## Non-mutating ## # ## Non-mutating ##
def count(self, val): def count(self, val):
"Standard list count method" "Standard list count method"
count = 0 count = 0
@ -192,7 +192,7 @@ class ListMixin(object):
return i return i
raise ValueError('%s not found in object' % str(val)) raise ValueError('%s not found in object' % str(val))
## Mutating ## # ## Mutating ##
def append(self, val): def append(self, val):
"Standard list append method" "Standard list append method"
self[len(self):] = [val] self[len(self):] = [val]
@ -235,7 +235,7 @@ class ListMixin(object):
temp.sort(reverse=reverse) temp.sort(reverse=reverse)
self[:] = temp self[:] = temp
### Private routines ### # ### Private routines ###
def _rebuild(self, newLen, newItems): def _rebuild(self, newLen, newItems):
if newLen < self._minlength: if newLen < self._minlength:
raise ValueError('Must have at least %d items' % self._minlength) raise ValueError('Must have at least %d items' % self._minlength)

View File

@ -129,7 +129,7 @@ class Point(GEOSGeometry):
y = property(get_y, set_y) y = property(get_y, set_y)
z = property(get_z, set_z) z = property(get_z, set_z)
### Tuple setting and retrieval routines. ### # ### Tuple setting and retrieval routines. ###
def get_coords(self): def get_coords(self):
"Returns a tuple of the point." "Returns a tuple of the point."
return self._cs.tuple return self._cs.tuple

View File

@ -67,7 +67,7 @@ class Polygon(GEOSGeometry):
(x0, y0, x0, y1, x1, y1, x1, y0, x0, y0)) (x0, y0, x0, y1, x1, y1, x1, y0, x0, y0))
return Polygon(((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): def _create_polygon(self, length, items):
# Instantiate LinearRing objects if necessary, but don't clone them yet # 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 # _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 _set_single = GEOSGeometry._set_single_rebuild
_assign_extended_slice = GEOSGeometry._assign_extended_slice_rebuild _assign_extended_slice = GEOSGeometry._assign_extended_slice_rebuild
#### Polygon Properties #### # #### Polygon Properties ####
@property @property
def num_interior_rings(self): def num_interior_rings(self):
"Returns the number of interior rings." "Returns the number of interior rings."

View File

@ -7,7 +7,7 @@ from django.contrib.gis.geos.prototypes.errcheck import (
from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc 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): def check_cs_ptr(result, func, cargs):
"Error checking on routines that return Geometries." "Error checking on routines that return Geometries."
if not result: if not result:
@ -33,7 +33,7 @@ def check_cs_get(result, func, cargs):
return last_arg_byref(cargs) return last_arg_byref(cargs)
## Coordinate sequence prototype generation functions. ## # ## Coordinate sequence prototype generation functions. ##
def cs_int(func): def cs_int(func):
"For coordinate sequence routines that return an integer." "For coordinate sequence routines that return an integer."
func.argtypes = [CS_PTR, POINTER(c_uint)] func.argtypes = [CS_PTR, POINTER(c_uint)]
@ -69,7 +69,7 @@ def cs_output(func, argtypes):
func.errcheck = check_cs_ptr func.errcheck = check_cs_ptr
return func return func
## Coordinate Sequence ctypes prototypes ## # ## Coordinate Sequence ctypes prototypes ##
# Coordinate Sequence constructors & cloning. # Coordinate Sequence constructors & cloning.
cs_clone = cs_output(GEOSFunc('GEOSCoordSeq_clone'), [CS_PTR]) cs_clone = cs_output(GEOSFunc('GEOSCoordSeq_clone'), [CS_PTR])

View File

@ -13,7 +13,6 @@ free.argtypes = [c_void_p]
free.restype = None free.restype = None
### ctypes error checking routines ###
def last_arg_byref(args): def last_arg_byref(args):
"Returns the last C argument's value by reference." "Returns the last C argument's value by reference."
return args[-1]._obj.value return args[-1]._obj.value

View File

@ -21,7 +21,7 @@ class geos_char_p(c_char_p):
pass pass
### ctypes generation functions ### # ### ctypes generation functions ###
def bin_constructor(func): def bin_constructor(func):
"Generates a prototype for binary construction (HEX, WKB) GEOS routines." "Generates a prototype for binary construction (HEX, WKB) GEOS routines."
func.argtypes = [c_char_p, c_size_t] func.argtypes = [c_char_p, c_size_t]
@ -71,7 +71,7 @@ def string_from_geom(func):
func.errcheck = check_string func.errcheck = check_string
return func return func
### ctypes prototypes ### # ### ctypes prototypes ###
# Deprecated creation routines from WKB, HEX, WKT # Deprecated creation routines from WKB, HEX, WKT
from_hex = bin_constructor(GEOSFunc('GEOSGeomFromHEX_buf')) from_hex = bin_constructor(GEOSFunc('GEOSGeomFromHEX_buf'))

View File

@ -12,7 +12,7 @@ from django.utils import six
from django.utils.encoding import force_bytes 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): class WKTReader_st(Structure):
pass pass
@ -33,7 +33,7 @@ WKT_WRITE_PTR = POINTER(WKTWriter_st)
WKB_READ_PTR = POINTER(WKBReader_st) WKB_READ_PTR = POINTER(WKBReader_st)
WKB_WRITE_PTR = POINTER(WKBReader_st) WKB_WRITE_PTR = POINTER(WKBReader_st)
### WKTReader routines ### # WKTReader routines
wkt_reader_create = GEOSFunc('GEOSWKTReader_create') wkt_reader_create = GEOSFunc('GEOSWKTReader_create')
wkt_reader_create.restype = WKT_READ_PTR 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.restype = GEOM_PTR
wkt_reader_read.errcheck = check_geom wkt_reader_read.errcheck = check_geom
### WKTWriter routines ### # WKTWriter routines
wkt_writer_create = GEOSFunc('GEOSWKTWriter_create') wkt_writer_create = GEOSFunc('GEOSWKTWriter_create')
wkt_writer_create.restype = WKT_WRITE_PTR wkt_writer_create.restype = WKT_WRITE_PTR
@ -69,7 +69,7 @@ except AttributeError:
wkt_writer_get_outdim = lambda ptr: 2 wkt_writer_get_outdim = lambda ptr: 2
wkt_writer_set_outdim = lambda ptr, dim: None wkt_writer_set_outdim = lambda ptr, dim: None
### WKBReader routines ### # WKBReader routines
wkb_reader_create = GEOSFunc('GEOSWKBReader_create') wkb_reader_create = GEOSFunc('GEOSWKBReader_create')
wkb_reader_create.restype = WKB_READ_PTR 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 = wkb_read_func(GEOSFunc('GEOSWKBReader_read'))
wkb_reader_read_hex = wkb_read_func(GEOSFunc('GEOSWKBReader_readHEX')) wkb_reader_read_hex = wkb_read_func(GEOSFunc('GEOSWKBReader_readHEX'))
### WKBWriter routines ### # WKBWriter routines
wkb_writer_create = GEOSFunc('GEOSWKBWriter_create') wkb_writer_create = GEOSFunc('GEOSWKBWriter_create')
wkb_writer_create.restype = WKB_WRITE_PTR 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) 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): class IOBase(GEOSBase):
"Base class for GEOS I/O objects." "Base class for GEOS I/O objects."
def __init__(self): def __init__(self):
@ -141,7 +141,7 @@ class IOBase(GEOSBase):
if self._ptr: if self._ptr:
self._destructor(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 # Non-public WKB/WKT reader classes for internal use because
@ -174,7 +174,7 @@ class _WKBReader(IOBase):
raise TypeError raise TypeError
### WKB/WKT Writer Classes ### # ### WKB/WKT Writer Classes ###
class WKTWriter(IOBase): class WKTWriter(IOBase):
_constructor = wkt_writer_create _constructor = wkt_writer_create
_destructor = wkt_writer_destroy _destructor = wkt_writer_destroy
@ -208,7 +208,7 @@ class WKBWriter(IOBase):
"Returns the HEXEWKB representation of the given geometry." "Returns the HEXEWKB representation of the given geometry."
return wkb_writer_write_hex(self.ptr, geom.ptr, byref(c_size_t())) return wkb_writer_write_hex(self.ptr, geom.ptr, byref(c_size_t()))
### WKBWriter Properties ### # ### WKBWriter Properties ###
# Property for getting/setting the byteorder. # Property for getting/setting the byteorder.
def _get_byteorder(self): def _get_byteorder(self):

View File

@ -13,7 +13,7 @@ from django.utils.six.moves import range
__all__ = ['geos_area', 'geos_distance', 'geos_length', 'geos_isvalidreason'] __all__ = ['geos_area', 'geos_distance', 'geos_length', 'geos_isvalidreason']
### ctypes generator function ### # ### ctypes generator function ###
def dbl_from_geom(func, num_geom=1): def dbl_from_geom(func, num_geom=1):
""" """
Argument is a Geometry, return type is double that is passed 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 func.errcheck = check_dbl
return func return func
### ctypes prototypes ### # ### ctypes prototypes ###
# Area, distance, and length prototypes. # Area, distance, and length prototypes.
geos_area = dbl_from_geom(GEOSFunc('GEOSArea')) geos_area = dbl_from_geom(GEOSFunc('GEOSArea'))

View File

@ -9,7 +9,7 @@ from django.contrib.gis.geos.prototypes.errcheck import check_predicate
from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc
## Binary & unary predicate functions ## # ## Binary & unary predicate functions ##
def binary_predicate(func, *args): def binary_predicate(func, *args):
"For GEOS binary predicate functions." "For GEOS binary predicate functions."
argtypes = [GEOM_PTR, GEOM_PTR] argtypes = [GEOM_PTR, GEOM_PTR]
@ -28,14 +28,14 @@ def unary_predicate(func):
func.errcheck = check_predicate func.errcheck = check_predicate
return func return func
## Unary Predicates ## # ## Unary Predicates ##
geos_hasz = unary_predicate(GEOSFunc('GEOSHasZ')) geos_hasz = unary_predicate(GEOSFunc('GEOSHasZ'))
geos_isempty = unary_predicate(GEOSFunc('GEOSisEmpty')) geos_isempty = unary_predicate(GEOSFunc('GEOSisEmpty'))
geos_isring = unary_predicate(GEOSFunc('GEOSisRing')) geos_isring = unary_predicate(GEOSFunc('GEOSisRing'))
geos_issimple = unary_predicate(GEOSFunc('GEOSisSimple')) geos_issimple = unary_predicate(GEOSFunc('GEOSisSimple'))
geos_isvalid = unary_predicate(GEOSFunc('GEOSisValid')) geos_isvalid = unary_predicate(GEOSFunc('GEOSisValid'))
## Binary Predicates ## # ## Binary Predicates ##
geos_contains = binary_predicate(GEOSFunc('GEOSContains')) geos_contains = binary_predicate(GEOSFunc('GEOSContains'))
geos_crosses = binary_predicate(GEOSFunc('GEOSCrosses')) geos_crosses = binary_predicate(GEOSFunc('GEOSCrosses'))
geos_disjoint = binary_predicate(GEOSFunc('GEOSDisjoint')) geos_disjoint = binary_predicate(GEOSFunc('GEOSDisjoint'))

View File

@ -30,7 +30,7 @@ def topology(func, *args, **kwargs):
func.errcheck = kwargs.get('errcheck', check_geom) func.errcheck = kwargs.get('errcheck', check_geom)
return func return func
### Topology Routines ### # Topology Routines
geos_boundary = topology(GEOSFunc('GEOSBoundary')) geos_boundary = topology(GEOSFunc('GEOSBoundary'))
geos_buffer = topology(GEOSFunc('GEOSBuffer'), c_double, c_int) geos_buffer = topology(GEOSFunc('GEOSBuffer'), c_double, c_int)
geos_centroid = topology(GEOSFunc('GEOSGetCentroid')) geos_centroid = topology(GEOSFunc('GEOSGetCentroid'))

View File

@ -464,7 +464,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
def test_memory_hijinks(self): def test_memory_hijinks(self):
"Testing Geometry __del__() on rings and polygons." "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. # These tests are needed to ensure sanity with writable geometries.
@ -659,7 +659,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
def test_mutable_geometries(self): def test_mutable_geometries(self):
"Testing the mutability of Polygons and Geometry Collections." "Testing the mutability of Polygons and Geometry Collections."
### Testing the mutability of Polygons ### # ### Testing the mutability of Polygons ###
for p in self.geometries.polygons: for p in self.geometries.polygons:
poly = fromstr(p.wkt) poly = fromstr(p.wkt)
@ -679,7 +679,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
self.assertEqual(poly.exterior_ring, new_shell) self.assertEqual(poly.exterior_ring, new_shell)
self.assertEqual(poly[0], 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: for tg in self.geometries.multipoints:
mp = fromstr(tg.wkt) mp = fromstr(tg.wkt)
for i in range(len(mp)): for i in range(len(mp)):
@ -717,11 +717,11 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
# Extreme (!!) __setitem__ -- no longer works, have to detect # Extreme (!!) __setitem__ -- no longer works, have to detect
# in the first object that __setitem__ is called in the subsequent # in the first object that __setitem__ is called in the subsequent
# objects -- maybe mpoly[0, 0, 0] = (3.14, 2.71)? # objects -- maybe mpoly[0, 0, 0] = (3.14, 2.71)?
#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]) # self.assertEqual((3.14, 2.71), mpoly[0][0][0])
# Doing it more slowly.. # Doing it more slowly..
#self.assertEqual((3.14, 2.71), mpoly[0].shell[0]) # self.assertEqual((3.14, 2.71), mpoly[0].shell[0])
#del mpoly # del mpoly
def test_threed(self): def test_threed(self):
"Testing three-dimensional geometries." "Testing three-dimensional geometries."

View File

@ -39,7 +39,7 @@ class GeoModelTest(TestCase):
def test_proxy(self): def test_proxy(self):
"Testing Lazy-Geometry support (using the GeometryProxy)." "Testing Lazy-Geometry support (using the GeometryProxy)."
## Testing on a Point # Testing on a Point
pnt = Point(0, 0) pnt = Point(0, 0)
nullcity = City(name='NullCity', point=pnt) nullcity = City(name='NullCity', point=pnt)
nullcity.save() nullcity.save()
@ -76,7 +76,7 @@ class GeoModelTest(TestCase):
self.assertEqual(Point(23, 5), City.objects.get(name='NullCity').point) self.assertEqual(Point(23, 5), City.objects.get(name='NullCity').point)
nullcity.delete() nullcity.delete()
## Testing on a Polygon # Testing on a Polygon
shell = LinearRing((0, 0), (0, 100), (100, 100), (100, 0), (0, 0)) shell = LinearRing((0, 0), (0, 100), (100, 100), (100, 0), (0, 0))
inner = LinearRing((40, 40), (40, 60), (60, 60), (60, 40), (40, 40)) inner = LinearRing((40, 40), (40, 60), (60, 60), (60, 40), (40, 40))

View File

@ -147,7 +147,7 @@ class LayerMapping(object):
else: else:
raise LayerMapError('Unrecognized transaction mode: %s' % transaction_mode) 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): def check_fid_range(self, fid_range):
"This checks the `fid_range` keyword." "This checks the `fid_range` keyword."
if fid_range: if fid_range:
@ -334,7 +334,7 @@ class LayerMapping(object):
else: else:
return {fld: kwargs[fld] for fld in self.unique} 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): def verify_ogr_field(self, ogr_field, model_field):
""" """
Verifies if the OGR Field contents are acceptable to the Django Verifies if the OGR Field contents are acceptable to the Django
@ -444,7 +444,7 @@ class LayerMapping(object):
# Returning the WKT of the geometry. # Returning the WKT of the geometry.
return g.wkt return g.wkt
#### Other model methods #### # #### Other model methods ####
def coord_transform(self): def coord_transform(self):
"Returns the coordinate transformation object." "Returns the coordinate transformation object."
SpatialRefSys = self.spatial_backend.spatial_ref_sys() SpatialRefSys = self.spatial_backend.spatial_ref_sys()

View File

@ -83,7 +83,7 @@ class BaseDatabaseWrapper(object):
"will be returned.".format(self.queries_log.maxlen)) "will be returned.".format(self.queries_log.maxlen))
return list(self.queries_log) 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): def get_connection_params(self):
"""Returns a dict of parameters suitable for get_new_connection.""" """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.""" """Creates a cursor. Assumes that a connection is established."""
raise NotImplementedError('subclasses of BaseDatabaseWrapper may require a create_cursor() method') 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): def connect(self):
"""Connects to the database. Assumes that the connection is closed.""" """Connects to the database. Assumes that the connection is closed."""
@ -129,7 +129,7 @@ class BaseDatabaseWrapper(object):
with self.wrap_database_errors: with self.wrap_database_errors:
self.connect() self.connect()
##### Backend-specific wrappers for PEP-249 connection methods ##### # ##### Backend-specific wrappers for PEP-249 connection methods #####
def _cursor(self): def _cursor(self):
self.ensure_connection() self.ensure_connection()
@ -151,7 +151,7 @@ class BaseDatabaseWrapper(object):
with self.wrap_database_errors: with self.wrap_database_errors:
return self.connection.close() return self.connection.close()
##### Generic wrappers for PEP-249 connection methods ##### # ##### Generic wrappers for PEP-249 connection methods #####
def cursor(self): def cursor(self):
""" """
@ -203,7 +203,7 @@ class BaseDatabaseWrapper(object):
else: else:
self.connection = None self.connection = None
##### Backend-specific savepoint management methods ##### # ##### Backend-specific savepoint management methods #####
def _savepoint(self, sid): def _savepoint(self, sid):
with self.cursor() as cursor: with self.cursor() as cursor:
@ -221,7 +221,7 @@ class BaseDatabaseWrapper(object):
# Savepoints cannot be created outside a transaction # Savepoints cannot be created outside a transaction
return self.features.uses_savepoints and not self.get_autocommit() return self.features.uses_savepoints and not self.get_autocommit()
##### Generic savepoint management methods ##### # ##### Generic savepoint management methods #####
def savepoint(self): def savepoint(self):
""" """
@ -269,7 +269,7 @@ class BaseDatabaseWrapper(object):
""" """
self.savepoint_state = 0 self.savepoint_state = 0
##### Backend-specific transaction management methods ##### # ##### Backend-specific transaction management methods #####
def _set_autocommit(self, autocommit): def _set_autocommit(self, autocommit):
""" """
@ -277,7 +277,7 @@ class BaseDatabaseWrapper(object):
""" """
raise NotImplementedError('subclasses of BaseDatabaseWrapper may require a _set_autocommit() method') raise NotImplementedError('subclasses of BaseDatabaseWrapper may require a _set_autocommit() method')
##### Generic transaction management methods ##### # ##### Generic transaction management methods #####
def get_autocommit(self): def get_autocommit(self):
""" """
@ -327,7 +327,7 @@ class BaseDatabaseWrapper(object):
"An error occurred in the current transaction. You can't " "An error occurred in the current transaction. You can't "
"execute queries until the end of the 'atomic' block.") "execute queries until the end of the 'atomic' block.")
##### Foreign key constraints checks handling ##### # ##### Foreign key constraints checks handling #####
@contextmanager @contextmanager
def constraint_checks_disabled(self): def constraint_checks_disabled(self):
@ -364,7 +364,7 @@ class BaseDatabaseWrapper(object):
""" """
pass pass
##### Connection termination handling ##### # ##### Connection termination handling #####
def is_usable(self): def is_usable(self):
""" """
@ -403,7 +403,7 @@ class BaseDatabaseWrapper(object):
self.close() self.close()
return return
##### Thread safety handling ##### # ##### Thread safety handling #####
def validate_thread_sharing(self): def validate_thread_sharing(self):
""" """
@ -420,7 +420,7 @@ class BaseDatabaseWrapper(object):
"thread id %s." "thread id %s."
% (self.alias, self._thread_ident, thread.get_ident())) % (self.alias, self._thread_ident, thread.get_ident()))
##### Miscellaneous ##### # ##### Miscellaneous #####
def prepare_database(self): def prepare_database(self):
""" """

View File

@ -39,7 +39,7 @@ Shared:
""" """
### Multiple Template Engines # Multiple Template Engines
from .engine import Engine from .engine import Engine
@ -51,7 +51,7 @@ engines = EngineHandler()
__all__ = ('Engine', 'engines') __all__ = ('Engine', 'engines')
### Django Template Language # Django Template Language
# Public exceptions # Public exceptions
from .base import (TemplateDoesNotExist, TemplateSyntaxError, # NOQA from .base import (TemplateDoesNotExist, TemplateSyntaxError, # NOQA

View File

@ -34,7 +34,7 @@ def has_target(fn):
print("Can't open or read %s. Not touching it." % fn) print("Can't open or read %s. Not touching it." % fn)
return (True, None) return (True, None)
#print fn, len(lines) # print fn, len(lines)
if len(lines) < 1: if len(lines) < 1:
print("Not touching empty file %s." % fn) print("Not touching empty file %s." % fn)
return (True, None) return (True, None)
@ -56,7 +56,7 @@ def main(argv=None):
files.extend((dirpath, f) for f in filenames) files.extend((dirpath, f) for f in filenames)
files.sort() files.sort()
files = [os.path.join(p, fn) for p, fn in files if fn.endswith('.txt')] files = [os.path.join(p, fn) for p, fn in files if fn.endswith('.txt')]
#print files # print files
for fn in files: for fn in files:
if fn in DONT_TOUCH: if fn in DONT_TOUCH:

View File

@ -56,7 +56,7 @@ spelling_word_list_filename = 'spelling_wordlist'
source_suffix = '.txt' source_suffix = '.txt'
# The encoding of source files. # The encoding of source files.
#source_encoding = 'utf-8-sig' # source_encoding = 'utf-8-sig'
# The master toctree document. # The master toctree document.
master_doc = 'contents' master_doc = 'contents'
@ -91,14 +91,14 @@ django_next_version = '1.9'
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.
#language = None # language = None
# Location for .po/.mo translation files used when language is set # Location for .po/.mo translation files used when language is set
locale_dirs = ['locale/'] locale_dirs = ['locale/']
# There are two options for replacing |today|: either, you set today to some # There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used: # non-false value, then it is used:
#today = '' # today = ''
# Else, today_fmt is used as the format for a strftime call. # Else, today_fmt is used as the format for a strftime call.
today_fmt = '%B %d, %Y' today_fmt = '%B %d, %Y'
@ -107,7 +107,7 @@ today_fmt = '%B %d, %Y'
exclude_patterns = ['_build'] exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents. # 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. # If true, '()' will be appended to :func: etc. cross-reference text.
add_function_parentheses = True 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 # 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 # further. For a list of options available for each theme, see the
# documentation. # documentation.
#html_theme_options = {} # html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory. # Add any paths that contain custom themes here, relative to this directory.
html_theme_path = ["_theme"] html_theme_path = ["_theme"]
# The name for this set of Sphinx documents. If None, it defaults to # The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation". # "<project> v<release> documentation".
#html_title = None # html_title = None
# A shorter title for the navigation bar. Default is the same as html_title. # 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 # The name of an image file (relative to this directory) to place at the top
# of the sidebar. # 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 # 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 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large. # pixels large.
#html_favicon = None # html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here, # 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, # relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css". # 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, # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format. # using the given strftime format.
@ -183,40 +183,40 @@ html_use_smartypants = True
html_translator_class = "djangodocs.DjangoHTMLTranslator" html_translator_class = "djangodocs.DjangoHTMLTranslator"
# Content template for the index page. # Content template for the index page.
#html_index = '' # html_index = ''
# Custom sidebar templates, maps document names to template names. # 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 # Additional templates that should be rendered to pages, maps page names to
# template names. # template names.
html_additional_pages = {} html_additional_pages = {}
# If false, no module index is generated. # If false, no module index is generated.
#html_domain_indices = True # html_domain_indices = True
# If false, no index is generated. # 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. # 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. # 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. # 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. # 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 # If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the # contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served. # 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"). # 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. # Output file base name for HTML help builder.
htmlhelp_basename = 'Djangodoc' htmlhelp_basename = 'Djangodoc'
@ -241,7 +241,7 @@ latex_elements = {
# Grouping the document tree into LaTeX files. List of tuples # Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, document class [howto/manual]). # (source start file, target name, title, author, document class [howto/manual]).
#latex_documents = [] # latex_documents = []
latex_documents = [ latex_documents = [
('contents', 'django.tex', 'Django Documentation', ('contents', 'django.tex', 'Django Documentation',
'Django Software Foundation', 'manual'), '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 name of an image file (relative to this directory) to place at the top of
# the title page. # the title page.
#latex_logo = None # latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts, # For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters. # not chapters.
#latex_use_parts = False # latex_use_parts = False
# If true, show page references after internal links. # If true, show page references after internal links.
#latex_show_pagerefs = False # latex_show_pagerefs = False
# If true, show URL addresses after external links. # 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. # Documents to append as an appendix to all manuals.
#latex_appendices = [] # latex_appendices = []
# If false, no module index is generated. # If false, no module index is generated.
#latex_domain_indices = True # latex_domain_indices = True
# -- Options for manual page output -------------------------------------------- # -- Options for manual page output --------------------------------------------
@ -296,7 +296,7 @@ epub_publisher = 'Django Software Foundation'
epub_copyright = copyright epub_copyright = copyright
# The basename for the epub file. It defaults to the project name. # 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 # 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 # 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 # The language of the text. It defaults to the language option
# or en if the language is not set. # or en if the language is not set.
#epub_language = '' # epub_language = ''
# The scheme of the identifier. Typical schemes are ISBN or URL. # 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 # The unique identifier of the text. This can be an ISBN number
# or the project homepage. # or the project homepage.
#epub_identifier = '' # epub_identifier = ''
# A unique identification for the text. # A unique identification for the text.
#epub_uid = '' # epub_uid = ''
# A tuple containing the cover image and cover page html template filenames. # A tuple containing the cover image and cover page html template filenames.
epub_cover = ('', 'epub-cover.html') epub_cover = ('', 'epub-cover.html')
# A sequence of (type, uri, title) tuples for the guide element of content.opf. # 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. # HTML files that should be inserted before the pages created by sphinx.
# The format is a list of tuples containing the path and title. # 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. # HTML files shat should be inserted after the pages created by sphinx.
# The format is a list of tuples containing the path and title. # 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. # 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. # The depth of the table of contents in toc.ncx.
#epub_tocdepth = 3 # epub_tocdepth = 3
# Allow duplicate toc entries. # Allow duplicate toc entries.
#epub_tocdup = True # epub_tocdup = True
# Choose between 'default' and 'includehidden'. # Choose between 'default' and 'includehidden'.
#epub_tocscope = 'default' # epub_tocscope = 'default'
# Fix unsupported image types using the PIL. # Fix unsupported image types using the PIL.
#epub_fix_images = False # epub_fix_images = False
# Scale large images. # Scale large images.
#epub_max_image_width = 0 # epub_max_image_width = 0
# How to display URL addresses: 'footnote', 'no', or 'inline'. # How to display URL addresses: 'footnote', 'no', or 'inline'.
#epub_show_urls = 'inline' # epub_show_urls = 'inline'
# If false, no index is generated. # If false, no index is generated.
#epub_use_index = True # epub_use_index = True
# -- ticket options ------------------------------------------------------------ # -- ticket options ------------------------------------------------------------
ticket_url = 'https://code.djangoproject.com/ticket/%s' ticket_url = 'https://code.djangoproject.com/ticket/%s'

View File

@ -4,7 +4,7 @@ install-script = scripts/rpm-install.sh
[flake8] [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 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 max-line-length = 119
[isort] [isort]

View File

@ -467,7 +467,7 @@ class EscapingChecks(TestCase):
@unittest.skipUnless(connection.vendor == 'sqlite', @unittest.skipUnless(connection.vendor == 'sqlite',
"This is an sqlite-specific issue") "This is an sqlite-specific issue")
def test_sqlite_parameter_escaping(self): def test_sqlite_parameter_escaping(self):
#13648: '%s' escaping support for sqlite3 # '%s' escaping support for sqlite3 #13648
cursor = connection.cursor() cursor = connection.cursor()
cursor.execute("select strftime('%s', date('now'))") cursor.execute("select strftime('%s', date('now'))")
response = cursor.fetchall()[0][0] response = cursor.fetchall()[0][0]
@ -505,7 +505,7 @@ class BackendTestCase(TransactionTestCase):
cursor.execute(query, args) cursor.execute(query, args)
def test_cursor_executemany(self): def test_cursor_executemany(self):
#4896: Test cursor.executemany # Test cursor.executemany #4896
args = [(i, i ** 2) for i in range(-5, 6)] args = [(i, i ** 2) for i in range(-5, 6)]
self.create_squares_with_executemany(args) self.create_squares_with_executemany(args)
self.assertEqual(models.Square.objects.count(), 11) self.assertEqual(models.Square.objects.count(), 11)
@ -514,13 +514,13 @@ class BackendTestCase(TransactionTestCase):
self.assertEqual(square.square, i ** 2) self.assertEqual(square.square, i ** 2)
def test_cursor_executemany_with_empty_params_list(self): def test_cursor_executemany_with_empty_params_list(self):
#4765: executemany with params=[] does nothing # Test executemany with params=[] does nothing #4765
args = [] args = []
self.create_squares_with_executemany(args) self.create_squares_with_executemany(args)
self.assertEqual(models.Square.objects.count(), 0) self.assertEqual(models.Square.objects.count(), 0)
def test_cursor_executemany_with_iterator(self): 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)) args = iter((i, i ** 2) for i in range(-3, 2))
self.create_squares_with_executemany(args) self.create_squares_with_executemany(args)
self.assertEqual(models.Square.objects.count(), 5) self.assertEqual(models.Square.objects.count(), 5)
@ -533,14 +533,14 @@ class BackendTestCase(TransactionTestCase):
@skipUnlessDBFeature('supports_paramstyle_pyformat') @skipUnlessDBFeature('supports_paramstyle_pyformat')
def test_cursor_execute_with_pyformat(self): 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} args = {'root': 3, 'square': 9}
self.create_squares(args, 'pyformat', multiple=False) self.create_squares(args, 'pyformat', multiple=False)
self.assertEqual(models.Square.objects.count(), 1) self.assertEqual(models.Square.objects.count(), 1)
@skipUnlessDBFeature('supports_paramstyle_pyformat') @skipUnlessDBFeature('supports_paramstyle_pyformat')
def test_cursor_executemany_with_pyformat(self): 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)] args = [{'root': i, 'square': i ** 2} for i in range(-5, 6)]
self.create_squares(args, 'pyformat', multiple=True) self.create_squares(args, 'pyformat', multiple=True)
self.assertEqual(models.Square.objects.count(), 11) self.assertEqual(models.Square.objects.count(), 11)
@ -561,7 +561,7 @@ class BackendTestCase(TransactionTestCase):
self.assertEqual(models.Square.objects.count(), 9) self.assertEqual(models.Square.objects.count(), 9)
def test_unicode_fetches(self): 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 qn = connection.ops.quote_name
models.Person(first_name="John", last_name="Doe").save() models.Person(first_name="John", last_name="Doe").save()
models.Person(first_name="Jane", last_name="Doe").save() models.Person(first_name="Jane", last_name="Doe").save()

View File

@ -346,7 +346,7 @@ class HttpResponseTests(unittest.TestCase):
# test odd inputs # test odd inputs
r = HttpResponse() r = HttpResponse()
r.content = ['1', '2', 3, '\u079e'] 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') self.assertEqual(r.content, b'123\xde\x9e')
# .content can safely be accessed multiple times. # .content can safely be accessed multiple times.

View File

@ -30,7 +30,7 @@ class IntrospectionTests(TransactionTestCase):
"django_table_names() returned a non-Django table") "django_table_names() returned a non-Django table")
def test_django_table_names_retval_type(self): 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) tl = connection.introspection.django_table_names(only_existing=True)
self.assertIs(type(tl), list) self.assertIs(type(tl), list)
tl = connection.introspection.django_table_names(only_existing=False) tl = connection.introspection.django_table_names(only_existing=False)

View File

@ -360,7 +360,7 @@ class MakeMigrationsTests(MigrationTestBase):
self.assertIn('\\u201c\\xd0j\\xe1\\xf1g\\xf3\\u201d', content) # title.default self.assertIn('\\u201c\\xd0j\\xe1\\xf1g\\xf3\\u201d', content) # title.default
def test_failing_migration(self): 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) apps.register_model('migrations', UnserializableModel)
with six.assertRaisesRegex(self, ValueError, r'Cannot serialize'): with six.assertRaisesRegex(self, ValueError, r'Cannot serialize'):

View File

@ -168,7 +168,7 @@ class VerboseNameField(models.Model):
field10 = models.FilePathField("verbose field10") field10 = models.FilePathField("verbose field10")
field11 = models.FloatField("verbose field11") field11 = models.FloatField("verbose field11")
# Don't want to depend on Pillow in this test # 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") field12 = models.IntegerField("verbose field12")
field13 = models.GenericIPAddressField("verbose field13", protocol="ipv4") field13 = models.GenericIPAddressField("verbose field13", protocol="ipv4")
field14 = models.NullBooleanField("verbose field14") field14 = models.NullBooleanField("verbose field14")

View File

@ -961,10 +961,10 @@ class ModelToDictTests(TestCase):
with self.assertNumQueries(0): with self.assertNumQueries(0):
d = model_to_dict(art) 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: for c in categories:
self.assertIn(c.pk, d['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) self.assertIsInstance(d['categories'], list)

View File

@ -28,7 +28,7 @@ class Article(models.Model):
class Movie(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) movie_id = models.AutoField(primary_key=True)
name = models.CharField(max_length=60) name = models.CharField(max_length=60)
@ -72,7 +72,7 @@ class NonAutoPK(models.Model):
name = models.CharField(max_length=10, primary_key=True) 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): class Model1(models.Model):
pkey = models.IntegerField(unique=True, db_index=True) pkey = models.IntegerField(unique=True, db_index=True)

View File

@ -6,7 +6,7 @@ from django.db import models
from django.utils.encoding import python_2_unicode_compatible from django.utils.encoding import python_2_unicode_compatible
## Basic tests # Basic tests
@python_2_unicode_compatible @python_2_unicode_compatible
class Author(models.Model): class Author(models.Model):
@ -88,7 +88,7 @@ class BookReview(models.Model):
notes = models.TextField(null=True, blank=True) notes = models.TextField(null=True, blank=True)
## Models for default manager tests # Models for default manager tests
class Qualification(models.Model): class Qualification(models.Model):
name = models.CharField(max_length=10) name = models.CharField(max_length=10)
@ -124,7 +124,7 @@ class Department(models.Model):
ordering = ['id'] ordering = ['id']
## GenericRelation/GenericForeignKey tests # GenericRelation/GenericForeignKey tests
@python_2_unicode_compatible @python_2_unicode_compatible
class TaggedItem(models.Model): class TaggedItem(models.Model):
@ -172,7 +172,7 @@ class Comment(models.Model):
ordering = ['id'] ordering = ['id']
## Models for lookup ordering tests # Models for lookup ordering tests
class House(models.Model): class House(models.Model):
name = models.CharField(max_length=50) name = models.CharField(max_length=50)
@ -209,7 +209,7 @@ class Person(models.Model):
ordering = ['id'] ordering = ['id']
## Models for nullable FK tests # Models for nullable FK tests
@python_2_unicode_compatible @python_2_unicode_compatible
class Employee(models.Model): class Employee(models.Model):
@ -224,7 +224,7 @@ class Employee(models.Model):
ordering = ['id'] ordering = ['id']
## Ticket #19607 # Ticket #19607
@python_2_unicode_compatible @python_2_unicode_compatible
class LessonEntry(models.Model): class LessonEntry(models.Model):
@ -244,7 +244,7 @@ class WordEntry(models.Model):
return "%s (%s)" % (self.name, self.id) return "%s (%s)" % (self.name, self.id)
## Ticket #21410: Regression when related_name="+" # Ticket #21410: Regression when related_name="+"
@python_2_unicode_compatible @python_2_unicode_compatible
class Author2(models.Model): class Author2(models.Model):

View File

@ -240,7 +240,7 @@ test_data = [
(data_obj, 81, IntegerData, -123456789), (data_obj, 81, IntegerData, -123456789),
(data_obj, 82, IntegerData, 0), (data_obj, 82, IntegerData, 0),
(data_obj, 83, IntegerData, None), (data_obj, 83, IntegerData, None),
#(XX, ImageData # (XX, ImageData
(data_obj, 95, GenericIPAddressData, "fe80:1424:2223:6cff:fe8a:2e8a:2151:abcd"), (data_obj, 95, GenericIPAddressData, "fe80:1424:2223:6cff:fe8a:2e8a:2151:abcd"),
(data_obj, 96, GenericIPAddressData, None), (data_obj, 96, GenericIPAddressData, None),
(data_obj, 100, NullBooleanData, True), (data_obj, 100, NullBooleanData, True),

View File

@ -93,7 +93,6 @@ class SyndicationFeedTest(FeedTestCase):
'link': 'http://example.com/blog/', 'link': 'http://example.com/blog/',
'language': 'en', 'language': 'en',
'lastBuildDate': last_build_date, 'lastBuildDate': last_build_date,
#'atom:link': '',
'ttl': '600', 'ttl': '600',
'copyright': 'Copyright (c) 2007, Sally Smith', 'copyright': 'Copyright (c) 2007, Sally Smith',
}) })

View File

@ -1 +0,0 @@
#from django.conf.urls import patterns, url, include