ó
>ņ[c           @   sæ   d  Z  d d l m Z d d l m Z d d l m Z d d l Z d Z d Z	 d Z
 d	 Z d
 Z d Z d   Z d   Z d   Z d   Z d e f d     YZ d e d d d d d  Z d S(   s(   
Created on Sep 23, 2013

@author: sean
i’’’’(   t   SummaryReporter(   t   Numbers(   t	   NotPythonNs   [33ms   [34ms   [32ms   [31ms   [0ms   [1mc         C   s   t  t |  t S(   N(   t   BOLDt   OKGREENt   ENDC(   t   text(    (    sc   lib/python2.7/site-packages/anaconda_client-1.7.2-py2.7.egg/binstar_client/tests/coverage_report.pyt   green   s    c         C   s   t  |  t S(   N(   t   FAILR   (   R   (    (    sc   lib/python2.7/site-packages/anaconda_client-1.7.2-py2.7.egg/binstar_client/tests/coverage_report.pyt   red   s    c         C   s   t  |  t S(   N(   t   WARNINGR   (   R   (    (    sc   lib/python2.7/site-packages/anaconda_client-1.7.2-py2.7.egg/binstar_client/tests/coverage_report.pyt   orange   s    c         C   s   t  |  t S(   N(   t   OKBLUER   (   R   (    (    sc   lib/python2.7/site-packages/anaconda_client-1.7.2-py2.7.egg/binstar_client/tests/coverage_report.pyt   blue   s    t   ColorSummaryReporterc           B   s5   e  Z e d     Z d   Z d   Z d d  Z RS(   c         C   s@   t  g  |  j D] } t | j  ^ q d g  } d | } | S(   Ni   s	   %%- %ds  (   t   maxt
   code_unitst   lent   name(   t   selft   cut   max_namet   fmt_name(    (    sc   lib/python2.7/site-packages/anaconda_client-1.7.2-py2.7.egg/binstar_client/tests/coverage_report.pyR       s    2
c         C   s”   |  j  d } |  j r# | d 7} n  t j   } t } | d k  rJ t } n  | d k  r_ t } n  | | d | d f  7} |  j j r | d 7} n  | d 7} | S(	   Ns   %6d %6ds    %6d %6diP   i2   s	   %%%ds%%%%i   s      %ss   
(	   R   t   branchesR   t   pc_str_widthR   R   R	   t   configt   show_missing(   R   t   perct   fmt_coveraget   width100t   color(    (    sc   lib/python2.7/site-packages/anaconda_client-1.7.2-py2.7.egg/binstar_client/tests/coverage_report.pyR   &   s    			
c         C   sY   |  j  d d } |  j r' | d 7} n  t j   } | d | d d f 7} | d 7} | S(   Nt   Names    Stmts   Misss    Branch BrMisss   %*si   t   Covers   
(   R   R   R   R   (   R   t   headerR   (    (    sc   lib/python2.7/site-packages/anaconda_client-1.7.2-py2.7.egg/binstar_client/tests/coverage_report.pyR!   8   s    	
c         C   sE  |  j  |  d } |  j   } d t |  d } | sE t j } n  | j |  | j |  t   } xW|  j D]L} y² |  j j	 |  } | j
 }	 | j |	 j |	 j f }
 |  j rŠ |
 |	 j |	 j f 7}
 n  |
 |	 j f 7}
 |  j j r|
 | j   f 7}
 n  | j |  j |	 j  |
  | |	 7} Wqr t k
 r@  qr |  j j } | rt j   d  \ } } | t k r| j   rt } qn  | r¾| j | | j | j | f  q¾qr Xqr W| j d k rA| j |  d | j | j f }
 |  j r|
 | j | j f 7}
 n  |
 | j f 7}
 |  j j rA|
 d 7}
 qAn  | S(	   s   Writes a report summarizing coverage statistics per module.

        `outfile` is a file object to write the summary to.

        s   %s   %s: %s
t   -s   
i   i   t   TOTALt    (   R$   (   t   find_code_unitsR!   R   t   syst   stdoutt   writeR   R   t   coveraget   _analyzet   numbersR   t   n_statementst	   n_missingR   t
   n_branchest   n_missing_branchest   pc_covered_strR   R   t   missing_formattedR   t
   pc_coveredt   KeyboardInterruptt   ignore_errorst   exc_infoR   t   should_be_pythont   Falset   __name__t   n_files(   R   t   morfst   outfilet   fmt_errR!   t   rulet   totalR   t   analysist   numst   argst	   report_itt   typt   msg(    (    sc   lib/python2.7/site-packages/anaconda_client-1.7.2-py2.7.egg/binstar_client/tests/coverage_report.pyt   reportA   sP    			+	N(   R8   t
   __module__t   propertyR   R   R!   t   NoneRE   (    (    (    sc   lib/python2.7/site-packages/anaconda_client-1.7.2-py2.7.egg/binstar_client/tests/coverage_report.pyR      s   			c      	   C   sT   |  j    |  j j d | d | d | d |  t |  |  j  } | j | d | S(   NR4   t   omitt   includeR   R;   (   t   _harvest_dataR   t	   from_argsR   RE   (   t   covR:   R   R4   t   fileRI   RJ   t   reporter(    (    sc   lib/python2.7/site-packages/anaconda_client-1.7.2-py2.7.egg/binstar_client/tests/coverage_report.pyRE   }   s    
(   t   __doc__t   coverage.summaryR    t   coverage.resultsR   t   coverage.miscR   R&   R
   R   R   R   R   R   R   R	   R   R   R   RH   R7   RE   (    (    (    sc   lib/python2.7/site-packages/anaconda_client-1.7.2-py2.7.egg/binstar_client/tests/coverage_report.pyt   <module>   s$   				_	