summaryrefslogtreecommitdiff
path: root/lib/python2.7/site-packages/django/contrib/gis/geos/factory.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python2.7/site-packages/django/contrib/gis/geos/factory.py')
-rw-r--r--lib/python2.7/site-packages/django/contrib/gis/geos/factory.py35
1 files changed, 0 insertions, 35 deletions
diff --git a/lib/python2.7/site-packages/django/contrib/gis/geos/factory.py b/lib/python2.7/site-packages/django/contrib/gis/geos/factory.py
deleted file mode 100644
index 2e5fa4f..0000000
--- a/lib/python2.7/site-packages/django/contrib/gis/geos/factory.py
+++ /dev/null
@@ -1,35 +0,0 @@
-from django.contrib.gis import memoryview
-from django.contrib.gis.geos.geometry import GEOSGeometry, wkt_regex, hex_regex
-
-from django.utils import six
-
-
-def fromfile(file_h):
- """
- Given a string file name, returns a GEOSGeometry. The file may contain WKB,
- WKT, or HEX.
- """
- # If given a file name, get a real handle.
- if isinstance(file_h, six.string_types):
- with open(file_h, 'rb') as file_h:
- buf = file_h.read()
- else:
- buf = file_h.read()
-
- # If we get WKB need to wrap in memoryview(), so run through regexes.
- if isinstance(buf, bytes):
- try:
- decoded = buf.decode()
- if wkt_regex.match(decoded) or hex_regex.match(decoded):
- return GEOSGeometry(decoded)
- except UnicodeDecodeError:
- pass
- else:
- return GEOSGeometry(buf)
-
- return GEOSGeometry(memoryview(buf))
-
-
-def fromstr(string, **kwargs):
- "Given a string value, returns a GEOSGeometry object."
- return GEOSGeometry(string, **kwargs)