a
    ßÁdx  ã                   @   s8   d Z ddlZddd„Zddd„Zddd	„Zdd
d„ZdS )zqLoad/dump geometries using the well-known binary (WKB) format.

Also provides pickle-like convenience functions.
é    NFc                 C   s
   t  | ¡S )zÆLoad a geometry from a WKB byte string, or hex-encoded string if
    ``hex=True``.

    Raises
    ------
    GEOSException, UnicodeDecodeError
        If ``data`` contains an invalid geometry.
    )ÚshapelyZfrom_wkb)ÚdataÚhex© r   úN/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/shapely/wkb.pyÚloads   s    	r   c                 C   s   |   ¡ }t||d�S )zœLoad a geometry from an open file.

    Raises
    ------
    GEOSException, UnicodeDecodeError
        If the given file contains an invalid geometry.
    )r   )Úreadr   )Úfpr   r   r   r   r   Úload   s    r
   c                 K   s\   |durt  | |¡} d|d< d|v rF| d¡}|r6dnd}|j|d� t j| fd|i|¤ŽS )	aL  Dump a WKB representation of a geometry to a byte string, or a
    hex-encoded string if ``hex=True``.

    Parameters
    ----------
    ob : geometry
        The geometry to export to well-known binary (WKB) representation
    hex : bool
        If true, export the WKB as a hexadecimal string. The default is to
        return a binary string/bytes object.
    srid : int
        Spatial reference system ID to include in the output. The default value
        means no SRID is included.
    **kw : kwargs, optional
        Keyword output options passed to :func:`~shapely.to_wkb`.
    NTZinclude_sridÚ
big_endianr   é   )Ú
byte_orderr   )r   Zset_sridÚpopÚupdateZto_wkb)Úobr   ZsridÚkwr   r   r   r   r   Údumps    s    
r   c                 K   s   |  t| fd|i|¤Ž¡ dS )z Dump a geometry to an open file.r   N)Úwriter   )r   r	   r   r   r   r   r   Údump>   s    r   )F)F)FN)F)Ú__doc__r   r   r
   r   r   r   r   r   r   Ú<module>   s
   


