HEX
Server: Apache/2.4.65 (Unix) OpenSSL/1.1.1k
System: Linux vps109042.inmotionhosting.com 4.18.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64
User: cisa (1010)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //opt/imh/python3.13/lib/python3.13/idlelib/__pycache__/browser.cpython-313.pyc
�

��e�!��4�SrSSKrSSKrSSKrSSKJr SSKJr SSKJ	r	J
r
Jr SSKJ
r
 SSKJr SqSrS	rSS
jr"SS5r"S
S\
5r"SS\
5rSr\S:Xa3\"\R45S:XaSSKJr \"SSSS9 SSKJr \"\5 gg)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��[RRU5up[RRU5nU[;=(a	 U[
;$�N)�os�path�splitext�normcaser�browseable_extension_blocklist)r
�_�exts   �5/opt/imh/python3.13/lib/python3.13/idlelib/browser.py�is_browseable_extensionrsB��
�W�W�
�
�d�
#�F�A�
�'�'�
�
�3�
�C��-��M�C�/M�$M�M�c�@�/nUR5GHup4UbURU:XdM[US5(a�UR(a�URU:Xa�/nURHcn[U[5(aUnO7URnURUR:waURSU3nURU5 Me U=RSRSRU55-
slURU5 GM	 U$)a�Transform 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.
�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��$�$�&����?�c�j�j�G�3��s�G�$�$����s�x�x�3�����9�9�C�!�#�s�+�+� #�� #�����:�:����3�'*�z�z�l�!�E�7�$;�E��M�M�%�(�%����F�M�M�$�)�)�F�*;�<�<���J�J�s�O�'��Jrc�D�\rSrSrSrSSS.SjrSSjrSrS	rS
r	Sr
g)
�
ModuleBrowser�Cz1Browse module classes and functions in IDLE.
    F)�_htest�_utestc�T�XlX lX0lX@lUR	5 g)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)�selfr1r
r.r/s     r�__init__�ModuleBrowser.__init__Js!��$���	������	�	�rNc�l�URR5 URR5 g)z&Dismiss the window and the tree nodes.N)�top�destroy�node)r3�events  r�close�ModuleBrowser.closebs"���������	�	���rc���URnUR(d!UR(d[RO[R
"U5nURq[RR5 [U5=UlnURSUR5 URSUR5 UR(a5UR!SUR#5UR%5S-4-5 UR'5 UR)5 [*R,"5n[*R."US5Sn[1X5SSS	9nUR2R5SS
S9 UR75n[9UR:SU5=UlnUR(d!UR?5 URA5 gg)
z3Create browser tkinter widgets, including the tree.�WM_DELETE_WINDOWz<Escape>z+%d+%d���normal�
backgroundr�)�bg�highlightthickness�	takefocus�both)�expand�fillN)!r1r.r/r�flist�PyShellFileList�open�	file_open�pyclbr�_modules�clearr	r7�protocolr;�bind�geometry�winfo_rootx�winfo_rooty�settitle�	focus_setr�CurrentTheme�GetHighlightr�frame�pack�rootnoder�canvasr9�updaterG)	r3�rootrIr7�themerA�sc�itemr9s	         rr2�ModuleBrowser.initgs^���{�{��'+�{�{�d�k�k�����-�-�d�3�	��J�J�	�������(��-�-���3����'����4�����T�Z�Z�(��;�;��L�L���!�!�#�T�%5�%5�%7�#�%=�>�?�
@��
�
���
�
���%�%�'���*�*�5�(�;�L�I�
�
�C�1�&'�)��
���
�
�Q�V�
�,��}�}���#�B�I�I�t�T�:�:��	�D��{�{��K�K�M��K�K�M�rc���URRS[RR	UR5-5 URRS5 g)zSet the window title.zModule Browser - zModule BrowserN)r7�wm_titlerr
�basename�wm_iconname�r3s rrU�ModuleBrowser.settitle�s@�������-����0@�0@����0K�K�L������-�.rc�,�[UR5$)z7Return a ModuleBrowserTreeItem as the root of the tree.)�ModuleBrowserTreeItemr
rgs rr[�ModuleBrowser.rootnode�s��$�T�Y�Y�/�/r)r.r/r1r9r
r7r)�__name__�
__module__�__qualname__�__firstlineno__�__doc__r4r;r2rUr[�__static_attributes__�rrr,r,Cs'���05�U��0�
�>/�
0rr,c�B�\rSrSrSrSrSrSrSrSr	Sr
S	rS
rg)rj�zrBrowser tree for Python module.

Uses TreeItem as the basis for the structure of the tree.
Used by both browsers.
c��Xlg)zLCreate a TreeItem for the file.

Args:
    file: Full path and module name.
N��file)r3rws  rr4�ModuleBrowserTreeItem.__init__�s	���	rc�T�[RRUR5$)z5Return the module name as the text string to display.)rr
rerwrgs r�GetText�ModuleBrowserTreeItem.GetText�s���w�w����	�	�*�*rc��g)�'Return the name of the icon to display.�pythonrrrgs r�GetIconName�!ModuleBrowserTreeItem.GetIconName�s��rc�`�UR5Vs/sHn[U5PM sn$s snf�z*Return ChildBrowserTreeItems for children.)�listchildren�ChildBrowserTreeItem�r3r&s  r�
GetSubList� ModuleBrowserTreeItem.GetSubList�s+��59�5F�5F�5H�I�5H�c�$�S�)�5H�I�I��Is�+c���[UR5(dg[RR	UR5(dg[UR5 g)z6Open a module in an editor window when double clicked.N)rrwrr
�existsrLrgs r�
OnDoubleClick�#ModuleBrowserTreeItem.OnDoubleClick�s:��&�t�y�y�1�1���w�w�~�~�d�i�i�(�(���$�)�)�rc�,�[UR5$)zReturn True if Python file.)rrwrgs r�IsExpandable�"ModuleBrowserTreeItem.IsExpandable�s��&�t�y�y�1�1rc�^�[UR5(d/$[RR	UR5up[RRU5up4[R"X1/[R-5n[XS5$![a /s$f=f)z5Return sequenced classes and functions in the module.)rrwrr
�splitrrM�
readmodule_ex�sys�ImportErrorr*)r3�dir�baserr�trees      rr��"ModuleBrowserTreeItem.listchildren�s���&�t�y�y�1�1��I��G�G�M�M�$�)�)�,�	���'�'�"�"�4�(���	��'�'��e�c�h�h�.>�?�D�"�$�-�-���	��I�	�s�*(B�B,�+B,rvN)
rlrmrnrorpr4rzrr�r�r�r�rqrrrrrjrj�s+����+��J��2�
.rrjc�<�\rSrSrSrSrSrSrSrSr	Sr
S	rg
)r���zkBrowser tree for child nodes within the module.

Uses TreeItem as the basis for the structure of the tree.
c�p�XlURUl[U[R5Ulg)z5Create a TreeItem for a pyclbr class/function object.N)r&rrrM�Function�
isfunctionr�s  rr4�ChildBrowserTreeItem.__init__�s$�����H�H��	�$�S�&�/�/�:��rc�V�URnUR(aSU-S-$SU-$)z1Return the name of the function/class to display.zdef z(...)zclass )rr�)r3rs  rrz�ChildBrowserTreeItem.GetText�s+���y�y���?�?��D�=�7�*�*��d�?�"rc�(�UR(agg)r}r~�folder)r�rgs rr� ChildBrowserTreeItem.GetIconName�s���?�?��rc�4�URR0:g$)z+Return True if self.obj has nested objects.)r&�childrenrgs rr��!ChildBrowserTreeItem.IsExpandable�s���x�x� � �B�&�&rc�~�[URR5Vs/sHn[U5PM sn$s snfr�)r*r&r�r�r�s  rr��ChildBrowserTreeItem.GetSubList�sA��.�d�h�h�.?�.?�@�B�@�C�%�S�)�@�B�	B��Bs�:c��[URR5nURURR5 g![
[4a gf=f)z2Open module with file_open and position to lineno.N)rLr&rw�gotoline�lineno�OSError�AttributeError)r3�edits  rr��"ChildBrowserTreeItem.OnDoubleClick�sD��	��T�X�X�]�]�+�D��M�M�$�(�(�/�/�*����(�	��	�s�AA�A�A)r�rr&N)rlrmrnrorpr4rzrr�r�r�rqrrrrr�r��s&���
;�#��'�B�
rr�c��[[R5S:�a[RSnO[n"SS[5nSn[XSS9 g)NrBc��\rSrSrSrSrg)�'_module_browser.<locals>.Nested_in_func�c��grrrrrrr�nested_in_class�7_module_browser.<locals>.Nested_in_func.nested_in_class�s��4rrrN)rlrmrnror�rqrrrr�Nested_in_funcr��s��'rr�c��"SS5ng)Nc��\rSrSrSrg)�;_module_browser.<locals>.closure.<locals>.Nested_in_closure�rrN)rlrmrnrorqrrrr�Nested_in_closurer��s��Trr�rr)r�s r�closure� _module_browser.<locals>.closure�s��)�)rT)r.)�lenr��argv�__file__rr,)�parentrwr�r�s    r�_module_browserr��s?��
�3�8�8�}�q���x�x��{����	(�X�	(�	*��&�t�,r�__main__rB)�mainzidlelib.idle_test.test_browser�F)�	verbosity�exit)�runr)rprrMr��idlelib.configr�idlelibr�idlelib.treerrr�idlelib.utilr�idlelib.windowr	rLrrr*r,rjr�r�rlr�r��unittestr��idlelib.idle_test.htestr�rrrr�<module>r�s����
�
�
�#��;�;�&�)�
�	�"+��N��@J0�J0�Z1.�H�1.�h*�8�*�Z
-��z��
�3�8�8�}���!��
-���G�+����
r