ó
'![c           @   s}   d  Z  d d l Z d d l Z d d l m Z d d l m Z d d l m Z d   Z d e j	 f d     YZ
 d	   Z d S(
   s'   Looks for  comparisons to empty string.i˙˙˙˙N(   t
   interfaces(   t   checkers(   t   utilsc         C   s   t  |  t j  o |  j d k S(   Nt    (   t
   isinstancet   astroidt   Constt   value(   t   node(    (    s<   lib/python2.7/site-packages/pylint/extensions/emptystring.pyt   _is_constant_empty_str   s    t   CompareToEmptyStringCheckerc           B   sQ   e  Z d  Z e j f Z d Z i d d 6Z d Z d Z	 e
 j d  d    Z RS(	   sù   Checks for comparisons to empty string.
    Most of the times you should use the fact that empty strings are false.
    An exception to this rule is when an empty string value is allowed in the program
    and has a different meaning than None!
    s   compare-to-empty-strings!   Avoid comparisons to empty strings@   Used when Pylint detects comparison to an empty string constant.t   C1901iŝ˙˙˙c   	      C   sĝ   d d d d g } d | j  f g } | j | j  t t j |    } x¨ t t |  d  D] } | | } | | d } | | d } t } t	 |  r³ | | k r³ t
 } n! | | k rÔ t	 |  rÔ t
 } n  | r` |  j d d	 | q` q` Wd  S(
   Ns   !=s   ==s   is nott   isR   i   i   s   compare-to-empty-stringR   (   t   leftt   extendt   opst   listt	   itertoolst   chaint   ranget   lent   FalseR	   t   Truet   add_message(	   t   selfR   t
   _operatorsR   t   ops_idxt   op_1t   op_2t   op_3t   error_detected(    (    s<   lib/python2.7/site-packages/pylint/extensions/emptystring.pyt   visit_compare*   s    
		(   s!   Avoid comparisons to empty strings   compare-to-empty-strings@   Used when Pylint detects comparison to an empty string constant.(    (   t   __name__t
   __module__t   __doc__R    t   IAstroidCheckert   __implements__t   namet   msgst   priorityt   optionsR   t   check_messagesR   (    (    (    s<   lib/python2.7/site-packages/pylint/extensions/emptystring.pyR
      s    
c         C   s   |  j  t |    d S(   s.   Required method to auto register this checker.N(   t   register_checkerR
   (   t   linter(    (    s<   lib/python2.7/site-packages/pylint/extensions/emptystring.pyt   registerF   s    (   R"   R   R   t   pylintR    R   t   pylint.checkersR   R	   t   BaseCheckerR
   R,   (    (    (    s<   lib/python2.7/site-packages/pylint/extensions/emptystring.pyt   <module>   s   	/