403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/lib/python3/dist-packages/traitlets/config/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/traitlets/config/__pycache__/configurable.cpython-311.pyc
�

�UcR���dZddlZddlZddlmZddlmZddlmZm	Z	m
Z
mZmZm
Z
mZmZmZddlmZmZddlmZmZmZmZGd	�d
e��ZGd�de��ZGd
�de��ZGd�de��ZGd�de��ZdS)z/A base class for objects that are configurable.�N)�deepcopy)�dedent)	�Any�	Container�Dict�	HasTraits�Instance�default�observe�observe_compat�validate)�indent�wrap_paragraphs�)�Config�DeferredConfig�LazyConfigValue�_is_section_keyc��eZdZdS)�ConfigurableErrorN��__name__�
__module__�__qualname__���?/usr/lib/python3/dist-packages/traitlets/config/configurable.pyrr ��������Drrc��eZdZdS)�MultipleInstanceErrorNrrrrr r $rrr c�@��eZdZeedi��Zedd���Z�fd�Zed���Z	d�Z
dd	�Zed
��e
d�����Zd�Zedd
���Zedd���Zedd���Zed���Zedd���Zed���Z�xZS)�Configurablerz*traitlets.config.configurable.ConfigurableT)�
allow_nonec��������dd��}|�'��dd���
|j�d<||_��dd��}t	��jdi���t
�����fd�}|�|��|�||_n|�|j��|�	|���D]}t||�|���dS)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�R��|j�vr��|j��dSdS)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_overrideZs6���
�{�f�$�$�%�)�)�&�+�6�6�6�6�6�%�$rr)�pop�getr&r%�super�__init__�setr�_load_config�	unobserve�setattr)�selfr,r%r&r-r(r+�	__class__s `    @�rr1zConfigurable.__init__2s(�����2���H�d�+�+�����z�z�(�D�)�)�1�#)�=��x� � �D�K����H�d�+�+��	�����"�"�6�"�"�"�!$����	7�	7�	7�	7�	7�	7�	
���+�,�,�,���!�D�K�K�
���d�k�*�*�*����-�.�.�.�)�	.�	.�D��D�$��t��-�-�-�-�	.�	.rc�D���fd�t�j��D��S)zreturn section names as a listc�h��g|].}t|t���t�|���'|j��/Sr��
issubclassr"r)�.0�c�clss  �r�
<listcomp>z.Configurable.section_names.<locals>.<listcomp>}sO���
�
�
���!�\�*�*�
�0:�#�q�/A�/A�
�
�J�
�
�
r)�reversed�__mro__�r>s`r�
section_nameszConfigurable.section_nameszs8���
�
�
�
��c�k�*�*�
�
�
�	
rc�(�|g}|jr-|�|j�|����t��}|D]I}|���D]2}|�|��r|�||���3�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_configrrC�_has_section�merge)r6�cfg�cfgs�	my_configr=�snames      rrFzConfigurable._find_my_config�s����u���;�	:��K�K���3�3�C�8�8�9�9�9��H�H�	��	.�	.�A��+�+�-�-�
.�
.���>�>�%�(�(�.��O�O�A�e�H�-�-�-��	
.�
�rNc
�(�|�|�d���}|�|���}|�|��}|���5|���D�]�\}}||vr�t|t��r&t||��}|�|��}n0t|t��r|�||��}t||t|������t|��s�t|t��s�ddlm}t|t ��r
|jj}	nd�}	|||��}
d�||jj���}t-|
��d	kr|d
|
d�d�z
}nLt-|
��d	kr9|d�d
�t1|
�������z
}|	|�����	ddd��dS#1swxYwYdS)z load traits from a Config objectNT�r&r)�get_close_matchesc�.�tj|d���S)N�	)�
stacklevel)�warnings�warn)�msgs r�<lambda>z+Configurable._load_config.<locals>.<lambda>�s��8�=���+K�+K�+K�rz5Config option `{option}` not recognized by `{klass}`.)�option�klassrz  Did you mean `z`?z#  Did you mean one of: `{matches}`?�, )�matches)�traitsrCrF�hold_trait_notifications�items�
isinstancer�getattr�	get_valuerr5rrr�difflibrO�LoggingConfigurable�log�warning�formatr7r�len�join�sorted)r6rIrCr[rKr(�config_value�initialrOrTrZrUs            rr3zConfigurable._load_config�s����>��[�[��[�-�-�F�� � �.�.�0�0�M��(�(��-�-�	��
*�
*�
,�
,�!	�!	�&/�o�o�&7�&7� 
� 
�"��l��6�>�>�!�,��@�@�L�#*�$��"5�"5��'3�'=�'=�g�'F�'F���#�L�.�A�A�L�'3�'=�'=�f�T�l�'K�'K���D�$���(>�(>�?�?�?�?�(��.�.��z�,�PV�7W�7W��9�9�9�9�9�9�!�$�(;�<�<�L�#�x�/���K�K��/�/��f�=�=�G�Q�X�X�#�4�>�+B�Y���C��7�|�|�q�(�(��@�'�!�*�@�@�@�@����W����*�*��D�K�K�$(�I�I�f�W�o�o�$>�$>� L� � ����D��I�I�I��A 
�!	�!	�!	�!	�!	�!	�!	�!	�!	�!	�!	�!	����!	�!	�!	�!	�!	�!	s�F!H�H�Hr&c��|�d���}|���}|�|j||���dS)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.
        TrN)r[rCN)r[rCr3�new)r6r*r[rCs    r�_config_changedzConfigurable._config_changed�sM�����D��)�)��
�*�*�,�,�
����&�*�V�=��Q�Q�Q�Q�Qrc��t|j��|_|�|��|j�|��dS)z%Update config and load the new valuesN)rr&r3rH)r6r&s  r�
update_configzConfigurable.update_config�sE���t�{�+�+������&�!�!�!�����&�!�!�!�!�!rc��|�t||��sJ�g}d�d�|jD����}|�|j�d|�d���|�t|d��dz��t
|�d�	�������D]0\}}|�	||��}|�|���1d
�|��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.
        NrYc3�$K�|]}|jV��dS�N)r�r<�ps  r�	<genexpr>z.Configurable.class_get_help.<locals>.<genexpr>�s$���� C� C���� C� C� C� C� C� Cr�(z	) optionsr�-TrN�
)
r^rg�	__bases__rErrfrh�class_traitsr]�class_get_trait_help)r>�inst�
final_help�base_classes�_�v�helps       r�class_get_helpzConfigurable.class_get_help�s���|�z�$��4�4�|�|�|��
��y�y� C� C�S�]� C� C� C�C�C�����S�\�C�C�L�C�C�C�D�D�D����#�j��m�,�,�s�2�3�3�3��3�+�+�4�+�8�8�>�>�@�@�A�A�	$�	$�D�A�q��+�+�A�t�4�4�D����d�#�#�#�#��y�y��$�$�$rc	�`�|�t||��sJ�g}d|j�d|j��}t|ttf��rl|j�dd��}t|t��rd}n!d|jj���z}|dkr	|�d|�d	�}n|�d
|�d	�}n|�d|jj�d�}|�	|��|�|j
}|d
krEd�t|d����}|�	t|����d|jjvr7|�	td|���z����|�9|�	tdt||j��������no	|���}n#t"$rd}YnwxYw|�Et%|��dkr
|dd�d	z}|�	td|z����d�|��S)aGet 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--�.�multiplicityrEz<key-1>=<value-1>z<%s-item-1>�=�...� z=<�>�rx�L�EnumzChoices: %sz	Current: �@�=zDefault: %s)r^rr(rr�metadatar/r7�lowerrEr�rgrr�infor_�default_value_repr�	Exceptionrf)	r>�traitr|�helptext�lines�headerr��sample_value�dvrs	         rr{z!Configurable.class_get_trait_help�sQ���|�z�$��4�4�|�|�|���1�c�l�1�1�U�Z�1�1���e�i��.�/�/�	>� �>�-�-�n�h�G�G�L��%��&�&�
P�2���,�u��/G�/M�/M�/O�/O�O���x�'�'�"�6�6�\�6�6�6���"�6�6�\�6�6�6����=�=�%�/�":�=�=�=�F�
���V�������z�H��r�>�>��y�y���2�!>�!>�?�?�H��L�L���)�)�*�*�*��U�_�-�-�-��L�L��
��
�
��� <�=�=�>�>�>����L�L�� I�G�D�%�*�,E�,E� I� I�J�J�K�K�K�K�
��.�.�0�0�����
�
�
�����
�������s�8�8�b�=�=��c�r�c�(�U�*�C����V�M�C�$7�8�8�9�9�9��y�y����s�-G�G�Gc�J�t|�|����dS)z4Get the help string for a single trait and print it.N)�printr�)r>r|s  r�class_print_helpzConfigurable.class_print_help1s&��	�c� � ��&�&�'�'�'�'�'rc���|}|���D]N}t|t��r7||vr3|�d����|jd��|ur|}�O|S)a7Get 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`.
        TrNN)�mror;r"�class_own_traitsr/r()r>r��classes�defining_clsr%s     r�_defining_classzConfigurable._defining_class6sx��$���g�g�i�i�	&�	&�F��6�<�0�0�
&��g�%�%��+�+�4�+�8�8�<�<�U�Z��N�N�RW�W�W�%����rc	��d�}d}d�d�|jD����}d|j�d|�d�}|||g}|����d��}|r|j}|st
|d	d
��}|r3|�||����|�d
��t|�d����	����D�]X\}}	|	�
��}
|r|�|	|��}n|}||ur�|	jr#|�||	j����d
t|	��jvr*|�d|	���z��|�d|
z��nd|	jr=|�||	j�dd��d����|�d|j�d|����|�d|j�d|�d|
����|�d
����Zd�|��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�z�d�t|d����}d|�dd��zS)z"return a commented, wrapped block.z

�Nz## rxz
#  )rgr�replace)�ss rr=z,Configurable.class_config_section.<locals>.c]s6�����O�A�r�2�2�3�3�A��1�9�9�T�7�3�3�3�3rzO#------------------------------------------------------------------------------rYc3�NK�|] }t|t���|jV��!dSrrr:rss  rruz4Configurable.class_config_section.<locals>.<genexpr>es5����"d�"d�!�
�ST�Vb�Hc�Hc�"d�1�:�"d�"d�"d�"d�"d�"drz# rvz) configuration�description�__doc__r�TrNr�z#  Choices: %sz#  Default: %srxrrz
#  See also: r�z# c.z = )rgryrrzr/�
default_valuer_rErhr]r�r�r��typer��split)r>r�r=�breaker�parent_classesr�r��descr(r��default_repr�defining_classs            r�class_config_sectionz!Configurable.class_config_sectionRs���	4�	4�	4�!�����"d�"d�s�}�"d�"d�"d�d�d��?���?�?��?�?�?���!�W�%�����!�!�%�%�m�4�4���	&��%�D��	/��3�	�2�.�.�D��	��L�L���4���!�!�!��L�L�����!�#�"2�"2�$�"2�"?�"?�"E�"E�"G�"G�H�H�	�	�K�D�%� �3�3�5�5�L��
%�!$�!4�!4�U�G�!D�!D���!$����$�$��:�0��L�L���5�:���/�/�/��T�%�[�[�1�1�1��L�L�!1�E�J�J�L�L�!@�A�A�A����-��<�=�=�=�=��:�B��L�L���5�:�#3�#3�D�!�#<�#<�Q�#?�!@�!@�A�A�A����M�^�-D�M�M�t�M�M�N�N�N��L�L�F���F�F�t�F�F��F�F�G�G�G��L�L�������y�y����rc�0�g}|j}t|�d��������D�]B\}}|jj}|dz|jz}d|vr|d|���zz
}n|d|zz
}|�|��	|���}n#t$rd}YnwxYw|�pt|��dkr
|dd�d	z}|�d
d��}|�td|z����|�d
��|j
pd}|�tt|������|�d
����Dd�|��S)zwGenerate rST documentation for this class' config options.

        Excludes traits defined on parent classes.
        TrNr�r�z : Nr�r�r�z\nz\\nzDefault: ``%s``r�zNo descriptionrx)rrhrzr]r7r(�info_rstrEr�r�rfr�rr�rrg)	r>r��	classnamerr��ttype�termliner�r�s	         r�class_config_rst_docz!Configurable.class_config_rst_doc�s������L�	��s�/�/�t�/�<�<�B�B�D�D�E�E�	�	�H�A�u��O�,�E� �3����3�H������E�E�N�N�$4�$4�4�4����E�E�M�)���L�L��"�"�"�
��.�.�0�0�����
�
�
�����
�������s�8�8�b�=�=��c�r�c�(�U�*�C��k�k�%��1�1�����V�$5��$;�<�<�=�=�=����R� � � ��:�1�!1�D��L�L���t���-�-�.�.�.�
�L�L�������y�y����s�B0�0B?�>B?)NNrr)rrrr	rr&r%r1�classmethodrCrFr3rrrmror�r{r�r�r�r��
__classcell__)r7s@rr"r"-s��������
�X�f�b�"�
%�
%�F�
�X�B�t�
T�
T�
T�F�B.�B.�B.�B.�B.�P�
�
��[�
����2,�,�,�,�\
�W�X����R�R��^���R� "�"�"� �%�%�%��[�%� �1 �1 �1 ��[�1 �f�(�(�(��[�(�����[��6�9 �9 �9 ��[�9 �v�' �' ��[�' �' �' �' �' rr"c��eZdZdZed���Zed��d���Zed��d���Z	d�Z
dS)	rbz�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 instance)r�rcc��t|jtjtjf��s)tj|jj�d|j�d���|jS)Nz..log should be a Logger or LoggerAdapter, got r�)	r^�value�logging�Logger�
LoggerAdapterrSrTr7r)r6�proposals  r�
_validate_logz!LoggingConfigurable._validate_log�sd���(�.�7�>�7�;P�*Q�R�R�	��M��>�*�*�*� ��*�*�*�
�
�
��~�rc��t|jt��r|jjSddlm}|���S)Nr)rc)r^r%rbrc�	traitlets�
get_logger)r6rcs  r�_log_defaultz LoggingConfigurable._log_default�sC���d�k�#6�7�7�	#��;�?�"�!�!�!�!�!�!��~�~���rc��|j}t|tj��r|j}t|dd��sdS|jdS)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.
        �handlersNr)rcr^r�r��loggerr_r�)r6r�s  r�_get_log_handlerz$LoggingConfigurable._get_log_handler�sM������f�g�3�4�4�	#��]�F��v�z�4�0�0�	��4���q�!�!rN)rrrr�rrcr
r�r
r�r�rrrrbrb�s����������#�5�
6�
6�
6�C�
�X�e�_�_����_��
�W�U�^�^� � ��^� �"�"�"�"�"rrbc�n�eZdZdZdZed���Zed���Zed���Zed���Z	dS)�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�|���D]6}t||��r$t|t��r|tkr|V��7dS)zfWalk the cls.mro() for parent classes that are also singletons

        For use in instance()
        N)r�r;r��r>�subclasss  r�	_walk_mrozSingletonConfigurable._walk_mro�sf�������	�	�	�	�H��3��)�)�
��x�)>�?�?�
�� 5�5�5������
	�	rc��|���sdS|���D]}t|j|��rd|_�dS)z5unset _instance for this class and singleton parents.N)�initializedr�r^�	_instancer�s  r�clear_instancez$SingletonConfigurable.clear_instance�s\����� � �	��F��
�
���	*�	*�H��(�,�c�2�2�
*�&*��"��		*�	*rc��|j�&||i|��}|���D]	}||_�
t|j|��r|jStd|j�dt|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 retrived using the base class instance::

            >>> class Bar(SingletonConfigurable): pass
            >>> class Bam(Bar): pass
            >>> bam = Bam.instance()
            >>> bam == Bar.instance()
            True
        NzAn incompatible sibling of 'z(' is already instanciated as singleton: )r�r�r^r rr�)r>�argsr,r|r�s     r�instancezSingletonConfigurable.instance	s���:�=� ��3��'��'�'�D� �M�M�O�O�
*�
*��%)��"�"��c�m�S�)�)�	��=� �'�'�'*�|�|�|�T�#�-�5H�5H�5Q�5Q�S���
rc�4�t|d��o|jduS)zHas an instance been created?r�N)�hasattrr�rBs rr�z!SingletonConfigurable.initialized5s ���s�K�(�(�F�S�]�$�-F�Fr)
rrrr�r�r�r�r�r�r�rrrr�r��s����������I�����[���*�*��[�*��)�)��[�)�V�G�G��[�G�G�Grr�)r�r�rS�copyr�textwrapr�traitlets.traitletsrrrrr	r
rrr
�traitlets.utils.textrr�loaderrrrrr�rr r"rbr�rrr�<module>r�s���5�5���������������������
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�9�8�8�8�8�8�8�8�L�L�L�L�L�L�L�L�L�L�L�L�	�	�	�	�	�	�	�	�	�	�	�	�	�	�-�	�	�	�I �I �I �I �I �9�I �I �I �X)"�)"�)"�)"�)"�,�)"�)"�)"�XSG�SG�SG�SG�SG�/�SG�SG�SG�SG�SGr

Youez - 2016 - github.com/yon3zu
LinuXploit