§
    Ï! h<'  ã                  ó^  — d Z ddlmZ ddlmZmZ ddlZddlmZ ddl	m
Z
  G d„ d¦  «        Z G d	„ d
¦  «        Zdd„ dfd%d„Z G d„ d¦  «        Z edd¬¦  «        d&d„¦   «         Z eed¬¦  «        d&d „¦   «         Z eed!¬¦  «        d&d"„¦   «         Z eed#¬¦  «        d&d$„¦   «         ZdS )'z†

accessor.py contains base classes for implementing accessor properties
that can be mixed into or pinned onto other pandas classes.

é    )Úannotations)ÚCallableÚfinalN)Údoc)Úfind_stack_levelc                  ó~   ‡ — e Zd ZU  e¦   «         Zded<    e¦   «         Zded<   ed
d„¦   «         Z	d
d„Z
dˆ fd	„Zˆ xZS )ÚDirNamesMixinúset[str]Ú
_accessorszfrozenset[str]Ú_hidden_attrsÚreturnc                ó    — | j         | j        z  S )z:
        Delete unwanted __dir__ for this object.
        )r   r   ©Úselfs    úNc:\xampp_lite_8_4\www\timesheet\venv\Lib\site-packages\pandas/core/accessor.pyÚ_dir_deletionszDirNamesMixin._dir_deletions   s   € ð
 Œ Ô!3Ñ3Ð3ó    c                ó*   ‡ — ˆ fd„‰ j         D ¦   «         S )z9
        Add additional __dir__ for this object.
        c                ó4   •— h | ]}t          ‰|¦  «        ¯|’ŒS © )Úhasattr)Ú.0Úaccessorr   s     €r   ú	<setcomp>z/DirNamesMixin._dir_additions.<locals>.<setcomp>"   s(   ø€ ÐTÐTÐT˜X½GÀDÈ(Ñ<SÔ<SÐT�ÐTÐTÐTr   )r   r   s   `r   Ú_dir_additionszDirNamesMixin._dir_additions   s"   ø€ ð UÐTÐTÐT¨¬ÐTÑTÔTÐTr   ú	list[str]c                óÔ   •— t          t          ¦   «                              ¦   «         ¦  «        }||                      ¦   «         z
  |                      ¦   «         z  }t          |¦  «        S )z€
        Provide method name lookup and completion.

        Notes
        -----
        Only provide 'public' methods.
        )ÚsetÚsuperÚ__dir__r   r   Úsorted)r   ÚrvÚ	__class__s     €r   r    zDirNamesMixin.__dir__$   sS   ø€ õ •‘”—’Ñ"Ô"Ñ#Ô#ˆØ�4×&Ò&Ñ(Ô(Ñ(¨D×,?Ò,?Ñ,AÔ,AÑAˆÝ�b‰zŒzÐr   )r   r
   )r   r   )Ú__name__Ú
__module__Ú__qualname__r   r   Ú__annotations__Ú	frozensetr   r   r   r   r    Ú__classcell__)r#   s   @r   r	   r	      s£   ø€ € € € € € Ø˜3™5œ5€JÐ Ð Ð Ñ Ø$- I¡K¤K€MÐ/Ð/Ð/Ñ/à
ð4ð 4ð 4ñ „Uð4ðUð Uð Uð Uð
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
r   r	   c                  óL   — e Zd ZdZdd„Zdd„Zdd„Zedd„ d	fdd„¦   «         ZdS )ÚPandasDelegatez@
    Abstract base class for delegating methods/properties.
    ÚnameÚstrc                ó&   — t          d|› �¦  «        ‚)NzYou cannot access the property ©Ú	TypeError©r   r,   ÚargsÚkwargss       r   Ú_delegate_property_getz%PandasDelegate._delegate_property_get6   s   € ÝÐ@¸$Ð@Ð@ÑAÔAÐAr   c                ó(   — t          d|› d�¦  «        ‚)NzThe property z cannot be setr/   )r   r,   Úvaluer2   r3   s        r   Ú_delegate_property_setz%PandasDelegate._delegate_property_set9   s   € ÝÐ<¨Ð<Ð<Ð<Ñ=Ô=Ð=r   c                ó&   — t          d|› �¦  «        ‚)NzYou cannot call method r/   r1   s       r   Ú_delegate_methodzPandasDelegate._delegate_method<   s   € ÝÐ8°$Ð8Ð8Ñ9Ô9Ð9r   Fc                ó   — | S ©Nr   ©Úxs    r   ú<lambda>zPandasDelegate.<lambda>F   s   € ¸1€ r   TÚ	accessorsr   ÚtypÚ	overwriteÚboolÚaccessor_mappingúCallable[[str], str]Úraise_on_missingr   ÚNonec                óê   ‡‡— dˆˆfd„}dˆˆfd„}|D ]_}	|st          ‰ ‰|	¦  «        d¦  «        €Œ|dk    r ||	¦  «        }
n ||	¦  «        }
|st          | |	¦  «        st          | |	|
¦  «         Œ`dS )aí  
        Add accessors to cls from the delegate class.

        Parameters
        ----------
        cls
            Class to add the methods/properties to.
        delegate
            Class to get methods/properties and doc-strings.
        accessors : list of str
            List of accessors to add.
        typ : {'property', 'method'}
        overwrite : bool, default False
            Overwrite the method/property in the target class if it exists.
        accessor_mapping: Callable, default lambda x: x
            Callable to map the delegate's function to the cls' function.
        raise_on_missing: bool, default True
            Raise if an accessor does not exist on delegate.
            False skips the missing accessor.
        r,   r-   c           
     ó’   •‡ — ˆ fd„}ˆ fd„}‰ |_         ‰ |_         t          ||t          ‰ ‰‰ ¦  «        ¦  «        j        ¬¦  «        S )Nc                ó.   •— |                       ‰¦  «        S r;   )r4   )r   r,   s    €r   Ú_getterz[PandasDelegate._add_delegate_accessors.<locals>._create_delegator_property.<locals>._getter_   s   ø€ Ø×2Ò2°4Ñ8Ô8Ð8r   c                ó0   •— |                       ‰|¦  «        S r;   )r7   )r   Ú
new_valuesr,   s     €r   Ú_setterz[PandasDelegate._add_delegate_accessors.<locals>._create_delegator_property.<locals>._setterb   s   ø€ Ø×2Ò2°4¸ÑDÔDÐDr   )ÚfgetÚfsetr   )r$   ÚpropertyÚgetattrÚ__doc__)r,   rJ   rM   rC   Údelegates   `  €€r   Ú_create_delegator_propertyzJPandasDelegate._add_delegate_accessors.<locals>._create_delegator_property^   s†   øø€ ð9ð 9ð 9ð 9ð 9ðEð Eð Eð Eð Eð  $ˆGÔØ#ˆGÔåØØÝ˜HÐ&6Ð&6°tÑ&<Ô&<Ñ=Ô=ÔEðñ ô ð r   c                óh   •‡ — ˆ fd„}‰ |_         t          ‰ ‰‰ ¦  «        ¦  «        j        |_        |S )Nc                ó&   •—  | j         ‰g|¢R i |¤ŽS r;   )r9   )r   r2   r3   r,   s      €r   ÚfzSPandasDelegate._add_delegate_accessors.<locals>._create_delegator_method.<locals>.fo   s&   ø€ Ø,�tÔ,¨TÐC°DÐCÐCÐC¸FÐCÐCÐCr   )r$   rQ   rR   )r,   rW   rC   rS   s   ` €€r   Ú_create_delegator_methodzHPandasDelegate._add_delegate_accessors.<locals>._create_delegator_methodn   sP   øø€ ðDð Dð Dð Dð Dð ˆAŒJÝ Ð*:Ð*:¸4Ñ*@Ô*@ÑAÔAÔIˆAŒIàˆHr   NrP   ©r,   r-   )rQ   r   Úsetattr)ÚclsrS   r?   r@   rA   rC   rE   rT   rX   r,   rW   s    `   `     r   Ú_add_delegate_accessorsz&PandasDelegate._add_delegate_accessors?   sé   øø€ ð>	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð ð 	&ð 	&ˆDà$ðå˜HÐ&6Ð&6°tÑ&<Ô&<¸dÑCÔCÐKàà�jÒ Ð Ø.Ð.¨tÑ4Ô4��à,Ð,¨TÑ2Ô2�ð ð &¥¨¨TÑ 2Ô 2ð &Ý˜˜T 1Ñ%Ô%Ð%øð	&ð 	&r   NrY   )r?   r   r@   r-   rA   rB   rC   rD   rE   rB   r   rF   )	r$   r%   r&   rR   r4   r7   r9   Úclassmethodr\   r   r   r   r+   r+   1   s—   € € € € € ðð ðBð Bð Bð Bð>ð >ð >ð >ð:ð :ð :ð :ð ð  Ø1<°Ø!%ðE&ð E&ð E&ð E&ñ „[ðE&ð E&ð E&r   r+   Fc                ó   — | S r;   r   r<   s    r   r>   r>   �   s   € °q€ r   Tr?   r   r@   r-   rA   rB   rC   rD   rE   c                ó&   ‡ ‡‡‡‡‡— ˆˆˆ ˆˆˆfd„}|S )a×  
    Add delegated names to a class using a class decorator.  This provides
    an alternative usage to directly calling `_add_delegate_accessors`
    below a class definition.

    Parameters
    ----------
    delegate : object
        The class to get methods/properties & doc-strings.
    accessors : Sequence[str]
        List of accessor to add.
    typ : {'property', 'method'}
    overwrite : bool, default False
       Overwrite the method/property in the target class if it exists.
    accessor_mapping: Callable, default lambda x: x
        Callable to map the delegate's function to the cls' function.
    raise_on_missing: bool, default True
        Raise if an accessor does not exist on delegate.
        False skips the missing accessor.

    Returns
    -------
    callable
        A class decorator.

    Examples
    --------
    @delegate_names(Categorical, ["categories", "ordered"], "property")
    class CategoricalAccessor(PandasDelegate):
        [...]
    c                ó>   •— |                       ‰‰‰‰‰‰¬¦  «         | S )N)rA   rC   rE   )r\   )r[   rC   r?   rS   rA   rE   r@   s    €€€€€€r   Úadd_delegate_accessorsz.delegate_names.<locals>.add_delegate_accessors°   s9   ø€ Ø×#Ò#ØØØØØ-Ø-ð 	$ñ 	
ô 	
ð 	
ð ˆ
r   r   )rS   r?   r@   rA   rC   rE   ra   s   `````` r   Údelegate_namesrb   ˆ   sC   øøøøøø€ ðP	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð "Ð!r   c                  ó    — e Zd ZdZd	d„Zd„ ZdS )
ÚCachedAccessora¡  
    Custom property-like object.

    A descriptor for caching accessors.

    Parameters
    ----------
    name : str
        Namespace that will be accessed under, e.g. ``df.foo``.
    accessor : cls
        Class with the extension methods.

    Notes
    -----
    For accessor, The class's __init__ method assumes that one of
    ``Series``, ``DataFrame`` or ``Index`` as the
    single argument ``data``.
    r,   r-   r   rF   c                ó"   — || _         || _        d S r;   )Ú_nameÚ	_accessor)r   r,   r   s      r   Ú__init__zCachedAccessor.__init__Ø   s   € ØˆŒ
Ø!ˆŒˆˆr   c                ó„   — |€| j         S |                       |¦  «        }t                               || j        |¦  «         |S r;   )rg   ÚobjectÚ__setattr__rf   )r   Úobjr[   Úaccessor_objs       r   Ú__get__zCachedAccessor.__get__Ü   sB   € Øˆ;à”>Ð!Ø—~’~ cÑ*Ô*ˆõ
 	×Ò˜3 ¤
¨LÑ9Ô9Ð9ØÐr   N)r,   r-   r   rF   )r$   r%   r&   rR   rh   rn   r   r   r   rd   rd   Ä   sA   € € € € € ðð ð&"ð "ð "ð "ð
ð 
ð 
ð 
ð 
r   rd   Ú )ÚklassÚothersr,   c                ó   ‡ ‡— ˆˆ fd„}|S )aG  
    Register a custom accessor on {klass} objects.

    Parameters
    ----------
    name : str
        Name under which the accessor should be registered. A warning is issued
        if this name conflicts with a preexisting attribute.

    Returns
    -------
    callable
        A class decorator.

    See Also
    --------
    register_dataframe_accessor : Register a custom accessor on DataFrame objects.
    register_series_accessor : Register a custom accessor on Series objects.
    register_index_accessor : Register a custom accessor on Index objects.

    Notes
    -----
    When accessed, your accessor will be initialized with the pandas object
    the user is interacting with. So the signature must be

    .. code-block:: python

        def __init__(self, pandas_object):  # noqa: E999
            ...

    For consistency with pandas methods, you should raise an ``AttributeError``
    if the data passed to your accessor has an incorrect dtype.

    >>> pd.Series(['a', 'b']).dt
    Traceback (most recent call last):
    ...
    AttributeError: Can only use .dt accessor with datetimelike values

    Examples
    --------
    In your library code::

        import pandas as pd

        @pd.api.extensions.register_dataframe_accessor("geo")
        class GeoAccessor:
            def __init__(self, pandas_obj):
                self._obj = pandas_obj

            @property
            def center(self):
                # return the geographic center point of this DataFrame
                lat = self._obj.latitude
                lon = self._obj.longitude
                return (float(lon.mean()), float(lat.mean()))

            def plot(self):
                # plot this array's data on a map, e.g., using Cartopy
                pass

    Back in an interactive IPython session:

        .. code-block:: ipython

            In [1]: ds = pd.DataFrame({{"longitude": np.linspace(0, 10),
               ...:                    "latitude": np.linspace(0, 20)}})
            In [2]: ds.geo.center
            Out[2]: (5.0, 10.0)
            In [3]: ds.geo.plot()  # plots data on a map
    c           
     óL  •— t          ‰‰¦  «        rYt          j        dt          | ¦  «        › dt          ‰¦  «        › dt          ‰¦  «        › d�t          t          ¦   «         ¬¦  «         t          ‰‰t          ‰| ¦  «        ¦  «         ‰j         	                    ‰¦  «         | S )Nzregistration of accessor z under name z
 for type z: is overriding a preexisting attribute with the same name.)Ú
stacklevel)
r   ÚwarningsÚwarnÚreprÚUserWarningr   rZ   rd   r   Úadd)r   r[   r,   s    €€r   Ú	decoratorz%_register_accessor.<locals>.decorator2  s·   ø€ Ý�3˜ÑÔð 	ÝŒMð1­D°©N¬Nð 1ð 1Ý˜‘:”:ð1ð 1Ý)-¨c©¬ð1ð 1ð 1õ Ý+Ñ-Ô-ðñ ô ð õ 	��T�>¨$°Ñ9Ô9Ñ:Ô:Ð:ØŒ×Ò˜4Ñ Ô Ð Øˆr   r   )r,   r[   rz   s   `` r   Ú_register_accessorr{   é   s+   øø€ ðRð ð ð ð ð ð Ðr   Ú	DataFrame)rp   c                ó.   — ddl m} t          | |¦  «        S )Nr   )r|   )Úpandasr|   r{   )r,   r|   s     r   Úregister_dataframe_accessorr   B  s$   € à Ð Ð Ð Ð Ð å˜d IÑ.Ô.Ð.r   ÚSeriesc                ó.   — ddl m} t          | |¦  «        S )Nr   )r€   )r~   r€   r{   )r,   r€   s     r   Úregister_series_accessorr‚   I  s$   € àÐÐÐÐÐå˜d FÑ+Ô+Ð+r   ÚIndexc                ó.   — ddl m} t          | |¦  «        S )Nr   )rƒ   )r~   rƒ   r{   )r,   rƒ   s     r   Úregister_index_accessorr…   P  s$   € àÐÐÐÐÐå˜d EÑ*Ô*Ð*r   )
r?   r   r@   r-   rA   rB   rC   rD   rE   rB   rY   )rR   Ú
__future__r   Útypingr   r   ru   Úpandas.util._decoratorsr   Úpandas.util._exceptionsr   r	   r+   rb   rd   r{   r   r‚   r…   r   r   r   ú<module>rŠ      sõ  ððð ð #Ð "Ð "Ð "Ð "Ð "ðð ð ð ð ð ð ð ð €€€à 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4ðð ð ð ð ñ ô ð ð<T&ð T&ð T&ð T&ð T&ñ T&ô T&ð T&ðv Ø-8¨[Ø!ð3"ð 3"ð 3"ð 3"ð 3"ðx"ð "ð "ð "ð "ñ "ô "ð "ðJ €ˆ2�bÐÑÔðUð Uð Uñ ÔðUðp €Ð˜{Ð+Ñ+Ô+ð/ð /ð /ñ ,Ô+ð/ð €Ð˜xÐ(Ñ(Ô(ð,ð ,ð ,ñ )Ô(ð,ð €Ð˜wÐ'Ñ'Ô'ð+ð +ð +ñ (Ô'ð+ð +ð +r   