
 X                 @   sH   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  r9 t |  d   }  |  j   } Wd QXn |  j   } t  | t  r y8 | j   } t j |  s t	 j |  r t
 |  SWq t k
 r Yq Xn
 t
 |  St
 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   M/home/ubuntu/projects/ifolica/build/django/django/contrib/gis/geos/factory.pyfromfile   s    
r   c             K   s   t  |  |  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   