ž 7’Reï$c@s¦dZddlZddlZddlZddlmZddlmZmZdd„Z ej ej fdd„Z d d „Z Gd d „d eƒZeƒZdS( uLogging iN(ubackwardcompat(ucoloramau pkg_resourcescs‡fdd†}|S(Ncs#djtˆƒ|tjjgƒS(Nu(ujoinulistucoloramauStyleu RESET_ALL(uinp(ucolors(u /tmp/pip-zej_zi-build/pip/log.pyuwrapped su_color_wrap..wrapped((ucolorsuwrapped((ucolorsu /tmp/pip-zej_zi-build/pip/log.pyu _color_wrap su _color_wrapcCsmt|tjƒs|n|j}||kr1dSt|dƒrP|jƒrPdS|jdƒdkridSdS(NuisattyuTERMuANSIFT( u isinstanceucoloramau AnsiToWin32uwrappeduFalseuhasattruisattyuTrueuget(uconsumeruenvironustdu real_consumer((u /tmp/pip-zej_zi-build/pip/log.pyu should_colors  u should_colorcCs dj|jdƒdd…ƒ}dj|jdƒdd…ƒ}|jdƒ\}}tt|ƒdƒ}dj||gƒ}tj|ƒtj|ƒkS(Nu.ii(ujoinusplitustruintu pkg_resourcesu parse_version(ucurrent_versionuremoval_versionumajoruminoru warn_version((u /tmp/pip-zej_zi-build/pip/log.pyu should_warn&s"" u should_warncBs¶|EeZdZdZejdZejZejZejejdZ ejZZ ej Z ej Z eeee ee e gZ ieejjƒe6eejjƒe 6eejjƒe 6Zdd„Zdd„Zdd „Zd d „Zd d „Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zddd„Z d+dd „Z"d!d"„Z#d#d$„Z$d%d&„Z%e&d'd(„ƒZ'd)d*„Z(d+S(,uLoggeru‰ Logging object for use in command-line script. Allows ranges of levels, to avoid some redundancy of displayed information. iicCs1g|_d|_d|_d|_d|_dS(NiF(u consumersuindentuFalseuexplicit_levelsuNoneu in_progressuin_progress_hanging(uself((u /tmp/pip-zej_zi-build/pip/log.pyu__init__Ls     uLogger.__init__cGs‡tjjdƒrsxn|D]S\}}t|dƒrV|jj|tj|ƒfƒq|jj||fƒqWn|jj|ƒdS(Nuwinuwrite( usysuplatformu startswithuhasattru consumersuappenducoloramau AnsiToWin32uextend(uselfu consumersuleveluconsumer((u /tmp/pip-zej_zi-build/pip/log.pyu add_consumersSs uLogger.add_consumerscOs|j|j|||ŽdS(N(uloguDEBUG(uselfumsguargsukw((u /tmp/pip-zej_zi-build/pip/log.pyudebug_su Logger.debugcOs|j|j|||ŽdS(N(uloguINFO(uselfumsguargsukw((u /tmp/pip-zej_zi-build/pip/log.pyuinfobsu Logger.infocOs|j|j|||ŽdS(N(uloguNOTIFY(uselfumsguargsukw((u /tmp/pip-zej_zi-build/pip/log.pyunotifyesu Logger.notifycOs|j|j|||ŽdS(N(uloguWARN(uselfumsguargsukw((u /tmp/pip-zej_zi-build/pip/log.pyuwarnhsu Logger.warncOs|j|j|||ŽdS(N(uloguERROR(uselfumsguargsukw((u /tmp/pip-zej_zi-build/pip/log.pyuerrorksu Logger.errorcOs|j|j|||ŽdS(N(uloguFATAL(uselfumsguargsukw((u /tmp/pip-zej_zi-build/pip/log.pyufatalnsu Logger.fatalcOsLddlm}t||ƒr5|j|||Žn|j|||ŽdS(u… 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. i(u __version__N(upipu __version__u should_warnuwarnuerror(uselfuremoval_versionumsguargsukwargsu __version__((u /tmp/pip-zej_zi-build/pip/log.pyu deprecatedqs uLogger.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 |tjƒr7|jj|dd„ƒ} | |ƒ}n|j |ƒt |dƒrm|j ƒqmqp||ƒqzqzWdS( Nu6You may give positional or keyword arguments, not bothu u%02i %su uwritecSs|S(N((ux((u /tmp/pip-zej_zi-build/pip/log.pyuŸsuLogger.log..uflushF(u TypeErroruindentuexplicit_levelsu consumersu level_matchesuin_progress_hangingusysustdoutustderruFalseuwriteuflushuhasattru should_coloruosuenvironuCOLORSuget( uselfulevelumsguargsukwurendereduconsumer_leveluconsumeru write_contentu colorizer((u /tmp/pip-zej_zi-build/pip/log.pyulog‚s6       u Logger.logcCs|j|jƒotjjƒS(u$Should we display download progress?(ustdout_level_matchesuNOTIFYusysustdoutuisatty(uself((u /tmp/pip-zej_zi-build/pip/log.pyu_show_progress¨suLogger._show_progresscCs‚|j s#td||jfƒ‚|jƒrctjjd|j|ƒtjjƒd|_ n d|_ ||_d|_ dS(Nu0Tried to start_progress(%r) while in_progress %ru TF( u in_progressuAssertionErroru_show_progressusysustdoutuwriteuindentuflushuTrueuin_progress_hanginguFalseuNoneu last_message(uselfumsg((u /tmp/pip-zej_zi-build/pip/log.pyustart_progress¬s      uLogger.start_progressudone.cCs­|jstdƒ‚|jƒr—|jsYtjjd|j|dƒtjjƒq—tj dƒtj dƒtjj|dƒtjjƒnd|_d|_dS(Nu,Tried to end_progress without start_progressu...u uF( u in_progressuAssertionErroru_show_progressuin_progress_hangingusysustdoutuwriteuflushuloggeru show_progressuNoneuFalse(uselfumsg((u /tmp/pip-zej_zi-build/pip/log.pyu end_progress¹s       uLogger.end_progresscCs´|jr°|dkr5tjjdƒtjjƒq°|jrgdtdt|jƒt|ƒƒ}nd}tjjdd|j |j ||fƒtjjƒ||_ndS(uaIf we are in a progress scope, and no log messages have been shown, write out another '.'u.u iuu %s%s%s%sN( uin_progress_hanginguNoneusysustdoutuwriteuflushu last_messageumaxulenuindentu in_progress(uselfumessageupadding((u /tmp/pip-zej_zi-build/pip/log.pyu show_progressÊs   )  uLogger.show_progresscCs|j||jƒƒS(u9Returns true if a message at this level will go to stdout(u level_matchesu _stdout_level(uselfulevel((u /tmp/pip-zej_zi-build/pip/log.pyustdout_level_matchesÛsuLogger.stdout_level_matchescCs4x*|jD]\}}|tjkr |Sq W|jS(u%Returns the level that stdout runs at(u consumersusysustdoutuFATAL(uselfuleveluconsumer((u /tmp/pip-zej_zi-build/pip/log.pyu _stdout_levelßsuLogger._stdout_levelcCslt|tƒr^|j|j}}|dk r>||kr>dS|dk sV||krZdSdS||kSdS(um >>> 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(u isinstanceusliceustartustopuNoneuFalseuTrue(uselfuleveluconsumer_levelustartustop((u /tmp/pip-zej_zi-build/pip/log.pyu level_matchesæsuLogger.level_matchescCs?|j}|dkr|dS|t|ƒkr7|dS||S(Niiiÿÿÿÿ(uLEVELSulen(uclsulevelulevels((u /tmp/pip-zej_zi-build/pip/log.pyulevel_for_integers   uLogger.level_for_integercCs–g}g}xR|jD]G\}}|tjkr|j||fƒ|j|tjfƒqqWx|D]}|jj|ƒqhW|jj|ƒdS(N(u consumersusysustdoutuappendustderruremoveuextend(uselfu to_removeuto_adduconsumer_leveluconsumeruitem((u /tmp/pip-zej_zi-build/pip/log.pyumove_stdout_to_stderr s uLogger.move_stdout_to_stderrN()u__name__u __module__u __qualname__u__doc__ulogginguDEBUGu VERBOSE_DEBUGuINFOuWARNuNOTIFYuWARNINGuERRORuFATALuLEVELSu _color_wrapucoloramauForeuYELLOWuREDuCOLORSu__init__u add_consumersudebuguinfounotifyuwarnuerrorufatalu deprecatedulogu_show_progressustart_progressu end_progressuNoneu show_progressustdout_level_matchesu _stdout_levelu level_matchesu classmethodulevel_for_integerumove_stdout_to_stderr(u __locals__((u /tmp/pip-zej_zi-build/pip/log.pyuLogger7s@               &      uLogger(u__doc__usysuosuloggingupipubackwardcompatu pip._vendorucoloramau pkg_resourcesu _color_wrapustdoutustderru should_coloru should_warnuobjectuLoggerulogger(((u /tmp/pip-zej_zi-build/pip/log.pyus     Ý