
    h)Q             
      
   S r SSKJr  SSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
rSSKJr  SSKJr  SSKJrJrJrJr  SSKJr  SS	KJr  SS
KJr  SSKJrJrJr  \\ \!\"4r#\$4r%\RL                  (       a  SSK'J(r(  OSSK
J(r(  / SQr)\" SSS5      r*\" SSS5      r+\*r, " S S\-5      r.SS jr/SS jr0SS jr1SS jr2 " S S5      r3SSS jjr4SS jr5 " S S5      r6 " S S 5      r7\7r8 " S! S"5      r9\(" S#5      r:\(" S$5      r;\(" S%5      r<\RL                  (       a   SS&K'J=r=J>r>  \(" S'\?S(9r@\(" S)\R                  S(9rB " S* S+\9\R                  \:\;4   5      rD " S, S-5      rESS. jrF " S/ S0\$5      rG " S1 S2\G5      rHS3S4.SS6 jjrISS8 jrJSS: jrKSS< jrL\RP                  " S7\R                  S=\R                  4   S>9rN " S? S@\95      rO " SA S5\O5      rP " SB S9\O5      rQ " SC S;\O5      rR " SD SE\GSF9rS " SG SH\S\HSF9rT " SI SJ\D\:\;4   5      rU " SK SL\U\:\;4   5      rV " SM SN\U\<\<4   5      rW " SO SP5      rX " SQ SR\X\V\:\;4   5      rY " SS ST\X\W\<   5      rZ " SU SV\U\R                  \<   \R                  \<   4   5      r\ " SW SX\D\R                  \R                  4   5      r] " SY SZ\D\R                  \R                     \R                  \R                     4   5      rA        SS[ jr^ " S\ S]\D\:\;4   5      r_ " S^ S_\_\:\;4   5      r`\_\`srarb\_rc " S` Sa\D\:\;4   5      rd " Sb Sc\d\:\;4   5      re " Sd Se\D\f\R                  \f\g\h4   4   5      ri " Sf Sg\i\D\f\R                  4   5      rj " Sh Si\D\k\k4   5      rl " Sj Sk\l\D\k\R                  4   5      rm " Sl Sm\D\:\;4   5      rn " Sn So\n\:\;4   \D\?\R                  4   5      ro " Sp Sq\D\?\?4   5      rp " Sr Ss\p5      rq " St Su\D\:\;4   5      rr " Sv Sw\r\:\;4   5      rs " Sx Sy\D\:\:4   5      rt " Sz S{\t\:   5      ru " S| S}\t\:   5      rv " S~ S\W\<   5      rw " S S\w\R                  \<      5      rx " S S\w\R                  \R                        5      ry " S S\w\R                  \R                  S=4      5      rz " S S\WS   5      r{ " S S\D\:\;4   5      r| " S S\DS\R                  S\?4   4   5      r} " S S\D\R                  \R                  4   5      r~ " S S\D\R                  S=\R                  4   \R                  S=\R                  4   4   5      rMg)a  
A lightweight Traits like module.

This is designed to provide a lightweight, simple, pure Python version of
many of the capabilities of enthought.traits.  This includes:

* Validation
* Type specification with defaults
* Static and dynamic notification
* Basic predefined types
* An API that is similar to enthought.traits

We don't support:

* Delegation
* Automatic GUI generation
* A full set of trait types.  Most importantly, we don't provide container
  traits (list, dict, tuple) that can trigger notifications if their
  contents change.
* API compatibility with enthought.traits

There are also some important difference in our design:

* enthought.traits does not validate default values.  We do.

We choose to create this module because we need these capabilities, but
we need them to be pure Python so they work in all Python implementations,
including Jython and IronPython.

Inheritance diagram:

.. inheritance-diagram:: traitlets.traitlets
   :parts: 3
    )annotationsN)literal_eval   )Bunch)add_articleclass_ofdescribe	repr_type)
getargspecimport_item)Sentinel)deprecated_methodshould_warnwarn)TypeVar);AllAnyBaseDescriptorBoolBytesCBoolCBytesCComplexCFloatCIntCLongCRegExpCUnicodeCallableCaselessStrEnumClassBasedTraitTypeComplex	ContainerDefaultHandlerDictDottedObjectNameEnumEventHandlerFloatForwardDeclaredInstanceForwardDeclaredMixinForwardDeclaredType	FuzzyEnumHasDescriptors	HasTraitsInstanceIntIntegerListLongMetaHasDescriptorsMetaHasTraits
ObjectNameObserveHandlerSet
TCPAddressThis
TraitError	TraitTypeTupleTypeUnicode	UndefinedUnionUseEnumValidateHandlerdefaultdirectional_linkdlinklinkobserveobserve_compatparse_notifier_namevalidaterB   	traitletszA
Used in Traitlets to specify that no defaults are set in kwargs
r   zi
Used in Traitlets to listen to all types of notification or to notifications
from all trait attributes.
c                      \ rS rSrSrg)r=       N)__name__
__module____qualname____firstlineno____static_attributes__rQ       fC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\traitlets/traitlets.pyr=   r=      s    rW   r=   c                T    [         R                  " [        U R                  5       5      $ N)tcastboolisidentifierss    rX   r^   r^      s    66$())rW   c                T     [        U 5      $ ! [        [        [        4 a    U s $ f = f)zkSafely evaluate an expression

Returns original string if eval fails.

Use only where types are ambiguous.
)r   	NameErrorSyntaxError
ValueErrorr_   s    rX   _safe_literal_evalre      s,    A{J/ s   
 ''c                ~    [        U [        5      =(       d'    [        U [        5      =(       a    [        U [        5      $ )zHReturns whether the given value is an instance or subclass of TraitType.)
isinstancer>   type
issubclass)r[   s    rX   is_traitrj      s'    a#Y
1d(;(X
1i@XYrW   c                @   U [         L d  [        U [        5      (       a  U /$ [        U [        5      (       a  [	        S5      eU (       a
  [         U ;   a  [         /$ U  H>  n[        U[        5      (       a  M  [	        S[        U5      R                   SU< S35      e   U $ )zConvert the name argument to a list of names.

Examples
--------
>>> parse_notifier_name([])
[traitlets.All]
>>> parse_notifier_name("a")
['a']
>>> parse_notifier_name(["a", "b"])
['a', 'b']
>>> parse_notifier_name(All)
[traitlets.All]
z7`names` must be either `All`, a str, or a list of strs.znames must be strings, not ())r   rg   strr   	TypeErrorrh   rR   )namesns     rX   rL   rL      s     |z%--w	E8	$	$QRRu5LAa%%"=d1g>N>N=OqQRPUUV WXX  rW   c                  <    \ rS rSrSS jrS	S jrS
S jrS
S jrSrg)_SimpleTest   c                    Xl         g rZ   valueselfrw   s     rX   __init___SimpleTest.__init__   s    
rW   c                0    [        XR                  :H  5      $ rZ   )r]   rw   )ry   tests     rX   __call___SimpleTest.__call__   s    DJJ&''rW   c                     SU R                   -  $ )Nz<SimpleTest(%r)rv   ry   s    rX   __repr___SimpleTest.__repr__   s     4::--rW   c                "    U R                  5       $ rZ   )r   r   s    rX   __str___SimpleTest.__str__   s    }}rW   rv   N)rw   t.AnyreturnNone)r}   r   r   r]   r   rn   )	rR   rS   rT   rU   rz   r~   r   r   rV   rQ   rW   rX   rs   rs      s    (.rW   rs   c                    / n[        U 5       H7  n [        X5      nU(       a  U" U5      (       a  UR                  X445        M7  M9     UR	                  5         U$ ! [         a     MZ  f = f)a  A safe version of inspect.getmembers that handles missing attributes.

This is useful when there are descriptor based attributes that for
some reason raise AttributeError even though they exist.  This happens
in zope.interface with the __provides__ attribute.
)dirgetattrappendAttributeErrorsort)object	predicateresultskeyrw   s        rX   
getmembersr      sl     G6{	-F(E 	% 0 0|, !1  LLNN  		s   A
A)(A)c                    U  Hy  n[        U5      S:X  d  [        S[        -  5      eUu  p#[        U[        5      (       d  [        S[        U5      -  5      eX2R                  5       ;  d  Mi  [        U< SU< 35      e   g)z.Validate arguments for traitlet link functions   zKEach linked traitlet must be specified as (HasTraits, 'trait_name'), not %rz%Each object must be HasTraits, not %rz has no trait N)lenro   r[   rg   r0   rh   traits)tuplestupobj
trait_names       rX   _validate_linkr      sz    3x1}]`aa  #y))Cd3iOPPZZ\)sg^J>BCC rW   c                  z    \ rS rSrSrSrSSS jjrSS jr\R                  SS j5       r
SS jrSS	 jrSS
 jrSrg)rI   i  a
  Link traits from different objects together so they remain in sync.

Parameters
----------
source : (object / attribute name) pair
target : (object / attribute name) pair
transform: iterable with two callables (optional)
    Data transformation between source and target and target and source.

Examples
--------
>>> class X(HasTraits):
...     value = Int()

>>> src = X(value=1)
>>> tgt = X(value=42)
>>> c = link((src, "value"), (tgt, "value"))

Setting source updates target objects:
>>> src.value = 5
>>> tgt.value
5
FNc                    [        X5        XsU l        U l        U(       a  UOS 4S-  u  U l        U l        U R                  5         g )Nc                    U $ rZ   rQ   xs    rX   <lambda>link.__init__.<locals>.<lambda>+  s    VWrW   r   )r   sourcetarget
_transform_transform_invrI   ry   r   r   	transforms       rX   rz   link.__init__(  s<    v&#) T[<EyK>\]K],,		rW   c                d    [        U R                  S   U R                  S   U R                  [        U R                  S   U R                  S   5      5      5        U R                  S   R                  U R                  U R                  S   S9  U R                  S   R                  U R                  U R                  S   S9  g ! U R                  S   R                  U R                  U R                  S   S9  U R                  S   R                  U R                  U R                  S   S9  f = fNr   r   rp   )setattrr   r   r   r   rJ   _update_target_update_sourcer   s    rX   rI   	link.link/  s    		NAAAA GH KKN""4#6#6dkk!n"MKKN""4#6#6dkk!n"M KKN""4#6#6dkk!n"MKKN""4#6#6dkk!n"Ms   AC A*D/c              #  J   #    SU l          S v   SU l         g ! SU l         f = f7fNTFupdatingr   s    rX   _busy_updatinglink._busy_updating;  "     	"!DMEDM   # #	 #c                   U R                   (       a  g U R                  5          [        U R                  S   U R                  S   U R	                  UR
                  5      5        [        U R                  S   U R                  S   5      UR
                  :w  a  [        SU  S35      e S S S 5        g ! , (       d  f       g = f)Nr   r   Broken link z5: the source value changed while updating the target.)	r   r   r   r   r   newr   r   r=   ry   changes     rX   r   link._update_targetC  s    ==  "DKKNDKKNDOOFJJ4OPt{{1~t{{1~6&**D "4&(aa  E #""   BB11
B?c                   U R                   (       a  g U R                  5          [        U R                  S   U R                  S   U R	                  UR
                  5      5        [        U R                  S   U R                  S   5      UR
                  :w  a  [        SU  S35      e S S S 5        g ! , (       d  f       g = f)Nr   r   r   z5: the target value changed while updating the source.)	r   r   r   r   r   r   r   r   r=   r   s     rX   r   link._update_sourceM  s    ==  "DKKNDKKND4G4G

4STt{{1~t{{1~6&**D "4&(aa  E #""r   c                    U R                   S   R                  U R                  U R                   S   S9  U R                  S   R                  U R                  U R                  S   S9  g r   )r   	unobserver   r   r   r   s    rX   unlinklink.unlinkW  sT    A  !4!4DKKN KA  !4!4DKKN KrW   )r   r   r   r   r   rZ   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )rR   rS   rT   rU   __doc__r   rz   rI   
contextlibcontextmanagerr   r   r   r   rV   rQ   rW   rX   rI   rI     sC    0 H
N " "LrW   rI   c                  p    \ rS rSrSrSrSSS jjrSS jr\R                  SS j5       r
SS jrSS	 jrS
rg)rG   i\  a:  Link the trait of a source object with traits of target objects.

Parameters
----------
source : (object, attribute name) pair
target : (object, attribute name) pair
transform: callable (optional)
    Data transformation between source and target.

Examples
--------
>>> class X(HasTraits):
...     value = Int()

>>> src = X(value=1)
>>> tgt = X(value=42)
>>> c = directional_link((src, "value"), (tgt, "value"))

Setting source updates target objects:
>>> src.value = 5
>>> tgt.value
5

Setting target does not update source object:
>>> tgt.value = 6
>>> src.value
5

FNc                x    U(       a  UOS U l         [        X5        XsU l        U l        U R	                  5         g )Nc                    U $ rZ   rQ   r   s    rX   r   +directional_link.__init__.<locals>.<lambda>~  s    rW   )r   r   r   r   rI   r   s       rX   rz   directional_link.__init__}  s,    '0)kv&#) T[		rW   c                    [        U R                  S   U R                  S   U R                  [        U R                  S   U R                  S   5      5      5        U R                  S   R                  U R                  U R                  S   S9  g ! U R                  S   R                  U R                  U R                  S   S9  f = fr   )r   r   r   r   r   rJ   _updater   s    rX   rI   directional_link.link  s    	GAAAA GH KKN""4<<t{{1~"FDKKN""4<<t{{1~"Fs   AB 6Cc              #  J   #    SU l          S v   SU l         g ! SU l         f = f7fr   r   r   s    rX   r   directional_link._busy_updating  r   r   c                    U R                   (       a  g U R                  5          [        U R                  S   U R                  S   U R	                  UR
                  5      5        S S S 5        g ! , (       d  f       g = fNr   r   )r   r   r   r   r   r   r   s     rX   r   directional_link._update  sM    ==  "DKKNDKKNDOOFJJ4OP #""s   AA--
A;c                l    U R                   S   R                  U R                  U R                   S   S9  g r   )r   r   r   r   s    rX   r   directional_link.unlink  s)    A  T[[^ DrW   )r   r   r   r   rZ   r   r   r   r   )rR   rS   rT   rU   r   r   rz   rI   r   r   r   r   r   rV   rQ   rW   rX   rG   rG   \  s?    < HG " "QErW   rG   c                  T    \ rS rSr% SrSrS\S'   SrS\S'   SS jrSS	 jr	SS
 jr
Srg)r   i  ay  Base descriptor class

Notes
-----
This implements Python's descriptor protocol.

This class is the base class for all such descriptors.  The
only magic we use is a custom metaclass for the main :class:`HasTraits`
class that does the following:

1. Sets the :attr:`name` attribute of every :class:`BaseDescriptor`
   instance in the class dict to the name of the attribute.
2. Sets the :attr:`this_class` attribute of every :class:`BaseDescriptor`
   instance in the class dict to the *class* that declared the trait.
   This is used by the :class:`This` trait to allow subclasses to
   accept superclasses for :class:`This` values.
N
str | Nonenameztype[HasTraits] | None
this_classc                    Xl         X l        g)a  Part of the initialization which may depend on the underlying
HasDescriptors class.

It is typically overloaded for specific types.

This method is called by :meth:`MetaHasDescriptors.__init__`
passing the class (`cls`) and `name` under which the descriptor
has been assigned.
N)r   r   )ry   clsr   s      rX   
class_initBaseDescriptor.class_init  s     	rW   c                N    UR                   R                  U R                  5        g rZ   )_instance_initsr   instance_initry   r   s     rX   subclass_initBaseDescriptor.subclass_init  s     	""4#5#56rW   c                    g)a  Part of the initialization which may depend on the underlying
HasDescriptors instance.

It is typically overloaded for specific types.

This method is called by :meth:`HasTraits.__new__` and in the
:meth:`BaseDescriptor.instance_init` method of descriptors holding
other descriptors.
NrQ   ry   r   s     rX   r   BaseDescriptor.instance_init  s    rW   )r   r   r   type[HasTraits]r   r   r   r   )r   r   r   r   r   r   r   r   )rR   rS   rT   rU   r   r   __annotations__r   r   r   r   rV   rQ   rW   rX   r   r     s-    $ D*)-J&-	7	rW   r   GST)LiteralSelfK)rF   Vc                     \ rS rSr% Sr0 rS\S'   SrS\S'   SrS\S'   S	r	S
\S'   \
rS\S'   \
SSSS4               S$S jjrS%S jrS&S'S jjrS(S jrS'S jrS&S)S jjr\R&                  S*S j5       r\R&                  S+S j5       rS,S jrS-S jrS-S jrS.S jrS.S jrS/S jrS0S jr  S1         S2S jjrS&S3S jjrS4S  jrS5S! jrS0S" jrS#r g)6r>   i  z!A base class for all trait types.dict[str, t.Any]metadataFr]   
allow_none	read_only	any valuern   	info_textr   default_valueNc                   U[         La  Xl        U(       a  X l        Ub  X0l        Ub  UOSU l        U R                  (       a  U R                  U l        [        U5      S:  Ga/  Sn[        R                  " 5       nUc   eUR                  R                  S:X  a2  US-  nUR                  nUc   eUR                  R                  S:X  a  M2  UR                  R                  S5      =(       d    Sn	U	R                  SS5      S   n
SU
/[        U5      Q7n[!        U5      (       a  [#        S	U S
3[$        US9  [        U R&                  5      S:  a;  U R&                  R)                  5       U l        U R&                  R+                  U5        O&X`l        OU R&                  R)                  5       U l        Ub  XPR&                  S'   Ub  X@R&                  S'   gg)a  Declare a traitlet.

If *allow_none* is True, None is a valid value in addition to any
values that are normally valid. The default is up to the subclass.
For most trait types, the default value for ``allow_none`` is False.

If *read_only* is True, attempts to directly modify a trait attribute raises a TraitError.

If *help* is a string, it documents the attribute's purpose.

Extra metadata can be associated with the traitlet using the .tag() convenience method
or by using the traitlet instance's .metadata dictionary.
N r   r   rz   rR   .zmetadata-tagz	metadata z was set from the constructor. With traitlets 4.1, metadata should be set using the .tag() method, e.g., Int().tag(key1='value1', key2='value2')
stacklevelconfighelp)rB   r  r   r   r	  r   r   inspectcurrentframef_codeco_namef_back	f_globalsgetsplitsortedr   r   DeprecationWarningr   copyupdate)ry   r  r   r   r	  r  kwargsr  fmodpkgr   s               rX   rz   TraitType.__init__  s   , 	)!.(O &N ,D"	9999DLv;?J$$&A= =((""j0a
HH}$} ((""j0 ++//*-3C))C#A&C!388C3x (D D ') 4==!A% $ 2 2 4$$V, & MM..0DM&,MM(# $(MM&! rW   c                6    U R                   (       a  US:X  a  gU$ )zGet a value from a config string

such as an environment variable or CLI arguments.

Traits can override this method to define their own
parsing of config strings.

.. seealso:: item_from_string

.. versionadded:: 5.0
r   Nr   ry   r`   s     rX   from_stringTraitType.from_string?  s     ??qF{rW   c                0   U R                   [        La%  [        R                  " [        U R                   5      $ [        U S5      (       a)  [        R                  " [        U R                  5       5      $ [        R                  " [        U R                   5      $ )zThe default generator for this trait

Notes
-----
This method is registered to HasTraits classes during ``class_init``
in the same way that dynamic defaults defined by ``@default`` are.
make_dynamic_default)r  rB   r[   r\   r   hasattrr!  r   s     rX   rF   TraitType.defaultO  sj     Y.66!T//00T12266!T66899 66!T//00rW   c                j    [        S[        SS9  [        R                  " [        U R
                  5      $ )z]DEPRECATED: Retrieve the static default value for this trait.
Use self.default_value instead
zRget_default_value is deprecated in traitlets 4.0: use the .default_value attributer   r  )r   r  r[   r\   r   r  r   s    rX   get_default_valueTraitType.get_default_value_  s.     	`	

 vva++,,rW   c                    [        S[        SS9  U R                  XR                  5      nX!R                  U R
                  '   U$ )z<DEPRECATED: Set the static default value for the trait type.zSinit_default_value is deprecated in traitlets 4.0, and may be removed in the futurer   r  )r   r  	_validater  _trait_valuesr   ry   r   rw   s      rX   init_default_valueTraitType.init_default_valuej  s@    a	

 s$6$67',$))$rW   c           
     `   U R                   c   e UR                  U R                      n[        R                  " [        U5      $ ! [
         a    UR                  U R                   5      nU[        L a  [        S[        SS9  UR                  n SUl
        U R                  X5      nXQl
        O! XQl
        f = fX1R                  U R                   '   UR                  [        U R                   UUSS95        [        R                  " [        U5      s $ [         a  n[        S5      UeS nAff = f)NzxExplicit using of Undefined as the default value is deprecated in traitlets 5.0, and may cause exceptions in the future.r   r  TrF   )r   rw   ownerrh   z=Unexpected error in TraitType: default value not set properly)r   r)  r[   r\   r   KeyErrortrait_defaultsrB   r   r  _cross_validation_lockr(  _notify_observersr   	Exceptionr=   )ry   r   r   rw   rF   r1  es          rX   r  TraitType.getu  s   yy$$$#	$%%dii0ED 66!U##C  	$((3G)#0 '  &)%?%?"D-1*s4-C*-C*+0dii(!!"	 66!U## 	e\]cdd	es7   A A	D-B.'D-.B66AD-	D-D((D-c                    g rZ   rQ   ry   r   r   s      rX   __get__TraitType.__get__      rW   c                    g rZ   rQ   r7  s      rX   r8  r9    r:  rW   c                `    Uc  U $ [         R                  " [        U R                  X5      5      $ )a%  Get the value of the trait by self.name for the instance.

Default values are instantiated when :meth:`HasTraits.__new__`
is called.  Thus by the time this method gets called either the
default value or a user defined value (they called :meth:`__set__`)
is in the :class:`HasTraits` instance.
)r[   r\   r   r  r7  s      rX   r8  r9    s(     ;K66!TXXc/00rW   c                d   U R                  X5      nU R                  c   e UR                  U R                     nX1R                  U R                  '    [        XC:H  5      nUSLa  UR                  U R                  XC5        g g ! [         a    U R                  n Naf = f! [         a    Sn NMf = f)NFT)r(  r   r)  r/  r  r]   r3  _notify_trait)ry   r   rw   	new_value	old_valuesilents         rX   setTraitType.set  s    NN3.	yy$$$	+))$))4I (1$))$	)01F  dii>   	+**I	+  	F	s#   B B  BB B/.B/c                x    U R                   (       a  [        SU R                  -  5      eU R                  X5        g)zSet the value of the trait by self.name for the instance.

Values pass through a validation stage where errors are raised when
impropper types, or types that cannot be coerced, are encountered.
zThe "%s" trait is read-only.N)r   r=   r   rB  r*  s      rX   __set__TraitType.__set__  s,     >>;diiGHHrW   c                    Uc  U R                   (       a  U$ [        U S5      (       a  U R                  X5      nUR                  SL a  U R	                  X5      n[
        R                  " [        U5      $ )NrM   F)r   r"  rM   r1  _cross_validater[   r\   r   r*  s      rX   r(  TraitType._validate  s\    =T__L4$$MM#-E%%.((4EvvarW   c                x   U R                   UR                  ;   a.  [        XUS.5      nUR                  U R                      " X5      nOX[        USU R                   -  5      (       a:  SU R                   -  n[	        X5      n[        UUR                  US5        U" X 5      n[        R                  " [        U5      $ )N)traitrw   r.  _%s_validate use @validate decorator instead.)
r   _trait_validatorsr   r"  r   r   	__class__r[   r\   r   )ry   r   rw   proposal	meth_namecross_validates         rX   rH  TraitType._cross_validate  s    99---tcJKH))$))4SCES.499455&2I$S4N2	 #5/EvvarW   c                t    [        U[        5      (       a  [        U /UR                  Q5      $ [        X/5      $ rZ   rg   rC   trait_typesry   others     rX   __or__TraitType.__or__  s5    eU##$3!2!2344$''rW   c                    U R                   $ rZ   )r  r   s    rX   infoTraitType.info  s    ~~rW   c                f   Ub  U=R                   U 4-  sl         U R                  b  SR                  S UR                   SS  5       5      nUbU  SR                  U R                  [	        SU5      UUR                   S   [	        SUR                   S	   5      5      4Ul         UeS
R                  U R                  UUR                   S   [	        SUR                   S	   5      5      4Ul         UeU R                  c#  [        X$=(       d    U R                  5       U 5      eUbI  SR                  U R                  [        U5      U=(       d    U R                  5       [	        SU5      5      nO>SR                  U R                  U=(       d    U R                  5       [	        SU5      5      n[        U5      e)a  Raise a TraitError

Parameters
----------
obj : HasTraits or None
    The instance which owns the trait. If not
    object is given, then an object agnostic
    error will be raised.
value : any
    The value that caused the error.
error : Exception (default: None)
    An error that was raised by a child trait.
    The arguments of this exception should be
    of the form ``(value, info, *traits)``.
    Where the ``value`` and ``info`` are the
    problem value, and string describing the
    expected value. The ``traits`` are a series
    of :class:`TraitType` instances that are
    "children" of this one (the first being
    the deepest).
info : str (default: None)
    A description of the expected value. By
    default this is inferred from this trait's
    ``info`` method.
N of c              3  :   #    U  H  n[        S U5      v   M     g7f)aN)r	   ).0r[   s     rX   	<genexpr>"TraitType.error.<locals>.<genexpr>  s     #MnHS!$4$4ns   r   zDThe '{}' trait of {} instance contains {} which expected {}, not {}.anr   ther   z5The '{}' trait contains {} which expected {}, not {}.z2The '{}' trait of {} instance expected {}, not {}.z#The '{}' trait expected {}, not {}.)argsr   joinformatr	   r=   r\  r   )ry   r   rw   errorr\  chainr4  s          rX   rj  TraitType.error  s~   @ JJ4'!Jyy$#Mejjn#MM?//5v II$T3/!!JJqM$UEJJqM:0	"EJ& K SYY II!!JJqM$UEJJqM:	"EJ K 99U$7DIIK>> ?DKK		#		&	A 6<<		#		&A
 mrW   c                r    US:X  a  SnOSn[        SU-   [        SS9  U R                  R                  X5      $ )z^DEPRECATED: Get a metadata value.

Use .metadata[key] or .metadata.get(key, default) instead.
r	  z3use the instance .help string directly, like x.helpzduse the instance .metadata dictionary directly, like x.metadata[key] or x.metadata.get(key, default)Deprecated in traitlets 4.1, r   r  )r   r  r   r  )ry   r   rF   msgs       rX   get_metadataTraitType.get_metadataA  s>    
 &=GCxC,s24FSTU}}  ..rW   c                Z    US:X  a  SnOSn[        SU-   [        SS9  X R                  U'   g)zKDEPRECATED: Set a metadata key/value.

Use .metadata[key] = value instead.
r	  z;use the instance .help string directly, like x.help = valuezLuse the instance .metadata dictionary directly, like x.metadata[key] = valuern  r   r  N)r   r  r   )ry   r   rw   ro  s       rX   set_metadataTraitType.set_metadataM  s5    
 &=OC`C,s24FSTU"crW   c                    [        UR                  5       5      R                  1 Sk5      nU(       a  [        SU-  [        SS9  U R
                  R                  U5        U $ )zSets metadata and returns self.

This allows convenient metadata tagging when initializing the trait, such as:

Examples
--------
>>> Int(0).tag(config=True, sync=True)
<traitlets.traitlets.Int object at ...>

>   r	  r   r   r  zcThe following attributes are set in using `tag`, but seem to be constructor keywords arguments: %s r   r  )rB  keysintersectionr   UserWarningr   r  )ry   r   maybe_constructor_keywordss      rX   tagTraitType.tagY  sZ     &)%9%F%F@&
" &u,-	 	X&rW   c                ,    [        U R                  5      $ rZ   )reprr  r   s    rX   default_value_reprTraitType.default_value_reprr  s    D&&''rW   )r   r   r  r	  r   r   )ry   zTraitType[G, S]r  r   r   r]   r   bool | Noner	  r   r  r   r  r   r   r   )r`   rn   r   G | NonerZ   )r   r   r   r  )r   r  )r   r0   r   ztype[t.Any] | Noner   r  )r   r   r   type[t.Any]r   r   )r   r   r   r  r   r   )r   HasTraits | Noner   r  r   zSelf | G)r   r0   rw   r   r   r   )r   r   rw   r   r   r  )rX  zTraitType[t.Any, t.Any]r   rC   r   )NN)
r   r  rw   r   rj  zException | Noner\  r   r   z
t.NoReturn)r   rn   rF   r   r   r   )r   rn   rw   r   r   r   )r   r   r   r   )!rR   rS   rT   rU   r   r   r   r   r   r  rB   r  rz   r  rF   r%  r+  r  r[   overloadr8  rB  rE  r(  rH  rY  r\  rj  rp  rs  rz  r~  rV   rQ   rW   rX   r>   r>     si   +!#H#JIt Is $M5$  ) !%B)B)B) B) 	B)
 B) B) B) 
B)H 1 	-	%$N ZZ  ZZ 1?&   ( #'OO O  	O
 O 
Ob
/
#2(rW   r>   c                  6    \ rS rSrSrSS jrS	S jrS
S jrSrg)_CallbackWrapperi{  zAn object adapting a on_trait_change callback into an observe callback.

The comparison operator __eq__ is implemented to enable removal of wrapped
callbacks.
c                    Xl         [        U R                   [        R                  5      (       a  SOSn[	        [        U5      S   5      U-   U l        U R                  S:  a  [        S5      eg )Nr      z1a trait changed callback must have 0-4 arguments.)cbrg   types
MethodTyper   r   nargsr=   )ry   r  offsets      rX   rz   _CallbackWrapper.__init__  sZ    !$''5+;+;<<!B*+f4
::>PQQ rW   c                    [        U[        5      (       a"  [        U R                  UR                  :H  5      $ [        U R                  U:H  5      $ rZ   )rg   r  r]   r  rW  s     rX   __eq___CallbackWrapper.__eq__  s<    e-..588+,,5())rW   c                *   U R                   S:X  a  U R                  5         g U R                   S:X  a  U R                  UR                  5        g U R                   S:X  a'  U R                  UR                  UR                  5        g U R                   S:X  a2  U R                  UR                  UR                  UR                  5        g U R                   S:X  a=  U R                  UR                  UR                  UR                  UR
                  5        g g )Nr   r   r      r  )r  r  r   r   oldr.  r   s     rX   r~   _CallbackWrapper.__call__  s    ::?GGIZZ1_GGFKK ZZ1_GGFKK,ZZ1_GGFKKVZZ8ZZ1_GGFKKVZZF rW   )r  r  N)r  r   r   r   )rX  r   r   r]   r   r   r   r   )	rR   rS   rT   rU   r   rz   r  r~   rV   rQ   rW   rX   r  r  {  s    R*GrW   r  c                F    [        U [        5      (       a  U $ [        U 5      $ rZ   )rg   r  )r  s    rX   _callback_wrapperr    s     "&''	##rW   c                  v   ^  \ rS rSrSr            SU 4S jjr          SU 4S jjrS	S jrSrU =r	$ )
r6   i  zA metaclass for HasDescriptors.

This metaclass makes sure that any TraitType class attributes are
instantiated and sets their name attribute.
c                   > UR                  5        HQ  u  pV[        R                  " U5      (       d  M"  [        U[        5      (       d  M9  [        S[        SS9  U" 5       X5'   MS     [        TU ]   " XX#40 UD6$ )z Create the HasDescriptors class.Traits should be given as instances, not types (for example, `Int()`, not `Int`). Passing types is deprecated in traitlets 4.1.r   r  )	itemsr
  isclassri   r>   r   r  super__new__)mclsr   bases	classdictkwdskvrO  s          rX   r  MetaHasDescriptors.__new__  sl     OO%DA q!!jI&>&>E& 	  !s	 & wt5DtDDrW   c                L   > [         TU ]  " XU40 UD6  U R                  U5        g)z-Finish initializing the HasDescriptors class.N)r  rz   setup_class)r   r   r  r  r  rO  s        rX   rz   MetaHasDescriptors.__init__  s%     	i848	"rW   c                P   / U l         / U l        UR                  5        H-  u  p#[        U[        5      (       d  M  UR                  X5        M/     [        U 5       HH  u  pC[        U[        5      (       d  M  UR                  U 5        U R                   R                  U5        MJ     g)zSetup descriptor instance on the class

This sets the :attr:`this_class` and :attr:`name` attributes of each
BaseDescriptor in the class dict of the newly created ``cls`` before
calling their :attr:`class_init` method.
N)	_descriptorsr   r  rg   r   r   r   r   r   )r   r  r  r  _s        rX   r  MetaHasDescriptors.setup_class  s     +-OO%DA!^,,S$ & sODA!^,,$  ''* $rW   rQ   )r  ztype[MetaHasDescriptors]r   rn   r  tuple[type, ...]r  r   r  r   r   r6   )
r   rn   r  r  r  r   r  r   r   r   )r   r6   r  r   r   r   )
rR   rS   rT   rU   r   r  rz   r  rV   __classcell__rO  s   @rX   r6   r6     s    E&EE  E $	E
 E 
E0##/#<L#V[#	#+ +rW   r6   c                  0   ^  \ rS rSrSrSU 4S jjrSrU =r$ )r7   i  zA metaclass for HasTraits.c                  > 0 U l         0 U l        0 U l        0 U l        [        T
U ]  U5        U R                  5       n[        U 5       GH  n [        X5      n[        U[        5      (       d  M'  X@R                  U'   UnSU-  nUn US UR                  UR                  5      S-    nU Ho  nXhR                  ;   a  UR                  U   U R                  U'     M  X8R                  R!                  S0 5      ;   d  MR  UR                   U   U R                  U'     M     UR"                  S L =(       a    UR$                  n	['        U5      [(        [*        4;   a[  UR,                  cN  UR.                  cA  [        UR"                  [0        5      (       d  U	(       a  UR"                  U R                  U'   GO	['        U5      [2        [4        4;   a[  UR,                  cN  UR.                  cA  [        UR"                  [6        5      (       d  U	(       a  UR"                  U R                  U'   GO['        U5      [8        [:        4;   aA  [        UR"                  [<        5      (       d  U	(       a  UR"                  U R                  U'   GO;['        U5      [>        [@        4;   a@  [        UR"                  [B        5      (       d  U	(       a  UR"                  U R                  U'   O['        U5      [D        :X  aP  [        UR"                  [B        [0        [6        [<        45      (       d  U	(       a  UR"                  U R                  U'   O['        U5      [F        :X  a  UR"                  c  S U R                  U'   OO[        U[H        5      (       a:  URJ                  c-  URL                  c   UR$                  (       a  S U R                  U'   URN                  U R                  U'   GM     g ! [         a     GM  f = f! [         a     GNQf = f)N_%s_defaultr   _trait_default_generators)(r  _all_trait_default_generators_traits _static_immutable_initial_valuesr  r  mror   r   r   rg   r>   indexr   rd   __dict__r  r  r   rh   r   r2   minmaxintr   r*   floatr   r   r]   r   rA   rn   r   rC   r1   default_argsdefault_kwargsrF   )r   r  r  r   rw   rK  default_method_name	mro_traitcnone_okrO  s             rX   r  MetaHasTraits.setup_class  s,   :<%,.)/1,I&ggiHD* %++$)D!&3d&:#	 #$Ecii0@0@&AA&E FI #A*jj8BC**M`Ba99$?zz~~.I2NNBCB]B]^bBc99$? # $11T9Ne>N>NGUc{2!II-!II-'(;(;SAAWEJEXEX<<TBU6!II-!II-'(;(;UCCwEJEXEX<<TBe5"5#6#6==EJEXEX<<TBe7(;;"5#6#6<<EJEXEX<<TBe+"5#6#6c5$8OPPT[EJEXEX<<TBe-%2E2E2MEI<<TB"5(33!..6!008!,,EI<<TB ?DmmC55d;O  "  " s$   O!O,
O)(O),
O:9O:rQ   )r   r7   r  r   r   r   )rR   rS   rT   rU   r   r  rV   r  r  s   @rX   r7   r7     s    $SL SLrW   r7   r   rh   r9   c                    U(       d  [        S5      eU H1  nU[        Ld  M  [        U[        5      (       a  M%  [        SU-  5      e   [	        XS9$ )a>  A decorator which can be used to observe Traits on a class.

The handler passed to the decorator will be called with one ``change``
dict argument. The change dictionary at least holds a 'type' key and a
'name' key, corresponding respectively to the type of notification and the
name of the attribute that triggered the notification.

Other keys may be passed depending on the value of 'type'. In the case
where type is 'change', we also have the following keys:
* ``owner`` : the HasTraits instance
* ``old`` : the old value of the modified trait attribute
* ``new`` : the new value of the modified trait attribute
* ``name`` : the name of the modified trait attribute.

Parameters
----------
*names
    The str names of the Traits to observe on the object.
type : str, kwarg-only
    The type of event to observe (e.g. 'change')
z2Please specify at least one trait name to observe.z5trait names to observe must be strings or All, not %rr  )ro   r   rg   rn   r9   )rh   rp   r   s      rX   rJ   rJ   8  sO    , LMMs?:dC#8#8SVZZ[[  %++rW   FuncTc                t   ^  [         [         4         SU 4S jjjn[        R                  " [        U5      $ )a:  Backward-compatibility shim decorator for observers

Use with:

@observe('name')
@observe_compat
def _foo_changed(self, change):
    ...

With this, `super()._foo_changed(self, name, old, new)` in subclasses will still work.
Allows adoption of new observer API without breaking subclasses that override and super.
c                   > [        U[        5      (       a  [        U5      nO9U R                  R                  n[        SU SU S3[        SS9  [        SUUUU S9nT" X5      $ )NzA parent of z._zA_changed has adopted the new (traitlets 4.1) @observe(change) APIr   r  r   )rh   r  r   r   r.  )rg   dictr   rO  rR   r   r  )ry   change_or_namer  r   r   clsnamefuncs         rX   compatible_observer+observe_compat.<locals>.compatible_observerd  su     nd++>*Fnn--Gwir.)99z{"
 #F D!!rW   )
ry   r   r  rn   r  r   r   r   r   r   )rB   r[   r\   r  )r  r  s   ` rX   rK   rK   V  sQ     8Ay""%("/4"GL"	" "* 66%,--rW   rE   c                     U (       d  [        S5      eU  H1  nU[        Ld  M  [        U[        5      (       a  M%  [        SU-  5      e   [	        U 5      $ )ah  A decorator to register cross validator of HasTraits object's state
when a Trait is set.

The handler passed to the decorator must have one ``proposal`` dict argument.
The proposal dictionary must hold the following keys:

* ``owner`` : the HasTraits instance
* ``value`` : the proposed value for the modified trait attribute
* ``trait`` : the TraitType instance associated with the attribute

Parameters
----------
*names
    The str names of the Traits to validate.

Notes
-----
Since the owner has access to the ``HasTraits`` instance via the 'owner' key,
the registered cross validator could potentially make changes to attributes
of the ``HasTraits`` instance. However, we recommend not to do so. The reason
is that the cross-validation of attributes may run in arbitrary order when
exiting the ``hold_trait_notifications`` context, and such changes may not
commute.
z3Please specify at least one trait name to validate.z6trait names to validate must be strings or All, not %r)ro   r   rg   rn   rE   )rp   r   s     rX   rM   rM   |  sO    2 MNNs?:dC#8#8TW[[\\  5!!rW   r%   c                ^    [        U [        5      (       d  [        SU -  5      e[        U 5      $ )a  A decorator which assigns a dynamic default for a Trait on a HasTraits object.

Parameters
----------
name
    The str name of the Trait on the object whose default should be generated.

Notes
-----
Unlike observers and validators which are properties of the HasTraits
instance, default value generators are class-level properties.

Besides, default generators are only invoked if they are registered in
subclasses of `this_type`.

::

    class A(HasTraits):
        bar = Int()

        @default('bar')
        def get_bar_default(self):
            return 11

    class B(A):
        bar = Float()  # This trait ignores the default generator defined in
                       # the base class A

    class C(B):

        @default('bar')
        def some_other_default(self):  # This default generator should not be
            return 3.0                 # ignored since it is defined in a
                                       # class derived from B.a.this_class.
z*Trait name must be a string or All, not %r)rg   rn   ro   r%   )r   s    rX   rF   rF     s.    H dC  DtKLL$rW   .)boundc                      \ rS rSrS	S jr\R                  S
S j5       r\R                  SS j5       rSS jrSSS jjrSr	g)r)   i  c                    Xl         U $ rZ   r  )ry   r  s     rX   
_init_callEventHandler._init_call  s    	rW   c                    g rZ   rQ   )ry   r  rg  r  s       rX   r~   EventHandler.__call__  r:  rW   c                    g rZ   rQ   ry   rg  r  s      rX   r~   r    r:  rW   c                l    [        U S5      (       a  U R                  " U0 UD6$ U R                  " U0 UD6$ )zCPass `*args` and `**kwargs` to the handler's function if it exists.r  )r"  r  r  r  s      rX   r~   r    s7    4  99d-f--??D3F33rW   Nc                N    Uc  U $ [         R                  " U R                  U5      $ rZ   )r  r  r  )ry   instr   s      rX   r8  EventHandler.__get__  s#    <K		400rW   r  )r  r  r   r)   )r  r  rg  r   r  r   r   r  rg  r   r  r   r   r   rZ   )r  r   r   r   r   ztypes.MethodType | EventHandler)
rR   rS   rT   rU   r  r[   r  r~   r8  rV   rQ   rW   rX   r)   r)     sF     ZZ  ZZ 41 1rW   r)   c                  ,    \ rS rSrSSS jjrSS jrSrg)	r9   i  c                    Xl         X l        g rZ   trait_namesrh   )ry   rp   rh   s      rX   rz   ObserveHandler.__init__  s     	rW   c                L    UR                  X R                  U R                  S9  g )Nr  )rJ   r  rh   ry   r  s     rX   r   ObserveHandler.instance_init  s    T++$))<rW   r  N)r  )rp   tuple[Sentinel | str, ...]rh   rn   r   r   r  r0   r   r   rR   rS   rT   rU   rz   r   rV   rQ   rW   rX   r9   r9     s    =rW   c                  (    \ rS rSrSS jrSS jrSrg)rE   i  c                    Xl         g rZ   r  )ry   rp   s     rX   rz   ValidateHandler.__init__  s     rW   c                :    UR                  X R                  5        g rZ   )_register_validatorr  r  s     rX   r   ValidateHandler.instance_init  s      '7'78rW   r  N)rp   r  r   r   r  r  rQ   rW   rX   rE   rE     s    !9rW   c                  6   ^  \ rS rSrSS jrSU 4S jjrSrU =r$ )r%   i  c                    Xl         g rZ   r   ry   r   s     rX   rz   DefaultHandler.__init__  s    rW   c                T   > [         TU ]  X5        XR                  U R                  '   g rZ   )r  r   r  r   ry   r   r   rO  s      rX   r   DefaultHandler.class_init  s"    3%9=%%doo6rW   r  )r   rn   r   r   r   )rR   rS   rT   rU   rz   r   rV   r  r  s   @rX   r%   r%     s    > >rW   c                  :   ^  \ rS rSrSrSU 4S jjrSS jrSrU =r$ )r/   i  z5The base class for all classes that have descriptors.c                    > U S   nU SS  n [         [        U]
  nU[        R                  L a	  U" U5      nOU" U/U Q70 UD6nUR                  " U 0 UD6  U$ r   )r  r/   r  r   setup_instance)rg  r  r   new_methr  rO  s        rX   r  HasDescriptors.__new__   sf    1gABx 5v~~%C=DC1$1&1DT,V,rW   c                 t    U S   nU SS n SUl         UR                  nUR                   H  nU" U5        M     g)z4
This is called **before** self.__init__ is called.
r   r   NF)r1  rO  r   )rg  r  ry   r   inits        rX   r  HasDescriptors.setup_instance  sB    
 AwABx&+#nn ''DJ (rW   r1  r  rg  r   r  r   r   r   )	rR   rS   rT   rU   r   r  r  rV   r  r  s   @rX   r/   r/     s    ? rW   r/   )	metaclassc                    ^  \ rS rSr% S\S'   S\S'   S\S'   S\S'   S\S	'   S\S
'   S\S'   S-U 4S jjrS-U 4S jjrS.S jrS/S jr\	\
R                  S0S j5       5       r\
R                  S0S j5       rS1S jrS2S jrS3S jr        S4S jr        S5S jr   S6       S7S jjr\S4       S8S jjr\S4       S8S jjr\4S9S jjr      S:S jrS;S jrS<S jr\S=S j5       r\S>S  j5       r\      S>U 4S! jj5       rS?S" jrS?S# jr S@S$ jr!SAS% jr"SBS& jr#SCS' jr$SDS( jr%SESFS) jjr&\SGU 4S* jj5       r'\SESHS+ jj5       r(S,r)U =r*$ )Ir0   i"  r   r)  r  zdict[str | Sentinel, t.Any]_trait_notifiersrN  r]   r1  r  r  c                    > U S   nU SS  n UR                   R                  5       Ul        0 Ul        0 Ul        SUl        [        [        U]"  " U 0 UD6  g )Nr   r   F)	r  r  r)  r	  rN  r1  r  r0   r  )rg  r  ry   rO  s      rX   r  HasTraits.setup_instance+  s\    AwABx
 "BBGGI "!#&+#i-t>v>rW   c           	     z  > Un0 nU(       a  SS jnXPl         SU l        0 nUR                  5        H<  u  pxU R                  U5      (       a  [	        XU5        [        US UU SS9Xg'   M8  XU'   M>     [        U5      [        U R                  5      -  n	U	 HC  nU R                  U   R                  U [        X5      5      nU R                  Xx5        XU   S'   ME     SU l        U ? U	 H  nU R                  Xg   5        M      [        TU ]0  " U0 UD6  g ! [         a  n
U Vs/ s H  n[        U5      PM     Os  snf nnUR                  5        H  u  pUR                  U SU< 35        M     SR!                  U5      n[#        S	R%                  UU R&                  R(                  U
S
9[*        SS9   S n
A
g S n
A
ff = f)Nr   c                    g rZ   rQ   )r   s    rX   ignore"HasTraits.__init__.<locals>.ignoreC  s    rW   Tr   r  r   r.  rh   r   F=z, zPassing unrecognized arguments to super({classname}).__init__({arg_s}).
{error}
This is deprecated in traitlets 4.2.This error will be raised in a future release of traitlets.)arg_s	classnamerj  r   r  r  )notify_changer1  r  	has_traitr   r   rB  r  rH  r   	set_traitr  rz   ro   r}  r   rh  r   ri  rO  rR   r  )ry   rg  r  
super_argssuper_kwargsr  changesr   rw   changedr4  arg
arg_s_listr  r  r  rO  s                   rX   rz   HasTraits.__init__9  s    
 "(*.D'G$lln
>>#&&Du-#(  !"%$GL ).% - &kC$55GS)99$@RSs*&+U#  +0D'"""7<0 	Gj9L9 	/9:z$s)z:J:$**,!!QCq,/ -IIj)EN OUf"nn55 OU O
 #	s%   D 
F:F5 D65A;F55F:c                    U R                   R                  5       n0 US'   0 US'   U R                  R                  5       US'   SUS'   U$ )Nr	  rN  r)  Fr1  )r  r  r)  )ry   ds     rX   __getstate__HasTraits.__getstate__v  sU    MM  !#
!#
!//446/&+
"#rW   c                    UR                  5       U l        U R                  n[        U5       H7  n [	        X#5      n[        U[        5      (       a  UR                  U 5        M7  M9     g ! [         a     MI  f = frZ   )	r  r  rO  r   r   rg   r)   r   r   )ry   stater   r   rw   s        rX   __setstate__HasTraits.__setstate__  sm    

 nns8C.) e\22''- 3  " s   A))
A76A7c              #  v   #    U R                   (       a  Sv   g SU l         Sv   SU l         g! SU l         f = f7f)z
A contextmanager for running a block with our cross validation lock set
to True.

At the end of the block, the lock's value is restored to its value
prior to entering the block.
NTFr  r   s    rX   cross_validation_lockHasTraits.cross_validation_lock  s6      &&4.2+.3+e+s   9- 9	69c              #  ~  ^^	#    U R                   (       a  Sv   g0 mS	S jm	S
UU	4S jjn Xl        SU l         Sv   [        TR                  5       5       HE  n[	        U R
                  U5      nUR                  U [	        X5      5      nU R                  X$5        MG      SU l         U ?TR                  5        H  nU H  nU R                  U5        M     M     g! [         a  nS U l        TR                  5        Hq  u  p&USSS2    H`  nUR                  S:X  d  M  UR                  [        La  U R                  X'R                  5        ME  U R                  R                  U5        Mb     Ms     0 mUeSnAff = f! SU l         U ?TR                  5        H  nU H  nU R                  U5        M     M     f = f7f)a   Context manager for bundling trait change notifications and cross
validation.

Use this when doing multiple trait assignments (init, config), to avoid
race conditions in trait notifiers requesting other trait values.
All trait notifications will fire after all values have been assigned.
Nr   c                    U c  U/$ U S   S   S:X  a$  UR                   S:X  a  UR                  U S   S'   U $ U R                  U5        U $ )z5Merges the provided change with the last if possible.r  rh   r   r   )rh   r   r   )past_changesr   s     rX   compress4HasTraits.hold_trait_notifications.<locals>.compress  s]    '"8O#B'/8;x@W28**R(/ (' %++F3''rW   c                T   > U R                   nT" TR                  U5      U 5      TU'   g rZ   )r   r  )r   r   cacher,  s     rX   hold0HasTraits.hold_trait_notifications.<locals>.hold  s$    {{&uyy?drW   Tc                    g rZ   rQ   r   s    rX   r   4HasTraits.hold_trait_notifications.<locals>.<lambda>  s    trW   r  F)r+  zlist[Bunch] | Noner   r   r   zlist[Bunch]r  )r1  r  listrv  r   rO  rH  r  r=   r  rh   r  rB   r)  popvalues)
ry   r0  r   rK  rw   r4  r  r   r/  r,  s
           @@rX   hold_trait_notifications"HasTraits.hold_trait_notifications  s     &&,.E
(@ @ 3 &*".2+ .D#DNND9E!11$8KLENN4/ /$ /4+&  %||~G")**62 #*  .'  %3"%*[[]MD")$B$-!;;(2%zz: $tZZ @ $ 2 2 6 6t < #0 &3  /4+&  %||~G")**62 #*  .s<   'F=A3C  ;F=
E;%6E6AE66E;;E> ><F::F=c           
     <    U R                  [        UUUU SS95        g )Nr   r  )r  r   )ry   r   r@  r?  s       rX   r>  HasTraits._notify_trait  s'    	
rW   r   c                $    U R                  U5      $ )z"Notify observers of a change event)r2  r   s     rX   r  HasTraits.notify_change  s    %%f--rW   c                   [        U[        5      (       d  [        U5      nUS   US   p2/ nX R                  ;   az  UR                  U R                  R	                  U0 5      R	                  U/ 5      5        UR                  U R                  R	                  U0 5      R	                  [
        / 5      5        [
        U R                  ;   a  UR                  U R                  R	                  [
        0 5      R	                  U/ 5      5        UR                  U R                  R	                  [
        0 5      R	                  [
        / 5      5        SU-  nUS   S:X  a}  [        X5      (       am  [        U R                  U5      n[        U[        5      (       dB  [        UU R                  US5        [        X5      nXt;  a  UR                  [        U5      5        U Hd  n[        U[        5      (       a  UR                  nO7[        U[        5      (       a"  UR                   b  [        XR                   5      nU" U5        Mf     g)zNotify observers of any eventr   rh   z_%s_changedr   z$use @observe and @unobserve instead.N)rg   r   r	  extendr  r   r"  r   rO  r9   r   r   r  r  r~   r)   r   )	ry   eventr   rh   	callables
magic_nameclass_valuer  r  s	            rX   r2  HasTraits._notify_observers  s   %''%LE6]E&Md	(((T2266tR@DDT2NOT2266tR@DDS"MN$'''T2266sB?CCD"MNT2266sB?CCCLM #T)
=H$)B)B!$..*=Kk>::!NN:	 T.&$$%6r%:; A !-..JJA|,,1CD&&)eH rW   c                    X R                   ;  a  / nX40U R                   U'   O8X0R                   U   ;  a  / nX@R                   U   U'   OU R                   U   U   nX;  a  UR                  U5        g g rZ   )r	  r   )ry   handlerr   rh   nlists        rX   _add_notifiersHasTraits._add_notifiers"  s|     ,,,!#E+/-D!!$'006649%%d+D1--d3D9LL!  rW   c                     Uc  U R                   U   U	 g U R                   U   U   R                  U5        g ! [         a     g f = frZ   )r	  remover/  )ry   rE  r   rh   s       rX   _remove_notifiersHasTraits._remove_notifiers1  sO    	))$/5%%d+D188A 		s   8 !8 
AAc                    [        S[        SS9  Uc  [        nU(       a  U R                  [	        U5      US9  gU R                  [	        U5      US9  g)a  DEPRECATED: Setup a handler to be called when a trait changes.

This is used to setup dynamic notifications of trait changes.

Static handlers can be created by creating methods on a HasTraits
subclass with the naming convention '_[traitname]_changed'.  Thus,
to create static handler for the trait 'a', create the method
_a_changed(self, name, old, new) (fewer arguments can be used, see
below).

If `remove` is True and `handler` is not specified, all change
handlers for the specified name are uninstalled.

Parameters
----------
handler : callable, None
    A callable that is called when a trait changes.  Its
    signature can be handler(), handler(name), handler(name, new),
    handler(name, old, new), or handler(name, old, new, self).
name : list, str, None
    If None, the handler will apply to all traits.  If a list
    of str, handler will apply to all names in the list.  If a
    str, the handler will apply just to that name.
remove : bool
    If False (the default), then install the handler.  If True
    then unintall it.
zCon_trait_change is deprecated in traitlets 4.1: use observe insteadr   r  Nr   )r   r  r   r   r  rJ   )ry   rE  r   rJ  s       rX   on_trait_changeHasTraits.on_trait_change<  sQ    B 	Q	

 <DNN,W5TNBLL*734L@rW   c                L    [        U5       H  nU R                  XU5        M     g)aY  Setup a handler to be called when a trait changes.

This is used to setup dynamic notifications of trait changes.

Parameters
----------
handler : callable
    A callable that is called when a trait changes. Its
    signature should be ``handler(change)``, where ``change`` is a
    dictionary. The change dictionary at least holds a 'type' key.
    * ``type``: the type of notification.
    Other keys may be passed depending on the value of 'type'. In the
    case where type is 'change', we also have the following keys:
    * ``owner`` : the HasTraits instance
    * ``old`` : the old value of the modified trait attribute
    * ``new`` : the new value of the modified trait attribute
    * ``name`` : the name of the modified trait attribute.
names : list, str, All
    If names is All, the handler will apply to all traits.  If a list
    of str, handler will apply to all names in the list.  If a
    str, the handler will apply just to that name.
type : str, All (default: 'change')
    The type of notification to filter by. If equal to All, then all
    notifications are passed to the observe handler.
N)rL   rG  ry   rE  rp   rh   r   s        rX   rJ   HasTraits.observei  s#    > (.Dt4 /rW   c                L    [        U5       H  nU R                  XU5        M     g)an  Remove a trait change handler.

This is used to unregister handlers to trait change notifications.

Parameters
----------
handler : callable
    The callable called when a trait attribute changes.
names : list, str, All (default: All)
    The names of the traits for which the specified handler should be
    uninstalled. If names is All, the specified handler is uninstalled
    from the list of notifiers corresponding to all changes.
type : str or All (default: 'change')
    The type of notification to filter by. If All, the specified handler
    is uninstalled from the list of notifiers corresponding to all types.
N)rL   rK  rQ  s        rX   r   HasTraits.unobserve  s#    , (.D""7$7 /rW   c                b    U[         L a  0 U l        g U R                  U	 g! [         a     gf = f)zwRemove trait change handlers of any type for the specified name.
If name is not specified, removes all trait notifiers.N)r   r	  r/  r  s     rX   unobserve_allHasTraits.unobserve_all  s8     3;$&D!))$/ s   ! 
..c                    U H_  nSU-  n[        X5      (       d  M  [        U R                  U5      n[        U[        5      (       a  MG  [        UU R                  US5        Ma     U H  nXR                  U'   M     g)a  Setup a handler to be called when a trait should be cross validated.

This is used to setup dynamic notifications for cross-validation.

If a validator is already registered for any of the provided names, a
TraitError is raised and no new validator is registered.

Parameters
----------
handler : callable
    A callable that is called when the given trait is cross-validated.
    Its signature is handler(proposal), where proposal is a Bunch (dictionary with attribute access)
    with the following attributes/keys:
        * ``owner`` : the HasTraits instance
        * ``value`` : the proposed value for the modified trait attribute
        * ``trait`` : the TraitType instance associated with the attribute
names : List of strings
    The names of the traits that should be cross-validated
rL  rM  N)r"  r   rO  rg   rE   r   rN  )ry   rE  rp   r   rA  rB  s         rX   r  HasTraits._register_validator  sr    , D'$.Jt((%dnnjA!+??%#":	  D+2""4( rW   c                $   U R                   nSUR                  0n[        US5      (       a  UR                  US'   UR	                  U5        [        UR                  U4U5      U l         UR                  5        H  nUR                  U 5        M     g)z;Dynamically add trait attributes to the HasTraits instance.rS   rT   N)	rO  rS   r"  rT   r  rh   rR   r6  r   )ry   r   r   attrsrK  s        rX   
add_traitsHasTraits.add_traits  sv    nns~~.3''$'$4$4E.!VcllSFE:]]_E% %rW   c                    U R                   nU R                  U5      (       d  [        SUR                   SU 35      e[	        X15      R                  X5        g)z>Forcibly sets trait attribute, including read-only attributes.Class  does not have a trait named N)rO  r  r=   rR   r   rB  )ry   r   rw   r   s       rX   r  HasTraits.set_trait  sL    nn~~d##vcll^3PQUPVWXXt+rW   c                8    [        U R                  " S0 UD65      $ )z}Get a list of all the names of this class' traits.

This method is just like the :meth:`trait_names` method,
but is unbound.
rQ   )r4  class_traits)r   r   s     rX   class_trait_namesHasTraits.class_trait_names  s     C$$0x011rW   c                V   U R                   R                  5       n[        U5      S:X  a  U$ 0 nUR                  5        Hg  u  pEUR                  5        HJ  u  pg[	        U5      (       d  [        U5      nU" UR                  R                  US5      5      (       a  MI    Ma     XSU'   Mi     U$ )a|  Get a ``dict`` of all the traits of this class.  The dictionary
is keyed on the name and the values are the TraitType objects.

This method is just like the :meth:`traits` method, but is unbound.

The TraitTypes returned don't know anything about the values
that the various HasTrait's instances are holding.

The metadata kwargs allow functions to be passed in which
filter traits based on metadata values.  The functions should
take a single value as an argument and return a boolean.  If
any function returns False, then the trait is not included in
the output.  If a metadata key doesn't exist, None will be passed
to the function.
r   Nr  r  r   r  callablers   r   r  )r   r   r   resultr   rK  	meta_name	meta_evals           rX   rc  HasTraits.class_traits  s    " !!#x=AM!<<>KD(0(8$		** +I 6I !3!3It!DEE	 )9  %t * rW   c           	        > [        X 5      nU R                  " S0 UD6R                  5        VVs0 s H  u  p4[        X#S5      ULd  M  X4_M     snn$ s  snnf )zGet a dict of all the traitlets defined on this class, not a parent.

Works like `class_traits`, except for excluding traits from parents.
NrQ   )r  rc  r  r   )r   r   suprq   r[   rO  s        rX   class_own_traitsHasTraits.class_own_traits  sa     Co **6X6<<>
>st$A- AD>
 	
 
s   A	Ac                    XR                   ;   $ )z?Returns True if the object has a trait with the specified name.r  r  s     rX   r  HasTraits.has_trait   s    ||##rW   c                    XR                   ;   $ )a  Returns True if the specified trait has a value.

This will return false even if ``getattr`` would return a
dynamically generated default value. These default values
will be recognized as existing only after they have been
generated.

Example

.. code-block:: python

    class MyClass(HasTraits):
        i = Int()


    mc = MyClass()
    assert not mc.trait_has_value("i")
    mc.i  # generates a default value
    assert mc.trait_has_value("i")
)r)  r  s     rX   trait_has_valueHasTraits.trait_has_value$  s    * ))))rW   c                d    U R                   " S0 UD6 Vs0 s H  o"[        X5      _M     sn$ s  snf )ap  A ``dict`` of trait names and their values.

The metadata kwargs allow functions to be passed in which
filter traits based on metadata values.  The functions should
take a single value as an argument and return a boolean.  If
any function returns False, then the trait is not included in
the output.  If a metadata key doesn't exist, None will be passed
to the function.

Returns
-------
A ``dict`` of trait names and their values.

Notes
-----
Trait values are retrieved via ``getattr``, any exceptions raised
by traits or the operations they may trigger will result in the
absence of a trait value in the result ``dict``.
rQ   )r  r   )ry   r   r   s      rX   trait_valuesHasTraits.trait_values;  s4    ( 7;6F6F6R6RS6Rdgd))6RSSSs   -c                    SU-  nX R                   ;   a  [        X5      $ X R                  R                   ;   a  [        U R                  U5      $ U R                  U   $ )z|Return default generator for a given trait

Walk the MRO to resolve the correct default generator according to inheritance.
r  )r  r   rO  r  )ry   r   method_names      rX   _get_trait_default_generator&HasTraits._get_trait_default_generatorQ  sU    
 $d*--'4--..1114>>;7711$77rW   c           	        U H>  nU R                  U5      (       a  M  [        SU S[        U 5      R                   S35      e   [	        U5      S:X  aB  [	        U5      S:X  a3  [
        R                  " [        U R                  US   5      " U 5      5      $ U R                  " S0 UD6nUR                  U5        0 nU H  nU R                  U5      " U 5      XS'   M     U$ )zReturn a trait's default value or a dictionary of them

Notes
-----
Dynamically generated default values may
depend on the current state of the object.'z' is not a trait of 'z' instancesr   r   rQ   )r  r=   rh   rR   r   r[   r\   r   r|  r  r>  )ry   rp   r   rq   r  defaultss         rX   r0  HasTraits.trait_defaults]  s     A>>!$$ 1QC'<T$Z=P=P<QQ\!]^^  u:?s8}166(D$E$EeAh$OPT$UVV&&225!A;;A>tDHK rW   c                8    [        U R                  " S0 UD65      $ )z2Get a list of all the names of this class' traits.rQ   )r4  r   )ry   r   s     rX   r  HasTraits.trait_namess  s    DKK+(+,,rW   c                V   U R                   R                  5       n[        U5      S:X  a  U$ 0 nUR                  5        Hg  u  pEUR                  5        HJ  u  pg[	        U5      (       d  [        U5      nU" UR                  R                  US5      5      (       a  MI    Ma     XSU'   Mi     U$ )a7  Get a ``dict`` of all the traits of this class.  The dictionary
is keyed on the name and the values are the TraitType objects.

The TraitTypes returned don't know anything about the values
that the various HasTrait's instances are holding.

The metadata kwargs allow functions to be passed in which
filter traits based on metadata values.  The functions should
take a single value as an argument and return a boolean.  If
any function returns False, then the trait is not included in
the output.  If a metadata key doesn't exist, None will be passed
to the function.
r   Nrg  )ry   r   r   ri  r   rK  rj  rk  s           rX   r   HasTraits.traitsw  s     ""$x=AM!<<>KD(0(8$		** +I 6I !3!3It!DEE	 )9  %t * rW   c                X    [        U R                  U5      nSU-   S-   n[        X5      (       a)  U[        X5      ;   a  [        X5      R                  X#5      $ UR                  R                  X#5      $ ! [         a+  n[        SU R                  R                   SU 35      UeSnAff = f)z%Get metadata values for trait by key.r_  r`  Nr  	_metadata)r   rO  r   r=   rR   r"  r  r   )ry   	traitnamer   rF   rK  r4  metadata_names          rX   trait_metadataHasTraits.trait_metadata  s    	DNNI6E
 i+54''C743O,O4/33CAA>>%%c33  	0011NykZ	s   A4 4
B)>&B$$B)c           	        > [        X 5      nU R                  U5      R                  5        VVs0 s H  u  p4[        X#S5      ULd  M  X4_M     snn$ s  snnf )zGet a dict of all event handlers defined on this class, not a parent.

Works like ``event_handlers``, except for excluding traits from parents.
N)r  eventsr  r   )r   r   rn  rq   r4  rO  s        rX   class_own_trait_events HasTraits.class_own_trait_events  s\     Co **T*002
2st$A- AD2
 	
 
s   AAc                   0 n[        U 5       Ht  u  p4[        U[        5      (       d  M  Uc  XBU'   M%  XR                  ;   a  XBU'   M:  [	        US5      (       d  MM  U R                  " S0 UR
                  D6(       d  Mp  XBU'   Mv     U$ )aF  Get a ``dict`` of all the event handlers of this class.

Parameters
----------
name : str (default: None)
    The name of a trait of this class. If name is ``None`` then all
    the event handlers of this class will be returned instead.

Returns
-------
The event handlers associated with a trait name, or all event handlers.
tagsrQ   )r   rg   r)   r  r"  r  )r   r   r  r  r  s        rX   trait_eventsHasTraits.trait_events  st     sODA!\**< !1I]]* !1IQ''000$%q	 $ rW   )rO  r  r1  r	  rN  r)  r  r  )r   r   )r#  r   r   r   r   )r   rn   r@  r   r?  r   r   r   r  )r?  r   r   r   )rE  t.Callable[..., t.Any]r   Sentinel | strrh   str | Sentinelr   r   )rE  zt.Callable[..., t.Any] | Noner   r  rh   r  r   r   )NNF)rE  zEventHandler | Noner   zSentinel | str | NonerJ  r]   r   r   )rE  r  rp   +Sentinel | str | t.Iterable[Sentinel | str]rh   r  r   r   )r   zstr | t.Anyr   r   )rE  zt.Callable[..., None]rp   ztuple[str | Sentinel, ...]r   r   )r   r   r   r   )r   rn   rw   r   r   r   )r   r   r   r   r   	list[str])r   r   r   r   r   "dict[str, TraitType[t.Any, t.Any]])r   rn   r   r]   )r   r   r   r   )r   rn   r   r   )rp   rn   r   r   r   zdict[str, t.Any] | Sentinel)r   r   r   r  )r   r   r   r  rZ   )r  rn   r   rn   rF   r   r   r   )r   r   r   rn   r   dict[str, EventHandler])r   r   r   r   r   r  )+rR   rS   rT   rU   r   r  rz   r   r$  propertyr   r   r'  r7  r>  r  r2  rG  rK  rN  r   rJ   r   rV  r  r\  r  classmethodrd  rc  ro  r  ru  rx  r|  r0  r  r   r  r  r  rV   r  r  s   @rX   r0   r0   "  sV   ##&661122  #33?;z
." 4  4$ >3 >3@	
.)V"-"5C"KY"	"	4	<J	R`			 (,&*	+A$+A $+A 	+A
 
+A` >A'	 5' 5 ; 5 	 5
 
 5J >A'	8'8 ;8 	8
 
82 14 	"3,"35O"3	"3H
&, 2 2  B 

*/
	+
 
$*.T,
8,->4 

 

  rW   r0   c                  "    \ rS rSrSrSS jrSrg)r"   i  zY
A trait with error reporting and string -> type resolution for Type,
Instance and This.
c                    [        U5      $ )z=
Resolve a string supplied for a type into an actual object.
r   )ry   strings     rX   _resolve_string#ClassBasedTraitType._resolve_string  s     6""rW   rQ   Nr  rn   r   r   rR   rS   rT   rU   r   r  rV   rQ   rW   rX   r"   r"     s    
#rW   r"   c                    ^  \ rS rSrSr\R                  (       a  \R                        S                 SS jj5       r\R                        S                 SS jj5       r\R                        S                 SS jj5       r\R                        S                 SS jj5       r\	SSSSS4               SU 4S	 jjjrSS
 jr
SS jrSS jrSS jrSS jrSrU =r$ )r@   i  z<A trait whose value must be a subclass of a specified class.c                    g rZ   rQ   ry   r  klassr   r   r	  r  r  s           rX   rz   Type.__init__       rW   c                    g rZ   rQ   r  s           rX   rz   r    r  rW   c                    g rZ   rQ   r  s           rX   rz   r    r  rW   c                    g rZ   rQ   r  s           rX   rz   r    r  rW   NFc                  > U[         L a  Uc  [        OUnOUnUc  Ub	  U[         L a  [        nOUn[        R                  " U5      (       d   [	        U[
        5      (       d  [        S5      eX l        [        T	U ]$  " U4UUUUS.UD6  g)a  Construct a Type trait

A Type trait specifies that its values must be subclasses of
a particular class.

If only ``default_value`` is given, it is used for the ``klass`` as
well. If neither are given, both default to ``object``.

Parameters
----------
default_value : class, str or None
    The default value must be a subclass of klass.  If an str,
    the str must be a fully specified class name, like 'foo.bar.Bah'.
    The string is resolved into real class, when the parent
    :class:`HasTraits` class is instantiated.
klass : class, str [ default object ]
    Values of this trait must be a subclass of klass.  The klass
    may be specified in a string like: 'foo.bar.MyClass'.
    The string is resolved into real class, when the parent
    :class:`HasTraits` class is instantiated.
allow_none : bool [ default False ]
    Indicates whether None is allowed as an assignable value.
**kwargs
    extra kwargs passed to `ClassBasedTraitType`
Nz"A Type trait must specify a class.)r   r   r	  r  )
rB   r   r
  r  rg   rn   r=   r  r  rz   )
ry   r  r  r   r   r	  r  r  new_default_valuerO  s
            rX   rz   r    s    F I%+0=u -=%=I+E%&&*UC*@*@ABB
	
!	
 	
rW   c           
     h   [        U[        5      (       a   U R                  U5      n [        X R                  5      (       a  [        R                  " [        U5      $  U R                  X5        g! [         a&  n[	        SU R
                   SU SU< S35      UeSnAff = f! [         a     NQf = f)z4Validates that the value is a valid object instance.zThe '' trait of z instance must be a type, but z could not be importedN)rg   rn   r  ImportErrorr=   r   ri   r  r[   r\   r   r3  rj  ry   r   rw   r4  s       rX   rM   Type.validateW  s    eS!!,,U3	%,,vva'' -
 	

3   DII;k#6Ti57   		s(   A1 4B$ 1
B!;!BB!$
B10B1c                    [        U R                  [        5      (       a  U R                  nO0U R                  R                  S-   U R                  R                  -   nSU-  nU R
                  (       a  US-   $ U$ )#Returns a description of the trait.r  za subclass of '%s' or None)rg   r  rn   rS   rR   r   )ry   r  ri  s      rX   r\  	Type.infoi  s`    djj#&&JJEJJ))C/$**2E2EEE%-??J&&rW   c                $    U R                  5         g rZ   _resolve_classesr   s     rX   r   Type.instance_initt       	rW   c                   [        U R                  [        5      (       a   U R                  U R                  5      U l        [        U R                  [        5      (       a!  U R                  U R                  5      U l        g g rZ   )rg   r  rn   r  r  r   s    rX   r  Type._resolve_classesy  sZ    djj#&&--djj9DJd((#..!%!5!5d6H6H!ID /rW   c                    U R                   nUc   e[        U[        5      (       a  [        U5      $ [        UR                   SUR
                   35      $ )Nr  )r  rg   rn   r}  rS   rR   rx   s     rX   r~  Type.default_value_repr  sR    ""   eS!!;5++,Aenn-=>??rW   )r  r  ......)ry   zType[type, type]r  Sentinel | None | strr  
None | strr   Literal[False]r   r  r	  r   r  t.Any | Noner  r   r   r   )ry   zType[type | None, type | None]r  r  r  r  r   Literal[True]r   r  r	  r   r  r  r  r   r   r   )ry   z
Type[S, S]r  r   r  r   r   r  r   r  r	  r   r  r  r  r   r   r   )ry   zType[S | None, S | None]r  zS | Noner  r   r   r  r   r  r	  r   r  r  r  r   r   r   )r  r   r  r   r   r]   r   r  r	  r   r  r  r  r   r   r   r   r   rw   r   r   r   r   r   r   )rR   rS   rT   rU   r   r[   TYPE_CHECKINGr  rz   rB   rM   r\  r   r  r~  rV   r  r  s   @rX   r@   r@     s   F	
 47 #),%("#&
	"
	0
	 
	 '	
	
 #
	 
	 !
	 
	 
	 

	 
 47 #(+%("#&
	0
	0
	 
	 &	
	
 #
	 
	 !
	 
	 
	 

	 
  #),%("#&
	
	
	 
	 '	
	
 #
	 
	 !
	 
	 
	 

	 
 '*(+%("#&
	*
	#
	 
	 &	
	
 #
	 
	 !
	 
	 
	 

	  ) !%#:
:
 :
 	:

 :
 :
 :
 :
 
:
 :
x$	 
J@ @rW   r@   c                  >  ^  \ rS rSr% SrSrS\S'   \R                  (       a  \R                        S                 SS jj5       r
\R                        S                 SS jj5       r
\R                        S                 SS jj5       r
\R                        S                 SS	 jj5       r
      S               SU 4S
 jjjr
SS jrSS jrSS jrSS jrSS jrSS jrSS jrSrU =r$ ) r1   i  zA trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute
Nstr | type[T] | Noner  c                    g rZ   rQ   ry   r  rg  kwr   r   r	  r  s           rX   rz   Instance.__init__  r  rW   c                    g rZ   rQ   r  s           rX   rz   r    r  rW   c                    g rZ   rQ   r  s           rX   rz   r    r  rW   c                    g rZ   rQ   r  s           rX   rz   r    r  rW   c                ~  > Uc  U R                   nUb7  [        R                  " U5      (       d  [        U[        5      (       a  Xl         O[        SU-  5      eUb   [        U[        5      (       d  [        S5      eUb   [        U[        5      (       d  [        S5      eX l        X0l	        [        TU ],  " SXEUS.UD6  g)a   Construct an Instance trait.

This trait allows values that are instances of a particular
class or its subclasses.  Our implementation is quite different
from that of enthough.traits as we don't allow instances to be used
for klass and we handle the ``args`` and ``kw`` arguments differently.

Parameters
----------
klass : class, str
    The class that forms the basis for the trait.  Class names
    can also be specified as strings, like 'foo.bar.Bar'.
args : tuple
    Positional arguments for generating the default value.
kw : dict
    Keyword arguments for generating the default value.
allow_none : bool [ default False ]
    Indicates whether None is allowed as a value.
**kwargs
    Extra kwargs passed to `ClassBasedTraitType`

Notes
-----
If both ``args`` and ``kw`` are None, then the default value is None.
If ``args`` is a tuple and ``kw`` is a dict, then the default is
created as ``klass(*args, **kw)``.  If exactly one of ``args`` or ``kw`` is
None, the None is replaced by ``()`` or ``{}``, respectively.
Nz+The klass attribute must be a class not: %rz)The 'kw' argument must be a dict or None.z,The 'args' argument must be a tuple or None.)r   r   r	  rQ   )r  r
  r  rg   rn   r=   r  tupler  r  r  rz   )	ry   r  rg  r  r   r   r	  r  rO  s	           rX   rz   r    s    L =JJEGOOE$:$:jPS>T>TJJURSSNJr4$8$8HIIju&=&=KLL  YJ$YRXYrW   c                    U R                   c   eU R                  (       a  Uc  U$ [        X R                   5      (       a  [        R                  " [
        U5      $ U R                  X5        g rZ   )r  r   rg   r[   r\   r   rj  r*  s      rX   rM   Instance.validate 	  sN    zz%%%??u}LeZZ((66!U##JJs"rW   c                    [        U R                  [        5      (       a  [        U R                  5      nO[	        SU R                  5      nU R
                  (       a  US-  nU$ )Nra  r  )rg   r  rn   r   r	   r   )ry   ri  s     rX   r\  Instance.info		  sG    djj#&& ,Fc4::.F??j FrW   c                $    U R                  5         g rZ   r  r   s     rX   r   Instance.instance_init	  r  rW   c                    [        U R                  [        5      (       a!  U R                  U R                  5      U l        g g rZ   )rg   r  rn   r  r   s    rX   r  Instance._resolve_classes	  s.    djj#&&--djj9DJ 'rW   c                    U R                   c  U R                  c  g U R                  c   eU R                  " U R                   =(       d    S0 U R                  =(       d    0 D6$ )NrQ   r  r  r  r   s    rX   r!  Instance.make_dynamic_default	  sW    %D,?,?,Gzz%%%zzD--3T9L9L9RPRTTrW   c                4    [        U R                  5       5      $ rZ   )r}  r!  r   s    rX   r~  Instance.default_value_repr!	  s    D--/00rW   c                J    [         R                  " [        [        U5      5      $ rZ   )r[   r\   r   re   r  s     rX   r  Instance.from_string$	  s    vva+A.//rW   r  r  )ry   zInstance[T]r  type[T]rg  tuple[t.Any, ...] | Noner  dict[str, t.Any] | Noner   r  r   r  r	  r   r  r   r   r   )ry   zInstance[T | None]r  r  rg  r  r  r  r   r  r   r  r	  r   r  r   r   r   )ry   zInstance[t.Any]r  r   rg  r  r  r  r   r  r   r  r	  r   r  r   r   r   )ry   zInstance[t.Any | None]r  r   rg  r  r  r  r   r  r   r  r	  r   r  r   r   r   )NNNFNN)r  r  rg  r  r  r  r   r]   r   r  r	  r   r  r   r   r   r   r   rw   r   r   T | Noner   r   r   )r   r  r`   rn   r   r  )rR   rS   rT   rU   r   r  r   r[   r  r  rz   rM   r\  r   r  r!  r~  r  rV   r  r  s   @rX   r1   r1     s    #'E&	
 !-0*-),%("
	
	
	 +
	 (	
	
 '
	 #
	 
	 
	 
	 

	 
 !-0*-(+%("
	$
	
	 +
	 (	
	
 &
	 #
	 
	 
	 
	 

	 
 !$-0*-),%("
	!
	
	 +
	 (	
	
 '
	 #
	 
	 
	 
	 

	 
 !$-0*-(+%("
	(
	
	 +
	 (	
	
 &
	 #
	 
	 
	 
	 

	 '+)-&* !%6Z#6Z '6Z $	6Z
 6Z 6Z 6Z 6Z 
6Z 6Zp# 
:U10 0rW   r1   c                  "    \ rS rSrSrSS jrSrg)r,   i(	  z;
Mixin for forward-declared versions of Instance and Type.
c                d    U R                   R                  n[        SR                  X!/5      5      $ )zn
Find the specified class name by looking for it in the module in which
our this_class attribute was defined.
r  )r   rS   r   rh  )ry   r  modnames      rX   r  $ForwardDeclaredMixin._resolve_string-	  s*    
 //,,388W$5677rW   rQ   Nr  r  rQ   rW   rX   r,   r,   (	  s    8rW   r,   c                      \ rS rSrSrSrg)r-   i6	  z#
Forward-declared version of Type.
rQ   NrR   rS   rT   rU   r   rV   rQ   rW   rX   r-   r-   6	      rW   r-   c                      \ rS rSrSrSrg)r+   i<	  z'
Forward-declared version of Instance.
rQ   Nr  rQ   rW   rX   r+   r+   <	  r  rW   r+   c                  >   ^  \ rS rSrSrSrSU 4S jjrSS jrSrU =r	$ )	r<   iB	  a   A trait for instances of the class containing this trait.

Because how how and when class bodies are executed, the ``This``
trait can only have a default value of None.  This, and because we
always validate default values, ``allow_none`` is *always* true.
z4an instance of the same type as the receiver or Nonec                &   > [         TU ]  " S0 UD6  g )NrZ   r  rz   )ry   r  rO  s     rX   rz   This.__init__L	  s    ((rW   c                    U R                   c   e[        X R                   5      (       d  Uc  U$ U R                  X5        g rZ   )r   rg   rj  r*  s      rX   rM   This.validateO	  s8     ***e__--%-LJJs"rW   rQ   )r  r   r   r   )r   r   rw   r   r   r  )
rR   rS   rT   rU   r   r  rz   rM   rV   r  r  s   @rX   r<   r<   B	  s     GI)# #rW   r<   c                     ^  \ rS rSrSrSU 4S jjrSSU 4S jjjrSU 4S jjrSS jrSS jr	SS jr
SU 4S	 jjrS
rU =r$ )rC   iZ	  z'A trait type representing a Union type.c                   > [        U5      U l        SR                  U R                   Vs/ s H  o3R                  5       PM     sn5      U l        [
        TU ]  " S0 UD6  gs  snf )a  Construct a Union  trait.

This trait allows values that are allowed by at least one of the
specified trait types. A Union traitlet cannot have metadata on
its own, besides the metadata of the listed types.

Parameters
----------
trait_types : sequence
    The list of trait types of length at least 1.
**kwargs
    Extra kwargs passed to `TraitType`

Notes
-----
Union([Float(), Bool(), Int()]) attempts to validate the provided values
with the validation function of Float, then Bool, and finally Int.

Parsing from string is ambiguous for container types which accept other
collection-like literals (e.g. List accepting both `[]` and `()`
precludes Union from ever parsing ``Union([List(), Tuple()])`` as a tuple;
you can modify behaviour of too permissive container traits by overriding
``_literal_from_string_pairs`` in subclasses.
Similarly, parsing unions of numeric types is only unambiguous if
types are provided in order of increasing permissiveness, e.g.
``Union([Int(), Float()])`` (since floats accept integer-looking values).
z or NrQ   )r4  rV  rh  r\  r  r  rz   )ry   rV  r  ttrO  s       rX   rz   Union.__init__]	  sS    8  ,$:J:J%K:JBggi:J%KL"6" &Ls   A!c                   > [         TU ]  U5      nU R                   H   nU[        L a  UR                  U5      nM    U$    U$ rZ   )r  rF   rV  rB   )ry   r   rF   rK  rO  s       rX   rF   Union.default}	  sF    '/#&%%E)#--, &
 rW   c                   > [        U R                  5       H  nUR                  US 5        M     [        TU ]	  X5        g rZ   )reversedrV  r   r  )ry   r   r   
trait_typerO  s       rX   r   Union.class_init	  s5    "4#3#34J!!#t, 53%rW   c                ^    [        U R                  5       H  nUR                  U5        M     g rZ   )r  rV  r   )ry   r   r  s      rX   r   Union.subclass_init	  s%    "4#3#34J$$S) 5rW   c                \   UR                      U R                   HT  n UR                  X5      nU R                  b'  [	        USU R                  -   S-   UR
                  5        Us  sS S S 5        $    S S S 5        U R                  X5        g ! [         a     M  f = f! , (       d  f       N1= f)Nr  r  )r'  rV  r(  r   r   r   r=   rj  )ry   r   rw   r  r  s        rX   rM   Union.validate	  s    &&"..
",,S8Ayy,S499_{%BJDWDWXH '&. ' 	

3 "  '&s5   BAB$B0B
BBBB
B+c                    [        U[        5      (       a"  [        U R                  UR                  -   5      $ [        / U R                  QUP5      $ rZ   rU  rW  s     rX   rY  Union.__or__	  sG    eU##))E,=,==>>34++3U344rW   c                   > U R                    H'  n UR                  U5      nUR                  S U5      s  $    [
        TU ]  U5      $ ! [        [        4 a     MM  f = frZ   )rV  r  rM   r=   rd   r  )ry   r`   r  r  rO  s       rX   r  Union.from_string	  sf    **J**1-!**433 + w"1%% 
+ s   "AAA)r  rV  )rV  r   r  r   r   r   rZ   )r   r   r   r   r   r   r  r   r   r   r   rw   r   r   r   )rX  r   r   rC   r`   rn   r   r   )rR   rS   rT   rU   r   rz   rF   r   r   rM   rY  r  rV   r  r  s   @rX   rC   rC   Z	  s4    1#@ &
*5& &rW   rC   c                     \ rS rSr% Sr\R                  (       a  \R                   SSSSS.               SS jjj5       r\R                   SSSSS.               SS jjj5       r\R                   SSSS	S
S.               SS jjj5       r SS	SS	S
S.               SS jjjr\R                  SS j5       r	\R                  SS j5       r	SS jr	S
r
S\S'   SrSrSS jrSrg
)r   i	  zA trait which allows any value..r   r	  r  r  r  c                   g rZ   rQ   ry   r  r   r   r	  r  r  s          rX   rz   Any.__init__	  r  rW   c                   g rZ   rQ   r  s          rX   rz   r  	  r  rW   FN)r   r	  r   r  c                   g rZ   rQ   ry   r  r   r	  r   r  r  s          rX   rz   r  	  r  rW   r  c                   g rZ   rQ   r  s          rX   rz   r  	       rW   c                    g rZ   rQ   r7  s      rX   r8  Any.__get__	      rW   c                    g rZ   rQ   r7  s      rX   r8  r  	  r  rW   c                    g rZ   rQ   r7  s      rX   r8  r  	  s    rW   Tr   c                    g rZ   rQ   r   s     rX   r   Any.subclass_init	      rW   rQ   ).)ry   r   r  r   r   r  r   r  r	  r   r  r  r  r   r   r   )ry   r   r  r   r   r  r   r  r	  r   r  r  r  r   r   r   )ry   r   r  r   r   Literal[True, False]r	  r   r   r  r  r   r  r   r   r   )ry   r   r  r   r   r]   r	  r   r   r  r  r   r  r   r   r   )r   r   r   r  r   r   )r   r   r   r  r   r   )r   r  r   r  r   zt.Any | Anyr	  )rR   rS   rT   rU   r   r[   r  r  rz   r8  r  r   r   r  r   rV   rQ   rW   rX   r   r   	  s1   )	
 $'
	
 &)"#&
	
	 
	 '	
	
 #
	 
	 !
	 
	 
	 

	 
 $'
	
 &)"#&
	
	 
	 &	
	
 #
	 
	 !
	 
	 
	 

	 
 $'
	 03"%* 
	
	 
	 -	
	
 
	 #
	 
	 
	 
	 

	 $'
	  %!%* 
	
	 
	 	
	
 
	 #
	 
	 
	 
	 
	 
	 
	 
		 #'M<&JIrW   r   c                J   U R                   bD  X R                   :  a5  [        SU R                   S[        U5       SU R                    SU S3	5      eU R                  bD  X R                  :  a5  [        SU R                   S[        U5       SU R                   SU S3	5      eU$ )z
Validate that a number to be applied to a trait is between bounds.

If value is not between min_bound and max_bound, this raises a
TraitError with an error message appropriate for this trait.
zThe value of the 'r  z" instance should not be less than , but a value of z was specifiedz% instance should not be greater than )r  r=   r   r   r  )rK  r   rw   s      rX   _validate_boundsr!  	  s     yy!2 K G  %		{*;E7 C
 	

 yy!2 K G##(99+->ug F
 	

 LrW   c                  &  ^  \ rS rSrSrSrSr\R                       S               SS jj5       r	\R                       S               SS jj5       r	\
SSSS4             SU 4S	 jjjr	SS
 jrSS jrSS jrSrU =r$ )r2   i
  zAn int trait.r   zan intc                    g rZ   rQ   r  s          rX   rz   Int.__init__
       	rW   c                    g rZ   rQ   r  s          rX   rz   r$  +
  r%  rW   FNc           	        > UR                  SS 5      U l        UR                  SS 5      U l        [        TU ]  " SUUUUUS.UD6  g )Nr  r  r  r   r   r	  r  rQ   )r5  r  r  r  rz   ry   r  r   r   r	  r  r  rO  s          rX   rz   r$  7
  sT     ::eT*::eT* 	
'!	
 	
rW   c                    [        U[        5      (       d  U R                  X5        [        R                  " [
        [        XU5      5      $ rZ   )rg   r  rj  r[   r\   r   r!  r*  s      rX   rM   Int.validateK
  s4    %%%JJs"vva)$U;<<rW   c                    U R                   (       a!  US:X  a  [        R                  " [        S 5      $ [        R                  " [        [	        U5      5      $ Nr   )r   r[   r\   r   r  r  s     rX   r  Int.from_stringP
  s4    ??qF{66!T?"vvaQ  rW   c                    g rZ   rQ   r   s     rX   r   Int.subclass_initU
  r  rW   r  r  .....)ry   zInt[int, int]r  zint | Sentinelr   r  r   r  r	  r   r  r  r  r   r   r   )ry   zInt[int | None, int | None]r  zint | Sentinel | Noner   r  r   r  r	  r   r  r  r  r   r   r   )r  r   r   r]   r   r  r	  r   r  r  r  r   r   r   r  r`   rn   r   r   r	  rR   rS   rT   rU   r   r  r  r[   r  rz   rB   rM   r  r   rV   r  r  s   @rX   r2   r2   
  sk   MIZZ ),%(!$"		%	 #	 		
 	 	 	 
	 	 ZZ 03$'!$"	)	,	 "	 		
 	 	 	 
	 	  ) !%#

 
 	

 
 
 
 

 
(=
!
 rW   r2   c                  "   \ rS rSrSr\R                  (       ao  \R                       S	               S
S jj5       r\R                       S	               SS jj5       r     S	               SS jjrSS jr	Sr
g)r   iY
  z#A casting version of the int trait.c                    g rZ   rQ   r  s          rX   rz   CInt.__init__^
  r  rW   c                    g rZ   rQ   r  s          rX   rz   r7  j
  r  rW   c                    g rZ   rQ   r  s          rX   rz   r7  v
       rW   c                     [        U5      n[        R                  " [
        [        XU5      5      $ ! [         a    U R                  X5         NBf = frZ   )r  r3  rj  r[   r\   r   r!  r*  s      rX   rM   CInt.validate
  sH    	#JE vva)$U;<<  	#JJs"	#   2 AArQ   Nr2  )ry   zCInt[int, t.Any]r  zt.Any | Sentinelr   r  r   r  r	  r   r  r  r  r   r   r   )ry   CInt[int | None, t.Any]r  t.Any | Sentinel | Noner   r  r   r  r	  r   r  r  r  r   r   r   )ry   r>  r  r?  r   r]   r   r  r	  r   r  r  r  r   r   r   r  rR   rS   rT   rU   r   r[   r  r  rz   rM   rV   rQ   rW   rX   r   r   Y
  s[   -	
 /2),%("#&		"		+		 '		 #			
 		 !		 		 		 
		 
 69(+%("#&		)		2		 &		 #			
 		 !		 		 		 
		 69"%("#&		)		2		 		 #			
 		 !		 		 		=rW   r   c                  *  ^  \ rS rSrSrSrSr\R                       S               SS jj5       r	\R                       S               SS jj5       r	\
SSSS4               SU 4S	 jjjr	SS
 jrSS jrSS jrSrU =r$ )r*   i
  zA float trait.g        za floatc                    g rZ   rQ   r  s          rX   rz   Float.__init__
  r%  rW   c                    g rZ   rQ   r  s          rX   rz   rC  
  r%  rW   FNc           	        > UR                  S[        S5      * 5      U l        UR                  S[        S5      5      U l        [        TU ]  " SUUUUUS.UD6  g )Nr  infr  r(  rQ   )r5  r  r  r  r  rz   r)  s          rX   rz   rC  
  s^     ::eeEl]3::eU5\2 	
'!	
 	
rW   c                    [        U[        5      (       a  [        U5      n[        U[        5      (       d  U R                  X5        [        R
                  " [        [        XU5      5      $ rZ   )rg   r  r  rj  r[   r\   r   r!  r*  s      rX   rM   Float.validate
  sJ    eS!!%LE%''JJs"vva)$U;<<rW   c                    U R                   (       a!  US:X  a  [        R                  " [        S 5      $ [        R                  " [        [	        U5      5      $ r-  )r   r[   r\   r   r  r  s     rX   r  Float.from_string
  s4    ??qF{66!T?"vvaq""rW   c                    g rZ   rQ   r   s     rX   r   Float.subclass_init
  r  rW   r1  r2  )ry   zFloat[float, int | float]r  zfloat | Sentinelr   r  r   r  r	  r   r  r  r  r   r   r   )ry   %Float[int | None, int | float | None]r  float | Sentinel | Noner   r  r   r  r	  r   r  r  r  r   r   r   )ry   rM  r  rN  r   r]   r   r  r	  r   r  r  r  r   r   r   r  r3  r	  r4  r  s   @rX   r*   r*   
  ss   MIZZ +.%(!$"	'	'	 #	 		
 	 	 	 
	 	 ZZ 25$'!$"	3	.	 "	 		
 	 	 	 
	 	 2; !&#
3
.
 
 	

 
 
 
 

 
(=#
 rW   r*   c                  "   \ rS rSrSr\R                  (       ao  \R                       S	               S
S jj5       r\R                       S	               SS jj5       r     S	               SS jjrSS jr	Sr
g)r   i
  z%A casting version of the float trait.c                    g rZ   rQ   r  s          rX   rz   CFloat.__init__
  r  rW   c                    g rZ   rQ   r  s          rX   rz   rQ  
  r  rW   c                    g rZ   rQ   r  s          rX   rz   rQ  
  r:  rW   c                     [        U5      n[        R                  " [
        [        XU5      5      $ ! [         a    U R                  X5         NBf = frZ   )r  r3  rj  r[   r\   r   r!  r*  s      rX   rM   CFloat.validate
  sH    	#%LE vva)$U;<<  	#JJs"	#r=  rQ   Nr2  )ry   zCFloat[float, t.Any]r  r   r   r  r   r  r	  r   r  r  r  r   r   r   )ry   CFloat[float | None, t.Any]r  r   r   r  r   r  r	  r   r  r  r  r   r   r   )ry   rV  r  r   r   r]   r   r  r	  r   r  r  r  r   r   r   r  r@  rQ   rW   rX   r   r   
  s[   /	
 $'),%("#&		&		 		 '		 #			
 		 !		 		 		 
		 
 $'(+%("#&		-		 		 &		 #			
 		 !		 		 		 
		 $'"%("#&		-		 		 		 #			
 		 !		 		 		=rW   r   c                  >    \ rS rSrSrSrSrS
S jrSS jrSS jr	Sr
g	)r#   i
  zA trait for complex numbers.y                za complex numberc                    [        U[        5      (       a  U$ [        U[        [        45      (       a  [        U5      $ U R	                  X5        g rZ   )rg   complexr  r  rj  r*  s      rX   rM   Complex.validate  s;    eW%%LeeS\**5>!

3rW   c                H    U R                   (       a  US:X  a  g [        U5      $ r-  )r   rY  r  s     rX   r  Complex.from_string  s    ??qF{qzrW   c                    g rZ   rQ   r   s     rX   r   Complex.subclass_init  r  rW   rQ   Nr   r   rw   r   r   complex | None)r`   rn   r   r`  r	  rR   rS   rT   rU   r   r  r  rM   r  r   rV   rQ   rW   rX   r#   r#   
  s    &M"I
rW   r#   c                  "    \ rS rSrSrSS jrSrg)r   i  z.A casting version of the complex number trait.c                \     [        U5      $ ! [         a    U R                  X5         g f = frZ   )rY  r3  rj  r*  s      rX   rM   CComplex.validate  s,    	#5>! 	#JJs"	#   
 ++rQ   Nr_  rR   rS   rT   rU   r   rM   rV   rQ   rW   rX   r   r     s
    8#rW   r   c                  >    \ rS rSrSrSrSrS
S jrSS jrSS jr	Sr
g	)r   i"  zA trait for byte strings.rW   za bytes objectc                T    [        U[        5      (       a  U$ U R                  X5        g rZ   )rg   bytesrj  r*  s      rX   rM   Bytes.validate(  s     eU##L

3rW   c                    U R                   (       a  US:X  a  g [        U5      S:  aA  S H;  nUS S SU 3:X  d  M  US   U:X  d  M  UnUSS n[        SU< SU< S	3[        SS
9    O   UR	                  S5      $ )Nr   r  "r  r   br  zISupporting extra quotes around Bytes is deprecated in traitlets 5.0. Use  instead of r  r  utf8)r   r   r   r  encode)ry   r`   quoteold_ss       rX   r  Bytes.from_string-  s    ??qF{q6Q;#Ra5awK'AbEUNE!BA e<y;*#$	  $ xxrW   c                    g rZ   rQ   r   s     rX   r   Bytes.subclass_init?  r  rW   rQ   Nr   r   rw   r   r   bytes | None)r`   rn   r   rx  r	  ra  rQ   rW   rX   r   r   "  s    #M I
 $rW   r   c                  "    \ rS rSrSrSS jrSrg)r   iC  z+A casting version of the byte string trait.c                \     [        U5      $ ! [         a    U R                  X5         g f = frZ   )ri  r3  rj  r*  s      rX   rM   CBytes.validateF  s,    	#< 	#JJs"	#re  rQ   Nrw  rf  rQ   rW   rX   r   r   C  s
    5#rW   r   c                  >   \ rS rSrSrSrSr\R                  (       ao  \R                       S               SS jj5       r
\R                       S               SS jj5       r
     S               SS jjr
SS jrSS	 jrSS
 jrSrg)rA   iM  zA trait for unicode strings.r  za unicode stringc                    g rZ   rQ   r  s          rX   rz   Unicode.__init__U  r  rW   c                    g rZ   rQ   r  s          rX   rz   r~  a  r  rW   c                    g rZ   rQ   r  s          rX   rz   r~  m  r:  rW   c           
        [        U[        5      (       a  [        R                  " [        U5      $ [        U[
        5      (       a,   [        R                  " [        UR                  SS5      5      $ U R                  X5        g ! [         a6  nSn[        UR                  X R                  [        U5      5      5      UeS nAff = f)Nasciistrictz<Could not decode {!r} for unicode trait '{}' of {} instance.)rg   rn   r[   r\   r   ri  decodeUnicodeDecodeErrorr=   ri  r   r   rj  )ry   r   rw   r4  ro  s        rX   rM   Unicode.validatex  s    eS!!66!U##eU##Uvvagx!@AA 	

3 & UT E99hsm!LMSTTUs   *B 
C1B??Cc                z   U R                   (       a!  US:X  a  [        R                  " [        S 5      $ [        R
                  R                  U5      n[        U5      S:  aA  S H;  nUS   US   s=:X  a  U:X  d  M  O  M  UnUSS n[        SU< SU< S	3[        SS
9  M=     [        R                  " [        U5      $ )Nr   r   rl  r   r  r   zSSupporting extra quotes around strings is deprecated in traitlets 5.0. You can use ro  z if you require traitlets >=5.r  )
r   r[   r\   r   ospath
expanduserr   r   r  )ry   r`   r  rs  s       rX   r  Unicode.from_string  s    ??qF{66!T?"GGq!q6Q;Q41R5%A%%E!BA''(e<y@^`*#$		   vva|rW   c                    g rZ   rQ   r   s     rX   r   Unicode.subclass_init  r  rW   rQ   Nr2  )ry   zUnicode[str, str | bytes]r  r  r   r  r   r  r	  r   r  r   r  r   r   r   )ry   'Unicode[str | None, str | bytes | None]r  str | Sentinel | Noner   r  r   r  r	  r   r  r   r  r   r   r   )ry   r  r  r  r   r]   r   r  r	  r   r  r   r  r   r   r   r  r3  r	  )rR   rS   rT   rU   r   r  r  r[   r  r  rz   rM   r  r   rV   rQ   rW   rX   rA   rA   M  so   &M"I	
 -0),%("		+		)		 '		 #			
 		 		 		 		 
		 
 47(+%("		9		0		 &		 #			
 		 		 		 		 
		 47"%("		9		0		 		 #			
 		 		 		 			$rW   rA   c                  "   \ rS rSrSr\R                  (       ao  \R                       S	               S
S jj5       r\R                       S	               SS jj5       r     S	               SS jjrSS jr	Sr
g)r   i  z'A casting version of the unicode trait.c                    g rZ   rQ   r  s          rX   rz   CUnicode.__init__  r  rW   c                    g rZ   rQ   r  s          rX   rz   r    r  rW   c                    g rZ   rQ   r  s          rX   rz   r    r:  rW   c                     [         R                  " [        [        U5      5      $ ! [         a    U R                  X5         g f = frZ   )r[   r\   r   rn   r3  rj  r*  s      rX   rM   CUnicode.validate  s7    	#66!SZ(( 	#JJs"	#   #& AArQ   Nr2  )ry   zCUnicode[str, t.Any]r  r  r   r  r   r  r	  r   r  r   r  r   r   r   )ry   CUnicode[str | None, t.Any]r  r  r   r  r   r  r	  r   r  r   r  r   r   r   )ry   r  r  r  r   r]   r   r  r	  r   r  r   r  r   r   r   r  r@  rQ   rW   rX   r   r     s[   1	
 -0),%("		&		)		 '		 #			
 		 		 		 		 
		 
 47(+%("		-		0		 &		 #			
 		 		 		 		 
		 47"%("		-		0		 		 #			
 		 		 		 		#rW   r   c                  B    \ rS rSrSrSr\" S 5      rS	S jrS
S jr	Sr
g)r8   i  zwA string holding a valid object name in this version of Python.

This does not check that the name exists in any scope.z#a valid object identifier in Pythonc                    U$ rZ   rQ   )r  r`   s     rX   r   ObjectName.<lambda>  s    1rW   c                    U R                  X5      n[        U[        5      (       a  [        U5      (       a  U$ U R	                  X5        g rZ   )
coerce_strrg   rn   r^   rj  r*  s      rX   rM   ObjectName.validate  s8    +eS!!l5&9&9L

3rW   c                6    U R                   (       a  US:X  a  g U$ r-  r  r  s     rX   r  ObjectName.from_string  s    ??qF{rW   rQ   Nr   r   rw   r   r   rn   )r`   rn   r   r   )rR   rS   rT   rU   r   r  staticmethodr  rM   r  rV   rQ   rW   rX   r8   r8     s"    > 6In-JrW   r8   c                  "    \ rS rSrSrSS jrSrg)r'   i  zFA string holding a valid dotted object name in Python, such as A.b3._cc                    U R                  X5      n[        U[        5      (       a(  [        S UR	                  S5       5       5      (       a  U$ U R                  X5        g )Nc              3  8   #    U  H  n[        U5      v   M     g 7frZ   )r^   )rb  ra  s     rX   rc  ,DottedObjectName.validate.<locals>.<genexpr>  s     )TCSa,q//CSs   r  )r  rg   rn   allr  rj  r*  s      rX   rM   DottedObjectName.validate  sG    +eS!!c)T5;;sCS)T&T&TL

3rW   rQ   Nr  rf  rQ   rW   rX   r'   r'     s
    PrW   r'   c                  H   \ rS rSrSrSrSr\R                  (       ao  \R                       S               SS jj5       r
\R                       S               SS jj5       r
     S               SS jjr
SS jrSS	 jrSS
 jrSS jrSrg)r   i  zA boolean (True, False) trait.Fz	a booleanc                    g rZ   rQ   r  s          rX   rz   Bool.__init__  r  rW   c                    g rZ   rQ   r  s          rX   rz   r    r  rW   c                    g rZ   rQ   r  s          rX   rz   r  	  r:  rW   c                4   [        U[        5      (       a  [        R                  " [        U5      $ [        U[
        5      (       aB  US:X  a  [        R                  " [        S5      $ US:X  a  [        R                  " [        S5      $ U R                  X5        g )Nr   Tr   F)rg   r]   r[   r\   r   r  rj  r*  s      rX   rM   Bool.validate  sh    eT""66!U##s##zvva&!vva''

3rW   c                    U R                   (       a!  US:X  a  [        R                  " [        S 5      $ UR	                  5       nUS;   a  [        R                  " [        S5      $ US;   a  [        R                  " [        S5      $ [        S5      e)Nr   >   1trueT>   0falseFz%r is not 1, 0, true, or false)r   r[   r\   r   lowerrd   r  s     rX   r  Bool.from_string  sg    ??qF{66!T?"GGI66!T?". 66!U##=>>rW   c                    g rZ   rQ   r   s     rX   r   Bool.subclass_init)  r  rW   c                R    / SQnU R                   (       a  UR                  S5        U$ ) Completion hints for argcomplete)r  r  r  r  r   )r   r   )ry   r  completionss      rX   argcompleterBool.argcompleter,  s"    1??v&rW   rQ   Nr2  )ry   zBool[bool, bool | int]r  bool | Sentinelr   r  r   r  r	  r   r  r   r  r   r   r   )ry   $Bool[bool | None, bool | int | None]r  bool | Sentinel | Noner   r  r   r  r	  r   r  r   r  r   r   r   )ry   r  r  r  r   r]   r   r  r	  r   r  r   r  r   r   r   r  r3  r	  r  r   r   r  )rR   rS   rT   rU   r   r  r  r[   r  r  rz   rM   r  r   r  rV   rQ   rW   rX   r   r     st   (MI	
 .1),%("		(		*		 '		 #			
 		 		 		 		 
		 
 58(+%("		6		1		 &		 #			
 		 		 		 		 
		 58"%("		6		1		 		 #			
 		 		 		 			?rW   r   c                  "   \ rS rSrSr\R                  (       ao  \R                       S	               S
S jj5       r\R                       S	               SS jj5       r     S	               SS jjrSS jr	Sr
g)r   i4  z'A casting version of the boolean trait.c                    g rZ   rQ   r  s          rX   rz   CBool.__init__9  r  rW   c                    g rZ   rQ   r  s          rX   rz   r  E  r  rW   c                    g rZ   rQ   r  s          rX   rz   r  Q  r:  rW   c                     [         R                  " [        [        U5      5      $ ! [         a    U R                  X5         g f = frZ   )r[   r\   r   r]   r3  rj  r*  s      rX   rM   CBool.validate\  s7    	#66!T%[)) 	#JJs"	#r  rQ   Nr2  )ry   zCBool[bool, t.Any]r  r  r   r  r   r  r	  r   r  r   r  r   r   r   )ry   CBool[bool | None, t.Any]r  r  r   r  r   r  r	  r   r  r   r  r   r   r   )ry   r  r  r  r   r]   r   r  r	  r   r  r   r  r   r   r   r  r@  rQ   rW   rX   r   r   4  s[   1	
 .1),%("		$		*		 '		 #			
 		 		 		 		 
		 
 58(+%("		+		1		 &		 #			
 		 		 		 		 
		 58"%("		+		1		 		 #			
 		 		 		 		#rW   r   c                    ^  \ rS rSrSr\R                  (       aX  \R                       S                 SS jj5       r\R                       S                 SS jj5       r\	SSSS4                 SU 4S jjjrSS jr
SSS	 jjrSSS
 jjrSS jrSS jrSS jrSS jrSS jrSrU =r$ )r(   ic  z0An enum whose value must be in a given sequence.c                    g rZ   rQ   ry   r6  r  r   r   r	  r  r  s           rX   rz   Enum.__init__h  r  rW   c                    g rZ   rQ   r  s           rX   rz   r  u  r  rW   FNc                t   > Xl         USL a  U[        L a  S nX7S'   XGS'   XWS'   XgS'   [        TU ]  " U40 UD6  g )NTr   r   r	  r  )r6  rB   r  rz   )	ry   r6  r  r   r   r	  r  r  rO  s	           rX   rz   r    sO     -9"< M)|'{v!x1&1rW   c                    U R                   (       a*  X R                   ;   a  [        R                  " [        U5      $ U R	                  X5        g rZ   )r6  r[   r\   r   rj  r*  s      rX   rM   Enum.validate  s/    ;;5KK/66!U##

3rW   c                    U R                   =(       d    / nU(       a  SR                  S U 5       5      nU$ [        [        U5      5      nU$ )6Returns a description of the trait choices (not none).|c              3  ,   #    U  H
  nS U-  v   M     g7fz``%r``NrQ   rb  r   s     rX   rc  $Enum._choices_str.<locals>.<genexpr>  s     !@1(Q,   )r6  rh  r}  r4  )ry   as_rstchoices
choice_strs       rX   _choices_strEnum._choices_str  sE    ++#!@!@@J  d7m,JrW   c                p    U R                   (       a  SU(       a  SOS-  OSnSU R                  U5       U 3$ r   or %s`None`r   r  any of r   r  ry   r  nones      rX   _info
Enum._info  6    >Booxv86:SU**623D6::rW   c                     U R                  SS9$ NFr  r  r   s    rX   r\  	Enum.info      zzz''rW   c                     U R                  SS9$ NTr  r  r   s    rX   info_rstEnum.info_rst      zzz&&rW   c                     U R                  S U5      $ ! [         a'    [        R                  " [        [        U5      5      s $ f = frZ   )rM   r=   r[   r\   r   re   r  s     rX   r  Enum.from_string  s>    	4==q)) 	466!/233	4s    .AAc                    g rZ   rQ   r   s     rX   r   Enum.subclass_init  r  rW   c                j    U R                   =(       d    /  Vs/ s H  n[        U5      PM     sn$ s  snf )r  )r6  rn   )ry   r  r  s      rX   r  Enum.argcompleter  s,     $ 1r 12 11A 1222s   0)r6  r2  )ry   Enum[G]r6  zt.Sequence[G]r  zG | Sentinelr   r  r   r  r	  r   r  r   r  r   r   r   )ry   zEnum[G | None]r6  t.Sequence[G] | Noner  G | Sentinel | Noner   r  r   r  r	  r   r  r   r  r   r   r   )ry   r  r6  r  r  r  r   r]   r   r  r	  r   r  r   r  r   r   r   r  Fr  r]   r   rn   r   r3  r	  r  )rR   rS   rT   rU   r   r[   r  r  rz   rB   rM   r  r  r\  r  r  r   r  rV   r  r  s   @rX   r(   r(   c  s   :	
 +.),%("
	
	!
	 (
	 '	
	
 #
	 
	 
	 
	 
	 

	 
 25(+%("
	 
	(
	 /
	 &	
	
 #
	 
	 
	 
	 
	 

	 .7 !%22$2 +2 	2
 2 2 2 2 
2 2&
;
('43 3rW   r(   c                  t   ^  \ rS rSrSr\4         S	U 4S jjjrS
S jrSSS jjrSS jr	SS jr
SrU =r$ )r!   i  z4An enum of strings where the case should be ignored.c                ,   > [         TU ]  " U4SU0UD6  g Nr  r  )ry   r6  r  r  rO  s       rX   rz   CaselessStrEnum.__init__  s     	G}GGrW   c                V   [        U[        5      (       d  U R                  X5        U R                  =(       d    /  HY  n[        U[        5      (       d   eUR	                  5       UR	                  5       :X  d  M>  [
        R                  " [        U5      s  $    U R                  X5        g rZ   )rg   rn   rj  r6  r  r[   r\   r   )ry   r   rw   r  s       rX   rM   CaselessStrEnum.validate  sv    %%%JJs"""Aa%%%%wwyEKKM)vva|# # 	

3rW   c                r    U R                   (       a  SU(       a  SOS-  OSnSU R                  U5       SU 3$ )r  r  r  r   r  r  z (case-insensitive)r  r  s      rX   r  CaselessStrEnum._info  s9    >Booxv86:SU**6233FtfMMrW   c                     U R                  SS9$ r  r  r   s    rX   r\  CaselessStrEnum.info  r  rW   c                     U R                  SS9$ r  r  r   s    rX   r  CaselessStrEnum.info_rst  r  rW   rQ   )
ry   zCaselessStrEnum[t.Any]r6  r   r  r   r  r   r   r   r  r  r  r   )rR   rS   rT   rU   r   rB   rz   rM   r  r\  r  rV   r  r  s   @rX   r!   r!     sd    >
  )H$HH H 	H
 
H HN
(' 'rW   r!   c                     ^  \ rS rSrSrSrSr\SS4             S
U 4S jjjrSS jr	SSS jjr
SS jrSS jrS	rU =r$ )r.   i  zEAn case-ignoring enum matching choices by unique prefixes/substrings.Fc                D   > X0l         X@l        [        TU ]  " U4SU0UD6  g r  )case_sensitivesubstring_matchingr  rz   )ry   r6  r  r  r  r  rO  s         rX   rz   FuzzyEnum.__init__  s(     -"4G}GGrW   c           	        [        U[        5      (       d  U R                  X5        U R                  (       a  S OS nU R                  nU(       a  S OS nU" U5      nU R
                  =(       d    / nU Vs/ s H  ou" X#" U5      5      PM     nn[        U5      S:X  a  [        Xh5       H  u  pU
(       d  M  U	s  $    U R                  X5        g s  snf )Nc                    U $ rZ   rQ   r  s    rX   r   $FuzzyEnum.validate.<locals>.<lambda>  s    qrW   c                "    U R                  5       $ rZ   )r  r  s    rX   r   r    s
    	rW   c                
    X;   $ rZ   rQ   r  r  s     rX   r   r    s    16rW   c                $    UR                  U 5      $ rZ   )
startswithr  s     rX   r   r    s    TUT`T`abTcrW   r   )rg   rn   rj  r  r  r6  sumzip)ry   r   rw   	conv_funcr  
match_funcr  r  matchesr  ms              rX   rM   FuzzyEnum.validate  s    %%%JJs"%)%8%8[>Q	!44.@)Gc
% ++#<CDGq:eYq\2GDw<1G-1H . 	

3 Es   8Cc                    U R                   (       a  SU(       a  SOS-  OSnU R                  (       a  SOSnU R                  (       a  SOSnS	U S
U SU R                  U5       U 3$ )r  r  r  r   r  	sensitiveinsensitive	substringprefixz	any case- r_  )r   r  r  r  )ry   r  r  casesubstrs        rX   r  FuzzyEnum._info  s`    >Booxv86:SU"11{} $ 7 7X4&&d.?.?.G-HOOrW   c                     U R                  SS9$ r  r  r   s    rX   r\  FuzzyEnum.info  r  rW   c                     U R                  SS9$ r  r  r   s    rX   r  FuzzyEnum.info_rst  r  rW   )r  r  )ry   zFuzzyEnum[t.Any]r6  r   r  r   r  r]   r  r]   r  r   r   r   r  r  r  r   )rR   rS   rT   rU   r   r  r  rB   rz   rM   r  r\  r  rV   r  r  s   @rX   r.   r.     s    ON
  )$#(
H
H
H 
H 	
H
 !
H 
H 

H 
H"P(' 'rW   r.   c                    ^  \ rS rSr% SrSrS\S'   SrS\S'   \r	Sr
S\S	'   S
rS\S'   \R                  SSSS.             SS jj5       r\R                  SSSS.             SS jj5       r\R                  SSSSSS.               SS jj5       rS\SSS4             SU 4S jjjrSU 4S jjrSS jrS U 4S jjrS!S jrS"S jrS#S jrS$S%S jjrSrU =r$ )&r$   i  zTAn instance of a container (list, set, etc.)

To be subclassed by overriding klass.
Nztype[T] | Noner  rQ   r   _cast_types_trait)[]()_literal_from_string_pairs.r  c                   g rZ   rQ   ry   r   r   r	  r  r  s         rX   rz   Container.__init__  r%  rW   c                   g rZ   rQ   r5  s         rX   rz   r6  '  r%  rW   )rK  r  r	  r   r  c                   g rZ   rQ   )ry   rK  r  r	  r   r  r  s          rX   rz   r6  3  s     	rW   c           	       > Ub  U[         L a  [        U5      (       d  UnSnUcD  UR                  SS5      (       d-  [        SU R                  R
                   S3[        SS9  [         nU[         L a  SnONUc  SnSUS	'   OC[        X R                  5      (       a  U4nO%[        S
U R                  R
                   SU 35      e[        U5      (       aH  [        U[        5      (       a  [        S[        SS9  [        U[        5      (       a  U" 5       OUU l        OUb  [        S[        U5      -  5      e[        TU ]8  " SU R                  XsXES.UD6  g)aF  Create a container trait type from a list, set, or tuple.

The default value is created by doing ``List(default_value)``,
which creates a copy of the ``default_value``.

``trait`` can be specified, which restricts the type of elements
in the container to that TraitType.

If only one arg is given and it is not a Trait, it is taken as
``default_value``:

``c = List([1, 2, 3])``

Parameters
----------
trait : TraitType [ optional ]
    the type for restricting the contents of the Container.  If unspecified,
    types are not checked.
default_value : SequenceType [ optional ]
    The default value for the Trait.  Must be list/tuple/set, and
    will be cast to the container type.
allow_none : bool [ default False ]
    Whether to allow the value to be None
**kwargs : any
    further keys for extensions to the Trait (e.g. config)

Nr   FSpecifying a(default_value=None) for no default is deprecated in traitlets 5.0.5. Use default_value=Undefinedr   r  rQ   r  default value of  was r  r  z'`trait` must be a Trait or None, got %s)r  rg  r	  r   r  )rB   rj   r  r   rO  rR   r  rg   _valid_defaultsro   rh   r0  r
   r  rz   r  )	ry   rK  r  r	  r   r  r  rg  rO  s	           rX   rz   r6  @  sT   L )!;HUOO!ME L%)H)H dnn556 7/ / # &MI%D"D&*F?#';';<<!#D/0G0G/Hm_]^^E??%&&E& 	 &0t%<%<%'%DKE	RWHXXYY 	
**4i	
Z`	
rW   c                   > [        X R                  5      (       a   U R                  c   eU R                  U5      n[        TU ]  X5      nUc  U$ U R                  X5      n[        R                  " [        U5      $ rZ   )	rg   r/  r  r  rM   validate_elementsr[   r\   r   ry   r   rw   rO  s      rX   rM   Container.validate  sl    e--..::)))JJu%E ,=L&&s2vvarW   c                   / nU R                   b  [        U R                   [        5      (       a  [        R                  " [
        U5      $ U H0  n U R                   R                  X5      nUR                  U5        M2     U R                  c   eU R                  U5      $ ! [         a  nU R                  XU5         S nAMv  S nAff = frZ   )r0  rg   r   r[   r\   r   r(  r   r=   rj  r  )ry   r   rw   	validatedr  rj  s         rX   r@  Container.validate_elements  s    	;;*T[[#">">66!U##A$KK))#1   #  zz%%%zz)$$  *

35))*s   B  
C*CCc                   > [        U R                  [        5      (       a  U R                  R                  US 5        [        TU ]  X5        g rZ   )rg   r0  r>   r   r  r  s      rX   r   Container.class_init  s5    dkk9--KK""3-3%rW   c                z    [        U R                  [        5      (       a  U R                  R                  U5        g g rZ   )rg   r0  r>   r   r   s     rX   r   Container.subclass_init  s*    dkk9--KK%%c* .rW   c                    [        U[        5      (       d  [        SU< 35      e [        U5      nU R                  SU5      $ ! [         a    Sn N f = f)Load value from a single stringzExpected string, got N)rg   rn   r=   r   r3  rM   ry   r`   r}   s      rX   r  Container.from_string  sY    !S!!4QE:;;	?D }}T4((  	D	s   A AAc                  ^ ^ T R                   c   e[        U5      S:X  a  US   mTS:X  a  T R                  (       a  g[        T5      S:  a  [        U4S jT R                   5       5      (       a  T R
                  (       a  T R
                  R                  S-   nOSnT R                  c   e[        S	R                  UT R                  -   T5      [        SS
9  T R                  [        T5      5      $ [        R                  " T R                  5      nSUR                  ;   a  T R                  nO
SSU 4S jjjnT R                  [!        U5       VVs/ s H  u  pVU" XeS9PM     snn5      $ s  snnf )zYReturn the value from a list of config strings

This is where we parse CLI configuration
Nr   r   r   r   c              3  z   >#    U  H0  u  pTR                  U5      =(       a    TR                  U5      v   M2     g 7frZ   )r  endswith)rb  startendrs      rX   rc  -Container.from_string_list.<locals>.<genexpr>  s3      #"AJE U#7

37"As   8;r  r  z}--{0}={1} for containers is deprecated in traitlets 5.0. You can pass `--{0} item` ... multiple times to add items to a list.r  r  c                X   > [         R                  " [        TR                  U 5      5      $ rZ   )r[   r\   r   item_from_string)r`   r  ry   s     rX   rV  4Container.from_string_list.<locals>.item_from_string  s    vva!6!6q!9::rW   )r  rZ   r`   rn   r  z
int | Noner   zT | str)r  r   r   anyr3  r   rR   r   r   ri  r  r   r
  	signaturerV  
parameters	enumerate)ry   s_listr  sigrV  idxr`   rS  s   `      @rX   from_string_listContainer.from_string_list  sJ   
 zz%%%v;!q	AF{t1v{s #"&"A"A#     ??"oo66<G Gyy,,,[[a[a$))+Q\ '  zz,q/22 5 56cnn$#44; ; zz:CF:KL:Ka+:KL
 	
Ls   E-
c                    U R                   (       a4  [        R                  " [        U R                   R	                  U5      5      $ U$ zYCast a single item from a string

Evaluated when parsing CLI configuration from a string
)r0  r[   r\   r   r  ry   r`   r  s      rX   rV  Container.item_from_string  s0    
 ;;66!T[[44Q788HrW   )r0  )ry   Container[T]r   r  r   r  r	  r   r  r  r  r   r   r   )ry   zContainer[T | None]r   r  r   r  r	  r   r  r  r  r   r   r   )ry   rf  rK  r   r  r   r	  rn   r   r]   r  r   r  r   r   r   )rK  r  r  r   r	  r   r   r  r  r  r  r   r   r   r  r   r  r   r   r   r   r	  r  )r]  r  r   r  rZ   rX  )rR   rS   rT   rU   r   r  r   r/  SequenceTypesr>  r0  r3  r[   r  rz   rB   rM   r@  r   r   r  r`  rV  rV   r  r  s   @rX   r$   r$     s   
 !E> K#OFE(44ZZ
 "%"		 #	 		
 	 	 	 
	 	 ZZ
 "%"	!	 "	 		
 	 	 	 
	 	 ZZ "

 
 	

 
 
 
 
 

 
 #(!%#P
P
 P
 	P

 P
 P
 P
 
P
 P
d
 %&
+)'
R rW   r$   c                     ^  \ rS rSr% Sr\r\4rS\	S'   S\
S\R                  4           SU 4S jjjrSS jrSU 4S	 jjrSU 4S
 jjrSrU =r$ )r4   i  zAn instance of a Python list.r   r/  Nr   c                B   > X@l         X0l        [        TU ]  " SXS.UD6  g)a9  Create a List trait type from a list, set, or tuple.

The default value is created by doing ``list(default_value)``,
which creates a copy of the ``default_value``.

``trait`` can be specified, which restricts the type of elements
in the container to that TraitType.

If only one arg is given and it is not a Trait, it is taken as
``default_value``:

``c = List([1, 2, 3])``

Parameters
----------
trait : TraitType [ optional ]
    the type for restricting the contents of the Container.
    If unspecified, types are not checked.
default_value : SequenceType [ optional ]
    The default value for the Trait.  Must be list/tuple/set, and
    will be cast to the container type.
minlen : Int [ default 0 ]
    The minimum length of the input list
maxlen : Int [ default sys.maxsize ]
    The maximum length of the input list
rK  r  NrQ   _maxlen_minlenr  rz   ry   rK  r  minlenmaxlenr  rO  s         rX   rz   List.__init__  %    D LuLVLrW   c                z    SU R                   [        U5      U R                  U R                  U4-  n[	        U5      eNz_The '%s' trait of %s instance must be of length %i <= L <= %i, but a value of %s was specified.r   r   rn  rm  r=   r  s       rX   length_errorList.length_error!  :    myy(3-t||UKL 	
 mrW   c                   > [        U5      nX0R                  :  d  X0R                  :  a  U R                  X5        [        TU ]  X5      $ rZ   r   rn  rm  rw  r  r@  ry   r   rw   lengthrO  s       rX   r@  List.validate_elements(  =    ULL F\\$9c)w(44rW   c                l   > [        U[        5      (       a  [        TU ]  X/5      $ [        TU ]  X5      $ rZ   rg   rn   r  rB  rA  s      rX   rB  List.set/  0    eS!!7;sG,,7;s**rW   rm  rn  )rK  zIt.List[T] | t.Tuple[T] | t.Set[T] | Sentinel | TraitType[T, t.Any] | Noner  z3t.List[T] | t.Tuple[T] | t.Set[T] | Sentinel | Nonerp  r  rq  r  r  r   r   r   r   r   rw   r   r   r   r
  )rR   rS   rT   rU   r   r4  r  r  r/  r   rB   sysmaxsizerz   rw  r@  rB  rV   r  r  s   @rX   r4   r4     s    'EK! \`MVkk$MX$M K$M 	$M
 $M $M 
$M $ML5+ +rW   r4   c                     ^  \ rS rSrSr\r\\4r	Sr
S\S\R                  4           SU 4S jjjrSS jrSU 4S jjrSU 4S	 jjrSS
 jrSrU =r$ )r:   i6  zAn instance of a Python set.)r1  r2  z{}Nr   c                B   > X@l         X0l        [        TU ]  " SXS.UD6  g)a6  Create a Set trait type from a list, set, or tuple.

The default value is created by doing ``set(default_value)``,
which creates a copy of the ``default_value``.

``trait`` can be specified, which restricts the type of elements
in the container to that TraitType.

If only one arg is given and it is not a Trait, it is taken as
``default_value``:

``c = Set({1, 2, 3})``

Parameters
----------
trait : TraitType [ optional ]
    the type for restricting the contents of the Container.
    If unspecified, types are not checked.
default_value : SequenceType [ optional ]
    The default value for the Trait.  Must be list/tuple/set, and
    will be cast to the container type.
minlen : Int [ default 0 ]
    The minimum length of the input list
maxlen : Int [ default sys.maxsize ]
    The maximum length of the input list
rk  NrQ   rl  ro  s         rX   rz   Set.__init__?  rs  rW   c                z    SU R                   [        U5      U R                  U R                  U4-  n[	        U5      eru  rv  r  s       rX   rw  Set.length_errore  ry  rW   c                   > [        U5      nX0R                  :  d  X0R                  :  a  U R                  X5        [        TU ]  X5      $ rZ   r{  r|  s       rX   r@  Set.validate_elementsl  r  rW   c                l   > [        U[        5      (       a  [        TU ]  X15      $ [        TU ]  X5      $ rZ   r  rA  s      rX   rB  Set.sets  r  rW   c                |    [        [        U R                  5       =(       d    / 5      5      nUS:X  a  gSUSS -   S-   $ )Nr1  zset(){r   r  })r}  r  r!  )ry   	list_reprs     rX   r~  Set.default_value_repry  s@     9 9 ; ArBC	Yq_$s**rW   r  )rK  r   r  r   rp  r  rq  r  r  r   r   r   r  r
  r   )rR   rS   rT   rU   r   rB  r  r  r4  r/  r3  rB   r  r  rz   rw  r@  r~  rV   r  r  s   @rX   r:   r:   6  s    &E$-K!3
 (kk$M$M $M 	$M
 $M $M 
$M $ML5++ +rW   r:   c                  h   ^  \ rS rSrSr\r\4rS	U 4S jjr	S
S jr
SS jrSU 4S jjrSS jrSrU =r$ )r?   i  zAn instance of a Python tuple.c                  > UR                  S[        5      n[        U5      S:X  a#  U[        L a  [        US   5      (       d  US   nSnUcD  UR	                  SS5      (       d-  [        SU R                  R                   S	3[        S
S9  [        nU[        L a  SnONUc  SnSUS'   OC[        X0R                  5      (       a  U4nO%[        SU R                  R                   SU 35      e/ U l        U HI  n[        U[        5      (       a  [        S[        S
S9  U" 5       nU R                  R                  U5        MK     U R                  (       a  Ub	  U[        L a  Sn[        [         U ]F  " SU R$                  US.UD6  g)a  Create a tuple from a list, set, or tuple.

Create a fixed-type tuple with Traits:

``t = Tuple(Int(), Str(), CStr())``

would be length 3, with Int,Str,CStr for each element.

If only one arg is given and it is not a Trait, it is taken as
default_value:

``t = Tuple((1, 2, 3))``

Otherwise, ``default_value`` *must* be specified by keyword.

Parameters
----------
*traits : TraitTypes [ optional ]
    the types for restricting the contents of the Tuple.  If unspecified,
    types are not checked. If specified, then each positional argument
    corresponds to an element of the tuple.  Tuples defined with traits
    are of fixed length.
default_value : SequenceType [ optional ]
    The default value for the Tuple.  Must be list/tuple/set, and
    will be cast to a tuple. If ``traits`` are specified,
    ``default_value`` must conform to the shape and type they specify.
**kwargs
    Other kwargs passed to `Container`
r  r   r   rQ   Nr   Fr:  r;  r   r  r<  r=  ~Traits should be given as instances, not types (for example, `Int()`, not `Int`) Passing types is deprecated in traitlets 4.1.r  rg  )r5  rB   r   rj   r  r   rO  rR   r  rg   r>  ro   r  rh   r   r  r$   rz   r  )ry   r   r  r  rg  rK  rO  s         rX   rz   Tuple.__init__  ss   < 

?I>v;! :8FSTICVCV"1IMF L%)H)H dnn556 7/ / # &MI%D"D&*F?#';';<<!#D/0G0G/Hm_]^^E%&&E& 	 LL&  <<]2my6PDi'NdjjtNvNrW   c                    U R                   (       a  U[        U R                   5      :  a  U$ U R                   U   R                  U5      $ rc  )r  r   r  rd  s      rX   rV  Tuple.item_from_string  s<    
 ||uDLL(99 H||E"..q11rW   c                   U R                   (       d  U$ [        U5      [        U R                   5      :w  aC  SU R                  [        U5      [        U R                   5      [	        U5      4-  n[        U5      e/ n[        U R                   U5       H(  u  pV UR                  X5      nUR                  U5        M*     [        U5      $ ! [
         a  nU R                  XU5         S nAMY  S nAff = f)NzTThe '%s' trait of %s instance requires %i elements, but a value of %s was specified.)r  r   r   r   r
   r=   r  r(  r   rj  r  )ry   r   rw   r4  rD  rK  r  rj  s           rX   r@  Tuple.validate_elements  s    ||Lu:T\\**f99hsmS->	%@PQR  Q-	DLL%0HE$OOC+   # 1 Y	  *

35))*s   C
C/C**C/c                   > U R                    H,  n[        U[        5      (       d  M  UR                  US 5        M.     [        [
        U ]  X5        g rZ   )r  rg   r>   r   r  r$   ry   r   r   rK  rO  s       rX   r   Tuple.class_init  s?    \\E%++  d+ " 	i)#4rW   c                z    U R                    H+  n[        U[        5      (       d  M  UR                  U5        M-     g rZ   )r  rg   r>   r   ry   r   rK  s      rX   r   Tuple.subclass_init  s+    \\E%++##C( "rW   rr  )r   r   r  r   r   r   )r`   rn   r  r  r   r   r
  rg  r	  )rR   rS   rT   rU   r   r  r  r4  r/  rz   rV  r@  r   r   rV   r  r  s   @rX   r?   r?     s3    (E'KKOZ	2 *5) )rW   r?   c                     ^  \ rS rSrSrSrSrSSS\4           SU 4S jjjr S         SS jjr	SU 4S jjr
SS jrSU 4S jjrSS	 jrSS
 jrSS jrSS jrSrU =r$ )r&   i  a  An instance of a Python dict.

One or more traits can be passed to the constructor
to validate the keys and/or values of the dict.
If you need more detailed validation,
you may use a custom validator method.

.. versionchanged:: 5.0
    Added key_trait for validating dict keys.

.. versionchanged:: 5.0
    Deprecated ambiguous ``trait``, ``traits`` args in favor of ``value_trait``, ``per_key_traits``.
Nc                  > UR                  SS5      nUb  Ub  [        S5      eUn[        S[        SS9  UR                  SS5      nUb  Ub  [        S5      eUn[        S	[        SS9  U[        L a.  Ub+  [        U5      (       d  [        U[        5      (       a   eUnSnUc  Ub  [        U5      (       a  UnSnU[        L a  0 nUc  SnO@[        U[        5      (       a  U4nO'[        U[        5      (       a  U4nO[        S
U-  5      e[        U5      (       a2  [        U[        5      (       a  [        S[        SS9  U" 5       nXl        OUb  [        S[        U5      -  5      e[        U5      (       a2  [        U[        5      (       a  [        S[        SS9  U" 5       nX0l        OUb  [        S[        U5      -  5      eX l        [        T	U ]@  " S[        US.UD6  g)a0  Create a dict trait type from a Python dict.

The default value is created by doing ``dict(default_value)``,
which creates a copy of the ``default_value``.

Parameters
----------
value_trait : TraitType [ optional ]
    The specified trait type to check and use to restrict the values of
    the dict. If unspecified, values are not checked.
per_key_traits : Dictionary of {keys:trait types} [ optional, keyword-only ]
    A Python dictionary containing the types that are valid for
    restricting the values of the dict on a per-key basis.
    Each value in this dict should be a Trait for validating
key_trait : TraitType [ optional, keyword-only ]
    The type for restricting the keys of the dict. If
    unspecified, the types of the keys are not checked.
default_value : SequenceType [ optional, keyword-only ]
    The default value for the Dict.  Must be dict, tuple, or None, and
    will be cast to a dict if not None. If any key or value traits are specified,
    the `default_value` must conform to the constraints.

Examples
--------
a dict whose values must be text
>>> d = Dict(Unicode())

d2['n'] must be an integer
d2['s'] must be text
>>> d2 = Dict(per_key_traits={"n": Integer(), "s": Unicode()})

d3's keys must be text
d3's values must be integers
>>> d3 = Dict(value_trait=Integer(), key_trait=Unicode())

rK  NzFFound a value for both `value_trait` and its deprecated alias `trait`.zIKeyword `trait` is deprecated in traitlets 5.0, use `value_trait` insteadr   r  r   zJFound a value for both `per_key_traits` and its deprecated alias `traits`.zMKeyword `traits` is deprecated in traitlets 5.0, use `per_key_traits` insteadzdefault value of Dict was %sr  z-`value_trait` must be a Trait or None, got %sz+`key_trait` must be a Trait or None, got %sr  rQ   )r5  ro   r   r  rB   rj   rg   r>   r  rh  rh   _value_traitr
   
_key_trait_per_key_traitsr  rz   )
ry   value_traitper_key_traits	key_traitr  r  rK  r   rg  rO  s
            rX   rz   Dict.__init__  s   \ 

7D)&\   K["
 Hd+)`  $N_" I%+*AK((%k9==== +"!;''*	!% I%M Dt,,!#D}55!#D:]JKK K  +t,,E& 	 *m +$?)KBXX  I)T**E& 	 &K	'O"IIV_L``aa-9t$9&9rW   c                    USU R                    S[        U5       SUR                  5        S[        U5       S3	-   n[	        U5      e)Nz	 of the 'r  z instance must be r   z was specified.)r   r   r\  r
   r=   )ry   r   element	validatorsider4  s         rX   element_errorDict.element_error  sm     $))K>PQZQ_Q_QaPbbst}  F  uG  tH  HW  XX 	
 mrW   c                N   > [         TU ]  X5      nUc  U$ U R                  X5      $ rZ   )r  rM   r@  rA  s      rX   rM   Dict.validate  s-     ,=L%%c11rW   c                   U R                   =(       d    0 nU R                  nU R                  nU(       d  U(       d	  U(       d  U$ 0 nU HN  nX'   nU(       a   UR                  X5      nUR                  Xu5      n	U	(       a   U	R                  X5      nXU'   MP     U R                  U5      $ ! [         a    U R                  XUS5         Nbf = f! [         a    U R                  XU	S5         N[f = f)NKeysValues)r  r  r  r(  r=   r  r  r  )
ry   r   rw   per_key_overrider  r  rD  r   r  active_value_traits
             rX   r@  Dict.validate_elements  s    //52OO	''[,<L	C
AD#--c7C "2!5!5c!G!M*44S<A cN  zz)$$ " D&&sFCD " M&&s/A8LMs$   B,C,CCC/.C/c                  > [        U R                  [        5      (       a  U R                  R                  US 5        [        U R                  [        5      (       a  U R                  R                  US 5        U R
                  b3  U R
                  R                  5        H  nUR                  US 5        M     [        TU ]  X5        g rZ   )rg   r  r>   r   r  r  r6  r  r  s       rX   r   Dict.class_init  s    d''33((d3dooy11OO&&sD1+--446  d+ 73%rW   c                l   [        U R                  [        5      (       a  U R                  R                  U5        [        U R                  [        5      (       a  U R                  R                  U5        U R
                  b3  U R
                  R                  5        H  nUR                  U5        M     g g rZ   )rg   r  r>   r   r  r  r6  r  s      rX   r   Dict.subclass_init  s    d''33++C0dooy11OO))#.+--446##C( 7 ,rW   c                   [        U[        5      (       d  [        SU< S[        U5       35      e [        R
                  " SU R                  U/5      5      $ ! [         a&    [        U5      n[        U[        5      (       a  Us $ e f = f)rK  z"from_string expects a string, got z	 of type 
dict[K, V])
rg   rn   ro   rh   r[   r\   r`  r3  re   r  rL  s      rX   r  Dict.from_string  s~    !S!!@YtTUwiXYY	66,(=(=qc(BCC 	%a(D$%%		s   &A ,B	B	c           	        [        U5      S:X  a  US   S:X  a  U R                  (       a  g[        U5      S:X  ap  US   R                  S5      (       aW  US   R                  S5      (       a>  [	        SU R
                   SUS    S	U R
                   S
3[        SS9  [        US   5      $ 0 nU Vs/ s H  o0R                  U5      PM     sn H  nUR                  U5        M     U$ s  snf )zReturn a dict from a list of config strings.

This is where we parse CLI configuration.

Each item should have the form ``"key=value"``.

item parsing is done in :meth:`.item_from_string`.
r   r   r   Nr  r  z--r  z@ for dict-traits is deprecated in traitlets 5.0. You can pass --z7 <key=value> ... multiple times to add items to a dict.r   r  )
r   r   r  rP  r   r   r  r   rV  r  )ry   r]  combinedr`   r  s        rX   r`  Dict.from_string_list  s     v;!q	V 3v;!q	 4 4S 9 9fQi>P>PQT>U>UTYYKq ,""&)),ce"	  q	**4:;Fq''*F;AOOA < <s   0C'c                   SU;  a&  [        SU R                  R                   SU< 35      eUR                  SS5      u  p#U R                  (       a  U R                  R                  U5      nU R                  =(       d    0 R                  X R                  5      nU(       a  UR                  U5      n[        R                  " SX#05      $ )zCast a single-key dict from a string.

Evaluated when parsing CLI configuration from a string.

Dicts expect strings of the form key=value.

Returns a one-key dictionary,
which will be merged in :meth:`.from_string_list`.
r  r  z.' options must have the form 'key=value', got r   r  )r=   rO  rR   r  r  r  r  r  r  r[   r\   )ry   r`   r   rw   r  s        rX   rV  Dict.item_from_string  s     a<DNN++,,Z[\Z_`  WWS!_
 ??//--c2C ++1r66s<M<MN++E2EvvlSL11rW   )r  r  r  )r  z6TraitType[t.Any, t.Any] | dict[K, V] | Sentinel | Noner  r   r  zTraitType[t.Any, t.Any] | Noner  zdict[K, V] | Sentinel | Noner  r   r   r   )r  )
r   r   r  r   r  r   r  rn   r   r   )r   r   rw   r   r   dict[K, V] | None)r   r   rw   zdict[t.Any, t.Any]r   r  rg  r	  )r`   rn   r   r  )r]  r  r   r   )r`   rn   r   r  )rR   rS   rT   rU   r   r  r  rB   rz   r  rM   r@  r   r   r  r`  rV  rV   r  r  s   @rX   r&   r&     s     LJ OS $486?~:K~: ~: 2	~:
 4~: ~: 
~: ~:B IQ#(5:BE	2%2&)
42 2rW   r&   r  c                  4   \ rS rSrSrSrSr\R                  (       ao  \R                       S               SS jj5       r
\R                       S               SS jj5       r
\SSSS4               SS	 jjr
SS
 jrSS jrSrg)r;   i  z_A trait for an (ip, port) tuple.

This allows for both IPv4 IP addresses as well as hostnames.
)z	127.0.0.1r   zan (ip, port) tuplec                    g rZ   rQ   r  s          rX   rz   TCPAddress.__init__  r  rW   c                    g rZ   rQ   r  s          rX   rz   r  *  r  rW   FNc                    g rZ   rQ   r  s          rX   rz   r  6  r  rW   c                &   [        U[        5      (       ak  [        U5      S:X  a\  [        US   [        5      (       aD  [        US   [        5      (       a,  US   nUS:  a!  US::  a  [
        R                  " [        U5      $ U R                  X5        g )Nr   r   r   i  )	rg   r  r   rn   r  r[   r\   r   rj  )ry   r   rw   ports       rX   rM   TCPAddress.validateB  sn    eU##5zQeAh,,E!Hc1J1J 8DqyTU] vva//

3rW   c                   U R                   (       a!  US:X  a  [        R                  " [        S 5      $ SU;  a  [	        SU-  5      eUR                  SS5      u  p#[        U5      n[        R                  " [        X$45      $ )Nr   :zRequire `ip:port`, got %rr   )r   r[   r\   r   rd   r  r  )ry   r`   ipport_strr  s        rX   r  TCPAddress.from_stringK  sd    ??qF{66!T?"a<81<==wwsA8}vva"$$rW   rQ   r2  )ry   z,TCPAddress[tuple[str, int], tuple[str, int]]r  r  r   r  r   r  r	  r   r  r   r  r   r   r   )ry   z:TCPAddress[tuple[str, int] | None, tuple[str, int] | None]r  bool | None | Sentinelr   r  r   r  r	  r   r  r   r  r   r   r   )ry   ziTCPAddress[tuple[str, int] | None, tuple[str, int] | None] | TCPAddress[tuple[str, int], tuple[str, int]]r  r  r   r  r   r  r	  r   r  r   r  r   r   r   r  r3  )rR   rS   rT   rU   r   r  r  r[   r  r  rz   rB   rM   r  rV   rQ   rW   rX   r;   r;     sr   
 %M%I	
 .1),%("		>		*		 '		 #			
 		 		 		 		 
		 
 58(+%("		L		1		 &		 #			
 		 		 		 		 
		 5>/4%)# 
	;
	 2
	 -	
	
 #
	 
	 
	 
	 
	%rW   r;   c                  &    \ rS rSrSrSrSS jrSrg)r   iU  zA casting compiled regular expression trait.

Accepts both strings and compiled regular expressions. The resulting
attribute will be a compiled regular expression.za regular expressionc                r     [         R                  " U5      $ ! [         a    U R                  X5         g f = frZ   )recompiler3  rj  r*  s      rX   rM   CRegExp.validate]  s1    	#::e$$ 	#JJs"	#s    66rQ   N)r   r   rw   r   r   zre.Pattern[t.Any] | NonerR   rS   rT   rU   r   r  rM   rV   rQ   rW   rX   r   r   U  s    8
 'I#rW   r   zre.Pattern[t.Any]c                     ^  \ rS rSr% SrSrS\S'   Sr S       SU 4S jjjr\	4SS jjr
\	4SS	 jjrSS
 jrSSS jjrSSS jjrSS jrSS jrSrU =r$ )rD   id  a'  Use a Enum class as model for the data type description.
Note that if no default-value is provided, the first enum-value is used
as default-value.

.. sourcecode:: python

    # -- SINCE: Python 3.4 (or install backport: pip install enum34)
    import enum
    from traitlets import HasTraits, UseEnum


    class Color(enum.Enum):
        red = 1  # -- IMPLICIT: default_value
        blue = 2
        green = 3


    class MyEntity(HasTraits):
        color = UseEnum(Color, default_value=Color.blue)


    entity = MyEntity(color=Color.red)
    entity.color = Color.green  # USE: Enum-value (preferred)
    entity.color = "green"  # USE: name (as string)
    entity.color = "Color.green"  # USE: scoped-name (as string)
    entity.color = 3  # USE: number (as int)
    assert entity.color is Color.green
Nzenum.Enum | Noner  z"Trait type adapter to a Enum classc                @  > [        U[        R                  5      (       d
   SU-  5       eUR                  SS5      nUc3  U(       d,  [	        [        UR                  R                  5       5      5      n[        TU ]$  " SSU0UD6  Xl
        UR                  S-   U l        g )NzREQUIRE: enum.Enum, but was: %rr   Fr  r  rQ   )ri   enumr(   r  nextiter__members__r6  r  rz   
enum_classrR   name_prefix)ry   r  r  r  r   rO  s        rX   rz   UseEnum.__init__  s     *dii00`2SV`2``0ZZe4
  j&<&<&C&C&E!FGM?}??$%..4rW   c                    [        U[        5      (       d   eU R                  R                  nUR	                  5        H  nUR
                  U:X  d  M  Us  $    U$ )z0Selects enum-value by using its number-constant.)rg   r  r  r  r6  rw   )ry   rw   rF   enum_members	enum_items        rX   select_by_numberUseEnum.select_by_number  sP    %%%%%22%,,.I%'   / rW   c                    [        U[        5      (       d   eUR                  U R                  5      (       a  UR	                  U R                  SS5      nU R
                  R                  R                  X5      $ )z4Selects enum-value by using its name or scoped-name.r  r   )rg   rn   r  r  replacer  r  r  )ry   rw   rF   s      rX   select_by_nameUseEnum.select_by_name  s_    %%%%%D,,--MM$"2"2B:E**..u>>rW   c                h   [        X R                  5      (       a  U$ [        U[        5      (       a  U R                  U5      nU[        La  U$ OS[        U[
        5      (       a  U R                  U5      nU[        La  U$ O!Uc  U R                  (       a  g U R                  $ U R                  X5        g rZ   )
rg   r  r  r  rB   rn   r  r   r  rj  )ry   r   rw   value2s       rX   rM   UseEnum.validate  s    e__--Ls##**51FY& 's##((/FY& '])))

3rW   c                    U R                   R                  R                  5       nU(       a  SR                  S U 5       5      $ [	        [        U5      5      $ )r  r  c              3  ,   #    U  H
  nS U-  v   M     g7fr  rQ   r  s     rX   rc  'UseEnum._choices_str.<locals>.<genexpr>  s     :'QHqL'r  )r  r  rv  rh  r}  r4  )ry   r  r  s      rX   r  UseEnum._choices_str  sA    //--22488:':::W&&rW   c                p    U R                   (       a  SU(       a  SOS-  OSnSU R                  U5       U 3$ r  r  r  s      rX   r  UseEnum._info  r  rW   c                     U R                  SS9$ r  r  r   s    rX   r\  UseEnum.info  r  rW   c                     U R                  SS9$ r  r  r   s    rX   r  UseEnum.info_rst  r  rW   )r  r  rZ   )r  r  r  r   r  r   r   r   )rw   r  rF   r   r   r   )rw   rn   rF   r   r   r   r
  r  r  r   )rR   rS   rT   rU   r   r  r   r  rz   rB   r  r  rM   r  r  r\  r  rV   r  r  s   @rX   rD   rD   d  s~    : '+M#*4I ?C	5%	56;	5NS	5		5 	5 =F  ;D ?(';
(' 'rW   rD   c                  &    \ rS rSrSrSrSS jrSrg)r    i  zhA trait which is callable.

Notes
-----
Classes are callable, as are instances
with a __call__() method.z
a callablec                J    [        U5      (       a  U$ U R                  X5        g rZ   )rh  rj  r*  s      rX   rM   Callable.validate  s    E??LJJs"rW   rQ   Nr
  r  rQ   rW   rX   r    r      s    ! I#rW   r    )r`   r   r   r]   r  )r[   r   r   r]   )rp   r  r   zt.Iterable[t.Any]rZ   )r   r   r   r   r   zlist[tuple[str, t.Any]])r   r   r   r   )r  r   r   r  )rp   r  rh   rn   r   r9   )r  r  r   r  )rp   r  r   rE   )r   rn   r   r%   )rK  z'Int[t.Any, t.Any] | Float[t.Any, t.Any]r   r   rw   r   r   r   )r   
__future__r   r   r  r
  r  r  r  r  typingr[   astr   utils.bunchr   utils.descriptionsr   r   r	   r
   utils.getargspecr   utils.importstringr   utils.sentinelr   utils.warningsr   r   r   r4  r  rB  	frozensetrh  rh   
ClassTypesr  typing_extensionsr   __all__rB   r   NoDefaultSpecifiedr3  r=   r^   re   rj   rL   rs   r   r   rI   rG   rH   r   r   r   r   r   r   rn   r   r   r   Genericr>   r  r  r6   r7   rJ   rK   rM   rF   r    r  r)   r9   rE   r%   r/   r0   r"   r@   r1   r,   r-   r+   Optionalr<   rC   r!  r2   r   r5   r   r3   r*   r   rY  r  r  r#   r   ri  r   r   rA   r   r8   r'   r   r   r(   r!   r.   r$   r4   r:   r?   r&   r;   r   rD   rQ   rW   rX   <module>r     s  !R #    	 	 
     J J ( + $ @ @uc9- W
??)<J 	 	  	 	*
Z
6 (DLL LL^@E @EF 	7 7t CLCLCL ??/S!AQUU#A
A(		!Q$ A(R!G !GH$6+ 6+rVL& VLr 19 ,<#.L"B& R 	
		'CJ!781> 14=\ =9l 9>\ >"1 "Jg
- g
f
#)AqD/ 
#c@q!t$ c@L]0"1a4( ]0@8 8.QT
 2HQK #qzz!}ajjm;< #0Q&IaeeQUUl# Q&rH)AJJquu%qzz!%%'88
9 HV29>GL
6=)AqD/ =@-=3q!t9 -=` 4e
?IadO ?D-=U1a4[ -=`i%)<!==> ,#w	'155.1 #IeUl# B#UIeQUUl+ #Ii1o IX,#wq!t}iQUU
3 ,#^38$ ,z H9QT? HV,#DAJ ,#^V39QT? V3r'd1g 'B/'Q /'dc cL>+9QVVAY >+BH+)AEE!%%L
! H+V|)IaggaeeSj)* |)BN28L! N2b?%1a4 ?%D#i+QWW5H#5M-NNO #c'iquu% c'L#yCJ/CJ1GGH #rW   