Viewing File: /opt/hc_python/lib/python3.12/site-packages/pip/_internal/utils/__pycache__/logging.cpython-312.pyc

�

T�*jf4���ddlmZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZddl
mZmZddlmZddlmZmZddlmZmZmZmZmZmZdd	lmZdd
lmZddlm Z ddl!m"Z"dd
l#m$Z$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+m,Z,ejZ�Z.da/dZ0e%d�Z1Gd�de2�Z3d*d�Z4ejjd+d��Z6ejjd,d-d��Z7d.d�Z8Gd�dejr�Z:eGd�d��Z;Gd�de�Z<dd�d/d �Z=Gd!�d"e�Z>Gd#�d$ej~j��ZAGd%�d&e�ZBGd'�d(e�ZCd0d)�ZDy)1�)�annotationsN)�	Generator)�	dataclass)�StringIO�
TextIOWrapper)�Filter)�Any�ClassVar)�Console�ConsoleOptions�ConsoleRenderable�RenderableType�RenderResult�RichCast)�NullHighlighter)�RichHandler)�Segment)�Style)�VERBOSE�	getLogger)�WINDOWS)�DEPRECATION_MSG_PREFIX)�
StreamWrapper�
ensure_dirzpip.subprocessorc��eZdZdZy)�BrokenStdoutLoggingErrorzO
    Raised if BrokenPipeError occurs for the stdout stream while logging.
    N)�__name__�
__module__�__qualname__�__doc__���J/opt/hc_python/lib/python3.12/site-packages/pip/_internal/utils/logging.pyrr(s��r"rc��|turytsyt|t�xr,|jtj
tjfvS)NTF)�BrokenPipeErrorr�
isinstance�OSError�errno�EINVAL�EPIPE)�	exc_class�excs  r#�_is_broken_pipe_errorr-.s=���O�#��
���c�7�#�P��	�	�e�l�l�E�K�K�5P�(P�Pr"c#�
K�i}tj�jD]"}t|t�s�|j
||<�$t
jtj�}|s|��ytt|j���j}t||d��}	|D]	}||_�|��|j�D]\}}||_�y#|j�D]\}}||_�wxYw�w)z-Capture all pip logs in a buffer temporarily.NT��file�no_color�	soft_wrap)�loggingr�handlersr&�RichPipStreamHandler�consoler�from_stream�sys�stdout�next�iter�valuesr1�
PipConsole�items)r4�handler�fake_streamr1�fake_console�original_consoles      r#�capture_loggingrC;s������H��$�$�&�/�/���g�3�4�!(���H�W��	0� �+�+�C�J�J�7�K������D����*�+�,�5�5�H��;��T�R�L�/��G�*�G�O� ���)1���)9�%�G�%�.�G�O�*:�����)9�%�G�%�.�G�O�*:�s#�4D�A5D�-C�? D�!D�Dc#��K�t�t_txj|z
c_	d��txj|zc_y#txj|zc_wxYw�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)�nums r#�
indent_logrI[sN����-�.�J�����c�!��&�
����#�%���
���#�%��s�-A,�A�A,�A)�)A,c�$�ttdd�S)NrGr)�getattrrFr!r"r#rErEjs���:�}�a�0�0r"c�L��eZdZdZdd�							d�fd�Zdd�Zd	�fd�Z�xZS)
�IndentingFormatterz%Y-%m-%dT%H:%M:%SF)�
add_timestampc�2��||_t�|�|i|��y)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)rN�super�__init__)�selfrN�args�kwargs�	__class__s    �r#rQzIndentingFormatter.__init__qs���+���
���$�)�&�)r"c��|tjkry|jt�ry|tjkryy)zv
        Return the start of the formatted log message (not counting the
        prefix to add to each line).
        �z	WARNING: zERROR: )r3�WARNING�
startswithr�ERROR)rR�	formatted�levelnos   r#�get_message_startz$IndentingFormatter.get_message_start�s9��
�W�_�_�$����� 6�7���W�]�]�"��r"c�8��t�|�|�}|j||j�}||z}d}|jr|j|��d�}|dt
�zz
}dj|jd�D�cgc]}||z��	c}�}|Scc}w)z�
        Calls the standard formatter, but will indent all of the log message
        lines by our current indentation level.
        rW� T)	rP�formatr]r\rN�
formatTimerE�join�
splitlines)rR�recordr[�
message_start�prefix�linerUs      �r#r`zIndentingFormatter.format�s����
�G�N�6�*�	��.�.�y�&�.�.�I�
�!�I�-�	����������/�0��2�F��#��)�)�)���G�G�y�7K�7K�D�7Q�R�7Q�t�V�d�]�7Q�R�S�	����Ss�B)rSr	rN�boolrTr	�return�None)r[�strr\�intrirk)rd�logging.LogRecordrirk)rrr�default_time_formatrQr]r`�
__classcell__�rUs@r#rMrMnsH���-��
$�
*��
*��
*��	
*�

�
*�� �r"rMc�6�eZdZUded<ded<						dd�Zy)�IndentedRenderabler�
renderablerl�indentc#��K�|j|j|�}tj|�}|D]3}td|jz���|Ed{���td����5y7��w)Nr_�
)�renderrsr�split_linesrt)rRr6�options�segments�linesrgs      r#�__rich_console__z#IndentedRenderable.__rich_console__�s^�����>�>�$�/�/�7�;���#�#�H�-���D��#����+�,�,��O�O��$�-����s�AA/�A-�A/N)r6rryrrir)rrr�__annotations__r|r!r"r#rrrr�s*�����K� �� �)7� �	� r"rrc��eZdZdd�Zy)r=c��t�d��N)r%)rRs r#�on_broken_pipezPipConsole.on_broken_pipe�s����T�)r"N)rirj)rrrr�r!r"r#r=r=�s��*r"r=F��stderrc�R�|rt�Jd��tSt�Jd��tS)Nzstderr rich console is missing!zstdout rich console is missing!)�_stderr_console�_stdout_consoler�s r#�get_consoler��s5��
��*�M�,M�M�*����*�M�,M�M�*��r"c�D��eZdZUgZded<d�fd�Zdd�Zd�fd�Z�xZS)r5zClassVar[list[str] | None]�KEYWORDSc�>��t�|�|dddt���y)NF)r6�	show_time�
show_level�	show_path�highlighter)rPrQr)rRr6rUs  �r#rQzRichPipStreamHandler.__init__�s'���
�������'�)�	�	
r"c�p�d}t|dd�ret|jt�sJ�|j\}t|tt
tf�s
J|�d���t|t���}n�|j|�}|j||�}|j�S|jtjk\r
td��}n)|jtjk\rtd��}	|j j#|dd|�	�y#t$$r|j'|�YywxYw)
N�richFz is not rich-console-renderable)rt�red)�color�yellow�ignore)�overflow�crop�style)rKr&rS�tupler
rrkrrrEr`�render_messager\r3rZrrXr6�print�	Exception�handleError)rRrdr��rich_renderablers�messages      r#�emitzRichPipStreamHandler.emit�s��"���6�6�5�)��f�k�k�5�1�1�1�!'����_���"3�X�s�!C��
C�!�"�"A�B�
C��*<���(9�*�J��k�k�&�)�G��,�,�V�W�=�J��~�~�)��>�>�W�]�]�2�!��.�E��^�^�w���6�!��1�E�	%��L�L���z�H�5�PU��V���	%����V�$�	%�s�8D�D5�4D5c����tj�dd\}}|r>|r<|jjtjurt||�r
t
��t�|�!|�S)z1Called when logging is unable to log some output.N�)	r8�exc_infor6r0r9r-rrPr�)rRrdr+r,rUs    �r#r�z RichPipStreamHandler.handleError�s\���������+��	�3�
�����!�!�S�Z�Z�/�%�i��5�*�,�,��w�"�6�*�*r")r6rrirj)rdrmrirj)	rrrr�r}rQr�r�rorps@r#r5r5�s"���+-�H�(�-�
�%�8+�+r"r5c� ��eZdZd�fd�Z�xZS)�BetterRotatingFileHandlerc���ttjj|j��t
�|��Sr�)r�os�path�dirname�baseFilenamerP�_open)rRrUs �r#r�zBetterRotatingFileHandler._open�s*����2�7�7�?�?�4�#4�#4�5�6��w�}��r")rir)rrrr�rorps@r#r�r��s
����r"r�c��eZdZdd�Zdd�Zy)�MaxLevelFilterc��||_yr�)�level)rRr�s  r#rQzMaxLevelFilter.__init__s	����
r"c�4�|j|jkSr�)r\r�)rRrds  r#�filterzMaxLevelFilter.filters���~�~��
�
�*�*r"N)r�rlrirj�rdrmrirh)rrrrQr�r!r"r#r�r�s���+r"r�c�$��eZdZdZd�fd�Z�xZS)�ExcludeLoggerFilterzQ
    A logging Filter that excludes records from a logger (or its children).
    c�$��t�|�|�Sr�)rPr�)rRrdrUs  �r#r�zExcludeLoggerFilter.filters����7�>�&�)�)�)r"r�)rrrr r�rorps@r#r�r�s����*�*r"r�c�*�|dk\rtj}n^|dk(rt}nR|dk(rtj}n<|dk(rtj}n&|dkrtj
}ntj}tj|�}|du}|r|}d}nd}|}|d	vrd
nd}ddd
�}	gd�|rdgngz}
ttj|d��attj|d��}tjjdddtjd�dtj d�dtj d�d�t"dd�t"ddd�d�||	dtddgd d!�d
|	d|dgd d!�||	d|d"gd d!�d|	d#|d$dd%d&�d'�||
d(�d)d*|iid+��|S),znConfigures and sets up all of the logging

    Returns the requested logging level, as its integer value.
    r�����������N�DEBUGz	/dev/null)�INFOrZrXz0pip._internal.utils.logging.RichPipStreamHandlerz5pip._internal.utils.logging.BetterRotatingFileHandler)�streamr0)r6�console_errors�console_subprocess�user_logTr/Fz*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�r`)r�r`rN)rt�indent_with_timestampr�r�r�rt)r��classr6�filters�	formatterr�r0zutf-8r�)r�r��filename�encoding�delayr�)r6r�r�r�)r�r4zpip._vendorr�)�version�disable_existing_loggersr��
formattersr4�root�loggers)r3r�rrXrZ�CRITICALr��getLevelNamer=r8r9r�r��config�
dictConfig�subprocess_loggerr�rM)�	verbosityr1�
user_log_file�level_numberr��include_user_log�additional_log_file�
root_level�vendored_log_level�handler_classesr4r�s            r#�
setup_loggingr�s���A�~��}�}��	�a����	�b������	�b���}�}��	�b���'�'���|�|��� � ��.�E�%�D�0���+���
�)���
�',�/@�&@��g��E�G��O�C�(���b��H�!�c�j�j�8�t�T�O� �c�j�j�8�t�T�O��N�N����(-�G�$�_�_�%�
+�-�2�2�+�
L�-�2�2�'�
� -�+��
-�+�%)�*�
�#�,�X�6�.� 4�6H�I�!)��'�,�X�6�.� 4�5�!)�#�#�,�X�6�.� 8�9�!)�'�%�,�V�4� 3� '�!�!8�
�1 �D$�$��&��1C�'D�E�CB	
�D�L�r")r+ztype[BaseException]r,�
BaseExceptionrirh)rizGenerator[StringIO, None, None])r�)rHrlrizGenerator[None, None, None])rirl)r�rhrir)r�rlr1rhr�z
str | Nonerirl)E�
__future__r�
contextlibr(r3�logging.handlersr�r8�	threading�collections.abcr�dataclassesr�iorrr�typingr	r
�pip._vendor.rich.consolerrr
rrr�pip._vendor.rich.highlighterr�pip._vendor.rich.loggingr�pip._vendor.rich.segmentr�pip._vendor.rich.styler�pip._internal.utils._logrr�pip._internal.utils.compatr�pip._internal.utils.deprecationr�pip._internal.utils.miscrr�localrFr�r�r�r�rr-�contextmanagerrCrIrE�	FormatterrMrrr=r�r5r4�RotatingFileHandlerr�r�r�r�r!r"r#�<module>r�sD��"�����	�
��%�!�&�� ���9�0�,�(�7�.�B�>�
�Y�_�_�
�
������0�1���y��
Q����/��/�>���&��&�1�0��*�*�0�f� � �� �*��*�#(��9+�;�9+�x�� 0� 0� D� D��+�V�+�*�&�*�vr"
Back to Directory File Manager