eaSrSSKrSSKrSSKrSSKJrJr SSKJr SSK J r SSK J r SSjr SrS r"S S \ 5rS r\S :XaSSKJr \"SSSS9 SSKJr \"\5 gg)zGrep dialog for Find in Files functionality. Inherits from SearchDialogBase for GUI and uses searchengine to prepare search pattern. N) StringVar BooleanVar) Checkbutton)SearchDialogBase) searchenginecUR5n[R"U5n[US5(d[ X4U5UlUR nURSS5nUR XU5 g)aOpen the Find in Files dialog. Module-level function to access the singleton GrepDialog instance and open the dialog. If text is selected, it is used as the search phrase; otherwise, the previous entry is used. Args: text: Text widget that contains the selected text for default search phrase. io: iomenu.IOBinding instance with default path to search. flist: filelist.FileList instance for OutputWindow parent. _grepdialogz sel.firstzsel.lastN)_rootrgethasattr GrepDialogr open)textioflistrootenginedialog searchphrases 2/opt/imh/python3.13/lib/python3.13/idlelib/grep.pygreprsd ::# UHCn[R"UT5(dM![RRTU5v ME g7fN)fnmatchospathjoin).0namedirpathpatterns r findfiles..9s:7 )tW50BGGLL$// )s A'AN)r"walkr)folderr( recursive_ filenamesr's ` @r findfilesr00sI"$!D7 )7 7 7y  "E 7s0A A A A cd^\rSrSrSrSrSrSrU4SjrSSjr Sr S r S r SS jr S rS rU=r$)r @z$Dialog for searching multiple files.zFind in Files DialogGreprcp>[TU]X5 X0l[U5Ul[ U5Ulg)aCreate search dialog for searching for a phrase in the file system. Uses SearchDialogBase as the basis for the GUI and a searchengine instance to prepare the search. Attributes: flist: filelist.Filelist instance for OutputWindow parent. globvar: String value of Entry widget for path to search. globent: Entry widget for globvar. Created in create_entries(). recvar: Boolean value of Checkbutton widget for traversing through subdirectories. N)super__init__rrglobvarrrecvar)selfrrr __class__s rr6GrepDialog.__init__Gs. &    & rc~[R"XU5 U(aUR=(d SnOSn[RR U5upV[RR U5upxU(dSnURR[RRUSU-55 g)a'Make dialog visible on top of others and ready to use. Extend the SearchDialogBase open() to set the initial value for globvar. Args: text: Multicall object containing the text information. searchphrase: String phrase to search. io: iomenu.IOBinding instance containing file path. z.py*N) rrfilenamer"r#splitsplitextr7setr$) r9rrrr#dirbaseheadtails rrGrepDialog.openZs d,7 ;;$"DDGGMM$' WW%%d+ D c3:67rcx[R"U5 URSUR5SUlg)z9Create base entry widgets and add widget for search path.z In files:rN)rcreate_entries make_entryr7globentr9s rrIGrepDialog.create_entriesps+''-{DLLA!D rcp[UR5SURSS9nURSSS9 g)z0Add check button to recurse down subdirectories.rzRecurse down subdirectories)variablertopboth)sidefillN)r make_framer8pack)r9btns rcreate_other_buttonsGrepDialog.create_other_buttonsus6!!$t{{24 e&)rcf[R"U5 URSURSS9 g)z. If entry values are populated, set OutputWindow as stdout and perform search. The search dialog is closed automatically when the search begins. Nr) OutputWindow) rgetprogr7r rPbellidlelib.outwinr`sysstdoutrgrep_it)r9eventprogr#r`saves rr]GrepDialog.default_commands}{{""$ ||! HHMMO /zz %djj1CJ LL $CJCJs 6,B.. B;c [RRU5up4U(d[Rn[ [ X4UR R555nUR5 URR5n[SU<SUS35 SnUHn[USS9n [U S5HXupU SS S :XaU S Sn URU 5(dM+[R R#US U S U S 35 US- nMZ S S S 5 M [U(aS US 3OS5 g !,(df  M=f![$an [U 5 S n A MS n A ff=f![&a g f=f)afSearch for prog within the lines of the files in path. For the each file in the path directory, open the file and search each line for the matching pattern. If the pattern is found, write the file and line information to stdout (which is an OutputWindow). Args: prog: The compiled, cooked search pattern. path: String containing the search path. z Searching z in z ...rreplace)errorsN z: z Hits found: z' (Hint: right-click to open locations.)zNo hits.)r"r#r@curdirsortedr0r8r closergetpatrr enumeratesearchrdrewriteOSErrorAttributeError) r9rhr#r,filepatfilelistpathitsfnflinenoliners rrfGrepDialog.grep_its^''---YYF)FT[[__5FGH kk  " 3'dV401  b3q,5aOLF#BCyD0'+CRy#{{400 # 0 0B4r&D61L M $  -<43 !&NO) +43#JJ   sf&E9, E64E.1EE'E9 E EE9E E6 E1+E91E66E99 FF)rrKr7r8r )__name__ __module__ __qualname____firstlineno____doc__titleiconneedwrapbuttonr6rrIrWr[r]rf__static_attributes__ __classcell__)r:s@rr r @s?* "E DN'&8,E *K .%%rr c^ ^ ^SSKJnJnJm SSKJnJn SSKJn U"U5nURS5 [[UR5RS5SS5upxURSUSUS-35 U"U5m U"U5n U R5 U"U S S 9mTR5 TRS S 5 U U U4S jn U"U SU S9n U R5 g)Nr)ToplevelTextSEL)FrameButton)PyShellFileListzTest GrepDialog+rn)height1.0z import grepcf>TRTSS5 [TTS9 TRTSS5 g)Nrz1.end)r)tag_addr tag_remove)rrrsrshow_grep_dialog&_grep_dialog..show_grep_dialogs- S%) T UG,rzShow GrepDialog)rcommand)tkinterrrr tkinter.ttkrridlelib.pyshellrrmapintgeometryr@rUinsert)parentrrrrrrPxyframerbuttonrrrs @@@r _grep_dialogrs++)/ 6 CII sFOO%++C04 5DALL1QCqS "# C E #JE JJL a DIIKKK}%- E 1;K LF KKMr__main__)mainzidlelib.idle_test.test_grepF) verbosityexit)run)NN)rr!r"rdrrrrridlelib.searchbaseridlelibrrrr0r rrunittestridlelib.idle_test.htestrrrrso  )#/ (.  }!}@4 z &!%@+  r