3
tûœ]/  ã               @   s\   d Z ddlZddlmZ ddlmZmZmZ ddlm	Z	 ddiZ
G d
d„ deƒZdd„ ZdS )z+check for new / old style related problems
é    N)ÚBaseChecker)Úcheck_messagesÚhas_known_basesÚnode_frame_class)ÚIAstroidCheckerZE1003ú&Bad first argument %r given to super()úbad-super-callúbUsed when another argument than the current class is given as first argument of the super builtin.c               @   s:   e Zd ZdZefZdZeZdZ	f Z
edƒdd„ ƒZeZdS )	ÚNewStyleConflictCheckerz°checks for usage of new style capabilities on old style classes and
    other new/old styles conflicts problems
    * use of property, __slots__, super
    * "super" usage
    Únewstyleé   zbad-super-callc       	      C   sÖ  |j ƒ sdS |jjƒ }�x¸|jtjƒD �]¦}t|ƒt|ƒkr>q&|j}t|tj	ƒsRq&|j
}t|tjƒo|t|jtjƒo||jjdks€q&|js�t|ƒ r&|js˜q&|jd }t|tjƒrÚt|jtjƒrÚ|jjdkrÚ| jd|dd� q&t|jƒdk�r<t|jd tjƒ�r<|jd jd	k�r<t|tj	ƒ�r<|jd
k�r<| jd|dd� q&y |j�oXt|jd jƒ dƒ}W n tjk
�rv   w&Y nX ||k	r&d}|�r’|j}n&|j�r¸t|jd dƒ�r¸|jd j}|r&| jd||fd� q&W dS )zcheck use of superNÚsuperr   Útypezbad-super-call)ÚnodeÚargsr   é   ÚselfÚ	__class__úself.__class__Úname)r   )r   )Z	is_methodÚparentÚframeZnodes_of_classÚastroidÚCallr   ÚfuncÚ
isinstanceÚ	AttributeÚexprÚNamer   r   r   r   Zadd_messageÚlenÚattrnameÚnextZinferZInferenceErrorÚhasattr)	r   r   ÚklassÚstmtr   ÚcallZarg0Zsupclsr   © r&   ú:/tmp/pip-build-fn42xldr/pylint/pylint/checkers/newstyle.pyÚvisit_functiondef1   sV    

 z)NewStyleConflictChecker.visit_functiondefNéþÿÿÿ)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Z__implements__r   ÚMSGSZmsgsÚpriorityÚoptionsr   r(   Zvisit_asyncfunctiondefr&   r&   r&   r'   r
       s   Ir
   c             C   s   | j t| ƒƒ dS )z.required method to auto register this checker N)Zregister_checkerr
   )Zlinterr&   r&   r'   Úregister}   s    r1   )r   r   r	   )r-   r   Zpylint.checkersr   Zpylint.checkers.utilsr   r   r   Zpylint.interfacesr   r.   r
   r1   r&   r&   r&   r'   Ú<module>   s     ]