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: 18.216.147.121
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : browser.cpython-310.pyc
o

_bz �@s�dZddlZddlZddlZddlmZddlmZddlm	Z	m
Z
mZddlm
Z
daddd�ZGd	d
�d
�ZGdd�de
�ZGd
d�de
�Zdd�Zedkrpeej�dkrdddlmZedddd�ddlmZee�dSdS)a8Module 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
- finish removing limitation to x.py files (ModuleBrowserTreeItem)
�N)�idleConf)�pyshell)�TreeNode�TreeItem�ScrolledCanvas)�ListedToplevelcCs�g}|��D]U\}}|dus|j|kr[t|d�rV|jrV|j|krVg}|jD]#}t|�td�ur2|}n|j}|j|jkrC|j�d|��}|�|�q%|jd�d�|��7_|�|�q|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�type�append�format�join)Z
child_dict�modnameZobs�key�objZsupers�supZsname�r�8/usr/local/python-3.10/lib/python3.10/idlelib/browser.py�transform_childrens 


�rc@sBeZdZdZddd�dd�Zddd�Zd	d
�Zdd�Zd
d�ZdS)�
ModuleBrowserz1Browse module classes and functions in IDLE.
    F)�_htest�_utestcCs$||_||_||_||_|��dS)azCreate 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 .py extension.  Used in
                creating ModuleBrowserTreeItem as the rootnode for
                the tree and subsequently in the children.
        N)�master�pathrr�init)�selfrrrrrrr�__init__As
zModuleBrowser.__init__NcCs|j��|j��dS)z&Dismiss the window and the tree nodes.N)�topZdestroy�node)r �eventrrr�closeYs
zModuleBrowser.closec	Cs|j}|js|jstjnt�|�}|jatj	�
�t|�|_}|�
d|j�|�d|j�|jr@|�d|��|��df�|��|��t��}t�|d�d}t||ddd	�}|jjdd
d�|��}t|jd|�|_}|js|��|� �dSdS)
z3Create browser tkinter widgets, including the tree.ZWM_DELETE_WINDOWz<Escape>z+%d+%d��Znormal�
backgroundr�)�bgZhighlightthicknessZ	takefocusZboth)�expand�fillN)!rrrr�flistZPyShellFileList�open�	file_open�pyclbrZ_modules�clearrr"�protocolr%�bindZgeometryZwinfo_rootxZwinfo_rooty�settitleZ	focus_setrZCurrentThemeZGetHighlightr�frame�pack�rootnoderZcanvasr#�updater*)	r �rootr,r"Zthemer'Zsc�itemr#rrrr^s6�
���zModuleBrowser.initcCs*|j�dtj�|j��|j�d�dS)zSet the window title.zModule Browser - zModule BrowserN)r"Zwm_title�osr�basenameZwm_iconname�r rrrr3}szModuleBrowser.settitlecCs
t|j�S)z7Return a ModuleBrowserTreeItem as the root of the tree.)�ModuleBrowserTreeItemrr<rrrr6�s
zModuleBrowser.rootnode�N)	�__name__�
__module__�__qualname__�__doc__r!r%rr3r6rrrrr:s
rc@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)r=z~Browser tree for Python module.

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

        Args:
            file: Full path and module name.
        N)�file)r rCrrrr!�s
zModuleBrowserTreeItem.__init__cCstj�|j�S)z5Return the module name as the text string to display.)r:rr;rCr<rrr�GetText�szModuleBrowserTreeItem.GetTextcCsdS)�'Return the name of the icon to display.�pythonrr<rrr�GetIconName�sz!ModuleBrowserTreeItem.GetIconNamecCsdd�|��D�S)�*Return ChildBrowserTreeItems for children.cS�g|]}t|��qSr��ChildBrowserTreeItem��.0rrrr�
<listcomp>�sz4ModuleBrowserTreeItem.GetSubList.<locals>.<listcomp>)�listchildrenr<rrr�
GetSubList�sz ModuleBrowserTreeItem.GetSubListcCs>tj�|jdd��dkrdStj�|j�sdSt|j�dS)z6Open a module in an editor window when double clicked.���N�.py)r:r�normcaserC�existsr.r<rrr�
OnDoubleClick�s
z#ModuleBrowserTreeItem.OnDoubleClickcCstj�|jdd��dkS)z!Return True if Python (.py) file.rQNrR)r:rrSrCr<rrr�IsExpandable�sz"ModuleBrowserTreeItem.IsExpandablecCsptj�|j�\}}tj�|�\}}tj�|�dkrgSzt�||gtj�}Wnt	y2gYSwt
||�S)z5Return sequenced classes and functions in the module.rR)r:r�splitrC�splitextrSr/Z
readmodule_ex�sys�ImportErrorr)r �dir�baser�extZtreerrrrO�s�
z"ModuleBrowserTreeItem.listchildrenN)r?r@rArBr!rDrGrPrUrVrOrrrrr=�sr=c@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)rKzsBrowser tree for child nodes within the module.

    Uses TreeItem as the basis for the structure of the tree.
    cCs ||_|j|_t|tj�|_dS)z5Create a TreeItem for a pyclbr class/function object.N)rr�
isinstancer/ZFunction�
isfunction)r rrrrr!�szChildBrowserTreeItem.__init__cCs |j}|jrd|dSd|S)z1Return the name of the function/class to display.zdef z(...)zclass )rr_)r rrrrrD�szChildBrowserTreeItem.GetTextcCs|jrdSdS)rErFZfolder)r_r<rrrrG�sz ChildBrowserTreeItem.GetIconNamecCs|jjikS)z+Return True if self.obj has nested objects.)r�childrenr<rrrrV�sz!ChildBrowserTreeItem.IsExpandablecCsdd�t|jj�D�S)rHcSrIrrJrLrrrrN�s�z3ChildBrowserTreeItem.GetSubList.<locals>.<listcomp>)rrr`r<rrrrP�s
�zChildBrowserTreeItem.GetSubListc	Cs:zt|jj�}|�|jj�WdSttfyYdSw)z2Open module with file_open and position to lineno.N)r.rrCZgotoline�lineno�OSError�AttributeError)r ZeditrrrrU�s�z"ChildBrowserTreeItem.OnDoubleClickN)
r?r@rArBr!rDrGrVrPrUrrrrrK�srKcCsHttj�dkr
tjd}nt}Gdd�dt�}dd�}t||dd�dS)Nr(c@seZdZdd�ZdS)z'_module_browser.<locals>.Nested_in_funccSsdSr>rrrrr�nested_in_class�sz7_module_browser.<locals>.Nested_in_func.nested_in_classN)r?r@rArdrrrr�Nested_in_func�srecSsGdd�d�}dS)Nc@seZdZdS)z;_module_browser.<locals>.closure.<locals>.Nested_in_closureN)r?r@rArrrr�Nested_in_closure�srfr)rfrrr�closure�sz _module_browser.<locals>.closureT)r)�lenrY�argv�__file__rr)�parentrCrergrrr�_module_browser�srl�__main__r()�mainzidlelib.idle_test.test_browser�F)�	verbosity�exit)�runr>)rBr:r/rYZidlelib.configrZidlelibrZidlelib.treerrrZidlelib.windowrr.rrr=rKrlr?rhriZunittestrnZidlelib.idle_test.htestrrrrrr�<module>s*
 M4-�
© 2025 GrazzMean