
    QhL/                       d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	m
Z
 d dlmZ d dlmZ d dlmZ d dlmZmZ d dlmZmZmZmZmZmZ d d	lmZ d d
lmZ d dlmZ d dl m!Z! d dl"m#Z#m$Z$ d dl%m&Z& d dl'm(Z( d dl)m*Z*  ejV                         Z,da-dZ. e$d      Z/ G d de0      Z1d)dZ2ejf                  d*d+d       Z4d,dZ5 G d dejl                        Z7e G d d             Z8 G d de      Z9ddd-dZ: G d  d!e      Z; G d" d#ejx                  jz                        Z> G d$ d%e      Z? G d& d'e      Z@d.d(ZAy)/    )annotationsN)	Generator)	dataclass)TextIOWrapper)Filter)AnyClassVar)ConsoleConsoleOptionsConsoleRenderableRenderableTypeRenderResultRichCast)NullHighlighter)RichHandler)Segment)Style)VERBOSE	getLogger)WINDOWS)DEPRECATION_MSG_PREFIX)
ensure_dirzpip.subprocessorc                      e Zd ZdZy)BrokenStdoutLoggingErrorzO
    Raised if BrokenPipeError occurs for the stdout stream while logging.
    N)__name__
__module____qualname____doc__     W/var/www/teggl/fontify/venv/lib/python3.12/site-packages/pip/_internal/utils/logging.pyr   r   (   s    r    r   c                    | t         u ryt        syt        |t              xr, |j                  t        j
                  t        j                  fv S )NTF)BrokenPipeErrorr   
isinstanceOSErrorerrnoEINVALEPIPE)	exc_classexcs     r!   _is_broken_pipe_errorr+   .   s=    O#
 c7#P		ellEKK5P(PPr    c              #     K   t               t        _        t        xj                  | z  c_        	 d t        xj                  | z  c_        y# t        xj                  | z  c_        w xY w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_logr1   ;   sN      -.Jc!&#%
#%s   -A,A A,A))A,c                 $    t        t        dd      S )Nr/   r   )getattrr.   r   r    r!   r-   r-   J   s    :}a00r    c                  L     e Zd ZdZdd	 	 	 	 	 	 	 d fdZddZd	 fdZ xZS )
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)r6   super__init__)selfr6   argskwargs	__class__s       r!   r9   zIndentingFormatter.__init__Q   s     +$)&)r    c                    |t         j                  k  ry|j                  t              ry|t         j                  k  ryy)zv
        Return the start of the formatted log message (not counting the
        prefix to add to each line).
         z	WARNING: zERROR: )loggingWARNING
startswithr   ERROR)r:   	formattedlevelnos      r!   get_message_startz$IndentingFormatter.get_message_start`   s9    
 W__$ 67 W]]"r    c                8   t         |   |      }| j                  ||j                        }||z   }d}| j                  r| j                  |       d}|dt               z  z  }dj                  |j                  d      D cg c]  }||z   	 c}      }|S c c}w )z
        Calls the standard formatter, but will indent all of the log message
        lines by our current indentation level.
        r?    T)	r8   formatrF   rE   r6   
formatTimer-   join
splitlines)r:   recordrD   message_startprefixliner=   s         r!   rI   zIndentingFormatter.formatp   s    
 GN6*	..y&..I!I-	/02F#)))GGy7K7KD7QRtVd]RS	 Ss   B)r;   r   r6   boolr<   r   returnNone)rD   strrE   intrR   rT   )rM   logging.LogRecordrR   rT   )r   r   r   default_time_formatr9   rF   rI   __classcell__r=   s   @r!   r5   r5   N   sH    -
 $** * 	*
 
*  r    r5   c                  6    e Zd ZU ded<   ded<   	 	 	 	 	 	 ddZy)IndentedRenderabler   
renderablerU   indentc              #     K   |j                  | j                  |      }t        j                  |      }|D ]3  }t        d| j                  z         |E d {    t        d       5 y 7 w)NrH   
)renderr\   r   split_linesr]   )r:   consoleoptionssegmentslinesrP   s         r!   __rich_console__z#IndentedRenderable.__rich_console__   sc      >>$//7;##H- 	 D#+,,OO$-	 s   AA/A-A/N)rb   r
   rc   r   rR   r   )r   r   r   __annotations__rf   r   r    r!   r[   r[      s*    K  )7 	 r    r[   c                      e Zd ZddZy)
PipConsolec                    t               d N)r#   )r:   s    r!   on_broken_pipezPipConsole.on_broken_pipe   s     T)r    N)rR   rS   )r   r   r   rl   r   r    r!   ri   ri      s    *r    ri   Fstderrc                R    | rt         J d       t         S t        J d       t        S )Nzstderr rich console is missing!zstdout rich console is missing!)_stderr_console_stdout_consolerm   s    r!   get_consolerr      s5    *M,MM**M,MM*r    c                  D     e Zd ZU g Zded<   d fdZddZd fdZ xZS )RichPipStreamHandlerzClassVar[list[str] | None]KEYWORDSc                >    t         |   |dddt                      y )NF)rb   	show_time
show_level	show_pathhighlighter)r8   r9   r   )r:   rb   r=   s     r!   r9   zRichPipStreamHandler.__init__   s'    ') 	 	
r    c                p   d }t        |dd      ret        |j                  t              sJ |j                  \  }t        |t        t
        t        f      s
J | d       t        |t                     }n| j                  |      }| j                  ||      }|j                  S|j                  t        j                  k\  rt        d      }n)|j                  t        j                  k\  rt        d      }	 | j                   j#                  |dd|	       y # t$        $ r | j'                  |       Y y w xY w)
NrichFz is not rich-console-renderable)r]   red)coloryellowignore)overflowcropstyle)r3   r$   r;   tupler   r   rT   r[   r-   rI   render_messagerE   r@   rC   r   rA   rb   print	ExceptionhandleError)r:   rM   r   rich_renderabler\   messages         r!   emitzRichPipStreamHandler.emit   s   " 665)fkk5111!'_"3Xs!C C!""ABC  *<(9*J kk&)G,,VW=J~~)>>W]]2!.E^^w6!1E	%LLzH5PUV 	%V$	%s   8D D54D5c                    t        j                         dd \  }}|r>|r<| j                  j                  t         j                  u rt        ||      r
t               t        | !  |      S )z1Called when logging is unable to log some output.N   )	sysexc_inforb   filestdoutr+   r   r8   r   )r:   rM   r)   r*   r=   s       r!   r   z RichPipStreamHandler.handleError   s\     +	3 !!SZZ/%i5*,,w"6**r    )rb   r
   rR   rS   )rM   rV   rR   rS   )	r   r   r   ru   rg   r9   r   r   rX   rY   s   @r!   rt   rt      s"    +-H(-
%8+ +r    rt   c                        e Zd Zd fdZ xZS )BetterRotatingFileHandlerc                    t        t        j                  j                  | j                               t
        |          S rk   )r   ospathdirnamebaseFilenamer8   _open)r:   r=   s    r!   r   zBetterRotatingFileHandler._open   s*    277??4#4#456w}r    )rR   r   )r   r   r   r   rX   rY   s   @r!   r   r      s     r    r   c                      e Zd ZddZddZy)MaxLevelFilterc                    || _         y rk   )level)r:   r   s     r!   r9   zMaxLevelFilter.__init__   s	    
r    c                4    |j                   | j                  k  S rk   )rE   r   )r:   rM   s     r!   filterzMaxLevelFilter.filter   s    ~~

**r    N)r   rU   rR   rS   rM   rV   rR   rQ   )r   r   r   r9   r   r   r    r!   r   r      s    +r    r   c                  $     e Zd ZdZd fdZ xZS )ExcludeLoggerFilterzQ
    A logging Filter that excludes records from a logger (or its children).
    c                $    t         |   |       S rk   )r8   r   )r:   rM   r=   s     r!   r   zExcludeLoggerFilter.filter   s     7>&)))r    r   )r   r   r   r   r   rX   rY   s   @r!   r   r      s    * *r    r   c                *   | dk\  rt         j                  }n^| dk(  rt        }nR| dk(  rt         j                  }n<| dk(  rt         j                  }n&| dk  rt         j
                  }nt         j                  }t        j                  |      }|du}|r|}d}nd}|}|d	v rd
nd}ddd}	g d|rdgng z   }
t        t        j                  |d      at        t        j                  |d      }t         j                  j                  dddt         j                  ddt        j                   ddt        j                   ddt"        ddt"        dddd||	d   t        ddgd d!d
|	d   |dgd d!||	d   |d"gd d!d|	d#   |d$dd%d&d'||
d(d)d*|iid+       |S ),znConfigures and sets up all of the logging

    Returns the requested logging level, as its integer value.
    r      NDEBUGz	/dev/null)INFOrC   rA   z0pip._internal.utils.logging.RichPipStreamHandlerz5pip._internal.utils.logging.BetterRotatingFileHandler)streamr   )rb   console_errorsconsole_subprocessuser_logT)r   no_color	soft_wrapFz*pip._internal.utils.logging.MaxLevelFilter)()r   zlogging.Filter)r   namez/pip._internal.utils.logging.ExcludeLoggerFilter)exclude_warningsrestrict_to_subprocessexclude_subprocessz%(message)s)r   rI   )r   rI   r6   )r]   indent_with_timestampr   r   r   r]   )r   classrb   filters	formatterr   r   zutf-8r   )r   r   filenameencodingdelayr   )rb   r   r   r   )r   handlerszpip._vendorr   )versiondisable_existing_loggersr   
formattersr   rootloggers)r@   r   r   rA   rC   CRITICALr   getLevelNameri   r   r   rq   rn   config
dictConfigsubprocess_loggerr   r5   )	verbosityr   user_log_filelevel_numberr   include_user_logadditional_log_file
root_levelvendored_log_levelhandler_classesr   rp   s               r!   setup_loggingr      s    A~}}	a	b	b}}	b''||  .E %D0+
)
 ',/@&@g EGO C(bH !cjj8tTO cjj8tTONN(- G$__%
 +-22+
 L-22'  -+
 -+%)*
 #,X6. 46HI!) ',X6. 45!)# #,X6. 89!)' %,V4 3 '!!81 D $$ &1C'DECB	
DL r    )r)   ztype[BaseException]r*   BaseExceptionrR   rQ   )r   )r0   rU   rR   zGenerator[None, None, None])rR   rU   )rn   rQ   rR   r
   )r   rU   r   rQ   r   z
str | NonerR   rU   )B
__future__r   
contextlibr&   r@   logging.handlersr   r   	threadingcollections.abcr   dataclassesr   ior   r   typingr   r	   pip._vendor.rich.consoler
   r   r   r   r   r   pip._vendor.rich.highlighterr   pip._vendor.rich.loggingr   pip._vendor.rich.segmentr   pip._vendor.rich.styler   pip._internal.utils._logr   r   pip._internal.utils.compatr   pip._internal.utils.deprecationr   pip._internal.utils.miscr   localr.   rq   rp   r   r   r   r+   contextmanagerr1   r-   	Formatterr5   r[   ri   rr   rt   r   RotatingFileHandlerr   r   r   r   r   r    r!   <module>r      s*   "     	 
  % !      9 0 , ( 7 . B /Y__
01 y 
Q & &10** 0f      * * #( 9+; 9+x 0 0 D D +V +*& *vr    