ó
'![c           @  s¾   d  Z  d d l m Z d d l Z d d l Z d d l Z d d l Z d d l Z d d d g Z e j	 d k r| d	 „  Z
 n  d
 „  Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d „  Z d S(   s+   utilities methods and classes for reportersiÿÿÿÿ(   t   print_functionNt   =t   -t   +i   i    c         C  s   |  | k |  | k  S(   N(    (   t   at   b(    (    s8   lib/python2.7/site-packages/pylint/reporters/__init__.pyt   cmp   s    c         C  sA   t  |  | ƒ } d t t |  | ƒ | r3 d | p6 d f } | S(   sS   given a old and new int value, return a string representing the
    difference
    s   %s%ss   %.2ft    (   t   abst   CMPSR   (   t   oldt   newt   difft   diff_str(    (    s8   lib/python2.7/site-packages/pylint/reporters/__init__.pyt   diff_string!   s    -t   BaseReporterc           B  sŒ   e  Z d  Z d Z d d „ Z d „  Z d d „ Z e j	 rH d „  Z
 n	 d „  Z
 d d „ Z d „  Z d	 „  Z d
 „  Z d „  Z d „  Z RS(   sS   base class for reporters

    symbols: show short symbolic names for messages.
    R   c         C  sK   d  |  _ d |  _ d  |  _ d  |  _ |  j | ƒ t j ƒ  t j |  _	 d  S(   Ni    (
   t   Nonet   lintert   sectiont   outt   out_encodingt
   set_outputt   ost   getcwdt   sept   path_strip_prefix(   t   selft   output(    (    s8   lib/python2.7/site-packages/pylint/reporters/__init__.pyt   __init__2   s    				c         C  s   d S(   s3   Handle a new message triggered on the current file.N(    (   R   t   msg(    (    s8   lib/python2.7/site-packages/pylint/reporters/__init__.pyt   handle_message;   s    c         C  s   | p t  j |  _ d S(   s   set output streamN(   t   syst   stdoutR   (   R   R   (    (    s8   lib/python2.7/site-packages/pylint/reporters/__init__.pyR   >   s    c         C  s   | S(   N(    (   R   t   string(    (    s8   lib/python2.7/site-packages/pylint/reporters/__init__.pyt   <lambda>C   s    c         C  sY   t  | t j ƒ s | St |  j d d  ƒ pF t j d t ƒ pF t	 j
 ƒ  } | j | d ƒ S(   Nt   encodingt   do_setlocalet   replace(   t
   isinstancet   sixt	   text_typet   getattrR   R   t   localet   getpreferredencodingt   FalseR   t   getdefaultencodingt   encode(   R   R!   R#   (    (    s8   lib/python2.7/site-packages/pylint/reporters/__init__.pyR.   E   s    c         C  s    t  |  j | ƒ d |  j ƒd S(   s!   write a line in the output buffert   fileN(   t   printR.   R   (   R   R!   (    (    s8   lib/python2.7/site-packages/pylint/reporters/__init__.pyt   writelnQ   s    c         C  sP   d |  _  t | d ƒ r? | j d j d j d | j 7_ n  |  j | ƒ d S(   s/   display results encapsulated in the layout treei    t	   report_ids    (%s)N(   R   t   hasattrt   childrent   dataR2   t   _display(   R   t   layout(    (    s8   lib/python2.7/site-packages/pylint/reporters/__init__.pyt   display_reportsU   s    	'c         C  s   t  ƒ  ‚ d S(   s   display the layoutN(   t   NotImplementedError(   R   R7   (    (    s8   lib/python2.7/site-packages/pylint/reporters/__init__.pyR6   \   s    c         C  s   d S(   s›  Hook for displaying the messages of the reporter

        This will be called whenever the underlying messages
        needs to be displayed. For some reporters, it probably
        doesn't make sense to display messages as soon as they
        are available, so some mechanism of storing them could be used.
        This method can be implemented to display them after they've
        been aggregated.
        N(    (   R   R7   (    (    s8   lib/python2.7/site-packages/pylint/reporters/__init__.pyt   display_messages`   s    c         C  s   d S(   s0   Hook called when a module starts to be analysed.N(    (   R   t   modulet   filepath(    (    s8   lib/python2.7/site-packages/pylint/reporters/__init__.pyt   on_set_current_modulem   s    c         C  s   d S(   s-   Hook called when a module finished analyzing.N(    (   R   t   statst   previous_stats(    (    s8   lib/python2.7/site-packages/pylint/reporters/__init__.pyt   on_closep   s    N(   t   __name__t
   __module__t   __doc__t	   extensionR   R   R   R   R'   t   PY3R.   R1   R8   R6   R:   R=   R@   (    (    (    s8   lib/python2.7/site-packages/pylint/reporters/__init__.pyR   *   s   								t   CollectingReporterc           B  s,   e  Z d  Z d Z d „  Z d „  Z d Z RS(   s   collects messagest	   collectorc         C  s   t  j |  ƒ g  |  _ d  S(   N(   R   R   t   messages(   R   (    (    s8   lib/python2.7/site-packages/pylint/reporters/__init__.pyR   y   s    c         C  s   |  j  j | ƒ d  S(   N(   RH   t   append(   R   R   (    (    s8   lib/python2.7/site-packages/pylint/reporters/__init__.pyR   }   s    N(   RA   RB   RC   t   nameR   R   R   R6   (    (    (    s8   lib/python2.7/site-packages/pylint/reporters/__init__.pyRF   t   s
   		c         C  s(   d d l  m } | j |  t d ƒ d S(   s1   initialize linter with reporters in this package iÿÿÿÿ(   t   utilsi    N(   t   pylintRK   t   register_pluginst   __path__(   R   RK   (    (    s8   lib/python2.7/site-packages/pylint/reporters/__init__.pyt
   initializeƒ   s    (   i   i    (   RC   t
   __future__R    R   R*   R   t   warningsR'   R	   t   version_infoR   R   t   objectR   RF   RO   (    (    (    s8   lib/python2.7/site-packages/pylint/reporters/__init__.pyt   <module>   s   		J