a Rel @sUddlZddlZddlmZmZmZddlmZddlmZm Z m Z ddl m Z ddl mZddlmZddlmZzdd lmZWneydZYn0eeed d d Zee eZeed <GdddZGdddeZGddde ZGdddZGdddZGdddeeeZGdddeeZGdddeeZ GdddeeZ!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) preferredfallbackreturncCsvt|jdd}|s|St|ddt|ddg}|tt|dg7}zd||Wntyl|YS0|SdS)Nencoding empty_fillfillphases)getattrfilelistjoinencodeUnicodeEncodeError)rrr charactersr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/lib/python3.9/site-packages/pip/_internal/cli/progress_bars.py_select_progress_classs    r_BaseBarcsDeZdZdZeeddfdd Zddfdd 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. Nargskwargsrcs4tj|i|tt|j|_|jdur0t|_dS)z= Save the original SIGINT handler for later. N)super__init__rr handle_sigintoriginal_handlerrselfr#r$ __class__rrr&Es zInterruptibleMixin.__init__rcsttt|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*signumframerrrr'`sz InterruptibleMixin.handle_sigint) __name__ __module__ __qualname____doc__rr&r.r' __classcell__rrr+rr!3s r!c@seZdZddddZdS) SilentBarNr-cCsdSNrr/rrrupdatelszSilentBar.update)r2r3r4r9rrrrr7ksr7c@seZdZdZdZdZdZdS) BlueEmojiBar %(percent)d%% )u🔹u🔷u🔵N)r2r3r4suffix bar_prefix bar_suffixrrrrrr:psr:csdeZdZeeddfdd ZeedddZeeddd Zeedd d Z d d Z Z S)DownloadProgressMixinNr"cs,tj|i|dtd|j|_dS)Nr<)r%r&r messager)r+rrr&yszDownloadProgressMixin.__init__r-cCs t|jSr8)r indexr/rrr downloaded~sz DownloadProgressMixin.downloadedcCs |jdkrdStd|jdS)Ngz...z/s)avgr r/rrrdownload_speeds z$DownloadProgressMixin.download_speedcCs|jrd|jSdS)Nzeta r)etaeta_tdr/rrr pretty_etas z DownloadProgressMixin.pretty_etaccs*|D]}|V|t|q|dSr8)nextlenr.)r*itxrrriterszDownloadProgressMixin.iter) r2r3r4rr&propertystrrDrGrJrOr6rrr+rr@xsr@cs&eZdZeeddfdd ZZS) WindowsMixinNr"cs\trjrd_tj|i|trXtrXtj_fddj_fddj_dS)NFcs jjSr8)rwrappedisattyrr/rrz'WindowsMixin.__init__..cs jjSr8)rrSflushrr/rrrUrV) r hide_cursorr%r&r AnsiToWin32rrTrWr)r+r/rr&s zWindowsMixin.__init__)r2r3r4rr&r6rrr+rrRsrRc@seZdZejZdZdZdS)BaseDownloadProgressBarr;z0%(downloaded)s %(download_speed)s %(pretty_eta)sN)r2r3r4sysstdoutrrBr=rrrrrZsrZc@s eZdZdS)DefaultDownloadProgressBarNr2r3r4rrrrr]sr]c@s eZdZdS)DownloadSilentBarNr^rrrrr_sr_c@s eZdZdS) DownloadBarNr^rrrrr`sr`c@s eZdZdS)DownloadFillingCirclesBarNr^rrrrrasrac@s eZdZdS)DownloadBlueEmojiProgressBarNr^rrrrrbsrbc@s2eZdZejZdZedddZddddZ dS)DownloadProgressSpinnerz!%(downloaded)s %(download_speed)sr-cCs"t|dst|j|_t|jS)N_phaser)hasattr itertoolscyclerrdrKr/rrr next_phases z"DownloadProgressSpinner.next_phaseNcCsN|j|}|}|j|}d||r*dnd||r6dnd|g}||dS)Nrr<)rBrhr=rwriteln)r*rBphaser=linerrrr9s     zDownloadProgressSpinner.update) r2r3r4r[r\rr=rQrhr9rrrrrcsrc)offonasciiprettyemojicCs8|dus|dkr t|djSt|d|djSdS)NrrE)max) BAR_TYPESrO) progress_barrqrrrDownloadProgressProvidersrt)N)'rfr[rrrtypingrpip._vendor.progress.barrrrpip._vendor.progress.spinnerr pip._internal.utils.compatr pip._internal.utils.loggingr pip._internal.utils.miscr pip._vendorr Exceptionrr __annotations__r!r7r:r@rRrZr]r_r`rarbrcrrrtrrrrsF        8