
    cMhnc                    N   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rddlmZmZ  G d	 d
e          Z G 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ee          Z d^dZ!d_d`d Z"dad"Z#dbdcd'Z$d_ddd(Z%ded)Z& G d* d+          Z' G d, d-ee                   Z(d.Z)d/Z*d0Z+d1Z, e(e"e)          a- e(e#e*          a. e(e%e,          Z/ e(e$e+          Z0 e'e          Z1 G d2 d3e          Z2	 	 	 dfdgd<a3	 	 	 dhdid@Z4djdAZ5dkdCZ6dldDZ7dmdEZ8dmdFZ9dndGZ:dldHZ;dodJZ<dpdqdQZ=edrdT            Z>dsdXZ?dtdYZ@dtdZZAdud\ZB e?eC          ZD e?eE          ZF e?eG          ZH e?eI          ZJ e@eIeKf          ZLdvd]ZMdS )wa  
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                  8    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__     U/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/pandas/_config/config.pyr   r   Q   s<         HHHOOOr   r   c                  B    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   sE         HHHNNNHHH----######r   r"   zdict[str, DeprecatedOption]_deprecated_optionszdict[str, RegisteredOption]_registered_optionsdict[str, Any]_global_configall	list[str]_reserved_keysc                      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    r2   r2   m   s        
 
 
 
r   r2   patr   silentboolreturnc                >   t          |           }t          |          dk    r0|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_deprecatedr2   repr_translate_key)r4   r5   keysr   s       r    _get_single_keyr@      s    3D
4yyA~~ 	%$$$9d3ii99:::
4yy1}}9:::
q'C !C   


CJr   Fr   c                V    t          | |          }t          |          \  }}||         S N)r@   	_get_root)r4   r5   r   rootks        r    _get_optionrF      s+    
#v
&
&C nnGD!7Nr   Nonec                    t          |           }|r	|dz  dk    rt          d          |                    dd          }|rAt          t	          |                                                    }t          d| d          t          | d d d         | dd d                   D ]\  }}t          ||          }t          |          }|r|j
        r|
                    |           t          |          \  }	}
||	|
<   |j        rZ|rCt          j        d	
          5  |                    |           d d d            n# 1 swxY w Y   |                    |           d S )N   r   z4Must provide an even number of non-keyword argumentsr5   Fz2_set_option() got an unexpected keyword argument ""r9   T)record)r;   
ValueErrorpopnextiterr?   	TypeErrorzipr@   _get_registered_optionr'   rC   r)   warningscatch_warnings)argskwargsnargsr5   kwargrE   vr   orD   k_roots              r    _set_optionr\      s   IIE QEAINNOPPP ZZ%((F WT&++--(())UUUUUVVVD1ItADqDz**  1a(("3'' 	 	KKNNN !~~fV4 	 ,D999  DDIII               S			! s   D>>E	E	 T_print_descr   c                    t          |           }t          |          dk    rt          d          d                    d |D                       }|rt	          |           d S |S )Nr   No such keys(s)
c                ,    g | ]}t          |          S r   )_build_option_description).0rE   s     r    
<listcomp>z$_describe_option.<locals>.<listcomp>   s!    >>>A,Q//>>>r   )r:   r;   r2   joinprint)r4   r^   r?   ss       r    _describe_optionri      sj    3D
4yyA~~+,,,		>>>>>??A atHr   c                ,   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 S )Nr   r`   r9      r.   zYou must specify at least 4 characters when resetting multiple keys, use the special keyword "all" to reset all the options to their default valuer5   )r:   r;   r2   rL   r\   r+   r$   )r4   r5   r?   rE   s       r    _reset_optionrm      s    3D
4yyA~~+,,,
4yy1}}SA#,,D
 
 	
  E EA*1-4VDDDDDE Er   c                L    t          | d          }t          |          j        S NTrl   )r@   rR   r$   )r4   r   s     r    get_default_valrp      s%    
#d
+
+
+C!#&&--r   c                  @    e Zd ZU dZded<   ddd	ZddZddZddZdS )DictWrapperz/provide attribute-style access to a nested dictr,   dr]   prefixr   r7   rG   c                v    t                               | d|           t                               | d|           d S )Nrs   rt   )r#   __setattr__)selfrs   rt   s      r    __init__zDictWrapper.__init__   s8    4a(((4622222r   r   valr   c                    t                               | d          }|r|dz  }||z  }|| j        v r2t          | j        |         t                    st          ||           d S t          d          )Nrt   .z.You can only set the value of existing options)r#   __getattribute__rs   
isinstancedictr\   r2   )rw   r   ry   rt   s       r    rv   zDictWrapper.__setattr__   sw    ((x88 	cMF# $&==DF3K!>!>=$$$$$NOOOr   c                B   t                               | d          }|r|dz  }||z  }	 t                               | d          |         }n"# t          $ r}t          d          |d }~ww xY wt	          |t
                    rt          ||          S t          |          S )Nrt   r{   rs   zNo such option)r#   r|   KeyErrorr2   r}   r~   rr   rF   )rw   r   rt   rY   errs        r    __getattr__zDictWrapper.__getattr__   s    ((x88 	cMF#	9''c2237AA 	9 	9 	9.//S8	9a 	'q&)))v&&&s   !A 
A*A%%A*r/   c                N    t          | j                                                  S rB   )listrs   r?   )rw   s    r    __dir__zDictWrapper.__dir__   s    DFKKMM"""r   N)r]   )rs   r,   rt   r   r7   rG   )r   r   ry   r   r7   rG   r   r   )r7   r/   )	r   r   r   r3   r   rx   rv   r   r   r   r   r    rr   rr      s         993 3 3 3 3
P 
P 
P 
P' ' ' '# # # # # #r   rr   c                  6    e Zd ZddZdd	Zedd
            ZdS )CallableDynamicDocfuncCallable[..., T]doc_tmplr   r7   rG   c                "    || _         || _        d S rB   )__doc_tmpl____func__)rw   r   r   s      r    rx   zCallableDynamicDoc.__init__  s    $r   r   c                     | j         |i |S rB   )r   )rw   rU   kwdss      r    __call__zCallableDynamicDoc.__call__  s    t}d+d+++r   c                    t          dd          }t          t          t                                                              }| j                            ||          S )Nr.   F)r^   )	opts_desc	opts_list)ri   pp_options_listr   r+   r?   r   format)rw   r   r   s      r    r3   zCallableDynamicDoc.__doc__  sR    $U>>>	#D)<)A)A)C)C$D$DEE	 '')y'QQQr   N)r   r   r   r   r7   rG   )r7   r   )r7   r   )r   r   r   rx   r   propertyr3   r   r   r    r   r     sb           , , , , R R R XR R Rr   r   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                  *    e Zd ZdZddZddZ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
    r7   rG   c           	         t          |          dz  dk    st          |          dk     rt          d          t          t          |d d d         |dd d                             | _        d S )NrI   r   z>Need to invoke as option_context(pat, val, [(pat, val), ...]).r9   )r;   rL   r   rQ   ops)rw   rU   s     r    rx   zoption_context.__init__  sm    t99q=ATQP   D1ItADqDz2233r   c                p    d | j         D             | _        | j         D ]\  }}t          ||d           d S )Nc                6    g | ]\  }}|t          |          fS r   )rF   )rd   r4   ry   s      r    re   z,option_context.__enter__.<locals>.<listcomp>  s)    FFFcc;s++,FFFr   Trl   )r   undor\   )rw   r4   ry   s      r    	__enter__zoption_context.__enter__  sP    FFTXFFF	 	/ 	/HCS.....	/ 	/r   c                V    | j         r| j         D ]\  }}t          ||d           d S d S ro   )r   r\   )rw   rU   r4   ry   s       r    __exit__zoption_context.__exit__  sM    9 	3 I 3 3SCT22222	3 	33 3r   Nr7   rG   )r   r   r   r3   rx   r   r   r   r   r    r   r     sZ        
 
4 4 4 4/ / / /3 3 3 3 3 3r   r   r   r$   r#   r%   r'   r&   r)   r(   c           
        ddl }ddl}|                                 } | t          v rt	          d|  d          | t
          v rt	          d|  d          |r ||           |                     d          }|D ][}t          j        d|j	        z   dz   |          st          | d	          |                    |          rt          | d
          \t          }	d}
t          |dd                   D ]i\  }}t          |	t                    s>t	          |
                    d                    |d|                                       ||	vri |	|<   |	|         }	jt          |	t                    s>t	          |
                    d                    |dd                                       ||	|d         <   t%          | ||||          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 keyr{   ^$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+   r2   r0   splitrematchNamerL   	iskeywordr-   	enumerater}   r~   r   rf   r"   )r   r$   r%   r'   r)   r   r   pathrE   cursorr   ips                r    register_optionr     s   > NNNOOO
))++C
!!!GSGGGHHH
n=S===>>>  	& 99S>>D 9 9xhm+c1155 	?===>>>Q 	9777888	9 F
AC$ss)$$  1&$'' 	Ecjjbqb0B0BjCCDDDF??F1Ifd## B#**CHHT#2#Y,?,?*@@AAAF48  0C9     r   r   r   r   c                    |                                  } | 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*   r2   r   )r   r   r   r   s       r    deprecate_optionr   6  sW    N ))++C
!!!SSSSSTTT/S$LLr   c                      t           v r gS t          t                                                     } dk    r|S  fd|D             S )zb
    returns a list of keys matching `pat`

    if pat=="all", returns all registered options
    r.   c                T    g | ]$}t          j        |t           j                  "|%S r   )r   searchI)rd   rE   r4   s     r    re   z#_select_options.<locals>.<listcomp>x  s.    777!rya667A777r   )r+   sortedr?   )r4   r?   s   ` r    r:   r:   i  s\     !!!u %**,,--D
e||7777t7777r   tuple[dict[str, Any], str]c                x    |                      d          }t          }|d d         D ]
}||         }||d         fS )Nr{   r   )r   r-   )r   r   r   r   s       r    rC   rC   {  sG    99S>>DF#2#Y  48r   c                <    |                                  } | t          v S )z4Returns True if the given option has been deprecated)r   r*   r   s    r    _is_deprecatedr     s    
))++C%%%r   c                D    	 t           |          }|S # t          $ r Y dS w xY w)z
    Retrieves the metadata for a deprecated option, if `key` is deprecated.

    Returns
    -------
    DeprecatedOption (namedtuple) if key is deprecated, None otherwise
    N)r*   r   r   rs   s     r    _get_deprecated_optionr     s<    $     tts    
c                6    t                               |           S )z
    Retrieves the option metadata if `key` is a registered option.

    Returns
    -------
    RegisteredOption (namedtuple) if key is deprecated, None otherwise
    )r+   getr   s    r    rR   rR     s     ""3'''r   c                :    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   s     r    r>   r>     s*    
 	s##A v}
r   c                P   t          |           }|r|j        r.t          j        |j        t          t                                 n]d|  d}|j        r|d|j         z  }|j        r|d|j         dz  }n|dz  }t          j        |t          t                                 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   rS   warnFutureWarningr   r   r   )r   rs   r   s      r    r<   r<     s     	s##A 5 	MM+--     +c***C} BA!-AAAv 9:::::88M#}9I9K9KLLLLt5r   rE   c                h   t          |           }t          |           }|  d}|j        rC|d                    |j                                                            d                    z  }n|dz  }|r|d|j         dt          | d           dz  }|r|j        pd}|d	z  }|d
| dz  }|dz  }|S )zCBuilds a formatted description of a registered option and prints it ra   zNo description available.z
    [default: z] [currently: T]r]   z
    (Deprecatedz, use `z
` instead.))	rR   r   r%   rf   stripr   r$   rF   r   )rE   rZ   rs   rh   r   s        r    rc   rc     s    q!!Aq!!AAu )	TYYqu{{}}**400111	(( P	OOOAt8L8LOOOO v|	  	't''''	SHr   P   r?   Iterable[str]widthint_printc                  
 ddl m} ddlm dfd
}g }d t	          |           D             }|r| |d|          z  }d | D             }  |t	          |           d           D ]/\  
}
fdt          |          D             }| |
|          z  }0d                    |          }	|rt          |	           dS |	S )z@Builds a concise listing of available options, grouped by prefixr   )groupby)wrapnamer   ksr   r7   r/   c                    | rd| z   dz   nd} d                     |          |dd          }|r|d         r| r|d         d	z   |d<   |S )
Nz- z.[r]   z, z  F)initial_indentsubsequent_indentbreak_long_wordsr   r   )rf   )r   r   pfxlsr   r   s       r    ppzpp_options_list.<locals>.pp  s|    $(0dTkD  bTIIbMM""
 
 
  	""R& 	"T 	"Vc\BrF	r   c                D    g | ]}|                     d           dk     |S r{   r   findrd   xs     r    re   z#pp_options_list.<locals>.<listcomp>  s'    :::Q!&&++//q///r   r]   c                D    g | ]}|                     d           dk    |S r   r   r   s     r    re   z#pp_options_list.<locals>.<listcomp>  s,    000!qvvc{{a//A///r   c                <    | d |                      d                   S Nr{   )rfind)r   s    r    <lambda>z!pp_options_list.<locals>.<lambda>  s    .AGGCLL.0A r   c                D    g | ]}|t                    d z   d         S )r9   N)r;   )rd   r   rE   s     r    re   z#pp_options_list.<locals>.<listcomp>  s+    ///!aA
o///r   ra   N)r   r   r   r   r7   r/   )	itertoolsr   textwrapr   r   r   rf   rg   )r?   r   r   r   r   r   singlesgr   rh   rE   r   s    `        @@r    r   r     s#   !!!!!!       B::&,,:::G 
bbWoo00t000Dt&A&ABB  1////tAww///
bbBii		"A ar   rt   Generator[None, None, None]c              #      K   d fd}t           }t          }t          } |t                    a |t                    a |t                     a 	 dV  |a|a|a dS # |a|a|a w xY 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.
    r   r   r7   c                >     d fd}t          t          |          S )Nr   r   c                *     d|  } |g|R i |S r   r   )r   rU   r   pkeyr   rt   s       r    innerz*config_prefix.<locals>.wrap.<locals>.inner+  s6    $$s$$D4,t,,,t,,,r   r   )r   r   )r   r   rt   s   ` r    r   zconfig_prefix.<locals>.wrap*  s7    	- 	- 	- 	- 	- 	- 	- Au~~r   N)r   r   r7   r   )r   
get_option
set_option)rt   r   _register_optionrF   r\   s   `    r    config_prefixr     s      <      'KKj!!Jj!!Jd?++O+ 
 
* !
 
*****s   A A$_type	type[Any]Callable[[Any], None]c                     d f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`

    r7   rG   c                T    t          |           k    rt          d d          d S )NzValue must have type 'r   )typerL   )r   r   s    r    r   zis_type_factory.<locals>.innerQ  s6    77e>e>>>??? r   r   r   )r   r   s   ` r    is_type_factoryr  C  s.    @ @ @ @ @ @ Lr   c                     t           t          t          f          r8t                      d                    t	          t
                               nd  dd f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   r7   rG   c                L    t          |           st          d           d S )NzValue must be an instance of )r}   rL   )r   r   	type_reprs    r    r   z"is_instance_factory.<locals>.innerk  s9    !U## 	JHYHHIII	J 	Jr   r   )r}   tupler   rf   mapr   )r   r   r  s   ` @r    is_instance_factoryr  X  s     %%'' !eHHSe__--		 LLL	J J J J J J J Lr   c                H     d  D             d  D              d fd}|S )Nc                0    g | ]}t          |          |S r   callablerd   cs     r    re   z%is_one_of_factory.<locals>.<listcomp>s  s#    888qHQKK8888r   c                0    g | ]}t          |          |S r   r  r  s     r    re   z%is_one_of_factory.<locals>.<listcomp>t  s#    ???!8A;;?A???r   r7   rG   c                      vrdt           fdD                       sKd D             }d                    |          }d| }t                    r|dz  }t          |          d S d S )Nc              3  .   K   | ]} |          V  d S rB   r   )rd   r  r   s     r    	<genexpr>z3is_one_of_factory.<locals>.inner.<locals>.<genexpr>x  s+      //qqtt//////r   c                ,    g | ]}t          |          S r   )r   )rd   lvals     r    re   z4is_one_of_factory.<locals>.inner.<locals>.<listcomp>y  s    <<<tT<<<r   r  zValue must be one of z or a callable)anyrf   r;   rL   )r   uvals	pp_valuesr   	callableslegal_valuess   `   r    r   z is_one_of_factory.<locals>.innerv  s    L  ////Y///// &<<|<<<HHUOO	9i99y>> ,++C oo% ! & &r   r   r   )r  r   r  s   ` @r    is_one_of_factoryr  r  sT    88L888I??|???L& & & & & & & Lr   valuec                f    | 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)r}   r   rL   )r  r   s     r    is_nonnegative_intr     s?     }	E3		 A::F
7C
S//r   c                B    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  rL   )objs    r    is_callabler#    s&     C== 534444r   )r4   r   r5   r6   r7   r   )F)r4   r   r5   r6   r7   r   r   )r]   T)r4   r   r^   r6   r7   r   )r4   r   r5   r6   r7   rG   )r4   r   )r]   NN)r   r   r$   r#   r%   r   r'   r&   r)   r(   r7   rG   )NNN)
r   r   r   r   r   r   r   r   r7   rG   )r4   r   r7   r/   )r   r   r7   r   )r   r   r7   r6   r   )r   r   r7   r   )rE   r   r7   r   )r   F)r?   r   r   r   r   r6   )rt   r   r7   r   )r   r   r7   r   )r7   r   )r  r#   r7   rG   )r7   r6   )Nr3   
__future__r   
contextlibr   r   r   typingr   r   r   r	   r
   r   rS   pandas._typingr   r   pandas.util._exceptionsr   collections.abcr   r   r   r"   r*   r   r+   r-   r0   AttributeErrorr   r2   r@   rF   r\   ri   rm   rp   rr   r   _get_option_tmpl_set_option_tmpl_describe_option_tmpl_reset_option_tmplr   r   reset_optiondescribe_optionoptionsr   r   r   r:   rC   r   r   rR   r>   r<   rc   r   r   r  r  r  r   r   is_intr6   is_boolfloatis_floatr   is_strbytesis_textr#  r   r   r    <module>r9     s|  0 0 0d # " " " " "        
			                        5 4 4 4 4 4            z   $ $ $ $ $z $ $ $ 46  5 5 5 5 46  5 5 5 5 "$ # # # # #G # # # #    .(   $   $       @
 
 
 
 
E E E E E". . . .
$# $# $# $# $# $# $# $#`R R R R R R R R % N- ^& P" L  -=>>
-=>>
!!-1CDD$$%57LMM
+n
%
%3 3 3 3 3% 3 3 3H 04&*H H H H HZ "	,M ,M ,M ,M ,Mf8 8 8 8$   & & & &    ( ( ( (	 	 	 	   <   0    L /+ /+ /+ /+l   *   4   "   6 
		
/$

?5!!			

sEl
+
+     r   