B
    A!p\+                 @   sr   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m	Z	m
Z
 dddd	d
difdZG dd deZdd ZdS )z+check for new / old style related problems
    N)IAstroidChecker)BaseChecker)check_messagesnode_frame_classhas_known_bases)z&Bad first argument %r given to super()zbad-super-callzbUsed when another argument than the current class is given as first argument of the super builtin.zMissing argument to super()zmissing-super-argumentz7Used when the super builtin didn't receive an argument.Z
maxversion)   r   )ZE1003ZE1004c               @   s<   e Zd ZdZefZdZeZdZ	dZ
edddd ZeZd	S )
NewStyleConflictCheckerzchecks 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-callzmissing-super-argumentc       	   	   C   s  |  sdS |j }x|tjD ]}t|t|kr>q&|j}t|tj	sRq&|j
}t|tjr&t|jtjr&|jjdksq&|jst|rq&q&|jstjd dkrq&n| jd|d q&|jd }t|tjrt|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ozt|jd  d}W n tjk
r   w&Y nX ||k	r&d}|r|j}n&|jrt|jd dr|jd j}|r&| jd||fd
 q&W dS )zcheck use of superNsuperr   r   zmissing-super-argument)nodetypezbad-super-call)r   )r   args      self	__class__)zself.__class__name)Z	is_methodparentframeZnodes_of_classastroidZCallr   func
isinstanceZ	AttributeexprNamer   r	   r   r   sysversion_infoZadd_messagelenZattrnamenextZinferZInferenceErrorhasattr)	r   r   klassZstmtr   ZcallZarg0Zsupclsr   r   r   7lib/python3.7/site-packages/pylint/checkers/newstyle.pyvisit_functiondef9   s^    

 z)NewStyleConflictChecker.visit_functiondefN)__name__
__module____qualname____doc__r   Z__implements__r   MSGSZmsgsZpriorityZoptionsr   r#   Zvisit_asyncfunctiondefr   r   r   r"   r   (   s   Pr   c             C   s   |  t|  dS )z.required method to auto register this checker N)Zregister_checkerr   )Zlinterr   r   r"   register   s    r)   )r'   r   r   Zpylint.interfacesr   Zpylint.checkersr   Zpylint.checkers.utilsr   r   r   r(   r   r)   r   r   r   r"   <module>   s   d