a
    û1$e¹  ã                   @   sB   d dl Zd dlmZmZmZ d dlmZ eeedœZddd„Z	dS )	é    N)ÚMultiLineStringÚ
MultiPointÚMultiPolygon)ÚBaseGeometry)ZPointZ
LineStringZPolygonFc                    s    t | tƒr| g} nt | tjƒr&t| ƒ} | d j‰ t‡ fdd„| D ƒƒsNtdƒ‚t| ƒdkrrˆ  	d¡rrtd 
ˆ ¡ƒ‚t| ƒdkr”ˆ  	d¡sŒ|s”| d S tˆ  | ƒS )aV  
    Collect single part geometries into their Multi* counterpart

    Parameters
    ----------
    x : an iterable or Series of Shapely geometries, a GeoSeries, or
        a single Shapely geometry
    multi : boolean, default False
        if True, force returned geometries to be Multi* even if they
        only have one component.

    r   c                 3   s   | ]}|j ˆ kV  qd S )N)Ú	geom_type)Ú.0Úg©Út© úP/var/www/html/django/DPS/env/lib/python3.9/site-packages/geopandas/tools/util.pyÚ	<genexpr>$   ó    zcollect.<locals>.<genexpr>z!Geometry type must be homogeneousé   ZMultiz/Cannot collect {0}. Must have single geometries)Ú
isinstancer   ÚpdZSeriesÚlistr   ÚallÚ
ValueErrorÚlenÚ
startswithÚformatÚ_multi_type_map)ÚxÚmultir   r	   r   Úcollect   s    

r   )F)
Zpandasr   Zshapely.geometryr   r   r   Zshapely.geometry.baser   r   r   r   r   r   r   Ú<module>   s   ý