o
    Û­jnc  ã                   @  sŠ  U d Z ddlmZ ddlmZmZ ddlZddlmZm	Z	m
Z
mZmZmZ ddlZddlmZmZ ddlmZ erAddlmZmZ G d	d
„ d
eƒZG dd„ deƒZi Zded< i Zded< i Zded< dgZded< G dd„ deeƒZ dudd„Z!dvdwd!d"„Z"dxd$d%„Z#dydzd*d+„Z$dvd{d,d-„Z%d|d.d/„Z&G d0d1„ d1ƒZ'G d2d3„ d3ee ƒZ(d4Z)d5Z*d6Z+d7Z,e(e"e)ƒa-e(e#e*ƒa.e(e%e,ƒZ/e(e$e+ƒZ0e'eƒZ1G d8d9„ d9eƒZ2	&		d}d~dBdC„a3			dd€dGdH„Z4d�dIdJ„Z5d‚dLdM„Z6dƒdNdO„Z7d„dPdQ„Z8d„dRdS„Z9d…dTdU„Z:dƒdVdW„Z;d†dYdZ„Z<d‡dˆdadb„Z=ed‰dedf„ƒZ>dŠdjdk„Z?d‹dldm„Z@d‹dndo„ZAdŒdqdr„ZBe?eCƒZDe?eEƒZFe?eGƒZHe?eIƒZJe@eIeKfƒZLd�dsdt„ZMdS )Žaò  
The config module holds package-wide configurables and provides
a uniform API for working with them.

Overview
========

This module supports the following requirements:
- options are referenced using keys in dot.notation, e.g. "x.y.option - z".
- keys are case-insensitive.
- functions should accept partial/regex keys, when unambiguous.
- options can be registered by modules at import time.
- options can be registered at init-time (via core.config_init)
- options have a default value, and (optionally) a description and
  validation function associated with them.
- options can be deprecated, in which case referencing them
  should produce a warning.
- deprecated options can optionally be rerouted to a replacement
  so that accessing a deprecated option reroutes to a differently
  named option.
- options can be reset to their default value.
- all option can be reset to their default value at once.
- all options in a certain sub - namespace can be reset at once.
- the user can set / get / reset or ask for the description of an option.
- a developer can register and mark an option as deprecated.
- you can register a callback to be invoked when the option value
  is set or reset. Changing the stored value is considered misuse, but
  is not verboten.

Implementation
==============

- Data is stored using nested dictionaries, and should be accessed
  through the provided API.

- "Registered options" and "Deprecated options" have metadata associated
  with them, which are stored in auxiliary dictionaries keyed on the
  fully-qualified key, e.g. "x.y.z.option".

- the config_init module is imported by the package's __init__.py file.
  placing any register_option() calls there will ensure those options
  are available as soon as pandas is loaded. If you use register_option
  in a module, it will only be available after that module is imported,
  which you should be aware of.

- `config_prefix` is a context_manager (for use with the `with` keyword)
  which can save developers some typing, see the docstring.

é    )Úannotations)ÚContextDecoratorÚcontextmanagerN)ÚTYPE_CHECKINGÚAnyÚCallableÚGenericÚ
NamedTupleÚcast)ÚFÚT)Úfind_stack_level)Ú	GeneratorÚIterablec                   @  s.   e Zd ZU ded< ded< ded< ded< dS )ÚDeprecatedOptionÚstrÚkeyú
str | NoneÚmsgÚrkeyÚremoval_verN©Ú__name__Ú
__module__Ú__qualname__Ú__annotations__© r   r   úR/var/www/html/CropPilot/venv/lib/python3.10/site-packages/pandas/_config/config.pyr   Q   s
   
 r   c                   @  s6   e Zd ZU ded< ded< ded< ded< ded	< d
S )ÚRegisteredOptionr   r   ÚobjectÚdefvalÚdocúCallable[[object], Any] | NoneÚ	validatorúCallable[[str], Any] | NoneÚcbNr   r   r   r   r   r   X   s   
 r   zdict[str, DeprecatedOption]Ú_deprecated_optionszdict[str, RegisteredOption]Ú_registered_optionsúdict[str, Any]Ú_global_configÚallú	list[str]Ú_reserved_keysc                   @  s   e Zd ZdZdS )ÚOptionErrorzÛ
    Exception raised for pandas.options.

    Backwards compatible with KeyError checks.

    Examples
    --------
    >>> pd.options.context
    Traceback (most recent call last):
    OptionError: No such option
    N)r   r   r   Ú__doc__r   r   r   r   r-   m   s    r-   Úpatr   ÚsilentÚboolÚreturnc                 C  sf   t | ƒ}t|ƒdkr|st| ƒ tdt| ƒ› �ƒ‚t|ƒdkr#tdƒ‚|d }|s-t|ƒ t|ƒ}|S )Nr   zNo such keys(s): é   zPattern matched multiple keys)Ú_select_optionsÚlenÚ_warn_if_deprecatedr-   ÚreprÚ_translate_key)r/   r0   Úkeysr   r   r   r   Ú_get_single_key   s   r:   Fr   c                 C  s   t | |ƒ}t|ƒ\}}|| S ©N)r:   Ú	_get_root)r/   r0   r   ÚrootÚkr   r   r   Ú_get_option‘   s   
r?   ÚNonec               	   O  s  t | ƒ}|r|d dkrtdƒ‚| dd¡}|r(tt| ¡ ƒƒ}td|› d�ƒ‚t| d d d… | dd d… ƒD ]G\}}t||ƒ}t	|ƒ}|rN|j
rN| 
|¡ t|ƒ\}	}
||	|
< |jr~|rytjd	d
�� | |¡ W d   ƒ n1 ssw   Y  q7| |¡ q7d S )Né   r   z4Must provide an even number of non-keyword argumentsr0   Fz2_set_option() got an unexpected keyword argument "ú"r3   T)Úrecord)r5   Ú
ValueErrorÚpopÚnextÚiterr9   Ú	TypeErrorÚzipr:   Ú_get_registered_optionr#   r<   r%   ÚwarningsÚcatch_warnings)ÚargsÚkwargsÚnargsr0   Úkwargr>   Úvr   Úor=   Úk_rootr   r   r   Ú_set_option™   s.   &


ÿ€
€ðrT   Ú TÚ_print_descr   c                 C  sD   t | ƒ}t|ƒdkrtdƒ‚d dd„ |D ƒ¡}|r t|ƒ d S |S )Nr   úNo such keys(s)Ú
c                 S  ó   g | ]}t |ƒ‘qS r   )Ú_build_option_description©Ú.0r>   r   r   r   Ú
<listcomp>¾   ó    z$_describe_option.<locals>.<listcomp>)r4   r5   r-   ÚjoinÚprint)r/   rV   r9   Úsr   r   r   Ú_describe_option¹   s   rb   c                 C  sf   t | ƒ}t|ƒdkrtdƒ‚t|ƒdkr"t| ƒdk r"| dkr"tdƒ‚|D ]}t|t| j|d� q$d S )Nr   rW   r3   é   r*   z’You must specify at least 4 characters when resetting multiple keys, use the special keyword "all" to reset all the options to their default value©r0   )r4   r5   r-   rD   rT   r'   r    )r/   r0   r9   r>   r   r   r   Ú_reset_optionÆ   s    ÿÿre   c                 C  s   t | dd�}t|ƒjS ©NTrd   )r:   rJ   r    )r/   r   r   r   r   Úget_default_val×   s   
rg   c                   @  sD   e Zd ZU dZded< ddd	d
„Zddd„Zddd„Zddd„ZdS )ÚDictWrapperz/provide attribute-style access to a nested dictr(   ÚdrU   Úprefixr   r2   r@   c                 C  s    t  | d|¡ t  | d|¡ d S )Nri   rj   )r   Ú__setattr__)Úselfri   rj   r   r   r   Ú__init__á   s   zDictWrapper.__init__r   Úvalr   c                 C  sP   t  | d¡}|r|d7 }||7 }|| jv r$t| j| tƒs$t||ƒ d S tdƒ‚)Nrj   Ú.z.You can only set the value of existing options)r   Ú__getattribute__ri   Ú
isinstanceÚdictrT   r-   )rl   r   rn   rj   r   r   r   rk   å   s   zDictWrapper.__setattr__c              
   C  st   t  | d¡}|r|d7 }||7 }z
t  | d¡| }W n ty+ } ztdƒ|‚d }~ww t|tƒr6t||ƒS t|ƒS )Nrj   ro   ri   zNo such option)r   rp   ÚKeyErrorr-   rq   rr   rh   r?   )rl   r   rj   rQ   Úerrr   r   r   Ú__getattr__ñ   s   
€ÿ

zDictWrapper.__getattr__r+   c                 C  s   t | j ¡ ƒS r;   )Úlistri   r9   )rl   r   r   r   Ú__dir__ÿ   s   zDictWrapper.__dir__N)rU   )ri   r(   rj   r   r2   r@   )r   r   rn   r   r2   r@   ©r   r   )r2   r+   )	r   r   r   r.   r   rm   rk   ru   rw   r   r   r   r   rh   Ü   s   
 

rh   c                   @  s.   e Zd Zddd„Zdd
d„Zeddd„ƒZdS )ÚCallableDynamicDocÚfuncúCallable[..., T]Údoc_tmplr   r2   r@   c                 C  s   || _ || _d S r;   )Ú__doc_tmpl__Ú__func__)rl   rz   r|   r   r   r   rm     s   
zCallableDynamicDoc.__init__r   c                 O  s   | j |i |¤ŽS r;   )r~   )rl   rM   Úkwdsr   r   r   Ú__call__  s   zCallableDynamicDoc.__call__c                 C  s,   t ddd�}ttt ¡ ƒƒ}| jj||d�S )Nr*   F)rV   )Ú	opts_descÚ	opts_list)rb   Úpp_options_listrv   r'   r9   r}   Úformat)rl   r�   r‚   r   r   r   r.     s   zCallableDynamicDoc.__doc__N)rz   r{   r|   r   r2   r@   )r2   r   )r2   r   )r   r   r   rm   r€   Úpropertyr.   r   r   r   r   ry     s
    

ry   aÓ  
get_option(pat)

Retrieves the value of the specified option.

Available options:

{opts_list}

Parameters
----------
pat : str
    Regexp which should match a single option.
    Note: partial matches are supported for convenience, but unless you use the
    full option name (e.g. x.y.z.option_name), your code may break in future
    versions if new options with similar names are introduced.

Returns
-------
result : the value of the option

Raises
------
OptionError : if no such option exists

Notes
-----
Please reference the :ref:`User Guide <options>` for more information.

The available options with its descriptions:

{opts_desc}

Examples
--------
>>> pd.get_option('display.max_columns')  # doctest: +SKIP
4
aŒ  
set_option(pat, value)

Sets the value of the specified option.

Available options:

{opts_list}

Parameters
----------
pat : str
    Regexp which should match a single option.
    Note: partial matches are supported for convenience, but unless you use the
    full option name (e.g. x.y.z.option_name), your code may break in future
    versions if new options with similar names are introduced.
value : object
    New value of option.

Returns
-------
None

Raises
------
OptionError if no such option exists

Notes
-----
Please reference the :ref:`User Guide <options>` for more information.

The available options with its descriptions:

{opts_desc}

Examples
--------
>>> pd.set_option('display.max_columns', 4)
>>> df = pd.DataFrame([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]])
>>> df
   0  1  ...  3   4
0  1  2  ...  4   5
1  6  7  ...  9  10
[2 rows x 5 columns]
>>> pd.reset_option('display.max_columns')
a�  
describe_option(pat, _print_desc=False)

Prints the description for one or more registered options.

Call with no arguments to get a listing for all registered options.

Available options:

{opts_list}

Parameters
----------
pat : str
    Regexp pattern. All matching keys will have their description displayed.
_print_desc : bool, default True
    If True (default) the description(s) will be printed to stdout.
    Otherwise, the description(s) will be returned as a unicode string
    (for testing).

Returns
-------
None by default, the description(s) as a unicode string if _print_desc
is False

Notes
-----
Please reference the :ref:`User Guide <options>` for more information.

The available options with its descriptions:

{opts_desc}

Examples
--------
>>> pd.describe_option('display.max_columns')  # doctest: +SKIP
display.max_columns : int
    If max_cols is exceeded, switch to truncate view...
aÍ  
reset_option(pat)

Reset one or more options to their default value.

Pass "all" as argument to reset all options.

Available options:

{opts_list}

Parameters
----------
pat : str/regex
    If specified only options matching `prefix*` will be reset.
    Note: partial matches are supported for convenience, but unless you
    use the full option name (e.g. x.y.z.option_name), your code may break
    in future versions if new options with similar names are introduced.

Returns
-------
None

Notes
-----
Please reference the :ref:`User Guide <options>` for more information.

The available options with its descriptions:

{opts_desc}

Examples
--------
>>> pd.reset_option('display.max_columns')  # doctest: +SKIP
c                   @  s.   e Zd ZdZddd„Zddd„Zddd	„Zd
S )Úoption_contextaF  
    Context manager to temporarily set options in the `with` statement context.

    You need to invoke as ``option_context(pat, val, [(pat, val), ...])``.

    Examples
    --------
    >>> from pandas import option_context
    >>> with option_context('display.max_rows', 10, 'display.max_columns', 5):
    ...     pass
    r2   r@   c                 G  sL   t |ƒd dkst |ƒdk rtdƒ‚tt|d d d… |dd d… ƒƒ| _d S )NrA   r   z>Need to invoke as option_context(pat, val, [(pat, val), ...]).r3   )r5   rD   rv   rI   Úops)rl   rM   r   r   r   rm   ×  s
   ÿ(zoption_context.__init__c                 C  s4   dd„ | j D ƒ| _| j D ]\}}t||dd� qd S )Nc                 S  s   g | ]
\}}|t |ƒf‘qS r   )r?   )r\   r/   rn   r   r   r   r]   à  s    z,option_context.__enter__.<locals>.<listcomp>Trd   )r‡   ÚundorT   )rl   r/   rn   r   r   r   Ú	__enter__ß  s   ÿzoption_context.__enter__c                 G  s,   | j r| j D ]\}}t||dd� qd S d S rf   )rˆ   rT   )rl   rM   r/   rn   r   r   r   Ú__exit__å  s
   þzoption_context.__exit__N©r2   r@   )r   r   r   r.   rm   r‰   rŠ   r   r   r   r   r†   Ê  s
    

r†   r   r    r   r!   r#   r"   r%   r$   c                 C  sT  ddl }ddl}|  ¡ } | tv rtd| › d�ƒ‚| tv r$td| › d�ƒ‚|r*||ƒ |  d¡}|D ] }t d|j	 d |¡sEt
|› d	�ƒ‚| |¡rQt
|› d
�ƒ‚q1t}	d}
t|dd… ƒD ]$\}}t|	tƒsvt|
jd |d|… ¡d�ƒ‚||	vr~i |	|< |	| }	q^t|	tƒs—t|
jd |dd… ¡d�ƒ‚||	|d < t| ||||d�t| < dS )aÎ  
    Register an option in the package-wide pandas config object

    Parameters
    ----------
    key : str
        Fully-qualified key, e.g. "x.y.option - z".
    defval : object
        Default value of the option.
    doc : str
        Description of the option.
    validator : Callable, optional
        Function of a single argument, should raise `ValueError` if
        called with a value which is not a legal value for the option.
    cb
        a function of a single argument "key", which is called
        immediately after an option value is set/reset. key is
        the full name of the option.

    Raises
    ------
    ValueError if `validator` is specified and `defval` is not a valid value.

    r   NúOption 'z' has already been registeredz' is a reserved keyro   ú^ú$z is not a valid identifierz is a python keywordz5Path prefix to option '{option}' is already an optionéÿÿÿÿ)Úoption)r   r    r!   r#   r%   )ÚkeywordÚtokenizeÚlowerr'   r-   r,   ÚsplitÚreÚmatchÚNamerD   Ú	iskeywordr)   Ú	enumeraterq   rr   r„   r_   r   )r   r    r!   r#   r%   r‘   r’   Úpathr>   Úcursorr   ÚiÚpr   r   r   Úregister_optionë  s<   

ÿ



ÿrž   r   r   r   c                 C  s6   |   ¡ } | tv rtd| › d�ƒ‚t| |||ƒt| < dS )a  
    Mark option `key` as deprecated, if code attempts to access this option,
    a warning will be produced, using `msg` if given, or a default message
    if not.
    if `rkey` is given, any access to the key will be re-routed to `rkey`.

    Neither the existence of `key` nor that if `rkey` is checked. If they
    do not exist, any subsequence access will fail as usual, after the
    deprecation warning is given.

    Parameters
    ----------
    key : str
        Name of the option to be deprecated.
        must be a fully-qualified option name (e.g "x.y.z.rkey").
    msg : str, optional
        Warning message to output when the key is referenced.
        if no message is given a default message will be emitted.
    rkey : str, optional
        Name of an option to reroute access to.
        If specified, any referenced `key` will be
        re-routed to `rkey` including set/get/reset.
        rkey must be a fully-qualified option name (e.g "x.y.z.rkey").
        used by the default message if no `msg` is specified.
    removal_ver : str, optional
        Specifies the version in which this option will
        be removed. used by the default message if no `msg` is specified.

    Raises
    ------
    OptionError
        If the specified key has already been deprecated.
    rŒ   z)' has already been defined as deprecated.N)r“   r&   r-   r   )r   r   r   r   r   r   r   Údeprecate_option6  s   'rŸ   c                   s8   ˆ t v rˆ gS tt  ¡ ƒ}ˆ dkr|S ‡ fdd„|D ƒS )zb
    returns a list of keys matching `pat`

    if pat=="all", returns all registered options
    r*   c                   s    g | ]}t  ˆ |t j¡r|‘qS r   )r•   ÚsearchÚIr[   ©r/   r   r   r]   x  ó     z#_select_options.<locals>.<listcomp>)r'   Úsortedr9   )r/   r9   r   r¢   r   r4   i  s   r4   útuple[dict[str, Any], str]c                 C  s4   |   d¡}t}|d d… D ]}|| }q||d fS )Nro   r�   )r”   r)   )r   rš   r›   r�   r   r   r   r<   {  s
   

r<   c                 C  s   |   ¡ } | tv S )z4Returns True if the given option has been deprecated)r“   r&   ©r   r   r   r   Ú_is_deprecatedƒ  s   r§   c                 C  s$   zt |  }W |S  ty   Y dS w )z±
    Retrieves the metadata for a deprecated option, if `key` is deprecated.

    Returns
    -------
    DeprecatedOption (namedtuple) if key is deprecated, None otherwise
    N)r&   rs   ©r   ri   r   r   r   Ú_get_deprecated_option‰  s   
ýÿr©   c                 C  s
   t  | ¡S )z¨
    Retrieves the option metadata if `key` is a registered option.

    Returns
    -------
    RegisteredOption (namedtuple) if key is deprecated, None otherwise
    )r'   Úgetr¦   r   r   r   rJ   ™  s   
rJ   c                 C  s   t | ƒ}|r|jp
| S | S )z‚
    if key id deprecated and a replacement key defined, will return the
    replacement key, otherwise returns `key` as - is
    )r©   r   r¨   r   r   r   r8   ¤  s   
r8   c                 C  sˆ   t | ƒ}|rB|jrtj|jttƒ d� dS d| › d�}|jr&|d|j› �7 }|jr3|d|j› d�7 }n|d7 }tj|ttƒ d� dS d	S )
zŸ
    Checks if `key` is a deprecated option and if so, prints a warning.

    Returns
    -------
    bool - True if `key` is deprecated, False otherwise.
    )Ú
stacklevelú'z' is deprecatedz and will be removed in z, please use 'z
' instead.z, please refrain from using it.TF)r©   r   rK   ÚwarnÚFutureWarningr   r   r   )r   ri   r   r   r   r   r6   °  s$   ý÷r6   r>   c                 C  s˜   t | ƒ}t| ƒ}| › d�}|jr|d |j ¡  d¡¡7 }n|d7 }|r3|d|j› dt| dƒ› d�7 }|rJ|jp9d}|d	7 }|d
|› d�7 }|d7 }|S )zCBuilds a formatted description of a registered option and prints itú rX   zNo description available.z
    [default: z] [currently: Tú]rU   z
    (Deprecatedz, use `z
` instead.ú))	rJ   r©   r!   r_   Ústripr”   r    r?   r   )r>   rR   ri   ra   r   r   r   r   rZ   Î  s   

rZ   éP   r9   úIterable[str]ÚwidthÚintÚ_printc           
        s¼   ddl m} ddlm‰ d‡‡fd
d„}g }dd„ t| ƒD ƒ}|r(||d|ƒ7 }dd„ | D ƒ} |t| ƒdd„ ƒD ]\‰ }‡ fdd„t|ƒD ƒ}||ˆ |ƒ7 }q8d |¡}	|r\t|	ƒ dS |	S )z@Builds a concise listing of available options, grouped by prefixr   )Úgroupby)ÚwrapÚnamer   Úksr´   r2   r+   c                   sP   | rd|  d nd}ˆd  |¡ˆ |ddd�}|r&|d r&| r&|d d	 |d< |S )
Nz- z.[rU   z, z  F)Úinitial_indentÚsubsequent_indentÚbreak_long_wordsr�   r°   )r_   )rº   r»   ÚpfxÚls)rµ   r¹   r   r   Úppë  s   ûzpp_options_list.<locals>.ppc                 S  s   g | ]}|  d ¡dk r|‘qS ©ro   r   ©Úfind©r\   Úxr   r   r   r]   ù  ó    z#pp_options_list.<locals>.<listcomp>rU   c                 S  s   g | ]}|  d ¡dkr|‘qS rÂ   rÃ   rÅ   r   r   r   r]   ü  rÇ   c                 S  s   | d |   d¡… S ©Nro   )Úrfind©rÆ   r   r   r   Ú<lambda>þ  s    z!pp_options_list.<locals>.<lambda>c                   s    g | ]}|t ˆ ƒd  d… ‘qS )r3   N)r5   rÅ   )r>   r   r   r]   ÿ  r£   rX   N)rº   r   r»   r´   r2   r+   )Ú	itertoolsr¸   Útextwrapr¹   r¤   rv   r_   r`   )
r9   rµ   r·   r¸   rÁ   rÀ   ÚsinglesÚgr»   ra   r   )r>   rµ   r¹   r   rƒ   æ  s   
rƒ   rj   úGenerator[None, None, None]c                 #  s\   � d‡ fdd„}t }t}t}|tƒa|tƒa|t ƒa zdV  W |a|a|a dS |a|a|a w )aÂ  
    contextmanager for multiple invocations of API with a common prefix

    supported API functions: (register / get / set )__option

    Warning: This is not thread - safe, and won't work properly if you import
    the API functions into your module using the "from x import y" construct.

    Example
    -------
    import pandas._config.config as cf
    with cf.config_prefix("display.font"):
        cf.register_option("color", "red")
        cf.register_option("size", " 5 pt")
        cf.set_option(size, " 6 pt")
        cf.get_option(size)
        ...

        etc'

    will register options "display.font.color", "display.font.size", set the
    value of "display.font.size"... and so on.
    rz   r   r2   c                   s   d‡ ‡fdd„}t t|ƒS )Nr   r   c                   s$   ˆ› d| › �}ˆ |g|¢R i |¤ŽS rÈ   r   )r   rM   r   Úpkey)rz   rj   r   r   Úinner+  s   z*config_prefix.<locals>.wrap.<locals>.innerrx   )r
   r   )rz   rÒ   ©rj   )rz   r   r¹   *  s   
zconfig_prefix.<locals>.wrapN)rz   r   r2   r   )rž   Ú
get_optionÚ
set_option)rj   r¹   Ú_register_optionr?   rT   r   rÓ   r   Úconfig_prefix  s    €þr×   Ú_typeú	type[Any]úCallable[[Any], None]c                   s   d‡ fdd„}|S )a  

    Parameters
    ----------
    `_type` - a type to be compared against (e.g. type(x) == `_type`)

    Returns
    -------
    validator - a function of a single argument x , which raises
                ValueError if type(x) is not equal to `_type`

    r2   r@   c                   s    t | ƒˆ krtdˆ › d�ƒ‚d S )NzValue must have type 'r¬   )ÚtyperD   rÊ   ©rØ   r   r   rÒ   Q  s   ÿzis_type_factory.<locals>.innerNr‹   r   ©rØ   rÒ   r   rÜ   r   Úis_type_factoryC  s   rÞ   c                   sH   t ˆ ttfƒrtˆ ƒ‰ d ttˆ ƒ¡‰ndˆ › d�‰d‡ ‡fdd„}|S )	zê

    Parameters
    ----------
    `_type` - the type to be checked against

    Returns
    -------
    validator - a function of a single argument x , which raises
                ValueError if x is not an instance of `_type`

    ú|r¬   r2   r@   c                   s   t | ˆ ƒstdˆ› �ƒ‚d S )NzValue must be an instance of )rq   rD   rÊ   ©rØ   Ú	type_reprr   r   rÒ   k  s   
ÿz"is_instance_factory.<locals>.innerNr‹   )rq   Útuplerv   r_   Úmapr   rÝ   r   rà   r   Úis_instance_factoryX  s   rä   c                   s0   dd„ ˆD ƒ‰ dd„ ˆD ƒ‰d‡ ‡fdd„}|S )	Nc                 S  s   g | ]}t |ƒr|‘qS r   ©Úcallable©r\   Úcr   r   r   r]   s  ó    z%is_one_of_factory.<locals>.<listcomp>c                 S  s   g | ]}t |ƒs|‘qS r   rå   rç   r   r   r   r]   t  ré   r2   r@   c                   s`   ˆ ˆvr,t ‡ fdd„ˆD ƒƒs.dd„ ˆD ƒ}d |¡}d|› �}tˆƒr(|d7 }t|ƒ‚d S d S )Nc                 3  s   � | ]}|ˆ ƒV  qd S r;   r   rç   rÊ   r   r   Ú	<genexpr>x  s   € z3is_one_of_factory.<locals>.inner.<locals>.<genexpr>c                 S  rY   r   )r   )r\   Úlvalr   r   r   r]   y  r^   z4is_one_of_factory.<locals>.inner.<locals>.<listcomp>rß   zValue must be one of z or a callable)Úanyr_   r5   rD   )rÆ   ÚuvalsÚ	pp_valuesr   ©Ú	callablesÚlegal_valuesrÊ   r   rÒ   v  s   

ùz is_one_of_factory.<locals>.innerr‹   r   )rñ   rÒ   r   rï   r   Úis_one_of_factoryr  s   
rò   Úvaluec                 C  s.   | du rdS t | tƒr| dkrdS d}t|ƒ‚)zö
    Verify that value is None or a positive int.

    Parameters
    ----------
    value : None or int
            The `value` to be checked.

    Raises
    ------
    ValueError
        When the value is not None or is a negative integer
    Nr   z+Value must be a nonnegative integer or None)rq   r¶   rD   )ró   r   r   r   r   Úis_nonnegative_intƒ  s   
rô   c                 C  s   t | ƒstdƒ‚dS )z»

    Parameters
    ----------
    `obj` - the object to be checked

    Returns
    -------
    validator - returns True if object is callable
        raises ValueError otherwise.

    zValue must be a callableT)ræ   rD   )Úobjr   r   r   Úis_callable¥  s   rö   )r/   r   r0   r1   r2   r   )F)r/   r   r0   r1   r2   r   r‹   )rU   T)r/   r   rV   r1   r2   r   )r/   r   r0   r1   r2   r@   )r/   r   )rU   NN)r   r   r    r   r!   r   r#   r"   r%   r$   r2   r@   )NNN)
r   r   r   r   r   r   r   r   r2   r@   )r/   r   r2   r+   )r   r   r2   r¥   )r   r   r2   r1   rx   )r   r   r2   r   )r>   r   r2   r   )r³   F)r9   r´   rµ   r¶   r·   r1   )rj   r   r2   rÐ   )rØ   rÙ   r2   rÚ   )r2   rÚ   )ró   r   r2   r@   )r2   r1   )Nr.   Ú
__future__r   Ú
contextlibr   r   r•   Útypingr   r   r   r   r	   r
   rK   Úpandas._typingr   r   Úpandas.util._exceptionsr   Úcollections.abcr   r   r   r   r&   r   r'   r)   r,   ÚAttributeErrorrs   r-   r:   r?   rT   rb   re   rg   rh   ry   Ú_get_option_tmplÚ_set_option_tmplÚ_describe_option_tmplÚ_reset_option_tmplrÔ   rÕ   Úreset_optionÚdescribe_optionÚoptionsr†   rž   rŸ   r4   r<   r§   r©   rJ   r8   r6   rZ   rƒ   r×   rÞ   rä   rò   rô   r¶   Úis_intr1   Úis_boolÚfloatÚis_floatr   Úis_strÚbytesÚis_textrö   r   r   r   r   Ú<module>   s€    2 	

 
0'/(
&


$ûMü
3






&
6


