File: //lib/python3/dist-packages/django/contrib/gis/geos/__pycache__/factory.cpython-310.pyc
o
���_� � @ s( d dl mZmZmZ dd� Zdd� ZdS )� )�GEOSGeometry� hex_regex� wkt_regexc C s� t | t�rt| d��} | �� }W d � n1 sw Y n| �� }t |t�rGz|�� }W n ty7 Y nw t�|�sBt �|�rFt
|�S nt
|�S t
t|��S )zf
Given a string file name, returns a GEOSGeometry. The file may contain WKB,
WKT, or HEX.
�rbN)�
isinstance�str�open�read�bytes�decode�UnicodeDecodeErrorr �matchr r �
memoryview)�file_h�buf�decoded� r �A/usr/lib/python3/dist-packages/django/contrib/gis/geos/factory.py�fromfile s"