ó
ž^Yc           @   s|   d  Z  d d l Z d d l Z d d l m Z m Z d d l m Z m Z m	 Z	 m
 Z
 e
 e  Z d e f d     YZ d S(   s$   Reporter foundation for coverage.py.i˙˙˙˙N(   t   prep_patternst   FnmatchMatcher(   t   CoverageExceptiont   NoSourcet	   NotPythont   isolate_modulet   Reporterc           B   s;   e  Z d  Z d   Z e d    Z d   Z d d  Z RS(   s   A base class for all reporters.c         C   s(   | |  _  | |  _ d |  _ g  |  _ d S(   sĽ   Create a reporter.

        `coverage` is the coverage instance. `config` is an instance  of
        CoverageConfig, for controlling all sorts of behavior.

        N(   t   coveraget   configt   Nonet	   directoryt   _file_reporters(   t   selfR   R   (    (    s1   /tmp/pip-build-hU8Cw8/coverage/coverage/report.pyt   __init__   s    			c         C   s   t  j d t  |  j S(   s8   Keep .file_reporters working for private-grabbing tools.sD   Report.file_reporters will no longer be available in Coverage.py 4.2(   t   warningst   warnt   DeprecationWarningR   (   R   (    (    s1   /tmp/pip-build-hU8Cw8/coverage/coverage/report.pyt   file_reporters&   s    c         C   sĚ   |  j  j |  } |  j j rd t t |  j j   } g  | D] } | j | j  r= | ^ q= } n  |  j j rś t t |  j j   } g  | D] } | j | j  s | ^ q } n  t	 |  |  _
 |  j
 S(   s   Find the FileReporters we'll report on.

        `morfs` is a list of modules or file names.

        Returns a list of FileReporters.

        (   R   t   _get_file_reportersR   t   includeR   R    t   matcht   filenamet   omitt   sortedR   (   R   t   morfst	   reporterst   matchert   fr(    (    s1   /tmp/pip-build-hU8Cw8/coverage/coverage/report.pyt   find_file_reporters/   s    ..c         C   s  |  j  |  } | s$ t d   n  | |  _ |  j r_ t j j |  j  r_ t j |  j  n  x | D] } y | | |  j j |   Wqf t	 k
 rŽ |  j
 j sü   qü qf t k
 rű | j   rü |  j
 j rň |  j j d j | j   qř   qü qf Xqf Wd S(   s?  Run a reporting function on a number of morfs.

        `report_fn` is called for each relative morf in `morfs`.  It is called
        as::

            report_fn(file_reporter, analysis)

        where `file_reporter` is the `FileReporter` for the morf, and
        `analysis` is the `Analysis` for the morf.

        s   No data to report.s   Could not parse Python file {0}N(   R   R   R
   t   ost   patht   existst   makedirsR   t   _analyzeR   R   t   ignore_errorsR   t   should_be_pythont   _warnt   formatR   (   R   t	   report_fnR   R
   R   R   (    (    s1   /tmp/pip-build-hU8Cw8/coverage/coverage/report.pyt   report_filesD   s"    		N(	   t   __name__t
   __module__t   __doc__R   t   propertyR   R   R	   R'   (    (    (    s1   /tmp/pip-build-hU8Cw8/coverage/coverage/report.pyR      s
   			(   R*   R   R   t   coverage.filesR    R   t   coverage.miscR   R   R   R   t   objectR   (    (    (    s1   /tmp/pip-build-hU8Cw8/coverage/coverage/report.pyt   <module>   s   "