HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/pip/_internal/utils/__pycache__/logging.cpython-310.pyc
o

@%Ne-�@s�ddlZddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZmZm
Z
mZmZmZmZmZddlmZmZmZmZddlmZddlmZddlmZdd	lmZdd
l m!Z!ddl"m#Z#m$Z$ddl%m&Z&dd
l'm(Z(ddl)m*Z*e�+�Z,e$d�Z-Gdd�de.�Z/dee0de0de1fdd�Z2ej3d.de4dedfdd��Z5de4fdd�Z6Gdd�dej7�Z8eGdd �d ��Z9Gd!d"�d"e�Z:Gd#d$�d$ej;j<�Z=Gd%d&�d&e	�Z>Gd'd(�d(e	�Z?d)e4d*e1d+ee@de4fd,d-�ZAdS)/�N)�	dataclass)�Filter)�IO�Any�ClassVar�Iterator�List�Optional�TextIO�Type)�Console�ConsoleOptions�ConsoleRenderable�RenderResult)�NullHighlighter)�RichHandler)�Segment)�Style)�DiagnosticPipError)�VERBOSE�	getLogger)�WINDOWS)�DEPRECATION_MSG_PREFIX)�
ensure_dirzpip.subprocessorc@seZdZdZdS)�BrokenStdoutLoggingErrorzO
    Raised if BrokenPipeError occurs for the stdout stream while logging.
    N)�__name__�
__module__�__qualname__�__doc__�rr�=/usr/lib/python3/dist-packages/pip/_internal/utils/logging.pyr!sr�	exc_class�exc�returncCs0|turdSts
dSt|t�o|jtjtjfvS)NTF)�BrokenPipeErrorr�
isinstance�OSError�errno�EINVAL�EPIPE)r!r"rrr �_is_broken_pipe_error's
r*��numc	csD�t�t_tj|7_z
dVWtj|8_dStj|8_w)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)r,rrr �
indent_log4s�"r0cCsttdd�S)Nr/r)�getattrr.rrrr r-C�r-c	sfeZdZdZdd�dedededdf�fd	d
�Zdededefd
d�Z	de
jdef�fdd�Z�Z
S)�IndentingFormatterz%Y-%m-%dT%H:%M:%SF)�
add_timestamp�argsr4�kwargsr#Ncs||_t�j|i|��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.
        N)r4�super�__init__)�selfr4r5r6��	__class__rr r8JszIndentingFormatter.__init__�	formatted�levelnocCs.|tjkrdS|�t�rdS|tjkrdSdS)zv
        Return the start of the formatted log message (not counting the
        prefix to add to each line).
        �z	WARNING: zERROR: )�logging�WARNING�
startswithr�ERROR)r9r<r=rrr �get_message_startYs


z$IndentingFormatter.get_message_start�recordcslt��|�}|�||j�}||}d�|jr|�|��d���dt�7�d��fdd�|�d�D��}|S)z�
        Calls the standard formatter, but will indent all of the log message
        lines by our current indentation level.
        r>� csg|]}�|�qSrr)�.0�line��prefixrr �
<listcomp>vsz-IndentingFormatter.format.<locals>.<listcomp>T)	r7�formatrCr=r4�
formatTimer-�join�
splitlines)r9rDr<�
message_startr:rHr rKiszIndentingFormatter.format)rrr�default_time_formatr�boolr8�str�intrCr?�	LogRecordrK�
__classcell__rrr:r r3Gs����� r3c@s4eZdZUeed<eed<dededefdd�Z	dS)	�IndentedRenderable�
renderable�indent�console�optionsr#ccsL�|�|j|�}t�|�}|D]}td|j�V|EdHtd�VqdS)NrE�
)�renderrWr�split_linesrX)r9rYrZ�segments�linesrGrrr �__rich_console__s�

�z#IndentedRenderable.__rich_console__N)
rrrr�__annotations__rSrr
rr`rrrr rVzs
���rVcsteZdZUgZeeeeed<dee	de
ddf�fdd�Zdej
ddfd	d
�Zdej
ddf�fdd�Z�ZS)
�RichPipStreamHandler�KEYWORDS�stream�no_colorr#Ncs&t�jt||dd�dddt�d�dS)NT)�filere�	soft_wrapF)rY�	show_time�
show_level�	show_path�highlighter)r7r8rr)r9rdrer:rr r8�s
�zRichPipStreamHandler.__init__rDcCs�d}|jdkr"t|j�dkr"|jd}t|t�sJ�t|t�d�}n'|�|�}|�||�}|j	durI|j	t
jkr>tdd�}n|j	t
j
krItdd�}z
|jj|dd	|d
�WdStye|�|�YdSw)Nz[present-diagnostic] %s�r)rX�red)�color�yellow�ignoreF)�overflow�crop�style)�msg�lenr5r%rrVr-rK�render_messager=r?rBrr@rY�print�	Exception�handleError)r9rDrs�diagnostic_errorrW�messagerrr �emit�s&
�


�zRichPipStreamHandler.emitcsFt��dd�\}}|r|r|jjtjurt||�rt��t��|�S)z1Called when logging is unable to log some output.Nr+)	�sys�exc_inforYrf�stdoutr*rr7ry)r9rDr!r"r:rr ry�s���z RichPipStreamHandler.handleError)rrrrcrr	rrRrar
rQr8r?rTr|ryrUrrr:r rb�s


 rbcs&eZdZdeef�fdd�Z�ZS)�BetterRotatingFileHandlerr#csttj�|j��t���S�N)r�os�path�dirname�baseFilenamer7�_open)r9r:rr r��s
zBetterRotatingFileHandler._open)rrrrrr�rUrrr:r r��sr�c@s2eZdZdeddfdd�Zdejdefdd�ZdS)	�MaxLevelFilter�levelr#NcCs
||_dSr�)r�)r9r�rrr r8�s
zMaxLevelFilter.__init__rDcCs|j|jkSr�)r=r��r9rDrrr �filter�r2zMaxLevelFilter.filter)	rrrrSr8r?rTrQr�rrrr r��sr�cs,eZdZdZdejdef�fdd�Z�ZS)�ExcludeLoggerFilterzQ
    A logging Filter that excludes records from a logger (or its children).
    rDr#cst��|�Sr�)r7r�r�r:rr r��szExcludeLoggerFilter.filter)	rrrrr?rTrQr�rUrrr:r r��s r��	verbosityre�
user_log_filecCs~|dkrtj}n"|dkrt}n|dkrtj}n|dkrtj}n|dkr'tj}ntj}t�|�}|du}|r:|}d}nd}|}|d	vrDd
nd}ddd
�}	ddd�}
gd�|rXdgng}tj�	dddtjd�dt
jd�dt
jd�d�tdd�tddd�d�||
d||	d d!d"gd#d$�d
|
d||	d%d!gd#d$�||
d|	d%|d&gd#d'�d|
d(|d)dd*d+�d,�||d-�d.d/|iid0��|S)1znConfigures and sets up all of the logging

    Returns the requested logging level, as its integer value.
    r+rl���������N�DEBUGz	/dev/null)�INFOrBr@zext://sys.stdoutzext://sys.stderr)r�stderrz0pip._internal.utils.logging.RichPipStreamHandlerz5pip._internal.utils.logging.BetterRotatingFileHandler)rdrf)rY�console_errors�console_subprocess�user_logFz*pip._internal.utils.logging.MaxLevelFilter)�()r�zlogging.Filter)r��namez/pip._internal.utils.logging.ExcludeLoggerFilter)�exclude_warnings�restrict_to_subprocess�exclude_subprocessz%(message)s)r�rKT)r�rKr4)rX�indent_with_timestamprdrr�r�rX)r��classrerd�filters�	formatterr�r�)r�r�rdrer�r�rfzutf-8r�)r�r��filename�encoding�delayr�)rYr�r�r�)r��handlerszpip._vendorr�)�version�disable_existing_loggersr��
formattersr��root�loggers)
r?r�rr@rB�CRITICALr��getLevelName�config�
dictConfig�subprocess_loggerr�r3)r�rer��level_numberr��include_user_log�additional_log_file�
root_level�vendored_log_level�log_streams�handler_classesr�rrr �
setup_logging�s�
����������
�	��	��%�
��Ir�)r+)B�
contextlibr'r?�logging.handlersr�r}�	threading�dataclassesrr�typingrrrrrr	r
r�pip._vendor.rich.consolerr
rr�pip._vendor.rich.highlighterr�pip._vendor.rich.loggingr�pip._vendor.rich.segmentr�pip._vendor.rich.styler�pip._internal.exceptionsr�pip._internal.utils._logrr�pip._internal.utils.compatr�pip._internal.utils.deprecationr�pip._internal.utils.miscr�localr.r�rxr�
BaseExceptionrQr*�contextmanagerrSr0r-�	Formatterr3rVrbr��RotatingFileHandlerr�r�r�rRr�rrrr �<module>sF(
39"