3
(h                 @   s4   d dl mZmZmZ d dlmZ dd Zdd ZdS )    )GEOSGeometry	hex_regex	wkt_regex)sixc             C   s   t | tjr,t| d} | j }W dQ R X n| j }t |tr~y(|j }tj|s\t	j|rdt
|S W q tk
rz   Y qX nt
|S t
tj|S )zf
    Given a string file name, returns a GEOSGeometry. The file may contain WKB,
    WKT, or HEX.
    rbN)
isinstancer   string_typesopenreadbytesdecoder   matchr   r   UnicodeDecodeError
memoryview)Zfile_hbufdecoded r   C/tmp/pip-install-q3hcpn_q/Django/django/contrib/gis/geos/factory.pyfromfile   s    
r   c             K   s   t | f|S )z4Given a string value, returns a GEOSGeometry object.)r   )stringkwargsr   r   r   fromstr   s    r   N)Z django.contrib.gis.geos.geometryr   r   r   Zdjango.utilsr   r   r   r   r   r   r   <module>   s   