a Z^y @sddlZddlZddlZddlmZmZddlmZGdddeZ GdddeZ Gdd d eZ d d Z e d krdd lmZeddddddlmZee dS)N) ModuleBrowserModuleBrowserTreeItem)TreeItemc@s,eZdZdddddZddZddZd S) PathBrowserF)_htest_utestcCs||_||_||_|dSN)masterrrinit)selfr rrr +/usr/lib64/python3.9/idlelib/pathbrowser.py__init__ szPathBrowser.__init__cCs|jd|jddS)Nz Path Browser)topZwm_titleZ wm_iconnamer r r r settitles zPathBrowser.settitlecCstSr)PathBrowserTreeItemrr r r rootnodeszPathBrowser.rootnodeN)__name__ __module__ __qualname__rrrr r r r r s rc@seZdZddZddZdS)rcCsdS)Nzsys.pathr rr r r GetTextszPathBrowserTreeItem.GetTextcCs&g}tjD]}t|}||q |Sr)syspathDirBrowserTreeItemappend)r sublistdiritemr r r GetSubList"s   zPathBrowserTreeItem.GetSubListN)rrrrrr r r r rsrc@s8eZdZgfddZddZddZddZd d Zd S) rcCs||_||_dSr)rpackages)r rr r r r r,szDirBrowserTreeItem.__init__cCs|js |jS|jddSdS)Nz : package)r rrr r r r0szDirBrowserTreeItem.GetTextcCszt|jptj}Wnty,gYS0g}|D]:}tj|j|}||r6tj|}| |||fq6| g}|D]&\}}}t ||j |g}| |q| |D]&\}}ttj|j|}| |q|Sr)oslistdirrcurdirOSErrorrjoin ispackagedirnormcasersortrr listmodulesr)r namesr namefilennrrr r r r6s&      zDirBrowserTreeItem.GetSubListcCs*tj|sdStj|d}tj|S)NFz __init__.py)r"risdirr&exists)r r-r r r r r'Ks zDirBrowserTreeItem.ispackagedirc Csi}tjjdd}|tjj7}|tjj7}g}|D]p}t| }|ddD]T}tj|}||d|krN|d|} | |vrNd|| <| ||f| |qNq4| |Sr) importlib machineryEXTENSION_SUFFIXESSOURCE_SUFFIXESBYTECODE_SUFFIXESlenr"rr(rremover)) r ZallnamesmodulessuffixessortedZsuffir,Z normed_namemod_namer r r r*Rs"     zDirBrowserTreeItem.listmodulesN)rrrrrrr'r*r r r r r*s  rcCst|dd|dS)NT)r)rZmainloop)parentr r r _path_browserfs r>__main__)mainz"idlelib.idle_test.test_pathbrowserF) verbosityexit)run)importlib.machineryr1r"rZidlelib.browserrrZ idlelib.treerrrrr>rZunittestr@Zidlelib.idle_test.htestrDr r r r s  <