From 7f508a36731660c8cd2659f23098f1379eaa8fb5 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Thu, 17 Oct 2013 05:15:08 -0700 Subject: [PATCH] Removed some dead code and simplified some other ocde --- django/contrib/gis/gdal/prototypes/errcheck.py | 10 ++-------- django/contrib/gis/gdal/prototypes/geom.py | 4 ++-- django/contrib/gis/geos/tests/test_geos_mutation.py | 9 --------- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/django/contrib/gis/gdal/prototypes/errcheck.py b/django/contrib/gis/gdal/prototypes/errcheck.py index 5d2963402a..3006107e45 100644 --- a/django/contrib/gis/gdal/prototypes/errcheck.py +++ b/django/contrib/gis/gdal/prototypes/errcheck.py @@ -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." diff --git a/django/contrib/gis/gdal/prototypes/geom.py b/django/contrib/gis/gdal/prototypes/geom.py index 6a5239399e..f8016bc7bf 100644 --- a/django/contrib/gis/gdal/prototypes/geom.py +++ b/django/contrib/gis/gdal/prototypes/geom.py @@ -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 ### diff --git a/django/contrib/gis/geos/tests/test_geos_mutation.py b/django/contrib/gis/geos/tests/test_geos_mutation.py index 1aa9a1db32..79084f9c2b 100644 --- a/django/contrib/gis/geos/tests/test_geos_mutation.py +++ b/django/contrib/gis/geos/tests/test_geos_mutation.py @@ -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))