U
    d                     @   s(   d dl mZmZmZ dd Zdd ZdS )    )GEOSGeometry	hex_regex	wkt_regexc              	   C   s   t | tr*t| d} |  }W 5 Q R X n|  }t |tr|z| }W n tk
r\   Y qX t|srt	|rt
|S nt
|S t
t|S )zf
    Given a string file name, returns a GEOSGeometry. The file may contain WKB,
    WKT, or HEX.
    rb)
isinstancestropenreadbytesdecodeUnicodeDecodeErrorr   matchr   r   
memoryview)Zfile_hbufdecoded r   C/tmp/pip-unpacked-wheel-7vj2equ7/django/contrib/gis/geos/factory.pyfromfile   s    


r   c                 K   s   t | f|S )z3Given a string value, return a GEOSGeometry object.)r   )stringkwargsr   r   r   fromstr   s    r   N)Z django.contrib.gis.geos.geometryr   r   r   r   r   r   r   r   r   <module>   s   