
    >ie;                       d Z ddlmZ ddlZddlmZ ddlm	Z
 ddlmZ  ed          Z ed          Z ed          Z ed          Z ed	          Z ed
          Z ed          Z ed          Z ed          Z ed          Z ed          Z ed          Z ed          Z ed          Z ed          Z ed          Z ed          Z ed          Z	 	 	 	 	 d dZd Z d!dZ!d Z"d"dZ#d#dZ$dS )$z4
Dispatch in dask.dataframe.

Also see extension.py
    )annotationsN)Dispatchmake_meta_dispatchmake_meta_objmeta_nonemptymeta_lib_from_arrayhash_object_dispatchgroup_split_dispatchget_parallel_typeCategoricalDtypeconcattolistis_categorical_dtypeunion_categoricalsgrouperpartd_encode_dispatchpyarrow_schema_dispatchfrom_pyarrow_table_dispatchto_pyarrow_table_dispatchto_pandas_dispatchouterFTc           	         t          |           dk    r| d         S t                              t          | d                             } || f|||||d|S )a  Concatenate, handling some edge cases:

    - Unions categoricals between partitions
    - Ignores empty partitions

    Parameters
    ----------
    dfs : list of DataFrame, Series, or Index
    axis : int or str, optional
    join : str, optional
    uniform : bool, optional
        Whether to treat ``dfs[0]`` as representative of ``dfs[1:]``. Set to
        True if all arguments have the same columns and dtypes (but not
        necessarily categories). Default is False.
    ignore_index : bool, optional
        Whether to allow index values to be ignored/dropped during
        concatenation. Default is False.
    ignore_order : bool, optional
        Whether to ignore the order when doing the union of categoricals.
        Default is False.
       r   )axisjoinuniformfilter_warningignore_index)lenconcat_dispatchdispatchtype)dfsr   r   r   r   r   kwargsfuncs           7lib/python3.11/site-packages/dask/dataframe/dispatch.pyr   r   #   ss    < 3xx1}}1v''SV55t
)%
 
 
 
 	
    c                    t          | d|           } t                              t          |                     } ||           S )Ndtype)getattris_categorical_dtype_dispatchr!   r"   objr%   s     r&   r   r   P   s:    
#w
$
$C(11$s))<<D499r'   c                j    t                               t          |                     } |||          S )N)
categoriesordered)categorical_dtype_dispatchr!   r"   )metar/   r0   r%   s       r&   categorical_dtyper3   V   s0    %..tDzz::D4:w7777r'   c                f    t                               t          |                     } ||           S )N)tolist_dispatchr!   r"   r,   s     r&   r   r   [   s)    ##DII..D499r'   c                   t          | t          j        t          j        j        t          j        j        t          j        j        t          j
        f          r| j        S 	 t          | |          S # t          $ rl |6t                              t!          |                    } || |          cY S t                              t"          j                  } || |          cY S w xY w)a  
    This method creates meta-data based on the type of ``x``,
    and ``parent_meta`` if supplied.

    Parameters
    ----------
    x : Object of any type.
        Object to construct meta-data from.
    index :  Index, optional
        Any index to use in the metadata. This is a pass-through
        parameter to dispatches registered.
    parent_meta : Object, default None
        If ``x`` is of arbitrary types and thus Dask cannot determine
        which back-end to be used to generate the meta-data for this
        object type, in which case ``parent_meta`` will be used to
        determine which back-end to select and dispatch to. To use
        utilize this parameter ``make_meta_obj`` has be dispatched.
        If ``parent_meta`` is ``None``, a pandas DataFrame is used for
        ``parent_meta`` thats chooses pandas as the backend.

    Returns
    -------
    A valid meta-data
    )index)
isinstancedd_FramecoreScalargroupby_GroupByaccessorAccessordaArray_metar   	TypeErrorr   r!   r"   pd	DataFrame)xr7   parent_metar%   s       r&   	make_metarI   `   s    4 	IGNJK H	
	 	 
 w
(!!51111 ( ( (" ))${*;*;<<D4'''''' !))",77D4''''''(s   A0 0A C&21C&%C&c                x    t                               t          | d                             } || ||          S )Nr   )sort_categoriesignore_order)union_categoricals_dispatchr!   r"   )to_unionrK   rL   r%   s       r&   r   r      s8    &//Xa[0A0ABBD4/UUUUr'   )r   r   FTF)NF)NN)FF)%__doc__
__future__r   pandasrE   
dask.arrayarrayrA   dask.dataframe	dataframer9   
dask.utilsr   r   r   r   r   r	   r
   r   r1   r    r5   r+   rM   grouper_dispatchr   r   r   r   r   r   r   r3   r   rI   r    r'   r&   <module>rY      s    # " " " " "                      X233 ))))h455 x 677 x 677 H011 %X&899 (8$$(8$$ ()? @ @ &h';<< 8I&&  !899 "(#<== &h'DEE $H%@AA X233 
 
	*
 *
 *
 *
Z  8 8 8 8
  
0( 0( 0( 0(fV V V V V Vr'   