
    .dg-                    F   d Z ddlZddlZddlZddlZddlZddlZddlZ	ddl
Z
ddlZddlZddlZddlZddlmZ ddlmZ ddlmZ ddlmZmZmZmZmZmZmZmZmZmZmZ ddl m!Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z- d	d
dZ.d Z/efdZ0d Z1d Z2 G d d      Z3 G d de      Z4 G d de      Z5 G d d      Z6 e6       Z7 G d de5      Z8 G d de8      Z9 G d de8      Z: G d de8      Z; G d  d!e8      Z< G d" d#e      Z= G d$ d%e=      Z> G d& d'      Z? e?       Z@ G d( d)e      ZA G d* d+eA      ZB G d, d-eB      ZC G d. d/eB      ZD G d0 d1eD      ZE G d2 d3eD      ZF G d4 d5e      ZG G d6 d7eG      ZH G d8 d9e      ZI G d: d;e      ZJ G d< d=eK      ZL G d> d?      ZM eM       ZN G d@ dA      ZO eO       ZP G dB dCe      ZQ G dD dEeJeQ      ZR G dF dGeR      ZS G dH dIeR      ZT G dJ dKeR      ZU G dL dMeU      ZV G dN dOeJ      ZW G dP dQeW      ZX G dR dSeW      ZY G dT dUeW      ZZ G dV dWeW      Z[ G dX dYe      Z\ G dZ d[e\      Z] G d\ d]e      Z^ e$e"^       G d_ d`e             Z_ G da dbe      Z` G dc dde`      Za G de dfe`      Zb G dg dhe      Zc G di dje      Zdy)ka  
Parameters are a kind of class attribute allowing special behavior,
including dynamically generated parameter values, documentation
strings, constant and read-only parameters, and type or range checking
at assignment time.

Potentially useful for any large Python program that needs
user-modifiable object attributes; see the Parameter and Parameterized
classes for more information.  If you do not want to add a dependency
on external code by importing from a separately installed param
package, you can simply save this file as param.py and copy it and
parameterized.py directly into your own package.

This file contains subclasses of Parameter, implementing specific
parameter types (e.g. Number), and also imports the definition of
Parameters and Parameterized classes.
    N)OrderedDict)Iterable)contextmanager   )Parameterized	ParameterParameterizedFunctionParamOverridesString	Undefined
get_loggerinstance_descriptor	_dt_types
_int_types_identity_hook)ParamFutureWarning_deprecate_positional_args_deprecated_validate_error_prefix_deserialize_from_path_named_objs_produce_value_get_min_max_value
_is_numberconcrete_descendents_abbreviate_paths_to_datetimeT)warnc                     i }|D ]J  }|j                   D ]9  }|dk7  s	||v r| rt               j                  d|        t        ||      ||<   ; L |S )a  
    Given a set of Parameterized objects, returns a dictionary
    with the union of all param name,value pairs across them.

    Parameters
    ----------
    warn : bool, optional
        Wether to warn if the same parameter have been given multiple values,
        otherwise use the last value, by default True

    Returns
    -------
    dict
        Union of all param name,value pairs

    namezoverwriting parameter )paramr   warninggetattr)r   parameterizedsdoks        0lib/python3.12/site-packages/param/parameters.pyparam_unionr)   =   s_    " 	AAF{6dL((+A!)EFq!}!	   H    c                  D   i }| j                         D ]	  \  }}t        |d      }t        |t              r|||<   *t        |t              rt        di |||<   It        |t              rt        di |||<   ht        |t              rt        di |||<   t        |t              rt        di |||<   t        |t              rt        di |||<   t        |t              rt        di |||<   t        |t              rbt!        d |D              rt#        di |||<   t%        |      dk(  r"t!        d |D              rt'        di |||<   Ft)        di |||<   Vt        |t*              rt-        di |||<   vdt.        j0                  v r"ddlm} t        ||      rt7        di |||<   d	t.        j0                  v r@dd
lm}m} t        ||      rt;        di |||<   t        ||      rt=        di |||<   t        di |||<    |S )zy
    Given a set of keyword literals, promote to the appropriate
    parameter type based on some simple heuristics.
    T)defaultconstantc              3   2   K   | ]  }t        |        y wN)r   .0els     r(   	<genexpr>z$guess_param_types.<locals>.<genexpr>o   s     .Ab:b>As      c              3   <   K   | ]  }t        |t                y wr/   )
isinstancer   r0   s     r(   r3   z$guess_param_types.<locals>.<genexpr>q   s     $K2ZI%>s   numpyr   ndarraypandas)	DataFrameSeries )itemsdictr6   r   r   DateboolBooleanintIntegerfloatNumberstrr   DicttupleallNumericTuplelen	DateRangeTuplelistListsysmodulesr7   r9   Arrayr:   r;   r<   )kwargsparamsr'   vkwsr9   pdDFramepdSeriess           r(   guess_param_typesrZ   X   s   
 F11t,a#F1I9%sF1I4 #F1I3#F1I5!F1I3F1I4 sF1I5!.A..(/3/q	Q1$K$K!K%,,q	!LCLq	4 sF1I#++%)a) %F1I3;;& a* ) 0C 0F1I8, &F1I!(C(F1IS V Mr*   c                 `    t        |t        t        f      s|g}t        | t        |      |      S )z
    Dynamically create a parameterized class with the given name and the
    supplied parameters, inheriting from the specified base(s).
    )r6   rO   rI   type)r    rU   basess      r(   parameterized_classr^      s,    
 edE]+geElF++r*   c                     i }| j                         D ]g  \  }}t        j                  |      }t        |t        t        f      r2||v r	||   \  }}nt        dd|j                        \  }}}||f|_        |||<   i |S )z
    Given a dictionary of Parameter instances, return a corresponding
    set of copies with the bounds appropriately set.


    If given a set of override keywords, use those numeric tuple bounds.
    N)value)r>   copyr6   rD   rF   r   r,   bounds)	rU   	overridesguessedr    p	new_paramminvmaxv_s	            r(   guess_boundsrj      s     G<<>aIIaL	a'6*+y %dO	T 24QYY OdA $d|I! " Nr*   c                 |    | d\  }}n| \  }}|d\  }}n|\  }}||||k  r|}n|}||||kD  r|}||fS |}||fS )z
    For each soft bound (upper and lower), if there is a defined bound
    (not equal to None) and does not exceed the hard bound, then it is
    returned. Otherwise it defaults to the hard bound. The hard bound
    could still be None.
    NNr=   )rb   
softboundshlhuslsulus           r(   get_soft_boundsrt      s{     ~BBBB	zbnB	zbnB q6M q6Mr*   c                   d    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zy)Infinitya  
    An instance of this class represents an infinite value. Unlike
    Python's float('inf') value, this object can be safely compared
    with gmpy numeric types across different gmpy versions.

    All operators on Infinity() return Infinity(), apart from the
    comparison and equality operators. Equality works by checking
    whether the two objects are both instances of this class.
    c                 .    t        || j                        S r/   )r6   	__class__selfothers     r(   __eq__zInfinity.__eq__   s    Zdnn%EEr*   c                     | |k(   S r/   r=   ry   s     r(   __ne__zInfinity.__ne__   s    u_4r*   c                      yNFr=   ry   s     r(   __lt__zInfinity.__lt__       Ur*   c                      yr   r=   ry   s     r(   __le__zInfinity.__le__   r   r*   c                      yNTr=   ry   s     r(   __gt__zInfinity.__gt__       Tr*   c                      yr   r=   ry   s     r(   __ge__zInfinity.__ge__   r   r*   c                     | S r/   r=   ry   s     r(   __add__zInfinity.__add__       Tkr*   c                     | S r/   r=   ry   s     r(   __radd__zInfinity.__radd__   r   r*   c                     | S r/   r=   ry   s     r(   __ladd__zInfinity.__ladd__   r   r*   c                     | S r/   r=   ry   s     r(   __sub__zInfinity.__sub__   r   r*   c                     | S r/   r=   ry   s     r(   __iadd__zInfinity.__iadd__   s    d{r*   c                     | S r/   r=   ry   s     r(   __isub__zInfinity.__isub__   r   r*   c                      y)Nz
Infinity()r=   rz   s    r(   __repr__zInfinity.__repr__   s    \r*   c                     t        |       S r/   )reprr   s    r(   __str__zInfinity.__str__   s    T$Z/r*   N)__name__
__module____qualname____doc__r|   r~   r   r   r   r   r   r   r   r   r   r   r   r   r=   r*   r(   rv   rv      s4     F4**))))))*)1/r*   rv   c                        e Zd ZdZdZ e       Z ed d      Z e	e
dd      Z e	dd      Z e	ed	      Z ed
d      Z fdZd Zd Zd Zd ZddZd Zd Zd Zd Zd Z xZS )Timea=
  
    A callable object returning a number for the current time.

    Here 'time' is an abstract concept that can be interpreted in any
    useful way.  For instance, in a simulation, it would be the
    current simulation time, while in a turn-taking game it could be
    the number of moves so far.  The key intended usage is to allow
    independent Parameterized objects with Dynamic parameters to
    remain consistent with a global reference.

    The time datatype (time_type) is configurable, but should
    typically be an exact numeric type like an integer or a rational,
    so that small floating-point errors do not accumulate as time is
    incremented repeatedly.

    When used as a context manager using the 'with' statement
    (implemented by the __enter__ and __exit__ special methods), entry
    into a context pushes the state of the Time object, allowing the
    effect of changes to the time value to be explored by setting,
    incrementing or decrementing time as desired. This allows the
    state of time-dependent objects to be modified temporarily as a
    function of time, within the context's block. For instance, you
    could use the context manager to "see into the future" to collect
    data over multiple times, without affecting the global time state
    once exiting the context. Of course, you need to be careful not to
    do anything while in context that would affect the lasting state
    of your other objects, if you want things to return to their
    starting state when exiting the context.

    The starting time value of a new Time object is 0, converted to
    the chosen time type. Here is an illustration of how time can be
    manipulated using a Time object:

    >>> time = Time(until=20, timestep=1)
    >>> 'The initial time is %s' % time()
    'The initial time is 0'
    >>> 'Setting the time to %s' % time(5)
    'Setting the time to 5'
    >>> time += 5
    >>> 'After incrementing by 5, the time is %s' % time()
    'After incrementing by 5, the time is 10'
    >>> with time as t:  # Entering a context
    ...     'Time before iteration: %s' % t()
    ...     'Iteration: %s' % [val for val in t]
    ...     'Time after iteration: %s' % t()
    ...     t += 2
    ...     'The until parameter may be exceeded outside iteration: %s' % t()
    'Time before iteration: 10'
    'Iteration: [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]'
    'Time after iteration: 20'
    'The until parameter may be exceeded outside iteration: 22'
    >>> 'After exiting the context the time is back to %s' % time()
    'After exiting the context the time is back to 10'
    Tz
         The label given to the Time object. Can be used to convey
         more specific notions of time as appropriate. For instance,
         the label could be 'Simulation Time' or 'Duration'.)r,   doca  
        Callable that Time will use to convert user-specified time
        values into the current time; all times will be of the resulting
        numeric type.

        By default, time is of integer type, but you can supply any
        arbitrary-precision type like a fixed-point decimal or a
        rational, to allow fractional times.  Floating-point times are
        also allowed, but are not recommended because they will suffer
        from accumulated rounding errors.  For instance, incrementing
        a floating-point value 0.0 by 0.05, 20 times, will not reach
        1.0 exactly.  Instead, it will be slightly higher than 1.0,
        because 0.05 cannot be represented exactly in a standard
        floating point numeric type. Fixed-point or rational types
        should be able to handle such computations exactly, avoiding
        accumulation issues over long time intervals.

        Some potentially useful exact number classes:

         - int: Suitable if all times can be expressed as integers.

         - Python's decimal.Decimal and fractions.Fraction classes:
           widely available but slow and also awkward to specify times
           (e.g. cannot simply type 0.05, but have to use a special
           constructor or a string).

         - fixedpoint.FixedPoint: Allows a natural representation of
           times in decimal notation, but very slow and needs to be
           installed separately.

         - gmpy.mpq: Allows a natural representation of times in
           decimal notation, and very fast because it uses the GNU
           Multi-Precision library, but needs to be installed
           separately and depends on a non-Python library.  gmpy.mpq
           is gmpy's rational type.
        )r,   r-   r         ?z
        Stepsize to be used with the iterator interface.
        Time can be advanced or decremented by any value, not just
        those corresponding to the stepsize, and so this value is only
        a default.z
         Declaration of an expected end to time values, if any.  When
         using the iterator interface, iteration will end before this
         value is exceeded.Na  
        The units of the time dimensions. The default of None is set
        as the global time function may on an arbitrary time base.

        Typical values for the parameter are 'seconds' (the SI unit
        for time) or subdivisions thereof (e.g. 'milliseconds').c                 l    t        |   di | | j                  d      | _        d | _        g | _        y )Nr   r=   )super__init__	time_type_time
_exhausted_pushed_state)rz   rU   rx   s     r(   r   zTime.__init___  s2    "6"^^A&
r*   c                     t        |t              sy| j                  | j                  f}|j                  |j                  f}||k7  ryy)NFT)r6   r   timestepuntil)rz   r{   self_paramsother_paramss       r(   r|   zTime.__eq__f  sA    %&}}TZZ0u{{3,&r*   c                     | |k(   S r/   r=   ry   s     r(   r~   zTime.__ne__p  s    EM""r*   c                     | S r/   r=   r   s    r(   __iter__zTime.__iter__t  s    tr*   c                 
   | j                  | j                        }| j                  d| _        | j                  S | j                  |z   | j                  k  r!| xj                  |z  c_        | j                  S d | _        t
        r   )r   r   r   r   r   StopIteration)rz   r   s     r(   __next__zTime.__next__w  sq    >>$--0??"#DO zz jj8#

2JJ("J zz #DOr*   c                     |r|t        d      |r?| j                  j                  d      j                  d      }d|_        || _        d|_        || j                  |      | _        | j                  S )a  
        When called with no arguments, returns the current time value.

        When called with a specified val, sets the time to it.

        When called with a specified time_type, changes the time_type
        and sets the current time to the given val (which *must* be
        specified) converted to that time type.  To ensure that
        the current state remains consistent, this is normally the only
        way to change the time_type of an existing Time instance.
        z-Please specify a value for the new time_type.existingr   FT)	Exceptionr!   objectsgetr-   r   r   )rz   valr   
type_params       r(   __call__zTime.__call__  so     KLL++J7;;KHJ"'J&DN"&J?,DJzzr*   c                     | |z  } y r/   r=   rz   r   s     r(   advancezTime.advance  s    r*   c                 L    | j                   | j                  |      z   | _         | S r/   r   r   ry   s     r(   r   zTime.__iadd__       ZZ$.."77
r*   c                 L    | j                   | j                  |      z
  | _         | S r/   r   ry   s     r(   r   zTime.__isub__  r   r*   c                     | j                   j                  | j                  | j                  | j                  f       d| _        | S )z-Enter the context and push the current state.T)r   appendr   r   r   
in_contextr   s    r(   	__enter__zTime.__enter__  s5    !!4::t}}djj"IJr*   c                     | j                   j                         \  | _        | _        | _        t        | j                         dk7  | _        |t        u ryy)z
        Exit from the current context, restoring the previous state.
        The StopIteration exception raised in context will force the
        context to exit. Any other exception exc that is raised in the
        block will not be caught.
        r   TN)r   popr   r   r   rL   r   r   )rz   excargss      r(   __exit__zTime.__exit__  sL     372D2D2H2H2J/T]DJd001Q6-  r*   rl   )r   r   r   r   _infinitely_iterablerv   foreverr   labelr   rC   r   r   r   unitr   r|   r~   r   r   r   r   r   r   r   r   __classcell__rx   s   @r(   r   r      s    5n  jG& '@ AE # #; #IJ  * H g +  E
 $ %D ED # $
2


r*   r   c                        e Zd ZdZ e       ZdZej                  	 dddddddddddddd       Z	e
f fd	Z	ddZ fd	Ze fd
       ZddZd fd	Zd fd	Zd fd	Z xZS )Dynamica  
    Parameter whose value can be generated dynamically by a callable
    object.

    If a Parameter is declared as Dynamic, it can be set a callable
    object (such as a function or callable class), and getting the
    parameter's value will call that callable.

    Note that at present, the callable object must allow attributes
    to be set on itself.

    If set as time_dependent, setting the Dynamic.time_fn allows the
    production of dynamic values to be controlled: a new value will be
    produced only if the current value of time_fn is different from
    what it was the last time the parameter value was requested.

    By default, the Dynamic parameters are not time_dependent so that
    new values are generated on every call regardless of the time. The
    default time_fn used when time_dependent is a single Time instance
    that allows general manipulations of time. It may be set to some
    other callable as required so long as a number is returned on each
    call.
    FNT)r   r   
precedenceinstantiater-   readonlypickle_default_value
allow_Noneper_instance
allow_refsnested_refsc                     y r/   r=   )rz   r,   r   r   r   r   r-   r   r   r   r   r   r   s                r(   r   zDynamic.__init__  s     	r*   c                     t        |   dd|i| t        | j                        r-| j	                  d       | j                  | j                         yy)zl
        Call the superclass's __init__ and set instantiate=True if the
        default is dynamic.
        r,   TNr=   )r   r   callabler,   _set_instantiate_initialize_generatorrz   r,   rU   rx   s      r(   r   zDynamic.__init__  sK    
 	33F3DLL!!!$'&&t||4 "r*   c                 v    t        |d      r|j                  |_        d|_        d|_        g |_        g |_        y)z=Add 'last time' and 'last value' attributes to the generator._Dynamic_time_fnN)hasattrr   _Dynamic_last_Dynamic_time_saved_Dynamic_last_saved_Dynamic_time)rz   genobjs      r(   r   zDynamic._initialize_generator  s?     3)*#&#7#7C   "$"$r*   c                 b    t         |   ||      }t        |d      s|S | j                  |      S )z
        Call the superclass's __get__; if the result is not dynamic
        return that result, otherwise ask that result to produce a
        value and return it.
        r   r   __get__r   r   rz   r   objtyper   rx   s       r(   r   zDynamic.__get__  s5     goc'*s?+J&&s++r*   c                     t         |   ||       t        |      }|r| j                  ||       || j	                  |       yy)z
        Call the superclass's set and keep this parameter's
        instantiate value up to date (dynamic parameters
        must be instantiated).

        If val is dynamic, initialize it as a generator.
        N)r   __set__r   r   r   )rz   r   r   dynamicrx   s       r(   r   zDynamic.__set__  sB     	C 3-D..s37;--g6;r*   c                    t        |d      r|j                  }n| j                  }|| j                  st	        |      }||_        |S  |       }|s||j                  k7  rt	        |      }||_        ||_        |S |j
                  }|S )a  
        Return a value from gen.

        If there is no time_fn, then a new value will be returned
        (i.e. gen will be asked to produce a new value).

        If force is True, or the value of time_fn() is different from
        what it was was last time _produce_value was called, a new
        value will be produced and returned. Otherwise, the last value
        gen produced will be returned.
        r   )r   r   time_fntime_dependentr   r   r   )rz   r   forcer   r`   times         r(   r   zDynamic._produce_value$  s     3)***GllGOT%8%8"3'E %C  9Dc///&s+$)!$(!  ))r*   c                 8    t        t        | 	  ||      d      S )zo
        Return True if the parameter is actually dynamic (i.e. the
        value is being generated).
        r   )r   r   r   )rz   r   r   rx   s      r(   _value_is_dynamiczDynamic._value_is_dynamicF  s    
 uws73ODDr*   c                 X    t         |   ||      }t        |d      r|j                  S |S )z3Return the last generated value for this parameter.r   )r   r   r   r   r   s       r(   _inspectzDynamic._inspectN  s.    GOC(3'$$$Jr*   c                 f    t         |   ||      }t        |d      r| j                  |d      S |S )z1Force a new value to be generated, and return it.r   T)r   r   r   s       r(   _forcezDynamic._forceX  s8    GOC(3'&&s&66Jr*   r/   F)r   r   r   r   r   r   r   typingoverloadr   r   r   r   r   r   r   r   r   r  r   r   s   @r(   r   r     s    0 fGN__55TeRVe	   ) 	5%, 7 7DE r*   r   c                   ,    e Zd ZdZd Zd Zed        Zy)__compute_set_hookzRemove when set_hook is removedc                     t         S r/   )r   rz   re   s     r(   r   z__compute_set_hook.__call__e  s    r*   c                 ,    t        | j                        S r/   r   sigr   s    r(   r   z__compute_set_hook.__repr__h      DHH~r*   c                      y r/   r=   r   s    r(   r  z__compute_set_hook.sigk      r*   Nr   r   r   r   r   r   propertyr  r=   r*   r(   r  r  b  s#    )  r*   r  c                       e Zd ZdZg dZ eej                  ddddde      Ze	j                  	 dddddddddddddddddd	d
       Zeefeeeeed fd       Z fdZ fdZd Zd Zd Zd Zd Zd Z fdZ xZS )rF   ao  
    A numeric Dynamic Parameter, with a default value and optional bounds.

    There are two types of bounds: ``bounds`` and
    ``softbounds``.  ``bounds`` are hard bounds: the parameter must
    have a value within the specified range.  The default bounds are
    (None,None), meaning there are actually no hard bounds.  One or
    both bounds can be set by specifying a value
    (e.g. bounds=(None,10) means there is no lower bound, and an upper
    bound of 10). Bounds are inclusive by default, but exclusivity
    can be specified for each bound by setting inclusive_bounds
    (e.g. inclusive_bounds=(True,False) specifies an exclusive upper
    bound).

    Number is also a type of Dynamic parameter, so its value
    can be set to a callable to get a dynamically generated
    number (see Dynamic).

    When not being dynamically generated, bounds are checked when a
    Number is created or set. Using a default value outside the hard
    bounds, or one that is not numeric, results in an exception. When
    being dynamically generated, bounds are checked when the value
    of a Number is requested. A generated value that is not numeric,
    or is outside the hard bounds, results in an exception.

    As a special case, if allow_None=True (which is true by default if
    the parameter has a default of None when declared) then a value
    of None is also allowed.

    A separate function set_in_bounds() is provided that will
    silently crop the given value into the legal range, for use
    in, for instance, a GUI.

    ``softbounds`` are present to indicate the typical range of
    the parameter, but are not enforced. Setting the soft bounds
    allows, for instance, a GUI to know what values to display on
    sliders for the Number.

    Example of creating a Number::

      AB = Number(default=0.5, bounds=(None,10), softbounds=(0,1), doc='Distance from A to B.')

    )rb   rm   inclusive_boundsset_hookstep        NTTr,   rb   rm   r  r  r  FTrb   rm   r  r  r  r   r   r   r   r   r-   r   r   r   r   r   c                     y r/   r=   rz   r,   rb   rm   r  r  r  r   r   r   r   r   r-   r   r   r   r   r   s                     r(   r   zNumber.__init__       	r*   rb   rm   r  r  r  c                    t        |   dd|i| || _        || _        || _        || _        || _        | j                  | j                         y)z
        Initialize this parameter object and store the bounds.

        Non-dynamic default values are checked against the bounds.
        r,   Nr=   )	r   r   r  rb   r  rm   r  	_validater,   	rz   r,   rb   rm   r  r  r  rU   rx   s	           r(   r   zNumber.__init__  sN     	33F3  0$	t||$r*   c                 n    t         |   ||      }| j                  ||      r| j                  |       |S )zy
        Same as the superclass's __get__, but if the value was
        dynamically generated, check the bounds.
        )r   r   r   r  )rz   r   r   resultrx   s       r(   r   zNumber.__get__  s8    
 g.
 !!#w/NN6"r*   c                 d    t        |      s| j                  |      }n|}t        |   ||       y)z
        Set to the given value, but cropped to be within the legal bounds.
        All objects are accepted, and no exceptions will be raised.  See
        crop_to_bounds for details on how cropping is done.
        N)r   crop_to_boundsr   r   )rz   r   r   bounded_valrx   s       r(   set_in_boundszNumber.set_in_bounds  s/     }--c2KK[)r*   c                     t        |      r1| j                  |S | j                  \  }}|||k  r|S |||kD  r|S |S | j                  r||S | j                  S )a  
        Return the given value cropped to be within the hard bounds
        for this parameter.

        If a numeric value is passed in, check it is within the hard
        bounds. If it is larger than the high bound, return the high
        bound. If it's smaller, return the low bound. In either case, the
        returned value could be None.  If a non-numeric value is passed
        in, set to be the default value (which could be None).  In no
        case is an exception raised; all values are accepted.

        As documented in https://github.com/holoviz/param/issues/80,
        currently does not respect exclusive bounds, which would
        strictly require setting to one less for integer values or
        an epsilon less for floats.
        )r   rb   r   r,   )rz   r   vminvmaxs       r(   r$  zNumber.crop_to_bounds  sp    & c?{{"
JD$: L:K 
 __J <<r*   c                 |   ||| j                   st        |      ry |\  }}|\  }}|H|du r"||k  s?t        t        |        d| d| d      ||k  st        t        |        d| d| d      |J|du r#||k\  st        t        |        d| d| d      y ||kD  st        t        |        d| d| d      y y )NTz must be at most , not .z must be less than z must be at least z must be greater than )r   r   
ValueErrorr   )rz   r   rb   r  r(  r)  incminincmaxs           r(   _validate_boundszNumber._validate_bounds  s+   >ckdoo(3-
d)~d{$1$788I&se1. 
 Tz$1$788K&se1. 
 ~d{$1$788J&se1.  # Tz$1$788N&se1.  " r*   c                     |r| t        |      rt        j                  |      sy t        |      s#t	        t        |        dt        |       d      y Nz  only takes numeric values, not r,  )r   inspectisgeneratorfunctionr   r-  r   r\   rz   r   r   s      r(   _validate_valuezNumber._validate_value$  sY    3;HSM'B]B]^aBb#)$/0 1Cyk$  r*   c                 h    |0t        |      s$t        t        | d       dt        |       d      y y )Nr  * can only be None or a numeric value, not r,  r   r-  r   r\   rz   r   r  s      r(   _validate_stepzNumber._validate_step.  sF    Jt$4)$78 9004T
|1>  %5r*   c                     | j                  || j                         | j                  || j                         | j	                  || j
                  | j                         y
        Checks that the value is numeric and that it is within the hard
        bounds; if not, an exception is raised.
        N)r6  r   r;  r  r0  rb   r  r   s     r(   r  zNumber._validate5  sH    
 	S$//2C+c4;;0E0EFr*   c                 B    t        | j                  | j                        S r/   rt   rb   rm   r   s    r(   rt   zNumber.get_soft_bounds>      t{{DOO<<r*   c                 6    d|vrd |d<   t         |   |       y )Nr  )r   __setstate__rz   staterx   s     r(   rC  zNumber.__setstate__A  s!     E&MU#r*   )r  )r   r   r   r   	__slots__r?   r   _slot_defaults_compute_set_hookr  r  r   r   r   r   r&  r$  r0  r6  r;  r  rt   rC  r   r   s   @r(   rF   rF   s  s    *X QIDT$4:KN
 __ #{Y]hld$4UTPTe   ( %I)"+)i%  %
*&PBG=$ $r*   rF   c                   D    e Zd ZdZ eej                  d      Zd Zd Zy)rD   z+Numeric Parameter required to be an Integerr   r,   c                     t        |      ry |r|y t        |t              s#t        t	        |        dt        |       d      y )Nz must be an integer, not r,  )r   r6   r   r-  r   r\   r5  s      r(   r6  zInteger._validate_valueN  sR    C=#+#z*)$/0 1Cyk$  +r*   c                 r    |5t        |t              s$t        t        | d       dt	        |       d      y y )Nr  z+ can only be None or an integer value, not r,  )r6   rC   r-  r   r\   r:  s      r(   r;  zInteger._validate_step[  sH    JtS$9)$78 9115dA?  %:r*   N)	r   r   r   r   r?   rF   rG  r6  r;  r=   r*   r(   rD   rD   I  s!    5&//;Nr*   rD   c                        e Zd ZdZ eej                  dd      Zej                  	 dddddddddddddddddd	d
       Z	e
fe
e
e
e
e
d fdZ	 xZS )	Magnitudez8Numeric Parameter required to be in the range [0.0-1.0].r   )r  r   )r,   rb   Nr  FTr  c                     y r/   r=   r  s                     r(   r   zMagnitude.__init__h  r  r*   r  c          
      2    t        |   d||||||d| y )Nr  r=   r   r   r   s	           r(   r   zMagnitude.__init__r  s+     	
Fz-D8	
OU	
r*   )r   )r   r   r   r   r?   rF   rG  r  r  r   r   r   r   s   @r(   rN  rN  c  s    B&//YON__ )d[_cnrd$4UTPTe   ) 
I)"+)i
 
r*   rN  c                        e Zd ZdZ eej                  d      Zej                  	 ddddddddddddddddddd       Z	e
f fd		Z	d
 Zd Z fdZed        Zed        Z xZS )r@   z(Date parameter of datetime or date type.NrJ  r  FTrb   rm   r  r  r  r   r   r   r   r-   r   r   r   r   r   r   c                     y r/   r=   rz   r,   rb   rm   r  r  r  r   r   r   r   r-   r   r   r   r   r   r   s                     r(   r   zDate.__init__  r  r*   c                 (    t        |   dd|i| y Nr,   r=   rQ  rz   r,   rT   rx   s      r(   r   zDate.__init__      33F3r*   c                     | j                   r|yt        |t              s(|r|#t        t	        |        dt        |       d      yy)r>  Nz) only takes datetime and date types, not r,  )r   r6   r   r-  r   r\   r5  s      r(   r6  zDate._validate_value  sY    
 ??s{#y):#+)$/0 1##'9+Q0  CN)r*   c                 r    |5t        |t              s$t        t        | d       dt	        |       d      y y )Nr  z0 can only be None, a datetime or date type, not r,  r6   r   r-  r   r\   r:  s      r(   r;  zDate._validate_step  sI    JtY$?)$78 9004T
|1>  %@r*   c                 d    t        |      }|d nt        t         |      }t        |   |||      S r/   )r   mapr   r0  )rz   r   rb   r  rx   s       r(   r0  zDate._validate_bounds  s4    3Sv-Fw'V5EFFr*   c                     |y t        |t        j                  t        j                  f      s|j	                  t        j                        }|j                  d      S )N%Y-%m-%dT%H:%M:%S.%f)r6   dtdatetimedateastypestrftimeclsr`   s     r(   	serializezDate.serialize  sC    =%"++rww!78LL-E~~455r*   c                 R    |dk(  s|y t         j                  j                  |d      S )Nnullr`  )ra  rb  strptimerf  s     r(   deserializezDate.deserialize  s(    F?em{{##E+ABBr*   r/   )r   r   r   r   r?   rF   rG  r  r  r   r   r6  r;  r0  classmethodrh  rl  r   r   s   @r(   r@   r@   z  s    2&//>N__  $Z^im55TeRVe   ) 4G
 6 6 C Cr*   r@   c                        e Zd ZdZ eej                  d      Zej                  	 ddddddddddddddddddd       Z	e
f fd		Z	d
 Zd Zed        Zed        Z xZS )CalendarDatez6Parameter specifically allowing dates (not datetimes).NrJ  r  FTrS  c                     y r/   r=   rU  s                     r(   r   zCalendarDate.__init__  r  r*   c                 (    t        |   dd|i| y rW  rQ  rX  s      r(   r   zCalendarDate.__init__  rY  r*   c                     | j                   r|yt        |t        j                        rt        |t        j                        r|r|t        t        |        d      yy)r>  Nz only takes date types.)r   r6   ra  rc  rb  r-  r   r5  s      r(   r6  zCalendarDate._validate_value  s^    
 ??s{3(JsBKK,HS]bebm)$/00GH  cn,Hr*   c                     |?t        |t        j                        s$t        t	        | d       dt        |       d      y y )Nr  z& can only be None or a date type, not r,  r6   ra  rc  r-  r   r\   r:  s      r(   r;  zCalendarDate._validate_step  sL    JtRWW$=)$78 9$$(J<q2  %>r*   c                 *    |y |j                  d      S N%Y-%m-%dre  rf  s     r(   rh  zCalendarDate.serialize  s    =~~j))r*   c                 n    |dk(  s|y t         j                  j                  |d      j                         S Nrj  rw  )ra  rb  rk  rc  rf  s     r(   rl  zCalendarDate.deserialize  s0    F?em{{##E:6;;==r*   r/   )r   r   r   r   r?   rF   rG  r  r  r   r   r6  r;  rm  rh  rl  r   r   s   @r(   ro  ro    s    @&//>N__  $Z^im55TeRVe   ) 4 * *
 > >r*   ro  c                        e Zd ZdZ eej                  d      Zej                  	 dddddddddddddd       Z	e
ef fd	       Z	d	 Zd
 Z xZS )rB   z%Binary or tristate Boolean Parameter.FrJ  NTr   r   r   r   r   r-   r   r   r   r   r   c                     y r/   r=   rz   r,   r   r   r   r   r   r-   r   r   r   r   r   s                r(   r   zBoolean.__init__  r  r*   c                 ^    t        |   dd|i| | j                  | j                         y rW  r   r   r  r,   r   s      r(   r   zBoolean.__init__  (    33F3t||$r*   c                     |r.t        |t              s|t        t        |        d|d      y y t        |t              st        t        |        d|d      y )Nz) only takes a boolean value or None, not r,  z must be True or False, not )r6   rA   r-  r   r5  s      r(   r6  zBoolean._validate_value  s~    c4(S_ -d34 5225;  .=(
 C&)$/0 1gQ   'r*   c                 <    | j                  || j                         y r/   r6  r   r   s     r(   r  zBoolean._validate      S$//2r*   r  )r   r   r   r   r?   r   rG  r  r  r   r   r   r6  r  r   r   s   @r(   rB   rB     su    /)22EBN__  d$4UTPTe   ( %  %3r*   rB   c                        e Zd ZdZg dZej                  	 dddddddddddddd       Zed fd	       Zd	 Z	e
 fd
       Z xZS )Eventa  
    An Event Parameter is one whose value is intimately linked to the
    triggering of events for watchers to consume. Event has a Boolean
    value, which when set to True triggers the associated watchers (as
    any Parameter does) and then is automatically set back to
    False. Conversely, if events are triggered directly via `.trigger`,
    the value is transiently set to True (so that it's clear which of
    many parameters being watched may have changed), then restored to
    False when the triggering completes. An Event parameter is thus like
    a momentary switch or pushbutton with a transient True value that
    serves only to launch some other action (e.g. via a param.depends
    decorator), rather than encapsulating the action itself as
    param.Action does.
    )_autotrigger_value_mode_autotrigger_reset_valueFNTr|  c                     y r/   r=   r~  s                r(   r   zEvent.__init__%  r  r*   c                 R    d| _         d| _        d| _        t        |   dd|i| y )NTF	set-resetr,   r=   )r  r  r  r   r   r   s      r(   r   zEvent.__init__/  s1    "&(-% 
  	2262r*   c                     d}||| _         n#||j                  j                  | j                  <   | j	                  ||       y r   )r,   _param__privatevaluesr    _post_setter)rz   r   r   s      r(   _reset_eventzEvent._reset_eventE  s=    ;DL47C&&tyy1#s#r*   c                     | j                   dv rt        | 	  ||       | j                   dv r| j                  ||       y y )N)r  set)r  reset)r  r   r   r  )rz   r   r   rx   s      r(   r   zEvent.__set__M  s@    ::--GOC%:://c3' 0r*   r  )r   r   r   r   rF  r  r  r   r   r  r   r   r   r   s   @r(   r  r    sy    $ LI__  d$4UTPTe   3  3*$ ( (r*   r  c                   (    e Zd Zd Zd Zed        Zy)__compute_length_of_defaultc                 ,    t        |j                        S r/   )rL   r,   r	  s     r(   r   z$__compute_length_of_default.__call__Y  s    199~r*   c                 ,    t        | j                        S r/   r  r   s    r(   r   z$__compute_length_of_default.__repr__\  r  r*   c                      y r/   r=   r   s    r(   r  z__compute_length_of_default.sig_  r  r*   Nr   r   r   r   r   r  r  r=   r*   r(   r  r  X  s       r*   r  c                        e Zd ZdZdgZ eej                  de      Ze	j                  	 ddddddddddddddd	       Zeefed
 fd       Zd Zd Zd Zed        Zed        Z xZS )rN   zCA tuple Parameter (e.g. ('a',7.6,[3,5])) with a fixed tuple length.lengthr   r   r,   r  NFT)r  r   r   r   r   r-   r   r   r   r   r   r   c                     y r/   r=   )rz   r,   r  r   r   r   r   r-   r   r   r   r   r   r   s                 r(   r   zTuple.__init__n  r  r*   )r  c                    t        |   dd|i| |t        u r$| j                  t	        t        | d       d      |t        ur|rt        |      | _        n|| _        | j                  | j                         y)a  
        Initialize a tuple parameter with a fixed length (number of
        elements).  The length is determined by the initial default
        value, if any, and must be supplied explicitly otherwise.  The
        length is not allowed to change after instantiation.
        r,   Nr  z- must be specified if no default is supplied.r=   )	r   r   r   r,   r-  r   rL   r  r  )rz   r,   r  rU   rx   s       r(   r   zTuple.__init__x  s}     	33F3Y4<<#7)$9: ;7 7  I%'g,DK DKt||$r*   c                 t    ||ry t        |t              s#t        t        |        dt	        |       d      y )N only takes a tuple value, not r,  )r6   rI   r-  r   r\   r5  s      r(   r6  zTuple._validate_value  sH    ;:#u%)$/0 1Cyk$  &r*   c                     || j                   ry t        |      |k(  s't        t        | d       dt        |       d| d      y )Nr  z is not of the correct length (z instead of ).r   rL   r-  r   )rz   r   r  s      r(   _validate_lengthzTuple._validate_length  sW    ;4??3x6!)$9: ;**-c(<xrK  "r*   c                 t    | j                  || j                         | j                  || j                         y r/   )r6  r   r  r  r   s     r(   r  zTuple._validate  s*    S$//2c4;;/r*   c                     |y t        |      S r/   )rO   rf  s     r(   rh  zTuple.serialize  s    =E{r*   c                 (    |dk(  s|y t        |      S )Nrj  )rI   rf  s     r(   rl  zTuple.deserialize  s    F?emU|r*   )r  )r   r   r   r   rF  r?   r   rG  _compute_length_of_defaultr  r  r   r   r   r6  r  r  rm  rh  rl  r   r   s   @r(   rN   rN   g  s    M
I)22EJdeN__ !%55TeRVe   ( %I %  %&0  
  r*   rN   c                   "     e Zd ZdZ fdZ xZS )rK   zGA numeric tuple Parameter (e.g. (4.5,7.6,3)) with a fixed tuple length.c                     t         |   ||       |r|y |D ]0  }t        |      rt        t	        |        dt        |       d       y r2  )r   r6  r   r-  r   r\   )rz   r   r   nrx   s       r(   r6  zNumericTuple._validate_value  s]    Z0#+A!})$/0 1#Awiq*  r*   )r   r   r   r   r6  r   r   s   @r(   rK   rK     s    Q
 
r*   rK   c                        e Zd ZdZ eej                  d      Zej                  	 d
dddddddddddddd       Z	e
f fd		Z	 xZS )XYCoordinatesz%A NumericTuple for an X,Y coordinate.r  r  rJ  NFT)r  r   r   r   r   r   r-   r   r   r   r   r   c                     y r/   r=   )rz   r,   r  r   r   r   r   r   r-   r   r   r   r   r   s                 r(   r   zXYCoordinates.__init__  r  r*   c                 *    t        |   d|dd| y Nr4   r  r=   rQ  r   s      r(   r   zXYCoordinates.__init__  s    ==f=r*   )r  )r   r   r   r   r?   rK   rG  r  r  r   r   r   r   s   @r(   r  r    sd    /,55zJN__ &*d$4UTPTe   ) > >r*   r  c                        e Zd ZdZg dZ eej                  ddddd      Zej                  	 ddddddddddddddddddd	       Z
eefeeeed
 fd       Z
 fdZd Zd Zd Zd Zd Zd Z xZS )Rangez4A numeric range with optional bounds and softbounds.)rb   r  rm   r  Nr  )r,   rb   r  rm   r  FT)rb   rm   r  r  r  r   r   r   r   r-   r   r   r   r   r   r   c                     y r/   r=   )rz   r,   rb   rm   r  r  r  r   r   r   r   r-   r   r   r   r   r   r   s                     r(   r   zRange.__init__  r  r*   )rb   rm   r  r  c                b    || _         || _        || _        || _        t	        |   d|dd| y r  )rb   r  rm   r  r   r   )rz   r,   rb   rm   r  r  rU   rx   s          r(   r   zRange.__init__  s9      0$	;;F;r*   c                 L   t         |   |       | j                  || j                  | j                  d       | j                  || j
                  | j                  d       | j                  || j                         | j                  || j                  | j                         y )Nbound	softbound)r   )
r   r  r0  rb   r  rm   r;  r  _validate_orderr   rz   r   rx   s     r(   r  zRange._validate  s}    #c4;;0E0EwOc4??D4I4I;WC+S$))Hr*   c                     |Mt        |      s$t        t        | d       dt        |       d      |dk(  rt        t        | d       d      y y )Nr  r8  r,  r   z cannot be 0.r9  r:  s      r(   r;  zRange._validate_step  sq    d# -dF;< =//3Dzl!=   -dF;<MJ   r*   c           
          ||ry ||d   |d   y |\  }}|*|dkD  r%||k  s t        t        |        d| d| d| d      |,|dk  r&||k\  s t        t        |        d| d| d| d      y y y )	Nr   r   z end z is less than its start z with positive step r,  z start z with negative step )r-  r   )rz   r   r  r   startends         r(   r  zRange._validate_order  s    ;:_#a&.CFN
sq#)$/0cU ;3D6<  $(5C<)$/0w ?1$q:  4@(r*   c                 l    t        |      s)t        t        |        d| d| dt        |       d      y )N z, can only be None or a numerical value, not r,  r9  rz   r`   positionkinds       r(   _validate_bound_typezRange._validate_bound_type  sJ    % )$/0(1TF C226u+aA  !r*   c                 z   |,t        ddg|      D ]  \  }}|	| j                  |||        |dk(  ry ||| j                  ry |\  }}|\  }	}
t        ddg|      D ][  \  }}|d uxr |	r||k  n||k  }|d uxr |
r||kD  n||k\  }|s|s/t        t	        |        d| d| j                          d| d       y )Nlowerupperr  r  z bound must be in range r+  r,  )zipr  r   r-  r   rangestr)rz   r   rb   r  r  posrV   r(  r)  r.  r/  r  too_lowtoo_highs                 r(   r0  zRange._validate_bounds  s    w0&9Q9))!S$7 : ;>ckdoo
d)Wg.4HE14'P&a$ha4iGD(Q6q4xqDyH( -d34AeW =!]]_-VA3a9 	 5r*   c                 B    t        | j                  | j                        S r/   r@  r   s    r(   rt   zRange.get_soft_bounds3  rA  r*   c                 l    | j                   \  }}| j                  \  }}|rdnd}|rdnd}| | d| | S )N[(]), )rb   r  )rz   r(  r)  r.  r/  s        r(   r  zRange.rangestr6  sI    [[
d..CC$r$x00r*   r/   )r   r   r   r   rF  r?   rK   rG  r  r  r   r   r   r  r;  r  r  r0  rt   r  r   r   s   @r(   r  r    s    >DI##T$$DN
 __  $Z^gk55TeRVe   ( <I)"+)<  <I
$,=1r*   r  c                   D     e Zd ZdZd Z fdZd Zed        Zd Z	 xZ
S )rM   z
    A datetime or date range specified as (start, end).

    Bounds must be specified as datetime or date types (see param.dt_types).
    c                 v    t        |t              s)t        t        |        d| d| dt	        |       d      y )Nr  z0 can only be None or a date/datetime value, not r,  r\  r  s       r(   r  zDateRange._validate_bound_typeE  sL    %+)$/0(1TF C66:5k]!E  ,r*   c                     |d nt        t        t        |            }|d nt        t        t        |            }t        |   ||||       y r/   )rI   r^  r   r   r0  )rz   r   rb   r  r  rx   s        r(   r0  zDateRange._validate_boundsL  sE    kduSs-C'DU3|V3L-M f.>Er*   c                 B   |r|y t        |t              s#t        t        |        dt	        |       d      |D ]5  }t        |t
              rt        t        |        dt	        |       d       |\  }}||k\  s#t        t        |        d|d    d|d    d      y )Nr  r,  z& only takes date/datetime values, not z end datetime r   z is before start datetime r   )r6   rI   r-  r   r\   r   rz   r   r   r  r  r  s         r(   r6  zDateRange._validate_valueQ  s     #+#u%)$/0 1Cyk$  A!Y')$/0 1#Awiq*   
se|)$/0s1vh G,,/F816  r*   c                 N   |y g }|D ]  }t        |t        j                  t        j                  f      s|j	                  t        j                        }t        |      t        j                  u r|j                  d      }n|j                  d      }|j                  |        |S )Nrw  r`  )r6   ra  rb  rc  rd  r\   re  r   )rg  r`   
serializedrV   s       r(   rh  zDateRange.serializel  s    =
Aa"++rww!78HHR[[)Aw"''!JJz*JJ56a   r*   c                    |dk(  s|y g }|D ]p  }t        |      dk(  r/t        j                  j                  |d      j	                         }n t        j                  j                  |d      }|j                  |       r t        |      S )Nrj  
   rw  r`  )rL   ra  rb  rk  rc  r   rI   )rg  r`   deserializedrV   s       r(   rl  zDateRange.deserialize}  s}    F?emA1v|KK((J7<<> KK((,BC"  \""r*   )r   r   r   r   r  r0  r6  rm  rh  rl  r   r   s   @r(   rM   rM   >  s1    F
6   #r*   rM   c                   <    e Zd ZdZd Zd Zed        Zed        Zy)CalendarDateRangez1A date range specified as (start_date, end_date).c                     |r|y |D ]6  }t        |t        j                        rt        t	        |        d| d       |\  }}||k\  s#t        t	        |        d|d    d|d    d      y )Nz only takes date types, not r,  z
 end date r   z is before start date r   )r6   ra  rc  r-  r   r  s         r(   r6  z!CalendarDateRange._validate_value  s    #+Aa) -d34 5%q"   
se|)$/0
3q6( C!!fXQ(  r*   c                     t        |t        j                        s)t        t	        |        d| d| dt        |       d      y )Nr  z' can only be None or a date value, not r,  rt  r  s       r(   r  z&CalendarDateRange._validate_bound_type  sO    %))$/0(1TF C--1%[M<  *r*   c                 P    |y |D cg c]  }|j                  d       c}S c c}w rv  rx  rg  r`   rV   s      r(   rh  zCalendarDateRange.serialize  s+    =0561

:&666s   #c           	          |dk(  s|y t        |D cg c]0  }t        j                  j                  |d      j	                         2 c}      S c c}w rz  )rI   ra  rb  rk  rc  r  s      r(   rl  zCalendarDateRange.deserialize  sG    F?em%P%Qbkk**1j9>>@%PQQPs   5AN)	r   r   r   r   r6  r  rm  rh  rl  r=   r*   r(   r  r    s9    ;$ 7 7 R Rr*   r  c                   ~     e Zd ZdZej
                  	 d
ddddddddddddd       Zeef fd	       Zd Z	d	 Z
 xZS )CallableaW  
    Parameter holding a value that is a callable object, such as a function.

    A keyword argument instantiate=True should be provided when a
    function object is used that might have state.  On the other hand,
    regular standalone functions cannot be deepcopied as of Python
    2.4, so instantiate must be False for those values.
    NFTr|  c                     y r/   r=   r~  s                r(   r   zCallable.__init__  r  r*   c                 ^    t        |   dd|i| | j                  | j                         y rW  r  r   s      r(   r   zCallable.__init__  r  r*   c                 h    |r|t        |      ry t        t        |        dt        |       d      )Nz. only takes a callable object, not objects of r,  )r   r-  r   r\   r5  s      r(   r6  zCallable._validate_value  s?    3;8C=%d+, -"3i[+
 	
r*   c                 <    | j                  || j                         y r/   r  r   s     r(   r  zCallable._validate  r  r*   r/   )r   r   r   r   r  r  r   r   r   r6  r  r   r   s   @r(   r  r    sg     __  d$4UTPTe   ( %  %
3r*   r  c                       e Zd ZdZy)Actionz
    A user-provided function that can be invoked like a class or object method using ().
    In a GUI, this might be mapped to a button, but it can be invoked directly as well.
    N)r   r   r   r   r=   r*   r(   r  r    s    r*   r  c                        e Zd ZdZddgZej                  dddddddddddddd       Zee	d	 fd

       Zd Z
d Zd Zd Z xZS )	Compositea)  
    A Parameter that is a composite of a set of other attributes of the class.

    The constructor argument 'attribs' takes a list of attribute
    names, which may or may not be Parameters.  Getting the parameter
    returns a list of the values of the constituents of the composite,
    in the order specified.  Likewise, setting the parameter takes a
    sequence of values and sets the value of the constituent
    attributes.

    This Parameter type has not been tested with watchers and
    dependencies, and may not support them properly.
    attribsr   NFT)r  r   r   r   r   r   r-   r   r   r   r   r   c                     y r/   r=   )rz   r  r   r   r   r   r   r-   r   r   r   r   r   s                r(   r   zComposite.__init__  r  r*   )r  c                R    |t         u rg }t        |   ddt         i| || _        y rW  )r   r   r   r  )rz   r  kwrx   s      r(   r   zComposite.__init__  s,    iG11b1r*   c                     |$| j                   D cg c]  }t        ||       c}S | j                   D cg c]  }t        ||       c}S c c}w c c}w )z0Return the values of all the attribs, as a list.)r  r#   )rz   r   r   as       r(   r   zComposite.__get__  sN    ;15>AGGQ'>>-1\\:\GCO\:: ?:s
   AAc           	          t        |      t        |      k(  ry t        t        |        dt        |       dt        |       d      )Nz( got the wrong number of values (needed z
, but got r  )rL   r-  r   )rz   r   r  s      r(   _validate_attribszComposite._validate_attribs  sM    s8s7|#%d+, -!!$WjS
"F
 	
r*   c                 <    | j                  || j                         y r/   )r  r  r   s     r(   r  zComposite._validate  s    sDLL1r*   c                     |6t        | j                  |      D ]  \  }}t        | j                  ||        y t        | j                  |      D ]  \  }}t        |||        y r/   )r  r  setattrr   )rz   r   r   r  rV   s        r(   r  zComposite._post_setter  sW    ;DLL#.1a+ / DLL#.1Q" /r*   )r   r   r   r   rF  r  r  r   r   r   r   r  r  r  r   r   s   @r(   r  r    st     I&I__ d$4UTPTe   "+   ;
2#r*   r  c                       e Zd ZdZdZd Zy)SelectorBasezx
    Parameter whose value must be chosen from a list of possibilities.

    Subclasses must implement get_range().
    Tc                     t        d      )Nz.get_range() must be implemented in subclasses.)NotImplementedErrorr   s    r(   	get_rangezSelectorBase.get_range4  s    !"RSSr*   N)r   r   r   r   _SelectorBase__abstractr  r=   r*   r(   r  r  +  s     JTr*   r  c                        e Zd ZdZd fd	Zd Zedd       Z fdZd fd	Z	 fdZ
d Z fd	Zd
 Z fdZ fdZddZ fdZd Zd Z fdZ fdZd Zd Z xZS )	ListProxyz
    Container that supports both list-style and dictionary-style
    updates. Useful for replacing code that originally accepted lists
    but needs to support dictionary access (typically for naming
    items).
    c                 2    t         |   |       || _        y r/   )r   r   
_parameter)rz   iterable	parameterrx   s      r(   r   zListProxy.__init__@  s    "#r*   c                     t        | j                        j                  }t               j	                  dj                  ||             y )Nz{clsname}.objects{method} is deprecated if objects attribute was declared as a dictionary. Use `{clsname}.objects[label] = value` instead.)clsnamemethod)r\   r  r   r   r"   format)rz   r  r
  s      r(   _warnzListProxy._warnD  s9    t'00  &wv F	
r*   c              #   h  K   d| j                   j                  v xr |}t        | j                   j                        xs t	        | j                   j
                        }d  |rL| j                   j                  xs | j                   j
                  }| j                   j                  d||       y y w)Nr   )r  watchersr?   namesrO   _objects_trigger_event)rz   triggeroldr`   s       r(   _triggerzListProxy._triggerL  s     t777CG4??(()KT$//2J2J-KOO))ET__-E-EEOO**9c5A s   B0B2c                     | j                   j                  r| j                   j                  |   S t        |   |      S r/   )r  r  r   __getitem__)rz   indexrx   s     r(   r  zListProxy.__getitem__U  s5    ??  ??((//w"5))r*   c                 @   t        |t        t        f      rj| j                  j                  r| j                  d       | j                         5  t        | !  ||       || j                  j                  |<   d d d        y | r0| j                  j                  st        |       | j                  _        | j                  |      5  || j                  j                  v rT| j                  j                  |   }| j                  |      }t        | !  ||       || j                  j                  |<   n4t        | 1  |       | j                  j                  j                  |       || j                  j                  |<   d d d        y # 1 sw Y   y xY w# 1 sw Y   y xY w)Nz[index] = object)r6   rC   slicer  r  r  r  r   __setitem__r  r   r  r   )rz   r  objectr  r  idxrx   s         r(   r  zListProxy.__setitem__Z  s7   ec5\*$$

-.#E6228((/ ! --$/$5DOO!]]7#---oo++E2jjo#C006((-v&((//7+1DOO!!%( $# !  $#s   *FB:FFFc                     t         |   |      }| j                  j                  r4|t        u r,t        t        | j                  j                  |             |k(  S |S r/   )r   r|   r  r  NotImplementedr?   r  )rz   r{   eqrx   s      r(   r|   zListProxy.__eq__o  sK    W^E"??  R>%9DOO11489UBB	r*   c                 &    | j                  |       S r/   )r|   ry   s     r(   r~   zListProxy.__ne__u  s    ;;u%%%r*   c                    | j                   j                  r| j                  d       | j                         5  t        |   |       | j                   j                  j                  |       d d d        y # 1 sw Y   y xY wNz.append)r  r  r  r  r   r   r  )rz   r  rx   s     r(   r   zListProxy.appendx  sS    ??  JJy!]]_GN6"OO$$++F3 __   5A77B c                     | j                   j                  r$| j                   j                  j                         S t        |       S r/   )r  r  ra   rO   r   s    r(   ra   zListProxy.copy  s2    ??  ??((--//Dzr*   c                     | j                         5  t        | 	          | j                  j                  j                          | j                  j
                  j                          d d d        y # 1 sw Y   y xY wr/   )r  r   clearr  r  r  rz   rx   s    r(   r'  zListProxy.clear  sK    ]]_GMOOO$$**,OO!!'') __s   AA22A;c                    | j                   j                  r| j                  d       | j                         5  t        |   |       | j                   j                  j                  |       d d d        y # 1 sw Y   y xY wr#  )r  r  r  r  r   extendr  )rz   r   rx   s     r(   r*  zListProxy.extend  sS    ??  JJy!]]_GN7#OO$$++G4 __r$  c                     | j                   j                  r&| j                   j                  j                  ||      S t        |       j                  ||      S r/   )r  r  r   r   )rz   keyr,   s      r(   r   zListProxy.get  sD    ??  ??((,,S'::4 $$S'22r*   c                 
   | j                   j                  r| j                  d       | j                         5  t        |   ||       | j                   j                  j                  ||       d d d        y # 1 sw Y   y xY w)Nz.insert)r  r  r  r  r   insertr  )rz   r  r  rx   s      r(   r.  zListProxy.insert  sW    ??  JJy!]]_GN5&)OO$$++E6: __s   7A99Bc                     | j                   j                  r$| j                   j                  j                         S t        |       j                         S r/   )r  r  r>   r   r   s    r(   r>   zListProxy.items  s<    ??  ??((..004 &&((r*   c                     | j                   j                  r$| j                   j                  j                         S t        |       j                         S r/   )r  r  keysr   r   s    r(   r1  zListProxy.keys  s<    ??  ??((--//4 %%''r*   c                    |r|d   nd}t        |t              r| j                         5  t        |   |       | j
                  j                  j	                  |      }| j
                  j                  rK| j
                  j                  j                         D ci c]  \  }}||u r|| c}}| j
                  _        d d d        y | r!| j
                  j                  st        d      | j                         5   | j
                  j                  j                  | }t        | )  |       | j
                  j                  j                  |       d d d        |S c c}}w # 1 sw Y   y xY w# 1 sw Y   S xY w)Nr   r   zXCannot pop an object from {clsname}.objects if objects was not declared as a dictionary.)r6   rC   r  r   r   r  r  r  r>   r-  remove)rz   r   r  r  r'   rV   rx   s         r(   r   zListProxy.pop  s;   QReS!E"1155e<??(()-)>)>)D)D)F-)FA; 1)F-DOO)	 ! --<  ]]_.T__**..5FGN6"OO$$++F3  -	 !   s+   A2E%E.E%=AE1E%%E.1E;c           	         | j                         5  t        | 	  |       | j                  j                  j                  |       | j                  j
                  r| j                  j
                  j                         }| j                  j
                  j                          | j                  j
                  j                   |j                         D ci c]  \  }}||us|| c}}       d d d        y c c}}w # 1 sw Y   y xY wr/   )
r  r   r3  r  r  r  ra   r'  updater>   )rz   r  ra   r'   rV   rx   s        r(   r3  zListProxy.remove  s    ]]_GN6"OO$$++F3$$,,113%%++-%%,,%/TZZ\.%1TQQf_AqD\.  _. _s$   CDC;%C;*D;DD
c           	      d   | j                   j                  st        |       | j                   _        t        |t              r|j                         n|}| j                         5  t        |      D ]~  \  }}t        |t        j                  j                        st        d| d      t        |      }t        |      }|dk7  rt        d| d| d      |\  }}| j                  ||d        |j                         D ]  \  }}| j                  ||d        	 d d d        y # 1 sw Y   y xY w)	Nz3cannot convert dictionary update sequence element #z to a sequencer4   z$dictionary update sequence element #z has length z; 2 is requiredF)r  )r  r  r   r6   r?   r>   r  	enumeratecollectionsabcSequence	TypeErrorrI   rL   r-  r  )rz   r   r>   ir&   r  r'   rV   s           r(   r5  zListProxy.update  s   $$$/$5DOO!%/%>'--/G]]_!'*1!![__%=%=>#MaSP^_  !HF6$>qcaSP_`  1  Au 5 + 1  Au 5 & __s   #B9D&&D/c                     | j                   j                  r$| j                   j                  j                         S t        |       j                         S r/   )r  r  r  r   r   s    r(   r  zListProxy.values  s<    ??  ??((//114 ''))r*   r/   )T)r   r   r   r   r   r  r   r  r  r  r|   r~   r   ra   r'  r*  r   r.  r>   r1  r   r3  r5  r  r   r   s   @r(   r  r  8  sx    $
 B B*
2*&4
*53
;)
(
.	6**r*   r  c                   ,    e Zd ZdZd Zd Zed        Zy)__compute_selector_defaultaK  
    Using a function instead of setting default to [] in _slot_defaults, as
    if it were modified in place later, which would happen with check_on_set set to False,
    then the object in _slot_defaults would itself be updated and the next Selector
    instance created wouldn't have [] as the default but a populated list.
    c                     g S r/   r=   r	  s     r(   r   z#__compute_selector_default.__call__  s    	r*   c                 ,    t        | j                        S r/   r  r   s    r(   r   z#__compute_selector_default.__repr__  r  r*   c                     g S r/   r=   r   s    r(   r  z__compute_selector_default.sig  s    	r*   Nr  r=   r*   r(   r?  r?    s%      r*   r?  c                   (    e Zd Zd Zd Zed        Zy)#__compute_selector_checking_defaultc                 2    t        |j                        dk7  S )Nr   )rL   r   r	  s     r(   r   z,__compute_selector_checking_default.__call__  s    199~""r*   c                 ,    t        | j                        S r/   r  r   s    r(   r   z,__compute_selector_checking_default.__repr__  r  r*   c                      y r/   r=   r   s    r(   r  z'__compute_selector_checking_default.sig   r  r*   Nr  r=   r*   r(   rD  rD    s     #  r*   rD  c            	       Z     e Zd Z eej
                  ededdd      Ze fd       Z	 xZ
S )_SignatureSelectorNF)r  compute_default_fncheck_on_setr   r   r,   c                 L    t         |          }|j                  d      |d<   |S )Nr  r   )r   _modified_slots_defaultsr   )rg  defaultsrx   s     r(   rM  z+_SignatureSelector._modified_slots_defaults  s(    735&ll:6r*   )r   r   r   r?   r  rG  _compute_selector_default"_compute_selector_checking_defaultrm  rM  r   r   s   @r(   rI  rI    s:    ##.G.PUDN  r*   rI  c                        e Zd ZdZg dZej                  g ddddddddddddddddd       Zee	e	e	e	e	e	dd fd	
       Zd
 Z
ed        Zej                  d        Zd Zd Zd Zd Zd Z xZS )Selectora  
    Parameter whose value must be one object from a list of possible objects.

    By default, if no default is specified, picks the first object from
    the provided set of objects, as long as the objects are in an
    ordered data collection.

    check_on_set restricts the value to be among the current list of
    objects. By default, if objects are initially supplied,
    check_on_set is True, whereas if no objects are initially
    supplied, check_on_set is False. This can be overridden by
    explicitly specifying check_on_set initially.

    If check_on_set is True (either because objects are supplied
    initially, or because it is explicitly specified), the default
    (initial) value must be among the list of objects (unless the
    default value is None).

    The list of objects can be supplied as a list (appropriate for
    selecting among a set of strings, or among a set of objects with a
    "name" parameter), or as a (preferably ordered) dictionary from
    names to objects.  If a dictionary is supplied, the objects
    will need to be hashable so that their names can be looked
    up from the object value.

    empty_default is an internal argument that does not have a slot.
    )r  rJ  rK  r  NFT)r   r,   r   rJ  rK  r   empty_defaultr   r   r   r-   r   r   r   r   r   c                     y r/   r=   )rz   r   r,   r   rJ  rK  r   rS  r   r   r   r-   r   r   r   r   r   s                    r(   r   zSelector.__init__5  r  r*   )r   r,   r   rJ  rK  r   rS  c                   t         }	|t         urD|rBt        |t              rt        |j	                               d   }	nt        |t              r|d   }	|s
|t         u r|	n|}|| _        || _        || _        t        
| $  d||d| |t         u r| j                  d   | _        n|| _        | j                  | j                  | j                         | j                          y )Nr   r,   r   r   r=   )r   r6   r?   rO   r  r   rJ  rK  r   r   rG  r   r,   r6  _update_state)rz   r   r,   r   rJ  rK  r   rS  rU   autodefaultrx   s             r(   r   zSelector.__init__A  s    
  )#'4("7>>#34Q7GT*%aj&398L+SZ"4( 	@	@8>	@ ""11,?DO(DO<<#  .r*   c                 r    | j                   du r)| j                  | j                  | j                         y y y r   rK  r,   _ensure_value_is_in_objectsr   s    r(   rW  zSelector._update_state^  s4    %$,,*B,,T\\: +C%r*   c                 .    t        | j                  |       S r/   )r  r  r   s    r(   r   zSelector.objectsb  s    --r*   c                     t        |t        j                  j                        r&|| _        t        |j                               | _        y i | _        || _        y r/   )r6   r8  r9  Mappingr  rO   r  r  )rz   r   s     r(   r   zSelector.objectsf  s>    g{667 DJ !12DMDJ#DMr*   c                     | j                   Gt        | j                        r1| j                         | _         | j                  | j                          yyy)z
        If this parameter's compute_default_fn is callable, call it
        and store the result in self.default.

        Also removes None from the list of objects (if the default is
        no longer None).
        N)r,   r   rJ  r[  r   s    r(   compute_defaultzSelector.compute_defaultr  sF     <<HT-D-D$E224DL,,T\\: %Fr*   c                 b    | j                   s| j                  |       y | j                  |       y r/   )rK  r[  r6  r   s     r(   r  zSelector._validate~  s*      ,,S1S!r*   c                 R   | j                   r| j                  r||| j                  vr}g }d}d}| j                  D ]5  }t        |      }|t	        |      z  }|dk  r|j                  |       3d} n ddj                  |      z   |z   }t        t        |        d|d|      y y y )	Nr  r      z, ...]r  r  z does not accept z; valid options include: )	rK  r   r   rG   rL   r   joinr-  r   )rz   r   r>   limiterr  itemstrings          r(   r6  zSelector._validate_value  s    doo#+3VZVbVbKbEGFT#f+%C<LL(&G % $))E**W4E)$/00A# I**/4  Lc+r*   c                 X    || j                   vr| j                  j                  |       yy)z
        Make sure that the provided value is present on the objects list.
        Subclasses can override if they support multiple items on a list,
        to check each item instead.
        N)r   r  r   r   s     r(   r[  z$Selector._ensure_value_is_in_objects  s'     dll"MM  % #r*   c                 B    t        | j                  | j                        S )z
        Return the possible objects to which this parameter could be set.

        (Returns the dictionary {object.name: object}.)
        )r   r  r  r   s    r(   r  zSelector.get_range  s     4==$**55r*   )r   r   r   r   rF  r  r  r   r   r   rW  r  r   setterr`  r  r6  r[  r  r   r   s   @r(   rR  rR    s    8 LI__ t4d%!TY   "+YI$-I%U  8; . . ^^$ $
;"&&6r*   rR  c                        e Zd ZdZej
                  	 d	g dddddddddddddddd       Zeefed fd       Z xZ	S )
ObjectSelectorzd
    Deprecated. Same as Selector, but with a different constructor for
    historical reasons.
    NFTr   r   rJ  rK  r   rS  r   r   r   r-   r   r   r   r   r   c                     y r/   r=   rz   r,   r   r   rJ  rK  r   rS  r   r   r   r-   r   r   r   r   r   s                    r(   r   zObjectSelector.__init__  r  r*   r   c                ,    t        |   d||dd| y NT)r   r,   rS  r=   rQ  rz   r,   r   rT   rx   s       r(   r   zObjectSelector.__init__  s$     	7''+	7/5	7r*   r/   )
r   r   r   r   r  r  r   r   r   r   r   s   @r(   rl  rl    sk    
 __ !#4d%!TY   ( 7Y 7  7r*   rl  c                        e Zd ZdZdgZ eej                  d      Zej                  	 ddg dddddddddddddddd	       Z
eefed fd
       Z
 fdZefdZ fdZ xZS )FileSelectorzFGiven a path glob, allows one file to be selected from those matching.path rv  NFT)rv  r   r   rJ  rK  r   rS  r   r   r   r-   r   r   r   r   r   c                     y r/   r=   )rz   r,   rv  r   r   rJ  rK  r   rS  r   r   r   r-   r   r   r   r   r   s                     r(   r   zFileSelector.__init__  r  r*   c                    || _         || _        | j                  |       |t        ur|| _         t	        |   d| j                   | j                  d| y Nrx  )r,   r   r=   )r,   rv  r5  r   r   r   r  rz   r,   rv  rT   rx   s       r(   r   zFileSelector.__init__  sM    	)#"DLOt}}OOr*   c                 X    t         |   |||       |dk(  r| j                  |       y y Nrv  rx  r   _on_setr5  rz   	attributer  newrx   s       r(   r  zFileSelector._on_set  .    	3,KKSK! r*   c                 ^   |t         u r| j                  }|dk(  rg | _        nKt        j                  t        j                  |            }t        t        j                  |            | _        | j                  | j                  v ry | j                  r| j                  d   | _	        y d | _	        y )Nrw  r   )
r   rv  r   osfspathpathlibPathsortedglobr,   )rz   rv  pathpatterns      r(   r5  zFileSelector.update  s}    999D2:DL ))GLL$67K!$))K"89DL<<4<<'*.,,t||ADr*   c                 H    t        | j                  t        |                S r/   r   rv  r   r  r(  s    r(   r  zFileSelector.get_range       57+<+>??r*   r/   r   r   r   r   rF  r?   rR  rG  r  r  r   r   r   r  r5  r  r   r   s   @r(   ru  ru    s    PIbN __  "%TXd%!TY   ( P) P  P"
 $ A@ @r*   ru  c                        e Zd ZdZej
                  	 dg dddddddddddddddd       Zeefed fd       Zd	 Z	d
 Z
d Z fdZd Z xZS )ListSelectorzj
    Variant of Selector where the value can be multiple objects from
    a list of possible objects.
    NFTrm  c                     y r/   r=   ro  s                    r(   r   zListSelector.__init__  r  r*   rp  c                ,    t        |   d||dd| y rr  rQ  rs  s       r(   r   zListSelector.__init__  s'     	LWD	LDJ	Lr*   c                     | j                   gt        | j                        rQ| j                         | _         | j                   D ],  }|| j                  vs| j                  j	                  |       . y y y r/   )r,   r   rJ  r   r   rz   r&   s     r(   r`  zListSelector.compute_default  s^    <<HT-D-D$E224DL\\DLL(LL''* " %Fr*   c                     || j                   ry | j                  |       | j                  r| j                  |       y |D ]  }| j	                  |        y r/   )r   _validate_typerK  r6  r[  )rz   r   rV   s      r(   r  zListSelector._validate  sM    KDOOC   %003 r*   c                 X    t        |t              st        t        |        d|d      y )Nz only takes list types, not r,  )r6   rO   r-  r   r   s     r(   r  zListSelector._validate_type  s:    #t$)$/0 1gQ   %r*   c                 Z    | j                  |       ||D ]  }t        | 	  |        y y r/   )r  r   r6  )rz   r   r&   rx   s      r(   r6  zListSelector._validate_value!  s2    C ?'*  r*   c                     | j                   du r0| j                  #| j                  D ]  }| j                  |        y y y r   rZ  r  s     r(   rW  zListSelector._update_state'  s>    %$,,*B\\003 " +C%r*   r/   )r   r   r   r   r  r  r   r   r   r`  r  r  r6  rW  r   r   s   @r(   r  r    s    
 __ !#4d%!TY   ( LY L  L+	4+4r*   r  c                        e Zd ZdZdgZ eej                  d      Zej                  	 ddg dddddddddddddddd	       Z
eefed fd
       Z
 fdZefdZ fdZ xZS )MultiFileSelectorzQGiven a path glob, allows multiple files to be selected from the list of matches.rv  rw  rx  NFT)rv  r   rJ  rK  r   rS  r   r   r   r   r-   r   r   r   r   r   c                     y r/   r=   )rz   r,   rv  r   rJ  rK  r   rS  r   r   r   r   r-   r   r   r   r   r   s                     r(   r   zMultiFileSelector.__init__6  s     	r*   c                ~    || _         || _        | j                  |       t        |   d|| j
                  d| y r{  )r,   rv  r5  r   r   r  r|  s       r(   r   zMultiFileSelector.__init__A  s:    	J$--J6Jr*   c                 X    t         |   |||       |dk(  r| j                  |       y y r~  r  r  s       r(   r  zMultiFileSelector._on_setH  r  r*   c                 0   |t         u r| j                  }t        t        j                  |            | _        | j
                  r0t        | j
                  D cg c]  }|| j                  v  c}      ry | j
                  sy | j                  | _        y c c}w r/   )r   rv  r  r  r   r,   rJ   )rz   rv  r&   s      r(   r5  zMultiFileSelector.updateM  so    999Ddiio.<<CDLL ILqdll!2L IJ||	 !Js   Bc                 H    t        | j                  t        |                S r/   r  r(  s    r(   r  zMultiFileSelector.get_rangeW  r  r*   r/   r  r   s   @r(   r  r  -  s    [IbN __  "d%5Te   ( K) K  K"
 $ $@ @r*   r  c                        e Zd ZdZddgZ eej                  dd      Zej                  ddddddddddddddd	       Z
eeeed
 fd
       Z
 fdZd Zd Z xZS )ClassSelectora5  
    Parameter allowing selection of either a subclass or an instance of a class or tuple of classes.
    By default, requires an instance, but if is_instance=False, accepts a class instead.
    Both class and instance values respect the instantiate slot, though it matters only
    for is_instance=True.
    class_is_instanceT)r   r  NF)r,   r   r  r   r   r   r   r-   r   r   r   r   r   c                     y r/   r=   )rz   r  r,   r   r  r   r   r   r   r-   r   r   r   r   r   s                  r(   r   zClassSelector.__init__g  r  r*   )r,   r   r  c                |    || _         || _        t        |   d||d| | j	                  | j
                         y )NrV  r=   )r  r  r   r   r  r,   )rz   r  r,   r   r  rU   rx   s         r(   r   zClassSelector.__init__q  s9    &J[J6Jt||$r*   c                 r    t         |   |       | j                  || j                  | j                         y r/   )r   r  _validate_class_r  r  r  s     r(   r  zClassSelector._validatex  s,    #c4;;0@0@Ar*   c           
      *   || j                   ry |rt        ||      s|st        ||      ry t        |t              r(dj	                  dj                  d |D                    }n|j                  }t        t        |        d|rdnd d| d|d	      )
Nz({})r  c              3   4   K   | ]  }|j                     y wr/   )r   )r1   cls     r(   r3   z1ClassSelector._validate_class_.<locals>.<genexpr>  s     1O""++s   z value must be zan instancez
a subclassz of r+  r,  )	r   r6   
issubclassr   r  rd  r   r-  r   )rz   r   r  r  
class_names        r(   r  zClassSelector._validate_class_|  s    KDOOJsF3[ZX[]cMdfh' --		1O1O(OPJJ%d+,O +}>d:,fUXT[[\^
 	
r*   c                    t        | j                  t              r| j                  n| j                  f}i }|D ]  }|j                  t	        |              t        d |j                         D              }| j                  rd|d<   |S )a%  
        Return the possible types for this parameter's value.

        (I.e. return `{name: <class>}` for all classes that are
        concrete_descendents() of `self.class_`.)

        Only classes from modules that have been imported are added
        (see concrete_descendents()).
        c              3   *   K   | ]  \  }}||f  y wr/   r=   )r1   r    r  s      r(   r3   z*ClassSelector.get_range.<locals>.<genexpr>  s     N:M;4v:Ms   NNone)r6   r  rI   r5  r   r   r>   r   )rz   classesall_classesrg  r%   s        r(   r  zClassSelector.get_range  ss     ",DKK!?$++dkk^C3C89 N+:K:K:MNN??AfIr*   )r   r   r   r   rF  r?   r  rG  r  r  r   r   r   r  r  r  r   r   s   @r(   r  r  [  s     =)I,554UYZN__  Ttd$4TPTe   *3Xa %  %B
 r*   r  c                   j     e Zd ZdZej
                  	 ddddddddddddddd       Zef fd	Z xZS )	rH   z&Parameter whose value is a dictionary.NTFr  r   r   r   r   r   r-   r   r   r   r   r   c                     y r/   r=   rz   r,   r  r   r   r   r   r   r-   r   r   r   r   r   s                 r(   r   zDict.__init__  r  r*   c                 2    t        |   d|t        d| y )Nr,   r  r=   )r   r   r?   r   s      r(   r   zDict.__init__  s    @@@r*   r/   )	r   r   r   r   r  r  r   r   r   r   s   @r(   rH   rH     sT    0__ %)d$4TTPTe   ) A Ar*   rH   c                        e Zd ZdZej
                  	 d
dddddddddddddd       Zef fd	Zed        Z	ed	        Z
 xZS )rS   z'Parameter whose value is a numpy array.NTFr  c                     y r/   r=   r  s                 r(   r   zArray.__init__  r  r*   c                 6    ddl m} t        |   d||d| y )Nr   r8   r  r=   )r7   r9   r   r   )rz   r,   rU   r9   rx   s       r(   r   zArray.__init__  s    !CCFCr*   c                 (    |y |j                         S r/   )tolistrf  s     r(   rh  zArray.serialize  s    =||~r*   c                     |dk(  s|y dd l t        |t              rt        j                  fdd|d      S j                  |      S )Nrj  r   c                 8    j                  t        |             S r/   )loadtxtrG   )xr7   s    r(   <lambda>z#Array.deserialize.<locals>.<lambda>  s    u}}SV7Lr*   )z.npyz.txtrS   )r7   r6   rG   r   loadasarray)rg  r`   r7   s     @r(   rl  zArray.deserialize  sN    F?emeS!)-LMw 
 ==''r*   r/   )r   r   r   r   r  r  r   r   rm  rh  rl  r   r   s   @r(   rS   rS     sv    1__ %)d$4TTPTe   ) D  
 
( 
(r*   rS   c                        e Zd ZdZg dZ eej                  ddd      Zej                  	 dddddddddddddddddd       Z
eefeeed fd       Z
d	 Z fd
Zed        Zed        Z xZS )r;   a  
    Parameter whose value is a pandas DataFrame.

    The structure of the DataFrame can be constrained by the rows and
    columns arguments:

    rows: If specified, may be a number or an integer bounds tuple to
    constrain the allowable number of rows.

    columns: If specified, may be a number, an integer bounds tuple, a
    list or a set. If the argument is numeric, constrains the number of
    columns using the same semantics as used for rows. If either a list
    or set of strings, the column names will be validated. If a set is
    used, the supplied DataFrame must contain the specified columns and
    if a list is given, the supplied DataFrame must contain exactly the
    same columns and in the same order and no other columns.
    )rowscolumnsorderedNTF)r  r  r  r  r   r   r   r   r   r-   r   r   r   r   r   c                     y r/   r=   )rz   r,   r  r  r  r  r   r   r   r   r   r-   r   r   r   r   r   s                    r(   r   zDataFrame.__init__  r  r*   c                    ddl m} || _        || _        || _        t        |   d||d| | j                  | j                         y )Nr   )r;   r  r=   )	r:   r;   r  r  r  r   r   r  r,   )rz   r,   r  r  r  rU   rX   rx   s          r(   r   zDataFrame.__init__  sB    0	DDVDt||$r*   c                     | d| d| }t        |t              s||k7  rt        t        |        d|       y |\  }}|d uxr ||k  xs |d uxr ||kD  }|rt        t        |        d|       y Nz length z# does not match declared bounds of z: r6   rI   r-  r   rz   rb   r  r    messager  r  failures           r(   _length_bounds_checkzDataFrame._length_bounds_check	      F(6(*MfXV&%(&  $:4$@#AG9!MNN%:6E> =D(;Ve^ 	 6t <=RyIJJ r*   c           	      4   t         |   |       t        | j                  t              r%| j
                  du rt        t        |        d      | j                  r|y | j                  nt        | j                  t              rft        | j                        dk(  rNt        d | j                  D              r2| j                  | j                  t        |j                        d       nt        | j                  t        t        f      r| j
                  t        | j                  t              n| j
                  | _        t	        | j                        |j                  D ch c]  }t        |       c}z
  }|rrt        t        |        dt        |j                         dt        | j                               | j                  | j                  t        |j                        d       | j
                  rdt        |j                        t        | j                        k7  r9t        t        |        dt        |j                         d	| j                         | j                   '| j                  | j                   t        |      d
       y y c c}w )NTz3: columns cannot be ordered when specified as a setr4   c              3   f   K   | ])  }t        |t        d       t        j                  f       + y wr/   )r6   r\   numbersrF   )r1   rV   s     r(   r3   z&DataFrame._validate.<locals>.<genexpr>	  s%     X<ajT$Z$@A<s   /1r  z: provided columns z# does not contain required columns columnz must exactly match row)r   r  r6   r  r  r  r-  r   r   rI   rL   rJ   r  rO   rG   r  r  )rz   r   r2   
differencerx   s       r(   r  zDataFrame._validate	  s   #dllC(T\\T-A)$/0 1* + 
 ??s{<<u-#dll2CQ2FX4<<XX%%dllC4DiPtSk2=A\\=Q:dllD9W[WcWcDLT\\*-L"c"g-LLJ -d344GCKK() *%dll346  %%dllC4DhO<<CKK D$66 -d344GCKK())=dll^M  99 %%diiS5A !! .Ms   &Jc                 *    |y |j                  d      S )Nrecords)to_dictrf  s     r(   rh  zDataFrame.serialize5	  s    =}}Y''r*   c                 t   |dk(  s|y dd l t        |t              rt        j                  j
                  j                  j                  j                  j                  j                  j                  j                  fdj                  j                  d|d      S j                  |      S )Nrj  r   c                 *    j                  | d      S )N	)sep)read_csv)r  r:   s    r(   r  z'DataFrame.deserialize.<locals>.<lambda>L	  s    fooaTo&Br*   )z.csvz.dtaz.featherz.h5z.hdf5z.jsonz.odsz.parquetz.pklz.tsvz.xlsmz.xlsxr;   )r:   r6   rG   r   r  
read_stataread_featherread_hdf	read_json
read_excelread_parquetread_pickler;   )rg  r`   r:   s     @r(   rl  zDataFrame.deserialize;	  s    F?emeS!)"OO"-- & 3 3!??#__#--"-- & 3 3"..B#..#.. +' '  ##E**r*   r/   )r   r   r   r   rF  r?   r  rG  r  r  r   r   r   r  r  rm  rh  rl  r   r   s   @r(   r;   r;     s    $ /I$$4tN __ "D$Dd$4TTPTe   ( %)YXa %  %K$BL ( (
 + +r*   r;   c                        e Zd ZdZdgZ eej                  dd      Zej                  	 dddddddddddddddd       Z
eefeed fd	       Z
d
 Z fdZ xZS )r<   z
    Parameter whose value is a pandas Series.

    The structure of the Series can be constrained by the rows argument
    which may be a number or an integer bounds tuple to constrain the
    allowable number of rows.
    r  NF)r  r   T)r  r   r  r   r   r   r   r-   r   r   r   r   r   c                     y r/   r=   )rz   r,   r  r   r  r   r   r   r   r-   r   r   r   r   r   s                  r(   r   zSeries.__init__c	  r  r*   c                |    ddl m} || _        t        |   d|||d| | j                  | j                         y )Nr   )r<   )r,   r  r   r=   )r:   r<   r  r   r   r  r,   )rz   r,   r  r   rU   rY   rx   s         r(   r   zSeries.__init__m	  s=    -	 	#j 	#!	#t||$r*   c                     | d| d| }t        |t              s||k7  rt        t        |        d|       y |\  }}|d uxr ||k  xs |d uxr ||kD  }|rt        t        |        d|       y r  r  r  s           r(   r  zSeries._length_bounds_checku	  r  r*   c                     t         |   |       | j                  r|y | j                  '| j	                  | j                  t        |      d       y y )Nr  )r   r  r   r  r  rL   r  s     r(   r  zSeries._validate	  sG    #??s{99 %%diiS5A !r*   r/   )r   r   r   r   rF  r?   r  rG  r  r  r   r   r   r  r  r   r   s   @r(   r<   r<   T	  s     I$$4EN __ "u$4TPTe   ( %)	 %  %KB Br*   r<   c                       e Zd ZdZg dZ eej                  ddddg       Zej                  g fdddddddddddddddd	       Z
eefeeeed
d       Z
d Zd Zd Zd Zy)rP   a  
    Parameter whose value is a list of objects, usually of a specified type.

    The bounds allow a minimum and/or maximum length of
    list to be enforced.  If the item_type is non-None, all
    items in the list are checked to be of that type.

    `class_` is accepted as an alias for `item_type`, but is
    deprecated due to conflict with how the `class_` slot is
    used in Selector classes.
    )rb   	item_typer  N)r   NT)r  r  rb   r   r,   F)r  r  r   rb   r   r   r   r   r-   r   r   r   r   r   c                     y r/   r=   )rz   r,   r  r  r   rb   r   r   r   r   r-   r   r   r   r   r   s                   r(   r   zList.__init__	  r  r*   )r  r  r   rb   c                F   |t         urt        j                  dt        d       |t         ur|t         ur|| _        n|t         u s||| _        n|| _        | j                  | _        || _        t        j                  | f||d| | j                  | j                         y )NzGThe 'class_' attribute on 'List' is deprecated. Use instead 'item_type'   )r  category
stacklevelrV  )r   warningsr   _ParamFutureWarningr  r  rb   r   r   r  r,   )rz   r,   r  r  r   rb   rU   s          r(   r   zList.__init__	  s     "MMa,
 I%&	*A&DN)#y'8#DN&DNnn4 	%k 	%#	%t||$r*   c                     | j                  || j                         | j                  || j                         | j	                  || j
                         yr=  )r6  r   r0  rb   _validate_item_typer  r   s     r(   r  zList._validate	  s@    
 	S$//2c4;;/  dnn5r*   c           
      >   ||| j                   ry|\  }}t        |      }|0|.||cxk  r|k  s"n t        t        |        d| d| d| d      y|#||k  st        t        |        d| d| d      y|#||k  st        t        |        d| d| d      yy)	zGChecks that the list is of the right length and has the right contents.Nz length must be between z and z (inclusive), not r,  z length must be at least r+  z length must be at most r  )rz   r   rb   
min_length
max_lengthrr   s         r(   r0  zList._validate_bounds	  s   >ckdoo!'
JH!j&<!1z1 -d344L!l%
|3EaSK  2
 #? -d34 5'Lqc4  #
 #
? -d34 5&<vaS3  # $r*   c                 t    |r|y t        |t              s#t        t        |        dt	        |       d      y )Nz" must be a list, not an object of r,  )r6   rO   r-  r   r\   r5  s      r(   r6  zList._validate_value	  sH    #+#t$)$/0 1!#YKq*  %r*   c           
          || j                   r|y |D ]4  }t        ||      rt        t        |        d|dt	        |       d       y )Nz items must be instances of r+  r,  )r   r6   r;  r   r\   )rz   r   r  rV   s       r(   r  zList._validate_item_type	  s_    S[A!Y')$/0 1]&a	4  r*   )r   r   r   r   rF  r?   r   rG  r  r  r   r   r   r  r0  r6  r  r=   r*   r(   rP   rP   	  s    
 2I  i"N
 __ "dYd$4TPTe   ( %I&y%  %*62	r*   rP   c                   *     e Zd ZdZddgZ fdZ xZS )HookListz
    Parameter whose value is a list of callable objects.

    This type of List Parameter is typically used to provide a place
    for users to register a set of commands to be called at a
    specified place in some sequence of processing steps.
    r  rb   c                     t         |   ||       |r|y |D ]'  }t        |      rt        t	        |        d|d       y )Nz items must be callable, not r,  )r   r6  r   r-  r   )rz   r   r   rV   rx   s       r(   r6  zHookList._validate_value
  sY    Z0#+A{)$/0 1e1  r*   )r   r   r   r   rF  r6  r   r   s   @r(   r   r   	  s     8$I
 
r*   r   c                   d    e Zd ZdZ e ej                         gdd      Z edddd      Z	d Z
y	)
resolve_patha<  
    Find the path to an existing file, searching the paths specified
    in the search_paths parameter if the filename is not absolute, and
    converting a UNIX-style path to the current OS's format if
    necessary.

    To turn a supplied relative path into an absolute one, the path is
    appended to paths in the search_paths parameter, in order, until
    the file is found.

    An IOError is raised if the file is not found.

    Similar to Python's os.path.abspath(), except more search paths
    than just os.getcwd() can be used, and the file must exist.
    FzS
        Prepended to a non-relative path, in order, until a file is
        found.r,   r   r   Tz
        String specifying whether the path refers to a 'File' or a
        'Folder'. If None, the path may point to *either* a 'File' *or*
        a 'Folder'.)r,   r   r   r   c                    t        | |      }t        j                  j                  |      }|j                  du rdn|j                  du rdnd}|j
                  st        j                         g|_        t        j                  j                  |      r|j                  t        j                  j                  |      sZ|j                  du rt        j                  j                  |      s-|j                  du r!t        j                  j                  |      r|S t        | d| d      g }|j
                  D ]  }t        j                  j                  t        j                  j                  |      |      }|j                  t        j                  j                  |      sZ|j                  du rt        j                  j                  |      s-|j                  du r#t        j                  j                  |      r|c S |j                  |        t        |dz   t        j                  j                  |      d	   z   d
z   t        |      z   dz         )NTFileFFolderr  z 'z' not found.r  r   z* was not found in the following place(s): r,  )r
   r  rv  normpathpath_to_filesearch_pathsgetcwdisabsexistsisfileisdirOSErrorrd  r   splitrG   )rz   rv  rU   re   ftypepaths_triedprefixtry_paths           r(   r   zresolve_path.__call__6
  s   4(ww%..D0^^u4& 	 ~~ iik]AN77=='RWW^^D-A4'RWW^^D-A5(RWW]]D-AUG2dV<899 K..77<<(8(8(@$G^^+1I^^t+1I^^u,1I#O""8, ) %#+d(;A(>>Ammpst  qA  A  DG  G  H  Hr*   N)r   r   r   r   rP   r  r  r
  rB   r	  r   r=   r*   r(   r  r  
  sE      E P L 4e&* 1LHr*   r  )warning_catc                   L    e Zd ZdZ e ej                         dd      ZddZy)normalize_patha?  
    Convert a UNIX-style path to the current OS's format,
    typically for creating a new file or directory.

    If the path is not already absolute, it will be made absolute
    (using the prefix parameter).

    Should do the same as Python's os.path.abspath(), except using
    prefix rather than os.getcwd).
    FzO
        Prepended to the specified path, if that path is not
        absolute.r  c                 $   t        | |      }t        j                  j                  |      sGt        j                  j	                  t        j                  j                  |j                        |      }t        j                  j                  |      S r/   )r
   r  rv  r  rd  r  r  )rz   rv  rU   re   s       r(   r   znormalize_path.__call__g
  sZ    4'ww}}T"77<< 0 0 :4@Dww%%r*   N)rw  )	r   r   r   r   r   r  r  r  r   r=   r*   r(   r  r  V
  s*    	 IBIIKU H F&r*   r  c                        e Zd ZdZddgZ eej                  d      Zej                  	 dddddddddddddddd	       Z
eefeed
 fd       Z
d Zd Z fdZ fdZ xZS )r  ak  
    Parameter that can be set to a string specifying the path of a file or folder.

    The string should be specified in UNIX style, but it will be
    returned in the format of the user's operating system. Please use
    the Filename or Foldername Parameters if you require discrimination
    between the two possibilities.

    The specified path can be absolute, or relative to either:

    * any of the paths specified in the search_paths attribute (if
       search_paths is not None);

    or

    * any of the paths searched by resolve_path() (if search_paths
      is None).

    Parameters
    ----------
    search_paths : list, default=[os.getcwd()]
        List of paths to search the path from
    check_exists: boolean, default=True
        If True (default) the path must exist on instantiation and set,
        otherwise the path can optionally exist.

    r
  check_existsT)r  NF)r
  r  r   r   r   r   r   r-   r   r   r   r   r   c                     y r/   r=   )rz   r,   r
  r  r   r   r   r   r   r-   r   r   r   r   r   s                  r(   r   zPath.__init__
  r  r*   )r
  r  c                    |t         u rg }|| _        |t         urt        |t              st	        d      || _        t        |   |fi | | j                  | j                         y )Nz0'check_exists' attribute value must be a boolean)
r   r
  r6   rA   r-  r  r   r   r  r,   )rz   r,   r
  r  rU   rx   s        r(   r   zPath.__init__
  s_    9$L(y(L$1OOPP(*6*t||$r*   c                 2    t        |d | j                        S )Nr	  r
  r  r
  rz   rv  s     r(   _resolvezPath._resolve
      Dt$BSBSTTr*   c                 X   |$| j                   st        t        |        d      y t        |t        t
        j                  f      st        t        |        d      	 | j                  |       y # t        $ r/}| j                  rt        |j                  d         d Y d }~y d }~ww xY w)Nz does not accept Nonez$ only take str or pathlib.Path typesr   )r   r-  r   r6   rG   r  r  r"  r  r  r   )rz   r   es      r(   r  zPath._validate
  s    ;?? $:4$@#AAV!WXX # cC#67 $:4$@#AAe!fgg7c" 7$$!!&&),$6 %7s   A1 1	B):%B$$B)c                     t         |   ||      }|d}|S 	 | j                  |      }|S # t        $ r | j                  r |}Y |S w xY w)z7Return an absolute, normalized path (see resolve_path).N)r   r   r"  r  r  )rz   r   r   raw_pathrv  rx   s        r(   r   zPath.__get__
  sf    7?3w/D $}}X.   $$$#D$s   , AAc                 6    t         |          }d|v rg |d<   |S )Nr
  )r   __getstate__rD  s     r(   r)  zPath.__getstate__
  s'    $&U"$&E.!r*   r/   )r   r   r   r   rF  r?   r   rG  r  r  r   r   r   r"  r  r   r)  r   r   s   @r(   r  r  q
  s    8  0I  tN __ &*d$4UTPTe   ( 	%)R[ 	%  	%U7 r*   r  c                       e Zd ZdZd Zy)Filenamea  
    Parameter that can be set to a string specifying the path of a file.

    The string should be specified in UNIX style, but it will be
    returned in the format of the user's operating system.

    The specified path can be absolute, or relative to either:

    * any of the paths specified in the search_paths attribute (if
      search_paths is not None);

    or

    * any of the paths searched by resolve_path() (if search_paths
      is None).
    c                 2    t        |d| j                        S )NTr  r   r!  s     r(   r"  zFilename._resolve
  r#  r*   Nr   r   r   r   r"  r=   r*   r(   r+  r+  
  s    "Ur*   r+  c                       e Zd ZdZd Zy)
Foldernamea  
    Parameter that can be set to a string specifying the path of a folder.

    The string should be specified in UNIX style, but it will be
    returned in the format of the user's operating system.

    The specified path can be absolute, or relative to either:

    * any of the paths specified in the search_paths attribute (if
      search_paths is not None);

    or

    * any of the paths searched by resolve_dir_path() (if search_paths
      is None).
    c                 2    t        |d| j                        S )NFr  r   r!  s     r(   r"  zFoldername._resolve
  s    Du4CTCTUUr*   Nr-  r=   r*   r(   r/  r/  
  s    "Vr*   r/  c                        e Zd ZdZg dZdgZ eej                  d      Ze	j                  	 ddddddddddddddd	       Zeefed fd
       Zd Zd Zd Z xZS )Colorzy
    Color parameter defined as a hex RGB string with an optional #
    prefix or (optionally) as a CSS3 color name.
    )	aliceblueantiquewhiteaqua
aquamarineazurebeigebisqueblackblanchedalmondblue
bluevioletbrown	burlywood	cadetblue
chartreuse	chocolatecoralcornflowerbluecornsilkcrimsoncyandarkbluedarkcyandarkgoldenroddarkgraydarkgrey	darkgreen	darkkhakidarkmagentadarkolivegreen
darkorange
darkorchiddarkred
darksalmondarkseagreendarkslatebluedarkslategraydarkslategreydarkturquoise
darkvioletdeeppinkdeepskybluedimgraydimgrey
dodgerblue	firebrickfloralwhiteforestgreenfuchsia	gainsboro
ghostwhitegold	goldenrodgraygreygreengreenyellowhoneydewhotpink	indianredindigoivorykhakilavenderlavenderblush	lawngreenlemonchiffon	lightblue
lightcoral	lightcyanlightgoldenrodyellow	lightgray	lightgrey
lightgreen	lightpinklightsalmonlightseagreenlightskybluelightslategraylightslategreylightsteelbluelightyellowlime	limegreenlinenmagentamaroonmediumaquamarine
mediumbluemediumorchidmediumpurplemediumseagreenmediumslatebluemediumspringgreenmediumturquoisemediumvioletredmidnightblue	mintcream	mistyrosemoccasinnavajowhitenavyoldlaceolive	olivedraborange	orangeredorchidpalegoldenrod	palegreenpaleturquoisepalevioletred
papayawhip	peachpuffperupinkplum
powderbluepurplered	rosybrown	royalbluesaddlebrownsalmon
sandybrownseagreenseashellsiennasilverskyblue	slateblue	slategray	slategreysnowspringgreen	steelbluetantealthistletomato	turquoisevioletwheatwhite
whitesmokeyellowyellowgreenallow_namedT)r  NF)r  r   r   r   r   r   r-   r   r   r   r   r   c                     y r/   r=   )rz   r,   r  r   r   r   r   r   r-   r   r   r   r   r   s                 r(   r   zColor.__init__2  r  r*   c                l    t        |   dd|i| || _        | j                  | j                         y rW  )r   r   r  r  r,   )rz   r,   r  rT   rx   s       r(   r   zColor.__init__<  s0    33F3&t||$r*   c                 t    | j                  || j                         | j                  || j                         y r/   )r6  r   _validate_allow_namedr  r   s     r(   r  zColor._validateB  s,    S$//2""3(8(89r*   c                 t    |r|y t        |t              s#t        t        |        dt	        |       d      y )Nz* expects a string value, not an object of r,  )r6   rG   r-  r   r\   r5  s      r(   r6  zColor._validate_valueF  sH    3;#s#)$/0 1$$(I;a1  $r*   c                    || j                   ry t        j                  d|      }| j                  r:|s7|j	                         | j
                  vrt        t        |        d| d      y y |st        t        |        d|d      y )Nz*^#?(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$z5 only takes RGB hex codes or named colors, received 'z'.z, only accepts valid RGB hex codes, received r,  )r   rematchr  r  _named_colorsr-  r   )rz   r   r  is_hexs       r(   r  zColor._validate_allow_namedO  s    KDOOFLciik1C1CC -d34 5225b:  D6
 )$/0 1##&',  r*   r/   )r   r   r   r   r  rF  r?   r   rG  r  r  r   r   r   r  r6  r  r   r   s   @r(   r2  r2    s    "/MH I)22EN__ %)d$4UTPTe   ( % %  %
:r*   r2  c                        e Zd ZdZdgZ eej                  ddd      Zej                  	 ddddddddddddddd	       Z
eefeed
 fd       Z
d Zd Zd Z xZS )Bytesz
    A Bytes Parameter, with a default value and optional regular
    expression (regex) matching.

    Similar to the String parameter, but instead of type string
    this parameter only allows objects of type bytes (e.g. b'bytes').
    regexr*   NF)r,   r  r   T)r  r   r   r   r   r   r-   r   r   r   r   r   c                     y r/   r=   )rz   r,   r  r   r   r   r   r   r-   r   r   r   r   r   s                 r(   r   zBytes.__init__s  r  r*   )r  r   c                l    t        |   dd|i| || _        | j                  | j                         y rW  )r   r   r  r  r,   )rz   r,   r  r   rT   rx   s        r(   r   zBytes.__init__}  s/    33F3
t||$r*   c                     || j                   ry |4t        j                  ||      t        t	        |        d|d|d      y y )Nz value z does not match regex r,  )r   r  r  r-  r   )rz   r   r  s      r(   _validate_regexzBytes._validate_regex  s]    KDOO%!5!=)$/0w ?((-y3  ">r*   c                 t    |r|y t        |t              s#t        t        |        dt	        |       d      y )Nz. only takes a byte string value, not value of r,  )r6   bytesr-  r   r\   r5  s      r(   r6  zBytes._validate_value  sH    #+#u%)$/0 1  $S	{!-  &r*   c                 t    | j                  || j                         | j                  || j                         y r/   )r6  r   r  r  r   s     r(   r  zBytes._validate  s*    S$//2S$**-r*   )r*   )r   r   r   r   rF  r?   r   rG  r  r  r   r   r   r  r6  r  r   r   s   @r(   r  r  c  s     	I  #TeN
 __ "u5TPTe   ( %9 %  %
.r*   r  )er   r8  ra   rb  ra  r  r3  r  os.pathr  r  r  rQ   r  r  r   collections.abcr   
contextlibr   parameterizedr   r   r	   r
   r   r   r   r   r   r   r   _utilsr   r  r   r   r   r   r   r   r   r   r   r   r   r)   rZ   r^   rj   rt   rv   r   r   r  rH  rF   rD   rN  r@   ro  rB   r  r  r  rN   rK   r  r  rM   r  r  r  r  r  rO   r  r?  rO  rD  rP  rI  rR  rl  ru  r  r  r  rH   rS   r;   r<   rP   r   r  r  r  r+  r/  r2  r  r=   r*   r(   <module>r     s)  $         	 
   # $ %   
   ( '+ 61h -: ,*<0 08V= VBYi Yx  '( R$W R$lf 4
 
.8C6 8Cv0>6 0>l"3i "3JB(G B(P	 	 9: GI GT5  >L >&g1L g1TL# L#^(R (R\"3y "3JX :#	 :#@
T9 
Ti* i*X $ 78 	 	 &I%J " Q6|/ Q6h7X 7,0@8 0@f748 74t+@ +@\BL BJA= A""(M "(J{+ {+|5B] 5Bvh9 hVt B7H( 7Hv ,-&* & .&4_9 _FUt U,V V2ZI Z@4.I 4.r*   