ó
ž^Yc           @   s~   d  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	 m
 Z
 m Z m Z d e f d     YZ d S(	   s   Summary reportingi˙˙˙˙N(   t   env(   t   Reporter(   t   Numbers(   t	   NotPythont   CoverageExceptiont   output_encodingt   StopEverythingt   SummaryReporterc           B   s#   e  Z d  Z d   Z d d  Z RS(   s*   A reporter for writing the summary report.c         C   s/   t  t |   j | |  | j j   |  _ d  S(   N(   t   superR   t   __init__t   datat   has_arcst   branches(   t   selft   coveraget   config(    (    s2   /tmp/pip-build-hU8Cw8/coverage/coverage/summary.pyR	      s    c      	      sę    d& k r t j   n    f d   } g  } d } t   } d } x=|  j |  D],} y |  j j |  }	 |	 j }
 | |
 7} |  j j	 rÉ |
 j
 d k } |
 j d k } | rÉ | rÉ | d 7} wR qÉ n  | j | |	 f  WqR t k
 ró   qR t k
 r}|  j j } | rQt j   d  \ } } t | t  rQ| j   rQt } qQn  | r~| | | j   | j | f  q~qR XqR Wt g  | D] \ } }	 t | j    ^ qd g  } d | } d } | d	 d
 } | d } |  j r| d 7} | d 7} n  t j   } | d | d d f 7} | d | d f 7} |  j j r^| d 7} | d 7} n  d t |  } t d d d d d d d d  } |  j rˇ| j t d d d d   n  | |  | |  g  } x| D]\ } }	 yí |	 j }
 | j   |
 j |
 j
 f } |  j r-| |
 j |
 j f 7} n  | |
 j  f 7} |  j j rŁ|	 j!   } |  j r|	 j"   } | r| r| d 7} n  | | 7} qn  | | f 7} n  | | } | |
 j# f 7} | j | | f  WqŘt k
 r[|  j j } | r/t j   d  \ } } | t k r/| j   r/t } q/n  | r\| | | j   | j | f  q\qŘXqŘWt$ |  j d d&  rÖ| j% |  j j& j'      d& k rşt( d j) |  j j&    n  | j& d   f d!    n  x | D] } | | d  qÝW| j* d k r| |  d" | j | j
 f } |  j rE| | j | j f 7} n  | | j  f 7} |  j j rn| d' 7} n  | | |  n  | j* r| rt( d$   n  |  j j	 rÚ| rÚ| | | | d k rĚd% n d# f  n  | j oé| j# S((   sŮ   Writes a report summarizing coverage statistics per module.

        `outfile` is a file object to write the summary to. It must be opened
        for native strings (bytes on Python 2, Unicode on Python 3).

        c            sB   t  j r |  j t    }  n    j |  j      j d  d S(   s-   Write a line to the output, adding a newline.s   
N(   R    t   PY2t   encodeR   t   writet   rstrip(   t   line(   t   outfile(    s2   /tmp/pip-build-hU8Cw8/coverage/coverage/summary.pyt   writeout   s    	i    u   %s   %s: %si   i   i   u	   %%- %ds  u,   
%s file%s skipped due to complete coverage.t   Nameu    Stmts   Missu   %6d %6du    Branch BrPartu    %6d %6du   %*si   t   Coveru	   %%%ds%%%%i   u
      Missingu      %su   -t   namet   stmtst   misst   coveri˙˙˙˙t   brancht   brparts   , t   sorts   Invalid sorting option: {0!r}t   keyc            s   |  d   |  d f S(   Ni   i    (    (   t   l(   t   position(    s2   /tmp/pip-build-hU8Cw8/coverage/coverage/summary.pyt   <lambda>   s    t   TOTALt    s   No data to report.t   sN(   R%   (+   t   Nonet   syst   stdoutR   t   find_file_reportersR   t   _analyzet   numbersR   t   skip_coveredt	   n_missingt   n_partial_branchest   appendR   t	   Exceptiont   ignore_errorst   exc_infot
   issubclassR   t   should_be_pythont   Falset   relative_filenamet   __name__t   maxt   lenR   t   pc_str_widtht   show_missingt   dictt   updatet   n_statementst
   n_branchest   pc_covered_strt   missing_formattedt   arcs_missing_formattedt
   pc_coveredt   getattrt   getR   t   lowerR   t   formatt   n_files(   R   t   morfsR   R   t   fr_analysist   skipped_countt   totalt   fmt_errt   frt   analysist   numst   no_missing_linest   no_missing_branchest	   report_itt   typt   msgt   max_namet   fmt_namet   fmt_skip_coveredt   headert   fmt_coveraget   width100t   rulet   column_ordert   linest   argst   missing_fmtdt   branches_fmtdt   textR   (    (   R   R"   s2   /tmp/pip-build-hU8Cw8/coverage/coverage/summary.pyt   report   sÄ    		

	+8

	

!	

			
+
	)N(   R8   t
   __module__t   __doc__R	   R'   Rd   (    (    (    s2   /tmp/pip-build-hU8Cw8/coverage/coverage/summary.pyR      s   	(   Rf   R(   R   R    t   coverage.reportR   t   coverage.resultsR   t   coverage.miscR   R   R   R   R   (    (    (    s2   /tmp/pip-build-hU8Cw8/coverage/coverage/summary.pyt   <module>   s   "