/ lib / traitlets / traitlets.pyc
traitlets.pyc
   1  o

   2  ��c���@s�dZddlZddlZddlZddlZddlZddlZddlZddlZ	ddl
   3  mZddlm
Z
mZddlmZddlmZmZmZmZddlmZdd	lmZdd
   4  lmZeeeefZ e!fZ"gd�Z#edd
d�Z$edd
d�Z%e$Z&Gdd�de'�Z(e�)d�Z*dd�Z+e�Z,dd�Z-dd�Z.dd�Z/dd�Z0dd�Z1Gd d!�d!�Z2d�d"d#�Z3d$d%�Z4Gd&d'�d'�Z5Gd(d)�d)�Z6e6Z7Gd*d+�d+�Z8Gd,d-�d-e8�Z9Gd.d/�d/�Z:d0d1�Z;Gd2d3�d3e!�Z<Gd4d5�d5e<�Z=d6d7�d8e	j>ee?fd9e?d:d;fd<d=�Z@d>d?�ZAd8e	j>ee?fd:d@fdAdB�ZBdCe?d:dDfdEdF�ZCGdGdH�dHe8�ZDGdId;�d;eD�ZEGdJd@�d@eD�ZFGdKdD�dDeD�ZGGdLdM�dMe<dN�ZHGdOdP�dPeHe=dN�ZIGdQdR�dRe9�ZJGdSdT�dTeJ�ZKGdUdV�dVeJ�ZLGdWdX�dX�ZMGdYdZ�dZeMeK�ZNGd[d\�d\eMeL�ZOGd]d^�d^eJ�ZPGd_d`�d`e9�Z>Gdadb�dbe9�ZQdcdd�ZRGdedf�dfe9�ZSGdgdh�dheS�ZTeSeTZUZVeSZWGdidj�dje9�ZXGdkdl�dleX�ZYGdmdn�dne9�ZZGdodp�dpeZ�Z[Gdqdr�dre9�Z\Gdsdt�dte\�Z]Gdudv�dve9�Z^Gdwdx�dxe^�Z_Gdydz�dze9�Z`Gd{d|�d|e`�ZaGd}d~�d~e9�ZbGdd��d�eb�ZcGd�d��d�e9�ZdGd�d��d�ed�ZeGd�d��d�ed�ZfGd�d��d�eL�ZgGd�d��d�eg�ZhGd�d��d�eh�ZiGd�d��d�eg�ZjGd�d��d�eL�ZkGd�d��d�e9�ZlGd�d��d�e9�ZmGd�d��d�e9�ZnGd�d��d�e9�ZodS)�a�
   5  A lightweight Traits like module.
   6  
   7  This is designed to provide a lightweight, simple, pure Python version of
   8  many of the capabilities of enthought.traits.  This includes:
   9  
  10  * Validation
  11  * Type specification with defaults
  12  * Static and dynamic notification
  13  * Basic predefined types
  14  * An API that is similar to enthought.traits
  15  
  16  We don't support:
  17  
  18  * Delegation
  19  * Automatic GUI generation
  20  * A full set of trait types.  Most importantly, we don't provide container
  21    traits (list, dict, tuple) that can trigger notifications if their
  22    contents change.
  23  * API compatibility with enthought.traits
  24  
  25  There are also some important difference in our design:
  26  
  27  * enthought.traits does not validate default values.  We do.
  28  
  29  We choose to create this module because we need these capabilities, but
  30  we need them to be pure Python so they work in all Python implementations,
  31  including Jython and IronPython.
  32  
  33  Inheritance diagram:
  34  
  35  .. inheritance-diagram:: traitlets.traitlets
  36     :parts: 3
  37  �N)�literal_eval)�warn�
warn_explicit�)�Bunch)�add_article�class_of�describe�	repr_type)�
  38  getargspec��import_item)�Sentinel);�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�
  39  ObjectName�ObserveHandler�Set�
  40  TCPAddress�This�
  41  TraitError�	TraitType�Tuple�Type�Unicode�	Undefined�Union�UseEnum�ValidateHandler�default�directional_link�dlink�link�observe�observe_compat�parse_notifier_name�validater>�	traitletszA
  42  Used in Traitlets to specify that no defaults are set in kwargs
  43  rzi
  44  Used in Traitlets to listen to all types of notification or to notifications
  45  from all trait attributes.
  46  c@seZdZdS)r9N)�__name__�
  47  __module__�__qualname__�rNrN��C:\Users\Jacks.GUTTSPC\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\traitlets\traitlets.pyr9�sr9z[a-zA-Z_][a-zA-Z0-9_]*$cC�|��S�N��isidentifier��srNrNrOrS��rScCs6tj�d�}|r|dkrdS|tvrt�|�dSdS)zZAdd our own checks for too many deprecation warnings.
  48  
  49      Limit to once per package.
  50      ZTRAITLETS_ALL_DEPRECATIONS�0TF)�os�environ�get�_deprecations_shown�add)�keyZenv_flagrNrNrO�_should_warn�s
  51  r^c
  52  Cs�dj|j||d�}t�|�D]}||jvr|}nq|j�dd�d}||f}t|�s-dSzt�|�p4d}t�	|�dp=d}	Wnt
  53  tfy]}
  54  zt|d|
  55  t
�WYd}
  56  ~
  57  dSd}
  58  ~
  59  wwt|t
||	�dS)	z�Show deprecation warning about a magic method definition.
  60  
  61      Uses warn_explicit to bind warning to method definition instead of triggering code,
  62      which isn't relevant.
  63      z?{classname}.{method_name} is deprecated in traitlets 4.1: {msg})�	classname�method_name�msg�.rrNz	<unknown>z
  64  (inspection failed) %s)�formatrK�inspect�getmro�__dict__rL�splitr^�
getsourcefile�getsourcelines�OSError�	TypeErrorr�DeprecationWarningr)�method�clsr`raZwarn_msg�parent�package_namer]�fname�lineno�erNrNrO�_deprecated_method�s(�
  65  � ��rtc
  66  Cs(zt|�WStttfy|YSw)zwSafely evaluate an expression
  67  
  68      Returns original string if eval fails.
  69  
  70      Use only where types are ambiguous.
  71      )r�	NameError�SyntaxError�
  72  ValueErrorrTrNrNrO�_safe_literal_eval�s
  73  
  74  �rxcCst|t�pt|t�ot|t�S)zHReturns whether the given value is an instance or subclass of TraitType.)�
  75  isinstancer:�type�
  76  issubclass)�trNrNrO�is_trait�sr}cCsN|tus	t|t�r|gS|rt|vrtgS|D]
}t|t�s$td|��q|S)aConvert the name argument to a list of names.
  77  
  78      Examples
  79      --------
  80      >>> parse_notifier_name([])
  81      [traitlets.All]
  82      >>> parse_notifier_name("a")
  83      ['a']
  84      >>> parse_notifier_name(["a", "b"])
  85      ['a', 'b']
  86      >>> parse_notifier_name(All)
  87      [traitlets.All]
  88      znames must be strings, not %r)rry�strrk)�names�nrNrNrOrH�s
  89  �rHc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
  90  �_SimpleTestcC�
  91  ||_dSrQ��value��selfr�rNrNrO�__init__�
  92  z_SimpleTest.__init__cCs
  93  ||jkSrQr�)r��testrNrNrO�__call__
  94  r�z_SimpleTest.__call__cCs
  95  d|jS)Nz<SimpleTest(%r)r��r�rNrNrO�__repr__
r�z_SimpleTest.__repr__cCrPrQ)r�r�rNrNrO�__str__rVz_SimpleTest.__str__N)rKrLrMr�r�r�r�rNrNrNrOr�s
  96  r�c	CsZg}t|�D] }zt||�}Wn	tyYqw|r||�r&|�||f�q|��|S)aA safe version of inspect.getmembers that handles missing attributes.
  97  
  98      This is useful when there are descriptor based attributes that for
  99      some reason raise AttributeError even though they exist.  This happens
 100      in zope.inteface with the __provides__ attribute.
 101      )�dir�getattr�AttributeError�append�sort)�object�	predicate�resultsr]r�rNrNrO�
 102  getmemberss��r�cGsf|D].}t|�dkstdt��|\}}t|t�s!tdt|���||��vr0t|�d|����qdS)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)�lenrkr|ryr,rz�traits)�tuples�tup�obj�
 103  trait_namerNrNrO�_validate_link(s�
 104  ��r�c@sLeZdZdZdZddd�Zdd�Zejdd	��Z	d
 105  d�Z
 106  dd
�Zdd�ZdS)rEaRLink traits from different objects together so they remain in sync.
 107  
 108      Parameters
 109      ----------
 110      source : (object / attribute name) pair
 111      target : (object / attribute name) pair
 112      transform: iterable with two callables (optional)
 113          Data transformation between source and target and target and source.
 114  
 115      Examples
 116      --------
 117      >>> class X(HasTraits):
 118      ...     value = Int()
 119  
 120      >>> src = X(value=1)
 121      >>> tgt = X(value=42)
 122      >>> c = link((src, "value"), (tgt, "value"))
 123  
 124      Setting source updates target objects:
 125      >>> src.value = 5
 126      >>> tgt.value
 127      5
 128      FNcCsBt||�|||_|_|r|ndd�fd\|_|_|��dS)NcS�|SrQrN��xrNrNrO�<lambda>T�zlink.__init__.<locals>.<lambda>r�)r��source�target�
 129  _transform�_transform_invrE�r�r�r��	transformrNrNrOr�Qs
 130  z
link.__init__c
 131  Cs�z7t|jd|jd|�t|jd|jd���W|jdj|j|jdd�|jdj|j|jdd�dS|jdj|j|jdd�|jdj|j|jdd�w�Nrr�r)�setattrr�r�r�r�rF�_update_target�_update_sourcer�rNrNrOrEXs� �z	link.linkcc�$�d|_z	dVWd|_dSd|_w�NTF��updatingr�rNrNrO�_busy_updatingd�
 132  �zlink._busy_updatingcC�|jrdS|���.t|jd|jd|�|j��t|jd|jd�|jkr/td�	|���Wd�dS1s:wYdS)NrrzCBroken link {}: the source value changed while updating the target.)
 133  r�r�r�r�r��newr�r�r9rc�r��changerNrNrOr�l�
 134   ��"�zlink._update_targetcCr�)NrrzCBroken link {}: the target value changed while updating the source.)
 135  r�r�r�r�r�r�r�r�r9rcr�rNrNrOr�wr�zlink._update_sourcecCs<|jdj|j|jdd�|jdj|j|jdd�dSr�)r��	unobserver�r�r�r�rNrNrO�unlink�s zlink.unlinkrQ)
rKrLrM�__doc__r�r�rE�
 136  contextlib�contextmanagerr�r�r�r�rNrNrNrOrE6s
 137  
 138  rEc@sDeZdZdZdZddd�Zdd�Zejdd	��Z	d
 139  d�Z
 140  dd
�ZdS)rCa�Link the trait of a source object with traits of target objects.
 141  
 142      Parameters
 143      ----------
 144      source : (object, attribute name) pair
 145      target : (object, attribute name) pair
 146      transform: callable (optional)
 147          Data transformation between source and target.
 148  
 149      Examples
 150      --------
 151      >>> class X(HasTraits):
 152      ...     value = Int()
 153  
 154      >>> src = X(value=1)
 155      >>> tgt = X(value=42)
 156      >>> c = directional_link((src, "value"), (tgt, "value"))
 157  
 158      Setting source updates target objects:
 159      >>> src.value = 5
 160      >>> tgt.value
 161      5
 162  
 163      Setting target does not update source object:
 164      >>> tgt.value = 6
 165      >>> src.value
 166      5
 167  
 168      FNcCs6|r|ndd�|_t||�|||_|_|��dS)NcSr�rQrNr�rNrNrOr��r�z+directional_link.__init__.<locals>.<lambda>)r�r�r�r�rEr�rNrNrOr��s
 169  zdirectional_link.__init__c
 170  Csrz)t|jd|jd|�t|jd|jd���W|jdj|j|jdd�dS|jdj|j|jdd�wr�)r�r�r�r�r�rF�_updater�rNrNrOrE�s�>zdirectional_link.linkccr�r�r�r�rNrNrOr��r�zdirectional_link._busy_updatingcCsX|jrdS|���t|jd|jd|�|j��Wd�dS1s%wYdS�Nrr)r�r�r�r�r�r�r�rNrNrOr��s
 171  
 172  ""�zdirectional_link._updatecCs |jdj|j|jdd�dSr�)r�r�r�r�rNrNrOr��s zdirectional_link.unlinkrQ)rKrLrMr�r�r�rEr�r�r�r�r�rNrNrNrOrC�s
 173  
 174  
 175  rCc@sVeZdZUdZdZejeed<dZ	ejej
 176  ejed<dd�Zdd�Z
d	d
 177  �ZdS)ra�Base descriptor class
 178  
 179      Notes
 180      -----
 181      This implements Python's descriptor protocol.
 182  
 183      This class is the base class for all such descriptors.  The
 184      only magic we use is a custom metaclass for the main :class:`HasTraits`
 185      class that does the following:
 186  
 187      1. Sets the :attr:`name` attribute of every :class:`BaseDescriptor`
 188         instance in the class dict to the name of the attribute.
 189      2. Sets the :attr:`this_class` attribute of every :class:`BaseDescriptor`
 190         instance in the class dict to the *class* that declared the trait.
 191         This is used by the :class:`This` trait to allow subclasses to
 192         accept superclasses for :class:`This` values.
 193      N�name�
 194  this_classcCs||_||_dS)aEPart of the initialization which may depend on the underlying
 195          HasDescriptors class.
 196  
 197          It is typically overloaded for specific types.
 198  
 199          This method is called by :meth:`MetaHasDescriptors.__init__`
 200          passing the class (`cls`) and `name` under which the descriptor
 201          has been assigned.
 202          N)r�r��r�rnr�rNrNrO�
 203  class_init�s
 204  
 205  zBaseDescriptor.class_initcCs|j�|j�dSrQ)�_instance_initsr��
instance_init�r�rnrNrNrO�
subclass_init�s	zBaseDescriptor.subclass_initcCsdS)aLPart of the initialization which may depend on the underlying
 206          HasDescriptors instance.
 207  
 208          It is typically overloaded for specific types.
 209  
 210          This method is called by :meth:`HasTraits.__new__` and in the
 211          :meth:`BaseDescriptor.instance_init` method of descriptors holding
 212          other descriptors.
 213          NrN�r�r�rNrNrOr�s
 214  zBaseDescriptor.instance_init)rKrLrMr�r�r|�Optionalr~�__annotations__r�r<rr�r�r�rNrNrNrOr�s
 215  
rc@s�eZdZUdZiZejeejfe	d<dZ
 216  dZdZe
Zejeje	d<e
ddddfdd�Zd	d
 217  �Zd+dd�Zd
d�Zdd�Zd+dd�Zd+dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd,d!d"�Zd+d#d$�Zd%d&�Zd'd(�Z d)d*�Z!dS)-r:z!A base class for all trait types.�metadataF�	any value�
default_valueNcKsT|tur||_|r||_|dur||_|dur|nd|_|jr#|j|_t|�dkr�d}t��}|dus5J�|j	j
 218  dkrN|d7}|j}|dusHJ�|j	j
 219  dks;|j�
d�pUd}	|	�dd�d}
 220  td|
 221  gt|��}t|�rvtd	|ft|d
 222  �t|j�dkr�|j��|_|j�|�n
 223  ||_n|j��|_|dur�||jd<|dur�||jd<dSdS)
aDeclare a traitlet.
 224  
 225          If *allow_none* is True, None is a valid value in addition to any
 226          values that are normally valid. The default is up to the subclass.
 227          For most trait types, the default value for ``allow_none`` is False.
 228  
 229          If *read_only* is True, attempts to directly modify a trait attribute raises a TraitError.
 230  
 231          Extra metadata can be associated with the traitlet using the .tag() convenience method
 232          or by using the traitlet instance's .metadata dictionary.
 233          N�rrr�rKrbzmetadata-tagz�metadata %s 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')��
 234  stacklevel�config�help)r>r��
 235  allow_none�	read_onlyr�r�r�rd�currentframe�f_code�co_name�f_back�	f_globalsrZrg�tuple�sortedr^rrlr��copy�update)r�r�r�r�r�r��kwargsr��f�mod�pkgr]rNrNrOr�sN���
 236  �zTraitType.__init__cCs|jr	|dkr	dS|S)a
 237  Get a value from a config string
 238  
 239          such as an environment variable or CLI arguments.
 240  
 241          Traits can override this method to define their own
 242          parsing of config strings.
 243  
 244          .. seealso:: item_from_string
 245  
 246          .. versionadded:: 5.0
 247          �NoneN�r��r�rUrNrNrO�from_stringXszTraitType.from_stringcCs(|jtur|jSt|d�r|��S|jS)z�The default generator for this trait
 248  
 249          Notes
 250          -----
 251          This method is registered to HasTraits classes during ``class_init``
 252          in the same way that dynamic defaults defined by ``@default`` are.
 253          �make_dynamic_default)r�r>�hasattrr�r�rNrNrOrBhs
 254  
 255  
 256  zTraitType.defaultcCstdtdd�|jS)zmDEPRECATED: Retrieve the static default value for this trait.
 257          Use self.default_value instead
 258          zRget_default_value is deprecated in traitlets 4.0: use the .default_value attributer�r�)rrlr�r�rNrNrO�get_default_valuexs�zTraitType.get_default_valuecCs,tdtdd�|�||j�}||j|j<|S)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�)rrl�	_validater��
_trait_valuesr��r�r�r�rNrNrO�init_default_value�s�zTraitType.init_default_valuecCs�z	|j|j}W|StyM|�|j�}|tur!tdtdd�|j}zd|_|�||�}W||_n||_w||j|j<|�	t
 259  |j||dd��|YSty]}ztd�|�d}~ww)NzxExplicit using of Undefined as the default value is deprecated in traitlets 5.0, and may cause exceptions in the future.r�r�TrB)r�r��ownerrzz=Unexpected error in TraitType: default value not set properly)
r�r��KeyError�trait_defaultsr>rrl�_cross_validation_lockr��_notify_observersr�	Exceptionr9)r�r�rnr�rBr�rsrNrNrOrZ�s<"��	��
 260  ��z
TraitType.getcCs|dur|S|�||�S)aMGet the value of the trait by self.name for the instance.
 261  
 262          Default values are instantiated when :meth:`HasTraits.__new__`
 263          is called.  Thus by the time this method gets called either the
 264          default value or a user defined value (they called :meth:`__set__`)
 265          is in the :class:`HasTraits` instance.
 266          N)rZ)r�r�rnrNrNrO�__get__�szTraitType.__get__cCs�|�||�}z|j|j}Wnty|j}Ynw||j|j<zt||k�}Wnty4d}Ynw|durC|�|j||�dSdS)NFT)r�r�r�r�r��boolr��
_notify_trait)r�r�r��	new_value�	old_value�silentrNrNrO�set�s
 267  ���z
TraitType.setcCs$|jr
 268  td|j��|�||�dS)z�Set the value of the trait by self.name for the instance.
 269  
 270          Values pass through a validation stage where errors are raised when
 271          impropper types, or types that cannot be coerced, are encountered.
 272          zThe "%s" trait is read-only.N)r�r9r�r�r�rNrNrO�__set__�szTraitType.__set__cCsB|dur	|jr	|St|d�r|�||�}|jdur|�||�}|S)NrIF)r�r�rIr��_cross_validater�rNrNrOr��s
 273  
 274  zTraitType._validatecCst|j|jvrt|||d��}|j|j||�}|St|d|j�r8d|j}t||�}t||j|d�|||�}|S)N)�traitr�r��_%s_validate� use @validate decorator instead.)r��_trait_validatorsrr�r�rt�	__class__)r�r�r��proposal�	meth_nameZcross_validaterNrNrOr��s�
 275  
 276  �
 277  zTraitType._cross_validatecCs&t|t�r
t|g|j�St||g�SrQ�ryr?�trait_types�r��otherrNrNrO�__or__�s
 278  zTraitType.__or__cCs|jSrQ)�	info_textr�rNrNrO�info�szTraitType.infoc	Cs|durT|j|f7_|jdurRd�dd�|jdd�D��}|dur>d|jtd|�||jdtd	|jd
 279  �ff|_|�d|j||jdtd	|jd
 280  �ff|_|�|jdurct||p`|��|��|dur{d�|jt|�|��td	|��}t|��d
�|j|��td	|��}t|��)a�Raise a TraitError
 281  
 282          Parameters
 283          ----------
 284          obj : HasTraits or None
 285              The instance which owns the trait. If not
 286              object is given, then an object agnostic
 287              error will be raised.
 288          value : any
 289              The value that caused the error.
 290          error : Exception (default: None)
 291              An error that was raised by a child trait.
 292              The arguments of this exception should be
 293              of the form ``(value, info, *traits)``.
 294              Where the ``value`` and ``info`` are the
 295              problem value, and string describing the
 296              expected value. The ``traits`` are a series
 297              of :class:`TraitType` instances that are
 298              "children" of this one (the first being
 299              the deepest).
 300          info : str (default: None)
 301              A description of the expected value. By
 302              default this is infered from this trait's
 303              ``info`` method.
 304          N� of css�|]}td|�VqdS)�aN)r	)�.0r|rNrNrO�	<genexpr>s�z"TraitType.error.<locals>.<genexpr>r�zDThe '%s' trait of %s instance contains %s which expected %s, not %s.�anr�therz5The '%s' trait contains %s which expected %s, not %s.z2The '{}' trait of {} instance expected {}, not {}.z#The '{}' trait expected {}, not {}.)�argsr��joinr	r9r
 305  rcr)r�r�r��errorr
 306  �chainrsrNrNrOrsP
 307  �������
 308  
 309  ���zTraitType.errorcCs2|dkrd}nd}td|tdd�|j�||�S)znDEPRECATED: Get a metadata value.
 310  
 311          Use .metadata[key] or .metadata.get(key, default) instead.
 312          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�)rrlr�rZ)r�r]rBrarNrNrO�get_metadataN�
 313  zTraitType.get_metadatacCs2|dkrd}nd}td|tdd�||j|<dS)z[DEPRECATED: Set a metadata key/value.
 314  
 315          Use .metadata[key] = value instead.
 316          r�z;use the instance .help string directly, like x.help = valuezLuse the instance .metadata dictionary directly, like x.metadata[key] = valuerr�r�N)rrlr�)r�r]r�rarNrNrO�set_metadataZrzTraitType.set_metadatacKs<t|����hd��}|rtd|tdd�|j�|�|S)aSets metadata and returns self.
 317  
 318          This allows convenient metadata tagging when initializing the trait, such as:
 319  
 320          Examples
 321          --------
 322          >>> Int(0).tag(config=True, sync=True)
 323          <traitlets.traitlets.Int object at ...>
 324  
 325          >r�r�r�r�zcThe following attributes are set in using `tag`, but seem to be constructor keywords arguments: %s r�r�)r��keys�intersectionr�UserWarningr�r�)r�r�Zmaybe_constructor_keywordsrNrNrO�tagfs���z
TraitType.tagcCs
 326  t|j�SrQ)�reprr�r�rNrNrO�default_value_reprr�zTraitType.default_value_reprrQ)NN)"rKrLrMr�r�r|r"r~rr�r�r�r	r>r�r�r�r�rBr�r�rZr�r�r�r�r�rr
 327  rrrrrrNrNrNrOr:
s<
 328  
 329  �B
 330  
 331  
 332  &
	
 333  
 334  Nr:c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_CallbackWrapperz�An object adapting a on_trait_change callback into an observe callback.
 335  
 336      The comparison operator __eq__ is implemented to enable removal of wrapped
 337      callbacks.
 338      cCsH||_t|jtj�rdnd}tt|�d�||_|jdkr"td��dS)N�����r�z1a trait changed callback must have 0-4 arguments.)�cbry�types�
 339  MethodTyper�r�nargsr9)r�r"�offsetrNrNrOr��s
 340  �z_CallbackWrapper.__init__cCs t|t�r|j|jkS|j|kSrQ)ryrr"rrNrNrO�__eq__�s
 341  
 342  z_CallbackWrapper.__eq__cCs�|jdkr|��dS|jdkr|�|j�dS|jdkr'|�|j|j�dS|jdkr8|�|j|j|j�dS|jdkrK|�|j|j|j|j�dSdS)Nrrr��r!)r%r"r�r��oldr�r�rNrNrOr��s
 343  
 344  
 345  
 346  
 347  �z_CallbackWrapper.__call__N)rKrLrMr�r�r'r�rNrNrNrOr�s
 348  rcCst|t�r|St|�SrQ)ryr)r"rNrNrO�_callback_wrapper�s
 349  r*cs4eZdZdZ�fdd�Z�fdd�Zdd�Z�ZS)r2z�A metaclass for HasDescriptors.
 350  
 351      This metaclass makes sure that any TraitType class attributes are
 352      instantiated and sets their name attribute.
 353      csP|��D]\}}t�|�rt|t�rtdtdd�|�||<qt��||||�S)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�)	�itemsrd�isclassr{r:rrl�super�__new__)�mclsr��bases�	classdict�k�v�rrNrOr/�s�
 354  �zMetaHasDescriptors.__new__cst��|||�|�|�dS)z-Finish initializing the HasDescriptors class.N)r.r��setup_class)rnr�r1r2r5rNrOr��szMetaHasDescriptors.__init__cCsjg|_g|_|��D]\}}t|t�r|�||�q
 355  t|�D]\}}t|t�r2|�|�|j�|�qdS)z�Setup descriptor instance on the class
 356  
 357          This sets the :attr:`this_class` and :attr:`name` attributes of each
 358          BaseDescriptor in the class dict of the newly created ``cls`` before
 359          calling their :attr:`class_init` method.
 360          N)	Z_descriptorsr�r,ryrr�r�r�r�)rnr2r3r4�_rNrNrOr6�s
 361  �
 362  
 363  ��zMetaHasDescriptors.setup_class)rKrLrMr�r/r�r6�
__classcell__rNrNr5rOr2�s
 364  r2cs eZdZdZ�fdd�Z�ZS)r3zA metaclass for HasTraits.c
 365  	s�i|_i|_i|_i|_t��|�|��}t|�D�]+}zt||�}Wn	t	y-Yqwt
 366  |t��rF||j|<|}d|}z|d|�|j
�d�}Wn	tyVYnw|D]$}||jvrj|j||j|<n�||j�di�vr}|j||j|<n�qY|jduo�|j}	t|�ttfvr�|jdur�|jdur�t
 367  |jt�s�|	r�|j|j|<n�t|�ttfvr�|jdur�|jdur�t
 368  |jt�s�|	r�|j|j|<nxt|�ttfvr�t
 369  |jt�s�|	r�|j|j|<nat|�tt fvr�t
 370  |jt!�s�|	r�|j|j|<nJt|�t"k�rt
 371  |jt!tttf��s|	�r|j|j|<n.t|�t#k�r%|jdu�r%d|j|<nt
 372  |t$��r@|j%du�r@|j&du�r@|j�r@d|j|<|j'|j|<qdS)N�_%s_defaultr�_trait_default_generators)(r:�_all_trait_default_generators�_traits� _static_immutable_initial_valuesr.r6�mror�r�r�ryr:�indexr�rwrfrZr�r�rzrr.�min�max�intrr&�floatrrr�rr=r~rr?r-�default_args�default_kwargsrB)
 373  rnr2r>r�r�r�Zdefault_method_nameZ	mro_trait�cZnone_okr5rNrOr6�s��
 374  �
 375  �
 376  
 377  
 378  
 379  ��
 380  
 381  
 382  ��
 383  ��
 384  ������
 385  ��zMetaHasTraits.setup_class)rKrLrMr�r6r8rNrNr5rOr3�sr3r��rzrrz�returnr5cGs@|std��|D]}|turt|t�std|��qt||d�S)a�A decorator which can be used to observe Traits on a class.
 386  
 387      The handler passed to the decorator will be called with one ``change``
 388      dict argument. The change dictionary at least holds a 'type' key and a
 389      'name' key, corresponding respectively to the type of notification and the
 390      name of the attribute that triggered the notification.
 391  
 392      Other keys may be passed depending on the value of 'type'. In the case
 393      where type is 'change', we also have the following keys:
 394      * ``owner`` : the HasTraits instance
 395      * ``old`` : the old value of the modified trait attribute
 396      * ``new`` : the new value of the modified trait attribute
 397      * ``name`` : the name of the modified trait attribute.
 398  
 399      Parameters
 400      ----------
 401      *names
 402          The str names of the Traits to observe on the object.
 403      type : str, kwarg-only
 404          The type of event to observe (e.g. 'change')
 405      z2Please specify at least one trait name to observe.z5trait names to observe must be strings or All, not %rrG)rkrryr~r5)rzrr�rNrNrOrF<s�rFcsttf�fdd�	}|S)aZBackward-compatibility shim decorator for observers
 406  
 407      Use with:
 408  
 409      @observe('name')
 410      @observe_compat
 411      def _foo_changed(self, change):
 412          ...
 413  
 414      With this, `super()._foo_changed(self, name, old, new)` in subclasses will still work.
 415      Allows adoption of new observer API without breaking subclasses that override and super.
 416      csFt|t�r|}n|jj}td||ft�td||||d�}�||�S)NzSA parent of %s._%s_changed has adopted the new (traitlets 4.1) @observe(change) APIr�)rzr)r�r�r�)ry�dictrrKrrlr)r�Zchange_or_namer)r�r��clsname��funcrNrO�compatible_observerhs"
 417  ���
 418  z+observe_compat.<locals>.compatible_observer)r>)rLrMrNrKrOrGZsrGrAcGs<|std��|D]}|turt|t�std|��qt|�S)a�A decorator to register cross validator of HasTraits object's state
 419      when a Trait is set.
 420  
 421      The handler passed to the decorator must have one ``proposal`` dict argument.
 422      The proposal dictionary must hold the following keys:
 423  
 424      * ``owner`` : the HasTraits instance
 425      * ``value`` : the proposed value for the modified trait attribute
 426      * ``trait`` : the TraitType instance associated with the attribute
 427  
 428      Parameters
 429      ----------
 430      *names
 431          The str names of the Traits to validate.
 432  
 433      Notes
 434      -----
 435      Since the owner has access to the ``HasTraits`` instance via the 'owner' key,
 436      the registered cross validator could potentially make changes to attributes
 437      of the ``HasTraits`` instance. However, we recommend not to do so. The reason
 438      is that the cross-validation of attributes may run in arbitrary order when
 439      exiting the ``hold_trait_notifications`` context, and such changes may not
 440      commute.
 441      z3Please specify at least one trait name to validate.z6trait names to validate must be strings or All, not %r)rkrryr~rA)rr�rNrNrOrI~s�rIr�r!cCst|t�std|��t|�S)a,A decorator which assigns a dynamic default for a Trait on a HasTraits object.
 442  
 443      Parameters
 444      ----------
 445      name
 446          The str name of the Trait on the object whose default should be generated.
 447  
 448      Notes
 449      -----
 450      Unlike observers and validators which are properties of the HasTraits
 451      instance, default value generators are class-level properties.
 452  
 453      Besides, default generators are only invoked if they are registered in
 454      subclasses of `this_type`.
 455  
 456      ::
 457  
 458          class A(HasTraits):
 459              bar = Int()
 460  
 461              @default('bar')
 462              def get_bar_default(self):
 463                  return 11
 464  
 465          class B(A):
 466              bar = Float()  # This trait ignores the default generator defined in
 467                             # the base class A
 468  
 469          class C(B):
 470  
 471              @default('bar')
 472              def some_other_default(self):  # This default generator should not be
 473                  return 3.0                 # ignored since it is defined in a
 474                                             # class derived from B.a.this_class.
 475      z*Trait name must be a string or All, not %r)ryr~rkr!)r�rNrNrOrB�s
 476  $rBc@s&eZdZdd�Zdd�Zddd�ZdS)	r%cCs
 477  ||_|SrQrK)r�rLrNrNrO�
 478  _init_call�szEventHandler._init_callcOs*t|d�r
|j|i|��S|j|i|��S)zCPass `*args` and `**kwargs` to the handler's function if it exists.rL)r�rLrN)r�rr�rNrNrOr��s
 479  zEventHandler.__call__NcCs|dur|St�|j|�SrQ)r#r$rL)r��instrnrNrNrOr��szEventHandler.__get__rQ)rKrLrMrNr�r�rNrNrNrOr%�sr%c@�eZdZdd�Zdd�ZdS)r5cCs||_||_dSrQ)�trait_namesrz)r�rrzrNrNrOr��s
 480  zObserveHandler.__init__cCs|j||j|jd�dS)NrG)rFrQrz�r�rOrNrNrOr��szObserveHandler.instance_initN�rKrLrMr�r�rNrNrNrOr5�sc@rP)rAcCr�rQ�rQ)r�rrNrNrOr��r�zValidateHandler.__init__cCs|�||j�dSrQ)�_register_validatorrQrRrNrNrOr��szValidateHandler.instance_initNrSrNrNrNrOrA�scs$eZdZdd�Z�fdd�Z�ZS)r!cCr�rQ)r��r�r�rNrNrOr��r�zDefaultHandler.__init__cst��||�||j|j<dSrQ)r.r�r:r�r�r5rNrOr��szDefaultHandler.class_init)rKrLrMr�r�r8rNrNr5rOr!�scs<eZdZdZdejdejdejf�fdd�Zdd�Z�ZS)	r+z5The base class for all classes that have descriptors.rr�rHcs^|d}|dd�}tt|�j}|tjur||�}n||g|�Ri|��}|j|i|��|Sr�)r.r+r/r��setup_instance)rr�rn�new_methrOr5rNrOr/�s
 481  
 482  zHasDescriptors.__new__cOs8|d}|dd�}d|_|j}|jD]}||�qdS)zD
 483          This is called **before** self.__init__ is called.
 484          rrNF)r�rr�)rr�r�rn�initrNrNrOrWs
 485  
 486  �zHasDescriptors.setup_instance)	rKrLrMr�r|rr/rWr8rNrNr5rOr+�s r+)�	metaclasscs�eZdZUejeejfed<ejeejfed<ejeejfed<ejeejfed<eed<ejeejfed<ejeejfed<�fdd	�Z	�fd
 487  d�Z
 488  dd
�Zdd�Ze
ejdd���Zejdd��Zdd�Zdd�Zdd�Zdd�Zdd�ZdId d!�Zed"fd#d$�Zed"fd%d&�Zefd'd(�Zd)d*�Zd+d,�Zd-d.�Zed/d0��Z ed1d2��Z!e�fd3d4��Z"d5d6�Z#d7d8�Z$d9d:�Z%d;d<�Z&d=d>�Z'd?d@�Z(dAdB�Z)dJdCdD�Z*e�fdEdF��Z+edJdGdH��Z,�Z-S)Kr,r�r=�_trait_notifiersrr�r<r;csL|d}|dd�}|j��|_i|_i|_d|_tt|�j|i|��dS)NrrF)	r=r�r�r[rr�r.r,rW)rr�r�r5rNrOrW"szHasTraits.setup_instancec
 489  sv|}i}|rmdd�}||_d|_i}|��D]\}}|�|�r1t|||�t|d||dd�||<q|||<qt|�t|j�@}	|	D]}|j|�|t	||��}|�
 490  ||�|||d<qAd|_|`|	D]	}|�||�qczt�j|i|��WdSt
y�}
 491  z5dd	�|D�}|��D]\}}
|�|�d
 492  |
���q�d�|�}tdj||jj|
 493  d
�tdd�WYd}
 494  ~
 495  dSd}
 496  ~
 497  ww)NcW�dSrQrN)Z_ignore_argsrNrNrO�ignore:�z"HasTraits.__init__.<locals>.ignoreTr��r�r)r�r�rzr�FcS�g|]}t|��qSrN)r)r
�argrNrNrO�
 498  <listcomp>\�z&HasTraits.__init__.<locals>.<listcomp>�=z, z�Passing unrecognized arguments to super({classname}).__init__({arg_s}).
 499  {error}
 500  This is deprecated in traitlets 4.2.This error will be raised in a future release of traitlets.)�arg_sr_rr�r�)�
notify_changer�r,�	has_traitr�rr�r<r�r��	set_traitr.r�rkr�rrrcrrKrl)r�rr�Z
 501  super_argsZsuper_kwargsr]�changesr]r��changedrsZ
 502  arg_s_listr3r4rer5rNrOr�0s\
 503  �
 504  	
 505  ����zHasTraits.__init__cCs4|j��}i|d<i|d<|j��|d<d|d<|S)Nr[rr�Fr�)rfr�r�)r��drNrNrO�__getstate__ms
 506  zHasTraits.__getstate__c	CsX|��|_|j}t|�D]}zt||�}Wn	tyYqwt|t�r)|�|�qdSrQ)	r�rfrr�r�r�ryr%r�)r��staternr]r�rNrNrO�__setstate__ys
 507  �
 508  
 509  ��zHasTraits.__setstate__ccs4�|jr	dVdSzd|_dVWd|_dSd|_w)z�
 510          A contextmanager for running a block with our cross validation lock set
 511          to True.
 512  
 513          At the end of the block, the lock's value is restored to its value
 514          prior to entering the block.
 515          NTF)r�r�rNrNrO�cross_validation_lock�s�
 516  zHasTraits.cross_validation_lockc#sb�|jr	dVdSi�dd����fdd�}z�z)||_d|_dVt����D]}t|j|�}|�|t||��}|�||�q'Wn@ty�}z4dd�|_��	�D]&\}}|ddd	�D]}|j
 517  d
 518  krv|jturp|�||j�q\|j
�|�q\qQi�|�d}~wwWd|_|`���D]}|D]}|�|�q�q�dSd|_|`���D]}|D]}|�|�q�q�w)aHContext manager for bundling trait change notifications and cross
 519          validation.
 520  
 521          Use this when doing multiple trait assignments (init, config), to avoid
 522          race conditions in trait notifiers requesting other trait values.
 523          All trait notifications will fire after all values have been assigned.
 524          NcSsH|dur|gS|dddkr|jdkr|j|dd<|S|�|�|S)z5Merges the provided change with the last if possible.Nr rzr�r�)rzr�r�)Zpast_changesr�rNrNrO�compress�s
 525  �z4HasTraits.hold_trait_notifications.<locals>.compresscs|j}���|�|��|<dSrQ)r�rZ)r�r���cacherprNrO�hold�sz0HasTraits.hold_trait_notifications.<locals>.holdTcSr\rQrNr�rNrNrOr��r�z4HasTraits.hold_trait_notifications.<locals>.<lambda>r r�F)r�rf�listrr�rr�rhr9r,rzr)r>r��pop�values)r�rsr�r�r�rsrir�rNrqrO�hold_trait_notifications�sZ�	�
 526  
 527  
 528  ����������z"HasTraits.hold_trait_notificationsc	Cs|�t||||dd��dS)Nr�r_)rfr)r�r�r�r�rNrNrOr��s��zHasTraits._notify_traitcCs
 529  |�|�S)z"Notify observers of a change event)r�r�rNrNrOrf��
 530  zHasTraits.notify_changec	CsXt|t�s	t|�}|d|d}}g}||jvr5|�|j�|i��|g��|�|j�|i��tg��t|jvrV|�|j�ti��|g��|�|j�ti��tg��d|}|ddkr�t||�r�t|j|�}t|t	�s�t
 531  ||j|d�t||�}||vr�|�t|��|D]}t|t
�r�|j}nt|t�r�|jdur�t||j�}||�q�dS)zNotify observers of any eventr�rzz_%s_changedr�z$use @observe and @unobserve instead.N)ryrr[�extendrZrr�r�rr5rtr�r*rr�r%r�)	r��eventr�rz�	callables�
 532  magic_name�class_valuer"rFrNrNrOr��sD
 533  
 534  
 535  ��
 536  �
 537  
 538  
 539  �zHasTraits._notify_observerscCsh||jvrg}||i|j|<n||j|vr g}||j||<n|j||}||vr2|�|�dSdSrQ)r[r�)r��handlerr�rz�nlistrNrNrO�_add_notifierss
 540  �zHasTraits._add_notifierscCsJz|dur|j||=WdS|j||�|�WdSty$YdSwrQ)r[�remover�)r�r~r�rzrNrNrO�_remove_notifiers*s�zHasTraits._remove_notifiersNFcCsJtdtdd�|dur
t}|r|jt|�|d�dS|jt|�|d�dS)a�DEPRECATED: Setup a handler to be called when a trait changes.
 541  
 542          This is used to setup dynamic notifications of trait changes.
 543  
 544          Static handlers can be created by creating methods on a HasTraits
 545          subclass with the naming convention '_[traitname]_changed'.  Thus,
 546          to create static handler for the trait 'a', create the method
 547          _a_changed(self, name, old, new) (fewer arguments can be used, see
 548          below).
 549  
 550          If `remove` is True and `handler` is not specified, all change
 551          handlers for the specified name are uninstalled.
 552  
 553          Parameters
 554          ----------
 555          handler : callable, None
 556              A callable that is called when a trait changes.  Its
 557              signature can be handler(), handler(name), handler(name, new),
 558              handler(name, old, new), or handler(name, old, new, self).
 559          name : list, str, None
 560              If None, the handler will apply to all traits.  If a list
 561              of str, handler will apply to all names in the list.  If a
 562              str, the handler will apply just to that name.
 563          remove : bool
 564              If False (the default), then install the handler.  If True
 565              then unintall it.
 566          zCon_trait_change is deprecated in traitlets 4.1: use observe insteadr�r�Nr�)rrlrr�r*rF)r�r~r�r�rNrNrO�on_trait_change3s�zHasTraits.on_trait_changer�cC�$t|�}|D]	}|�|||�qdS)a	Setup a handler to be called when a trait changes.
 567  
 568          This is used to setup dynamic notifications of trait changes.
 569  
 570          Parameters
 571          ----------
 572          handler : callable
 573              A callable that is called when a trait changes. Its
 574              signature should be ``handler(change)``, where ``change`` is a
 575              dictionary. The change dictionary at least holds a 'type' key.
 576              * ``type``: the type of notification.
 577              Other keys may be passed depending on the value of 'type'. In the
 578              case where type is 'change', we also have the following keys:
 579              * ``owner`` : the HasTraits instance
 580              * ``old`` : the old value of the modified trait attribute
 581              * ``new`` : the new value of the modified trait attribute
 582              * ``name`` : the name of the modified trait attribute.
 583          names : list, str, All
 584              If names is All, the handler will apply to all traits.  If a list
 585              of str, handler will apply to all names in the list.  If a
 586              str, the handler will apply just to that name.
 587          type : str, All (default: 'change')
 588              The type of notification to filter by. If equal to All, then all
 589              notifications are passed to the observe handler.
 590          N)rHr��r�r~rrzr�rNrNrOrF[s�zHasTraits.observecCr�)a�Remove a trait change handler.
 591  
 592          This is used to unregister handlers to trait change notifications.
 593  
 594          Parameters
 595          ----------
 596          handler : callable
 597              The callable called when a trait attribute changes.
 598          names : list, str, All (default: All)
 599              The names of the traits for which the specified handler should be
 600              uninstalled. If names is All, the specified handler is uninstalled
 601              from the list of notifiers corresponding to all changes.
 602          type : str or All (default: 'change')
 603              The type of notification to filter by. If All, the specified handler
 604              is uninstalled from the list of notifiers corresponding to all types.
 605          N)rHr�r�rNrNrOr�ys�zHasTraits.unobservecCs6|tur	i|_dSz|j|=WdStyYdSw)zRemove trait change handlers of any type for the specified name.
 606          If name is not specified, removes all trait notifiers.N)rr[r�rVrNrNrO�
unobserve_all�s
 607  �zHasTraits.unobserve_allcCsZ|D]}d|}t||�r t|j|�}t|t�s t||j|d�q|D]}||j|<q#dS)a�Setup a handler to be called when a trait should be cross validated.
 608  
 609          This is used to setup dynamic notifications for cross-validation.
 610  
 611          If a validator is already registered for any of the provided names, a
 612          TraitError is raised and no new validator is registered.
 613  
 614          Parameters
 615          ----------
 616          handler : callable
 617              A callable that is called when the given trait is cross-validated.
 618              Its signature is handler(proposal), where proposal is a Bunch (dictionary with attribute access)
 619              with the following attributes/keys:
 620                  * ``owner`` : the HasTraits instance
 621                  * ``value`` : the proposed value for the modified trait attribute
 622                  * ``trait`` : the TraitType instance associated with the attribute
 623          names : List of strings
 624              The names of the traits that should be cross-validated
 625          r�r�N)r�r�rryrArtr)r�r~rr�r|r}rNrNrOrU�s
 626  
 627  ���zHasTraits._register_validatorcKs\|j}d|ji}t|d�r|j|d<|�|�t|j|f|�|_|��D]}|�|�q$dS)z;Dynamically add trait attributes to the HasTraits instance.rLrMN)	rrLr�rMr�rzrKrvr�)r�r�rn�attrsr�rNrNrO�
 628  add_traits�s
 629  
 630  
 631  
 632  �zHasTraits.add_traitscCs<|j}|�|�std|j�d|����t||��||�dS)z>Forcibly sets trait attribute, including read-only attributes.�Class � does not have a trait named N)rrgr9rKr�r�)r�r�r�rnrNrNrOrh�s
 633  zHasTraits.set_traitcK�t|jdi|���S)z�Get a list of all the names of this class' traits.
 634  
 635          This method is just like the :meth:`trait_names` method,
 636          but is unbound.
 637          NrN)rt�class_traits�rnr�rNrNrO�class_trait_names�szHasTraits.class_trait_namescK�t|j��}t|�dkr
|Si}|��D]$\}}|��D]\}}t|�s't|�}||j�|d��s2nq|||<q|S)a�Get a ``dict`` of all the traits of this class.  The dictionary
 638          is keyed on the name and the values are the TraitType objects.
 639  
 640          This method is just like the :meth:`traits` method, but is unbound.
 641  
 642          The TraitTypes returned don't know anything about the values
 643          that the various HasTrait's instances are holding.
 644  
 645          The metadata kwargs allow functions to be passed in which
 646          filter traits based on metadata values.  The functions should
 647          take a single value as an argument and return a boolean.  If
 648          any function returns False, then the trait is not included in
 649          the output.  If a metadata key doesn't exist, None will be passed
 650          to the function.
 651          rN�r<r�r�r,�callabler�r�rZ)rnr�r��resultr�r��	meta_name�	meta_evalrNrNrOr��s
 652  ��zHasTraits.class_traitscs,t||���fdd�|jdi|����D�S)z�Get a dict of all the traitlets defined on this class, not a parent.
 653  
 654          Works like `class_traits`, except for excluding traits from parents.
 655          c�&i|]\}}t�|d�|ur||�qSrQ�r�)r
r�r|��suprNrO�
 656  <dictcomp>�
 657  �z.HasTraits.class_own_traits.<locals>.<dictcomp>NrN)r.r�r,r�r5r�rO�class_own_traits�s
 658  
 659  �zHasTraits.class_own_traitscC�
 660  ||jvS)z?Returns True if the object has a trait with the specified name.)r<rVrNrNrOrgrxzHasTraits.has_traitcCr�)a'Returns True if the specified trait has a value.
 661  
 662          This will return false even if ``getattr`` would return a
 663          dynamically generated default value. These default values
 664          will be recognized as existing only after they have been
 665          generated.
 666  
 667          Example
 668  
 669          .. code-block:: python
 670  
 671              class MyClass(HasTraits):
 672                  i = Int()
 673  
 674              mc = MyClass()
 675              assert not mc.trait_has_value("i")
 676              mc.i # generates a default value
 677              assert mc.trait_has_value("i")
 678          )r�rVrNrNrO�trait_has_values
 679  zHasTraits.trait_has_valuecs�fdd��jdi|��D�S)a�A ``dict`` of trait names and their values.
 680  
 681          The metadata kwargs allow functions to be passed in which
 682          filter traits based on metadata values.  The functions should
 683          take a single value as an argument and return a boolean.  If
 684          any function returns False, then the trait is not included in
 685          the output.  If a metadata key doesn't exist, None will be passed
 686          to the function.
 687  
 688          Returns
 689          -------
 690          A ``dict`` of trait names and their values.
 691  
 692          Notes
 693          -----
 694          Trait values are retrieved via ``getattr``, any exceptions raised
 695          by traits or the operations they may trigger will result in the
 696          absence of a trait value in the result ``dict``.
 697          csi|]}|t�|��qSrNr�)r
r�r�rNrOr�5sz*HasTraits.trait_values.<locals>.<dictcomp>NrNrT�r�r�rNr�rO�trait_values!szHasTraits.trait_valuescCs>d|}||jvrt||�S||jjvrt|j|�S|j|S)z�Return default generator for a given trait
 698  
 699          Walk the MRO to resolve the correct default generator according to inheritance.
 700          r9)rfr�rr;)r�r�r`rNrNrO�_get_trait_default_generator7s
 701  
 702  
 703  z&HasTraits._get_trait_default_generatorcOs�|D]}|�|�std|�dt|�j�d���qt|�dkr-t|�dkr-|�|d�|�S|jdi|��}|�|�i}|D]}|�|�|�||<q>|S)z�Return a trait's default value or a dictionary of them
 704  
 705          Notes
 706          -----
 707          Dynamically generated default values may
 708          depend on the current state of the object.�'z' is not a trait of 'z' instancesrrNrN)rgr9rzrKr�r�rQry)r�rr�r�rQ�defaultsrNrNrOr�Cs
 709  �
 710  zHasTraits.trait_defaultscKr�)z2Get a list of all the names of this class' traits.NrN)rtr�r�rNrNrOrQYszHasTraits.trait_namescKr�)a�Get a ``dict`` of all the traits of this class.  The dictionary
 711          is keyed on the name and the values are the TraitType objects.
 712  
 713          The TraitTypes returned don't know anything about the values
 714          that the various HasTrait's instances are holding.
 715  
 716          The metadata kwargs allow functions to be passed in which
 717          filter traits based on metadata values.  The functions should
 718          take a single value as an argument and return a boolean.  If
 719          any function returns False, then the trait is not included in
 720          the output.  If a metadata key doesn't exist, None will be passed
 721          to the function.
 722          rNr�)r�r�r�r�r�r�r�r�rNrNrOr�]s
 723  ��zHasTraits.traitsc
 724  Cs�zt|j|�}Wnty!}z
td|jj�d|���|�d}~wwd|d}t||�r=|t||�vr=t||��||�S|j�||�S)z%Get metadata values for trait by key.r�r�Nr7�	_metadata)r�rr�r9rKr�rZr�)r��	traitnamer]rBr�rsZ
metadata_namerNrNrO�trait_metadata|s����zHasTraits.trait_metadatacs&t||���fdd�|�|���D�S)z�Get a dict of all event handlers defined on this class, not a parent.
 725  
 726          Works like ``event_handlers``, except for excluding traits from parents.
 727          cr�rQr�)r
r�rsr�rNrOr��r�z4HasTraits.class_own_trait_events.<locals>.<dictcomp>)r.�eventsr,)rnr�r5r�rO�class_own_trait_events�s
 728  
 729  �z HasTraits.class_own_trait_eventscCsni}t|�D].\}}t|t�r4|dur|||<q||jvr"|||<qt|d�r4|jdi|j��r4|||<q|S)a�Get a ``dict`` of all the event handlers of this class.
 730  
 731          Parameters
 732          ----------
 733          name : str (default: None)
 734              The name of a trait of this class. If name is ``None`` then all
 735              the event handlers of this class will be returned instead.
 736  
 737          Returns
 738          -------
 739          The event handlers associated with a trait name, or all event handlers.
 740          N�tagsrN)r�ryr%rQr�r�)rnr�r�r3r4rNrNrO�trait_events�s
 741  
 742  
 743  
 744  
 745  �zHasTraits.trait_events)NNFrQ).rKrLrMr|r"r~rr�r�rWr�rlrn�propertyr�r�rorwr�rfr�r�r�r�rrFr�r�rUr�rh�classmethodr�r�r�rgr�r�r�r�rQr�r�r�r�r8rNrNr5rOr,s^
 746  =
 747  @/
 748  	("
 749  
 750  !
 751  r,c@�eZdZdZdd�ZdS)rze
 752      A trait with error reporting and string -> type resolution for Type,
 753      Instance and This.
 754      cC�t|�S)zM
 755          Resolve a string supplied for a type into an actual object.
 756          r)r��stringrNrNrO�_resolve_string�sz#ClassBasedTraitType._resolve_stringN�rKrLrMr�r�rNrNrNrOr�srcsNeZdZdZedf�fdd�	Zdd�Zdd�Zd	d
 757  �Zdd�Z	d
d�Z
 758  �ZS)r<z<A trait whose value must be a subclass of a specified class.Ncsz|tur
|dur
 759  tn|}n|}|dur |dus|turt}n|}t�|�s.t|t�s.td��||_t�j	|fi|��dS)a^Construct a Type trait
 760  
 761          A Type trait specifies that its values must be subclasses of
 762          a particular class.
 763  
 764          If only ``default_value`` is given, it is used for the ``klass`` as
 765          well. If neither are given, both default to ``object``.
 766  
 767          Parameters
 768          ----------
 769          default_value : class, str or None
 770              The default value must be a subclass of klass.  If an str,
 771              the str must be a fully specified class name, like 'foo.bar.Bah'.
 772              The string is resolved into real class, when the parent
 773              :class:`HasTraits` class is instantiated.
 774          klass : class, str [ default object ]
 775              Values of this trait must be a subclass of klass.  The klass
 776              may be specified in a string like: 'foo.bar.MyClass'.
 777              The string is resolved into real class, when the parent
 778              :class:`HasTraits` class is instantiated.
 779          allow_none : bool [ default False ]
 780              Indicates whether None is allowed as an assignable value.
 781          **kwargs
 782              extra kwargs passed to `ClassBasedTraitType`
 783          Nz"A Type trait must specify a class.)
 784  r>r�rdr-ryr~r9�klassr.r�)r�r�r�r�Znew_default_valuer5rNrOr��sz
Type.__init__c
 785  Cs�t|t�r$z|�|�}Wnty#}ztd|j||f�|�d}~wwzt||j�r.|WSWn	ty8Ynw|�	||�dS)z4Validates that the value is a valid object instance.zJThe '%s' trait of %s instance must be a type, but %r could not be importedN)
 786  ryr~r��ImportErrorr9r�r{r�r�r�r�r�r�rsrNrNrOrI�s*
 787  
 788  �������z
Type.validatecCsBt|jt�r
 789  |j}n
 790  |jjd|jj}d|}|jr|dS|S)�#Returns a description of the trait.rbza subclass of '%s'� or None)ryr�r~rLrKr�)r�r�r�rNrNrOr
 791  	sz	Type.infocC�|��dSrQ��_resolve_classesr�rNrNrOr��zType.instance_initcCs<t|jt�r
|�|j�|_t|jt�r|�|j�|_dSdSrQ)ryr�r~r�r�r�rNrNrOr�s
 792  �zType._resolve_classescCs:|j}|dus	J�t|t�rt|�St|j�d|j���S)Nrb)r�ryr~rrLrKr�rNrNrOrs
 793  
 794  zType.default_value_repr)rKrLrMr�r>r�rIr
 795  r�r�rr8rNrNr5rOr<�s,r<cs^eZdZdZdZd�fdd�	Zdd�Zdd�Zd	d
 796  �Zdd�Z	d
d�Z
 797  dd�Zdd�Z�Z
S)r-z�A trait whose value must be an instance of a specified class.
 798  
 799      The value can also be an instance of a subclass of the specified class.
 800  
 801      Subclasses can declare default classes by overriding the klass attribute
 802      Ncs�|dur|j}|durt�|�st|t�r||_ntd|��|dur,t|t�s,td��|dur9t|t�s9td��||_||_	t
 803  �jdi|��dS)a�Construct an Instance trait.
 804  
 805          This trait allows values that are instances of a particular
 806          class or its subclasses.  Our implementation is quite different
 807          from that of enthough.traits as we don't allow instances to be used
 808          for klass and we handle the ``args`` and ``kw`` arguments differently.
 809  
 810          Parameters
 811          ----------
 812          klass : class, str
 813              The class that forms the basis for the trait.  Class names
 814              can also be specified as strings, like 'foo.bar.Bar'.
 815          args : tuple
 816              Positional arguments for generating the default value.
 817          kw : dict
 818              Keyword arguments for generating the default value.
 819          allow_none : bool [ default False ]
 820              Indicates whether None is allowed as a value.
 821          **kwargs
 822              Extra kwargs passed to `ClassBasedTraitType`
 823  
 824          Notes
 825          -----
 826          If both ``args`` and ``kw`` are None, then the default value is None.
 827          If ``args`` is a tuple and ``kw`` is a dict, then the default is
 828          created as ``klass(*args, **kw)``.  If exactly one of ``args`` or ``kw`` is
 829          None, the None is replaced by ``()`` or ``{}``, respectively.
 830          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.rN)r�rdr-ryr~r9rIr�rDrEr.r�)r�r�r�kwr�r5rNrOr�2szInstance.__init__cCs.|jdusJ�t||j�r|S|�||�dSrQ)r�ryrr�rNrNrOrIaszInstance.validatecCs6t|jt�rt|j�}ntd|j�}|jr|d7}|S)Nrr�)ryr�r~rr	r�)r�r�rNrNrOr
 831  hsz
Instance.infocCr�rQr�r�rNrNrOr�qr�zInstance.instance_initcCs"t|jt�r|�|j�|_dSdSrQ)ryr�r~r�r�rNrNrOr�vs�zInstance._resolve_classescCsB|jdur|jdurdS|jdusJ�|j|jpdi|jpi��S)NrN)rDrEr�r�rNrNrOr�zs��zInstance.make_dynamic_defaultcCst|���SrQ)rr�r�rNrNrOr��zInstance.default_value_reprcCr�rQ)rxr�rNrNrOr��rVzInstance.from_string)NNN)rKrLrMr�r�r�rIr
 832  r�r�r�rr�r8rNrNr5rOr-(s/	r-c@r�)r(zC
 833      Mixin for forward-declared versions of Instance and Type.
 834      cCs|jj}td�||g��S)z�
 835          Find the specified class name by looking for it in the module in which
 836          our this_class attribute was defined.
 837          rb)r�rLr
r)r�r��modnamerNrNrOr��sz$ForwardDeclaredMixin._resolve_stringNr�rNrNrNrOr(�sr(c@�eZdZdZdS)r)z+
 838      Forward-declared version of Type.
 839      N�rKrLrMr�rNrNrNrOr)��r)c@r�)r'z/
 840      Forward-declared version of Instance.
 841      Nr�rNrNrNrOr'�r�r'cs,eZdZdZdZ�fdd�Zdd�Z�ZS)r8aA trait for instances of the class containing this trait.
 842  
 843      Because how how and when class bodies are executed, the ``This``
 844      trait can only have a default value of None.  This, and because we
 845      always validate default values, ``allow_none`` is *always* true.
 846      z4an instance of the same type as the receiver or Nonecst�jdi|��dS)NrQ�r.r��r�r�r5rNrOr��sz
This.__init__cCs6|jdusJ�t||j�s|dur|S|�||�dSrQ)r�ryrr�rNrNrOrI�sz
This.validate)rKrLrMr�r	r�rIr8rNrNr5rOr8�s
 847  r8cs^eZdZdZ�fdd�Zd�fdd�	Z�fdd�Zd	d
 848  �Zdd�Zd
d�Z	�fdd�Z
 849  �ZS)r?z'A trait type representing a Union type.cs8t|�|_d�dd�|jD��|_t�jdi|��dS)a�Construct a Union  trait.
 850  
 851          This trait allows values that are allowed by at least one of the
 852          specified trait types. A Union traitlet cannot have metadata on
 853          its own, besides the metadata of the listed types.
 854  
 855          Parameters
 856          ----------
 857          trait_types : sequence
 858              The list of trait types of length at least 1.
 859          **kwargs
 860              Extra kwargs passed to `TraitType`
 861  
 862          Notes
 863          -----
 864          Union([Float(), Bool(), Int()]) attempts to validate the provided values
 865          with the validation function of Float, then Bool, and finally Int.
 866  
 867          Parsing from string is ambiguous for container types which accept other
 868          collection-like literals (e.g. List accepting both `[]` and `()`
 869          precludes Union from ever parsing ``Union([List(), Tuple()])`` as a tuple;
 870          you can modify behaviour of too permissive container traits by overriding
 871          ``_literal_from_string_pairs`` in subclasses.
 872          Similarly, parsing unions of numeric types is only unambiguous if
 873          types are provided in order of increasing permissiveness, e.g.
 874          ``Union([Int(), Float()])`` (since floats accept integer-looking values).
 875          z or cSsg|]}|���qSrN)r
 876  )r
�ttrNrNrOrb�rcz"Union.__init__.<locals>.<listcomp>NrN)rtrrr	r.r�)r�rr�r5rNrOr��s
 877  zUnion.__init__Ncs4t��|�}|jD]}|tur|�|�}q	|S|SrQ)r.rBrr>)r�r�rBr�r5rNrOrB�s
 878  z
Union.defaultcs.t|j�D]}|�|d�qt��||�dSrQ)�reversedrr�r.)r�rnr��
 879  trait_typer5rNrOr��szUnion.class_initcCst|j�D]}|�|�qdSrQ)r�rr�)r�rnr�rNrNrOr��s�zUnion.subclass_initc
 880  Cs�|j�:|jD].}z#|�||�}|jdur!t|d|jd|j�|WWd�Sty5YqwWd�n1s@wY|�||�dS)Nr7r�)rorr�r�r�r�r9r)r�r�r�r�r4rNrNrOrI�s
 881  
 882  ����
 883  zUnion.validatecCs*t|t�r
t|j|j�St|j|g�SrQrrrNrNrOr	s
 884  zUnion.__or__c
 885  sJ|jD]}z|�|�}|�d|�WSttfyYqwt��|�SrQ)rr�rIr9rwr.)r�rUr�r4r5rNrOr�		s
 886  
 887  �zUnion.from_stringrQ)rKrLrMr�r�rBr�r�rIrr�r8rNrNr5rOr?�s 	
r?c@s6eZdZUdZdZejejed<dZ	dZ
 888  dd�ZdS)rzA trait which allows any value.Nr�Tr�cCr\rQrNr�rNrNrOr�	r^zAny.subclass_init)rKrLrMr�r�r|r�rr�r�r	r�rNrNrNrOr	s
 889  rcCsh|jdur||jkrtdj|jt|�||jd���|jdur2||jkr2tdj|jt|�||jd���|S)z�
 890      Validate that a number to be applied to a trait is between bounds.
 891  
 892      If value is not between min_bound and max_bound, this raises a
 893      TraitError with an error message appropriate for this trait.
 894      Nz}The value of the '{name}' trait of {klass} instance should not be less than {min_bound}, but a value of {value} was specified)r�r�r�Z	min_boundz�The value of the '{name}' trait of {klass} instance should not be greater than {max_bound}, but a value of {value} was specified)r�r�r�Z	max_bound)r@r9rcr�rrA)r�r�r�rNrNrO�_validate_bounds#	s����r�c�FeZdZdZdZdZedf�fdd�	Zdd�Zd	d
 895  �Z	dd�Z
 896  �ZS)
r.z
An int trait.rzan intFcs8|�dd�|_|�dd�|_t�jd||d�|��dS)Nr@rA�r�r�rN)rur@rAr.r��r�r�r�r�r5rNrOr�C	szInt.__init__cCs"t|t�s|�||�t|||�SrQ)ryrBrr�r�rNrNrOrIH	s
 897  zInt.validatecC�|jr	|dkr	dSt|�S�Nr�)r�rBr�rNrNrOr�M	�zInt.from_stringcCr\rQrNr�rNrNrOr�R	r^zInt.subclass_init�rKrLrMr�r�r	r>r�rIr�r�r8rNrNr5rOr.=	sr.c@r�)rz#A casting version of the int trait.cC�8zt|�}Wnty|�||�Ynwt|||�SrQ)rBr�rr�r�rNrNrOrIY	��z
CInt.validateN�rKrLrMr�rIrNrNrNrOrV	�rcr�)
r&zA float trait.gza floatFcsB|�dtd��|_|�dtd��|_t�jd||d�|��dS)Nr@�infrAr�rN)rurCr@rAr.r�r�r5rNrOr�k	szFloat.__init__cCs4t|t�r	t|�}t|t�s|�||�t|||�SrQ)ryrBrCrr�r�rNrNrOrIp	s
 898  
 899  
 900  zFloat.validatecCr�r�)r�rCr�rNrNrOr�w	r�zFloat.from_stringcCr\rQrNr�rNrNrOr�|	r^zFloat.subclass_initr�rNrNr5rOr&e	sr&c@r�)rz%A casting version of the float trait.cCr�rQ)rCr�rr�r�rNrNrOrI�	r�zCFloat.validateNr�rNrNrNrOr�	r�rc@�0eZdZdZdZdZdd�Zdd�Zdd	�Zd
 901  S)rzA trait for complex numbers.yza complex numbercCs4t|t�r|St|ttf�rt|�S|�||�dSrQ)ry�complexrCrBrr�rNrNrOrI�	s
 902  
 903  zComplex.validatecCr�r�)r�r�r�rNrNrOr��	r�zComplex.from_stringcCr\rQrNr�rNrNrOr��	r^zComplex.subclass_initN�	rKrLrMr�r�r	rIr�r�rNrNrNrOr�	src@r�)rz.A casting version of the complex number trait.cC�,zt|�WSty|�||�YdSwrQ)r�r�rr�rNrNrOrI�	�
 904  
 905  �zCComplex.validateNr�rNrNrNrOr�	r�rc@r�)rzA trait for byte strings.�za bytes objectcCst|t�r|S|�||�dSrQ)ry�bytesrr�rNrNrOrI�	�
 906  zBytes.validatecCsz|jr	|dkr	dSt|�dkr8dD]&}|dd�d|��kr7|d|kr7|}|dd�}td||ft�nq|�d�S)	Nr�r(��"r�r��br zZSupporting extra quotes around Bytes is deprecated in traitlets 5.0. Use %r instead of %r.�utf8)r�r�r�
FutureWarning�encode)r�rU�quote�old_srNrNrOr��	s "���
 907  zBytes.from_stringcCr\rQrNr�rNrNrOr��	r^zBytes.subclass_initNr�rNrNrNrOr�	src@r�)rz+A casting version of the byte string trait.cCr�rQ)r�r�rr�rNrNrOrI�	r�zCBytes.validateNr�rNrNrNrOr�	r�rc@r�)r=zA trait for unicode strings.r�za unicode stringc
 908  Csnt|t�r|St|t�r/z|�dd�WSty.}zd}t|�||jt|���|�d}~ww|�	||�dS)N�ascii�strictz<Could not decode {!r} for unicode trait '{}' of {} instance.)
 909  ryr~r��decode�UnicodeDecodeErrorr9rcr�rr)r�r�r�rsrarNrNrOrI�	s
 910  
 911  ��zUnicode.validatecCsz|jr	|dkr	dStj�|�}t|�dkr;dD]#}|d|dkr'|kr:nq|}|dd�}td||ft�q|S)Nr�r�r�rr rz�Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use %r instead of %r if you require traitlets >=5.)r�rX�path�
 912  expanduserr�rr�)r�rUrFr�rNrNrOr��	s  ���zUnicode.from_stringcCr\rQrNr�rNrNrOr��	r^zUnicode.subclass_initNr�rNrNrNrOr=�	sr=c@r�)rz'A casting version of the unicode trait.cCr�rQ)r~r�rr�rNrNrOrI
 913  r�zCUnicode.validateNr�rNrNrNrOr�	r�rc@s0eZdZdZdZedd��Zdd�Zdd�Zd	S)
 914  r4z{A string holding a valid object name in this version of Python.
 915  
 916      This does not check that the name exists in any scope.z#a valid object identifier in PythoncCs|SrQrN)r7rUrNrNrOr�
 917  r�zObjectName.<lambda>cCs2|�||�}t|t�rt|�r|S|�||�dSrQ)�
 918  coerce_strryr~rSrr�rNrNrOrI
 919  szObjectName.validatecCs|jr	|dkr	dS|Sr�r�r�rNrNrOr�
 920  szObjectName.from_stringN)	rKrLrMr�r	�staticmethodr�rIr�rNrNrNrOr4
 921  sr4c@r�)r#zFA string holding a valid dotted object name in Python, such as A.b3._ccCsB|�||�}t|t�rtdd�|�d�D��r|S|�||�dS)Ncss�|]}t|�VqdSrQrR)r
rrNrNrOr$
 922  ��z,DottedObjectName.validate.<locals>.<genexpr>rb)r�ryr~�allrgrr�rNrNrOrI!
 923  s"zDottedObjectName.validateNr�rNrNrNrOr#
 924  r�r#c@s8eZdZdZdZdZdd�Zdd�Zdd	�Zd
 925  d�Z	dS)
rzA boolean (True, False) trait.Fz	a booleancCs@t|t�r|St|t�r|dkrdS|dkrdS|�||�dS)NrTrF)ryr�rBrr�rNrNrOrI/
 926  s
 927  
 928  z
Bool.validatecCs:|jr	|dkr	dS|��}|dvrdS|dvrdStd��)Nr�>�1�trueT>rW�falseFz%r is not 1, 0, true, or false)r��lowerrwr�rNrNrOr�9
 929  szBool.from_stringcCr\rQrNr�rNrNrOr�D
 930  r^zBool.subclass_initcKsgd�}|jr|�d�|S)� Completion hints for argcomplete)r�r�r�rWr�)r�r�)r�r��completionsrNrNrO�argcompleterG
 931  s
 932  zBool.argcompleterN)
 933  rKrLrMr�r�r	rIr�r�r�rNrNrNrOr)
 934  s
 935  rc@r�)rz'A casting version of the boolean trait.cCr�rQ)r�r�rr�rNrNrOrIR
 936  r�zCBool.validateNr�rNrNrNrOrO
 937  r�rcsheZdZdZef�fdd�	Zdd�Zddd�Zdd	d
 938  �Zdd�Z	d
d�Z
 939  dd�Zdd�Zdd�Z
�ZS)r$z0An enum whose value must be in a given sequence.cs6||_|�dd�r|turd}t�j|fi|��dS)Nr�F)rvrZr>r.r��r�rvr�r�r5rNrOr�\
 940  sz
Enum.__init__cCs||jvr|S|�||�dSrQ)rvrr�rNrNrOrIb
 941  r�z
Enum.validateFcCs2|j}|rd�dd�|D��}|Stt|��}|S)�6Returns a description of the trait choices (not none).�|cs��|]}d|VqdS�z``%r``NrN�r
r�rNrNrOrk
 942  r�z$Enum._choices_str.<locals>.<genexpr>)rvrrrt�r��as_rst�choicesrNrNrO�_choices_strg
 943  s�zEnum._choices_strcC�.|jrd|rdndnd}d|�|��|��S�r�� or %s�`None`r�r��any of �r�r��r�r��nonerNrNrO�_infop
 944  �z
 945  Enum._infocC�|jdd�S�NF�r��rr�rNrNrOr
 946  u
 947  r�z	Enum.infocCr�NTr	r
 948  r�rNrNrO�info_rstx
 949  r�z
Enum.info_rstcCs*z|�d|�WStyt|�YSwrQ)rIr9rxr�rNrNrOr�{
 950  s
 951  �zEnum.from_stringcCr\rQrNr�rNrNrOr��
 952  r^zEnum.subclass_initcKsdd�|jD�S)r�cSr`rN)r~)r
r4rNrNrOrb�
 953  rcz%Enum.argcompleter.<locals>.<listcomp>)rvr�rNrNrOr��
 954  szEnum.argcompleter�F)rKrLrMr�r>r�rIr�rr
 955  rr�r�r�r8rNrNr5rOr$Y
 956  s
 957  
 958  	r$csFeZdZdZef�fdd�	Zdd�Zd
dd�Zd	d
 959  �Zdd�Z	�Z
 960  S)rz4An enum of strings where the case should be ignored.cst�j|fd|i|��dS�Nr�r�r�r5rNrOr��
 961  szCaselessStrEnum.__init__cCsJt|t�s|�||�|jD]}|��|��kr|Sq|�||�dSrQ)ryr~rrvr�)r�r�r�r4rNrNrOrI�
 962  s
 963  
 964  �zCaselessStrEnum.validateFcCs0|jrd|rdndnd}d|�|��d|��S)r�r�rr�r�rz (case-insensitive)rrrNrNrOr�
 965  szCaselessStrEnum._infocCrrr
 966  r�rNrNrOr
 967  �
 968  r�zCaselessStrEnum.infocCrrr
 969  r�rNrNrOr�
 970  r�zCaselessStrEnum.info_rstr
)rKrLrMr�r>r�rIrr
 971  rr8rNrNr5rOr�
 972  s
 973  	rcsReZdZdZdZdZeddf�fdd�	Zdd�Zd
dd�Z	d	d
 974  �Z
 975  dd�Z�ZS)r*zEAn case-ignoring enum matching choices by unique prefixes/substrings.Fcs(||_||_t�j|fd|i|��dSr)�case_sensitive�substring_matchingr.r�)r�rvr�rrr�r5rNrOr��
 976  szFuzzyEnum.__init__cs�t�t�s|�|��|jrdd�ndd��|j}|rdd�ndd������|j}���fdd�|D�}t|�dkrKt||�D]
 977  \}}|rJ|Sq@|�|��dS)	NcSr�rQrN�rFrNrNrOr��
 978  r�z$FuzzyEnum.validate.<locals>.<lambda>cSrPrQ)r�rrNrNrOr��
 979  �cSs||vSrQrN�r4rFrNrNrOr��
 980  rcSs
 981  |�|�SrQ)�
 982  startswithrrNrNrOr��
 983  �
 984  csg|]	}���|���qSrNrN)r
rF�Z	conv_func�
 985  match_funcr�rNrOrb�
 986  sz&FuzzyEnum.validate.<locals>.<listcomp>r)ryr~rrrrv�sum�zip)r�r�r�rr��matchesr4�mrNrrOrI�
 987  s"
 988  
 989  ���zFuzzyEnum.validatecCsV|jrd|rdndnd}|jrdnd}|jrdnd}d	|�d
 990  |�d|�|��|��S)r�r�rr�r��	sensitive�insensitive�	substring�prefixz	any case-� r)r�rrr�)r�r�r�case�substrrNrNrOr�
 991  s zFuzzyEnum._infocCrrr
 992  r�rNrNrOr
 993  �
 994  r�zFuzzyEnum.infocCrrr
 995  r�rNrNrOr�
 996  r�zFuzzyEnum.info_rstr
)
rKrLrMr�rrr>r�rIrr
 997  rr8rNrNr5rOr*�
 998  s�
 999  r*cs�eZdZUdZdZejejeej	ej
1000  fed<dZej
1001  ed<e
ZdZdZej
1002  ed<def�fdd	�	Z�fd
1003  d�Zdd
�Z�fdd�Zdd�Zdd�Zdd�Zddd�Z�ZS)r z\An instance of a container (list, set, etc.)
1004  
1005      To be subclassed by overriding klass.
1006      Nr�rN�_cast_types)�[]�()�_literal_from_string_pairscs|dur|turt|�s|}d}|dur)|�dd�s)td|jj�d�tdd�t}|tur0d}n!|dur;d}d|d	<nt||j�rE|f}nt	d
1007  |jj�d|����t|�rmt|t
1008  �ratdtd
d�t|t
1009  �ri|�n||_n|duryt	dt|���t
�jd|j|d�|��dS)a�Create a container trait type from a list, set, or tuple.
1010  
1011          The default value is created by doing ``List(default_value)``,
1012          which creates a copy of the ``default_value``.
1013  
1014          ``trait`` can be specified, which restricts the type of elements
1015          in the container to that TraitType.
1016  
1017          If only one arg is given and it is not a Trait, it is taken as
1018          ``default_value``:
1019  
1020          ``c = List([1, 2, 3])``
1021  
1022          Parameters
1023          ----------
1024          trait : TraitType [ optional ]
1025              the type for restricting the contents of the Container.  If unspecified,
1026              types are not checked.
1027          default_value : SequenceType [ optional ]
1028              The default value for the Trait.  Must be list/tuple/set, and
1029              will be cast to the container type.
1030          allow_none : bool [ default False ]
1031              Whether to allow the value to be None
1032          **kwargs : any
1033              further keys for extensions to the Trait (e.g. config)
1034  
1035          Nr�F�Specifying �a(default_value=None) for no default is deprecated in traitlets 5.0.5. Use default_value=Undefinedr�r�rNr��default value of � was r+r(z'`trait` must be a Trait or None, got %s�r�r)r>r}rZrrrKrlry�_valid_defaultsrkrz�_traitr
1036  r.r�r�)r�r�r�r�rr5rNrOr��
1037  s:�
1038  
1039  �zContainer.__init__csNt||j�r|jdus
J�|�|�}t��||�}|dur|S|�||�}|SrQ)ryr#r�r.rI�validate_elementsr�r5rNrOrI.s
1040  zContainer.validatecCs�g}|jdus
t|jt�r|S|D]*}z	|j�||�}Wnty5}z
|�|||�WYd}~qd}~ww|�|�q|jdusCJ�|�|�SrQ)r-ryrr�r9rr�r�)r�r�r��	validatedr4rrNrNrOr.:s��
1041  zContainer.validate_elementscs,t|jt�r
|j�|d�t��||�dSrQ)ryr-r:r�r.r�r5rNrOr�HszContainer.class_initcCs t|jt�r|j�|�dSdSrQ)ryr-r:r�r�rNrNrOr�Ms�zContainer.subclass_initcCsHt|t�std|����zt|�}Wntyd}Ynw|�d|�S)�Load value from a single stringzExpected string, got N)ryr~r9rr�rI�r�rUr�rNrNrOr�Ss
1042  �zContainer.from_stringcs��jdusJ�t|�dkrR|d��dkr�jrdSt��dkrRt�fdd��jD��rR�jr6�jjd}nd	}�jdus?J�td
1043  �	|�j��t
1044  ���t���St�
�j�}d|jvra�j�nd�fdd
�	����fdd�t|�D��S)ziReturn the value from a list of config strings
1045  
1046          This is where we parse CLI configuration
1047          Nrrr�r�c3s(�|]\}}��|�o��|�VqdSrQ)r�endswith)r
�start�end)�rrNrOrhs
1048  ��
1049  �z-Container.from_string_list.<locals>.<genexpr>rbr�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?cs
1050  ��|�SrQ��item_from_string)rUr?r�rNrOr�~rz,Container.from_string_list.<locals>.<lambda>csg|]
1051  \}}�||d��qS))r?rN)r
�idxrUr6rNrOrb�sz.Container.from_string_list.<locals>.<listcomp>rQ)r�r�r��anyr&r�rKr�rrcr�rrd�	signaturer7�
1052  parameters�	enumerate)r��s_listrJ�sigrN)r7r5r�rO�from_string_list]s6�
1053  ��
1054  �zContainer.from_string_listcCs|jr	|j�|�S|S�ziCast a single item from a string
1055  
1056          Evaluated when parsing CLI configuration from a string
1057          )r-r��r�rUr?rNrNrOr7�szContainer.item_from_stringrQ)rKrLrMr�r�r|r�r?r~r<rr�r#�
SequenceTypesr,r-r&r>r�rIr.r�r�r�r?r7r8rNrNr5rOr �
1058  s
1059  $H
1060  'r csbeZdZUdZeZefZej	e
1061  d<dedej
f�fdd�	Zdd�Z�fd	d
1062  �Z�fdd�Z�ZS)
r0zAn instance of a Python list.r#Nrcs(||_||_t�jd||d�|��dS)a�Create a List trait type from a list, set, or tuple.
1063  
1064          The default value is created by doing ``list(default_value)``,
1065          which creates a copy of the ``default_value``.
1066  
1067          ``trait`` can be specified, which restricts the type of elements
1068          in the container to that TraitType.
1069  
1070          If only one arg is given and it is not a Trait, it is taken as
1071          ``default_value``:
1072  
1073          ``c = List([1, 2, 3])``
1074  
1075          Parameters
1076          ----------
1077          trait : TraitType [ optional ]
1078              the type for restricting the contents of the Container.
1079              If unspecified, types are not checked.
1080          default_value : SequenceType [ optional ]
1081              The default value for the Trait.  Must be list/tuple/set, and
1082              will be cast to the container type.
1083          minlen : Int [ default 0 ]
1084              The minimum length of the input list
1085          maxlen : Int [ default sys.maxsize ]
1086              The maximum length of the input list
1087          )r�r�NrN)�_minlen�_maxlenr.r��r�r�r��minlen�maxlenr�r5rNrOr��s"z
List.__init__cCs$d|jt|�|j|j|f}t|��)Nz_The '%s' trait of %s instance must be of length %i <= L <= %i, but a value of %s was specified.)r�rrCrDr9r�rNrNrO�length_error�s
1088  ��zList.length_errorcs6t|�}||jks||jkr|�||�t��||�SrQ)r�rCrDrHr.r.)r�r�r��lengthr5rNrOr.�szList.validate_elementscs(t|t�r
t��||g�St��||�SrQ)ryr~r.r�r�r5rNrOr��s
1089  zList.set)rKrLrMr�rtr�r�r#r|rr�r>�sys�maxsizer�rHr.r�r8rNrNr5rOr0�s
1090  �&r0csDeZdZdZeZeefZdZ	de
1091  dejf�fdd�	Z
dd�Z�ZS)	r6zAn instance of a Python set.)r$r%z{}Nrcst�j||||fi|��dS)a�Create a Set trait type from a list, set, or tuple.
1092  
1093          The default value is created by doing ``set(default_value)``,
1094          which creates a copy of the ``default_value``.
1095  
1096          ``trait`` can be specified, which restricts the type of elements
1097          in the container to that TraitType.
1098  
1099          If only one arg is given and it is not a Trait, it is taken as
1100          ``default_value``:
1101  
1102          ``c = Set({1, 2, 3})``
1103  
1104          Parameters
1105          ----------
1106          trait : TraitType [ optional ]
1107              the type for restricting the contents of the Container.
1108              If unspecified, types are not checked.
1109          default_value : SequenceType [ optional ]
1110              The default value for the Trait.  Must be list/tuple/set, and
1111              will be cast to the container type.
1112          minlen : Int [ default 0 ]
1113              The minimum length of the input list
1114          maxlen : Int [ default sys.maxsize ]
1115              The maximum length of the input list
1116          Nr�rEr5rNrOr��s"zSet.__init__cCs0tt|����}|dkrdSd|dd�dS)Nr$zset()�{rr �})rr�r�)r�Z	list_reprrNrNrOr�szSet.default_value_repr)rKrLrMr�r�r�r�rtr#r&r>rJrKr�rr8rNrNr5rOr6�s�$r6csNeZdZdZeZefZ�fdd�Zdd�Z	dd�Z
1117  �fdd	�Zd
1118  d�Z�Z
S)r;zAn instance of a Python tuple.cs0|�dt�}t|�dkr|turt|d�s|d}d}|dur5|�dd�s5td|jj�d	�td
1119  d�t}|tur<d}n!|durGd}d|d<nt	||j
1120  �rQ|f}ntd|jj�d
|����g|_|D]}t	|t
�rstdtd
1121  d�|�}|j�|�qb|jr�|dus�|tur�d}tt|�jd|j|d�|��dS)aGCreate a tuple from a list, set, or tuple.
1122  
1123          Create a fixed-type tuple with Traits:
1124  
1125          ``t = Tuple(Int(), Str(), CStr())``
1126  
1127          would be length 3, with Int,Str,CStr for each element.
1128  
1129          If only one arg is given and it is not a Trait, it is taken as
1130          default_value:
1131  
1132          ``t = Tuple((1, 2, 3))``
1133  
1134          Otherwise, ``default_value`` *must* be specified by keyword.
1135  
1136          Parameters
1137          ----------
1138          *traits : TraitTypes [ optional ]
1139              the types for restricting the contents of the Tuple.  If unspecified,
1140              types are not checked. If specified, then each positional argument
1141              corresponds to an element of the tuple.  Tuples defined with traits
1142              are of fixed length.
1143          default_value : SequenceType [ optional ]
1144              The default value for the Tuple.  Must be list/tuple/set, and
1145              will be cast to a tuple. If ``traits`` are specified,
1146              ``default_value`` must conform to the shape and type they specify.
1147          **kwargs
1148              Other kwargs passed to `Container`
1149          r�rrrNNr�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+)rur>r�r}rZrrrKrlryr,rkr<rzr�r.r r�r�)r�r�r�r�rr�r5rNrOr�s@ �
1150  
1151  �"zTuple.__init__cCs(|jr
1152  |t|j�kr|S|j|�|�Sr@)r<r�r�rArNrNrOr7XszTuple.item_from_stringcCs�|js|St|�t|j�kr"d|jt|�t|j�t|�f}t|��g}t|j|�D]+\}}z|�||�}WntyO}z
|�|||�WYd}~q*d}~ww|�	|�q*t
1153  |�S)NzTThe '%s' trait of %s instance requires %i elements, but a value of %s was specified.)r<r�r�rr
1154  r9rr�rr�r�)r�r�r�rsr/r�r4rrNrNrOr.cs$����zTuple.validate_elementscs8|jD]
}t|t�r|�|d�qtt|��||�dSrQ)r<ryr:r�r.r �r�rnr�r�r5rNrOr�xs
1155  
1156  
1157  �zTuple.class_initcCs$|jD]}t|t�r|�|�qdSrQ)r<ryr:r��r�rnr�rNrNrOr�~s
1158  
1159  
1160  
1161  ��zTuple.subclass_init)rKrLrMr�r�r�rtr#r�r7r.r�r�r8rNrNr5rOr;sMr;cs|eZdZdZdZdZdddef�fdd�	Zddd�Z�fdd	�Z	d
1162  d�Z
1163  �fdd
�Zdd�Zdd�Z
dd�Zdd�Z�ZS)r"a�An instance of a Python dict.
1164  
1165      One or more traits can be passed to the constructor
1166      to validate the keys and/or values of the dict.
1167      If you need more detailed validation,
1168      you may use a custom validator method.
1169  
1170      .. versionchanged:: 5.0
1171          Added key_trait for validating dict keys.
1172  
1173      .. versionchanged:: 5.0
1174          Deprecated ambiguous ``trait``, ``traits`` args in favor of ``value_trait``, ``per_key_traits``.
1175      Nc	s�|�dd�}|dur|durtd��|}tdtdd�|�dd�}|dur6|dur-td��|}td	tdd�|turF|durFt|�sF|}d}|durV|durVt|�rV|}d}|tur\i}|durcd}nt|t�rl|f}nt|t�ru|f}ntd
1176  |��t|�r�t|t	�r�tdtdd�|�}||_
1177  n|dur�tdt|���t|�r�t|t	�r�tdtdd�|�}||_n|dur�td
t|���||_
t�jdt|d�|��dS)aCreate a dict trait type from a Python dict.
1178  
1179          The default value is created by doing ``dict(default_value)``,
1180          which creates a copy of the ``default_value``.
1181  
1182          Parameters
1183          ----------
1184          value_trait : TraitType [ optional ]
1185              The specified trait type to check and use to restrict the values of
1186              the dict. If unspecified, values are not checked.
1187          per_key_traits : Dictionary of {keys:trait types} [ optional, keyword-only ]
1188              A Python dictionary containing the types that are valid for
1189              restricting the values of the dict on a per-key basis.
1190              Each value in this dict should be a Trait for validating
1191          key_trait : TraitType [ optional, keyword-only ]
1192              The type for restricting the keys of the dict. If
1193              unspecified, the types of the keys are not checked.
1194          default_value : SequenceType [ optional, keyword-only ]
1195              The default value for the Dict.  Must be dict, tuple, or None, and
1196              will be cast to a dict if not None. If any key or value traits are specified,
1197              the `default_value` must conform to the constraints.
1198  
1199          Examples
1200          --------
1201          a dict whose values must be text
1202          >>> d = Dict(Unicode())
1203  
1204          d2['n'] must be an integer
1205          d2['s'] must be text
1206          >>> d2 = Dict(per_key_traits={"n": Integer(), "s": Unicode()})
1207  
1208          d3's keys must be text
1209          d3's values must be integers
1210          >>> d3 = Dict(value_trait=Integer(), key_trait=Unicode())
1211  
1212          r�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` insteadzdefault value of Dict was %srNz-`value_trait` must be a Trait or None, got %sz+`key_trait` must be a Trait or None, got %sr+rN)rurkrrlr>r}ryrIrBrz�_value_traitr
12131214  _key_trait�_per_key_traitsr.r�)	r��value_traitZper_key_traits�	key_traitr�r�r�r�rr5rNrOr��s�.����
1215  
1216  
1217  �
1218  �
1219  �z
Dict.__init__�ValuescCs*|d|jt|�|��t|�f}t|��)NzN of the '%s' trait of %s instance must be %s, but a value of %s was specified.)r�rr
1220  r
1221  r9)r�r��element�	validator�sidersrNrNrO�
element_error
s���zDict.element_errorcs*t��||�}|dur
|S|�||�}|SrQ)r.rIr.r�r5rNrOrI
s
1222  z
Dict.validatec
1223  
1224  Cs�|jpi}|j}|j}|s|s|s|Si}|D]H}||}|r9z|�||�}Wnty8|�|||d�Ynw|�||�}	|	r[z|	�||�}WntyZ|�|||	d�Ynw|||<q|�|�S)N�KeysrV)rSrRrQr�r9rZrZr�)
1225  r�r�r�Zper_key_overriderUrTr/r]r4Zactive_value_traitrNrNrOr.&
s.
1226  ��
1227  
1228  zDict.validate_elementscslt|jt�r
|j�|d�t|jt�r|j�|d�|jdur-|j��D]}|�|d�q$t��||�dSrQ)ryrQr:r�rRrSrvr.rOr5rNrOr�?
s
1229  zDict.class_initcCs\t|jt�r|j�|�t|jt�r|j�|�|jdur*|j��D]	}|�|�q"dSdSrQ)ryrQr:r�rRrSrvrPrNrNrOr�I
s
1230  �zDict.subclass_initcCs`t|t�stdt|��dt|�����z|�|g�WSty/t|�}t|t�r.|YS�w)r0z"from_string expects a string, got z	 of type )	ryr~rkrrzr?r�rxrIr1rNrNrOr�T
s
1231  
1232  �zDict.from_stringcs�t|�dkr|ddkr�jrdSt|�dkr7|d�d�r7|d�d�r7td��j|d�t�t|d�Si}�fdd	�|D�D]}|�	|�qB|S)
1233  z�Return a dict from a list of config strings.
1234  
1235          This is where we parse CLI configuration.
1236  
1237          Each item should have the form ``"key=value"``.
1238  
1239          item parsing is done in :meth:`.item_from_string`.
1240          rrr�NrLrMz�--{0}={1} for dict-traits is deprecated in traitlets 5.0. You can pass --{0} <key=value> ... multiple times to add items to a dict.csg|]}��|��qSrNr6)r
rUr�rNrOrbx
sz)Dict.from_string_list.<locals>.<listcomp>)
1241  r�r�rr2rrcr�r�rr�)r�r=�combinedrkrNr�rOr?`
s 	(��	zDict.from_string_listcCsld|vrtd|jjt|�f��|�dd�\}}|jr!|j�|�}|jp%i�||j	�}|r2|�|�}||iS)aCast a single-key dict from a string.
1242  
1243          Evaluated when parsing CLI configuration from a string.
1244  
1245          Dicts expect strings of the form key=value.
1246  
1247          Returns a one-key dictionary,
1248          which will be merged in :meth:`.from_string_list`.
1249          rdz3'%s' options must have the form 'key=value', got %sr)
1250  r9rrKrrgrRr�rSrZrQ)r�rUr]r�rTrNrNrOr7|
s���
1251  zDict.item_from_string)rV)rKrLrMr�rQrRr>r�rZrIr.r�r�r�r?r7r8rNrNr5rOr"�s"�
1252  
1253  r"c@s(eZdZdZdZdZdd�Zdd�ZdS)	r7zgA trait for an (ip, port) tuple.
1254  
1255      This allows for both IPv4 IP addresses as well as hostnames.
1256      )z	127.0.0.1rzan (ip, port) tuplecCs^t|t�r't|�dkr't|dt�r't|dt�r'|d}|dkr'|dkr'|S|�||�dS)Nr�rri��)ryr�r�r~rBr)r�r�r��portrNrNrOrI�
s
1257  zTCPAddress.validatecCsF|jr	|dkr	dSd|vrtd|��|�dd�\}}t|�}||fS)Nr��:zRequire `ip:port`, got %rr)r�rwrgrB)r�rU�ipr]rNrNrOr��
szTCPAddress.from_stringN)rKrLrMr�r�r	rIr�rNrNrNrOr7�
s	r7c@�eZdZdZdZdd�ZdS)rz�A casting compiled regular expression trait.
1258  
1259      Accepts both strings and compiled regular expressions. The resulting
1260      attribute will be a compiled regular expression.za regular expressioncCs.zt�|�WSty|�||�YdSwrQ)�re�compiler�rr�rNrNrOrI�
s
1261  �zCRegExp.validateN�rKrLrMr�r	rIrNrNrNrOr�
srcs�eZdZUdZdZejeje	d<dZ
1262  d�fdd�	Zefdd�Z
efd	d
1263  �Zdd�Zddd�Zddd�Zdd�Zdd�Z�ZS)r@a�Use a Enum class as model for the data type description.
1264      Note that if no default-value is provided, the first enum-value is used
1265      as default-value.
1266  
1267      .. sourcecode:: python
1268  
1269          # -- SINCE: Python 3.4 (or install backport: pip install enum34)
1270          import enum
1271          from traitlets import HasTraits, UseEnum
1272  
1273          class Color(enum.Enum):
1274              red = 1         # -- IMPLICIT: default_value
1275              blue = 2
1276              green = 3
1277  
1278          class MyEntity(HasTraits):
1279              color = UseEnum(Color, default_value=Color.blue)
1280  
1281          entity = MyEntity(color=Color.red)
1282          entity.color = Color.green    # USE: Enum-value (preferred)
1283          entity.color = "green"        # USE: name (as string)
1284          entity.color = "Color.green"  # USE: scoped-name (as string)
1285          entity.color = 3              # USE: number (as int)
1286          assert entity.color is Color.green
1287      Nr�z"Trait type adapter to a Enum classcsnt|tj�sJd|��|�dd�}|dur!|s!t|j���d}t�jdd|i|��||_	|j
1288  d|_dS)NzREQUIRE: enum.Enum, but was: %rr�Frr�rbrN)r{�enumr$rZrt�__members__rvr.r��
1289  enum_classrK�name_prefix)r�rfr�r�r�r5rNrOr��
szUseEnum.__init__cCs:t|t�sJ�|jj}|��D]}|j|kr|Sq|S)z0Selects enum-value by using its number-constant.)ryrBrfrervr�)r�r�rB�enum_membersZ	enum_itemrNrNrO�select_by_number�
s
1290  �zUseEnum.select_by_numbercCs:t|t�sJ�|�|j�r|�|jdd�}|jj�||�S)z4Selects enum-value by using its name or scoped-name.r�r)ryr~rrg�replacerfrerZ)r�r�rBrNrNrO�select_by_name�
szUseEnum.select_by_namecCs|t||j�r|St|t�r|�|�}|tur|Snt|t�r*|�|�}|tur)|Sn|dur6|jr3dS|jS|�	||�dSrQ)
1291  ryrfrBrir>r~rkr�r�r)r�r�r��value2rNrNrOrIs"
1292  
1293  �
1294  
1295  �zUseEnum.validateFcCs0|jj��}|rd�dd�|D��Stt|��S)r�r�csr�r�rNr�rNrNrOrr�z'UseEnum._choices_str.<locals>.<genexpr>)rfrerrrrtr�rNrNrOr�szUseEnum._choices_strcCr�r�rrrNrNrOrrz
UseEnum._infocCrrr
1296  r�rNrNrOr
1297  !r�zUseEnum.infocCrrr
1298  r�rNrNrOr$r�zUseEnum.info_rstrQr
)rKrLrMr�r�r|r�rdr$r�r	r�r>rirkrIr�rr
1299  rr8rNrNr5rOr@�
s
1300  	
1301  
1302  
1303  r@c@r`)rzxA trait which is callable.
1304  
1305      Notes
1306      -----
1307      Classes are callable, as are instances
1308      with a __call__() method.z
1309  a callablecCst|�r|S|�||�dSrQ)r�rr�rNrNrOrI2szCallable.validateNrcrNrNrNrOr(srrQ)pr�r�rdrdrXrarJr#�typingr|�astr�warningsrr�utils.bunchrZutils.descriptionsrrr	r
1310  Zutils.getargspecr�utils.importstringr
�utils.sentinelrrtr�r��	frozensetrBrz�
1311  ClassTypes�__all__r>r�NoDefaultSpecifiedr�r9rb�_name_rerSr[r^rtrxr}rHr�r�r�rErCrDrr:rr*r2r3r?r~rFrGrIrBr%r5rAr!r+r,rr<r-r(r)r'r8rr�r.rr1rr/r&rrrrrr=rr4r#rrr$rr*r r0r6r;r"r7rr@rrNrNrNrO�<module>s�)E��
1312  
1313  

1314  QC;}$1&X$!)		%'
`aY
1315  
 
1316  &
1317  &
1318  066A5a