Ë
    ý�pj›W  ã                  ó¼  — d Z ddlmZ ddlZddlZddlmZ ddlm	Z	 ddl
mZmZmZmZmZmZmZmZmZmZ ddlmZ ddlmZ dd	lmZmZ d
dlmZmZmZm Z  ejB                  rddl"m#Z# ejB                  r'ejH                  ejJ                  ej                     z  Z&nej                  Z& G d„ de'«      Z( G d„ de(«      Z) G d„ de«      Z* G d„ de*«      Z+ G d„ de+«      Z,y)z/A base class for objects that are configurable.é    )ÚannotationsN)Údeepcopy)Údedent)
ÚAnyÚ	ContainerÚDictÚ	HasTraitsÚInstanceÚ	TraitTypeÚdefaultÚobserveÚobserve_compatÚvalidate)Úwarnings)ÚBunch)ÚindentÚwrap_paragraphsé   )ÚConfigÚDeferredConfigÚLazyConfigValueÚ_is_section_key)ÚSelfc                  ó   — e Zd Zy)ÚConfigurableErrorN©Ú__name__Ú
__module__Ú__qualname__© ó    ún/workspace/moltex-experiments/.pixi/envs/default/lib/python3.12/site-packages/traitlets/config/configurable.pyr   r   +   ó   „ Ør!   r   c                  ó   — e Zd Zy)ÚMultipleInstanceErrorNr   r    r!   r"   r%   r%   /   r#   r!   r%   c                  ó@  ‡ — e Zd Z eedi «      Z edd¬«      Zdˆ fd„Zedd„«       Z	dd„Z
	 	 d	 	 	 	 	 	 	 dd„Z ed	«      edd
„«       «       Zdd„Zeddd„«       Ze	 	 d	 	 	 	 	 	 	 dd„«       Zeddd„«       Ze	 	 	 	 	 	 dd„«       Zeddd„«       Zedd„«       Zˆ xZS ) ÚConfigurabler    z*traitlets.config.configurable.ConfigurableT)Ú
allow_nonec                ó   •‡‡— ‰j                  dd«      }|�'‰j                  d«      €|j                  ‰d<   || _        ‰j                  dd«      }t	        ‰| �  di ‰¤Ž t        «       Šdˆˆfd„}| j                  |«       |�|| _        n| j                  | j                  «       | j                  |«       ‰D ]  }t        | |‰|   «       Œ y)a„  Create a configurable given a config config.

        Parameters
        ----------
        config : Config
            If this is empty, default values are used. If config is a
            :class:`Config` instance, it will be used to configure the
            instance.
        parent : Configurable instance, optional
            The parent Configurable instance of this object.

        Notes
        -----
        Subclasses of Configurable must call the :meth:`__init__` method of
        :class:`Configurable` *before* doing anything else and using
        :func:`super`::

            class MyConfigurable(Configurable):
                def __init__(self, config=None):
                    super(MyConfigurable, self).__init__(config=config)
                    # Then any other code you need to finish initialization.

        This ensures that instances will be configured properly.
        ÚparentNÚconfigc                óZ   •— | j                   ‰v r‰j                  | j                   «       yy)z‚Record traits set by both config and kwargs.

            They will need to be overridden again after loading config.
            N)ÚnameÚadd)ÚchangeÚconfig_override_namesÚkwargss    €€r"   Únotice_config_overridez5Configurable.__init__.<locals>.notice_config_overrided   s(   ø€ ð
 �{‰{˜fÑ$Ø%×)Ñ)¨&¯+©+Õ6ð %r!   r    ©r/   r   ÚreturnÚNone)ÚpopÚgetr+   r*   ÚsuperÚ__init__Úsetr   Ú_load_configÚ	unobserveÚsetattr)Úselfr1   r*   r+   r2   r-   r0   Ú	__class__s    `    @€r"   r9   zConfigurable.__init__<   sË   ú€ ð2 —‘˜H dÓ+ˆØÐà�z‰z˜(Ó#Ð+Ø#)§=¡=��xÑ Ø ˆDŒKà—‘˜H dÓ+ˆô 	‰ÑÑ"˜6Ò"ô !$£Ðö	7ð 	�‰Ð+Ô,ð Ðð !ˆD�Kð ×Ñ˜dŸk™kÔ*Ø�‰Ð-Ô.ã)ˆDÜ�D˜$  t¡Õ-ñ *r!   c                óž   — t        | j                  «      D �cg c]*  }t        |t        «      rt        | |«      r|j                  ‘Œ, c}S c c}w )zreturn section names as a list)ÚreversedÚ__mro__Ú
issubclassr'   r   )ÚclsÚcs     r"   Úsection_nameszConfigurable.section_names„   sI   € ô
 ˜cŸk™kÔ*ó
á*�Ü˜!œ\Ô*¬z¸#¸qÔ/Að �J‹JØ*ñ
ð 	
ùò 
s   ˜/A
c                ó  — |g}| j                   r*|j                  | j                   j                  |«      «       t        «       }|D ]=  }| j	                  «       D ](  }|j                  |«      sŒ|j                  ||   «       Œ* Œ? |S )aÃ  extract my config from a global Config object

        will construct a Config object of only the config values that apply to me
        based on my mro(), as well as those of my parent(s) if they exist.

        If I am Bar and my parent is Foo, and their parent is Tim,
        this will return merge following config sections, in this order::

            [Bar, Foo.Bar, Tim.Foo.Bar]

        With the last item being the highest priority.
        )r*   ÚappendÚ_find_my_configr   rF   Ú_has_sectionÚmerge)r>   ÚcfgÚcfgsÚ	my_configrE   Úsnames         r"   rI   zConfigurable._find_my_config�   sw   € ð ˆuˆØ�;Š;Ø�K‰K˜Ÿ™×3Ñ3°CÓ8Ô9Ü“Hˆ	ÛˆAØ×+Ñ+Ö-�ð —>‘> %Õ(Ø—O‘O A e¡HÕ-ñ	 .ð ð Ðr!   c           
     óŒ  — |€| j                  d¬«      }|€| j                  «       }| j                  |«      }| j                  «       5  |j	                  «       D �]S  \  }}||v rit        |t        «      rt        | |«      }|j                  |«      }n$t        |t        «      r|j                  ||   «      }t        | |t        |«      «       Œtt        |«      rŒ€t        |t        «      rŒ‘ddlm} t        | t         «      r%| j"                  €J ‚| j"                  j$                  }	ndd„}	 |||«      }
d|› d| j&                  j(                  › d	�}t+        |
«      d
k(  r|d|
d   › d�z  }n;t+        |
«      d
k\  r-|dj-                  dj/                  t1        |
«      «      ¬«      z  } |	|«       �ŒV 	 ddd«       y# 1 sw Y   yxY w)z load traits from a Config objectNT©r+   r   )Úget_close_matchesc                ó:   — t        j                  | t        d¬«      S )Né	   ©Ú
stacklevel)r   ÚwarnÚUserWarning)Úmsgs    r"   rW   z'Configurable._load_config.<locals>.warnÍ   s   € Ü#+§=¡=°´kÈaÔ#PÐPr!   zConfig option `z` not recognized by `z`.r   z  Did you mean `z`?z#  Did you mean one of: `{matches}`?ú, )Úmatches)rY   út.Anyr4   r5   )ÚtraitsrF   rI   Úhold_trait_notificationsÚitemsÚ
isinstancer   ÚgetattrÚ	get_valuer   r=   r   r   r   ÚdifflibrR   ÚLoggingConfigurableÚlogÚwarningr?   r   ÚlenÚformatÚjoinÚsorted)r>   rL   rF   r]   rN   r-   Úconfig_valueÚinitialrR   rW   r[   rY   s               r"   r;   zConfigurable._load_config¦   s©  € ð ˆ>Ø—[‘[¨�[Ó-ˆFØÐ Ø ×.Ñ.Ó0ˆMà×(Ñ(¨Ó-ˆ	ð ×*Ñ*Õ,Ø&/§o¡o×&7Ñ"��lØ˜6‘>Ü! ,´Ô@ô #*¨$°Ó"5˜Ø'3×'=Ñ'=¸gÓ'F™Ü# L´.ÔAà'3×'=Ñ'=¸fÀT¹lÓ'K˜ô ˜D $¬°Ó(>Õ?Ü(¨Õ.´zÀ,ÔPVÕ7WÝ9ä! $Ô(;Ô<Ø#Ÿx™xÐ3Ð3Ð3Ø#Ÿx™x×/Ñ/™óQñ 0°°fÓ=�GØ+¨D¨6Ð1FÀtÇ~Á~×G^ÑG^ÐF_Ð_aÐb�Cä˜7“| qÒ(ØÐ!1°'¸!±*°¸RÐ@Ñ@™Ü˜W›¨Ò*ØÐD×KÑKØ$(§I¡I¬f°W«oÓ$>ð  Ló  ñ ˜ñ ˜–IñE '8÷ -×,Ñ,ús   ÁBF:ÃF:Ã*CF:Æ:Gr+   c                ó„   — | j                  d¬«      }| j                  «       }| j                  |j                  ||¬«       y)zòUpdate all the class traits having ``config=True`` in metadata.

        For any class trait with a ``config`` metadata attribute that is
        ``True``, we update the trait with the value of the corresponding
        config entry.
        TrQ   )r]   rF   N)r]   rF   r;   Únew)r>   r/   r]   rF   s       r"   Ú_config_changedzConfigurable._config_changedÛ   s=   € ð —‘ D�Ó)ˆð
 ×*Ñ*Ó,ˆØ×Ñ˜&Ÿ*™*¨VÀ=ÐÕQr!   c                ó�   — t        | j                  «      | _        | j                  |«       | j                  j                  |«       y)z%Update config and load the new valuesN)r   r+   r;   rK   )r>   r+   s     r"   Úupdate_configzConfigurable.update_configí   s4   € ô ˜tŸ{™{Ó+ˆŒà×Ñ˜&Ô!à�‰×Ñ˜&Õ!r!   c                ó¶  — |�t        || «      sJ ‚g }dj                  d„ | j                  D «       «      }|j                  | j                  › d|› d�«       |j                  t        |d   «      dz  «       t        | j                  d¬«      j                  «       «      D ](  \  }}| j                  ||«      }|j                  |«       Œ* d	j                  |«      S )
z¢Get the help string for this class in ReST format.

        If `inst` is given, its current trait values will be used in place of
        class defaults.
        rZ   c              3  ó4   K  — | ]  }|j                   –— Œ y ­w©N)r   ©Ú.0Úps     r"   Ú	<genexpr>z.Configurable.class_get_help.<locals>.<genexpr>  s   è ø€ Ð C±]° §¥±]ùs   ‚Ú(z	) optionsr   Ú-TrQ   Ú
)
r`   ri   Ú	__bases__rH   r   rg   rj   Úclass_traitsr_   Úclass_get_trait_help)rD   ÚinstÚ
final_helpÚbase_classesÚ_ÚvÚhelps          r"   Úclass_get_helpzConfigurable.class_get_helpý   sÌ   € ð ˆ|œz¨$°Ô4Ð4Ð4Øˆ
Ø—y‘yÑ C°S·]²]Ó CÓCˆØ×Ñ˜SŸ\™\˜N¨!¨L¨>¸ÐCÔDØ×Ñœ#˜j¨™mÓ,¨sÑ2Ô3Ü˜3×+Ñ+°4Ð+Ó8×>Ñ>Ó@ÖA‰DˆAˆqØ×+Ñ+¨A¨tÓ4ˆDØ×Ñ˜dÕ#ð Bð �y‰y˜Ó$Ð$r!   c           
     ó  — |�t        || «      sJ ‚g }d| j                  › d|j                  › �}t        |t        t        f«      rn|j
                  j                  dd«      }t        |t        «      rd}n(d|j                  j                  j                  «       › d�}|dk(  r	|› d	|› d
�}n%|› d|› d
�}n|› d|j                  j                  › d�}|j                  |«       |€|j                  }|dk7  r5dj                  t        |d«      «      }|j                  t        |«      «       d|j                  j                  v r+|j                  t        d|j                  «       › �«      «       |�6|j                  t        dt        ||j                  xs d«      ›�«      «       nF	 |j!                  «       }|�3t%        |«      dkD  r|dd d
z   }|j                  t        d|› �«      «       dj                  |«      S # t"        $ r d}Y ŒSw xY w)a  Get the helptext string for a single trait.

        :param inst:
            If given, its current trait values will be used in place of
            the class default.
        :param helptext:
            If not given, uses the `help` attribute of the current trait.
        Nz--Ú.ÚmultiplicityrH   z<key-1>=<value-1>Ú<z-item-1>Ú=ú...Ú z=<Ú>Ú ú

éL   ÚEnumz	Choices: z	Current: é@   é=   z	Default: r{   )r`   r   r-   r   r   Úmetadatar7   r?   ÚlowerrH   r„   ri   r   r   Úinfora   Údefault_value_reprÚ	Exceptionrg   )	rD   Útraitr   ÚhelptextÚlinesÚheaderrˆ   Úsample_valueÚdvrs	            r"   r~   z!Configurable.class_get_trait_help  sï  € ð ˆ|œz¨$°Ô4Ð4Ð4ØˆØ�c—l‘l�^ 1 U§Z¡Z LÐ1ˆÜ�eœi¬Ð.Ô/Ø Ÿ>™>×-Ñ-¨n¸hÓGˆLÜ˜%¤Ô&Ø2‘à!" 5§?¡?×#;Ñ#;×#AÑ#AÓ#CÐ"DÀHÐM�Ø˜xÒ'Ø"˜8 1 \ N°#Ð6‘à"˜8 1 \ N°#Ð6‘à�x˜r %§/¡/×":Ñ":Ð!;¸1Ð=ˆFà�‰�VÔàÐØ—z‘zˆHØ�rŠ>Ø—{‘{¤?°8¸RÓ#@ÓAˆHØ�L‰Lœ Ó)Ô*à�U—_‘_×-Ñ-Ñ-à�L‰Lœ )¨E¯J©J«L¨>Ð :Ó;Ô<àÐØ�L‰Lœ )¬G°D¸%¿*¹*Ò:JÈÓ,KÐ+NÐ OÓPÕQðØ×.Ñ.Ó0�ð ˆÜ�s“8˜b’=Ø˜c˜r˜( UÑ*�CØ—‘œV i°¨uÐ$5Ó6Ô7à�y‰y˜ÓÐøô ò Ø’ðús   Æ$G: Ç:HÈHc                ó8   — t        | j                  |«      «       y)z4Get the help string for a single trait and print it.N)Úprintr…   )rD   r   s     r"   Úclass_print_helpzConfigurable.class_print_helpG  s   € ô 	ˆc× Ñ  Ó&Õ'r!   c                óÞ   — | }|j                   €J ‚| j                  «       D ]I  }t        |t        «      sŒ||v sŒ|j	                  d¬«      j                  |j                   d«      |u sŒH|}ŒK |S )a7  Get the class that defines a trait

        For reducing redundant help output in config files.
        Returns the current class if:
        - the trait is defined on this class, or
        - the class where it is defined would not be in the config file

        Parameters
        ----------
        trait : Trait
            The trait to look for
        classes : list
            The list of other classes to consider for redundancy.
            Will return `cls` even if it is not defined on `cls`
            if the defining class is not in `classes`.
        NTrQ   )r-   ÚmrorC   r'   Úclass_own_traitsr7   )rD   r™   ÚclassesÚdefining_clsr*   s        r"   Ú_defining_classzConfigurable._defining_classL  sp   € ð( ˆØ�z‰zÐ%Ð%Ð%Ø—g‘g–iˆFä˜6¤<Õ0Ø˜gÒ%Ø×+Ñ+°4Ð+Ó8×<Ñ<¸U¿Z¹ZÈÓNÐRWÒWà%‘ð  ð Ðr!   c           	     óN  — dd„}d}dj                  d„ | j                  D «       «      }d| j                  › d|› d�}|||g}| j                  «       j	                  d«      }|r|j
                  }|st        | d	d
«      }|r(|j                   ||«      «       |j                  d
«       t        | j                  d¬«      j                  «       «      D �]B  \  }}	|	j                  «       }
|r| j                  |	|«      }n| }|| u r{|	j                  r!|j                   ||	j                  «      «       dt        |	«      j                  v r"|j                  d|	j                  «       › �«       |j                  d|
› �«       na|	j                  r4|j                   ||	j                  j                  dd«      d   «      «       |j                  d|j                  › d|› �«       |j                  d| j                  › d|› d|
› �«       |j                  d
«       �ŒE dj                  |«      S )zãGet the config section for this class.

        Parameters
        ----------
        classes : list, optional
            The list of other classes in the config file.
            Used to reduce redundant information.
        c                ób   — dj                  t        | d«      «      } d| j                  dd«      z   S )z"return a commented, wrapped block.r�   éN   z## r{   z
#  )ri   r   Úreplace)Úss    r"   rE   z,Configurable.class_config_section.<locals>.cv  s-   € à—‘œO¨A¨rÓ2Ó3ˆAà˜1Ÿ9™9 T¨7Ó3Ñ3Ð3r!   zO#------------------------------------------------------------------------------rZ   c              3  óV   K  — | ]!  }t        |t        «      sŒ|j                  –— Œ# y ­wrt   )rC   r'   r   ru   s     r"   rx   z4Configurable.class_config_section.<locals>.<genexpr>~  s    è ø€ Ð"d±}°!Ì
ÐSTÔVbÕHc 1§:¥:±}ùs   ‚)˜)z# ry   z) configurationÚdescriptionÚ__doc__rŽ   TrQ   r‘   z#  Choices: z#  Default: r{   r   r   z#  See also: r‡   z# c.z = )r¬   Ústrr4   r°   )ri   r|   r   r}   r7   Údefault_valuera   rH   rj   r_   r—   r§   r„   Útyper–   Úsplit)rD   r¥   rE   ÚbreakerÚparent_classesr¬   r›   Údescr-   r™   Údefault_reprÚdefining_classs               r"   Úclass_config_sectionz!Configurable.class_config_sectionk  sæ  € ó	4ð !ˆØŸ™Ñ"d°s·}²}Ó"dÓdˆà�—‘�˜a Ð/¨Ð?ˆØ˜!˜WÐ%ˆà×ÑÓ!×%Ñ% mÓ4ˆÙØ×%Ñ%ˆDÙä˜3 	¨2Ó.ˆDÙØ�L‰L™˜4›Ô!Ø�L‰L˜Ôä! #×"2Ñ"2¸$Ð"2Ó"?×"EÑ"EÓ"G×H‰KˆD�%Ø ×3Ñ3Ó5ˆLáØ!$×!4Ñ!4°U¸GÓ!D‘à!$�Ø Ñ$à—:’:Ø—L‘L¡ 5§:¡:£Ô/ØœT %›[×1Ñ1Ñ1à—L‘L <°·
±
³¨~Ð!>Ô?Ø—‘˜|¨L¨>Ð:Õ;ð —:’:Ø—L‘L¡ 5§:¡:×#3Ñ#3°D¸!Ó#<¸QÑ#?Ó!@ÔAØ—‘˜}¨^×-DÑ-DÐ,EÀQÀtÀfÐMÔNà�L‰L˜4 §¡˜~¨Q¨t¨f°C¸°~ÐFÔGØ�L‰L˜Öð/ Ið0 �y‰y˜ÓÐr!   c                óö  — g }| j                   }t        | j                  d¬«      j                  «       «      D �]  \  }}|j                  j                   }|j
                  sŒ*|dz   |j
                  z   }d|v r|d|j                  «       z   z  }n|d|z   z  }|j                  |«       	 |j                  «       }|�Wt        |«      dkD  r|dd d	z   }|j                  d
d«      }|j                  t        d|› d�«      «       |j                  d«       |j                  xs d}|j                  t        t        |«      «      «       |j                  d«       �Œ  dj                  |«      S # t        $ r d}Y Œ¾w xY w)zwGenerate rST documentation for this class' config options.

        Excludes traits defined on parent classes.
        TrQ   r‡   r‘   z : Nr’   r“   r‹   z\nz\\nzDefault: ``z``rŽ   zNo descriptionr{   )r   rj   r}   r_   r?   r-   Úinfo_rstrH   r—   r˜   rg   r«   r   r„   r   ri   )	rD   r›   Ú	classnamer‚   r™   ÚttypeÚtermlinerž   r„   s	            r"   Úclass_config_rst_docz!Configurable.class_config_rst_doc§  sg  € ð ˆØ—L‘Lˆ	Ü˜s×/Ñ/°tÐ/Ó<×BÑBÓD×E‰HˆAˆuØ—O‘O×,Ñ,ˆEà—:’:ØØ  3‘¨¯©Ñ3ˆHð ˜‰à˜E E§N¡NÓ$4Ñ4Ñ4‘à˜E E™MÑ)�Ø�L‰L˜Ô"ðØ×.Ñ.Ó0�ð ˆÜ�s“8˜b’=Ø˜c˜r˜( UÑ*�Cà—k‘k %¨Ó1�Ø—‘œV k°#°°bÐ$9Ó:Ô;Ø—‘˜RÔ à—:‘:Ò1Ð!1ˆDØ�L‰Lœ¤ t£Ó-Ô.ð �L‰L˜ÖðA FðD �y‰y˜ÓÐøô! ò Ø’ðús   Â)E*Å*E8Å7E8)r1   r\   r4   r5   )r4   z	list[str])rL   r   r4   r\   )NN)rL   r   rF   zlist[str] | Noner]   z)dict[str, TraitType[t.Any, t.Any]] | Noner4   r5   r3   )r+   r   r4   r5   rt   )r   úHasTraits | Noner4   r°   )r™   úTraitType[t.Any, t.Any]r   rÀ   rš   z
str | Noner4   r°   )r   rÀ   r4   r5   )r™   rÁ   r¥   zt.Sequence[type[HasTraits]]r4   ztype[Configurable])r¥   z"t.Sequence[type[HasTraits]] | Noner4   r°   )r4   r°   )r   r   r   r
   r   r+   r*   r9   ÚclassmethodrF   rI   r;   r   r   ro   rq   r…   r~   r¡   r§   r¹   r¿   Ú__classcell__)r?   s   @r"   r'   r'   8   sZ  ø„ Ù�f˜b "Ó%€FÙÐBÈtÔT€FõB.ðP ò
ó ð
óð8 +/Ø<@ð	3àð3ð (ð3ð :ð	3ð
 
ó3ñj ˆXÓØòRó ó ðRó "ð  ó%ó ð%ð  ð "&Ø#ð	6 à&ð6 ð ð6 ð ð	6 ð
 
ò6 ó ð6 ðp ó(ó ð(ð ðØ+ðØ6Qðà	òó ðð< ó9 ó ð9 ðv ò) ó ô) r!   r'   c                  óh   — e Zd ZdZ edd¬«      Z ed«      d
d„«       Z ed«      dd„«       Z	dd„Z
y	)rd   z«A parent class for Configurables that log.

    Subclasses have a log trait, and the default behavior
    is to get the logger from the currently running Application.
    z Logger or LoggerAdapter instanceF)r„   r(   re   c                ó2  — t        |j                  t        j                  t        j                  f«      s@t        j                  | j                  j                  › d|j                  › d�t        d¬«       t        j                  t        |j                  «      S )Nz..log should be a Logger or LoggerAdapter, got r‡   é   rU   )r`   ÚvalueÚloggingÚLoggerÚLoggerAdapterr   rW   r?   r   rX   ÚtÚcastÚ
LoggerType)r>   Úproposals     r"   Ú_validate_logz!LoggingConfigurable._validate_logÝ  sn   € ä˜(Ÿ.™.¬7¯>©>¼7×;PÑ;PÐ*QÔRä�M‰MØ—>‘>×*Ñ*Ð+ð ,Ø Ÿ™Ð' qð*äØõ	ô �v‰v”j (§.¡.Ó1Ð1r!   c                óî   — t        | j                  t        «      rF| j                  €J ‚t        j                  t
        j                  | j                  j                  «      S ddlm} |j                  «       S )Nr   )re   )
r`   r*   rd   rË   rÌ   rÈ   rÉ   re   Ú	traitletsÚ
get_logger)r>   re   s     r"   Ú_log_defaultz LoggingConfigurable._log_defaulté  sN   € ä�d—k‘kÔ#6Ô7Ø—;‘;Ð*Ð*Ð*Ü—6‘6œ'Ÿ.™.¨$¯+©+¯/©/Ó:Ð:Ý!à�~‰~ÓÐr!   c                óâ   — | j                   syt        | j                   t        j                  «      r| j                   n| j                   j                  }t        |dd«      sy|j                  d   S )z»Return the default Handler

        Returns None if none can be found

        Deprecated, this now returns the first log handler which may or may
        not be the default one.
        NÚhandlersr   )re   r`   rÈ   rÉ   Úloggerra   rÕ   )r>   rÖ   s     r"   Ú_get_log_handlerz$LoggingConfigurable._get_log_handlerò  sU   € ð �xŠxØä" 4§8¡8¬W¯^©^Ô<ˆD�HŠHÀ$Ç(Á(Ç/Á/ð 	ô �v˜z¨4Ô0àØ�‰˜qÑ!Ð!r!   N)rÎ   r   r4   rÍ   )r4   rÍ   )r4   zlogging.Handler | None)r   r   r   r¯   r   re   r   rÏ   r   rÓ   r×   r    r!   r"   rd   rd   Ô  sI   „ ññ Ð5À%Ô
H€Cáˆeƒ_ò	2ó ð	2ñ ˆUƒ^ò ó ð ô"r!   rd   c                  ó\   — e Zd ZdZdZedd„«       Zedd„«       Zed	d„«       Zed
d„«       Z	y)ÚSingletonConfigurablezôA configurable that only allows one instance.

    This class is for classes that should only have one instance of itself
    or *any* subclass. To create and retrieve such a class use the
    :meth:`SingletonConfigurable.instance` method.
    Nc              #  óŽ   K  — | j                  «       D ].  }t        | |«      sŒt        |t        «      sŒ!|t        k7  sŒ+|–— Œ0 y­w)zfWalk the cls.mro() for parent classes that are also singletons

        For use in instance()
        N)r£   rC   rÙ   ©rD   Úsubclasss     r"   Ú	_walk_mrozSingletonConfigurable._walk_mro  s;   è ø€ ð Ÿ™ž	ˆHä˜3 Õ)Ü˜xÔ)>Õ?ØÔ 5Ó5à“ñ "ùs   ‚ A£A´	A¾Ac                óŒ   — | j                  «       sy| j                  «       D ]   }t        |j                  | «      sŒd|_        Œ" y)z5unset _instance for this class and singleton parents.N)ÚinitializedrÝ   r`   Ú	_instancerÛ   s     r"   Úclear_instancez$SingletonConfigurable.clear_instance  s;   € ð �‰Ô ØØŸ™žˆHÜ˜(×,Ñ,¨cÕ2ð &*�Õ"ñ	 (r!   c                ó  — | j                   €$ | |i |¤Ž}| j                  «       D ]	  }||_         Œ t        | j                   | «      r| j                   S t        d| j                  › dt        | j                   «      j                  › �«      ‚)a³  Returns a global instance of this class.

        This method create a new instance if none have previously been created
        and returns a previously created instance is one already exists.

        The arguments and keyword arguments passed to this method are passed
        on to the :meth:`__init__` method of the class upon instantiation.

        Examples
        --------
        Create a singleton class using instance, and retrieve it::

            >>> from traitlets.config.configurable import SingletonConfigurable
            >>> class Foo(SingletonConfigurable): pass
            >>> foo = Foo.instance()
            >>> foo == Foo.instance()
            True

        Create a subclass that is retrieved using the base class instance::

            >>> class Bar(SingletonConfigurable): pass
            >>> class Bam(Bar): pass
            >>> bam = Bam.instance()
            >>> bam == Bar.instance()
            True
        zAn incompatible sibling of 'z(' is already instantiated as singleton: )rà   rÝ   r`   r%   r   r²   )rD   Úargsr1   r   rÜ   s        r"   ÚinstancezSingletonConfigurable.instance)  s‰   € ð: �=‰=Ð Ù˜Ð' Ñ'ˆDð  ŸM™MžO�Ø%)�Õ"ð ,ô �c—m‘m SÔ)Ø—=‘=Ð ä'Ø.¨s¯|©|¨nð ="Ü"& s§}¡}Ó"5×">Ñ">Ð!?ðAóð r!   c                ó:   — t        | d«      xr | j                  duS )zHas an instance been created?rà   N)Úhasattrrà   )rD   s    r"   rß   z!SingletonConfigurable.initializedU  s   € ô �s˜KÓ(ÒF¨S¯]©]À$Ð-FÐFr!   )r4   z4t.Generator[type[SingletonConfigurable], None, None])r4   r5   )rã   r\   r1   r\   r4   r   )r4   Úbool)
r   r   r   r¯   rà   rÂ   rÝ   rá   rä   rß   r    r!   r"   rÙ   rÙ     s_   „ ñð €Iàòó ðð ò*ó ð*ð ò)ó ð)ðV òGó ñGr!   rÙ   )-r¯   Ú
__future__r   rÈ   ÚtypingrË   Úcopyr   Útextwrapr   Útraitlets.traitletsr   r   r   r	   r
   r   r   r   r   r   Útraitlets.utilsr   Útraitlets.utils.bunchr   Útraitlets.utils.textr   r   Úloaderr   r   r   r   ÚTYPE_CHECKINGÚtyping_extensionsr   rÉ   rÊ   rÍ   r˜   r   r%   r'   rd   rÙ   r    r!   r"   Ú<module>ró      s¸   ðÙ 5õ #ã Û Ý Ý ÷÷ ÷ õ %Ý 'ß 8ç LÓ Là‡?‚?Ý&ð ‡?‚?Ø—‘ '×"7Ñ"7¸¿¹Ñ">Ñ>�Jà—‘€Jô	˜	ô 	ô	Ð-ô 	ôY �9ô Y ôx."˜,ô ."ôbSGÐ/õ SGr!   