Re%3@sWddlmZddlZddlZddlZddlZddlZddlZddlmZm Z ddl m Z ddl m Z ddlmZddlmZyddlZWnek rddlZYnXyddlmZWnek r dZYnXdd lmZeZejZe d ZGd d d eZe r|e rmd dZqddZn!e rddZn ddZej dddZ!ddZ"Gdddej#Z$ddZ%Gdddej&Z'Gdddej(j)Z*Gdd d eZ+Gd!d"d"eZ,d#d$Z-dS)%)absolute_importN)Filter getLogger)PY2)WINDOWS)DEPRECATION_MSG_PREFIX) ensure_dir)colorama)Forezpip.subprocessorc@seZdZdZdS)BrokenStdoutLoggingErrorzO Raised if BrokenPipeError occurs for the stdout stream while logging. N)__name__ __module__ __qualname____doc__rr/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-5.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/logging.pyr :s r cCs%|tko$|jtjtjfkS)z1See the docstring for non-Windows Python 3 below.)IOErrorerrnoEINVALEPIPE) exc_classexcrrr_is_broken_pipe_errorHs rcCs1|tkp0|tko0|jtjtjfkS)z1See the docstring for non-Windows Python 3 below.)BrokenPipeErrorOSErrorrrr)rrrrrrNs  cCs|tko|jtjkS)z1See the docstring for non-Windows Python 3 below.)rrr)rrrrrrTscCs |tkS)z Return whether an exception is a broken pipe error. Args: exc_class: an exception class. exc: an exception instance. )r)rrrrrrYsc cs;tt_tj|7_z dVWdtj|8_XdS)zv A context manager which will cause the log output to be indented for any log messages emitted inside it. N)get_indentation _log_state indentation)numrrr indent_logds   r cCsttddS)Nrr)getattrrrrrrrssrcs@eZdZfddZddZfddZS)IndentingFormattercs2|jdd|_tt|j||dS)z A logging.Formatter that obeys the indent_log() context manager. :param add_timestamp: A bool indicating output lines should be prefixed with their record's timestamp. add_timestampFN)popr#superr"__init__)selfargskwargs) __class__rrr&yszIndentingFormatter.__init__cCs=|tjkrdS|jtr&dS|tjkr9dSdS)zv Return the start of the formatted log message (not counting the prefix to add to each line). z WARNING: zERROR: )loggingWARNING startswithrERROR)r' formattedlevelnorrrget_message_startsz$IndentingFormatter.get_message_startcstt|j|}|j||j}||}d|jrj|j|d}djtdt7dj fdd|j dD}|S)z Calls the standard formatter, but will indent all of the log message lines by our current indentation level. r+z%Y-%m-%dT%H:%M:%Sz{t},{record.msecs:03.0f}  csg|]}|qSrr).0line)prefixrr s z-IndentingFormatter.format..T) r%r"formatr2r1r# formatTimelocalsrjoin splitlines)r'recordr0 message_startt)r*)r6rr8s  zIndentingFormatter.format)r r rr&r2r8rr)r*rr"ws  r"csfdd}|S)Ncs#djt|tjjgS)Nr+)r;listr Style RESET_ALL)inp)colorsrrwrappedsz_color_wrap..wrappedr)rDrEr)rDr _color_wrapsrFcseZdZerEejeejfej eej fgZ ngZ ddddZ ddZ ddZdd Zfd d ZS) ColorizedStreamHandlerNcCsAtjj||||_tr=tr=tj|j|_dS)N)r, StreamHandlerr& _no_colorrr AnsiToWin32stream)r'rKno_colorrrrr&s  zColorizedStreamHandler.__init__cCs/trtr|jjtjkS|jtjkS)zA Return whether the handler is using sys.stdout. )rr rKrEsysstdout)r'rrr _using_stdouts z$ColorizedStreamHandler._using_stdoutcCs}t s|jrdSt|jtjs2|jn |jj}t|dr]|jr]dStj j ddkrydSdS)NFisattyTTERMANSI) r rI isinstancerKrJrEhasattrrPosenvironget)r' real_streamrrr should_colors z#ColorizedStreamHandler.should_colorcCs[tjj||}|jrWx3|jD](\}}|j|kr+||}Pq+W|S)N)r,rHr8rYCOLORSr1)r'r=msglevelcolorrrrr8s  zColorizedStreamHandler.formatcs\tjdd\}}|rF|jrFt||rFttt|j|S)Nr)rMexc_inforOrr r%rG handleError)r'r=rr)r*rrr_s  z"ColorizedStreamHandler.handleError)r r rr r,r/rFr REDr-YELLOWrZr&rOrYr8r_rr)r*rrGs   rGc@seZdZddZdS)BetterRotatingFileHandlercCs,ttjj|jtjjj|S)N) rrUpathdirname baseFilenamer,handlersRotatingFileHandler_open)r'rrrrhszBetterRotatingFileHandler._openN)r r rrhrrrrrbs rbc@s(eZdZddZddZdS)MaxLevelFiltercCs ||_dS)N)r\)r'r\rrrr&szMaxLevelFilter.__init__cCs|j|jkS)N)r1r\)r'r=rrrfilterszMaxLevelFilter.filterN)r r rr&rjrrrrris  rics(eZdZdZfddZS)ExcludeLoggerFilterzQ A logging Filter that excludes records from a logger (or its children). cstt|j| S)N)r%rkrj)r'r=)r*rrrjszExcludeLoggerFilter.filter)r r rrrjrr)r*rrk s rkc Cs}|dkrd}nE|d4kr*d}n0|d5kr?d}n|d6krTd}nd}tt|}|d k }|r|}d}n d }|}|d7krdnd}d d d di} ddddi} dddg|rdgng} tjjdddddddddtjiddd d!tjid"dd#d!tjiid$d%dtd&d'id(dtd&d'd)d*iid+dd|d,| dd-|d| d dd"dgd.d%idddd,| dd-|d| d dd"gd.d%idd|d,| dd-|d| d ddgd.d%idddd,| dd/|d0d*d.d(iid1d|d+| id2d3d|iii|S)8znConfigures and sets up all of the logging Returns the requested logging level, as its integer value. DEBUGr-rr/CRITICALINFONz /dev/nullrNzext://sys.stdoutstderrzext://sys.stderrrKz2pip._internal.utils.logging.ColorizedStreamHandlerfilez5pip._internal.utils.logging.BetterRotatingFileHandlerconsoleconsole_errorsconsole_subprocessuser_logversiondisable_existing_loggersFfiltersexclude_warningsz()z*pip._internal.utils.logging.MaxLevelFilterr\restrict_to_subprocesszlogging.Filternameexclude_subprocessz/pip._internal.utils.logging.ExcludeLoggerFilter formattersindentr8z %(message)sindent_with_timestampr#TrfclassrL formatterfilenamedelayrootloggersz pip._vendor)rpr/)r!r,config dictConfigr-subprocess_loggerr|r") verbosityrL user_log_filer\ level_numberinclude_user_logadditional_log_file root_levelvendored_log_level log_streamshandler_classesrfrrr setup_loggings                                 r). __future__r contextlibrr,logging.handlersrUrMrrZpip._vendor.sixrpip._internal.utils.compatrpip._internal.utils.deprecationrpip._internal.utils.miscr threading ImportErrordummy_threading pip._vendorr _colorama ExceptionZpip._vendor.coloramar localrrr rcontextmanagerr r Formatterr"rFrHrGrfrgrbrirkrrrrrsR               2 K