mirror of https://github.com/django/django.git
parent
232a1d297c
commit
fc8e1e0c10
|
@ -344,7 +344,7 @@ class Apps(object):
|
|||
for model in self.get_models(include_auto_created=True):
|
||||
model._meta._expire_cache()
|
||||
|
||||
### DEPRECATED METHODS GO BELOW THIS LINE ###
|
||||
# ### DEPRECATED METHODS GO BELOW THIS LINE ###
|
||||
|
||||
def load_app(self, app_name):
|
||||
"""
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -23,7 +23,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
|
||||
|
@ -428,7 +428,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.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -57,7 +57,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:
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -22,7 +22,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.
|
||||
|
@ -69,7 +68,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
|
||||
|
@ -108,7 +107,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
|
||||
|
|
|
@ -16,7 +16,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
|
||||
|
@ -44,7 +43,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)
|
||||
|
@ -69,7 +68,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."
|
||||
|
@ -103,7 +102,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
|
||||
|
||||
|
|
|
@ -154,7 +154,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."
|
||||
|
@ -190,7 +190,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."
|
||||
|
@ -254,7 +254,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):
|
||||
|
@ -297,7 +297,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."
|
||||
|
@ -360,7 +360,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)
|
||||
|
@ -405,7 +405,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."""
|
||||
|
@ -448,7 +448,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):
|
||||
|
|
|
@ -26,7 +26,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
|
||||
|
@ -95,7 +94,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."
|
||||
|
@ -189,7 +188,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
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -11,7 +11,7 @@ from django.contrib.gis.gdal.prototypes.generation import (const_string_output,
|
|||
|
||||
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])
|
||||
|
@ -19,7 +19,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])
|
||||
|
@ -28,7 +28,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])
|
||||
|
@ -43,14 +43,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])
|
||||
|
@ -66,7 +66,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])
|
||||
|
|
|
@ -21,7 +21,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.
|
||||
|
@ -62,17 +62,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
|
||||
|
@ -91,7 +91,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)
|
||||
|
@ -100,7 +100,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.
|
||||
|
|
|
@ -6,7 +6,7 @@ from django.contrib.gis.gdal.prototypes.generation import (const_string_output,
|
|||
double_output, geom_output, int_output, srs_output, string_output, void_output)
|
||||
|
||||
|
||||
### Generation routines specific to this module ###
|
||||
# ### Generation routines specific to this module ###
|
||||
def env_func(f, argtypes):
|
||||
"For getting OGREnvelopes."
|
||||
f.argtypes = argtypes
|
||||
|
@ -26,7 +26,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])
|
||||
|
|
|
@ -18,14 +18,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])
|
||||
|
@ -43,7 +43,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])
|
||||
|
@ -57,7 +57,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])
|
||||
|
|
|
@ -4,7 +4,7 @@ from django.contrib.gis.gdal.prototypes.generation import (const_string_output,
|
|||
double_output, int_output, srs_output, string_output, void_output)
|
||||
|
||||
|
||||
## 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
|
||||
|
|
|
@ -37,7 +37,6 @@ from django.utils import six
|
|||
from django.utils.encoding import force_bytes, force_text
|
||||
|
||||
|
||||
#### Spatial Reference class. ####
|
||||
class SpatialReference(GDALBase):
|
||||
"""
|
||||
A wrapper for the OGRSpatialReference object. According to the GDAL Web site,
|
||||
|
@ -45,7 +44,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.
|
||||
|
@ -135,7 +133,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
|
||||
|
@ -176,7 +174,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."
|
||||
|
@ -197,7 +195,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."
|
||||
|
@ -238,7 +236,7 @@ class SpatialReference(GDALBase):
|
|||
name = force_text(name)
|
||||
return (units, name)
|
||||
|
||||
#### Spheroid/Ellipsoid Properties ####
|
||||
# #### Spheroid/Ellipsoid Properties ####
|
||||
@property
|
||||
def ellipsoid(self):
|
||||
"""
|
||||
|
@ -262,7 +260,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):
|
||||
"""
|
||||
|
@ -284,7 +282,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)
|
||||
|
@ -305,7 +303,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."
|
||||
|
|
|
@ -196,7 +196,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))
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -2,7 +2,7 @@ from ctypes import c_char_p, c_float, c_int, string_at, Structure, POINTER
|
|||
from django.contrib.gis.geoip.libgeoip import lgeoip, free
|
||||
|
||||
|
||||
#### GeoIP C Structure definitions ####
|
||||
# #### GeoIP C Structure definitions ####
|
||||
|
||||
class GeoIPRecord(Structure):
|
||||
_fields_ = [('country_code', c_char_p),
|
||||
|
@ -36,7 +36,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'):
|
||||
|
|
|
@ -49,7 +49,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)
|
||||
|
|
|
@ -16,7 +16,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):
|
||||
|
@ -68,7 +67,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
|
||||
|
@ -80,7 +79,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)
|
||||
|
@ -117,7 +116,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."
|
||||
|
@ -136,7 +135,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)
|
||||
|
|
|
@ -43,7 +43,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
|
||||
|
@ -175,7 +174,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
|
||||
|
@ -198,7 +197,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."
|
||||
|
@ -221,7 +220,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'"
|
||||
|
@ -256,7 +255,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):
|
||||
"""
|
||||
|
@ -292,7 +291,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)
|
||||
|
@ -360,7 +359,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)
|
||||
|
@ -374,7 +373,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):
|
||||
"""
|
||||
|
@ -454,7 +453,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."
|
||||
|
@ -525,7 +524,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)
|
||||
|
@ -639,7 +638,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."
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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."
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -128,7 +128,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
|
||||
|
|
|
@ -66,7 +66,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
|
||||
|
@ -143,7 +143,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."
|
||||
|
|
|
@ -4,7 +4,7 @@ from django.contrib.gis.geos.prototypes.errcheck import last_arg_byref, GEOSExce
|
|||
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:
|
||||
|
@ -30,7 +30,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)]
|
||||
|
@ -66,7 +66,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])
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -19,7 +19,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]
|
||||
|
@ -69,7 +69,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'))
|
||||
|
|
|
@ -10,7 +10,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
|
||||
|
||||
|
@ -31,7 +31,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
|
||||
|
||||
|
@ -43,7 +43,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
|
||||
|
||||
|
@ -67,7 +67,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
|
||||
|
||||
|
@ -89,7 +89,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
|
||||
|
||||
|
@ -127,7 +127,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):
|
||||
|
@ -139,7 +139,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
|
||||
|
@ -172,7 +172,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
|
||||
|
@ -206,7 +206,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):
|
||||
|
|
|
@ -12,7 +12,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
|
||||
|
@ -25,7 +25,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'))
|
||||
|
|
|
@ -8,7 +8,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]
|
||||
|
@ -27,14 +27,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'))
|
||||
|
|
|
@ -27,7 +27,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'))
|
||||
|
|
|
@ -466,7 +466,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.
|
||||
|
||||
|
@ -661,7 +661,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)
|
||||
|
||||
|
@ -681,7 +681,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)):
|
||||
|
@ -719,11 +719,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."
|
||||
|
|
|
@ -37,7 +37,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()
|
||||
|
@ -74,7 +74,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))
|
||||
|
||||
|
|
|
@ -144,7 +144,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:
|
||||
|
@ -331,7 +331,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
|
||||
|
@ -441,7 +441,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()
|
||||
|
|
|
@ -84,7 +84,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."""
|
||||
|
@ -102,7 +102,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."""
|
||||
|
@ -130,7 +130,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()
|
||||
|
@ -152,7 +152,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):
|
||||
"""
|
||||
|
@ -204,7 +204,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:
|
||||
|
@ -222,7 +222,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):
|
||||
"""
|
||||
|
@ -270,7 +270,7 @@ class BaseDatabaseWrapper(object):
|
|||
"""
|
||||
self.savepoint_state = 0
|
||||
|
||||
##### Backend-specific transaction management methods #####
|
||||
# ##### Backend-specific transaction management methods #####
|
||||
|
||||
def _set_autocommit(self, autocommit):
|
||||
"""
|
||||
|
@ -278,7 +278,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):
|
||||
"""
|
||||
|
@ -328,7 +328,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):
|
||||
|
@ -365,7 +365,7 @@ class BaseDatabaseWrapper(object):
|
|||
"""
|
||||
pass
|
||||
|
||||
##### Connection termination handling #####
|
||||
# ##### Connection termination handling #####
|
||||
|
||||
def is_usable(self):
|
||||
"""
|
||||
|
@ -404,7 +404,7 @@ class BaseDatabaseWrapper(object):
|
|||
self.close()
|
||||
return
|
||||
|
||||
##### Thread safety handling #####
|
||||
# ##### Thread safety handling #####
|
||||
|
||||
def validate_thread_sharing(self):
|
||||
"""
|
||||
|
@ -421,7 +421,7 @@ class BaseDatabaseWrapper(object):
|
|||
"thread id %s."
|
||||
% (self.alias, self._thread_ident, thread.get_ident()))
|
||||
|
||||
##### Miscellaneous #####
|
||||
# ##### Miscellaneous #####
|
||||
|
||||
def prepare_database(self):
|
||||
"""
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
86
docs/conf.py
86
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
|
||||
# "<project> v<release> 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 <link> 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'
|
||||
|
|
|
@ -4,7 +4,7 @@ install-script = scripts/rpm-install.sh
|
|||
|
||||
[flake8]
|
||||
exclude=build,.git,./django/utils/dictconfig.py,./django/utils/unittest.py,./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
|
||||
|
||||
[metadata]
|
||||
|
|
|
@ -464,7 +464,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]
|
||||
|
@ -502,7 +502,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)
|
||||
|
@ -511,13 +511,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)
|
||||
|
@ -530,14 +530,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)
|
||||
|
@ -558,7 +558,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()
|
||||
|
|
|
@ -345,7 +345,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.
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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'):
|
||||
|
|
|
@ -166,7 +166,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.IPAddressField("verbose field13")
|
||||
field14 = models.GenericIPAddressField("verbose field14", protocol="ipv4")
|
||||
|
|
|
@ -955,10 +955,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)
|
||||
|
||||
|
||||
|
|
|
@ -29,7 +29,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)
|
||||
|
||||
|
@ -73,7 +73,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)
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -241,7 +241,7 @@ test_data = [
|
|||
(data_obj, 81, IntegerData, -123456789),
|
||||
(data_obj, 82, IntegerData, 0),
|
||||
(data_obj, 83, IntegerData, None),
|
||||
#(XX, ImageData
|
||||
# (XX, ImageData
|
||||
(data_obj, 90, IPAddressData, "127.0.0.1"),
|
||||
(data_obj, 91, IPAddressData, None),
|
||||
(data_obj, 95, GenericIPAddressData, "fe80:1424:2223:6cff:fe8a:2e8a:2151:abcd"),
|
||||
|
|
|
@ -94,7 +94,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',
|
||||
})
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
#from django.conf.urls import patterns, url, include
|
Loading…
Reference in New Issue