AlkantarClanX12

Your IP : 3.148.108.144


Current Path : /proc/self/root/lib/python2.7/site-packages/pip/utils/
Upload File :
Current File : //proc/self/root/lib/python2.7/site-packages/pip/utils/ui.pyo

�
��abc@`s<ddlmZddlmZddlZddlZddlmZmZmZddlZddl	Z	ddl
Z
ddlmZddl
mZddlmZddlmZdd	lmZmZdd
lmZmZmZddlmZyddlmZWnek
r'dZnXe
je �Z!d
�Z"e"ee�Z#de$fd��YZ%de$fd��YZ&de$fd��YZ'de'e%e&e#fd��YZ(de'e%e&eefd��YZ)e	j*d��Z+de$fd��YZ,de$fd��YZ-de$fd��YZ.e	j*d��Z/dS( i(tabsolute_import(tdivisionN(tsignaltSIGINTtdefault_int_handler(tWINDOWS(tformat_size(tget_indentation(tsix(tBartIncrementalBar(tWritelnMixintHIDE_CURSORtSHOW_CURSOR(tSpinner(tcoloramacC`s�t|jdd�}|s|St|dtj��t|dtj��g}|tt|dg��7}y tj�j|�j|�Wntk
r�|SX|SdS(Ntencodingt
empty_filltfilltphases(	tgetattrtfiletNoneRt	text_typetlisttjointencodetUnicodeEncodeError(t	preferredtfallbackRt
characters((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyt_select_progress_classs 
tInterruptibleMixincB`s)eZdZd�Zd�Zd�ZRS(s�
    Helper to ensure that self.finish() gets called on keyboard interrupt.

    This allows downloads to be interrupted without leaving temporary state
    (like hidden cursors) behind.

    This class is similar to the progress library's existing SigIntMixin
    helper, but as of version 1.2, that helper has the following problems:

    1. It calls sys.exit().
    2. It discards the existing SIGINT handler completely.
    3. It leaves its own handler in place even after an uninterrupted finish,
       which will have unexpected delayed effects if the user triggers an
       unrelated keyboard interrupt some time after a progress-displaying
       download has already completed, for example.
    cO`sMtt|�j||�tt|j�|_|jdkrIt|_ndS(s=
        Save the original SIGINT handler for later.
        N(	tsuperR t__init__RRt
handle_siginttoriginal_handlerRR(tselftargstkwargs((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyR"NscC`s'tt|�j�tt|j�dS(s�
        Restore the original SIGINT handler after finishing.

        This should happen regardless of whether the progress display finishes
        normally, or gets interrupted.
        N(R!R tfinishRRR$(R%((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyR(^scC`s|j�|j||�dS(s�
        Call self.finish() before delegating to the original SIGINT handler.

        This handler should only be in place while the progress display is
        active.
        N(R(R$(R%tsignumtframe((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyR#hs
(t__name__t
__module__t__doc__R"R(R#(((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyR <s		
tDownloadProgressMixincB`sJeZd�Zed��Zed��Zed��Zdd�ZRS(cO`s8tt|�j||�dt�d|j|_dS(Nt i(R!R.R"Rtmessage(R%R&R'((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyR"uscC`s
t|j�S(N(Rtindex(R%((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyt
downloadedyscC`s(|jdkrdStd|j�dS(Ngs...is/s(tavgR(R%((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pytdownload_speed}scC`s|jrd|jSdS(Nseta %st(tetateta_td(R%((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyt
pretty_eta�s	icc`s1x |D]}|V|j|�qW|j�dS(N(tnextR((R%tittntx((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pytiter�s
(R+R,R"tpropertyR2R4R8R=(((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyR.ss
	tWindowsMixincB`seZd�ZRS(c`s�tr�jrt�_ntt��j||�tr�tr�tj�j��_�fd��j_	�fd��j_
ndS(Nc`s�jjj�S(N(Rtwrappedtisatty((R%(s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyt<lambda>�R5c`s�jjj�S(N(RR@tflush((R%(s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyRB�R5(Rthide_cursortFalseR!R?R"RtAnsiToWin32RRARC(R%R&R'((R%s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyR"�s(R+R,R"(((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyR?�stDownloadProgressBarcB`seZejZdZdZRS(s
%(percent)d%%s0%(downloaded)s %(download_speed)s %(pretty_eta)s(R+R,tsyststdoutRR0tsuffix(((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyRG�s	tDownloadProgressSpinnercB`s)eZejZdZd�Zd�ZRS(s!%(downloaded)s %(download_speed)scC`s4t|d�s'tj|j�|_nt|j�S(Nt_phaser(thasattrt	itertoolstcycleRRLR9(R%((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyt
next_phase�scC`sm|j|}|j�}|j|}dj||r;dnd||rMdnd|g�}|j|�dS(NR5R/(R0RPRJRtwriteln(R%R0tphaseRJtline((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pytupdate�s

(R+R,RHRIRRJRPRT(((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyRK�s		cc`sctrdVnQ|j�s0tj�tjkr8dVn'|jt�z	dVWd|jt�XdS(N(	RRAtloggertgetEffectiveLeveltloggingtINFOtwriteRR
(R((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyt
hidden_cursor�s"
	tRateLimitercB`s#eZd�Zd�Zd�ZRS(cC`s||_d|_dS(Ni(t_min_update_interval_secondst_last_update(R%tmin_update_interval_seconds((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyR"�s	cC`s&tj�}||j}||jkS(N(ttimeR]R\(R%tnowtdelta((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pytready�s
cC`stj�|_dS(N(R_R](R%((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pytreset�s(R+R,R"RbRc(((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyR[�s		tInteractiveSpinnercB`s5eZdddd�Zd�Zd�Zd�ZRS(s-\|/g�?cC`s�||_|dkr!tj}n||_t|�|_t|_t	j
|�|_|jjdt
�|jd�d|_dS(NR/s ... i(t_messageRRHRIt_fileR[t
_rate_limiterREt	_finishedRNROt_spin_cycleRYRt_width(R%R0Rt
spin_charsR^((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyR"�s			"cC`sid|j}|jj|d|j|�|jj|�t|�|_|jj�|jj�dS(NsR/(RjRfRYtlenRCRgRc(R%tstatustbackup((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyt_write	s

cC`s:|jr
dS|jj�s dS|jt|j��dS(N(RhRgRbRoR9Ri(R%((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pytspins
	cC`sD|jr
dS|j|�|jjd�|jj�t|_dS(Ns
(RhRoRfRYRCtTrue(R%tfinal_status((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyR(s	

N(R+R,RR"RoRpR((((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyRd�s

		tNonInteractiveSpinnercB`s/eZdd�Zd�Zd�Zd�ZRS(i<cC`s2||_t|_t|�|_|jd�dS(Ntstarted(ReRERhR[Rgt_update(R%R0R^((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyR"*s		cC`s'|jj�tjd|j|�dS(Ns%s: %s(RgRcRUtinfoRe(R%Rm((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyRu0s
cC`s1|jr
dS|jj�s dS|jd�dS(Nsstill running...(RhRgRbRu(R%((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyRp5s
	cC`s.|jr
dS|jd|f�t|_dS(Nsfinished with status '%s'(RhRuRq(R%Rr((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyR(<s	(R+R,R"RuRpR((((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyRs)s		cc`s�tjj�r3tj�tjkr3t|�}nt|�}yt	tj��
|VWdQXWnAt
k
r�|jd��n.tk
r�|jd��nX|jd�dS(Ntcanceledterrortdone(
RHRIRARURVRWRXRdRsRZtKeyboardInterruptR(t	Exception(R0tspinner((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pytopen_spinnerCs$



(0t
__future__RRRNRHRRRR_t
contextlibRWt
pip.compatRt	pip.utilsRtpip.utils.loggingRtpip._vendorRtpip._vendor.progress.barR	R
tpip._vendor.progress.helpersRRR
tpip._vendor.progress.spinnerRRR{Rt	getLoggerR+RURt_BaseBartobjectR R.R?RGRKtcontextmanagerRZR[RdRsR}(((s0/usr/lib/python2.7/site-packages/pip/utils/ui.pyt<module>sB

	7		!0