AlkantarClanX12

Your IP : 18.224.69.176


Current Path : /proc/self/root/usr/lib/python3.6/site-packages/dnf/cli/commands/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib/python3.6/site-packages/dnf/cli/commands/__pycache__/search.cpython-36.pyc

3

�ft`��@s�ddlmZddlmZddlmZddlZddlmZddlmZddl	m
Z
mZmZddl	Z
ddlZ
ddlZ
ddlZddlZejd�ZGd	d
�d
ej�ZdS)�)�absolute_import)�print_function)�unicode_literalsN)�commands)�OptionParser)�ucd�_�C_�dnfc@sPeZdZdZdZed�Zedd��Zdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dS)�
SearchCommandzTA class containing methods needed by the cli to execute the
    search command.
    �search�sez+search package details for the given stringc	Cs<|jddtd�d�|jddtd�dgdtjtd	�d
�dS)Nz--all�
store_truez'search also package description and URL)�action�help�query_string�+ZKEYWORD�allzKeyword to search for)�nargs�metavar�choices�defaultrr)�add_argumentrrZPkgNarrowCallback)�parser�r�/usr/lib/python3.6/search.py�
set_argparser0szSearchCommand.set_argparsercs4tjdtdd�fdtdd�fdtdd�fdtd	�ff���fd
d����fdd
�}tjj�}x(|D] }�j|d|��j|d|�qbW�jj	r�xd|D] }�j|d|��j|d|�q�Wn:t
|�}t|j��}x$|D]}t
|j
|��|kr�||=q�Wd}d}	d}
d}d}�jjj�s0�jjj�j|j�d�j�}t�}
x�|jd|d�D]�}�jjj�s~|j|j|
k�rl�qF|
j|j|j�||j|�k�r�|j|�}d}|	|j
|�k�r�|j
|�}	d}|
|j|�|	kk�r�|j|�|	k}
d}|�r�||
||	�d}�jjj||j|�|��qFWt
|�dk�r0tjtd��dS)z0Search for simple text tags in a package object.�nameZlong�Name�summaryZSummary�descriptionZDescriptionZurlZURLc	sy�|S|SdS)Nr)�attr)�	TRANS_TBLrr�_translate_attrCsz.SearchCommand._search.<locals>._translate_attrcs^t�|�}td�j|�}|r*td�|}ntd�|}�jjj|dj|��}tt|��dS)Nz & z%s Exactly Matched: %%sz%s Matched: %%sz, )�mapr�join�base�outputZ
fmtSection�printr)�exact_matchZattrs�keysZtrans_attrsZtrans_attrs_strZsection_textZ	formatted)r#�selfrr�_print_section_headerIs
z4SearchCommand._search.<locals>._print_section_headerNF)�pkgT)�reverseZlimit_torzNo matches found.) �collections�OrderedDictr	rr
Z
match_counterZMatchCounter�_search_counted�optsr�len�listr*�matched_needlesr&ZconfZshowdupesfromrepos�sack�query�filtermZlatest�set�sortedrZarch�addZmatched_keysZmatched_haystacksr'Z
matchcallback�logger�info)r+�argsr,�counter�argZneedlesZpkgsr-Z
used_attrsr5r)Zprint_section_header�limit�seenr)r"r#r+r�_search9s`






zSearchCommand._searchcCs`d||i}tjj|�r$d||i}|jjj�jtjf|�}x|j	�D]}|j
|||�qFW|S)Nz
%s__substrz%s__glob)r
�utilZis_glob_patternr&r6r7r8�hawkeyZICASE�runr;)r+r?r!ZneedleZfdict�qr-rrrr1�szSearchCommand._search_countedcCs |jjs|jjtjtjd�dS)N)�stdout�stderr)r2�quiet�cliZredirect_logger�loggingZWARNING�INFO)r+rrr�
pre_configure�szSearchCommand.pre_configurecCsD|jjs|jj�|jj}d|_d|_d|_|jjp:|jj	|j_dS)NTF)
r2rJrKZredirect_repo_progress�demandsZavailable_reposZfresh_metadataZsack_activationrZquery_string_action)r+rOrrr�	configure�s
zSearchCommand.configurecCstjtd��|j|jj�S)NzSearching Packages: )r<�debugrrCr2r)r+rrrrF�szSearchCommand.runN)rr
)�__name__�
__module__�__qualname__�__doc__�aliasesrr�staticmethodrrCr1rNrPrFrrrrr(s	O		r)Z
__future__rrrr/Zdnf.clirZdnf.cli.option_parserrZdnf.i18nrrr	r
Zdnf.match_counterZdnf.utilrErLZ	getLoggerr<ZCommandrrrrr�<module>s