Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 52.15.164.56
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : browser.cpython-311.pyc
�

Tf�!��V�dZddlZddlZddlZddlmZddlmZddlm	Z	m
Z
mZddlm
Z
ddlmZdadZd	�Zdd
�ZGd�d��ZGd
�de
��ZGd�de
��Zd�Zedkr;eej��dkrddlmZeddd���ddlmZee��dSdS)z�Module browser.

XXX TO DO:

- reparse when source changed (maybe just a button would be OK?)
    (or recheck on window popup)
- add popup menu with more options (e.g. doc strings, base classes, imports)
- add base classes to class browser tree
�N)�idleConf)�pyshell)�TreeNode�TreeItem�ScrolledCanvas)�
py_extensions)�ListedToplevel)z.pyic��tj�|��\}}tj�|��}|tvo|t
vS�N)�os�path�splitext�normcaser�browseable_extension_blocklist)r
�_�exts   �8/usr/local/python-3.11/lib/python3.11/idlelib/browser.py�is_browseable_extensionrsF��
�W�
�
�d�
#�
#�F�A�s�
�'�
�
�3�
�
�C��-��M�C�/M�$M�M�c���g}|���D]�\}}|�|j|kr�t|d��r�|jr�|j|kr�g}|jD]R}t|t��r|}n#|j}|j|jkr|j�d|��}|�|���S|xjd�d�	|����z
c_|�|����|S)aTransform a child dictionary to an ordered sequence of objects.

    The dictionary maps names to pyclbr information objects.
    Filter out imported objects.
    Augment class names with bases.
    The insertion order of the dictionary is assumed to have been in line
    number order, so sorting is not necessary.

    The current tree only calls this once per child_dict as it saves
    TreeItems once created.  A future tree and tests might violate this,
    so a check prevents multiple in-place augmentations.
    N�super�.z({})z, )
�items�module�hasattrr�name�
isinstance�str�append�format�join)�
child_dict�modname�obs�key�obj�supers�sup�snames        r�transform_childrenr*#s
��
�C��$�$�&�&�����S��?�c�j�G�3�3��s�G�$�$�
=���
=�s�x�3������9�)�)�C�!�#�s�+�+�<� #��� #����:���3�3�'*�z�$;�$;�E�$;�$;�E��M�M�%�(�(�(�(����F�M�M�$�)�)�F�*;�*;�<�<�<����J�J�s�O�O�O���Jrc�:�eZdZdZddd�d�Zd
d�Zd�Zd�Zd	�ZdS)�
ModuleBrowserz1Browse module classes and functions in IDLE.
    F)�_htest�_utestc�f�||_||_||_||_|���dS)aCreate a window for browsing a module's structure.

        Args:
            master: parent for widgets.
            path: full path of file to browse.
            _htest - bool; change box location when running htest.
            -utest - bool; suppress contents when running unittest.

        Global variables:
            file_open: Function used for opening a file.

        Instance variables:
            name: Module name.
            file: Full path and module with supported extension.
                Used in creating ModuleBrowserTreeItem as the rootnode for
                the tree and subsequently in the children.
        N)�masterr
r-r.�init)�selfr0r
r-r.s     r�__init__zModuleBrowser.__init__Js1��$�����	��������	�	�����rNc�j�|j���|j���dS)z&Dismiss the window and the tree nodes.N)�top�destroy�node)r2�events  r�closezModuleBrowser.closebs0����������	�������rc��|j}|js|jstjntj|��}|jatj	�
��t|��x|_}|�
d|j��|�d|j��|jrA|�d|���|���dzfz��|���|���t+j��}t+j|d��d}t1||dd�	��}|j�dd
���|���}t9|jd|��x|_}|js*|���|� ��dSdS)
z3Create browser tkinter widgets, including the tree.�WM_DELETE_WINDOWz<Escape>z+%d+%d���normal�
backgroundr�)�bg�highlightthickness�	takefocus�both)�expand�fillN)!r0r-r.r�flist�PyShellFileList�open�	file_open�pyclbr�_modules�clearr	r5�protocolr9�bind�geometry�winfo_rootx�winfo_rooty�settitle�	focus_setr�CurrentTheme�GetHighlightr�frame�pack�rootnoder�canvasr7�updaterD)	r2�rootrFr5�themer>�sc�itemr7s	         rr1zModuleBrowser.initgs����{��'+�{�4�d�k�4�����-�d�3�3�	��J�	��������(��-�-�-���3����'���4�4�4�����T�Z�(�(�(��;�	@��L�L���!�!�#�#�T�%5�%5�%7�%7�#�%=�>�?�
@�
@�
@��
�
�����
�
�����%�'�'���*�5�(�;�;�L�I�
�
�C�J�1�&'�)�)�)��
��
�
�Q�V�
�,�,�,��}�}����#�B�I�t�T�:�:�:��	�D��{�	��K�K�M�M�M��K�K�M�M�M�M�M�	�	rc��|j�dtj�|j��z��|j�d��dS)zSet the window title.zModule Browser - zModule BrowserN)r5�wm_titlerr
�basename�wm_iconname�r2s rrRzModuleBrowser.settitle�sM������-���0@�0@���0K�0K�K�L�L�L�����-�.�.�.�.�.rc�*�t|j��S)z7Return a ModuleBrowserTreeItem as the root of the tree.)�ModuleBrowserTreeItemr
rcs rrXzModuleBrowser.rootnode�s��$�T�Y�/�/�/rr)	�__name__�
__module__�__qualname__�__doc__r3r9r1rRrX�rrr,r,Cs��������05�U������0����
���>/�/�/�
0�0�0�0�0rr,c�<�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	S)
rez~Browser tree for Python module.

    Uses TreeItem as the basis for the structure of the tree.
    Used by both browsers.
    c��||_dS)zdCreate a TreeItem for the file.

        Args:
            file: Full path and module name.
        N)�file)r2rms  rr3zModuleBrowserTreeItem.__init__�s����	�	�	rc�J�tj�|j��S)z5Return the module name as the text string to display.)rr
rarmrcs r�GetTextzModuleBrowserTreeItem.GetText�s���w����	�*�*�*rc��dS)�'Return the name of the icon to display.�pythonrjrcs r�GetIconNamez!ModuleBrowserTreeItem.GetIconName�s���xrc�>�d�|���D��S)�*Return ChildBrowserTreeItems for children.c�,�g|]}t|����Srj��ChildBrowserTreeItem��.0r&s  r�
<listcomp>z4ModuleBrowserTreeItem.GetSubList.<locals>.<listcomp>�s!��I�I�I�c�$�S�)�)�I�I�Ir)�listchildrenrcs r�
GetSubListz ModuleBrowserTreeItem.GetSubList�s"��I�I�T�5F�5F�5H�5H�I�I�I�Irc��t|j��sdStj�|j��sdSt|j��dS)z6Open a module in an editor window when double clicked.N)rrmrr
�existsrIrcs r�
OnDoubleClickz#ModuleBrowserTreeItem.OnDoubleClick�sL��&�t�y�1�1�	��F��w�~�~�d�i�(�(�	��F��$�)�����rc�*�t|j��S)zReturn True if Python file.)rrmrcs r�IsExpandablez"ModuleBrowserTreeItem.IsExpandable�s��&�t�y�1�1�1rc�N�t|j��sgStj�|j��\}}tj�|��\}}	t
j||gtjz��}n#t$rgcYSwxYwt||��S)z5Return sequenced classes and functions in the module.)rrmrr
�splitrrJ�
readmodule_ex�sys�ImportErrorr*)r2�dir�baserr�trees      rr|z"ModuleBrowserTreeItem.listchildren�s���&�t�y�1�1�	��I��G�M�M�$�)�,�,�	��T��'�"�"�4�(�(���a�	��'��s�e�c�h�.>�?�?�D�D���	�	�	��I�I�I�	����!�$��-�-�-s�!#B�B�BN)rfrgrhrir3rorsr}r�r�r|rjrrrere�s������������+�+�+����J�J�J����2�2�2�
.�
.�
.�
.�
.rrec�6�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	dS)	rxzsBrowser tree for child nodes within the module.

    Uses TreeItem as the basis for the structure of the tree.
    c�j�||_|j|_t|tj��|_dS)z5Create a TreeItem for a pyclbr class/function object.N)r&rrrJ�Function�
isfunction)r2r&s  rr3zChildBrowserTreeItem.__init__�s)������H��	�$�S�&�/�:�:����rc�8�|j}|jrd|zdzSd|zS)z1Return the name of the function/class to display.zdef z(...)zclass )rr�)r2rs  rrozChildBrowserTreeItem.GetText�s,���y���?�	#��D�=�7�*�*��d�?�"rc��|jrdSdS)rqrr�folder)r�rcs rrsz ChildBrowserTreeItem.GetIconName�s���?�	��8��8rc�"�|jjikS)z+Return True if self.obj has nested objects.)r&�childrenrcs rr�z!ChildBrowserTreeItem.IsExpandable�s���x� �B�&�&rc�H�d�t|jj��D��S)ruc�,�g|]}t|����Srjrwrys  rr{z3ChildBrowserTreeItem.GetSubList.<locals>.<listcomp>�s6��B�B�B��%�S�)�)�B�B�Br)r*r&r�rcs rr}zChildBrowserTreeItem.GetSubList�s6��B�B�-�d�h�.?�@�@�B�B�B�	Brc��	t|jj��}|�|jj��dS#t
tf$rYdSwxYw)z2Open module with file_open and position to lineno.N)rIr&rm�gotoline�lineno�OSError�AttributeError)r2�edits  rr�z"ChildBrowserTreeItem.OnDoubleClick�s[��	��T�X�]�+�+�D��M�M�$�(�/�*�*�*�*�*����(�	�	�	��D�D�	���s�8<�A�AN)
rfrgrhrir3rorsr�r}r�rjrrrxrx�s{��������
;�;�;�#�#�#����'�'�'�B�B�B�
����rrxc���ttj��dkrtjd}nt}Gd�dt��}d�}t||d���dS)Nr?c��eZdZd�ZdS)�'_module_browser.<locals>.Nested_in_funcc��dSrrjrjrr�nested_in_classz7_module_browser.<locals>.Nested_in_func.nested_in_class�s���rN)rfrgrhr�rjrr�Nested_in_funcr��s������'�'�'�'�'rr�c� �Gd�d��}dS)Nc��eZdZdS)�;_module_browser.<locals>.closure.<locals>.Nested_in_closureN)rfrgrhrjrr�Nested_in_closurer��s�������rr�rj)r�s r�closurez _module_browser.<locals>.closure�s ��)�)�)�)�)�)�)�)�)�)rT)r-)�lenr��argv�__file__rr,)�parentrmr�r�s    r�_module_browserr��s{��
�3�8�}�}�q����x��{�����	(�	(�	(�	(�	(�X�	(�	(�	(�	*�	*�	*��&�$�t�,�,�,�,�,�,r�__main__r?)�mainzidlelib.idle_test.test_browser�F)�	verbosity�exit)�runr)rirrJr��idlelib.configr�idlelibr�idlelib.treerrr�idlelib.utilr�idlelib.windowr	rIrrr*r,rerxr�rfr�r��unittestr��idlelib.idle_test.htestr�rjrr�<module>r�s�����
�	�	�	�
�
�
�
�
�
�
�
�#�#�#�#�#�#�������;�;�;�;�;�;�;�;�;�;�&�&�&�&�&�&�)�)�)�)�)�)�
�	�"+��N�N�N�����@J0�J0�J0�J0�J0�J0�J0�J0�Z1.�1.�1.�1.�1.�H�1.�1.�1.�h*�*�*�*�*�8�*�*�*�Z
-�
-�
-��z���
�s�3�8�}�}����!�!�!�!�!�!���
-���G�G�G�G�+�+�+�+�+�+��C�������
�r
© 2025 GrazzMean