
    He                        d Z ddlmZ ddlZddlmZmZmZmZm	Z	m
Z
 ddlmZmZ ddlmZ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
rddlmZ  G d de	      Z	 	 	 	 	 	 	 	 	 	 ddZ	 	 	 	 	 	 ddZy)z$Reporter foundation for coverage.py.    )annotationsN)CallableIterableIteratorIOProtocolTYPE_CHECKING)NoDataError	NotPython)prep_patternsGlobMatcher)ensure_dir_for_filefile_be_gone)FileReporter)Analysis)TMorf)Coveragec                  $    e Zd ZU dZded<   ddZy)ReporterzWhat we expect of reporters.strreport_typec                     y)z3Generate a report of `morfs`, written to `outfile`.N )selfmorfsoutfiles      6/usr/lib/python3/dist-packages/coverage/report_core.pyreportzReporter.report   s        N)r   Iterable[TMorf] | Noner   zIO[str]returnfloat)__name__
__module____qualname____doc____annotations__r   r   r   r   r   r      s    &Br   r   c                b   d}d}| dk(  rt         j                  }nt        |        t        | dd      }|}d}	 |j	                  ||      }| |d	|j
                   d
|         d}|||j                          |rt        |        S S S # ||j                          |rt        |        w w w xY w)zRun a one-file report generator, managing the output file.

    This function ensures the output file is ready to be written to. Then writes
    the report to it. Then closes the file and cleans up.

    NF-wzutf-8)encodingT)r   zWrote z to )sysstdoutr   openr   r   closer   )output_pathreporterr   msgfnfile_to_closedelete_filer   rets           r   render_reportr6   "   s     MKc**
 	K({C':
*ooeWo5$F8//0[MBC$![)  %=$![)  %s   0B #B.c              #  `  K   | j                  |      }| j                  }|j                  rJt        t	        |j                        d      }|D cg c]   }|j                  |j                        s|" }}|j                  rJt        t	        |j                        d      }|D cg c]   }|j                  |j                        r|" }}|st        d      t        |      D ]  }	 | j                  |      }||f  y
c c}w c c}w # t        $ rD |j                         r1|j                  r$d|j                   d}| j                  |d       n Y tt        $ rK}|j                  r4d|j                   d	| j!                         }| j                  |d       n Y d
}~d
}~ww xY ww)zGet the files to report on.

    For each morf in `morfs`, if it should be reported on (based on the omit
    and include configuration options), yield a pair, the `FileReporter` and
    `Analysis` for the morf.

    report_includereport_omitzNo data to report.zCouldn't parse Python file ''zcouldnt-parse)slugzCouldn't parse 'z': N)_get_file_reportersconfigr8   r   r   matchfilenamer9   r
   sorted_analyzer   should_be_pythonignore_errors_warn	Exceptionrstrip)	coverager   file_reportersr=   matcherfranalysismsgexcs	            r   get_analysis_to_reportrN   I   s     11%8N__FmF,A,ABDTU'5Tr{{9S"TTmF,>,>?O'5XW]]2;;=W"XX.//^$ !	!((,H& x. +! U Y  
	
 ""$''8QGCNN3_N= 	##(S>EEGs9 :	sb   AF. D0D41F.% DD
F.(D9F.A
F+F.F+ AF&!F.&F++F.)
r0   r   r1   r   r   r    r2   zCallable[[str], None]r!   r"   )rG   r   r   r    r!   z'Iterator[tuple[FileReporter, Analysis]])r&   
__future__r   r,   typingr   r   r   r   r   r	   coverage.exceptionsr
   r   coverage.filesr   r   coverage.miscr   r   coverage.pluginr   coverage.resultsr   coverage.typesr   rG   r   r   r6   rN   r   r   r   <module>rW      s    + " 
  7 5 ; ( %  !Bx B$*$*$* "$* !	$*
 $*N.!.!!.! -.!r   