403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.25
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 :  /lib/python3/dist-packages/prompt_toolkit/layout/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/prompt_toolkit/layout/__pycache__/layout.cpython-311.pyc
�

�Ïc�6����dZddlmZmZmZmZmZmZddlm	Z	ddl
mZmZm
Z
mZmZddlmZmZmZgd�Zeee	eefZGd�d	��ZGd
�de��Zdd
e
dedee
fd�ZdS)z
Wrapper for the layout.
�)�Dict�	Generator�Iterable�List�Optional�Union)�Buffer�)�AnyContainer�ConditionalContainer�	Container�Window�to_container)�
BufferControl�SearchBufferControl�	UIControl)�Layout�InvalidLayoutError�walkc��eZdZdZ	d#dedeeddfd�Zdefd�Z	de
eddffd�Zde
efd	�Zd
eddfd�Zd
edefd�Zedefd
���Zejdeddfd���Zedefd���Zejd
eddfd���Zedefd���Zedeefd���Zde
efd�Zdeefd�Zedeefd���Zdedeefd�Zedefd���Z edefd���Z!d$d�Z"d$d�Z#d$d�Z$de
e%fd�Z&de
e%fd�Z'd$d �Z(d$d!�Z)de%dee%fd"�Z*dS)%raL
    The layout for a prompt_toolkit
    :class:`~prompt_toolkit.application.Application`.
    This also keeps track of which user control is focused.

    :param container: The "root" container for the layout.
    :param focused_element: element to be focused initially. (Can be anything
        the `focus` function accepts.)
    N�	container�focused_element�returnc�N�t|��|_g|_i|_i|_|�]	|j�t
|�������n7#t$r}td��|�d}~wwxYw|�
|��g|_dS)Nz>Invalid layout. The layout does not contain any Window object.)rr�_stack�search_links�_child_to_parent�append�next�find_all_windows�
StopIterationr�focus�visible_windows)�selfrr�es    �>/usr/lib/python3/dist-packages/prompt_toolkit/layout/layout.py�__init__zLayout.__init__%s���&�i�0�0���$&���GI���
=?����"�
���"�"�4��(=�(=�(?�(?�#@�#@�A�A�A�A�� �
�
�
�(�T���������
����

�J�J��'�'�'�.0����s�9A'�'
B�1B�Bc�(�d|j�d|j�d�S)NzLayout(z, current_window=�))r�current_window�r$s r&�__repr__zLayout.__repr__Hs ��T���T�T�D�<O�T�T�T�T�c#�jK�|���D]}t|t��r|V��dS)zJ
        Find all the :class:`.UIControl` objects in this layout.
        N)r�
isinstancer)r$�items  r&r zLayout.find_all_windowsKsE�����I�I�K�K�	�	�D��$��'�'�
��
�
�
��	�	r-c#�JK�|���D]}|jV��dS�N)r �content�r$rs  r&�find_all_controlszLayout.find_all_controlsSs=�����.�.�0�0�	$�	$�I��#�#�#�#�#�	$�	$r-�valuec��t|t��rg|���D]?}t|t��r(|jj|kr|�|��dS�@td|�d����t|t��rb|���D]:}t|t��r#|j|kr|�|��dS�;td|�d����t|t��rQ||���vrtd���|�
��std���||_dSt|��}t|t��r1||���vrtd|�����||_dSg}t!|d���D]E}t|t��r.|j�
��r|�|���Ft'|j��D]}||vr
||_dS�|r|d	|_dStd
|�����)a�
        Focus the given UI element.

        `value` can be either:

        - a :class:`.UIControl`
        - a :class:`.Buffer` instance or the name of a :class:`.Buffer`
        - a :class:`.Window`
        - Any container object. In this case we will focus the :class:`.Window`
          from this container that was focused most recent, or the very first
          focusable :class:`.Window` of the container.
        Nz,Couldn't find Buffer in the current layout: �.z7Invalid value. Container does not appear in the layout.z*Invalid value. UIControl is not focusable.z5Invalid value. Window does not appear in the layout: T��skip_hiddenrz,Invalid value. Container cannot be focused: )r/�strr5r�buffer�namer"�
ValueErrorr	r�is_focusable�current_controlrrr r*rr3r�reversedr)r$r6�control�windows�c�ws      r&r"zLayout.focusWs����e�S�!�!�?	��1�1�3�3�
�
���g�}�5�5��'�.�:M�QV�:V�:V��J�J�w�'�'�'��F�F���V�E�V�V�V�W�W�W���v�
&�
&�7	��1�1�3�3�
�
���g�}�5�5��'�.�E�:Q�:Q��J�J�w�'�'�'��F�F���V�E�V�V�V�W�W�W���y�
)�
)�/	��D�2�2�4�4�4�4� �M�����%�%�'�'�
O� �!M�N�N�N�#(�D� � � �!��'�'�E��%��(�(�!
��� 5� 5� 7� 7�7�7�$�*� �5�#����
',��#�#�#����e��6�6�6�*�*�A�!�!�V�,�,�*���1G�1G�1I�1I�*����q�)�)�)��"�$�+�.�.���A��G�|�|�./��+����$�
��*1�!�*�D�'��F� �L�5�L�L���r-c��t|t��r|j�dS|jj|kSt|t��r|j|kSt|t
��r|j|kSt|��}t|t��r|j	|kSt|��D]}||j	krdS�dS)z�
        Check whether the given control has the focus.
        :param value: :class:`.UIControl` or :class:`.Window` instance.
        NFT)r/r;�current_bufferr=r	rr@rrr*r)r$r6�elements   r&�	has_focuszLayout.has_focus�s���
�e�S�!�!�	5��"�*��u��&�+�u�4�4��e�V�$�$�	0��&�%�/�/��e�Y�'�'�	��'�5�0�0� ��'�'�E��%��(�(�
��*�e�3�3� $�E�{�{�$�$�G��$�"5�5�5�#�t�t�6��ur-c�&�|jdjS)zI
        Get the :class:`.UIControl` to currently has the focus.
        ���)rr3r+s r&r@zLayout.current_control�s��
�{�2��&�&r-rBc�x�|���D]}|j|kr
||_dS�td���)zC
        Set the :class:`.UIControl` to receive the focus.
        Nz(Control not found in the user interface.)r r3r*r>)r$rB�windows   r&r@zLayout.current_control�sQ��
�+�+�-�-�	�	�F��~��(�(�&,��#����)��C�D�D�Dr-c��|jdS)z=Return the :class:`.Window` object that is currently focused.rK)rr+s r&r*zLayout.current_window�s���{�2��r-c�:�|j�|��dS)z8Set the :class:`.Window` object to be currently focused.N)rr)r$r6s  r&r*zLayout.current_window�s ��	
����5�!�!�!�!�!r-c��|j|jvS)z#True if we are searching right now.)r@rr+s r&�is_searchingzLayout.is_searching�s���#�t�'8�8�8r-c�r�|j}t|t��r|j�|��SdS)zY
        Return the :class:`.BufferControl` in which we are searching or `None`.
        N)r@r/rr�get)r$rBs  r&�search_target_buffer_controlz#Layout.search_target_buffer_control�s;���&���g�2�3�3�	��$�(�(��1�1�1��4r-c#�K�|���D]4}t|t��r|j���r|V��5dS)zl
        Return all the :class:`.Window` objects which are focusable (in the
        'modal' area).
        N)�walk_through_modal_arear/rr3r?)r$rEs  r&�get_focusable_windowszLayout.get_focusable_windows�s^����
�-�-�/�/�	�	�A��!�V�$�$�
���)?�)?�)A�)A�
������	�	r-c�R��|j��fd�|���D��S)zO
        Return a list of :class:`.Window` objects that are focusable.
        c���g|]}|�v�|��	S�rZ)�.0rEr#s  �r&�
<listcomp>z8Layout.get_visible_focusable_windows.<locals>.<listcomp>�s#���P�P�P�a�1��;O�;O��;O�;O�;Or-)r#rW)r$r#s @r&�get_visible_focusable_windowsz$Layout.get_visible_focusable_windows�s3����.��P�P�P�P�4�5�5�7�7�P�P�P�Pr-c�L�|j}t|t��r|jSdS)zD
        The currently focused :class:`~.Buffer` or `None`.
        N)r@r/rr<�r$�
ui_controls  r&rGzLayout.current_buffers,��
�)�
��j�-�0�0�	%��$�$��tr-�buffer_namec���|���D]T}t|t��r=t|jt��r#|jjj|kr|jjcS�UdS)zt
        Look in the layout for a buffer with the given name.
        Return `None` when nothing was found.
        N)rr/rr3rr<r=)r$rarEs   r&�get_buffer_by_namezLayout.get_buffer_by_namesj��
�����	,�	,�A��!�V�$�$�
,��A�I�}�)M�)M�
,��9�#�(�K�7�7��9�+�+�+�+���tr-c�:�|j}t|t��S)z�
        Return `True` if the currently focused control is a
        :class:`.BufferControl`. (For instance, used to determine whether the
        default key bindings should be active or not.)
        )r@r/rr_s  r&�buffer_has_focuszLayout.buffer_has_focuss���)�
��*�m�4�4�4r-c�l�	|jdjS#t$r|jdjcYSwxYw)zJ
        Get the :class:`.UIControl` to previously had the focus.
        ���rK)rr3�
IndexErrorr+s r&�previous_controlzLayout.previous_control sF��
	+��;�r�?�*�*���	+�	+�	+��;�r�?�*�*�*�*�	+���s��3�3c�b�t|j��dkr|jdd�|_dSdS)z=
        Give the focus to the last focused control.
        r
NrK)�lenrr+s r&�
focus_lastzLayout.focus_last*s7���t�{���a����+�c�r�c�*�D�K�K�K� �r-c��|���}t|��dkr`	|�|j��}|dzt|��z}n#t$rd}YnwxYw|�||��dSdS)z:
        Focus the next visible/focusable Window.
        rr
N�r]rk�indexr*r>r"�r$rCros   r&�
focus_nextzLayout.focus_next1����4�4�6�6���w�<�<�!���
3��
�
�d�&9�:�:�����c�'�l�l�2�����
�
�
�����
����

�J�J�w�u�~�&�&�&�&�&����A�A(�'A(c��|���}t|��dkr`	|�|j��}|dz
t|��z}n#t$rd}YnwxYw|�||��dSdS)z>
        Focus the previous visible/focusable Window.
        rr
Nrnrps   r&�focus_previouszLayout.focus_previousArrrsc#�>K�t|j��Ed{V��dS)zX
        Walk through all the layout nodes (and their children) and yield them.
        N)rrr+s r&rzLayout.walkQs0�������'�'�'�'�'�'�'�'�'�'�'r-c#��K�|j}|���s3||jvr*|j|}|���s	||jv�*t|��Ed{V��dS)zn
        Walk through all the containers which are in the current 'modal' part
        of the layout.
        N)r*�is_modalrr)r$�roots  r&rVzLayout.walk_through_modal_areaWs�����-���-�-�/�/�	/�d�d�.C�&C�&C��(��.�D��-�-�/�/�	/�d�d�.C�&C�&C���:�:���������r-c�\���i�dtddf��fd���|j���|_dS)z=
        Update child->parent relationships mapping.
        r%rNc�V��|���D]}|�|<�|���dSr2)�get_children)r%rD�parentsrs  ��r&rz-Layout.update_parents_relations.<locals>.walkjs>����^�^�%�%�
�
�����
���Q�����
�
r-)r
rr)r$r}rs @@r&�update_parents_relationszLayout.update_parents_relationsds^������	�I�	�$�	�	�	�	�	�	�	�
	
��T�^���� '����r-c�j�|j���|j���dSr2)r�clearr�resetr+s r&r�zLayout.resetss3��
	
����!�!�!���������r-c�@�	|j|S#t$rYdSwxYw)zo
        Return the parent container for the given container, or ``None``, if it
        wasn't found.
        N)r�KeyErrorr4s  r&�
get_parentzLayout.get_parent|s7��
	��(��3�3���	�	�	��4�4�	���s��
�r2)rN)+�__name__�
__module__�__qualname__�__doc__rr�FocusableElementr'r;r,rrr rrr5r"�boolrI�propertyr@�setterr*rQrrTrWrr]r	rGrcrerirlrqrur
rrVr~r�r�rZr-r&rrs���������7;�!0�!0��!0�"�"2�3�!0�
�	!0�!0�!0�!0�FU�#�U�U�U�U��)�F�D�$�,>�"?�����$�8�I�#6�$�$�$�$�M�+�M��M�M�M�M�^�/��D�����2�'��'�'�'��X�'���	E�y�	E�T�	E�	E�	E���	E��������X����"�F�"�t�"�"�"���"��9�d�9�9�9��X�9���h�}�.E�����X���x��'7�����Q�t�F�|�Q�Q�Q�Q����� 0�����X��	�c�	�h�v�6F�	�	�	�	��5�$�5�5�5��X�5��+�)�+�+�+��X�+�+�+�+�+�'�'�'�'� '�'�'�'� (�h�y�)�(�(�(�(���)�)<�����
(�
(�
(�
(������I��(�9�2E������r-rc��eZdZdS)rN)r�r�r�rZr-r&rr�s�������Dr-rFrr:rc#��K�|r+t|t��r|���sdS|V�|���D]}t	||���Ed{V���dS)z:
    Walk through layout, starting at this container.
    Nr9)r/r�filterr|r)rr:rDs   r&rr�s�����	���y�"6�7�7��� � �"�"��
	��
�O�O�O�
�
#�
#�
%�
%�4�4����{�3�3�3�3�3�3�3�3�3�3�3�4�4r-N)F)r��typingrrrrrr�prompt_toolkit.bufferr	�
containersrrr
rr�controlsrrr�__all__r;r�r�	Exceptionrr�rrZr-r&�<module>r�sz����D�C�C�C�C�C�C�C�C�C�C�C�C�C�C�C�(�(�(�(�(�(���������������D�C�C�C�C�C�C�C�C�C�������f�i��=�>��j�j�j�j�j�j�j�j�Z	�	�	�	�	��	�	�	�4�4�I�4�D�4�X�i�=P�4�4�4�4�4�4r-

Youez - 2016 - github.com/yon3zu
LinuXploit