
    vKg                       S r SSKJr  SSKrSSKrSSKrSSKrSSKr\R                  " S\R                  5      r
SSSS.r\R                  " S	S
9 " S S5      5       rSS jrSS jrSS jr\S:X  a  \" \R$                  SS 5        gg)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                  l    \ rS rSr% SrS\S'   S\S'   S\S'   S\S'   S	rS
\S'   S	rS
\S'   S	rS
\S'   Sr	g	)Result(   z7Accumulated 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____firstlineno____doc____annotations__r   r   r   __static_attributes__r       Y/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/trio/_tools/mypy_annotate.pyr   r   (   s7    AMO
IL Iz HjGZr   r   c           
        [         R                  U R                  5       5      =n(       a^  UR                  5       u  p#pEpgn[	        U[        U5      Ub  [        U5      OS Ub  [        U5      OS Ub  [        U5      OS [        U   US9$ g )N)r   r   r   r   r   r   r   )	report_re	fullmatchrstripgroupsr   r   mypy_to_github)	linematchr   st_linest_colr   r   r   r   s	            r   process_liner*   5   s    ##DKKM22u2FKllnC6WG7|%+%7c&kT&.&:S]$+$7CLT%
 	
 r   c                   U R                  5        GHR  u  p[        SUR                   SUR                   SUR                   S3SS9  UR
                  b  [        SUR
                   S3SS9  UR                  bv  UR                  bi  [        S	UR                   S
UR                   S3SS9  SUR                   SUR
                   SUR                   SUR                   SUR                   3
nOESUR                   SUR
                   SUR                   3nOUR                   SUR                   3n[        SSR                  U5       SUR                   SU 35        GMU     g)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)resultsres	platformsr   s       r   exportr8   E   s=   !--/388*F3<<.s~~6FaHbQ==$Dq)r2{{&3<<+Ck#++aHbQcnn-Qs}}oSaPSP[P[}\^_b_j_j^klcnn-Qs}}oR}M(#++7GCHHY/03<<.'KL *r   c                "   [         R                  " [        S9nUR                  SSSS9  UR                  SSSS	9  UR	                  U 5      n [        UR                  S
5       n[        R                  " U5      nSSS5        UR                  c  [        W5        gUR                  n[        R                   HE  n[        U5      nUb   WU   R!                  U5        [        R$                  R'                  U5        MG     [        UR                  S5       n[        R(                  " WU5        SSS5        g! , (       d  f       N= f! [        [        R                  4 a    0 n Nf = f! ["         a	    U/WU'    Nf = f! , (       d  f       g= f)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platformr8   sysstdinr*   appendKeyErrorstdoutwritedump)argvparsercmd_linefr5   rJ   r&   parseds           r   mainrW   U   se   $$9F
1  
 =  
   &H(##T*akk!nG +  w ))IID!$'F!1FO**84 JJT"  (##T*aKK# +*' +*v556    1'/jGFO1 +*sN   E #D7:E 	E*F 7
EE E E'&E'*E=<E= 
F__main__   )r&   r   returnzResult | None)r5   zdict[Result, list[str]]rZ   None)rR   z	list[str]rZ   r[   )r   
__future__r   r@   rF   rerK   attrscompileVERBOSEr!   r%   frozenr   r*   r8   rW   r   rR   r   r   r   <module>rb      s    #   	 
  JJ JJ	  d	 	 	 M %$P z!" r   