
    \
qii                       U d Z ddlmZ ddlmZ ddlZddlmZmZm	Z	m
Z
 ddlZddlmZ ddlmZ er
ddlmZ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dUdZdVdadWda dXdYd%Z!dZd&Z"d[d'Z# G d( d)          Z$ e$e          Z%e&'                    e%d*d+           ed\d-            Z(	 	 	 d]d^d6a)	 	 	 d_d`d<Z*dad=Z+dbd?Z,dcd@Z-dcdAZ.dddBZ/dedCZ0dfdEZ1edgdG            Z2dhdKZ3didMZ4djdPZ5dkdRZ6 e3e7          Z8 e3e9          Z: e3e;          Z< e3e=          Z> e4e=e?f          Z@dldTZAd+t>          _B        d+t@          _B        d+e!_B        d+e"_B        d+e(_B        dS )ma  
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)contextmanagerN)TYPE_CHECKINGAny
NamedTuplecast)F)find_stack_level)Callable	GeneratorSequencec                  B    e Zd ZU ded<   ded<   ded<   ded<   ded<   d	S )
DeprecatedOptionstrkeytype[Warning]category
str | Nonemsgrkeyremoval_verN__name__
__module____qualname____annotations__     u/var/www/html/bestrading.cuttalo.com/services/ml-inference/venv/lib/python3.11/site-packages/pandas/_config/config.pyr   r   J   sH         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   r   defvaldocCallable[[object], Any] | None	validatorCallable[[str], Any] | NonecbNr   r   r   r   r!   r!   R   sE         HHHKKK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ZdS )OptionErrora.  
    Exception raised for pandas.options.

    Backwards compatible with KeyError checks.

    See Also
    --------
    options : Access and modify global pandas settings.

    Examples
    --------
    >>> pd.options.context
    Traceback (most recent call last):
    OptionError: No such option
    zpandas.errorsN)r   r   r   __doc__r   r   r   r0   r0   g   s           !JJJr   r0   patr   returnc                   t          |           }t          |          dk    r!t          |            t          d|           t          |          dk    rt          d          |d         }t          |           t	          |          }|S )Nr   zNo such keys(s):    zPattern matched multiple keys)_select_optionslen_warn_if_deprecatedr0   _translate_key)r2   keysr   s      r   _get_single_keyr;      s    3D
4yyA~~C   5c55666
4yy1}}9:::
q'C


CJr   r   c                T    t          |           }t          |          \  }}||         S )a  
    Retrieve the value of the specified option.

    This method allows users to query the current value of a given option
    in the pandas configuration system. Options control various display,
    performance, and behavior-related settings within pandas.

    Parameters
    ----------
    pat : str
        Regexp which should match a single option.

        .. warning::

            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
    -------
    Any
        The value of the option.

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

    See Also
    --------
    set_option : Set the value of the specified option or options.
    reset_option : Reset one or more options to their default value.
    describe_option : Print the description for one or more registered options.

    Notes
    -----
    For all available options, please view the :ref:`User Guide <options.available>`
    or use ``pandas.describe_option()``.

    Examples
    --------
    >>> pd.get_option("display.max_columns")  # doctest: +SKIP
    4
    )r;   	_get_root)r2   r   rootks       r   
get_optionr@      s,    X #

C nnGD!7Nr   Nonec                 H   t          |           dk    rLt          | d         t                    r1t          d | d                                         D                       } t          |           }|r	|dz  dk    rt          d          t          | ddd         | ddd         d          D ]t\  }}t          |          }t          |          }|r|j	        r|	                    |           t          |          \  }}|||<   |j        r|                    |           udS )	a\	  
    Set the value of the specified option or options.

    This method allows fine-grained control over the behavior and display settings
    of pandas. Options affect various functionalities such as output formatting,
    display limits, and operational behavior. Settings can be modified at runtime
    without requiring changes to global configurations or environment variables.

    Parameters
    ----------
    *args : str | object | dict
        Arguments provided in pairs, which will be interpreted as (pattern, value),
        or as a single dictionary containing multiple option-value pairs.
        pattern: str
        Regexp which should match a single option
        value: object
        New value of option

        .. warning::

            Partial pattern 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
        No return value.

    Raises
    ------
    ValueError if odd numbers of non-keyword arguments are provided
    TypeError if keyword arguments are provided
    OptionError if no such option exists

    See Also
    --------
    get_option : Retrieve the value of the specified option.
    reset_option : Reset one or more options to their default value.
    describe_option : Print the description for one or more registered options.
    option_context : Context manager to temporarily set options in a ``with``
        statement.

    Notes
    -----
    For all available options, please view the :ref:`User Guide <options.available>`
    or use ``pandas.describe_option()``.

    Examples
    --------
    Option-Value Pair Input:

    >>> 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")

    Dictionary Input:

    >>> pd.set_option({"display.max_columns": 4, "display.precision": 1})
    >>> 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")
    >>> pd.reset_option("display.precision")
    r5   r   c              3  $   K   | ]}|D ]}|V  d S Nr   .0itemkvs      r   	<genexpr>zset_option.<locals>.<genexpr>  /      CCDdCCRCCCCCCCr      z4Must provide an even number of non-keyword argumentsNTstrict)r7   
isinstancedicttupleitems
ValueErrorzipr;   _get_registered_optionr%   r=   r'   )argsnargsr?   vr   optr>   k_roots           r   
set_optionrZ      s.   V 4yyA~~*T!Wd33~CCDGMMOOCCCCCIIE QEAINNOPPPD1ItADqDz$777  1a  $S)) 	3= 	MM! !~~fV6 	FF3KKK r    T_print_descboolr   c                    t          |           }t          |          dk    rt          d|           d                    d |D                       }|rt	          |           dS |S )a  
    Print the description for one or more registered options.

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

    Parameters
    ----------
    pat : str, default ""
        String or string regexp pattern.
        Empty string will return all options.
        For regexp strings, 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 string
        (for testing).

    Returns
    -------
    None
        If ``_print_desc=True``.
    str
        If the description(s) as a string if ``_print_desc=False``.

    See Also
    --------
    get_option : Retrieve the value of the specified option.
    set_option : Set the value of the specified option or options.
    reset_option : Reset one or more options to their default value.

    Notes
    -----
    For all available options, please view the
    :ref:`User Guide <options.available>`.

    Examples
    --------
    >>> pd.describe_option("display.max_columns")  # doctest: +SKIP
    display.max_columns : int
        If max_cols is exceeded, switch to truncate view...
    r   No such keys(s) for pat=
c                ,    g | ]}t          |          S r   )_build_option_description)rF   r?   s     r   
<listcomp>z#describe_option.<locals>.<listcomp>P  s!    >>>A,Q//>>>r   N)r6   r7   r0   joinprint)r2   r\   r:   ss       r   describe_optionrg   #  su    R 3D
4yyA~~777888		>>>>>??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 )a  
    Reset one or more options to their default value.

    This method resets the specified pandas option(s) back to their default
    values. It allows partial string matching for convenience, but users should
    exercise caution to avoid unintended resets due to changes in option names
    in future versions.

    Parameters
    ----------
    pat : str/regex
        If specified only options matching ``pat*`` will be reset.
        Pass ``"all"`` as argument to reset all options.

        .. warning::

            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
        No return value.

    See Also
    --------
    get_option : Retrieve the value of the specified option.
    set_option : Set the value of the specified option or options.
    describe_option : Print the description for one or more registered options.

    Notes
    -----
    For all available options, please view the
    :ref:`User Guide <options.available>`.

    Examples
    --------
    >>> pd.reset_option("display.max_columns")  # doctest: +SKIP
    r   r_   r5      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 valueN)r6   r7   r0   rR   rZ   r)   r"   )r2   r:   r?   s      r   reset_optionrj   X  s    R 3D
4yyA~~777888
4yy1}}SA#,,D
 
 	
  5 51)!,344445 5r   c                H    t          |           }t          |          j        S rD   )r;   rT   r"   )r2   r   s     r   get_default_valrl     s     
#

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   r3   rA   c                v    t                               | d|           t                               | d|           d S )Nro   rp   )object__setattr__)selfro   rp   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          )Nrp   .z.You can only set the value of existing options)rr   __getattribute__ro   rN   rO   rZ   r0   )rt   r   rv   rp   s       r   rs   zDictWrapper.__setattr__  sw    ((x88 	cMF# $&==DF3K!>!>=vs#####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 )Nrp   rx   ro   zNo such option)rr   ry   KeyErrorr0   rN   rO   rn   r@   )rt   r   rp   rW   errs        r   __getattr__zDictWrapper.__getattr__  s    ((x88 	cMF#	9''c2237AA 	9 	9 	9.//S8	9a 	&q&)))f%%%s   !A 
A*A%%A*r-   c                N    t          | j                                                  S rD   )listro   r:   )rt   s    r   __dir__zDictWrapper.__dir__  s    DFKKMM"""r   N)r[   )ro   r*   rp   r   r3   rA   )r   r   rv   r   r3   rA   r   r   )r3   r-   )	r   r   r   r1   r   ru   rs   r}   r   r   r   r   rn   rn     s         993 3 3 3 3
P 
P 
P 
P& & & &# # # # # #r   rn   r   pandasGenerator[None]c            	   '  t  K   t          |           dk    rLt          | d         t                    r1t          d | d                                         D                       } t          |           dz  dk    st          |           dk     rt          d          t          t          | ddd         | ddd         d                    }d	}	 t          d
 |D                       }|D ]\  }}t          ||           dV  |D ]\  }}t          ||           dS # |D ]\  }}t          ||           w xY w)a  
    Context manager to temporarily set options in a ``with`` statement.

    This method allows users to set one or more pandas options temporarily
    within a controlled block. The previous options' values are restored
    once the block is exited. This is useful when making temporary adjustments
    to pandas' behavior without affecting the global state.

    Parameters
    ----------
    *args : str | object | dict
        An even amount of arguments provided in pairs which will be
        interpreted as (pattern, value) pairs. Alternatively, a single
        dictionary of {pattern: value} may be provided.

    Returns
    -------
    None
        No return value.

    Yields
    ------
    None
        No yield value.

    See Also
    --------
    get_option : Retrieve the value of the specified option.
    set_option : Set the value of the specified option.
    reset_option : Reset one or more options to their default value.
    describe_option : Print the description for one or more registered options.

    Notes
    -----
    For all available options, please view the :ref:`User Guide <options.available>`
    or use ``pandas.describe_option()``.

    Examples
    --------
    >>> from pandas import option_context
    >>> with option_context("display.max_rows", 10, "display.max_columns", 5):
    ...     pass
    >>> with option_context({"display.max_rows": 10, "display.max_columns": 5}):
    ...     pass
    r5   r   c              3  $   K   | ]}|D ]}|V  d S rD   r   rE   s      r   rI   z!option_context.<locals>.<genexpr>  rJ   r   rK   zMProvide an even amount of arguments as option_context(pat, val, pat, val...).NTrL   r   c              3  >   K   | ]\  }}|t          |          fV  d S rD   )r@   )rF   r2   rv   s      r   rI   z!option_context.<locals>.<genexpr>   s1      @@Sc:c??+@@@@@@r   )r7   rN   rO   rP   rQ   rR   rS   rZ   )rU   opsundor2   rv   s        r   option_contextr     sq     ^ 4yyA~~*T!Wd33~CCDGMMOOCCCCC
4yy1}SYY]]5
 
 	

 D1ItADqDz$777
8
8C(*D!@@C@@@@@ 	! 	!HCsC     	! 	!HCsC    	! 	! 	! 	!HCsC    	!s   5D D7r   r"   rr   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 keyrx   ^$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)   r0   r.   splitrematchNamerR   	iskeywordr+   	enumeraterN   rO   formatrd   r!   )r   r"   r#   r%   r'   r   r   pathr?   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   r   r   c                    |                                  } | t          v rt          d|  d          t          | ||||          t          | <   dS )aW  
    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").
    category : Warning
        Warning class for the deprecation.
    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(   r0   r   )r   r   r   r   r   s        r   deprecate_optionr   T  sY    T ))++C
!!!SSSSSTTT/XsD+VV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)rF   r?   r2   s     r   rc   z#_select_options.<locals>.<listcomp>  s.    777!rya667A777r   )r)   sortedr:   )r2   r:   s   ` r   r6   r6     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 )Nrx   r   )r   r+   )r   r   r   r   s       r   r=   r=     sG    99S>>DF#2#Y  48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   ro   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)   get)r   s    r   rT   rT     s     ""3'''r   c                :    t          |           }|r	|j        p| S | S )z
    if `key` is deprecated and a replacement key defined, will return the
    replacement key, otherwise returns `key` as-is
    )r   r   r   s     r   r9   r9     s*    
 	s##A v}
r   c                P   t          |           }|r|j        r.t          j        |j        |j        t                                 n]d|  d}|j        r|d|j         z  }|j        r|d|j         dz  }n|dz  }t          j        ||j        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   warningswarnr   r
   r   r   )r   ro   r   s      r   r8   r8     s     	s##A 5 	M
+--     +c***C} BA!-AAAv 9:::::88M
+--   
 t5r   r?   c                $   t          |           }t          |           }|  d}|j        rC|d                    |j                                                            d                    z  }n|dz  }|r}t          j                    5  t          j        dt                     t          j        dt                     |d|j         dt          |            dz  }ddd           n# 1 swxY w Y   |r|j        pd	}|d
z  }|d| dz  }|dz  }|S )zCBuilds a formatted description of a registered option and prints it r`   zNo description available.ignorez
    [default: z] [currently: ]Nr[   z
    (Deprecatedz, use `z
` instead.))rT   r   r#   rd   stripr   r   catch_warningssimplefilterFutureWarningDeprecationWarningr"   r@   r   )r?   oro   rf   r   s        r   rb   rb     s{   q!!Aq!!AAu )	TYYqu{{}}**400111	(( M$&& 	M 	M!(M:::!(,>???LAHLLJqMMLLLLA	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M
 	 v|	  	't''''	SHs   AC''C+.C+rp   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.
    funcr	   r3   c                >     d fd}t          t          |          S )Nr   r   c                *     d|  } |g|R i |S )Nrx   r   )r   rU   kwdspkeyr   rp   s       r   innerz*config_prefix.<locals>.wrap.<locals>.inner*  s6    $$s$$D4,t,,,t,,,r   r   )r   r	   )r   r   rp   s   ` r   wrapzconfig_prefix.<locals>.wrap)  s7    	- 	- 	- 	- 	- 	- 	- Au~~r   N)r   r	   r3   r	   )r   r@   rZ   )rp   r   _register_option_get_option_set_options   `    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`

    r3   rA   c                T    t          |           k    rt          d d          d S )NzValue must have type 'r   )typerR   )xr   s    r   r   zis_type_factory.<locals>.innerP  s6    77e>e>>>??? r   r3   rA   r   )r   r   s   ` r   is_type_factoryr   B  s.    @ @ @ @ @ @ Lr   type | tuple[type, ...]c                     t           t                    r)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   r3   rA   c                L    t          |           st          d           d S )NzValue must be an instance of )rN   rR   )r   r   	type_reprs    r   r   z"is_instance_factory.<locals>.inneri  s9    !U## 	JHYHHIII	J 	Jr   r   )rN   rP   rd   mapr   )r   r   r   s   ` @r   is_instance_factoryr   W  sq     % !HHSe__--		 LLL	J J J J J J J Lr   legal_valuesr   c                H     d  D             d  D              d fd}|S )Nc                0    g | ]}t          |          |S r   callablerF   cs     r   rc   z%is_one_of_factory.<locals>.<listcomp>q  s#    888qHQKK8888r   c                0    g | ]}t          |          |S r   r   r   s     r   rc   z%is_one_of_factory.<locals>.<listcomp>r  s#    ???!8A;;?A???r   r3   rA   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 rD   r   )rF   r   r   s     r   rI   z3is_one_of_factory.<locals>.inner.<locals>.<genexpr>v  s+      //qqtt//////r   c                ,    g | ]}t          |          S r   )r   )rF   lvals     r   rc   z4is_one_of_factory.<locals>.inner.<locals>.<listcomp>w  s    <<<tT<<<r   r   zValue must be one of z or a callable)anyrd   r7   rR   )r   uvals	pp_valuesr   	callablesr   s   `   r   r   z is_one_of_factory.<locals>.innert  s    L  ////Y///// &<<|<<<HHUOO	9i99y>> ,++C oo% ! & &r   r   r   )r   r   r   s   ` @r   is_one_of_factoryr   p  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)rN   intrR   )r   r   s     r   is_nonnegative_intr     s?     }	E3		 A::F
7C
S//r   objc                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   rR   )r   s    r   is_callabler     s&     C== 534444r   )r2   r   r3   r   )r2   r   r3   r   r   )r[   T)r2   r   r\   r]   r3   r   )r2   r   r3   rA   )r2   r   )r3   r   )r[   NN)r   r   r"   rr   r#   r   r%   r$   r'   r&   r3   rA   )NNN)r   r   r   r   r   r   r   r   r   r   r3   rA   )r2   r   r3   r-   )r   r   r3   r   r   )r   r   r3   r   )r   r   r3   r]   )r?   r   r3   r   )rp   r   r3   r   )r   r   r3   r   )r   r   r3   r   )r   r   r3   r   )r   rr   r3   rA   )r   rr   r3   r]   )Cr1   
__future__r   
contextlibr   r   typingr   r   r   r   r   pandas._typingr	   pandas.util._exceptionsr
   collections.abcr   r   r   r   r!   r(   r   r)   r+   r.   AttributeErrorr{   r0   r;   r@   rZ   rg   rj   rl   rn   optionsrr   rs   r   r   r   r6   r=   r   rT   r9   r8   rb   r   r   r   r   r   r   is_intr]   is_boolfloatis_floatr   is_strbytesis_textr   r   r   r   r   <module>r     s  0 0 0d # " " " " " % % % % % % 				                   4 4 4 4 4 4              z   $ $ $ $ $z $ $ $ 46  5 5 5 5 46  5 5 5 5 "$ # # # # #G # # # #! ! ! ! !.( ! ! !0    0 0 0 0f^ ^ ^ ^B2 2 2 2 2j65 65 65 65r. . . .
$# $# $# $# $# $# $# $#N +n
%
%   7L( 3 3 3 @! @! @! @!L 04&*H H H H H\ "/W /W /W /W /Wl8 8 8 8$       ( ( ( (	 	 	 	   D   < /+ /+ /+ /+l   *   2   "   6 
		
/$

?5!!			

sEl
+
+   & !
  
 % " $   r   