python (3.11.7)

(root)/
lib/
python3.11/
idlelib/
__pycache__/
grep.cpython-311.opt-1.pyc

efdZddlZddlZddlZddlmZmZddlmZddl	m
Z
ddlmZddZ
dZd	ZGd
de
ZdZed
kr'ddlmZedddddlmZeedSdS)zGrep dialog for Find in Files functionality.

   Inherits from SearchDialogBase for GUI and uses searchengine
   to prepare search pattern.
N)	StringVar
BooleanVar)Checkbutton)SearchDialogBase)searchenginec
|}tj|}t|dst	||||_|j}|dd}||||dS)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       @/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/idlelib/grep.pygreprs~::<<D

d
#
#F6=))='fe<<

F88K44L
KKlB'''''c$t|dS)zHandle os.walk error.N)print)msgs r
walk_errorr+s	#JJJJJrc#Ktj|tD] \}}fd|DEd{V|sdS!dS)zGenerate file names in dir that match pattern.

    Args:
        folder: Root directory to search.
        pattern: File pattern to match.
        recursive: True to include subdirectories.
    )onerrorc3K|]9}tj|tj|V:dSN)fnmatchospathjoin).0namedirpathpatterns  r	<genexpr>zfindfiles.<locals>.<genexpr>9sX77tW557BGLL$//777777rN)r"walkr)folderr(	recursive_	filenamesr's `   @r	findfilesr/0s"$!D!D!DI77777 )777	7	7	7	7	7	7	7	EE		rcVeZdZdZdZdZdZfdZd
dZdZ	d	Z
d
Zd
dZdZ
xZS)r
z$Dialog for searching multiple files.zFind in Files DialogGreprct||||_t||_t||_dS)a-Create 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    rr4zGrepDialog.__init__GsF	v&&&
  &&rNcTtj||||r
|jpd}nd}tj|\}}tj|\}}|sd}|jtj	|d|zdS)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#splitsplitextr5setr$)	r7rrrr#dirbaseheadtails	         rrzGrepDialog.openZs	dD,777
	;$"DDDGMM$''	TW%%d++
d	Dc3:6677777rcztj||d|jd|_dS)z9Create base entry widgets and add widget for search path.z	In files:rN)rcreate_entries
make_entryr5globentr7s rrEzGrepDialog.create_entriesps3'---{DLAA!Drct|d|jd}|dddS)z0Add check button to recurse down subdirectories.rzRecurse down subdirectories)variablertopboth)sidefillN)r
make_framer6pack)r7btns  rcreate_other_buttonszGrepDialog.create_other_buttonsusM!!!$t{2444	e&)))))rchtj||d|jddS)z<Create base command buttons and add button for Search Files.zSearch FilesT)isdefN)rcreate_command_buttonsmake_buttondefault_commandrHs rrUz!GrepDialog.create_command_buttons|s7/555)=TJJJJJrcl|j}|sdS|j}|s|jdSddlm}tj	}	||j
t_	||||t_	dS#|t_	wxYw)a
Grep for search pattern in file path. The default command is bound
        to <Return>.

        If entry values are populated, set OutputWindow as stdout
        and perform search.  The search dialog is closed automatically
        when the search begins.
        Nr)OutputWindow)rgetprogr5rrKbellidlelib.outwinrYsysstdoutrgrep_it)r7eventprogr#rYsaves      rrWzGrepDialog.default_commands{""$$	F|!!	HMMOOOF//////z	%dj11CJLLt$$$CJJJCJs'0B%%B3c8tj|\}}|stj}t	t|||j}||j	
}td|d|dd}	|D]}	t|d5}	t|	dD]_\}
}|dd	d
kr
|d	d}||r-tj|d|
d|d
|dz
}`	d	d	d	n#1swxYwY#t$$r}t|Yd	}~d	}~wwxYwt|rd|d
ndd	S#t&$rYd	SwxYw)aSearch 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=curdirsortedr/r6rclosergetpatrr	enumeratesearchr]r^writeOSErrorAttributeError)
r7rar#r+filepatfilelistpathitsfnflinenoliners
             rr_zGrepDialog.grep_its4'----	YF)FGT[__5F5FGGHH

k  ""
0300d000111	



	b333*q,5aOO**LFD#BCCyD00'+CRCy#{{400* #
 0 0B1L1L&1L1LD1L1L1L M M M $	****************#JJJJJJJJ*OOOOO)
+
+
+
+
+			
DD	sa,F1EA1E4EE	EE	EF
E/E*%F*E//F
FFr )__name__
__module____qualname____doc__titleiconneedwrapbuttonr4rrErRrUrWr_
__classcell__)r8s@rr
r
@s**"EDN'''''&8888,EEE
***KKK
.%%%%%%%rr
cZ
ddlm}m}m
m}ddlm}m}ddlm	}||}|
dtt|
ddd\}}	|
d|d|	dz||||}
|
||
d	
dd
fd
}||
d|}|dS)Nr)ToplevelTextSELEND)FrameButton)PyShellFileListzTest GrepDialog+rf)height1.0zimport grepcddtdddS)Nrz1.end)r)tag_addr
tag_remove)rrrsrshow_grep_dialogz&_grep_dialog.<locals>.show_grep_dialogsHS%)))TUG,,,,,rzShow GrepDialog)rcommand)tkinterrrrrtkinter.ttkrridlelib.pyshellrr~mapintgeometryr=rPinsert)parentrrrrrrrKxyframerbuttonrrrs             @@@r_grep_dialogrs|000000000000))))))))//////
(6

CII   sFOO%%++C00455DAqLL"Q""S""###OC  EE#JJE	JJLLL4a   DIIKKKKK}%%%-------
VE 1;K
L
L
LF
KKMMMMMr__main__)mainzidlelib.idle_test.test_grepF)	verbosityexit)run)NN)r}r!r"r]rrrrridlelib.searchbaseridlelibrrrr/r
rrzunittestridlelib.idle_test.htestrrr<module>rsV
				



))))))))######//////      ((((.



 }}}}}!}}}@4zD	&!%@@@@++++++Cr