Ë ”�Ãîœò½ãó4—dZddlZddlZddlZddlmZddlmZddlm Z m Z m Z ddl m Z ddlmZdadZd „Zdd „ZGd „d «ZGd „de «ZGd„de «Zd„Zedk(r5eej4«dk(rddlmZeddd¬«ddlmZee«yy)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ó¨—tjj|«\}}tjj|«}|tvxr|t vS©N)ÚosÚpathÚsplitextÚnormcaserÚbrowseable_extension_blocklist)r Ú_Úexts ú&/usr/lib/python3.12/idlelib/browser.pyÚis_browseable_extensionrsD€Ü �W‰W× Ñ ˜dÓ #�F€A€sÜ �'‰'× Ñ ˜3Ó €CØ ”-Ð Ò M CÔ/MÐ$MÐMócó—g}|j«D]ï\}}|�|j|k(sŒt|d«r»|jr¯|j|k(r g}|jD]\}t |t «r|}n6|j}|j|jk7r|j›d|›�}|j|«Œ^|xjdjdj|««z c_|j|«Œñ|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. Ú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™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ó8—eZdZdZdddœd„Zd d„Zd„Zd„Zd „Zy) Ú ModuleBrowserz1Browse module classes and functions in IDLE. F)Ú_htestÚ_utestcó\—||_||_||_||_|j «y)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__Js)€ð$ˆŒ ؈Œ ؈Œ ؈Œ Ø � ‰ � rNcól—|jj«|jj«y)z&Dismiss the window and the tree nodes.N)ÚtopÚdestroyÚnode)r2Úevents rÚclosezModuleBrowser.closebs"€à �‰×ÑÔØ � ‰ ×ÑÕrcó¨—|j}|js|jstjntj |«}|j atjj«t|«x|_ }|jd|j«|jd|j«|jr5|j!d|j#«|j%«dzfz«|j'«|j)«t+j,«}t+j.|d«d}t1||dd¬ «}|j2j5dd ¬ «|j7«}t9|j:d |«x|_}|js!|j?«|jA«y y ) z3Create browser tkinter widgets, including the tree.ÚWM_DELETE_WINDOWzz+%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`€ð�{‰{ˆØ'+§{¢{°d·k²k”—’Ü×-Ñ-¨dÓ3ð à—J‘Jˆ Ü�‰×ÑÔô(¨Ó-Ð-ˆŒ�3Ø � ‰ Ð'¨¯©Ô4Ø �‰�˜TŸZ™ZÔ(Ø �;Š;Ø �L‰L˜Ø×!Ñ!Ó# T×%5Ñ%5Ó%7¸#Ñ%=Ð>ñ?ô @à � ‰ ŒØ � ‰ Œô×%Ñ%Ó'ˆÜ×*Ñ*¨5°(Ó;¸LÑIˆ Ü ˜C JÀ1Ø&'ô)ˆà �‰� ‰ ˜Q Vˆ Ô,Ø�}‰}‹ˆÜ# B§I¡I¨t°TÓ:Ð:ˆŒ �DØ�{Š{Ø �K‰KŒMØ �K‰K�MðrcóÄ—|jjdtjj |j«z«|jj d«y)zSet the window title.zModule Browser - zModule BrowserN)r5Úwm_titler r ÚbasenameÚ wm_iconname©r2s rrRzModuleBrowser.settitle†s@€à �‰×ÑÐ-´·±×0@Ñ0@ÀÇÁÓ0KÑKÔLØ �‰×ÑÐ-Õ.rcó,—t|j«S)z7Return a ModuleBrowserTreeItem as the root of the tree.)ÚModuleBrowserTreeItemr rcs rrXzModuleBrowser.rootnode‹s€ä$ T§Y¡YÓ/Ð/rr ) Ú__name__Ú __module__Ú __qualname__Ú__doc__r3r9r1rRrX©rrr,r,Cs'„ñð 05¸Uôó0ò ò>/ó 0rr,có:—eZdZdZd„Zd„Zd„Zd„Zd„Zd„Z d„Z y ) rez~Browser tree for Python module. Uses TreeItem as the basis for the structure of the tree. Used by both browsers. có—||_y)zdCreate a TreeItem for the file. Args: file: Full path and module name. N)Úfile)r2rms rr3zModuleBrowserTreeItem.__init__—s €ð ˆ� rcóT—tjj|j«S)z5Return the module name as the text string to display.)r r rarmrcs rÚGetTextzModuleBrowserTreeItem.GetTextŸs€ä�w‰w×Ñ § ¡ Ó*Ð*rcó—y)ú'Return the name of the icon to display.Úpythonrjrcs rÚ GetIconNamez!ModuleBrowserTreeItem.GetIconName£s€àrcóZ—|j«D�cgc] }t|«‘Œc}Scc}w©z*Return ChildBrowserTreeItems for children.)Ú listchildrenÚChildBrowserTreeItem©r2r&s rÚ GetSubListz ModuleBrowserTreeItem.GetSubList§s+€à59×5FÑ5FÔ5HÓIÑ5H¨cÔ$ SÕ)Ð5HÑIÐIùÒIs“(có®—t|j«sytjj |j«syt |j«y)z6Open a module in an editor window when double clicked.N)rrmr r ÚexistsrIrcs rÚ OnDoubleClickz#ModuleBrowserTreeItem.OnDoubleClick«s4€ä& t§y¡yÔ1Ø Ü�w‰w�~‰~˜dŸi™iÔ(Ø Ü�$—)‘)Õrcó,—t|j«S)zReturn True if Python file.)rrmrcs rÚ IsExpandablez"ModuleBrowserTreeItem.IsExpandable³s€ä& t§y¡yÓ1Ð1rcóX—t|j«sgStjj |j«\}}tjj |«\}} t j||gtjz«}t||«S#t$rgcYSwxYw)z5Return sequenced classes and functions in the module.) rrmr r ÚsplitrrJÚ readmodule_exÚsysÚ ImportErrorr*)r2ÚdirÚbaserrÚtrees rrvz"ModuleBrowserTreeItem.listchildren·sŒ€ä& t§y¡yÔ1؈IÜ—G‘G—M‘M $§)¡)Ó,‰ ˆˆTÜ—'‘'×"Ñ" 4Ó(‰ˆˆað Ü×'Ñ'¨¨s¨e´c·h±hÑ.>Ó?ˆDô" $¨Ó-Ð-øôò ØŠIð úsÁ'(B B)Â(B)N) rfrgrhrir3rorsryr|r~rvrjrrrere�s+„ñò ò+òòJòò2ó .rrecó4—eZdZdZd„Zd„Zd„Zd„Zd„Zd„Z y) rwzsBrowser tree for child nodes within the module. Uses TreeItem as the basis for the structure of the tree. cór—||_|j|_t|tj«|_y)z5Create a TreeItem for a pyclbr class/function object.N)r&rrrJÚFunctionÚ isfunctionrxs rr3zChildBrowserTreeItem.__init__Ês&€àˆŒØ—H‘HˆŒ Ü$ S¬&¯/©/Ó:ˆ�rcóL—|j}|jrd|zdzSd|zS)z1Return the name of the function/class to display.zdef z(...)zclass )rrŠ)r2rs rrozChildBrowserTreeItem.GetTextÐs+€à�y‰yˆØ �?Š?ؘD‘= 7Ñ*Ð *à˜d‘?Ð "rcó—|jryy)rqrrÚfolder)rŠrcs rrsz ChildBrowserTreeItem.GetIconNameØs€à �?Š?Øàrcó4—|jjik7S)z+Return True if self.obj has nested objects.)r&Úchildrenrcs rr~z!ChildBrowserTreeItem.IsExpandableßs€à�x‰x× Ñ  BÑ&Ð&rcóx—t|jj«D�cgc] }t|«‘Œc}Scc}wru)r*r&r�rwrxs rryzChildBrowserTreeItem.GetSubListãsA€ô.¨d¯h©h×.?Ñ.?Ô@óBÙ@�Cô% SÕ)Ø@ñBð BùòBs¢7có¸— t|jj«}|j|jj«y#t t f$rYywxYw)z2Open module with file_open and position to lineno.N)rIr&rmÚgotolineÚlinenoÚOSErrorÚAttributeError)r2Úedits rr|z"ChildBrowserTreeItem.OnDoubleClickèsD€ð ܘTŸX™XŸ]™]Ó+ˆDØ �M‰M˜$Ÿ(™(Ÿ/™/Õ *øÜœÐ(ò Ù ð ús‚AAÁAÁAN) rfrgrhrir3rorsr~ryr|rjrrrwrwÄs&„ñò ;ò #òò'òBó rrwcó°—ttj«dkDrtjd}nt}Gd„dt«}d„}t ||d¬«y)Nr?có—eZdZd„Zy)ú'_module_browser..Nested_in_funccó—yr rjrjrrÚnested_in_classz7_module_browser..Nested_in_func.nested_in_classøs€ 4rN)rfrgrhr›rjrrÚNested_in_funcr™÷s„Û 'rrœcó—Gd„d«}y)Ncó —eZdZy)ú;_module_browser..closure..Nested_in_closureN)rfrgrhrjrrÚNested_in_closurerŸús…rr rj)r s rÚclosurez _module_browser..closureùs€ß )Ò )rT)r-)Úlenr‚ÚargvÚ__file__rr,)Úparentrmrœr¡s rÚ_module_browserr¦ñsA€Ü Œ3�8‰8ƒ}�qÒÜ�x‰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,rerwr¦rfr¢r£Úunittestr¨Úidlelib.idle_test.htestr¬rjrrÚr´s¨ðñó Û Û å#Ýß;Ñ;Ý&Ý)ð € ð"+ÐòNó ÷@J0ñJ0ôZ1.˜Hô1.ôh*˜8ô*òZ -ð ˆzÒÙ ˆ3�8‰8ƒ}˜ÒÝ!Ù Ð -¸ÀÕGå+ÙˆÕð r