o Ecl @sUddlZddlZddlmZmZmZddlmZddlmZm Z m Z ddl m Z ddl mZddlmZddlmZzdd lmZWn eyNdZYnwd ed ed efd dZee eZeed<GdddZGdddeZGddde ZGdddZGdddZGdddeeeZGdddeeZGdddeeZ Gd d!d!eeZ!Gd"d#d#ee Z"Gd$d%d%eeZ#Gd&d'd'eeee Z$e e fee$fe!e$fe"e$fe#e$fd(Z%d+d)d*Z&dS),N)SIGINTdefault_int_handlersignal)Any)BarFillingCirclesBarIncrementalBar)Spinner)WINDOWS)get_indentation) format_size)colorama preferredfallbackreturncCspt|jdd}|s |St|ddt|ddg}|tt|dg7}z d||W|Sty7|YSw)NencodingZ empty_fillZfillphases)getattrfilelistjoinencodeUnicodeEncodeError)rrrZ charactersrR/opt/alt/python310/lib/python3.10/site-packages/pip/_internal/cli/progress_bars.py_select_progress_classs   r_BaseBarcsDeZdZdZdededdffdd Zd fdd Zd d ZZS) InterruptibleMixina 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. argskwargsrNcs8tj|i|tt|j|_|jdurt|_dSdS)z= Save the original SIGINT handler for later. N)super__init__rr handle_sigintoriginal_handlerrselfrr  __class__rrr"Es   zInterruptibleMixin.__init__csttt|jdS)z Restore the original SIGINT handler after finishing. This should happen regardless of whether the progress display finishes normally, or gets interrupted. N)r!finishrrr$r&r'rrr)Vs zInterruptibleMixin.finishcCs||||dS)z 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&Zsignumframerrrr#`sz InterruptibleMixin.handle_sigintrN) __name__ __module__ __qualname____doc__rr"r)r# __classcell__rrr'rr3s  rc@seZdZdddZdS) SilentBarrNcCsdSNrr*rrrupdatelszSilentBar.updater,)r-r.r/r4rrrrr2ksr2c@seZdZdZdZdZdZdS) BlueEmojiBar %(percent)d%% )u🔹u🔷u🔵N)r-r.r/suffixZ bar_prefixZ bar_suffixrrrrrr5ps r5csheZdZdededdffdd ZedefddZedefd d Zedefd d Z d dZ Z S)DownloadProgressMixinrr rNcs,tj|i|dtd|j|_dS)Nr7)r!r"r messager%r'rrr"yszDownloadProgressMixin.__init__cCs t|jSr3)r indexr*rrr downloaded~s z DownloadProgressMixin.downloadedcCs |jdkrdStd|jdS)Ngz...z/s)Zavgr r*rrrdownload_speeds z$DownloadProgressMixin.download_speedcCs|jr d|jSdS)Nzeta r)ZetaZeta_tdr*rrr pretty_etas z DownloadProgressMixin.pretty_etaccs,|D] }|V|t|q|dSr3)nextlenr))r&itxrrriters  zDownloadProgressMixin.iter) r-r.r/rr"propertystrr=r?r@rEr1rrr'rr9xsr9cs*eZdZdededdffdd ZZS) WindowsMixinrr rNcsdtrjrd_tj|i|tr.tr0tj_fddj_fddj_dSdSdS)NFc jjSr3)rwrappedisattyrr*rr z'WindowsMixin.__init__..crIr3)rrJflushrr*rrrLrM) r Z hide_cursorr!r"r Z AnsiToWin32rrKrNr%r'r*rr"s zWindowsMixin.__init__)r-r.r/rr"r1rrr'rrHs"rHc@seZdZejZdZdZdS)BaseDownloadProgressBarr6z0%(downloaded)s %(download_speed)s %(pretty_eta)sN)r-r.r/sysstdoutrr;r8rrrrrOsrOc@ eZdZdS)DefaultDownloadProgressBarNr-r.r/rrrrrSrSc@rR)DownloadSilentBarNrTrrrrrVrUrVc@rR) DownloadBarNrTrrrrrWrUrWc@rR)DownloadFillingCirclesBarNrTrrrrrXrUrXc@rR)DownloadBlueEmojiProgressBarNrTrrrrrYrUrYc@s.eZdZejZdZdefddZdddZ dS) DownloadProgressSpinnerz!%(downloaded)s %(download_speed)srcCs"t|ds t|j|_t|jS)N_phaser)hasattr itertoolscyclerr[rAr*rrr next_phases  z"DownloadProgressSpinner.next_phaseNcCsN|j|}|}|j|}d||rdnd||rdnd|g}||dS)Nrr7)r;r_r8rZwriteln)r&r;Zphaser8linerrrr4s     zDownloadProgressSpinner.updater,) r-r.r/rPrQrr8rGr_r4rrrrrZs rZ)ZoffZonasciiZprettyZemojicCs4|dus|dkrt|djSt|d|djS)Nrr>)max) BAR_TYPESrE)Z progress_barrbrrrDownloadProgressProvidersrdr3)'r]rPrrrtypingrZpip._vendor.progress.barrrrZpip._vendor.progress.spinnerr Zpip._internal.utils.compatr Zpip._internal.utils.loggingr Zpip._internal.utils.miscr Z pip._vendorr Exceptionrr__annotations__rr2r5r9rHrOrSrVrWrXrYrZrcrdrrrrsJ       8