
     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Z ej        dej	                  Z
ddddZ ej        d	
           G d d                      ZddZddZddZedk    r eej        dd                    dS dS )a  Translates Mypy's output into GitHub's error/warning annotation syntax.

See: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

This first is run with Mypy's output piped in, to collect messages in
mypy_annotate.dat. After all platforms run, we run this again, which prints the
messages in GitHub's format but with cross-platform failures deduplicated.
    )annotationsNa)  
    ([^:]+):  # Filename (anything but ":")
    ([0-9]+):  # Line number (start)
    (?:([0-9]+):  # Optional column number
      (?:([0-9]+):([0-9]+):)?  # then also optionally, 2 more numbers for end columns
    )?
    \s*(error|warn|note):  # Kind, prefixed with space
    (.+)  # Message
    errorwarningnotice)r   warnnoteT)kw_onlyc                  f    e Zd ZU dZded<   ded<   ded<   ded<   dZd	ed
<   dZd	ed<   dZd	ed<   dS )Resultz7Accumulated results, used as a dict key to deduplicate.strfilenameint
start_linekindmessageNz
int | None	start_colend_lineend_col)__name__
__module____qualname____doc____annotations__r   r   r        \/var/www/api.educacionweb.es/myenv/lib/python3.11/site-packages/trio/_tools/mypy_annotate.pyr   r   (   so         AAMMMOOOIIILLL I    HGr   r   liner   returnResult | Nonec           	     \   t                               |                                           x}r}|                                \  }}}}}}}t	          |t          |          |t          |          nd |t          |          nd |t          |          nd t          |         |          S d S )N)r   r   r   r   r   r   r   )	report_re	fullmatchrstripgroupsr   r   mypy_to_github)	r   matchr   st_linest_colr   r   r   r   s	            r   process_liner)   5   s    ##DKKMM222u FKllnnC'68WdG7||%+%7c&kkkT&.&:S]]]$+$7CLLLT%
 
 
 	
 tr   resultsdict[Result, list[str]]Nonec                B   |                                  D ]\  }}t          d|j         d|j         d|j         dd           |j        t          d|j         dd           |j        T|j        Mt          d	|j         d
|j         dd           d|j         d|j         d|j         d|j         d|j         
}n,d|j         d|j         d|j         }n|j         d|j         }t          dd	                    |           d|j         d|            
dS )zDisplay the collected results.z::z file=z,line=, )endNzcol=zendLine=z,endColumn=(:z - z):ztitle=Mypy-+)
itemsprintr   r   r   r   r   r   r   join)r*   res	platformsr   s       r   exportr9   E   st   !--// M MYH38HH3<HHs~HHHbQQQQ=$))))r2222{&3<+CHHH#+HHHbQQQQlcnlls}llllPSP[ll_b_jllMcnMMs}MMMM77#+77GKCHHY//KK3<KK'KKLLLLM Mr   argv	list[str]c                .   t          j        t                    }|                    ddd           |                    ddd	           |                    |           }	 t          |j        d
          5 }t          j        |          }ddd           n# 1 swxY w Y   n# t          t          j
        f$ r i }Y nw xY w|j        t          |           dS |j        }t          j        D ]e}t          |          }|3	 ||                             |           n# t"          $ r	 |g||<   Y nw xY wt          j                            |           ft          |j        d          5 }t          j        ||           ddd           dS # 1 swxY w Y   dS )z0Look for error messages, and convert the format.)descriptionz
--dumpfilez"File to write pickled messages to.T)helprequiredz
--platformz.OS name, if set Mypy should be piped to stdin.N)r>   defaultrbwb)argparseArgumentParserr   add_argument
parse_argsopendumpfilepickleloadFileNotFoundErrorUnpicklingErrorplatformr9   sysstdinr)   appendKeyErrorstdoutwritedump)r:   parsercmd_linefr*   rM   r   parseds           r   mainrY   U   sJ   $999F
?$     =    
   &&H(#T** 	%ak!nnG	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	%v56     w )I 	# 	#D!$''F!1FO**84444 1 1 1'/jGFOOO1JT""""(#T** 	$aK###	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$sZ   !B# 6BB# BB# BB# #B>=B> DD/.D/'F

FF__main__   )r   r   r   r   )r*   r+   r   r,   )r:   r;   r   r,   )r   
__future__r   rC   rI   rerN   attrscompileVERBOSEr!   r%   frozenr   r)   r9   rY   r   r:   r   r   r   <module>rb      sB    # " " " " "   				 



  BJ J 	   d	 	 	 	 	 	 	 	    M M M M #$ #$ #$ #$L zD!"" r   