mirror of https://github.com/django/django.git
Removed some dead code and simplified some other ocde
This commit is contained in:
parent
cce42d4cf2
commit
7f508a3673
|
@ -3,10 +3,12 @@
|
|||
ctypes prototypes.
|
||||
"""
|
||||
from ctypes import c_void_p, string_at
|
||||
|
||||
from django.contrib.gis.gdal.error import check_err, OGRException, SRSException
|
||||
from django.contrib.gis.gdal.libgdal import lgdal
|
||||
from django.utils import six
|
||||
|
||||
|
||||
# Helper routines for retrieving pointers and/or values from
|
||||
# arguments passed in by reference.
|
||||
def arg_byref(args, offset=-1):
|
||||
|
@ -17,13 +19,6 @@ def ptr_byref(args, offset=-1):
|
|||
"Returns the pointer argument passed in by-reference."
|
||||
return args[offset]._obj
|
||||
|
||||
def check_bool(result, func, cargs):
|
||||
"Returns the boolean evaluation of the value."
|
||||
if bool(result):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
### String checking Routines ###
|
||||
def check_const_string(result, func, cargs, offset=None):
|
||||
"""
|
||||
|
@ -111,7 +106,6 @@ def check_errcode(result, func, cargs):
|
|||
Check the error code returned (c_int).
|
||||
"""
|
||||
check_err(result)
|
||||
return
|
||||
|
||||
def check_pointer(result, func, cargs):
|
||||
"Makes sure the result pointer is valid."
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from ctypes import c_char_p, c_double, c_int, c_void_p, POINTER
|
||||
from django.contrib.gis.gdal.envelope import OGREnvelope
|
||||
from django.contrib.gis.gdal.libgdal import lgdal
|
||||
from django.contrib.gis.gdal.prototypes.errcheck import check_bool, check_envelope
|
||||
from django.contrib.gis.gdal.prototypes.errcheck import check_envelope
|
||||
from django.contrib.gis.gdal.prototypes.generation import (const_string_output,
|
||||
double_output, geom_output, int_output, srs_output, string_output, void_output)
|
||||
|
||||
|
@ -20,7 +20,7 @@ def pnt_func(f):
|
|||
def topology_func(f):
|
||||
f.argtypes = [c_void_p, c_void_p]
|
||||
f.restype = c_int
|
||||
f.errchck = check_bool
|
||||
f.errchck = bool
|
||||
return f
|
||||
|
||||
### OGR_G ctypes function prototypes ###
|
||||
|
|
|
@ -12,15 +12,6 @@ if HAS_GEOS:
|
|||
from ..error import GEOSIndexError
|
||||
|
||||
|
||||
def getItem(o,i):
|
||||
return o[i]
|
||||
|
||||
def delItem(o,i):
|
||||
del o[i]
|
||||
|
||||
def setItem(o,i,v):
|
||||
o[i] = v
|
||||
|
||||
if HAS_GEOS:
|
||||
def api_get_distance(x):
|
||||
return x.distance(Point(-200,-200))
|
||||
|
|
Loading…
Reference in New Issue