AlkantarClanX12

Your IP : 3.12.34.192


Current Path : /opt/alt/python34/lib/python3.4/site-packages/pip/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib/python3.4/site-packages/pip/__pycache__/log.cpython-34.pyc

�
�Re�$�@s�dZddlZddlZddlZddlmZddlmZmZdd�Z	ej
ejfdd�Zd	d
�Z
Gdd�de�Ze�ZdS)
zLogging
�N)�backwardcompat)�colorama�
pkg_resourcescs�fdd�}|S)Ncs#djt��|tjjg�S)N�)�join�listr�Style�	RESET_ALL)�inp)�colors��"/tmp/pip-ztkk0jow-build/pip/log.py�wrapped
sz_color_wrap.<locals>.wrappedr)rrr)rr
�_color_wrapsrcCsmt|tj�s|n|j}||kr1dSt|d�rP|j�rPdS|jd�dkridSdS)NF�isattyT�TERM�ANSI)�
isinstancer�AnsiToWin32r�hasattrr�get)�consumer�environ�std�
real_consumerrrr
�should_colors	rcCs�dj|jd�dd��}dj|jd�dd��}|jd�\}}tt|�d�}dj||g�}tj|�tj|�kS)N�.��)r�split�str�intr�
parse_version)�current_version�removal_version�major�minor�warn_versionrrr
�should_warn&s""r(c@s�eZdZdZejdZejZejZejejdZ	ejZZ
ejZejZeeee	eeegZ
ieejj�e6eejj�e6eejj�e6Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zddd�Z dd d!�Z!d"d#�Z"d$d%�Z#d&d'�Z$e%d(d)��Z&d*d+�Z'dS),�Loggerz�
    Logging object for use in command-line script.  Allows ranges of
    levels, to avoid some redundancy of displayed information.
    rrcCs1g|_d|_d|_d|_d|_dS)NrF)�	consumers�indent�explicit_levels�in_progress�in_progress_hanging)�selfrrr
�__init__Ls
				zLogger.__init__cGs�tjjd�rsxn|D]S\}}t|d�rV|jj|tj|�f�q|jj||f�qWn|jj|�dS)N�win�write)	�sys�platform�
startswithrr*�appendrr�extend)r/r*�levelrrrr
�
add_consumersSs	zLogger.add_consumerscOs|j|j|||�dS)N)�log�DEBUG)r/�msg�args�kwrrr
�debug_szLogger.debugcOs|j|j|||�dS)N)r:�INFO)r/r<r=r>rrr
�infobszLogger.infocOs|j|j|||�dS)N)r:�NOTIFY)r/r<r=r>rrr
�notifyesz
Logger.notifycOs|j|j|||�dS)N)r:�WARN)r/r<r=r>rrr
�warnhszLogger.warncOs|j|j|||�dS)N)r:�ERROR)r/r<r=r>rrr
�errorkszLogger.errorcOs|j|j|||�dS)N)r:�FATAL)r/r<r=r>rrr
�fatalnszLogger.fatalcOsLddlm}t||�r5|j|||�n|j|||�dS)a�
        Logs deprecation message which is log level WARN if the
        ``removal_version`` is > 1 minor release away and log level ERROR
        otherwise.

        removal_version should be the version that the deprecated feature is
        expected to be removed in, so something that will not exist in
        version 1.7, but will in 1.6 would have a removal_version of 1.7.
        r)�__version__N)�piprJr(rErG)r/r$r<r=�kwargsrJrrr
�
deprecatedqs
zLogger.deprecatedc
Osx|r|rtd��qn|p'|}|r=||}n|}d|j|}|jrpd||f}nx|jD]�\}}|j||�rz|jr�|tjtjfkr�d|_tjj	d�tjj
�nt|d�rc|d}t|t
j�r7|jj|dd��}	|	|�}n|j	|�t|d	�rm|j
�qmqp||�qzqzWdS)
Nz6You may give positional or keyword arguments, not both� z%02i %sF�
r2cSs|S)Nr)�xrrr
�<lambda>�szLogger.log.<locals>.<lambda>�flush)�	TypeErrorr+r,r*�
level_matchesr.r3�stdout�stderrr2rRrr�osr�COLORSr)
r/r8r<r=r>�rendered�consumer_levelr�
write_content�	colorizerrrr
r:�s6
			

z
Logger.logcCs|j|j�otjj�S)z$Should we display download progress?)�stdout_level_matchesrBr3rUr)r/rrr
�_show_progress�szLogger._show_progresscCs�|js#td||jf��|j�rctjjd|j|�tjj�d|_n	d|_||_d|_	dS)Nz0Tried to start_progress(%r) while in_progress %rrNTF)
r-�AssertionErrorr^r3rUr2r+rRr.�last_message)r/r<rrr
�start_progress�s

		zLogger.start_progresszdone.cCs�|jstd��|j�r�|jsYtjjd|j|d�tjj�q�tj	d�tj	d�tjj|d�tjj�nd|_d|_dS)Nz,Tried to end_progress without start_progressz...rOrF)
r-r_r^r.r3rUr2rR�logger�
show_progress)r/r<rrr
�end_progress�s		

	zLogger.end_progressNcCs�|jr�|dkr5tjjd�tjj�q�|jrgdtdt|j�t|��}nd}tjjdd|j|j	||f�tjj�||_ndS)zaIf we are in a progress scope, and no log messages have been
        shown, write out another '.'NrrNrrz	
%s%s%s%s)
r.r3rUr2rRr`�max�lenr+r-)r/�message�paddingrrr
rc�s		)
zLogger.show_progresscCs|j||j��S)z9Returns true if a message at this level will go to stdout)rT�
_stdout_level)r/r8rrr
r]�szLogger.stdout_level_matchescCs4x*|jD]\}}|tjkr
|Sq
W|jS)z%Returns the level that stdout runs at)r*r3rUrH)r/r8rrrr
ri�szLogger._stdout_levelcCslt|t�r^|j|j}}|dk	r>||kr>dS|dk	sV||krZdSdS||kSdS)am
        >>> l = Logger()
        >>> l.level_matches(3, 4)
        False
        >>> l.level_matches(3, 2)
        True
        >>> l.level_matches(slice(None, 3), 3)
        False
        >>> l.level_matches(slice(None, 3), 2)
        True
        >>> l.level_matches(slice(1, 3), 1)
        True
        >>> l.level_matches(slice(2, 3), 1)
        False
        NFT)r�slice�start�stop)r/r8rZrkrlrrr
rT�szLogger.level_matchescCs?|j}|dkr|dS|t|�kr7|dS||S)Nrr���)�LEVELSrf)�clsr8�levelsrrr
�level_for_integers	zLogger.level_for_integercCs�g}g}xR|jD]G\}}|tjkr|j||f�|j|tjf�qqWx|D]}|jj|�qhW|jj|�dS)N)r*r3rUr6rV�remover7)r/�	to_remove�to_addrZr�itemrrr
�move_stdout_to_stderr	s
zLogger.move_stdout_to_stderr)(�__name__�
__module__�__qualname__�__doc__�loggingr;�
VERBOSE_DEBUGr@rDrB�WARNINGrFrHrnrr�Fore�YELLOW�REDrXr0r9r?rArCrErGrIrMr:r^rardrcr]rirT�classmethodrqrvrrrr
r)7s@
		
		&
	r))rzr3rWr{rKr�pip._vendorrrrrUrVrr(�objectr)rbrrrr
�<module>s�