PATH:
opt
/
alt
/
python35
/
lib
/
python3.5
/
site-packages
/
pip
/
_vendor
/
pep517
/
__pycache__
��Re � @ s� d Z d d l Z d d l Z y d d l Z Wn e k rH d Z Yn Xd d � Z Gd d � d e j � Z e j d d � Z d S) zONicer log formatting with colours. Code copied from Tornado, Apache licensed. � Nc C so d } t rk t t j d � rk t j j � rk y) t j � t j d � d k rU d } Wn t k rj Yn X| S)NF�isatty�colorsr T)�curses�hasattr�sys�stderrr Z setuptermZtigetnum� Exception)�color� r ��/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-5.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/pep517/colorlog.py�_stderr_supports_color s ' r c @ s^ e Z d Z d Z e j d e j d e j d e j d i Z d d d d � Z d d � Z d S)�LogFormatterz&Log formatter with colour support � � � TNc C s t j j | d | �i | _ | r t � r t j d � pO t j d � pO d } d t j k ol d k n r� t | d � } x? | j j � D]. \ } } t t j | | � d � | j | <q� Wt t j d � d � | _ t j � } | j � d | _ t j � n d | _ d | _ d S)aO :arg bool color: Enables color support. :arg string fmt: Log message format. It will be applied to the attributes dict of log records. The text between ``%(color)s`` and ``%(end_color)s`` will be colored depending on the level if color support is on. :arg dict colors: color mappings from logging level to terminal color code :arg string datefmt: Datetime format. Used for formatting ``(asctime)`` placeholder in ``prefix_fmt``. .. versionchanged:: 3.2 Added ``fmt`` and ``datefmt`` arguments. �datefmtZsetafZsetf� r r r �asciiZsgr0r �F N)r r )r r r )�logging� Formatter�__init__�_colorsr r Ztigetstrr �version_info�str�DEFAULT_COLORS�itemsZtparm�_normalZinitscrZgetmaxyx� termwidthZendwin)�selfr r Zfg_color�levelno�codeZscrr r r r 2 s # zLogFormatter.__init__c C s� t | j � } d j d | j d d | j � } | t | � | j k rh d | j | t | � } n d } | j | j k r� | j | j } | j } n d } } | j | | | | S)Nz{initial}-{name}�initialr �name� z r ) �len�message�format� levelnamer# r r r r )r �record�mlenZ right_text�spaceZstart_colorZ end_colorr r r � formatMessage] s zLogFormatter.formatMessage)�__name__� __module__�__qualname__�__doc__r �INFO�WARNING�ERROR�CRITICALr r r, r r r r r ( s +r c C s@ t j � } | j t � � t j j | � t j j | � d S)N)r � StreamHandler�setFormatterr �root� addHandler�setLevel)�level�handlerr r r �enable_colourful_outputo s r<