Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.9/idlelib/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.9/idlelib/__pycache__/grep.cpython-39.opt-2.pyc

a

��g7�@s�ddlZddlZddlZddlmZmZddlmZddlm	Z	ddl
mZddd�Zdd	�Z
d
d�ZGdd
�d
e	�Zdd�Zedkr�ddlmZedddd�ddlmZee�dS)�N)�	StringVar�
BooleanVar)�Checkbutton)�SearchDialogBase)�searchenginecCsN|��}t�|�}t|d�s*t|||�|_|j}|�dd�}|�|||�dS)N�_grepdialogz	sel.firstzsel.last)�_rootr�get�hasattr�
GrepDialogr�open)�text�io�flist�root�engineZdialog�searchphrase�r�(/usr/local/lib/python3.9/idlelib/grep.py�greps

rcCst|�dS�N)�print)�msgrrr�
walk_error+src#s@tj|td�D],\�}}��fdd�|D�EdH|sq<qdS)N)�onerrorc3s(|] }t�|��rtj��|�VqdSr)�fnmatch�os�path�join)�.0�name��dirpath�patternrr�	<genexpr>9s�zfindfiles.<locals>.<genexpr>)r�walkr)�folderr#�	recursive�_�	filenamesrr!r�	findfiles0s�r*cs\eZdZdZdZdZ�fdd�Zddd�Zd	d
�Zdd�Z	d
d�Z
ddd�Zdd�Z�Z
S)rzFind in Files DialogZGreprcs,t��||�||_t|�|_t|�|_dSr)�super�__init__rr�globvarr�recvar)�selfrrr��	__class__rrr,Gs
zGrepDialog.__init__Nc	Csht�|||�|r|jpd}nd}tj�|�\}}tj�|�\}}|sJd}|j�tj�	|d|��dS)N�z.py�*)
rr�filenamerr�split�splitextr-�setr)	r/r
rrr�dir�base�head�tailrrrrZszGrepDialog.opencCs"t�|�|�d|j�d|_dS)Nz	In files:r)r�create_entriesZ
make_entryr-Zglobent�r/rrrr<ps
zGrepDialog.create_entriescCs*t|��d|jdd�}|jddd�dS)NrzRecurse down subdirectories)�variabler
�topZboth)Zside�fill)rZ
make_framer.�pack)r/Zbtnrrr�create_other_buttonsus
�zGrepDialog.create_other_buttonscCs t�|�|jd|jdd�dS)NzSearch FilesT)Zisdef)r�create_command_buttonsZmake_button�default_commandr=rrrrC|s
z!GrepDialog.create_command_buttonscCsp|j��}|sdS|j��}|s.|j��dSddlm}tj	}z"||j
�t_	|�||�W|t_	n|t_	0dS)Nr)�OutputWindow)rZgetprogr-r	r?ZbellZidlelib.outwinrE�sys�stdoutr�grep_it)r/�event�progrrE�saverrrrD�s


zGrepDialog.default_commandc
Cs^tj�|�\}}|stj}tt|||j����}|��|j	�
�}td|�d|�d��d}z�|D]�}z�t|dd��p}	t
|	d�D]T\}
}|dd�d	kr�|dd�}|�|�r�tj�|�d
|
�d
|�d	��|d7}q�Wd�n1s�0YWqbt�y$}zt|�WYd}~qbd}~00qbt|�r<d|�d�nd
�Wnt�yXYn0dS)Nz
Searching z in z ...r�replace)�errors�����
z: zHits found: z'
(Hint: right-click to open locations.)zNo hits.)rrr5�curdir�sortedr*r.r	�closerZgetpatrr�	enumerate�searchrFrG�write�OSError�AttributeError)
r/rJrr&ZfilepatZfilelist�pat�hits�fn�f�lineno�linerrrrrH�s6

, ��zGrepDialog.grep_it)N)N)�__name__�
__module__�__qualname__�titleZiconZneedwrapbuttonr,rr<rBrCrDrH�
__classcell__rrr0rr@s

rcs�ddlm}m}m�m�ddlm}m}ddlm	}||�}|�
d�tt|�
��d�dd��\}}|�
d|�d|d���||��||�}	|	��||	d	d
���������fdd�}
||	d
|
d�}|��dS)Nr)�Toplevel�Text�SEL�END)�Frame�Button)�PyShellFileListzTest GrepDialog�+rN��)Zheightcs,���d��t��d����d��dS)Nz1.0)r)Ztag_addrZ
tag_remover�rgrfrr
rr�show_grep_dialog�sz&_grep_dialog.<locals>.show_grep_dialogzShow GrepDialog)r
Zcommand)�tkinterrdrerfrg�tkinter.ttkrhriZidlelib.pyshellrjrb�map�intZgeometryr5rA)�parentrdrerhrirjr?�x�y�frameroZbuttonrrnr�_grep_dialog�s
 rx�__main__)�mainzidlelib.idle_test.test_grep�F)�	verbosity�exit)�run)NN)rrrFrprrrqrZidlelib.searchbaserZidlelibrrrr*rrxr_ZunittestrzZidlelib.idle_test.htestr~rrrr�<module>s"


Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists