
    bi                    ~    d dl mZ d dlZd dlZd dlZd dlZd dlm	Z	 ddZ
ddZd Z G d d      Zd	 Zd
 Zd Zd Zy)    )annotationsN)derived_fromc           	         fd}|_         | j                    d |_        	 t        |      |_        t        |  t        ||      |             y # t        $ r Y *w xY w)Nc                0     | j                   g|i |S N)_function_map)selfargskwargsattrs      R/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/dask/dataframe/accessor.pyfuncz_bind_method.<locals>.func   s     !t!!$8888    .version)__name____qualname__getattr__wrapped__	Exceptionsetattrr   )clspd_clsr   min_versionr   s     `  r   _bind_methodr      sm    9 DM<<.$0D"640 C@|FK@FG  s   A 	A! A!c                j   fd}|_         | j                    d |_        	 t        |      }t        |t              r|j
                  }n0t        |t        j                        r|j                  }n	|}||_	        t        | t	         t        ||      |                   y # t        $ r Y 3w xY w)Nc                &    | j                        S r   )_property_map)r	   r   s    r   r   z_bind_property.<locals>.func   s    !!$''r   r   r   )r   r   r   
isinstancepropertyfget	functoolscached_propertyr   r   r   r   r   )r   r   r   r   r   original_propmethods     `    r   _bind_propertyr'      s    ( DM<<.$0D-mX."''Fy'@'@A"''F"F%D Cx IV[ I$ OPQ  s   AB& &	B21B2c                    t        |t        j                        r[t        | t        j                        r,t        j                  || j
                  |j                        S t        j                  |      S |S )N)indexdtype)r    npndarraypdSeriesr)   r*   Index)objxs     r   maybe_wrap_pandasr2   /   sL    !RZZ c299%99Qciiqww??xx{Hr   c                      e Zd ZdZd Zd Zy)CachedAccessora  
    Custom property-like object (descriptor) for caching accessors.

    Parameters
    ----------
    name : str
        The namespace this will be accessed under, e.g. ``df.foo``
    accessor : cls
        The class with the extension methods. The class' __init__ method
        should expect one of a ``Series``, ``DataFrame`` or ``Index`` as
        the single argument ``data``
    c                     || _         || _        y r   )_name	_accessor)r	   nameaccessors      r   __init__zCachedAccessor.__init__G   s    
!r   c                    || j                   S | j                  |      }t        j                  || j                  |       |S r   )r7   object__setattr__r6   )r	   r0   r   accessor_objs       r   __get__zCachedAccessor.__get__K   s=    ;>>!~~c*
 	3

L9r   N)r   
__module__r   __doc__r:   r?    r   r   r4   r4   9   s    "
r   r4   c                      fd}|S )Nc                    t              r-t        j                  dj                  |       t        d       t        t        |              j                  j                         | S )Nzuregistration of accessor {!r} under name {!r} for type {!r} is overriding a preexisting attribute with the same name.   )
stacklevel)	hasattrwarningswarnformatUserWarningr   r4   
_accessorsadd)r9   r   r8   s    r   	decoratorz%_register_accessor.<locals>.decoratorY   s^    3MMxs3 	T>$9:4 r   rB   )r8   r   rN   s   `` r   _register_accessorrO   X   s     r   c                &    ddl m} t        | |      S )z
    Register a custom accessor on :class:`dask.dataframe.DataFrame`.

    See :func:`pandas.api.extensions.register_dataframe_accessor` for more.
    r   )	DataFrame)dask.dataframerQ   rO   )r8   rQ   s     r   register_dataframe_accessorrS   i   s     )dI..r   c                &    ddl m} t        | |      S )z
    Register a custom accessor on :class:`dask.dataframe.Series`.

    See :func:`pandas.api.extensions.register_series_accessor` for more.
    r   )r.   )rR   r.   rO   )r8   r.   s     r   register_series_accessorrU   t   s     &dF++r   c                &    ddl m} t        | |      S )z
    Register a custom accessor on :class:`dask.dataframe.Index`.

    See :func:`pandas.api.extensions.register_index_accessor` for more.
    r   )r/   )rR   r/   rO   )r8   r/   s     r   register_index_accessorrW      s     %dE**r   r   )
__future__r   r#   rH   numpyr+   pandasr-   
dask.utilsr   r   r'   r2   r4   rO   rS   rU   rW   rB   r   r   <module>r\      sF    "     #
HR, >"/,+r   