e!4SrSSKrSSKrSSKrSSKJr SSKJr SSKJ r J r J r SSK J r SSKJr SqSrS rSS jr"S S 5r"S S\ 5r"SS\ 5rSr\S:Xa3\"\R45S:XaSSKJr \"SSSS9 SSKJr \"\5 gg)zModule 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)TreeNodeTreeItemScrolledCanvas) py_extensions)ListedToplevel)z.pyic[RRU5up[RRU5nU[;=(a U[ ;$N)ospathsplitextnormcaserbrowseable_extension_blocklist)r _exts 5/opt/imh/python3.13/lib/python3.13/idlelib/browser.pyis_browseable_extensionrsB WW  d #FA ''  3 C -  MC/M$MMc@/nUR5GHup4UbURU:XdM[US5(aUR(aURU:Xa/nURHcn[ U[ 5(aUnO7URnURUR:waURSU3nURU5 Me U=RSRSRU55- slURU5 GM U$)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. super.z({})z, ) itemsmodulehasattrrname isinstancestrappendformatjoin) child_dictmodnameobskeyobjsuperssupsnames rtransform_childrenr*#s C$$& ?cjjG3sG$$sxx399C!#s++ # #::3'*zzl!E7$;EMM%(%FMM$))F*;<< JJsO' JrcD\rSrSrSrSSS.SjrS SjrSrS rS r S r g) ModuleBrowserCz1Browse module classes and functions in IDLE. F)_htest_utestcTXlX 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!$     rNclURR5 URR5 g)z&Dismiss the window and the tree nodes.N)topdestroynode)r3events rcloseModuleBrowser.closebs"  rcURnUR(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 S 9 UR75n[9UR:S U5=UlnUR(d!UR?5 URA5 g g ) z3Create browser tkinter widgets, including the tree.WM_DELETE_WINDOWzz+%d+%dnormal backgroundr)bghighlightthickness takefocusboth)expandfillN)!r1r.r/rflistPyShellFileListopen file_openpyclbr_modulesclearr r7protocolr;bindgeometry winfo_rootx winfo_rootysettitle focus_setr CurrentTheme GetHighlightrframepackrootnodercanvasr9updaterG) r3rootrIr7themerAscitemr9s rr2ModuleBrowser.initgs^{{'+{{dkk--d3 JJ (--3 '4 TZZ( ;; LL!!#T%5%5%7#%=>? @  %%'**5(;LI C1&')  QV ,}}#BIItT:: D{{ KKM KKMrcURRS[RR UR5-5 URR S5 g)zSet the window title.zModule Browser - zModule BrowserN)r7wm_titler r basename wm_iconnamer3s rrUModuleBrowser.settitles@ -0@0@0KKL -.rc,[UR5$)z7Return a ModuleBrowserTreeItem as the root of the tree.)ModuleBrowserTreeItemr rgs rr[ModuleBrowser.rootnodes$TYY//r)r.r/r1r9r r7r ) __name__ __module__ __qualname____firstlineno____doc__r4r;r2rUr[__static_attributes__rrr,r,Cs' 05U0 >/ 0rr,cB\rSrSrSrSrSrSrSrSr Sr S r S r g ) rjzrBrowser tree for Python module. Uses TreeItem as the basis for the structure of the tree. Used by both browsers. cXlg)zLCreate a TreeItem for the file. Args: file: Full path and module name. Nfile)r3rws rr4ModuleBrowserTreeItem.__init__s  rcT[RRUR5$)z5Return the module name as the text string to display.)r r rerwrgs rGetTextModuleBrowserTreeItem.GetTextsww **rcg)'Return the name of the icon to display.pythonrrrgs r GetIconName!ModuleBrowserTreeItem.GetIconNamesrc`UR5Vs/sHn[U5PM sn$s snfz*Return ChildBrowserTreeItems for children.) listchildrenChildBrowserTreeItemr3r&s r GetSubList ModuleBrowserTreeItem.GetSubLists+595F5F5HI5Hc$S)5HIIIs+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.OnDoubleClicks:&tyy11 ww~~dii(( $))rc,[UR5$)zReturn True if Python file.)rrwrgs r IsExpandable"ModuleBrowserTreeItem.IsExpandables&tyy11rc^[UR5(d/$[RR UR5up[RR U5up4[ R"X1/[R-5n[XS5$![a /s$f=f)z5Return sequenced classes and functions in the module.) rrwr r splitrrM readmodule_exsys ImportErrorr*)r3dirbaserrtrees rr"ModuleBrowserTreeItem.listchildrens&tyy11IGGMM$)), ''""4( ''echh.>?D"$-- I s*(B B,+B,rvN) rlrmrnrorpr4rzrrrrrrqrrrrrjrjs+ +J2 .rrjc<\rSrSrSrSrSrSrSrSr Sr S r g ) rzkBrowser tree for child nodes within the module. Uses TreeItem as the basis for the structure of the tree. cpXlURUl[U[R5Ulg)z5Create a TreeItem for a pyclbr class/function object.N)r&rrrMFunction isfunctionrs rr4ChildBrowserTreeItem.__init__s$HH $S&//:rcVURnUR(aSU-S-$SU-$)z1Return the name of the function/class to display.zdef z(...)zclass )rr)r3rs rrzChildBrowserTreeItem.GetTexts+yy ??D=7* *d? "rc(UR(agg)r}r~folder)rrgs rr ChildBrowserTreeItem.GetIconNames ??rc4URR0:g$)z+Return True if self.obj has nested objects.)r&childrenrgs rr!ChildBrowserTreeItem.IsExpandablesxx  B&&rc~[URR5Vs/sHn[U5PM sn$s snfr)r*r&rrrs rrChildBrowserTreeItem.GetSubListsA.dhh.?.?@B@C%S)@B BBs:c[URR5nURURR5 g![ [ 4a gf=f)z2Open module with file_open and position to lineno.N)rLr&rwgotolinelinenoOSErrorAttributeError)r3edits rr"ChildBrowserTreeItem.OnDoubleClicksD TXX]]+D MM$((// *(   sAAAA)rrr&N) rlrmrnrorpr4rzrrrrrqrrrrrrs& ; #'B rrc[[R5S:a[RSnO[n"SS[5nSn[ XSS9 g)NrBc\rSrSrSrSrg)'_module_browser..Nested_in_funccgr rrrrrrnested_in_class7_module_browser..Nested_in_func.nested_in_classs4rrrN)rlrmrnrorrqrrrrNested_in_funcrs 'rrc"SS5ng)Nc\rSrSrSrg);_module_browser..closure..Nested_in_closurerrN)rlrmrnrorqrrrrNested_in_closurersTrrrr)rs rclosure _module_browser..closures ) )rT)r.)lenrargv__file__rr,)parentrwrrs r_module_browserrs? 388}qxx{ (X ( *&t,r__main__rB)mainzidlelib.idle_test.test_browserF) verbosityexit)runr )rpr rMridlelib.configridlelibr idlelib.treerrr idlelib.utilridlelib.windowr rLrrr*r,rjrrrlrrunittestridlelib.idle_test.htestrrrrrrs #;;&)  "+N @J0J0Z1.H1.h*8*Z - z 388}! -G+ r