ok

Mini Shell

Direktori : /proc/self/root/lib/python3.6/site-packages/pip/commands/__pycache__/
Upload File :
Current File : //proc/self/root/lib/python3.6/site-packages/pip/commands/__pycache__/search.cpython-36.pyc

3

���^��@s�ddlmZddlZddlZddlZddlmZmZddlm	Z	ddl
mZddlm
Z
ddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZeje�ZGdd�de�Z dd�Z!ddd�Z"dd�Z#dS)�)�absolute_importN)�Command�SUCCESS)�OrderedDict)�PipXmlrpcTransport)�PyPI)�get_terminal_size)�
indent_log)�CommandError)�NO_MATCHES_FOUND)�parse)�
pkg_resources)�
xmlrpc_clientcs<eZdZdZdZdZdZ�fdd�Zdd�Zd	d
�Z	�Z
S)�
SearchCommandz@Search for PyPI packages whose name or summary contains <query>.�searchz
      %prog [options] <query>zSearch PyPI for packages.cs@tt|�j||�|jjddddtjdd�|jjd|j�dS)Nz-iz--index�indexZURLz3Base URL of Python Package Index (default %default))�dest�metavar�default�helpr)	�superr�__init__Zcmd_optsZ
add_optionrZpypi_url�parserZinsert_option_group)�self�args�kw)�	__class__��/usr/lib/python3.6/search.pyrszSearchCommand.__init__cCsT|std��|}|j||�}t|�}d}tjj�r<t�d}t||d�|rPtSt	S)Nz)Missing required argument (search query).r)�terminal_width)
r
r�transform_hits�sys�stdout�isattyr�
print_resultsrr)r�optionsr�queryZ	pypi_hits�hitsrrrr�run)s

zSearchCommand.runcCsH|j}|j|��.}t||�}tj||�}|j||d�d�}|SQRXdS)N)�name�summary�or)rZ_build_sessionrrZServerProxyr)rr&r%Z	index_urlZsessionZ	transportZpypir'rrrr9s
zSearchCommand.search)�__name__�
__module__�__qualname__�__doc__r)Zusager*rr(r�
__classcell__rr)rrrsrcCs�t�}xv|D]n}|d}|d}|d}||j�krH|||gd�||<q||dj|�|t||d�kr|||d<qWt|j��S)z�
    The list from pypi is really a list of versions. We want a list of
    packages with the list of versions stored inline. This converts the
    list from pypi into one we can use.
    r)r*�version)r)r*�versionsr2)r�keys�append�highest_version�list�values)r'Zpackages�hitr)r*r1rrrr Bs
r cCsT|sdS|dkr&tdd�|D��d}dd�tjD�}�x|D�]}|d}|dpVd}|jdd	g�d}|dk	r�||d}|dkr�tj||�}d
d|dj|�}d|d||f|f}	yvtj|	�||k�r2tj	|�}
t
��Ht|d�}|
j|k�rtjd|
j�ntjd|
j�tjd|�WdQRXWq>t
k
�rJYq>Xq>WdS)NcSs.g|]&}t|d�t|jddg�d��qS)r)r2�-����)�len�get)�.0r8rrr�
<listcomp>csz!print_results.<locals>.<listcomp>�cSsg|]
}|j�qSr)Zproject_name)r>�prrrr?gsr)r*�r2r9r:��
�
� �z	%-*s - %sz%s (%s)zINSTALLED: %s (latest)z
INSTALLED: %sz
LATEST:    %sr;)�maxr
Zworking_setr=�textwrapZwrap�join�logger�infoZget_distributionr	r5r1�UnicodeEncodeError)r'Zname_column_widthrZinstalled_packagesr8r)r*r1Ztarget_width�lineZdistZlatestrrrr$^s>


r$cCst|td�S)N)�key)rH�
parse_version)r2rrrr5�sr5)NN)$Z
__future__rZloggingr!rIZpip.basecommandrrZ
pip.compatrZpip.downloadrZ
pip.modelsrZ	pip.utilsrZpip.utils.loggingr	Zpip.exceptionsr
Zpip.status_codesrZpip._vendor.packaging.versionrrPZpip._vendorr
Zpip._vendor.six.movesrZ	getLoggerr,rKrr r$r5rrrr�<module>s&
+
&

Zerion Mini Shell 1.0