
    e                        U d Z ddlmZ ddlm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lmZ erdd	lmZ d
diZded<    G d de      ZddZy)z+Check for new / old style related problems.    )annotations)TYPE_CHECKINGN)nodes)BaseChecker)has_known_basesnode_frame_classonly_required_for_messages)MessageDefinitionTuple)PyLinterE1003)z&Bad first argument %r given to super()bad-super-callzbUsed when another argument than the current class is given as first argument of the super builtin.z!dict[str, MessageDefinitionTuple]MSGSc                  >    e Zd ZdZdZeZdZ ed      dd       Z	e	Z
y)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 r   c                (   |j                         sy|j                  j                         }|j                  t        j
                        D ]  }t        |      t        |      k7  r|j                  }t        |t        j                        sC|j                  }t        |t        j
                        r=t        |j                  t        j                        r|j                  j                  dk(  s|j                  st        |      r|j                  s|j                  d   }t        |t        j
                        rSt        |j                  t        j                        r/|j                  j                  dk(  r| j!                  d|d       Ht#        |j                        dk\  rt        |j                  d	   t        j                        r[|j                  d	   j                  d
k(  r?t        |t        j                        r%|j$                  dk(  r| j!                  d|d       	 |j                  xr' t'        |j                  d   j)                         d      |ust/        fd|j1                         D              sBd}rj                  }n>|j                  r2t3        |j                  d   d      r|j                  d   j                  }|s| j!                  d||f        y# t*        j,                  $ r Y w xY w)zCheck use of super.Nsuperr   typer   )r   )nodeargs      self	__class__)zself.__class__c              3  (   K   | ]	  }|k7    y wNr   ).0isupclss     :/usr/lib/python3/dist-packages/pylint/checkers/newstyle.py	<genexpr>z<NewStyleConflictChecker.visit_functiondef.<locals>.<genexpr>q   s     .VqqF{.Vs   name)	is_methodparentframenodes_of_classr   Callr   func
isinstance	AttributeexprNamer#   r   r   r   add_messagelenattrnamenextinferastroidInferenceErrorall	ancestorshasattr)	r   r   klassstmtr,   callarg0r#   r    s	           @r!   visit_functiondefz)NewStyleConflictChecker.visit_functiondef2   s\    ~~!!#''

3 B	TD%)9$)??99DdEOO499D 4,tyy%**5IINNg- ~~_U%;yy yy|tUZZ0"499ejj9		&0$$%5Dy$Q
 		Na'"499Q<<		!))V3"494$$(t:M %  !YYK4		!0B0B0Dd+KF &3.VEOODU.V+VD %{{wtyy|V'D#yy|00(()9D7(SEB	Tf -- s   /5K::LLN)r   znodes.FunctionDefreturnNone)__name__
__module____qualname____doc__r#   r   msgsoptionsr	   r<   visit_asyncfunctiondefr       r!   r   r   #   s=     DDG 01HT 2HTT /rF   r   c                8    | j                  t        |              y r   )register_checkerr   )linters    r!   registerrJ      s    
3F;<rF   )rI   r   r=   r>   )rB   
__future__r   typingr   r3   r   pylint.checkersr   pylint.checkers.utilsr   r   r	   pylint.typingr
   pylint.lintr   r   __annotations__r   rJ   r   rF   r!   <module>rR      s[   
 2 "     ' 
 1$  +' Z/k Z/z=rF   