
    5 f%              
         d Z ddlmZ ddlZddlZddlZddlZddlmZm	Z	 ddl
mZmZmZmZ ddlmZ ddlmZ ddlmZ erdd	lmZ dd
lmZ  G d de          Zeeef         Zg dZdZdZdZddddddddZ ddddddddd d!	Z!d"  e	e          D             Z"	 d:d'Z#d;d)Z$ G d* d+e          Z% G d, d-e%          Z& G d. d/e%          Z' G d0 d1e'          Z( G d2 d3e%          Z) G d4 d5e%          Z*d<d9Z+dS )=zwPlain text reporters:.

:text: the default one grouping messages by module
:colorized: an ANSI colorized text reporter
    )annotationsN)asdictfields)TYPE_CHECKINGDict
NamedTupleTextIO)Message)BaseReporter)
TextWriter)PyLinter)Sectionc                  @    e Zd ZU dZded<   	 dZded<   	 dd	ZddZdS )MessageStylezStyling of a message.
str | Nonecolor ztuple[str, ...]stylereturnstrc                d   d | j         D             }| j        rp| j                                        r2|                    ddg           |                    | j                   n%|                    t
          | j                            |r%t          d                    |          z   t          z   S dS )zReturn ANSI escape code corresponding to color and style.

        :raise KeyError: if a nonexistent color or style identifier is given

        :return: the built escape code
        c                (    g | ]}t           |         S r   )ANSI_STYLES).0effects     K/var/www/equiseq/venv/lib/python3.11/site-packages/pylint/reporters/text.py
<listcomp>z0MessageStyle.__get_ansi_code.<locals>.<listcomp>.   s    BBBV[(BBB    385; )	r   r   isdigitextendappendANSI_COLORSANSI_PREFIXjoinANSI_END)self	ansi_codes     r   __get_ansi_codezMessageStyle.__get_ansi_code'   s     CBtzBBB	: 	:z!!## :  $---  ,,,,  TZ!8999 	@)!4!44x??rr   msgc                    | j         t          | j                  dk    r|S |                                 }|r| | t           S |S )Nr   )r   lenr   _MessageStyle__get_ansi_code
ANSI_RESET)r*   r-   escape_codes      r   _colorize_ansizMessageStyle._colorize_ansi9   sU    :#dj//Q"6"6J**,, 	5!434
444
r   N)r   r   )r-   r   r   r   )__name__
__module____qualname____doc____annotations__r   r0   r3   r   r   r   r   r      sk           EJ   $     r   r   )r"   =-.z[mz[0m0134r    79)resetbolditalic	underlineblinkinversestrike3031323334353637)	rC   blackredgreenyellowbluemagentacyanwhitec                    h | ]	}|j         
S r   )name)r   is     r   	<setcomp>r]   `   s    222Q!&222r   r-   r   	msg_styler   c                ,    |                     |           S )z7Colorize message by wrapping it with ANSI escape codes.)r3   )r-   r^   s     r   colorize_ansir`   d   s    ##C(((r   r
   c                    d| j          S )Nz************* Module )module)r-   s    r   make_headerrc   i   s    /3:///r   c                  R     e Zd ZdZdZdZdZdd fd
ZddZddZ	ddZ
ddZ xZS )TextReporterz+Reports messages and layouts in plain text.texttxtz2{path}:{line}:{column}: {msg_id}: {msg} ({symbol})NoutputTextIO | Noner   Nonec                    t                                          |           t                      | _        | j        | _        | j        | _        d S N)super__init__set_modulesline_format	_template_fixed_templater*   rh   	__class__s     r   rn   zTextReporter.__init__t   sA       "%%%)#/QQr   rb   r   filepathr   c                \   t          | j        j        j        p| j                  }|| j        k    rdS || _        t          j        d|          }|D ]S}|d         t          vrBt          j	        d|d          dd           t          j
        d|d         z   d	z   d
|          }T|| _        dS )zHSet the format template to be used and check for unrecognized arguments.Nz\{(\w+?)(:.*)?\}r   zDon't recognize the argument 'zW' in the --msg-template. Are you sure it is supported on the current version of pylint?   
stacklevelz\{z	(:.*?)?\}r"   )r   linterconfigmsg_templaterr   refindallMESSAGE_FIELDSwarningswarnsubrs   )r*   rb   rv   template	argumentsarguments         r   on_set_current_modulez"TextReporter.on_set_current_module{   s    t{)6H$.II t~%%F " J2H==	! 	T 	TH{.00UXa[ U U U    
 6%(1+"5"Db(SS'r   r-   r
   c                    t          |          }dD ]}||         pd||<   |                      | j        j        di |           dS )z]Convenience method to write a formatted message with class default
        template.
        end_line
end_columnr"   Nr   )r   writelnrs   formatr*   r-   	self_dictkeys       r   write_messagezTextReporter.write_message   sa     3KK	- 	2 	2C&s^1rIcNN0T)0==9==>>>>>r   c                    |j         | j        vrA|                     t          |                     | j                            |j                    |                     |           dS )z<Manage message of different type and in the context of path.N)rb   rp   r   rc   addr   r*   r-   s     r   handle_messagezTextReporter.handle_message   s]    :T]**LLS))***Mcj)))3r   layoutr   c                ~    t          | j                   t                                          || j                   dS )zLaunch layouts display.)fileN)printoutr   r   )r*   r   s     r   _displayzTextReporter._display   s7    48FDH-----r   rl   rh   ri   r   rj   )rb   r   rv   r   r   rj   r-   r
   r   rj   )r   r   r   rj   )r4   r5   r6   r7   r[   	extensionrq   rn   r   r   r   r   __classcell__ru   s   @r   re   re   m   s        55DIFKR R R R R R R( ( ( (.? ? ? ?       . . . . . . . .r   re   c                      e Zd ZdZdZd	dZdS )
NoHeaderReporterzCReports messages and layouts in plain text without a module header.z	no-headerr-   r
   r   rj   c                    |j         | j        vr| j                            |j                    |                     |           dS )z'Write message(s) without module header.N)rb   rp   r   r   r   s     r   r   zNoHeaderReporter.handle_message   sC    :T]**Mcj)))3r   Nr   )r4   r5   r6   r7   r[   r   r   r   r   r   r      s3        MMD           r   r   c                  .     e Zd ZdZdZdZd
d fd	Z xZS )ParseableTextReporterzA reporter very similar to TextReporter, but display messages in a form
    recognized by most text editors :

    <filename>:<linenum>:<msg>
    	parseablez0{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}Nrh   ri   r   rj   c                    t          j        | j         d| j         t          d           t                                          |           d S )NzC output format is deprecated. This is equivalent to --msg-template=rx   ry   )r   r   r[   rq   DeprecationWarningrm   rn   rt   s     r   rn   zParseableTextReporter.__init__   sY    yoo]a]moo	
 	
 	
 	

 	     r   rl   r   )r4   r5   r6   r7   r[   rq   rn   r   r   s   @r   r   r      sX          DDK! ! ! ! ! ! ! ! ! ! !r   r   c                      e Zd ZdZdZdZdS )VSTextReporterzVisual studio text reporter.msvsz/{path}({line}): [{msg_id}({symbol}){obj}] {msg}N)r4   r5   r6   r7   r[   rq   r   r   r   r   r      s        &&DCKKKr   r   c            
           e Zd ZU dZdZ ed           edd           edd           ed           edd           edd	           ed
d          dZded<   	 	 dd fdZddZ	d dZ
 xZS )!ColorizedTextReporterz/Simple TextReporter that colorizes text output.	colorizedrT   N)rD   rW   )rD   rE   rS   )rD   rF   rU   )rH   )ICRWEFSColorMappingDictCOLOR_MAPPINGrh   ri   color_mappingColorMappingDict | Noner   rj   c                (   t                                          |           |pt          j        | _        ddg}t
          j                            d          |vr5t          j	        dk    r'dd l
}|                    | j                  | _        d S d S d S )Nzxterm-16colorzxterm-256colorTERMwin32r   )rm   rn   r   r   r   osenvirongetsysplatformcoloramaAnsiToWin32r   )r*   rh   r   
ansi_termsr   ru   s        r   rn   zColorizedTextReporter.__init__   s    
 	   *Q.C.Q%'78
:>>&!!33|w&&#//99 43&&r   msg_idr   r   c                `    | j                             |d                   pt          d          S )z;Returns the message style as defined in self.color_mapping.r   N)r   r   r   )r*   r   s     r   _get_decorationz%ColorizedTextReporter._get_decoration   s*    !%%fQi00FL4F4FFr   r-   r
   c                   |j         | j        vrf|                     d          }t          t	          |          |          }|                     |           | j                            |j                    |                     |j                  }t          |j        |          |_        t          |j	        |          |_	        t          |j
        |          |_
        t          |j        |          |_        |                     |           dS )z`Manage message of different types, and colorize output
        using ANSI escape codes.
        r   N)rb   rp   r   r`   rc   r   r   r   r-   symbolcategoryr   )r*   r-   r^   modseps       r   r   z$ColorizedTextReporter.handle_message   s     :T]**,,S11I";s#3#3Y??FLL   Mcj)))((//	33"3:y99
$S\9==ceY//3r   )NN)rh   ri   r   r   r   rj   )r   r   r   r   r   )r4   r5   r6   r7   r[   r   r   r8   rn   r   r   r   r   s   @r   r   r      s
        99D\'""\$	**\)%788\)$$\%++\%!677\(L11' 'M     !%15: : : : : : :G G G G               r   r   c                  4    e Zd ZdZdZdZdddddddZddZdS )GithubReporterz[Report messages in GitHub's special format to annotate code in its user
    interface.
    githubzZ::{category} file={path},line={line},endline={end_line},col={column},title={msg_id}::{msg}errorwarningnotice)r   r   r   r   r   r   r-   r
   r   rj   c                    t          |          }dD ]}||         pd||<   | j                            |j                  pd|d<   |                      | j        j        di |           d S )Nr   r"   r   r   r   )r   category_mapr   r   r   rs   r   r   s       r   r   zGithubReporter.write_message  s    3KK	- 	2 	2C&s^1rIcNN $ 1 5 5ce < < G	*0T)0==9==>>>>>r   Nr   )r4   r5   r6   r7   r[   rq   r   r   r   r   r   r   r     s\          DnK L? ? ? ? ? ?r   r   r{   r   rj   c                >   |                      t                     |                      t                     |                      t                     |                      t                     |                      t
                     |                      t                     d S rl   )register_reporterre   r   r   r   r   r   )r{   s    r   registerr     s    
\***
-...
2333
^,,,
2333
^,,,,,r   )r-   r   r^   r   r   r   )r-   r
   r   r   )r{   r   r   rj   ),r7   
__future__r   r   r~   r   r   dataclassesr   r   typingr   r   r   r	   pylint.messager
   pylint.reportersr   %pylint.reporters.ureports.text_writerr   pylint.lintr   pylint.reporters.ureports.nodesr   r   r   r   TITLE_UNDERLINESr'   r)   r1   r   r&   r   r`   rc   re   r   r   r   r   r   r   r   r   r   <module>r      s  
  # " " " " " 				 				 



  & & & & & & & & : : : : : : : : : : : : " " " " " " ) ) ) ) ) ) < < < < < < 8$$$$$$777777$ $ $ $ $: $ $ $N \)* &&& 
  
 
 32&&//222 &) ) ) )
0 0 0 09. 9. 9. 9. 9.< 9. 9. 9.x	  	  	  	  	 | 	  	  	 ! ! ! ! !L ! ! !&D D D D D* D D D0  0  0  0  0 L 0  0  0 f? ? ? ? ?\ ? ? ?2- - - - - -r   