diff options
| author | Daniel Wiesmann <daniel.wiesmann@gmail.com> | 2015-02-09 10:14:48 +0000 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2015-02-09 15:51:19 +0100 |
| commit | 32ed4c202f9f8ecd0bf305db06d363cd7a9927eb (patch) | |
| tree | 5245db7789c2ade8255601854ff16df09f06d351 /django | |
| parent | e215d325a8918eef489648a7050fea3d103f023f (diff) | |
Moved numpy import helper to shortcuts
Numpy will be used in both the geos and gdal modules,
so the import should sit in the parent module gis.
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/gis/geos/base.py | 6 | ||||
| -rw-r--r-- | django/contrib/gis/geos/coordseq.py | 3 | ||||
| -rw-r--r-- | django/contrib/gis/geos/linestring.py | 2 | ||||
| -rw-r--r-- | django/contrib/gis/geos/tests/test_geos.py | 3 | ||||
| -rw-r--r-- | django/contrib/gis/shortcuts.py | 6 |
5 files changed, 11 insertions, 9 deletions
diff --git a/django/contrib/gis/geos/base.py b/django/contrib/gis/geos/base.py index ff54fe6695..634ed7d3d1 100644 --- a/django/contrib/gis/geos/base.py +++ b/django/contrib/gis/geos/base.py @@ -12,12 +12,6 @@ except ImportError: HAS_GDAL = False gdal = GDALInfo() -# NumPy supported? -try: - import numpy -except ImportError: - numpy = False - class GEOSBase(object): """ diff --git a/django/contrib/gis/geos/coordseq.py b/django/contrib/gis/geos/coordseq.py index de3583e499..ae82908f5c 100644 --- a/django/contrib/gis/geos/coordseq.py +++ b/django/contrib/gis/geos/coordseq.py @@ -6,9 +6,10 @@ from ctypes import byref, c_double, c_uint from django.contrib.gis.geos import prototypes as capi -from django.contrib.gis.geos.base import GEOSBase, numpy +from django.contrib.gis.geos.base import GEOSBase from django.contrib.gis.geos.error import GEOSException, GEOSIndexError from django.contrib.gis.geos.libgeos import CS_PTR +from django.contrib.gis.shortcuts import numpy from django.utils.six.moves import range diff --git a/django/contrib/gis/geos/linestring.py b/django/contrib/gis/geos/linestring.py index 7b2cc540ba..82ae9a2a4e 100644 --- a/django/contrib/gis/geos/linestring.py +++ b/django/contrib/gis/geos/linestring.py @@ -1,9 +1,9 @@ from django.contrib.gis.geos import prototypes as capi -from django.contrib.gis.geos.base import numpy from django.contrib.gis.geos.coordseq import GEOSCoordSeq from django.contrib.gis.geos.error import GEOSException from django.contrib.gis.geos.geometry import GEOSGeometry from django.contrib.gis.geos.point import Point +from django.contrib.gis.shortcuts import numpy from django.utils.six.moves import range diff --git a/django/contrib/gis/geos/tests/test_geos.py b/django/contrib/gis/geos/tests/test_geos.py index 7c9c1e829e..a288300f8f 100644 --- a/django/contrib/gis/geos/tests/test_geos.py +++ b/django/contrib/gis/geos/tests/test_geos.py @@ -10,6 +10,7 @@ from unittest import skipUnless from django.contrib.gis.gdal import HAS_GDAL from django.contrib.gis.geometry.test_data import TestDataMixin +from django.contrib.gis.shortcuts import numpy from django.utils import six from django.utils.encoding import force_bytes from django.utils.six.moves import range @@ -20,7 +21,7 @@ if HAS_GEOS: from .. import (GEOSException, GEOSIndexError, GEOSGeometry, GeometryCollection, Point, MultiPoint, Polygon, MultiPolygon, LinearRing, LineString, MultiLineString, fromfile, fromstr, geos_version_info) - from ..base import gdal, numpy, GEOSBase + from ..base import gdal, GEOSBase @skipUnless(HAS_GEOS, "Geos is required.") diff --git a/django/contrib/gis/shortcuts.py b/django/contrib/gis/shortcuts.py index a530228e84..2df690c116 100644 --- a/django/contrib/gis/shortcuts.py +++ b/django/contrib/gis/shortcuts.py @@ -5,6 +5,12 @@ from django.conf import settings from django.http import HttpResponse from django.template import loader +# NumPy supported? +try: + import numpy +except ImportError: + numpy = False + def compress_kml(kml): "Returns compressed KMZ from the given KML string." |
